text: !function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=86)}([function(t,e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t){return"["+t.join(", ")+"]"}function i(t,e){return t.equals(e)}function o(t){return t.hashCode()}function a(t,e){return this.data={},this.hashFunction=t||o,this.equalsFunction=e||i,this}function s(){return this.data=[],this}function u(t,e){return this.data={},this.hashFunction=t||o,this.equalsFunction=e||i,this}function c(){return this.data={},this}function l(t){return this.defaultMapCtor=t||u,this.cacheMap=new this.defaultMapCtor,this}function p(){return this.count=0,this.hash=0,this}String.prototype.seed=String.prototype.seed||Math.round(Math.random()*Math.pow(2,32)),String.prototype.hashCode=function(){var t,e,n,r,i,o,a,s,u=this.toString();for(t=3&u.length,e=u.length-t,n=String.prototype.seed,i=3432918353,o=461845907,s=0;s<e;)a=255&u.charCodeAt(s)|(255&u.charCodeAt(++s))<<8|(255&u.charCodeAt(++s))<<16|(255&u.charCodeAt(++s))<<24,++s,n=27492+(65535&(r=5*(65535&(n=(n^=a=(65535&(a=(a=(65535&a)*i+(((a>>>16)*i&65535)<<16)&4294967295)<<15|a>>>17))*o+(((a>>>16)*o&65535)<<16)&4294967295)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)&4294967295))+((58964+(r>>>16)&65535)<<16);switch(a=0,t){case 3:a^=(255&u.charCodeAt(s+2))<<16;case 2:a^=(255&u.charCodeAt(s+1))<<8;case 1:n^=a=(65535&(a=(a=(65535&(a^=255&u.charCodeAt(s)))*i+(((a>>>16)*i&65535)<<16)&4294967295)<<15|a>>>17))*o+(((a>>>16)*o&65535)<<16)&4294967295}return n^=u.length,n=2246822507*(65535&(n^=n>>>16))+((2246822507*(n>>>16)&65535)<<16)&4294967295,n=3266489909*(65535&(n^=n>>>13))+((3266489909*(n>>>16)&65535)<<16)&4294967295,(n^=n>>>16)>>>0},Object.defineProperty(a.prototype,"length",{get:function(){var t=0;for(var e in this.data)0===e.indexOf("hash_")&&(t+=this.data[e].length);return t}}),a.prototype.add=function(t){var e="hash_"+this.hashFunction(t);if(e in this.data){for(var n=this.data[e],r=0;r<n.length;r++)if(this.equalsFunction(t,n[r]))return n[r];return n.push(t),t}return this.data[e]=[t],t},a.prototype.contains=function(t){return null!=this.get(t)},a.prototype.get=function(t){var e="hash_"+this.hashFunction(t);if(e in this.data)for(var n=this.data[e],r=0;r<n.length;r++)if(this.equalsFunction(t,n[r]))return n[r];return null},a.prototype.values=function(){var t=[];for(var e in this.data)0===e.indexOf("hash_")&&(t=t.concat(this.data[e]));return t},a.prototype.toString=function(){return r(this.values())},s.prototype.add=function(t){this.data[t]=!0},s.prototype.or=function(t){var e=this;Object.keys(t.data).map((function(t){e.add(t)}))},s.prototype.remove=function(t){delete this.data[t]},s.prototype.contains=function(t){return!0===this.data[t]},s.prototype.values=function(){return Object.keys(this.data)},s.prototype.minValue=function(){return Math.min.apply(null,this.values())},s.prototype.hashCode=function(){var t=new p;return t.update(this.values()),t.finish()},s.prototype.equals=function(t){return t instanceof s&&this.hashCode()===t.hashCode()},Object.defineProperty(s.prototype,"length",{get:function(){return this.values().length}}),s.prototype.toString=function(){return"{"+this.values().join(", ")+"}"},Object.defineProperty(u.prototype,"length",{get:function(){var t=0;for(var e in this.data)0===e.indexOf("hash_")&&(t+=this.data[e].length);return t}}),u.prototype.put=function(t,e){var n="hash_"+this.hashFunction(t);if(n in this.data){for(var r=this.data[n],i=0;i<r.length;i++){var o=r[i];if(this.equalsFunction(t,o.key)){var a=o.value;return o.value=e,a}}return r.push({key:t,value:e}),e}return this.data[n]=[{key:t,value:e}],e},u.prototype.containsKey=function(t){var e="hash_"+this.hashFunction(t);if(e in this.data)for(var n=this.data[e],r=0;r<n.length;r++){var i=n[r];if(this.equalsFunction(t,i.key))return!0}return!1},u.prototype.get=function(t){var e="hash_"+this.hashFunction(t);if(e in this.data)for(var n=this.data[e],r=0;r<n.length;r++){var i=n[r];if(this.equalsFunction(t,i.key))return i.value}return null},u.prototype.entries=function(){var t=[];for(var e in this.data)0===e.indexOf("hash_")&&(t=t.concat(this.data[e]));return t},u.prototype.getKeys=function(){return this.entries().map((function(t){return t.key}))},u.prototype.getValues=function(){return this.entries().map((function(t){return t.value}))},u.prototype.toString=function(){return"["+this.entries().map((function(t){return"{"+t.key+":"+t.value+"}"})).join(", ")+"]"},c.prototype.get=function(t){return(t="k-"+t)in this.data?this.data[t]:null},c.prototype.put=function(t,e){t="k-"+t,this.data[t]=e},c.prototype.values=function(){var t=this.data;return Object.keys(this.data).map((function(e){return t[e]}))},p.prototype.update=function(){for(var t=0;t<arguments.length;t++){var e=arguments[t];if(null!=e)if(Array.isArray(e))this.update.apply(this,e);else{var r=0;switch(n(e)){case"undefined":case"function":continue;case"number":case"boolean":r=e;break;case"string":r=e.hashCode();break;default:e.updateHashCode?e.updateHashCode(this):console.log("No updateHashCode for "+e.toString());continue}r=(r*=3432918353)<<15|r>>>17,r*=461845907,this.count=this.count+1;var i=this.hash^r;i=5*(i=i<<13|i>>>19)+3864292196,this.hash=i}}},p.prototype.finish=function(){var t=this.hash^4*this.count;return t^=t>>>16,t*=2246822507,t^=t>>>13,t*=3266489909,t^=t>>>16},l.prototype.get=function(t,e){var n=this.cacheMap.get(t)||null;return null===n?null:n.get(e)||null},l.prototype.set=function(t,e,n){var r=this.cacheMap.get(t)||null;null===r&&(r=new this.defaultMapCtor,this.cacheMap.put(t,r)),r.put(e,n)},e.Hash=p,e.Set=a,e.Map=u,e.BitSet=s,e.AltDict=c,e.DoubleDict=l,e.hashStuff=function(){var t=new p;return t.update.apply(t,arguments),t.finish()},e.escapeWhitespace=function(t,e){return t=t.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r"),e&&(t=t.replace(/ /g,"·")),t},e.arrayToString=r,e.titleCase=function(t){return t.replace(/\w\S*/g,(function(t){return t.charAt(0).toUpperCase()+t.substr(1)}))},e.equalArrays=function(t,e){if(!Array.isArray(t)||!Array.isArray(e))return!1;if(t==e)return!0;if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(t[n]!=e[n]&&!t[n].equals(e[n]))return!1;return!0}},function(t,e){function n(){return this.source=null,this.type=null,this.channel=null,this.start=null,this.stop=null,this.tokenIndex=null,this.line=null,this.column=null,this._text=null,this}function r(t,e,i,o,a){return n.call(this),this.source=void 0!==t?t:r.EMPTY_SOURCE,this.type=void 0!==e?e:null,this.channel=void 0!==i?i:n.DEFAULT_CHANNEL,this.start=void 0!==o?o:-1,this.stop=void 0!==a?a:-1,this.tokenIndex=-1,null!==this.source[0]?(this.line=t[0].line,this.column=t[0].column):this.column=-1,this}n.INVALID_TYPE=0,n.EPSILON=-2,n.MIN_USER_TOKEN_TYPE=1,n.EOF=-1,n.DEFAULT_CHANNEL=0,n.HIDDEN_CHANNEL=1,Object.defineProperty(n.prototype,"text",{get:function(){return this._text},set:function(t){this._text=t}}),n.prototype.getTokenSource=function(){return this.source[0]},n.prototype.getInputStream=function(){return this.source[1]},r.prototype=Object.create(n.prototype),r.prototype.constructor=r,r.EMPTY_SOURCE=[null,null],r.prototype.clone=function(){var t=new r(this.source,this.type,this.channel,this.start,this.stop);return t.tokenIndex=this.tokenIndex,t.line=this.line,t.column=this.column,t.text=this.text,t},Object.defineProperty(r.prototype,"text",{get:function(){if(null!==this._text)return this._text;var t=this.getInputStream();if(null===t)return null;var e=t.size;return this.start<e&&this.stop<e?t.getText(this.start,this.stop):"<EOF>"},set:function(t){this._text=t}}),r.prototype.toString=function(){var t=this.text;return t=null!==t?t.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t"):"<no text>","[@"+this.tokenIndex+","+this.start+":"+this.stop+"='"+t+"',<"+this.type+">"+(this.channel>0?",channel="+this.channel:"")+","+this.line+":"+this.column+"]"},e.Token=n,e.CommonToken=r},function(t,e,n){var r=n(1).Token;function i(t,e){return this.start=t,this.stop=e,this}function o(){this.intervals=null,this.readOnly=!1}i.prototype.contains=function(t){return t>=this.start&&t<this.stop},i.prototype.toString=function(){return this.start===this.stop-1?this.start.toString():this.start.toString()+".."+(this.stop-1).toString()},Object.defineProperty(i.prototype,"length",{get:function(){return this.stop-this.start}}),o.prototype.first=function(t){return null===this.intervals||0===this.intervals.length?r.INVALID_TYPE:this.intervals[0].start},o.prototype.addOne=function(t){this.addInterval(new i(t,t+1))},o.prototype.addRange=function(t,e){this.addInterval(new i(t,e+1))},o.prototype.addInterval=function(t){if(null===this.intervals)this.intervals=[],this.intervals.push(t);else{for(var e=0;e<this.intervals.length;e++){var n=this.intervals[e];if(t.stop<n.start)return void this.intervals.splice(e,0,t);if(t.stop===n.start)return void(this.intervals[e].start=t.start);if(t.start<=n.stop)return this.intervals[e]=new i(Math.min(n.start,t.start),Math.max(n.stop,t.stop)),void this.reduce(e)}this.intervals.push(t)}},o.prototype.addSet=function(t){if(null!==t.intervals)for(var e=0;e<t.intervals.length;e++){var n=t.intervals[e];this.addInterval(new i(n.start,n.stop))}return this},o.prototype.reduce=function(t){if(t<this.intervalslength-1){var e=this.intervals[t],n=this.intervals[t+1];e.stop>=n.stop?(this.intervals.pop(t+1),this.reduce(t)):e.stop>=n.start&&(this.intervals[t]=new i(e.start,n.stop),this.intervals.pop(t+1))}},o.prototype.complement=function(t,e){var n=new o;n.addInterval(new i(t,e+1));for(var r=0;r<this.intervals.length;r++)n.removeRange(this.intervals[r]);return n},o.prototype.contains=function(t){if(null===this.intervals)return!1;for(var e=0;e<this.intervals.length;e++)if(this.intervals[e].contains(t))return!0;return!1},Object.defineProperty(o.prototype,"length",{get:function(){var t=0;return this.intervals.map((function(e){t+=e.length})),t}}),o.prototype.removeRange=function(t){if(t.start===t.stop-1)this.removeOne(t.start);else if(null!==this.intervals)for(var e=0,n=0;n<this.intervals.length;n++){var r=this.intervals[e];if(t.stop<=r.start)return;if(t.start>r.start&&t.stop<r.stop){this.intervals[e]=new i(r.start,t.start);var o=new i(t.stop,r.stop);return void this.intervals.splice(e,0,o)}t.start<=r.start&&t.stop>=r.stop?(this.intervals.splice(e,1),e-=1):t.start<r.stop?this.intervals[e]=new i(r.start,t.start):t.stop<r.stop&&(this.intervals[e]=new i(t.stop,r.stop)),e+=1}},o.prototype.removeOne=function(t){if(null!==this.intervals)for(var e=0;e<this.intervals.length;e++){var n=this.intervals[e];if(t<n.start)return;if(t===n.start&&t===n.stop-1)return void this.intervals.splice(e,1);if(t===n.start)return void(this.intervals[e]=new i(n.start+1,n.stop));if(t===n.stop-1)return void(this.intervals[e]=new i(n.start,n.stop-1));if(t<n.stop-1){var r=new i(n.start,t);return n.start=t+1,void this.intervals.splice(e,0,r)}}},o.prototype.toString=function(t,e,n){return t=t||null,e=e||null,n=n||!1,null===this.intervals?"{}":null!==t||null!==e?this.toTokenString(t,e):n?this.toCharString():this.toIndexString()},o.prototype.toCharString=function(){for(var t=[],e=0;e<this.intervals.length;e++){var n=this.intervals[e];n.stop===n.start+1?n.start===r.EOF?t.push("<EOF>"):t.push("'"+String.fromCharCode(n.start)+"'"):t.push("'"+String.fromCharCode(n.start)+"'..'"+String.fromCharCode(n.stop-1)+"'")}return t.length>1?"{"+t.join(", ")+"}":t[0]},o.prototype.toIndexString=function(){for(var t=[],e=0;e<this.intervals.length;e++){var n=this.intervals[e];n.stop===n.start+1?n.start===r.EOF?t.push("<EOF>"):t.push(n.start.toString()):t.push(n.start.toString()+".."+(n.stop-1).toString())}return t.length>1?"{"+t.join(", ")+"}":t[0]},o.prototype.toTokenString=function(t,e){for(var n=[],r=0;r<this.intervals.length;r++)for(var i=this.intervals[r],o=i.start;o<i.stop;o++)n.push(this.elementName(t,e,o));return n.length>1?"{"+n.join(", ")+"}":n[0]},o.prototype.elementName=function(t,e,n){return n===r.EOF?"<EOF>":n===r.EPSILON?"<EPSILON>":t[n]||e[n]},e.Interval=i,e.IntervalSet=o},function(t,e){function n(){return this.atn=null,this.stateNumber=n.INVALID_STATE_NUMBER,this.stateType=null,this.ruleIndex=0,this.epsilonOnlyTransitions=!1,this.transitions=[],this.nextTokenWithinRule=null,this}function r(){return n.call(this),this.stateType=n.BASIC,this}function i(){return n.call(this),this.decision=-1,this.nonGreedy=!1,this}function o(){return i.call(this),this.endState=null,this}function a(){return o.call(this),this.stateType=n.BLOCK_START,this}function s(){return n.call(this),this.stateType=n.BLOCK_END,this.startState=null,this}function u(){return n.call(this),this.stateType=n.RULE_STOP,this}function c(){return n.call(this),this.stateType=n.RULE_START,this.stopState=null,this.isPrecedenceRule=!1,this}function l(){return i.call(this),this.stateType=n.PLUS_LOOP_BACK,this}function p(){return o.call(this),this.stateType=n.PLUS_BLOCK_START,this.loopBackState=null,this}function h(){return o.call(this),this.stateType=n.STAR_BLOCK_START,this}function f(){return n.call(this),this.stateType=n.STAR_LOOP_BACK,this}function d(){return i.call(this),this.stateType=n.STAR_LOOP_ENTRY,this.loopBackState=null,this.isPrecedenceDecision=null,this}function y(){return n.call(this),this.stateType=n.LOOP_END,this.loopBackState=null,this}function g(){return i.call(this),this.stateType=n.TOKEN_START,this}n.INVALID_TYPE=0,n.BASIC=1,n.RULE_START=2,n.BLOCK_START=3,n.PLUS_BLOCK_START=4,n.STAR_BLOCK_START=5,n.TOKEN_START=6,n.RULE_STOP=7,n.BLOCK_END=8,n.STAR_LOOP_BACK=9,n.STAR_LOOP_ENTRY=10,n.PLUS_LOOP_BACK=11,n.LOOP_END=12,n.serializationNames=["INVALID","BASIC","RULE_START","BLOCK_START","PLUS_BLOCK_START","STAR_BLOCK_START","TOKEN_START","RULE_STOP","BLOCK_END","STAR_LOOP_BACK","STAR_LOOP_ENTRY","PLUS_LOOP_BACK","LOOP_END"],n.INVALID_STATE_NUMBER=-1,n.prototype.toString=function(){return this.stateNumber},n.prototype.equals=function(t){return t instanceof n&&this.stateNumber===t.stateNumber},n.prototype.isNonGreedyExitState=function(){return!1},n.prototype.addTransition=function(t,e){void 0===e&&(e=-1),0===this.transitions.length?this.epsilonOnlyTransitions=t.isEpsilon:this.epsilonOnlyTransitions!==t.isEpsilon&&(this.epsilonOnlyTransitions=!1),-1===e?this.transitions.push(t):this.transitions.splice(e,1,t)},r.prototype=Object.create(n.prototype),r.prototype.constructor=r,i.prototype=Object.create(n.prototype),i.prototype.constructor=i,o.prototype=Object.create(i.prototype),o.prototype.constructor=o,a.prototype=Object.create(o.prototype),a.prototype.constructor=a,s.prototype=Object.create(n.prototype),s.prototype.constructor=s,u.prototype=Object.create(n.prototype),u.prototype.constructor=u,c.prototype=Object.create(n.prototype),c.prototype.constructor=c,l.prototype=Object.create(i.prototype),l.prototype.constructor=l,p.prototype=Object.create(o.prototype),p.prototype.constructor=p,h.prototype=Object.create(o.prototype),h.prototype.constructor=h,f.prototype=Object.create(n.prototype),f.prototype.constructor=f,d.prototype=Object.create(i.prototype),d.prototype.constructor=d,y.prototype=Object.create(n.prototype),y.prototype.constructor=y,g.prototype=Object.create(i.prototype),g.prototype.constructor=g,e.ATNState=n,e.BasicState=r,e.DecisionState=i,e.BlockStartState=o,e.BlockEndState=s,e.LoopEndState=y,e.RuleStartState=c,e.RuleStopState=u,e.TokensStartState=g,e.PlusLoopbackState=l,e.StarLoopbackState=f,e.StarLoopEntryState=d,e.PlusBlockStartState=p,e.StarBlockStartState=h,e.BasicBlockStartState=a},function(t,e,n){var r=n(1).Token,i=n(2).Interval,o=new i(-1,-2);n(0);function a(){return this}function s(){return a.call(this),this}function u(){return s.call(this),this}function c(){return u.call(this),this}function l(){return u.call(this),this}function p(){return l.call(this),this}function h(){return this}function f(){return this}function d(t){return l.call(this),this.parentCtx=null,this.symbol=t,this}function y(t){return d.call(this,t),this}function g(){return this}s.prototype=Object.create(a.prototype),s.prototype.constructor=s,u.prototype=Object.create(s.prototype),u.prototype.constructor=u,c.prototype=Object.create(u.prototype),c.prototype.constructor=c,l.prototype=Object.create(u.prototype),l.prototype.constructor=l,p.prototype=Object.create(l.prototype),p.prototype.constructor=p,h.prototype.visit=function(t){return Array.isArray(t)?t.map((function(t){return t.accept(this)}),this):t.accept(this)},h.prototype.visitChildren=function(t){return t.children?this.visit(t.children):null},h.prototype.visitTerminal=function(t){},h.prototype.visitErrorNode=function(t){},f.prototype.visitTerminal=function(t){},f.prototype.visitErrorNode=function(t){},f.prototype.enterEveryRule=function(t){},f.prototype.exitEveryRule=function(t){},d.prototype=Object.create(l.prototype),d.prototype.constructor=d,d.prototype.getChild=function(t){return null},d.prototype.getSymbol=function(){return this.symbol},d.prototype.getParent=function(){return this.parentCtx},d.prototype.getPayload=function(){return this.symbol},d.prototype.getSourceInterval=function(){if(null===this.symbol)return o;var t=this.symbol.tokenIndex;return new i(t,t)},d.prototype.getChildCount=function(){return 0},d.prototype.accept=function(t){return t.visitTerminal(this)},d.prototype.getText=function(){return this.symbol.text},d.prototype.toString=function(){return this.symbol.type===r.EOF?"<EOF>":this.symbol.text},y.prototype=Object.create(d.prototype),y.prototype.constructor=y,y.prototype.isErrorNode=function(){return!0},y.prototype.accept=function(t){return t.visitErrorNode(this)},g.prototype.walk=function(t,e){if(e instanceof p||void 0!==e.isErrorNode&&e.isErrorNode())t.visitErrorNode(e);else if(e instanceof l)t.visitTerminal(e);else{this.enterRule(t,e);for(var n=0;n<e.getChildCount();n++){var r=e.getChild(n);this.walk(t,r)}this.exitRule(t,e)}},g.prototype.enterRule=function(t,e){var n=e.getRuleContext();t.enterEveryRule(n),n.enterRule(t)},g.prototype.exitRule=function(t,e){var n=e.getRuleContext();n.exitRule(t),t.exitEveryRule(n)},g.DEFAULT=new g,e.RuleNode=c,e.ErrorNode=p,e.TerminalNode=l,e.ErrorNodeImpl=y,e.TerminalNodeImpl=d,e.ParseTreeListener=f,e.ParseTreeVisitor=h,e.ParseTreeWalker=g,e.INVALID_INTERVAL=o},function(t,e,n){var r=n(10).PredicateTransition;function i(t){if(Error.call(this),Error.captureStackTrace)Error.captureStackTrace(this,i);else(new Error).stack;return this.message=t.message,this.recognizer=t.recognizer,this.input=t.input,this.ctx=t.ctx,this.offendingToken=null,this.offendingState=-1,null!==this.recognizer&&(this.offendingState=this.recognizer.state),this}function o(t,e,n,r){return i.call(this,{message:"",recognizer:t,input:e,ctx:null}),this.startIndex=n,this.deadEndConfigs=r,this}function a(t,e,n,r,o,a){a=a||t._ctx,r=r||t.getCurrentToken(),n=n||t.getCurrentToken(),e=e||t.getInputStream(),i.call(this,{message:"",recognizer:t,input:e,ctx:a}),this.deadEndConfigs=o,this.startToken=n,this.offendingToken=r}function s(t){i.call(this,{message:"",recognizer:t,input:t.getInputStream(),ctx:t._ctx}),this.offendingToken=t.getCurrentToken()}function u(t,e,n){i.call(this,{message:this.formatMessage(e,n||null),recognizer:t,input:t.getInputStream(),ctx:t._ctx});var o=t._interp.atn.states[t.state].transitions[0];return o instanceof r?(this.ruleIndex=o.ruleIndex,this.predicateIndex=o.predIndex):(this.ruleIndex=0,this.predicateIndex=0),this.predicate=e,this.offendingToken=t.getCurrentToken(),this}function c(){return Error.call(this),Error.captureStackTrace(this,c),this}i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,i.prototype.getExpectedTokens=function(){return null!==this.recognizer?this.recognizer.atn.getExpectedTokens(this.offendingState,this.ctx):null},i.prototype.toString=function(){return this.message},o.prototype=Object.create(i.prototype),o.prototype.constructor=o,o.prototype.toString=function(){var t="";return this.startIndex>=0&&this.startIndex<this.input.size&&(t=this.input.getText((this.startIndex,this.startIndex))),"LexerNoViableAltException"+t},a.prototype=Object.create(i.prototype),a.prototype.constructor=a,s.prototype=Object.create(i.prototype),s.prototype.constructor=s,u.prototype=Object.create(i.prototype),u.prototype.constructor=u,u.prototype.formatMessage=function(t,e){return null!==e?e:"failed predicate: {"+t+"}?"},c.prototype=Object.create(Error.prototype),c.prototype.constructor=c,e.RecognitionException=i,e.NoViableAltException=a,e.LexerNoViableAltException=o,e.InputMismatchException=s,e.FailedPredicateException=u,e.ParseCancellationException=c},function(t,e,n){var r=n(16).RuleContext,i=n(0).Hash,o=n(0).Map;function a(t){this.cachedHashCode=t}function s(){return this.cache=new o,this}function u(t,e){var n,r=new i;null!==t?r.update(t,e):r.update(1),n=r.finish(),a.call(this,n),this.parentCtx=t,this.returnState=e}function c(){return u.call(this,null,a.EMPTY_RETURN_STATE),this}function l(t,e){var n=new i;n.update(t,e);var r=n.finish();return a.call(this,r),this.parents=t,this.returnStates=e,this}function p(t,e,n,r){if(t===e)return t;if(t instanceof u&&e instanceof u)return function(t,e,n,r){if(null!==r){var i=r.get(t,e);if(null!==i)return i;if(null!==(i=r.get(e,t)))return i}var o=function(t,e,n){if(n){if(t===a.EMPTY)return a.EMPTY;if(e===a.EMPTY)return a.EMPTY}else{if(t===a.EMPTY&&e===a.EMPTY)return a.EMPTY;if(t===a.EMPTY){var r=[e.returnState,a.EMPTY_RETURN_STATE];return new l([e.parentCtx,null],r)}if(e===a.EMPTY){r=[t.returnState,a.EMPTY_RETURN_STATE];return new l([t.parentCtx,null],r)}}return null}(t,e,n);if(null!==o)return null!==r&&r.set(t,e,o),o;if(t.returnState===e.returnState){var s=p(t.parentCtx,e.parentCtx,n,r);if(s===t.parentCtx)return t;if(s===e.parentCtx)return e;var c=u.create(s,t.returnState);return null!==r&&r.set(t,e,c),c}var h=null;if((t===e||null!==t.parentCtx&&t.parentCtx===e.parentCtx)&&(h=t.parentCtx),null!==h){var f=[t.returnState,e.returnState];t.returnState>e.returnState&&(f[0]=e.returnState,f[1]=t.returnState);var d=new l(y=[h,h],f);return null!==r&&r.set(t,e,d),d}f=[t.returnState,e.returnState];var y=[t.parentCtx,e.parentCtx];t.returnState>e.returnState&&(f[0]=e.returnState,f[1]=t.returnState,y=[e.parentCtx,t.parentCtx]);var g=new l(y,f);return null!==r&&r.set(t,e,g),g}(t,e,n,r);if(n){if(t instanceof c)return t;if(e instanceof c)return e}return t instanceof u&&(t=new l([t.getParent()],[t.returnState])),e instanceof u&&(e=new l([e.getParent()],[e.returnState])),function(t,e,n,r){if(null!==r){var i=r.get(t,e);if(null!==i)return i;if(null!==(i=r.get(e,t)))return i}var s=0,c=0,h=0,f=[],d=[];for(;s<t.returnStates.length&&c<e.returnStates.length;){var y=t.parents[s],g=e.parents[c];if(t.returnStates[s]===e.returnStates[c]){var m=t.returnStates[s],v=m===a.EMPTY_RETURN_STATE&&null===y&&null===g,x=null!==y&&null!==g&&y===g;if(v||x)d[h]=y,f[h]=m;else{var T=p(y,g,n,r);d[h]=T,f[h]=m}s+=1,c+=1}else t.returnStates[s]<e.returnStates[c]?(d[h]=y,f[h]=t.returnStates[s],s+=1):(d[h]=g,f[h]=e.returnStates[c],c+=1);h+=1}if(s<t.returnStates.length)for(var _=s;_<t.returnStates.length;_++)d[h]=t.parents[_],f[h]=t.returnStates[_],h+=1;else for(_=c;_<e.returnStates.length;_++)d[h]=e.parents[_],f[h]=e.returnStates[_],h+=1;if(h<d.length){if(1===h){var E=u.create(d[0],f[0]);return null!==r&&r.set(t,e,E),E}d=d.slice(0,h),f=f.slice(0,h)}var S=new l(d,f);if(S===t)return null!==r&&r.set(t,e,t),t;if(S===e)return null!==r&&r.set(t,e,e),e;(function(t){for(var e=new o,n=0;n<t.length;n++){var r=t[n];e.containsKey(r)||e.put(r,r)}for(var i=0;i<t.length;i++)t[i]=e.get(t[i])})(d),null!==r&&r.set(t,e,S);return S}(t,e,n,r)}a.EMPTY=null,a.EMPTY_RETURN_STATE=2147483647,a.globalNodeCount=1,a.id=a.globalNodeCount,a.prototype.isEmpty=function(){return this===a.EMPTY},a.prototype.hasEmptyPath=function(){return this.getReturnState(this.length-1)===a.EMPTY_RETURN_STATE},a.prototype.hashCode=function(){return this.cachedHashCode},a.prototype.updateHashCode=function(t){t.update(this.cachedHashCode)},s.prototype.add=function(t){if(t===a.EMPTY)return a.EMPTY;var e=this.cache.get(t)||null;return null!==e?e:(this.cache.put(t,t),t)},s.prototype.get=function(t){return this.cache.get(t)||null},Object.defineProperty(s.prototype,"length",{get:function(){return this.cache.length}}),u.prototype=Object.create(a.prototype),u.prototype.contructor=u,u.create=function(t,e){return e===a.EMPTY_RETURN_STATE&&null===t?a.EMPTY:new u(t,e)},Object.defineProperty(u.prototype,"length",{get:function(){return 1}}),u.prototype.getParent=function(t){return this.parentCtx},u.prototype.getReturnState=function(t){return this.returnState},u.prototype.equals=function(t){return this===t||t instanceof u&&(this.hashCode()===t.hashCode()&&(this.returnState===t.returnState&&(null==this.parentCtx?null==t.parentCtx:this.parentCtx.equals(t.parentCtx))))},u.prototype.toString=function(){var t=null===this.parentCtx?"":this.parentCtx.toString();return 0===t.length?this.returnState===a.EMPTY_RETURN_STATE?"$":""+this.returnState:this.returnState+" "+t},c.prototype=Object.create(u.prototype),c.prototype.constructor=c,c.prototype.isEmpty=function(){return!0},c.prototype.getParent=function(t){return null},c.prototype.getReturnState=function(t){return this.returnState},c.prototype.equals=function(t){return this===t},c.prototype.toString=function(){return"$"},a.EMPTY=new c,l.prototype=Object.create(a.prototype),l.prototype.constructor=l,l.prototype.isEmpty=function(){return this.returnStates[0]===a.EMPTY_RETURN_STATE},Object.defineProperty(l.prototype,"length",{get:function(){return this.returnStates.length}}),l.prototype.getParent=function(t){return this.parents[t]},l.prototype.getReturnState=function(t){return this.returnStates[t]},l.prototype.equals=function(t){return this===t||t instanceof l&&(this.hashCode()===t.hashCode()&&(this.returnStates===t.returnStates&&this.parents===t.parents))},l.prototype.toString=function(){if(this.isEmpty())return"[]";for(var t="[",e=0;e<this.returnStates.length;e++)e>0&&(t+=", "),this.returnStates[e]!==a.EMPTY_RETURN_STATE?(t+=this.returnStates[e],null!==this.parents[e]?t=t+" "+this.parents[e]:t+="null"):t+="$";return t+"]"},e.merge=p,e.PredictionContext=a,e.PredictionContextCache=s,e.SingletonPredictionContext=u,e.predictionContextFromRuleContext=function t(e,n){if(null==n&&(n=r.EMPTY),null===n.parentCtx||n===r.EMPTY)return a.EMPTY;var i=t(e,n.parentCtx),o=e.states[n.invokingState].transitions[0];return u.create(i,o.followState.stateNumber)},e.getCachedPredictionContext=function t(e,n,r){if(e.isEmpty())return e;var i=r.get(e)||null;if(null!==i)return i;if(null!==(i=n.get(e)))return r.put(e,i),i;for(var o=!1,s=[],c=0;c<s.length;c++){var p=t(e.getParent(c),n,r);if(o||p!==e.getParent(c)){if(!o){s=[];for(var h=0;h<e.length;h++)s[h]=e.getParent(h);o=!0}s[c]=p}}if(!o)return n.add(e),r.put(e,e),e;var f=null;return f=0===s.length?a.EMPTY:1===s.length?u.create(s[0],e.getReturnState(0)):new l(s,e.returnStates),n.add(f),r.put(f,f),r.put(e,f),f}},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i={},o=n(8).ResourceNode;i.raiseError=function(t,e){throw(e=e?e+": ":"")+t},i.assertAtMostOne=function(t,e){t.length>1&&i.raiseError("Was expecting no more than one element but got "+JSON.stringify(t),e)},i.assertType=function(t,e,n){var o=this.valData(t);if(e.indexOf(r(o))<0){var a=e.length>1?"one of "+e.join(", "):e[0];i.raiseError("Found type '"+r(t)+"' but was expecting "+a,n)}return o},i.isEmpty=function(t){return Array.isArray(t)&&0==t.length},i.isSome=function(t){return null!=t&&!i.isEmpty(t)},i.isTrue=function(t){return null!=t&&(!0===t||1==t.length&&!0===t[0])},i.isFalse=function(t){return null!=t&&(!1===t||1==t.length&&!1===t[0])},i.isCapitalized=function(t){return t&&t[0]===t[0].toUpperCase()},i.flatten=function(t){return t.reduce((function(t,e){return Array.isArray(e)?t=t.concat(e):t.push(e),t}),[])},i.arraify=function(t){return Array.isArray(t)?t:i.isSome(t)?[t]:[]},i.valData=function(t){return t instanceof o?t.data:t},t.exports=i},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&o(t,e)}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=h(t);if(e){var i=h(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return s(this,n)}}function s(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function l(t,e,n){return e&&c(t.prototype,e),n&&c(t,n),t}function p(t,e,n){return(p="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=h(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=n(35),d=n(36).UcumLhcUtils.getInstance(),y=n(37),g="[0-9][0-9](\\:[0-9][0-9](\\:[0-9][0-9](\\.[0-9]+)?)?)?(Z|(\\+|-)[0-9][0-9]\\:[0-9][0-9])?",m=new RegExp("^T?"+g+"$"),v=new RegExp("^[0-9][0-9][0-9][0-9](-[0-9][0-9](-[0-9][0-9](T"+g+")?)?)?Z?$"),x=function(){function t(){u(this,t)}return l(t,[{key:"equals",value:function(){return!1}},{key:"equivalentTo",value:function(){return!1}},{key:"toString",value:function(){return this.asStr?this.asStr:p(h(t.prototype),"toString",this).call(this)}},{key:"toJSON",value:function(){return this.toString()}},{key:"compare",value:function(){throw"Not implemented"}}]),t}(),T=function(t){i(n,t);var e=a(n);function n(t,r){var i;return u(this,n),(i=e.call(this)).asStr=t+" "+r,i.value=t,i.unit=r,i}return l(n,[{key:"equals",value:function(t){if(!(t instanceof this.constructor))return!1;if(this.unit===t.unit)return y.isEqual(this.value,t.value);var e=this._compareYearsAndMonths(t);if(e)return e.isEqual;var r=n.toUcumQuantity(this.value,this.unit),i=n.toUcumQuantity(t.value,t.unit),o=d.convertUnitTo(i.unit,i.value,r.unit);return"succeeded"===o.status&&y.isEqual(r.value,o.toVal)}},{key:"equivalentTo",value:function(t){if(!(t instanceof this.constructor))return!1;if(this.unit===t.unit)return y.isEquivalent(this.value,t.value);var e=n.getEquivalentUcumUnitCode(this.unit),r=n.getEquivalentUcumUnitCode(t.unit),i=d.convertUnitTo(r,t.value,e);return"succeeded"===i.status&&y.isEquivalent(this.value,i.toVal)}},{key:"_compareYearsAndMonths",value:function(t){var e=n._yearMonthConversionFactor[this.unit],r=n._yearMonthConversionFactor[t.unit];return e&&r?{isEqual:y.isEqual(this.value*e,t.value*r)}:null}}]),n}(x),_=/^'|'$/g;T.getEquivalentUcumUnitCode=function(t){return T.mapTimeUnitsToUCUMCode[t]||t.replace(_,"")},T.toUcumQuantity=function(t,e){var n=T._calendarDuration2Seconds[e];return n?{value:n*t,unit:"s"}:{value:t,unit:e.replace(_,"")}},T.convUnitTo=function(t,e,n){var r=T._yearMonthConversionFactor[t],i=T._yearMonthConversionFactor[n];if(r&&i)return new T(r*e/i,n);var o=T._calendarDuration2Seconds[t],a=T._calendarDuration2Seconds[n];if(a){if(o)return new T(o*e/a,n);var s=d.convertUnitTo(t.replace(/^'|'$/g,""),e,"s");if("succeeded"===s.status)return new T(s.toVal/a,n)}else{var u=o?d.convertUnitTo("s",o*e,n.replace(/^'|'$/g,"")):d.convertUnitTo(t.replace(/^'|'$/g,""),e,n.replace(/^'|'$/g,""));if("succeeded"===u.status)return new T(u.toVal,n)}return null},T._calendarDuration2Seconds={years:31536e3,months:2592e3,weeks:604800,days:86400,hours:3600,minutes:60,seconds:1,milliseconds:.001,year:31536e3,month:2592e3,week:604800,day:86400,hour:3600,minute:60,second:1,millisecond:.001},T._yearMonthConversionFactor={years:12,months:1,year:12,month:1},T.timeUnitsToUCUM={years:"'a'",months:"'mo'",weeks:"'wk'",days:"'d'",hours:"'h'",minutes:"'min'",seconds:"'s'",milliseconds:"'ms'",year:"'a'",month:"'mo'",week:"'wk'",day:"'d'",hour:"'h'",minute:"'min'",second:"'s'",millisecond:"'ms'","'a'":"'a'","'mo'":"'mo'","'wk'":"'wk'","'d'":"'d'","'h'":"'h'","'min'":"'min'","'s'":"'s'","'ms'":"'ms'"},T.mapUCUMCodeToTimeUnits={a:"year",mo:"month",wk:"week",d:"day",h:"hour",min:"minute",s:"second",ms:"millisecond"},T.mapTimeUnitsToUCUMCode=Object.keys(T.mapUCUMCodeToTimeUnits).reduce((function(t,e){return t[T.mapUCUMCodeToTimeUnits[e]]=e,t[T.mapUCUMCodeToTimeUnits[e]+"s"]=e,t}),{}),T.integerUnits={"'a'":!0,"'mo'":!0,"'wk'":!0,"'d'":!0,"'h'":!0,"'min'":!0};var E=function(t){i(n,t);var e=a(n);function n(t){var r;return u(this,n),(r=e.call(this)).asStr=t,r}return l(n,[{key:"plus",value:function(t){var e=t.unit,r=T.timeUnitsToUCUM[e];if(!r)throw new Error("For date/time arithmetic, the unit of the quantity must be a recognized time-based unit");var i=this.constructor,o=i._ucumToDatePrecision[r];if(void 0===o)throw new Error("Unsupported unit for +.  The unit should be one of "+Object.keys(i._ucumToDatePrecision).join(", ")+".");var a=T.integerUnits[r],s=t.value;if(a&&!Number.isInteger(s))throw new Error("When adding a quantity of unit "+e+" to a date/time, the value must be an integer.");if(this._getPrecision()<o){var u=r.slice(1,r.length-1),c=i._datePrecisionToUnquotedUcum[this._getPrecision()],l=d.convertUnitTo(u,s,c);if("succeeded"!=l.status)throw new Error(l.msg.join("\n"));r="'"+c+"'",s=Math.floor(l.toVal)}var p=n.timeUnitToAddFn[r](this._getDateObj(),s),h=i===C,f=this._getPrecision();h&&(f+=3);var y=S.isoDateTime(p,f);return h&&(y=y.slice(y.indexOf("T")+1)),new i(y)}},{key:"equals",value:function(t){var e;if(t instanceof this.constructor){var n=this._getPrecision(),r=t._getPrecision();if(n==r)e=this._getDateObj().getTime()==t._getDateObj().getTime();else{var i=n<=r?n:r,o=this._getDateObj().toISOString(),a=t._getDateObj().toISOString();this.constructor===C&&(i+=3,n+=3,r+=3);for(var s=n>2?new S(o)._getTimeParts():this._getTimeParts(),u=r>2?new S(a)._getTimeParts():t._getTimeParts(),c=0;c<=i&&!1!==e;++c)e=s[c]==u[c];e&&(e=void 0)}}else e=!1;return e}},{key:"equivalentTo",value:function(t){var e=t instanceof this.constructor;e&&((e=this._getPrecision()==t._getPrecision())&&(e=this._getDateObj().getTime()==t._getDateObj().getTime()));return e}},{key:"compare",value:function(t){var e=this._getPrecision(),n=t._getPrecision(),r=e<=n?this._getDateObj().getTime():this._dateAtPrecision(n).getTime(),i=n<=e?t._getDateObj().getTime():t._dateAtPrecision(e).getTime();return r<i?-1:r===i?0:1}},{key:"_getPrecision",value:function(){return void 0===this.precision&&this._getMatchData(),this.precision}},{key:"_getMatchData",value:function(t,e){if(void 0===this.timeMatchData&&(this.timeMatchData=this.asStr.match(t),this.timeMatchData))for(var n=e;n>=0&&void 0===this.precision;--n)this.timeMatchData[n]&&(this.precision=n);return this.timeMatchData}},{key:"_getTimeParts",value:function(t){var e=[];e=[t[0]];var n=t[4];if(n){var r=e[0];e[0]=r.slice(0,r.length-n.length)}var i=t[1];if(i){var o=e[0];e[0]=o.slice(0,o.length-i.length),e[1]=i;var a=t[2];if(a){e[1]=i.slice(0,i.length-a.length),e[2]=a;var s=t[3];s&&(e[2]=a.slice(0,a.length-s.length),e[3]=s)}}return e}},{key:"_getDateObj",value:function(){if(!this.dateObj){var t=this._getPrecision();this.dateObj=this._dateAtPrecision(t)}return this.dateObj}},{key:"_createDate",value:function(t,e,n,r,i,o,a,s){var u=new Date(t,e,n,r,i,o,a);if(s){var c=u.getTimezoneOffset(),l=0;if("Z"!=s){var p=s.split(":"),h=parseInt(p[0]);l=parseInt(p[1]),h<0&&(l=-l),l+=60*h}u=f(u,-c-l)}return u}}]),n}(x);E.timeUnitToAddFn={"'a'":n(66),"'mo'":n(38),"'wk'":n(68),"'d'":n(39),"'h'":n(69),"'min'":n(35),"'s'":n(70),"'ms'":n(20)};var S=function(t){i(n,t);var e=a(n);function n(t){return u(this,n),e.call(this,t)}return l(n,[{key:"compare",value:function(t){if(!(t instanceof n))throw"Invalid comparison of a DateTime with something else";return p(h(n.prototype),"compare",this).call(this,t)}},{key:"_getMatchData",value:function(){return p(h(n.prototype),"_getMatchData",this).call(this,v,6)}},{key:"_getTimeParts",value:function(){if(!this.timeParts){var t=this._getMatchData(),e=t[0];this.timeParts=[e];var r=t[1];if(r){this.timeParts[0]=e.slice(0,e.length-r.length),this.timeParts[1]=r;var i=t[2];if(i){this.timeParts[1]=r.slice(0,r.length-i.length),this.timeParts[2]=i;var o=t[3];o&&(this.timeParts[2]=i.slice(0,i.length-o.length),"T"===o[0]&&(t[3]=o.slice(1)),this.timeParts=this.timeParts.concat(p(h(n.prototype),"_getTimeParts",this).call(this,t.slice(3))))}}}return this.timeParts}},{key:"_dateAtPrecision",value:function(t){var e=this._getTimeParts(),n=this._getMatchData()[7],r=this._getPrecision(),i=parseInt(e[0]),o=r>0?parseInt(e[1].slice(1))-1:0,a=r>1?parseInt(e[2].slice(1)):1,s=r>2?parseInt(e[3]):0,u=r>3?parseInt(e[4].slice(1)):0,c=r>4?parseInt(e[5].slice(1)):0,l=r>5?parseInt(e[6].slice(1)):0,p=this._createDate(i,o,a,s,u,c,l,n);return t<this._getPrecision()&&(i=p.getFullYear(),o=t>0?p.getMonth():0,a=t>1?p.getDate():1,s=t>2?p.getHours():0,u=t>3?p.getMinutes():0,c=t>4?p.getSeconds():0,l=t>5?p.getMilliseconds():0,p=new Date(i,o,a,s,u,c,l)),p}}]),n}(E);S.checkString=function(t){var e=new S(t);return e._getMatchData()||(e=null),e},S._ucumToDatePrecision={"'a'":0,"'mo'":1,"'wk'":2,"'d'":2,"'h'":3,"'min'":4,"'s'":5,"'ms'":6},S._datePrecisionToUnquotedUcum=["a","mo","d","h","min","s","ms"];var C=function(t){i(n,t);var e=a(n);function n(t){return u(this,n),"T"==t[0]&&(t=t.slice(1)),e.call(this,t)}return l(n,[{key:"compare",value:function(t){if(!(t instanceof n))throw"Invalid comparison of a time with something else";return p(h(n.prototype),"compare",this).call(this,t)}},{key:"_dateAtPrecision",value:function(t){var e=this._getTimeParts(),n=this._getMatchData()[4],r=this._getPrecision(),i=parseInt(e[0]),o=r>0?parseInt(e[1].slice(1)):0,a=r>1?parseInt(e[2].slice(1)):0,s=r>2?parseInt(e[3].slice(1)):0,u=this._createDate(2010,0,1,i,o,a,s,n);return n&&(u.setYear(2010),u.setMonth(0),u.setDate(1)),t<this._getPrecision()&&(i=u.getHours(),o=t>0?u.getMinutes():0,a=t>1?u.getSeconds():0,s=t>2?u.getMilliseconds():0,u=new Date(2010,0,1,i,o,a,s)),u}},{key:"_getMatchData",value:function(){return p(h(n.prototype),"_getMatchData",this).call(this,m,3)}},{key:"_getTimeParts",value:function(){return this.timeParts||(this.timeParts=p(h(n.prototype),"_getTimeParts",this).call(this,this._getMatchData())),this.timeParts}}]),n}(E);function I(t,e){var n=t;return 3===e&&t<100&&(n="0"+t),t<10&&(n="0"+n),n}C.checkString=function(t){var e=new C(t);return e._getMatchData()||(e=null),e},C._ucumToDatePrecision={"'h'":0,"'min'":1,"'s'":2,"'ms'":3},C._datePrecisionToUnquotedUcum=["h","min","s","ms"],S.isoDateTime=function(t,e){void 0===e&&(e=6);var n=""+t.getFullYear();if(e>0&&(n+="-"+I(t.getMonth()+1),e>1&&(n+="-"+I(t.getDate()),e>2&&(n+="T"+I(t.getHours()),e>3&&(n+=":"+I(t.getMinutes()),e>4&&(n+=":"+I(t.getSeconds()),e>5&&(n+="."+I(t.getMilliseconds(),3))))))),e>2){var r=t.getTimezoneOffset(),i=r<0?"+":"-",o=(r=Math.abs(r))%60;n+=i+I((r-o)/60)+":"+I(o)}return n},S.isoDate=function(t,e){return(void 0===e||e>2)&&(e=2),S.isoDateTime(t,e)};var b=function(){function t(e,n){u(this,t),e.resourceType&&(n=e.resourceType),this.path=n,this.data=function(t,e){"Quantity"===e&&"http://unitsofmeasure.org"===t.system&&"number"==typeof t.value&&"string"==typeof t.code&&(t=new T(t.value,T.mapUCUMCodeToTimeUnits[t.code]||"'"+t.code+"'"));return t}(e,n)}return l(t,[{key:"getTypeInfo",value:function(){var t=R.FHIR;return-1===this.path.indexOf(".")?new R({namespace:t,name:this.path}):R.createByValueInNamespace({namespace:t,value:this.data})}},{key:"toJSON",value:function(){return JSON.stringify(this.data)}}]),t}();b.makeResNode=function(t,e){return t instanceof b?t:new b(t,e)};var R=function(){function t(e){var n=e.name,r=e.namespace;u(this,t),this.name=n,this.namespace=r}return l(t,[{key:"is",value:function(e){return e instanceof t&&this.name===e.name&&(!this.namespace||!e.namespace||this.namespace===e.namespace)}}]),t}();R.System="System",R.FHIR="FHIR",R.createByValueInNamespace=function(t){var e=t.namespace,n=t.value,i=r(n);return Number.isInteger(n)?i="integer":"number"===i?i="decimal":n instanceof S?i="dateTime":n instanceof C?i="time":n instanceof T&&(i="Quantity"),e===R.System&&(i=i.replace(/^\w/,(function(t){return t.toUpperCase()}))),new R({namespace:e,name:i})},R.fromValue=function(t){return t instanceof b?t.getTypeInfo():R.createByValueInNamespace({namespace:R.System,value:t})},t.exports={FP_Type:x,FP_TimeBase:E,FP_DateTime:S,FP_Time:C,FP_Quantity:T,timeRE:m,dateTimeRE:v,ResourceNode:b,TypeInfo:R,typeFn:function(t){return t.map((function(t){return R.fromValue(t)}))},isFn:function(t,e){if(0===t.length)return[];if(t.length>1)throw new Error("Expected singleton on left side of is, got "+JSON.stringify(t));return R.fromValue(t[0]).is(e)}}},function(t,e,n){var r=n(47).LL1Analyzer,i=n(2).IntervalSet;function o(t,e){return this.grammarType=t,this.maxTokenType=e,this.states=[],this.decisionToState=[],this.ruleToStartState=[],this.ruleToStopState=null,this.modeNameToStartState={},this.ruleToTokenType=null,this.lexerActions=null,this.modeToStartState=[],this}o.prototype.nextTokensInContext=function(t,e){return new r(this).LOOK(t,null,e)},o.prototype.nextTokensNoContext=function(t){return null!==t.nextTokenWithinRule||(t.nextTokenWithinRule=this.nextTokensInContext(t,null),t.nextTokenWithinRule.readOnly=!0),t.nextTokenWithinRule},o.prototype.nextTokens=function(t,e){return void 0===e?this.nextTokensNoContext(t):this.nextTokensInContext(t,e)},o.prototype.addState=function(t){null!==t&&(t.atn=this,t.stateNumber=this.states.length),this.states.push(t)},o.prototype.removeState=function(t){this.states[t.stateNumber]=null},o.prototype.defineDecisionState=function(t){return this.decisionToState.push(t),t.decision=this.decisionToState.length-1,t.decision},o.prototype.getDecisionState=function(t){return 0===this.decisionToState.length?null:this.decisionToState[t]};var a=n(1).Token;o.prototype.getExpectedTokens=function(t,e){if(t<0||t>=this.states.length)throw"Invalid state number.";var n=this.states[t],r=this.nextTokens(n);if(!r.contains(a.EPSILON))return r;var o=new i;for(o.addSet(r),o.removeOne(a.EPSILON);null!==e&&e.invokingState>=0&&r.contains(a.EPSILON);){var s=this.states[e.invokingState].transitions[0];r=this.nextTokens(s.followState),o.addSet(r),o.removeOne(a.EPSILON),e=e.parentCtx}return r.contains(a.EPSILON)&&o.addOne(a.EOF),o},o.INVALID_ALT_NUMBER=0,e.ATN=o},function(t,e,n){var r=n(1).Token,i=(n(2).Interval,n(2).IntervalSet),o=n(12).Predicate,a=n(12).PrecedencePredicate;function s(t){if(null==t)throw"target cannot be null.";return this.target=t,this.isEpsilon=!1,this.label=null,this}function u(t,e){return s.call(this,t),this.label_=e,this.label=this.makeLabel(),this.serializationType=s.ATOM,this}function c(t,e,n,r){return s.call(this,t),this.ruleIndex=e,this.precedence=n,this.followState=r,this.serializationType=s.RULE,this.isEpsilon=!0,this}function l(t,e){return s.call(this,t),this.serializationType=s.EPSILON,this.isEpsilon=!0,this.outermostPrecedenceReturn=e,this}function p(t,e,n){return s.call(this,t),this.serializationType=s.RANGE,this.start=e,this.stop=n,this.label=this.makeLabel(),this}function h(t){return s.call(this,t),this}function f(t,e,n,r){return h.call(this,t),this.serializationType=s.PREDICATE,this.ruleIndex=e,this.predIndex=n,this.isCtxDependent=r,this.isEpsilon=!0,this}function d(t,e,n,r){return s.call(this,t),this.serializationType=s.ACTION,this.ruleIndex=e,this.actionIndex=void 0===n?-1:n,this.isCtxDependent=void 0!==r&&r,this.isEpsilon=!0,this}function y(t,e){return s.call(this,t),this.serializationType=s.SET,null!=e?this.label=e:(this.label=new i,this.label.addOne(r.INVALID_TYPE)),this}function g(t,e){return y.call(this,t,e),this.serializationType=s.NOT_SET,this}function m(t){return s.call(this,t),this.serializationType=s.WILDCARD,this}function v(t,e){return h.call(this,t),this.serializationType=s.PRECEDENCE,this.precedence=e,this.isEpsilon=!0,this}s.EPSILON=1,s.RANGE=2,s.RULE=3,s.PREDICATE=4,s.ATOM=5,s.ACTION=6,s.SET=7,s.NOT_SET=8,s.WILDCARD=9,s.PRECEDENCE=10,s.serializationNames=["INVALID","EPSILON","RANGE","RULE","PREDICATE","ATOM","ACTION","SET","NOT_SET","WILDCARD","PRECEDENCE"],s.serializationTypes={EpsilonTransition:s.EPSILON,RangeTransition:s.RANGE,RuleTransition:s.RULE,PredicateTransition:s.PREDICATE,AtomTransition:s.ATOM,ActionTransition:s.ACTION,SetTransition:s.SET,NotSetTransition:s.NOT_SET,WildcardTransition:s.WILDCARD,PrecedencePredicateTransition:s.PRECEDENCE},u.prototype=Object.create(s.prototype),u.prototype.constructor=u,u.prototype.makeLabel=function(){var t=new i;return t.addOne(this.label_),t},u.prototype.matches=function(t,e,n){return this.label_===t},u.prototype.toString=function(){return this.label_},c.prototype=Object.create(s.prototype),c.prototype.constructor=c,c.prototype.matches=function(t,e,n){return!1},l.prototype=Object.create(s.prototype),l.prototype.constructor=l,l.prototype.matches=function(t,e,n){return!1},l.prototype.toString=function(){return"epsilon"},p.prototype=Object.create(s.prototype),p.prototype.constructor=p,p.prototype.makeLabel=function(){var t=new i;return t.addRange(this.start,this.stop),t},p.prototype.matches=function(t,e,n){return t>=this.start&&t<=this.stop},p.prototype.toString=function(){return"'"+String.fromCharCode(this.start)+"'..'"+String.fromCharCode(this.stop)+"'"},h.prototype=Object.create(s.prototype),h.prototype.constructor=h,f.prototype=Object.create(h.prototype),f.prototype.constructor=f,f.prototype.matches=function(t,e,n){return!1},f.prototype.getPredicate=function(){return new o(this.ruleIndex,this.predIndex,this.isCtxDependent)},f.prototype.toString=function(){return"pred_"+this.ruleIndex+":"+this.predIndex},d.prototype=Object.create(s.prototype),d.prototype.constructor=d,d.prototype.matches=function(t,e,n){return!1},d.prototype.toString=function(){return"action_"+this.ruleIndex+":"+this.actionIndex},y.prototype=Object.create(s.prototype),y.prototype.constructor=y,y.prototype.matches=function(t,e,n){return this.label.contains(t)},y.prototype.toString=function(){return this.label.toString()},g.prototype=Object.create(y.prototype),g.prototype.constructor=g,g.prototype.matches=function(t,e,n){return t>=e&&t<=n&&!y.prototype.matches.call(this,t,e,n)},g.prototype.toString=function(){return"~"+y.prototype.toString.call(this)},m.prototype=Object.create(s.prototype),m.prototype.constructor=m,m.prototype.matches=function(t,e,n){return t>=e&&t<=n},m.prototype.toString=function(){return"."},v.prototype=Object.create(h.prototype),v.prototype.constructor=v,v.prototype.matches=function(t,e,n){return!1},v.prototype.getPredicate=function(){return new a(this.precedence)},v.prototype.toString=function(){return this.precedence+" >= _p"},e.Transition=s,e.AtomTransition=u,e.SetTransition=y,e.NotSetTransition=g,e.RuleTransition=c,e.ActionTransition=d,e.EpsilonTransition=l,e.RangeTransition=p,e.WildcardTransition=m,e.PredicateTransition=f,e.PrecedencePredicateTransition=v,e.AbstractPredicateTransition=h},function(t,e,n){var r=n(9).ATN,i=n(0),o=i.Hash,a=i.Set,s=n(12).SemanticContext,u=n(6).merge;function c(t){return t.hashCodeForConfigSet()}function l(t,e){return t===e||null!==t&&null!==e&&t.equalsForConfigSet(e)}function p(t){return this.configLookup=new a(c,l),this.fullCtx=void 0===t||t,this.readOnly=!1,this.configs=[],this.uniqueAlt=0,this.conflictingAlts=null,this.hasSemanticContext=!1,this.dipsIntoOuterContext=!1,this.cachedHashCode=-1,this}function h(){return p.call(this),this.configLookup=new a,this}p.prototype.add=function(t,e){if(void 0===e&&(e=null),this.readOnly)throw"This set is readonly";t.semanticContext!==s.NONE&&(this.hasSemanticContext=!0),t.reachesIntoOuterContext>0&&(this.dipsIntoOuterContext=!0);var n=this.configLookup.add(t);if(n===t)return this.cachedHashCode=-1,this.configs.push(t),!0;var r=!this.fullCtx,i=u(n.context,t.context,r,e);return n.reachesIntoOuterContext=Math.max(n.reachesIntoOuterContext,t.reachesIntoOuterContext),t.precedenceFilterSuppressed&&(n.precedenceFilterSuppressed=!0),n.context=i,!0},p.prototype.getStates=function(){for(var t=new a,e=0;e<this.configs.length;e++)t.add(this.configs[e].state);return t},p.prototype.getPredicates=function(){for(var t=[],e=0;e<this.configs.length;e++){var n=this.configs[e].semanticContext;n!==s.NONE&&t.push(n.semanticContext)}return t},Object.defineProperty(p.prototype,"items",{get:function(){return this.configs}}),p.prototype.optimizeConfigs=function(t){if(this.readOnly)throw"This set is readonly";if(0!==this.configLookup.length)for(var e=0;e<this.configs.length;e++){var n=this.configs[e];n.context=t.getCachedContext(n.context)}},p.prototype.addAll=function(t){for(var e=0;e<t.length;e++)this.add(t[e]);return!1},p.prototype.equals=function(t){return this===t||t instanceof p&&i.equalArrays(this.configs,t.configs)&&this.fullCtx===t.fullCtx&&this.uniqueAlt===t.uniqueAlt&&this.conflictingAlts===t.conflictingAlts&&this.hasSemanticContext===t.hasSemanticContext&&this.dipsIntoOuterContext===t.dipsIntoOuterContext},p.prototype.hashCode=function(){var t=new o;return t.update(this.configs),t.finish()},p.prototype.updateHashCode=function(t){this.readOnly?(-1===this.cachedHashCode&&(this.cachedHashCode=this.hashCode()),t.update(this.cachedHashCode)):t.update(this.hashCode())},Object.defineProperty(p.prototype,"length",{get:function(){return this.configs.length}}),p.prototype.isEmpty=function(){return 0===this.configs.length},p.prototype.contains=function(t){if(null===this.configLookup)throw"This method is not implemented for readonly sets.";return this.configLookup.contains(t)},p.prototype.containsFast=function(t){if(null===this.configLookup)throw"This method is not implemented for readonly sets.";return this.configLookup.containsFast(t)},p.prototype.clear=function(){if(this.readOnly)throw"This set is readonly";this.configs=[],this.cachedHashCode=-1,this.configLookup=new a},p.prototype.setReadonly=function(t){this.readOnly=t,t&&(this.configLookup=null)},p.prototype.toString=function(){return i.arrayToString(this.configs)+(this.hasSemanticContext?",hasSemanticContext="+this.hasSemanticContext:"")+(this.uniqueAlt!==r.INVALID_ALT_NUMBER?",uniqueAlt="+this.uniqueAlt:"")+(null!==this.conflictingAlts?",conflictingAlts="+this.conflictingAlts:"")+(this.dipsIntoOuterContext?",dipsIntoOuterContext":"")},h.prototype=Object.create(p.prototype),h.prototype.constructor=h,e.ATNConfigSet=p,e.OrderedATNConfigSet=h},function(t,e,n){var r=n(0).Set,i=n(0).Hash;function o(){return this}function a(t,e,n){return o.call(this),this.ruleIndex=void 0===t?-1:t,this.predIndex=void 0===e?-1:e,this.isCtxDependent=void 0!==n&&n,this}function s(t){o.call(this),this.precedence=void 0===t?0:t}function u(t,e){o.call(this);var n=new r;t instanceof u?t.opnds.map((function(t){n.add(t)})):n.add(t),e instanceof u?e.opnds.map((function(t){n.add(t)})):n.add(e);var i=s.filterPrecedencePredicates(n);if(i.length>0){var a=null;i.map((function(t){(null===a||t.precedence<a.precedence)&&(a=t)})),n.add(a)}return this.opnds=n.values(),this}function c(t,e){o.call(this);var n=new r;t instanceof c?t.opnds.map((function(t){n.add(t)})):n.add(t),e instanceof c?e.opnds.map((function(t){n.add(t)})):n.add(e);var i=s.filterPrecedencePredicates(n);if(i.length>0){var a=i.sort((function(t,e){return t.compareTo(e)})),u=a[a.length-1];n.add(u)}return this.opnds=n.values(),this}o.prototype.hashCode=function(){var t=new i;return this.updateHashCode(t),t.finish()},o.prototype.evaluate=function(t,e){},o.prototype.evalPrecedence=function(t,e){return this},o.andContext=function(t,e){if(null===t||t===o.NONE)return e;if(null===e||e===o.NONE)return t;var n=new u(t,e);return 1===n.opnds.length?n.opnds[0]:n},o.orContext=function(t,e){if(null===t)return e;if(null===e)return t;if(t===o.NONE||e===o.NONE)return o.NONE;var n=new c(t,e);return 1===n.opnds.length?n.opnds[0]:n},a.prototype=Object.create(o.prototype),a.prototype.constructor=a,o.NONE=new a,a.prototype.evaluate=function(t,e){var n=this.isCtxDependent?e:null;return t.sempred(n,this.ruleIndex,this.predIndex)},a.prototype.updateHashCode=function(t){t.update(this.ruleIndex,this.predIndex,this.isCtxDependent)},a.prototype.equals=function(t){return this===t||t instanceof a&&(this.ruleIndex===t.ruleIndex&&this.predIndex===t.predIndex&&this.isCtxDependent===t.isCtxDependent)},a.prototype.toString=function(){return"{"+this.ruleIndex+":"+this.predIndex+"}?"},s.prototype=Object.create(o.prototype),s.prototype.constructor=s,s.prototype.evaluate=function(t,e){return t.precpred(e,this.precedence)},s.prototype.evalPrecedence=function(t,e){return t.precpred(e,this.precedence)?o.NONE:null},s.prototype.compareTo=function(t){return this.precedence-t.precedence},s.prototype.updateHashCode=function(t){t.update(31)},s.prototype.equals=function(t){return this===t||t instanceof s&&this.precedence===t.precedence},s.prototype.toString=function(){return"{"+this.precedence+">=prec}?"},s.filterPrecedencePredicates=function(t){var e=[];return t.values().map((function(t){t instanceof s&&e.push(t)})),e},u.prototype=Object.create(o.prototype),u.prototype.constructor=u,u.prototype.equals=function(t){return this===t||t instanceof u&&this.opnds===t.opnds},u.prototype.updateHashCode=function(t){t.update(this.opnds,"AND")},u.prototype.evaluate=function(t,e){for(var n=0;n<this.opnds.length;n++)if(!this.opnds[n].evaluate(t,e))return!1;return!0},u.prototype.evalPrecedence=function(t,e){for(var n=!1,r=[],i=0;i<this.opnds.length;i++){var a=this.opnds[i],s=a.evalPrecedence(t,e);if(n|=s!==a,null===s)return null;s!==o.NONE&&r.push(s)}if(!n)return this;if(0===r.length)return o.NONE;var u=null;return r.map((function(t){u=null===u?t:o.andContext(u,t)})),u},u.prototype.toString=function(){var t="";return this.opnds.map((function(e){t+="&& "+e.toString()})),t.length>3?t.slice(3):t},c.prototype=Object.create(o.prototype),c.prototype.constructor=c,c.prototype.constructor=function(t){return this===t||t instanceof c&&this.opnds===t.opnds},c.prototype.updateHashCode=function(t){t.update(this.opnds,"OR")},c.prototype.evaluate=function(t,e){for(var n=0;n<this.opnds.length;n++)if(this.opnds[n].evaluate(t,e))return!0;return!1},c.prototype.evalPrecedence=function(t,e){for(var n=!1,r=[],i=0;i<this.opnds.length;i++){var a=this.opnds[i],s=a.evalPrecedence(t,e);if(n|=s!==a,s===o.NONE)return o.NONE;null!==s&&r.push(s)}if(!n)return this;if(0===r.length)return null;return r.map((function(t){return t})),null},c.prototype.toString=function(){var t="";return this.opnds.map((function(e){t+="|| "+e.toString()})),t.length>3?t.slice(3):t},e.SemanticContext=o,e.PrecedencePredicate=s,e.Predicate=a},function(t,e,n){var r=n(11).ATNConfigSet,i=n(0),o=i.Hash,a=i.Set;function s(t,e){return this.alt=e,this.pred=t,this}function u(t,e){return null===t&&(t=-1),null===e&&(e=new r),this.stateNumber=t,this.configs=e,this.edges=null,this.isAcceptState=!1,this.prediction=0,this.lexerActionExecutor=null,this.requiresFullContext=!1,this.predicates=null,this}s.prototype.toString=function(){return"("+this.pred+", "+this.alt+")"},u.prototype.getAltSet=function(){var t=new a;if(null!==this.configs)for(var e=0;e<this.configs.length;e++){var n=this.configs[e];t.add(n.alt)}return 0===t.length?null:t},u.prototype.equals=function(t){return this===t||t instanceof u&&this.configs.equals(t.configs)},u.prototype.toString=function(){var t=this.stateNumber+":"+this.configs;return this.isAcceptState&&(t+="=>",null!==this.predicates?t+=this.predicates:t+=this.prediction),t},u.prototype.hashCode=function(){var t=new o;return t.update(this.configs),t.finish()},e.DFAState=u,e.PredPrediction=s},function(t,e,n){e.atn=n(46),e.codepointat=n(31),e.dfa=n(53),e.fromcodepoint=n(32),e.tree=n(55),e.error=n(56),e.Token=n(1).Token,e.CommonToken=n(1).CommonToken,e.InputStream=n(58).InputStream,e.CommonTokenStream=n(59).CommonTokenStream,e.Lexer=n(17).Lexer,e.Parser=n(61).Parser;var r=n(6);e.PredictionContextCache=r.PredictionContextCache,e.ParserRuleContext=n(22).ParserRuleContext,e.Interval=n(2).Interval,e.Utils=n(0)},function(t,e,n){var r=n(3).DecisionState,i=n(12).SemanticContext,o=n(0).Hash;function a(t,e){if(null===t){var n={state:null,alt:null,context:null,semanticContext:null};return e&&(n.reachesIntoOuterContext=0),n}var r={};return r.state=t.state||null,r.alt=void 0===t.alt?null:t.alt,r.context=t.context||null,r.semanticContext=t.semanticContext||null,e&&(r.reachesIntoOuterContext=t.reachesIntoOuterContext||0,r.precedenceFilterSuppressed=t.precedenceFilterSuppressed||!1),r}function s(t,e){return this.checkContext(t,e),t=a(t),e=a(e,!0),this.state=null!==t.state?t.state:e.state,this.alt=null!==t.alt?t.alt:e.alt,this.context=null!==t.context?t.context:e.context,this.semanticContext=null!==t.semanticContext?t.semanticContext:null!==e.semanticContext?e.semanticContext:i.NONE,this.reachesIntoOuterContext=e.reachesIntoOuterContext,this.precedenceFilterSuppressed=e.precedenceFilterSuppressed,this}function u(t,e){s.call(this,t,e);var n=t.lexerActionExecutor||null;return this.lexerActionExecutor=n||(null!==e?e.lexerActionExecutor:null),this.passedThroughNonGreedyDecision=null!==e&&this.checkNonGreedyDecision(e,this.state),this}s.prototype.checkContext=function(t,e){null!==t.context&&void 0!==t.context||null!==e&&null!==e.context&&void 0!==e.context||(this.context=null)},s.prototype.hashCode=function(){var t=new o;return this.updateHashCode(t),t.finish()},s.prototype.updateHashCode=function(t){t.update(this.state.stateNumber,this.alt,this.context,this.semanticContext)},s.prototype.equals=function(t){return this===t||t instanceof s&&(this.state.stateNumber===t.state.stateNumber&&this.alt===t.alt&&(null===this.context?null===t.context:this.context.equals(t.context))&&this.semanticContext.equals(t.semanticContext)&&this.precedenceFilterSuppressed===t.precedenceFilterSuppressed)},s.prototype.hashCodeForConfigSet=function(){var t=new o;return t.update(this.state.stateNumber,this.alt,this.semanticContext),t.finish()},s.prototype.equalsForConfigSet=function(t){return this===t||t instanceof s&&(this.state.stateNumber===t.state.stateNumber&&this.alt===t.alt&&this.semanticContext.equals(t.semanticContext))},s.prototype.toString=function(){return"("+this.state+","+this.alt+(null!==this.context?",["+this.context.toString()+"]":"")+(this.semanticContext!==i.NONE?","+this.semanticContext.toString():"")+(this.reachesIntoOuterContext>0?",up="+this.reachesIntoOuterContext:"")+")"},u.prototype=Object.create(s.prototype),u.prototype.constructor=u,u.prototype.updateHashCode=function(t){t.update(this.state.stateNumber,this.alt,this.context,this.semanticContext,this.passedThroughNonGreedyDecision,this.lexerActionExecutor)},u.prototype.equals=function(t){return this===t||t instanceof u&&this.passedThroughNonGreedyDecision==t.passedThroughNonGreedyDecision&&(this.lexerActionExecutor?this.lexerActionExecutor.equals(t.lexerActionExecutor):!t.lexerActionExecutor)&&s.prototype.equals.call(this,t)},u.prototype.hashCodeForConfigSet=u.prototype.hashCode,u.prototype.equalsForConfigSet=u.prototype.equals,u.prototype.checkNonGreedyDecision=function(t,e){return t.passedThroughNonGreedyDecision||e instanceof r&&e.nonGreedy},e.ATNConfig=s,e.LexerATNConfig=u},function(t,e,n){var r=n(4).RuleNode,i=n(4).INVALID_INTERVAL,o=n(9).INVALID_ALT_NUMBER;function a(t,e){return r.call(this),this.parentCtx=t||null,this.invokingState=e||-1,this}a.prototype=Object.create(r.prototype),a.prototype.constructor=a,a.prototype.depth=function(){for(var t=0,e=this;null!==e;)e=e.parentCtx,t+=1;return t},a.prototype.isEmpty=function(){return-1===this.invokingState},a.prototype.getSourceInterval=function(){return i},a.prototype.getRuleContext=function(){return this},a.prototype.getPayload=function(){return this},a.prototype.getText=function(){return 0===this.getChildCount()?"":this.children.map((function(t){return t.getText()})).join("")},a.prototype.getAltNumber=function(){return o},a.prototype.setAltNumber=function(t){},a.prototype.getChild=function(t){return null},a.prototype.getChildCount=function(){return 0},a.prototype.accept=function(t){return t.visitChildren(this)},e.RuleContext=a;var s=n(24).Trees;a.prototype.toStringTree=function(t,e){return s.toStringTree(this,t,e)},a.prototype.toString=function(t,e){t=t||null,e=e||null;for(var n=this,r="[";null!==n&&n!==e;){if(null===t)n.isEmpty()||(r+=n.invokingState);else{var i=n.ruleIndex;r+=i>=0&&i<t.length?t[i]:""+i}null===n.parentCtx||null===t&&n.parentCtx.isEmpty()||(r+=" "),n=n.parentCtx}return r+="]"}},function(t,e,n){var r=n(1).Token,i=n(28).Recognizer,o=n(50).CommonTokenFactory,a=n(5).RecognitionException,s=n(5).LexerNoViableAltException;function u(t){return i.call(this),this._input=t,this._factory=o.DEFAULT,this._tokenFactorySourcePair=[this,t],this._interp=null,this._token=null,this._tokenStartCharIndex=-1,this._tokenStartLine=-1,this._tokenStartColumn=-1,this._hitEOF=!1,this._channel=r.DEFAULT_CHANNEL,this._type=r.INVALID_TYPE,this._modeStack=[],this._mode=u.DEFAULT_MODE,this._text=null,this}u.prototype=Object.create(i.prototype),u.prototype.constructor=u,u.DEFAULT_MODE=0,u.MORE=-2,u.SKIP=-3,u.DEFAULT_TOKEN_CHANNEL=r.DEFAULT_CHANNEL,u.HIDDEN=r.HIDDEN_CHANNEL,u.MIN_CHAR_VALUE=0,u.MAX_CHAR_VALUE=1114111,u.prototype.reset=function(){null!==this._input&&this._input.seek(0),this._token=null,this._type=r.INVALID_TYPE,this._channel=r.DEFAULT_CHANNEL,this._tokenStartCharIndex=-1,this._tokenStartColumn=-1,this._tokenStartLine=-1,this._text=null,this._hitEOF=!1,this._mode=u.DEFAULT_MODE,this._modeStack=[],this._interp.reset()},u.prototype.nextToken=function(){if(null===this._input)throw"nextToken requires a non-null input stream.";var t=this._input.mark();try{for(;;){if(this._hitEOF)return this.emitEOF(),this._token;this._token=null,this._channel=r.DEFAULT_CHANNEL,this._tokenStartCharIndex=this._input.index,this._tokenStartColumn=this._interp.column,this._tokenStartLine=this._interp.line,this._text=null;for(var e=!1;;){this._type=r.INVALID_TYPE;var n=u.SKIP;try{n=this._interp.match(this._input,this._mode)}catch(t){if(!(t instanceof a))throw console.log(t.stack),t;this.notifyListeners(t),this.recover(t)}if(this._input.LA(1)===r.EOF&&(this._hitEOF=!0),this._type===r.INVALID_TYPE&&(this._type=n),this._type===u.SKIP){e=!0;break}if(this._type!==u.MORE)break}if(!e)return null===this._token&&this.emit(),this._token}}finally{this._input.release(t)}},u.prototype.skip=function(){this._type=u.SKIP},u.prototype.more=function(){this._type=u.MORE},u.prototype.mode=function(t){this._mode=t},u.prototype.pushMode=function(t){this._interp.debug&&console.log("pushMode "+t),this._modeStack.push(this._mode),this.mode(t)},u.prototype.popMode=function(){if(0===this._modeStack.length)throw"Empty Stack";return this._interp.debug&&console.log("popMode back to "+this._modeStack.slice(0,-1)),this.mode(this._modeStack.pop()),this._mode},Object.defineProperty(u.prototype,"inputStream",{get:function(){return this._input},set:function(t){this._input=null,this._tokenFactorySourcePair=[this,this._input],this.reset(),this._input=t,this._tokenFactorySourcePair=[this,this._input]}}),Object.defineProperty(u.prototype,"sourceName",{get:function(){return this._input.sourceName}}),u.prototype.emitToken=function(t){this._token=t},u.prototype.emit=function(){var t=this._factory.create(this._tokenFactorySourcePair,this._type,this._text,this._channel,this._tokenStartCharIndex,this.getCharIndex()-1,this._tokenStartLine,this._tokenStartColumn);return this.emitToken(t),t},u.prototype.emitEOF=function(){var t=this.column,e=this.line,n=this._factory.create(this._tokenFactorySourcePair,r.EOF,null,r.DEFAULT_CHANNEL,this._input.index,this._input.index-1,e,t);return this.emitToken(n),n},Object.defineProperty(u.prototype,"type",{get:function(){return this.type},set:function(t){this._type=t}}),Object.defineProperty(u.prototype,"line",{get:function(){return this._interp.line},set:function(t){this._interp.line=t}}),Object.defineProperty(u.prototype,"column",{get:function(){return this._interp.column},set:function(t){this._interp.column=t}}),u.prototype.getCharIndex=function(){return this._input.index},Object.defineProperty(u.prototype,"text",{get:function(){return null!==this._text?this._text:this._interp.getText(this._input)},set:function(t){this._text=t}}),u.prototype.getAllTokens=function(){for(var t=[],e=this.nextToken();e.type!==r.EOF;)t.push(e),e=this.nextToken();return t},u.prototype.notifyListeners=function(t){var e=this._tokenStartCharIndex,n=this._input.index,r=this._input.getText(e,n),i="token recognition error at: '"+this.getErrorDisplay(r)+"'";this.getErrorListenerDispatch().syntaxError(this,null,this._tokenStartLine,this._tokenStartColumn,i,t)},u.prototype.getErrorDisplay=function(t){for(var e=[],n=0;n<t.length;n++)e.push(t[n]);return e.join("")},u.prototype.getErrorDisplayForChar=function(t){return t.charCodeAt(0)===r.EOF?"<EOF>":"\n"===t?"\\n":"\t"===t?"\\t":"\r"===t?"\\r":t},u.prototype.getCharErrorDisplay=function(t){return"'"+this.getErrorDisplayForChar(t)+"'"},u.prototype.recover=function(t){this._input.LA(1)!==r.EOF&&(t instanceof s?this._interp.consume(this._input):this._input.consume())},e.Lexer=u},function(t,e){function n(){return this}function r(){return n.call(this),this}function i(t){if(n.call(this),null===t)throw"delegates";return this.delegates=t,this}n.prototype.syntaxError=function(t,e,n,r,i,o){},n.prototype.reportAmbiguity=function(t,e,n,r,i,o,a){},n.prototype.reportAttemptingFullContext=function(t,e,n,r,i,o){},n.prototype.reportContextSensitivity=function(t,e,n,r,i,o){},r.prototype=Object.create(n.prototype),r.prototype.constructor=r,r.INSTANCE=new r,r.prototype.syntaxError=function(t,e,n,r,i,o){console.error("line "+n+":"+r+" "+i)},i.prototype=Object.create(n.prototype),i.prototype.constructor=i,i.prototype.syntaxError=function(t,e,n,r,i,o){this.delegates.map((function(a){a.syntaxError(t,e,n,r,i,o)}))},i.prototype.reportAmbiguity=function(t,e,n,r,i,o,a){this.delegates.map((function(s){s.reportAmbiguity(t,e,n,r,i,o,a)}))},i.prototype.reportAttemptingFullContext=function(t,e,n,r,i,o){this.delegates.map((function(a){a.reportAttemptingFullContext(t,e,n,r,i,o)}))},i.prototype.reportContextSensitivity=function(t,e,n,r,i,o){this.delegates.map((function(a){a.reportContextSensitivity(t,e,n,r,i,o)}))},e.ErrorListener=n,e.ConsoleErrorListener=r,e.ProxyErrorListener=i},function(t,e){function n(t,e,n){return this.dfa=t,this.literalNames=e||[],this.symbolicNames=n||[],this}function r(t){return n.call(this,t,null),this}n.prototype.toString=function(){if(null===this.dfa.s0)return null;for(var t="",e=this.dfa.sortedStates(),n=0;n<e.length;n++){var r=e[n];if(null!==r.edges)for(var i=r.edges.length,o=0;o<i;o++){var a=r.edges[o]||null;null!==a&&2147483647!==a.stateNumber&&(t=(t=(t=(t=(t=(t=t.concat(this.getStateString(r))).concat("-")).concat(this.getEdgeLabel(o))).concat("->")).concat(this.getStateString(a))).concat("\n"))}}return 0===t.length?null:t},n.prototype.getEdgeLabel=function(t){return 0===t?"EOF":null!==this.literalNames||null!==this.symbolicNames?this.literalNames[t-1]||this.symbolicNames[t-1]:String.fromCharCode(t-1)},n.prototype.getStateString=function(t){var e=(t.isAcceptState?":":"")+"s"+t.stateNumber+(t.requiresFullContext?"^":"");return t.isAcceptState?null!==t.predicates?e+"=>"+t.predicates.toString():e+"=>"+t.prediction.toString():e},r.prototype=Object.create(n.prototype),r.prototype.constructor=r,r.prototype.getEdgeLabel=function(t){return"'"+String.fromCharCode(t)+"'"},e.DFASerializer=n,e.LexerDFASerializer=r},function(t,e,n){var r=n(21);t.exports=function(t,e){var n=r(t).getTime(),i=Number(e);return new Date(n+i)}},function(t,e,n){var r=n(64),i=n(65),o=/[T ]/,a=/:/,s=/^(\d{2})$/,u=[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],c=/^(\d{4})/,l=[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],p=/^-(\d{2})$/,h=/^-?(\d{3})$/,f=/^-?(\d{2})-?(\d{2})$/,d=/^-?W(\d{2})$/,y=/^-?W(\d{2})-?(\d{1})$/,g=/^(\d{2}([.,]\d*)?)$/,m=/^(\d{2}):?(\d{2}([.,]\d*)?)$/,v=/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,x=/([Z+-].*)$/,T=/^(Z)$/,_=/^([+-])(\d{2})$/,E=/^([+-])(\d{2}):?(\d{2})$/;function S(t,e,n){e=e||0,n=n||0;var r=new Date(0);r.setUTCFullYear(t,0,4);var i=7*e+n+1-(r.getUTCDay()||7);return r.setUTCDate(r.getUTCDate()+i),r}t.exports=function(t,e){if(i(t))return new Date(t.getTime());if("string"!=typeof t)return new Date(t);var n=(e||{}).additionalDigits;n=null==n?2:Number(n);var C=function(t){var e,n={},r=t.split(o);a.test(r[0])?(n.date=null,e=r[0]):(n.date=r[0],e=r[1]);if(e){var i=x.exec(e);i?(n.time=e.replace(i[1],""),n.timezone=i[1]):n.time=e}return n}(t),I=function(t,e){var n,r=u[e],i=l[e];if(n=c.exec(t)||i.exec(t)){var o=n[1];return{year:parseInt(o,10),restDateString:t.slice(o.length)}}if(n=s.exec(t)||r.exec(t)){var a=n[1];return{year:100*parseInt(a,10),restDateString:t.slice(a.length)}}return{year:null}}(C.date,n),b=I.year,R=function(t,e){if(null===e)return null;var n,r,i,o;if(0===t.length)return(r=new Date(0)).setUTCFullYear(e),r;if(n=p.exec(t))return r=new Date(0),i=parseInt(n[1],10)-1,r.setUTCFullYear(e,i),r;if(n=h.exec(t)){r=new Date(0);var a=parseInt(n[1],10);return r.setUTCFullYear(e,0,a),r}if(n=f.exec(t)){r=new Date(0),i=parseInt(n[1],10)-1;var s=parseInt(n[2],10);return r.setUTCFullYear(e,i,s),r}if(n=d.exec(t))return o=parseInt(n[1],10)-1,S(e,o);if(n=y.exec(t)){o=parseInt(n[1],10)-1;var u=parseInt(n[2],10)-1;return S(e,o,u)}return null}(I.restDateString,b);if(R){var A,D=R.getTime(),O=0;if(C.time&&(O=function(t){var e,n,r;if(e=g.exec(t))return(n=parseFloat(e[1].replace(",",".")))%24*36e5;if(e=m.exec(t))return n=parseInt(e[1],10),r=parseFloat(e[2].replace(",",".")),n%24*36e5+6e4*r;if(e=v.exec(t)){n=parseInt(e[1],10),r=parseInt(e[2],10);var i=parseFloat(e[3].replace(",","."));return n%24*36e5+6e4*r+1e3*i}return null}(C.time)),C.timezone)A=6e4*function(t){var e,n;if(e=T.exec(t))return 0;if(e=_.exec(t))return n=60*parseInt(e[2],10),"+"===e[1]?-n:n;if(e=E.exec(t))return n=60*parseInt(e[2],10)+parseInt(e[3],10),"+"===e[1]?-n:n;return 0}(C.timezone);else{var w=D+O,L=new Date(w);A=r(L);var N=new Date(w);N.setDate(L.getDate()+1);var P=r(N)-r(L);P>0&&(A+=P)}return new Date(D+O+A)}return new Date(t)}},function(t,e,n){var r=n(16).RuleContext,i=n(4),o=i.INVALID_INTERVAL,a=i.TerminalNode,s=i.TerminalNodeImpl,u=i.ErrorNodeImpl,c=n(2).Interval;function l(t,e){t=t||null,e=e||null,r.call(this,t,e),this.ruleIndex=-1,this.children=null,this.start=null,this.stop=null,this.exception=null}function p(t,e,n){return l.call(t,e),this.ruleIndex=n,this}l.prototype=Object.create(r.prototype),l.prototype.constructor=l,l.prototype.copyFrom=function(t){this.parentCtx=t.parentCtx,this.invokingState=t.invokingState,this.children=null,this.start=t.start,this.stop=t.stop,t.children&&(this.children=[],t.children.map((function(t){t instanceof u&&(this.children.push(t),t.parentCtx=this)}),this))},l.prototype.enterRule=function(t){},l.prototype.exitRule=function(t){},l.prototype.addChild=function(t){return null===this.children&&(this.children=[]),this.children.push(t),t},l.prototype.removeLastChild=function(){null!==this.children&&this.children.pop()},l.prototype.addTokenNode=function(t){var e=new s(t);return this.addChild(e),e.parentCtx=this,e},l.prototype.addErrorNode=function(t){var e=new u(t);return this.addChild(e),e.parentCtx=this,e},l.prototype.getChild=function(t,e){if(e=e||null,null===this.children||t<0||t>=this.children.length)return null;if(null===e)return this.children[t];for(var n=0;n<this.children.length;n++){var r=this.children[n];if(r instanceof e){if(0===t)return r;t-=1}}return null},l.prototype.getToken=function(t,e){if(null===this.children||e<0||e>=this.children.length)return null;for(var n=0;n<this.children.length;n++){var r=this.children[n];if(r instanceof a&&r.symbol.type===t){if(0===e)return r;e-=1}}return null},l.prototype.getTokens=function(t){if(null===this.children)return[];for(var e=[],n=0;n<this.children.length;n++){var r=this.children[n];r instanceof a&&r.symbol.type===t&&e.push(r)}return e},l.prototype.getTypedRuleContext=function(t,e){return this.getChild(e,t)},l.prototype.getTypedRuleContexts=function(t){if(null===this.children)return[];for(var e=[],n=0;n<this.children.length;n++){var r=this.children[n];r instanceof t&&e.push(r)}return e},l.prototype.getChildCount=function(){return null===this.children?0:this.children.length},l.prototype.getSourceInterval=function(){return null===this.start||null===this.stop?o:new c(this.start.tokenIndex,this.stop.tokenIndex)},r.EMPTY=new l,p.prototype=Object.create(l.prototype),p.prototype.constructor=p,e.ParserRuleContext=l},function(t,e){t.exports=LForms},function(t,e,n){var r=n(0),i=n(1).Token,o=(n(4).RuleNode,n(4).ErrorNode),a=n(4).TerminalNode,s=n(22).ParserRuleContext,u=n(16).RuleContext,c=n(9).INVALID_ALT_NUMBER;function l(){}l.toStringTree=function(t,e,n){e=e||null,null!==(n=n||null)&&(e=n.ruleNames);var i=l.getNodeText(t,e);i=r.escapeWhitespace(i,!1);var o=t.getChildCount();if(0===o)return i;var a="("+i+" ";o>0&&(i=l.toStringTree(t.getChild(0),e),a=a.concat(i));for(var s=1;s<o;s++)i=l.toStringTree(t.getChild(s),e),a=a.concat(" "+i);return a=a.concat(")")},l.getNodeText=function(t,e,n){if(e=e||null,null!==(n=n||null)&&(e=n.ruleNames),null!==e){if(t instanceof u){var r=t.getAltNumber();return r!=c?e[t.ruleIndex]+":"+r:e[t.ruleIndex]}if(t instanceof o)return t.toString();if(t instanceof a&&null!==t.symbol)return t.symbol.text}var s=t.getPayload();return s instanceof i?s.text:t.getPayload().toString()},l.getChildren=function(t){for(var e=[],n=0;n<t.getChildCount();n++)e.push(t.getChild(n));return e},l.getAncestors=function(t){var e=[];for(t=t.getParent();null!==t;)e=[t].concat(e),t=t.getParent();return e},l.findAllTokenNodes=function(t,e){return l.findAllNodes(t,e,!0)},l.findAllRuleNodes=function(t,e){return l.findAllNodes(t,e,!1)},l.findAllNodes=function(t,e,n){var r=[];return l._findAllNodes(t,e,n,r),r},l._findAllNodes=function(t,e,n,r){n&&t instanceof a?t.symbol.type===e&&r.push(t):!n&&t instanceof s&&t.ruleIndex===e&&r.push(t);for(var i=0;i<t.getChildCount();i++)l._findAllNodes(t.getChild(i),e,n,r)},l.descendants=function(t){for(var e=[t],n=0;n<t.getChildCount();n++)e=e.concat(l.descendants(t.getChild(n)));return e},e.Trees=l},function(t,e,n){var r=n(1).Token,i=n(9).ATN,o=n(48).ATNType,a=n(3),s=a.ATNState,u=a.BasicState,c=a.DecisionState,l=a.BlockStartState,p=a.BlockEndState,h=a.LoopEndState,f=a.RuleStartState,d=a.RuleStopState,y=a.TokensStartState,g=a.PlusLoopbackState,m=a.StarLoopbackState,v=a.StarLoopEntryState,x=a.PlusBlockStartState,T=a.StarBlockStartState,_=a.BasicBlockStartState,E=n(10),S=E.Transition,C=E.AtomTransition,I=E.SetTransition,b=E.NotSetTransition,R=E.RuleTransition,A=E.RangeTransition,D=E.ActionTransition,O=E.EpsilonTransition,w=E.WildcardTransition,L=E.PredicateTransition,N=E.PrecedencePredicateTransition,P=n(2).IntervalSet,k=(n(2).Interval,n(26).ATNDeserializationOptions),F=n(27),M=F.LexerActionType,U=F.LexerSkipAction,j=F.LexerChannelAction,q=F.LexerCustomAction,B=F.LexerMoreAction,V=F.LexerTypeAction,H=F.LexerPushModeAction,Q=F.LexerPopModeAction,z=F.LexerModeAction,W="59627784-3BE5-417A-B9EB-8131A7286089",Y=["AADB8D7E-AEEF-4415-AD2B-8204D6CF042E",W];function K(t,e){var n=[];return n[t-1]=e,n.map((function(t){return e}))}function G(t){return null==t&&(t=k.defaultOptions),this.deserializationOptions=t,this.stateFactories=null,this.actionFactories=null,this}G.prototype.isFeatureSupported=function(t,e){var n=Y.indexOf(t);return!(n<0)&&Y.indexOf(e)>=n},G.prototype.deserialize=function(t){this.reset(t),this.checkVersion(),this.checkUUID();var e=this.readATN();this.readStates(e),this.readRules(e),this.readModes(e);var n=[];return this.readSets(e,n,this.readInt.bind(this)),this.isFeatureSupported(W,this.uuid)&&this.readSets(e,n,this.readInt32.bind(this)),this.readEdges(e,n),this.readDecisions(e),this.readLexerActions(e),this.markPrecedenceDecisions(e),this.verifyATN(e),this.deserializationOptions.generateRuleBypassTransitions&&e.grammarType===o.PARSER&&(this.generateRuleBypassTransitions(e),this.verifyATN(e)),e},G.prototype.reset=function(t){var e=t.split("").map((function(t){var e=t.charCodeAt(0);return e>1?e-2:e+65534}));e[0]=t.charCodeAt(0),this.data=e,this.pos=0},G.prototype.checkVersion=function(){var t=this.readInt();if(3!==t)throw"Could not deserialize ATN with version "+t+" (expected 3)."},G.prototype.checkUUID=function(){var t=this.readUUID();if(Y.indexOf(t)<0)throw"59627784-3BE5-417A-B9EB-8131A7286089";this.uuid=t},G.prototype.readATN=function(){var t=this.readInt(),e=this.readInt();return new i(t,e)},G.prototype.readStates=function(t){for(var e,n,r,i=[],o=[],a=this.readInt(),u=0;u<a;u++){var c=this.readInt();if(c!==s.INVALID_TYPE){var p=this.readInt();65535===p&&(p=-1);var h=this.stateFactory(c,p);if(c===s.LOOP_END){var f=this.readInt();i.push([h,f])}else if(h instanceof l){var d=this.readInt();o.push([h,d])}t.addState(h)}else t.addState(null)}for(e=0;e<i.length;e++)(n=i[e])[0].loopBackState=t.states[n[1]];for(e=0;e<o.length;e++)(n=o[e])[0].endState=t.states[n[1]];var y=this.readInt();for(e=0;e<y;e++)r=this.readInt(),t.states[r].nonGreedy=!0;var g=this.readInt();for(e=0;e<g;e++)r=this.readInt(),t.states[r].isPrecedenceRule=!0},G.prototype.readRules=function(t){var e,n=this.readInt();for(t.grammarType===o.LEXER&&(t.ruleToTokenType=K(n,0)),t.ruleToStartState=K(n,0),e=0;e<n;e++){var i=this.readInt(),a=t.states[i];if(t.ruleToStartState[e]=a,t.grammarType===o.LEXER){var s=this.readInt();65535===s&&(s=r.EOF),t.ruleToTokenType[e]=s}}for(t.ruleToStopState=K(n,0),e=0;e<t.states.length;e++){var u=t.states[e];u instanceof d&&(t.ruleToStopState[u.ruleIndex]=u,t.ruleToStartState[u.ruleIndex].stopState=u)}},G.prototype.readModes=function(t){for(var e=this.readInt(),n=0;n<e;n++){var r=this.readInt();t.modeToStartState.push(t.states[r])}},G.prototype.readSets=function(t,e,n){for(var r=this.readInt(),i=0;i<r;i++){var o=new P;e.push(o);var a=this.readInt();0!==this.readInt()&&o.addOne(-1);for(var s=0;s<a;s++){var u=n(),c=n();o.addRange(u,c)}}},G.prototype.readEdges=function(t,e){var n,r,i,o,a,s=this.readInt();for(n=0;n<s;n++){var u=this.readInt(),c=this.readInt(),p=this.readInt(),h=this.readInt(),f=this.readInt(),d=this.readInt();o=this.edgeFactory(t,p,u,c,h,f,d,e),t.states[u].addTransition(o)}for(n=0;n<t.states.length;n++)for(i=t.states[n],r=0;r<i.transitions.length;r++){var y=i.transitions[r];if(y instanceof R){var T=-1;t.ruleToStartState[y.target.ruleIndex].isPrecedenceRule&&0===y.precedence&&(T=y.target.ruleIndex),o=new O(y.followState,T),t.ruleToStopState[y.target.ruleIndex].addTransition(o)}}for(n=0;n<t.states.length;n++){if((i=t.states[n])instanceof l){if(null===i.endState)throw"IllegalState";if(null!==i.endState.startState)throw"IllegalState";i.endState.startState=i}if(i instanceof g)for(r=0;r<i.transitions.length;r++)(a=i.transitions[r].target)instanceof x&&(a.loopBackState=i);else if(i instanceof m)for(r=0;r<i.transitions.length;r++)(a=i.transitions[r].target)instanceof v&&(a.loopBackState=i)}},G.prototype.readDecisions=function(t){for(var e=this.readInt(),n=0;n<e;n++){var r=this.readInt(),i=t.states[r];t.decisionToState.push(i),i.decision=n}},G.prototype.readLexerActions=function(t){if(t.grammarType===o.LEXER){var e=this.readInt();t.lexerActions=K(e,null);for(var n=0;n<e;n++){var r=this.readInt(),i=this.readInt();65535===i&&(i=-1);var a=this.readInt();65535===a&&(a=-1);var s=this.lexerActionFactory(r,i,a);t.lexerActions[n]=s}}},G.prototype.generateRuleBypassTransitions=function(t){var e,n=t.ruleToStartState.length;for(e=0;e<n;e++)t.ruleToTokenType[e]=t.maxTokenType+e+1;for(e=0;e<n;e++)this.generateRuleBypassTransition(t,e)},G.prototype.generateRuleBypassTransition=function(t,e){var n,r,i=new _;i.ruleIndex=e,t.addState(i);var o=new p;o.ruleIndex=e,t.addState(o),i.endState=o,t.defineDecisionState(i),o.startState=i;var a=null,s=null;if(t.ruleToStartState[e].isPrecedenceRule){for(s=null,n=0;n<t.states.length;n++)if(r=t.states[n],this.stateIsEndStateFor(r,e)){s=r,a=r.loopBackState.transitions[0];break}if(null===a)throw"Couldn't identify final state of the precedence rule prefix section."}else s=t.ruleToStopState[e];for(n=0;n<t.states.length;n++){r=t.states[n];for(var c=0;c<r.transitions.length;c++){var l=r.transitions[c];l!==a&&(l.target===s&&(l.target=o))}}for(var h=t.ruleToStartState[e],f=h.transitions.length;f>0;)i.addTransition(h.transitions[f-1]),h.transitions=h.transitions.slice(-1);t.ruleToStartState[e].addTransition(new O(i)),o.addTransition(new O(s));var d=new u;t.addState(d),d.addTransition(new C(o,t.ruleToTokenType[e])),i.addTransition(new O(d))},G.prototype.stateIsEndStateFor=function(t,e){if(t.ruleIndex!==e)return null;if(!(t instanceof v))return null;var n=t.transitions[t.transitions.length-1].target;return n instanceof h&&n.epsilonOnlyTransitions&&n.transitions[0].target instanceof d?t:null},G.prototype.markPrecedenceDecisions=function(t){for(var e=0;e<t.states.length;e++){var n=t.states[e];if(n instanceof v&&t.ruleToStartState[n.ruleIndex].isPrecedenceRule){var r=n.transitions[n.transitions.length-1].target;r instanceof h&&r.epsilonOnlyTransitions&&r.transitions[0].target instanceof d&&(n.isPrecedenceDecision=!0)}}},G.prototype.verifyATN=function(t){if(this.deserializationOptions.verifyATN)for(var e=0;e<t.states.length;e++){var n=t.states[e];if(null!==n)if(this.checkCondition(n.epsilonOnlyTransitions||n.transitions.length<=1),n instanceof x)this.checkCondition(null!==n.loopBackState);else if(n instanceof v)if(this.checkCondition(null!==n.loopBackState),this.checkCondition(2===n.transitions.length),n.transitions[0].target instanceof T)this.checkCondition(n.transitions[1].target instanceof h),this.checkCondition(!n.nonGreedy);else{if(!(n.transitions[0].target instanceof h))throw"IllegalState";this.checkCondition(n.transitions[1].target instanceof T),this.checkCondition(n.nonGreedy)}else n instanceof m?(this.checkCondition(1===n.transitions.length),this.checkCondition(n.transitions[0].target instanceof v)):n instanceof h?this.checkCondition(null!==n.loopBackState):n instanceof f?this.checkCondition(null!==n.stopState):n instanceof l?this.checkCondition(null!==n.endState):n instanceof p?this.checkCondition(null!==n.startState):n instanceof c?this.checkCondition(n.transitions.length<=1||n.decision>=0):this.checkCondition(n.transitions.length<=1||n instanceof d)}},G.prototype.checkCondition=function(t,e){if(!t)throw null==e&&(e="IllegalState"),e},G.prototype.readInt=function(){return this.data[this.pos++]},G.prototype.readInt32=function(){return this.readInt()|this.readInt()<<16},G.prototype.readLong=function(){return 4294967295&this.readInt32()|this.readInt32()<<32};var $=function(){for(var t=[],e=0;e<256;e++)t[e]=(e+256).toString(16).substr(1).toUpperCase();return t}();G.prototype.readUUID=function(){for(var t=[],e=7;e>=0;e--){var n=this.readInt();t[2*e+1]=255&n,t[2*e]=n>>8&255}return $[t[0]]+$[t[1]]+$[t[2]]+$[t[3]]+"-"+$[t[4]]+$[t[5]]+"-"+$[t[6]]+$[t[7]]+"-"+$[t[8]]+$[t[9]]+"-"+$[t[10]]+$[t[11]]+$[t[12]]+$[t[13]]+$[t[14]]+$[t[15]]},G.prototype.edgeFactory=function(t,e,n,i,o,a,s,u){var c=t.states[i];switch(e){case S.EPSILON:return new O(c);case S.RANGE:return new A(c,0!==s?r.EOF:o,a);case S.RULE:return new R(t.states[o],a,s,c);case S.PREDICATE:return new L(c,o,a,0!==s);case S.PRECEDENCE:return new N(c,o);case S.ATOM:return new C(c,0!==s?r.EOF:o);case S.ACTION:return new D(c,o,a,0!==s);case S.SET:return new I(c,u[o]);case S.NOT_SET:return new b(c,u[o]);case S.WILDCARD:return new w(c);default:throw"The specified transition type: "+e+" is not valid."}},G.prototype.stateFactory=function(t,e){if(null===this.stateFactories){var n=[];n[s.INVALID_TYPE]=null,n[s.BASIC]=function(){return new u},n[s.RULE_START]=function(){return new f},n[s.BLOCK_START]=function(){return new _},n[s.PLUS_BLOCK_START]=function(){return new x},n[s.STAR_BLOCK_START]=function(){return new T},n[s.TOKEN_START]=function(){return new y},n[s.RULE_STOP]=function(){return new d},n[s.BLOCK_END]=function(){return new p},n[s.STAR_LOOP_BACK]=function(){return new m},n[s.STAR_LOOP_ENTRY]=function(){return new v},n[s.PLUS_LOOP_BACK]=function(){return new g},n[s.LOOP_END]=function(){return new h},this.stateFactories=n}if(t>this.stateFactories.length||null===this.stateFactories[t])throw"The specified state type "+t+" is not valid.";var r=this.stateFactories[t]();if(null!==r)return r.ruleIndex=e,r},G.prototype.lexerActionFactory=function(t,e,n){if(null===this.actionFactories){var r=[];r[M.CHANNEL]=function(t,e){return new j(t)},r[M.CUSTOM]=function(t,e){return new q(t,e)},r[M.MODE]=function(t,e){return new z(t)},r[M.MORE]=function(t,e){return B.INSTANCE},r[M.POP_MODE]=function(t,e){return Q.INSTANCE},r[M.PUSH_MODE]=function(t,e){return new H(t)},r[M.SKIP]=function(t,e){return U.INSTANCE},r[M.TYPE]=function(t,e){return new V(t)},this.actionFactories=r}if(t>this.actionFactories.length||null===this.actionFactories[t])throw"The specified lexer action type "+t+" is not valid.";return this.actionFactories[t](e,n)},e.ATNDeserializer=G},function(t,e){function n(t){return void 0===t&&(t=null),this.readOnly=!1,this.verifyATN=null===t||t.verifyATN,this.generateRuleBypassTransitions=null!==t&&t.generateRuleBypassTransitions,this}n.defaultOptions=new n,n.defaultOptions.readOnly=!0,e.ATNDeserializationOptions=n},function(t,e){function n(){}function r(t){return this.actionType=t,this.isPositionDependent=!1,this}function i(){return r.call(this,n.SKIP),this}function o(t){return r.call(this,n.TYPE),this.type=t,this}function a(t){return r.call(this,n.PUSH_MODE),this.mode=t,this}function s(){return r.call(this,n.POP_MODE),this}function u(){return r.call(this,n.MORE),this}function c(t){return r.call(this,n.MODE),this.mode=t,this}function l(t,e){return r.call(this,n.CUSTOM),this.ruleIndex=t,this.actionIndex=e,this.isPositionDependent=!0,this}function p(t){return r.call(this,n.CHANNEL),this.channel=t,this}function h(t,e){return r.call(this,e.actionType),this.offset=t,this.action=e,this.isPositionDependent=!0,this}n.CHANNEL=0,n.CUSTOM=1,n.MODE=2,n.MORE=3,n.POP_MODE=4,n.PUSH_MODE=5,n.SKIP=6,n.TYPE=7,r.prototype.hashCode=function(){var t=new Hash;return this.updateHashCode(t),t.finish()},r.prototype.updateHashCode=function(t){t.update(this.actionType)},r.prototype.equals=function(t){return this===t},i.prototype=Object.create(r.prototype),i.prototype.constructor=i,i.INSTANCE=new i,i.prototype.execute=function(t){t.skip()},i.prototype.toString=function(){return"skip"},o.prototype=Object.create(r.prototype),o.prototype.constructor=o,o.prototype.execute=function(t){t.type=this.type},o.prototype.updateHashCode=function(t){t.update(this.actionType,this.type)},o.prototype.equals=function(t){return this===t||t instanceof o&&this.type===t.type},o.prototype.toString=function(){return"type("+this.type+")"},a.prototype=Object.create(r.prototype),a.prototype.constructor=a,a.prototype.execute=function(t){t.pushMode(this.mode)},a.prototype.updateHashCode=function(t){t.update(this.actionType,this.mode)},a.prototype.equals=function(t){return this===t||t instanceof a&&this.mode===t.mode},a.prototype.toString=function(){return"pushMode("+this.mode+")"},s.prototype=Object.create(r.prototype),s.prototype.constructor=s,s.INSTANCE=new s,s.prototype.execute=function(t){t.popMode()},s.prototype.toString=function(){return"popMode"},u.prototype=Object.create(r.prototype),u.prototype.constructor=u,u.INSTANCE=new u,u.prototype.execute=function(t){t.more()},u.prototype.toString=function(){return"more"},c.prototype=Object.create(r.prototype),c.prototype.constructor=c,c.prototype.execute=function(t){t.mode(this.mode)},c.prototype.updateHashCode=function(t){t.update(this.actionType,this.mode)},c.prototype.equals=function(t){return this===t||t instanceof c&&this.mode===t.mode},c.prototype.toString=function(){return"mode("+this.mode+")"},l.prototype=Object.create(r.prototype),l.prototype.constructor=l,l.prototype.execute=function(t){t.action(null,this.ruleIndex,this.actionIndex)},l.prototype.updateHashCode=function(t){t.update(this.actionType,this.ruleIndex,this.actionIndex)},l.prototype.equals=function(t){return this===t||t instanceof l&&(this.ruleIndex===t.ruleIndex&&this.actionIndex===t.actionIndex)},p.prototype=Object.create(r.prototype),p.prototype.constructor=p,p.prototype.execute=function(t){t._channel=this.channel},p.prototype.updateHashCode=function(t){t.update(this.actionType,this.channel)},p.prototype.equals=function(t){return this===t||t instanceof p&&this.channel===t.channel},p.prototype.toString=function(){return"channel("+this.channel+")"},h.prototype=Object.create(r.prototype),h.prototype.constructor=h,h.prototype.execute=function(t){this.action.execute(t)},h.prototype.updateHashCode=function(t){t.update(this.actionType,this.offset,this.action)},h.prototype.equals=function(t){return this===t||t instanceof h&&(this.offset===t.offset&&this.action===t.action)},e.LexerActionType=n,e.LexerSkipAction=i,e.LexerChannelAction=p,e.LexerCustomAction=l,e.LexerIndexedCustomAction=h,e.LexerMoreAction=u,e.LexerTypeAction=o,e.LexerPushModeAction=a,e.LexerPopModeAction=s,e.LexerModeAction=c},function(t,e,n){var r=n(1).Token,i=n(18).ConsoleErrorListener,o=n(18).ProxyErrorListener;function a(){return this._listeners=[i.INSTANCE],this._interp=null,this._stateNumber=-1,this}a.tokenTypeMapCache={},a.ruleIndexMapCache={},a.prototype.checkVersion=function(t){"4.8"!==t&&console.log("ANTLR runtime and generated code versions disagree: 4.8!="+t)},a.prototype.addErrorListener=function(t){this._listeners.push(t)},a.prototype.removeErrorListeners=function(){this._listeners=[]},a.prototype.getTokenTypeMap=function(){var t=this.getTokenNames();if(null===t)throw"The current recognizer does not provide a list of token names.";var e=this.tokenTypeMapCache[t];return void 0===e&&((e=t.reduce((function(t,e,n){t[e]=n}))).EOF=r.EOF,this.tokenTypeMapCache[t]=e),e},a.prototype.getRuleIndexMap=function(){var t=this.ruleNames;if(null===t)throw"The current recognizer does not provide a list of rule names.";var e=this.ruleIndexMapCache[t];return void 0===e&&(e=t.reduce((function(t,e,n){t[e]=n})),this.ruleIndexMapCache[t]=e),e},a.prototype.getTokenType=function(t){var e=this.getTokenTypeMap()[t];return void 0!==e?e:r.INVALID_TYPE},a.prototype.getErrorHeader=function(t){return"line "+t.getOffendingToken().line+":"+t.getOffendingToken().column},a.prototype.getTokenErrorDisplay=function(t){if(null===t)return"<no token>";var e=t.text;return null===e&&(e=t.type===r.EOF?"<EOF>":"<"+t.type+">"),"'"+(e=e.replace("\n","\\n").replace("\r","\\r").replace("\t","\\t"))+"'"},a.prototype.getErrorListenerDispatch=function(){return new o(this._listeners)},a.prototype.sempred=function(t,e,n){return!0},a.prototype.precpred=function(t,e){return!0},Object.defineProperty(a.prototype,"state",{get:function(){return this._stateNumber},set:function(t){this._stateNumber=t}}),e.Recognizer=a},function(t,e,n){var r=n(13).DFAState,i=n(11).ATNConfigSet,o=n(6).getCachedPredictionContext,a=n(0).Map;function s(t,e){return this.atn=t,this.sharedContextCache=e,this}s.ERROR=new r(2147483647,new i),s.prototype.getCachedContext=function(t){if(null===this.sharedContextCache)return t;var e=new a;return o(t,this.sharedContextCache,e)},e.ATNSimulator=s},function(t,e,n){n(0).Set;var r=n(0).Map,i=n(0).BitSet,o=n(0).AltDict,a=n(9).ATN,s=n(3).RuleStopState,u=n(11).ATNConfigSet,c=n(15).ATNConfig,l=n(12).SemanticContext,p=(n(0).Hash,n(0).hashStuff);n(0).equalArrays;function h(){return this}h.SLL=0,h.LL=1,h.LL_EXACT_AMBIG_DETECTION=2,h.hasSLLConflictTerminatingPrediction=function(t,e){if(h.allConfigsInRuleStopStates(e))return!0;if(t===h.SLL&&e.hasSemanticContext){for(var n=new u,r=0;r<e.items.length;r++){var i=e.items[r];i=new c({semanticContext:l.NONE},i),n.add(i)}e=n}var o=h.getConflictingAltSubsets(e);return h.hasConflictingAltSet(o)&&!h.hasStateAssociatedWithOneAlt(e)},h.hasConfigInRuleStopState=function(t){for(var e=0;e<t.items.length;e++){if(t.items[e].state instanceof s)return!0}return!1},h.allConfigsInRuleStopStates=function(t){for(var e=0;e<t.items.length;e++){if(!(t.items[e].state instanceof s))return!1}return!0},h.resolvesToJustOneViableAlt=function(t){return h.getSingleViableAlt(t)},h.allSubsetsConflict=function(t){return!h.hasNonConflictingAltSet(t)},h.hasNonConflictingAltSet=function(t){for(var e=0;e<t.length;e++){if(1===t[e].length)return!0}return!1},h.hasConflictingAltSet=function(t){for(var e=0;e<t.length;e++){if(t[e].length>1)return!0}return!1},h.allSubsetsEqual=function(t){for(var e=null,n=0;n<t.length;n++){var r=t[n];if(null===e)e=r;else if(r!==e)return!1}return!0},h.getUniqueAlt=function(t){var e=h.getAlts(t);return 1===e.length?e.minValue():a.INVALID_ALT_NUMBER},h.getAlts=function(t){var e=new i;return t.map((function(t){e.or(t)})),e},h.getConflictingAltSubsets=function(t){var e=new r;return e.hashFunction=function(t){p(t.state.stateNumber,t.context)},e.equalsFunction=function(t,e){return t.state.stateNumber==e.state.stateNumber&&t.context.equals(e.context)},t.items.map((function(t){var n=e.get(t);null===n&&(n=new i,e.put(t,n)),n.add(t.alt)})),e.getValues()},h.getStateToAltMap=function(t){var e=new o;return t.items.map((function(t){var n=e.get(t.state);null===n&&(n=new i,e.put(t.state,n)),n.add(t.alt)})),e},h.hasStateAssociatedWithOneAlt=function(t){for(var e=h.getStateToAltMap(t).values(),n=0;n<e.length;n++)if(1===e[n].length)return!0;return!1},h.getSingleViableAlt=function(t){for(var e=null,n=0;n<t.length;n++){var r=t[n].minValue();if(null===e)e=r;else if(e!==r)return a.INVALID_ALT_NUMBER}return e},e.PredictionMode=h},function(t,e){
  /*! https://mths.be/codepointat v0.2.0 by @mathias */
  String.prototype.codePointAt||function(){"use strict";var t=function(){try{var t={},e=Object.defineProperty,n=e(t,t,t)&&e}catch(t){}return n}(),e=function(t){if(null==this)throw TypeError();var e=String(this),n=e.length,r=t?Number(t):0;if(r!=r&&(r=0),!(r<0||r>=n)){var i,o=e.charCodeAt(r);return o>=55296&&o<=56319&&n>r+1&&(i=e.charCodeAt(r+1))>=56320&&i<=57343?1024*(o-55296)+i-56320+65536:o}};t?t(String.prototype,"codePointAt",{value:e,configurable:!0,writable:!0}):String.prototype.codePointAt=e}()},function(t,e){var n,r,i,o;
  /*! https://mths.be/fromcodepoint v0.2.1 by @mathias */
  String.fromCodePoint||(n=function(){try{var t={},e=Object.defineProperty,n=e(t,t,t)&&e}catch(t){}return n}(),r=String.fromCharCode,i=Math.floor,o=function(t){var e,n,o=16384,a=[],s=-1,u=arguments.length;if(!u)return"";for(var c="";++s<u;){var l=Number(arguments[s]);if(!isFinite(l)||l<0||l>1114111||i(l)!=l)throw RangeError("Invalid code point: "+l);l<=65535?a.push(l):(e=55296+((l-=65536)>>10),n=l%1024+56320,a.push(e,n)),(s+1==u||a.length>o)&&(c+=r.apply(null,a),a.length=0)}return c},n?n(String,"fromCodePoint",{value:o,configurable:!0,writable:!0}):String.fromCodePoint=o)},function(t,e,n){var r=n(1).Token,i=n(5),o=i.NoViableAltException,a=i.InputMismatchException,s=i.FailedPredicateException,u=i.ParseCancellationException,c=n(3).ATNState,l=n(2).Interval,p=n(2).IntervalSet;function h(){}function f(){return h.call(this),this.errorRecoveryMode=!1,this.lastErrorIndex=-1,this.lastErrorStates=null,this}function d(){return f.call(this),this}h.prototype.reset=function(t){},h.prototype.recoverInline=function(t){},h.prototype.recover=function(t,e){},h.prototype.sync=function(t){},h.prototype.inErrorRecoveryMode=function(t){},h.prototype.reportError=function(t){},f.prototype=Object.create(h.prototype),f.prototype.constructor=f,f.prototype.reset=function(t){this.endErrorCondition(t)},f.prototype.beginErrorCondition=function(t){this.errorRecoveryMode=!0},f.prototype.inErrorRecoveryMode=function(t){return this.errorRecoveryMode},f.prototype.endErrorCondition=function(t){this.errorRecoveryMode=!1,this.lastErrorStates=null,this.lastErrorIndex=-1},f.prototype.reportMatch=function(t){this.endErrorCondition(t)},f.prototype.reportError=function(t,e){this.inErrorRecoveryMode(t)||(this.beginErrorCondition(t),e instanceof o?this.reportNoViableAlternative(t,e):e instanceof a?this.reportInputMismatch(t,e):e instanceof s?this.reportFailedPredicate(t,e):(console.log("unknown recognition error type: "+e.constructor.name),console.log(e.stack),t.notifyErrorListeners(e.getOffendingToken(),e.getMessage(),e)))},f.prototype.recover=function(t,e){this.lastErrorIndex===t.getInputStream().index&&null!==this.lastErrorStates&&this.lastErrorStates.indexOf(t.state)>=0&&t.consume(),this.lastErrorIndex=t._input.index,null===this.lastErrorStates&&(this.lastErrorStates=[]),this.lastErrorStates.push(t.state);var n=this.getErrorRecoverySet(t);this.consumeUntil(t,n)},f.prototype.sync=function(t){if(!this.inErrorRecoveryMode(t)){var e=t._interp.atn.states[t.state],n=t.getTokenStream().LA(1),i=t.atn.nextTokens(e);if(!i.contains(r.EPSILON)&&!i.contains(n))switch(e.stateType){case c.BLOCK_START:case c.STAR_BLOCK_START:case c.PLUS_BLOCK_START:case c.STAR_LOOP_ENTRY:if(null!==this.singleTokenDeletion(t))return;throw new a(t);case c.PLUS_LOOP_BACK:case c.STAR_LOOP_BACK:this.reportUnwantedToken(t);var o=new p;o.addSet(t.getExpectedTokens());var s=o.addSet(this.getErrorRecoverySet(t));this.consumeUntil(t,s)}}},f.prototype.reportNoViableAlternative=function(t,e){var n,i=t.getTokenStream();n=null!==i?e.startToken.type===r.EOF?"<EOF>":i.getText(new l(e.startToken.tokenIndex,e.offendingToken.tokenIndex)):"<unknown input>";var o="no viable alternative at input "+this.escapeWSAndQuote(n);t.notifyErrorListeners(o,e.offendingToken,e)},f.prototype.reportInputMismatch=function(t,e){var n="mismatched input "+this.getTokenErrorDisplay(e.offendingToken)+" expecting "+e.getExpectedTokens().toString(t.literalNames,t.symbolicNames);t.notifyErrorListeners(n,e.offendingToken,e)},f.prototype.reportFailedPredicate=function(t,e){var n="rule "+t.ruleNames[t._ctx.ruleIndex]+" "+e.message;t.notifyErrorListeners(n,e.offendingToken,e)},f.prototype.reportUnwantedToken=function(t){if(!this.inErrorRecoveryMode(t)){this.beginErrorCondition(t);var e=t.getCurrentToken(),n="extraneous input "+this.getTokenErrorDisplay(e)+" expecting "+this.getExpectedTokens(t).toString(t.literalNames,t.symbolicNames);t.notifyErrorListeners(n,e,null)}},f.prototype.reportMissingToken=function(t){if(!this.inErrorRecoveryMode(t)){this.beginErrorCondition(t);var e=t.getCurrentToken(),n="missing "+this.getExpectedTokens(t).toString(t.literalNames,t.symbolicNames)+" at "+this.getTokenErrorDisplay(e);t.notifyErrorListeners(n,e,null)}},f.prototype.recoverInline=function(t){var e=this.singleTokenDeletion(t);if(null!==e)return t.consume(),e;if(this.singleTokenInsertion(t))return this.getMissingSymbol(t);throw new a(t)},f.prototype.singleTokenInsertion=function(t){var e=t.getTokenStream().LA(1),n=t._interp.atn,r=n.states[t.state].transitions[0].target;return!!n.nextTokens(r,t._ctx).contains(e)&&(this.reportMissingToken(t),!0)},f.prototype.singleTokenDeletion=function(t){var e=t.getTokenStream().LA(2);if(this.getExpectedTokens(t).contains(e)){this.reportUnwantedToken(t),t.consume();var n=t.getCurrentToken();return this.reportMatch(t),n}return null},f.prototype.getMissingSymbol=function(t){var e,n=t.getCurrentToken(),i=this.getExpectedTokens(t).first();e=i===r.EOF?"<missing EOF>":"<missing "+t.literalNames[i]+">";var o=n,a=t.getTokenStream().LT(-1);return o.type===r.EOF&&null!==a&&(o=a),t.getTokenFactory().create(o.source,i,e,r.DEFAULT_CHANNEL,-1,-1,o.line,o.column)},f.prototype.getExpectedTokens=function(t){return t.getExpectedTokens()},f.prototype.getTokenErrorDisplay=function(t){if(null===t)return"<no token>";var e=t.text;return null===e&&(e=t.type===r.EOF?"<EOF>":"<"+t.type+">"),this.escapeWSAndQuote(e)},f.prototype.escapeWSAndQuote=function(t){return"'"+(t=(t=(t=t.replace(/\n/g,"\\n")).replace(/\r/g,"\\r")).replace(/\t/g,"\\t"))+"'"},f.prototype.getErrorRecoverySet=function(t){for(var e=t._interp.atn,n=t._ctx,i=new p;null!==n&&n.invokingState>=0;){var o=e.states[n.invokingState].transitions[0],a=e.nextTokens(o.followState);i.addSet(a),n=n.parentCtx}return i.removeOne(r.EPSILON),i},f.prototype.consumeUntil=function(t,e){for(var n=t.getTokenStream().LA(1);n!==r.EOF&&!e.contains(n);)t.consume(),n=t.getTokenStream().LA(1)},d.prototype=Object.create(f.prototype),d.prototype.constructor=d,d.prototype.recover=function(t,e){for(var n=t._ctx;null!==n;)n.exception=e,n=n.parentCtx;throw new u(e)},d.prototype.recoverInline=function(t){this.recover(t,new a(t))},d.prototype.sync=function(t){},e.BailErrorStrategy=d,e.DefaultErrorStrategy=f},function(t,e,n){var r=n(14);function i(){return r.tree.ParseTreeListener.call(this),this}i.prototype=Object.create(r.tree.ParseTreeListener.prototype),i.prototype.constructor=i,i.prototype.enterIndexerExpression=function(t){},i.prototype.exitIndexerExpression=function(t){},i.prototype.enterPolarityExpression=function(t){},i.prototype.exitPolarityExpression=function(t){},i.prototype.enterAdditiveExpression=function(t){},i.prototype.exitAdditiveExpression=function(t){},i.prototype.enterMultiplicativeExpression=function(t){},i.prototype.exitMultiplicativeExpression=function(t){},i.prototype.enterUnionExpression=function(t){},i.prototype.exitUnionExpression=function(t){},i.prototype.enterOrExpression=function(t){},i.prototype.exitOrExpression=function(t){},i.prototype.enterAndExpression=function(t){},i.prototype.exitAndExpression=function(t){},i.prototype.enterMembershipExpression=function(t){},i.prototype.exitMembershipExpression=function(t){},i.prototype.enterInequalityExpression=function(t){},i.prototype.exitInequalityExpression=function(t){},i.prototype.enterInvocationExpression=function(t){},i.prototype.exitInvocationExpression=function(t){},i.prototype.enterEqualityExpression=function(t){},i.prototype.exitEqualityExpression=function(t){},i.prototype.enterImpliesExpression=function(t){},i.prototype.exitImpliesExpression=function(t){},i.prototype.enterTermExpression=function(t){},i.prototype.exitTermExpression=function(t){},i.prototype.enterTypeExpression=function(t){},i.prototype.exitTypeExpression=function(t){},i.prototype.enterInvocationTerm=function(t){},i.prototype.exitInvocationTerm=function(t){},i.prototype.enterLiteralTerm=function(t){},i.prototype.exitLiteralTerm=function(t){},i.prototype.enterExternalConstantTerm=function(t){},i.prototype.exitExternalConstantTerm=function(t){},i.prototype.enterParenthesizedTerm=function(t){},i.prototype.exitParenthesizedTerm=function(t){},i.prototype.enterNullLiteral=function(t){},i.prototype.exitNullLiteral=function(t){},i.prototype.enterBooleanLiteral=function(t){},i.prototype.exitBooleanLiteral=function(t){},i.prototype.enterStringLiteral=function(t){},i.prototype.exitStringLiteral=function(t){},i.prototype.enterNumberLiteral=function(t){},i.prototype.exitNumberLiteral=function(t){},i.prototype.enterDateTimeLiteral=function(t){},i.prototype.exitDateTimeLiteral=function(t){},i.prototype.enterTimeLiteral=function(t){},i.prototype.exitTimeLiteral=function(t){},i.prototype.enterQuantityLiteral=function(t){},i.prototype.exitQuantityLiteral=function(t){},i.prototype.enterExternalConstant=function(t){},i.prototype.exitExternalConstant=function(t){},i.prototype.enterMemberInvocation=function(t){},i.prototype.exitMemberInvocation=function(t){},i.prototype.enterFunctionInvocation=function(t){},i.prototype.exitFunctionInvocation=function(t){},i.prototype.enterThisInvocation=function(t){},i.prototype.exitThisInvocation=function(t){},i.prototype.enterIndexInvocation=function(t){},i.prototype.exitIndexInvocation=function(t){},i.prototype.enterTotalInvocation=function(t){},i.prototype.exitTotalInvocation=function(t){},i.prototype.enterFunctn=function(t){},i.prototype.exitFunctn=function(t){},i.prototype.enterParamList=function(t){},i.prototype.exitParamList=function(t){},i.prototype.enterQuantity=function(t){},i.prototype.exitQuantity=function(t){},i.prototype.enterUnit=function(t){},i.prototype.exitUnit=function(t){},i.prototype.enterDateTimePrecision=function(t){},i.prototype.exitDateTimePrecision=function(t){},i.prototype.enterPluralDateTimePrecision=function(t){},i.prototype.exitPluralDateTimePrecision=function(t){},i.prototype.enterTypeSpecifier=function(t){},i.prototype.exitTypeSpecifier=function(t){},i.prototype.enterQualifiedIdentifier=function(t){},i.prototype.exitQualifiedIdentifier=function(t){},i.prototype.enterIdentifier=function(t){},i.prototype.exitIdentifier=function(t){},e.FHIRPathListener=i},function(t,e,n){var r=n(20);t.exports=function(t,e){var n=Number(e);return r(t,6e4*n)}},function(t,e){t.exports=LForms.ucumPkg},function(t,e){var n={};function r(t){var e=/(\d+)(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/.exec(""+ +t);if(!e)return 0;var n=e[2],r=e[3];return Math.max(0,("0"===n?0:(n||"").length)-(r||0))}function i(t,e){var n=Math.pow(10,e);return Math.round(t*n)/n}function o(t){return 1e-8*Math.round(t/1e-8)}n.isEquivalent=function(t,e){if(Number.isInteger(t)&&Number.isInteger(e))return t===e;var n=Math.min(r(t),r(e));return 0===n?Math.round(t)===Math.round(e):i(t,n)===i(e,n)},n.isEqual=function(t,e){return o(t)===o(e)},t.exports=n},function(t,e,n){var r=n(21),i=n(67);t.exports=function(t,e){var n=r(t),o=Number(e),a=n.getMonth()+o,s=new Date(0);s.setFullYear(n.getFullYear(),a,1),s.setHours(0,0,0,0);var u=i(s);return n.setMonth(a,Math.min(u,n.getDate())),n}},function(t,e,n){var r=n(21);t.exports=function(t,e){var n=r(t),i=Number(e);return n.setDate(n.getDate()+i),n}},function(t,e){t.exports={reset:function(){this.nowDate=new Date,this.today=null,this.now=null,this.localTimezoneOffset=null},today:null,now:null}},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=n(7),o=n(42),a={};function s(t){return JSON.stringify(u(t))}function u(t){return"object"===r(t)?Array.isArray(t)?t.map(u):Object.keys(t).sort().reduce((function(e,n){var r=t[n];return e[n]=u(r),e}),{}):t}function c(t,e){var n=t.length<=e.length;if(n)for(var r={},o=0,a=t.length;o<a&&n;++o){var u=s(i.valData(t[o])),c=!1;if(0===o)for(var l=0,p=e.length;l<p;++l){var h=i.valData(e[l]),f=s(h);r[f]=h,c=c||u===f}else c=!!r[u];n=c}return n}a.emptyFn=i.isEmpty,a.notFn=function(t){var e;return 1===t.length&&"boolean"==typeof(e=i.valData(t[0]))?!e:[]},a.existsMacro=function(t,e){var n=t;return e?a.existsMacro(o.whereMacro(t,e)):!i.isEmpty(n)},a.allMacro=function(t,e){for(var n=0,r=t.length;n<r;++n)if(!i.isTrue(e(t[n])))return[!1];return[!0]},a.allTrueFn=function(t){for(var e=!0,n=0,r=t.length;n<r&&e;++n){e=!0===i.assertType(t[n],["boolean"],"allTrue")}return[e]},a.anyTrueFn=function(t){for(var e=!1,n=0,r=t.length;n<r&&!e;++n){e=!0===i.assertType(t[n],["boolean"],"anyTrue")}return[e]},a.allFalseFn=function(t){for(var e=!0,n=0,r=t.length;n<r&&e;++n){e=!1===i.assertType(t[n],["boolean"],"allFalse")}return[e]},a.anyFalseFn=function(t){for(var e=!1,n=0,r=t.length;n<r&&!e;++n){e=!1===i.assertType(t[n],["boolean"],"anyFalse")}return[e]},a.subsetOfFn=function(t,e){return[c(t,e)]},a.supersetOfFn=function(t,e){return[c(e,t)]},a.isDistinctFn=function(t){return[t.length===a.distinctFn(t).length]},a.distinctFn=function(t){var e=[];if(t.length>0)for(var n={},r=0,i=t.length;r<i;++r){var o=t[r],a=JSON.stringify(o);void 0===n[a]&&(e.push(o),n[a]=o)}return e},a.countFn=function(t){return t&&t.length?t.length:0},t.exports=a},function(t,e,n){var r=n(7),i=n(8).TypeInfo,o={whereMacro:function(t,e){return!1===t||t?r.flatten(t.filter((function(t){return e(t)[0]}))):[]},selectMacro:function(t,e){return!1===t||t?r.flatten(t.map((function(t){return e(t)}))):[]},repeatMacro:function(t,e){if(!1!==t&&!t)return[];for(var n=[],r=t,i=null;0!=r.length;)(i=e(r.shift()))&&(n=n.concat(i),r=r.concat(i));return n},singleFn:function(t){return 1==t.length?t:0==t.length?[]:{$status:"error",$error:"Expected single"}},firstFn:function(t){return t[0]},lastFn:function(t){return t[t.length-1]},tailFn:function(t){return t.slice(1,t.length)},takeFn:function(t,e){return t.slice(0,e)},skipFn:function(t,e){return t.slice(e,t.length)},ofTypeFn:function(t,e){return t.filter((function(t){return i.fromValue(t).is(e)}))}};t.exports=o},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=n(8).FP_Type,o=n(7),a=n(37),s=Array.prototype.slice,u=Object.keys,c=function(t){return"[object Arguments]"==Object.prototype.toString.call(t)};function l(t){return"string"==typeof t||t instanceof String}function p(t){return!isNaN(parseFloat(t))&&isFinite(t)}function h(t){return t.toUpperCase().replace(/\s+/," ")}var f=function(t,e,n){if(n||(n={}),(t=o.valData(t))===(e=o.valData(e)))return!0;if(n.fuzzy){if(l(t)&&l(e))return h(t)==h(e);if(p(t)&&p(e))return a.isEquivalent(t,e)}else if("number"==typeof t&&"number"==typeof e)return a.isEqual(t,e);if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();if(!t||!e||"object"!=r(t)&&"object"!=r(e))return n.strict?t===e:t==e;var s=t instanceof i,u=e instanceof i;if(s&&u)return n.fuzzy?t.equivalentTo(e):t.equals(e);if(s||u){var c,f;s?(c=t,f=e):(c=e,f=t);var d="string"==typeof f;if(d){var g=c.constructor.checkString(f);d=!!g&&(n.fuzzy?t.equivalentTo(g):c.equals(g))}return d}return y(t,e,n)};function d(t){return null==t}function y(t,e,n){var i,o;if(d(t)||d(e))return!1;if(t.prototype!==e.prototype)return!1;if(c(t)||c(e))return t=c(t)?s.call(t):t,e=c(e)?s.call(e):e,f(t,e,n);try{var a=u(t),l=u(e)}catch(t){return!1}if(a.length!=l.length)return!1;for(a.sort(),l.sort(),i=a.length-1;i>=0;i--)if(a[i]!=l[i])return!1;if(1===a.length)return o=a[0],f(t[o],e[o],n);for(i=a.length-1;i>=0;i--)if(o=a[i],!f(t[o],e[o],n))return!1;return r(t)===r(e)}t.exports=f},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){i=!0,o=t}finally{try{r||null==s.return||s.return()}finally{if(i)throw o}}return n}(t,e)||o(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){if(t){if("string"==typeof t)return a(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var s=n(45),u=n(7);n(71);var c=n(40),l={},p=n(41),h=n(42),f=n(72),d=n(73),y=n(74),g=n(75),m=n(76),v=n(77),x=n(78),T=n(79),_=n(80),E=n(81),S=n(8),C=S.FP_DateTime,I=S.FP_Time,b=S.FP_Quantity,R=S.FP_Type,A=S.ResourceNode,D=S.TypeInfo,O=A.makeResNode;l.invocationTable={empty:{fn:p.emptyFn},not:{fn:p.notFn},exists:{fn:p.existsMacro,arity:{0:[],1:["Expr"]}},all:{fn:p.allMacro,arity:{1:["Expr"]}},allTrue:{fn:p.allTrueFn},anyTrue:{fn:p.anyTrueFn},allFalse:{fn:p.allFalseFn},anyFalse:{fn:p.anyFalseFn},subsetOf:{fn:p.subsetOfFn,arity:{1:["AnyAtRoot"]}},supersetOf:{fn:p.supersetOfFn,arity:{1:["AnyAtRoot"]}},isDistinct:{fn:p.isDistinctFn},distinct:{fn:p.distinctFn},count:{fn:p.countFn},where:{fn:h.whereMacro,arity:{1:["Expr"]}},select:{fn:h.selectMacro,arity:{1:["Expr"]}},aggregate:{fn:f.aggregateMacro,arity:{1:["Expr"],2:["Expr","Integer"]}},single:{fn:h.singleFn},first:{fn:h.firstFn},last:{fn:h.lastFn},type:{fn:S.typeFn,arity:{0:[]}},ofType:{fn:h.ofTypeFn,arity:{1:["TypeSpecifier"]}},is:{fn:S.isFn,arity:{1:["TypeSpecifier"]}},tail:{fn:h.tailFn},take:{fn:h.takeFn,arity:{1:["Integer"]}},skip:{fn:h.skipFn,arity:{1:["Integer"]}},combine:{fn:d.combineFn,arity:{1:["AnyAtRoot"]}},union:{fn:d.union,arity:{1:["AnyAtRoot"]}},iif:{fn:y.iifMacro,arity:{2:["Expr","Expr"],3:["Expr","Expr","Expr"]}},trace:{fn:y.traceFn,arity:{0:[],1:["String"]}},toInteger:{fn:y.toInteger},toDecimal:{fn:y.toDecimal},toString:{fn:y.toString},toDateTime:{fn:y.toDateTime},toTime:{fn:y.toTime},toBoolean:{fn:y.toBoolean},toQuantity:{fn:y.toQuantity,arity:{0:[],1:["String"]}},convertsToBoolean:{fn:y.createConvertsToFn(y.toBoolean,"boolean")},convertsToInteger:{fn:y.createConvertsToFn(y.toInteger,"number")},convertsToDecimal:{fn:y.createConvertsToFn(y.toDecimal,"number")},convertsToString:{fn:y.createConvertsToFn(y.toString,"string")},convertsToDateTime:{fn:y.createConvertsToFn(y.toDateTime,C)},convertsToTime:{fn:y.createConvertsToFn(y.toTime,I)},convertsToQuantity:{fn:y.createConvertsToFn(y.toQuantity,b)},indexOf:{fn:x.indexOf,arity:{1:["String"]}},substring:{fn:x.substring,arity:{1:["Integer"],2:["Integer","Integer"]}},startsWith:{fn:x.startsWith,arity:{1:["String"]}},endsWith:{fn:x.endsWith,arity:{1:["String"]}},contains:{fn:x.containsFn,arity:{1:["String"]}},replace:{fn:x.replace,arity:{2:["String","String"]}},matches:{fn:x.matches,arity:{1:["String"]}},replaceMatches:{fn:x.replaceMatches,arity:{2:["String","String"]}},length:{fn:x.length},abs:{fn:v.abs},ceiling:{fn:v.ceiling},exp:{fn:v.exp},floor:{fn:v.floor},ln:{fn:v.ln},log:{fn:v.log,arity:{1:["Number"]},nullable:!0},power:{fn:v.power,arity:{1:["Number"]},nullable:!0},round:{fn:v.round,arity:{1:["Number"]}},sqrt:{fn:v.sqrt},truncate:{fn:v.truncate},now:{fn:_.now},today:{fn:_.today},repeat:{fn:h.repeatMacro,arity:{1:["Expr"]}},children:{fn:T.children},descendants:{fn:T.descendants},"|":{fn:d.union,arity:{2:["Any","Any"]}},"=":{fn:g.equal,arity:{2:["Any","Any"]},nullable:!0},"!=":{fn:g.unequal,arity:{2:["Any","Any"]},nullable:!0},"~":{fn:g.equival,arity:{2:["Any","Any"]}},"!~":{fn:g.unequival,arity:{2:["Any","Any"]}},"<":{fn:g.lt,arity:{2:["Any","Any"]},nullable:!0},">":{fn:g.gt,arity:{2:["Any","Any"]},nullable:!0},"<=":{fn:g.lte,arity:{2:["Any","Any"]},nullable:!0},">=":{fn:g.gte,arity:{2:["Any","Any"]},nullable:!0},containsOp:{fn:m.contains,arity:{2:["Any","Any"]}},inOp:{fn:m.in,arity:{2:["Any","Any"]}},isOp:{fn:S.isFn,arity:{2:["Any","TypeSpecifier"]}},"&":{fn:v.amp,arity:{2:["String","String"]}},"+":{fn:v.plus,arity:{2:["Any","Any"]},nullable:!0},"-":{fn:v.minus,arity:{2:["Any","Any"]},nullable:!0},"*":{fn:v.mul,arity:{2:["Number","Number"]},nullable:!0},"/":{fn:v.div,arity:{2:["Number","Number"]},nullable:!0},mod:{fn:v.mod,arity:{2:["Number","Number"]},nullable:!0},div:{fn:v.intdiv,arity:{2:["Number","Number"]},nullable:!0},or:{fn:E.orOp,arity:{2:[["Boolean"],["Boolean"]]}},and:{fn:E.andOp,arity:{2:[["Boolean"],["Boolean"]]}},xor:{fn:E.xorOp,arity:{2:[["Boolean"],["Boolean"]]}},implies:{fn:E.impliesOp,arity:{2:[["Boolean"],["Boolean"]]}}},l.InvocationExpression=function(t,e,n){return n.children.reduce((function(e,n){return l.doEval(t,e,n)}),e)},l.TermExpression=function(t,e,n){return e&&(e=e.map((function(t){return t instanceof Object&&t.resourceType?O(t,t.resourceType):t}))),l.doEval(t,e,n.children[0])},l.PolarityExpression=function(t,e,n){var r=n.terminalNodeText[0],i=l.doEval(t,e,n.children[0]);if(1!=i.length)throw new Error("Unary "+r+" can only be applied to an individual number.");if("number"!=typeof i[0]||isNaN(i[0]))throw new Error("Unary "+r+" can only be applied to a number.");return"-"===r&&(i[0]=-i[0]),i},l.TypeSpecifier=function(t,e,n){var r,o,a=n.text.split(".").map((function(t){return t.replace(/(^`|`$)/g,"")}));switch(a.length){case 2:var s=i(a,2);r=s[0],o=s[1];break;case 1:o=i(a,1)[0];break;default:throw new Error("Expected TypeSpecifier node, got "+JSON.stringify(n))}return new D({namespace:r,name:o})},l.ExternalConstantTerm=function(t,e,n){var r=n.children[0].children[0],i=l.Identifier(t,e,r)[0],o=t.vars[i];return void 0===o?[]:o instanceof Array?o:[o]},l.LiteralTerm=function(t,e,n){var r=n.children[0];return r?l.doEval(t,e,r):[n.text]},l.StringLiteral=function(t,e,n){var r=n.text.replace(/(^'|'$)/g,"");return[r=r.replace(/\\(u\d{4}|.)/g,(function(t,e){switch(t){case"\\r":return"\r";case"\\n":return"\n";case"\\t":return"\t";case"\\f":return"\f";default:return e.length>1?String.fromCharCode("0x"+e.slice(1)):e}}))]},l.BooleanLiteral=function(t,e,n){return"true"===n.text?[!0]:[!1]},l.QuantityLiteral=function(t,e,n){var r=n.children[0],i=Number(r.terminalNodeText[0]),o=r.children[0],a=o.terminalNodeText[0];return!a&&o.children&&(a=o.children[0].terminalNodeText[0]),[new b(i,a)]},l.DateTimeLiteral=function(t,e,n){var r=n.text.slice(1);return[new C(r)]},l.TimeLiteral=function(t,e,n){var r=n.text.slice(1);return[new I(r)]},l.NumberLiteral=function(t,e,n){return[Number(n.text)]},l.Identifier=function(t,e,n){return[n.text.replace(/(^`|`$)/g,"")]},l.InvocationTerm=function(t,e,n){return l.doEval(t,e,n.children[0])},l.MemberInvocation=function(t,e,n){var r=l.doEval(t,e,n.children[0])[0],i=t.model;return e?u.isCapitalized(r)?e.filter((function(t){return t instanceof A&&t.path===r})):e.reduce((function(t,e){var n,a=(e=O(e)).path+"."+r;if(i){var s=i.pathsDefinedElsewhere[a];s&&(a=s)}var c=i&&i.choiceTypePaths[a];if(c){var l,p=function(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=o(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,u=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return s=t.done,t},e:function(t){u=!0,a=t},f:function(){try{s||null==n.return||n.return()}finally{if(u)throw a}}}}(c);try{for(p.s();!(l=p.n()).done;){var h=l.value,f=r+h;if(n=e.data[f]){a=h;break}}}catch(t){p.e(t)}finally{p.f()}}else n=e.data[r];return u.isSome(n)?(Array.isArray(n)?t=t.concat(n.map((function(t){return O(t,a)}))):t.push(O(n,a)),t):t}),[]):[]},l.IndexerExpression=function(t,e,n){var r=n.children[0],i=n.children[1],o=l.doEval(t,e,r),a=l.doEval(t,e,i);if(u.isEmpty(a))return[];var s=parseInt(a[0]);return o&&u.isSome(s)&&o.length>s&&s>=0?[o[s]]:[]},l.Functn=function(t,e,n){return n.children.map((function(n){return l.doEval(t,e,n)}))},l.realizeParams=function(t,e,n){return n&&n[0]&&n[0].children?n[0].children.map((function(n){return l.doEval(t,e,n)})):[]};var w={Integer:function(t){var e=u.valData(t);if("number"!=typeof e||!Number.isInteger(e))throw new Error("Expected integer, got: "+JSON.stringify(e));return e},Boolean:function(t){var e=u.valData(t);if(!0===e||!1===e)return e;throw new Error("Expected boolean, got: "+JSON.stringify(e))},Number:function(t){var e=u.valData(t);if("number"!=typeof e)throw new Error("Expected number, got: "+JSON.stringify(e));return e},String:function(t){var e=u.valData(t);if("string"!=typeof e)throw new Error("Expected string, got: "+JSON.stringify(e));return e}};function L(t,e,n,r){if(t.currentData=e,"Expr"===n)return function(e){return l.doEval(t,u.arraify(e),r)};if("AnyAtRoot"===n)return l.doEval(t,t.dataRoot,r);if("Identifier"===n){if("TermExpression"==r.type)return r.text;throw new Error("Expected identifier node, got "+JSON.stringify(r))}if("TypeSpecifier"===n)return l.TypeSpecifier(t,e,r);var i=l.doEval(t,e,r);if("Any"===n)return i;if(Array.isArray(n)){if(0==i.length)return[];n=n[0]}var o=w[n];if(i.length>1)throw new Error("Unexpected collection"+JSON.stringify(i)+"; expected singleton of type "+n);if(0==i.length)return[];if(o)return o(i[0]);throw console.error(n,r),new Error("IMPL me for "+n)}function N(t){return null==t||u.isEmpty(t)}function P(t,e,n,r){var i=l.invocationTable[e];if(i&&i.fn){var o=r?r.length:0;if(2!=o)throw new Error("Infix invoke should have arity 2");var a=i.arity[o];if(a){for(var s=[],c=0;c<o;c++){var p=a[c],h=r[c];s.push(L(t,n,p,h))}if(i.nullable&&s.some(N))return[];var f=i.fn.apply(t,s);return u.arraify(f)}return console.log(e+" wrong arity: got "+o),[]}throw new Error("Not impl "+e)}l.FunctionInvocation=function(t,e,n){var r=l.doEval(t,e,n.children[0]),i=r[0];return r.shift(),function(t,e,n,r){var i,o=l.invocationTable[e];if(o){if(o.arity){var a=r?r.length:0,s=o.arity[a];if(s){for(var c=[],p=0;p<a;p++){var h=s[p],f=r[p];c.push(L(t,n,h,f))}return c.unshift(n),o.nullable&&c.some(N)?[]:(i=o.fn.apply(t,c),u.arraify(i))}return console.log(e+" wrong arity: got "+a),[]}if(r)throw new Error(e+" expects no params");return i=o.fn.call(t,u.arraify(n)),u.arraify(i)}throw new Error("Not implemented: "+e)}(t,i,e,r&&r[0]&&r[0].children)},l.ParamList=function(t,e,n){return n},l.UnionExpression=function(t,e,n){return P(t,"|",e,n.children)},l.ThisInvocation=function(t){return u.arraify(t.currentData)},l.TotalInvocation=function(t){return u.arraify(t.$total)},l.IndexInvocation=function(t){return u.arraify(t.$index)},l.OpExpression=function(t,e,n){return P(t,n.terminalNodeText[0],e,n.children)},l.AliasOpExpression=function(t){return function(e,n,r){var i=r.terminalNodeText[0],o=t[i];if(!o)throw new Error("Do not know how to alias "+i+" by "+JSON.stringify(t));return P(e,o,n,r.children)}},l.NullLiteral=function(){return[]},l.ParenthesizedTerm=function(t,e,n){return l.doEval(t,e,n.children[0])},l.evalTable={BooleanLiteral:l.BooleanLiteral,EqualityExpression:l.OpExpression,FunctionInvocation:l.FunctionInvocation,Functn:l.Functn,Identifier:l.Identifier,IndexerExpression:l.IndexerExpression,InequalityExpression:l.OpExpression,InvocationExpression:l.InvocationExpression,AdditiveExpression:l.OpExpression,MultiplicativeExpression:l.OpExpression,TypeExpression:l.AliasOpExpression({is:"isOp"}),MembershipExpression:l.AliasOpExpression({contains:"containsOp",in:"inOp"}),NullLiteral:l.NullLiteral,InvocationTerm:l.InvocationTerm,LiteralTerm:l.LiteralTerm,MemberInvocation:l.MemberInvocation,NumberLiteral:l.NumberLiteral,ParamList:l.ParamList,ParenthesizedTerm:l.ParenthesizedTerm,StringLiteral:l.StringLiteral,TermExpression:l.TermExpression,ThisInvocation:l.ThisInvocation,TotalInvocation:l.TotalInvocation,IndexInvocation:l.IndexInvocation,UnionExpression:l.UnionExpression,OrExpression:l.OpExpression,ImpliesExpression:l.OpExpression,AndExpression:l.OpExpression,XorExpression:l.OpExpression},l.doEval=function(t,e,n){var r=l.evalTable[n.type]||l[n.type];if(r)return r.call(l,t,e,n);throw new Error("No "+n.type+" evaluator ")};var k=function(t){return s.parse(t)};function F(t,e,n,i){c.reset();var o=u.arraify(t),a={context:t,ucum:"http://unitsofmeasure.org"},s={dataRoot:o,vars:Object.assign(a,n),model:i},p=l.doEval(s,o,e.children[0]);return p=function t(e){if(e=u.valData(e),Array.isArray(e))for(var n=0,i=e.length;n<i;++n)e[n]=t(e[n]);else if("object"===r(e)&&!(e instanceof R))for(var o=0,a=Object.keys(e);o<a.length;o++){var s=a[o];e[s]=t(e[s])}return e}(p)}t.exports={parse:k,compile:function(t,e){var n=k(t);return function(t,r){return F(t,n,r,e)}},evaluate:function(t,e,n,r){return F(t,s.parse(e),n,r)},ucumUtils:n(36).UcumLhcUtils.getInstance()}},function(t,e,n){function r(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,u=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return s=t.done,t},e:function(t){u=!0,a=t},f:function(){try{s||null==n.return||n.return()}finally{if(u)throw a}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var o=n(14),a=n(62).FHIRPathLexer,s=n(63).FHIRPathParser,u=n(34).FHIRPathListener,c=function(t){return o.error.ErrorListener.call(this),this.errors=t,this};(c.prototype=Object.create(o.error.ErrorListener.prototype)).constructor=c,c.prototype.syntaxError=function(t,e,n,r,i,o){this.errors.push([t,e,n,r,i,o])};t.exports={parse:function(t){var e=new o.InputStream(t),n=new a(e),i=new o.CommonTokenStream(n),l=new s(i);l.buildParseTrees=!0;var p=[],h=new c(p);n.removeErrorListeners(),n.addErrorListener(h),l.removeErrorListeners(),l.addErrorListener(h);var f=l.expression();function d(){return u.call(this),this}d.prototype=Object.create(u.prototype),d.prototype.constructor=d;for(var y,g={},m=[g],v=function(){var t=T[x];t.startsWith("enter")?d.prototype[t]=function(e){var n=m[m.length-1],i=t.slice(5);(y={type:i}).text=e.getText(),n.children||(n.children=[]),n.children.push(y),m.push(y),y.terminalNodeText=[];var o,a=r(e.children);try{for(a.s();!(o=a.n()).done;){var s=o.value;s.symbol&&y.terminalNodeText.push(s.getText())}}catch(t){a.e(t)}finally{a.f()}}:t.startsWith("exit")&&(d.prototype[t]=function(){m.pop()})},x=0,T=Object.keys(u.prototype);x<T.length;x++)v();var _=new d;if(o.tree.ParseTreeWalker.DEFAULT.walk(_,f),p.length>0){for(var E=[],S=0,C=p.length;S<C;++S){var I=p[S],b="line: "+I[2]+"; column: "+I[3]+"; message: "+I[4];E.push(b)}var R=new Error(E.join("\n"));throw R.errors=p,R}return g}}},function(t,e,n){e.ATN=n(9).ATN,e.ATNDeserializer=n(25).ATNDeserializer,e.LexerATNSimulator=n(49).LexerATNSimulator,e.ParserATNSimulator=n(52).ParserATNSimulator,e.PredictionMode=n(30).PredictionMode},function(t,e,n){var r=n(0).Set,i=n(0).BitSet,o=n(1).Token,a=n(15).ATNConfig,s=(n(2).Interval,n(2).IntervalSet),u=n(3).RuleStopState,c=n(10).RuleTransition,l=n(10).NotSetTransition,p=n(10).WildcardTransition,h=n(10).AbstractPredicateTransition,f=n(6),d=f.predictionContextFromRuleContext,y=f.PredictionContext,g=f.SingletonPredictionContext;function m(t){this.atn=t}m.HIT_PRED=o.INVALID_TYPE,m.prototype.getDecisionLookahead=function(t){if(null===t)return null;for(var e=t.transitions.length,n=[],o=0;o<e;o++){n[o]=new s;var a=new r;this._LOOK(t.transition(o).target,null,y.EMPTY,n[o],a,new i,!1,!1),(0===n[o].length||n[o].contains(m.HIT_PRED))&&(n[o]=null)}return n},m.prototype.LOOK=function(t,e,n){var o=new s,a=null!==(n=n||null)?d(t.atn,n):null;return this._LOOK(t,e,a,o,new r,new i,!0,!0),o},m.prototype._LOOK=function(t,e,n,r,i,s,f,d){var v=new a({state:t,alt:0,context:n},null);if(!i.contains(v)){if(i.add(v),t===e){if(null===n)return void r.addOne(o.EPSILON);if(n.isEmpty()&&d)return void r.addOne(o.EOF)}if(t instanceof u){if(null===n)return void r.addOne(o.EPSILON);if(n.isEmpty()&&d)return void r.addOne(o.EOF);if(n!==y.EMPTY){for(var x=0;x<n.length;x++){var T=this.atn.states[n.getReturnState(x)],_=s.contains(T.ruleIndex);try{s.remove(T.ruleIndex),this._LOOK(T,e,n.getParent(x),r,i,s,f,d)}finally{_&&s.add(T.ruleIndex)}}return}}for(var E=0;E<t.transitions.length;E++){var S=t.transitions[E];if(S.constructor===c){if(s.contains(S.target.ruleIndex))continue;var C=g.create(n,S.followState.stateNumber);try{s.add(S.target.ruleIndex),this._LOOK(S.target,e,C,r,i,s,f,d)}finally{s.remove(S.target.ruleIndex)}}else if(S instanceof h)f?this._LOOK(S.target,e,n,r,i,s,f,d):r.addOne(m.HIT_PRED);else if(S.isEpsilon)this._LOOK(S.target,e,n,r,i,s,f,d);else if(S.constructor===p)r.addRange(o.MIN_USER_TOKEN_TYPE,this.atn.maxTokenType);else{var I=S.label;null!==I&&(S instanceof l&&(I=I.complement(o.MIN_USER_TOKEN_TYPE,this.atn.maxTokenType)),r.addSet(I))}}}},e.LL1Analyzer=m},function(t,e){function n(){}n.LEXER=0,n.PARSER=1,e.ATNType=n},function(t,e,n){var r=n(1).Token,i=n(17).Lexer,o=n(9).ATN,a=n(29).ATNSimulator,s=n(13).DFAState,u=(n(11).ATNConfigSet,n(11).OrderedATNConfigSet),c=n(6).PredictionContext,l=n(6).SingletonPredictionContext,p=n(3).RuleStopState,h=n(15).LexerATNConfig,f=n(10).Transition,d=n(51).LexerActionExecutor,y=n(5).LexerNoViableAltException;function g(t){t.index=-1,t.line=0,t.column=-1,t.dfaState=null}function m(){return g(this),this}function v(t,e,n,r){return a.call(this,e,r),this.decisionToDFA=n,this.recog=t,this.startIndex=-1,this.line=1,this.column=0,this.mode=i.DEFAULT_MODE,this.prevAccept=new m,this}m.prototype.reset=function(){g(this)},v.prototype=Object.create(a.prototype),v.prototype.constructor=v,v.debug=!1,v.dfa_debug=!1,v.MIN_DFA_EDGE=0,v.MAX_DFA_EDGE=127,v.match_calls=0,v.prototype.copyState=function(t){this.column=t.column,this.line=t.line,this.mode=t.mode,this.startIndex=t.startIndex},v.prototype.match=function(t,e){this.match_calls+=1,this.mode=e;var n=t.mark();try{this.startIndex=t.index,this.prevAccept.reset();var r=this.decisionToDFA[e];return null===r.s0?this.matchATN(t):this.execATN(t,r.s0)}finally{t.release(n)}},v.prototype.reset=function(){this.prevAccept.reset(),this.startIndex=-1,this.line=1,this.column=0,this.mode=i.DEFAULT_MODE},v.prototype.matchATN=function(t){var e=this.atn.modeToStartState[this.mode];v.debug&&console.log("matchATN mode "+this.mode+" start: "+e);var n=this.mode,r=this.computeStartState(t,e),i=r.hasSemanticContext;r.hasSemanticContext=!1;var o=this.addDFAState(r);i||(this.decisionToDFA[this.mode].s0=o);var a=this.execATN(t,o);return v.debug&&console.log("DFA after matchATN: "+this.decisionToDFA[n].toLexerString()),a},v.prototype.execATN=function(t,e){v.debug&&console.log("start state closure="+e.configs),e.isAcceptState&&this.captureSimState(this.prevAccept,t,e);for(var n=t.LA(1),i=e;;){v.debug&&console.log("execATN loop starting closure: "+i.configs);var o=this.getExistingTargetState(i,n);if(null===o&&(o=this.computeTargetState(t,i,n)),o===a.ERROR)break;if(n!==r.EOF&&this.consume(t),o.isAcceptState&&(this.captureSimState(this.prevAccept,t,o),n===r.EOF))break;n=t.LA(1),i=o}return this.failOrAccept(this.prevAccept,t,i.configs,n)},v.prototype.getExistingTargetState=function(t,e){if(null===t.edges||e<v.MIN_DFA_EDGE||e>v.MAX_DFA_EDGE)return null;var n=t.edges[e-v.MIN_DFA_EDGE];return void 0===n&&(n=null),v.debug&&null!==n&&console.log("reuse state "+t.stateNumber+" edge to "+n.stateNumber),n},v.prototype.computeTargetState=function(t,e,n){var r=new u;return this.getReachableConfigSet(t,e.configs,r,n),0===r.items.length?(r.hasSemanticContext||this.addDFAEdge(e,n,a.ERROR),a.ERROR):this.addDFAEdge(e,n,null,r)},v.prototype.failOrAccept=function(t,e,n,i){if(null!==this.prevAccept.dfaState){var o=t.dfaState.lexerActionExecutor;return this.accept(e,o,this.startIndex,t.index,t.line,t.column),t.dfaState.prediction}if(i===r.EOF&&e.index===this.startIndex)return r.EOF;throw new y(this.recog,e,this.startIndex,n)},v.prototype.getReachableConfigSet=function(t,e,n,i){for(var a=o.INVALID_ALT_NUMBER,s=0;s<e.items.length;s++){var u=e.items[s],c=u.alt===a;if(!c||!u.passedThroughNonGreedyDecision){v.debug&&console.log("testing %s at %s\n",this.getTokenName(i),u.toString(this.recog,!0));for(var l=0;l<u.state.transitions.length;l++){var p=u.state.transitions[l],f=this.getReachableTarget(p,i);if(null!==f){var d=u.lexerActionExecutor;null!==d&&(d=d.fixOffsetBeforeMatch(t.index-this.startIndex));var y=i===r.EOF,g=new h({state:f,lexerActionExecutor:d},u);this.closure(t,g,n,c,!0,y)&&(a=u.alt)}}}}},v.prototype.accept=function(t,e,n,r,i,o){v.debug&&console.log("ACTION %s\n",e),t.seek(r),this.line=i,this.column=o,null!==e&&null!==this.recog&&e.execute(this.recog,t,n)},v.prototype.getReachableTarget=function(t,e){return t.matches(e,0,i.MAX_CHAR_VALUE)?t.target:null},v.prototype.computeStartState=function(t,e){for(var n=c.EMPTY,r=new u,i=0;i<e.transitions.length;i++){var o=e.transitions[i].target,a=new h({state:o,alt:i+1,context:n},null);this.closure(t,a,r,!1,!1,!1)}return r},v.prototype.closure=function(t,e,n,r,i,o){var a=null;if(v.debug&&console.log("closure("+e.toString(this.recog,!0)+")"),e.state instanceof p){if(v.debug&&(null!==this.recog?console.log("closure at %s rule stop %s\n",this.recog.ruleNames[e.state.ruleIndex],e):console.log("closure at rule stop %s\n",e)),null===e.context||e.context.hasEmptyPath()){if(null===e.context||e.context.isEmpty())return n.add(e),!0;n.add(new h({state:e.state,context:c.EMPTY},e)),r=!0}if(null!==e.context&&!e.context.isEmpty())for(var s=0;s<e.context.length;s++)if(e.context.getReturnState(s)!==c.EMPTY_RETURN_STATE){var u=e.context.getParent(s),l=this.atn.states[e.context.getReturnState(s)];a=new h({state:l,context:u},e),r=this.closure(t,a,n,r,i,o)}return r}e.state.epsilonOnlyTransitions||r&&e.passedThroughNonGreedyDecision||n.add(e);for(var f=0;f<e.state.transitions.length;f++){var d=e.state.transitions[f];null!==(a=this.getEpsilonTarget(t,e,d,n,i,o))&&(r=this.closure(t,a,n,r,i,o))}return r},v.prototype.getEpsilonTarget=function(t,e,n,o,a,s){var u=null;if(n.serializationType===f.RULE){var c=l.create(e.context,n.followState.stateNumber);u=new h({state:n.target,context:c},e)}else{if(n.serializationType===f.PRECEDENCE)throw"Precedence predicates are not supported in lexers.";if(n.serializationType===f.PREDICATE)v.debug&&console.log("EVAL rule "+n.ruleIndex+":"+n.predIndex),o.hasSemanticContext=!0,this.evaluatePredicate(t,n.ruleIndex,n.predIndex,a)&&(u=new h({state:n.target},e));else if(n.serializationType===f.ACTION)if(null===e.context||e.context.hasEmptyPath()){var p=d.append(e.lexerActionExecutor,this.atn.lexerActions[n.actionIndex]);u=new h({state:n.target,lexerActionExecutor:p},e)}else u=new h({state:n.target},e);else n.serializationType===f.EPSILON?u=new h({state:n.target},e):n.serializationType!==f.ATOM&&n.serializationType!==f.RANGE&&n.serializationType!==f.SET||s&&n.matches(r.EOF,0,i.MAX_CHAR_VALUE)&&(u=new h({state:n.target},e))}return u},v.prototype.evaluatePredicate=function(t,e,n,r){if(null===this.recog)return!0;if(!r)return this.recog.sempred(null,e,n);var i=this.column,o=this.line,a=t.index,s=t.mark();try{return this.consume(t),this.recog.sempred(null,e,n)}finally{this.column=i,this.line=o,t.seek(a),t.release(s)}},v.prototype.captureSimState=function(t,e,n){t.index=e.index,t.line=this.line,t.column=this.column,t.dfaState=n},v.prototype.addDFAEdge=function(t,e,n,r){if(void 0===n&&(n=null),void 0===r&&(r=null),null===n&&null!==r){var i=r.hasSemanticContext;if(r.hasSemanticContext=!1,n=this.addDFAState(r),i)return n}return e<v.MIN_DFA_EDGE||e>v.MAX_DFA_EDGE||(v.debug&&console.log("EDGE "+t+" -> "+n+" upon "+e),null===t.edges&&(t.edges=[]),t.edges[e-v.MIN_DFA_EDGE]=n),n},v.prototype.addDFAState=function(t){for(var e=new s(null,t),n=null,r=0;r<t.items.length;r++){var i=t.items[r];if(i.state instanceof p){n=i;break}}null!==n&&(e.isAcceptState=!0,e.lexerActionExecutor=n.lexerActionExecutor,e.prediction=this.atn.ruleToTokenType[n.state.ruleIndex]);var o=this.decisionToDFA[this.mode],a=o.states.get(e);if(null!==a)return a;var u=e;return u.stateNumber=o.states.length,t.setReadonly(!0),u.configs=t,o.states.add(u),u},v.prototype.getDFA=function(t){return this.decisionToDFA[t]},v.prototype.getText=function(t){return t.getText(this.startIndex,t.index-1)},v.prototype.consume=function(t){t.LA(1)==="\n".charCodeAt(0)?(this.line+=1,this.column=0):this.column+=1,t.consume()},v.prototype.getTokenName=function(t){return-1===t?"EOF":"'"+String.fromCharCode(t)+"'"},e.LexerATNSimulator=v},function(t,e,n){var r=n(1).CommonToken;function i(){return this}function o(t){return i.call(this),this.copyText=void 0!==t&&t,this}o.prototype=Object.create(i.prototype),o.prototype.constructor=o,o.DEFAULT=new o,o.prototype.create=function(t,e,n,i,o,a,s,u){var c=new r(t,e,i,o,a);return c.line=s,c.column=u,null!==n?c.text=n:this.copyText&&null!==t[1]&&(c.text=t[1].getText(o,a)),c},o.prototype.createThin=function(t,e){var n=new r(null,t);return n.text=e,n},e.CommonTokenFactory=o},function(t,e,n){var r=n(0).hashStuff,i=n(27).LexerIndexedCustomAction;function o(t){return this.lexerActions=null===t?[]:t,this.cachedHashCode=r(t),this}o.append=function(t,e){return new o(null===t?[e]:t.lexerActions.concat([e]))},o.prototype.fixOffsetBeforeMatch=function(t){for(var e=null,n=0;n<this.lexerActions.length;n++)!this.lexerActions[n].isPositionDependent||this.lexerActions[n]instanceof i||(null===e&&(e=this.lexerActions.concat([])),e[n]=new i(t,this.lexerActions[n]));return null===e?this:new o(e)},o.prototype.execute=function(t,e,n){var r=!1,o=e.index;try{for(var a=0;a<this.lexerActions.length;a++){var s=this.lexerActions[a];if(s instanceof i){var u=s.offset;e.seek(n+u),s=s.action,r=n+u!==o}else s.isPositionDependent&&(e.seek(o),r=!1);s.execute(t)}}finally{r&&e.seek(o)}},o.prototype.hashCode=function(){return this.cachedHashCode},o.prototype.updateHashCode=function(t){t.update(this.cachedHashCode)},o.prototype.equals=function(t){if(this===t)return!0;if(t instanceof o){if(this.cachedHashCode!=t.cachedHashCode)return!1;if(this.lexerActions.length!=t.lexerActions.length)return!1;for(var e=this.lexerActions.length,n=0;n<e;++n)if(!this.lexerActions[n].equals(t.lexerActions[n]))return!1;return!0}return!1},e.LexerActionExecutor=o},function(t,e,n){var r=n(0),i=r.Set,o=r.BitSet,a=r.DoubleDict,s=n(9).ATN,u=n(3).ATNState,c=n(15).ATNConfig,l=n(11).ATNConfigSet,p=n(1).Token,h=n(13).DFAState,f=n(13).PredPrediction,d=n(29).ATNSimulator,y=n(30).PredictionMode,g=n(16).RuleContext,m=(n(22).ParserRuleContext,n(12).SemanticContext),v=(n(3).StarLoopEntryState,n(3).RuleStopState),x=n(6).PredictionContext,T=n(2).Interval,_=n(10),E=_.Transition,S=_.SetTransition,C=_.NotSetTransition,I=_.RuleTransition,b=_.ActionTransition,R=n(5).NoViableAltException,A=n(6).SingletonPredictionContext,D=n(6).predictionContextFromRuleContext;function O(t,e,n,r){return d.call(this,e,r),this.parser=t,this.decisionToDFA=n,this.predictionMode=y.LL,this._input=null,this._startIndex=0,this._outerContext=null,this._dfa=null,this.mergeCache=null,this}O.prototype=Object.create(d.prototype),O.prototype.constructor=O,O.prototype.debug=!1,O.prototype.debug_closure=!1,O.prototype.debug_add=!1,O.prototype.debug_list_atn_decisions=!1,O.prototype.dfa_debug=!1,O.prototype.retry_debug=!1,O.prototype.reset=function(){},O.prototype.adaptivePredict=function(t,e,n){(this.debug||this.debug_list_atn_decisions)&&console.log("adaptivePredict decision "+e+" exec LA(1)=="+this.getLookaheadName(t)+" line "+t.LT(1).line+":"+t.LT(1).column),this._input=t,this._startIndex=t.index,this._outerContext=n;var r=this.decisionToDFA[e];this._dfa=r;var i=t.mark(),o=t.index;try{var a;if(null===(a=r.precedenceDfa?r.getPrecedenceStartState(this.parser.getPrecedence()):r.s0)){null===n&&(n=g.EMPTY),(this.debug||this.debug_list_atn_decisions)&&console.log("predictATN decision "+r.decision+" exec LA(1)=="+this.getLookaheadName(t)+", outerContext="+n.toString(this.parser.ruleNames));var s=this.computeStartState(r.atnStartState,g.EMPTY,!1);r.precedenceDfa?(r.s0.configs=s,s=this.applyPrecedenceFilter(s),a=this.addDFAState(r,new h(null,s)),r.setPrecedenceStartState(this.parser.getPrecedence(),a)):(a=this.addDFAState(r,new h(null,s)),r.s0=a)}var u=this.execATN(r,a,t,o,n);return this.debug&&console.log("DFA after predictATN: "+r.toString(this.parser.literalNames)),u}finally{this._dfa=null,this.mergeCache=null,t.seek(o),t.release(i)}},O.prototype.execATN=function(t,e,n,r,i){var o;(this.debug||this.debug_list_atn_decisions)&&console.log("execATN decision "+t.decision+" exec LA(1)=="+this.getLookaheadName(n)+" line "+n.LT(1).line+":"+n.LT(1).column);var a=e;this.debug&&console.log("s0 = "+e);for(var u=n.LA(1);;){var c=this.getExistingTargetState(a,u);if(null===c&&(c=this.computeTargetState(t,a,u)),c===d.ERROR){var l=this.noViableAlt(n,i,a.configs,r);if(n.seek(r),(o=this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(a.configs,i))!==s.INVALID_ALT_NUMBER)return o;throw l}if(c.requiresFullContext&&this.predictionMode!==y.SLL){var h=null;if(null!==c.predicates){this.debug&&console.log("DFA state has preds in DFA sim LL failover");var f=n.index;if(f!==r&&n.seek(r),1===(h=this.evalSemanticContext(c.predicates,i,!0)).length)return this.debug&&console.log("Full LL avoided"),h.minValue();f!==r&&n.seek(f)}this.dfa_debug&&console.log("ctx sensitive state "+i+" in "+c);var g=this.computeStartState(t.atnStartState,i,!0);return this.reportAttemptingFullContext(t,h,c.configs,r,n.index),o=this.execATNWithFullContext(t,c,g,n,r,i)}if(c.isAcceptState){if(null===c.predicates)return c.prediction;var m=n.index;n.seek(r);var v=this.evalSemanticContext(c.predicates,i,!0);if(0===v.length)throw this.noViableAlt(n,i,c.configs,r);return 1===v.length||this.reportAmbiguity(t,c,r,m,!1,v,c.configs),v.minValue()}a=c,u!==p.EOF&&(n.consume(),u=n.LA(1))}},O.prototype.getExistingTargetState=function(t,e){var n=t.edges;return null===n?null:n[e+1]||null},O.prototype.computeTargetState=function(t,e,n){var i=this.computeReachSet(e.configs,n,!1);if(null===i)return this.addDFAEdge(t,e,n,d.ERROR),d.ERROR;var o=new h(null,i),a=this.getUniqueAlt(i);if(this.debug){var u=y.getConflictingAltSubsets(i);console.log("SLL altSubSets="+r.arrayToString(u)+", previous="+e.configs+", configs="+i+", predict="+a+", allSubsetsConflict="+y.allSubsetsConflict(u)+", conflictingAlts="+this.getConflictingAlts(i))}return a!==s.INVALID_ALT_NUMBER?(o.isAcceptState=!0,o.configs.uniqueAlt=a,o.prediction=a):y.hasSLLConflictTerminatingPrediction(this.predictionMode,i)&&(o.configs.conflictingAlts=this.getConflictingAlts(i),o.requiresFullContext=!0,o.isAcceptState=!0,o.prediction=o.configs.conflictingAlts.minValue()),o.isAcceptState&&o.configs.hasSemanticContext&&(this.predicateDFAState(o,this.atn.getDecisionState(t.decision)),null!==o.predicates&&(o.prediction=s.INVALID_ALT_NUMBER)),o=this.addDFAEdge(t,e,n,o)},O.prototype.predicateDFAState=function(t,e){var n=e.transitions.length,r=this.getConflictingAltsOrUniqueAlt(t.configs),i=this.getPredsForAmbigAlts(r,t.configs,n);null!==i?(t.predicates=this.getPredicatePredictions(r,i),t.prediction=s.INVALID_ALT_NUMBER):t.prediction=r.minValue()},O.prototype.execATNWithFullContext=function(t,e,n,r,i,o){(this.debug||this.debug_list_atn_decisions)&&console.log("execATNWithFullContext "+n);var a=!1,u=null,c=n;r.seek(i);for(var l=r.LA(1),h=-1;;){if(null===(u=this.computeReachSet(c,l,!0))){var f=this.noViableAlt(r,o,c,i);r.seek(i);var d=this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(c,o);if(d!==s.INVALID_ALT_NUMBER)return d;throw f}var g=y.getConflictingAltSubsets(u);if(this.debug&&console.log("LL altSubSets="+g+", predict="+y.getUniqueAlt(g)+", resolvesToJustOneViableAlt="+y.resolvesToJustOneViableAlt(g)),u.uniqueAlt=this.getUniqueAlt(u),u.uniqueAlt!==s.INVALID_ALT_NUMBER){h=u.uniqueAlt;break}if(this.predictionMode!==y.LL_EXACT_AMBIG_DETECTION){if((h=y.resolvesToJustOneViableAlt(g))!==s.INVALID_ALT_NUMBER)break}else if(y.allSubsetsConflict(g)&&y.allSubsetsEqual(g)){a=!0,h=y.getSingleViableAlt(g);break}c=u,l!==p.EOF&&(r.consume(),l=r.LA(1))}return u.uniqueAlt!==s.INVALID_ALT_NUMBER?(this.reportContextSensitivity(t,h,u,i,r.index),h):(this.reportAmbiguity(t,e,i,r.index,a,null,u),h)},O.prototype.computeReachSet=function(t,e,n){this.debug&&console.log("in computeReachSet, starting closure: "+t),null===this.mergeCache&&(this.mergeCache=new a);for(var r=new l(n),o=null,u=0;u<t.items.length;u++){var h=t.items[u];if(this.debug_add&&console.log("testing "+this.getTokenName(e)+" at "+h),h.state instanceof v)(n||e===p.EOF)&&(null===o&&(o=[]),o.push(h),this.debug_add&&console.log("added "+h+" to skippedStopStates"));else for(var f=0;f<h.state.transitions.length;f++){var d=h.state.transitions[f],g=this.getReachableTarget(d,e);if(null!==g){var m=new c({state:g},h);r.add(m,this.mergeCache),this.debug_add&&console.log("added "+m+" to intermediate")}}}var x=null;if(null===o&&e!==p.EOF&&(1===r.items.length||this.getUniqueAlt(r)!==s.INVALID_ALT_NUMBER)&&(x=r),null===x){x=new l(n);for(var T=new i,_=e===p.EOF,E=0;E<r.items.length;E++)this.closure(r.items[E],x,T,!1,n,_)}if(e===p.EOF&&(x=this.removeAllConfigsNotInRuleStopState(x,x===r)),!(null===o||n&&y.hasConfigInRuleStopState(x)))for(var S=0;S<o.length;S++)x.add(o[S],this.mergeCache);return 0===x.items.length?null:x},O.prototype.removeAllConfigsNotInRuleStopState=function(t,e){if(y.allConfigsInRuleStopStates(t))return t;for(var n=new l(t.fullCtx),r=0;r<t.items.length;r++){var i=t.items[r];if(i.state instanceof v)n.add(i,this.mergeCache);else if(e&&i.state.epsilonOnlyTransitions)if(this.atn.nextTokens(i.state).contains(p.EPSILON)){var o=this.atn.ruleToStopState[i.state.ruleIndex];n.add(new c({state:o},i),this.mergeCache)}}return n},O.prototype.computeStartState=function(t,e,n){for(var r=D(this.atn,e),o=new l(n),a=0;a<t.transitions.length;a++){var s=t.transitions[a].target,u=new c({state:s,alt:a+1,context:r},null),p=new i;this.closure(u,o,p,!0,n,!1)}return o},O.prototype.applyPrecedenceFilter=function(t){for(var e,n=[],r=new l(t.fullCtx),i=0;i<t.items.length;i++)if(1===(e=t.items[i]).alt){var o=e.semanticContext.evalPrecedence(this.parser,this._outerContext);null!==o&&(n[e.state.stateNumber]=e.context,o!==e.semanticContext?r.add(new c({semanticContext:o},e),this.mergeCache):r.add(e,this.mergeCache))}for(i=0;i<t.items.length;i++)if(1!==(e=t.items[i]).alt){if(!e.precedenceFilterSuppressed){var a=n[e.state.stateNumber]||null;if(null!==a&&a.equals(e.context))continue}r.add(e,this.mergeCache)}return r},O.prototype.getReachableTarget=function(t,e){return t.matches(e,0,this.atn.maxTokenType)?t.target:null},O.prototype.getPredsForAmbigAlts=function(t,e,n){for(var i=[],o=0;o<e.items.length;o++){var a=e.items[o];t.contains(a.alt)&&(i[a.alt]=m.orContext(i[a.alt]||null,a.semanticContext))}var s=0;for(o=1;o<n+1;o++){var u=i[o]||null;null===u?i[o]=m.NONE:u!==m.NONE&&(s+=1)}return 0===s&&(i=null),this.debug&&console.log("getPredsForAmbigAlts result "+r.arrayToString(i)),i},O.prototype.getPredicatePredictions=function(t,e){for(var n=[],r=!1,i=1;i<e.length;i++){var o=e[i];null!==t&&t.contains(i)&&n.push(new f(o,i)),o!==m.NONE&&(r=!0)}return r?n:null},O.prototype.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule=function(t,e){var n=this.splitAccordingToSemanticValidity(t,e),r=n[0],i=n[1],o=this.getAltThatFinishedDecisionEntryRule(r);return o!==s.INVALID_ALT_NUMBER||i.items.length>0&&(o=this.getAltThatFinishedDecisionEntryRule(i))!==s.INVALID_ALT_NUMBER?o:s.INVALID_ALT_NUMBER},O.prototype.getAltThatFinishedDecisionEntryRule=function(t){for(var e=[],n=0;n<t.items.length;n++){var r=t.items[n];(r.reachesIntoOuterContext>0||r.state instanceof v&&r.context.hasEmptyPath())&&e.indexOf(r.alt)<0&&e.push(r.alt)}return 0===e.length?s.INVALID_ALT_NUMBER:Math.min.apply(null,e)},O.prototype.splitAccordingToSemanticValidity=function(t,e){for(var n=new l(t.fullCtx),r=new l(t.fullCtx),i=0;i<t.items.length;i++){var o=t.items[i];if(o.semanticContext!==m.NONE)o.semanticContext.evaluate(this.parser,e)?n.add(o):r.add(o);else n.add(o)}return[n,r]},O.prototype.evalSemanticContext=function(t,e,n){for(var r=new o,i=0;i<t.length;i++){var a=t[i];if(a.pred!==m.NONE){var s=a.pred.evaluate(this.parser,e);if((this.debug||this.dfa_debug)&&console.log("eval pred "+a+"="+s),s&&((this.debug||this.dfa_debug)&&console.log("PREDICT "+a.alt),r.add(a.alt),!n))break}else if(r.add(a.alt),!n)break}return r},O.prototype.closure=function(t,e,n,r,i,o){this.closureCheckingStopState(t,e,n,r,i,0,o)},O.prototype.closureCheckingStopState=function(t,e,n,r,i,o,a){if((this.debug||this.debug_closure)&&(console.log("closure("+t.toString(this.parser,!0)+")"),t.reachesIntoOuterContext>50))throw"problem";if(t.state instanceof v){if(!t.context.isEmpty()){for(var s=0;s<t.context.length;s++)if(t.context.getReturnState(s)!==x.EMPTY_RETURN_STATE){var u=this.atn.states[t.context.getReturnState(s)],l=t.context.getParent(s),p={state:u,alt:t.alt,context:l,semanticContext:t.semanticContext},h=new c(p,null);h.reachesIntoOuterContext=t.reachesIntoOuterContext,this.closureCheckingStopState(h,e,n,r,i,o-1,a)}else{if(i){e.add(new c({state:t.state,context:x.EMPTY},t),this.mergeCache);continue}this.debug&&console.log("FALLING off rule "+this.getRuleName(t.state.ruleIndex)),this.closure_(t,e,n,r,i,o,a)}return}if(i)return void e.add(t,this.mergeCache);this.debug&&console.log("FALLING off rule "+this.getRuleName(t.state.ruleIndex))}this.closure_(t,e,n,r,i,o,a)},O.prototype.closure_=function(t,e,n,r,i,o,a){var s=t.state;s.epsilonOnlyTransitions||e.add(t,this.mergeCache);for(var u=0;u<s.transitions.length;u++)if(0!=u||!this.canDropLoopEntryEdgeInLeftRecursiveRule(t)){var c=s.transitions[u],l=r&&!(c instanceof b),p=this.getEpsilonTarget(t,c,l,0===o,i,a);if(null!==p){var h=o;if(t.state instanceof v){if(null!==this._dfa&&this._dfa.precedenceDfa&&c.outermostPrecedenceReturn===this._dfa.atnStartState.ruleIndex&&(p.precedenceFilterSuppressed=!0),p.reachesIntoOuterContext+=1,n.add(p)!==p)continue;e.dipsIntoOuterContext=!0,h-=1,this.debug&&console.log("dips into outer ctx: "+p)}else{if(!c.isEpsilon&&n.add(p)!==p)continue;c instanceof I&&h>=0&&(h+=1)}this.closureCheckingStopState(p,e,n,l,i,h,a)}}},O.prototype.canDropLoopEntryEdgeInLeftRecursiveRule=function(t){var e=t.state;if(e.stateType!=u.STAR_LOOP_ENTRY)return!1;if(e.stateType!=u.STAR_LOOP_ENTRY||!e.isPrecedenceDecision||t.context.isEmpty()||t.context.hasEmptyPath())return!1;for(var n=t.context.length,r=0;r<n;r++){if((a=this.atn.states[t.context.getReturnState(r)]).ruleIndex!=e.ruleIndex)return!1}var i=e.transitions[0].target.endState.stateNumber,o=this.atn.states[i];for(r=0;r<n;r++){var a,s=t.context.getReturnState(r);if(1!=(a=this.atn.states[s]).transitions.length||!a.transitions[0].isEpsilon)return!1;var c=a.transitions[0].target;if((a.stateType!=u.BLOCK_END||c!=e)&&(a!=o&&c!=o&&(c.stateType!=u.BLOCK_END||1!=c.transitions.length||!c.transitions[0].isEpsilon||c.transitions[0].target!=e)))return!1}return!0},O.prototype.getRuleName=function(t){return null!==this.parser&&t>=0?this.parser.ruleNames[t]:"<rule "+t+">"},O.prototype.getEpsilonTarget=function(t,e,n,r,i,o){switch(e.serializationType){case E.RULE:return this.ruleTransition(t,e);case E.PRECEDENCE:return this.precedenceTransition(t,e,n,r,i);case E.PREDICATE:return this.predTransition(t,e,n,r,i);case E.ACTION:return this.actionTransition(t,e);case E.EPSILON:return new c({state:e.target},t);case E.ATOM:case E.RANGE:case E.SET:return o&&e.matches(p.EOF,0,1)?new c({state:e.target},t):null;default:return null}},O.prototype.actionTransition=function(t,e){if(this.debug){var n=-1==e.actionIndex?65535:e.actionIndex;console.log("ACTION edge "+e.ruleIndex+":"+n)}return new c({state:e.target},t)},O.prototype.precedenceTransition=function(t,e,n,i,o){this.debug&&(console.log("PRED (collectPredicates="+n+") "+e.precedence+">=_p, ctx dependent=true"),null!==this.parser&&console.log("context surrounding pred is "+r.arrayToString(this.parser.getRuleInvocationStack())));var a=null;if(n&&i)if(o){var s=this._input.index;this._input.seek(this._startIndex);var u=e.getPredicate().evaluate(this.parser,this._outerContext);this._input.seek(s),u&&(a=new c({state:e.target},t))}else{var l=m.andContext(t.semanticContext,e.getPredicate());a=new c({state:e.target,semanticContext:l},t)}else a=new c({state:e.target},t);return this.debug&&console.log("config from pred transition="+a),a},O.prototype.predTransition=function(t,e,n,i,o){this.debug&&(console.log("PRED (collectPredicates="+n+") "+e.ruleIndex+":"+e.predIndex+", ctx dependent="+e.isCtxDependent),null!==this.parser&&console.log("context surrounding pred is "+r.arrayToString(this.parser.getRuleInvocationStack())));var a=null;if(n&&(e.isCtxDependent&&i||!e.isCtxDependent))if(o){var s=this._input.index;this._input.seek(this._startIndex);var u=e.getPredicate().evaluate(this.parser,this._outerContext);this._input.seek(s),u&&(a=new c({state:e.target},t))}else{var l=m.andContext(t.semanticContext,e.getPredicate());a=new c({state:e.target,semanticContext:l},t)}else a=new c({state:e.target},t);return this.debug&&console.log("config from pred transition="+a),a},O.prototype.ruleTransition=function(t,e){this.debug&&console.log("CALL rule "+this.getRuleName(e.target.ruleIndex)+", ctx="+t.context);var n=e.followState,r=A.create(t.context,n.stateNumber);return new c({state:e.target,context:r},t)},O.prototype.getConflictingAlts=function(t){var e=y.getConflictingAltSubsets(t);return y.getAlts(e)},O.prototype.getConflictingAltsOrUniqueAlt=function(t){var e=null;return t.uniqueAlt!==s.INVALID_ALT_NUMBER?(e=new o).add(t.uniqueAlt):e=t.conflictingAlts,e},O.prototype.getTokenName=function(t){if(t===p.EOF)return"EOF";if(null!==this.parser&&null!==this.parser.literalNames){if(!(t>=this.parser.literalNames.length&&t>=this.parser.symbolicNames.length))return(this.parser.literalNames[t]||this.parser.symbolicNames[t])+"<"+t+">";console.log(t+" ttype out of range: "+this.parser.literalNames),console.log(""+this.parser.getInputStream().getTokens())}return""+t},O.prototype.getLookaheadName=function(t){return this.getTokenName(t.LA(1))},O.prototype.dumpDeadEndConfigs=function(t){console.log("dead end configs: ");for(var e=t.getDeadEndConfigs(),n=0;n<e.length;n++){var r=e[n],i="no edges";if(r.state.transitions.length>0){var o=r.state.transitions[0];if(o instanceof AtomTransition)i="Atom "+this.getTokenName(o.label);else if(o instanceof S){i=(o instanceof C?"~":"")+"Set "+o.set}}console.error(r.toString(this.parser,!0)+":"+i)}},O.prototype.noViableAlt=function(t,e,n,r){return new R(this.parser,t,t.get(r),t.LT(1),n,e)},O.prototype.getUniqueAlt=function(t){for(var e=s.INVALID_ALT_NUMBER,n=0;n<t.items.length;n++){var r=t.items[n];if(e===s.INVALID_ALT_NUMBER)e=r.alt;else if(r.alt!==e)return s.INVALID_ALT_NUMBER}return e},O.prototype.addDFAEdge=function(t,e,n,r){if(this.debug&&console.log("EDGE "+e+" -> "+r+" upon "+this.getTokenName(n)),null===r)return null;if(r=this.addDFAState(t,r),null===e||n<-1||n>this.atn.maxTokenType)return r;if(null===e.edges&&(e.edges=[]),e.edges[n+1]=r,this.debug){var i=null===this.parser?null:this.parser.literalNames,o=null===this.parser?null:this.parser.symbolicNames;console.log("DFA=\n"+t.toString(i,o))}return r},O.prototype.addDFAState=function(t,e){if(e==d.ERROR)return e;var n=t.states.get(e);return null!==n?n:(e.stateNumber=t.states.length,e.configs.readOnly||(e.configs.optimizeConfigs(this),e.configs.setReadonly(!0)),t.states.add(e),this.debug&&console.log("adding new DFA state: "+e),e)},O.prototype.reportAttemptingFullContext=function(t,e,n,r,i){if(this.debug||this.retry_debug){var o=new T(r,i+1);console.log("reportAttemptingFullContext decision="+t.decision+":"+n+", input="+this.parser.getTokenStream().getText(o))}null!==this.parser&&this.parser.getErrorListenerDispatch().reportAttemptingFullContext(this.parser,t,r,i,e,n)},O.prototype.reportContextSensitivity=function(t,e,n,r,i){if(this.debug||this.retry_debug){var o=new T(r,i+1);console.log("reportContextSensitivity decision="+t.decision+":"+n+", input="+this.parser.getTokenStream().getText(o))}null!==this.parser&&this.parser.getErrorListenerDispatch().reportContextSensitivity(this.parser,t,r,i,e,n)},O.prototype.reportAmbiguity=function(t,e,n,r,i,o,a){if(this.debug||this.retry_debug){var s=new T(n,r+1);console.log("reportAmbiguity "+o+":"+a+", input="+this.parser.getTokenStream().getText(s))}null!==this.parser&&this.parser.getErrorListenerDispatch().reportAmbiguity(this.parser,t,n,r,i,o,a)},e.ParserATNSimulator=O},function(t,e,n){e.DFA=n(54).DFA,e.DFASerializer=n(19).DFASerializer,e.LexerDFASerializer=n(19).LexerDFASerializer,e.PredPrediction=n(13).PredPrediction},function(t,e,n){var r=n(0).Set,i=n(13).DFAState,o=n(3).StarLoopEntryState,a=n(11).ATNConfigSet,s=n(19).DFASerializer,u=n(19).LexerDFASerializer;function c(t,e){if(void 0===e&&(e=0),this.atnStartState=t,this.decision=e,this._states=new r,this.s0=null,this.precedenceDfa=!1,t instanceof o&&t.isPrecedenceDecision){this.precedenceDfa=!0;var n=new i(null,new a);n.edges=[],n.isAcceptState=!1,n.requiresFullContext=!1,this.s0=n}return this}c.prototype.getPrecedenceStartState=function(t){if(!this.precedenceDfa)throw"Only precedence DFAs may contain a precedence start state.";return t<0||t>=this.s0.edges.length?null:this.s0.edges[t]||null},c.prototype.setPrecedenceStartState=function(t,e){if(!this.precedenceDfa)throw"Only precedence DFAs may contain a precedence start state.";t<0||(this.s0.edges[t]=e)},c.prototype.setPrecedenceDfa=function(t){if(this.precedenceDfa!==t){if(this._states=new DFAStatesSet,t){var e=new i(null,new a);e.edges=[],e.isAcceptState=!1,e.requiresFullContext=!1,this.s0=e}else this.s0=null;this.precedenceDfa=t}},Object.defineProperty(c.prototype,"states",{get:function(){return this._states}}),c.prototype.sortedStates=function(){return this._states.values().sort((function(t,e){return t.stateNumber-e.stateNumber}))},c.prototype.toString=function(t,e){return t=t||null,e=e||null,null===this.s0?"":new s(this,t,e).toString()},c.prototype.toLexerString=function(){return null===this.s0?"":new u(this).toString()},e.DFA=c},function(t,e,n){var r=n(4);e.Trees=n(24).Trees,e.RuleNode=r.RuleNode,e.ParseTreeListener=r.ParseTreeListener,e.ParseTreeVisitor=r.ParseTreeVisitor,e.ParseTreeWalker=r.ParseTreeWalker},function(t,e,n){e.RecognitionException=n(5).RecognitionException,e.NoViableAltException=n(5).NoViableAltException,e.LexerNoViableAltException=n(5).LexerNoViableAltException,e.InputMismatchException=n(5).InputMismatchException,e.FailedPredicateException=n(5).FailedPredicateException,e.DiagnosticErrorListener=n(57).DiagnosticErrorListener,e.BailErrorStrategy=n(33).BailErrorStrategy,e.ErrorListener=n(18).ErrorListener},function(t,e,n){var r=n(0).BitSet,i=n(18).ErrorListener,o=n(2).Interval;function a(t){return i.call(this),t=t||!0,this.exactOnly=t,this}a.prototype=Object.create(i.prototype),a.prototype.constructor=a,a.prototype.reportAmbiguity=function(t,e,n,r,i,a,s){if(!this.exactOnly||i){var u="reportAmbiguity d="+this.getDecisionDescription(t,e)+": ambigAlts="+this.getConflictingAlts(a,s)+", input='"+t.getTokenStream().getText(new o(n,r))+"'";t.notifyErrorListeners(u)}},a.prototype.reportAttemptingFullContext=function(t,e,n,r,i,a){var s="reportAttemptingFullContext d="+this.getDecisionDescription(t,e)+", input='"+t.getTokenStream().getText(new o(n,r))+"'";t.notifyErrorListeners(s)},a.prototype.reportContextSensitivity=function(t,e,n,r,i,a){var s="reportContextSensitivity d="+this.getDecisionDescription(t,e)+", input='"+t.getTokenStream().getText(new o(n,r))+"'";t.notifyErrorListeners(s)},a.prototype.getDecisionDescription=function(t,e){var n=e.decision,r=e.atnStartState.ruleIndex,i=t.ruleNames;if(r<0||r>=i.length)return""+n;var o=i[r]||null;return null===o||0===o.length?""+n:n+" ("+o+")"},a.prototype.getConflictingAlts=function(t,e){if(null!==t)return t;for(var n=new r,i=0;i<e.items.length;i++)n.add(e.items[i].alt);return"{"+n.values().join(", ")+"}"},e.DiagnosticErrorListener=a},function(t,e,n){var r=n(1).Token;function i(t,e){return this.name="<empty>",this.strdata=t,this.decodeToUnicodeCodePoints=e||!1,function(t){if(t._index=0,t.data=[],t.decodeToUnicodeCodePoints)for(var e=0;e<t.strdata.length;){var n=t.strdata.codePointAt(e);t.data.push(n),e+=n<=65535?1:2}else for(e=0;e<t.strdata.length;e++){var r=t.strdata.charCodeAt(e);t.data.push(r)}t._size=t.data.length}(this),this}n(31),n(32),Object.defineProperty(i.prototype,"index",{get:function(){return this._index}}),Object.defineProperty(i.prototype,"size",{get:function(){return this._size}}),i.prototype.reset=function(){this._index=0},i.prototype.consume=function(){if(this._index>=this._size)throw"cannot consume EOF";this._index+=1},i.prototype.LA=function(t){if(0===t)return 0;t<0&&(t+=1);var e=this._index+t-1;return e<0||e>=this._size?r.EOF:this.data[e]},i.prototype.LT=function(t){return this.LA(t)},i.prototype.mark=function(){return-1},i.prototype.release=function(t){},i.prototype.seek=function(t){t<=this._index?this._index=t:this._index=Math.min(t,this._size)},i.prototype.getText=function(t,e){if(e>=this._size&&(e=this._size-1),t>=this._size)return"";if(this.decodeToUnicodeCodePoints){for(var n="",r=t;r<=e;r++)n+=String.fromCodePoint(this.data[r]);return n}return this.strdata.slice(t,e+1)},i.prototype.toString=function(){return this.strdata},e.InputStream=i},function(t,e,n){var r=n(1).Token,i=n(60).BufferedTokenStream;function o(t,e){return i.call(this,t),this.channel=void 0===e?r.DEFAULT_CHANNEL:e,this}o.prototype=Object.create(i.prototype),o.prototype.constructor=o,o.prototype.adjustSeekIndex=function(t){return this.nextTokenOnChannel(t,this.channel)},o.prototype.LB=function(t){if(0===t||this.index-t<0)return null;for(var e=this.index,n=1;n<=t;)e=this.previousTokenOnChannel(e-1,this.channel),n+=1;return e<0?null:this.tokens[e]},o.prototype.LT=function(t){if(this.lazyInit(),0===t)return null;if(t<0)return this.LB(-t);for(var e=this.index,n=1;n<t;)this.sync(e+1)&&(e=this.nextTokenOnChannel(e+1,this.channel)),n+=1;return this.tokens[e]},o.prototype.getNumberOfOnChannelTokens=function(){var t=0;this.fill();for(var e=0;e<this.tokens.length;e++){var n=this.tokens[e];if(n.channel===this.channel&&(t+=1),n.type===r.EOF)break}return t},e.CommonTokenStream=o},function(t,e,n){var r=n(1).Token,i=n(17).Lexer,o=n(2).Interval;function a(){return this}function s(t){return a.call(this),this.tokenSource=t,this.tokens=[],this.index=-1,this.fetchedEOF=!1,this}s.prototype=Object.create(a.prototype),s.prototype.constructor=s,s.prototype.mark=function(){return 0},s.prototype.release=function(t){},s.prototype.reset=function(){this.seek(0)},s.prototype.seek=function(t){this.lazyInit(),this.index=this.adjustSeekIndex(t)},s.prototype.get=function(t){return this.lazyInit(),this.tokens[t]},s.prototype.consume=function(){if(!(this.index>=0&&(this.fetchedEOF?this.index<this.tokens.length-1:this.index<this.tokens.length))&&this.LA(1)===r.EOF)throw"cannot consume EOF";this.sync(this.index+1)&&(this.index=this.adjustSeekIndex(this.index+1))},s.prototype.sync=function(t){var e=t-this.tokens.length+1;return!(e>0)||this.fetch(e)>=e},s.prototype.fetch=function(t){if(this.fetchedEOF)return 0;for(var e=0;e<t;e++){var n=this.tokenSource.nextToken();if(n.tokenIndex=this.tokens.length,this.tokens.push(n),n.type===r.EOF)return this.fetchedEOF=!0,e+1}return t},s.prototype.getTokens=function(t,e,n){if(void 0===n&&(n=null),t<0||e<0)return null;this.lazyInit();var i=[];e>=this.tokens.length&&(e=this.tokens.length-1);for(var o=t;o<e;o++){var a=this.tokens[o];if(a.type===r.EOF)break;(null===n||n.contains(a.type))&&i.push(a)}return i},s.prototype.LA=function(t){return this.LT(t).type},s.prototype.LB=function(t){return this.index-t<0?null:this.tokens[this.index-t]},s.prototype.LT=function(t){if(this.lazyInit(),0===t)return null;if(t<0)return this.LB(-t);var e=this.index+t-1;return this.sync(e),e>=this.tokens.length?this.tokens[this.tokens.length-1]:this.tokens[e]},s.prototype.adjustSeekIndex=function(t){return t},s.prototype.lazyInit=function(){-1===this.index&&this.setup()},s.prototype.setup=function(){this.sync(0),this.index=this.adjustSeekIndex(0)},s.prototype.setTokenSource=function(t){this.tokenSource=t,this.tokens=[],this.index=-1,this.fetchedEOF=!1},s.prototype.nextTokenOnChannel=function(t,e){if(this.sync(t),t>=this.tokens.length)return-1;for(var n=this.tokens[t];n.channel!==this.channel;){if(n.type===r.EOF)return-1;t+=1,this.sync(t),n=this.tokens[t]}return t},s.prototype.previousTokenOnChannel=function(t,e){for(;t>=0&&this.tokens[t].channel!==e;)t-=1;return t},s.prototype.getHiddenTokensToRight=function(t,e){if(void 0===e&&(e=-1),this.lazyInit(),t<0||t>=this.tokens.length)throw t+" not in 0.."+this.tokens.length-1;var n=this.nextTokenOnChannel(t+1,i.DEFAULT_TOKEN_CHANNEL),r=t+1,o=-1===n?this.tokens.length-1:n;return this.filterForChannel(r,o,e)},s.prototype.getHiddenTokensToLeft=function(t,e){if(void 0===e&&(e=-1),this.lazyInit(),t<0||t>=this.tokens.length)throw t+" not in 0.."+this.tokens.length-1;var n=this.previousTokenOnChannel(t-1,i.DEFAULT_TOKEN_CHANNEL);if(n===t-1)return null;var r=n+1,o=t-1;return this.filterForChannel(r,o,e)},s.prototype.filterForChannel=function(t,e,n){for(var r=[],o=t;o<e+1;o++){var a=this.tokens[o];-1===n?a.channel!==i.DEFAULT_TOKEN_CHANNEL&&r.push(a):a.channel===n&&r.push(a)}return 0===r.length?null:r},s.prototype.getSourceName=function(){return this.tokenSource.getSourceName()},s.prototype.getText=function(t){this.lazyInit(),this.fill(),null==t&&(t=new o(0,this.tokens.length-1));var e=t.start;e instanceof r&&(e=e.tokenIndex);var n=t.stop;if(n instanceof r&&(n=n.tokenIndex),null===e||null===n||e<0||n<0)return"";n>=this.tokens.length&&(n=this.tokens.length-1);for(var i="",a=e;a<n+1;a++){var s=this.tokens[a];if(s.type===r.EOF)break;i+=s.text}return i},s.prototype.fill=function(){for(this.lazyInit();1e3===this.fetch(1e3););},e.BufferedTokenStream=s},function(t,e,n){var r=n(1).Token,i=n(4).ParseTreeListener,o=n(28).Recognizer,a=n(33).DefaultErrorStrategy,s=n(25).ATNDeserializer,u=n(26).ATNDeserializationOptions,c=n(4).TerminalNode,l=n(4).ErrorNode;function p(t){return i.call(this),this.parser=t,this}function h(t){return o.call(this),this._input=null,this._errHandler=new a,this._precedenceStack=[],this._precedenceStack.push(0),this._ctx=null,this.buildParseTrees=!0,this._tracer=null,this._parseListeners=null,this._syntaxErrors=0,this.setInputStream(t),this}p.prototype=Object.create(i.prototype),p.prototype.constructor=p,p.prototype.enterEveryRule=function(t){console.log("enter   "+this.parser.ruleNames[t.ruleIndex]+", LT(1)="+this.parser._input.LT(1).text)},p.prototype.visitTerminal=function(t){console.log("consume "+t.symbol+" rule "+this.parser.ruleNames[this.parser._ctx.ruleIndex])},p.prototype.exitEveryRule=function(t){console.log("exit    "+this.parser.ruleNames[t.ruleIndex]+", LT(1)="+this.parser._input.LT(1).text)},h.prototype=Object.create(o.prototype),h.prototype.contructor=h,h.bypassAltsAtnCache={},h.prototype.reset=function(){null!==this._input&&this._input.seek(0),this._errHandler.reset(this),this._ctx=null,this._syntaxErrors=0,this.setTrace(!1),this._precedenceStack=[],this._precedenceStack.push(0),null!==this._interp&&this._interp.reset()},h.prototype.match=function(t){var e=this.getCurrentToken();return e.type===t?(this._errHandler.reportMatch(this),this.consume()):(e=this._errHandler.recoverInline(this),this.buildParseTrees&&-1===e.tokenIndex&&this._ctx.addErrorNode(e)),e},h.prototype.matchWildcard=function(){var t=this.getCurrentToken();return t.type>0?(this._errHandler.reportMatch(this),this.consume()):(t=this._errHandler.recoverInline(this),this._buildParseTrees&&-1===t.tokenIndex&&this._ctx.addErrorNode(t)),t},h.prototype.getParseListeners=function(){return this._parseListeners||[]},h.prototype.addParseListener=function(t){if(null===t)throw"listener";null===this._parseListeners&&(this._parseListeners=[]),this._parseListeners.push(t)},h.prototype.removeParseListener=function(t){if(null!==this._parseListeners){var e=this._parseListeners.indexOf(t);e>=0&&this._parseListeners.splice(e,1),0===this._parseListeners.length&&(this._parseListeners=null)}},h.prototype.removeParseListeners=function(){this._parseListeners=null},h.prototype.triggerEnterRuleEvent=function(){if(null!==this._parseListeners){var t=this._ctx;this._parseListeners.map((function(e){e.enterEveryRule(t),t.enterRule(e)}))}},h.prototype.triggerExitRuleEvent=function(){if(null!==this._parseListeners){var t=this._ctx;this._parseListeners.slice(0).reverse().map((function(e){t.exitRule(e),e.exitEveryRule(t)}))}},h.prototype.getTokenFactory=function(){return this._input.tokenSource._factory},h.prototype.setTokenFactory=function(t){this._input.tokenSource._factory=t},h.prototype.getATNWithBypassAlts=function(){var t=this.getSerializedATN();if(null===t)throw"The current parser does not support an ATN with bypass alternatives.";var e=this.bypassAltsAtnCache[t];if(null===e){var n=new u;n.generateRuleBypassTransitions=!0,e=new s(n).deserialize(t),this.bypassAltsAtnCache[t]=e}return e};var f=n(17).Lexer;h.prototype.compileParseTreePattern=function(t,e,n){if(null===(n=n||null)&&null!==this.getTokenStream()){var r=this.getTokenStream().tokenSource;r instanceof f&&(n=r)}if(null===n)throw"Parser can't discover a lexer to use";return new ParseTreePatternMatcher(n,this).compile(t,e)},h.prototype.getInputStream=function(){return this.getTokenStream()},h.prototype.setInputStream=function(t){this.setTokenStream(t)},h.prototype.getTokenStream=function(){return this._input},h.prototype.setTokenStream=function(t){this._input=null,this.reset(),this._input=t},h.prototype.getCurrentToken=function(){return this._input.LT(1)},h.prototype.notifyErrorListeners=function(t,e,n){n=n||null,null===(e=e||null)&&(e=this.getCurrentToken()),this._syntaxErrors+=1;var r=e.line,i=e.column;this.getErrorListenerDispatch().syntaxError(this,e,r,i,t,n)},h.prototype.consume=function(){var t=this.getCurrentToken();t.type!==r.EOF&&this.getInputStream().consume();var e,n=null!==this._parseListeners&&this._parseListeners.length>0;(this.buildParseTrees||n)&&((e=this._errHandler.inErrorRecoveryMode(this)?this._ctx.addErrorNode(t):this._ctx.addTokenNode(t)).invokingState=this.state,n&&this._parseListeners.map((function(t){e instanceof l||void 0!==e.isErrorNode&&e.isErrorNode()?t.visitErrorNode(e):e instanceof c&&t.visitTerminal(e)})));return t},h.prototype.addContextToParseTree=function(){null!==this._ctx.parentCtx&&this._ctx.parentCtx.addChild(this._ctx)},h.prototype.enterRule=function(t,e,n){this.state=e,this._ctx=t,this._ctx.start=this._input.LT(1),this.buildParseTrees&&this.addContextToParseTree(),null!==this._parseListeners&&this.triggerEnterRuleEvent()},h.prototype.exitRule=function(){this._ctx.stop=this._input.LT(-1),null!==this._parseListeners&&this.triggerExitRuleEvent(),this.state=this._ctx.invokingState,this._ctx=this._ctx.parentCtx},h.prototype.enterOuterAlt=function(t,e){t.setAltNumber(e),this.buildParseTrees&&this._ctx!==t&&null!==this._ctx.parentCtx&&(this._ctx.parentCtx.removeLastChild(),this._ctx.parentCtx.addChild(t)),this._ctx=t},h.prototype.getPrecedence=function(){return 0===this._precedenceStack.length?-1:this._precedenceStack[this._precedenceStack.length-1]},h.prototype.enterRecursionRule=function(t,e,n,r){this.state=e,this._precedenceStack.push(r),this._ctx=t,this._ctx.start=this._input.LT(1),null!==this._parseListeners&&this.triggerEnterRuleEvent()},h.prototype.pushNewRecursionContext=function(t,e,n){var r=this._ctx;r.parentCtx=t,r.invokingState=e,r.stop=this._input.LT(-1),this._ctx=t,this._ctx.start=r.start,this.buildParseTrees&&this._ctx.addChild(r),null!==this._parseListeners&&this.triggerEnterRuleEvent()},h.prototype.unrollRecursionContexts=function(t){this._precedenceStack.pop(),this._ctx.stop=this._input.LT(-1);var e=this._ctx;if(null!==this._parseListeners)for(;this._ctx!==t;)this.triggerExitRuleEvent(),this._ctx=this._ctx.parentCtx;else this._ctx=t;e.parentCtx=t,this.buildParseTrees&&null!==t&&t.addChild(e)},h.prototype.getInvokingContext=function(t){for(var e=this._ctx;null!==e;){if(e.ruleIndex===t)return e;e=e.parentCtx}return null},h.prototype.precpred=function(t,e){return e>=this._precedenceStack[this._precedenceStack.length-1]},h.prototype.inContext=function(t){return!1},h.prototype.isExpectedToken=function(t){var e=this._interp.atn,n=this._ctx,i=e.states[this.state],o=e.nextTokens(i);if(o.contains(t))return!0;if(!o.contains(r.EPSILON))return!1;for(;null!==n&&n.invokingState>=0&&o.contains(r.EPSILON);){var a=e.states[n.invokingState].transitions[0];if((o=e.nextTokens(a.followState)).contains(t))return!0;n=n.parentCtx}return!(!o.contains(r.EPSILON)||t!==r.EOF)},h.prototype.getExpectedTokens=function(){return this._interp.atn.getExpectedTokens(this.state,this._ctx)},h.prototype.getExpectedTokensWithinCurrentRule=function(){var t=this._interp.atn,e=t.states[this.state];return t.nextTokens(e)},h.prototype.getRuleIndex=function(t){var e=this.getRuleIndexMap()[t];return null!==e?e:-1},h.prototype.getRuleInvocationStack=function(t){null===(t=t||null)&&(t=this._ctx);for(var e=[];null!==t;){var n=t.ruleIndex;n<0?e.push("n/a"):e.push(this.ruleNames[n]),t=t.parentCtx}return e},h.prototype.getDFAStrings=function(){return this._interp.decisionToDFA.toString()},h.prototype.dumpDFA=function(){for(var t=!1,e=0;e<this._interp.decisionToDFA.length;e++){var n=this._interp.decisionToDFA[e];n.states.length>0&&(t&&console.log(),this.printer.println("Decision "+n.decision+":"),this.printer.print(n.toString(this.literalNames,this.symbolicNames)),t=!0)}},h.prototype.getSourceName=function(){return this._input.sourceName},h.prototype.setTrace=function(t){t?(null!==this._tracer&&this.removeParseListener(this._tracer),this._tracer=new p(this),this.addParseListener(this._tracer)):(this.removeParseListener(this._tracer),this._tracer=null)},e.Parser=h},function(t,e,n){var r=n(14),i=["悋Ꜫ脳맭䅼㯧瞆奤","Aȃ\b\t\t","\t\t\t\t","\b\t\b\t\t\t\n\t\n\v\t\v","\f\t\f\r\t\r\t\t","\t\t\t\t","\t\t\t","\t\t\t\t","\t\t\t",'\t\t \t !\t!"\t"#',"\t#$\t$%\t%&\t&'\t'(\t()\t)","*\t*+\t+,\t,-\t-.\t./\t/0\t0","1\t12\t23\t34\t45\t56\t67\t7","8\t89\t9:\t:;\t;<\t<=\t=>\t>","?\t?@\t@A\tAB\tBC\tCD\tD","","\b","\b\t\t\t\t\n\n\n\n","\v\v\f\f\r\r\r","","","","","","","","",""," ",' !!!!!"""','"""##$$$$$',"$%%%%%%%&","&&&&&&''((","((())))))*","****++++,,",",,,-------",".......///","/////////0","0000011111","1122222233","3334444445","5555555666","6666677777","7777777788","8888888888","88ƃ\n88ƅ\n88Ƈ\n888Ɗ","\n89999:::::","::::::ƚ\n:\r::ƛ",":ƞ\n::Ơ\n::Ƣ\n::::",":::::ƫ\n:;;Ʈ\n;",";;Ʊ\n;\f;;ƴ\v;<<<","<ƹ\n<\f<<Ƽ\v<<<==","==ǃ\n=\f==ǆ\v===>",">ǋ\n>\r>>ǌ>>>Ǒ\n>\r>>ǒ",">Ǖ\n>??ǘ\n?\r??Ǚ?","?@@@@@Ǣ\n@\f@@ǥ\v","@@@@@@AAAA","Aǰ\nA\fAAǳ\vAAABB","BBǺ\nBCCCCCCD","DǣE\t\v","\r\b\t\n\v\f\r","!#%')+","-/13579;= ?!A","\"C#E$G%I&K'M(O)Q*S+U,W-Y.[/]0_1a2c3e4g5i6k7m8o9q:su;w<y={>}","?@A\f","2;--//C\\aac|2;C\\aac|",'^^bb))\v\f""',"\f\f\n))11^^bbhhppttvv2;CHchȔ","","\t","\v\r","","","","","!","#%","')+","-/","13","57","9;","=?A","CE","GI","KM","OQ","SUW","Y[","]_","ac","eg","ikm","oq","uw","y{","}","","","\t\v","\r","","¡","£¦","¨ª","!­#°%³","'µ)·","+º-½","/À1É","3Í5Ð","7Ô9Ü;Þ","=à?â","AäCé","EïGñ","I÷Kþ","MąOćQČ","SĒUė","WěYĠ","[ħ]Į","_ĺaŀ","cŇeōgŒ","iŘkŠ","mŨoŵ","qƋsƏ","uƭwƵ","yƿ{Ǌ}Ǘ","ǝǫ","Ƕǻ","ȁ","0","]","_\b","-\n/","\f,","1","f","kx","o","qf"," ( ","¡¢~¢","£¤>¤¥","?¥¦§",">§¨©","@©ª«","@«¬?¬ ","­®k®¯u",'¯"°±c',"±²u²$³","´?´&µ¶","¶(·¸","#¸¹?¹*","º»#»¼","¼,½¾k","¾¿p¿.","ÀÁeÁÂqÂ","ÃpÃÄvÄÅ","cÅÆkÆÇ","pÇÈuÈ0","ÉÊcÊËp","ËÌfÌ2Í","ÎqÎÏtÏ4","ÐÑzÑÒ","qÒÓtÓ6","ÔÕkÕÖo","Ö×r×ØnØ","ÙkÙÚgÚÛ","uÛ8ÜÝ","*Ý:Þß+","ß<àá}","á>âã","ã@äåvå","ætæçwçè","gèBéê","hêëcëìn","ìíuíîg","îDïð'ð","Fñò&òó","vóôjôõ","kõöuöH","÷ø&øùk","ùúpúûfû","ügüýzýJ","þÿ&ÿĀ","vĀāqāĂv","ĂăcăĄn","ĄLąĆ.Ć","NćĈ{Ĉĉ","gĉĊcĊċ","tċPČčo","čĎqĎďp","ďĐvĐđjđ","RĒēyēĔ","gĔĕgĕĖ","mĖTėĘf","ĘęcęĚ{","ĚVěĜjĜ","ĝqĝĞwĞğ","tğXĠġ","oġĢkĢģp","ģĤwĤĥv","ĥĦgĦZħ","ĨuĨĩgĩĪ","eĪīqīĬ","pĬĭfĭ\\","Įįoįİk","İınıĲnĲ","ĳkĳĴuĴĵ","gĵĶeĶķ","qķĸpĸĹf","Ĺ^ĺĻ{","ĻļgļĽcĽ","ľtľĿuĿ`","ŀŁoŁł","qłŃpŃńv","ńŅjŅņu","ņbŇňyň","ŉgŉŊgŊŋ","mŋŌuŌd","ōŎfŎŏc","ŏŐ{Őőu","őfŒœjœ","ŔqŔŕwŕŖ","tŖŗuŗh","ŘřořŚk","ŚśpśŜw","ŜŝvŝŞgŞ","şuşjŠš","ušŢgŢţ","eţŤqŤťp","ťŦfŦŧu","ŧlŨũoũ","ŪkŪūnūŬ","nŬŭkŭŮ","uŮůgůŰe","ŰűqűŲp","ŲųfųŴuŴ","nŵŶBŶŷ","\tŷŸ\tŸŹ\t","ŹƆ\tźŻ/","Żż\tżƄ\t","Žž/žſ\tſ","Ƃ\tƀƁVƁƃ","s:ƂƀƂƃ","ƃƅƄŽ","ƄƅƅƇ","ƆźƆƇ","ƇƉƈƊ","\\ƉƈƉƊ","ƊpƋƌ","BƌƍVƍƎs:","ƎrƏƐ\tƐ","ơ\tƑƒ<ƒƓ","\tƓƟ\tƔƕ","<ƕƖ\tƖƝ\t","Ɨƙ0Ƙƚ\t","ƙƘƚƛ","ƛƙƛƜ","ƜƞƝƗ","ƝƞƞƠ","ƟƔƟƠ","ƠƢơƑ","ơƢƢƪ","ƣƫ\\Ƥƥ\tƥ","Ʀ\tƦƧ\tƧƨ","<ƨƩ\tƩƫ\t","ƪƣƪƤ","ƪƫƫt","ƬƮ\tƭƬ","ƮƲƯƱ\t","ưƯƱƴ","ƲưƲƳ","ƳvƴƲ","Ƶƺbƶƹ","BƷƹ\nƸƶ","ƸƷƹƼ","ƺƸƺƻ","ƻƽƼƺ","ƽƾbƾx","ƿǄ)ǀǃBǁ","ǃ\nǂǀǂ","ǁǃǆǄ","ǂǄǅǅ","ǇǆǄǇ","ǈ)ǈzǉǋ","\tǊǉǋǌ","ǌǊǌǍ","Ǎǔǎǐ","0ǏǑ\tǐǏ","Ǒǒǒǐ","ǒǓǓǕ","ǔǎǔǕ","Ǖ|ǖǘ\t\b","ǗǖǘǙ","ǙǗǙǚ","ǚǛǛǜ\b?","ǜ~ǝǞ1Ǟ","ǟ,ǟǣǠ","Ǣ\vǡǠǢ","ǥǣǤǣ","ǡǤǦǥ","ǣǦǧ,ǧ","Ǩ1Ǩǩǩ","Ǫ\b@ǪǫǬ","1Ǭǭ1ǭǱ","Ǯǰ\n\tǯǮ","ǰǳǱǯ","ǱǲǲǴ","ǳǱǴǵ\bA","ǵǶǹ^","ǷǺ\t\nǸǺCǹ","ǷǹǸǺ","ǻǼwǼ","ǽDǽǾDǾǿ","DǿȀDȀ","ȁȂ\t\vȂ","ƂƄƆƉƛƝƟ","ơƪƭưƲƸƺǂǄǌǒǔ","ǙǣǱǹ"].join(""),o=(new r.atn.ATNDeserializer).deserialize(i),a=o.decisionToState.map((function(t,e){return new r.dfa.DFA(t,e)}));function s(t){return r.Lexer.call(this,t),this._interp=new r.atn.LexerATNSimulator(this,o,a,new r.PredictionContextCache),this}s.prototype=Object.create(r.Lexer.prototype),s.prototype.constructor=s,Object.defineProperty(s.prototype,"atn",{get:function(){return o}}),s.EOF=r.Token.EOF,s.T__0=1,s.T__1=2,s.T__2=3,s.T__3=4,s.T__4=5,s.T__5=6,s.T__6=7,s.T__7=8,s.T__8=9,s.T__9=10,s.T__10=11,s.T__11=12,s.T__12=13,s.T__13=14,s.T__14=15,s.T__15=16,s.T__16=17,s.T__17=18,s.T__18=19,s.T__19=20,s.T__20=21,s.T__21=22,s.T__22=23,s.T__23=24,s.T__24=25,s.T__25=26,s.T__26=27,s.T__27=28,s.T__28=29,s.T__29=30,s.T__30=31,s.T__31=32,s.T__32=33,s.T__33=34,s.T__34=35,s.T__35=36,s.T__36=37,s.T__37=38,s.T__38=39,s.T__39=40,s.T__40=41,s.T__41=42,s.T__42=43,s.T__43=44,s.T__44=45,s.T__45=46,s.T__46=47,s.T__47=48,s.T__48=49,s.T__49=50,s.T__50=51,s.T__51=52,s.T__52=53,s.T__53=54,s.DATETIME=55,s.TIME=56,s.IDENTIFIER=57,s.DELIMITEDIDENTIFIER=58,s.STRING=59,s.NUMBER=60,s.WS=61,s.COMMENT=62,s.LINE_COMMENT=63,s.prototype.channelNames=["DEFAULT_TOKEN_CHANNEL","HIDDEN"],s.prototype.modeNames=["DEFAULT_MODE"],s.prototype.literalNames=[null,"'.'","'['","']'","'+'","'-'","'*'","'/'","'div'","'mod'","'&'","'|'","'<='","'<'","'>'","'>='","'is'","'as'","'='","'~'","'!='","'!~'","'in'","'contains'","'and'","'or'","'xor'","'implies'","'('","')'","'{'","'}'","'true'","'false'","'%'","'$this'","'$index'","'$total'","','","'year'","'month'","'week'","'day'","'hour'","'minute'","'second'","'millisecond'","'years'","'months'","'weeks'","'days'","'hours'","'minutes'","'seconds'","'milliseconds'"],s.prototype.symbolicNames=[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"DATETIME","TIME","IDENTIFIER","DELIMITEDIDENTIFIER","STRING","NUMBER","WS","COMMENT","LINE_COMMENT"],s.prototype.ruleNames=["T__0","T__1","T__2","T__3","T__4","T__5","T__6","T__7","T__8","T__9","T__10","T__11","T__12","T__13","T__14","T__15","T__16","T__17","T__18","T__19","T__20","T__21","T__22","T__23","T__24","T__25","T__26","T__27","T__28","T__29","T__30","T__31","T__32","T__33","T__34","T__35","T__36","T__37","T__38","T__39","T__40","T__41","T__42","T__43","T__44","T__45","T__46","T__47","T__48","T__49","T__50","T__51","T__52","T__53","DATETIME","TIME","TIMEFORMAT","IDENTIFIER","DELIMITEDIDENTIFIER","STRING","NUMBER","WS","COMMENT","LINE_COMMENT","ESC","UNICODE","HEX"],s.prototype.grammarFileName="FHIRPath.g4",e.FHIRPathLexer=s},function(t,e,n){var r=n(14),i=n(34).FHIRPathListener,o=["悋Ꜫ脳맭䅼㯧瞆奤","A\t\t\t","\t\t\t","\b\t\b\t\t\t\n\t\n\v\t\v\f\t\f","\r\t\r\t\t","#\n","","","","","","","K\n\fN\v","","W\n","a\n","f\n","m\n","r\n","\b\b\b\by\n\b\f\b\b|\v\b","\t\t\t\n\t\n\n\n\n\n","\n\v\v\f\f\r\r","\n\f","\v","\b\n\f","\b\v","\f\f","",'"#)018',';<©"V',"`\bb","\nl\fnu","}","","","","\b# !\t",'!#\r"" ',"#L$%\f\f%&\t","&K\r'(\f\v()\t",")K\f*+\f\n+,\r",",K\v-.\f\t./\t","/K\n01\f12\t2","K\b34\f45\t5K","67\f78","8K9:\f:;\t\b;","K<=\f=>",">K?@\f@A","AK\nBC\fCD","DEEFFK","GH\f\bHI\t\tIK","\rJ$J'J*","J-J0","J3J6J9","J<J?JB","JGKNLJ","LMM","NLOW\nPW","QW\bRSST","TUUW","VOVPVQ","VRWXY"," Ya!Za\t\n[a=","\\a>]a9^a:","_a\t`X`Z","`[`\\`]","`^`_","abe$cf","df=eced","f\tgmhm","\fim%jm&km","'lglhl","iljlk","m\vnooq","pr\bqpq","rrsst","t\ruzvw","(wyxvy|","zxz{","{|z}",">~\n~","","\v\f","=","","\t\v","\t\f","","","","","","","\t\r",'"JLV`elqz'].join(""),a=(new r.atn.ATNDeserializer).deserialize(o),s=a.decisionToState.map((function(t,e){return new r.dfa.DFA(t,e)})),u=new r.PredictionContextCache,c=[null,"'.'","'['","']'","'+'","'-'","'*'","'/'","'div'","'mod'","'&'","'|'","'<='","'<'","'>'","'>='","'is'","'as'","'='","'~'","'!='","'!~'","'in'","'contains'","'and'","'or'","'xor'","'implies'","'('","')'","'{'","'}'","'true'","'false'","'%'","'$this'","'$index'","'$total'","','","'year'","'month'","'week'","'day'","'hour'","'minute'","'second'","'millisecond'","'years'","'months'","'weeks'","'days'","'hours'","'minutes'","'seconds'","'milliseconds'"],l=[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"DATETIME","TIME","IDENTIFIER","DELIMITEDIDENTIFIER","STRING","NUMBER","WS","COMMENT","LINE_COMMENT"],p=["expression","term","literal","externalConstant","invocation","functn","paramList","quantity","unit","dateTimePrecision","pluralDateTimePrecision","typeSpecifier","qualifiedIdentifier","identifier"];function h(t){return r.Parser.call(this,t),this._interp=new r.atn.ParserATNSimulator(this,a,s,u),this.ruleNames=p,this.literalNames=c,this.symbolicNames=l,this}function f(t,e,n){return void 0===e&&(e=null),null==n&&(n=-1),r.ParserRuleContext.call(this,e,n),this.parser=t,this.ruleIndex=h.RULE_expression,this}function d(t,e){return f.call(this,t),f.prototype.copyFrom.call(this,e),this}function y(t,e){return f.call(this,t),f.prototype.copyFrom.call(this,e),this}function g(t,e){return f.call(this,t),f.prototype.copyFrom.call(this,e),this}function m(t,e){return f.call(this,t),f.prototype.copyFrom.call(this,e),this}function v(t,e){return f.call(this,t),f.prototype.copyFrom.call(this,e),this}function x(t,e){return f.call(this,t),f.prototype.copyFrom.call(this,e),this}function T(t,e){return f.call(this,t),f.prototype.copyFrom.call(this,e),this}function _(t,e){return f.call(this,t),f.prototype.copyFrom.call(this,e),this}function E(t,e){return f.call(this,t),f.prototype.copyFrom.call(this,e),this}function S(t,e){return f.call(this,t),f.prototype.copyFrom.call(this,e),this}function C(t,e){return f.call(this,t),f.prototype.copyFrom.call(this,e),this}function I(t,e){return f.call(this,t),f.prototype.copyFrom.call(this,e),this}function b(t,e){return f.call(this,t),f.prototype.copyFrom.call(this,e),this}function R(t,e){return f.call(this,t),f.prototype.copyFrom.call(this,e),this}function A(t,e,n){return void 0===e&&(e=null),null==n&&(n=-1),r.ParserRuleContext.call(this,e,n),this.parser=t,this.ruleIndex=h.RULE_term,this}function D(t,e){return A.call(this,t),A.prototype.copyFrom.call(this,e),this}function O(t,e){return A.call(this,t),A.prototype.copyFrom.call(this,e),this}function w(t,e){return A.call(this,t),A.prototype.copyFrom.call(this,e),this}function L(t,e){return A.call(this,t),A.prototype.copyFrom.call(this,e),this}function N(t,e,n){return void 0===e&&(e=null),null==n&&(n=-1),r.ParserRuleContext.call(this,e,n),this.parser=t,this.ruleIndex=h.RULE_literal,this}function P(t,e){return N.call(this,t),N.prototype.copyFrom.call(this,e),this}function k(t,e){return N.call(this,t),N.prototype.copyFrom.call(this,e),this}function F(t,e){return N.call(this,t),N.prototype.copyFrom.call(this,e),this}function M(t,e){return N.call(this,t),N.prototype.copyFrom.call(this,e),this}function U(t,e){return N.call(this,t),N.prototype.copyFrom.call(this,e),this}function j(t,e){return N.call(this,t),N.prototype.copyFrom.call(this,e),this}function q(t,e){return N.call(this,t),N.prototype.copyFrom.call(this,e),this}function B(t,e,n){return void 0===e&&(e=null),null==n&&(n=-1),r.ParserRuleContext.call(this,e,n),this.parser=t,this.ruleIndex=h.RULE_externalConstant,this}function V(t,e,n){return void 0===e&&(e=null),null==n&&(n=-1),r.ParserRuleContext.call(this,e,n),this.parser=t,this.ruleIndex=h.RULE_invocation,this}function H(t,e){return V.call(this,t),V.prototype.copyFrom.call(this,e),this}function Q(t,e){return V.call(this,t),V.prototype.copyFrom.call(this,e),this}function z(t,e){return V.call(this,t),V.prototype.copyFrom.call(this,e),this}function W(t,e){return V.call(this,t),V.prototype.copyFrom.call(this,e),this}function Y(t,e){return V.call(this,t),V.prototype.copyFrom.call(this,e),this}function K(t,e,n){return void 0===e&&(e=null),null==n&&(n=-1),r.ParserRuleContext.call(this,e,n),this.parser=t,this.ruleIndex=h.RULE_functn,this}function G(t,e,n){return void 0===e&&(e=null),null==n&&(n=-1),r.ParserRuleContext.call(this,e,n),this.parser=t,this.ruleIndex=h.RULE_paramList,this}function $(t,e,n){return void 0===e&&(e=null),null==n&&(n=-1),r.ParserRuleContext.call(this,e,n),this.parser=t,this.ruleIndex=h.RULE_quantity,this}function X(t,e,n){return void 0===e&&(e=null),null==n&&(n=-1),r.ParserRuleContext.call(this,e,n),this.parser=t,this.ruleIndex=h.RULE_unit,this}function J(t,e,n){return void 0===e&&(e=null),null==n&&(n=-1),r.ParserRuleContext.call(this,e,n),this.parser=t,this.ruleIndex=h.RULE_dateTimePrecision,this}function Z(t,e,n){return void 0===e&&(e=null),null==n&&(n=-1),r.ParserRuleContext.call(this,e,n),this.parser=t,this.ruleIndex=h.RULE_pluralDateTimePrecision,this}function tt(t,e,n){return void 0===e&&(e=null),null==n&&(n=-1),r.ParserRuleContext.call(this,e,n),this.parser=t,this.ruleIndex=h.RULE_typeSpecifier,this}function et(t,e,n){return void 0===e&&(e=null),null==n&&(n=-1),r.ParserRuleContext.call(this,e,n),this.parser=t,this.ruleIndex=h.RULE_qualifiedIdentifier,this}function nt(t,e,n){return void 0===e&&(e=null),null==n&&(n=-1),r.ParserRuleContext.call(this,e,n),this.parser=t,this.ruleIndex=h.RULE_identifier,this}h.prototype=Object.create(r.Parser.prototype),h.prototype.constructor=h,Object.defineProperty(h.prototype,"atn",{get:function(){return a}}),h.EOF=r.Token.EOF,h.T__0=1,h.T__1=2,h.T__2=3,h.T__3=4,h.T__4=5,h.T__5=6,h.T__6=7,h.T__7=8,h.T__8=9,h.T__9=10,h.T__10=11,h.T__11=12,h.T__12=13,h.T__13=14,h.T__14=15,h.T__15=16,h.T__16=17,h.T__17=18,h.T__18=19,h.T__19=20,h.T__20=21,h.T__21=22,h.T__22=23,h.T__23=24,h.T__24=25,h.T__25=26,h.T__26=27,h.T__27=28,h.T__28=29,h.T__29=30,h.T__30=31,h.T__31=32,h.T__32=33,h.T__33=34,h.T__34=35,h.T__35=36,h.T__36=37,h.T__37=38,h.T__38=39,h.T__39=40,h.T__40=41,h.T__41=42,h.T__42=43,h.T__43=44,h.T__44=45,h.T__45=46,h.T__46=47,h.T__47=48,h.T__48=49,h.T__49=50,h.T__50=51,h.T__51=52,h.T__52=53,h.T__53=54,h.DATETIME=55,h.TIME=56,h.IDENTIFIER=57,h.DELIMITEDIDENTIFIER=58,h.STRING=59,h.NUMBER=60,h.WS=61,h.COMMENT=62,h.LINE_COMMENT=63,h.RULE_expression=0,h.RULE_term=1,h.RULE_literal=2,h.RULE_externalConstant=3,h.RULE_invocation=4,h.RULE_functn=5,h.RULE_paramList=6,h.RULE_quantity=7,h.RULE_unit=8,h.RULE_dateTimePrecision=9,h.RULE_pluralDateTimePrecision=10,h.RULE_typeSpecifier=11,h.RULE_qualifiedIdentifier=12,h.RULE_identifier=13,f.prototype=Object.create(r.ParserRuleContext.prototype),f.prototype.constructor=f,f.prototype.copyFrom=function(t){r.ParserRuleContext.prototype.copyFrom.call(this,t)},d.prototype=Object.create(f.prototype),d.prototype.constructor=d,h.IndexerExpressionContext=d,d.prototype.expression=function(t){return void 0===t&&(t=null),null===t?this.getTypedRuleContexts(f):this.getTypedRuleContext(f,t)},d.prototype.enterRule=function(t){t instanceof i&&t.enterIndexerExpression(this)},d.prototype.exitRule=function(t){t instanceof i&&t.exitIndexerExpression(this)},y.prototype=Object.create(f.prototype),y.prototype.constructor=y,h.PolarityExpressionContext=y,y.prototype.expression=function(){return this.getTypedRuleContext(f,0)},y.prototype.enterRule=function(t){t instanceof i&&t.enterPolarityExpression(this)},y.prototype.exitRule=function(t){t instanceof i&&t.exitPolarityExpression(this)},g.prototype=Object.create(f.prototype),g.prototype.constructor=g,h.AdditiveExpressionContext=g,g.prototype.expression=function(t){return void 0===t&&(t=null),null===t?this.getTypedRuleContexts(f):this.getTypedRuleContext(f,t)},g.prototype.enterRule=function(t){t instanceof i&&t.enterAdditiveExpression(this)},g.prototype.exitRule=function(t){t instanceof i&&t.exitAdditiveExpression(this)},m.prototype=Object.create(f.prototype),m.prototype.constructor=m,h.MultiplicativeExpressionContext=m,m.prototype.expression=function(t){return void 0===t&&(t=null),null===t?this.getTypedRuleContexts(f):this.getTypedRuleContext(f,t)},m.prototype.enterRule=function(t){t instanceof i&&t.enterMultiplicativeExpression(this)},m.prototype.exitRule=function(t){t instanceof i&&t.exitMultiplicativeExpression(this)},v.prototype=Object.create(f.prototype),v.prototype.constructor=v,h.UnionExpressionContext=v,v.prototype.expression=function(t){return void 0===t&&(t=null),null===t?this.getTypedRuleContexts(f):this.getTypedRuleContext(f,t)},v.prototype.enterRule=function(t){t instanceof i&&t.enterUnionExpression(this)},v.prototype.exitRule=function(t){t instanceof i&&t.exitUnionExpression(this)},x.prototype=Object.create(f.prototype),x.prototype.constructor=x,h.OrExpressionContext=x,x.prototype.expression=function(t){return void 0===t&&(t=null),null===t?this.getTypedRuleContexts(f):this.getTypedRuleContext(f,t)},x.prototype.enterRule=function(t){t instanceof i&&t.enterOrExpression(this)},x.prototype.exitRule=function(t){t instanceof i&&t.exitOrExpression(this)},T.prototype=Object.create(f.prototype),T.prototype.constructor=T,h.AndExpressionContext=T,T.prototype.expression=function(t){return void 0===t&&(t=null),null===t?this.getTypedRuleContexts(f):this.getTypedRuleContext(f,t)},T.prototype.enterRule=function(t){t instanceof i&&t.enterAndExpression(this)},T.prototype.exitRule=function(t){t instanceof i&&t.exitAndExpression(this)},_.prototype=Object.create(f.prototype),_.prototype.constructor=_,h.MembershipExpressionContext=_,_.prototype.expression=function(t){return void 0===t&&(t=null),null===t?this.getTypedRuleContexts(f):this.getTypedRuleContext(f,t)},_.prototype.enterRule=function(t){t instanceof i&&t.enterMembershipExpression(this)},_.prototype.exitRule=function(t){t instanceof i&&t.exitMembershipExpression(this)},E.prototype=Object.create(f.prototype),E.prototype.constructor=E,h.InequalityExpressionContext=E,E.prototype.expression=function(t){return void 0===t&&(t=null),null===t?this.getTypedRuleContexts(f):this.getTypedRuleContext(f,t)},E.prototype.enterRule=function(t){t instanceof i&&t.enterInequalityExpression(this)},E.prototype.exitRule=function(t){t instanceof i&&t.exitInequalityExpression(this)},S.prototype=Object.create(f.prototype),S.prototype.constructor=S,h.InvocationExpressionContext=S,S.prototype.expression=function(){return this.getTypedRuleContext(f,0)},S.prototype.invocation=function(){return this.getTypedRuleContext(V,0)},S.prototype.enterRule=function(t){t instanceof i&&t.enterInvocationExpression(this)},S.prototype.exitRule=function(t){t instanceof i&&t.exitInvocationExpression(this)},C.prototype=Object.create(f.prototype),C.prototype.constructor=C,h.EqualityExpressionContext=C,C.prototype.expression=function(t){return void 0===t&&(t=null),null===t?this.getTypedRuleContexts(f):this.getTypedRuleContext(f,t)},C.prototype.enterRule=function(t){t instanceof i&&t.enterEqualityExpression(this)},C.prototype.exitRule=function(t){t instanceof i&&t.exitEqualityExpression(this)},I.prototype=Object.create(f.prototype),I.prototype.constructor=I,h.ImpliesExpressionContext=I,I.prototype.expression=function(t){return void 0===t&&(t=null),null===t?this.getTypedRuleContexts(f):this.getTypedRuleContext(f,t)},I.prototype.enterRule=function(t){t instanceof i&&t.enterImpliesExpression(this)},I.prototype.exitRule=function(t){t instanceof i&&t.exitImpliesExpression(this)},b.prototype=Object.create(f.prototype),b.prototype.constructor=b,h.TermExpressionContext=b,b.prototype.term=function(){return this.getTypedRuleContext(A,0)},b.prototype.enterRule=function(t){t instanceof i&&t.enterTermExpression(this)},b.prototype.exitRule=function(t){t instanceof i&&t.exitTermExpression(this)},R.prototype=Object.create(f.prototype),R.prototype.constructor=R,h.TypeExpressionContext=R,R.prototype.expression=function(){return this.getTypedRuleContext(f,0)},R.prototype.typeSpecifier=function(){return this.getTypedRuleContext(tt,0)},R.prototype.enterRule=function(t){t instanceof i&&t.enterTypeExpression(this)},R.prototype.exitRule=function(t){t instanceof i&&t.exitTypeExpression(this)},h.prototype.expression=function(t){void 0===t&&(t=0);var e=this._ctx,n=this.state,i=new f(this,this._ctx,n);this.enterRecursionRule(i,0,h.RULE_expression,t);var o=0;try{switch(this.enterOuterAlt(i,1),this.state=32,this._errHandler.sync(this),this._input.LA(1)){case h.T__15:case h.T__16:case h.T__21:case h.T__22:case h.T__27:case h.T__29:case h.T__31:case h.T__32:case h.T__33:case h.T__34:case h.T__35:case h.T__36:case h.DATETIME:case h.TIME:case h.IDENTIFIER:case h.DELIMITEDIDENTIFIER:case h.STRING:case h.NUMBER:i=new b(this,i),this._ctx=i,i,this.state=29,this.term();break;case h.T__3:case h.T__4:i=new y(this,i),this._ctx=i,i,this.state=30,(o=this._input.LA(1))!==h.T__3&&o!==h.T__4?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume()),this.state=31,this.expression(11);break;default:throw new r.error.NoViableAltException(this)}this._ctx.stop=this._input.LT(-1),this.state=74,this._errHandler.sync(this);for(var a=this._interp.adaptivePredict(this._input,2,this._ctx);2!=a&&a!=r.atn.ATN.INVALID_ALT_NUMBER;){if(1===a)switch(null!==this._parseListeners&&this.triggerExitRuleEvent(),i,this.state=72,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,1,this._ctx)){case 1:if(i=new m(this,new f(this,e,n)),this.pushNewRecursionContext(i,0,h.RULE_expression),this.state=34,!this.precpred(this._ctx,10))throw new r.error.FailedPredicateException(this,"this.precpred(this._ctx, 10)");this.state=35,0!=(-32&(o=this._input.LA(1)))||0==(1<<o&(1<<h.T__5|1<<h.T__6|1<<h.T__7|1<<h.T__8))?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume()),this.state=36,this.expression(11);break;case 2:if(i=new g(this,new f(this,e,n)),this.pushNewRecursionContext(i,0,h.RULE_expression),this.state=37,!this.precpred(this._ctx,9))throw new r.error.FailedPredicateException(this,"this.precpred(this._ctx, 9)");this.state=38,0!=(-32&(o=this._input.LA(1)))||0==(1<<o&(1<<h.T__3|1<<h.T__4|1<<h.T__9))?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume()),this.state=39,this.expression(10);break;case 3:if(i=new v(this,new f(this,e,n)),this.pushNewRecursionContext(i,0,h.RULE_expression),this.state=40,!this.precpred(this._ctx,8))throw new r.error.FailedPredicateException(this,"this.precpred(this._ctx, 8)");this.state=41,this.match(h.T__10),this.state=42,this.expression(9);break;case 4:if(i=new E(this,new f(this,e,n)),this.pushNewRecursionContext(i,0,h.RULE_expression),this.state=43,!this.precpred(this._ctx,7))throw new r.error.FailedPredicateException(this,"this.precpred(this._ctx, 7)");this.state=44,0!=(-32&(o=this._input.LA(1)))||0==(1<<o&(1<<h.T__11|1<<h.T__12|1<<h.T__13|1<<h.T__14))?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume()),this.state=45,this.expression(8);break;case 5:if(i=new C(this,new f(this,e,n)),this.pushNewRecursionContext(i,0,h.RULE_expression),this.state=46,!this.precpred(this._ctx,5))throw new r.error.FailedPredicateException(this,"this.precpred(this._ctx, 5)");this.state=47,0!=(-32&(o=this._input.LA(1)))||0==(1<<o&(1<<h.T__17|1<<h.T__18|1<<h.T__19|1<<h.T__20))?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume()),this.state=48,this.expression(6);break;case 6:if(i=new _(this,new f(this,e,n)),this.pushNewRecursionContext(i,0,h.RULE_expression),this.state=49,!this.precpred(this._ctx,4))throw new r.error.FailedPredicateException(this,"this.precpred(this._ctx, 4)");this.state=50,(o=this._input.LA(1))!==h.T__21&&o!==h.T__22?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume()),this.state=51,this.expression(5);break;case 7:if(i=new T(this,new f(this,e,n)),this.pushNewRecursionContext(i,0,h.RULE_expression),this.state=52,!this.precpred(this._ctx,3))throw new r.error.FailedPredicateException(this,"this.precpred(this._ctx, 3)");this.state=53,this.match(h.T__23),this.state=54,this.expression(4);break;case 8:if(i=new x(this,new f(this,e,n)),this.pushNewRecursionContext(i,0,h.RULE_expression),this.state=55,!this.precpred(this._ctx,2))throw new r.error.FailedPredicateException(this,"this.precpred(this._ctx, 2)");this.state=56,(o=this._input.LA(1))!==h.T__24&&o!==h.T__25?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume()),this.state=57,this.expression(3);break;case 9:if(i=new I(this,new f(this,e,n)),this.pushNewRecursionContext(i,0,h.RULE_expression),this.state=58,!this.precpred(this._ctx,1))throw new r.error.FailedPredicateException(this,"this.precpred(this._ctx, 1)");this.state=59,this.match(h.T__26),this.state=60,this.expression(2);break;case 10:if(i=new S(this,new f(this,e,n)),this.pushNewRecursionContext(i,0,h.RULE_expression),this.state=61,!this.precpred(this._ctx,13))throw new r.error.FailedPredicateException(this,"this.precpred(this._ctx, 13)");this.state=62,this.match(h.T__0),this.state=63,this.invocation();break;case 11:if(i=new d(this,new f(this,e,n)),this.pushNewRecursionContext(i,0,h.RULE_expression),this.state=64,!this.precpred(this._ctx,12))throw new r.error.FailedPredicateException(this,"this.precpred(this._ctx, 12)");this.state=65,this.match(h.T__1),this.state=66,this.expression(0),this.state=67,this.match(h.T__2);break;case 12:if(i=new R(this,new f(this,e,n)),this.pushNewRecursionContext(i,0,h.RULE_expression),this.state=69,!this.precpred(this._ctx,6))throw new r.error.FailedPredicateException(this,"this.precpred(this._ctx, 6)");this.state=70,(o=this._input.LA(1))!==h.T__15&&o!==h.T__16?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume()),this.state=71,this.typeSpecifier()}this.state=76,this._errHandler.sync(this),a=this._interp.adaptivePredict(this._input,2,this._ctx)}}catch(t){if(!(t instanceof r.error.RecognitionException))throw t;i.exception=t,this._errHandler.reportError(this,t),this._errHandler.recover(this,t)}finally{this.unrollRecursionContexts(e)}return i},A.prototype=Object.create(r.ParserRuleContext.prototype),A.prototype.constructor=A,A.prototype.copyFrom=function(t){r.ParserRuleContext.prototype.copyFrom.call(this,t)},D.prototype=Object.create(A.prototype),D.prototype.constructor=D,h.ExternalConstantTermContext=D,D.prototype.externalConstant=function(){return this.getTypedRuleContext(B,0)},D.prototype.enterRule=function(t){t instanceof i&&t.enterExternalConstantTerm(this)},D.prototype.exitRule=function(t){t instanceof i&&t.exitExternalConstantTerm(this)},O.prototype=Object.create(A.prototype),O.prototype.constructor=O,h.LiteralTermContext=O,O.prototype.literal=function(){return this.getTypedRuleContext(N,0)},O.prototype.enterRule=function(t){t instanceof i&&t.enterLiteralTerm(this)},O.prototype.exitRule=function(t){t instanceof i&&t.exitLiteralTerm(this)},w.prototype=Object.create(A.prototype),w.prototype.constructor=w,h.ParenthesizedTermContext=w,w.prototype.expression=function(){return this.getTypedRuleContext(f,0)},w.prototype.enterRule=function(t){t instanceof i&&t.enterParenthesizedTerm(this)},w.prototype.exitRule=function(t){t instanceof i&&t.exitParenthesizedTerm(this)},L.prototype=Object.create(A.prototype),L.prototype.constructor=L,h.InvocationTermContext=L,L.prototype.invocation=function(){return this.getTypedRuleContext(V,0)},L.prototype.enterRule=function(t){t instanceof i&&t.enterInvocationTerm(this)},L.prototype.exitRule=function(t){t instanceof i&&t.exitInvocationTerm(this)},h.TermContext=A,h.prototype.term=function(){var t=new A(this,this._ctx,this.state);this.enterRule(t,2,h.RULE_term);try{switch(this.state=84,this._errHandler.sync(this),this._input.LA(1)){case h.T__15:case h.T__16:case h.T__21:case h.T__22:case h.T__34:case h.T__35:case h.T__36:case h.IDENTIFIER:case h.DELIMITEDIDENTIFIER:t=new L(this,t),this.enterOuterAlt(t,1),this.state=77,this.invocation();break;case h.T__29:case h.T__31:case h.T__32:case h.DATETIME:case h.TIME:case h.STRING:case h.NUMBER:t=new O(this,t),this.enterOuterAlt(t,2),this.state=78,this.literal();break;case h.T__33:t=new D(this,t),this.enterOuterAlt(t,3),this.state=79,this.externalConstant();break;case h.T__27:t=new w(this,t),this.enterOuterAlt(t,4),this.state=80,this.match(h.T__27),this.state=81,this.expression(0),this.state=82,this.match(h.T__28);break;default:throw new r.error.NoViableAltException(this)}}catch(e){if(!(e instanceof r.error.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t},N.prototype=Object.create(r.ParserRuleContext.prototype),N.prototype.constructor=N,N.prototype.copyFrom=function(t){r.ParserRuleContext.prototype.copyFrom.call(this,t)},P.prototype=Object.create(N.prototype),P.prototype.constructor=P,h.TimeLiteralContext=P,P.prototype.TIME=function(){return this.getToken(h.TIME,0)},P.prototype.enterRule=function(t){t instanceof i&&t.enterTimeLiteral(this)},P.prototype.exitRule=function(t){t instanceof i&&t.exitTimeLiteral(this)},k.prototype=Object.create(N.prototype),k.prototype.constructor=k,h.NullLiteralContext=k,k.prototype.enterRule=function(t){t instanceof i&&t.enterNullLiteral(this)},k.prototype.exitRule=function(t){t instanceof i&&t.exitNullLiteral(this)},F.prototype=Object.create(N.prototype),F.prototype.constructor=F,h.DateTimeLiteralContext=F,F.prototype.DATETIME=function(){return this.getToken(h.DATETIME,0)},F.prototype.enterRule=function(t){t instanceof i&&t.enterDateTimeLiteral(this)},F.prototype.exitRule=function(t){t instanceof i&&t.exitDateTimeLiteral(this)},M.prototype=Object.create(N.prototype),M.prototype.constructor=M,h.StringLiteralContext=M,M.prototype.STRING=function(){return this.getToken(h.STRING,0)},M.prototype.enterRule=function(t){t instanceof i&&t.enterStringLiteral(this)},M.prototype.exitRule=function(t){t instanceof i&&t.exitStringLiteral(this)},U.prototype=Object.create(N.prototype),U.prototype.constructor=U,h.BooleanLiteralContext=U,U.prototype.enterRule=function(t){t instanceof i&&t.enterBooleanLiteral(this)},U.prototype.exitRule=function(t){t instanceof i&&t.exitBooleanLiteral(this)},j.prototype=Object.create(N.prototype),j.prototype.constructor=j,h.NumberLiteralContext=j,j.prototype.NUMBER=function(){return this.getToken(h.NUMBER,0)},j.prototype.enterRule=function(t){t instanceof i&&t.enterNumberLiteral(this)},j.prototype.exitRule=function(t){t instanceof i&&t.exitNumberLiteral(this)},q.prototype=Object.create(N.prototype),q.prototype.constructor=q,h.QuantityLiteralContext=q,q.prototype.quantity=function(){return this.getTypedRuleContext($,0)},q.prototype.enterRule=function(t){t instanceof i&&t.enterQuantityLiteral(this)},q.prototype.exitRule=function(t){t instanceof i&&t.exitQuantityLiteral(this)},h.LiteralContext=N,h.prototype.literal=function(){var t=new N(this,this._ctx,this.state);this.enterRule(t,4,h.RULE_literal);var e=0;try{switch(this.state=94,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,4,this._ctx)){case 1:t=new k(this,t),this.enterOuterAlt(t,1),this.state=86,this.match(h.T__29),this.state=87,this.match(h.T__30);break;case 2:t=new U(this,t),this.enterOuterAlt(t,2),this.state=88,(e=this._input.LA(1))!==h.T__31&&e!==h.T__32?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume());break;case 3:t=new M(this,t),this.enterOuterAlt(t,3),this.state=89,this.match(h.STRING);break;case 4:t=new j(this,t),this.enterOuterAlt(t,4),this.state=90,this.match(h.NUMBER);break;case 5:t=new F(this,t),this.enterOuterAlt(t,5),this.state=91,this.match(h.DATETIME);break;case 6:t=new P(this,t),this.enterOuterAlt(t,6),this.state=92,this.match(h.TIME);break;case 7:t=new q(this,t),this.enterOuterAlt(t,7),this.state=93,this.quantity()}}catch(e){if(!(e instanceof r.error.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t},B.prototype=Object.create(r.ParserRuleContext.prototype),B.prototype.constructor=B,B.prototype.identifier=function(){return this.getTypedRuleContext(nt,0)},B.prototype.STRING=function(){return this.getToken(h.STRING,0)},B.prototype.enterRule=function(t){t instanceof i&&t.enterExternalConstant(this)},B.prototype.exitRule=function(t){t instanceof i&&t.exitExternalConstant(this)},h.ExternalConstantContext=B,h.prototype.externalConstant=function(){var t=new B(this,this._ctx,this.state);this.enterRule(t,6,h.RULE_externalConstant);try{switch(this.enterOuterAlt(t,1),this.state=96,this.match(h.T__33),this.state=99,this._errHandler.sync(this),this._input.LA(1)){case h.T__15:case h.T__16:case h.T__21:case h.T__22:case h.IDENTIFIER:case h.DELIMITEDIDENTIFIER:this.state=97,this.identifier();break;case h.STRING:this.state=98,this.match(h.STRING);break;default:throw new r.error.NoViableAltException(this)}}catch(e){if(!(e instanceof r.error.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t},V.prototype=Object.create(r.ParserRuleContext.prototype),V.prototype.constructor=V,V.prototype.copyFrom=function(t){r.ParserRuleContext.prototype.copyFrom.call(this,t)},H.prototype=Object.create(V.prototype),H.prototype.constructor=H,h.TotalInvocationContext=H,H.prototype.enterRule=function(t){t instanceof i&&t.enterTotalInvocation(this)},H.prototype.exitRule=function(t){t instanceof i&&t.exitTotalInvocation(this)},Q.prototype=Object.create(V.prototype),Q.prototype.constructor=Q,h.ThisInvocationContext=Q,Q.prototype.enterRule=function(t){t instanceof i&&t.enterThisInvocation(this)},Q.prototype.exitRule=function(t){t instanceof i&&t.exitThisInvocation(this)},z.prototype=Object.create(V.prototype),z.prototype.constructor=z,h.IndexInvocationContext=z,z.prototype.enterRule=function(t){t instanceof i&&t.enterIndexInvocation(this)},z.prototype.exitRule=function(t){t instanceof i&&t.exitIndexInvocation(this)},W.prototype=Object.create(V.prototype),W.prototype.constructor=W,h.FunctionInvocationContext=W,W.prototype.functn=function(){return this.getTypedRuleContext(K,0)},W.prototype.enterRule=function(t){t instanceof i&&t.enterFunctionInvocation(this)},W.prototype.exitRule=function(t){t instanceof i&&t.exitFunctionInvocation(this)},Y.prototype=Object.create(V.prototype),Y.prototype.constructor=Y,h.MemberInvocationContext=Y,Y.prototype.identifier=function(){return this.getTypedRuleContext(nt,0)},Y.prototype.enterRule=function(t){t instanceof i&&t.enterMemberInvocation(this)},Y.prototype.exitRule=function(t){t instanceof i&&t.exitMemberInvocation(this)},h.InvocationContext=V,h.prototype.invocation=function(){var t=new V(this,this._ctx,this.state);this.enterRule(t,8,h.RULE_invocation);try{switch(this.state=106,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,6,this._ctx)){case 1:t=new Y(this,t),this.enterOuterAlt(t,1),this.state=101,this.identifier();break;case 2:t=new W(this,t),this.enterOuterAlt(t,2),this.state=102,this.functn();break;case 3:t=new Q(this,t),this.enterOuterAlt(t,3),this.state=103,this.match(h.T__34);break;case 4:t=new z(this,t),this.enterOuterAlt(t,4),this.state=104,this.match(h.T__35);break;case 5:t=new H(this,t),this.enterOuterAlt(t,5),this.state=105,this.match(h.T__36)}}catch(e){if(!(e instanceof r.error.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t},K.prototype=Object.create(r.ParserRuleContext.prototype),K.prototype.constructor=K,K.prototype.identifier=function(){return this.getTypedRuleContext(nt,0)},K.prototype.paramList=function(){return this.getTypedRuleContext(G,0)},K.prototype.enterRule=function(t){t instanceof i&&t.enterFunctn(this)},K.prototype.exitRule=function(t){t instanceof i&&t.exitFunctn(this)},h.FunctnContext=K,h.prototype.functn=function(){var t=new K(this,this._ctx,this.state);this.enterRule(t,10,h.RULE_functn);var e=0;try{this.enterOuterAlt(t,1),this.state=108,this.identifier(),this.state=109,this.match(h.T__27),this.state=111,this._errHandler.sync(this),(0==(-32&(e=this._input.LA(1)))&&0!=(1<<e&(1<<h.T__3|1<<h.T__4|1<<h.T__15|1<<h.T__16|1<<h.T__21|1<<h.T__22|1<<h.T__27|1<<h.T__29))||0==(e-32&-32)&&0!=(1<<e-32&(1<<h.T__31-32|1<<h.T__32-32|1<<h.T__33-32|1<<h.T__34-32|1<<h.T__35-32|1<<h.T__36-32|1<<h.DATETIME-32|1<<h.TIME-32|1<<h.IDENTIFIER-32|1<<h.DELIMITEDIDENTIFIER-32|1<<h.STRING-32|1<<h.NUMBER-32)))&&(this.state=110,this.paramList()),this.state=113,this.match(h.T__28)}catch(e){if(!(e instanceof r.error.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t},G.prototype=Object.create(r.ParserRuleContext.prototype),G.prototype.constructor=G,G.prototype.expression=function(t){return void 0===t&&(t=null),null===t?this.getTypedRuleContexts(f):this.getTypedRuleContext(f,t)},G.prototype.enterRule=function(t){t instanceof i&&t.enterParamList(this)},G.prototype.exitRule=function(t){t instanceof i&&t.exitParamList(this)},h.ParamListContext=G,h.prototype.paramList=function(){var t=new G(this,this._ctx,this.state);this.enterRule(t,12,h.RULE_paramList);var e=0;try{for(this.enterOuterAlt(t,1),this.state=115,this.expression(0),this.state=120,this._errHandler.sync(this),e=this._input.LA(1);e===h.T__37;)this.state=116,this.match(h.T__37),this.state=117,this.expression(0),this.state=122,this._errHandler.sync(this),e=this._input.LA(1)}catch(e){if(!(e instanceof r.error.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t},$.prototype=Object.create(r.ParserRuleContext.prototype),$.prototype.constructor=$,$.prototype.NUMBER=function(){return this.getToken(h.NUMBER,0)},$.prototype.unit=function(){return this.getTypedRuleContext(X,0)},$.prototype.enterRule=function(t){t instanceof i&&t.enterQuantity(this)},$.prototype.exitRule=function(t){t instanceof i&&t.exitQuantity(this)},h.QuantityContext=$,h.prototype.quantity=function(){var t=new $(this,this._ctx,this.state);this.enterRule(t,14,h.RULE_quantity);try{this.enterOuterAlt(t,1),this.state=123,this.match(h.NUMBER),this.state=125,this._errHandler.sync(this),1===this._interp.adaptivePredict(this._input,9,this._ctx)&&(this.state=124,this.unit())}catch(e){if(!(e instanceof r.error.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t},X.prototype=Object.create(r.ParserRuleContext.prototype),X.prototype.constructor=X,X.prototype.dateTimePrecision=function(){return this.getTypedRuleContext(J,0)},X.prototype.pluralDateTimePrecision=function(){return this.getTypedRuleContext(Z,0)},X.prototype.STRING=function(){return this.getToken(h.STRING,0)},X.prototype.enterRule=function(t){t instanceof i&&t.enterUnit(this)},X.prototype.exitRule=function(t){t instanceof i&&t.exitUnit(this)},h.UnitContext=X,h.prototype.unit=function(){var t=new X(this,this._ctx,this.state);this.enterRule(t,16,h.RULE_unit);try{switch(this.state=130,this._errHandler.sync(this),this._input.LA(1)){case h.T__38:case h.T__39:case h.T__40:case h.T__41:case h.T__42:case h.T__43:case h.T__44:case h.T__45:this.enterOuterAlt(t,1),this.state=127,this.dateTimePrecision();break;case h.T__46:case h.T__47:case h.T__48:case h.T__49:case h.T__50:case h.T__51:case h.T__52:case h.T__53:this.enterOuterAlt(t,2),this.state=128,this.pluralDateTimePrecision();break;case h.STRING:this.enterOuterAlt(t,3),this.state=129,this.match(h.STRING);break;default:throw new r.error.NoViableAltException(this)}}catch(e){if(!(e instanceof r.error.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t},J.prototype=Object.create(r.ParserRuleContext.prototype),J.prototype.constructor=J,J.prototype.enterRule=function(t){t instanceof i&&t.enterDateTimePrecision(this)},J.prototype.exitRule=function(t){t instanceof i&&t.exitDateTimePrecision(this)},h.DateTimePrecisionContext=J,h.prototype.dateTimePrecision=function(){var t=new J(this,this._ctx,this.state);this.enterRule(t,18,h.RULE_dateTimePrecision);var e=0;try{this.enterOuterAlt(t,1),this.state=132,0!=((e=this._input.LA(1))-39&-32)||0==(1<<e-39&(1<<h.T__38-39|1<<h.T__39-39|1<<h.T__40-39|1<<h.T__41-39|1<<h.T__42-39|1<<h.T__43-39|1<<h.T__44-39|1<<h.T__45-39))?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof r.error.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t},Z.prototype=Object.create(r.ParserRuleContext.prototype),Z.prototype.constructor=Z,Z.prototype.enterRule=function(t){t instanceof i&&t.enterPluralDateTimePrecision(this)},Z.prototype.exitRule=function(t){t instanceof i&&t.exitPluralDateTimePrecision(this)},h.PluralDateTimePrecisionContext=Z,h.prototype.pluralDateTimePrecision=function(){var t=new Z(this,this._ctx,this.state);this.enterRule(t,20,h.RULE_pluralDateTimePrecision);var e=0;try{this.enterOuterAlt(t,1),this.state=134,0!=((e=this._input.LA(1))-47&-32)||0==(1<<e-47&(1<<h.T__46-47|1<<h.T__47-47|1<<h.T__48-47|1<<h.T__49-47|1<<h.T__50-47|1<<h.T__51-47|1<<h.T__52-47|1<<h.T__53-47))?this._errHandler.recoverInline(this):(this._errHandler.reportMatch(this),this.consume())}catch(e){if(!(e instanceof r.error.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t},tt.prototype=Object.create(r.ParserRuleContext.prototype),tt.prototype.constructor=tt,tt.prototype.qualifiedIdentifier=function(){return this.getTypedRuleContext(et,0)},tt.prototype.enterRule=function(t){t instanceof i&&t.enterTypeSpecifier(this)},tt.prototype.exitRule=function(t){t instanceof i&&t.exitTypeSpecifier(this)},h.TypeSpecifierContext=tt,h.prototype.typeSpecifier=function(){var t=new tt(this,this._ctx,this.state);this.enterRule(t,22,h.RULE_typeSpecifier);try{this.enterOuterAlt(t,1),this.state=136,this.qualifiedIdentifier()}catch(e){if(!(e instanceof r.error.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t},et.prototype=Object.create(r.ParserRuleContext.prototype),et.prototype.constructor=et,et.prototype.identifier=function(t){return void 0===t&&(t=null),null===t?this.getTypedRuleContexts(nt):this.getTypedRuleContext(nt,t)},et.prototype.enterRule=function(t){t instanceof i&&t.enterQualifiedIdentifier(this)},et.prototype.exitRule=function(t){t instanceof i&&t.exitQualifiedIdentifier(this)},h.QualifiedIdentifierContext=et,h.prototype.qualifiedIdentifier=function(){var t=new et(this,this._ctx,this.state);this.enterRule(t,24,h.RULE_qualifiedIdentifier);try{this.enterOuterAlt(t,1),this.state=138,this.identifier(),this.state=143,this._errHandler.sync(this);for(var e=this._interp.adaptivePredict(this._input,11,this._ctx);2!=e&&e!=r.atn.ATN.INVALID_ALT_NUMBER;)1===e&&(this.state=139,this.match(h.T__0),this.state=140,this.identifier()),this.state=145,this._errHandler.sync(this),e=this._interp.adaptivePredict(this._input,11,this._ctx)}catch(e){if(!(e instanceof r.error.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t},nt.prototype=Object.create(r.ParserRuleContext.prototype),nt.prototype.constructor=nt,nt.prototype.IDENTIFIER=function(){return this.getToken(h.IDENTIFIER,0)},nt.prototype.DELIMITEDIDENTIFIER=function(){return this.getToken(h.DELIMITEDIDENTIFIER,0)},nt.prototype.enterRule=function(t){t instanceof i&&t.enterIdentifier(this)},nt.prototype.exitRule=function(t){t instanceof i&&t.exitIdentifier(this)},h.IdentifierContext=nt,h.prototype.identifier=function(){var t=new nt(this,this._ctx,this.state);this.enterRule(t,26,h.RULE_identifier);var e=0;try{this.enterOuterAlt(t,1),this.state=146,0==(-32&(e=this._input.LA(1)))&&0!=(1<<e&(1<<h.T__15|1<<h.T__16|1<<h.T__21|1<<h.T__22))||e===h.IDENTIFIER||e===h.DELIMITEDIDENTIFIER?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(e){if(!(e instanceof r.error.RecognitionException))throw e;t.exception=e,this._errHandler.reportError(this,e),this._errHandler.recover(this,e)}finally{this.exitRule()}return t},h.prototype.sempred=function(t,e,n){switch(e){case 0:return this.expression_sempred(t,n);default:throw"No predicate with index:"+e}},h.prototype.expression_sempred=function(t,e){switch(e){case 0:return this.precpred(this._ctx,10);case 1:return this.precpred(this._ctx,9);case 2:return this.precpred(this._ctx,8);case 3:return this.precpred(this._ctx,7);case 4:return this.precpred(this._ctx,5);case 5:return this.precpred(this._ctx,4);case 6:return this.precpred(this._ctx,3);case 7:return this.precpred(this._ctx,2);case 8:return this.precpred(this._ctx,1);case 9:return this.precpred(this._ctx,13);case 10:return this.precpred(this._ctx,12);case 11:return this.precpred(this._ctx,6);default:throw"No predicate with index:"+e}},e.FHIRPathParser=h},function(t,e){t.exports=function(t){var e=new Date(t.getTime()),n=e.getTimezoneOffset();return e.setSeconds(0,0),6e4*n+e.getTime()%6e4}},function(t,e){t.exports=function(t){return t instanceof Date}},function(t,e,n){var r=n(38);t.exports=function(t,e){var n=Number(e);return r(t,12*n)}},function(t,e,n){var r=n(21);t.exports=function(t){var e=r(t),n=e.getFullYear(),i=e.getMonth(),o=new Date(0);return o.setFullYear(n,i+1,0),o.setHours(0,0,0,0),o.getDate()}},function(t,e,n){var r=n(39);t.exports=function(t,e){var n=Number(e);return r(t,7*n)}},function(t,e,n){var r=n(20);t.exports=function(t,e){var n=Number(e);return r(t,36e5*n)}},function(t,e,n){var r=n(20);t.exports=function(t,e){var n=Number(e);return r(t,1e3*n)}},function(t,e){var n=Function.prototype.call.bind(Array.prototype.slice);Number.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},String.prototype.startsWith||Object.defineProperty(String.prototype,"startsWith",{value:function(t,e){return e=e||0,this.indexOf(t,e)===e}}),String.prototype.endsWith||Object.defineProperty(String.prototype,"endsWith",{value:function(t,e){var n=this.toString();(void 0===e||e>n.length)&&(e=n.length),e-=t.length;var r=n.indexOf(t,e);return-1!==r&&r===e}}),String.prototype.includes||Object.defineProperty(String.prototype,"includes",{value:function(){return-1!==this.indexOf.apply(this,arguments)}}),Object.assign||Object.defineProperty(Object,"assign",{value:function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");return n(arguments,1).reduce((function(t,e){return Object.keys(Object(e)).forEach((function(n){t[n]=e[n]})),t}),Object(t))}})},function(t,e){var n={aggregateMacro:function(t,e,n){var r=this;return t.reduce((function(t,n,i){return r.$index=i,r.$total=e(n)}),this.$total=n)}};t.exports=n},function(t,e,n){var r={},i=n(41);r.union=function(t,e){return i.distinctFn(t.concat(e))},r.combineFn=function(t,e){return t.concat(e)},t.exports=r},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=n(7),o=n(8),a=o.FP_Quantity,s={iifMacro:function(t,e,n,r){return i.isTrue(e(t))?n(t):r?r(t):[]},traceFn:function(t,e){return console.log("TRACE:["+(e||"")+"]",JSON.stringify(t,null," ")),t}},u=/^[+-]?\d+$/;s.toInteger=function(t){if(1!=t.length)return[];var e=i.valData(t[0]);return!1===e?0:!0===e?1:"number"==typeof e?Number.isInteger(e)?e:[]:"string"==typeof e&&u.test(e)?parseInt(e):[]};var c=/^((\+|-)?\d+(\.\d+)?)\s*(('[^']+')|([a-zA-Z]+))?$/,l=1,p=5,h=6;s.toQuantity=function(t,e){var n;if(e&&!a.mapTimeUnitsToUCUMCode[e]&&(e="'".concat(e,"'")),t.length>1)throw new Error("Could not convert to quantity: input collection contains multiple items");if(1===t.length){var r,o=t[0],s=i.valData(o);if("number"==typeof s)n=new a(s,"'1'");else if(s instanceof a)n=s;else if("boolean"==typeof s)n=new a(s?1:0,"'1'");else if("string"==typeof s&&(r=c.exec(s))){var u=r[l],f=r[p],d=r[h];d&&!a.mapTimeUnitsToUCUMCode[d]||(n=new a(Number(u),f||d||"'1'"))}n&&e&&n.unit!==e&&(n=a.convUnitTo(n.unit,n.value,e))}return n||[]};var f=/^[+-]?\d+(\.\d+)?$/;function d(t){var e=t.slice(3);s["to"+e]=function(n){var r=[];if(n.length>1)throw Error("to "+e+" called for a collection of length "+n.length);if(1===n.length){var a=o[t].checkString(i.valData(n[0]));a&&(r=a)}return r}}s.toDecimal=function(t){if(1!=t.length)return[];var e=i.valData(t[0]);if(!1===e)return 0;if(!0===e)return 1;if("number"==typeof e)return e;if("string"==typeof e){if(f.test(e))return parseFloat(e);throw new Error("Could not convert to decimal: "+e)}return[]},s.toString=function(t){return 1!=t.length?[]:i.valData(t[0]).toString()},d("FP_DateTime"),d("FP_Time");var y=["true","t","yes","y","1","1.0"].reduce((function(t,e){return t[e]=!0,t}),{}),g=["false","f","no","n","0","0.0"].reduce((function(t,e){return t[e]=!0,t}),{});s.toBoolean=function(t){if(1!==t.length)return[];var e=i.valData(t[0]);switch(r(e)){case"boolean":return e;case"number":if(1===e)return!0;if(0===e)return!1;break;case"string":var n=e.toLowerCase();if(y[n])return!0;if(g[n])return!1}return[]},s.createConvertsToFn=function(t,e){return"string"==typeof e?function(n){return 1!==n.length?[]:r(t(n))===e}:function(n){return 1!==n.length?[]:t(n)instanceof e}},t.exports=s},function(t,e,n){var r=n(7),i=n(43),o=n(8),a=o.FP_Type,s=o.FP_DateTime,u=o.FP_Time,c={};function l(t,e){return r.isEmpty(t)||r.isEmpty(e)?[]:i(t,e)}function p(t,e){return r.isEmpty(t)&&r.isEmpty(e)?[!0]:r.isEmpty(t)||r.isEmpty(e)?[]:i(t,e,{fuzzy:!0})}function h(t,e){var n=null;r.assertAtMostOne(t,"Singleton was expected"),r.assertAtMostOne(e,"Singleton was expected"),t=r.valData(t[0]),e=r.valData(e[0]);var i,o=t.constructor,a=e.constructor;o!=a&&(o!==String||a!==s&&a!==u?a!==String||o!==s&&o!==u||(i=o.checkString(e))&&(n=[t,i]):(i=a.checkString(t))&&(n=[i,e]),n||r.raiseError('Type of "'+t+'" ('+o.name+') did not match type of "'+e+'" ('+a.name+")","InequalityExpression"));return n||[t,e]}c.equal=function(t,e){return l(t,e)},c.unequal=function(t,e){var n=l(t,e);return void 0===n?void 0:!n},c.equival=function(t,e){return p(t,e)},c.unequival=function(t,e){return!p(t,e)},c.lt=function(t,e){if(!t.length||!e.length)return[];var n=h(t,e),r=n[0],i=n[1];return r instanceof a?-1==r.compare(i):r<i},c.gt=function(t,e){if(!t.length||!e.length)return[];var n=h(t,e),r=n[0],i=n[1];return r instanceof a?1==r.compare(i):r>i},c.lte=function(t,e){if(!t.length||!e.length)return[];var n=h(t,e),r=n[0],i=n[1];return r instanceof a?r.compare(i)<=0:r<=i},c.gte=function(t,e){if(!t.length||!e.length)return[];var n=h(t,e),r=n[0],i=n[1];return r instanceof a?r.compare(i)>=0:r>=i},t.exports=c},function(t,e,n){var r=n(43),i={};function o(t,e){if(0==e.length)return!0;for(var n=0;n<t.length;n++)if(r(t[n],e[0]))return!0;return!1}i.contains=function(t,e){if(0==e.length)return[];if(0==t.length)return!1;if(e.length>1)throw new Error("Expected singleton on right side of contains, got "+JSON.stringify(e));return o(t,e)},i.in=function(t,e){if(0==t.length)return[];if(0==e.length)return!1;if(t.length>1)throw new Error("Expected singleton on right side of in, got "+JSON.stringify(e));return o(e,t)},t.exports=i},function(t,e,n){var r=n(8),i=r.FP_TimeBase,o=r.FP_Quantity,a=n(7),s={};function u(t){var e=a.valData(t);if("number"!=typeof e){if(1==e.length&&"number"==typeof(e=a.valData(e[0])))return e;throw new Error("Expected number, but got "+JSON.stringify(e||t))}return e}function c(t){return"number"!=typeof t&&0==t.length}s.amp=function(t,e){return(t||"")+(e||"")},s.plus=function(t,e){if(1==t.length&&1==e.length){var n=a.valData(t[0]),r=a.valData(e[0]);if("string"==typeof n&&"string"==typeof r)return n+r;if("number"==typeof n&&"number"==typeof r)return n+r;if(n instanceof i&&r instanceof o)return n.plus(r)}throw new Error("Cannot "+JSON.stringify(t)+" + "+JSON.stringify(e))},s.minus=function(t,e){if(1==t.length&&1==e.length){var n=a.valData(t[0]),r=a.valData(e[0]);if("number"==typeof n&&"number"==typeof r)return n-r;if(n instanceof i&&r instanceof o)return n.plus(new o(-r.value,r.unit))}throw new Error("Cannot "+JSON.stringify(t)+" - "+JSON.stringify(e))},s.mul=function(t,e){return t*e},s.div=function(t,e){return t/e},s.intdiv=function(t,e){return Math.floor(t/e)},s.mod=function(t,e){return t%e},s.abs=function(t){if(c(t))return[];var e=u(t);return Math.abs(e)},s.ceiling=function(t){if(c(t))return[];var e=u(t);return Math.ceil(e)},s.exp=function(t){if(c(t))return[];var e=u(t);return Math.exp(e)},s.floor=function(t){if(c(t))return[];var e=u(t);return Math.floor(e)},s.ln=function(t){if(c(t))return[];var e=u(t);return Math.log(e)},s.log=function(t,e){if(c(t)||c(e))return[];var n=u(t),r=u(e);return Math.log(n)/Math.log(r)},s.power=function(t,e){if(c(t)||c(e))return[];var n=u(t),r=u(e);return n<0&&Math.floor(r)!=r?[]:Math.pow(n,r)},s.round=function(t,e){if(c(t))return[];var n=u(t);if(c(e))return Math.round(n);var r=u(e),i=Math.pow(10,r);return Math.round(n*i)/i},s.sqrt=function(t){if(c(t))return[];var e=u(t);return e<0?[]:Math.sqrt(e)},s.truncate=function(t){if(c(t))return[];var e=u(t);return Math.trunc(e)},t.exports=s},function(t,e,n){var r=n(7),i={};function o(t){var e;if(1==t.length&&"string"==typeof(e=r.valData(t[0])))return e;throw new Error("Expected string, but got "+JSON.stringify(e||t))}i.indexOf=function(t,e){return o(t).indexOf(e)},i.substring=function(t,e,n){var i=o(t);return r.isEmpty(e)||e<0||e>=i.length?[]:void 0===n||r.isEmpty(n)?i.substring(e):i.substring(e,e+n)},i.startsWith=function(t,e){return o(t).startsWith(e)},i.endsWith=function(t,e){return o(t).endsWith(e)},i.containsFn=function(t,e){return o(t).includes(e)},i.matches=function(t,e){var n=o(t);return new RegExp(e).test(n)},i.replace=function(t,e,n){return o(t).replace(e,n)},i.replaceMatches=function(t,e,n){var r=o(t),i=new RegExp(e);return r.replace(i,n)},i.length=function(t){return o(t).length},t.exports=i},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=n(7),o=n(8).ResourceNode.makeResNode,a={children:function(t){var e=this.model;return t.reduce((function(t,n){var a=i.valData(n);if(n=o(n),"object"===r(a)){for(var s=0,u=Object.keys(a);s<u.length;s++){var c=u[s],l=a[c],p=n.path+"."+c;if(e){var h=e.pathsDefinedElsewhere[p];h&&(p=h)}Array.isArray(l)?t.push.apply(t,l.map((function(t){return o(t,p)}))):t.push(o(l,p))}return t}return t}),[])},descendants:function(t){for(var e=a.children.call(this,t),n=[];e.length>0;)n.push.apply(n,e),e=a.children.call(this,e);return n}};t.exports=a},function(t,e,n){var r={},i=n(8),o=n(40),a=i.FP_DateTime;r.now=function(){if(!o.now){var t=o.nowDate,e=a.isoDateTime(t);o.now=new a(e)}return o.now},r.today=function(){if(!o.today){var t=o.nowDate,e=a.isoDate(t);o.today=new a(e)}return o.today},t.exports=r},function(t,e){var n={orOp:function(t,e){if(Array.isArray(e)){if(!0===t)return!0;if(!1===t)return[];if(Array.isArray(t))return[]}return Array.isArray(t)?!0===e||[]:t||e},andOp:function(t,e){if(Array.isArray(e)){if(!0===t)return[];if(!1===t)return!1;if(Array.isArray(t))return[]}return Array.isArray(t)?!0===e&&[]:t&&e},xorOp:function(t,e){return Array.isArray(t)||Array.isArray(e)?[]:t&&!e||!t&&e},impliesOp:function(t,e){if(Array.isArray(e)){if(!0===t)return[];if(!1===t)return!0;if(Array.isArray(t))return[]}return Array.isArray(t)?!0===e||[]:!1===t||t&&e}};t.exports=n},function(t,e,n){t.exports={choiceTypePaths:n(83),pathsDefinedElsewhere:n(84)}},function(t){t.exports=JSON.parse('{"ActivityDefinition.product":["Reference","CodeableConcept"],"ActivityDefinition.subject":["CodeableConcept","Reference"],"ActivityDefinition.timing":["Timing","DateTime","Age","Period","Range","Duration"],"AllergyIntolerance.onset":["DateTime","Age","Period","Range","String"],"Annotation.author":["Reference","String"],"AuditEvent.entity.detail.value":["String","Base64Binary"],"BiologicallyDerivedProduct.collection.collected":["DateTime","Period"],"BiologicallyDerivedProduct.manipulation.time":["DateTime","Period"],"BiologicallyDerivedProduct.processing.time":["DateTime","Period"],"CarePlan.activity.detail.product":["CodeableConcept","Reference"],"CarePlan.activity.detail.scheduled":["Timing","Period","String"],"ChargeItem.occurrence":["DateTime","Period","Timing"],"ChargeItem.product":["Reference","CodeableConcept"],"Claim.accident.location":["Address","Reference"],"Claim.diagnosis.diagnosis":["CodeableConcept","Reference"],"Claim.item.location":["CodeableConcept","Address","Reference"],"Claim.item.serviced":["Date","Period"],"Claim.procedure.procedure":["CodeableConcept","Reference"],"Claim.supportingInfo.timing":["Date","Period"],"Claim.supportingInfo.value":["Boolean","String","Quantity","Attachment","Reference"],"ClaimResponse.addItem.location":["CodeableConcept","Address","Reference"],"ClaimResponse.addItem.serviced":["Date","Period"],"ClinicalImpression.effective":["DateTime","Period"],"CodeSystem.concept.property.value":["Code","Coding","String","Integer","Boolean","DateTime","Decimal"],"Communication.payload.content":["String","Attachment","Reference"],"CommunicationRequest.occurrence":["DateTime","Period"],"CommunicationRequest.payload.content":["String","Attachment","Reference"],"Composition.relatesTo.target":["Identifier","Reference"],"ConceptMap.source":["Uri","Canonical"],"ConceptMap.target":["Uri","Canonical"],"Condition.abatement":["DateTime","Age","Period","Range","String"],"Condition.onset":["DateTime","Age","Period","Range","String"],"Consent.source":["Attachment","Reference"],"Contract.friendly.content":["Attachment","Reference"],"Contract.legal.content":["Attachment","Reference"],"Contract.legallyBinding":["Attachment","Reference"],"Contract.rule.content":["Attachment","Reference"],"Contract.term.action.occurrence":["DateTime","Period","Timing"],"Contract.term.asset.valuedItem.entity":["CodeableConcept","Reference"],"Contract.term.offer.answer.value":["Boolean","Decimal","Integer","Date","DateTime","Time","String","Uri","Attachment","Coding","Quantity","Reference"],"Contract.term.topic":["CodeableConcept","Reference"],"Contract.topic":["CodeableConcept","Reference"],"Coverage.costToBeneficiary.value":["Quantity","Money"],"CoverageEligibilityRequest.item.diagnosis.diagnosis":["CodeableConcept","Reference"],"CoverageEligibilityRequest.serviced":["Date","Period"],"CoverageEligibilityResponse.insurance.item.benefit.allowed":["UnsignedInt","String","Money"],"CoverageEligibilityResponse.insurance.item.benefit.used":["UnsignedInt","String","Money"],"CoverageEligibilityResponse.serviced":["Date","Period"],"DataRequirement.dateFilter.value":["DateTime","Period","Duration"],"DataRequirement.subject":["CodeableConcept","Reference"],"DetectedIssue.identified":["DateTime","Period"],"DeviceDefinition.manufacturer":["String","Reference"],"DeviceRequest.code":["Reference","CodeableConcept"],"DeviceRequest.occurrence":["DateTime","Period","Timing"],"DeviceRequest.parameter.value":["CodeableConcept","Quantity","Range","Boolean"],"DeviceUseStatement.timing":["Timing","Period","DateTime"],"DiagnosticReport.effective":["DateTime","Period"],"Dosage.asNeeded":["Boolean","CodeableConcept"],"Dosage.doseAndRate.dose":["Range","Quantity"],"Dosage.doseAndRate.rate":["Ratio","Range","Quantity"],"ElementDefinition.defaultValue":["Base64Binary","Boolean","Canonical","Code","Date","DateTime","Decimal","Id","Instant","Integer","Markdown","Oid","PositiveInt","String","Time","UnsignedInt","Uri","Url","Uuid","Address","Age","Annotation","Attachment","CodeableConcept","Coding","ContactPoint","Count","Distance","Duration","HumanName","Identifier","Money","Period","Quantity","Range","Ratio","Reference","SampledData","Signature","Timing","ContactDetail","Contributor","DataRequirement","Expression","ParameterDefinition","RelatedArtifact","TriggerDefinition","UsageContext","Dosage","Meta"],"ElementDefinition.example.value":["Base64Binary","Boolean","Canonical","Code","Date","DateTime","Decimal","Id","Instant","Integer","Markdown","Oid","PositiveInt","String","Time","UnsignedInt","Uri","Url","Uuid","Address","Age","Annotation","Attachment","CodeableConcept","Coding","ContactPoint","Count","Distance","Duration","HumanName","Identifier","Money","Period","Quantity","Range","Ratio","Reference","SampledData","Signature","Timing","ContactDetail","Contributor","DataRequirement","Expression","ParameterDefinition","RelatedArtifact","TriggerDefinition","UsageContext","Dosage","Meta"],"ElementDefinition.extension.value":["CodeableConcept","Canonical"],"ElementDefinition.fixed":["Base64Binary","Boolean","Canonical","Code","Date","DateTime","Decimal","Id","Instant","Integer","Markdown","Oid","PositiveInt","String","Time","UnsignedInt","Uri","Url","Uuid","Address","Age","Annotation","Attachment","CodeableConcept","Coding","ContactPoint","Count","Distance","Duration","HumanName","Identifier","Money","Period","Quantity","Range","Ratio","Reference","SampledData","Signature","Timing","ContactDetail","Contributor","DataRequirement","Expression","ParameterDefinition","RelatedArtifact","TriggerDefinition","UsageContext","Dosage","Meta"],"ElementDefinition.maxValue":["Date","DateTime","Instant","Time","Decimal","Integer","PositiveInt","UnsignedInt","Quantity"],"ElementDefinition.minValue":["Date","DateTime","Instant","Time","Decimal","Integer","PositiveInt","UnsignedInt","Quantity"],"ElementDefinition.pattern":["Base64Binary","Boolean","Canonical","Code","Date","DateTime","Decimal","Id","Instant","Integer","Markdown","Oid","PositiveInt","String","Time","UnsignedInt","Uri","Url","Uuid","Address","Age","Annotation","Attachment","CodeableConcept","Coding","ContactPoint","Count","Distance","Duration","HumanName","Identifier","Money","Period","Quantity","Range","Ratio","Reference","SampledData","Signature","Timing","ContactDetail","Contributor","DataRequirement","Expression","ParameterDefinition","RelatedArtifact","TriggerDefinition","UsageContext","Dosage","Meta"],"EventDefinition.subject":["CodeableConcept","Reference"],"EvidenceVariable.characteristic.definition":["Reference","Canonical","CodeableConcept","Expression","DataRequirement","TriggerDefinition"],"EvidenceVariable.characteristic.participantEffective":["DateTime","Period","Duration","Timing"],"ExplanationOfBenefit.accident.location":["Address","Reference"],"ExplanationOfBenefit.addItem.location":["CodeableConcept","Address","Reference"],"ExplanationOfBenefit.addItem.serviced":["Date","Period"],"ExplanationOfBenefit.benefitBalance.financial.allowed":["UnsignedInt","String","Money"],"ExplanationOfBenefit.benefitBalance.financial.used":["UnsignedInt","Money"],"ExplanationOfBenefit.diagnosis.diagnosis":["CodeableConcept","Reference"],"ExplanationOfBenefit.item.location":["CodeableConcept","Address","Reference"],"ExplanationOfBenefit.item.serviced":["Date","Period"],"ExplanationOfBenefit.procedure.procedure":["CodeableConcept","Reference"],"ExplanationOfBenefit.supportingInfo.timing":["Date","Period"],"ExplanationOfBenefit.supportingInfo.value":["Boolean","String","Quantity","Attachment","Reference"],"Extension.value":["Base64Binary","Boolean","Canonical","Code","Date","DateTime","Decimal","Id","Instant","Integer","Markdown","Oid","PositiveInt","String","Time","UnsignedInt","Uri","Url","Uuid","Address","Age","Annotation","Attachment","CodeableConcept","Coding","ContactPoint","Count","Distance","Duration","HumanName","Identifier","Money","Period","Quantity","Range","Ratio","Reference","SampledData","Signature","Timing","ContactDetail","Contributor","DataRequirement","Expression","ParameterDefinition","RelatedArtifact","TriggerDefinition","UsageContext","Dosage","Meta"],"FamilyMemberHistory.age":["Age","Range","String"],"FamilyMemberHistory.born":["Period","Date","String"],"FamilyMemberHistory.condition.onset":["Age","Range","Period","String"],"FamilyMemberHistory.deceased":["Boolean","Age","Range","Date","String"],"Goal.start":["Date","CodeableConcept"],"Goal.target.detail":["Quantity","Range","CodeableConcept","String","Boolean","Integer","Ratio"],"Goal.target.due":["Date","Duration"],"Group.characteristic.value":["CodeableConcept","Boolean","Quantity","Range","Reference"],"GuidanceResponse.module":["Uri","Canonical","CodeableConcept"],"Immunization.occurrence":["DateTime","String"],"Immunization.protocolApplied.doseNumber":["PositiveInt","String"],"Immunization.protocolApplied.seriesDoses":["PositiveInt","String"],"ImmunizationEvaluation.doseNumber":["PositiveInt","String"],"ImmunizationEvaluation.seriesDoses":["PositiveInt","String"],"ImmunizationRecommendation.recommendation.doseNumber":["PositiveInt","String"],"ImmunizationRecommendation.recommendation.seriesDoses":["PositiveInt","String"],"ImplementationGuide.definition.page.name":["Url","Reference"],"ImplementationGuide.definition.resource.example":["Boolean","Canonical"],"ImplementationGuide.manifest.resource.example":["Boolean","Canonical"],"Invoice.lineItem.chargeItem":["Reference","CodeableConcept"],"Library.subject":["CodeableConcept","Reference"],"Measure.subject":["CodeableConcept","Reference"],"Media.created":["DateTime","Period"],"Medication.ingredient.item":["CodeableConcept","Reference"],"MedicationAdministration.dosage.rate":["Ratio","Quantity"],"MedicationAdministration.effective":["DateTime","Period"],"MedicationAdministration.medication":["CodeableConcept","Reference"],"MedicationDispense.medication":["CodeableConcept","Reference"],"MedicationDispense.statusReason":["CodeableConcept","Reference"],"MedicationKnowledge.administrationGuidelines.indication":["CodeableConcept","Reference"],"MedicationKnowledge.administrationGuidelines.patientCharacteristics.characteristic":["CodeableConcept","Quantity"],"MedicationKnowledge.drugCharacteristic.value":["CodeableConcept","String","Quantity","Base64Binary"],"MedicationKnowledge.ingredient.item":["CodeableConcept","Reference"],"MedicationRequest.medication":["CodeableConcept","Reference"],"MedicationRequest.reported":["Boolean","Reference"],"MedicationRequest.substitution.allowed":["Boolean","CodeableConcept"],"MedicationStatement.effective":["DateTime","Period"],"MedicationStatement.medication":["CodeableConcept","Reference"],"MedicinalProduct.specialDesignation.indication":["CodeableConcept","Reference"],"MedicinalProductAuthorization.procedure.date":["Period","DateTime"],"MedicinalProductContraindication.otherTherapy.medication":["CodeableConcept","Reference"],"MedicinalProductIndication.otherTherapy.medication":["CodeableConcept","Reference"],"MedicinalProductInteraction.interactant.item":["Reference","CodeableConcept"],"MessageDefinition.event":["Coding","Uri"],"MessageHeader.event":["Coding","Uri"],"NutritionOrder.enteralFormula.administration.rate":["Quantity","Ratio"],"Observation.component.value":["Quantity","CodeableConcept","String","Boolean","Integer","Range","Ratio","SampledData","Time","DateTime","Period"],"Observation.effective":["DateTime","Period","Timing","Instant"],"Observation.value":["Quantity","CodeableConcept","String","Boolean","Integer","Range","Ratio","SampledData","Time","DateTime","Period"],"Parameters.parameter.value":["Base64Binary","Boolean","Canonical","Code","Date","DateTime","Decimal","Id","Instant","Integer","Markdown","Oid","PositiveInt","String","Time","UnsignedInt","Uri","Url","Uuid","Address","Age","Annotation","Attachment","CodeableConcept","Coding","ContactPoint","Count","Distance","Duration","HumanName","Identifier","Money","Period","Quantity","Range","Ratio","Reference","SampledData","Signature","Timing","ContactDetail","Contributor","DataRequirement","Expression","ParameterDefinition","RelatedArtifact","TriggerDefinition","UsageContext","Dosage","Meta"],"Patient.deceased":["Boolean","DateTime"],"Patient.multipleBirth":["Boolean","Integer"],"PlanDefinition.action.definition":["Canonical","Uri"],"PlanDefinition.action.relatedAction.offset":["Duration","Range"],"PlanDefinition.action.subject":["CodeableConcept","Reference"],"PlanDefinition.action.timing":["DateTime","Age","Period","Duration","Range","Timing"],"PlanDefinition.goal.target.detail":["Quantity","Range","CodeableConcept"],"PlanDefinition.subject":["CodeableConcept","Reference"],"Population.age":["Range","CodeableConcept"],"Procedure.performed":["DateTime","Period","String","Age","Range"],"Provenance.occurred":["Period","DateTime"],"Questionnaire.item.answerOption.value":["Integer","Date","Time","String","Coding","Reference"],"Questionnaire.item.enableWhen.answer":["Boolean","Decimal","Integer","Date","DateTime","Time","String","Coding","Quantity","Reference"],"Questionnaire.item.initial.value":["Boolean","Decimal","Integer","Date","DateTime","Time","String","Uri","Attachment","Coding","Quantity","Reference"],"QuestionnaireResponse.item.answer.value":["Boolean","Decimal","Integer","Date","DateTime","Time","String","Uri","Attachment","Coding","Quantity","Reference"],"RequestGroup.action.relatedAction.offset":["Duration","Range"],"RequestGroup.action.timing":["DateTime","Age","Period","Duration","Range","Timing"],"ResearchDefinition.subject":["CodeableConcept","Reference"],"ResearchElementDefinition.characteristic.definition":["CodeableConcept","Canonical","Expression","DataRequirement"],"ResearchElementDefinition.characteristic.participantEffective":["DateTime","Period","Duration","Timing"],"ResearchElementDefinition.characteristic.studyEffective":["DateTime","Period","Duration","Timing"],"ResearchElementDefinition.subject":["CodeableConcept","Reference"],"RiskAssessment.occurrence":["DateTime","Period"],"RiskAssessment.prediction.probability":["Decimal","Range"],"RiskAssessment.prediction.when":["Period","Range"],"ServiceRequest.asNeeded":["Boolean","CodeableConcept"],"ServiceRequest.occurrence":["DateTime","Period","Timing"],"ServiceRequest.quantity":["Quantity","Ratio","Range"],"Specimen.collection.collected":["DateTime","Period"],"Specimen.collection.fastingStatus":["CodeableConcept","Duration"],"Specimen.container.additive":["CodeableConcept","Reference"],"Specimen.processing.time":["DateTime","Period"],"SpecimenDefinition.typeTested.container.additive.additive":["CodeableConcept","Reference"],"SpecimenDefinition.typeTested.container.minimumVolume":["Quantity","String"],"StructureMap.group.rule.source.defaultValue":["Base64Binary","Boolean","Canonical","Code","Date","DateTime","Decimal","Id","Instant","Integer","Markdown","Oid","PositiveInt","String","Time","UnsignedInt","Uri","Url","Uuid","Address","Age","Annotation","Attachment","CodeableConcept","Coding","ContactPoint","Count","Distance","Duration","HumanName","Identifier","Money","Period","Quantity","Range","Ratio","Reference","SampledData","Signature","Timing","ContactDetail","Contributor","DataRequirement","Expression","ParameterDefinition","RelatedArtifact","TriggerDefinition","UsageContext","Dosage","Meta"],"StructureMap.group.rule.target.parameter.value":["Id","String","Boolean","Integer","Decimal"],"Substance.ingredient.substance":["CodeableConcept","Reference"],"SubstanceAmount.amount":["Quantity","Range","String"],"SubstanceReferenceInformation.target.amount":["Quantity","Range","String"],"SubstanceSpecification.moiety.amount":["Quantity","String"],"SubstanceSpecification.property.amount":["Quantity","String"],"SubstanceSpecification.property.definingSubstance":["Reference","CodeableConcept"],"SubstanceSpecification.relationship.amount":["Quantity","Range","Ratio","String"],"SubstanceSpecification.relationship.substance":["Reference","CodeableConcept"],"SupplyDelivery.occurrence":["DateTime","Period","Timing"],"SupplyDelivery.suppliedItem.item":["CodeableConcept","Reference"],"SupplyRequest.item":["CodeableConcept","Reference"],"SupplyRequest.occurrence":["DateTime","Period","Timing"],"SupplyRequest.parameter.value":["CodeableConcept","Quantity","Range","Boolean"],"Task.input.value":["Base64Binary","Boolean","Canonical","Code","Date","DateTime","Decimal","Id","Instant","Integer","Markdown","Oid","PositiveInt","String","Time","UnsignedInt","Uri","Url","Uuid","Address","Age","Annotation","Attachment","CodeableConcept","Coding","ContactPoint","Count","Distance","Duration","HumanName","Identifier","Money","Period","Quantity","Range","Ratio","Reference","SampledData","Signature","Timing","ContactDetail","Contributor","DataRequirement","Expression","ParameterDefinition","RelatedArtifact","TriggerDefinition","UsageContext","Dosage","Meta"],"Task.output.value":["Base64Binary","Boolean","Canonical","Code","Date","DateTime","Decimal","Id","Instant","Integer","Markdown","Oid","PositiveInt","String","Time","UnsignedInt","Uri","Url","Uuid","Address","Age","Annotation","Attachment","CodeableConcept","Coding","ContactPoint","Count","Distance","Duration","HumanName","Identifier","Money","Period","Quantity","Range","Ratio","Reference","SampledData","Signature","Timing","ContactDetail","Contributor","DataRequirement","Expression","ParameterDefinition","RelatedArtifact","TriggerDefinition","UsageContext","Dosage","Meta"],"Timing.repeat.bounds":["Duration","Range","Period"],"TriggerDefinition.timing":["Timing","Reference","Date","DateTime"],"UsageContext.value":["CodeableConcept","Quantity","Range","Reference"],"ValueSet.expansion.parameter.value":["String","Boolean","Integer","Decimal","Uri","Code","DateTime"]}')},function(t){t.exports=JSON.parse('{"Bundle.entry.link":"Bundle.link","CapabilityStatement.rest.operation":"CapabilityStatement.rest.resource.operation","CapabilityStatement.rest.searchParam":"CapabilityStatement.rest.resource.searchParam","ChargeItemDefinition.propertyGroup.applicability":"ChargeItemDefinition.applicability","ClaimResponse.addItem.adjudication":"ClaimResponse.item.adjudication","ClaimResponse.addItem.detail.adjudication":"ClaimResponse.item.adjudication","ClaimResponse.addItem.detail.subDetail.adjudication":"ClaimResponse.item.adjudication","ClaimResponse.adjudication":"ClaimResponse.item.adjudication","ClaimResponse.item.detail.adjudication":"ClaimResponse.item.adjudication","ClaimResponse.item.detail.subDetail.adjudication":"ClaimResponse.item.adjudication","CodeSystem.concept.concept":"CodeSystem.concept","Composition.section.section":"Composition.section","ConceptMap.group.element.target.product":"ConceptMap.group.element.target.dependsOn","Consent.provision.provision":"Consent.provision","Contract.term.asset.answer":"Contract.term.offer.answer","Contract.term.group":"Contract.term","ExampleScenario.process.step.alternative.step":"ExampleScenario.process.step","ExampleScenario.process.step.operation.request":"ExampleScenario.instance.containedInstance","ExampleScenario.process.step.operation.response":"ExampleScenario.instance.containedInstance","ExampleScenario.process.step.process":"ExampleScenario.process","ExplanationOfBenefit.addItem.adjudication":"ExplanationOfBenefit.item.adjudication","ExplanationOfBenefit.addItem.detail.adjudication":"ExplanationOfBenefit.item.adjudication","ExplanationOfBenefit.addItem.detail.subDetail.adjudication":"ExplanationOfBenefit.item.adjudication","ExplanationOfBenefit.adjudication":"ExplanationOfBenefit.item.adjudication","ExplanationOfBenefit.item.detail.adjudication":"ExplanationOfBenefit.item.adjudication","ExplanationOfBenefit.item.detail.subDetail.adjudication":"ExplanationOfBenefit.item.adjudication","GraphDefinition.link.target.link":"GraphDefinition.link","ImplementationGuide.definition.page.page":"ImplementationGuide.definition.page","Invoice.totalPriceComponent":"Invoice.lineItem.priceComponent","MedicinalProductAuthorization.procedure.application":"MedicinalProductAuthorization.procedure","MedicinalProductIngredient.substance.strength":"MedicinalProductIngredient.specifiedSubstance.strength","MedicinalProductPackaged.packageItem.packageItem":"MedicinalProductPackaged.packageItem","Observation.component.referenceRange":"Observation.referenceRange","OperationDefinition.parameter.part":"OperationDefinition.parameter","Parameters.parameter.part":"Parameters.parameter","PlanDefinition.action.action":"PlanDefinition.action","Provenance.entity.agent":"Provenance.agent","Questionnaire.item.item":"Questionnaire.item","QuestionnaireResponse.item.answer.item":"QuestionnaireResponse.item","QuestionnaireResponse.item.item":"QuestionnaireResponse.item","RequestGroup.action.action":"RequestGroup.action","StructureMap.group.rule.rule":"StructureMap.group.rule","SubstanceSpecification.molecularWeight":"SubstanceSpecification.structure.isotope.molecularWeight","SubstanceSpecification.name.synonym":"SubstanceSpecification.name","SubstanceSpecification.name.translation":"SubstanceSpecification.name","SubstanceSpecification.structure.molecularWeight":"SubstanceSpecification.structure.isotope.molecularWeight","TestReport.teardown.action.operation":"TestReport.setup.action.operation","TestReport.test.action.assert":"TestReport.setup.action.assert","TestReport.test.action.operation":"TestReport.setup.action.operation","TestScript.teardown.action.operation":"TestScript.setup.action.operation","TestScript.test.action.assert":"TestScript.setup.action.assert","TestScript.test.action.operation":"TestScript.setup.action.operation","ValueSet.compose.exclude":"ValueSet.compose.include","ValueSet.expansion.contains.contains":"ValueSet.expansion.contains","ValueSet.expansion.contains.designation":"ValueSet.compose.include.concept.designation"}')},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t.exports=function t(e,n){if(e===n)return!0;if(e&&n&&"object"==r(e)&&"object"==r(n)){if(e.constructor!==n.constructor)return!1;var i,o,a;if(Array.isArray(e)){if((i=e.length)!=n.length)return!1;for(o=i;0!=o--;)if(!t(e[o],n[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if((i=(a=Object.keys(e)).length)!==Object.keys(n).length)return!1;for(o=i;0!=o--;)if(!Object.prototype.hasOwnProperty.call(n,a[o]))return!1;for(o=i;0!=o--;){var s=a[o];if(!t(e[s],n[s]))return!1}return!0}return e!=e&&n!=n}},function(t,e,n){"use strict";n.r(e);var r=n(23),i={_OBX_REF_PREFIX:"Observation/",_getFormattedDate:function(t){return t?r.Util.dateToDTMString(t):""},_getExtensionData:function(t){var e={};if(t.templateOptions.formHeaderItems&&t.templateOptions.formHeaderItems.length>0)for(var n=0,r=t.templateOptions.formHeaderItems.length;n<r;n++){var i=t.templateOptions.formHeaderItems[n];"date_done"===i.questionCode&&i.value&&(e.lforms_dateDone=i.value),"where_done"===i.questionCode&&i.value&&(e.lforms_whereDone={display:i.value.text}),"time_done"===i.questionCode&&i.value&&(e.lforms_timeDone=i.value),"comment"===i.questionCode&&i.value&&(e.lforms_comments=i.value)}return e},_createDiagnosticReportContent:function(t,e){for(var n={result:[],resultObj:[]},r=0,i=t.items.length;r<i;r++){var o=t.items[r];if(o){var a=this._commonExport._createObservation(o,!0);if(o.items&&o.items.length>0){a[0].related=[];for(var s=this._createDiagnosticReportContent(o,e),u=0,c=s.result.length;u<c;u++){var l=s.result[u];a[0].related.push({type:"has-member",target:{reference:l.reference}})}}for(var p=0,h=a.length;p<h;p++)e.push(a[p]),n.result.push({reference:"#"+a[p].id}),n.resultObj.push(a[p])}}return n},_convertFromContainedToBundle:function(t,e){var n={};if(e||(e="transaction"),t)switch(e){case"transaction":n=this._convertContainedToTransactionBundle(t);break;case"collection":n=this._convertContainedToCollectionBundle(t);break;default:console.log("Bundle type not supported: "+e)}return n},_convertContainedToTransactionBundle:function(t){var e={resourceType:"Bundle",type:"transaction",entry:[]},n=t.contained;delete t.contained;for(var r=0,i=t.result.length;r<i;r++){var o=t.result[r];o.reference=this._OBX_REF_PREFIX+o.reference.slice(1)}e.entry.push({resource:t,request:{method:"POST",url:"DiagnosticReport"}});for(var a=0,s=n.length;a<s;a++){var u=n[a];if(u.related)for(var c=0,l=u.related.length;c<l;c++){var p=u.related[c];p.target.reference=this._OBX_REF_PREFIX+p.target.reference.slice(1)}e.entry.push({resource:u,request:{method:"POST",url:"Observation"}})}return e},_convertContainedToCollectionBundle:function(t){var e={resourceType:"Bundle",type:"collection",entry:[]},n=t.contained;delete t.contained,e.entry.push({resource:t});for(var r=0,i=n.length;r<i;r++){var o=n[r];e.entry.push({resource:o})}return e},createDiagnosticReport:function(t,e,n,i){var o=null,a=[];if(t){var s=t.getFormData(!0,!0,!0),u=this._createDiagnosticReportContent(s,a);o={resourceType:"DiagnosticReport",id:this._commonExport._getUniqueId(s.code),status:"final",code:{coding:[{system:"http://loinc.org",code:s.code,display:s.name}],text:s.name},result:u.result,contained:a},this._commonExport._addVersionTag(o),e&&(o.subject=r.Util.createLocalFHIRReference(e));var c=this._getExtensionData(s);c.lforms_dateDone&&(o.effectiveDateTime=c.lforms_dateDone),o.issued=this._getFormattedDate(new Date)}var l=n?this._convertFromContainedToBundle(o,i):o;return r.Util.pruneNulls(l),l},_findObxById:function(t,e){var n=null;if(t)for(var r="#"===t[0]?t.slice(1):t,i=0,o=e.length;i<o;i++)if(e[i].id===r){n=e[i];break}return n},_setupItemValueAndUnit:function(t,e){if(e&&t.code.coding[0].code===e.questionCode){var n=e.dataType;switch((!n||"ST"===n)&&e.units&&e.units.length>0&&(n="REAL"),n){case"INT":if(t.valueInteger){e.value=t.valueInteger;break}case"REAL":case"QTY":var i=t.valueQuantity;e.value=i.value;var o=i.unit||i.code;(o||i.code||i.system)&&(e.unit={},o&&(e.unit.name=o),i.code&&(e.unit.code=i.code),i.system&&(e.unit.system=i.system));break;case"DT":e.value=r.Util.stringToDTDateISO(t.valueDate);break;case"DTM":e.value=r.Util.stringToDate(t.valueDateTime);break;case"CNE":case"CWE":var a;t.valueCodeableConcept?a={code:t.valueCodeableConcept.coding[0].code,text:t.valueCodeableConcept.coding[0].display,codeSystem:t.valueCodeableConcept.coding[0].system}:t.valueString&&(a=t.valueString),e.answerCardinality&&("*"===e.answerCardinality.max||parseInt(e.answerCardinality.max)>1)?(e.value||(e.value=[]),e.value.push(a)):e.value=a;break;case"SECTION":case"TITLE":case"":break;default:e.value=t.valueString}}},_findTotalRepeatingNum:function(t,e,n){for(var r=0,i=[],o=0,a=t.length;o<a;o++){this._findObxById(t[o],n).code.coding[0].code===e&&(i.push(t[o]),r+=1)}return{total:r,refIds:i}},_checkRepeatingItems:function(t,e,n){var r=[],i={},o=[];if(!e&&n.result)for(var a=0,s=n.result.length;a<s;a++)o.push(n.result[a].reference);else{var u=this._findObxById(e,n.contained);if(u&&u.related)for(a=0,s=u.related.length;a<s;a++)o.push(u.related[a].target.reference)}for(a=0,s=o.length;a<s;a++){var c=o[a],l=this._findObxById(c,n.contained).code.coding[0].code;if(!i[l]){var p=this._findTotalRepeatingNum(o,l,n.contained);i[l]={total:p.total,refIds:p.refIds}}for(var h=i[l].refIds,f=0,d=h.length;f<d;f++)if(c===h[f]){var y={code:l,refId:c,index:f,total:i[l].total};this._checkRepeatingItems(y,c,n),r.push(y)}}t.obxInfoList=r},_getReportStructure:function(t){var e={obxInfoList:[]};return t&&this._checkRepeatingItems(e,null,t),e},_findTheMatchingItemByCodeAndIndex:function(t,e,n){var r=null,i=0;if(t.items)for(var o=0,a=t.items.length;o<a;o++){var s=t.items[o];if(e===s.questionCode){if(("CNE"===s.dataType||"CWE"===s.dataType)&&s.answerCardinality&&("*"===s.answerCardinality.max||parseInt(s.answerCardinality.max)>1)){r=s;break}if(i===n){r=s;break}i+=1}}return r},_addRepeatingItems:function(t,e,n){var r=null;if(t.items){for(var i=0,o=t.items.length;i<o;i++)if(e===t.items[i].questionCode){r=t.items[i];break}if(r&&("CNE"!==r.dataType&&"CWE"!==r.dataType||!r.answerCardinality||!("*"===r.answerCardinality.max||parseInt(r.answerCardinality.max)>1)))for(;n>1;){var a=angular.copy(r);t.items.splice(i,0,a),n-=1}}},_processObxAndItem:function(t,e,n){for(var r=0,i=t.obxInfoList.length;r<i;r++){var o=t.obxInfoList[r],a=this._findObxById(o.refId,n.contained);if(a){o.total>1&&0===o.index&&this._addRepeatingItems(e,o.code,o.total);var s=this._findTheMatchingItemByCodeAndIndex(e,o.code,o.index);this._setupItemValueAndUnit(a,s),o.obxInfoList&&o.obxInfoList.length>0&&this._processObxAndItem(o,s,n)}}},_convertFromBundleToContained:function(t){var e;if(t&&"searchset"===t.type){for(var n=t.entry,r=0,i=n.length;r<i;r++)if("DiagnosticReport"===n[r].resource.resourceType){for(var o=0,a=(e=n[r].resource).result.length;o<a;o++){var s=e.result[o];s.reference&&s.reference.match(new RegExp(this._OBX_REF_PREFIX))&&(s.reference=s.reference.slice(this._OBX_REF_PREFIX.length))}e.contained=[];break}if(e)for(r=0,i=n.length;r<i;r++)if("Observation"===n[r].resource.resourceType){var u=n[r].resource;if(u.related)for(o=0,a=u.related.length;o<a;o++){var c=u.related[o];c.target&&c.target.reference&&c.target.reference.match(new RegExp(this._OBX_REF_PREFIX))&&(c.target.reference=c.target.reference.slice(this._OBX_REF_PREFIX.length))}e.contained.push(u)}}return e},mergeDiagnosticReportToLForms:function(t,e){t instanceof r.LFormsData||(t.hasSavedData=!0,t=new r.LFormsData(t).getFormData());var n=e&&"Bundle"===e.resourceType?this._convertFromBundleToContained(e):e,i=this._getReportStructure(n);if(this._processObxAndItem(i,t,n),n.effectiveDateTime&&t.templateOptions.formHeaderItems){var o=new r.Util.dateToString(n.effectiveDateTime);o&&(t.templateOptions.formHeaderItems[0].value=o)}return t}};function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var a=n(23),s={_createObservation:function(t,e){var n=[],r=t.dataType;switch((!r||"ST"===r)&&t.units&&t.units.length>0&&(r="REAL"),r){case"INT":n=[this._createObsIntValue(t)];break;case"REAL":case"QTY":var i={value:t.value};this._setFHIRQuantityUnit(i,t.unit),n=[{key:"valueQuantity",val:i}];break;case"DT":n=[{key:"valueDate",val:t.value}];break;case"DTM":n=[{key:"valueDateTime",val:t.value}];break;case"CNE":case"CWE":for(var s,u=t.answerCardinality.max,c=0,l=(s=u&&("*"===u||parseInt(u)>1)?t.value:[t.value]).length;c<l;c++){var p=s[c];if("object"===o(p)){var h={};p.code&&(h.code=p.code),p.text&&(h.display=p.text);var f=p.system;f&&(h.system=a.Util.getCodeSystem(f)),n.push({key:"valueCodeableConcept",val:{coding:[h],text:h.display}})}else"string"==typeof p&&""!==p&&n.push({key:"valueString",val:p})}break;default:n=[{key:"valueString",val:t.value}]}for(var d=[],y=0,g=n.length;y<g;y++){var m={resourceType:"Observation",status:"final",code:{coding:t.codeList,text:t.question}};this._addVersionTag(m),e&&(m.id=this._getUniqueId(t.questionCode)),t.header||(m[n[y].key]=n[y].val),d.push(m)}return d},_getUniqueId:function(t){return this._idCtr||(this._idCtr=0),t+"-"+Date.now()+"-"+ ++this._idCtr+"-"+Math.random().toString(16).substr(2)},_setFHIRQuantityUnit:function(t,e){e&&(e.name&&(t.unit=e.name),e.code&&(t.code=e.code),e.system&&(t.system=e.system))},_resTags:function(t){var e=t.meta;e||(e=t.meta={});var n=e.tag;return n||(n=e.tag=[]),n},_setVersionTag:function(t){for(var e=this._resTags(t),n=0,r=e.length;n<r;++n){var i=e[n];if(i.code&&0===i.code.indexOf("lformsVersion: ")){e.splice(n,1);break}}this._addVersionTag(t)},_addVersionTag:function(t){this._resTags(t).push({code:"lformsVersion: "+a.lformsVersion})}},u=Object.create(s);Object.assign(u,{_createObsIntValue:function(t){var e;if(t.unit){var n={value:t.value};this._setFHIRQuantityUnit(n,t.unit),e={key:"valueQuantity",val:n}}else e={key:"valueInteger",val:t.value};return e}});var c=u;function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var p={SDCVersion:"2.7",QProfile:"http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire|2.7",QRProfile:"http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaireresponse|2.7",stdQProfile:"http://hl7.org/fhir/4.0/StructureDefinition/Questionnaire",stdQRProfile:"http://hl7.org/fhir/4.0/StructureDefinition/QuestionnaireResponse",convertLFormsToFHIRData:function(t,e,n){var r=this.convertLFormsToQuestionnaireResponse(t,e,n);r.id||(r.id=this._commonExport._getUniqueId(r.identifier&&r.identifier.value||"QR"));for(var i="QuestionnaireResponse/"+r.id,o=[r],a=0,s=t.itemList.length;a<s;++a){var u=t.itemList[a];if(p._getExtractValue(u)&&u.value)for(var c=this._commonExport._createObservation(u),l=0,h=c.length;l<h;l++)r.basedOn&&(c[l].basedOn=r.basedOn),r.partOf&&(c[l].partOf=r.partOf),r.subject&&(c[l].subject=r.subject),r.encounter&&(c[l].encounter=r.encounter),r.authored&&(c[l].effectiveDateTime=r.authored,c[l].issued=r.authored),r.author&&(c[l].performer=r.author),c[l].derivedFrom=[{reference:i}],o.push(c[l])}return o},_processQuestionCardinality:function(t,e){e.questionCardinality&&("*"===e.questionCardinality.max?t.repeats=!0:parseInt(e.questionCardinality.max)>1&&(t.repeats=!0,t.extension.push({url:"http://hl7.org/fhir/StructureDefinition/questionnaire-maxOccurs",valueInteger:parseInt(e.questionCardinality.max)})))},_handleSpecialConstraints:function(t,e){t&&"TITLE"===e.dataType&&(delete t.code,delete t.required,delete t.repeats,delete t.readOnly)},_handleRestrictions:function(t,e){if(e.restrictions)for(var n in e.restrictions){var r=e.restrictions[n],i=null,o=this._getAssumedDataTypeForExport(e),a=this._getValueKeyByDataType("value",e);switch(n){case"minExclusive":case"minInclusive":case"maxExclusive":case"maxInclusive":i=this._exportMinMax(o,r,a,n);break;case"minLength":"ST"!==o&&"TX"!==o&&"URL"!==o&&"QTY"!==o||(i={url:"http://hl7.org/fhir/StructureDefinition/minLength",valueInteger:parseInt(r)});break;case"maxLength":"ST"!==o&&"TX"!==o&&"URL"!==o&&"QTY"!==o||(t.maxLength=parseInt(r));break;case"pattern":"ST"!==o&&"TX"!==o||(i={url:"http://hl7.org/fhir/StructureDefinition/regex",valueString:r})}i&&t.extension.push(i)}},_handleChoiceField:function(t,e,n){e.externallyDefined?this._handleExternallyDefined(t,e):e.answers&&!e.answerValueSet?e._fhirExt&&e._fhirExt[this.fhirExtAnswerExp]||(t.answerOption=this._handleAnswers(e,n)):e.answerValueSet&&(t.answerValueSet=e.answerValueSet)},_handleAnswers:function(t,e){for(var n=[],r=0,i=t.answers.length;r<i;r++){var o=t.answers[r],a={};if(!e){var s=[];o.label&&s.push({url:"http://hl7.org/fhir/StructureDefinition/questionnaire-optionPrefix",valueString:o.label}),null!==o.score&&void 0!==o.score&&s.push({url:"http://hl7.org/fhir/StructureDefinition/ordinalValue",valueDecimal:parseFloat(o.score)}),s.length>0&&(a.extension=s)}a.valueCoding={},o.code&&(a.valueCoding.code=o.code),o.text&&(a.valueCoding.display=o.text),o.system&&(a.valueCoding.system=LForms.Util.getCodeSystem(o.system)),n.push(a)}return n},_handleInitialValues:function(t,e){if(null!==e.defaultAnswer&&void 0!==e.defaultAnswer&&""!==e.defaultAnswer){var n,r,i,o=this._answerRepeats(e)&&Array.isArray(e.defaultAnswer)?e.defaultAnswer:[e.defaultAnswer],a=this._getAssumedDataTypeForExport(e),s=this._getValueKeyByDataType("value",e),u=null;t.initial=[];for(var c=0,p=o.length;c<p;c++)if("CWE"===a||"CNE"===a)if("object"===l(o[c])){var h={code:o[c].code};void 0!==o[c].text&&(h.display=o[c].text);var f=o[c].system||e.answerCodeSystem;f&&(h.system=LForms.Util.getCodeSystem(f)),(u={})[s]=h,t.initial.push(u)}else"string"==typeof o[c]&&t.initial.push({valueString:o[c]});else if("QTY"===a)(u={})[s]=this._makeQuantity(o[c],e.units),t.initial.push(u);else if("INT"===a||"REAL"===a||"BL"===a||"TM"===a||"ST"===a||"TX"===a||"URL"===a)(u={})[s]=o[c],t.initial.push(u);else if("DT"===a||"DTM"===a){var d=LForms.Util.stringToDate(o[c]);d?(d="DTM"===a?LForms.Util.dateToDTMString(d):LForms.Util.dateToDTStringISO(d),t.initial.push((i=d,(r=s)in(n={})?Object.defineProperty(n,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[r]=i,n))):console.error(o[c]+": Invalid date/datetime string as defaultAnswer for "+e.questionCode)}}},_handleLFormsUnits:function(t,e){if(e.units&&e.units.length>0){var n=this._getAssumedDataTypeForExport(e);if("REAL"===n||"INT"===n)t.extension.push({url:this.fhirExtUrlUnit,valueCoding:this._createFhirUnitCoding(e.units[0])});else if("QTY"===n){var r=this._getDefaultUnit(e.units);if(r&&r.default&&!(t.initial&&t.initial.length>0)){t.initial||(t.initial=[]);var i={};p._setUnitAttributesToFhirQuantity(i,r),t.initial.push({valueQuantity:i})}for(var o=0,a=e.units.length;o<a;o++){var s=e.units[o],u={url:this.fhirExtUrlUnitOption,valueCoding:p._createFhirUnitCoding(s)};t.extension.push(u)}}}},_handleSkipLogic:function(t,e,n){if(e.skipLogic){for(var r=[],i=!1,o=0,a=e.skipLogic.conditions.length;o<a;o++){var s=e.skipLogic.conditions[o],u=n._getSkipLogicSourceItem(e,s.source),c=p._createEnableWhenRulesForSkipLogicCondition(s,u);c.length>1&&(i=!0),r=r.concat(c)}if(i&&e.skipLogic.conditions.length>1)throw new Error("Multiple skip logic conditons included with range specification is not supported yet.");t.enableWhen=r,"ALL"===e.skipLogic.logic||i?t.enableBehavior="all":r.length>1&&(t.enableBehavior="any")}}},h=p;function f(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var d=function(t){var e=t;e.convertLFormsToQuestionnaireResponse=function(t,e,n){var r={};if(t){var i=t.getFormData(!0,!0,!0);if(this._processRepeatingItemValues(i),this._setResponseFormLevelFields(r,i,e),i.items&&Array.isArray(i.items)){var o=this._processResponseItem(i,!0);o&&o.item&&o.item.length&&(r.item=o.item)}}return LForms.Util.pruneNulls(r),n&&(r.subject=LForms.Util.createLocalFHIRReference(n)),this._commonExport._setVersionTag(r),r},e.convertLFormsToQuestionnaire=function(t,e){var n={};if(t){var r=angular.copy(t);if(r instanceof LForms.LFormsData||(r=new LForms.LFormsData(r)),this._removeRepeatingItems(r),this._setFormLevelFields(n,t,e),r.items&&Array.isArray(r.items)){n.item=[];for(var i=0,o=r.items.length;i<o;i++){var a=this._processItem(r.items[i],r,e);n.item.push(a)}}}return LForms.Util.pruneNulls(n),this._commonExport._setVersionTag(n),n},e._processItem=function(t,e,n){var r={};if(r.type=this._getFhirDataType(t),r.code=t.codeList,r.extension=t.extension||[],!0!==t._answerRequired&&!1!==t._answerRequired||(r.required=t._answerRequired),r.required){var i=parseInt(t.questionCardinality.min);i>1&&r.extension.push({url:"http://hl7.org/fhir/StructureDefinition/questionnaire-minOccurs",valueInteger:i})}this._processQuestionAndAnswerCardinality(r,t),this._handleItemControl(r,t),this._handleRestrictions(r,t),t._isHiddenInDef&&r.extension.push({url:"http://hl7.org/fhir/StructureDefinition/questionnaire-hidden",valueBoolean:!0}),r.linkId=t.linkId,r.text=t.question,t.prefix&&(r.prefix=t.prefix);for(var o=0,a=["_prefix","_text"];o<a.length;o++){var s=a[o],u=t["obj"+s];u&&(r[s]=u)}if(t.skipLogic&&this._handleSkipLogic(r,t,e),"SECTION"!==t.dataType&&"TITLE"!==t.dataType&&"0"===t.editable&&(r.readOnly=!0),this._handleChoiceField(r,t,n),this._handleTerminologyServer(r,t),this._handleInitialValues(r,t),t.units&&this._handleLFormsUnits(r,t),this._handleDataControl(r,t),t.items&&Array.isArray(t.items)){r.item=[];for(var c=0,l=t.items.length;c<l;c++){var p=this._processItem(t.items[c],e,n);r.item.push(p)}}if(t.codingInstructions){var h={text:t.codingInstructionsPlain?t.codingInstructionsPlain:t.codingInstructions,type:"display",linkId:r.linkId+"-help",extension:[{url:"http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",valueCodeableConcept:{text:"Help-Button",coding:[{code:"help",display:"Help-Button",system:"http://hl7.org/fhir/questionnaire-item-control"}]}}]};"html"===t.codingInstructionsFormat&&(h._text={extension:[{url:"http://hl7.org/fhir/StructureDefinition/rendering-xhtml",valueString:t.codingInstructions}]}),Array.isArray(r.item)?r.item.push(h):r.item=[h]}return this._handleSpecialConstraints(r,t),(n||0===r.extension.length)&&delete r.extension,this.copyFields(t,r,this.itemLevelIgnoredFields),r},e._processQuestionAndAnswerCardinality=function(t,n){var r=0,i=n.questionCardinality,o=n.answerCardinality,a=i&&void 0!==i.max?i.max:null,s=o&&void 0!==o.max?o.max:null;if("*"===a||"*"===s)"TITLE"!==n.dataType&&(t.repeats=!0);else{var u=parseInt(a),c=parseInt(s);(u>1||c>1)&&"TITLE"!==n.dataType&&(t.repeats=!0,isNaN(u)||isNaN(c)?isNaN(u)?isNaN(c)||(r=c):r=u:r=Math.max(u,c),r>1&&t.extension.push({url:e.fhirExtUrlCardinalityMax,valueInteger:r}))}},e._handleExternallyDefined=function(t,e){e.externallyDefined&&t.extension.push({url:"http://hl7.org/fhir/StructureDefinition/questionnaire-externallydefined",valueUri:e.externallyDefined})},e._handleDataControl=function(t,e){e.dataControl&&t.extension.push({url:"http://lhcforms.nlm.nih.gov/fhirExt/dataControl",valueString:JSON.stringify(e.dataControl)})},e._removeRepeatingItems=function(t){if(t.items&&Array.isArray(t.items))for(var e=t.items.length-1;e>=0;e--)t.items[e]._id>1?t.items.splice(e,1):this._removeRepeatingItems(t.items[e])},e._setFormLevelFields=function(t,e,n){this.copyFields(e,t,this.formLevelFields),t.name=e.shortName,t.title=e.name,e.obj_title&&(t._title=e.obj_title),t.code=e.codeList,t.resourceType="Questionnaire",t.status=t.status?t.status:"draft";var r=n?this.stdQProfile:this.QProfile;t.meta=t.meta?t.meta:{},t.meta.profile=t.meta.profile?t.meta.profile:[r]},e._handleItemControl=function(t,e){var n,r,i="";if(!jQuery.isEmptyObject(e.displayControl)){var o=this._getAssumedDataTypeForExport(e);!e.displayControl.answerLayout||"CNE"!==o&&"CWE"!==o?e.displayControl.questionLayout&&"SECTION"===o&&("horizontal"===e.displayControl.questionLayout?(i="gtable",n="Group Table"):"matrix"===e.displayControl.questionLayout&&(i="table",n="Vertical Answer Table")):e.externallyDefined||e.answerValueSet&&e.isSearchAutocomplete?(i="autocomplete",n="Auto-complete"):"COMBO_BOX"===e.displayControl.answerLayout.type?(i="drop-down",n="Drop down"):"RADIO_CHECKBOX"===e.displayControl.answerLayout.type&&(e.answerCardinality&&("*"===e.answerCardinality.max||parseInt(e.answerCardinality.max)>1)?(i="check-box",n="Check-box"):(i="radio-button",n="Radio Button"),"0"===e.displayControl.answerLayout.columns?r="horizontal":"1"===e.displayControl.answerLayout.columns&&(r="vertical")),i&&(t.extension.push({url:"http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",valueCodeableConcept:{coding:[{system:"http://hl7.org/fhir/questionnaire-item-control",code:i,display:n}],text:n||i}}),r&&t.extension.push({url:"http://hl7.org/fhir/StructureDefinition/questionnaire-choiceOrientation",valueCode:r}))}},e._handleTerminologyServer=function(t,n){n.terminologyServer&&t.extension.push({url:e.fhirExtTerminologyServer,valueUrl:n.terminologyServer})},e._getFhirDataType=function(t){var e=this._getAssumedDataTypeForExport(t),n=this._lformsTypesToFHIRTypes[e];return n||(n="string"),n},e._getAssumedDataTypeForExport=function(t){var e=t.dataType;return("REAL"===t.dataType||"INT"===t.dataType)&&t.units&&t.units.length>1&&(e="QTY"),e},e._makeValueQuantity=function(t,n,r){var i={},o=parseFloat(t);return isNaN(o)||(i.value=o),n&&(e._setUnitAttributesToFhirQuantity(i,n),r&&(i.system=r)),Object.keys(i).length>0?i:null},e._makeQuantity=function(t,e,n){var r=this._getDefaultUnit(e);return this._makeValueQuantity(t,r,n)},e._getDefaultUnit=function(t){if(!t||0===t.length)return null;for(var e=null,n=0;n<t.length;n++)if(t[n].default){e=t[n];break}return e||(e=t[0]),e},e._getValueKeyByDataType=function(t,e){t||(t="value");var n="quantity"===this._getFhirDataType(e)?"QTY":e.dataType;return t+this._lformsTypesToFHIRFields[n]},e._MIN_MAX_TYPES=["DT","DTM","TM","REAL","INT"].reduce((function(t,e){return t[e]=e,t}),{}),e._MIN_MAX_KEYS=["minExclusive","minInclusive","maxExclusive","maxInclusive"].reduce((function(t,e){return t[e]=e,t}),{}),e._exportMinMax=function(t,n,r,i){if(null!=n&&e._MIN_MAX_TYPES[t]&&e._MIN_MAX_KEYS[i]){var o="DT"===t||"DTM"===t?new Date(n).toISOString():"TM"==t?new Date("1970-01-01T"+n+"Z").toISOString():null,a="DT"===t?o.substring(0,10):"DTM"===t?o:"TM"===t?o.substring(11,o.length-1):"REAL"===t?parseFloat(n):parseInt(n);return f({url:0===i.indexOf("min")?"http://hl7.org/fhir/StructureDefinition/minValue":"http://hl7.org/fhir/StructureDefinition/maxValue"},r,a)}},e._skipLogicValueDataTypes=["BL","REAL","INT","QTY","DT","DTM","TM","ST","TX","URL"].reduce((function(t,e){return t[e]=e,t}),{}),e._createEnableWhenRulesForSkipLogicCondition=function(t,n){var r=this._getAssumedDataTypeForExport(n),i=this._getValueKeyByDataType("answer",n),o=[];return Object.keys(t.trigger).forEach((function(a){var s=e._operatorMapping[a],u=t.trigger[a];if(!s||0!==u&&!1!==u&&!u)throw new Error("Invalid lforms skip logic trigger: "+JSON.stringify(t.trigger,null,4));var c=null;if("exists"===s)c={answerBoolean:u};else if("CWE"===r||"CNE"===r){var l=e._copyTriggerCoding(u,null,!0);if(!l)throw new Error("Invalid CNE/CWE trigger, key="+a+"; value="+u);c={answerCoding:l}}else{if(!r||!e._skipLogicValueDataTypes[r])throw new Error("Unsupported data type for skip logic export: "+r);var p=u;if("answerQuantity"===i&&(p=e._makeQuantity(p,n.units)),0!==p&&!1!==p&&!p)throw new Error("Invalid value for trigger "+a+": "+u);c=f({},i,p)}c.question=n.linkId,c.operator=s,o.push(c)})),o},e._setResponseFormLevelFields=function(t,e,n){t.resourceType="QuestionnaireResponse";var r=n?this.stdQRProfile:this.QRProfile;t.meta=t.meta?t.meta:{},t.meta.profile=t.meta.profile?t.meta.profile:[r],t.status="completed",t.authored=LForms.Util.dateToDTMString(new Date)},e._setUnitAttributesToFhirQuantity=function(t,e){t&&e&&(e.name&&(t.unit=e.name),e.code&&(t.code=e.code),e.system&&(t.system=e.system))},e._createFhirUnitCoding=function(t){var e=null;return t&&(e={},t.code&&(e.code=t.code),t.name&&(e.display=t.name),t.system&&(e.system=t.system)),e},e._lfItemValueToFhirAnswer=function(t){if(void 0===t.value||null===t.value||""===t.value)return null;for(var e=this._getAssumedDataTypeForExport(t),n=this._answerRepeats(t)?t.value:[t.value],r=[],i=0;i<n.length;++i){var o=n[i];if(null!=o&&""!==o){var a=null;if("CWE"===e||"CNE"===e){if("CWE"===e&&"string"==typeof o)a={valueString:o};else if(!jQuery.isEmptyObject(o)){var s=this._setIfHasValue(null,"system",LForms.Util.getCodeSystem(o.system));s=this._setIfHasValue(s,"code",o.code),s=this._setIfHasValue(s,"display",o.text),a=this._setIfHasValue(null,"valueCoding",s)}}else if("QTY"===e)a=this._setIfHasValue(null,"valueQuantity",this._makeValueQuantity(o,t.unit));else if("BL"===e||"REAL"===e||"INT"===e||"DT"===e||"DTM"===e||"TM"===e||"ST"===e||"TX"===e||"URL"===e){a=f({},this._getValueKeyByDataType("value",t),o)}null!==a&&r.push(a)}}return 0===r.length?null:r},e._lfHasSubItems=function(t){return t&&t.items&&Array.isArray(t.items)&&t.items.length>0},e._processResponseItem=function(t,e){if(e&&"boolean"!=typeof e)throw new Error("_processResponseItem function signature has been changed, please check/fix.");var n=e||"TITLE"===t.dataType?{}:{linkId:t.linkId,text:t.question};if(e||"TITLE"===t.dataType||"SECTION"===t.dataType||this._setIfHasValue(n,"answer",this._lfItemValueToFhirAnswer(t)),this._lfHasSubItems(t)){for(var r=[],i=0;i<t.items.length;++i){var o=t.items[i];if(!o._isProcessed){var a=o.linkId,s=t._repeatingItems&&t._repeatingItems[a];if(s){for(var u={linkId:a,text:o.question,answer:[]},c=0;c<s.length;++c){var l=s[c],p=this._processResponseItem(l);p.answer&&Array.prototype.push.apply(u.answer,p.answer),l._isProcessed=!0}r.push(u),delete t._repeatingItems[a]}else{var h=this._processResponseItem(o);r.push(h)}}o._isProcessed&&delete o._isProcessed}r.length>0&&(e||"SECTION"===t.dataType?n.item=r:(n.answer=n.answer||[],n.answer[0]=n.answer[0]||{},n.answer[0].item=r))}return n},e._processRepeatingItemValues=function(t){if(t.items)for(var e=0,n=t.items.length;e<n;e++){var r=t.items[e];if("TITLE"!==r.dataType&&"SECTION"!==r.dataType&&this._questionRepeats(r)){var i=r.linkId;t._repeatingItems=t._repeatingItems||{},t._repeatingItems[i]=t._repeatingItems[i]||[],t._repeatingItems[i].push(r)}this._lfHasSubItems(r)&&this._processRepeatingItemValues(r)}},e._getExtractValue=function(t){for(var e=t;;){if(e._fhirExt&&e._fhirExt[this.fhirExtObsExtract])return e._fhirExt[this.fhirExtObsExtract][0].valueBoolean;if(!e._parentItem)return!1;e=e._parentItem}}};var y=function(t){var e=t;e.fhirExtUrlOptionScore="http://hl7.org/fhir/StructureDefinition/ordinalValue",e.fhirExtUrlValueSetScore=e.fhirExtUrlOptionScore,e._extractContainedVS=function(t){var n;return t.contained&&t.contained.length>0&&(n={},t.contained.forEach((function(t){if("ValueSet"===t.resourceType){var r=e.answersFromVS(t);r||(r=[]);var i={answers:r};t.id&&(n["#"+t.id]=i),t.url&&(n[t.url]=i)}}))),n},e._processQuestionnaireItem=function(t,n,r){var i={};return e._processDataType(i,t),e._processTextAndPrefix(i,t),e._processCodeAndLinkId(i,t),e._processDisplayItemCode(i,t),e._processEditable(i,t),e._processFHIRQuestionAndAnswerCardinality(i,t),e._processDisplayControl(i,t),e._processDataControl(i,t),e._processRestrictions(i,t),e._processHiddenItem(i,t),e._processUnitList(i,t),e._processAnswers(i,t,n),e._processDefaultAnswer(i,t),e._processExternallyDefined(i,t),e._processTerminologyServer(i,t),e._processSkipLogic(i,t,r),e._processExtensions(i,t),e.copyFields(t,i,e.itemLevelIgnoredFields),e._processChildItems(i,t,n,r),i},e._processSkipLogic=function(t,n,r){if(n.enableWhen){t.skipLogic={conditions:[],action:"show"};for(var i=0;i<n.enableWhen.length;i++){var o=e._getDataType(r[n.enableWhen[i].question]),a={source:n.enableWhen[i].question,trigger:{}},s=e._getFHIRValueWithPrefixKey(n.enableWhen[i],/^answer/),u=e._operatorMapping[n.enableWhen[i].operator];if(!u)throw new Error("Unable to map FHIR enableWhen operator: "+n.enableWhen[i].operator);"exists"===u?a.trigger.exists=s:a.trigger[u]="CWE"===o||"CNE"===o?e._copyTriggerCoding(s,null,!1):"QTY"===o?s.value:s,t.skipLogic.conditions.push(a)}n.enableBehavior&&(t.skipLogic.logic=n.enableBehavior.toUpperCase())}},e._processExternallyDefined=function(t,n){var r=LForms.Util.findObjectInArray(n.extension,"url",e.fhirExtUrlExternallyDefined);r&&r.valueUri&&(t.externallyDefined=r.valueUri)},e._processHiddenItem=function(t,n){var r=LForms.Util.findObjectInArray(n.extension,"url",e.fhirExtUrlHidden);return r&&(t._isHiddenInDef="boolean"==typeof r.valueBoolean?r.valueBoolean:"true"===r.valueBoolean),t._isHiddenInDef},e._processAnswers=function(t,n,r){if(n.answerOption){t.answers=[];for(var i=0;i<n.answerOption.length;i++){var o={},a=n.answerOption[i],s=LForms.Util.findObjectInArray(a.extension,"url",e.fhirExtUrlOptionPrefix);s&&(o.label=s.valueString);var u=LForms.Util.findObjectInArray(a.extension,"url",e.fhirExtUrlOptionScore);(u=u||LForms.Util.findObjectInArray(a.extension,"url",e.argonautExtUrlExtensionScore))&&(o.score=u.valueDecimal.toString());var c=Object.keys(a).filter((function(t){return 0===t.indexOf("value")}));c&&c.length>0&&("valueCoding"===c[0]?(void 0!==a[c[0]].code&&(o.code=a[c[0]].code),void 0!==a[c[0]].display&&(o.text=a[c[0]].display),void 0!==a[c[0]].system&&(o.system=a[c[0]].system)):o.text=a[c[0]].toString()),t.answers.push(o)}}else if(n.answerValueSet){if(r)var l=r[n.answerValueSet];l?t.answers=l.answers:t.answerValueSet=n.answerValueSet}},e._processEditable=function(t,e){e.readOnly&&(t.editable="0")},e._processDefaultAnswer=function(t,n){if(n.initial){var r=[];n.initial.forEach((function(t){var n=(t=angular.copy(t)).valueCoding;n?n._type="Coding":n=e._getFHIRValueWithPrefixKey(t,/^value/),n&&r.push(n)})),r.length>0&&this._processFHIRValues(t,r,!0)}},e.getFirstInitialQuantity=function(t){return t.initial&&t.initial.length>0&&t.initial[0].valueQuantity||null},e._processDisplayItemCode=function(t,e){if("display"===e.type&&e.linkId){var n=e.linkId.split("/");n&&n[n.length-1]&&(t.questionCode=n[n.length-1])}},e._processDataType=function(t,n){var r=e._getDataType(n);"SECTION"===r&&(t.header=!0),t.dataType=r},e._mergeQR={_getQRStructure:function(t){var e={qrItemsInfo:[]};return t&&this._checkQRItems(e,t),e},_checkQRItems:function(t,n){var r=[],i={};if(n&&n.item){for(var o=0,a=n.item.length;o<a;o++){var s=n.item[o].linkId;if(!i[s]){for(var u=this._findTotalRepeatingNum(s,n),c=u.repeatingItems,l=0,p=c.length;l<p;l++){var h={linkId:s,item:c[l],index:l,total:u.total};this._checkQRItems(h,c[l]),e._checkQRItemAnswerItems(h,c[l]),r.push(h)}i[s]=!0}}t.qrItemsInfo=r}},_findTotalRepeatingNum:function(t,e){for(var n=0,r=[],i=0,o=e.item.length;i<o;i++){var a=e.item[i];t===a.linkId&&(r.push(a),Array.isArray(a.answer)?n+=a.answer.length:n+=1)}return{total:n,repeatingItems:r}},_addRepeatingItems:function(t,e,n){var r=null;if(t.items){for(var i=0,o=t.items.length;i<o;i++)if(e===t.items[i].linkId){r=t.items[i];break}if(r)for(;n>1;){var a=angular.copy(r);t.items.splice(i,0,a),n-=1}}},_findTheMatchingItemByLinkIdAndIndex:function(t,e,n){var r=null,i=0;if(t.items)for(var o=0,a=t.items.length;o<a;o++)if(e===t.items[o].linkId){if(i===n){r=t.items[o];break}i+=1}return r},_findTheMatchingItemByLinkId:function(t,e){var n=null;if(t.items)for(var r=0,i=t.items.length;r<i;r++)if(e===t.items[r].linkId){n=t.items[r];break}return n},_setupItemValueAndUnit:function(e,n,r){if(r&&e===r.linkId&&"SECTION"!==r.dataType&&"TITLE"!==r.dataType){var i=r.dataType;(!i||"ST"===i)&&r.units&&r.units.length>0&&(r.dataType=i="REAL");var o=n[0];switch(i){case"BL":!0!==o.valueBoolean&&!1!==o.valueBoolean||(r.value=o.valueBoolean);break;case"INT":o.valueQuantity?(r.value=o.valueQuantity.value,o.valueQuantity.code&&(r.unit={name:o.valueQuantity.code})):o.valueInteger&&(r.value=o.valueInteger);break;case"REAL":case"QTY":o.valueQuantity?(r.value=o.valueQuantity.value,o.valueQuantity.code&&(r.unit={name:o.valueQuantity.code})):o.valueDecimal&&(r.value=o.valueDecimal);break;case"DT":r.value=o.valueDate;break;case"DTM":r.value=o.valueDateTime;break;case"CNE":case"CWE":if(t._answerRepeats(r)){for(var a=[],s=0,u=n.length;s<u;s++){(c=t._processCWECNEValueInQR(n[s]))&&a.push(c)}r.value=a}else{var c;(c=t._processCWECNEValueInQR(o))&&(r.value=c)}break;case"ST":case"TX":r.value=o.valueString;break;case"SECTION":case"TITLE":case"":break;default:r.value=o.valueString}}}}};function g(t){if(LForms.fhirContext&&t._fhir){if(LForms._serverFHIRReleaseID){var e=[];LForms.Util.validateFHIRVersion(LForms._serverFHIRReleaseID);for(var n=LForms.FHIR[LForms._serverFHIRReleaseID],r=t._fhir.SDC.fhirExtObsLinkPeriod,i=function(){var i=t.itemList[o],a=i._fhirExt&&i._fhirExt[r];if(a){s=a[0].valueDuration,u=LForms.fhirContext;var p={code:i.codeList.map((function(t){return["LOINC"===t.system?n.LOINC_URI:t.system,t.code].join("|")})).join(","),_sort:"-date",status:"final,amended,corrected",_count:5};s&&s.value&&s.code&&"succeeded"===(c=LForms.ucumPkg.UcumLhcUtils.getInstance().convertUnitTo(s.code,s.value,"ms")).status&&(l=new Date(new Date-c.toVal),p.date="gt"+l.toISOString()),e.push(u.patient.request(t._buildURL(["Observation"],p)).then((function(e){var r=e;if(r.entry)for(var o,a=0,s=r.entry.length;a<s&&!o;++a){var u=r.entry[a].resource;u.focus||(n.SDC.importObsValue(i,u),i.value&&(o=!0,i.unit&&t._setUnitDisplay(i.unit)))}return i.questionCode})))}},o=0,a=t.itemList.length;o<a;++o){var s,u,c,l;i()}return Promise.all(e)}return new Promise((function(e,n){LForms.Util.getServerFHIRReleaseID((function(r){r?e(g(t)):n("Unable to obtain the server's FHIR version")}))}))}}function m(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return v(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return v(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var x=function(t){var e=t;e.requestLinkedObs=g,e._lformsTypesToFHIRTypes={SECTION:"group",TITLE:"display",ST:"string",BL:"boolean",REAL:"decimal",INT:"integer",DT:"date",DTM:"dateTime",TM:"time",TX:"text",URL:"url",CNE:"choice",CWE:"open-choice",QTY:"quantity"},e._lformsTypesToFHIRFields={INT:"Integer",REAL:"Decimal",DT:"Date",DTM:"DateTime",TM:"Time",ST:"String",TX:"String",BL:"Boolean",URL:"Url",CNE:"Coding",CWE:"Coding",QTY:"Quantity"},e._operatorMapping={minExclusive:">",maxExclusive:"<",minInclusive:">=",maxInclusive:"<=",value:"=",notEqual:"!=",">":"minExclusive","<":"maxExclusive",">=":"minInclusive","<=":"maxInclusive","=":"value","!=":"notEqual",exists:"exists"},e._questionRepeats=function(t){return t&&t.questionCardinality&&t.questionCardinality.max&&("*"===t.questionCardinality.max||parseInt(t.questionCardinality.max)>1)},e._answerRepeats=function(t){return t&&t.answerCardinality&&t.answerCardinality.max&&("*"===t.answerCardinality.max||parseInt(t.answerCardinality.max)>1)},e.copyFields=function(t,e,n){t&&e&&n&&n.length>0&&n.forEach((function(n){t.hasOwnProperty(n)&&(e[n]=t[n])}))},e.UCUM_URI="http://unitsofmeasure.org",e._setIfHasValue=function(t,e,n){return null!=n&&""!==n&&(t||(t={}),t[e]=n),t},e._copyTriggerCoding=function(t,n,r){var i=r?"text":"display",o=r?"display":"text";return n=e._setIfHasValue(n,"code",t.code),n=e._setIfHasValue(n,"system",t.system),n=e._setIfHasValue(n,o,t[i])},e.hasResponsiveExpression=function(t){var n=t._fhirExt;return!!n&&!(!n[e.fhirExtCalculatedExp]&&!n[e.fhirExtAnswerExp])},e.hasListExpression=function(t){var n=t._fhirExt;return!!n&&!!n[e.fhirExtAnswerExp]},e.hasInitialExpression=function(t){return!(!t._fhirExt||!t._fhirExt[e.fhirExtInitialExp])},e.buildExtensionMap=function(t){if(t.extension){var e,n={},r=m(t.extension);try{for(r.s();!(e=r.n()).done;){var i=e.value,o=n[i.url];o||(o=n[i.url]=[]),o.push(i)}}catch(t){r.e(t)}finally{r.f()}t._fhirExt=n}},e.loadLaunchContext=function(t){for(var n=LForms.Util.findObjectInArray(t.extension,"url",e.fhirExtLaunchContext,0,!0),r={patient:{Patient:1},encounter:{Encounter:1},user:{Patient:1,Practitioner:1,PractitionerRole:1,RelatedPerson:1},study:{Study:1}},i=[],o=function(){var e=n[a].extension,o=null,s=[];for(u=0,c=e.length;u<c;++u)if(l=e[u],o||"name"!==l.url)"type"===l.url&&s.push(l.valueCode);else{var p=l.valueId;r[p]?o=p:console.warn("A launch context of name "+p+" was requested by the form, but the supported types are: "+Object.keys(r).join(", "))}o&&s.length&&i.push(new Promise((function(e,n){var i=LForms.fhirContext[o];i.id?i.read().then((function(n){if(n){var i=n.resourceType;if(-1==s.indexOf(i))console.warn("Could not retrieve a resource of the requested types for launch context name "+o);else{var a=r[o];a[i]?t._fhirVariables[o]=n:console.warn("A launch context resource of type "+i+" was requested by the form, but the supported types for name "+o+" are: "+Object.keys(a).join(", "))}}e()}),(function(t){console.warn("A launch context of name "+o+" was requested, but could not be read."),console.error(t),e()})):(console.warn("A launch context resource of name "+o+" was requested by the form, but none was available"),e())})))},a=0,s=n.length;a<s;++a){var u,c,l;o()}return i}};function T(t){return(T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var _=n(23);var E=function(t){var e=t;e.fhirExtUrlCardinalityMin="http://hl7.org/fhir/StructureDefinition/questionnaire-minOccurs",e.fhirExtUrlCardinalityMax="http://hl7.org/fhir/StructureDefinition/questionnaire-maxOccurs",e.fhirExtUrlItemControl="http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",e.fhirExtUrlUnit="http://hl7.org/fhir/StructureDefinition/questionnaire-unit",e.fhirExtUrlUnitOption="http://hl7.org/fhir/StructureDefinition/questionnaire-unitOption",e.fhirExtUrlOptionPrefix="http://hl7.org/fhir/StructureDefinition/questionnaire-optionPrefix",e.fhirExtVariable="http://hl7.org/fhir/StructureDefinition/variable",e.fhirExtUrlMinValue="http://hl7.org/fhir/StructureDefinition/minValue",e.fhirExtUrlMaxValue="http://hl7.org/fhir/StructureDefinition/maxValue",e.fhirExtUrlMinLength="http://hl7.org/fhir/StructureDefinition/minLength",e.fhirExtUrlRegex="http://hl7.org/fhir/StructureDefinition/regex",e.fhirExtUrlAnswerRepeats="http://hl7.org/fhir/StructureDefinition/questionnaire-answerRepeats",e.fhirExtUrlExternallyDefined="http://hl7.org/fhir/StructureDefinition/questionnaire-externallydefined",e.argonautExtUrlExtensionScore="http://fhir.org/guides/argonaut-questionnaire/StructureDefinition/extension-score",e.fhirExtUrlHidden="http://hl7.org/fhir/StructureDefinition/questionnaire-hidden",e.fhirExtTerminologyServer="http://hl7.org/fhir/StructureDefinition/terminology-server",e.fhirExtUrlDataControl="http://lhcforms.nlm.nih.gov/fhirExt/dataControl",e.fhirExtCalculatedExp="http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression",e.fhirExtInitialExp="http://hl7.org/fhir/StructureDefinition/questionnaire-initialExpression",e.fhirExtObsLinkPeriod="http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod",e.fhirExtObsExtract="http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationExtract",e.fhirExtAnswerExp="http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-answerExpression",e.fhirExtChoiceOrientation="http://hl7.org/fhir/StructureDefinition/questionnaire-choiceOrientation",e.fhirExtLaunchContext="http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-launchContext",e.fhirExtUrlRestrictionArray=[e.fhirExtUrlMinValue,e.fhirExtUrlMaxValue,e.fhirExtUrlMinLength,e.fhirExtUrlRegex],e.handledExtensionSet=new Set([e.fhirExtUrlCardinalityMin,e.fhirExtUrlCardinalityMax,e.fhirExtUrlItemControl,e.fhirExtUrlUnit,e.fhirExtUrlUnitOption,e.fhirExtUrlOptionPrefix,e.fhirExtUrlMinValue,e.fhirExtUrlMaxValue,e.fhirExtUrlMinLength,e.fhirExtUrlRegex,e.fhirExtUrlAnswerRepeats,e.fhirExtUrlExternallyDefined,e.argonautExtUrlExtensionScore,e.fhirExtUrlHidden,e.fhirExtTerminologyServer,e.fhirExtUrlDataControl,e.fhirExtChoiceOrientation]),e.formLevelFields=["id","meta","implicitRules","language","text","contained","extension","modifiedExtension","date","version","identifier","code","subjectType","derivedFrom","status","experimental","publisher","contact","description","useContext","jurisdiction","purpose","copyright","approvalDate","reviewDate","effectivePeriod","url"],e.itemLevelIgnoredFields=["definition"],e.convertQuestionnaireToLForms=function(t){var n=null;if(t){n=_.Util.baseFormDef(),e._processFormLevelFields(n,t);var r=e._extractContainedVS(t);if(t.item&&t.item.length>0){var i=e._createLinkIdItemMap(t);n.items=[];for(var o=0;o<t.item.length;o++){var a=e._processQuestionnaireItem(t.item[o],r,i);n.items.push(a)}}n.fhirVersion=e.fhirVersion}return n},e._processFormLevelFields=function(t,n){e.copyFields(n,t,e.formLevelFields),t.shortName=n.name,t.name=n.title,n._title&&(t.obj_title=n._title),n.code&&(t.codeList=n.code);var r=e._getCode(n);r&&(t.code=r.code,t.codeSystem=r.system)},e._significantDigits=function(t){var e=/(\d+)(?:\.(\d+))?/.exec(""+ +t);if(!e)return 0;var n=e[1],r=e[2];return"0"===n?0:n.length+(r?r.length:0)},e.importObsValue=function(t,n){var r=null,i=t.dataType,o=this._lformsTypesToFHIRFields[i];if("Coding"===o&&(o="CodeableConcept"),o&&(r=n["value"+o]),r||"REAL"!==i&&"INT"!==i||(r=n.valueQuantity)&&(r._type="Quantity"),r){r._type||"object"!==T(r)||(r._type=o);var a=!0;if("Quantity"===r._type&&t.units){var s,u=r.system;u&&"/"===u[u.length-1]&&(u=u.slice(0,-1));for(var c,l=u===e.UCUM_URI,p=0,h=t.units.length;p<h&&!s;++p){var f=t.units[p];(f.system&&f.system===u&&f.code===r.code||!f.system&&f.name===r.unit)&&(s=f),!l||s||c||f.system!==e.UCUM_URI||(c=f)}if(!s&&c){var d=_.ucumPkg.UcumLhcUtils.getInstance().convertUnitTo(r.code,r.value,c.code);if("succeeded"===d.status){s=c;var y=this._significantDigits(r.value);r.value=y>0?parseFloat(d.toVal.toPrecision(y)):d.toVal,r.code=c.code}}s?t.unit=s:a=!1}a&&this._processFHIRValues(t,[r])}},e._processFHIRValues=function(t,e,n){for(var r=t.dataType,i=t.answerCardinality&&"*"===t.answerCardinality.max,o=[],a=0,s=e.length;a<s;++a){var u=e[a],c=null;if("CWE"===r||"CNE"===r){var l=null;if("CodeableConcept"===u._type?l=u.coding:"Coding"!==u._type&&"object"!==T(u)||(l=[u]),l){if(t.answers)for(var p=t._modifiedAnswers||t.answers,h=0,f=l.length;h<f&&!c;++h)for(var d=l[h],y=0,g=p.length;y<g&&!c;++y){var m=p[y],v=m.system?_.Util.getCodeSystem(m.system):null;(d.system||v)&&d.system!==v||!(d.hasOwnProperty("code")&&m.hasOwnProperty("code")&&d.code===m.code||d.hasOwnProperty("display")&&m.hasOwnProperty("text")&&d.display===m.text)||(c=p[y])}}else"CWE"===r&&(c=u)}else"Quantity"!==u._type||"QTY"!==r&&"REAL"!==r&&"INT"!==r?c=n||"DTM"!==t.dataType||"string"!=typeof u?n||"DT"!==t.dataType||"string"!=typeof u?u:_.Util.stringToDTDateISO(u):new Date(u):void 0!==u.value&&(c=u.value);void 0!==c&&o.push(c)}i?n?t.defaultAnswer=o:t.value=o:n?t.defaultAnswer=o[0]:t.value=o[0]},e._getFHIRValueWithPrefixKey=function(t,e){var n=null;if("object"===T(t))for(var r in t){var i=r.match(e);if(i){(n=t[r])&&"object"===T(n)&&((n=angular.copy(n))._type=r.substring(i[0].length));break}}return n},e._processTextAndPrefix=function(t,e){e.prefix&&(t.prefix=e.prefix),t.question=e.text;for(var n=0,r=["_prefix","_text"];n<r.length;n++){var i=r[n],o=e[i];o&&(t["obj"+i]=o)}},e._processCodeAndLinkId=function(t,n){n.code&&(t.codeList=n.code);var r=e._getCode(n);r?(t.questionCode=r.code,t.questionCodeSystem=r.system):(t.questionCode=n.linkId,t.questionCodeSystem="LinkId"),t.linkId=n.linkId},e._processFHIRQuestionAndAnswerCardinality=function(t,n){var r,i,o=_.Util.findObjectInArray(n.extension,"url",e.fhirExtUrlCardinalityMin),a=_.Util.findObjectInArray(n.extension,"url",e.fhirExtUrlCardinalityMax),s=n.repeats,u=n.required;"CNE"===t.dataType||"CWE"===t.dataType?(r=s?a?{max:a.valueInteger.toString()}:{max:"*"}:{max:"1"}).min=u?o?o.valueInteger.toString():"1":"0":(i=s?a?{max:a.valueInteger.toString()}:{max:"*"}:{max:"1"},u?(i.min=o?o.valueInteger.toString():"1",r={min:"1"}):i.min="1"),i&&(t.questionCardinality=i),r&&(t.answerCardinality=r)},e._processUnitList=function(t,n){var r=[],i=null,o=_.Util.findObjectInArray(n.extension,"url",e.fhirExtUrlUnitOption,0,!0);if(o&&o.length>0){if("quantity"!==n.type)throw new Error("The extension "+e.fhirExtUrlUnitOption+' can only be used with type quantity.  Question "'+n.text+'" is of type '+n.type);for(var a=0;a<o.length;a++){var s=o[a].valueCoding,u={name:s.display,code:s.code,system:s.system};r.push(u)}}var c=_.Util.findObjectInArray(n.extension,"url",e.fhirExtUrlUnit);if(c){if("integer"!==n.type&&"decimal"!==n.type)throw new Error("The extension "+e.fhirExtUrlUnit+' can only be used with types integer or decimal.  Question "'+n.text+'" is of type '+n.type);i={name:c.valueCoding.display,code:c.valueCoding.code,system:c.valueCoding.system,default:!0},r.push(i)}if("quantity"===n.type){var l=this.getFirstInitialQuantity(n);l&&l.unit&&((i=_.Util.findItem(r,"name",l.unit))?i.default=!0:(i={name:l.unit,code:l.code,system:l.system,default:!0},r.push(i)))}r.length>0&&(i||(r[0].default=!0),t.units=r)},e._processDisplayControl=function(t,n){var r=_.Util.findObjectInArray(n.extension,"url",e.fhirExtUrlItemControl);if(r){var i={};switch(r.valueCodeableConcept.coding[0].code){case"Lookup":case"Combo-box":case"autocomplete":t.isSearchAutocomplete=!0;case"drop-down":i.answerLayout={type:"COMBO_BOX"};break;case"Checkbox":case"check-box":case"Radio":case"radio-button":i.answerLayout={type:"RADIO_CHECKBOX"};var o=_.Util.findObjectInArray(n.extension,"url",e.fhirExtChoiceOrientation);o&&("vertical"===o.valueCode?i.answerLayout.columns="1":"horizontal"===o.valueCode&&(i.answerLayout.columns="0"));break;case"Table":case"gtable":"SECTION"===t.dataType&&(i.questionLayout="horizontal");break;case"Matrix":case"table":"SECTION"===t.dataType&&(i.questionLayout="matrix");break;default:i=null}i&&!jQuery.isEmptyObject(i)&&(t.displayControl=i)}},e._processDataControl=function(t,n){var r=_.Util.findObjectInArray(n.extension,"url",e.fhirExtUrlDataControl);if(r&&r.valueString)try{var i=JSON.parse(r.valueString);i&&(t.dataControl=i)}catch(t){console.log("Invalid dataControl data!")}};var n=e._mergeQR;n.mergeQuestionnaireResponseToLForms=function(t,e){t instanceof _.LFormsData||(t.hasSavedData=!0,t=new _.LFormsData(t).getFormData());var r=n._getQRStructure(e);return n._processQRItemAndLFormsItem(r,t),t},n._processQRItemAndLFormsItem=function(e,n){for(var r=0;r<e.qrItemsInfo.length;r++){var i=e.qrItemsInfo[r],o=i.item;if(o){if(i.total>1&&0===i.index){var a=this._findTheMatchingItemByLinkId(n,i.linkId);if(t._questionRepeats(a)){if(this._addRepeatingItems(n,i.linkId,i.total),"SECTION"!==a.dataType&&"TITLE"!==a.dataType){for(var s=1;s<i.total;s++){var u=angular.copy(i);u.index=s,u.item.answer=[u.item.answer[s]],i.qrAnswersItemsInfo&&i.qrAnswersItemsInfo[s]&&(u.qrAnswersItemsInfo=[i.qrAnswersItemsInfo[s]]),e.qrItemsInfo.splice(r+s,0,u)}i.item.answer=[i.item.answer[0]],i.qrAnswersItemsInfo&&i.qrAnswersItemsInfo[0]?i.qrAnswersItemsInfo=[i.qrAnswersItemsInfo[0]]:delete i.qrAnswersItemsInfo}}else t._answerRepeats(a)&&(i.total=1)}var c=this._findTheMatchingItemByLinkIdAndIndex(n,i.linkId,i.index);if("SECTION"!==c.dataType&&"TITLE"!==c.dataType){var l=o.answer;if(l&&l.length>0&&(this._setupItemValueAndUnit(o.linkId,l,c),i.qrAnswersItemsInfo)){if(i.qrAnswersItemsInfo.length>1)throw new Error("item.answer.item with item.answer.length > 1 is not yet supported");this._processQRItemAndLFormsItem(i.qrAnswersItemsInfo[0],c)}}i.qrItemsInfo&&i.qrItemsInfo.length>0&&this._processQRItemAndLFormsItem(i,c)}}},e._getDataType=function(t){var e="string";switch(t.type){case"string":e="ST";break;case"group":e="SECTION";break;case"choice":e="CNE";break;case"open-choice":e="CWE";break;case"integer":e="INT";break;case"decimal":e="REAL";break;case"text":e="TX";break;case"boolean":e="BL";break;case"date":e="DT";break;case"dateTime":e="DTM";break;case"time":e="TM";break;case"display":e="TITLE";break;case"url":e="URL";break;case"quantity":e="QTY"}return e},e._createLinkIdItemMap=function(t){var e={};return t.item&&(e=function t(e,n){return e.forEach((function(e){n[e.linkId]=e,e.item&&t(e.item,n)})),n}(t.item,e)),e},e._getCode=function(t){var n=null;return t&&Array.isArray(t.code)&&t.code.length?n={code:t.code[0].code,system:e._toLfCodeSystem(t.code[0].system)}:t&&Array.isArray(t.identifier)&&t.identifier.length&&(n={code:t.identifier[0].value,system:e._toLfCodeSystem(t.identifier[0].system)}),n},e.answersFromVS=function(t){var n=t,r=[];return n.expansion&&n.expansion.contains&&n.expansion.contains.length>0&&n.expansion.contains.forEach((function(t){var n={code:t.code,text:t.display,system:t.system},i=_.Util.findObjectInArray(t.extension,"url",e.fhirExtUrlValueSetScore);i&&(n.score=i.valueDecimal),r.push(n)})),r.length>0?r:null},e._toLfCodeSystem=function(t){var e=t;switch(t){case"http://loinc.org":e="LOINC"}return e},e.mergeQuestionnaireResponseToLForms=n.mergeQuestionnaireResponseToLForms,e._processTerminologyServer=function(t,n){var r=_.Util.findObjectInArray(n.extension,"url",e.fhirExtTerminologyServer);r&&r.valueUrl&&(t.terminologyServer=r.valueUrl)},e._getTerminologyServer=function(t){for(var e=t.terminologyServer,n=t._parentItem;!e&&n;)e=n.terminologyServer,n=n._parentItem;return e},e._getExpansionURL=function(t){var e;if(t.answerValueSet){var n=this._getTerminologyServer(t);n&&(e=n+"/ValueSet/$expand?url="+t.answerValueSet)}return e},e.loadAnswerValueSets=function(t){for(var n=this,r=[],i=t.itemList,o=function(){var o=i[a];if(o.answerValueSet&&!o.isSearchAutocomplete){var s=n._getExpansionURL(o),c=s||o.answerValueSet;o._answerValueSetKey=c,_._valueSetAnswerCache||(_._valueSetAnswerCache={});var l=_._valueSetAnswerCache[c];l?(o.answers=l,t._updateAutocompOptions(o,!0)):s?r.push(fetch(s).then((function(t){return t.json()})).then((function(n){(l=e.answersFromVS(n))&&(_._valueSetAnswerCache[s]=l,o.answers=l,t._updateAutocompOptions(o,!0))}),(function(){throw new Error("Unable to load ValueSet from "+s)}))):(u=_.fhirContext,r.push(u.request(t._buildURL(["ValueSet","$expand"],{url:o.answerValueSet})).then((function(n){var r=n,i=e.answersFromVS(r);i&&(_._valueSetAnswerCache[c]=i,o.answers=i,t._updateAutocompOptions(o,!0))}),(function(){throw new Error("Unable to load ValueSet "+o.answerValueSet+" from FHIR server")}))))}},a=0,s=i.length;a<s;++a){var u;o()}return r},e._processCWECNEValueInQR=function(t){var e;return t.valueCoding?e={code:t.valueCoding.code,text:t.valueCoding.display,system:t.valueCoding.system}:t.valueString&&(e=t.valueString),e},e._processCodingInstructions=function(t){var n,r=null,i=_.Util.findObjectInArray(t.extension,"url",e.fhirExtUrlItemControl);return"display"===t.type&&i&&(t._text&&(n=_.Util.findObjectInArray(t._text.extension,"url","http://hl7.org/fhir/StructureDefinition/rendering-xhtml")),r=n?{codingInstructionsFormat:"html",codingInstructions:n.valueString,codingInstructionsPlain:t.text}:{codingInstructionsFormat:"text",codingInstructions:t.text,codingInstructionsPlain:t.text}),r},e._processChildItems=function(t,n,r,i){if(Array.isArray(n.item)){t.items=[];for(var o=0;o<n.item.length;o++){var a=e._processCodingInstructions(n.item[o]);if(null!==a)t.codingInstructions=a.codingInstructions,t.codingInstructionsFormat=a.codingInstructionsFormat,t.codingInstructionsPlain=a.codingInstructionsPlain;else{var s=e._processQuestionnaireItem(n.item[o],r,i);t.items.push(s)}}}},e._processExtensions=function(t,n){var r=[];if(Array.isArray(n.extension))for(var i=0;i<n.extension.length;i++)e.handledExtensionSet.has(n.extension[i].url)||r.push(n.extension[i]);r.length>0&&(t.extension=r)},e._arrayLen=function(t){return t&&Array.isArray(t)?t.length:-1},e._checkQRItemAnswerItems=function(t,n){var r=e._arrayLen(n.answer);if(!(r<1)){for(var i=0,o=[],a=0;a<r;a++)this._arrayLen(n.answer[a].item)>0?(o.push({}),e._mergeQR._checkQRItems(o[a],n.answer[a]),++i):o.push(null);i>0&&(t.numAnswersWithItems=i,t.qrAnswersItemsInfo=o)}},e._processRestrictions=function(t,n){var r={};void 0!==n.maxLength&&(r.maxLength=n.maxLength.toString());for(var i=0;i<e.fhirExtUrlRestrictionArray.length;i++){var o=_.Util.findObjectInArray(n.extension,"url",e.fhirExtUrlRestrictionArray[i]),a=e._getFHIRValueWithPrefixKey(o,/^value/);null!=a&&(o.url.match(/minValue$/)?r.minInclusive=a:o.url.match(/maxValue$/)?r.maxInclusive=a:o.url.match(/minLength$/)?r.minLength=a:o.url.match(/regex$/)&&(r.pattern=a))}jQuery.isEmptyObject(r)||(t.restrictions=r)}};var S,C=function(t,e,n){var r=n.valueString;r&&(t["_"+e+"CSS"]=r)},I={};function b(t){return(b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function R(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return A(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return A(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function A(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}I["http://hl7.org/fhir/StructureDefinition/rendering-style"]=C;var D=n(85);(S=function(t){if(this._queryCache={},this._pendingQueries=[],this._pendingRun=!1,this._currentRunPromise=void 0,this._lfData=t,!t._fhir)throw new Error("lfData._fhir should be set");this._fhir=t._fhir,this._compiledExpressions={};var e=this._fhir.SDC;this._responsiveFieldExpURIs=[e.fhirExtAnswerExp,e.fhirExtCalculatedExp],(this._initialFieldExpURIs=this._responsiveFieldExpURIs.slice()).splice(1,0,e.fhirExtInitialExp)}).prototype={runCalculations:function(t){if(this._currentRunPromise)this._pendingRun=!0;else{this._pendingRun=!1,this._runStart=new Date;var e=this._lfData;e._fhirVariables.questionnaire||(e._fhirVariables.questionnaire=this._fhir.SDC.convertLFormsToQuestionnaire(e)),this._currentRunPromise=this._asyncRunCalculations(t,!0)}return this._currentRunPromise},_handlePendingQueries:function(t,e){var n=this;return Promise.allSettled(this._pendingQueries).then((function(r){n._pendingQueries=[];for(var i=0,o=r.length;!t&&i<o;++i)r[i].value&&(t=!0);if(t)return e()}))},_asyncRunCalculations:function(t,e){var n=this,r=this._lfData,i=!1;return e&&(this._regenerateQuestionnaireResp(),i=this._evaluateVariables(r)),this._handlePendingQueries(i||e,(function(){var i=n._evaluateFieldExpressions(r,t,!e);return n._handlePendingQueries(i,(function(){return n._asyncRunCalculations(!1,!1)}))})).then((function(){if(console.log("Ran expressions in "+(new Date-n._runStart)+" ms"),n._firstExpressionRunComplete||(n._firstExpressionRunComplete=!0),n._currentRunPromise=void 0,n._pendingRun)return n.runCalculations(!1)}),(function(t){throw console.log("Run of expressions failed; reason follows"),console.log(t),n._currentRunPromise=void 0,n._pendingRun=!1,t}))},_updateItemVariable:function(t,e,n){var r=t._fhirVariables[e];return t._fhirVariables[e]=n,D(r,n)||(t._varChanged=!0),t._varChanged},_evaluateVariables:function(t){var e=this,n=this,r=!1,i=this._fhir.SDC,o=t._fhirExt&&t._fhirExt[i.fhirExtVariable];if(o){for(var a=function(r,i){var a=o[r],s=void 0,u=a.valueExpression.name;if(t._fhirVariables?t._fhirVariables[u]:t._fhirVariables=Object.create(e._itemWithVars(t)._fhirVariables),"text/fhirpath"==a.valueExpression.language){var c=t._fhirVariables[u];delete t._fhirVariables[u],s=e._evaluateFHIRPath(t,a.valueExpression.expression),t._fhirVariables[u]=c,e._updateItemVariable(t,u,s)}else if("application/x-fhir-query"==a.valueExpression.language){var l=a.valueExpression.expression,p=!1;l=l.replace(/\{\{([^}]+)\}\}/g,(function(e,r){var i=n._evaluateFHIRPath(t,r)[0];return null==i&&(p=!0),p?"":""+i})),t._currentFhirQueryURIs||(t._currentFhirQueryURIs={});var h,f=t._currentFhirQueryURIs[u];l!=f&&(t._currentFhirQueryURIs[u]=l,p?e._updateItemVariable(t,u,void 0):e._queryCache.hasOwnProperty(l)?(s=e._queryCache[l],e._updateItemVariable(t,u,s)):(l+=(l.indexOf("?")>0?"&":"?")+"_format=json",h=!/^https?:/.test(l)&&LForms.fhirContext?LForms.fhirContext.request(l):fetch(l).then((function(t){return t.json()})),e._pendingQueries.push(h.then((function(e){return s=n._queryCache[l]=e,n._updateItemVariable(t,u,s)}),(function(){return console.error("Unable to load FHIR data from "+l),n._updateItemVariable(t,u,void 0)})))))}},s=0,u=o.length;s<u;++s)a(s);r=t._varChanged}if(t.items)for(var c=0,l=t.items.length;c<l;++c){var p=this._evaluateVariables(t.items[c]);r||(r=p)}return r},_evaluateFieldExpressions:function(t,e,n){var r=!1;if(n&&t.items&&t._varChanged&&(t._varChanged=!1,n=!1),!n){t._varChanged=!1;var i=t._fhirExt;if(i){var o=this._fhir.SDC,a=e?t._initialFieldExpExts:t._responsiveFieldExpExts;if(void 0===a){a=[];var s,u=R(e?this._initialFieldExpURIs:this._responsiveFieldExpURIs);try{for(u.s();!(s=u.n()).done;){var c=i[s.value];c&&a.push.apply(a,c)}}catch(t){u.e(t)}finally{u.f()}0===a.length&&(a=null),e?t._initialFieldExpExts=a:t._responsiveFieldExpExts=a}if(a){for(var l=!1,p=0,h=a.length;p<h;++p){var f=a[p],d=f.url==o.fhirExtCalculatedExp;if(d&&t._calculatedValue&&!D(t._calculatedValue,t.value)&&(t._userModifiedCalculatedValue=!0),!(t._userModifiedCalculatedValue&&d||"text/fhirpath"!=f.valueExpression.language)){var y=this._evaluateFHIRPath(t,f.valueExpression.expression),g=f.url==o.fhirExtAnswerExp?this._setItemListFromFHIRPath(t,y):this._setItemValueFromFHIRPath(t,y,d);l||(l=g)}}r=l}}}if(t.items)for(var m=0,v=t.items.length;m<v;++m){var x=this._evaluateFieldExpressions(t.items[m],e,n);r||(r=x)}return r},_regenerateQuestionnaireResp:function(){var t=this._fhir.SDC.convertLFormsToQuestionnaireResponse(this._lfData);this._lfData._fhirVariables.resource=t,this._elemIDToQRItem=this._createIDtoQRItemMap(t)},_itemWithVars:function(t){for(var e=t;!e._fhirVariables;)e=e._parentItem;return e},_evaluateFHIRPath:function(t,e){var n,r=this._itemWithVars(t)._fhirVariables;try{var i={};for(var o in r)i[o]=r[o];var a=t._elementId?this._elemIDToQRItem[t._elementId]:this._lfData._fhirVariables.resource,s=this._compiledExpressions[e];s||(s=this._compiledExpressions[e]=this._fhir.fhirpath.compile(e,this._fhir.fhirpathModel)),n=s(a,i)}catch(t){console.log(t)}return n},_createIDtoQRItemMap:function(t){var e={};return this._addToIDtoQRItemMap(this._lfData,t,e),e},_addToIDtoQRItemMap:function(t,e,n){var r=0;if(t.linkId===e.linkId){if(t.items&&e&&e.item&&e.item.length>0)for(var i=t.items,o=e.item,a=i.length,s=0,u=0,c=o.length;u<c&&s<a;++u){var l=o[u],p=i[s];if(l.answer)for(var h=l.answer?l.answer.length:0,f=0;f<h;++s){if(s>=a)throw new Error("Logic error in _addToIDtoQRITemMap; ran out of lfItems");var d=i[s],y=this._addToIDtoQRItemMap(d,l,n);0!=y&&(Array.isArray(d.value)?f+=d.value.length:f+=1),r+=y}else{var g=this._addToIDtoQRItemMap(p,l,n);0===g?--u:r+=g,++s}}if(t._elementId&&(r||void 0!==t.value&&null!==t.value&&""!==t.value)){if(!e)throw new Error("Logic error in _addToIDtoQRItemMap; missing qrItem");n[t._elementId]=e,r+=1}}return r},_setItemListFromFHIRPath:function(t,e){var n=t.answers,r=!!n&&Array.isArray(n),i=!!e&&Array.isArray(e),o=r!=i||i&&e.length!=n.length,a=[],s=this._fhir.SDC.fhirExtUrlOptionScore;if(i)for(var u=0,c=e.length;u<c;++u){var l=e[u],p=a[u]={};if("object"===b(l)){var h=l.code;void 0!==h&&(p.code=h);var f=l.display;void 0!==f&&(p.text=f);var d=l.system;void 0!==d&&(p.system=d);var y=t._fhirExt&&t._fhirExt[s];y&&(p.score=y[0].valueDecimal)}else p={text:""+l};o||(o=!r||!this._lfData._objectEqual(p,n[u]))}return o&&(t.answers=a,this._lfData._updateAutocompOptions(t,!0),this._lfData._resetItemValueWithModifiedAnswers(t)),o},_setItemValueFromFHIRPath:function(t,e,n){var r,i=t.value;void 0!==e&&(r=e[0]),null==r?t.value=void 0:this._fhir.SDC._processFHIRValues(t,e);var o=!D(i,t.value);return t._calculatedValue=t.value,o&&n&&!this._firstExpressionRunComplete&&this._lfData.hasSavedData&&(t._userModifiedCalculatedValue=!0,t.value=i,o=!1),o}};LForms.FHIR||(LForms.FHIR={});var O=LForms.FHIR.R4={LOINC_URI:"http://loinc.org"};O.fhirpath=n(44),O.fhirpathModel=n(82),O.DiagnosticReport=i,O.DiagnosticReport._commonExport=c,O.SDC=h,O.SDC._commonExport=c,d(O.SDC),y(O.SDC),x(O.SDC),E(O.SDC),O.SDC.processExtensions=function(t,e){var n=e?t[e]:t;if(n){var r=n.extension;if(r)for(var i=0,o=r.length;i<o;++i){var a=r[i],s=a.url,u=I[s];u&&u(t,e,a)}}},O.SDC.ExpressionProcessor=S,O.SDC.fhirVersion="R4",O.reservedVarNames={},["context","resource"].forEach((function(t){O.reservedVarNames[t]=!0}))}]);
  //# sourceMappingURL=lformsFHIR.min.js.map