@arcgis/core 4.31.0-next.20240605 → 4.31.0-next.20240607
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/arcade/functions/centroid.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/04d84f7c9c5b5a6bdf47.js +1 -0
- package/assets/esri/core/workers/chunks/17e4d9be754e9ce2cec4.js +1 -0
- package/assets/esri/core/workers/chunks/1a64e0020d12c251ad4b.js +1 -0
- package/assets/esri/core/workers/chunks/{3ec2ed6b4d2f373ed0dc.js → 1ece003ccf1c03fb42d9.js} +1 -1
- package/assets/esri/core/workers/chunks/2ee7d91cc6c1ae7f3698.js +1 -0
- package/assets/esri/core/workers/chunks/423abec9211aa6ab6502.js +1 -0
- package/assets/esri/core/workers/chunks/493851fc4b07de3fe924.js +1 -0
- package/assets/esri/core/workers/chunks/66b835a5edfcdcf21c06.js +1 -0
- package/assets/esri/core/workers/chunks/{24a02d266749a77c8ae1.js → 7866b86ebe02adf5e874.js} +17 -17
- package/assets/esri/core/workers/chunks/{d1c4d0d53614055bc173.js → c406e673d2dd7e702af0.js} +1 -1
- package/assets/esri/core/workers/chunks/{a5f467805178686b7240.js → c70683b7183458b338f8.js} +1 -1
- package/assets/esri/core/workers/chunks/fa5e171c8ce844363b6c.js +1 -0
- package/assets/esri/themes/base/widgets/_BuildingDisciplinesTree.scss +5 -138
- package/assets/esri/themes/base/widgets/_BuildingExplorer.scss +1 -9
- package/assets/esri/themes/base/widgets/_BuildingLevelPicker.scss +5 -39
- package/assets/esri/themes/base/widgets/_BuildingPhasePicker.scss +2 -17
- package/assets/esri/themes/base/widgets/_Editor.scss +8 -0
- package/assets/esri/themes/base/widgets/_Sketch.scss +8 -0
- package/assets/esri/themes/base/widgets/_SketchTooltipControls.scss +1 -0
- package/assets/esri/themes/base/widgets/_SnappingControls.scss +4 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/ColorMaterial.glsl.js +1 -1
- package/chunks/ComponentShader.glsl.js +1 -1
- package/chunks/CypherLexer.js +5 -0
- package/chunks/CypherListener.js +5 -0
- package/chunks/CypherParser.js +5 -0
- package/chunks/DefaultMaterial.glsl.js +1 -1
- package/chunks/HUDMaterial.glsl.js +32 -32
- package/chunks/ImageMaterial.glsl.js +1 -1
- package/chunks/LineMarker.glsl.js +1 -1
- package/chunks/NativeLine.glsl.js +1 -1
- package/chunks/OITCompositing.glsl.js +12 -9
- package/chunks/Pattern.glsl.js +1 -1
- package/chunks/RealisticTree.glsl.js +1 -1
- package/chunks/RibbonLine.glsl.js +1 -1
- package/chunks/ShadedColorMaterial.glsl.js +1 -1
- package/chunks/WaterSurface.glsl.js +1 -1
- package/chunks/antlr4.web.js +5 -0
- package/layers/LinkChartLayer.js +1 -1
- package/layers/knowledgeGraph/antlr/BindParamsListener.js +5 -0
- package/layers/knowledgeGraph/antlr/SimpleErrorListener.js +5 -0
- package/layers/knowledgeGraph/cypherUtils.js +5 -0
- package/layers/knowledgeGraph/supportUtils.js +1 -1
- package/layers/support/rasterFunctions/AspectFunction.js +1 -1
- package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
- package/layers/support/rasterFunctions/NDVIFunction.js +1 -1
- package/layers/support/rasterFunctions/RemapFunction.js +1 -1
- package/layers/support/rasterFunctions/SlopeFunction.js +1 -1
- package/libs/linkchartlayout/LinkChartLayout.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/2d/support/HighlightOptions.js +1 -1
- package/views/3d/layers/i3s/I3SClientMaterialUtil.js +1 -1
- package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
- package/views/3d/support/HighlightOptions.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/terrain/TileAgent.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/terrain/terrainUtils.js +1 -1
- package/views/3d/terrain/tileUtils.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ElevationAgnosticBVH.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/AlphaCutoff.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/DiscardOrAdjustAlphaBlend.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/OITCompositing.glsl.js +1 -1
- package/views/support/HighlightDefaults.js +5 -0
- package/views/support/HighlightOptions.js +5 -0
- package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesNode.js +1 -1
- package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesTree.js +1 -1
- package/widgets/BuildingExplorer/BuildingDisciplinesViewModel.js +1 -1
- package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
- package/widgets/BuildingExplorer/BuildingLevelPicker/Label.js +1 -1
- package/widgets/BuildingExplorer/BuildingLevelPicker/LevelItem.js +1 -1
- package/widgets/BuildingExplorer/BuildingLevelPicker/css.js +1 -1
- package/widgets/BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js +1 -1
- package/widgets/BuildingExplorer/BuildingPhasePicker/css.js +5 -0
- package/widgets/BuildingExplorer/support/LayerTreeNode.js +1 -1
- package/widgets/BuildingExplorer.js +1 -1
- package/widgets/support/legacyIcon.js +1 -1
- package/assets/esri/core/workers/chunks/3841ef7007eda2f3a7a4.js +0 -1
- package/assets/esri/core/workers/chunks/4ccf7a2b36e0b8b26736.js +0 -1
- package/assets/esri/core/workers/chunks/a111eb0ae78a9f5be981.js +0 -1
- package/assets/esri/core/workers/chunks/b57a5055b9956433dac2.js +0 -1
- package/assets/esri/core/workers/chunks/b9e4e2451108cad75bfd.js +0 -1
- package/assets/esri/core/workers/chunks/f9774ba48f3aa3b8fac4.js +0 -1
- package/assets/esri/core/workers/chunks/fa8b00135363c450de16.js +0 -1
- package/views/3d/webgl-engine/effects/highlight/HighlightDefaults.js +0 -5
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
var t={92:()=>{}},e={};function n(s){var i=e[s];if(void 0!==i)return i.exports;var r=e[s]={exports:{}};return t[s](r,r.exports,n),r.exports}n.d=(t,e)=>{for(var s in e)n.o(e,s)&&!n.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var s={};(()=>{n.d(s,{dx:()=>$,q2:()=>Ot,FO:()=>Ce,xf:()=>Ie,Gy:()=>ve,s4:()=>Pt,c7:()=>be,_7:()=>le,tx:()=>Ae,gp:()=>me,cK:()=>Lt,zs:()=>Te,AV:()=>Ie,Xp:()=>m,VS:()=>E,ul:()=>W,hW:()=>Ut,x1:()=>Xt,z5:()=>ee,oN:()=>de,TB:()=>pe,u1:()=>ge,_b:()=>Fe,$F:()=>se,_T:()=>Be,db:()=>ie,Zx:()=>te,_x:()=>Ft,r8:()=>M,JI:()=>w,TP:()=>P,WU:()=>t,Nj:()=>c,ZP:()=>We});class t{constructor(){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}getTokenSource(){return this.source[0]}getInputStream(){return this.source[1]}get text(){return this._text}set text(t){this._text=t}}function e(t,e){if(!Array.isArray(t)||!Array.isArray(e))return!1;if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!(t[n]===e[n]||t[n].equals&&t[n].equals(e[n])))return!1;return!0}t.INVALID_TYPE=0,t.EPSILON=-2,t.MIN_USER_TOKEN_TYPE=1,t.EOF=-1,t.DEFAULT_CHANNEL=0,t.HIDDEN_CHANNEL=1;const i=Math.round(Math.random()*Math.pow(2,32));function r(t){if(!t)return 0;const e=typeof t,n="string"===e?t:!("object"!==e||!t.toString)&&t.toString();if(!n)return 0;let s,r;const o=3&n.length,a=n.length-o;let l=i;const h=3432918353,c=461845907;let u=0;for(;u<a;)r=255&n.charCodeAt(u)|(255&n.charCodeAt(++u))<<8|(255&n.charCodeAt(++u))<<16|(255&n.charCodeAt(++u))<<24,++u,r=(65535&r)*h+(((r>>>16)*h&65535)<<16)&4294967295,r=r<<15|r>>>17,r=(65535&r)*c+(((r>>>16)*c&65535)<<16)&4294967295,l^=r,l=l<<13|l>>>19,s=5*(65535&l)+((5*(l>>>16)&65535)<<16)&4294967295,l=27492+(65535&s)+((58964+(s>>>16)&65535)<<16);switch(r=0,o){case 3:r^=(255&n.charCodeAt(u+2))<<16;case 2:r^=(255&n.charCodeAt(u+1))<<8;case 1:r^=255&n.charCodeAt(u),r=(65535&r)*h+(((r>>>16)*h&65535)<<16)&4294967295,r=r<<15|r>>>17,r=(65535&r)*c+(((r>>>16)*c&65535)<<16)&4294967295,l^=r}return l^=n.length,l^=l>>>16,l=2246822507*(65535&l)+((2246822507*(l>>>16)&65535)<<16)&4294967295,l^=l>>>13,l=3266489909*(65535&l)+((3266489909*(l>>>16)&65535)<<16)&4294967295,l^=l>>>16,l>>>0}class o{constructor(){this.count=0,this.hash=0}update(){for(let t=0;t<arguments.length;t++){const e=arguments[t];if(null!=e)if(Array.isArray(e))this.update.apply(this,e);else{let t=0;switch(typeof e){case"undefined":case"function":continue;case"number":case"boolean":t=e;break;case"string":t=r(e);break;default:e.updateHashCode?e.updateHashCode(this):console.log("No updateHashCode for "+e.toString());continue}t*=3432918353,t=t<<15|t>>>17,t*=461845907,this.count=this.count+1;let n=this.hash^t;n=n<<13|n>>>19,n=5*n+3864292196,this.hash=n}}}finish(){let t=this.hash^4*this.count;return t^=t>>>16,t*=2246822507,t^=t>>>13,t*=3266489909,t^=t>>>16,t}static hashStuff(){const t=new o;return t.update.apply(t,arguments),t.finish()}}function a(t){return t?"string"==typeof t?r(t):t.hashCode():-1}function l(t,e){return t?t.equals(e):t===e}function h(t){return null===t?"null":t}function c(t){return Array.isArray(t)?"["+t.map(h).join(", ")+"]":"null"}const u="h-";class d{constructor(t,e){this.data={},this.hashFunction=t||a,this.equalsFunction=e||l}add(t){const e=u+this.hashFunction(t);if(e in this.data){const n=this.data[e];for(let e=0;e<n.length;e++)if(this.equalsFunction(t,n[e]))return n[e];return n.push(t),t}return this.data[e]=[t],t}has(t){return null!=this.get(t)}get(t){const e=u+this.hashFunction(t);if(e in this.data){const n=this.data[e];for(let e=0;e<n.length;e++)if(this.equalsFunction(t,n[e]))return n[e]}return null}values(){return Object.keys(this.data).filter((t=>t.startsWith(u))).flatMap((t=>this.data[t]),this)}toString(){return c(this.values())}get length(){return Object.keys(this.data).filter((t=>t.startsWith(u))).map((t=>this.data[t].length),this).reduce(((t,e)=>t+e),0)}}class p{hashCode(){const t=new o;return this.updateHashCode(t),t.finish()}evaluate(t,e){}evalPrecedence(t,e){return this}static andContext(t,e){if(null===t||t===p.NONE)return e;if(null===e||e===p.NONE)return t;const n=new g(t,e);return 1===n.opnds.length?n.opnds[0]:n}static orContext(t,e){if(null===t)return e;if(null===e)return t;if(t===p.NONE||e===p.NONE)return p.NONE;const n=new f(t,e);return 1===n.opnds.length?n.opnds[0]:n}}class g extends p{constructor(t,e){super();const n=new d;t instanceof g?t.opnds.map((function(t){n.add(t)})):n.add(t),e instanceof g?e.opnds.map((function(t){n.add(t)})):n.add(e);const s=x(n);if(s.length>0){let t=null;s.map((function(e){(null===t||e.precedence<t.precedence)&&(t=e)})),n.add(t)}this.opnds=Array.from(n.values())}equals(t){return this===t||t instanceof g&&e(this.opnds,t.opnds)}updateHashCode(t){t.update(this.opnds,"AND")}evaluate(t,e){for(let n=0;n<this.opnds.length;n++)if(!this.opnds[n].evaluate(t,e))return!1;return!0}evalPrecedence(t,e){let n=!1;const s=[];for(let r=0;r<this.opnds.length;r++){const i=this.opnds[r],o=i.evalPrecedence(t,e);if(n|=o!==i,null===o)return null;o!==p.NONE&&s.push(o)}if(!n)return this;if(0===s.length)return p.NONE;let i=null;return s.map((function(t){i=null===i?t:p.andContext(i,t)})),i}toString(){const t=this.opnds.map((t=>t.toString()));return(t.length>3?t.slice(3):t).join("&&")}}class f extends p{constructor(t,e){super();const n=new d;t instanceof f?t.opnds.map((function(t){n.add(t)})):n.add(t),e instanceof f?e.opnds.map((function(t){n.add(t)})):n.add(e);const s=x(n);if(s.length>0){const t=s.sort((function(t,e){return t.compareTo(e)})),e=t[t.length-1];n.add(e)}this.opnds=Array.from(n.values())}equals(t){return this===t||t instanceof f&&e(this.opnds,t.opnds)}updateHashCode(t){t.update(this.opnds,"OR")}evaluate(t,e){for(let n=0;n<this.opnds.length;n++)if(this.opnds[n].evaluate(t,e))return!0;return!1}evalPrecedence(t,e){let n=!1;const s=[];for(let i=0;i<this.opnds.length;i++){const r=this.opnds[i],o=r.evalPrecedence(t,e);if(n|=o!==r,o===p.NONE)return p.NONE;null!==o&&s.push(o)}return n?(s.length,null):this}toString(){const t=this.opnds.map((t=>t.toString()));return(t.length>3?t.slice(3):t).join("||")}}function x(t){const e=[];return t.values().map((function(t){t instanceof p.PrecedencePredicate&&e.push(t)})),e}function T(t,e){if(null===t){const t={state:null,alt:null,context:null,semanticContext:null};return e&&(t.reachesIntoOuterContext=0),t}{const n={};return n.state=t.state||null,n.alt=void 0===t.alt?null:t.alt,n.context=t.context||null,n.semanticContext=t.semanticContext||null,e&&(n.reachesIntoOuterContext=t.reachesIntoOuterContext||0,n.precedenceFilterSuppressed=t.precedenceFilterSuppressed||!1),n}}class S{constructor(t,e){this.checkContext(t,e),t=T(t),e=T(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:p.NONE,this.reachesIntoOuterContext=e.reachesIntoOuterContext,this.precedenceFilterSuppressed=e.precedenceFilterSuppressed}checkContext(t,e){null!==t.context&&void 0!==t.context||null!==e&&null!==e.context&&void 0!==e.context||(this.context=null)}hashCode(){const t=new o;return this.updateHashCode(t),t.finish()}updateHashCode(t){t.update(this.state.stateNumber,this.alt,this.context,this.semanticContext)}equals(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}hashCodeForConfigSet(){const t=new o;return t.update(this.state.stateNumber,this.alt,this.semanticContext),t.finish()}equalsForConfigSet(t){return this===t||t instanceof S&&this.state.stateNumber===t.state.stateNumber&&this.alt===t.alt&&this.semanticContext.equals(t.semanticContext)}toString(){return"("+this.state+","+this.alt+(null!==this.context?",["+this.context.toString()+"]":"")+(this.semanticContext!==p.NONE?","+this.semanticContext.toString():"")+(this.reachesIntoOuterContext>0?",up="+this.reachesIntoOuterContext:"")+")"}}class m{constructor(t,e){this.start=t,this.stop=e}clone(){return new m(this.start,this.stop)}contains(t){return t>=this.start&&t<this.stop}toString(){return this.start===this.stop-1?this.start.toString():this.start.toString()+".."+(this.stop-1).toString()}get length(){return this.stop-this.start}}m.INVALID_INTERVAL=new m(-1,-2);class E{constructor(){this.intervals=null,this.readOnly=!1}first(e){return null===this.intervals||0===this.intervals.length?t.INVALID_TYPE:this.intervals[0].start}addOne(t){this.addInterval(new m(t,t+1))}addRange(t,e){this.addInterval(new m(t,e+1))}addInterval(t){if(null===this.intervals)this.intervals=[],this.intervals.push(t.clone());else{for(let e=0;e<this.intervals.length;e++){const 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]=new m(t.start,n.stop));if(t.start<=n.stop)return this.intervals[e]=new m(Math.min(n.start,t.start),Math.max(n.stop,t.stop)),void this.reduce(e)}this.intervals.push(t.clone())}}addSet(t){return null!==t.intervals&&t.intervals.forEach((t=>this.addInterval(t)),this),this}reduce(t){if(t<this.intervals.length-1){const e=this.intervals[t],n=this.intervals[t+1];e.stop>=n.stop?(this.intervals.splice(t+1,1),this.reduce(t)):e.stop>=n.start&&(this.intervals[t]=new m(e.start,n.stop),this.intervals.splice(t+1,1))}}complement(t,e){const n=new E;return n.addInterval(new m(t,e+1)),null!==this.intervals&&this.intervals.forEach((t=>n.removeRange(t))),n}contains(t){if(null===this.intervals)return!1;for(let e=0;e<this.intervals.length;e++)if(this.intervals[e].contains(t))return!0;return!1}removeRange(t){if(t.start===t.stop-1)this.removeOne(t.start);else if(null!==this.intervals){let e=0;for(let n=0;n<this.intervals.length;n++){const n=this.intervals[e];if(t.stop<=n.start)return;if(t.start>n.start&&t.stop<n.stop){this.intervals[e]=new m(n.start,t.start);const s=new m(t.stop,n.stop);return void this.intervals.splice(e,0,s)}t.start<=n.start&&t.stop>=n.stop?(this.intervals.splice(e,1),e-=1):t.start<n.stop?this.intervals[e]=new m(n.start,t.start):t.stop<n.stop&&(this.intervals[e]=new m(t.stop,n.stop)),e+=1}}}removeOne(t){if(null!==this.intervals)for(let e=0;e<this.intervals.length;e++){const 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 m(n.start+1,n.stop));if(t===n.stop-1)return void(this.intervals[e]=new m(n.start,n.stop-1));if(t<n.stop-1){const s=new m(n.start,t);return n.start=t+1,void this.intervals.splice(e,0,s)}}}toString(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()}toCharString(){const e=[];for(let n=0;n<this.intervals.length;n++){const s=this.intervals[n];s.stop===s.start+1?s.start===t.EOF?e.push("<EOF>"):e.push("'"+String.fromCharCode(s.start)+"'"):e.push("'"+String.fromCharCode(s.start)+"'..'"+String.fromCharCode(s.stop-1)+"'")}return e.length>1?"{"+e.join(", ")+"}":e[0]}toIndexString(){const e=[];for(let n=0;n<this.intervals.length;n++){const s=this.intervals[n];s.stop===s.start+1?s.start===t.EOF?e.push("<EOF>"):e.push(s.start.toString()):e.push(s.start.toString()+".."+(s.stop-1).toString())}return e.length>1?"{"+e.join(", ")+"}":e[0]}toTokenString(t,e){const n=[];for(let s=0;s<this.intervals.length;s++){const i=this.intervals[s];for(let s=i.start;s<i.stop;s++)n.push(this.elementName(t,e,s))}return n.length>1?"{"+n.join(", ")+"}":n[0]}elementName(e,n,s){return s===t.EOF?"<EOF>":s===t.EPSILON?"<EPSILON>":e[s]||n[s]}get length(){return this.intervals.map((t=>t.length)).reduce(((t,e)=>t+e))}}class _{constructor(){this.atn=null,this.stateNumber=_.INVALID_STATE_NUMBER,this.stateType=null,this.ruleIndex=0,this.epsilonOnlyTransitions=!1,this.transitions=[],this.nextTokenWithinRule=null}toString(){return this.stateNumber}equals(t){return t instanceof _&&this.stateNumber===t.stateNumber}isNonGreedyExitState(){return!1}addTransition(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)}}_.INVALID_TYPE=0,_.BASIC=1,_.RULE_START=2,_.BLOCK_START=3,_.PLUS_BLOCK_START=4,_.STAR_BLOCK_START=5,_.TOKEN_START=6,_.RULE_STOP=7,_.BLOCK_END=8,_.STAR_LOOP_BACK=9,_.STAR_LOOP_ENTRY=10,_.PLUS_LOOP_BACK=11,_.LOOP_END=12,_.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"],_.INVALID_STATE_NUMBER=-1;class A extends _{constructor(){return super(),this.stateType=_.RULE_STOP,this}}class C{constructor(t){if(null==t)throw"target cannot be null.";this.target=t,this.isEpsilon=!1,this.label=null}}C.EPSILON=1,C.RANGE=2,C.RULE=3,C.PREDICATE=4,C.ATOM=5,C.ACTION=6,C.SET=7,C.NOT_SET=8,C.WILDCARD=9,C.PRECEDENCE=10,C.serializationNames=["INVALID","EPSILON","RANGE","RULE","PREDICATE","ATOM","ACTION","SET","NOT_SET","WILDCARD","PRECEDENCE"],C.serializationTypes={EpsilonTransition:C.EPSILON,RangeTransition:C.RANGE,RuleTransition:C.RULE,PredicateTransition:C.PREDICATE,AtomTransition:C.ATOM,ActionTransition:C.ACTION,SetTransition:C.SET,NotSetTransition:C.NOT_SET,WildcardTransition:C.WILDCARD,PrecedencePredicateTransition:C.PRECEDENCE};class N extends C{constructor(t,e,n,s){super(t),this.ruleIndex=e,this.precedence=n,this.followState=s,this.serializationType=C.RULE,this.isEpsilon=!0}matches(t,e,n){return!1}}class y extends C{constructor(e,n){super(e),this.serializationType=C.SET,null!=n?this.label=n:(this.label=new E,this.label.addOne(t.INVALID_TYPE))}matches(t,e,n){return this.label.contains(t)}toString(){return this.label.toString()}}class I extends y{constructor(t,e){super(t,e),this.serializationType=C.NOT_SET}matches(t,e,n){return t>=e&&t<=n&&!super.matches(t,e,n)}toString(){return"~"+super.toString()}}class k extends C{constructor(t){super(t),this.serializationType=C.WILDCARD}matches(t,e,n){return t>=e&&t<=n}toString(){return"."}}class O extends C{constructor(t){super(t)}}class L{}class v extends L{}class R extends v{}class w extends R{get ruleContext(){throw new Error("missing interface implementation")}}class P extends R{}class b extends P{}const D={toStringTree:function(t,e,n){e=e||null,null!==(n=n||null)&&(e=n.ruleNames);let s=D.getNodeText(t,e);s=function(t,e){return t.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r")}(s);const i=t.getChildCount();if(0===i)return s;let r="("+s+" ";i>0&&(s=D.toStringTree(t.getChild(0),e),r=r.concat(s));for(let o=1;o<i;o++)s=D.toStringTree(t.getChild(o),e),r=r.concat(" "+s);return r=r.concat(")"),r},getNodeText:function(e,n,s){if(n=n||null,null!==(s=s||null)&&(n=s.ruleNames),null!==n){if(e instanceof w){const t=e.ruleContext.getAltNumber();return 0!=t?n[e.ruleIndex]+":"+t:n[e.ruleIndex]}if(e instanceof b)return e.toString();if(e instanceof P&&null!==e.symbol)return e.symbol.text}const i=e.getPayload();return i instanceof t?i.text:e.getPayload().toString()},getChildren:function(t){const e=[];for(let n=0;n<t.getChildCount();n++)e.push(t.getChild(n));return e},getAncestors:function(t){let e=[];for(t=t.getParent();null!==t;)e=[t].concat(e),t=t.getParent();return e},findAllTokenNodes:function(t,e){return D.findAllNodes(t,e,!0)},findAllRuleNodes:function(t,e){return D.findAllNodes(t,e,!1)},findAllNodes:function(t,e,n){const s=[];return D._findAllNodes(t,e,n,s),s},_findAllNodes:function(t,e,n,s){n&&t instanceof P?t.symbol.type===e&&s.push(t):!n&&t instanceof w&&t.ruleIndex===e&&s.push(t);for(let i=0;i<t.getChildCount();i++)D._findAllNodes(t.getChild(i),e,n,s)},descendants:function(t){let e=[t];for(let n=0;n<t.getChildCount();n++)e=e.concat(D.descendants(t.getChild(n)));return e}},F=D;class M extends w{constructor(t,e){super(),this.parentCtx=t||null,this.invokingState=e||-1}depth(){let t=0,e=this;for(;null!==e;)e=e.parentCtx,t+=1;return t}isEmpty(){return-1===this.invokingState}getSourceInterval(){return m.INVALID_INTERVAL}get ruleContext(){return this}getPayload(){return this}getText(){return 0===this.getChildCount()?"":this.children.map((function(t){return t.getText()})).join("")}getAltNumber(){return 0}setAltNumber(t){}getChild(t){return null}getChildCount(){return 0}accept(t){return t.visitChildren(this)}toStringTree(t,e){return F.toStringTree(this,t,e)}toString(t,e){t=t||null,e=e||null;let n=this,s="[";for(;null!==n&&n!==e;){if(null===t)n.isEmpty()||(s+=n.invokingState);else{const e=n.ruleIndex;s+=e>=0&&e<t.length?t[e]:""+e}null===n.parentCtx||null===t&&n.parentCtx.isEmpty()||(s+=" "),n=n.parentCtx}return s+="]",s}}class U{constructor(t){this.cachedHashCode=t}isEmpty(){return this===U.EMPTY}hasEmptyPath(){return this.getReturnState(this.length-1)===U.EMPTY_RETURN_STATE}hashCode(){return this.cachedHashCode}updateHashCode(t){t.update(this.cachedHashCode)}}U.EMPTY=null,U.EMPTY_RETURN_STATE=2147483647,U.globalNodeCount=1,U.id=U.globalNodeCount,U.trace_atn_sim=!1;class B extends U{constructor(t,e){const n=new o;return n.update(t,e),super(n.finish()),this.parents=t,this.returnStates=e,this}isEmpty(){return this.returnStates[0]===U.EMPTY_RETURN_STATE}getParent(t){return this.parents[t]}getReturnState(t){return this.returnStates[t]}equals(t){return this===t||t instanceof B&&this.hashCode()===t.hashCode()&&e(this.returnStates,t.returnStates)&&e(this.parents,t.parents)}toString(){if(this.isEmpty())return"[]";{let t="[";for(let e=0;e<this.returnStates.length;e++)e>0&&(t+=", "),this.returnStates[e]!==U.EMPTY_RETURN_STATE?(t+=this.returnStates[e],null!==this.parents[e]?t=t+" "+this.parents[e]:t+="null"):t+="$";return t+"]"}}get length(){return this.returnStates.length}}class V extends U{constructor(t,e){let n=0;const s=new o;null!==t?s.update(t,e):s.update(1),n=s.finish(),super(n),this.parentCtx=t,this.returnState=e}getParent(t){return this.parentCtx}getReturnState(t){return this.returnState}equals(t){return this===t||t instanceof V&&this.hashCode()===t.hashCode()&&this.returnState===t.returnState&&(null==this.parentCtx?null==t.parentCtx:this.parentCtx.equals(t.parentCtx))}toString(){const t=null===this.parentCtx?"":this.parentCtx.toString();return 0===t.length?this.returnState===U.EMPTY_RETURN_STATE?"$":""+this.returnState:this.returnState+" "+t}get length(){return 1}static create(t,e){return e===U.EMPTY_RETURN_STATE&&null===t?U.EMPTY:new V(t,e)}}class z extends V{constructor(){super(null,U.EMPTY_RETURN_STATE)}isEmpty(){return!0}getParent(t){return null}getReturnState(t){return this.returnState}equals(t){return this===t}toString(){return"$"}}U.EMPTY=new z;const q="h-";class H{constructor(t,e){this.data={},this.hashFunction=t||a,this.equalsFunction=e||l}set(t,e){const n=q+this.hashFunction(t);if(n in this.data){const s=this.data[n];for(let n=0;n<s.length;n++){const i=s[n];if(this.equalsFunction(t,i.key)){const t=i.value;return i.value=e,t}}return s.push({key:t,value:e}),e}return this.data[n]=[{key:t,value:e}],e}containsKey(t){const e=q+this.hashFunction(t);if(e in this.data){const n=this.data[e];for(let e=0;e<n.length;e++){const s=n[e];if(this.equalsFunction(t,s.key))return!0}}return!1}get(t){const e=q+this.hashFunction(t);if(e in this.data){const n=this.data[e];for(let e=0;e<n.length;e++){const s=n[e];if(this.equalsFunction(t,s.key))return s.value}}return null}entries(){return Object.keys(this.data).filter((t=>t.startsWith(q))).flatMap((t=>this.data[t]),this)}getKeys(){return this.entries().map((t=>t.key))}getValues(){return this.entries().map((t=>t.value))}toString(){return"["+this.entries().map((t=>"{"+t.key+":"+t.value+"}")).join(", ")+"]"}get length(){return Object.keys(this.data).filter((t=>t.startsWith(q))).map((t=>this.data[t].length),this).reduce(((t,e)=>t+e),0)}}function K(t,e){if(null==e&&(e=M.EMPTY),null===e.parentCtx||e===M.EMPTY)return U.EMPTY;const n=K(t,e.parentCtx),s=t.states[e.invokingState].transitions[0];return V.create(n,s.followState.stateNumber)}function Y(t,e,n){if(t.isEmpty())return t;let s=n.get(t)||null;if(null!==s)return s;if(s=e.get(t),null!==s)return n.set(t,s),s;let i=!1,r=[];for(let a=0;a<r.length;a++){const s=Y(t.getParent(a),e,n);if(i||s!==t.getParent(a)){if(!i){r=[];for(let e=0;e<t.length;e++)r[e]=t.getParent(e);i=!0}r[a]=s}}if(!i)return e.add(t),n.set(t,t),t;let o=null;return o=0===r.length?U.EMPTY:1===r.length?V.create(r[0],t.getReturnState(0)):new B(r,t.returnStates),e.add(o),n.set(o,o),n.set(t,o),o}function G(t,e,n,s){if(t===e)return t;if(t instanceof V&&e instanceof V)return function(t,e,n,s){if(null!==s){let n=s.get(t,e);if(null!==n)return n;if(n=s.get(e,t),null!==n)return n}const i=function(t,e,n){if(n){if(t===U.EMPTY)return U.EMPTY;if(e===U.EMPTY)return U.EMPTY}else{if(t===U.EMPTY&&e===U.EMPTY)return U.EMPTY;if(t===U.EMPTY){const t=[e.returnState,U.EMPTY_RETURN_STATE],n=[e.parentCtx,null];return new B(n,t)}if(e===U.EMPTY){const e=[t.returnState,U.EMPTY_RETURN_STATE],n=[t.parentCtx,null];return new B(n,e)}}return null}(t,e,n);if(null!==i)return null!==s&&s.set(t,e,i),i;if(t.returnState===e.returnState){const i=G(t.parentCtx,e.parentCtx,n,s);if(i===t.parentCtx)return t;if(i===e.parentCtx)return e;const r=V.create(i,t.returnState);return null!==s&&s.set(t,e,r),r}{let n=null;if((t===e||null!==t.parentCtx&&t.parentCtx===e.parentCtx)&&(n=t.parentCtx),null!==n){const i=[t.returnState,e.returnState];t.returnState>e.returnState&&(i[0]=e.returnState,i[1]=t.returnState);const r=new B([n,n],i);return null!==s&&s.set(t,e,r),r}const i=[t.returnState,e.returnState];let r=[t.parentCtx,e.parentCtx];t.returnState>e.returnState&&(i[0]=e.returnState,i[1]=t.returnState,r=[e.parentCtx,t.parentCtx]);const o=new B(r,i);return null!==s&&s.set(t,e,o),o}}(t,e,n,s);if(n){if(t instanceof z)return t;if(e instanceof z)return e}return t instanceof V&&(t=new B([t.getParent()],[t.returnState])),e instanceof V&&(e=new B([e.getParent()],[e.returnState])),function(t,e,n,s){if(null!==s){let n=s.get(t,e);if(null!==n)return U.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> previous"),n;if(n=s.get(e,t),null!==n)return U.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> previous"),n}let i=0,r=0,o=0,a=new Array(t.returnStates.length+e.returnStates.length).fill(0),l=new Array(t.returnStates.length+e.returnStates.length).fill(null);for(;i<t.returnStates.length&&r<e.returnStates.length;){const h=t.parents[i],c=e.parents[r];if(t.returnStates[i]===e.returnStates[r]){const e=t.returnStates[i];e===U.EMPTY_RETURN_STATE&&null===h&&null===c||null!==h&&null!==c&&h===c?(l[o]=h,a[o]=e):(l[o]=G(h,c,n,s),a[o]=e),i+=1,r+=1}else t.returnStates[i]<e.returnStates[r]?(l[o]=h,a[o]=t.returnStates[i],i+=1):(l[o]=c,a[o]=e.returnStates[r],r+=1);o+=1}if(i<t.returnStates.length)for(let c=i;c<t.returnStates.length;c++)l[o]=t.parents[c],a[o]=t.returnStates[c],o+=1;else for(let c=r;c<e.returnStates.length;c++)l[o]=e.parents[c],a[o]=e.returnStates[c],o+=1;if(o<l.length){if(1===o){const n=V.create(l[0],a[0]);return null!==s&&s.set(t,e,n),n}l=l.slice(0,o),a=a.slice(0,o)}const h=new B(l,a);return h.equals(t)?(null!==s&&s.set(t,e,t),U.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> a"),t):h.equals(e)?(null!==s&&s.set(t,e,e),U.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> b"),e):(function(t){const e=new H;for(let n=0;n<t.length;n++){const s=t[n];e.containsKey(s)||e.set(s,s)}for(let n=0;n<t.length;n++)t[n]=e.get(t[n])}(l),null!==s&&s.set(t,e,h),U.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> "+h),h)}(t,e,n,s)}class j{constructor(){this.data=[]}add(t){this.data[t]=!0}or(t){Object.keys(t.data).map((t=>this.add(t)),this)}remove(t){delete this.data[t]}has(t){return!0===this.data[t]}values(){return Object.keys(this.data)}minValue(){return Math.min.apply(null,this.values())}hashCode(){return o.hashStuff(this.values())}equals(t){return t instanceof j&&e(this.data,t.data)}toString(){return"{"+this.values().join(", ")+"}"}get length(){return this.values().length}}class W{constructor(t){this.atn=t}getDecisionLookahead(t){if(null===t)return null;const e=t.transitions.length,n=[];for(let s=0;s<e;s++){n[s]=new E;const e=new d,i=!1;this._LOOK(t.transition(s).target,null,U.EMPTY,n[s],e,new j,i,!1),(0===n[s].length||n[s].contains(W.HIT_PRED))&&(n[s]=null)}return n}LOOK(t,e,n){const s=new E,i=null!==(n=n||null)?K(t.atn,n):null;return this._LOOK(t,e,i,s,new d,new j,!0,!0),s}_LOOK(e,n,s,i,r,o,a,l){const h=new S({state:e,alt:0,context:s},null);if(!r.has(h)){if(r.add(h),e===n){if(null===s)return void i.addOne(t.EPSILON);if(s.isEmpty()&&l)return void i.addOne(t.EOF)}if(e instanceof A){if(null===s)return void i.addOne(t.EPSILON);if(s.isEmpty()&&l)return void i.addOne(t.EOF);if(s!==U.EMPTY){const t=o.has(e.ruleIndex);try{o.remove(e.ruleIndex);for(let t=0;t<s.length;t++){const e=this.atn.states[s.getReturnState(t)];this._LOOK(e,n,s.getParent(t),i,r,o,a,l)}}finally{t&&o.add(e.ruleIndex)}return}}for(let h=0;h<e.transitions.length;h++){const c=e.transitions[h];if(c.constructor===N){if(o.has(c.target.ruleIndex))continue;const t=V.create(s,c.followState.stateNumber);try{o.add(c.target.ruleIndex),this._LOOK(c.target,n,t,i,r,o,a,l)}finally{o.remove(c.target.ruleIndex)}}else if(c instanceof O)a?this._LOOK(c.target,n,s,i,r,o,a,l):i.addOne(W.HIT_PRED);else if(c.isEpsilon)this._LOOK(c.target,n,s,i,r,o,a,l);else if(c.constructor===k)i.addRange(t.MIN_USER_TOKEN_TYPE,this.atn.maxTokenType);else{let e=c.label;null!==e&&(c instanceof I&&(e=e.complement(t.MIN_USER_TOKEN_TYPE,this.atn.maxTokenType)),i.addSet(e))}}}}}W.HIT_PRED=t.INVALID_TYPE;class ${constructor(t,e){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=[]}nextTokensInContext(t,e){return new W(this).LOOK(t,null,e)}nextTokensNoContext(t){return null!==t.nextTokenWithinRule||(t.nextTokenWithinRule=this.nextTokensInContext(t,null),t.nextTokenWithinRule.readOnly=!0),t.nextTokenWithinRule}nextTokens(t,e){return void 0===e?this.nextTokensNoContext(t):this.nextTokensInContext(t,e)}addState(t){null!==t&&(t.atn=this,t.stateNumber=this.states.length),this.states.push(t)}removeState(t){this.states[t.stateNumber]=null}defineDecisionState(t){return this.decisionToState.push(t),t.decision=this.decisionToState.length-1,t.decision}getDecisionState(t){return 0===this.decisionToState.length?null:this.decisionToState[t]}getExpectedTokens(e,n){if(e<0||e>=this.states.length)throw"Invalid state number.";const s=this.states[e];let i=this.nextTokens(s);if(!i.contains(t.EPSILON))return i;const r=new E;for(r.addSet(i),r.removeOne(t.EPSILON);null!==n&&n.invokingState>=0&&i.contains(t.EPSILON);){const e=this.states[n.invokingState].transitions[0];i=this.nextTokens(e.followState),r.addSet(i),r.removeOne(t.EPSILON),n=n.parentCtx}return i.contains(t.EPSILON)&&r.addOne(t.EOF),r}}$.INVALID_ALT_NUMBER=0;class X extends _{constructor(){super(),this.stateType=_.BASIC}}class J extends _{constructor(){return super(),this.decision=-1,this.nonGreedy=!1,this}}class Z extends J{constructor(){return super(),this.endState=null,this}}class Q extends _{constructor(){return super(),this.stateType=_.BLOCK_END,this.startState=null,this}}class tt extends _{constructor(){return super(),this.stateType=_.LOOP_END,this.loopBackState=null,this}}class et extends _{constructor(){return super(),this.stateType=_.RULE_START,this.stopState=null,this.isPrecedenceRule=!1,this}}class nt extends J{constructor(){return super(),this.stateType=_.TOKEN_START,this}}class st extends J{constructor(){return super(),this.stateType=_.PLUS_LOOP_BACK,this}}class it extends _{constructor(){return super(),this.stateType=_.STAR_LOOP_BACK,this}}class rt extends J{constructor(){return super(),this.stateType=_.STAR_LOOP_ENTRY,this.loopBackState=null,this.isPrecedenceDecision=null,this}}class ot extends Z{constructor(){return super(),this.stateType=_.PLUS_BLOCK_START,this.loopBackState=null,this}}class at extends Z{constructor(){return super(),this.stateType=_.STAR_BLOCK_START,this}}class lt extends Z{constructor(){return super(),this.stateType=_.BLOCK_START,this}}class ht extends C{constructor(t,e){super(t),this.label_=e,this.label=this.makeLabel(),this.serializationType=C.ATOM}makeLabel(){const t=new E;return t.addOne(this.label_),t}matches(t,e,n){return this.label_===t}toString(){return this.label_}}class ct extends C{constructor(t,e,n){super(t),this.serializationType=C.RANGE,this.start=e,this.stop=n,this.label=this.makeLabel()}makeLabel(){const t=new E;return t.addRange(this.start,this.stop),t}matches(t,e,n){return t>=this.start&&t<=this.stop}toString(){return"'"+String.fromCharCode(this.start)+"'..'"+String.fromCharCode(this.stop)+"'"}}class ut extends C{constructor(t,e,n,s){super(t),this.serializationType=C.ACTION,this.ruleIndex=e,this.actionIndex=void 0===n?-1:n,this.isCtxDependent=void 0!==s&&s,this.isEpsilon=!0}matches(t,e,n){return!1}toString(){return"action_"+this.ruleIndex+":"+this.actionIndex}}class dt extends C{constructor(t,e){super(t),this.serializationType=C.EPSILON,this.isEpsilon=!0,this.outermostPrecedenceReturn=e}matches(t,e,n){return!1}toString(){return"epsilon"}}class pt extends p{constructor(t,e,n){super(),this.ruleIndex=void 0===t?-1:t,this.predIndex=void 0===e?-1:e,this.isCtxDependent=void 0!==n&&n}evaluate(t,e){const n=this.isCtxDependent?e:null;return t.sempred(n,this.ruleIndex,this.predIndex)}updateHashCode(t){t.update(this.ruleIndex,this.predIndex,this.isCtxDependent)}equals(t){return this===t||t instanceof pt&&this.ruleIndex===t.ruleIndex&&this.predIndex===t.predIndex&&this.isCtxDependent===t.isCtxDependent}toString(){return"{"+this.ruleIndex+":"+this.predIndex+"}?"}}p.NONE=new pt;class gt extends O{constructor(t,e,n,s){super(t),this.serializationType=C.PREDICATE,this.ruleIndex=e,this.predIndex=n,this.isCtxDependent=s,this.isEpsilon=!0}matches(t,e,n){return!1}getPredicate(){return new pt(this.ruleIndex,this.predIndex,this.isCtxDependent)}toString(){return"pred_"+this.ruleIndex+":"+this.predIndex}}class ft extends p{constructor(t){super(),this.precedence=void 0===t?0:t}evaluate(t,e){return t.precpred(e,this.precedence)}evalPrecedence(t,e){return t.precpred(e,this.precedence)?p.NONE:null}compareTo(t){return this.precedence-t.precedence}updateHashCode(t){t.update(this.precedence)}equals(t){return this===t||t instanceof ft&&this.precedence===t.precedence}toString(){return"{"+this.precedence+">=prec}?"}}p.PrecedencePredicate=ft;class xt extends O{constructor(t,e){super(t),this.serializationType=C.PRECEDENCE,this.precedence=e,this.isEpsilon=!0}matches(t,e,n){return!1}getPredicate(){return new ft(this.precedence)}toString(){return this.precedence+" >= _p"}}class Tt{constructor(t){void 0===t&&(t=null),this.readOnly=!1,this.verifyATN=null===t||t.verifyATN,this.generateRuleBypassTransitions=null!==t&&t.generateRuleBypassTransitions}}Tt.defaultOptions=new Tt,Tt.defaultOptions.readOnly=!0;class St{constructor(t){this.actionType=t,this.isPositionDependent=!1}hashCode(){const t=new o;return this.updateHashCode(t),t.finish()}updateHashCode(t){t.update(this.actionType)}equals(t){return this===t}}class mt extends St{constructor(){super(6)}execute(t){t.skip()}toString(){return"skip"}}mt.INSTANCE=new mt;class Et extends St{constructor(t){super(0),this.channel=t}execute(t){t._channel=this.channel}updateHashCode(t){t.update(this.actionType,this.channel)}equals(t){return this===t||t instanceof Et&&this.channel===t.channel}toString(){return"channel("+this.channel+")"}}class _t extends St{constructor(t,e){super(1),this.ruleIndex=t,this.actionIndex=e,this.isPositionDependent=!0}execute(t){t.action(null,this.ruleIndex,this.actionIndex)}updateHashCode(t){t.update(this.actionType,this.ruleIndex,this.actionIndex)}equals(t){return this===t||t instanceof _t&&this.ruleIndex===t.ruleIndex&&this.actionIndex===t.actionIndex}}class At extends St{constructor(){super(3)}execute(t){t.more()}toString(){return"more"}}At.INSTANCE=new At;class Ct extends St{constructor(t){super(7),this.type=t}execute(t){t.type=this.type}updateHashCode(t){t.update(this.actionType,this.type)}equals(t){return this===t||t instanceof Ct&&this.type===t.type}toString(){return"type("+this.type+")"}}class Nt extends St{constructor(t){super(5),this.mode=t}execute(t){t.pushMode(this.mode)}updateHashCode(t){t.update(this.actionType,this.mode)}equals(t){return this===t||t instanceof Nt&&this.mode===t.mode}toString(){return"pushMode("+this.mode+")"}}class yt extends St{constructor(){super(4)}execute(t){t.popMode()}toString(){return"popMode"}}yt.INSTANCE=new yt;class It extends St{constructor(t){super(2),this.mode=t}execute(t){t.mode(this.mode)}updateHashCode(t){t.update(this.actionType,this.mode)}equals(t){return this===t||t instanceof It&&this.mode===t.mode}toString(){return"mode("+this.mode+")"}}function kt(t,e){const n=[];return n[t-1]=e,n.map((function(t){return e}))}class Ot{constructor(t){null==t&&(t=Tt.defaultOptions),this.deserializationOptions=t,this.stateFactories=null,this.actionFactories=null}deserialize(t){const e=this.reset(t);this.checkVersion(e),e&&this.skipUUID();const n=this.readATN();this.readStates(n,e),this.readRules(n,e),this.readModes(n);const s=[];return this.readSets(n,s,this.readInt.bind(this)),e&&this.readSets(n,s,this.readInt32.bind(this)),this.readEdges(n,s),this.readDecisions(n),this.readLexerActions(n,e),this.markPrecedenceDecisions(n),this.verifyATN(n),this.deserializationOptions.generateRuleBypassTransitions&&1===n.grammarType&&(this.generateRuleBypassTransitions(n),this.verifyATN(n)),n}reset(t){if(3===(t.charCodeAt?t.charCodeAt(0):t[0])){const e=function(t){const e=t.charCodeAt(0);return e>1?e-2:e+65534},n=t.split("").map(e);return n[0]=t.charCodeAt(0),this.data=n,this.pos=0,!0}return this.data=t,this.pos=0,!1}skipUUID(){let t=0;for(;t++<8;)this.readInt()}checkVersion(t){const e=this.readInt();if(!t&&4!==e)throw"Could not deserialize ATN with version "+e+" (expected 4)."}readATN(){const t=this.readInt(),e=this.readInt();return new $(t,e)}readStates(t,e){let n,s,i;const r=[],o=[],a=this.readInt();for(let c=0;c<a;c++){const n=this.readInt();if(n===_.INVALID_TYPE){t.addState(null);continue}let s=this.readInt();e&&65535===s&&(s=-1);const i=this.stateFactory(n,s);if(n===_.LOOP_END){const t=this.readInt();r.push([i,t])}else if(i instanceof Z){const t=this.readInt();o.push([i,t])}t.addState(i)}for(n=0;n<r.length;n++)s=r[n],s[0].loopBackState=t.states[s[1]];for(n=0;n<o.length;n++)s=o[n],s[0].endState=t.states[s[1]];let l=this.readInt();for(n=0;n<l;n++)i=this.readInt(),t.states[i].nonGreedy=!0;let h=this.readInt();for(n=0;n<h;n++)i=this.readInt(),t.states[i].isPrecedenceRule=!0}readRules(e,n){let s;const i=this.readInt();for(0===e.grammarType&&(e.ruleToTokenType=kt(i,0)),e.ruleToStartState=kt(i,0),s=0;s<i;s++){const i=this.readInt();if(e.ruleToStartState[s]=e.states[i],0===e.grammarType){let i=this.readInt();n&&65535===i&&(i=t.EOF),e.ruleToTokenType[s]=i}}for(e.ruleToStopState=kt(i,0),s=0;s<e.states.length;s++){const t=e.states[s];t instanceof A&&(e.ruleToStopState[t.ruleIndex]=t,e.ruleToStartState[t.ruleIndex].stopState=t)}}readModes(t){const e=this.readInt();for(let n=0;n<e;n++){let e=this.readInt();t.modeToStartState.push(t.states[e])}}readSets(t,e,n){const s=this.readInt();for(let i=0;i<s;i++){const t=new E;e.push(t);const s=this.readInt();0!==this.readInt()&&t.addOne(-1);for(let e=0;e<s;e++){const e=n(),s=n();t.addRange(e,s)}}}readEdges(t,e){let n,s,i,r,o;const a=this.readInt();for(n=0;n<a;n++){const n=this.readInt(),s=this.readInt(),i=this.readInt(),o=this.readInt(),a=this.readInt(),l=this.readInt();r=this.edgeFactory(t,i,n,s,o,a,l,e),t.states[n].addTransition(r)}for(n=0;n<t.states.length;n++)for(i=t.states[n],s=0;s<i.transitions.length;s++){const e=i.transitions[s];if(!(e instanceof N))continue;let n=-1;t.ruleToStartState[e.target.ruleIndex].isPrecedenceRule&&0===e.precedence&&(n=e.target.ruleIndex),r=new dt(e.followState,n),t.ruleToStopState[e.target.ruleIndex].addTransition(r)}for(n=0;n<t.states.length;n++){if(i=t.states[n],i instanceof Z){if(null===i.endState)throw"IllegalState";if(null!==i.endState.startState)throw"IllegalState";i.endState.startState=i}if(i instanceof st)for(s=0;s<i.transitions.length;s++)o=i.transitions[s].target,o instanceof ot&&(o.loopBackState=i);else if(i instanceof it)for(s=0;s<i.transitions.length;s++)o=i.transitions[s].target,o instanceof rt&&(o.loopBackState=i)}}readDecisions(t){const e=this.readInt();for(let n=0;n<e;n++){const e=this.readInt(),s=t.states[e];t.decisionToState.push(s),s.decision=n}}readLexerActions(t,e){if(0===t.grammarType){const n=this.readInt();t.lexerActions=kt(n,null);for(let s=0;s<n;s++){const n=this.readInt();let i=this.readInt();e&&65535===i&&(i=-1);let r=this.readInt();e&&65535===r&&(r=-1),t.lexerActions[s]=this.lexerActionFactory(n,i,r)}}}generateRuleBypassTransitions(t){let e;const 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)}generateRuleBypassTransition(t,e){let n,s;const i=new lt;i.ruleIndex=e,t.addState(i);const r=new Q;r.ruleIndex=e,t.addState(r),i.endState=r,t.defineDecisionState(i),r.startState=i;let o=null,a=null;if(t.ruleToStartState[e].isPrecedenceRule){for(a=null,n=0;n<t.states.length;n++)if(s=t.states[n],this.stateIsEndStateFor(s,e)){a=s,o=s.loopBackState.transitions[0];break}if(null===o)throw"Couldn't identify final state of the precedence rule prefix section."}else a=t.ruleToStopState[e];for(n=0;n<t.states.length;n++){s=t.states[n];for(let t=0;t<s.transitions.length;t++){const e=s.transitions[t];e!==o&&e.target===a&&(e.target=r)}}const l=t.ruleToStartState[e],h=l.transitions.length;for(;h>0;)i.addTransition(l.transitions[h-1]),l.transitions=l.transitions.slice(-1);t.ruleToStartState[e].addTransition(new dt(i)),r.addTransition(new dt(a));const c=new X;t.addState(c),c.addTransition(new ht(r,t.ruleToTokenType[e])),i.addTransition(new dt(c))}stateIsEndStateFor(t,e){if(t.ruleIndex!==e)return null;if(!(t instanceof rt))return null;const n=t.transitions[t.transitions.length-1].target;return n instanceof tt&&n.epsilonOnlyTransitions&&n.transitions[0].target instanceof A?t:null}markPrecedenceDecisions(t){for(let e=0;e<t.states.length;e++){const n=t.states[e];if(n instanceof rt&&t.ruleToStartState[n.ruleIndex].isPrecedenceRule){const t=n.transitions[n.transitions.length-1].target;t instanceof tt&&t.epsilonOnlyTransitions&&t.transitions[0].target instanceof A&&(n.isPrecedenceDecision=!0)}}}verifyATN(t){if(this.deserializationOptions.verifyATN)for(let e=0;e<t.states.length;e++){const n=t.states[e];if(null!==n)if(this.checkCondition(n.epsilonOnlyTransitions||n.transitions.length<=1),n instanceof ot)this.checkCondition(null!==n.loopBackState);else if(n instanceof rt)if(this.checkCondition(null!==n.loopBackState),this.checkCondition(2===n.transitions.length),n.transitions[0].target instanceof at)this.checkCondition(n.transitions[1].target instanceof tt),this.checkCondition(!n.nonGreedy);else{if(!(n.transitions[0].target instanceof tt))throw"IllegalState";this.checkCondition(n.transitions[1].target instanceof at),this.checkCondition(n.nonGreedy)}else n instanceof it?(this.checkCondition(1===n.transitions.length),this.checkCondition(n.transitions[0].target instanceof rt)):n instanceof tt?this.checkCondition(null!==n.loopBackState):n instanceof et?this.checkCondition(null!==n.stopState):n instanceof Z?this.checkCondition(null!==n.endState):n instanceof Q?this.checkCondition(null!==n.startState):n instanceof J?this.checkCondition(n.transitions.length<=1||n.decision>=0):this.checkCondition(n.transitions.length<=1||n instanceof A)}}checkCondition(t,e){if(!t)throw null==e&&(e="IllegalState"),e}readInt(){return this.data[this.pos++]}readInt32(){return this.readInt()|this.readInt()<<16}edgeFactory(e,n,s,i,r,o,a,l){const h=e.states[i];switch(n){case C.EPSILON:return new dt(h);case C.RANGE:return new ct(h,0!==a?t.EOF:r,o);case C.RULE:return new N(e.states[r],o,a,h);case C.PREDICATE:return new gt(h,r,o,0!==a);case C.PRECEDENCE:return new xt(h,r);case C.ATOM:return new ht(h,0!==a?t.EOF:r);case C.ACTION:return new ut(h,r,o,0!==a);case C.SET:return new y(h,l[r]);case C.NOT_SET:return new I(h,l[r]);case C.WILDCARD:return new k(h);default:throw"The specified transition type: "+n+" is not valid."}}stateFactory(t,e){if(null===this.stateFactories){const t=[];t[_.INVALID_TYPE]=null,t[_.BASIC]=()=>new X,t[_.RULE_START]=()=>new et,t[_.BLOCK_START]=()=>new lt,t[_.PLUS_BLOCK_START]=()=>new ot,t[_.STAR_BLOCK_START]=()=>new at,t[_.TOKEN_START]=()=>new nt,t[_.RULE_STOP]=()=>new A,t[_.BLOCK_END]=()=>new Q,t[_.STAR_LOOP_BACK]=()=>new it,t[_.STAR_LOOP_ENTRY]=()=>new rt,t[_.PLUS_LOOP_BACK]=()=>new st,t[_.LOOP_END]=()=>new tt,this.stateFactories=t}if(t>this.stateFactories.length||null===this.stateFactories[t])throw"The specified state type "+t+" is not valid.";{const n=this.stateFactories[t]();if(null!==n)return n.ruleIndex=e,n}}lexerActionFactory(t,e,n){if(null===this.actionFactories){const t=[];t[0]=(t,e)=>new Et(t),t[1]=(t,e)=>new _t(t,e),t[2]=(t,e)=>new It(t),t[3]=(t,e)=>At.INSTANCE,t[4]=(t,e)=>yt.INSTANCE,t[5]=(t,e)=>new Nt(t),t[6]=(t,e)=>mt.INSTANCE,t[7]=(t,e)=>new Ct(t),this.actionFactories=t}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)}}class Lt{syntaxError(t,e,n,s,i,r){}reportAmbiguity(t,e,n,s,i,r,o){}reportAttemptingFullContext(t,e,n,s,i,r){}reportContextSensitivity(t,e,n,s,i,r){}}class vt extends Lt{constructor(){super()}syntaxError(t,e,n,s,i,r){console.error("line "+n+":"+s+" "+i)}}vt.INSTANCE=new vt;class Rt extends Lt{constructor(t){if(super(),null===t)throw"delegates";return this.delegates=t,this}syntaxError(t,e,n,s,i,r){this.delegates.map((o=>o.syntaxError(t,e,n,s,i,r)))}reportAmbiguity(t,e,n,s,i,r,o){this.delegates.map((a=>a.reportAmbiguity(t,e,n,s,i,r,o)))}reportAttemptingFullContext(t,e,n,s,i,r){this.delegates.map((o=>o.reportAttemptingFullContext(t,e,n,s,i,r)))}reportContextSensitivity(t,e,n,s,i,r){this.delegates.map((o=>o.reportContextSensitivity(t,e,n,s,i,r)))}}class wt{constructor(){this._listeners=[vt.INSTANCE],this._interp=null,this._stateNumber=-1}checkVersion(t){const e="4.13.1";e!==t&&console.log("ANTLR runtime and generated code versions disagree: "+e+"!="+t)}addErrorListener(t){this._listeners.push(t)}removeErrorListeners(){this._listeners=[]}getLiteralNames(){return Object.getPrototypeOf(this).constructor.literalNames||[]}getSymbolicNames(){return Object.getPrototypeOf(this).constructor.symbolicNames||[]}getTokenNames(){if(!this.tokenNames){const t=this.getLiteralNames(),e=this.getSymbolicNames(),n=t.length>e.length?t.length:e.length;this.tokenNames=[];for(let s=0;s<n;s++)this.tokenNames[s]=t[s]||e[s]||"<INVALID"}return this.tokenNames}getTokenTypeMap(){const e=this.getTokenNames();if(null===e)throw"The current recognizer does not provide a list of token names.";let n=this.tokenTypeMapCache[e];return void 0===n&&(n=e.reduce((function(t,e,n){t[e]=n})),n.EOF=t.EOF,this.tokenTypeMapCache[e]=n),n}getRuleIndexMap(){const t=this.ruleNames;if(null===t)throw"The current recognizer does not provide a list of rule names.";let e=this.ruleIndexMapCache[t];return void 0===e&&(e=t.reduce((function(t,e,n){t[e]=n})),this.ruleIndexMapCache[t]=e),e}getTokenType(e){const n=this.getTokenTypeMap()[e];return void 0!==n?n:t.INVALID_TYPE}getErrorHeader(t){return"line "+t.getOffendingToken().line+":"+t.getOffendingToken().column}getTokenErrorDisplay(e){if(null===e)return"<no token>";let n=e.text;return null===n&&(n=e.type===t.EOF?"<EOF>":"<"+e.type+">"),n=n.replace("\n","\\n").replace("\r","\\r").replace("\t","\\t"),"'"+n+"'"}getErrorListenerDispatch(){return new Rt(this._listeners)}sempred(t,e,n){return!0}precpred(t,e){return!0}get atn(){return this._interp.atn}get state(){return this._stateNumber}set state(t){this._stateNumber=t}}wt.tokenTypeMapCache={},wt.ruleIndexMapCache={};class Pt extends t{constructor(e,n,s,i,r){super(),this.source=void 0!==e?e:Pt.EMPTY_SOURCE,this.type=void 0!==n?n:null,this.channel=void 0!==s?s:t.DEFAULT_CHANNEL,this.start=void 0!==i?i:-1,this.stop=void 0!==r?r:-1,this.tokenIndex=-1,null!==this.source[0]?(this.line=e[0].line,this.column=e[0].column):this.column=-1}clone(){const t=new Pt(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}cloneWithType(e){const n=new Pt(this.source,e,this.channel,this.start,this.stop);return n.tokenIndex=this.tokenIndex,n.line=this.line,n.column=this.column,e===t.EOF&&(n.text=""),n}toString(){let 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+"]"}get text(){if(null!==this._text)return this._text;const t=this.getInputStream();if(null===t)return null;const e=t.size;return this.start<e&&this.stop<e?t.getText(this.start,this.stop):"<EOF>"}set text(t){this._text=t}}Pt.EMPTY_SOURCE=[null,null];class bt{}class Dt extends bt{constructor(t){super(),this.copyText=void 0!==t&&t}create(t,e,n,s,i,r,o,a){const l=new Pt(t,e,s,i,r);return l.line=o,l.column=a,null!==n?l.text=n:this.copyText&&null!==t[1]&&(l.text=t[1].getText(i,r)),l}createThin(t,e){const n=new Pt(null,t);return n.text=e,n}}Dt.DEFAULT=new Dt;class Ft extends Error{constructor(t){super(t.message),Error.captureStackTrace&&Error.captureStackTrace(this,Ft),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)}getExpectedTokens(){return null!==this.recognizer?this.recognizer.atn.getExpectedTokens(this.offendingState,this.ctx):null}toString(){return this.message}}class Mt extends Ft{constructor(t,e,n,s){super({message:"",recognizer:t,input:e,ctx:null}),this.startIndex=n,this.deadEndConfigs=s}toString(){let t="";return this.startIndex>=0&&this.startIndex<this.input.size&&(t=this.input.getText(new m(this.startIndex,this.startIndex))),"LexerNoViableAltException"+t}}class Ut extends wt{constructor(e){super(),this._input=e,this._factory=Dt.DEFAULT,this._tokenFactorySourcePair=[this,e],this._interp=null,this._token=null,this._tokenStartCharIndex=-1,this._tokenStartLine=-1,this._tokenStartColumn=-1,this._hitEOF=!1,this._channel=t.DEFAULT_CHANNEL,this._type=t.INVALID_TYPE,this._modeStack=[],this._mode=Ut.DEFAULT_MODE,this._text=null}reset(){null!==this._input&&this._input.seek(0),this._token=null,this._type=t.INVALID_TYPE,this._channel=t.DEFAULT_CHANNEL,this._tokenStartCharIndex=-1,this._tokenStartColumn=-1,this._tokenStartLine=-1,this._text=null,this._hitEOF=!1,this._mode=Ut.DEFAULT_MODE,this._modeStack=[],this._interp.reset()}nextToken(){if(null===this._input)throw"nextToken requires a non-null input stream.";const e=this._input.mark();try{for(;;){if(this._hitEOF)return this.emitEOF(),this._token;this._token=null,this._channel=t.DEFAULT_CHANNEL,this._tokenStartCharIndex=this._input.index,this._tokenStartColumn=this._interp.column,this._tokenStartLine=this._interp.line,this._text=null;let e=!1;for(;;){this._type=t.INVALID_TYPE;let n=Ut.SKIP;try{n=this._interp.match(this._input,this._mode)}catch(t){if(!(t instanceof Ft))throw console.log(t.stack),t;this.notifyListeners(t),this.recover(t)}if(this._input.LA(1)===t.EOF&&(this._hitEOF=!0),this._type===t.INVALID_TYPE&&(this._type=n),this._type===Ut.SKIP){e=!0;break}if(this._type!==Ut.MORE)break}if(!e)return null===this._token&&this.emit(),this._token}}finally{this._input.release(e)}}skip(){this._type=Ut.SKIP}more(){this._type=Ut.MORE}mode(t){this._mode=t}pushMode(t){this._interp.debug&&console.log("pushMode "+t),this._modeStack.push(this._mode),this.mode(t)}popMode(){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}emitToken(t){this._token=t}emit(){const 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}emitEOF(){const e=this.column,n=this.line,s=this._factory.create(this._tokenFactorySourcePair,t.EOF,null,t.DEFAULT_CHANNEL,this._input.index,this._input.index-1,n,e);return this.emitToken(s),s}getCharIndex(){return this._input.index}getAllTokens(){const e=[];let n=this.nextToken();for(;n.type!==t.EOF;)e.push(n),n=this.nextToken();return e}notifyListeners(t){const e=this._tokenStartCharIndex,n=this._input.index,s=this._input.getText(e,n),i="token recognition error at: '"+this.getErrorDisplay(s)+"'";this.getErrorListenerDispatch().syntaxError(this,null,this._tokenStartLine,this._tokenStartColumn,i,t)}getErrorDisplay(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n]);return e.join("")}getErrorDisplayForChar(e){return e.charCodeAt(0)===t.EOF?"<EOF>":"\n"===e?"\\n":"\t"===e?"\\t":"\r"===e?"\\r":e}getCharErrorDisplay(t){return"'"+this.getErrorDisplayForChar(t)+"'"}recover(e){this._input.LA(1)!==t.EOF&&(e instanceof Mt?this._interp.consume(this._input):this._input.consume())}get inputStream(){return this._input}set inputStream(t){this._input=null,this._tokenFactorySourcePair=[this,this._input],this.reset(),this._input=t,this._tokenFactorySourcePair=[this,this._input]}get sourceName(){return this._input.sourceName}get type(){return this._type}set type(t){this._type=t}get line(){return this._interp.line}set line(t){this._interp.line=t}get column(){return this._interp.column}set column(t){this._interp.column=t}get text(){return null!==this._text?this._text:this._interp.getText(this._input)}set text(t){this._text=t}}function Bt(t){return t.hashCodeForConfigSet()}function Vt(t,e){return t===e||null!==t&&null!==e&&t.equalsForConfigSet(e)}Ut.DEFAULT_MODE=0,Ut.MORE=-2,Ut.SKIP=-3,Ut.DEFAULT_TOKEN_CHANNEL=t.DEFAULT_CHANNEL,Ut.HIDDEN=t.HIDDEN_CHANNEL,Ut.MIN_CHAR_VALUE=0,Ut.MAX_CHAR_VALUE=1114111;class zt{constructor(t){this.configLookup=new d(Bt,Vt),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}add(t,e){if(void 0===e&&(e=null),this.readOnly)throw"This set is readonly";t.semanticContext!==p.NONE&&(this.hasSemanticContext=!0),t.reachesIntoOuterContext>0&&(this.dipsIntoOuterContext=!0);const n=this.configLookup.add(t);if(n===t)return this.cachedHashCode=-1,this.configs.push(t),!0;const s=!this.fullCtx,i=G(n.context,t.context,s,e);return n.reachesIntoOuterContext=Math.max(n.reachesIntoOuterContext,t.reachesIntoOuterContext),t.precedenceFilterSuppressed&&(n.precedenceFilterSuppressed=!0),n.context=i,!0}getStates(){const t=new d;for(let e=0;e<this.configs.length;e++)t.add(this.configs[e].state);return t}getPredicates(){const t=[];for(let e=0;e<this.configs.length;e++){const n=this.configs[e].semanticContext;n!==p.NONE&&t.push(n.semanticContext)}return t}optimizeConfigs(t){if(this.readOnly)throw"This set is readonly";if(0!==this.configLookup.length)for(let e=0;e<this.configs.length;e++){const n=this.configs[e];n.context=t.getCachedContext(n.context)}}addAll(t){for(let e=0;e<t.length;e++)this.add(t[e]);return!1}equals(t){return this===t||t instanceof zt&&e(this.configs,t.configs)&&this.fullCtx===t.fullCtx&&this.uniqueAlt===t.uniqueAlt&&this.conflictingAlts===t.conflictingAlts&&this.hasSemanticContext===t.hasSemanticContext&&this.dipsIntoOuterContext===t.dipsIntoOuterContext}hashCode(){const t=new o;return t.update(this.configs),t.finish()}updateHashCode(t){this.readOnly?(-1===this.cachedHashCode&&(this.cachedHashCode=this.hashCode()),t.update(this.cachedHashCode)):t.update(this.hashCode())}isEmpty(){return 0===this.configs.length}contains(t){if(null===this.configLookup)throw"This method is not implemented for readonly sets.";return this.configLookup.contains(t)}containsFast(t){if(null===this.configLookup)throw"This method is not implemented for readonly sets.";return this.configLookup.containsFast(t)}clear(){if(this.readOnly)throw"This set is readonly";this.configs=[],this.cachedHashCode=-1,this.configLookup=new d}setReadonly(t){this.readOnly=t,t&&(this.configLookup=null)}toString(){return c(this.configs)+(this.hasSemanticContext?",hasSemanticContext="+this.hasSemanticContext:"")+(this.uniqueAlt!==$.INVALID_ALT_NUMBER?",uniqueAlt="+this.uniqueAlt:"")+(null!==this.conflictingAlts?",conflictingAlts="+this.conflictingAlts:"")+(this.dipsIntoOuterContext?",dipsIntoOuterContext":"")}get items(){return this.configs}get length(){return this.configs.length}}class qt{constructor(t,e){return null===t&&(t=-1),null===e&&(e=new zt),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}getAltSet(){const t=new d;if(null!==this.configs)for(let e=0;e<this.configs.length;e++){const n=this.configs[e];t.add(n.alt)}return 0===t.length?null:t}equals(t){return this===t||t instanceof qt&&this.configs.equals(t.configs)}toString(){let t=this.stateNumber+":"+this.configs;return this.isAcceptState&&(t+="=>",null!==this.predicates?t+=this.predicates:t+=this.prediction),t}hashCode(){const t=new o;return t.update(this.configs),t.finish()}}class Ht{constructor(t,e){return this.atn=t,this.sharedContextCache=e,this}getCachedContext(t){if(null===this.sharedContextCache)return t;const e=new H;return Y(t,this.sharedContextCache,e)}}Ht.ERROR=new qt(2147483647,new zt);class Kt extends zt{constructor(){super(),this.configLookup=new d}}class Yt extends S{constructor(t,e){super(t,e);const n=t.lexerActionExecutor||null;return this.lexerActionExecutor=n||(null!==e?e.lexerActionExecutor:null),this.passedThroughNonGreedyDecision=null!==e&&this.checkNonGreedyDecision(e,this.state),this.hashCodeForConfigSet=Yt.prototype.hashCode,this.equalsForConfigSet=Yt.prototype.equals,this}updateHashCode(t){t.update(this.state.stateNumber,this.alt,this.context,this.semanticContext,this.passedThroughNonGreedyDecision,this.lexerActionExecutor)}equals(t){return this===t||t instanceof Yt&&this.passedThroughNonGreedyDecision===t.passedThroughNonGreedyDecision&&(this.lexerActionExecutor?this.lexerActionExecutor.equals(t.lexerActionExecutor):!t.lexerActionExecutor)&&super.equals(t)}checkNonGreedyDecision(t,e){return t.passedThroughNonGreedyDecision||e instanceof J&&e.nonGreedy}}class Gt extends St{constructor(t,e){super(e.actionType),this.offset=t,this.action=e,this.isPositionDependent=!0}execute(t){this.action.execute(t)}updateHashCode(t){t.update(this.actionType,this.offset,this.action)}equals(t){return this===t||t instanceof Gt&&this.offset===t.offset&&this.action===t.action}}class jt{constructor(t){return this.lexerActions=null===t?[]:t,this.cachedHashCode=o.hashStuff(t),this}fixOffsetBeforeMatch(t){let e=null;for(let n=0;n<this.lexerActions.length;n++)!this.lexerActions[n].isPositionDependent||this.lexerActions[n]instanceof Gt||(null===e&&(e=this.lexerActions.concat([])),e[n]=new Gt(t,this.lexerActions[n]));return null===e?this:new jt(e)}execute(t,e,n){let s=!1;const i=e.index;try{for(let r=0;r<this.lexerActions.length;r++){let o=this.lexerActions[r];if(o instanceof Gt){const t=o.offset;e.seek(n+t),o=o.action,s=n+t!==i}else o.isPositionDependent&&(e.seek(i),s=!1);o.execute(t)}}finally{s&&e.seek(i)}}hashCode(){return this.cachedHashCode}updateHashCode(t){t.update(this.cachedHashCode)}equals(t){if(this===t)return!0;if(t instanceof jt){if(this.cachedHashCode!=t.cachedHashCode)return!1;if(this.lexerActions.length!=t.lexerActions.length)return!1;{const e=this.lexerActions.length;for(let n=0;n<e;++n)if(!this.lexerActions[n].equals(t.lexerActions[n]))return!1;return!0}}return!1}static append(t,e){if(null===t)return new jt([e]);const n=t.lexerActions.concat([e]);return new jt(n)}}function Wt(t){t.index=-1,t.line=0,t.column=-1,t.dfaState=null}class $t{constructor(){Wt(this)}reset(){Wt(this)}}class Xt extends Ht{constructor(t,e,n,s){super(e,s),this.decisionToDFA=n,this.recog=t,this.startIndex=-1,this.line=1,this.column=0,this.mode=Ut.DEFAULT_MODE,this.prevAccept=new $t}copyState(t){this.column=t.column,this.line=t.line,this.mode=t.mode,this.startIndex=t.startIndex}match(t,e){this.mode=e;const n=t.mark();try{this.startIndex=t.index,this.prevAccept.reset();const n=this.decisionToDFA[e];return null===n.s0?this.matchATN(t):this.execATN(t,n.s0)}finally{t.release(n)}}reset(){this.prevAccept.reset(),this.startIndex=-1,this.line=1,this.column=0,this.mode=Ut.DEFAULT_MODE}matchATN(t){const e=this.atn.modeToStartState[this.mode];Xt.debug&&console.log("matchATN mode "+this.mode+" start: "+e);const n=this.mode,s=this.computeStartState(t,e),i=s.hasSemanticContext;s.hasSemanticContext=!1;const r=this.addDFAState(s);i||(this.decisionToDFA[this.mode].s0=r);const o=this.execATN(t,r);return Xt.debug&&console.log("DFA after matchATN: "+this.decisionToDFA[n].toLexerString()),o}execATN(e,n){Xt.debug&&console.log("start state closure="+n.configs),n.isAcceptState&&this.captureSimState(this.prevAccept,e,n);let s=e.LA(1),i=n;for(;;){Xt.debug&&console.log("execATN loop starting closure: "+i.configs);let n=this.getExistingTargetState(i,s);if(null===n&&(n=this.computeTargetState(e,i,s)),n===Ht.ERROR)break;if(s!==t.EOF&&this.consume(e),n.isAcceptState&&(this.captureSimState(this.prevAccept,e,n),s===t.EOF))break;s=e.LA(1),i=n}return this.failOrAccept(this.prevAccept,e,i.configs,s)}getExistingTargetState(t,e){if(null===t.edges||e<Xt.MIN_DFA_EDGE||e>Xt.MAX_DFA_EDGE)return null;let n=t.edges[e-Xt.MIN_DFA_EDGE];return void 0===n&&(n=null),Xt.debug&&null!==n&&console.log("reuse state "+t.stateNumber+" edge to "+n.stateNumber),n}computeTargetState(t,e,n){const s=new Kt;return this.getReachableConfigSet(t,e.configs,s,n),0===s.items.length?(s.hasSemanticContext||this.addDFAEdge(e,n,Ht.ERROR),Ht.ERROR):this.addDFAEdge(e,n,null,s)}failOrAccept(e,n,s,i){if(null!==this.prevAccept.dfaState){const t=e.dfaState.lexerActionExecutor;return this.accept(n,t,this.startIndex,e.index,e.line,e.column),e.dfaState.prediction}if(i===t.EOF&&n.index===this.startIndex)return t.EOF;throw new Mt(this.recog,n,this.startIndex,s)}getReachableConfigSet(e,n,s,i){let r=$.INVALID_ALT_NUMBER;for(let o=0;o<n.items.length;o++){const a=n.items[o],l=a.alt===r;if(!l||!a.passedThroughNonGreedyDecision){Xt.debug&&console.log("testing %s at %s\n",this.getTokenName(i),a.toString(this.recog,!0));for(let n=0;n<a.state.transitions.length;n++){const o=a.state.transitions[n],h=this.getReachableTarget(o,i);if(null!==h){let n=a.lexerActionExecutor;null!==n&&(n=n.fixOffsetBeforeMatch(e.index-this.startIndex));const o=i===t.EOF,c=new Yt({state:h,lexerActionExecutor:n},a);this.closure(e,c,s,l,!0,o)&&(r=a.alt)}}}}}accept(t,e,n,s,i,r){Xt.debug&&console.log("ACTION %s\n",e),t.seek(s),this.line=i,this.column=r,null!==e&&null!==this.recog&&e.execute(this.recog,t,n)}getReachableTarget(t,e){return t.matches(e,0,Ut.MAX_CHAR_VALUE)?t.target:null}computeStartState(t,e){const n=U.EMPTY,s=new Kt;for(let i=0;i<e.transitions.length;i++){const r=e.transitions[i].target,o=new Yt({state:r,alt:i+1,context:n},null);this.closure(t,o,s,!1,!1,!1)}return s}closure(t,e,n,s,i,r){let o=null;if(Xt.debug&&console.log("closure("+e.toString(this.recog,!0)+")"),e.state instanceof A){if(Xt.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 Yt({state:e.state,context:U.EMPTY},e)),s=!0}if(null!==e.context&&!e.context.isEmpty())for(let a=0;a<e.context.length;a++)if(e.context.getReturnState(a)!==U.EMPTY_RETURN_STATE){const l=e.context.getParent(a),h=this.atn.states[e.context.getReturnState(a)];o=new Yt({state:h,context:l},e),s=this.closure(t,o,n,s,i,r)}return s}e.state.epsilonOnlyTransitions||s&&e.passedThroughNonGreedyDecision||n.add(e);for(let a=0;a<e.state.transitions.length;a++){const l=e.state.transitions[a];o=this.getEpsilonTarget(t,e,l,n,i,r),null!==o&&(s=this.closure(t,o,n,s,i,r))}return s}getEpsilonTarget(e,n,s,i,r,o){let a=null;if(s.serializationType===C.RULE){const t=V.create(n.context,s.followState.stateNumber);a=new Yt({state:s.target,context:t},n)}else{if(s.serializationType===C.PRECEDENCE)throw"Precedence predicates are not supported in lexers.";if(s.serializationType===C.PREDICATE)Xt.debug&&console.log("EVAL rule "+s.ruleIndex+":"+s.predIndex),i.hasSemanticContext=!0,this.evaluatePredicate(e,s.ruleIndex,s.predIndex,r)&&(a=new Yt({state:s.target},n));else if(s.serializationType===C.ACTION)if(null===n.context||n.context.hasEmptyPath()){const t=jt.append(n.lexerActionExecutor,this.atn.lexerActions[s.actionIndex]);a=new Yt({state:s.target,lexerActionExecutor:t},n)}else a=new Yt({state:s.target},n);else s.serializationType===C.EPSILON?a=new Yt({state:s.target},n):s.serializationType!==C.ATOM&&s.serializationType!==C.RANGE&&s.serializationType!==C.SET||o&&s.matches(t.EOF,0,Ut.MAX_CHAR_VALUE)&&(a=new Yt({state:s.target},n))}return a}evaluatePredicate(t,e,n,s){if(null===this.recog)return!0;if(!s)return this.recog.sempred(null,e,n);const i=this.column,r=this.line,o=t.index,a=t.mark();try{return this.consume(t),this.recog.sempred(null,e,n)}finally{this.column=i,this.line=r,t.seek(o),t.release(a)}}captureSimState(t,e,n){t.index=e.index,t.line=this.line,t.column=this.column,t.dfaState=n}addDFAEdge(t,e,n,s){if(void 0===n&&(n=null),void 0===s&&(s=null),null===n&&null!==s){const t=s.hasSemanticContext;if(s.hasSemanticContext=!1,n=this.addDFAState(s),t)return n}return e<Xt.MIN_DFA_EDGE||e>Xt.MAX_DFA_EDGE||(Xt.debug&&console.log("EDGE "+t+" -> "+n+" upon "+e),null===t.edges&&(t.edges=[]),t.edges[e-Xt.MIN_DFA_EDGE]=n),n}addDFAState(t){const e=new qt(null,t);let n=null;for(let o=0;o<t.items.length;o++){const e=t.items[o];if(e.state instanceof A){n=e;break}}null!==n&&(e.isAcceptState=!0,e.lexerActionExecutor=n.lexerActionExecutor,e.prediction=this.atn.ruleToTokenType[n.state.ruleIndex]);const s=this.decisionToDFA[this.mode],i=s.states.get(e);if(null!==i)return i;const r=e;return r.stateNumber=s.states.length,t.setReadonly(!0),r.configs=t,s.states.add(r),r}getDFA(t){return this.decisionToDFA[t]}getText(t){return t.getText(this.startIndex,t.index-1)}consume(t){t.LA(1)==="\n".charCodeAt(0)?(this.line+=1,this.column=0):this.column+=1,t.consume()}getTokenName(t){return-1===t?"EOF":"'"+String.fromCharCode(t)+"'"}}Xt.debug=!1,Xt.dfa_debug=!1,Xt.MIN_DFA_EDGE=0,Xt.MAX_DFA_EDGE=127;class Jt{constructor(t,e){this.alt=e,this.pred=t}toString(){return"("+this.pred+", "+this.alt+")"}}class Zt{constructor(){this.data={}}get(t){return this.data["k-"+t]||null}set(t,e){this.data["k-"+t]=e}values(){return Object.keys(this.data).filter((t=>t.startsWith("k-"))).map((t=>this.data[t]),this)}}const Qt={SLL:0,LL:1,LL_EXACT_AMBIG_DETECTION:2,hasSLLConflictTerminatingPrediction:function(t,e){if(Qt.allConfigsInRuleStopStates(e))return!0;if(t===Qt.SLL&&e.hasSemanticContext){const t=new zt;for(let n=0;n<e.items.length;n++){let s=e.items[n];s=new S({semanticContext:p.NONE},s),t.add(s)}e=t}const n=Qt.getConflictingAltSubsets(e);return Qt.hasConflictingAltSet(n)&&!Qt.hasStateAssociatedWithOneAlt(e)},hasConfigInRuleStopState:function(t){for(let e=0;e<t.items.length;e++)if(t.items[e].state instanceof A)return!0;return!1},allConfigsInRuleStopStates:function(t){for(let e=0;e<t.items.length;e++)if(!(t.items[e].state instanceof A))return!1;return!0},resolvesToJustOneViableAlt:function(t){return Qt.getSingleViableAlt(t)},allSubsetsConflict:function(t){return!Qt.hasNonConflictingAltSet(t)},hasNonConflictingAltSet:function(t){for(let e=0;e<t.length;e++)if(1===t[e].length)return!0;return!1},hasConflictingAltSet:function(t){for(let e=0;e<t.length;e++)if(t[e].length>1)return!0;return!1},allSubsetsEqual:function(t){let e=null;for(let n=0;n<t.length;n++){const s=t[n];if(null===e)e=s;else if(s!==e)return!1}return!0},getUniqueAlt:function(t){const e=Qt.getAlts(t);return 1===e.length?e.minValue():$.INVALID_ALT_NUMBER},getAlts:function(t){const e=new j;return t.map((function(t){e.or(t)})),e},getConflictingAltSubsets:function(t){const e=new H;return e.hashFunction=function(t){o.hashStuff(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){let n=e.get(t);null===n&&(n=new j,e.set(t,n)),n.add(t.alt)})),e.getValues()},getStateToAltMap:function(t){const e=new Zt;return t.items.map((function(t){let n=e.get(t.state);null===n&&(n=new j,e.set(t.state,n)),n.add(t.alt)})),e},hasStateAssociatedWithOneAlt:function(t){const e=Qt.getStateToAltMap(t).values();for(let n=0;n<e.length;n++)if(1===e[n].length)return!0;return!1},getSingleViableAlt:function(t){let e=null;for(let n=0;n<t.length;n++){const s=t[n].minValue();if(null===e)e=s;else if(e!==s)return $.INVALID_ALT_NUMBER}return e}},te=Qt;class ee extends Ft{constructor(t,e,n,s,i,r){r=r||t._ctx,s=s||t.getCurrentToken(),n=n||t.getCurrentToken(),e=e||t.getInputStream(),super({message:"",recognizer:t,input:e,ctx:r}),this.deadEndConfigs=i,this.startToken=n,this.offendingToken=s}}class ne{constructor(t){this.defaultMapCtor=t||H,this.cacheMap=new this.defaultMapCtor}get(t,e){const n=this.cacheMap.get(t)||null;return null===n?null:n.get(e)||null}set(t,e,n){let s=this.cacheMap.get(t)||null;null===s&&(s=new this.defaultMapCtor,this.cacheMap.set(t,s)),s.set(e,n)}}class se extends Ht{constructor(t,e,n,s){super(e,s),this.parser=t,this.decisionToDFA=n,this.predictionMode=te.LL,this._input=null,this._startIndex=0,this._outerContext=null,this._dfa=null,this.mergeCache=null,this.debug=!1,this.debug_closure=!1,this.debug_add=!1,this.trace_atn_sim=!1,this.dfa_debug=!1,this.retry_debug=!1}reset(){}adaptivePredict(t,e,n){(this.debug||this.trace_atn_sim)&&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;const s=this.decisionToDFA[e];this._dfa=s;const i=t.mark(),r=t.index;try{let e;if(e=s.precedenceDfa?s.getPrecedenceStartState(this.parser.getPrecedence()):s.s0,null===e){null===n&&(n=M.EMPTY),this.debug&&console.log("predictATN decision "+s.decision+" exec LA(1)=="+this.getLookaheadName(t)+", outerContext="+n.toString(this.parser.ruleNames));const i=!1;let r=this.computeStartState(s.atnStartState,M.EMPTY,i);s.precedenceDfa?(s.s0.configs=r,r=this.applyPrecedenceFilter(r),e=this.addDFAState(s,new qt(null,r)),s.setPrecedenceStartState(this.parser.getPrecedence(),e)):(e=this.addDFAState(s,new qt(null,r)),s.s0=e)}const i=this.execATN(s,e,t,r,n);return this.debug&&console.log("DFA after predictATN: "+s.toString(this.parser.literalNames,this.parser.symbolicNames)),i}finally{this._dfa=null,this.mergeCache=null,t.seek(r),t.release(i)}}execATN(e,n,s,i,r){let o;(this.debug||this.trace_atn_sim)&&console.log("execATN decision "+e.decision+", DFA state "+n+", LA(1)=="+this.getLookaheadName(s)+" line "+s.LT(1).line+":"+s.LT(1).column);let a=n;this.debug&&console.log("s0 = "+n);let l=s.LA(1);for(;;){let n=this.getExistingTargetState(a,l);if(null===n&&(n=this.computeTargetState(e,a,l)),n===Ht.ERROR){const t=this.noViableAlt(s,r,a.configs,i);if(s.seek(i),o=this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(a.configs,r),o!==$.INVALID_ALT_NUMBER)return o;throw t}if(n.requiresFullContext&&this.predictionMode!==te.SLL){let t=null;if(null!==n.predicates){this.debug&&console.log("DFA state has preds in DFA sim LL failover");const e=s.index;if(e!==i&&s.seek(i),t=this.evalSemanticContext(n.predicates,r,!0),1===t.length)return this.debug&&console.log("Full LL avoided"),t.minValue();e!==i&&s.seek(e)}this.dfa_debug&&console.log("ctx sensitive state "+r+" in "+n);const a=!0,l=this.computeStartState(e.atnStartState,r,a);return this.reportAttemptingFullContext(e,t,n.configs,i,s.index),o=this.execATNWithFullContext(e,n,l,s,i,r),o}if(n.isAcceptState){if(null===n.predicates)return n.prediction;const t=s.index;s.seek(i);const o=this.evalSemanticContext(n.predicates,r,!0);if(0===o.length)throw this.noViableAlt(s,r,n.configs,i);return 1===o.length||this.reportAmbiguity(e,n,i,t,!1,o,n.configs),o.minValue()}a=n,l!==t.EOF&&(s.consume(),l=s.LA(1))}}getExistingTargetState(t,e){const n=t.edges;return null===n?null:n[e+1]||null}computeTargetState(t,e,n){const s=this.computeReachSet(e.configs,n,!1);if(null===s)return this.addDFAEdge(t,e,n,Ht.ERROR),Ht.ERROR;let i=new qt(null,s);const r=this.getUniqueAlt(s);if(this.debug){const t=te.getConflictingAltSubsets(s);console.log("SLL altSubSets="+c(t)+", configs="+s+", predict="+r+", allSubsetsConflict="+te.allSubsetsConflict(t)+", conflictingAlts="+this.getConflictingAlts(s))}return r!==$.INVALID_ALT_NUMBER?(i.isAcceptState=!0,i.configs.uniqueAlt=r,i.prediction=r):te.hasSLLConflictTerminatingPrediction(this.predictionMode,s)&&(i.configs.conflictingAlts=this.getConflictingAlts(s),i.requiresFullContext=!0,i.isAcceptState=!0,i.prediction=i.configs.conflictingAlts.minValue()),i.isAcceptState&&i.configs.hasSemanticContext&&(this.predicateDFAState(i,this.atn.getDecisionState(t.decision)),null!==i.predicates&&(i.prediction=$.INVALID_ALT_NUMBER)),i=this.addDFAEdge(t,e,n,i),i}predicateDFAState(t,e){const n=e.transitions.length,s=this.getConflictingAltsOrUniqueAlt(t.configs),i=this.getPredsForAmbigAlts(s,t.configs,n);null!==i?(t.predicates=this.getPredicatePredictions(s,i),t.prediction=$.INVALID_ALT_NUMBER):t.prediction=s.minValue()}execATNWithFullContext(e,n,s,i,r,o){(this.debug||this.trace_atn_sim)&&console.log("execATNWithFullContext "+s);let a,l=!1,h=s;i.seek(r);let c=i.LA(1),u=-1;for(;;){if(a=this.computeReachSet(h,c,!0),null===a){const t=this.noViableAlt(i,o,h,r);i.seek(r);const e=this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(h,o);if(e!==$.INVALID_ALT_NUMBER)return e;throw t}const e=te.getConflictingAltSubsets(a);if(this.debug&&console.log("LL altSubSets="+e+", predict="+te.getUniqueAlt(e)+", resolvesToJustOneViableAlt="+te.resolvesToJustOneViableAlt(e)),a.uniqueAlt=this.getUniqueAlt(a),a.uniqueAlt!==$.INVALID_ALT_NUMBER){u=a.uniqueAlt;break}if(this.predictionMode!==te.LL_EXACT_AMBIG_DETECTION){if(u=te.resolvesToJustOneViableAlt(e),u!==$.INVALID_ALT_NUMBER)break}else if(te.allSubsetsConflict(e)&&te.allSubsetsEqual(e)){l=!0,u=te.getSingleViableAlt(e);break}h=a,c!==t.EOF&&(i.consume(),c=i.LA(1))}return a.uniqueAlt!==$.INVALID_ALT_NUMBER?(this.reportContextSensitivity(e,u,a,r,i.index),u):(this.reportAmbiguity(e,n,r,i.index,l,null,a),u)}computeReachSet(e,n,s){this.debug&&console.log("in computeReachSet, starting closure: "+e),null===this.mergeCache&&(this.mergeCache=new ne);const i=new zt(s);let r=null;for(let a=0;a<e.items.length;a++){const o=e.items[a];if(this.debug&&console.log("testing "+this.getTokenName(n)+" at "+o),o.state instanceof A)(s||n===t.EOF)&&(null===r&&(r=[]),r.push(o),this.debug_add&&console.log("added "+o+" to skippedStopStates"));else for(let t=0;t<o.state.transitions.length;t++){const e=o.state.transitions[t],s=this.getReachableTarget(e,n);if(null!==s){const t=new S({state:s},o);i.add(t,this.mergeCache),this.debug_add&&console.log("added "+t+" to intermediate")}}}let o=null;if(null===r&&n!==t.EOF&&(1===i.items.length||this.getUniqueAlt(i)!==$.INVALID_ALT_NUMBER)&&(o=i),null===o){o=new zt(s);const e=new d,r=n===t.EOF;for(let t=0;t<i.items.length;t++)this.closure(i.items[t],o,e,!1,s,r)}if(n===t.EOF&&(o=this.removeAllConfigsNotInRuleStopState(o,o===i)),!(null===r||s&&te.hasConfigInRuleStopState(o)))for(let t=0;t<r.length;t++)o.add(r[t],this.mergeCache);return this.trace_atn_sim&&console.log("computeReachSet "+e+" -> "+o),0===o.items.length?null:o}removeAllConfigsNotInRuleStopState(e,n){if(te.allConfigsInRuleStopStates(e))return e;const s=new zt(e.fullCtx);for(let i=0;i<e.items.length;i++){const r=e.items[i];if(r.state instanceof A)s.add(r,this.mergeCache);else if(n&&r.state.epsilonOnlyTransitions&&this.atn.nextTokens(r.state).contains(t.EPSILON)){const t=this.atn.ruleToStopState[r.state.ruleIndex];s.add(new S({state:t},r),this.mergeCache)}}return s}computeStartState(t,e,n){const s=K(this.atn,e),i=new zt(n);this.trace_atn_sim&&console.log("computeStartState from ATN state "+t+" initialContext="+s.toString(this.parser));for(let r=0;r<t.transitions.length;r++){const e=t.transitions[r].target,o=new S({state:e,alt:r+1,context:s},null),a=new d;this.closure(o,i,a,!0,n,!1)}return i}applyPrecedenceFilter(t){let e;const n=[],s=new zt(t.fullCtx);for(let i=0;i<t.items.length;i++){if(e=t.items[i],1!==e.alt)continue;const r=e.semanticContext.evalPrecedence(this.parser,this._outerContext);null!==r&&(n[e.state.stateNumber]=e.context,r!==e.semanticContext?s.add(new S({semanticContext:r},e),this.mergeCache):s.add(e,this.mergeCache))}for(let i=0;i<t.items.length;i++)if(e=t.items[i],1!==e.alt){if(!e.precedenceFilterSuppressed){const t=n[e.state.stateNumber]||null;if(null!==t&&t.equals(e.context))continue}s.add(e,this.mergeCache)}return s}getReachableTarget(t,e){return t.matches(e,0,this.atn.maxTokenType)?t.target:null}getPredsForAmbigAlts(t,e,n){let s=[];for(let r=0;r<e.items.length;r++){const n=e.items[r];t.has(n.alt)&&(s[n.alt]=p.orContext(s[n.alt]||null,n.semanticContext))}let i=0;for(let r=1;r<n+1;r++){const t=s[r]||null;null===t?s[r]=p.NONE:t!==p.NONE&&(i+=1)}return 0===i&&(s=null),this.debug&&console.log("getPredsForAmbigAlts result "+c(s)),s}getPredicatePredictions(t,e){const n=[];let s=!1;for(let i=1;i<e.length;i++){const r=e[i];null!==t&&t.has(i)&&n.push(new Jt(r,i)),r!==p.NONE&&(s=!0)}return s?n:null}getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(t,e){const n=this.splitAccordingToSemanticValidity(t,e),s=n[0],i=n[1];let r=this.getAltThatFinishedDecisionEntryRule(s);return r!==$.INVALID_ALT_NUMBER||i.items.length>0&&(r=this.getAltThatFinishedDecisionEntryRule(i),r!==$.INVALID_ALT_NUMBER)?r:$.INVALID_ALT_NUMBER}getAltThatFinishedDecisionEntryRule(t){const e=[];for(let n=0;n<t.items.length;n++){const s=t.items[n];(s.reachesIntoOuterContext>0||s.state instanceof A&&s.context.hasEmptyPath())&&e.indexOf(s.alt)<0&&e.push(s.alt)}return 0===e.length?$.INVALID_ALT_NUMBER:Math.min.apply(null,e)}splitAccordingToSemanticValidity(t,e){const n=new zt(t.fullCtx),s=new zt(t.fullCtx);for(let i=0;i<t.items.length;i++){const r=t.items[i];r.semanticContext!==p.NONE?r.semanticContext.evaluate(this.parser,e)?n.add(r):s.add(r):n.add(r)}return[n,s]}evalSemanticContext(t,e,n){const s=new j;for(let i=0;i<t.length;i++){const r=t[i];if(r.pred===p.NONE){if(s.add(r.alt),!n)break;continue}const o=r.pred.evaluate(this.parser,e);if((this.debug||this.dfa_debug)&&console.log("eval pred "+r+"="+o),o&&((this.debug||this.dfa_debug)&&console.log("PREDICT "+r.alt),s.add(r.alt),!n))break}return s}closure(t,e,n,s,i,r){this.closureCheckingStopState(t,e,n,s,i,0,r)}closureCheckingStopState(t,e,n,s,i,r,o){if((this.trace_atn_sim||this.debug_closure)&&console.log("closure("+t.toString(this.parser,!0)+")"),t.state instanceof A){if(!t.context.isEmpty()){for(let a=0;a<t.context.length;a++){if(t.context.getReturnState(a)===U.EMPTY_RETURN_STATE){if(i){e.add(new S({state:t.state,context:U.EMPTY},t),this.mergeCache);continue}this.debug&&console.log("FALLING off rule "+this.getRuleName(t.state.ruleIndex)),this.closure_(t,e,n,s,i,r,o);continue}const l=this.atn.states[t.context.getReturnState(a)],h=t.context.getParent(a),c={state:l,alt:t.alt,context:h,semanticContext:t.semanticContext},u=new S(c,null);u.reachesIntoOuterContext=t.reachesIntoOuterContext,this.closureCheckingStopState(u,e,n,s,i,r-1,o)}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,s,i,r,o)}closure_(t,e,n,s,i,r,o){const a=t.state;a.epsilonOnlyTransitions||e.add(t,this.mergeCache);for(let l=0;l<a.transitions.length;l++){if(0===l&&this.canDropLoopEntryEdgeInLeftRecursiveRule(t))continue;const h=a.transitions[l],c=s&&!(h instanceof ut),u=this.getEpsilonTarget(t,h,c,0===r,i,o);if(null!==u){let s=r;if(t.state instanceof A){if(null!==this._dfa&&this._dfa.precedenceDfa&&h.outermostPrecedenceReturn===this._dfa.atnStartState.ruleIndex&&(u.precedenceFilterSuppressed=!0),u.reachesIntoOuterContext+=1,n.add(u)!==u)continue;e.dipsIntoOuterContext=!0,s-=1,this.debug&&console.log("dips into outer ctx: "+u)}else{if(!h.isEpsilon&&n.add(u)!==u)continue;h instanceof N&&s>=0&&(s+=1)}this.closureCheckingStopState(u,e,n,c,i,s,o)}}}canDropLoopEntryEdgeInLeftRecursiveRule(t){const e=t.state;if(e.stateType!==_.STAR_LOOP_ENTRY)return!1;if(e.stateType!==_.STAR_LOOP_ENTRY||!e.isPrecedenceDecision||t.context.isEmpty()||t.context.hasEmptyPath())return!1;const n=t.context.length;for(let r=0;r<n;r++)if(this.atn.states[t.context.getReturnState(r)].ruleIndex!==e.ruleIndex)return!1;const s=e.transitions[0].target.endState.stateNumber,i=this.atn.states[s];for(let r=0;r<n;r++){const n=t.context.getReturnState(r),s=this.atn.states[n];if(1!==s.transitions.length||!s.transitions[0].isEpsilon)return!1;const o=s.transitions[0].target;if(!(s.stateType===_.BLOCK_END&&o===e||s===i||o===i||o.stateType===_.BLOCK_END&&1===o.transitions.length&&o.transitions[0].isEpsilon&&o.transitions[0].target===e))return!1}return!0}getRuleName(t){return null!==this.parser&&t>=0?this.parser.ruleNames[t]:"<rule "+t+">"}getEpsilonTarget(e,n,s,i,r,o){switch(n.serializationType){case C.RULE:return this.ruleTransition(e,n);case C.PRECEDENCE:return this.precedenceTransition(e,n,s,i,r);case C.PREDICATE:return this.predTransition(e,n,s,i,r);case C.ACTION:return this.actionTransition(e,n);case C.EPSILON:return new S({state:n.target},e);case C.ATOM:case C.RANGE:case C.SET:return o&&n.matches(t.EOF,0,1)?new S({state:n.target},e):null;default:return null}}actionTransition(t,e){if(this.debug){const t=-1===e.actionIndex?65535:e.actionIndex;console.log("ACTION edge "+e.ruleIndex+":"+t)}return new S({state:e.target},t)}precedenceTransition(t,e,n,s,i){this.debug&&(console.log("PRED (collectPredicates="+n+") "+e.precedence+">=_p, ctx dependent=true"),null!==this.parser&&console.log("context surrounding pred is "+c(this.parser.getRuleInvocationStack())));let r=null;if(n&&s)if(i){const n=this._input.index;this._input.seek(this._startIndex);const s=e.getPredicate().evaluate(this.parser,this._outerContext);this._input.seek(n),s&&(r=new S({state:e.target},t))}else{const n=p.andContext(t.semanticContext,e.getPredicate());r=new S({state:e.target,semanticContext:n},t)}else r=new S({state:e.target},t);return this.debug&&console.log("config from pred transition="+r),r}predTransition(t,e,n,s,i){this.debug&&(console.log("PRED (collectPredicates="+n+") "+e.ruleIndex+":"+e.predIndex+", ctx dependent="+e.isCtxDependent),null!==this.parser&&console.log("context surrounding pred is "+c(this.parser.getRuleInvocationStack())));let r=null;if(n&&(e.isCtxDependent&&s||!e.isCtxDependent))if(i){const n=this._input.index;this._input.seek(this._startIndex);const s=e.getPredicate().evaluate(this.parser,this._outerContext);this._input.seek(n),s&&(r=new S({state:e.target},t))}else{const n=p.andContext(t.semanticContext,e.getPredicate());r=new S({state:e.target,semanticContext:n},t)}else r=new S({state:e.target},t);return this.debug&&console.log("config from pred transition="+r),r}ruleTransition(t,e){this.debug&&console.log("CALL rule "+this.getRuleName(e.target.ruleIndex)+", ctx="+t.context);const n=e.followState,s=V.create(t.context,n.stateNumber);return new S({state:e.target,context:s},t)}getConflictingAlts(t){const e=te.getConflictingAltSubsets(t);return te.getAlts(e)}getConflictingAltsOrUniqueAlt(t){let e=null;return t.uniqueAlt!==$.INVALID_ALT_NUMBER?(e=new j,e.add(t.uniqueAlt)):e=t.conflictingAlts,e}getTokenName(e){if(e===t.EOF)return"EOF";if(null!==this.parser&&null!==this.parser.literalNames){if(!(e>=this.parser.literalNames.length&&e>=this.parser.symbolicNames.length))return(this.parser.literalNames[e]||this.parser.symbolicNames[e])+"<"+e+">";console.log(e+" ttype out of range: "+this.parser.literalNames),console.log(""+this.parser.getInputStream().getTokens())}return""+e}getLookaheadName(t){return this.getTokenName(t.LA(1))}dumpDeadEndConfigs(t){console.log("dead end configs: ");const e=t.getDeadEndConfigs();for(let n=0;n<e.length;n++){const t=e[n];let s="no edges";if(t.state.transitions.length>0){const e=t.state.transitions[0];e instanceof ht?s="Atom "+this.getTokenName(e.label):e instanceof y&&(s=(e instanceof I?"~":"")+"Set "+e.set)}console.error(t.toString(this.parser,!0)+":"+s)}}noViableAlt(t,e,n,s){return new ee(this.parser,t,t.get(s),t.LT(1),n,e)}getUniqueAlt(t){let e=$.INVALID_ALT_NUMBER;for(let n=0;n<t.items.length;n++){const s=t.items[n];if(e===$.INVALID_ALT_NUMBER)e=s.alt;else if(s.alt!==e)return $.INVALID_ALT_NUMBER}return e}addDFAEdge(t,e,n,s){if(this.debug&&console.log("EDGE "+e+" -> "+s+" upon "+this.getTokenName(n)),null===s)return null;if(s=this.addDFAState(t,s),null===e||n<-1||n>this.atn.maxTokenType)return s;if(null===e.edges&&(e.edges=[]),e.edges[n+1]=s,this.debug){const e=null===this.parser?null:this.parser.literalNames,n=null===this.parser?null:this.parser.symbolicNames;console.log("DFA=\n"+t.toString(e,n))}return s}addDFAState(t,e){if(e===Ht.ERROR)return e;const n=t.states.get(e);return null!==n?(this.trace_atn_sim&&console.log("addDFAState "+e+" exists"),n):(e.stateNumber=t.states.length,e.configs.readOnly||(e.configs.optimizeConfigs(this),e.configs.setReadonly(!0)),this.trace_atn_sim&&console.log("addDFAState new "+e),t.states.add(e),this.debug&&console.log("adding new DFA state: "+e),e)}reportAttemptingFullContext(t,e,n,s,i){if(this.debug||this.retry_debug){const e=new m(s,i+1);console.log("reportAttemptingFullContext decision="+t.decision+":"+n+", input="+this.parser.getTokenStream().getText(e))}null!==this.parser&&this.parser.getErrorListenerDispatch().reportAttemptingFullContext(this.parser,t,s,i,e,n)}reportContextSensitivity(t,e,n,s,i){if(this.debug||this.retry_debug){const e=new m(s,i+1);console.log("reportContextSensitivity decision="+t.decision+":"+n+", input="+this.parser.getTokenStream().getText(e))}null!==this.parser&&this.parser.getErrorListenerDispatch().reportContextSensitivity(this.parser,t,s,i,e,n)}reportAmbiguity(t,e,n,s,i,r,o){if(this.debug||this.retry_debug){const t=new m(n,s+1);console.log("reportAmbiguity "+r+":"+o+", input="+this.parser.getTokenStream().getText(t))}null!==this.parser&&this.parser.getErrorListenerDispatch().reportAmbiguity(this.parser,t,n,s,i,r,o)}}class ie{constructor(){this.cache=new H}add(t){if(t===U.EMPTY)return U.EMPTY;const e=this.cache.get(t)||null;return null!==e?e:(this.cache.set(t,t),t)}get(t){return this.cache.get(t)||null}get length(){return this.cache.length}}const re={ATN:$,ATNDeserializer:Ot,LexerATNSimulator:Xt,ParserATNSimulator:se,PredictionMode:te,PredictionContextCache:ie};class oe{constructor(t,e,n){this.dfa=t,this.literalNames=e||[],this.symbolicNames=n||[]}toString(){if(null===this.dfa.s0)return null;let t="";const e=this.dfa.sortedStates();for(let n=0;n<e.length;n++){const s=e[n];if(null!==s.edges){const e=s.edges.length;for(let n=0;n<e;n++){const e=s.edges[n]||null;null!==e&&2147483647!==e.stateNumber&&(t=t.concat(this.getStateString(s)),t=t.concat("-"),t=t.concat(this.getEdgeLabel(n)),t=t.concat("->"),t=t.concat(this.getStateString(e)),t=t.concat("\n"))}}}return 0===t.length?null:t}getEdgeLabel(t){return 0===t?"EOF":null!==this.literalNames||null!==this.symbolicNames?this.literalNames[t-1]||this.symbolicNames[t-1]:String.fromCharCode(t-1)}getStateString(t){const e=(t.isAcceptState?":":"")+"s"+t.stateNumber+(t.requiresFullContext?"^":"");return t.isAcceptState?null!==t.predicates?e+"=>"+c(t.predicates):e+"=>"+t.prediction.toString():e}}class ae extends oe{constructor(t){super(t,null)}getEdgeLabel(t){return"'"+String.fromCharCode(t)+"'"}}class le{constructor(t,e){if(void 0===e&&(e=0),this.atnStartState=t,this.decision=e,this._states=new d,this.s0=null,this.precedenceDfa=!1,t instanceof rt&&t.isPrecedenceDecision){this.precedenceDfa=!0;const t=new qt(null,new zt);t.edges=[],t.isAcceptState=!1,t.requiresFullContext=!1,this.s0=t}}getPrecedenceStartState(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}setPrecedenceStartState(t,e){if(!this.precedenceDfa)throw"Only precedence DFAs may contain a precedence start state.";t<0||(this.s0.edges[t]=e)}setPrecedenceDfa(t){if(this.precedenceDfa!==t){if(this._states=new d,t){const t=new qt(null,new zt);t.edges=[],t.isAcceptState=!1,t.requiresFullContext=!1,this.s0=t}else this.s0=null;this.precedenceDfa=t}}sortedStates(){return this._states.values().sort((function(t,e){return t.stateNumber-e.stateNumber}))}toString(t,e){return t=t||null,e=e||null,null===this.s0?"":new oe(this,t,e).toString()}toLexerString(){return null===this.s0?"":new ae(this).toString()}get states(){return this._states}}const he={DFA:le,DFASerializer:oe,LexerDFASerializer:ae,PredPrediction:Jt},ce={PredictionContext:U},ue={Interval:m,IntervalSet:E};class de{visitTerminal(t){}visitErrorNode(t){}enterEveryRule(t){}exitEveryRule(t){}}class pe{visit(t){return Array.isArray(t)?t.map((function(t){return t.accept(this)}),this):t.accept(this)}visitChildren(t){return t.children?this.visit(t.children):null}visitTerminal(t){}visitErrorNode(t){}}class ge{walk(t,e){if(e instanceof b||void 0!==e.isErrorNode&&e.isErrorNode())t.visitErrorNode(e);else if(e instanceof P)t.visitTerminal(e);else{this.enterRule(t,e);for(let n=0;n<e.getChildCount();n++){const s=e.getChild(n);this.walk(t,s)}this.exitRule(t,e)}}enterRule(t,e){const n=e.ruleContext;t.enterEveryRule(n),n.enterRule(t)}exitRule(t,e){const n=e.ruleContext;n.exitRule(t),t.exitEveryRule(n)}}ge.DEFAULT=new ge;const fe={Trees:F,RuleNode:w,ErrorNode:b,TerminalNode:P,ParseTreeListener:de,ParseTreeVisitor:pe,ParseTreeWalker:ge};class xe extends Ft{constructor(t){super({message:"",recognizer:t,input:t.getInputStream(),ctx:t._ctx}),this.offendingToken=t.getCurrentToken()}}class Te extends Ft{constructor(t,e,n){super({message:Se(e,n||null),recognizer:t,input:t.getInputStream(),ctx:t._ctx});const s=t._interp.atn.states[t.state].transitions[0];s instanceof gt?(this.ruleIndex=s.ruleIndex,this.predicateIndex=s.predIndex):(this.ruleIndex=0,this.predicateIndex=0),this.predicate=e,this.offendingToken=t.getCurrentToken()}}function Se(t,e){return null!==e?e:"failed predicate: {"+t+"}?"}class me extends Lt{constructor(t){super(),t=t||!0,this.exactOnly=t}reportAmbiguity(t,e,n,s,i,r,o){if(this.exactOnly&&!i)return;const a="reportAmbiguity d="+this.getDecisionDescription(t,e)+": ambigAlts="+this.getConflictingAlts(r,o)+", input='"+t.getTokenStream().getText(new m(n,s))+"'";t.notifyErrorListeners(a)}reportAttemptingFullContext(t,e,n,s,i,r){const o="reportAttemptingFullContext d="+this.getDecisionDescription(t,e)+", input='"+t.getTokenStream().getText(new m(n,s))+"'";t.notifyErrorListeners(o)}reportContextSensitivity(t,e,n,s,i,r){const o="reportContextSensitivity d="+this.getDecisionDescription(t,e)+", input='"+t.getTokenStream().getText(new m(n,s))+"'";t.notifyErrorListeners(o)}getDecisionDescription(t,e){const n=e.decision,s=e.atnStartState.ruleIndex,i=t.ruleNames;if(s<0||s>=i.length)return""+n;const r=i[s]||null;return null===r||0===r.length?""+n:`${n} (${r})`}getConflictingAlts(t,e){if(null!==t)return t;const n=new j;for(let s=0;s<e.items.length;s++)n.add(e.items[s].alt);return`{${n.values().join(", ")}}`}}class Ee extends Error{constructor(){super(),Error.captureStackTrace(this,Ee)}}class _e{reset(t){}recoverInline(t){}recover(t,e){}sync(t){}inErrorRecoveryMode(t){}reportError(t){}}class Ae extends _e{constructor(){super(),this.errorRecoveryMode=!1,this.lastErrorIndex=-1,this.lastErrorStates=null,this.nextTokensContext=null,this.nextTokenState=0}reset(t){this.endErrorCondition(t)}beginErrorCondition(t){this.errorRecoveryMode=!0}inErrorRecoveryMode(t){return this.errorRecoveryMode}endErrorCondition(t){this.errorRecoveryMode=!1,this.lastErrorStates=null,this.lastErrorIndex=-1}reportMatch(t){this.endErrorCondition(t)}reportError(t,e){this.inErrorRecoveryMode(t)||(this.beginErrorCondition(t),e instanceof ee?this.reportNoViableAlternative(t,e):e instanceof xe?this.reportInputMismatch(t,e):e instanceof Te?this.reportFailedPredicate(t,e):(console.log("unknown recognition error type: "+e.constructor.name),console.log(e.stack),t.notifyErrorListeners(e.getOffendingToken(),e.getMessage(),e)))}recover(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);const n=this.getErrorRecoverySet(t);this.consumeUntil(t,n)}sync(e){if(this.inErrorRecoveryMode(e))return;const n=e._interp.atn.states[e.state],s=e.getTokenStream().LA(1),i=e.atn.nextTokens(n);if(i.contains(s))return this.nextTokensContext=null,void(this.nextTokenState=_.INVALID_STATE_NUMBER);if(i.contains(t.EPSILON))null===this.nextTokensContext&&(this.nextTokensContext=e._ctx,this.nextTokensState=e._stateNumber);else switch(n.stateType){case _.BLOCK_START:case _.STAR_BLOCK_START:case _.PLUS_BLOCK_START:case _.STAR_LOOP_ENTRY:if(null!==this.singleTokenDeletion(e))return;throw new xe(e);case _.PLUS_LOOP_BACK:case _.STAR_LOOP_BACK:{this.reportUnwantedToken(e);const t=new E;t.addSet(e.getExpectedTokens());const n=t.addSet(this.getErrorRecoverySet(e));this.consumeUntil(e,n)}}}reportNoViableAlternative(e,n){const s=e.getTokenStream();let i;i=null!==s?n.startToken.type===t.EOF?"<EOF>":s.getText(new m(n.startToken.tokenIndex,n.offendingToken.tokenIndex)):"<unknown input>";const r="no viable alternative at input "+this.escapeWSAndQuote(i);e.notifyErrorListeners(r,n.offendingToken,n)}reportInputMismatch(t,e){const n="mismatched input "+this.getTokenErrorDisplay(e.offendingToken)+" expecting "+e.getExpectedTokens().toString(t.literalNames,t.symbolicNames);t.notifyErrorListeners(n,e.offendingToken,e)}reportFailedPredicate(t,e){const n="rule "+t.ruleNames[t._ctx.ruleIndex]+" "+e.message;t.notifyErrorListeners(n,e.offendingToken,e)}reportUnwantedToken(t){if(this.inErrorRecoveryMode(t))return;this.beginErrorCondition(t);const e=t.getCurrentToken(),n="extraneous input "+this.getTokenErrorDisplay(e)+" expecting "+this.getExpectedTokens(t).toString(t.literalNames,t.symbolicNames);t.notifyErrorListeners(n,e,null)}reportMissingToken(t){if(this.inErrorRecoveryMode(t))return;this.beginErrorCondition(t);const e=t.getCurrentToken(),n="missing "+this.getExpectedTokens(t).toString(t.literalNames,t.symbolicNames)+" at "+this.getTokenErrorDisplay(e);t.notifyErrorListeners(n,e,null)}recoverInline(t){const e=this.singleTokenDeletion(t);if(null!==e)return t.consume(),e;if(this.singleTokenInsertion(t))return this.getMissingSymbol(t);throw new xe(t)}singleTokenInsertion(t){const e=t.getTokenStream().LA(1),n=t._interp.atn,s=n.states[t.state].transitions[0].target;return!!n.nextTokens(s,t._ctx).contains(e)&&(this.reportMissingToken(t),!0)}singleTokenDeletion(t){const e=t.getTokenStream().LA(2);if(this.getExpectedTokens(t).contains(e)){this.reportUnwantedToken(t),t.consume();const e=t.getCurrentToken();return this.reportMatch(t),e}return null}getMissingSymbol(e){const n=e.getCurrentToken(),s=this.getExpectedTokens(e).first();let i;i=s===t.EOF?"<missing EOF>":"<missing "+e.literalNames[s]+">";let r=n;const o=e.getTokenStream().LT(-1);return r.type===t.EOF&&null!==o&&(r=o),e.getTokenFactory().create(r.source,s,i,t.DEFAULT_CHANNEL,-1,-1,r.line,r.column)}getExpectedTokens(t){return t.getExpectedTokens()}getTokenErrorDisplay(e){if(null===e)return"<no token>";let n=e.text;return null===n&&(n=e.type===t.EOF?"<EOF>":"<"+e.type+">"),this.escapeWSAndQuote(n)}escapeWSAndQuote(t){return"'"+(t=(t=(t=t.replace(/\n/g,"\\n")).replace(/\r/g,"\\r")).replace(/\t/g,"\\t"))+"'"}getErrorRecoverySet(e){const n=e._interp.atn;let s=e._ctx;const i=new E;for(;null!==s&&s.invokingState>=0;){const t=n.states[s.invokingState].transitions[0],e=n.nextTokens(t.followState);i.addSet(e),s=s.parentCtx}return i.removeOne(t.EPSILON),i}consumeUntil(e,n){let s=e.getTokenStream().LA(1);for(;s!==t.EOF&&!n.contains(s);)e.consume(),s=e.getTokenStream().LA(1)}}class Ce extends Ae{constructor(){super()}recover(t,e){let n=t._ctx;for(;null!==n;)n.exception=e,n=n.parentCtx;throw new Ee(e)}recoverInline(t){this.recover(t,new xe(t))}sync(t){}}const Ne={RecognitionException:Ft,NoViableAltException:ee,LexerNoViableAltException:Mt,InputMismatchException:xe,FailedPredicateException:Te,DiagnosticErrorListener:me,BailErrorStrategy:Ce,DefaultErrorStrategy:Ae,ErrorListener:Lt};class ye{constructor(t,e){if(this.name="<empty>",this.strdata=t,this.decodeToUnicodeCodePoints=e||!1,this._index=0,this.data=[],this.decodeToUnicodeCodePoints)for(let n=0;n<this.strdata.length;){const t=this.strdata.codePointAt(n);this.data.push(t),n+=t<=65535?1:2}else{this.data=new Array(this.strdata.length);for(let t=0;t<this.strdata.length;t++)this.data[t]=this.strdata.charCodeAt(t)}this._size=this.data.length}reset(){this._index=0}consume(){if(this._index>=this._size)throw"cannot consume EOF";this._index+=1}LA(e){if(0===e)return 0;e<0&&(e+=1);const n=this._index+e-1;return n<0||n>=this._size?t.EOF:this.data[n]}LT(t){return this.LA(t)}mark(){return-1}release(t){}seek(t){t<=this._index?this._index=t:this._index=Math.min(t,this._size)}getText(t,e){if(e>=this._size&&(e=this._size-1),t>=this._size)return"";if(this.decodeToUnicodeCodePoints){let n="";for(let s=t;s<=e;s++)n+=String.fromCodePoint(this.data[s]);return n}return this.strdata.slice(t,e+1)}toString(){return this.strdata}get index(){return this._index}get size(){return this._size}}class Ie extends ye{constructor(t,e){super(t,e)}}var ke=n(92);const Oe="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node;class Le extends Ie{static fromPath(t,e,n){if(!Oe)throw new Error("FileStream is only available when running in Node!");ke.readFile(t,e,(function(t,e){let s=null;null!==e&&(s=new ye(e,!0)),n(t,s)}))}constructor(t,e,n){if(!Oe)throw new Error("FileStream is only available when running in Node!");super(ke.readFileSync(t,e||"utf-8"),n),this.fileName=t}}const ve={fromString:function(t){return new ye(t,!0)},fromBlob:function(t,e,n,s){const i=new window.FileReader;i.onload=function(t){const e=new ye(t.target.result,!0);n(e)},i.onerror=s,i.readAsText(t,e)},fromBuffer:function(t,e){return new ye(t.toString(e),!0)},fromPath:function(t,e,n){Le.fromPath(t,e,n)},fromPathSync:function(t,e){return new Le(t,e)}},Re={arrayToString:c,stringToCharArray:function(t){let e=new Uint16Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}};class we{}class Pe extends we{constructor(t){super(),this.tokenSource=t,this.tokens=[],this.index=-1,this.fetchedEOF=!1}mark(){return 0}release(t){}reset(){this.seek(0)}seek(t){this.lazyInit(),this.index=this.adjustSeekIndex(t)}get size(){return this.tokens.length}get(t){return this.lazyInit(),this.tokens[t]}consume(){let e=!1;if(e=this.index>=0&&(this.fetchedEOF?this.index<this.tokens.length-1:this.index<this.tokens.length),!e&&this.LA(1)===t.EOF)throw"cannot consume EOF";this.sync(this.index+1)&&(this.index=this.adjustSeekIndex(this.index+1))}sync(t){const e=t-this.tokens.length+1;return!(e>0)||this.fetch(e)>=e}fetch(e){if(this.fetchedEOF)return 0;for(let n=0;n<e;n++){const e=this.tokenSource.nextToken();if(e.tokenIndex=this.tokens.length,this.tokens.push(e),e.type===t.EOF)return this.fetchedEOF=!0,n+1}return e}getTokens(e,n,s){if(void 0===s&&(s=null),e<0||n<0)return null;this.lazyInit();const i=[];n>=this.tokens.length&&(n=this.tokens.length-1);for(let r=e;r<n;r++){const e=this.tokens[r];if(e.type===t.EOF)break;(null===s||s.contains(e.type))&&i.push(e)}return i}LA(t){return this.LT(t).type}LB(t){return this.index-t<0?null:this.tokens[this.index-t]}LT(t){if(this.lazyInit(),0===t)return null;if(t<0)return this.LB(-t);const e=this.index+t-1;return this.sync(e),e>=this.tokens.length?this.tokens[this.tokens.length-1]:this.tokens[e]}adjustSeekIndex(t){return t}lazyInit(){-1===this.index&&this.setup()}setup(){this.sync(0),this.index=this.adjustSeekIndex(0)}setTokenSource(t){this.tokenSource=t,this.tokens=[],this.index=-1,this.fetchedEOF=!1}nextTokenOnChannel(e,n){if(this.sync(e),e>=this.tokens.length)return-1;let s=this.tokens[e];for(;s.channel!==this.channel;){if(s.type===t.EOF)return-1;e+=1,this.sync(e),s=this.tokens[e]}return e}previousTokenOnChannel(t,e){for(;t>=0&&this.tokens[t].channel!==e;)t-=1;return t}getHiddenTokensToRight(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;const n=this.nextTokenOnChannel(t+1,Ut.DEFAULT_TOKEN_CHANNEL),s=t+1,i=-1===n?this.tokens.length-1:n;return this.filterForChannel(s,i,e)}getHiddenTokensToLeft(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;const n=this.previousTokenOnChannel(t-1,Ut.DEFAULT_TOKEN_CHANNEL);if(n===t-1)return null;const s=n+1,i=t-1;return this.filterForChannel(s,i,e)}filterForChannel(t,e,n){const s=[];for(let i=t;i<e+1;i++){const t=this.tokens[i];-1===n?t.channel!==Ut.DEFAULT_TOKEN_CHANNEL&&s.push(t):t.channel===n&&s.push(t)}return 0===s.length?null:s}getSourceName(){return this.tokenSource.getSourceName()}getText(e){this.lazyInit(),this.fill(),e||(e=new m(0,this.tokens.length-1));let n=e.start;n instanceof t&&(n=n.tokenIndex);let s=e.stop;if(s instanceof t&&(s=s.tokenIndex),null===n||null===s||n<0||s<0)return"";s>=this.tokens.length&&(s=this.tokens.length-1);let i="";for(let r=n;r<s+1;r++){const e=this.tokens[r];if(e.type===t.EOF)break;i+=e.text}return i}fill(){for(this.lazyInit();1e3===this.fetch(1e3););}}Object.defineProperty(Pe,"size",{get:function(){return this.tokens.length}});class be extends Pe{constructor(e,n){super(e),this.channel=void 0===n?t.DEFAULT_CHANNEL:n}adjustSeekIndex(t){return this.nextTokenOnChannel(t,this.channel)}LB(t){if(0===t||this.index-t<0)return null;let e=this.index,n=1;for(;n<=t;)e=this.previousTokenOnChannel(e-1,this.channel),n+=1;return e<0?null:this.tokens[e]}LT(t){if(this.lazyInit(),0===t)return null;if(t<0)return this.LB(-t);let e=this.index,n=1;for(;n<t;)this.sync(e+1)&&(e=this.nextTokenOnChannel(e+1,this.channel)),n+=1;return this.tokens[e]}getNumberOfOnChannelTokens(){let e=0;this.fill();for(let n=0;n<this.tokens.length;n++){const s=this.tokens[n];if(s.channel===this.channel&&(e+=1),s.type===t.EOF)break}return e}}class De extends de{constructor(t){super(),this.parser=t}enterEveryRule(t){console.log("enter "+this.parser.ruleNames[t.ruleIndex]+", LT(1)="+this.parser._input.LT(1).text)}visitTerminal(t){console.log("consume "+t.symbol+" rule "+this.parser.ruleNames[this.parser._ctx.ruleIndex])}exitEveryRule(t){console.log("exit "+this.parser.ruleNames[t.ruleIndex]+", LT(1)="+this.parser._input.LT(1).text)}}class Fe extends wt{constructor(t){super(),this._input=null,this._errHandler=new Ae,this._precedenceStack=[],this._precedenceStack.push(0),this._ctx=null,this.buildParseTrees=!0,this._tracer=null,this._parseListeners=null,this._syntaxErrors=0,this.setInputStream(t)}reset(){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()}match(t){let 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}matchWildcard(){let 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}getParseListeners(){return this._parseListeners||[]}addParseListener(t){if(null===t)throw"listener";null===this._parseListeners&&(this._parseListeners=[]),this._parseListeners.push(t)}removeParseListener(t){if(null!==this._parseListeners){const e=this._parseListeners.indexOf(t);e>=0&&this._parseListeners.splice(e,1),0===this._parseListeners.length&&(this._parseListeners=null)}}removeParseListeners(){this._parseListeners=null}triggerEnterRuleEvent(){if(null!==this._parseListeners){const t=this._ctx;this._parseListeners.forEach((function(e){e.enterEveryRule(t),t.enterRule(e)}))}}triggerExitRuleEvent(){if(null!==this._parseListeners){const t=this._ctx;this._parseListeners.slice(0).reverse().forEach((function(e){t.exitRule(e),e.exitEveryRule(t)}))}}getTokenFactory(){return this._input.tokenSource._factory}setTokenFactory(t){this._input.tokenSource._factory=t}getATNWithBypassAlts(){const t=this.getSerializedATN();if(null===t)throw"The current parser does not support an ATN with bypass alternatives.";let e=this.bypassAltsAtnCache[t];if(null===e){const n=new Tt;n.generateRuleBypassTransitions=!0,e=new Ot(n).deserialize(t),this.bypassAltsAtnCache[t]=e}return e}getInputStream(){return this.getTokenStream()}setInputStream(t){this.setTokenStream(t)}getTokenStream(){return this._input}setTokenStream(t){this._input=null,this.reset(),this._input=t}get syntaxErrorsCount(){return this._syntaxErrors}getCurrentToken(){return this._input.LT(1)}notifyErrorListeners(t,e,n){n=n||null,null===(e=e||null)&&(e=this.getCurrentToken()),this._syntaxErrors+=1;const s=e.line,i=e.column;this.getErrorListenerDispatch().syntaxError(this,e,s,i,t,n)}consume(){const e=this.getCurrentToken();e.type!==t.EOF&&this.getInputStream().consume();const n=null!==this._parseListeners&&this._parseListeners.length>0;if(this.buildParseTrees||n){let t;t=this._errHandler.inErrorRecoveryMode(this)?this._ctx.addErrorNode(e):this._ctx.addTokenNode(e),t.invokingState=this.state,n&&this._parseListeners.forEach((function(e){t instanceof b||void 0!==t.isErrorNode&&t.isErrorNode()?e.visitErrorNode(t):t instanceof P&&e.visitTerminal(t)}))}return e}addContextToParseTree(){null!==this._ctx.parentCtx&&this._ctx.parentCtx.addChild(this._ctx)}enterRule(t,e,n){this.state=e,this._ctx=t,this._ctx.start=this._input.LT(1),this.buildParseTrees&&this.addContextToParseTree(),this.triggerEnterRuleEvent()}exitRule(){this._ctx.stop=this._input.LT(-1),this.triggerExitRuleEvent(),this.state=this._ctx.invokingState,this._ctx=this._ctx.parentCtx}enterOuterAlt(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}getPrecedence(){return 0===this._precedenceStack.length?-1:this._precedenceStack[this._precedenceStack.length-1]}enterRecursionRule(t,e,n,s){this.state=e,this._precedenceStack.push(s),this._ctx=t,this._ctx.start=this._input.LT(1),this.triggerEnterRuleEvent()}pushNewRecursionContext(t,e,n){const s=this._ctx;s.parentCtx=t,s.invokingState=e,s.stop=this._input.LT(-1),this._ctx=t,this._ctx.start=s.start,this.buildParseTrees&&this._ctx.addChild(s),this.triggerEnterRuleEvent()}unrollRecursionContexts(t){this._precedenceStack.pop(),this._ctx.stop=this._input.LT(-1);const e=this._ctx,n=this.getParseListeners();if(null!==n&&n.length>0)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)}getInvokingContext(t){let e=this._ctx;for(;null!==e;){if(e.ruleIndex===t)return e;e=e.parentCtx}return null}precpred(t,e){return e>=this._precedenceStack[this._precedenceStack.length-1]}inContext(t){return!1}isExpectedToken(e){const n=this._interp.atn;let s=this._ctx;const i=n.states[this.state];let r=n.nextTokens(i);if(r.contains(e))return!0;if(!r.contains(t.EPSILON))return!1;for(;null!==s&&s.invokingState>=0&&r.contains(t.EPSILON);){const t=n.states[s.invokingState].transitions[0];if(r=n.nextTokens(t.followState),r.contains(e))return!0;s=s.parentCtx}return!(!r.contains(t.EPSILON)||e!==t.EOF)}getExpectedTokens(){return this._interp.atn.getExpectedTokens(this.state,this._ctx)}getExpectedTokensWithinCurrentRule(){const t=this._interp.atn,e=t.states[this.state];return t.nextTokens(e)}getRuleIndex(t){const e=this.getRuleIndexMap()[t];return null!==e?e:-1}getRuleInvocationStack(t){null===(t=t||null)&&(t=this._ctx);const e=[];for(;null!==t;){const n=t.ruleIndex;n<0?e.push("n/a"):e.push(this.ruleNames[n]),t=t.parentCtx}return e}getDFAStrings(){return this._interp.decisionToDFA.toString()}dumpDFA(){let t=!1;for(let e=0;e<this._interp.decisionToDFA.length;e++){const 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)}}getSourceName(){return this._input.sourceName}setTrace(t){t?(null!==this._tracer&&this.removeParseListener(this._tracer),this._tracer=new De(this),this.addParseListener(this._tracer)):(this.removeParseListener(this._tracer),this._tracer=null)}}Fe.bypassAltsAtnCache={};class Me extends P{constructor(t){super(),this.parentCtx=null,this.symbol=t}getChild(t){return null}getSymbol(){return this.symbol}getParent(){return this.parentCtx}getPayload(){return this.symbol}getSourceInterval(){if(null===this.symbol)return m.INVALID_INTERVAL;const t=this.symbol.tokenIndex;return new m(t,t)}getChildCount(){return 0}accept(t){return t.visitTerminal(this)}getText(){return this.symbol.text}toString(){return this.symbol.type===t.EOF?"<EOF>":this.symbol.text}}class Ue extends Me{constructor(t){super(t)}isErrorNode(){return!0}accept(t){return t.visitErrorNode(this)}}class Be extends M{constructor(t,e){super(t,e),this.children=null,this.start=null,this.stop=null,this.exception=null}copyFrom(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 Ue&&(this.children.push(t),t.parentCtx=this)}),this))}enterRule(t){}exitRule(t){}addChild(t){return null===this.children&&(this.children=[]),this.children.push(t),t}removeLastChild(){null!==this.children&&this.children.pop()}addTokenNode(t){const e=new Me(t);return this.addChild(e),e.parentCtx=this,e}addErrorNode(t){const e=new Ue(t);return this.addChild(e),e.parentCtx=this,e}getChild(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(let n=0;n<this.children.length;n++){const s=this.children[n];if(s instanceof e){if(0===t)return s;t-=1}}return null}getToken(t,e){if(null===this.children||e<0||e>=this.children.length)return null;for(let n=0;n<this.children.length;n++){const s=this.children[n];if(s instanceof P&&s.symbol.type===t){if(0===e)return s;e-=1}}return null}getTokens(t){if(null===this.children)return[];{const e=[];for(let n=0;n<this.children.length;n++){const s=this.children[n];s instanceof P&&s.symbol.type===t&&e.push(s)}return e}}getTypedRuleContext(t,e){return this.getChild(e,t)}getTypedRuleContexts(t){if(null===this.children)return[];{const e=[];for(let n=0;n<this.children.length;n++){const s=this.children[n];s instanceof t&&e.push(s)}return e}}getChildCount(){return null===this.children?0:this.children.length}getSourceInterval(){return null===this.start||null===this.stop?m.INVALID_INTERVAL:new m(this.start.tokenIndex,this.stop.tokenIndex)}}M.EMPTY=new Be;class Ve{constructor(t){this.tokens=t,this.programs=new Map}getTokenStream(){return this.tokens}insertAfter(t,e){let n,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ve.DEFAULT_PROGRAM_NAME;n="number"==typeof t?t:t.tokenIndex;let i=this.getProgram(s),r=new Ge(this.tokens,n,i.length,e);i.push(r)}insertBefore(t,e){let n,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ve.DEFAULT_PROGRAM_NAME;n="number"==typeof t?t:t.tokenIndex;const i=this.getProgram(s),r=new Ye(this.tokens,n,i.length,e);i.push(r)}replaceSingle(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ve.DEFAULT_PROGRAM_NAME;this.replace(t,t,e,n)}replace(t,e,n){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Ve.DEFAULT_PROGRAM_NAME;if("number"!=typeof t&&(t=t.tokenIndex),"number"!=typeof e&&(e=e.tokenIndex),t>e||t<0||e<0||e>=this.tokens.size)throw new RangeError(`replace: range invalid: ${t}..${e}(size=${this.tokens.size})`);let i=this.getProgram(s),r=new je(this.tokens,t,e,i.length,n);i.push(r)}delete(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ve.DEFAULT_PROGRAM_NAME;void 0===e&&(e=t),this.replace(t,e,null,n)}getProgram(t){let e=this.programs.get(t);return null==e&&(e=this.initializeProgram(t)),e}initializeProgram(t){const e=[];return this.programs.set(t,e),e}getText(e){let n,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ve.DEFAULT_PROGRAM_NAME;n=e instanceof m?e:new m(0,this.tokens.size-1),"string"==typeof e&&(s=e);const i=this.programs.get(s);let r=n.start,o=n.stop;if(o>this.tokens.size-1&&(o=this.tokens.size-1),r<0&&(r=0),null==i||0===i.length)return this.tokens.getText(new m(r,o));let a=[],l=this.reduceToSingleOperationPerIndex(i),h=r;for(;h<=o&&h<this.tokens.size;){let e=l.get(h);l.delete(h);let n=this.tokens.get(h);null==e?(n.type!==t.EOF&&a.push(String(n.text)),h++):h=e.execute(a)}if(o===this.tokens.size-1)for(const t of l.values())t.index>=this.tokens.size-1&&a.push(t.text.toString());return a.join("")}reduceToSingleOperationPerIndex(t){for(let n=0;n<t.length;n++){let e=t[n];if(null==e)continue;if(!(e instanceof je))continue;let s=e,i=this.getKindOfOps(t,Ye,n);for(let n of i)n.index===s.index?(t[n.instructionIndex]=void 0,s.text=n.text.toString()+(null!=s.text?s.text.toString():"")):n.index>s.index&&n.index<=s.lastIndex&&(t[n.instructionIndex]=void 0);let r=this.getKindOfOps(t,je,n);for(let n of r){if(n.index>=s.index&&n.lastIndex<=s.lastIndex){t[n.instructionIndex]=void 0;continue}let e=n.lastIndex<s.index||n.index>s.lastIndex;if(null!=n.text||null!=s.text||e){if(!e)throw new Error(`replace op boundaries of ${s} overlap with previous ${n}`)}else t[n.instructionIndex]=void 0,s.index=Math.min(n.index,s.index),s.lastIndex=Math.max(n.lastIndex,s.lastIndex)}}for(let n=0;n<t.length;n++){let e=t[n];if(null==e)continue;if(!(e instanceof Ye))continue;let s=e,i=this.getKindOfOps(t,Ye,n);for(let n of i)n.index===s.index&&(n instanceof Ge?(s.text=this.catOpText(n.text,s.text),t[n.instructionIndex]=void 0):n instanceof Ye&&(s.text=this.catOpText(s.text,n.text),t[n.instructionIndex]=void 0));let r=this.getKindOfOps(t,je,n);for(let o of r)if(s.index!==o.index){if(s.index>=o.index&&s.index<=o.lastIndex)throw new Error(`insert op ${s} within boundaries of previous ${o}`)}else o.text=this.catOpText(s.text,o.text),t[n]=void 0}let e=new Map;for(let n of t)if(null!=n){if(null!=e.get(n.index))throw new Error("should only be one op per index");e.set(n.index,n)}return e}catOpText(t,e){let n="",s="";return null!=t&&(n=t.toString()),null!=e&&(s=e.toString()),n+s}getKindOfOps(t,e,n){return t.slice(0,n).filter((t=>t&&t instanceof e))}}var ze,qe,He;ze=Ve,He="default",(qe=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var s=n.call(t,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:String(e)}(qe="DEFAULT_PROGRAM_NAME"))in ze?Object.defineProperty(ze,qe,{value:He,enumerable:!0,configurable:!0,writable:!0}):ze[qe]=He;class Ke{constructor(t,e,n,s){this.tokens=t,this.instructionIndex=n,this.index=e,this.text=void 0===s?"":s}toString(){let t=this.constructor.name;const e=t.indexOf("$");return t=t.substring(e+1,t.length),"<"+t+"@"+this.tokens.get(this.index)+':"'+this.text+'">'}}class Ye extends Ke{constructor(t,e,n,s){super(t,e,n,s)}execute(e){return this.text&&e.push(this.text.toString()),this.tokens.get(this.index).type!==t.EOF&&e.push(String(this.tokens.get(this.index).text)),this.index+1}}class Ge extends Ye{constructor(t,e,n,s){super(t,e+1,n,s)}}class je extends Ke{constructor(t,e,n,s,i){super(t,e,s,i),this.lastIndex=n}execute(t){return this.text&&t.push(this.text.toString()),this.lastIndex+1}toString(){return null==this.text?"<DeleteOp@"+this.tokens.get(this.index)+".."+this.tokens.get(this.lastIndex)+">":"<ReplaceOp@"+this.tokens.get(this.index)+".."+this.tokens.get(this.lastIndex)+':"'+this.text+'">'}}const We={atn:re,dfa:he,context:ce,misc:ue,tree:fe,error:Ne,Token:t,CommonToken:Pt,CharStreams:ve,CharStream:Ie,InputStream:Ie,CommonTokenStream:be,Lexer:Ut,Parser:Fe,ParserRuleContext:Be,Interval:m,IntervalSet:E,LL1Analyzer:W,Utils:Re,TokenStreamRewriter:Ve}})(),s.dx,s.q2,s.FO;var i=s.xf;s.Gy,s.s4;var r=s.c7;s._7,s.tx,s.gp;var o=s.cK;s.zs,s.AV,s.Xp,s.VS,s.ul,s.hW,s.x1,s.z5,s.oN,s.TB;var a=s.u1;s._b,s.$F,s._T,s.db,s.Zx,s._x,s.r8,s.JI,s.TP,s.WU,s.Nj;var l=s.ZP;export{i as CharStream,r as CommonTokenStream,o as ErrorListener,a as ParseTreeWalker,l as default};
|
package/layers/LinkChartLayer.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import t from"../core/Collection.js";import a from"../core/Error.js";import i from"../core/Logger.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{throwIfAborted as s}from"../core/promiseUtils.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import h from"./Layer.js";import{convertFromGeometry as l}from"./graphics/featureConversionUtils.js";import d from"./graphics/OptimizedGeometry.js";import{IdealEdgeLengthTypeOptions as p}from"./knowledgeGraph/IdealEdgeLengthTypeOptions.js";import{KnowledgeGraphLayerDataManager as c,mockOidFieldName as u,mockOriginIdFieldName as y,mockDestinationIdFieldName as g,mockLayoutGeometryFieldName as m,mockAggregationCountFieldName as f}from"./knowledgeGraph/KnowledgeGraphLayerDataManager.js";import L from"./knowledgeGraph/KnowledgeGraphSublayer.js";import{getRelationshipEndNodeIds as C}from"./knowledgeGraph/supportUtils.js";import{BlendLayer as k}from"./mixins/BlendLayer.js";import{ScaleRangeLayer as w}from"./mixins/ScaleRangeLayer.js";import{LCSimpleLayout as M,LCSmartTreeLayout as b,LCRadialTreeLayout as E,LCHierarchicalLayout as T,LCCommunityLayout as D,LCForceDirectedLayout as x,NodeFlag as N,load as v,LinkType as R}from"../libs/linkchartlayout/LinkChartLayout.js";import{fetchKnowledgeGraph as I}from"../rest/knowledgeGraphService.js";import A from"../geometry/Extent.js";import G from"../geometry/Point.js";import _ from"../geometry/Polyline.js";let j=class extends(k(w(h))){constructor(e){if(super(e),this.dataPreloadedInLocalCache=!1,this.defaultLinkChartConfig=null,this._currentLinkChartConfig={layoutMode:"RADIAL_TREE"},this._graphTypeLookup=new Map,this.dataManager=null,this.knowledgeGraph=null,this.layers=new t,this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map,this.linkChartExtent=new A({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7}),this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.sublayerIdsCache=new Map,this.tables=new t,this.type="link-chart",this._originalInclusionList=e.inclusionModeDefinition,e.dataPreloadedInLocalCache&&!e.inclusionModeDefinition)throw new a("knowledge-graph:linkchart-layer-constructor","If creating a link chart composite layer and configured that data is already loaded in the cache, you must specify an inclusion list so the Composite Layer knows what records belong to it")}normalizeCtorArgs(e){return{url:e.url,title:e.title,dataPreloadedInLocalCache:e.dataPreloadedInLocalCache,defaultLinkChartConfig:e.defaultLinkChartConfig}}_initializeLayerProperties(e){if(!this.title&&this.url){const e=this.url.split("/");this.title=e[e.length-2]}const t=new Set;let n=[],s=[];if(e.inclusionModeDefinition&&(!e.inclusionModeDefinition.namedTypeDefinitions||e.inclusionModeDefinition.namedTypeDefinitions.size<1))throw new a("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined");e.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),e.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),e.inclusionModeDefinition?.generateAllSublayers?(n=e.knowledgeGraph.dataModel.entityTypes??[],s=e.knowledgeGraph.dataModel.relationshipTypes??[]):e.inclusionModeDefinition?.namedTypeDefinitions&&e.inclusionModeDefinition?.namedTypeDefinitions.size>0?e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((a,o)=>{const r=this._graphTypeLookup.get(o);if(!r)return i.getLogger(this).warn(`A named type, ${o}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(o);"relationship"===r.type?t.has(o)||(t.add(o),s.push(r)):"entity"===r.type?t.has(o)||(t.add(o),n.push(r)):(i.getLogger(this).warn(`A named type, ${o}, was in the inclusion list that wasn't properly modeled and will be removed`),e.inclusionModeDefinition?.namedTypeDefinitions.delete(o))})):(n=e.knowledgeGraph.dataModel.entityTypes??[],s=e.knowledgeGraph.dataModel.relationshipTypes??[]);const o=new c({knowledgeGraph:e.knowledgeGraph,inclusionModeDefinition:e.inclusionModeDefinition});this.knowledgeGraph=e.knowledgeGraph,this.memberEntityTypes=n,this.memberRelationshipTypes=s,this.dataManager=o}load(e){return this.addResolvingPromise(new Promise((t=>{I(this.url).then((a=>{if(this._initializeLayerProperties({knowledgeGraph:a,inclusionModeDefinition:this._originalInclusionList}),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.size||(this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map},this.dataManager.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})})),this.dataManager.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})}))),this.dataPreloadedInLocalCache)this.loadLayerAssumingLocalCache(),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach((e=>{e.useAllData=!1,e.members?.forEach((e=>{let t;t=e.linkChartLocation instanceof d?e.linkChartLocation:e.linkChartLocation?l(e.linkChartLocation):null,t&&2===t.coords.length&&0===t.lengths.length?this.entityLinkChartDiagramLookup.set(e.id,t):this.relationshipLinkChartDiagramLookup.set(e.id,t)})),this.addResolvingPromise(this._initializeDiagram().then((async()=>{this.layers.forEach((async e=>{await e.refreshCachedQueryEngine()})),this.tables.forEach((async e=>{await e.refreshCachedQueryEngine()}))})))}));else{const t="GEOGRAPHIC"===this.defaultLinkChartConfig?.layoutMode;this.addResolvingPromise(this.dataManager.refreshCacheContent(void 0,!1,t,!0).then((async()=>{s(e);const t=[],a=[];this.loadLayerAssumingLocalCache(),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1,this.dataManager.inclusionModeDefinition.namedTypeDefinitions.forEach((e=>{e.useAllData=!1}))),await this._initializeDiagram(),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine()),t.push(new Promise((t=>{e.on("layerview-create",(()=>{t(null)}))})))})),this.tables.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),await Promise.all(a)})))}t(null)}))}))),Promise.resolve(this)}async addRecords(e,t){let a=[];t?.cascadeAddRelationshipEndNodes&&this.dataManager.knowledgeGraph.dataModel&&(a=await C(e,this.dataManager.knowledgeGraph));const i=e.concat(a).filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));await this._handleNewRecords(i)}async removeRecords(e,{cascadeRemoveRelationships:t=!0,recalculateLayout:a=!1}={cascadeRemoveRelationships:!0,recalculateLayout:!1}){let i=[];for(const s of e)!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(s.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(s.typeName)?.members?.has(s.id)&&i.push(s);if(t){const e=new Set,t=[];for(const a of i)if(this.dataManager.nodeConnectionsLookup.has(a.id))for(const t of this.dataManager.nodeConnectionsLookup.get(a.id))e.add(t);for(const a of e)if(this.dataManager.memberIdTypeLookup.has(a))for(const e of this.dataManager.memberIdTypeLookup.get(a))this.dataManager.relationshipTypeNames.has(e)&&t.push({id:a,typeName:e});i=i.concat(t)}this.dataManager.removeFromLayer(i);for(const s of i)this.sublayerIdsCache.get(s.typeName)?.delete(s.id),this.dataManager.relationshipTypeNames.has(s.typeName)?this.relationshipLinkChartDiagramLookup.delete(s.id):this.entityLinkChartDiagramLookup.delete(s.id);a&&await this.calculateLinkChartLayout(this._currentLinkChartConfig.layoutMode,this._currentLinkChartConfig.layoutOptions);const n=[];return this.layers.forEach((e=>{n.push(e.refreshCachedQueryEngine())})),await Promise.all(n),this._refreshNamedTypes(),i}async expand(e,t){const a=await this.dataManager.getConnectedRecordIds(e,t),i=a.filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));return await this._handleNewRecords(a),{records:i}}loadLayerAssumingLocalCache(){this.memberRelationshipTypes.forEach((e=>{const t=new L({objectType:e,parentCompositeLayer:this,graphType:"relationship",title:e.name});t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.has(e.name)||this.dataManager.sublayerCaches.set(e.name,new Map)})),this.memberEntityTypes.forEach((e=>{const t=new L({objectType:e,parentCompositeLayer:this,graphType:"entity",title:e.name});t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.has(e.name)||this.dataManager.sublayerCaches.set(e.name,new Map)})),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{const a=n(this.sublayerIdsCache,t,(()=>new Set));e.members?.forEach((e=>{if(a.add(e.id),e.linkChartLocation)if(e.linkChartLocation instanceof d)this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e.id,e.linkChartLocation):this.entityLinkChartDiagramLookup.set(e.id,e.linkChartLocation);else{const a=l(e.linkChartLocation);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e.id,e.linkChartLocation?a:null):this.entityLinkChartDiagramLookup.set(e.id,e.linkChartLocation?a:null)}}))}))}async calculateLinkChartLayout(e="RADIAL_TREE",t){const n=[],s=[],o=[];this.dataManager.sublayerCaches.forEach(((e,t)=>{this.dataManager.entityTypeNames.has(t)?e.forEach((e=>{n.push({typeName:t,feature:e})})):this.dataManager.relationshipTypeNames.has(t)&&e.forEach((e=>{s.push({typeName:t,feature:e})}))})),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map;const r=new Map,h=new Map,d=new Map,p=new Map,c=new Uint8Array(n.length),L=new Float64Array(n.length),C=new Float64Array(n.length),k=new Uint32Array(s.length),w=new Uint32Array(s.length),I=[],j="FORCE_DIRECTED",P=new A({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let S,O="FORCE_DIRECTED",z=0,B=0;switch(O="GEOGRAPHIC"===e?j:e,O){case"FORCE_DIRECTED":S=x.apply;break;case"COMMUNITY":S=D.apply;break;case"HIERARCHICAL":S=T.apply;break;case"RADIAL_TREE":S=E.apply;break;case"SMART_TREE":S=b.apply;break;default:S=M.apply}n.forEach((({typeName:a,feature:i})=>{if(t?.lockedNodeLocations?.has(i.attributes[u])){"GEOGRAPHIC"===e&&this.dataManager.geographicLookup.has(a)?c[z]=N.IsGeographic:c[z]=N.None;const n=t.lockedNodeLocations.get(i.attributes[u]);L[z]=n.x,C[z]=n.y}else if("GEOGRAPHIC"===e&&this.dataManager.geographicLookup.has(a)){c[z]=N.IsGeographic;let e=null;const t=i.attributes[this.dataManager.geographicLookup.get(a).name],n=this.dataManager.geographicLookup.get(a)?.geometryType;switch(n){case"esriGeometryPoint":L[z]=t?.x,C[z]=t?.y;break;case"esriGeometryPolygon":e=t?.centroid,null!=e?.x&&null!=e?.y?(L[z]=e.x,C[z]=e.y):c[z]=N.IsMovable;break;case"esriGeometryPolyline":case"esriGeometryMultipoint":e=t?.extent?.center,null!=e?.x&&null!=e?.y?(L[z]=e.x,C[z]=e.y):c[z]=N.IsMovable;break;default:c[z]=N.IsMovable}(null==L[z]||null==C[z]||Number.isNaN(L[z])||Number.isNaN(C[z]))&&(c[z]=N.IsMovable,L[z]=0,C[z]=0)}else c[z]=N.IsMovable,L[z]=0,C[z]=0;p.set(i.attributes[u],z),I[z]={feature:i,typeName:a},z++}));let U=!1;const F=new Map;s.forEach((e=>{const t=e.feature.attributes[y],a=e.feature.attributes[g],i=p.get(t),n=p.get(a);if(void 0!==i&&void 0!==n){const s=t+"-"+a,r=F.get(s),h=r?.has(e.typeName);h||(k[B]=i,w[B]=n,void 0===r?F.set(s,new Map([[e.typeName,B]])):r.set(e.typeName,B),B++),o.push(e)}else U=!0,this.relationshipLinkChartDiagramLookup.set(t,null)})),U&&i.getLogger(this).warn("A relationship is a member of this layer that has either origin or destination entity nodes that are not members. The diagram geometry will be set to null");const H=this._validateLayoutSettings(e,t),Q=this._convertLayoutSettingsToCalculationSettings(H);await v();const{success:K,links:Y}=S(c,L,C,k.subarray(0,B),w.subarray(0,B),Q.computationBudgetTime,Q.idealEdgeLengthMultiplier,Q.repulsionRadiusMultiplier);if(!K)throw new a("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");for(let a=0;a<I.length;a++){if(C[a]>84.9999?C[a]=84.9999:C[a]<-84.9999&&(C[a]=-84.9999),L[a]>179.9999?L[a]=179.9999:L[a]<-179.9999&&(L[a]=-179.9999),I[a].feature.attributes[m]=new G(L[a],C[a]),r.has(I[a].typeName)){const e=r.get(I[a].typeName);e?.set(I[a].feature.attributes[u],I[a].feature)}else{const e=new Map;e.set(I[a].feature.attributes[u],I[a].feature),r.set(I[a].typeName,e)}d.set(I[a].feature.attributes[u],I[a].feature);const e=l(I[a].feature.attributes[m]);this.entityLinkChartDiagramLookup.set(I[a].feature.attributes[u],I[a].feature.attributes[m]?e:null),I[a].feature.attributes[m].x<P.xmin&&(P.xmin=I[a].feature.attributes[m].x),I[a].feature.attributes[m].x>P.xmax&&(P.xmax=I[a].feature.attributes[m].x),I[a].feature.attributes[m].y<P.ymin&&(P.ymin=I[a].feature.attributes[m].y),I[a].feature.attributes[m].y>P.ymax&&(P.ymax=I[a].feature.attributes[m].y)}if(this.linkChartExtent.xmin=P.xmin,this.linkChartExtent.xmax=P.xmax,this.linkChartExtent.ymin=P.ymin,this.linkChartExtent.ymax=P.ymax,!Y)throw new a("knowledge-graph:layout-failed","Attempting to retrieve link geometry from diagram engine failed");const $=new Map,W=new Map,q=new Map,J=new Set;for(let a=0;a<o.length;a++){const e=[],t=o[a],n=t.feature.attributes[y],s=t.feature.attributes[g],r=n+"-"+s,c=F.get(r).get(t.typeName),f=0===c?0:Y?.vertexEndIndex[c-1];if(!J.has(c)){if(J.add(c),Y.types[c]===R.Recursive){const t=[Y.vertices[2*f],Y.vertices[2*f+1]],a=[Y.vertices[2*(f+1)],Y.vertices[2*(f+1)+1]],i=[.5*(t[0]+a[0]),.5*(t[1]+a[1])],n=[i[0]-t[0],i[1]-t[1]],s=[i[0]+n[1],i[1]-n[0]],o=[i[0]-n[1],i[1]+n[0]];e.push(t),e.push(s),e.push(a),e.push(o),e.push(t)}else{if(Y.types[c]!==R.Regular){i.getLogger(this).warn("A relationship generated an unsupported link geometry type. It will not be rendered");continue}for(let t=f;t<Y.vertexEndIndex[c];t++)e.push([Y.vertices[2*t],Y.vertices[2*t+1]])}const t=I[p.get(n)]?.feature.attributes[m],a=I[p.get(s)]?.feature.attributes[m];e[0][0]===t.x&&e[0][1]===t.y||(e[0]=[t.x,t.y]),e[e.length-1][0]===a.x&&e[e.length-1][1]===a.y||(e[e.length-1]=[a.x,a.y]);for(let i=1;i<e.length-1;i++)e[i][1]>85.5?e[i][1]=85.5:e[i][1]<-85.5&&(e[i][1]=-85.5),e[i][0]>179.9999?e[i][0]=179.9999:e[i][0]<-179.9999&&(e[i][0]=-179.9999);$.has(r)?$.get(r).push(e):$.set(r,[e])}const L=$.get(r);W.has(r)||(W.set(r,new Map),q.set(r,new Map));const C=W.get(r),k=q.get(r);C.has(t.typeName)||(C.set(t.typeName,L.shift()),k.set(t.typeName,0));const w=C.get(t.typeName);k.set(t.typeName,k.get(t.typeName)+1);const M=new _({paths:w});if(t.feature.attributes[m]=M,h.has(t.typeName)){const e=h.get(t.typeName);e?.set(t.feature.attributes[u],t.feature)}else{const e=new Map;e.set(t.feature.attributes[u],t.feature),h.set(t.typeName,e)}d.set(t.feature.attributes[u],t.feature);const b=l(t.feature.attributes[m]);this.relationshipLinkChartDiagramLookup.set(t.feature.attributes[u],t.feature.attributes[m]?b:null)}for(const a of o)a.feature.attributes[f]=q.get(a.feature.attributes[y]+"-"+a.feature.attributes[g])?.get(a.typeName)??null;return this._currentLinkChartConfig={layoutMode:e,layoutOptions:H},{nodes:r,links:h,idMap:d}}async applyNewLinkChartLayout(e="RADIAL_TREE",t){const a=[];await this.calculateLinkChartLayout(e,t),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),await Promise.all(a),this._refreshNamedTypes()}getCurrentNodeLocations(){const e=new Map;return this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach((t=>{t?.members?.forEach((t=>{const a=t.linkChartLocation;let i;const n=t.id;a&&(i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]},e.set(n,new G({x:i.x,y:i.y})))}))})),e}async synchronizeInclusionListWithCache(){return new Promise((e=>{this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{if(e.useAllData=!1,e.members&&e.members.size>0){if(!this.dataManager.sublayerCaches.get(t))return;const a=new Set(Array.from(this.dataManager.sublayerCaches.get(t).keys()));Array.from(e.members.keys()).filter((e=>!a.has(e))).forEach((t=>{e.members?.delete(t)}))}})),e()}))}async refreshLinkChartCache(e){await this.dataManager.refreshCacheContent(e);const t=[];this.layers.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t),this._refreshNamedTypes()}async connectBetweenEntities(e){let t=[];for(const i of this.dataManager.relationshipTypeNames){const e=this.sublayerIdsCache.get(i);e&&(t=t.concat(Array.from(e.keys())))}const a=await this.dataManager.getRelationshipsBetweenNodes(e,t);return await this._handleNewRecords(a),{records:a}}async connectFromEntities(e){let t=[];for(const n of this.dataManager.relationshipTypeNames){const e=this.sublayerIdsCache.get(n);e&&(t=t.concat(Array.from(e.keys())))}let a=[];for(const n of this.dataManager.entityTypeNames){const e=this.sublayerIdsCache.get(n);e&&(a=a.concat(Array.from(e)))}const i=await this.dataManager.getRelationshipsFromNodes(e,a,t);return await this._handleNewRecords(i),{records:i}}async _handleNewRecords(e){const t=[];this.dataManager.addToLayer(e);for(const i of e)this.sublayerIdsCache.has(i.typeName)||(this.sublayerIdsCache.set(i.typeName,new Set),t.push(i.typeName)),this.sublayerIdsCache.get(i.typeName).add(i.id);for(const i of t){const e=this._graphTypeLookup.get(i);if(e){const t=new L({objectType:e,parentCompositeLayer:this,graphType:e.type,title:i});"entity"===e.type?this.dataManager.entityTypeNames.add(i):this.dataManager.relationshipTypeNames.add(i),t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.set(i,new Map)}}await this.dataManager.refreshCacheContent(e.map((e=>e.id)));const a=Object.assign({},this._currentLinkChartConfig.layoutOptions);a.lockedNodeLocations=new Map;for(const[i,n]of this.entityLinkChartDiagramLookup.entries())n&&a.lockedNodeLocations.set(i,new G(n.coords[0],n.coords[1]));console.log("Applying new layout with locked locations: ",a.lockedNodeLocations),await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode,a)}async _initializeDiagram(){this.defaultLinkChartConfig?this.defaultLinkChartConfig.doNotRecalculateLayout?(this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e?.members?.forEach((e=>{const a=e.linkChartLocation;let i;const n=e.id;if(!a)return;i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]};const s=l(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(n,s):this.entityLinkChartDiagramLookup.set(n,s),this.linkChartExtent.xmin>i.x&&(this.linkChartExtent.xmin=i.x),this.linkChartExtent.xmax<i.x&&(this.linkChartExtent.xmax=i.x),this.linkChartExtent.ymin>i.y&&(this.linkChartExtent.ymin=i.y),this.linkChartExtent.ymax<i.y&&(this.linkChartExtent.ymax=i.y)}))})),this.memberRelationshipTypes.forEach((e=>{e.name&&this.dataManager.sublayerCaches.get(e.name)?.forEach((e=>{const t=this.relationshipLinkChartDiagramLookup.get(e.attributes[y]),a=this.relationshipLinkChartDiagramLookup.get(e.attributes[g]);if(t&&a){const i=l(new _({paths:[[t.coords[0],t.coords[1]],[a.coords[0],a.coords[1]]]}));this.relationshipLinkChartDiagramLookup.set(e.attributes[u],i)}else this.relationshipLinkChartDiagramLookup.set(e.attributes[u],null)}))}))):await this.calculateLinkChartLayout(this.defaultLinkChartConfig.layoutMode,{lockedNodeLocations:this.getCurrentNodeLocations(),...this.defaultLinkChartConfig.layoutOptions||{}}):await this.calculateLinkChartLayout("RADIAL_TREE",{lockedNodeLocations:this.getCurrentNodeLocations()})}_refreshNamedTypes(){for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}_validateLayoutSettings(e,t){const a=e=>"number"==typeof e&&!isNaN(e),n=e=>a(e)&&e>=1,s=e=>a(e)&&e>=1,o=e=>Object.values(p).includes(e),r=e=>a(e)&&e>=0,h=new Set(["FORCE_DIRECTED","COMMUNITY","GEOGRAPHIC"]),l={};if(!h.has(e)||!t)return!h.has(e)&&t&&i.getLogger(this).warn("Layout mode options were given for a layout mode that does not utilize them, settings will be ignored"),l;const{computationBudgetTime:d,repulsionRadiusMultiplier:c,idealEdgeLength:u,idealEdgeLengthType:y}=t;s(d)?l.computationBudgetTime=d:void 0!==d&&i.getLogger(this).warn("Invalid layout computationBudgetTime setting, will revert to default setting"),n(c)?l.repulsionRadiusMultiplier=c:void 0!==c&&i.getLogger(this).warn("Invalid layout repulsionRadiusMultiplier setting, will revert to default setting");const g=void 0!==u||void 0!==y;return"GEOGRAPHIC"!==e&&g?i.getLogger(this).warn("Ideal edge length settings were specified for an incompatible layout mode, and will be ignored"):"GEOGRAPHIC"===e&&g&&(o(y)?l.idealEdgeLengthType=y:void 0!==y&&i.getLogger(this).warn('Invalid layout idealEdgeLengthType setting, will revert to "multiplier" setting'),r(u)?l.idealEdgeLength=u:void 0!==u&&i.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting")),l}_convertLayoutSettingsToCalculationSettings(e){let t=e.idealEdgeLength;return e.idealEdgeLengthType===p.ABSOLUTE&&(void 0===t?t=-1:t*=-1),{computationBudgetTime:e.computationBudgetTime,repulsionRadiusMultiplier:e.repulsionRadiusMultiplier,idealEdgeLengthMultiplier:t}}};e([o()],j.prototype,"dataPreloadedInLocalCache",void 0),e([o()],j.prototype,"defaultLinkChartConfig",void 0),e([o()],j.prototype,"dataManager",void 0),e([o()],j.prototype,"knowledgeGraph",void 0),e([o()],j.prototype,"layers",void 0),e([o()],j.prototype,"entityLinkChartDiagramLookup",void 0),e([o()],j.prototype,"relationshipLinkChartDiagramLookup",void 0),e([o()],j.prototype,"linkChartExtent",void 0),e([o()],j.prototype,"memberEntityTypes",void 0),e([o()],j.prototype,"memberRelationshipTypes",void 0),e([o()],j.prototype,"sublayerIdsCache",void 0),e([o()],j.prototype,"tables",void 0),e([o({json:{read:!1}})],j.prototype,"type",void 0),j=e([r("esri.layers.LinkChartLayer")],j);const P=j;export{P as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import t from"../core/Collection.js";import a from"../core/Error.js";import i from"../core/Logger.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{throwIfAborted as o}from"../core/promiseUtils.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import l from"./Layer.js";import{convertFromGeometry as h}from"./graphics/featureConversionUtils.js";import d from"./graphics/OptimizedGeometry.js";import{IdealEdgeLengthTypeOptions as p}from"./knowledgeGraph/IdealEdgeLengthTypeOptions.js";import{KnowledgeGraphLayerDataManager as u,mockOidFieldName as c,mockOriginIdFieldName as y,mockDestinationIdFieldName as g,mockLayoutGeometryFieldName as m,mockAggregationCountFieldName as f}from"./knowledgeGraph/KnowledgeGraphLayerDataManager.js";import L from"./knowledgeGraph/KnowledgeGraphSublayer.js";import{getRelationshipEndNodeIds as C}from"./knowledgeGraph/supportUtils.js";import{BlendLayer as k}from"./mixins/BlendLayer.js";import{ScaleRangeLayer as w}from"./mixins/ScaleRangeLayer.js";import{LCChronologicalLayout as M,LCSimpleLayout as b,LCSmartTreeLayout as T,LCRadialTreeLayout as E,LCHierarchicalLayout as D,LCCommunityLayout as N,LCForceDirectedLayout as x,NodeFlag as I,load as R,LinkType as v}from"../libs/linkchartlayout/LinkChartLayout.js";import{fetchKnowledgeGraph as A}from"../rest/knowledgeGraphService.js";import G from"../geometry/Extent.js";import _ from"../geometry/Point.js";import O from"../geometry/Polyline.js";let j=class extends(k(w(l))){constructor(e){if(super(e),this.dataPreloadedInLocalCache=!1,this.defaultLinkChartConfig=null,this._currentLinkChartConfig={layoutMode:"RADIAL_TREE"},this._graphTypeLookup=new Map,this.dataManager=null,this.knowledgeGraph=null,this.layers=new t,this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map,this.linkChartExtent=new G({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7}),this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.sublayerIdsCache=new Map,this.tables=new t,this.type="link-chart",this.chronologicalAuxiliaryGraphics=null,this._originalInclusionList=e.inclusionModeDefinition,e.dataPreloadedInLocalCache&&!e.inclusionModeDefinition)throw new a("knowledge-graph:linkchart-layer-constructor","If creating a link chart composite layer and configured that data is already loaded in the cache, you must specify an inclusion list so the Composite Layer knows what records belong to it")}normalizeCtorArgs(e){return{url:e.url,title:e.title,dataPreloadedInLocalCache:e.dataPreloadedInLocalCache,defaultLinkChartConfig:e.defaultLinkChartConfig}}_initializeLayerProperties(e){if(!this.title&&this.url){const e=this.url.split("/");this.title=e[e.length-2]}const t=new Set;let n=[],o=[];if(e.inclusionModeDefinition&&(!e.inclusionModeDefinition.namedTypeDefinitions||e.inclusionModeDefinition.namedTypeDefinitions.size<1))throw new a("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined");e.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),e.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),e.inclusionModeDefinition?.generateAllSublayers?(n=e.knowledgeGraph.dataModel.entityTypes??[],o=e.knowledgeGraph.dataModel.relationshipTypes??[]):e.inclusionModeDefinition?.namedTypeDefinitions&&e.inclusionModeDefinition?.namedTypeDefinitions.size>0?e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((a,s)=>{const r=this._graphTypeLookup.get(s);if(!r)return i.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(s);"relationship"===r.type?t.has(s)||(t.add(s),o.push(r)):"entity"===r.type?t.has(s)||(t.add(s),n.push(r)):(i.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't properly modeled and will be removed`),e.inclusionModeDefinition?.namedTypeDefinitions.delete(s))})):(n=e.knowledgeGraph.dataModel.entityTypes??[],o=e.knowledgeGraph.dataModel.relationshipTypes??[]);const s=new u({knowledgeGraph:e.knowledgeGraph,inclusionModeDefinition:e.inclusionModeDefinition});this.knowledgeGraph=e.knowledgeGraph,this.memberEntityTypes=n,this.memberRelationshipTypes=o,this.dataManager=s}load(e){return this.addResolvingPromise(new Promise((t=>{A(this.url).then((a=>{if(this._initializeLayerProperties({knowledgeGraph:a,inclusionModeDefinition:this._originalInclusionList}),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.size||(this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map},this.dataManager.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})})),this.dataManager.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})}))),this.dataPreloadedInLocalCache)this.loadLayerAssumingLocalCache(),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach((e=>{e.useAllData=!1,e.members?.forEach((e=>{let t;t=e.linkChartLocation instanceof d?e.linkChartLocation:e.linkChartLocation?h(e.linkChartLocation):null,t&&2===t.coords.length&&0===t.lengths.length?this.entityLinkChartDiagramLookup.set(e.id,t):this.relationshipLinkChartDiagramLookup.set(e.id,t)})),this.addResolvingPromise(this._initializeDiagram().then((async()=>{this.layers.forEach((async e=>{await e.refreshCachedQueryEngine()})),this.tables.forEach((async e=>{await e.refreshCachedQueryEngine()}))})))}));else{const t="GEOGRAPHIC"===this.defaultLinkChartConfig?.layoutMode;this.addResolvingPromise(this.dataManager.refreshCacheContent(void 0,!1,t,!0).then((async()=>{o(e);const t=[],a=[];this.loadLayerAssumingLocalCache(),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1,this.dataManager.inclusionModeDefinition.namedTypeDefinitions.forEach((e=>{e.useAllData=!1}))),await this._initializeDiagram(),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine()),t.push(new Promise((t=>{e.on("layerview-create",(()=>{t(null)}))})))})),this.tables.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),await Promise.all(a)})))}t(null)}))}))),Promise.resolve(this)}async addRecords(e,t){let a=[];t?.cascadeAddRelationshipEndNodes&&this.dataManager.knowledgeGraph.dataModel&&(a=await C(e,this.dataManager.knowledgeGraph));const i=e.concat(a).filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));await this._handleNewRecords(i)}async removeRecords(e,{cascadeRemoveRelationships:t=!0,recalculateLayout:a=!1}={cascadeRemoveRelationships:!0,recalculateLayout:!1}){let i=[];for(const o of e)!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(o.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(o.typeName)?.members?.has(o.id)&&i.push(o);if(t){const e=new Set,t=[];for(const a of i)if(this.dataManager.nodeConnectionsLookup.has(a.id))for(const t of this.dataManager.nodeConnectionsLookup.get(a.id))e.add(t);for(const a of e)if(this.dataManager.memberIdTypeLookup.has(a))for(const e of this.dataManager.memberIdTypeLookup.get(a))this.dataManager.relationshipTypeNames.has(e)&&t.push({id:a,typeName:e});i=i.concat(t)}this.dataManager.removeFromLayer(i);for(const o of i)this.sublayerIdsCache.get(o.typeName)?.delete(o.id),this.dataManager.relationshipTypeNames.has(o.typeName)?this.relationshipLinkChartDiagramLookup.delete(o.id):this.entityLinkChartDiagramLookup.delete(o.id);a&&await this._calculateLayoutWithSublayerTimeInfo(this._currentLinkChartConfig.layoutMode,this._currentLinkChartConfig.layoutOptions);const n=[];return this.layers.forEach((e=>{n.push(e.refreshCachedQueryEngine())})),await Promise.all(n),this._refreshNamedTypes(),i}async expand(e,t){const a=await this.dataManager.getConnectedRecordIds(e,t),i=a.filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));return await this._handleNewRecords(a),{records:i}}loadLayerAssumingLocalCache(){this.memberRelationshipTypes.forEach((e=>{const t=new L({objectType:e,parentCompositeLayer:this,graphType:"relationship",title:e.name});t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.has(e.name)||this.dataManager.sublayerCaches.set(e.name,new Map)})),this.memberEntityTypes.forEach((e=>{const t=new L({objectType:e,parentCompositeLayer:this,graphType:"entity",title:e.name});t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.has(e.name)||this.dataManager.sublayerCaches.set(e.name,new Map)})),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{const a=n(this.sublayerIdsCache,t,(()=>new Set));e.members?.forEach((e=>{if(a.add(e.id),e.linkChartLocation)if(e.linkChartLocation instanceof d)this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e.id,e.linkChartLocation):this.entityLinkChartDiagramLookup.set(e.id,e.linkChartLocation);else{const a=h(e.linkChartLocation);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e.id,e.linkChartLocation?a:null):this.entityLinkChartDiagramLookup.set(e.id,e.linkChartLocation?a:null)}}))}))}async calculateLinkChartLayout(e="RADIAL_TREE",t){const n=[],o=[],s=[];this.dataManager.sublayerCaches.forEach(((e,t)=>{this.dataManager.entityTypeNames.has(t)?e.forEach((e=>{n.push({typeName:t,feature:e})})):this.dataManager.relationshipTypeNames.has(t)&&e.forEach((e=>{o.push({typeName:t,feature:e})}))})),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map;const r=new Map,l=new Map,d=new Map,p=new Map,u=new Uint8Array(n.length),L=new Float64Array(n.length),C=new Float64Array(n.length),k=new Float64Array(n.length),w=new Float64Array(n.length),A=new Uint32Array(o.length),j=new Uint32Array(o.length),P=new Float64Array(o.length),S=new Float64Array(o.length),F=[],B="FORCE_DIRECTED",H=new G({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let z,U="FORCE_DIRECTED",Q=0,W=0;const K=M.apply;switch(U="GEOGRAPHIC"===e?B:e,U){case"FORCE_DIRECTED":z=x.apply;break;case"COMMUNITY":z=N.apply;break;case"HIERARCHICAL":z=D.apply;break;case"RADIAL_TREE":z=E.apply;break;case"SMART_TREE":z=T.apply;break;default:z=b.apply}let Y=!1;n.forEach((({typeName:a,feature:i})=>{if("CHRONOLOGICAL"!==e&&t?.lockedNodeLocations?.has(i.attributes[c])){"GEOGRAPHIC"===e&&this.dataManager.geographicLookup.has(a)?u[Q]=I.IsGeographic:u[Q]=I.None;const n=t.lockedNodeLocations.get(i.attributes[c]);L[Q]=n.x,C[Q]=n.y}else if("GEOGRAPHIC"===e&&this.dataManager.geographicLookup.has(a)){u[Q]=I.IsGeographic;let e=null;const t=i.attributes[this.dataManager.geographicLookup.get(a).name],n=this.dataManager.geographicLookup.get(a)?.geometryType;switch(n){case"esriGeometryPoint":L[Q]=t?.x,C[Q]=t?.y;break;case"esriGeometryPolygon":e=t?.centroid,null!=e?.x&&null!=e?.y?(L[Q]=e.x,C[Q]=e.y):u[Q]=I.IsMovable;break;case"esriGeometryPolyline":case"esriGeometryMultipoint":e=t?.extent?.center,null!=e?.x&&null!=e?.y?(L[Q]=e.x,C[Q]=e.y):u[Q]=I.IsMovable;break;default:u[Q]=I.IsMovable}(null==L[Q]||null==C[Q]||Number.isNaN(L[Q])||Number.isNaN(C[Q]))&&(u[Q]=I.IsMovable,L[Q]=0,C[Q]=0)}else if("CHRONOLOGICAL"===e){!Y&&t?.lockedNodeLocations?.has(i.attributes[c])&&(Y=!0);const e=t?.timeInfoByTypeName?.get(a),n=e?.startField,o=n&&e?.startField?i.attributes[n]:null;k[Q]=o?new Date(o).getTime():NaN;const s=e?.endField,r=s&&e?.endField?i.attributes[s]:null;w[Q]=r?new Date(r).getTime():NaN,L[Q]=0,C[Q]=0,u[Q]=I.IsMovable}else u[Q]=I.IsMovable,L[Q]=0,C[Q]=0;p.set(i.attributes[c],Q),F[Q]={feature:i,typeName:a},Q++})),Y&&i.getLogger(this).warn("Locked node locations are not supported for chronological layout at this time. Requested node locations were ignored");let $=!1;const q=new Map;o.forEach((a=>{const i=a.feature.attributes[y],n=a.feature.attributes[g],o=p.get(i),r=p.get(n),l=t?.timeInfoByTypeName?.get(a.typeName),h=t?.timeInfoByTypeName?l?.startField:null,d=h?a.feature.attributes[h]:null,u=l?.endField,c=u?a.feature.attributes[u]:null;if(void 0!==o&&void 0!==r){let t=i+"-"+n;"CHRONOLOGICAL"===e&&(t=t+"-"+d+"-"+c);const l=q.get(t),h=l?.has(a.typeName);h||(A[W]=o,j[W]=r,"CHRONOLOGICAL"===e&&(P[W]=d?new Date(d).getTime():NaN,S[W]=c?new Date(c).getTime():NaN),void 0===l?q.set(t,new Map([[a.typeName,W]])):l.set(a.typeName,W),W++),s.push(a)}else $=!0,this.relationshipLinkChartDiagramLookup.set(i,null)})),$&&i.getLogger(this).warn("A relationship is a member of this layer that has either origin or destination entity nodes that are not members. The diagram geometry will be set to null");const J=this._validateLayoutSettings(e,t),V=this._convertLayoutSettingsToCalculationSettings(J);await R();let X=!1,Z=null;if("CHRONOLOGICAL"===e){let e;({success:X,links:Z,graphics:e}=K(u,L,C,k,w,A.subarray(0,W),j.subarray(0,W),P.subarray(0,W),S.subarray(0,W))),X&&(this.chronologicalAuxiliaryGraphics=e)}else({success:X,links:Z}=z(u,L,C,A.subarray(0,W),j.subarray(0,W),V.computationBudgetTime,V.idealEdgeLengthMultiplier,V.repulsionRadiusMultiplier));if(!X)throw new a("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");for(let a=0;a<F.length;a++){if(C[a]>84.9999?C[a]=84.9999:C[a]<-84.9999&&(C[a]=-84.9999),L[a]>179.9999?L[a]=179.9999:L[a]<-179.9999&&(L[a]=-179.9999),F[a].feature.attributes[m]=new _(L[a],C[a]),r.has(F[a].typeName)){const e=r.get(F[a].typeName);e?.set(F[a].feature.attributes[c],F[a].feature)}else{const e=new Map;e.set(F[a].feature.attributes[c],F[a].feature),r.set(F[a].typeName,e)}d.set(F[a].feature.attributes[c],F[a].feature);const e=h(F[a].feature.attributes[m]);this.entityLinkChartDiagramLookup.set(F[a].feature.attributes[c],F[a].feature.attributes[m]?e:null),F[a].feature.attributes[m].x<H.xmin&&(H.xmin=F[a].feature.attributes[m].x),F[a].feature.attributes[m].x>H.xmax&&(H.xmax=F[a].feature.attributes[m].x),F[a].feature.attributes[m].y<H.ymin&&(H.ymin=F[a].feature.attributes[m].y),F[a].feature.attributes[m].y>H.ymax&&(H.ymax=F[a].feature.attributes[m].y)}if(this.linkChartExtent.xmin=H.xmin,this.linkChartExtent.xmax=H.xmax,this.linkChartExtent.ymin=H.ymin,this.linkChartExtent.ymax=H.ymax,!Z)throw new a("knowledge-graph:layout-failed","Attempting to retrieve link geometry from diagram engine failed");const ee=new Map,te=new Map,ae=new Map,ie=new Set;for(let a=0;a<s.length;a++){const n=[],o=s[a],r=o.feature.attributes[y],u=o.feature.attributes[g];let f=r+"-"+u;if("CHRONOLOGICAL"===e){const e=t?.timeInfoByTypeName?.get(o.typeName),a=t?.timeInfoByTypeName?e?.startField:null,i=a?o.feature.attributes[a]:null,n=e?.endField;f+="-"+i+"-"+(n?o.feature.attributes[n]:null)}const L=q.get(f).get(o.typeName),C=0===L?0:Z?.vertexEndIndex[L-1];if(!ie.has(L)){if(ie.add(L),Z.types[L]===v.Recursive){const e=[Z.vertices[2*C],Z.vertices[2*C+1]],t=[Z.vertices[2*(C+1)],Z.vertices[2*(C+1)+1]],a=[.5*(e[0]+t[0]),.5*(e[1]+t[1])],i=[a[0]-e[0],a[1]-e[1]],o=[a[0]+i[1],a[1]-i[0]],s=[a[0]-i[1],a[1]+i[0]];n.push(e),n.push(o),n.push(t),n.push(s),n.push(e)}else{if(Z.types[L]!==v.Regular){i.getLogger(this).warn("A relationship generated an unsupported link geometry type. It will not be rendered");continue}for(let e=C;e<Z.vertexEndIndex[L];e++)n.push([Z.vertices[2*e],Z.vertices[2*e+1]])}if("CHRONOLOGICAL"!==e){const e=F[p.get(r)]?.feature.attributes[m],t=F[p.get(u)]?.feature.attributes[m];n[0][0]===e.x&&n[0][1]===e.y||(n[0]=[e.x,e.y]),n[n.length-1][0]===t.x&&n[n.length-1][1]===t.y||(n[n.length-1]=[t.x,t.y])}for(let e=1;e<n.length-1;e++)n[e][1]>85.5?n[e][1]=85.5:n[e][1]<-85.5&&(n[e][1]=-85.5),n[e][0]>179.9999?n[e][0]=179.9999:n[e][0]<-179.9999&&(n[e][0]=-179.9999);ee.has(f)?ee.get(f).push(n):ee.set(f,[n])}const k=ee.get(f);te.has(f)||(te.set(f,new Map),ae.set(f,new Map));const w=te.get(f),M=ae.get(f);w.has(o.typeName)||(w.set(o.typeName,k.shift()),M.set(o.typeName,0));const b=w.get(o.typeName);M.set(o.typeName,M.get(o.typeName)+1);const T=new O({paths:b});if(o.feature.attributes[m]=T,l.has(o.typeName)){const e=l.get(o.typeName);e?.set(o.feature.attributes[c],o.feature)}else{const e=new Map;e.set(o.feature.attributes[c],o.feature),l.set(o.typeName,e)}d.set(o.feature.attributes[c],o.feature);const E=h(o.feature.attributes[m]);this.relationshipLinkChartDiagramLookup.set(o.feature.attributes[c],o.feature.attributes[m]?E:null)}for(const a of s)a.feature.attributes[f]=ae.get(a.feature.attributes[y]+"-"+a.feature.attributes[g])?.get(a.typeName)??null;return this._currentLinkChartConfig={layoutMode:e,layoutOptions:J},{nodes:r,links:l,idMap:d}}async applyNewLinkChartLayout(e="RADIAL_TREE",t){const a=[];await this._calculateLayoutWithSublayerTimeInfo(e,t),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),await Promise.all(a),this._refreshNamedTypes()}getCurrentNodeLocations(){const e=new Map;return this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach((t=>{t?.members?.forEach((t=>{const a=t.linkChartLocation;let i;const n=t.id;a&&(i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]},e.set(n,new _({x:i.x,y:i.y})))}))})),e}async synchronizeInclusionListWithCache(){return new Promise((e=>{this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach(((e,t)=>{if(e.useAllData=!1,e.members&&e.members.size>0){if(!this.dataManager.sublayerCaches.get(t))return;const a=new Set(Array.from(this.dataManager.sublayerCaches.get(t).keys()));Array.from(e.members.keys()).filter((e=>!a.has(e))).forEach((t=>{e.members?.delete(t)}))}})),e()}))}async refreshLinkChartCache(e){await this.dataManager.refreshCacheContent(e);const t=[];this.layers.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t),this._refreshNamedTypes()}async connectBetweenEntities(e){let t=[];for(const i of this.dataManager.relationshipTypeNames){const e=this.sublayerIdsCache.get(i);e&&(t=t.concat(Array.from(e.keys())))}const a=await this.dataManager.getRelationshipsBetweenNodes(e,t);return await this._handleNewRecords(a),{records:a}}async connectFromEntities(e){let t=[];for(const n of this.dataManager.relationshipTypeNames){const e=this.sublayerIdsCache.get(n);e&&(t=t.concat(Array.from(e.keys())))}let a=[];for(const n of this.dataManager.entityTypeNames){const e=this.sublayerIdsCache.get(n);e&&(a=a.concat(Array.from(e)))}const i=await this.dataManager.getRelationshipsFromNodes(e,a,t);return await this._handleNewRecords(i),{records:i}}getCurrentLayout(){return this._currentLinkChartConfig.layoutMode}async _calculateLayoutWithSublayerTimeInfo(e="RADIAL_TREE",t){const a=new Map;this.layers.forEach((e=>{a.set(e.objectType.name,e.timeInfo)})),await this.calculateLinkChartLayout(e,{timeInfoByTypeName:a,...t})}async _handleNewRecords(e){const t=[];this.dataManager.addToLayer(e);for(const i of e)this.sublayerIdsCache.has(i.typeName)||(this.sublayerIdsCache.set(i.typeName,new Set),t.push(i.typeName)),this.sublayerIdsCache.get(i.typeName).add(i.id);for(const i of t){const e=this._graphTypeLookup.get(i);if(e){const t=new L({objectType:e,parentCompositeLayer:this,graphType:e.type,title:i});"entity"===e.type?this.dataManager.entityTypeNames.add(i):this.dataManager.relationshipTypeNames.add(i),t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.set(i,new Map)}}await this.dataManager.refreshCacheContent(e.map((e=>e.id)));const a=Object.assign({},this._currentLinkChartConfig.layoutOptions);a.lockedNodeLocations=new Map;for(const[i,n]of this.entityLinkChartDiagramLookup.entries())n&&a.lockedNodeLocations.set(i,new _(n.coords[0],n.coords[1]));console.log("Applying new layout with locked locations: ",a.lockedNodeLocations),await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode,a)}async _initializeDiagram(){this.defaultLinkChartConfig?this.defaultLinkChartConfig.doNotRecalculateLayout?(this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e?.members?.forEach((e=>{const a=e.linkChartLocation;let i;const n=e.id;if(!a)return;i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]};const o=h(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(n,o):this.entityLinkChartDiagramLookup.set(n,o),this.linkChartExtent.xmin>i.x&&(this.linkChartExtent.xmin=i.x),this.linkChartExtent.xmax<i.x&&(this.linkChartExtent.xmax=i.x),this.linkChartExtent.ymin>i.y&&(this.linkChartExtent.ymin=i.y),this.linkChartExtent.ymax<i.y&&(this.linkChartExtent.ymax=i.y)}))})),this.memberRelationshipTypes.forEach((e=>{e.name&&this.dataManager.sublayerCaches.get(e.name)?.forEach((e=>{const t=this.relationshipLinkChartDiagramLookup.get(e.attributes[y]),a=this.relationshipLinkChartDiagramLookup.get(e.attributes[g]);if(t&&a){const i=h(new O({paths:[[t.coords[0],t.coords[1]],[a.coords[0],a.coords[1]]]}));this.relationshipLinkChartDiagramLookup.set(e.attributes[c],i)}else this.relationshipLinkChartDiagramLookup.set(e.attributes[c],null)}))}))):await this._calculateLayoutWithSublayerTimeInfo(this.defaultLinkChartConfig.layoutMode,{lockedNodeLocations:this.getCurrentNodeLocations(),...this.defaultLinkChartConfig.layoutOptions||{}}):await this._calculateLayoutWithSublayerTimeInfo("RADIAL_TREE",{lockedNodeLocations:this.getCurrentNodeLocations()})}_refreshNamedTypes(){for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}_validateLayoutSettings(e,t){const a=e=>"number"==typeof e&&!isNaN(e),n=e=>a(e)&&e>=1,o=e=>a(e)&&e>=1,s=e=>Object.values(p).includes(e),r=e=>a(e)&&e>=0,l=new Set(["FORCE_DIRECTED","COMMUNITY","GEOGRAPHIC"]),h={};if(!l.has(e)||!t)return!l.has(e)&&t&&i.getLogger(this).warn("Layout mode options were given for a layout mode that does not utilize them, settings will be ignored"),h;const{computationBudgetTime:d,repulsionRadiusMultiplier:u,idealEdgeLength:c,idealEdgeLengthType:y}=t;o(d)?h.computationBudgetTime=d:void 0!==d&&i.getLogger(this).warn("Invalid layout computationBudgetTime setting, will revert to default setting"),n(u)?h.repulsionRadiusMultiplier=u:void 0!==u&&i.getLogger(this).warn("Invalid layout repulsionRadiusMultiplier setting, will revert to default setting");const g=void 0!==c||void 0!==y;return"GEOGRAPHIC"!==e&&g?i.getLogger(this).warn("Ideal edge length settings were specified for an incompatible layout mode, and will be ignored"):"GEOGRAPHIC"===e&&g&&(s(y)?h.idealEdgeLengthType=y:void 0!==y&&i.getLogger(this).warn('Invalid layout idealEdgeLengthType setting, will revert to "multiplier" setting'),r(c)?h.idealEdgeLength=c:void 0!==c&&i.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting")),h}_convertLayoutSettingsToCalculationSettings(e){let t=e.idealEdgeLength;return e.idealEdgeLengthType===p.ABSOLUTE&&(void 0===t?t=-1:t*=-1),{computationBudgetTime:e.computationBudgetTime,repulsionRadiusMultiplier:e.repulsionRadiusMultiplier,idealEdgeLengthMultiplier:t}}};e([s()],j.prototype,"dataPreloadedInLocalCache",void 0),e([s()],j.prototype,"defaultLinkChartConfig",void 0),e([s()],j.prototype,"dataManager",void 0),e([s()],j.prototype,"knowledgeGraph",void 0),e([s()],j.prototype,"layers",void 0),e([s()],j.prototype,"entityLinkChartDiagramLookup",void 0),e([s()],j.prototype,"relationshipLinkChartDiagramLookup",void 0),e([s()],j.prototype,"linkChartExtent",void 0),e([s()],j.prototype,"memberEntityTypes",void 0),e([s()],j.prototype,"memberRelationshipTypes",void 0),e([s()],j.prototype,"sublayerIdsCache",void 0),e([s()],j.prototype,"tables",void 0),e([s({json:{read:!1}})],j.prototype,"type",void 0),e([s({json:{read:!1}})],j.prototype,"chronologicalAuxiliaryGraphics",void 0),j=e([r("esri.layers.LinkChartLayer")],j);const P=j;export{P as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{C as s}from"../../../chunks/CypherListener.js";class e extends s{constructor(){super(...arguments),this.bindParams=[],this.enterOC_Parameter=s=>{this.bindParams.push(s.getText())}}}export{e as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{ErrorListener as r}from"../../../chunks/antlr4.web.js";class s extends r{constructor(){super(...arguments),this.errors=null}syntaxError(r,s,e,t,o,n){this.errors||(this.errors=[]),this.errors.push({line:e,column:t,msg:o,e:n})}}export{s as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
async function r(r){const{CharStream:e,CommonTokenStream:a,ParseTreeWalker:t}=await import("../../chunks/antlr4.web.js"),{default:n}=await import("./antlr/BindParamsListener.js"),{default:s}=await import("../../chunks/CypherLexer.js"),{default:o}=await import("../../chunks/CypherParser.js"),{default:i}=await import("./antlr/SimpleErrorListener.js"),m=new i,w=new s(new e(r));w.removeErrorListeners(),w.addErrorListener(m);const p=new o(new a(w));p.removeErrorListeners(),p.addErrorListener(m);const d=p.oC_Cypher(),l=new n;return(new t).walk(l,d),{bindParameters:Array.from(new Set(l.bindParams)).map((r=>r.slice(1))),parseErrors:m.errors}}export{r as getBindParamsFromCypherQuery};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../request.js";import t from"../../core/Error.js";import{getOrCreateMapValue as r}from"../../core/MapUtils.js";import{convertFromGeometry as n}from"../graphics/featureConversionUtils.js";import s from"../graphics/OptimizedGeometry.js";import{executeQueryStreaming as i}from"../../rest/knowledgeGraphService.js";import a from"../../rest/knowledgeGraph/GraphQueryStreaming.js";import{ProtoOutboundRelationshipFeatureCollectionAttributionIndexes as o,ProtoInboundFeatureCollectionAttributionNames as l,ProtoOutboundEntityFeatureCollectionAttributionIndexes as c}from"../../rest/knowledgeGraph/ProtoFeatureCollection.js";import{getWasmInterface as d}from"../../rest/knowledgeGraph/wasmInterface/knowledgeWasmAccess.js";import{EsriFieldTypes as p}from"../../rest/knowledgeGraph/wasmInterface/WasmDataModelWrapperInterfaces.js";import{WasmQuantizeOriginPositionTypeCode as f,SqlTypeCode as u,IdArrayType as m}from"../../rest/knowledgeGraph/wasmInterface/WasmSerializedLayerData.js";import{wasmToProtoFeatureCollection as y}from"../../rest/knowledgeGraph/wasmInterface/wasmToFeatureFactories.js";function w(e){if(!e.spatialReference.isWGS84)throw new t("knowledge-graph:layer-support-utils","The extentToInBoundsRings function only supports WGS84 spatial references.");return e.clone().normalize().map((e=>[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]))}async function h(e,t){const r=[],n=new Map,s=[];if(t.dataModel?.relationshipTypes)for(const i of t.dataModel.relationshipTypes)i.name&&n.set(i.name,[]);for(const i of e)n.has(i.typeName)&&n.get(i.typeName)?.push(i.id);for(const[o,l]of n){if(l.length<1)continue;const e=new a({openCypherQuery:`MATCH (n)-[r:${o}]->(m) WHERE id(r) in $ids RETURN id(n), labels(n)[0], id(m), labels(m)[0]`,bindParameters:{ids:l}});s.push(i(t,e).then((async e=>{const t=e.resultRowsStream.getReader();for(;;){const{done:e,value:n}=await t.read();if(e)break;for(const t of n)r.push({id:t[0],typeName:t[1]}),r.push({id:t[2],typeName:t[3]})}})))}return await Promise.all(s),r}async function _(e,t){const r=new Map,n=new Map,s=[];if(t.dataModel?.relationshipTypes)for(const i of t.dataModel.relationshipTypes)i.name&&n.set(i.name,[]);for(const i of e)n.has(i.typeName)&&n.get(i.typeName)?.push(i.id);for(const[o,l]of n){if(l.length<1)continue;const e=new a({openCypherQuery:`MATCH (n)-[r:${o}]->(m) WHERE id(r) in $ids RETURN id(r), id(n), id(m)`,bindParameters:{ids:l}});s.push(i(t,e).then((async e=>{const t=e.resultRowsStream.getReader();for(;;){const{done:e,value:n}=await t.read();if(e)break;for(const t of n)r.set(t[0],[t[1],t[2]])}})))}return await Promise.all(s),r}async function g(e){const t=[],r={generateAllSublayers:!1,namedTypeDefinitions:new Map};return e.entitiesUrl&&t.push(F(e.entitiesUrl).then((e=>{C(e,r)}))),e.relationshipsUrl&&t.push(F(e.relationshipsUrl).then((e=>{C(e,r)}))),e.idCollectionsUrl&&t.push(I(e.idCollectionsUrl).then((e=>{D(e,r)}))),await Promise.all(t),r}async function T(e,t){t??=!1;const r={generateAllSublayers:t,namedTypeDefinitions:new Map};return await I(e).then((e=>{D(e,r)})),r}async function b(e,t,r){const n=await d(),s=new n.FeatureCollection,i=new n.FeatureCollection;try{k(s,n,e,"entities",t,r),k(i,n,e,"relationships",t,r);const a=new n.FeatureCollectionEncoder,o=new n.FeatureCollectionEncoder,l=R(s,a),c=structuredClone(l),d=R(i,o),p={entitiesFC:c,relationshipsFC:structuredClone(d),idCollections:await E(e)};return a.delete(),o.delete(),p}finally{s.delete(),i.delete()}}async function E(e){const r=await d(),n=new r.MapOfObjectIdentifierSets;M(n,r,e);const s=new r.MapOfObjectIdentifierSetsEncoder;try{s.set_map_of_identifier_sets(n),s.encode();const e=s.get_encoding_result();if(0!==e.error.error_code)throw new t("knowledge-graph:layer-support-utils",e.error.error_message);const r=structuredClone(e.get_byte_buffer());return s.delete(),r}finally{n.delete()}}function k(e,t,r,s,i,a){e.version="";const l=new t.QueryResult,d=new t.FeatureResult,m="entities"===s?c:o;d.unique_id_field={name:m[m.ELEMENTUID],isSystemMaintained:!1},d.globalid_field_name=m[m.ELEMENTUID],d.geohash_field_name="",d.geometry_properties={shapeAreaFieldName:"",shapeLengthFieldName:"",units:""},d.spatial_reference={wkid:4326,latestWkid:4326,vcsWkid:0,latestVcsWkid:0,wkt:""},d.exceeded_transfer_limit=!1,d.has_z=!1,d.has_m=!1,d.transform={quantizeOriginPosition:{value:f.upperLeft},scale:{xScale:1e-9,yScale:1e-9,mScale:1e-4,zScale:1e-4},translate:{xTranslate:-400,yTranslate:-400,mTranslate:-1e5,zTranslate:-1e5}};for(const n of Object.keys(m).filter((e=>isNaN(Number(e))))){const e=new t.Field;if(e.name=n,e.alias=n,e.sql_type={value:u.sqlTypeBigInt},"entities"===s)switch(n){case m[m.ELEMENTUID]:case m[m.TYPENAME]:e.field_type={value:p.esriFieldTypeString}}else switch(n){case m[m.ELEMENTUID]:case m[m.TYPENAME]:case o[o.FROMUID]:case o[o.TOUID]:e.field_type={value:p.esriFieldTypeString}}e.domain="",d.add_field(e),e.delete()}const y=new Map;for(const n of i.dataModel.entityTypes)y.set(n.name,"entities");for(const n of i.dataModel.relationshipTypes)y.set(n.name,"relationships");for(const[c,p]of r.namedTypeDefinitions)if(s===y.get(c))for(const e of p.members.values()){const r=new t.Feature;for(const n of Object.keys(m).filter((e=>isNaN(Number(e)))))if("entities"===s)switch(n){case m[m.ELEMENTUID]:r.add_attribute(e.id,t.esriFieldType.esriFieldTypeString);break;case m[m.TYPENAME]:r.add_attribute(c,t.esriFieldType.esriFieldTypeString)}else switch(n){case m[m.ELEMENTUID]:r.add_attribute(e.id,t.esriFieldType.esriFieldTypeString);break;case o[o.FROMUID]:r.add_attribute(a.has(e.id)?a.get(e.id)[0]:"",t.esriFieldType.esriFieldTypeString);break;case o[o.TOUID]:r.add_attribute(a.has(e.id)?a.get(e.id)[1]:"",t.esriFieldType.esriFieldTypeString);break;case m[m.TYPENAME]:r.add_attribute(c,t.esriFieldType.esriFieldTypeString)}let i;if(e.linkChartLocation&&"x"in e.linkChartLocation?i=n(e.linkChartLocation):e.linkChartLocation&&(i=e.linkChartLocation),e.linkChartLocation&&i){const e=new t.FeatureCollectionGeometry;switch(s){case"entities":e.geometry_type=t.esriGeometryType.esriGeometryPoint;break;case"relationships":e.geometry_type=t.esriGeometryType.esriGeometryPolyline}e.coords=new Float64Array(i.coords),e.lengths=new Uint32Array(i.lengths),r.set_compressed_geometry(e),e.delete()}d.add_feature(r),r.delete()}switch(s){case"entities":d.geometry_type=t.esriGeometryType.esriGeometryPoint;break;case"relationships":d.geometry_type=t.esriGeometryType.esriGeometryPolyline}return l.set_feature_result(d),e.set_query_result(l),d.delete(),l.delete(),e}function M(e,t,r){for(const[n,s]of r.namedTypeDefinitions){if(!s.members||s.useAllData)continue;const r=s.members.keys(),i=new t.GlobalIdArray,a=new t.ObjectIdentifierSet;for(const e of r)i.add_globalid(e);a.set_globalid_array(i),i.delete(),e.put_identifier_set(n,a),a.delete()}return e}async function F(t){const r=await e(t,{responseType:"array-buffer"});return N(await r.data)}async function N(e){const r=new((await d()).FeatureCollectionDecoder),n=r.decode(new Uint8Array(e));if(0!==n.error_code)throw new t("knowledge-graph:layer-support-utils",n.error_message);const s=r.get_feature_collection(),i=y(s);return r.delete(),i}async function I(t){const r=await e(t,{responseType:"array-buffer"}),n=await r.data;return A(new Uint8Array(n))}async function A(e){const r=new((await d()).MapOfObjectIdentifierSetsDecoder),n=r.decode(new Uint8Array(e)),s=new Map;if(0!==n.error_code)throw new t("knowledge-graph:layer-support-utils",n.error_message);const i=r.get_map_of_identifier_sets(),a=i.keys,o=a.size();for(let l=0;l<o;l++){const e=a.get(l),r=i.query_identifier_set(e),n=[];if(r.id_array_type.value===m.GLOBALID_ARRAY){const e=r.get_globalid_array(),t=e.count();for(let r=0;r<t;r++)n.push(e.get_globalid_at(r))}else{if(r.id_array_type.value!==m.IDENTIFIER_ARRAY)throw new t("knowledge-graph:layer-support-utils","Tried to encode an unexpected ID Array type.");{const e=r.get_identifier_array(),t=e.count();for(let r=0;r<t;r++)n.push(e.get_identifier_at(r).toString())}}s.set(e,n)}return r.delete(),s}function C(e,t){if(!e?.queryResult?.featureResult)return t;const n=e.queryResult.featureResult.fieldNameToAttributeIndexMap;for(const i of e.queryResult.featureResult.features){const e=i.attributes[n[l.TYPENAME]],a=r(t.namedTypeDefinitions,e,(()=>({useAllData:!1,members:new Map}))),o=i.attributes[n[l.ELEMENTUID]];i.compressedGeometry?.coords?.length>0?a.members.set(o,{id:o,linkChartLocation:new s(i.compressedGeometry.lengths,i.compressedGeometry.coords)}):a.members.set(o,{id:o})}return t}function D(e,t){for(const[n,s]of e){const e=r(t.namedTypeDefinitions,n,(()=>({useAllData:!1,members:new Map})));for(const t of s)e.members.has(t)||e.members.set(t,{id:t})}return t}const R=(e,r)=>{r.set_feature_collection(e),r.encode();const n=r.get_encoding_result();if(0!==n.error.error_code)throw new t("knowledge-graph:layer-support-utils",n.error.error_message);return n.get_byte_buffer()};export{C as addFeatureCollectionToInclusionDefinition,D as addIdMapToInclusionDefinition,N as deserializeFeatureCollection,A as deserializeIdCollectionMap,w as extentToInBoundsRings,T as fetchAndConvertSerializedKgIdMap,g as fetchAndConvertSerializedLinkChart,F as fetchAndDeserializeFeatureCollection,I as fetchAndDeserializeIdCollectionMap,h as getRelationshipEndNodeIds,_ as getRelationshipEndNodeMap,b as serializeInclusionDefinitionToAllPbf,E as serializeInclusionDefinitionToIdCollectionsMapPbf};
|
|
5
|
+
import"../../geometry.js";import e from"../../Graphic.js";import t from"../../request.js";import"../../symbols.js";import r from"../../core/Error.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import n from"../GraphicsLayer.js";import{convertFromGeometry as i}from"../graphics/featureConversionUtils.js";import s from"../graphics/OptimizedGeometry.js";import{Direction2D as a}from"../../libs/linkchartlayout/LinkChartLayout.js";import{executeQueryStreaming as l}from"../../rest/knowledgeGraphService.js";import c from"../../rest/knowledgeGraph/GraphQueryStreaming.js";import{ProtoOutboundRelationshipFeatureCollectionAttributionIndexes as d,ProtoInboundFeatureCollectionAttributionNames as m,ProtoOutboundEntityFeatureCollectionAttributionIndexes as p}from"../../rest/knowledgeGraph/ProtoFeatureCollection.js";import{getWasmInterface as f}from"../../rest/knowledgeGraph/wasmInterface/knowledgeWasmAccess.js";import{EsriFieldTypes as y}from"../../rest/knowledgeGraph/wasmInterface/WasmDataModelWrapperInterfaces.js";import{WasmQuantizeOriginPositionTypeCode as u,SqlTypeCode as h,IdArrayType as g}from"../../rest/knowledgeGraph/wasmInterface/WasmSerializedLayerData.js";import{wasmToProtoFeatureCollection as w}from"../../rest/knowledgeGraph/wasmInterface/wasmToFeatureFactories.js";import _ from"../../symbols/SimpleLineSymbol.js";import b from"../../geometry/Polyline.js";import T from"../../symbols/SimpleFillSymbol.js";import E from"../../geometry/Polygon.js";import k from"../../symbols/TextSymbol.js";import M from"../../geometry/Point.js";function F(e){if(!e.spatialReference.isWGS84)throw new r("knowledge-graph:layer-support-utils","The extentToInBoundsRings function only supports WGS84 spatial references.");return e.clone().normalize().map((e=>[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]))}async function S(e,t){const r=[],o=new Map,n=[];if(t.dataModel?.relationshipTypes)for(const i of t.dataModel.relationshipTypes)i.name&&o.set(i.name,[]);for(const i of e)o.has(i.typeName)&&o.get(i.typeName)?.push(i.id);for(const[i,s]of o){if(s.length<1)continue;const e=new c({openCypherQuery:`MATCH (n)-[r:${i}]->(m) WHERE id(r) in $ids RETURN id(n), labels(n)[0], id(m), labels(m)[0]`,bindParameters:{ids:s}});n.push(l(t,e).then((async e=>{const t=e.resultRowsStream.getReader();for(;;){const{done:e,value:o}=await t.read();if(e)break;for(const t of o)r.push({id:t[0],typeName:t[1]}),r.push({id:t[2],typeName:t[3]})}})))}return await Promise.all(n),r}async function A(e,t){const r=new Map,o=new Map,n=[];if(t.dataModel?.relationshipTypes)for(const i of t.dataModel.relationshipTypes)i.name&&o.set(i.name,[]);for(const i of e)o.has(i.typeName)&&o.get(i.typeName)?.push(i.id);for(const[i,s]of o){if(s.length<1)continue;const e=new c({openCypherQuery:`MATCH (n)-[r:${i}]->(m) WHERE id(r) in $ids RETURN id(r), id(n), id(m)`,bindParameters:{ids:s}});n.push(l(t,e).then((async e=>{const t=e.resultRowsStream.getReader();for(;;){const{done:e,value:o}=await t.read();if(e)break;for(const t of o)r.set(t[0],[t[1],t[2]])}})))}return await Promise.all(n),r}async function G(e){const t=[],r={generateAllSublayers:!1,namedTypeDefinitions:new Map};return e.entitiesUrl&&t.push(D(e.entitiesUrl).then((e=>{P(e,r)}))),e.relationshipsUrl&&t.push(D(e.relationshipsUrl).then((e=>{P(e,r)}))),e.idCollectionsUrl&&t.push(U(e.idCollectionsUrl).then((e=>{v(e,r)}))),await Promise.all(t),r}async function I(e,t){t??=!1;const r={generateAllSublayers:t,namedTypeDefinitions:new Map};return await U(e).then((e=>{v(e,r)})),r}async function N(e,t,r){const o=await f(),n=new o.FeatureCollection,i=new o.FeatureCollection;try{C(n,o,e,"entities",t,r),C(i,o,e,"relationships",t,r);const s=new o.FeatureCollectionEncoder,a=new o.FeatureCollectionEncoder,l=z(n,s),c=structuredClone(l),d=z(i,a),m={entitiesFC:c,relationshipsFC:structuredClone(d),idCollections:await j(e)};return s.delete(),a.delete(),m}finally{n.delete(),i.delete()}}async function j(e){const t=await f(),o=new t.MapOfObjectIdentifierSets;x(o,t,e);const n=new t.MapOfObjectIdentifierSetsEncoder;try{n.set_map_of_identifier_sets(o),n.encode();const e=n.get_encoding_result();if(0!==e.error.error_code)throw new r("knowledge-graph:layer-support-utils",e.error.error_message);const t=structuredClone(e.get_byte_buffer());return n.delete(),t}finally{o.delete()}}function C(e,t,r,o,n,s){e.version="";const a=new t.QueryResult,l=new t.FeatureResult,c="entities"===o?p:d;l.unique_id_field={name:c[c.ELEMENTUID],isSystemMaintained:!1},l.globalid_field_name=c[c.ELEMENTUID],l.geohash_field_name="",l.geometry_properties={shapeAreaFieldName:"",shapeLengthFieldName:"",units:""},l.spatial_reference={wkid:4326,latestWkid:4326,vcsWkid:0,latestVcsWkid:0,wkt:""},l.exceeded_transfer_limit=!1,l.has_z=!1,l.has_m=!1,l.transform={quantizeOriginPosition:{value:u.upperLeft},scale:{xScale:1e-9,yScale:1e-9,mScale:1e-4,zScale:1e-4},translate:{xTranslate:-400,yTranslate:-400,mTranslate:-1e5,zTranslate:-1e5}};for(const i of Object.keys(c).filter((e=>isNaN(Number(e))))){const e=new t.Field;if(e.name=i,e.alias=i,e.sql_type={value:h.sqlTypeBigInt},"entities"===o)switch(i){case c[c.ELEMENTUID]:case c[c.TYPENAME]:e.field_type={value:y.esriFieldTypeString}}else switch(i){case c[c.ELEMENTUID]:case c[c.TYPENAME]:case d[d.FROMUID]:case d[d.TOUID]:e.field_type={value:y.esriFieldTypeString}}e.domain="",l.add_field(e),e.delete()}const m=new Map;for(const i of n.dataModel.entityTypes)m.set(i.name,"entities");for(const i of n.dataModel.relationshipTypes)m.set(i.name,"relationships");for(const[p,f]of r.namedTypeDefinitions)if(o===m.get(p))for(const e of f.members.values()){const r=new t.Feature;for(const i of Object.keys(c).filter((e=>isNaN(Number(e)))))if("entities"===o)switch(i){case c[c.ELEMENTUID]:r.add_attribute(e.id,t.esriFieldType.esriFieldTypeString);break;case c[c.TYPENAME]:r.add_attribute(p,t.esriFieldType.esriFieldTypeString)}else switch(i){case c[c.ELEMENTUID]:r.add_attribute(e.id,t.esriFieldType.esriFieldTypeString);break;case d[d.FROMUID]:r.add_attribute(s.has(e.id)?s.get(e.id)[0]:"",t.esriFieldType.esriFieldTypeString);break;case d[d.TOUID]:r.add_attribute(s.has(e.id)?s.get(e.id)[1]:"",t.esriFieldType.esriFieldTypeString);break;case c[c.TYPENAME]:r.add_attribute(p,t.esriFieldType.esriFieldTypeString)}let n;if(e.linkChartLocation&&"x"in e.linkChartLocation?n=i(e.linkChartLocation):e.linkChartLocation&&(n=e.linkChartLocation),e.linkChartLocation&&n){const e=new t.FeatureCollectionGeometry;switch(o){case"entities":e.geometry_type=t.esriGeometryType.esriGeometryPoint;break;case"relationships":e.geometry_type=t.esriGeometryType.esriGeometryPolyline}e.coords=new Float64Array(n.coords),e.lengths=new Uint32Array(n.lengths),r.set_compressed_geometry(e),e.delete()}l.add_feature(r),r.delete()}switch(o){case"entities":l.geometry_type=t.esriGeometryType.esriGeometryPoint;break;case"relationships":l.geometry_type=t.esriGeometryType.esriGeometryPolyline}return a.set_feature_result(l),e.set_query_result(a),l.delete(),a.delete(),e}function x(e,t,r){for(const[o,n]of r.namedTypeDefinitions){if(!n.members||n.useAllData)continue;const r=n.members.keys(),i=new t.GlobalIdArray,s=new t.ObjectIdentifierSet;for(const e of r)i.add_globalid(e);s.set_globalid_array(i),i.delete(),e.put_identifier_set(o,s),s.delete()}return e}async function D(e){const r=await t(e,{responseType:"array-buffer"});return R(await r.data)}async function R(e){const t=new((await f()).FeatureCollectionDecoder),o=t.decode(new Uint8Array(e));if(0!==o.error_code)throw new r("knowledge-graph:layer-support-utils",o.error_message);const n=t.get_feature_collection(),i=w(n);return t.delete(),i}async function U(e){const r=await t(e,{responseType:"array-buffer"}),o=await r.data;return L(new Uint8Array(o))}async function L(e){const t=new((await f()).MapOfObjectIdentifierSetsDecoder),o=t.decode(new Uint8Array(e)),n=new Map;if(0!==o.error_code)throw new r("knowledge-graph:layer-support-utils",o.error_message);const i=t.get_map_of_identifier_sets(),s=i.keys,a=s.size();for(let l=0;l<a;l++){const e=s.get(l),t=i.query_identifier_set(e),o=[];if(t.id_array_type.value===g.GLOBALID_ARRAY){const e=t.get_globalid_array(),r=e.count();for(let t=0;t<r;t++)o.push(e.get_globalid_at(t))}else{if(t.id_array_type.value!==g.IDENTIFIER_ARRAY)throw new r("knowledge-graph:layer-support-utils","Tried to encode an unexpected ID Array type.");{const e=t.get_identifier_array(),r=e.count();for(let t=0;t<r;t++)o.push(e.get_identifier_at(t).toString())}}n.set(e,o)}return t.delete(),n}function P(e,t){if(!e?.queryResult?.featureResult)return t;const r=e.queryResult.featureResult.fieldNameToAttributeIndexMap;for(const n of e.queryResult.featureResult.features){const e=n.attributes[r[m.TYPENAME]],i=o(t.namedTypeDefinitions,e,(()=>({useAllData:!1,members:new Map}))),a=n.attributes[r[m.ELEMENTUID]];n.compressedGeometry?.coords?.length>0?i.members.set(a,{id:a,linkChartLocation:new s(n.compressedGeometry.lengths,n.compressedGeometry.coords)}):i.members.set(a,{id:a})}return t}function v(e,t){for(const[r,n]of e){const e=o(t.namedTypeDefinitions,r,(()=>({useAllData:!1,members:new Map})));for(const t of n)e.members.has(t)||e.members.set(t,{id:t})}return t}const O="ESRI__ChronologicalLayoutOverlay",W=()=>O,q=t=>{const r=[];for(const o of t.chronologicalAuxiliaryGraphics?.lines??[]){const t=new _({color:[o.color.r,o.color.g,o.color.b,o.color.a/100],width:o.width,style:o.dashPattern.length>0?"dash":"solid",marker:o.arrowheadSizeAtEnd?{color:[o.color.r,o.color.g,o.color.b,o.color.a/100],placement:"end",style:"arrow"}:void 0});for(const n of o.elements){const o=new b({paths:[[[n.origin.x,n.origin.y],[n.destination.x,n.destination.y]]]});r.push(new e({geometry:o,symbol:t}))}}for(const o of t.chronologicalAuxiliaryGraphics?.polygons??[]){const t=new T({color:[o.color.r,o.color.g,o.color.b,o.color.a/100],style:"solid",outline:null});for(const n of o.elements){const o=new E({rings:[n.points.map((e=>[e.x,e.y]))]});r.push(new e({geometry:o,symbol:t}))}}for(const o of t.chronologicalAuxiliaryGraphics?.texts??[]){let t="middle";o.direction?.value===a.Down&&(t="bottom");for(const n of o.elements){const i=new k({color:[o.color.r,o.color.g,o.color.b,o.color.a/100],text:n.str,font:{size:o.height,weight:"bold"},verticalAlignment:t}),s=new M({x:n.anchor.x,y:n.anchor.y});r.push(new e({geometry:s,symbol:i}))}}return new n({graphics:r,listMode:"hide",title:O,id:O})},z=(e,t)=>{t.set_feature_collection(e),t.encode();const o=t.get_encoding_result();if(0!==o.error.error_code)throw new r("knowledge-graph:layer-support-utils",o.error.error_message);return o.get_byte_buffer()};export{P as addFeatureCollectionToInclusionDefinition,v as addIdMapToInclusionDefinition,R as deserializeFeatureCollection,L as deserializeIdCollectionMap,F as extentToInBoundsRings,I as fetchAndConvertSerializedKgIdMap,G as fetchAndConvertSerializedLinkChart,D as fetchAndDeserializeFeatureCollection,U as fetchAndDeserializeIdCollectionMap,q as getChronologicalOverlay,W as getDefaultChronologicalOverlayLayerId,S as getRelationshipEndNodeIds,A as getRelationshipEndNodeMap,N as serializeInclusionDefinitionToAllPbf,j as serializeInclusionDefinitionToIdCollectionsMapPbf};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as e}from"../../../core/accessorSupport/decorators/subclass.js";import r from"./AspectFunctionArguments.js";import o from"./BaseRasterFunction.js";import{aspect as i}from"./surfaceUtils.js";let n=class extends o{constructor(){super(...arguments),this.functionName="Aspect",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){const t=this.sourceRasterInfos[0];this.isGCS=t.spatialReference?.isGeographic??!1,this.outputPixelType=this._getOutputPixelType("f32");const s=t.clone();return s.pixelType=this.outputPixelType,s.statistics=[{min:-1,max:360,avg:180,stddev:30}],s.
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as e}from"../../../core/accessorSupport/decorators/subclass.js";import r from"./AspectFunctionArguments.js";import o from"./BaseRasterFunction.js";import{aspect as i}from"./surfaceUtils.js";let n=class extends o{constructor(){super(...arguments),this.functionName="Aspect",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){const t=this.sourceRasterInfos[0];this.isGCS=t.spatialReference?.isGeographic??!1,this.outputPixelType=this._getOutputPixelType("f32");const s=t.clone();return s.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(s),s.statistics=[{min:-1,max:360,avg:180,stddev:30}],s.bandCount=1,this.rasterInfo=s,{success:!0,supportsGPU:!0}}_processPixels(t){const s=t.pixelBlocks?.[0];if(null==s)return null;const{extent:e,primaryPixelSizes:r}=t,o=r?.[0],n=o??(e?{x:e.width/s.width,y:e.height/s.height}:{x:1,y:1});return i(s,{resolution:n})}};t([s({json:{write:!0,name:"rasterFunction"}})],n.prototype,"functionName",void 0),t([s({type:r,json:{write:!0,name:"rasterFunctionArguments"}})],n.prototype,"functionArguments",void 0),t([s()],n.prototype,"rasterArgumentNames",void 0),t([s({json:{write:!0}})],n.prototype,"isGCS",void 0),n=t([e("esri.layers.support.rasterFunctions.AspectFunction")],n);const p=n;export{p as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import{JSONSupport as s}from"../../../core/JSONSupport.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import{cast as r}from"../../../core/accessorSupport/decorators/cast.js";import"../../../core/RandomLCG.js";import"../../../core/has.js";import{subclass as
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import{JSONSupport as s}from"../../../core/JSONSupport.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import{cast as r}from"../../../core/accessorSupport/decorators/cast.js";import"../../../core/RandomLCG.js";import"../../../core/has.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import n from"../PixelBlock.js";import o from"../RasterInfo.js";const a=new Set(["slope","aspect","curvature","hillshade","shadedrelief","statistics"]);let u=class extends s{constructor(){super(...arguments),this.functionArguments=null,this.readingBufferSize=0,this.id=-1,this.isNoopProcess=!1,this.rawInputBandIds=[],this.rawSourceRasterInfos=null,this.isInputBandIdsSwizzled=!1,this.swizzledBandSelection=[],this.isBranch=!1,this._bindingResult=null}get supportsGPU(){return this._bindingResult.supportsGPU}get flatWebGLFunctionChain(){const t=this.getWebGLProcessorDefinition();if(!t)return null;const s=[t],{parameters:e}=t;let r=e.rasters||e.raster&&[e.raster];for(;r?.length;){s.unshift(...r);const t=[];for(let s=0;s<r.length;s++){const{parameters:e}=r[s],i=e.rasters||e.raster&&[e.raster];i?.length&&t.push(...i)}r=t}for(let a=s.length-1;a>=0;a--)s[a].isNoopProcess&&s.splice(a,1);let i=!1;for(let a=0;a<s.length;a++){const t=s[a];t.id=s.length-a-1;const{rasters:e}=t.parameters;i=i||null!=e&&e.length>1}const n=s.some((({name:t})=>a.has(t.toLowerCase()))),{rawSourceRasterInfos:o}=this;return{functions:s,hasBranches:i,hasFocalFunction:n,isSourceSingleBand:1===o?.[0]?.bandCount}}bind(t,s=!1,e=-1){this.id=e+1;const r=this._getRasterValues();let i=!0;for(let n=0;n<r.length;n++){const e=r[n];if(null!=e&&this._isRasterFunctionValue(e)){const r=e.bind(t,s,this.id+n);if(!r.success)return this._bindingResult=r,r;i=i&&r.supportsGPU}}return!this.rasterInfo||s?(this.sourceRasterInfos=this._getSourceRasterInfos(t),this._bindingResult=this._bindSourceRasters(),this._bindingResult.success&&this._patchRasterInfo(),this._bindingResult.supportsGPU=i&&this._bindingResult.supportsGPU,this.processInputBandIds(),this._bindingResult):(this._bindingResult={success:!0,supportsGPU:!0},this.processInputBandIds(),this._bindingResult)}process(t){const s=this._getRasterValues(),e=0===s.length?t.pixelBlocks??t.primaryPixelBlocks:s.map((s=>this._readRasterValue(s,t)));return this._processPixels({...t,pixelBlocks:e})}processInputBandIds(){const t=this._getRasterValues().filter(this._isRasterFunctionValue);let s;if(t.length>1){const s=t.map((t=>t.processInputBandIds()[0]));this.rawInputBandIds=s,this.isInputBandIdsSwizzled=this.rawInputBandIds.some(((t,s)=>t!==s));const e=t.filter((t=>"ExtractBand"===t.functionName));return e.length&&e.forEach(((t,s)=>{t.isInputBandIdsSwizzled=!0,t.swizzledBandSelection=[s,s,s]})),this.rawInputBandIds}const e=t[0];if(e){if(s=e.processInputBandIds(),e.isInputBandIdsSwizzled)return this.rawInputBandIds=s,s}else{s=[];const{bandCount:t}=this.sourceRasterInfos[0];for(let e=0;e<t;e++)s.push(e)}const r=this._getInputBandIds(s);return this.isInputBandIdsSwizzled=r.some(((t,s)=>t!==s)),this.rawInputBandIds=r,this.rawInputBandIds}getPrimaryRasters(){const t=[],s=[];return this._getPrimaryRasters(this,t,s),{rasters:t,rasterIds:s}}getWebGLProcessorDefinition(){const t=this._getWebGLParameters(),{raster:s,rasters:e}=this.functionArguments;return e&&Array.isArray(e)&&e.length?(t.rasters=e.map((t=>this._isRasterFunctionValue(t)?t.getWebGLProcessorDefinition():"number"==typeof t?{name:"Constant",parameters:{value:t},pixelType:"f32",id:-1,isNoopProcess:!1}:{name:"Identity",parameters:{value:t},pixelType:"f32",id:-1,isNoopProcess:!1})),t.rasters.some((t=>null!=t))||(t.rasters=null)):this._isRasterFunctionValue(s)&&(t.raster=s.getWebGLProcessorDefinition()),{name:this.functionName,parameters:t,pixelType:this.outputPixelType,id:this.id,isNoopProcess:this.isNoopProcess}}getClippingGeometries(){const t=[];"Clip"===this.functionName&&t.push(this.functionArguments);const{raster:s,rasters:e}=this.functionArguments;if(e&&Array.isArray(e)&&e.length)e.forEach((s=>{if(this._isRasterFunctionValue(s)){const e=s.getClippingGeometries();t.push(...e)}}));else if(this._isRasterFunctionValue(s)){const e=s.getClippingGeometries();t.push(...e)}return t}_getOutputPixelType(t){return"unknown"===this.outputPixelType?t:this.outputPixelType??t}_getWebGLParameters(){return{}}_getInputBandIds(t){return t}_removeStatsHistColormapVAT(t){t.statistics=null,t.histograms=null,t.colormap=null,t.attributeTable=null,t.multidimensionalInfo?.variables.forEach((t=>{t.statistics=void 0,t.histograms=void 0}))}_getRasterValues(){const{rasterArgumentNames:t}=this;return"rasters"===t[0]?this.functionArguments.rasters??[]:t.flatMap((t=>this.functionArguments[t]))}_getSourceRasterInfos(t){const s=this._getRasterValues(),{rasterInfos:e,rasterIds:r}=t;if(0===s.length)return e;const i=s.map((t=>t&&"object"==typeof t&&"bind"in t&&t.rasterInfo?t.rasterInfo:"string"==typeof t&&r.includes(t)?e[r.indexOf(t)]:"number"!=typeof t?e[0]:void 0)),n=i.find((t=>t))??e[0];return i.forEach(((t,s)=>{void 0===t&&(i[s]=n)})),i}_getPrimaryRasterId(t){return t?.rasterId}_getPrimaryRasters(t,s=[],e=[]){for(let r=0;r<t.sourceRasters.length;r++){const i=t.sourceRasters[r];if("number"!=typeof i)if("bind"in i)this._getPrimaryRasters(i,s,e);else{const t=i,r=this._getPrimaryRasterId(t);if(null==r)continue;e.includes(r)||(this.mainPrimaryRasterId===r?(s.unshift(t),e.unshift(r)):(s.push(t),e.push(r)))}}}_isRasterFunctionValue(t){return null!=t&&"object"==typeof t&&"getWebGLProcessorDefinition"in t}_readRasterValue(t,s){const{primaryPixelBlocks:e}=s;if(null==t||"$$"===t){const t=e[0];return null==t?null:t.clone()}if("string"==typeof t){const r=s.primaryRasterIds.indexOf(t);return-1===r?null:e[r]}if("number"==typeof t){const s=e[0];if(null==s)return null;const{width:r,height:i,pixelType:o}=s,a=new Float32Array(r*i);a.fill(t);const u=this.sourceRasterInfos[0].bandCount,p=new Array(u).fill(a);return new n({width:r,height:i,pixelType:o,pixels:p})}return t.process(s)}_patchRasterInfo(){const{rasterInfo:t}=this;if(!t?.keyProperties)return;const{bandCount:s,keyProperties:e,statistics:r,histograms:i}=t,n=e.BandProperties;n&&n.length!==s&&(t.keyProperties={...e,BandProperties:void 0}),r&&r.length!==s&&(t.statistics=r.length>s?r.slice(0,s):null),i&&i.length!==s&&(t.histograms=i.length>s?i.slice(0,s):null),e.BAND_COUNT&&Number(e.BAND_COUNT)!==s&&(t.keyProperties={...e,BAND_COUNT:"string"==typeof e.BAND_COUNT?String(s):s})}};t([e({json:{write:!0}})],u.prototype,"functionName",void 0),t([e({json:{write:!0}})],u.prototype,"functionArguments",void 0),t([e()],u.prototype,"rasterArgumentNames",void 0),t([e({json:{write:!0}}),r((t=>t?.toLowerCase()))],u.prototype,"outputPixelType",void 0),t([e({json:{write:!0}})],u.prototype,"mainPrimaryRasterId",void 0),t([e()],u.prototype,"sourceRasters",void 0),t([e({type:[o],json:{write:!0}})],u.prototype,"sourceRasterInfos",void 0),t([e({json:{write:!0}})],u.prototype,"rasterInfo",void 0),t([e({json:{write:!0}})],u.prototype,"readingBufferSize",void 0),t([e({json:{write:!0}})],u.prototype,"id",void 0),t([e()],u.prototype,"isNoopProcess",void 0),t([e()],u.prototype,"supportsGPU",null),t([e()],u.prototype,"rawInputBandIds",void 0),t([e()],u.prototype,"rawSourceRasterInfos",void 0),t([e()],u.prototype,"isInputBandIdsSwizzled",void 0),t([e()],u.prototype,"swizzledBandSelection",void 0),t([e()],u.prototype,"isBranch",void 0),t([e({readOnly:!0})],u.prototype,"flatWebGLFunctionChain",null),t([e()],u.prototype,"_bindingResult",void 0),u=t([i("esri.layers.support.rasterFunctions.BaseRasterFunction")],u);const p=u;export{p as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{calculateNDVI as e,getBandMatrix3 as n}from"./bandIndexUtils.js";import o from"./BaseRasterFunction.js";import i from"./NDVIFunctionArguments.js";let u=class extends o{constructor(){super(...arguments),this.functionName="NDVI",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{scientificOutput:t,visibleBandID:s,infraredBandID:r}=this.functionArguments;this.outputPixelType=this._getOutputPixelType(t?"f32":"u8");const e=this.sourceRasterInfos[0],n=Math.max(s,r);if(e.bandCount<2||n>=e.bandCount)return{success:!1,supportsGPU:!1,error:"ndvi-function: source raster has insufficient amount of raster bands"};const o=e.clone();o.pixelType=this.outputPixelType,
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{calculateNDVI as e,getBandMatrix3 as n}from"./bandIndexUtils.js";import o from"./BaseRasterFunction.js";import i from"./NDVIFunctionArguments.js";let u=class extends o{constructor(){super(...arguments),this.functionName="NDVI",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{scientificOutput:t,visibleBandID:s,infraredBandID:r}=this.functionArguments;this.outputPixelType=this._getOutputPixelType(t?"f32":"u8");const e=this.sourceRasterInfos[0],n=Math.max(s,r);if(e.bandCount<2||n>=e.bandCount)return{success:!1,supportsGPU:!1,error:"ndvi-function: source raster has insufficient amount of raster bands"};const o=e.clone();o.pixelType=this.outputPixelType,this._removeStatsHistColormapVAT(o),o.bandCount=1,o.keyProperties={...o.keyProperties,BandProperties:void 0};const[i,u,a,c]=t?[-1,1,0,.1]:[0,200,100,10];return o.statistics=[{min:i,max:u,avg:a,stddev:c}],this.rasterInfo=o,{success:!0,supportsGPU:!0}}_processPixels(t){const s=t.pixelBlocks?.[0];if(null==s)return null;const{visibleBandID:r,infraredBandID:n,scientificOutput:o}=this.functionArguments;return e(s,r,n,!o)}_getWebGLParameters(){const{visibleBandID:t,infraredBandID:s,scientificOutput:r}=this.functionArguments,e=this.isInputBandIdsSwizzled?[0,1,2]:[s,t,0];return{bandIndexMat3:n(e),scaled:!r}}_getInputBandIds(t){const{visibleBandID:s,infraredBandID:r}=this.functionArguments;return[r,s,0].map((s=>t[s]))}};t([s({json:{write:!0,name:"rasterFunction"}})],u.prototype,"functionName",void 0),t([s({type:i,json:{write:!0,name:"rasterFunctionArguments"}})],u.prototype,"functionArguments",void 0),t([s()],u.prototype,"rasterArgumentNames",void 0),u=t([r("esri.layers.support.rasterFunctions.NDVIFunction")],u);const a=u;export{a as default};
|