@arcgis/core 5.1.0-next.11 → 5.1.0-next.13
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/WebScene.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/008887a8014b61f837ae.js +1 -0
- package/assets/esri/core/workers/chunks/04f82b740325e3388d23.js +1 -0
- package/assets/esri/core/workers/chunks/09cf8aed89a1ea1f8b28.js +1 -0
- package/assets/esri/core/workers/chunks/{ff2412c5be1ad4edb458.js → 0b59e5be22139387bd84.js} +1 -1
- package/assets/esri/core/workers/chunks/0bf742d48f434c4c575f.js +1 -0
- package/assets/esri/core/workers/chunks/0c8a676599821b9871c2.js +1 -0
- package/assets/esri/core/workers/chunks/11882cbb28710e5f9fc5.js +1 -0
- package/assets/esri/core/workers/chunks/{f0e7207fd2c899b9fe9f.js → 12fd2e26e949d90abfbd.js} +1 -1
- package/assets/esri/core/workers/chunks/{8c5e834c2d243fc369fe.js → 18b0776aef1536867ab8.js} +1 -1
- package/assets/esri/core/workers/chunks/{72ab3ed37ac4da355710.js → 1aa2187597f7c4adb67f.js} +1 -1
- package/assets/esri/core/workers/chunks/2216264b22a605a0f1ce.js +1 -0
- package/assets/esri/core/workers/chunks/22d12c309af9c19a1a48.js +1 -0
- package/assets/esri/core/workers/chunks/{aefc089928ada18bc4d4.js → 2762149a922275136171.js} +2 -2
- package/assets/esri/core/workers/chunks/27aa21da934ecaca381a.js +1 -0
- package/assets/esri/core/workers/chunks/{a5d3dcb490686430c81d.js → 27c8dea6154eb8c36fed.js} +1 -1
- package/assets/esri/core/workers/chunks/27d60fd727e9a68973f6.js +1 -0
- package/assets/esri/core/workers/chunks/{8fbfdd154413a2140180.js → 2a3e82a230b7ee4dfd55.js} +1 -1
- package/assets/esri/core/workers/chunks/{5aab1db039b2b61c6c6b.js → 2bb7bb7901bd343201fc.js} +1 -1
- package/assets/esri/core/workers/chunks/2d1a772abd730b61854f.js +1 -0
- package/assets/esri/core/workers/chunks/2d67ab4927a968d5c8d4.js +1 -0
- package/assets/esri/core/workers/chunks/{ee2ae61fc747b5f9827b.js → 2e7d4a437717606bc39c.js} +1 -1
- package/assets/esri/core/workers/chunks/{02f03297491eef26f113.js → 34207774bc371e95ba3c.js} +1 -1
- package/assets/esri/core/workers/chunks/360b3499e2a671c309ce.js +1 -0
- package/assets/esri/core/workers/chunks/3b0cfe3db8d90e02d6c6.js +1 -0
- package/assets/esri/core/workers/chunks/3d78e9b3c97c0ce21d16.js +1 -0
- package/assets/esri/core/workers/chunks/4550b7620932cd6de20e.js +1 -0
- package/assets/esri/core/workers/chunks/{f3022255054e8d09c38b.js → 455fbddd814e4681f0c0.js} +1 -1
- package/assets/esri/core/workers/chunks/{3db4938b3f89b9b8234e.js → 4742a8c19b86a5f859f0.js} +1 -1
- package/assets/esri/core/workers/chunks/58cf3d35771b87bd74e5.js +1 -0
- package/assets/esri/core/workers/chunks/{d84af069f1057044c879.js → 5c12a9b0db317620dce2.js} +1 -1
- package/assets/esri/core/workers/chunks/65ad8838911a6d71816b.js +1 -0
- package/assets/esri/core/workers/chunks/{7a85e08cb968586f8d74.js → 72acfb74fd9ab9bae923.js} +2 -2
- package/assets/esri/core/workers/chunks/79ee97609f72e4cf989c.js +1 -0
- package/assets/esri/core/workers/chunks/{fba30f2e1d6b364aae79.js → 7b1964255722e756eba3.js} +1 -1
- package/assets/esri/core/workers/chunks/7e6309bfed6692e8d2d7.js +2 -0
- package/assets/esri/core/workers/chunks/804c31973f7d116523cb.js +1 -0
- package/assets/esri/core/workers/chunks/{dc65843654dc25bd8f97.js → 8177e95596b71bf020aa.js} +1 -1
- package/assets/esri/core/workers/chunks/{afffb40cce91e135f092.js → 8374658d17f69bde6b08.js} +1 -1
- package/assets/esri/core/workers/chunks/879e8439a513cb333b61.js +1 -0
- package/assets/esri/core/workers/chunks/{ca767f0e3aa559b13699.js → 90aeef17af12cfbecb36.js} +1 -1
- package/assets/esri/core/workers/chunks/{4bd98d025bcd713eddca.js → 91858b02da40ff251ab2.js} +2 -2
- package/assets/esri/core/workers/chunks/{3114cbf7298239e1269d.js → 956237a2baa30760c256.js} +1 -1
- package/assets/esri/core/workers/chunks/a027da22acdaa6d6baa3.js +1 -0
- package/assets/esri/core/workers/chunks/{c064025d0dc69bb44f0d.js → a115984b794a7f90b2c0.js} +1 -1
- package/assets/esri/core/workers/chunks/a3e8b7185d63a0f85931.js +1 -0
- package/assets/esri/core/workers/chunks/{6be2dc8331ecf944efdc.js → a5af20f3d484d2d3bafe.js} +1 -1
- package/assets/esri/core/workers/chunks/b0b24fb60a21b995b348.js +1 -0
- package/assets/esri/core/workers/chunks/b6e155b42a4a423139e7.js +1 -0
- package/assets/esri/core/workers/chunks/{fb57a07b76580dcdde46.js → bc9997d15ec0a86793c6.js} +1 -1
- package/assets/esri/core/workers/chunks/{4a571a1e897c8ad359c4.js → bf2bfc0d78be8c185d58.js} +1 -1
- package/assets/esri/core/workers/chunks/bf9b2aa2e67ca746ec7c.js +1 -0
- package/assets/esri/core/workers/chunks/c9babe86c00ae69e63ee.js +2 -0
- package/assets/esri/core/workers/chunks/{da40c63408affee86ac4.js → d0d1378e714ff0e43e26.js} +1 -1
- package/assets/esri/core/workers/chunks/{940185f10c2b16612b66.js → d3416e6da0c1cbb53b3a.js} +1 -1
- package/assets/esri/core/workers/chunks/d9c1e1ec5c56f09fb82f.js +1 -0
- package/assets/esri/core/workers/chunks/d9dc3962535616a06e2f.js +1 -0
- package/assets/esri/core/workers/chunks/{4ee618a256b06221ea8f.js → da5deed75e1a170a49b3.js} +8 -8
- package/assets/esri/core/workers/chunks/{bb75ec3727b7ecabca6f.js → e4eb14952b7660feecc7.js} +1 -1
- package/assets/esri/core/workers/chunks/eaf5d55060ffc55aac39.js +1 -0
- package/assets/esri/core/workers/chunks/{9bcf8241c6b4aa42b1c5.js → ed78e19b1e400c0db309.js} +1 -1
- package/assets/esri/core/workers/chunks/f0b8de5b3cfbe9223df6.js +1 -0
- package/assets/esri/core/workers/chunks/fcf6a47f44c917490deb.js +1 -0
- package/assets/esri/core/workers/chunks/fd5a5b05a1551cdb8c87.js +1 -0
- package/assets/esri/themes/base/widgets/_FeatureTable.scss +1 -0
- package/assets/esri/themes/base/widgets/_Grid.scss +8 -1
- 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/config.js +1 -1
- package/core/Logger.js +1 -1
- package/core/Version.js +1 -1
- package/core/deprecate.js +1 -1
- package/core/has.js +1 -1
- package/core/iteratorUtils.js +1 -1
- package/core/sql/WhereClause.js +1 -1
- package/core/sql/WhereGrammar.js +1 -1
- package/core/sql/sqlVisitor.js +2 -0
- package/core/sql/writeUtils.js +2 -0
- package/core/sql.d.ts +2 -3
- package/core/sql.js +1 -1
- package/kernel.js +1 -1
- package/layers/ImageryLayer.d.ts +1 -1
- package/layers/MapImageLayer.d.ts +1 -1
- package/layers/TileLayer.d.ts +1 -1
- package/layers/WebTileLayer.d.ts +1 -1
- package/layers/graphics/data/QueryEngineCapabilities.js +1 -1
- package/layers/graphics/sources/FeatureLayerSource.js +1 -1
- package/layers/graphics/sources/OGCFeatureSource.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/graphics/sources/support/QueryTask.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/mixins/FeatureLayerBase.js +1 -1
- package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
- package/layers/orientedImagery/transformations/utils.js +1 -1
- package/layers/orientedImagery/transformations/worldToImage.js +1 -1
- package/layers/raster/datasets/ImageServerRaster.js +1 -1
- package/layers/support/Sublayer.js +1 -1
- package/layers/support/arcgisLayerUrl.js +1 -1
- package/layers/support/capabilities.js +1 -1
- package/layers/support/relativeTimeQueryUtils.js +2 -0
- package/layers/support/serviceCapabilitiesUtils.js +1 -1
- package/networks/support/jsonTypes.d.ts +2 -2
- package/package.json +2 -2
- package/renderers/support/rasterRendererHelper.js +1 -1
- package/rest/print.js +1 -1
- package/support/basemapUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/support/Symbol3DEmissive.d.ts +9 -9
- package/symbols/support/Symbol3DMaterial.d.ts +8 -8
- package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
- package/views/2d/layers/features/schema/SourceSchema.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
- package/views/3d/analysis/ShadowCast/ShadowCastTooltip.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
- package/views/3d/environment/Fog.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/VectorTileLayerView3D.js +1 -1
- package/views/3d/layers/support/featureTileQuery3D.js +1 -1
- package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
- package/views/3d/webgl/ManagedFBOResource.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/effects/RenderNodes.js +1 -1
- package/views/3d/webgl-engine/effects/blit/Blit.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillDepth.js +1 -1
- package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
- package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
- package/views/3d/webgl-engine/parts/renderUtils.js +1 -1
- package/views/Attribution.js +1 -1
- package/views/DOMContainer.js +1 -1
- package/views/SelectionManager.d.ts +242 -0
- package/views/View.d.ts +1 -1
- package/views/draw/DrawTool.js +1 -1
- package/views/draw/plugins/BezierSegmentPlugin.js +1 -1
- package/views/draw/plugins/CircularArcSegmentPlugin.js +2 -0
- package/views/draw/support/EditSession.js +1 -1
- package/views/draw/support/PluginContext.js +1 -1
- package/views/draw/support/managers/TooltipManager.js +1 -1
- package/views/selection/types.d.ts +140 -0
- package/views/support/selectionUtils.js +1 -1
- package/views/ui/DefaultUI.d.ts +5 -12
- package/views/ui/DefaultUI.js +1 -1
- package/views/ui/types.d.ts +1 -1
- package/webscene/SunLighting.d.ts +20 -2
- package/webscene/VirtualLighting.d.ts +20 -2
- package/webscene/support/schemaValidator.js +1 -1
- package/webscene/support/versionUtils.js +1 -1
- package/widgets/Attribution/AttributionViewModel.d.ts +1 -1
- package/widgets/Attribution.d.ts +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.d.ts +48 -0
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
- package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
- package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/support/SketchController.js +1 -1
- package/widgets/Editor.d.ts +35 -0
- package/widgets/Editor.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.d.ts +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable.d.ts +9 -3
- package/widgets/FeatureTable.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/DataCaptureAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/view/MapViewAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/services/TransformationService.js +1 -1
- package/widgets/OrientedImageryViewer/support/dataCaptureUtils.js +1 -1
- package/widgets/OrientedImageryViewer/support/geometryUtils.js +1 -1
- package/widgets/OrientedImageryViewer/support/urlUtils.js +1 -1
- package/widgets/OrientedImageryViewer/utils.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer/support/PanoramicMedia.js +1 -1
- package/widgets/Sketch/SketchViewModel.d.ts +14 -15
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch/support/OperationHandle.js +1 -1
- package/widgets/Sketch/support/PluginManager.js +1 -1
- package/widgets/Sketch/support/sketchUtils.js +1 -1
- package/widgets/Sketch.d.ts +37 -0
- package/widgets/Sketch.js +1 -1
- package/assets/esri/core/workers/chunks/012992dc3910466ed207.js +0 -1
- package/assets/esri/core/workers/chunks/0485ae33a8b327974751.js +0 -1
- package/assets/esri/core/workers/chunks/0994c12d01fe6f74350e.js +0 -1
- package/assets/esri/core/workers/chunks/13b104cc7925d4423aad.js +0 -1
- package/assets/esri/core/workers/chunks/147d0f7a2e471442c95c.js +0 -2
- package/assets/esri/core/workers/chunks/1a11ac1a34614132fabc.js +0 -1
- package/assets/esri/core/workers/chunks/1f613c599eff3b16c1d2.js +0 -1
- package/assets/esri/core/workers/chunks/2431a5480f0d22f00e00.js +0 -1
- package/assets/esri/core/workers/chunks/319226db47849acbe321.js +0 -1
- package/assets/esri/core/workers/chunks/360dd5cd63d132b5c7d5.js +0 -2
- package/assets/esri/core/workers/chunks/3e4c5cc24bdc1c807125.js +0 -1
- package/assets/esri/core/workers/chunks/504e6868445419b7680e.js +0 -1
- package/assets/esri/core/workers/chunks/545d801c4ba6f49df726.js +0 -1
- package/assets/esri/core/workers/chunks/71879de16a936a079362.js +0 -1
- package/assets/esri/core/workers/chunks/733d4ddb937c51ef3aed.js +0 -1
- package/assets/esri/core/workers/chunks/7352b4129f4875a053b0.js +0 -1
- package/assets/esri/core/workers/chunks/768ee8d940b5eb353ec3.js +0 -1
- package/assets/esri/core/workers/chunks/8556d06f522914e71bb8.js +0 -1
- package/assets/esri/core/workers/chunks/863873ffbed0cbbdfb9b.js +0 -1
- package/assets/esri/core/workers/chunks/88fe7d75dc3b619b8543.js +0 -1
- package/assets/esri/core/workers/chunks/8ac7a552189143ab4f91.js +0 -1
- package/assets/esri/core/workers/chunks/8ba1c7919e898ef4557f.js +0 -1
- package/assets/esri/core/workers/chunks/944b6d230a93add78c0d.js +0 -1
- package/assets/esri/core/workers/chunks/a37a003da59bdaf7ec0e.js +0 -1
- package/assets/esri/core/workers/chunks/ad688eee6a9f2be6df4a.js +0 -1
- package/assets/esri/core/workers/chunks/c0ae85f9c2dbe8611499.js +0 -1
- package/assets/esri/core/workers/chunks/c0cb0c22ee7fd91855cb.js +0 -1
- package/assets/esri/core/workers/chunks/c88101cb8301f095d037.js +0 -1
- package/assets/esri/core/workers/chunks/cb1b16f8bf7c135e14f7.js +0 -1
- package/assets/esri/core/workers/chunks/cc245eb1c5aaaac5916e.js +0 -1
- package/assets/esri/core/workers/chunks/e03bf0ca545dce221ea0.js +0 -1
- package/assets/esri/core/workers/chunks/e880d7738155a4de4b0e.js +0 -1
- package/assets/esri/core/workers/chunks/fb4bcf366ba1b51668f6.js +0 -1
- package/assets/esri/core/workers/chunks/fb58f3ea98bf5e8cf8dd.js +0 -1
- package/views/3d/webgl/utils.js +0 -2
- /package/assets/esri/core/workers/chunks/{aefc089928ada18bc4d4.js.LICENSE.txt → 2762149a922275136171.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{7a85e08cb968586f8d74.js.LICENSE.txt → 72acfb74fd9ab9bae923.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{360dd5cd63d132b5c7d5.js.LICENSE.txt → 7e6309bfed6692e8d2d7.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{4bd98d025bcd713eddca.js.LICENSE.txt → 91858b02da40ff251ab2.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{147d0f7a2e471442c95c.js.LICENSE.txt → c9babe86c00ae69e63ee.js.LICENSE.txt} +0 -0
package/config.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.1.0-next.
|
|
2
|
+
import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.1.0-next.13";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
|
package/core/Logger.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import e from"../config.js";import"./has.js";import{numericHash as
|
|
2
|
+
import e from"../config.js";import{esriToCore as t}from"./deprecate.js";import"./has.js";import{numericHash as r}from"./string.js";const i={info:0,warn:1,error:2,none:3};class n{constructor(e){this.level=null,this._module="",this._parent=null,this.writer=null,this._loggedMessages={error:new Map,warn:new Map,info:new Map},null!=e.level&&(this.level=e.level),null!=e.writer&&(this.writer=e.writer),this._module=e.module,n._loggers.set(this.module,this);const t=this.module.lastIndexOf(".");-1!==t&&(this._parent=n.getLogger(this.module.slice(0,t)))}get module(){return this._module}get parent(){return this._parent}error(...e){this._log("error","always",...e)}warn(...e){this._log("warn","always",...e)}info(...e){this._log("info","always",...e)}errorOnce(...e){this._log("error","once",...e)}warnOnce(...e){this._log("warn","once",...e)}infoOnce(...e){this._log("info","once",...e)}errorOncePerTick(...e){this._log("error","oncePerTick",...e)}warnOncePerTick(...e){this._log("warn","oncePerTick",...e)}infoOncePerTick(...e){this._log("info","oncePerTick",...e)}get test(){}static get test(){}static getLogger(e){return e="string"!=typeof e?e.declaredClass:e,n._loggers.get(e)||new n({module:e})}static{this._loggers=new Map}static{this._tickCounter=0}static{this._tickCounterScheduled=!1}static{this._throttlingDisabled=!1}_log(t,r,...i){if(!this._matchLevel(t))return;if("always"!==r&&!n._throttlingDisabled){const e=s(i),o=this._loggedMessages[t].get(e);if("once"===r&&null!=o||"oncePerTick"===r&&o&&o>=n._tickCounter)return;this._loggedMessages[t].set(e,n._tickCounter),n._scheduleTickCounterIncrement()}for(const n of e.log.interceptors)if(n(t,this.module,...i))return;this._inheritedWriter()(t,this.module,...i)}_parentWithMember(e,t){let r=this;for(;null!=r;){const t=r[e];if(null!=t)return t;r=r.parent}return t}_inheritedWriter(){return this._parentWithMember("writer",o)}_matchLevel(t){const r=e.log.level||"warn";return i[this._parentWithMember("level",r)]<=i[t]}static _scheduleTickCounterIncrement(){n._tickCounterScheduled||(n._tickCounterScheduled=!0,Promise.resolve().then(()=>{n._tickCounter++,n._tickCounterScheduled=!1}))}}function o(e,r,...i){console[e](`[${t(r)}]`,...i)}function s(...e){const t=(e,t)=>"object"!=typeof t||Array.isArray(t)?t:"[Object]";return r(JSON.stringify(e,t))}export{n as default};
|
package/core/Version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import t from"./Error.js";class r{constructor(t,r,o=""){this.major=t,this.minor=r,this._context=o}lessThan(t,r){return this.major<t||t===this.major&&this.minor<r}greaterEqual(t,r){return!this.lessThan(t,r)}validate(r){if(this.major!==r.major){const o=this._context&&this._context+":",
|
|
2
|
+
import t from"./Error.js";class r{constructor(t,r,o=""){this.major=t,this.minor=r,this._context=o}lessThan(t,r){return this.major<t||t===this.major&&this.minor<r}greaterEqual(t,r){return!this.lessThan(t,r)}toString(){return`${this.major}.${this.minor}`}validate(r){if(this.major!==r.major){const o=this._context&&this._context+":",s=this._context&&this._context+" ";throw new t(o+"unsupported-version",`Required major ${s}version is '${this.major}', but got '\${version.major}.\${version.minor}'`,{version:r})}}clone(){return new r(this.major,this.minor,this._context)}static parse(o,s=""){const[e,i]=o.split("."),n=/^\s*\d+\s*$/;if(!e?.match||!n.test(e)){throw new t((s&&s+":")+"invalid-version","Expected major version to be a number, but got '${version}'",{version:o})}if(!i?.match||!n.test(i)){throw new t((s&&s+":")+"invalid-version","Expected minor version to be a number, but got '${version}'",{version:o})}const a=parseInt(e,10),h=parseInt(i,10);return new r(a,h,s)}}export{r as default};
|
package/core/deprecate.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import has from"./has.js";const e=new WeakMap;function n(n,t,r=!1){const o=`🛑 DEPRECATED - ${t}`;if(!r)return void n.warn(o);let i=e.get(n);i||(i=new Set,e.set(n,i)),i.has(t)||(i.add(t),n.warn(o))}const t="https://www.esriurl.com/";function r(e,n,r,o={}){has("esri-deprecation-warnings")&&m(e,`This widget is deprecated. Use the ${n} component instead.`,{see:[`${n} component reference: ${t}${r}/`,`Esri's move to web components: ${t}components-transition-plan/`],replacement:`<${r}></${r}>`,warnOnce:!0,...o})}function o(e,n,r,o={}){has("esri-deprecation-warnings")&&m(e,`This class is deprecated. Use the ${n} component instead.`,{see:[`${n} component reference: ${t}${r}/`,`Esri's move to web components: ${t}components-transition-plan/`],replacement:`<${r}></${r}>`,warnOnce:!0,...o})}function i(e,n,t={}){has("esri-deprecation-warnings")&&m(e,`Module: ${n}`,t)}function s(e,n,t={}){if(has("esri-deprecation-warnings")){const{moduleName:r}=t;m(e,`Function: ${(r
|
|
2
|
+
import has from"./has.js";const e=new WeakMap;function n(n,t,r=!1){const o=`🛑 DEPRECATED - ${t}`;if(!r)return void n.warn(o);let i=e.get(n);i||(i=new Set,e.set(n,i)),i.has(t)||(i.add(t),n.warn(o))}const t="https://www.esriurl.com/";function r(e,n,r,o={}){has("esri-deprecation-warnings")&&m(e,`This widget is deprecated. Use the ${n} component instead.`,{see:[`${n} component reference: ${t}${r}/`,`Esri's move to web components: ${t}components-transition-plan/`],replacement:`<${r}></${r}>`,warnOnce:!0,...o})}function o(e,n,r,o={}){has("esri-deprecation-warnings")&&m(e,`This class is deprecated. Use the ${n} component instead.`,{see:[`${n} component reference: ${t}${r}/`,`Esri's move to web components: ${t}components-transition-plan/`],replacement:`<${r}></${r}>`,warnOnce:!0,...o})}function i(e,n,t={}){has("esri-deprecation-warnings")&&m(e,`Module: ${$(n)}`,t)}function s(e,n,t={}){if(has("esri-deprecation-warnings")){const{moduleName:r}=t;m(e,`Function: ${(r?$(r)+"::":"")+n+"()"}`,t)}}function c(e,n,t={}){if(has("esri-deprecation-warnings")){const{moduleName:r}=t;m(e,`Property: ${(r?$(r)+"::":"")+n}`,t)}}function a(e,n,t,r={}){if(has("esri-deprecation-warnings")){const{moduleName:o}=r;m(e,`'${(o?$(o)+"::":"")+n}' value: ${t}`,r)}}function p(e,n,t={}){has("esri-deprecation-warnings")&&m(e,`Multiple argument constructor: ${n=$(n)}`,{warnOnce:!0,replacement:`new ${n}({ <your properties here> })`,...t})}function m(e,t,r={}){if(has("esri-deprecation-warnings")){const{replacement:o,version:i,see:s,warnOnce:c}=r;let a=t;if(o&&(a+=`\n\t🛠️ Replacement: ${o}`),i&&(a+=`\n\t⚙️ Version: ${i}`),s)if(Array.isArray(s)){a+="\n\t🔗 See for more details:";for(const e of s)a+=`\n\t\t${e}`}else a+=`\n\t🔗 See ${s} for more details.`;n(e,a,c)}}function $(e){return e.startsWith("esri.")?e.replace("esri.","@arcgis/core/").replaceAll(".","/"):e}export{o as deprecateUnnecessaryViewModel,r as deprecateWidget,m as deprecated,p as deprecatedConstructorSignature,s as deprecatedFunction,i as deprecatedModule,c as deprecatedProperty,a as deprecatedPropertyValue,$ as esriToCore,t as esriurl};
|
package/core/has.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
const e=globalThis,a={...e.esriConfig?.has};function has(d){return"function"==typeof a[d]?a[d]=a[d](e):a[d]}has.add=(e,d,r,t)=>{(t||void 0===a[e])&&(a[e]=d),r&&has(e)},has.cache=a,has.add("big-integer-warning-enabled",!0),has.add("esri-deprecation-warnings",!0),has.add("esri-tests-disable-screenshots",!1),has.add("esri-tests-use-full-window",!1),has.add("esri-tests-post-to-influx",!0),has.add("esri-cim-animations-enable-status","enabled"),has.add("esri-cim-animations-spotlight",!1),has.add("esri-cim-animations-freeze-time",!1),(()=>{has.add("host-webworker",void 0!==e.WorkerGlobalScope&&self instanceof e.WorkerGlobalScope);const a="undefined"!=typeof window&&"undefined"!=typeof location&&"undefined"!=typeof document&&window.location===location&&window.document===document;if(has.add("host-browser",a),has.add("host-node",!("object"!=typeof e.process||!e.process.versions?.node||!e.process.versions.v8)),has.add("dom",a),has("host-browser")){const e=navigator,a=e.userAgent,d=e.appVersion,r=parseFloat(d);if(has.add("wp",parseFloat(a.split("Windows Phone")[1])||void 0),has.add("msapp",parseFloat(a.split("MSAppHost/")[1])||void 0),has.add("khtml",d.includes("Konqueror")?r:void 0),has.add("edge",parseFloat(a.split("Edge/")[1])||void 0),has.add("opr",parseFloat(a.split("OPR/")[1])||void 0),has.add("webkit",!has("wp")&&!has("edge")&&parseFloat(a.split("WebKit/")[1])||void 0),has.add("chrome",!has("edge")&&!has("opr")&&parseFloat(a.split("Chrome/")[1])||void 0),has.add("android",!has("wp")&&parseFloat(a.split("Android ")[1])||void 0),has.add("safari",!d.includes("Safari")||has("wp")||has("chrome")||has("android")||has("edge")||has("opr")?void 0:parseFloat(d.split("Version/")[1])),has.add("mac",d.includes("Macintosh")),!has("wp")&&/(iPhone|iPod|iPad)/.test(a)){const e=RegExp.$1.replace(/P/,"p"),d=/OS ([\d_]+)/.test(a)?RegExp.$1:"1",r=parseFloat(d.replace(/_/,".").replaceAll("_",""));has.add(e,r),has.add("ios",r)}has("webkit")||(!a.includes("Gecko")||has("wp")||has("khtml")||has("edge")||has.add("mozilla",r),has("mozilla")&&has.add("ff",parseFloat(a.split("Firefox/")[1]||a.split("Minefield/")[1])||void 0))}})(),(()=>{if(e.navigator){const e=navigator.userAgent,a=/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini|IEMobile/i.test(e),d=/iPhone/i.test(e);a&&has.add("esri-mobile",a),d&&has.add("esri-iPhone",d),has.add("esri-geolocation",!!navigator.geolocation)}has.add("esri-wasm","WebAssembly"in e),has.add("esri-performance-mode-frames-between-render",20),has.add("esri-force-performance-mode",!1),has.add("esri-shared-array-buffer",()=>{const a="SharedArrayBuffer"in e,d=!1===e.crossOriginIsolated;return a&&!d}),has.add("wasm-simd",()=>{const e=[0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11];return WebAssembly.validate(new Uint8Array(e))}),has.add("esri-atomics","Atomics"in e),has.add("esri-workers","Worker"in e),has.add("web-feat:cache","caches"in e),has.add("esri-workers-arraybuffer-transfer",!has("safari")||Number(has("safari"))>=12),has.add("workers-pool-size",8),has.add("featurelayer-simplify-thresholds",[.5,.5,.5,.5]),has.add("featurelayer-simplify-payload-size-factors",[1,1,4]),has.add("featurelayer-animation-enabled",!0),has.add("featurelayer-snapshot-enabled",!0),has.add("featurelayer-snapshot-initial-tolerance",0),has.add("featurelayer-snapshot-point-min-threshold",8e4),has.add("featurelayer-snapshot-point-max-threshold",4e5),has.add("featurelayer-snapshot-multipoint-min-threshold",2e4),has.add("featurelayer-snapshot-multipoint-max-threshold",1e5),has.add("featurelayer-snapshot-polygon-min-threshold",2e3),has.add("featurelayer-snapshot-polygon-max-threshold",2e3),has.add("featurelayer-snapshot-polyline-min-threshold",2e3),has.add("featurelayer-snapshot-polyline-max-threshold",2e3),has.add("featurelayer-snapshot-max-vertex-count",25e4),has.add("featurelayer-snapshot-non-hosted-exceedslimit-enabled",!0),has.add("featurelayer-snapshot-concurrency",4),has.add("featurelayer-snapshot-allow-editable",!1),has.add("featurelayer-snapshot-coverage",.1),has.add("featurelayer-query-max-depth",4),has.add("featurelayer-query-pausing-enabled",!1),has.add("featurelayer-query-tile-concurrency",4),has.add("featurelayer-query-tile-max-features",6e5),has.add("featurelayer-advanced-symbols",!1),has.add("featurelayer-pbf",!0),has.add("featurelayer-pbf-statistics",!1),has.add("feature-layers-workers",!0),has.add("feature-polyline-generalization-factor",1),has.add("parquetlayer-full-query-feature-count",2e4),has.add("parquetlayer-hittest-max-feature-count",1),has.add("parquetlayer-persistence-enabled",!1),has.add("parquetlayer-cache-enabled",!0),has.add("mapview-transitions-duration",200),has.add("mapview-essential-goto-duration",200),has.add("mapview-srswitch-adjust-rotation-scale-threshold",24e6),has.add("mapserver-pbf-version-support",10.81),has.add("mapservice-popup-identify-max-tolerance",20),has.add("request-queue-concurrency-global",50),has.add("request-queue-concurrency-hosted",16),has.add("request-queue-concurrency-non-hosted",6),has.add("curve-densification-coarse-segments",128),has.add("curve-densification-max-segments",2e3),has.add("curve-densification-min-segments",3),has.add("curve-densification-pixel-deviation",.5),has.add("view-readyState-waiting-delay",1e3),has.add("gradient-depth-bias",.01),has.add("gradient-depth-epsilon",1e-8),has.add("enable-feature:esri-compress-textures",!0),has.add("enable-feature:basemap-groundlayers",!0),has.add("enable-feature:oit-ground",!0),has.add("enable-feature:im-shading",!0),!has("host-webworker")&&has("host-browser")&&(has.add("esri-csp-restrictions",()=>{try{new Function}catch{return!0}return!1}),has.add("esri-url-encodes-apostrophe",()=>{const e=window.document.createElement("a");return e.href="?'",e.href.includes("?%27")}))})();export{has as default};
|
|
2
|
+
const e=globalThis,a={...e.esriConfig?.has};function has(d){return"function"==typeof a[d]?a[d]=a[d](e):a[d]}has.add=(e,d,r,t)=>{(t||void 0===a[e])&&(a[e]=d),r&&has(e)},has.cache=a,has.add("big-integer-warning-enabled",!0),has.add("esri-deprecation-warnings",!0),has.add("esri-tests-disable-screenshots",!1),has.add("esri-tests-use-full-window",!1),has.add("esri-tests-post-to-influx",!0),has.add("esri-cim-animations-enable-status","enabled"),has.add("esri-cim-animations-spotlight",!1),has.add("esri-cim-animations-freeze-time",!1),(()=>{has.add("host-webworker",void 0!==e.WorkerGlobalScope&&self instanceof e.WorkerGlobalScope);const a="undefined"!=typeof window&&"undefined"!=typeof location&&"undefined"!=typeof document&&window.location===location&&window.document===document;if(has.add("host-browser",a),has.add("host-node",!("object"!=typeof e.process||!e.process.versions?.node||!e.process.versions.v8)),has.add("dom",a),has("host-browser")){const e=navigator,a=e.userAgent,d=e.appVersion,r=parseFloat(d);if(has.add("wp",parseFloat(a.split("Windows Phone")[1])||void 0),has.add("msapp",parseFloat(a.split("MSAppHost/")[1])||void 0),has.add("khtml",d.includes("Konqueror")?r:void 0),has.add("edge",parseFloat(a.split("Edge/")[1])||void 0),has.add("opr",parseFloat(a.split("OPR/")[1])||void 0),has.add("webkit",!has("wp")&&!has("edge")&&parseFloat(a.split("WebKit/")[1])||void 0),has.add("chrome",!has("edge")&&!has("opr")&&parseFloat(a.split("Chrome/")[1])||void 0),has.add("android",!has("wp")&&parseFloat(a.split("Android ")[1])||void 0),has.add("safari",!d.includes("Safari")||has("wp")||has("chrome")||has("android")||has("edge")||has("opr")?void 0:parseFloat(d.split("Version/")[1])),has.add("mac",d.includes("Macintosh")),!has("wp")&&/(iPhone|iPod|iPad)/.test(a)){const e=RegExp.$1.replace(/P/,"p"),d=/OS ([\d_]+)/.test(a)?RegExp.$1:"1",r=parseFloat(d.replace(/_/,".").replaceAll("_",""));has.add(e,r),has.add("ios",r)}has("webkit")||(!a.includes("Gecko")||has("wp")||has("khtml")||has("edge")||has.add("mozilla",r),has("mozilla")&&has.add("ff",parseFloat(a.split("Firefox/")[1]||a.split("Minefield/")[1])||void 0))}})(),(()=>{if(e.navigator){const e=navigator.userAgent,a=/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini|IEMobile/i.test(e),d=/iPhone/i.test(e);a&&has.add("esri-mobile",a),d&&has.add("esri-iPhone",d),has.add("esri-geolocation",!!navigator.geolocation)}has.add("esri-wasm","WebAssembly"in e),has.add("esri-performance-mode-frames-between-render",20),has.add("esri-force-performance-mode",!1),has.add("esri-shared-array-buffer",()=>{const a="SharedArrayBuffer"in e,d=!1===e.crossOriginIsolated;return a&&!d}),has.add("wasm-simd",()=>{const e=[0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11];return WebAssembly.validate(new Uint8Array(e))}),has.add("esri-atomics","Atomics"in e),has.add("esri-workers","Worker"in e),has.add("web-feat:cache","caches"in e),has.add("esri-workers-arraybuffer-transfer",!has("safari")||Number(has("safari"))>=12),has.add("workers-pool-size",8),has.add("featurelayer-simplify-thresholds",[.5,.5,.5,.5]),has.add("featurelayer-simplify-payload-size-factors",[1,1,4]),has.add("featurelayer-animation-enabled",!0),has.add("featurelayer-snapshot-enabled",!0),has.add("featurelayer-snapshot-initial-tolerance",0),has.add("featurelayer-snapshot-point-min-threshold",8e4),has.add("featurelayer-snapshot-point-max-threshold",4e5),has.add("featurelayer-snapshot-multipoint-min-threshold",2e4),has.add("featurelayer-snapshot-multipoint-max-threshold",1e5),has.add("featurelayer-snapshot-polygon-min-threshold",2e3),has.add("featurelayer-snapshot-polygon-max-threshold",2e3),has.add("featurelayer-snapshot-polyline-min-threshold",2e3),has.add("featurelayer-snapshot-polyline-max-threshold",2e3),has.add("featurelayer-snapshot-max-vertex-count",25e4),has.add("featurelayer-snapshot-non-hosted-exceedslimit-enabled",!0),has.add("featurelayer-snapshot-concurrency",4),has.add("featurelayer-snapshot-allow-editable",!1),has.add("featurelayer-snapshot-coverage",.1),has.add("featurelayer-query-max-depth",4),has.add("featurelayer-query-pausing-enabled",!1),has.add("featurelayer-query-tile-concurrency",4),has.add("featurelayer-query-tile-max-features",6e5),has.add("featurelayer-advanced-symbols",!1),has.add("featurelayer-pbf",!0),has.add("featurelayer-pbf-statistics",!1),has.add("feature-layers-workers",!0),has.add("feature-polyline-generalization-factor",1),has.add("featurelayer-relative-time-queries-enabled",!0),has.add("featurelayer-relative-time-queries-bin-window-public",1),has.add("featurelayer-relative-time-queries-bin-window-private",60),has.add("parquetlayer-full-query-feature-count",2e4),has.add("parquetlayer-hittest-max-feature-count",1),has.add("parquetlayer-persistence-enabled",!1),has.add("parquetlayer-cache-enabled",!0),has.add("mapview-transitions-duration",200),has.add("mapview-essential-goto-duration",200),has.add("mapview-srswitch-adjust-rotation-scale-threshold",24e6),has.add("mapserver-pbf-version-support",10.81),has.add("mapservice-popup-identify-max-tolerance",20),has.add("request-queue-concurrency-global",50),has.add("request-queue-concurrency-hosted",16),has.add("request-queue-concurrency-non-hosted",6),has.add("curve-densification-coarse-segments",128),has.add("curve-densification-max-segments",2e3),has.add("curve-densification-min-segments",3),has.add("curve-densification-pixel-deviation",.5),has.add("view-readyState-waiting-delay",1e3),has.add("gradient-depth-bias",.01),has.add("gradient-depth-epsilon",1e-8),has.add("enable-feature:esri-compress-textures",!0),has.add("enable-feature:basemap-groundlayers",!0),has.add("enable-feature:oit-ground",!0),has.add("enable-feature:im-shading",!0),!has("host-webworker")&&has("host-browser")&&(has.add("esri-csp-restrictions",()=>{try{new Function}catch{return!0}return!1}),has.add("esri-url-encodes-apostrophe",()=>{const e=window.document.createElement("a");return e.href="?'",e.href.includes("?%27")}))})();export{has as default};
|
package/core/iteratorUtils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
function n(n){const t=[];return function*(){yield*t;let e,
|
|
2
|
+
function n(n){const t=[];return function*(){yield*t;let e,o=t.length;for(;!(e=n.next()).done;)for(t.push(e.value),yield e.value;++o<t.length;)yield t[o]}}const t=Object.freeze({done:!0,value:void 0});function e(n){const e=[];let o=null,l=null,u=!1;async function r(){if(u)return t;if(null!=l)return l;l=n.next();try{const n=await l;return l=null,n.done?(u=!0,t):(e.push(n.value),n)}catch(r){throw u=!0,l=null,o=r,r}}return async function*(){yield*e;let n,t=e.length;for(;!(n=await r()).done;)for(yield n.value;++t<e.length;)yield e[t];if(null!=o)throw o}}function o(n,t){for(const e of n)if(null!=e&&t(e))return e}function l(n,t){for(const e of n)if(t(e))return!0;return!1}function u(n){return null!=n&&"function"==typeof n[Symbol.iterator]}function r(n){return n.done?void 0:n.value}export{n as cache,e as cacheAsync,o as find,r as getYieldedValue,u as isIterable,l as some};
|
package/core/sql/WhereClause.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import has from"../has.js";import{isAggregate as e,aggregateFunction as t}from"./AggregateFunctions.js";import{DateOnly as r}from"./DateOnly.js";import{SqlError as a}from"./errorSupport.js";import{sqlCalculateFunction as n}from"./sqlArithmeticUtils.js";import{sqlCompare as s,flipSqlComparisonOperator as i,prepareDateFieldToTimestampLiteralComparisonData as o,isDateOrTimeValue as l}from"./sqlCompareUtils.js";import{isDateTime as u,isTimestampOffset as c,isTimeOnly as p,isDateOnly as m,parseTime as h,parseTimestamp as d,parseDate as f,convertToExecutingTimeZone as _}from"./sqlDateParsingUtils.js";import{SqlInterval as N}from"./SqlInterval.js";import{SqlTimeStampOffset as g}from"./SqlTimestampOffset.js";import{evaluateFunction as v,isStandardized as y}from"./StandardizedFunctions.js";import{TimeOnly as S}from"./TimeOnly.js";import{WhereGrammar as T,visitAll as w}from"./WhereGrammar.js";import{isDate as D}from"../../support/guards.js";import{getLuxonTimeZone as I}from"../../time/timeZoneUtils.js";import{DateTime as x,FixedOffsetZone as F}from"luxon";const $=new Set(["current_timestamp","current_date","current_time"]);class E{constructor(e){this.staticData=e}makeBool(e){return M(e)}featureValue(e,t,r,a){return ae(e,t,r,a)}equalsNull(e){return null===e}applyLike(e,t,r){return ee(e,t,r)}ensureArray(e){return J(e)}applyIn(e,t){return K(e,t)}currentTimestamp(e){return Q(e)}currentDate(e){return P(e)}currentTime(e){return H(e)}makeSqlInterval(e,t,r){return N.createFromValueAndQualifier(e,t,r)}convertInterval(e){return N.isInterval(e)?e.valueInMilliseconds():e}compare(e,t,r){return s(t,r,e)}calculate(e,t,r,a){return n(e,t,r,a)}evaluateTime(e){return h(e)}evaluateTimestamp(e,t){return d(e,t)}evaluateDate(e,t){return f(e,t)}evaluateFunction(e,t,r){return v(e,t,r)}lookup(e,t){const r=t[e];return void 0===r?null:r}between(e,t){return null==e||null==t[0]||null==t[1]?null:s(e,t[0],">=")&&s(e,t[1],"<=")}notbetween(e,t){return null==e||null==t[0]||null==t[1]?null:s(e,t[0],"<")||s(e,t[1],">")}ternaryNot(e){return B(e)}ternaryAnd(e,t){return W(e,t)}ternaryOr(e,t){return G(e,t)}}function b(e,...t){return`this.${e}(${t.join(", ")})`}function A(e){return void 0===e?"void 0":JSON.stringify(e)}function O({type:e,start:t,end:r}){return`{type: ${A(e)}, start: ${V(t)}, end: ${V(r)}}`}function V({type:e,period:t,precision:r,secondary:a}){return JSON.stringify({type:e,period:t,precision:r,secondary:a})}function U({type:e,size:t,withtimezone:r}){return JSON.stringify({type:e,size:t,withtimezone:r})}const j="feature",k="lookups",q="attributeAdapter",C="fieldsIndex",R="timeZone",L="currentUser";class Z{constructor(e,t){this._parseTree=e,this._fieldsIndex=t,this._staticData=Object.create(null),this._nextStaticDataId=0,this._tempVars=new Set,this._nextTempVarId=0}compile(){const e=this._compileNode(this._parseTree),t=`\n ${this._tempVars.size>0?`var ${Array.from(this._tempVars).join(", ")};`:""}\n return this.convertInterval(${e});\n `;return new Function(j,k,q,C,R,L,t).bind(new E(this._staticData))}_storeStaticData(e){const t="static$"+this._nextStaticDataId++;return this._staticData[t]=e,t}_compileRefStaticData(e){return`this.staticData[${A(e)}]`}_generateTempVar(){const e="temp$"+this._nextTempVarId++;return this._tempVars.add(e),e}_compileSimpleCase(e){const t=this._compileNode(e.operand),r=this._generateTempVar(),a=[];for(const n of e.clauses){const e=b("compare",A("="),r,this._compileNode(n.operand)),t=this._compileNode(n.value);a.push(`${e} ? (${t}) :`)}return null!=e.else?a.push(this._compileNode(e.else)):a.push(A(null)),`(${r} = ${t}, ${a.join(" ")})`}_compileSearchedCase(e){const t=[];for(const r of e.clauses){const e=b("makeBool",this._compileNode(r.operand)),a=this._compileNode(r.value);t.push(`${e} ? (${a}) :`)}return null!=e.else?t.push(this._compileNode(e.else)):t.push(A(null)),t.join(" ")}_compileInExpr(e,t){const r=new Set,a=[];for(const i of t.value)"number"===i.type||"string"===i.type?r.add(i.value):a.push(i);const n=this._compileNode(e),s=b("ensureArray",this._compileNode({type:"expression-list",location:t.location,value:a}));if(r.size>0){const e=this._compileRefStaticData(this._storeStaticData(r)),t=this._generateTempVar();return a.length>0?`(${t} = ${n}, ${e}.has(${t}) || ${b("applyIn",t,s)})`:`(${t} = ${n}, ${t} == null ? null : ${e}.has(${t}))`}return b("applyIn",n,s)}_compileNode(e){switch(e.type){case"interval":return b("makeSqlInterval",this._compileNode(e.value),"interval-qualifier"===e.qualifier.type?O(e.qualifier):V(e.qualifier),A(e.op));case"case-expression":return"simple"===e.format?this._compileSimpleCase(e):this._compileSearchedCase(e);case"parameter":return b("lookup",A(e.value.toLowerCase()),k);case"expression-list":return`[${e.value.map(e=>this._compileNode(e)).join(", ")}]`;case"unary-expression":return b("ternaryNot",this._compileNode(e.expr));case"binary-expression":switch(e.operator){case"AND":return b("ternaryAnd",this._compileNode(e.left),this._compileNode(e.right));case"OR":return b("ternaryOr",this._compileNode(e.left),this._compileNode(e.right));case"IS":if("null"!==e.right.type)throw new a("UnsupportedIsRhs");return b("equalsNull",this._compileNode(e.left));case"ISNOT":if("null"!==e.right.type)throw new a("UnsupportedIsRhs");return`!${b("equalsNull",this._compileNode(e.left))}`;case"IN":return this._compileInExpr(e.left,e.right);case"NOT IN":return b("ternaryNot",this._compileInExpr(e.left,e.right));case"BETWEEN":return b("between",this._compileNode(e.left),this._compileNode(e.right));case"NOTBETWEEN":return b("notbetween",this._compileNode(e.left),this._compileNode(e.right));case"LIKE":return b("applyLike",this._compileNode(e.left),this._compileNode(e.right),A(e.escape));case"NOT LIKE":return b("ternaryNot",b("applyLike",this._compileNode(e.left),this._compileNode(e.right),A(e.escape)));case"<>":case"<":case">":case">=":case"<=":case"=":if(te(e,e.operator,this._fieldsIndex)){const t=e.comparisonData;return b("compare",A(t.op),b("featureValue",j,A(t.fieldName),A(null),q),this._compileRefStaticData(this._storeStaticData(t.comparisonEpochMs)))}return b("compare",A(e.operator),this._compileNode(e.left),this._compileNode(e.right));case"*":case"-":case"+":case"/":case"||":return b("calculate",A(e.operator),this._compileNode(e.left),this._compileNode(e.right),R);default:throw new a("UnsupportedOperator",{operator:e.operator})}case"null":case"boolean":case"string":case"number":return A(e.value);case"time":try{return this._compileRefStaticData(this._storeStaticData(h(e.value)))}catch{return b("evaluateTime",A(e.value))}case"date":try{return this._compileRefStaticData(this._storeStaticData(f(e.value,"unknown")))}catch{return b("evaluateDate",A(e.value),A("unknown"))}case"timestamp":try{return this._compileRefStaticData(this._storeStaticData(d(e.value,"unknown")))}catch{return b("evaluateTimestamp",A(e.value),A("unknown"))}case"current-time":return"date"===e.mode?b("currentDate",R):"time"===e.mode?b("currentTime",R):b("currentTimestamp",R);case"current-user":return L;case"column-reference":return b("featureValue",j,A(e.column),C,q);case"data-type":return U(e.value);case"function":return b("evaluateFunction",A(e.name),this._compileNode(e.args),R)}throw new a("UnsupportedSyntax",{node:e.type})}}class z{static create(e,t={}){return new z(e,t.fieldsIndex,t.timeZone??void 0,t.currentUser)}constructor(e,t,r="UTC",a=null){this.fieldsIndex=t,this.timeZone=r,this.currentUser=a,this.parameters={},this._compiledExecutor=null,this._hasDateFunctions=void 0,this.parseTree=T.parse(e);const{isStandardized:n,isAggregate:s,currentUserRequired:i,referencedFieldNames:o}=this._extractExpressionInfo(t);this._referencedFieldNames=o,this.isStandardized=n,this.isAggregate=s,this.currentUserRequired=i}static convertValueToStorageFormat(e,t=null){if(null===t)return D(e)?e.getTime():u(e)?e.toMillis():c(e)?e.toStorageFormat():p(e)?e.toStorageString():m(e)?e.toStorageFormat():e;switch(t){case"date":return D(e)?e.getTime():u(e)?e.toMillis():c(e)?e.toMilliseconds():m(e)?e.toNumber():e;case"date-only":return D(e)?r.fromDateJS(e).toString():c(e)?r.fromSqlTimeStampOffset(e).toString():u(e)?r.fromDateTime(e).toString():e;case"time-only":return D(e)?S.fromDateJS(e).toStorageString():u(e)?S.fromDateTime(e).toStorageString():c(e)?S.fromSqlTimeStampOffset(e).toStorageString():p(e)?e.toStorageString():e;case"timestamp-offset":if(D(e))return g.fromJSDate(e).toStorageFormat();if(u(e))return g.fromDateTime(e).toStorageFormat();if(c(e))return e.toStorageFormat()}return e}get fieldNames(){return this._referencedFieldNames}testSet(e,t=ne,r=this.currentUser){return!!this._evaluateNode(this.parseTree,null,t,e,r)}calculateValue(e,t=ne,r=this.currentUser){const a=this._evaluateNode(this.parseTree,e,t,null,r);return N.isInterval(a)?a.valueInMilliseconds()/864e5:a}tryGetCompiledExecutor(){if(null!=this._compiledExecutor)return this._compiledExecutor;if(has("esri-csp-restrictions"))return null;const e=new Z(this.parseTree,this.fieldsIndex);return this._compiledExecutor=e.compile(),this._compiledExecutor}calculateValueCompiled(e,t=ne,r=this.currentUser){const a=this.tryGetCompiledExecutor();return null==a?this.calculateValue(e,t):a(e,this.parameters,t,this.fieldsIndex,this.timeZone,r??null)}testFeature(e,t=ne,r=this.currentUser){return!!this._evaluateNode(this.parseTree,e,t,null,r)}testFeatureCompiled(e,t=ne,r=this.currentUser){const a=this.tryGetCompiledExecutor();return null==a?this.testFeature(e,t):!!a(e,this.parameters,t,this.fieldsIndex,this.timeZone,r??null)}get hasDateFunctions(){return null!=this._hasDateFunctions||(this._hasDateFunctions=!1,w(this.parseTree,e=>{"current-time"===e.type?this._hasDateFunctions=!0:"function"===e.type&&(this._hasDateFunctions=this._hasDateFunctions||$.has(e.name.toLowerCase()))})),this._hasDateFunctions}getFunctions(){const e=new Set;return w(this.parseTree,t=>{"function"===t.type&&e.add(t.name.toLowerCase())}),Array.from(e)}getExpressions(){const e=new Map;return w(this.parseTree,t=>{if("function"===t.type){const r=t.name.toLowerCase(),a=t.args.value[0];if("column-reference"===a.type){const t=a.column,n=`${r}-${t}`;e.has(n)||e.set(n,{aggregateType:r,field:t})}}}),[...e.values()]}getVariables(){const e=new Set;return w(this.parseTree,t=>{"parameter"===t.type&&e.add(t.value.toLowerCase())}),Array.from(e)}_extractExpressionInfo(t){const r=[],a=new Set;let n=!0,s=!1,i=!1;return w(this.parseTree,o=>{switch(o.type){case"column-reference":{const e=t?.get(o.column);let n,s;e?n=s=e.name??"":(s=o.column,n=s.toLowerCase()),a.has(n)||(a.add(n),r.push(s)),o.column=s;break}case"current-user":i=!0;break;case"function":{const{name:t,args:r}=o,a=r.value.length;n&&(n=y(t,a)),!1===s&&(s=e(t,a));break}}}),{referencedFieldNames:Array.from(r),isStandardized:n,isAggregate:s,currentUserRequired:i}}_evaluateNode(r,i,o,l,u){let c;switch(r.type){case"interval":{const e=this._evaluateNode(r.value,i,o,l,u);return N.createFromValueAndQualifier(e,r.qualifier,r.op)}case"case-expression":if("simple"===r.format){const e=this._evaluateNode(r.operand,i,o,l,u);for(let t=0;t<r.clauses.length;t++)if(s(e,this._evaluateNode(r.clauses[t].operand,i,o,l,u),"="))return this._evaluateNode(r.clauses[t].value,i,o,l,u);if(null!==r.else)return this._evaluateNode(r.else,i,o,l,u)}else{for(let e=0;e<r.clauses.length;e++)if(M(this._evaluateNode(r.clauses[e].operand,i,o,l,u)))return this._evaluateNode(r.clauses[e].value,i,o,l,u);if(null!==r.else)return this._evaluateNode(r.else,i,o,l,u)}return null;case"parameter":return c=this.parameters[r.value.toLowerCase()],D(c)?x.fromJSDate(c):null!=c&&"object"==typeof c&&"toDateTime"in c?c.toDateTime():c;case"expression-list":{const e=[];for(const t of r.value)e.push(this._evaluateNode(t,i,o,l,u));return e}case"unary-expression":return B(this._evaluateNode(r.expr,i,o,l,u));case"binary-expression":switch(r.operator){case"AND":return W(this._evaluateNode(r.left,i,o,l,u),this._evaluateNode(r.right,i,o,l,u));case"OR":return G(this._evaluateNode(r.left,i,o,l,u),this._evaluateNode(r.right,i,o,l,u));case"IS":if("null"!==r.right.type)throw new a("UnsupportedIsRhs");return null===this._evaluateNode(r.left,i,o,l,u);case"ISNOT":if("null"!==r.right.type)throw new a("UnsupportedIsRhs");return null!==this._evaluateNode(r.left,i,o,l,u);case"IN":{const e=J(this._evaluateNode(r.right,i,o,l,u));return K(this._evaluateNode(r.left,i,o,l,u),e)}case"NOT IN":{const e=J(this._evaluateNode(r.right,i,o,l,u));return B(K(this._evaluateNode(r.left,i,o,l,u),e))}case"BETWEEN":{const e=this._evaluateNode(r.left,i,o,l,u),t=this._evaluateNode(r.right,i,o,l,u);return null==e||null==t[0]||null==t[1]?null:s(e,t[0],">=")&&s(e,t[1],"<=")}case"NOTBETWEEN":{const e=this._evaluateNode(r.left,i,o,l,u),t=this._evaluateNode(r.right,i,o,l,u);return null==e||null==t[0]||null==t[1]?null:s(e,t[0],"<")||s(e,t[1],">")}case"LIKE":return ee(this._evaluateNode(r.left,i,o,l,u),this._evaluateNode(r.right,i,o,l,u),r.escape);case"NOT LIKE":return B(ee(this._evaluateNode(r.left,i,o,l,u),this._evaluateNode(r.right,i,o,l,u),r.escape));case"<>":case"<":case">":case">=":case"<=":case"=":if(te(r,r.operator,this.fieldsIndex)){const e=r.comparisonData;return s(ae(i,e.fieldName,null,o),e.comparisonEpochMs,e.op)}return s(this._evaluateNode(r.left,i,o,l,u),this._evaluateNode(r.right,i,o,l,u),r.operator);case"-":case"+":case"*":case"/":case"||":return n(r.operator,this._evaluateNode(r.left,i,o,l,u),this._evaluateNode(r.right,i,o,l,u),this.timeZone)}case"null":case"boolean":case"string":case"number":return r.value;case"date":return r.parsedValue??=f(r.value,"unknown"),r.parsedValue;case"timestamp":return r.parsedValue??=d(r.value,"unknown"),r.parsedValue;case"time":return r.parsedValue??=h(r.value),r.parsedValue;case"current-time":return"date"===r.mode?P(this.timeZone):"time"===r.mode?H(this.timeZone):Q(this.timeZone);case"current-user":return u??null;case"column-reference":return ae(i,r.column,this.fieldsIndex,o);case"data-type":return r.value;case"function":{if(this.isAggregate&&e(r.name,r.args.value.length)){const e=[];for(const t of r.args?.value||[]){const r=[];for(const e of l||[])r.push(this._evaluateNode(t,e,o,null,u));e.push(r)}return t(r.name,e)}const a=this._evaluateNode(r.args,i,o,l,u);return v(r.name,a,this.timeZone)}}throw new a("UnsupportedSyntax",{node:r.type})}}function M(e){return!0===e}function J(e){return Array.isArray(e)?e:[e]}function B(e){return null!==e?!0!==e:null}function W(e,t){return null!=e&&null!=t?!0===e&&!0===t:!1!==e&&!1!==t&&null}function G(e,t){return null!=e&&null!=t?!0===e||!0===t:!0===e||!0===t||null}function K(e,t){if(null==e)return null;let r=!1;for(const a of t)if(null==a)r=null;else{if(e===a){r=!0;break}if(l(e)&&l(a)&&(r=s(e,a,"="),r))break}return r}function Q(e){return _(new Date,e)}function P(e){return r.fromNow(e)}function H(e){const t=_(new Date,e);return S.fromDateTime(t)}const X="-[]/{}()*+?.\\^$|";function Y(e,t){const r=t;let a="",n=0;for(let s=0;s<e.length;s++){const t=e.charAt(s);switch(n){case 0:t===r?n=1:X.includes(t)?a+="\\"+t:a+="%"===t?".*":"_"===t?".":t;break;case 1:X.includes(t)?a+="\\"+t:a+=t,n=0}}return new RegExp("^"+a+"$","m")}function ee(e,t,r){if(null==e)return null;return Y(t,r).test(e)}function te(e,t,r){if("comparisonData"in e)return null!=e.comparisonData;try{if(null==r)return!1;let a,n;if("column-reference"===e.left.type&&"timestamp"===e.right.type)a=e.left,n=e.right;else{if("timestamp"!==e.left.type||"column-reference"!==e.right.type)return!1;a=e.right,n=e.left,t=i(t)}const s=r.get(a.column);if("esriFieldTypeDate"!==s?.type&&"date"!==s?.type)return!1;const l=r.getTimeZone(s.name),u=null!=l?I(l):F.utcInstance;return!!u.isUniversal&&(e.comparisonData=o(s.name,u,t,n.value),!0)}finally{"comparisonData"in e||(e.comparisonData=null)}}function re(e){return e&&"object"==typeof e.attributes}function ae(e,t,a,n){if("getAttributeSQL"in n)return n.getAttributeSQL(e,t);const s=n.getAttribute(e,t);if(null==s)return s;const i=a?.get(t);switch(i?.type){case"esriFieldTypeDate":case"date":{const e=a?.getTimeZone(i.name);return _(new Date(s),null!=e?I(e):F.utcInstance)}case"esriFieldTypeDateOnly":case"date-only":return r.fromReader(s);case"esriFieldTypeTimeOnly":case"time-only":return S.fromReader(s);case"esriFieldTypeTimestampOffset":case"timestamp-offset":return new g(s)}return s}const ne={getAttribute:(e,t)=>(re(e)?e.attributes:e)[t]};export{z as default};
|
|
2
|
+
import has from"../has.js";import{some as e}from"../iteratorUtils.js";import{isAggregate as t,aggregateFunction as r}from"./AggregateFunctions.js";import{DateOnly as a}from"./DateOnly.js";import{SqlError as s}from"./errorSupport.js";import{sqlCalculateFunction as n}from"./sqlArithmeticUtils.js";import{sqlCompare as i,flipSqlComparisonOperator as o,prepareDateFieldToTimestampLiteralComparisonData as l,isDateOrTimeValue as u}from"./sqlCompareUtils.js";import{isDateTime as c,isTimestampOffset as p,isTimeOnly as m,isDateOnly as h,parseTime as d,parseTimestamp as f,parseDate as _,convertToExecutingTimeZone as N}from"./sqlDateParsingUtils.js";import{SqlInterval as g}from"./SqlInterval.js";import{SqlTimeStampOffset as v}from"./SqlTimestampOffset.js";import{iterateSqlNodes as y}from"./sqlVisitor.js";import{isStandardized as S,evaluateFunction as T}from"./StandardizedFunctions.js";import{TimeOnly as w}from"./TimeOnly.js";import{WhereGrammar as D}from"./WhereGrammar.js";import{isDate as I}from"../../support/guards.js";import{getLuxonTimeZone as x}from"../../time/timeZoneUtils.js";import{DateTime as $,FixedOffsetZone as E}from"luxon";const F=new Set(["current_timestamp","current_date","current_time"]);class b{constructor(e){this.staticData=e}makeBool(e){return J(e)}featureValue(e,t,r,a){return se(e,t,r,a)}equalsNull(e){return null===e}applyLike(e,t,r){return te(e,t,r)}ensureArray(e){return B(e)}applyIn(e,t){return Q(e,t)}currentTimestamp(e){return P(e)}currentDate(e){return H(e)}currentTime(e){return X(e)}makeSqlInterval(e,t,r){return g.createFromValueAndQualifier(e,t,r)}convertInterval(e){return g.isInterval(e)?e.valueInMilliseconds():e}compare(e,t,r){return i(t,r,e)}calculate(e,t,r,a){return n(e,t,r,a)}evaluateTime(e){return d(e)}evaluateTimestamp(e,t){return f(e,t)}evaluateDate(e,t){return _(e,t)}evaluateFunction(e,t,r){return T(e,t,r)}lookup(e,t){const r=t[e];return void 0===r?null:r}between(e,t){return null==e||null==t[0]||null==t[1]?null:i(e,t[0],">=")&&i(e,t[1],"<=")}notbetween(e,t){return null==e||null==t[0]||null==t[1]?null:i(e,t[0],"<")||i(e,t[1],">")}ternaryNot(e){return W(e)}ternaryAnd(e,t){return G(e,t)}ternaryOr(e,t){return K(e,t)}}function A(e,...t){return`this.${e}(${t.join(", ")})`}function V(e){return void 0===e?"void 0":JSON.stringify(e)}function O({type:e,start:t,end:r}){return`{type: ${V(e)}, start: ${U(t)}, end: ${U(r)}}`}function U({type:e,period:t,precision:r,secondary:a}){return JSON.stringify({type:e,period:t,precision:r,secondary:a})}function j({type:e,size:t,withtimezone:r}){return JSON.stringify({type:e,size:t,withtimezone:r})}const k="feature",q="lookups",C="attributeAdapter",R="fieldsIndex",L="timeZone",Z="currentUser";class z{constructor(e,t){this._parseTree=e,this._fieldsIndex=t,this._staticData=Object.create(null),this._nextStaticDataId=0,this._tempVars=new Set,this._nextTempVarId=0}compile(){const e=this._compileNode(this._parseTree),t=`\n ${this._tempVars.size>0?`var ${Array.from(this._tempVars).join(", ")};`:""}\n return this.convertInterval(${e});\n `;return new Function(k,q,C,R,L,Z,t).bind(new b(this._staticData))}_storeStaticData(e){const t="static$"+this._nextStaticDataId++;return this._staticData[t]=e,t}_compileRefStaticData(e){return`this.staticData[${V(e)}]`}_generateTempVar(){const e="temp$"+this._nextTempVarId++;return this._tempVars.add(e),e}_compileSimpleCase(e){const t=this._compileNode(e.operand),r=this._generateTempVar(),a=[];for(const s of e.clauses){const e=A("compare",V("="),r,this._compileNode(s.operand)),t=this._compileNode(s.value);a.push(`${e} ? (${t}) :`)}return null!=e.else?a.push(this._compileNode(e.else)):a.push(V(null)),`(${r} = ${t}, ${a.join(" ")})`}_compileSearchedCase(e){const t=[];for(const r of e.clauses){const e=A("makeBool",this._compileNode(r.operand)),a=this._compileNode(r.value);t.push(`${e} ? (${a}) :`)}return null!=e.else?t.push(this._compileNode(e.else)):t.push(V(null)),t.join(" ")}_compileInExpr(e,t){const r=new Set,a=[];for(const i of t.value)"number"===i.type||"string"===i.type?r.add(i.value):a.push(i);const s=this._compileNode(e),n=A("ensureArray",this._compileNode({type:"expression-list",location:t.location,value:a}));if(r.size>0){const e=this._compileRefStaticData(this._storeStaticData(r)),t=this._generateTempVar();return a.length>0?`(${t} = ${s}, ${e}.has(${t}) || ${A("applyIn",t,n)})`:`(${t} = ${s}, ${t} == null ? null : ${e}.has(${t}))`}return A("applyIn",s,n)}_compileNode(e){switch(e.type){case"interval":return A("makeSqlInterval",this._compileNode(e.value),"interval-qualifier"===e.qualifier.type?O(e.qualifier):U(e.qualifier),V(e.op));case"case-expression":return"simple"===e.format?this._compileSimpleCase(e):this._compileSearchedCase(e);case"parameter":return A("lookup",V(e.value.toLowerCase()),q);case"expression-list":return`[${e.value.map(e=>this._compileNode(e)).join(", ")}]`;case"unary-expression":return A("ternaryNot",this._compileNode(e.expr));case"binary-expression":switch(e.operator){case"AND":return A("ternaryAnd",this._compileNode(e.left),this._compileNode(e.right));case"OR":return A("ternaryOr",this._compileNode(e.left),this._compileNode(e.right));case"IS":if("null"!==e.right.type)throw new s("UnsupportedIsRhs");return A("equalsNull",this._compileNode(e.left));case"ISNOT":if("null"!==e.right.type)throw new s("UnsupportedIsRhs");return`!${A("equalsNull",this._compileNode(e.left))}`;case"IN":return this._compileInExpr(e.left,e.right);case"NOT IN":return A("ternaryNot",this._compileInExpr(e.left,e.right));case"BETWEEN":return A("between",this._compileNode(e.left),this._compileNode(e.right));case"NOTBETWEEN":return A("notbetween",this._compileNode(e.left),this._compileNode(e.right));case"LIKE":return A("applyLike",this._compileNode(e.left),this._compileNode(e.right),V(e.escape));case"NOT LIKE":return A("ternaryNot",A("applyLike",this._compileNode(e.left),this._compileNode(e.right),V(e.escape)));case"<>":case"<":case">":case">=":case"<=":case"=":if(re(e,e.operator,this._fieldsIndex)){const t=e.comparisonData;return A("compare",V(t.op),A("featureValue",k,V(t.fieldName),V(null),C),this._compileRefStaticData(this._storeStaticData(t.comparisonEpochMs)))}return A("compare",V(e.operator),this._compileNode(e.left),this._compileNode(e.right));case"*":case"-":case"+":case"/":case"||":return A("calculate",V(e.operator),this._compileNode(e.left),this._compileNode(e.right),L);default:throw new s("UnsupportedOperator",{operator:e.operator})}case"null":case"boolean":case"string":case"number":return V(e.value);case"time":try{return this._compileRefStaticData(this._storeStaticData(d(e.value)))}catch{return A("evaluateTime",V(e.value))}case"date":try{return this._compileRefStaticData(this._storeStaticData(_(e.value,"unknown")))}catch{return A("evaluateDate",V(e.value),V("unknown"))}case"timestamp":try{return this._compileRefStaticData(this._storeStaticData(f(e.value,"unknown")))}catch{return A("evaluateTimestamp",V(e.value),V("unknown"))}case"current-time":return"date"===e.mode?A("currentDate",L):"time"===e.mode?A("currentTime",L):A("currentTimestamp",L);case"current-user":return Z;case"column-reference":return A("featureValue",k,V(e.column),R,C);case"data-type":return j(e.value);case"function":return A("evaluateFunction",V(e.name),this._compileNode(e.args),L)}throw new s("UnsupportedSyntax",{node:e.type})}}class M{static create(e,t={}){return new M(e,t.fieldsIndex,t.timeZone??void 0,t.currentUser)}constructor(e,t,r="UTC",a=null){this.fieldsIndex=t,this.timeZone=r,this.currentUser=a,this.parameters={},this._compiledExecutor=null,this._hasDateFunctions=void 0,this.parseTree=D.parse(e);const{isStandardized:s,isAggregate:n,currentUserRequired:i,referencedFieldNames:o}=this._extractExpressionInfo(t);this._referencedFieldNames=o,this.isStandardized=s,this.isAggregate=n,this.currentUserRequired=i}static convertValueToStorageFormat(e,t=null){if(null===t)return I(e)?e.getTime():c(e)?e.toMillis():p(e)?e.toStorageFormat():m(e)?e.toStorageString():h(e)?e.toStorageFormat():e;switch(t){case"date":return I(e)?e.getTime():c(e)?e.toMillis():p(e)?e.toMilliseconds():h(e)?e.toNumber():e;case"date-only":return I(e)?a.fromDateJS(e).toString():p(e)?a.fromSqlTimeStampOffset(e).toString():c(e)?a.fromDateTime(e).toString():e;case"time-only":return I(e)?w.fromDateJS(e).toStorageString():c(e)?w.fromDateTime(e).toStorageString():p(e)?w.fromSqlTimeStampOffset(e).toStorageString():m(e)?e.toStorageString():e;case"timestamp-offset":if(I(e))return v.fromJSDate(e).toStorageFormat();if(c(e))return v.fromDateTime(e).toStorageFormat();if(p(e))return e.toStorageFormat()}return e}get fieldNames(){return this._referencedFieldNames}testSet(e,t=ne,r=this.currentUser){return!!this._evaluateNode(this.parseTree,null,t,e,r)}calculateValue(e,t=ne,r=this.currentUser){const a=this._evaluateNode(this.parseTree,e,t,null,r);return g.isInterval(a)?a.valueInMilliseconds()/864e5:a}tryGetCompiledExecutor(){if(null!=this._compiledExecutor)return this._compiledExecutor;if(has("esri-csp-restrictions"))return null;const e=new z(this.parseTree,this.fieldsIndex);return this._compiledExecutor=e.compile(),this._compiledExecutor}calculateValueCompiled(e,t=ne,r=this.currentUser){const a=this.tryGetCompiledExecutor();return null==a?this.calculateValue(e,t):a(e,this.parameters,t,this.fieldsIndex,this.timeZone,r??null)}testFeature(e,t=ne,r=this.currentUser){return!!this._evaluateNode(this.parseTree,e,t,null,r)}testFeatureCompiled(e,t=ne,r=this.currentUser){const a=this.tryGetCompiledExecutor();return null==a?this.testFeature(e,t):!!a(e,this.parameters,t,this.fieldsIndex,this.timeZone,r??null)}get hasDateFunctions(){return null!=this._hasDateFunctions||(this._hasDateFunctions=e(y(this.parseTree),e=>"current-time"===e.type||"function"===e.type&&F.has(e.name.toLowerCase()))),this._hasDateFunctions}getFunctions(){const e=new Set;for(const t of y(this.parseTree))"function"===t.type&&e.add(t.name.toLowerCase());return Array.from(e)}getExpressions(){const e=new Map;for(const t of y(this.parseTree))if("function"===t.type){const r=t.name.toLowerCase(),a=t.args.value[0];if("column-reference"===a.type){const t=a.column,s=`${r}-${t}`;e.has(s)||e.set(s,{aggregateType:r,field:t})}}return Array.from(e.values())}getVariables(){const e=new Set;for(const t of y(this.parseTree))"parameter"===t.type&&e.add(t.value.toLowerCase());return Array.from(e)}_extractExpressionInfo(e){const r=[],a=new Set;let s=!0,n=!1,i=!1;for(const o of y(this.parseTree))switch(o.type){case"column-reference":{const t=e?.get(o.column);let s,n;t?s=n=t.name??"":(n=o.column,s=n.toLowerCase()),a.has(s)||(a.add(s),r.push(n)),o.column=n;break}case"current-user":i=!0;break;case"function":{const{name:e,args:r}=o,a=r.value.length;s&&(s=S(e,a)),!1===n&&(n=t(e,a));break}}return{referencedFieldNames:Array.from(r),isStandardized:s,isAggregate:n,currentUserRequired:i}}_evaluateNode(e,a,o,l,u){let c;switch(e.type){case"interval":{const t=this._evaluateNode(e.value,a,o,l,u);return g.createFromValueAndQualifier(t,e.qualifier,e.op)}case"case-expression":if("simple"===e.format){const t=this._evaluateNode(e.operand,a,o,l,u);for(let r=0;r<e.clauses.length;r++)if(i(t,this._evaluateNode(e.clauses[r].operand,a,o,l,u),"="))return this._evaluateNode(e.clauses[r].value,a,o,l,u);if(null!==e.else)return this._evaluateNode(e.else,a,o,l,u)}else{for(let t=0;t<e.clauses.length;t++)if(J(this._evaluateNode(e.clauses[t].operand,a,o,l,u)))return this._evaluateNode(e.clauses[t].value,a,o,l,u);if(null!==e.else)return this._evaluateNode(e.else,a,o,l,u)}return null;case"parameter":return c=this.parameters[e.value.toLowerCase()],I(c)?$.fromJSDate(c):null!=c&&"object"==typeof c&&"toDateTime"in c?c.toDateTime():c;case"expression-list":{const t=[];for(const r of e.value)t.push(this._evaluateNode(r,a,o,l,u));return t}case"unary-expression":return W(this._evaluateNode(e.expr,a,o,l,u));case"binary-expression":switch(e.operator){case"AND":return G(this._evaluateNode(e.left,a,o,l,u),this._evaluateNode(e.right,a,o,l,u));case"OR":return K(this._evaluateNode(e.left,a,o,l,u),this._evaluateNode(e.right,a,o,l,u));case"IS":if("null"!==e.right.type)throw new s("UnsupportedIsRhs");return null===this._evaluateNode(e.left,a,o,l,u);case"ISNOT":if("null"!==e.right.type)throw new s("UnsupportedIsRhs");return null!==this._evaluateNode(e.left,a,o,l,u);case"IN":{const t=B(this._evaluateNode(e.right,a,o,l,u));return Q(this._evaluateNode(e.left,a,o,l,u),t)}case"NOT IN":{const t=B(this._evaluateNode(e.right,a,o,l,u));return W(Q(this._evaluateNode(e.left,a,o,l,u),t))}case"BETWEEN":{const t=this._evaluateNode(e.left,a,o,l,u),r=this._evaluateNode(e.right,a,o,l,u);return null==t||null==r[0]||null==r[1]?null:i(t,r[0],">=")&&i(t,r[1],"<=")}case"NOTBETWEEN":{const t=this._evaluateNode(e.left,a,o,l,u),r=this._evaluateNode(e.right,a,o,l,u);return null==t||null==r[0]||null==r[1]?null:i(t,r[0],"<")||i(t,r[1],">")}case"LIKE":return te(this._evaluateNode(e.left,a,o,l,u),this._evaluateNode(e.right,a,o,l,u),e.escape);case"NOT LIKE":return W(te(this._evaluateNode(e.left,a,o,l,u),this._evaluateNode(e.right,a,o,l,u),e.escape));case"<>":case"<":case">":case">=":case"<=":case"=":if(re(e,e.operator,this.fieldsIndex)){const t=e.comparisonData;return i(se(a,t.fieldName,null,o),t.comparisonEpochMs,t.op)}return i(this._evaluateNode(e.left,a,o,l,u),this._evaluateNode(e.right,a,o,l,u),e.operator);case"-":case"+":case"*":case"/":case"||":return n(e.operator,this._evaluateNode(e.left,a,o,l,u),this._evaluateNode(e.right,a,o,l,u),this.timeZone)}case"null":case"boolean":case"string":case"number":return e.value;case"date":return e.parsedValue??=_(e.value,"unknown"),e.parsedValue;case"timestamp":return e.parsedValue??=f(e.value,"unknown"),e.parsedValue;case"time":return e.parsedValue??=d(e.value),e.parsedValue;case"current-time":return"date"===e.mode?H(this.timeZone):"time"===e.mode?X(this.timeZone):P(this.timeZone);case"current-user":return u??null;case"column-reference":return se(a,e.column,this.fieldsIndex,o);case"data-type":return e.value;case"function":{if(this.isAggregate&&t(e.name,e.args.value.length)){const t=[];for(const r of e.args?.value||[]){const e=[];for(const t of l||[])e.push(this._evaluateNode(r,t,o,null,u));t.push(e)}return r(e.name,t)}const s=this._evaluateNode(e.args,a,o,l,u);return T(e.name,s,this.timeZone)}}throw new s("UnsupportedSyntax",{node:e.type})}}function J(e){return!0===e}function B(e){return Array.isArray(e)?e:[e]}function W(e){return null!==e?!0!==e:null}function G(e,t){return null!=e&&null!=t?!0===e&&!0===t:!1!==e&&!1!==t&&null}function K(e,t){return null!=e&&null!=t?!0===e||!0===t:!0===e||!0===t||null}function Q(e,t){if(null==e)return null;let r=!1;for(const a of t)if(null==a)r=null;else{if(e===a){r=!0;break}if(u(e)&&u(a)&&(r=i(e,a,"="),r))break}return r}function P(e){return N(new Date,e)}function H(e){return a.fromNow(e)}function X(e){const t=N(new Date,e);return w.fromDateTime(t)}const Y="-[]/{}()*+?.\\^$|";function ee(e,t){const r=t;let a="",s=0;for(let n=0;n<e.length;n++){const t=e.charAt(n);switch(s){case 0:t===r?s=1:Y.includes(t)?a+="\\"+t:a+="%"===t?".*":"_"===t?".":t;break;case 1:Y.includes(t)?a+="\\"+t:a+=t,s=0}}return new RegExp("^"+a+"$","m")}function te(e,t,r){if(null==e)return null;return ee(t,r).test(e)}function re(e,t,r){if("comparisonData"in e)return null!=e.comparisonData;try{if(null==r)return!1;let a,s;if("column-reference"===e.left.type&&"timestamp"===e.right.type)a=e.left,s=e.right;else{if("timestamp"!==e.left.type||"column-reference"!==e.right.type)return!1;a=e.right,s=e.left,t=o(t)}const n=r.get(a.column);if("esriFieldTypeDate"!==n?.type&&"date"!==n?.type)return!1;const i=r.getTimeZone(n.name),u=null!=i?x(i):E.utcInstance;return!!u.isUniversal&&(e.comparisonData=l(n.name,u,t,s.value),!0)}finally{"comparisonData"in e||(e.comparisonData=null)}}function ae(e){return e&&"object"==typeof e.attributes}function se(e,t,r,s){if("getAttributeSQL"in s)return s.getAttributeSQL(e,t);const n=s.getAttribute(e,t);if(null==n)return n;const i=r?.get(t);switch(i?.type){case"esriFieldTypeDate":case"date":{const e=r?.getTimeZone(i.name);return N(new Date(n),null!=e?x(e):E.utcInstance)}case"esriFieldTypeDateOnly":case"date-only":return a.fromReader(n);case"esriFieldTypeTimeOnly":case"time-only":return w.fromReader(n);case"esriFieldTypeTimestampOffset":case"timestamp-offset":return new v(n)}return n}const ne={getAttribute:(e,t)=>(ae(e)?e.attributes:e)[t]};export{M as default};
|
package/core/sql/WhereGrammar.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
class t extends SyntaxError{constructor(t,n,e,r){super(t),this.expected=n,this.found=e,this.location=r,this.name="SyntaxError"}format(t){let n="Error: "+this.message;if(this.location){let e=null;const r=t.find(t=>t.source===this.location.source);r&&(e=r.text.split(/\r\n|\n|\r/g));const o=this.location.start,u=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(o):o,i=this.location.source+":"+u.line+":"+u.column;if(e){const t=this.location.end,r="".padEnd(u.line.toString().length," "),c=e[o.line-1],l=(o.line===t.line?t.column:c.length+1)-o.column||1;n+="\n --\x3e "+i+"\n"+r+" |\n"+u.line+" | "+c+"\n"+r+" | "+"".padEnd(o.column-1," ")+"".padEnd(l,"^")}else n+="\n at "+i}return n}static buildMessage(t,n){function e(t){return t.codePointAt(0).toString(16).toUpperCase()}const r=Object.prototype.hasOwnProperty.call(RegExp.prototype,"unicode")?new RegExp("[\\p{C}\\p{Mn}\\p{Mc}]","gu"):null;function o(t){return r?t.replace(r,t=>"\\u{"+e(t)+"}"):t}function u(t){return o(t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+e(t)).replace(/[\x10-\x1F\x7F-\x9F]/g,t=>"\\x"+e(t)))}function i(t){return o(t.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+e(t)).replace(/[\x10-\x1F\x7F-\x9F]/g,t=>"\\x"+e(t)))}const c={literal:t=>'"'+u(t.text)+'"',class(t){const n=t.parts.map(t=>Array.isArray(t)?i(t[0])+"-"+i(t[1]):i(t));return"["+(t.inverted?"^":"")+n.join("")+"]"+(t.unicode?"u":"")},any:()=>"any character",end:()=>"end of input",other:t=>t.description};function l(t){return c[t.type](t)}function s(t){const n=t.map(l);if(n.sort(),n.length>0){let t=1;for(let e=1;e<n.length;e++)n[e-1]!==n[e]&&(n[t]=n[e],t++);n.length=t}switch(n.length){case 1:return n[0];case 2:return n[0]+" or "+n[1];default:return n.slice(0,-1).join(", ")+", or "+n[n.length-1]}}function a(t){return t?'"'+u(t)+'"':"end of input"}return"Expected "+s(t)+" but "+a(n)+" found."}}function n(n,e){const r={},o=(e=void 0!==e?e:{}).grammarSource,u={start:yu};let i=yu;const c="!",l="=",s=">=",a=">",f="<=",p="<>",d="!=",v="||",y="@",h="'",g="N'",E="''",C=".",m="null",A="true",b="false",L="in",w="is",T="like",x="escape",N="not",R="and",I="or",O="between",F="from",S="for",M="substring",$="extract",D="trim",U="position",_="timestamp",H="date",P="time",Z="leading",j="trailing",k="both",z="cast",G="as",W="integer",B="int",Y="smallint",q="float",K="real",V="varchar",X="to",J="interval",Q="year",tt="timezone_hour",nt="timezone_minute",et="month",rt="day",ot="hour",ut="minute",it="second",ct="dow",lt="doy",st="week",at="case",ft="end",pt="when",dt="then",vt="else",yt=",",ht="(",gt=")",Et="`",Ct=/^[<-=]/,mt=/^[+\-]/,At=/^[*\/]/,bt=/^[A-Za-z_\x80-\uFFFF]/,Lt=/^[A-Za-z0-9_]/,wt=/^[A-Za-z0-9_.\x80-\uFFFF]/,Tt=/^["]/,xt=/^[^']/,Nt=/^[0-9]/,Rt=/^[eE]/,It=/^[ \t\n\r]/,Ot=/^[^`]/,Ft=cu("!",!1),St=cu("=",!1),Mt=cu(">=",!1),$t=cu(">",!1),Dt=cu("<=",!1),Ut=cu("<>",!1),_t=lu([["<","="]],!1,!1,!1),Ht=cu("!=",!1),Pt=lu(["+","-"],!1,!1,!1),Zt=cu("||",!1),jt=lu(["*","/"],!1,!1,!1),kt=lu([["A","Z"],["a","z"],"_",["",""]],!1,!1,!1),zt=lu([["A","Z"],["a","z"],["0","9"],"_"],!1,!1,!1),Gt=lu([["A","Z"],["a","z"],["0","9"],"_",".",["",""]],!1,!1,!1),Wt=lu(['"'],!1,!1,!1),Bt=cu("@",!1),Yt=cu("'",!1),qt=cu("N'",!1),Kt=cu("''",!1),Vt=lu(["'"],!0,!1,!1),Xt=cu(".",!1),Jt=lu([["0","9"]],!1,!1,!1),Qt=lu(["e","E"],!1,!1,!1),tn=cu("NULL",!0),nn=cu("TRUE",!0),en=cu("FALSE",!0),rn=cu("IN",!0),on=cu("IS",!0),un=cu("LIKE",!0),cn=cu("ESCAPE",!0),ln=cu("NOT",!0),sn=cu("AND",!0),an=cu("OR",!0),fn=cu("BETWEEN",!0),pn=cu("FROM",!0),dn=cu("FOR",!0),vn=cu("SUBSTRING",!0),yn=cu("EXTRACT",!0),hn=cu("TRIM",!0),gn=cu("POSITION",!0),En=cu("TIMESTAMP",!0),Cn=cu("DATE",!0),mn=cu("TIME",!0),An=cu("LEADING",!0),bn=cu("TRAILING",!0),Ln=cu("BOTH",!0),wn=cu("CAST",!0),Tn=cu("AS",!0),xn=cu("INTEGER",!0),Nn=cu("INT",!0),Rn=cu("SMALLINT",!0),In=cu("FLOAT",!0),On=cu("REAL",!0),Fn=cu("VARCHAR",!0),Sn=cu("TO",!0),Mn=cu("INTERVAL",!0),$n=cu("YEAR",!0),Dn=cu("TIMEZONE_HOUR",!0),Un=cu("TIMEZONE_MINUTE",!0),_n=cu("MONTH",!0),Hn=cu("DAY",!0),Pn=cu("HOUR",!0),Zn=cu("MINUTE",!0),jn=cu("SECOND",!0),kn=cu("DOW",!0),zn=cu("DOY",!0),Gn=cu("WEEK",!0),Wn=cu("CASE",!0),Bn=cu("END",!0),Yn=cu("WHEN",!0),qn=cu("THEN",!0),Kn=cu("ELSE",!0),Vn=cu(",",!1),Xn=cu("(",!1),Jn=cu(")",!1),Qn=lu([" ","\t","\n","\r"],!1,!1,!1),te=cu("`",!1),ne=lu(["`"],!0,!1,!1);function ee(t){return t}function re(t){return{type:"expression-list",location:ou(),value:t}}function oe(t,n,e){return{op:n,expr:e,location:ou()}}function ue(t,n){return Hc(t,n)}function ie(t,n,e){return{op:n,expr:e,location:ou()}}function ce(t,n){return Hc(t,n)}function le(t){return Dc("NOT",t,ou())}function se(t,n){if(""==n||null==n||null==n)return t;return"arithmetic"==n.type?Hc(t,n.tail):Uc(n.op,t,n.right,n.escape,ou())}function ae(t,n){return{op:t,expr:n,location:ou()}}function fe(t){return{type:"arithmetic",tail:t}}function pe(t,n){return{op:t+"NOT",right:n}}function de(t,n){return{op:t,right:n}}function ve(t,n,e){return _c(ou(),n,e)}function ye(t,n){return{op:"NOT"+t,right:n}}function he(t,n,e){return _c(ou(),n,e)}function ge(t,n){return{op:t,right:n}}function Ee(t){return t[0]+" "+t[2]}function Ce(t){return t[0]+" "+t[2]}function me(t,n,e){return{op:t,right:n,escape:e.value}}function Ae(t,n){return{op:t,right:n,escape:""}}function be(t,n){return{op:t,right:n}}function Le(t,n){return{op:t,right:n}}function we(t,n,e){return{op:n,expr:e,location:ou()}}function Te(t,n){return Hc(t,n)}function xe(t,n,e){return{op:n,expr:e,location:ou()}}function Ne(t,n){return Hc(t,n)}function Re(t){return t.paren=!0,t}function Ie(t){return/^CURRENT_DATE$/i.test(t)?{type:"current-time",location:ou(),mode:"date"}:/^CURRENT_TIMESTAMP$/i.test(t)?{type:"current-time",location:ou(),mode:"timestamp"}:/^CURRENT_TIME$/i.test(t)?{type:"current-time",location:ou(),mode:"time"}:/^CURRENT_USER$/i.test(t)?{type:"current-user",location:ou()}:{type:"column-reference",location:ou(),table:"",column:t}}function Oe(t){return{type:"column-reference",location:ou(),table:"",column:t,delimited:!0}}function Fe(t){return t}function Se(t,n){return t+n.join("")}function Me(t,n){return t+n.join("")}function $e(t){return t}function De(t){return t.join("")}function Ue(){return'"'}function _e(t){return{type:"parameter",location:ou(),value:t[1]}}function He(t,n){return _c(ou(),t,n)}function Pe(t,n){return _c(ou(),t,n)}function Ze(t){return{type:"function",location:ou(),name:"extract",args:t}}function je(t,n,e){return _c(ou(),t,n,...e?[e]:[])}function ke(t,n,e){return _c(ou(),t,n,e)}function ze(t){return{type:"function",location:ou(),name:"substring",args:t}}function Ge(t,n){return _c(ou(),t,n)}function We(t,n){return _c(ou(),t,n)}function Be(t){return{type:"function",location:ou(),name:"cast",args:t}}function Ye(){return{type:"data-type",location:ou(),value:{type:"integer"}}}function qe(){return{type:"data-type",location:ou(),value:{type:"smallint"}}}function Ke(){return{type:"data-type",location:ou(),value:{type:"float"}}}function Ve(){return{type:"data-type",location:ou(),value:{type:"real"}}}function Xe(){return{type:"data-type",location:ou(),value:{type:"date"}}}function Je(){return{type:"data-type",location:ou(),value:{type:"timestamp"}}}function Qe(){return{type:"data-type",location:ou(),value:{type:"time"}}}function tr(t){return{type:"data-type",location:ou(),value:{type:"varchar",size:parseInt(t)}}}function nr(t,n,e){return _c(ou(),t,n,e)}function er(t,n){return _c(ou(),t,n)}function rr(t){return{type:"function",location:ou(),name:"trim",args:t}}function or(t){return{type:"string",location:ou(),value:t??"BOTH"}}function ur(t,n){return _c(ou(),t,n)}function ir(t,n){return _c(ou(),t,n)}function cr(t){return{type:"function",location:ou(),name:"position",args:t}}function lr(t,n){return{type:"function",location:ou(),name:t,args:n}}function sr(t){return{type:"string",location:ou(),value:t}}function ar(t){return"string"===t.type&&Pc(t.value),{type:"timestamp",location:ou(),value:t.value}}function fr(t){return"string"===t.type&&Zc(t.value),{type:"time",location:ou(),value:t.value}}function pr(t,n,e){return{type:"interval",location:ou(),value:n,qualifier:e,op:t}}function dr(t,n){return{type:"interval",location:ou(),value:t,qualifier:n,op:""}}function vr(t,n){return{type:"interval-qualifier",location:ou(),start:t,end:n}}function yr(t,n){return{type:"interval-period",location:ou(),period:t.value,precision:n,secondary:null}}function hr(t){return{type:"interval-period",location:ou(),period:t.value,precision:null,secondary:null}}function gr(t){return{type:"interval-period",location:ou(),period:t.value,precision:null,secondary:null}}function Er(t,n){return{type:"interval-period",location:ou(),period:"second",precision:t,secondary:n}}function Cr(t){return{type:"interval-period",location:ou(),period:"second",precision:t,secondary:null}}function mr(){return{type:"interval-period",location:ou(),period:"second",precision:null,secondary:null}}function Ar(t,n){return{type:"interval-period",location:ou(),period:t.value,precision:n,secondary:null}}function br(t){return{type:"interval-period",location:ou(),period:t.value,precision:null,secondary:null}}function Lr(t,n){return{type:"interval-period",location:ou(),period:"second",precision:t,secondary:n}}function wr(t){return{type:"interval-period",location:ou(),period:"second",precision:t,secondary:null}}function Tr(){return{type:"interval-period",location:ou(),period:"second",precision:null,secondary:null}}function xr(){return{type:"string",location:ou(),value:"day"}}function Nr(){return{type:"string",location:ou(),value:"hour"}}function Rr(){return{type:"string",location:ou(),value:"minute"}}function Ir(){return{type:"string",location:ou(),value:"month"}}function Or(){return{type:"string",location:ou(),value:"year"}}function Fr(t){return parseFloat(t)}function Sr(t){return parseFloat(t)}function Mr(t){return"string"===t.type&&jc(t.value),{type:"date",location:ou(),value:t.value}}function $r(){return{type:"null",location:ou(),value:null}}function Dr(){return{type:"boolean",location:ou(),value:!0}}function Ur(){return{type:"boolean",location:ou(),value:!1}}function _r(){return"'"}function Hr(t){return{type:"string",location:ou(),value:t.join("")}}function Pr(t,n){return{type:"case-expression",location:ou(),format:"simple",operand:t,clauses:n,else:null,elseLocation:null}}function Zr(t,n,e){return{type:"case-expression",location:ou(),format:"simple",operand:t,clauses:n,else:e.value,elseLocation:e.location}}function jr(t){return{type:"case-expression",location:ou(),format:"searched",clauses:t,else:null,elseLocation:null}}function kr(t,n){return{type:"case-expression",location:ou(),format:"searched",clauses:t,else:n.value,elseLocation:n.location}}function zr(t,n){return{type:"when-clause",location:ou(),operand:t,value:n}}function Gr(t,n){return{type:"when-clause",location:ou(),operand:t,value:n}}function Wr(t){return{type:"else-clause",location:ou(),value:t}}function Br(t){return{type:"number",location:ou(),value:t}}function Yr(t,n,e){return parseFloat(t+n+e)}function qr(t,n){return parseFloat(t+n)}function Kr(t,n){return parseFloat(t+n)}function Vr(t){return parseFloat(t)}function Xr(t,n){return t[0]+n}function Jr(t){return"."+(null!=t?t:"")}function Qr(t,n){return t+n}function to(t){return t.join("")}function no(t,n){return"e"+(null===n?"":n)}function eo(){return"IN"}function ro(){return"IS"}function oo(){return"LIKE"}function uo(){return"ESCAPE"}function io(){return"NOT"}function co(){return"AND"}function lo(){return"OR"}function so(){return"BETWEEN"}function ao(){return"FROM"}function fo(){return"FOR"}function po(){return"SUBSTRING"}function vo(){return"EXTRACT"}function yo(){return"TRIM"}function ho(){return"POSITION"}function go(){return"TIMESTAMP"}function Eo(){return"DATE"}function Co(){return"TIME"}function mo(){return"LEADING"}function Ao(){return"TRAILING"}function bo(){return"BOTH"}function Lo(){return"CAST"}function wo(){return"AS"}function To(){return"INTEGER"}function xo(){return"INT"}function No(){return"SMALLINT"}function Ro(){return"FLOAT"}function Io(){return"REAL"}function Oo(){return"VARCHAR"}function Fo(){return"TO"}function So(){return"INTERVAL"}function Mo(){return"YEAR"}function $o(){return"TIMEZONE_HOUR"}function Do(){return"TIMEZONE_MINUTE"}function Uo(){return"MONTH"}function _o(){return"DAY"}function Ho(){return"HOUR"}function Po(){return"MINUTE"}function Zo(){return"SECOND"}function jo(){return"DOW"}function ko(){return"DOY"}function zo(){return"WEEK"}function Go(){return"CASE"}function Wo(){return"END"}function Bo(){return"WHEN"}function Yo(){return"THEN"}function qo(){return"ELSE"}function Ko(t){return t}function Vo(t){return t.join("")}let Xo=0|e.peg$currPos,Jo=Xo;const Qo=[{line:1,column:1}];let tu,nu=Xo,eu=e.peg$maxFailExpected||[],ru=0|e.peg$silentFails;if(e.startRule){if(!(e.startRule in u))throw new Error("Can't start parsing from rule \""+e.startRule+'".');i=u[e.startRule]}function ou(){return fu(Jo,Xo)}function uu(t,n){throw du(t,n=void 0!==n?n:fu(Jo,Xo))}function iu(t=Xo){const e=n.codePointAt(t);return void 0===e?"":String.fromCodePoint(e)}function cu(t,n){return{type:"literal",text:t,ignoreCase:n}}function lu(t,n,e,r){return{type:"class",parts:t,inverted:n,ignoreCase:e,unicode:r}}function su(){return{type:"end"}}function au(t){let e,r=Qo[t];if(r)return r;if(t>=Qo.length)e=Qo.length-1;else for(e=t;!Qo[--e];);for(r=Qo[e],r={line:r.line,column:r.column};e<t;)10===n.charCodeAt(e)?(r.line++,r.column=1):r.column++,e++;return Qo[t]=r,r}function fu(t,n,e){const r=au(t),u=au(n);return{source:o,start:{offset:t,line:r.line,column:r.column},end:{offset:n,line:u.line,column:u.column}}}function pu(t){Xo<nu||(Xo>nu&&(nu=Xo,eu=[]),eu.push(t))}function du(n,e){return new t(n,null,null,e)}function vu(n,e,r){return new t(t.buildMessage(n,e),n,e,r)}function yu(){let t,n;return t=Xo,Sc(),n=gu(),n!==r?(Sc(),Jo=t,t=ee(n)):(Xo=t,t=r),t}function hu(){let t,n,e,o,u,i,c,l;if(t=Xo,n=Oc(),n!==r){for(Sc(),e=[],o=gu();o!==r;)e.push(o),o=Xo,u=Xo,i=Sc(),c=Ic(),c!==r?(l=Sc(),i=[i,c,l],u=i):(Xo=u,u=r),u!==r?(u=gu(),u===r?(Xo=o,o=r):o=u):o=u;o=Sc(),u=Fc(),u!==r?(Jo=t,t=re(e)):(Xo=t,t=r)}else Xo=t,t=r;return t}function gu(){let t,n,e,o,u,i;if(t=Xo,n=Eu(),n!==r){for(e=[],o=Xo,Sc(),u=zi(),u!==r?(Sc(),i=Eu(),i!==r?(Jo=o,o=oe(n,u,i)):(Xo=o,o=r)):(Xo=o,o=r);o!==r;)e.push(o),o=Xo,Sc(),u=zi(),u!==r?(Sc(),i=Eu(),i!==r?(Jo=o,o=oe(n,u,i)):(Xo=o,o=r)):(Xo=o,o=r);Jo=t,t=ue(n,e)}else Xo=t,t=r;return t}function Eu(){let t,n,e,o,u,i;if(t=Xo,n=Cu(),n!==r){for(e=[],o=Xo,Sc(),u=ki(),u!==r?(Sc(),i=Cu(),i!==r?(Jo=o,o=ie(n,u,i)):(Xo=o,o=r)):(Xo=o,o=r);o!==r;)e.push(o),o=Xo,Sc(),u=ki(),u!==r?(Sc(),i=Cu(),i!==r?(Jo=o,o=ie(n,u,i)):(Xo=o,o=r)):(Xo=o,o=r);Jo=t,t=ce(n,e)}else Xo=t,t=r;return t}function Cu(){let t,e,o,u,i;return t=Xo,e=ji(),e===r&&(e=Xo,33===n.charCodeAt(Xo)?(o=c,Xo++):(o=r,0===ru&&pu(Ft)),o!==r?(u=Xo,ru++,61===n.charCodeAt(Xo)?(i=l,Xo++):(i=r,0===ru&&pu(St)),ru--,i===r?u=void 0:(Xo=u,u=r),u!==r?(o=[o,u],e=o):(Xo=e,e=r)):(Xo=e,e=r)),e!==r?(o=Sc(),u=Cu(),u!==r?(Jo=t,t=le(u)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=mu()),t}function mu(){let t,n,e,o;return t=Xo,n=Ou(),n!==r?(e=Xo,Sc(),o=Au(),o!==r?e=o:(Xo=e,e=r),e===r&&(e=null),Jo=t,t=se(n,e)):(Xo=t,t=r),t}function Au(){let t;return t=bu(),t===r&&(t=Iu(),t===r&&(t=Tu(),t===r&&(t=wu(),t===r&&(t=Ru())))),t}function bu(){let t,n,e,o,u;if(t=Xo,n=[],e=Xo,Sc(),o=Lu(),o!==r?(Sc(),u=Ou(),u!==r?(Jo=e,e=ae(o,u)):(Xo=e,e=r)):(Xo=e,e=r),e!==r)for(;e!==r;)n.push(e),e=Xo,Sc(),o=Lu(),o!==r?(Sc(),u=Ou(),u!==r?(Jo=e,e=ae(o,u)):(Xo=e,e=r)):(Xo=e,e=r);else n=r;return n!==r&&(Jo=t,n=fe(n)),t=n,t}function Lu(){let t;return n.substr(Xo,2)===s?(t=s,Xo+=2):(t=r,0===ru&&pu(Mt)),t===r&&(62===n.charCodeAt(Xo)?(t=a,Xo++):(t=r,0===ru&&pu($t)),t===r&&(n.substr(Xo,2)===f?(t=f,Xo+=2):(t=r,0===ru&&pu(Dt)),t===r&&(n.substr(Xo,2)===p?(t=p,Xo+=2):(t=r,0===ru&&pu(Ut)),t===r&&(t=n.charAt(Xo),Ct.test(t)?Xo++:(t=r,0===ru&&pu(_t)),t===r&&(n.substr(Xo,2)===d?(t=d,Xo+=2):(t=r,0===ru&&pu(Ht))))))),t}function wu(){let t,n,e,o;return t=Xo,n=Hi(),n!==r?(Sc(),e=ji(),e!==r?(Sc(),o=Ou(),o!==r?(Jo=t,t=pe(n,o)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Xo,n=Hi(),n!==r?(Sc(),e=Ou(),e!==r?(Jo=t,t=de(n,e)):(Xo=t,t=r)):(Xo=t,t=r)),t}function Tu(){let t,n,e,o,u,i,c,l;return t=Xo,n=ji(),n!==r?(Sc(),e=Gi(),e!==r?(o=Sc(),u=Xo,i=Ou(),i!==r?(Sc(),c=ki(),c!==r?(Sc(),l=Ou(),l!==r?(Jo=u,u=ve(e,i,l)):(Xo=u,u=r)):(Xo=u,u=r)):(Xo=u,u=r),u!==r?(Jo=t,t=ye(e,u)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Xo,n=Gi(),n!==r?(Sc(),e=Xo,o=Ou(),o!==r?(u=Sc(),i=ki(),i!==r?(Sc(),c=Ou(),c!==r?(Jo=e,e=he(n,o,c)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r),e!==r?(Jo=t,t=ge(n,e)):(Xo=t,t=r)):(Xo=t,t=r)),t}function xu(){let t,n,e,o,u;return t=Xo,n=Xo,e=ji(),e!==r?(o=Sc(),u=Pi(),u!==r?(e=[e,o,u],n=e):(Xo=n,n=r)):(Xo=n,n=r),n!==r&&(Jo=t,n=Ee(n)),t=n,t===r&&(t=Pi()),t}function Nu(){let t,n,e,o,u;return t=Xo,n=Xo,e=ji(),e!==r?(o=Sc(),u=_i(),u!==r?(e=[e,o,u],n=e):(Xo=n,n=r)):(Xo=n,n=r),n!==r&&(Jo=t,n=Ce(n)),t=n,t===r&&(t=_i()),t}function Ru(){let t,n,e,o,u;return t=Xo,n=xu(),n!==r?(Sc(),e=Ou(),e!==r?(Sc(),o=Zi(),o!==r?(Sc(),u=Ci(),u!==r?(Jo=t,t=me(n,e,u)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Xo,n=xu(),n!==r?(Sc(),e=Ou(),e!==r?(Jo=t,t=Ae(n,e)):(Xo=t,t=r)):(Xo=t,t=r)),t}function Iu(){let t,n,e;return t=Xo,n=Nu(),n!==r?(Sc(),e=hu(),e!==r?(Jo=t,t=be(n,e)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Xo,n=Nu(),n!==r?(Sc(),e=qu(),e!==r?(Jo=t,t=Le(n,e)):(Xo=t,t=r)):(Xo=t,t=r)),t}function Ou(){let t,n,e,o,u,i;if(t=Xo,n=Su(),n!==r){for(e=[],o=Xo,Sc(),u=Fu(),u!==r?(Sc(),i=Su(),i!==r?(Jo=o,o=we(n,u,i)):(Xo=o,o=r)):(Xo=o,o=r);o!==r;)e.push(o),o=Xo,Sc(),u=Fu(),u!==r?(Sc(),i=Su(),i!==r?(Jo=o,o=we(n,u,i)):(Xo=o,o=r)):(Xo=o,o=r);Jo=t,t=Te(n,e)}else Xo=t,t=r;return t}function Fu(){let t;return t=n.charAt(Xo),mt.test(t)?Xo++:(t=r,0===ru&&pu(Pt)),t===r&&(n.substr(Xo,2)===v?(t=v,Xo+=2):(t=r,0===ru&&pu(Zt))),t}function Su(){let t,n,e,o,u,i;if(t=Xo,n=$u(),n!==r){for(e=[],o=Xo,Sc(),u=Mu(),u!==r?(Sc(),i=$u(),i!==r?(Jo=o,o=xe(n,u,i)):(Xo=o,o=r)):(Xo=o,o=r);o!==r;)e.push(o),o=Xo,Sc(),u=Mu(),u!==r?(Sc(),i=$u(),i!==r?(Jo=o,o=xe(n,u,i)):(Xo=o,o=r)):(Xo=o,o=r);Jo=t,t=Ne(n,e)}else Xo=t,t=r;return t}function Mu(){let t;return t=n.charAt(Xo),At.test(t)?Xo++:(t=r,0===ru&&pu(jt)),t}function $u(){let t,n,e,o;return t=oi(),t===r&&(t=Ku(),t===r&&(t=Vu(),t===r&&(t=Qu(),t===r&&(t=ni(),t===r&&(t=Xu(),t===r&&(t=ei(),t===r&&(t=mi(),t===r&&(t=Du(),t===r&&(t=qu(),t===r&&(t=Xo,n=Oc(),n!==r?(Sc(),e=gu(),e!==r?(Sc(),o=Fc(),o!==r?(Jo=t,t=Re(e)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r))))))))))),t}function Du(){let t,n;return t=Xo,n=Uu(),n!==r&&(Jo=t,n=Ie(n)),t=n,t===r&&(t=Xo,n=ku(),n!==r&&(Jo=t,n=Oe(n)),t=n),t}function Uu(){let t,n;return t=Xo,n=_u(),n!==r&&(Jo=t,n=Fe(n)),t=n,t}function _u(){let t,n,e,o;if(t=Xo,n=Pu(),n!==r){for(e=[],o=ju();o!==r;)e.push(o),o=ju();Jo=t,t=Se(n,e)}else Xo=t,t=r;return t}function Hu(){let t,n,e,o;if(t=Xo,n=Pu(),n!==r){for(e=[],o=Zu();o!==r;)e.push(o),o=Zu();Jo=t,t=Me(n,e)}else Xo=t,t=r;return t}function Pu(){let t;return t=n.charAt(Xo),bt.test(t)?Xo++:(t=r,0===ru&&pu(kt)),t}function Zu(){let t;return t=n.charAt(Xo),Lt.test(t)?Xo++:(t=r,0===ru&&pu(zt)),t}function ju(){let t;return t=n.charAt(Xo),wt.test(t)?Xo++:(t=r,0===ru&&pu(Gt)),t}function ku(){let t,n,e,o;return t=Xo,n=Yu(),n!==r?(e=zu(),o=Yu(),o!==r?(Jo=t,t=$e(e)):(Xo=t,t=r)):(Xo=t,t=r),t}function zu(){let t,n,e;for(t=Xo,n=[],e=Gu();e!==r;)n.push(e),e=Gu();return Jo=t,n=De(n),t=n,t}function Gu(){let t;return t=Bu(),t===r&&(t=Wu()),t}function Wu(){let t,n,e;return t=Xo,n=Yu(),n!==r?(e=Yu(),e!==r?(Jo=t,t=Ue()):(Xo=t,t=r)):(Xo=t,t=r),t}function Bu(){let t;return t=n.charAt(Xo),wt.test(t)?Xo++:(t=r,0===ru&&pu(Gt)),t}function Yu(){let t;return t=n.charAt(Xo),Tt.test(t)?Xo++:(t=r,0===ru&&pu(Wt)),t}function qu(){let t,e,o,u;return t=Xo,e=Xo,64===n.charCodeAt(Xo)?(o=y,Xo++):(o=r,0===ru&&pu(Bt)),o!==r?(u=Hu(),u!==r?(o=[o,u],e=o):(Xo=e,e=r)):(Xo=e,e=r),e!==r&&(Jo=t,e=_e(e)),t=e,t}function Ku(){let t,n,e,o,u,i,c,l;return t=Xo,n=qi(),n!==r?(Sc(),e=Xo,o=Oc(),o!==r?(Sc(),u=ri(),u!==r?(Sc(),i=Wi(),i!==r?(Sc(),c=gu(),c!==r?(Sc(),l=Fc(),l!==r?(Jo=e,e=He(u,c)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r),e===r&&(e=Xo,o=Oc(),o!==r?(Sc(),u=ri(),u!==r?(Sc(),i=Ic(),i!==r?(Sc(),c=gu(),c!==r?(Sc(),l=Fc(),l!==r?(Jo=e,e=Pe(u,c)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)),e!==r?(Jo=t,t=Ze(e)):(Xo=t,t=r)):(Xo=t,t=r),t}function Vu(){let t,n,e,o,u,i,c,l,s,a,f;return t=Xo,n=Yi(),n!==r?(Sc(),e=Xo,o=Oc(),o!==r?(Sc(),u=gu(),u!==r?(Sc(),i=Wi(),i!==r?(Sc(),c=gu(),c!==r?(Sc(),l=Xo,s=Bi(),s!==r?(a=Sc(),f=gu(),f!==r?(Sc(),l=f):(Xo=l,l=r)):(Xo=l,l=r),l===r&&(l=null),s=Fc(),s!==r?(Jo=e,e=je(u,c,l)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r),e===r&&(e=Xo,o=Oc(),o!==r?(Sc(),u=gu(),u!==r?(Sc(),i=Ic(),i!==r?(Sc(),c=gu(),c!==r?(Sc(),l=Ic(),l!==r?(s=Sc(),a=gu(),a!==r?(f=Fc(),f!==r?(Jo=e,e=ke(u,c,a)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)),e!==r?(Jo=t,t=ze(e)):(Xo=t,t=r)):(Xo=t,t=r),t}function Xu(){let t,n,e,o,u,i,c,l;return t=Xo,n=rc(),n!==r?(Sc(),e=Xo,o=Oc(),o!==r?(Sc(),u=gu(),u!==r?(Sc(),i=oc(),i!==r?(Sc(),c=Ju(),c!==r?(Sc(),l=Fc(),l!==r?(Jo=e,e=Ge(u,c)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r),e===r&&(e=Xo,o=Oc(),o!==r?(Sc(),u=gu(),u!==r?(Sc(),i=Ic(),i!==r?(Sc(),c=Ju(),c!==r?(Sc(),l=Fc(),l!==r?(Jo=e,e=We(u,c)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)),e!==r?(Jo=t,t=Be(e)):(Xo=t,t=r)):(Xo=t,t=r),t}function Ju(){let t,n,e,o,u;return t=Xo,n=uc(),n===r&&(n=ic()),n!==r&&(Jo=t,n=Ye()),t=n,t===r&&(t=Xo,n=cc(),n!==r&&(Jo=t,n=qe()),t=n,t===r&&(t=Xo,n=lc(),n!==r&&(Jo=t,n=Ke()),t=n,t===r&&(t=Xo,n=sc(),n!==r&&(Jo=t,n=Ve()),t=n,t===r&&(t=Xo,n=Ji(),n!==r&&(Jo=t,n=Xe()),t=n,t===r&&(t=Xo,n=Xi(),n!==r&&(Jo=t,n=Je()),t=n,t===r&&(t=Xo,n=Qi(),n!==r&&(Jo=t,n=Qe()),t=n,t===r&&(t=Xo,n=ac(),n!==r?(Sc(),e=Oc(),e!==r?(Sc(),o=Fi(),o!==r?(Sc(),u=Fc(),u!==r?(Jo=t,t=tr(o)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)))))))),t}function Qu(){let t,n,e,o,u,i,c,l,s;return t=Xo,n=Ki(),n!==r?(Sc(),e=Xo,o=Oc(),o!==r?(Sc(),u=ti(),Sc(),i=gu(),i!==r?(Sc(),c=Wi(),c!==r?(Sc(),l=gu(),l!==r?(Sc(),s=Fc(),s!==r?(Jo=e,e=nr(u,i,l)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r),e===r&&(e=Xo,o=Oc(),o!==r?(Sc(),u=ti(),Sc(),i=gu(),i!==r?(Sc(),c=Fc(),c!==r?(Jo=e,e=er(u,i)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)),e!==r?(Jo=t,t=rr(e)):(Xo=t,t=r)):(Xo=t,t=r),t}function ti(){let t,n;return t=Xo,n=tc(),n===r&&(n=nc(),n===r&&(n=ec())),n===r&&(n=null),Jo=t,n=or(n),t=n,t}function ni(){let t,n,e,o,u,i,c,l;return t=Xo,n=Vi(),n!==r?(Sc(),e=Xo,o=Oc(),o!==r?(Sc(),u=gu(),u!==r?(Sc(),i=_i(),i!==r?(Sc(),c=gu(),c!==r?(Sc(),l=Fc(),l!==r?(Jo=e,e=ur(u,c)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r),e===r&&(e=Xo,o=Oc(),o!==r?(Sc(),u=gu(),u!==r?(Sc(),i=Ic(),i!==r?(Sc(),c=gu(),c!==r?(Sc(),l=Fc(),l!==r?(Jo=e,e=ir(u,c)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)),e!==r?(Jo=t,t=cr(e)):(Xo=t,t=r)):(Xo=t,t=r),t}function ei(){let t,n,e,o;return t=Xo,n=Xo,ru++,e=qi(),ru--,e===r?n=void 0:(Xo=n,n=r),n!==r?(e=$c(),e!==r?(Sc(),o=hu(),o!==r?(Jo=t,t=lr(e,o)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t}function ri(){let t,n;return t=Xo,n=dc(),n===r&&(n=hc(),n===r&&(n=gc(),n===r&&(n=Ec(),n===r&&(n=Cc(),n===r&&(n=mc(),n===r&&(n=vc(),n===r&&(n=yc(),n===r&&(n=Ac(),n===r&&(n=bc(),n===r&&(n=Lc())))))))))),n!==r&&(Jo=t,n=sr(n)),t=n,t}function oi(){let t;return t=Ci(),t===r&&(t=xi(),t===r&&(t=gi(),t===r&&(t=hi(),t===r&&(t=yi(),t===r&&(t=ui(),t===r&&(t=ci(),t===r&&(t=ii()))))))),t}function ui(){let t,n,e;return t=Xo,n=Xi(),n!==r?(Sc(),e=Ei(),e!==r?(Jo=t,t=ar(e)):(Xo=t,t=r)):(Xo=t,t=r),t}function ii(){let t,n,e;return t=Xo,n=Qi(),n!==r?(Sc(),e=Ei(),e!==r?(Jo=t,t=fr(e)):(Xo=t,t=r)):(Xo=t,t=r),t}function ci(){let t,e,o,u,i;return t=Xo,e=pc(),e!==r?(Sc(),o=n.charAt(Xo),mt.test(o)?Xo++:(o=r,0===ru&&pu(Pt)),o!==r?(Sc(),u=Ei(),u!==r?(Sc(),i=li(),i!==r?(Jo=t,t=pr(o,u,i)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Xo,e=pc(),e!==r?(Sc(),o=Ei(),o!==r?(Sc(),u=li(),u!==r?(Jo=t,t=dr(o,u)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)),t}function li(){let t,n,e,o;return t=Xo,n=si(),n!==r?(Sc(),e=fc(),e!==r?(Sc(),o=ai(),o!==r?(Jo=t,t=vr(n,o)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=fi()),t}function si(){let t,n,e,o,u;return t=Xo,n=pi(),n!==r?(Sc(),e=Oc(),e!==r?(Sc(),o=vi(),o!==r?(Sc(),u=Fc(),u!==r?(Jo=t,t=yr(n,o)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Xo,n=pi(),n!==r&&(Jo=t,n=hr(n)),t=n),t}function ai(){let t,n,e,o,u,i,c;return t=Xo,n=pi(),n!==r&&(Jo=t,n=gr(n)),t=n,t===r&&(t=Xo,n=mc(),n!==r?(Sc(),e=Oc(),e!==r?(Sc(),o=vi(),o!==r?(Sc(),u=Ic(),u!==r?(Sc(),i=di(),i!==r?(Sc(),c=Fc(),c!==r?(Jo=t,t=Er(o,i)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Xo,n=mc(),n!==r?(Sc(),e=Oc(),e!==r?(Sc(),o=vi(),o!==r?(Sc(),u=Fc(),u!==r?(Jo=t,t=Cr(o)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Xo,n=mc(),n!==r&&(Jo=t,n=mr()),t=n))),t}function fi(){let t,n,e,o,u,i,c;return t=Xo,n=pi(),n!==r?(Sc(),e=Oc(),e!==r?(Sc(),o=di(),o!==r?(Sc(),u=Fc(),u!==r?(Jo=t,t=Ar(n,o)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Xo,n=pi(),n!==r&&(Jo=t,n=br(n)),t=n,t===r&&(t=Xo,n=mc(),n!==r?(Sc(),e=Oc(),e!==r?(Sc(),o=vi(),o!==r?(Sc(),u=Ic(),u!==r?(Sc(),i=di(),i!==r?(Sc(),c=Fc(),c!==r?(Jo=t,t=Lr(o,i)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Xo,n=mc(),n!==r?(Sc(),e=Oc(),e!==r?(Sc(),o=di(),o!==r?(Sc(),u=Fc(),u!==r?(Jo=t,t=wr(o)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Xo,n=mc(),n!==r&&(Jo=t,n=Tr()),t=n)))),t}function pi(){let t,n;return t=Xo,n=gc(),n!==r&&(Jo=t,n=xr()),t=n,t===r&&(t=Xo,n=Ec(),n!==r&&(Jo=t,n=Nr()),t=n,t===r&&(t=Xo,n=Cc(),n!==r&&(Jo=t,n=Rr()),t=n,t===r&&(t=Xo,n=hc(),n!==r&&(Jo=t,n=Ir()),t=n,t===r&&(t=Xo,n=dc(),n!==r&&(Jo=t,n=Or()),t=n)))),t}function di(){let t,n;return t=Xo,n=Fi(),n!==r&&(Jo=t,n=Fr(n)),t=n,t}function vi(){let t,n;return t=Xo,n=Fi(),n!==r&&(Jo=t,n=Sr(n)),t=n,t}function yi(){let t,n,e;return t=Xo,n=Ji(),n!==r?(Sc(),e=Ei(),e!==r?(Jo=t,t=Mr(e)):(Xo=t,t=r)):(Xo=t,t=r),t}function hi(){let t,n;return t=Xo,n=$i(),n!==r&&(Jo=t,n=$r()),t=n,t}function gi(){let t,n;return t=Xo,n=Di(),n!==r&&(Jo=t,n=Dr()),t=n,t===r&&(t=Xo,n=Ui(),n!==r&&(Jo=t,n=Ur()),t=n),t}function Ei(){let t;return t=Ci(),t===r&&(t=qu()),t}function Ci(){let t,e,o,u,i;if(t=Xo,39===n.charCodeAt(Xo)?(e=h,Xo++):(e=r,0===ru&&pu(Yt)),e===r&&(n.substr(Xo,2)===g?(e=g,Xo+=2):(e=r,0===ru&&pu(qt))),e!==r){for(o=[],u=Xo,n.substr(Xo,2)===E?(i=E,Xo+=2):(i=r,0===ru&&pu(Kt)),i!==r&&(Jo=u,i=_r()),u=i,u===r&&(u=n.charAt(Xo),xt.test(u)?Xo++:(u=r,0===ru&&pu(Vt)));u!==r;)o.push(u),u=Xo,n.substr(Xo,2)===E?(i=E,Xo+=2):(i=r,0===ru&&pu(Kt)),i!==r&&(Jo=u,i=_r()),u=i,u===r&&(u=n.charAt(Xo),xt.test(u)?Xo++:(u=r,0===ru&&pu(Vt)));39===n.charCodeAt(Xo)?(u=h,Xo++):(u=r,0===ru&&pu(Yt)),u!==r?(Jo=t,t=Hr(o)):(Xo=t,t=r)}else Xo=t,t=r;return t}function mi(){let t;return t=Ai(),t===r&&(t=bi()),t}function Ai(){let t,n,e,o,u,i,c;if(t=Xo,n=wc(),n!==r)if(Sc(),e=gu(),e!==r){for(Sc(),o=[],u=Xo,i=wi(),i!==r?(c=Sc(),u=i):(Xo=u,u=r);u!==r;)o.push(u),u=Xo,i=wi(),i!==r?(c=Sc(),u=i):(Xo=u,u=r);u=Tc(),u!==r?(Jo=t,t=Pr(e,o)):(Xo=t,t=r)}else Xo=t,t=r;else Xo=t,t=r;if(t===r)if(t=Xo,n=wc(),n!==r)if(Sc(),e=gu(),e!==r){for(Sc(),o=[],u=Xo,i=wi(),i!==r?(c=Sc(),u=i):(Xo=u,u=r);u!==r;)o.push(u),u=Xo,i=wi(),i!==r?(c=Sc(),u=i):(Xo=u,u=r);u=Ti(),u!==r?(i=Sc(),c=Tc(),c!==r?(Jo=t,t=Zr(e,o,u)):(Xo=t,t=r)):(Xo=t,t=r)}else Xo=t,t=r;else Xo=t,t=r;return t}function bi(){let t,n,e,o,u,i;if(t=Xo,n=wc(),n!==r){for(Sc(),e=[],o=Xo,u=Li(),u!==r?(i=Sc(),o=u):(Xo=o,o=r);o!==r;)e.push(o),o=Xo,u=Li(),u!==r?(i=Sc(),o=u):(Xo=o,o=r);o=Tc(),o!==r?(Jo=t,t=jr(e)):(Xo=t,t=r)}else Xo=t,t=r;if(t===r)if(t=Xo,n=wc(),n!==r){for(Sc(),e=[],o=Xo,u=Li(),u!==r?(i=Sc(),o=u):(Xo=o,o=r);o!==r;)e.push(o),o=Xo,u=Li(),u!==r?(i=Sc(),o=u):(Xo=o,o=r);o=Ti(),o!==r?(u=Sc(),i=Tc(),i!==r?(Jo=t,t=kr(e,o)):(Xo=t,t=r)):(Xo=t,t=r)}else Xo=t,t=r;return t}function Li(){let t,n,e,o,u;return t=Xo,n=xc(),n!==r?(Sc(),e=gu(),e!==r?(Sc(),o=Nc(),o!==r?(Sc(),u=gu(),u!==r?(Jo=t,t=zr(e,u)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t}function wi(){let t,n,e,o,u;return t=Xo,n=xc(),n!==r?(Sc(),e=gu(),e!==r?(Sc(),o=Nc(),o!==r?(Sc(),u=gu(),u!==r?(Jo=t,t=Gr(e,u)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t}function Ti(){let t,n,e;return t=Xo,n=Rc(),n!==r?(Sc(),e=gu(),e!==r?(Jo=t,t=Wr(e)):(Xo=t,t=r)):(Xo=t,t=r),t}function xi(){let t,n,e,o;return t=Xo,n=Ni(),n!==r?(e=Xo,ru++,o=Pu(),ru--,o===r?e=void 0:(Xo=e,e=r),e!==r?(Jo=t,t=Br(n)):(Xo=t,t=r)):(Xo=t,t=r),t}function Ni(){let t,n,e,o;return t=Xo,n=Ri(),n!==r?(e=Ii(),e!==r?(o=Oi(),o!==r?(Jo=t,t=Yr(n,e,o)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Xo,n=Ri(),n!==r?(e=Ii(),e!==r?(Jo=t,t=qr(n,e)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Xo,n=Ri(),n!==r?(e=Oi(),e!==r?(Jo=t,t=Kr(n,e)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Xo,n=Ri(),n!==r&&(Jo=t,n=Vr(n)),t=n))),t}function Ri(){let t,e,o;return t=Fi(),t===r&&(t=Xo,e=n.charAt(Xo),mt.test(e)?Xo++:(e=r,0===ru&&pu(Pt)),e!==r?(o=Fi(),o!==r?(Jo=t,t=Xr(e,o)):(Xo=t,t=r)):(Xo=t,t=r)),t}function Ii(){let t,e,o;return t=Xo,46===n.charCodeAt(Xo)?(e=C,Xo++):(e=r,0===ru&&pu(Xt)),e!==r?(o=Fi(),o===r&&(o=null),Jo=t,t=Jr(o)):(Xo=t,t=r),t}function Oi(){let t,n,e;return t=Xo,n=Mi(),n!==r?(e=Fi(),e!==r?(Jo=t,t=Qr(n,e)):(Xo=t,t=r)):(Xo=t,t=r),t}function Fi(){let t,n,e;if(t=Xo,n=[],e=Si(),e!==r)for(;e!==r;)n.push(e),e=Si();else n=r;return n!==r&&(Jo=t,n=to(n)),t=n,t}function Si(){let t;return t=n.charAt(Xo),Nt.test(t)?Xo++:(t=r,0===ru&&pu(Jt)),t}function Mi(){let t,e,o;return t=Xo,e=n.charAt(Xo),Rt.test(e)?Xo++:(e=r,0===ru&&pu(Qt)),e!==r?(o=n.charAt(Xo),mt.test(o)?Xo++:(o=r,0===ru&&pu(Pt)),o===r&&(o=null),Jo=t,t=no(e,o)):(Xo=t,t=r),t}function $i(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===m?Xo+=4:(e=r,0===ru&&pu(tn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(e=[e,o],t=e):(Xo=t,t=r)):(Xo=t,t=r),t}function Di(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===A?Xo+=4:(e=r,0===ru&&pu(nn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(e=[e,o],t=e):(Xo=t,t=r)):(Xo=t,t=r),t}function Ui(){let t,e,o,u;return t=Xo,e=n.substr(Xo,5),e.toLowerCase()===b?Xo+=5:(e=r,0===ru&&pu(en)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(e=[e,o],t=e):(Xo=t,t=r)):(Xo=t,t=r),t}function _i(){let t,e,o,u;return t=Xo,e=n.substr(Xo,2),e.toLowerCase()===L?Xo+=2:(e=r,0===ru&&pu(rn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=eo()):(Xo=t,t=r)):(Xo=t,t=r),t}function Hi(){let t,e,o,u;return t=Xo,e=n.substr(Xo,2),e.toLowerCase()===w?Xo+=2:(e=r,0===ru&&pu(on)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=ro()):(Xo=t,t=r)):(Xo=t,t=r),t}function Pi(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===T?Xo+=4:(e=r,0===ru&&pu(un)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=oo()):(Xo=t,t=r)):(Xo=t,t=r),t}function Zi(){let t,e,o,u;return t=Xo,e=n.substr(Xo,6),e.toLowerCase()===x?Xo+=6:(e=r,0===ru&&pu(cn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=uo()):(Xo=t,t=r)):(Xo=t,t=r),t}function ji(){let t,e,o,u;return t=Xo,e=n.substr(Xo,3),e.toLowerCase()===N?Xo+=3:(e=r,0===ru&&pu(ln)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=io()):(Xo=t,t=r)):(Xo=t,t=r),t}function ki(){let t,e,o,u;return t=Xo,e=n.substr(Xo,3),e.toLowerCase()===R?Xo+=3:(e=r,0===ru&&pu(sn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=co()):(Xo=t,t=r)):(Xo=t,t=r),t}function zi(){let t,e,o,u;return t=Xo,e=n.substr(Xo,2),e.toLowerCase()===I?Xo+=2:(e=r,0===ru&&pu(an)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=lo()):(Xo=t,t=r)):(Xo=t,t=r),t}function Gi(){let t,e,o,u;return t=Xo,e=n.substr(Xo,7),e.toLowerCase()===O?Xo+=7:(e=r,0===ru&&pu(fn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=so()):(Xo=t,t=r)):(Xo=t,t=r),t}function Wi(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===F?Xo+=4:(e=r,0===ru&&pu(pn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=ao()):(Xo=t,t=r)):(Xo=t,t=r),t}function Bi(){let t,e,o,u;return t=Xo,e=n.substr(Xo,3),e.toLowerCase()===S?Xo+=3:(e=r,0===ru&&pu(dn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=fo()):(Xo=t,t=r)):(Xo=t,t=r),t}function Yi(){let t,e,o,u;return t=Xo,e=n.substr(Xo,9),e.toLowerCase()===M?Xo+=9:(e=r,0===ru&&pu(vn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=po()):(Xo=t,t=r)):(Xo=t,t=r),t}function qi(){let t,e,o,u;return t=Xo,e=n.substr(Xo,7),e.toLowerCase()===$?Xo+=7:(e=r,0===ru&&pu(yn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=vo()):(Xo=t,t=r)):(Xo=t,t=r),t}function Ki(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===D?Xo+=4:(e=r,0===ru&&pu(hn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=yo()):(Xo=t,t=r)):(Xo=t,t=r),t}function Vi(){let t,e,o,u;return t=Xo,e=n.substr(Xo,8),e.toLowerCase()===U?Xo+=8:(e=r,0===ru&&pu(gn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=ho()):(Xo=t,t=r)):(Xo=t,t=r),t}function Xi(){let t,e,o,u;return t=Xo,e=n.substr(Xo,9),e.toLowerCase()===_?Xo+=9:(e=r,0===ru&&pu(En)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=go()):(Xo=t,t=r)):(Xo=t,t=r),t}function Ji(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===H?Xo+=4:(e=r,0===ru&&pu(Cn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Eo()):(Xo=t,t=r)):(Xo=t,t=r),t}function Qi(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===P?Xo+=4:(e=r,0===ru&&pu(mn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Co()):(Xo=t,t=r)):(Xo=t,t=r),t}function tc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,7),e.toLowerCase()===Z?Xo+=7:(e=r,0===ru&&pu(An)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=mo()):(Xo=t,t=r)):(Xo=t,t=r),t}function nc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,8),e.toLowerCase()===j?Xo+=8:(e=r,0===ru&&pu(bn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Ao()):(Xo=t,t=r)):(Xo=t,t=r),t}function ec(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===k?Xo+=4:(e=r,0===ru&&pu(Ln)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=bo()):(Xo=t,t=r)):(Xo=t,t=r),t}function rc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===z?Xo+=4:(e=r,0===ru&&pu(wn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Lo()):(Xo=t,t=r)):(Xo=t,t=r),t}function oc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,2),e.toLowerCase()===G?Xo+=2:(e=r,0===ru&&pu(Tn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=wo()):(Xo=t,t=r)):(Xo=t,t=r),t}function uc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,7),e.toLowerCase()===W?Xo+=7:(e=r,0===ru&&pu(xn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=To()):(Xo=t,t=r)):(Xo=t,t=r),t}function ic(){let t,e,o,u;return t=Xo,e=n.substr(Xo,3),e.toLowerCase()===B?Xo+=3:(e=r,0===ru&&pu(Nn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=xo()):(Xo=t,t=r)):(Xo=t,t=r),t}function cc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,8),e.toLowerCase()===Y?Xo+=8:(e=r,0===ru&&pu(Rn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=No()):(Xo=t,t=r)):(Xo=t,t=r),t}function lc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,5),e.toLowerCase()===q?Xo+=5:(e=r,0===ru&&pu(In)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Ro()):(Xo=t,t=r)):(Xo=t,t=r),t}function sc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===K?Xo+=4:(e=r,0===ru&&pu(On)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Io()):(Xo=t,t=r)):(Xo=t,t=r),t}function ac(){let t,e,o,u;return t=Xo,e=n.substr(Xo,7),e.toLowerCase()===V?Xo+=7:(e=r,0===ru&&pu(Fn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Oo()):(Xo=t,t=r)):(Xo=t,t=r),t}function fc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,2),e.toLowerCase()===X?Xo+=2:(e=r,0===ru&&pu(Sn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Fo()):(Xo=t,t=r)):(Xo=t,t=r),t}function pc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,8),e.toLowerCase()===J?Xo+=8:(e=r,0===ru&&pu(Mn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=So()):(Xo=t,t=r)):(Xo=t,t=r),t}function dc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===Q?Xo+=4:(e=r,0===ru&&pu($n)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Mo()):(Xo=t,t=r)):(Xo=t,t=r),t}function vc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,13),e.toLowerCase()===tt?Xo+=13:(e=r,0===ru&&pu(Dn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=$o()):(Xo=t,t=r)):(Xo=t,t=r),t}function yc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,15),e.toLowerCase()===nt?Xo+=15:(e=r,0===ru&&pu(Un)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Do()):(Xo=t,t=r)):(Xo=t,t=r),t}function hc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,5),e.toLowerCase()===et?Xo+=5:(e=r,0===ru&&pu(_n)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Uo()):(Xo=t,t=r)):(Xo=t,t=r),t}function gc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,3),e.toLowerCase()===rt?Xo+=3:(e=r,0===ru&&pu(Hn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=_o()):(Xo=t,t=r)):(Xo=t,t=r),t}function Ec(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===ot?Xo+=4:(e=r,0===ru&&pu(Pn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Ho()):(Xo=t,t=r)):(Xo=t,t=r),t}function Cc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,6),e.toLowerCase()===ut?Xo+=6:(e=r,0===ru&&pu(Zn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Po()):(Xo=t,t=r)):(Xo=t,t=r),t}function mc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,6),e.toLowerCase()===it?Xo+=6:(e=r,0===ru&&pu(jn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Zo()):(Xo=t,t=r)):(Xo=t,t=r),t}function Ac(){let t,e,o,u;return t=Xo,e=n.substr(Xo,3),e.toLowerCase()===ct?Xo+=3:(e=r,0===ru&&pu(kn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=jo()):(Xo=t,t=r)):(Xo=t,t=r),t}function bc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,3),e.toLowerCase()===lt?Xo+=3:(e=r,0===ru&&pu(zn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=ko()):(Xo=t,t=r)):(Xo=t,t=r),t}function Lc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===st?Xo+=4:(e=r,0===ru&&pu(Gn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=zo()):(Xo=t,t=r)):(Xo=t,t=r),t}function wc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===at?Xo+=4:(e=r,0===ru&&pu(Wn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Go()):(Xo=t,t=r)):(Xo=t,t=r),t}function Tc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,3),e.toLowerCase()===ft?Xo+=3:(e=r,0===ru&&pu(Bn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Wo()):(Xo=t,t=r)):(Xo=t,t=r),t}function xc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===pt?Xo+=4:(e=r,0===ru&&pu(Yn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Bo()):(Xo=t,t=r)):(Xo=t,t=r),t}function Nc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===dt?Xo+=4:(e=r,0===ru&&pu(qn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Yo()):(Xo=t,t=r)):(Xo=t,t=r),t}function Rc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===vt?Xo+=4:(e=r,0===ru&&pu(Kn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=qo()):(Xo=t,t=r)):(Xo=t,t=r),t}function Ic(){let t;return 44===n.charCodeAt(Xo)?(t=yt,Xo++):(t=r,0===ru&&pu(Vn)),t}function Oc(){let t;return 40===n.charCodeAt(Xo)?(t=ht,Xo++):(t=r,0===ru&&pu(Xn)),t}function Fc(){let t;return 41===n.charCodeAt(Xo)?(t=gt,Xo++):(t=r,0===ru&&pu(Jn)),t}function Sc(){let t,n;for(t=[],n=Mc();n!==r;)t.push(n),n=Mc();return t}function Mc(){let t;return t=n.charAt(Xo),It.test(t)?Xo++:(t=r,0===ru&&pu(Qn)),t}function $c(){let t,e,o,u;if(t=Xo,e=Hu(),e!==r&&(Jo=t,e=Ko(e)),t=e,t===r)if(t=Xo,96===n.charCodeAt(Xo)?(e=Et,Xo++):(e=r,0===ru&&pu(te)),e!==r){if(o=[],u=n.charAt(Xo),Ot.test(u)?Xo++:(u=r,0===ru&&pu(ne)),u!==r)for(;u!==r;)o.push(u),u=n.charAt(Xo),Ot.test(u)?Xo++:(u=r,0===ru&&pu(ne));else o=r;o!==r?(96===n.charCodeAt(Xo)?(u=Et,Xo++):(u=r,0===ru&&pu(te)),u!==r?(Jo=t,t=Vo(o)):(Xo=t,t=r)):(Xo=t,t=r)}else Xo=t,t=r;return t}function Dc(t,n,e){return{type:"unary-expression",location:e,operator:t,expr:n}}function Uc(t,n,e,r,o){const u={type:"binary-expression",location:o,operator:t,left:n,right:e};return void 0!==r&&(u.escape=r),u}function _c(t,...n){return{type:"expression-list",location:t,value:n}}function Hc(t,n){let e=t;for(const{op:r,expr:o,location:{end:u}}of n)e=Uc(r,e,o,void 0,{...e.location,end:u});return e}function Pc(t){!0!==/^(\d{4})-(\d{1,2})-(\d{1,2})$|^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})(\.[0-9]+)?$|^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})(\.[0-9]+)?[ ]{0,1}(\+|\-)(\d{1,2}):(\d{1,2})$|^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2})?[ ]{0,1}(\+|\-)(\d{1,2}):(\d{1,2})$|^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2})$/.test(t)&&uu("Timestamp literal is invalid")}function Zc(t){!0!==/^(\d{1,2}):(\d{1,2}):(\d{1,2})$|^(\d{1,2}):(\d{1,2})$|^(\d{1,2}):(\d{1,2}):(\d{1,2}).([0-9]+)$/.test(t)&&uu("Time literal is invalid")}function jc(t){!0!==/^(\d{4})-(\d{1,2})-(\d{1,2})$|^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})(\.[0-9]+)?$|^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})(\.[0-9]+)?[ ]{0,1}(\+|\-)(\d{1,2}):(\d{1,2})$|^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2})?[ ]{0,1}(\+|\-)(\d{1,2}):(\d{1,2})$|^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2})$/.test(t)&&uu("Date literal is invalid")}tu=i();const kc=tu!==r&&Xo===n.length;function zc(){throw tu!==r&&Xo<n.length&&pu(su()),vu(eu,nu<n.length?iu(nu):null,nu<n.length?fu(nu,nu+1):fu(nu,nu))}return e.peg$library?{peg$result:tu,peg$currPos:Xo,peg$FAILED:r,peg$maxFailExpected:eu,peg$maxFailPos:nu,peg$success:kc,peg$throw:kc?void 0:zc}:kc?tu:void zc()}class e{static parse(t){return n(t)}}function r(t,n){if(null!=t)switch(n(t),t.type){case"when-clause":r(t.operand,n),r(t.value,n);break;case"case-expression":for(const e of t.clauses)r(e,n);"simple"===t.format&&r(t.operand,n),null!==t.else&&r(t.else,n);break;case"expression-list":for(const e of t.value)r(e,n);break;case"unary-expression":r(t.expr,n);break;case"binary-expression":r(t.left,n),r(t.right,n);break;case"function":r(t.args,n);break;case"interval":r(t.value,n),r(t.qualifier,n);break;case"interval-qualifier":r(t.start,n),r(t.end,n)}}export{e as WhereGrammar,r as visitAll};
|
|
2
|
+
class t extends SyntaxError{constructor(t,n,e,r){super(t),this.expected=n,this.found=e,this.location=r,this.name="SyntaxError"}format(t){let n="Error: "+this.message;if(this.location){let e=null;const r=t.find(t=>t.source===this.location.source);r&&(e=r.text.split(/\r\n|\n|\r/g));const o=this.location.start,u=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(o):o,i=this.location.source+":"+u.line+":"+u.column;if(e){const t=this.location.end,r="".padEnd(u.line.toString().length," "),c=e[o.line-1],l=(o.line===t.line?t.column:c.length+1)-o.column||1;n+="\n --\x3e "+i+"\n"+r+" |\n"+u.line+" | "+c+"\n"+r+" | "+"".padEnd(o.column-1," ")+"".padEnd(l,"^")}else n+="\n at "+i}return n}static buildMessage(t,n){function e(t){return t.codePointAt(0).toString(16).toUpperCase()}const r=Object.prototype.hasOwnProperty.call(RegExp.prototype,"unicode")?new RegExp("[\\p{C}\\p{Mn}\\p{Mc}]","gu"):null;function o(t){return r?t.replace(r,t=>"\\u{"+e(t)+"}"):t}function u(t){return o(t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+e(t)).replace(/[\x10-\x1F\x7F-\x9F]/g,t=>"\\x"+e(t)))}function i(t){return o(t.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+e(t)).replace(/[\x10-\x1F\x7F-\x9F]/g,t=>"\\x"+e(t)))}const c={literal:t=>'"'+u(t.text)+'"',class(t){const n=t.parts.map(t=>Array.isArray(t)?i(t[0])+"-"+i(t[1]):i(t));return"["+(t.inverted?"^":"")+n.join("")+"]"+(t.unicode?"u":"")},any:()=>"any character",end:()=>"end of input",other:t=>t.description};function l(t){return c[t.type](t)}function s(t){const n=t.map(l);if(n.sort(),n.length>0){let t=1;for(let e=1;e<n.length;e++)n[e-1]!==n[e]&&(n[t]=n[e],t++);n.length=t}switch(n.length){case 1:return n[0];case 2:return n[0]+" or "+n[1];default:return n.slice(0,-1).join(", ")+", or "+n[n.length-1]}}function a(t){return t?'"'+u(t)+'"':"end of input"}return"Expected "+s(t)+" but "+a(n)+" found."}}function n(n,e){const r={},o=(e=void 0!==e?e:{}).grammarSource,u={start:yu};let i=yu;const c="!",l="=",s=">=",a=">",f="<=",p="<>",d="!=",v="||",y="@",h="'",g="N'",E="''",C=".",A="null",m="true",L="false",b="in",T="is",w="like",x="escape",N="not",R="and",I="or",O="between",F="from",S="for",M="substring",$="extract",D="trim",U="position",_="timestamp",H="date",P="time",Z="leading",j="trailing",z="both",G="cast",W="as",B="integer",Y="int",K="smallint",V="float",q="real",k="varchar",X="to",J="interval",Q="year",tt="timezone_hour",nt="timezone_minute",et="month",rt="day",ot="hour",ut="minute",it="second",ct="dow",lt="doy",st="week",at="case",ft="end",pt="when",dt="then",vt="else",yt=",",ht="(",gt=")",Et="`",Ct=/^[<-=]/,At=/^[+\-]/,mt=/^[*\/]/,Lt=/^[A-Za-z_\x80-\uFFFF]/,bt=/^[A-Za-z0-9_]/,Tt=/^[A-Za-z0-9_.\x80-\uFFFF]/,wt=/^["]/,xt=/^[^']/,Nt=/^[0-9]/,Rt=/^[eE]/,It=/^[ \t\n\r]/,Ot=/^[^`]/,Ft=cu("!",!1),St=cu("=",!1),Mt=cu(">=",!1),$t=cu(">",!1),Dt=cu("<=",!1),Ut=cu("<>",!1),_t=lu([["<","="]],!1,!1,!1),Ht=cu("!=",!1),Pt=lu(["+","-"],!1,!1,!1),Zt=cu("||",!1),jt=lu(["*","/"],!1,!1,!1),zt=lu([["A","Z"],["a","z"],"_",["",""]],!1,!1,!1),Gt=lu([["A","Z"],["a","z"],["0","9"],"_"],!1,!1,!1),Wt=lu([["A","Z"],["a","z"],["0","9"],"_",".",["",""]],!1,!1,!1),Bt=lu(['"'],!1,!1,!1),Yt=cu("@",!1),Kt=cu("'",!1),Vt=cu("N'",!1),qt=cu("''",!1),kt=lu(["'"],!0,!1,!1),Xt=cu(".",!1),Jt=lu([["0","9"]],!1,!1,!1),Qt=lu(["e","E"],!1,!1,!1),tn=cu("NULL",!0),nn=cu("TRUE",!0),en=cu("FALSE",!0),rn=cu("IN",!0),on=cu("IS",!0),un=cu("LIKE",!0),cn=cu("ESCAPE",!0),ln=cu("NOT",!0),sn=cu("AND",!0),an=cu("OR",!0),fn=cu("BETWEEN",!0),pn=cu("FROM",!0),dn=cu("FOR",!0),vn=cu("SUBSTRING",!0),yn=cu("EXTRACT",!0),hn=cu("TRIM",!0),gn=cu("POSITION",!0),En=cu("TIMESTAMP",!0),Cn=cu("DATE",!0),An=cu("TIME",!0),mn=cu("LEADING",!0),Ln=cu("TRAILING",!0),bn=cu("BOTH",!0),Tn=cu("CAST",!0),wn=cu("AS",!0),xn=cu("INTEGER",!0),Nn=cu("INT",!0),Rn=cu("SMALLINT",!0),In=cu("FLOAT",!0),On=cu("REAL",!0),Fn=cu("VARCHAR",!0),Sn=cu("TO",!0),Mn=cu("INTERVAL",!0),$n=cu("YEAR",!0),Dn=cu("TIMEZONE_HOUR",!0),Un=cu("TIMEZONE_MINUTE",!0),_n=cu("MONTH",!0),Hn=cu("DAY",!0),Pn=cu("HOUR",!0),Zn=cu("MINUTE",!0),jn=cu("SECOND",!0),zn=cu("DOW",!0),Gn=cu("DOY",!0),Wn=cu("WEEK",!0),Bn=cu("CASE",!0),Yn=cu("END",!0),Kn=cu("WHEN",!0),Vn=cu("THEN",!0),qn=cu("ELSE",!0),kn=cu(",",!1),Xn=cu("(",!1),Jn=cu(")",!1),Qn=lu([" ","\t","\n","\r"],!1,!1,!1),te=cu("`",!1),ne=lu(["`"],!0,!1,!1);function ee(t){return t}function re(t){return{type:"expression-list",location:ou(),value:t}}function oe(t,n,e){return{op:n,expr:e,location:ou()}}function ue(t,n){return Hc(t,n)}function ie(t,n,e){return{op:n,expr:e,location:ou()}}function ce(t,n){return Hc(t,n)}function le(t){return Dc("NOT",t,ou())}function se(t,n){if(""==n||null==n||null==n)return t;return"arithmetic"==n.type?Hc(t,n.tail):Uc(n.op,t,n.right,n.escape,ou())}function ae(t,n){return{op:t,expr:n,location:ou()}}function fe(t){return{type:"arithmetic",tail:t}}function pe(t,n){return{op:t+"NOT",right:n}}function de(t,n){return{op:t,right:n}}function ve(t,n,e){return _c(ou(),n,e)}function ye(t,n){return{op:"NOT"+t,right:n}}function he(t,n,e){return _c(ou(),n,e)}function ge(t,n){return{op:t,right:n}}function Ee(t){return t[0]+" "+t[2]}function Ce(t){return t[0]+" "+t[2]}function Ae(t,n,e){return{op:t,right:n,escape:e.value}}function me(t,n){return{op:t,right:n,escape:""}}function Le(t,n){return{op:t,right:n}}function be(t,n){return{op:t,right:n}}function Te(t,n,e){return{op:n,expr:e,location:ou()}}function we(t,n){return Hc(t,n)}function xe(t,n,e){return{op:n,expr:e,location:ou()}}function Ne(t,n){return Hc(t,n)}function Re(t){return t.paren=!0,t}function Ie(t){return/^CURRENT_DATE$/i.test(t)?{type:"current-time",location:ou(),mode:"date"}:/^CURRENT_TIMESTAMP$/i.test(t)?{type:"current-time",location:ou(),mode:"timestamp"}:/^CURRENT_TIME$/i.test(t)?{type:"current-time",location:ou(),mode:"time"}:/^CURRENT_USER$/i.test(t)?{type:"current-user",location:ou()}:{type:"column-reference",location:ou(),table:"",column:t}}function Oe(t){return{type:"column-reference",location:ou(),table:"",column:t,delimited:!0}}function Fe(t){return t}function Se(t,n){return t+n.join("")}function Me(t,n){return t+n.join("")}function $e(t){return t}function De(t){return t.join("")}function Ue(){return'"'}function _e(t){return{type:"parameter",location:ou(),value:t[1]}}function He(t,n){return _c(ou(),t,n)}function Pe(t,n){return _c(ou(),t,n)}function Ze(t){return{type:"function",location:ou(),name:"extract",args:t}}function je(t,n,e){return _c(ou(),t,n,...e?[e]:[])}function ze(t,n,e){return _c(ou(),t,n,e)}function Ge(t){return{type:"function",location:ou(),name:"substring",args:t}}function We(t,n){return _c(ou(),t,n)}function Be(t,n){return _c(ou(),t,n)}function Ye(t){return{type:"function",location:ou(),name:"cast",args:t}}function Ke(){return{type:"data-type",location:ou(),value:{type:"integer"}}}function Ve(){return{type:"data-type",location:ou(),value:{type:"smallint"}}}function qe(){return{type:"data-type",location:ou(),value:{type:"float"}}}function ke(){return{type:"data-type",location:ou(),value:{type:"real"}}}function Xe(){return{type:"data-type",location:ou(),value:{type:"date"}}}function Je(){return{type:"data-type",location:ou(),value:{type:"timestamp"}}}function Qe(){return{type:"data-type",location:ou(),value:{type:"time"}}}function tr(t){return{type:"data-type",location:ou(),value:{type:"varchar",size:parseInt(t)}}}function nr(t,n,e){return _c(ou(),t,n,e)}function er(t,n){return _c(ou(),t,n)}function rr(t){return{type:"function",location:ou(),name:"trim",args:t}}function or(t){return{type:"string",location:ou(),value:t??"BOTH"}}function ur(t,n){return _c(ou(),t,n)}function ir(t,n){return _c(ou(),t,n)}function cr(t){return{type:"function",location:ou(),name:"position",args:t}}function lr(t,n){return{type:"function",location:ou(),name:t,args:n}}function sr(t){return{type:"string",location:ou(),value:t}}function ar(t){return"string"===t.type&&Pc(t.value),{type:"timestamp",location:ou(),value:t.value}}function fr(t){return"string"===t.type&&Zc(t.value),{type:"time",location:ou(),value:t.value}}function pr(t,n,e){return{type:"interval",location:ou(),value:n,qualifier:e,op:t}}function dr(t,n){return{type:"interval",location:ou(),value:t,qualifier:n,op:""}}function vr(t,n){return{type:"interval-qualifier",location:ou(),start:t,end:n}}function yr(t,n){return{type:"interval-period",location:ou(),period:t.value,precision:n,secondary:null}}function hr(t){return{type:"interval-period",location:ou(),period:t.value,precision:null,secondary:null}}function gr(t){return{type:"interval-period",location:ou(),period:t.value,precision:null,secondary:null}}function Er(t,n){return{type:"interval-period",location:ou(),period:"second",precision:t,secondary:n}}function Cr(t){return{type:"interval-period",location:ou(),period:"second",precision:t,secondary:null}}function Ar(){return{type:"interval-period",location:ou(),period:"second",precision:null,secondary:null}}function mr(t,n){return{type:"interval-period",location:ou(),period:t.value,precision:n,secondary:null}}function Lr(t){return{type:"interval-period",location:ou(),period:t.value,precision:null,secondary:null}}function br(t,n){return{type:"interval-period",location:ou(),period:"second",precision:t,secondary:n}}function Tr(t){return{type:"interval-period",location:ou(),period:"second",precision:t,secondary:null}}function wr(){return{type:"interval-period",location:ou(),period:"second",precision:null,secondary:null}}function xr(){return{type:"string",location:ou(),value:"day"}}function Nr(){return{type:"string",location:ou(),value:"hour"}}function Rr(){return{type:"string",location:ou(),value:"minute"}}function Ir(){return{type:"string",location:ou(),value:"month"}}function Or(){return{type:"string",location:ou(),value:"year"}}function Fr(t){return parseFloat(t)}function Sr(t){return parseFloat(t)}function Mr(t){return"string"===t.type&&jc(t.value),{type:"date",location:ou(),value:t.value}}function $r(){return{type:"null",location:ou(),value:null}}function Dr(){return{type:"boolean",location:ou(),value:!0}}function Ur(){return{type:"boolean",location:ou(),value:!1}}function _r(){return"'"}function Hr(t){return{type:"string",location:ou(),value:t.join("")}}function Pr(t,n){return{type:"case-expression",location:ou(),format:"simple",operand:t,clauses:n,else:null,elseLocation:null}}function Zr(t,n,e){return{type:"case-expression",location:ou(),format:"simple",operand:t,clauses:n,else:e.value,elseLocation:e.location}}function jr(t){return{type:"case-expression",location:ou(),format:"searched",clauses:t,else:null,elseLocation:null}}function zr(t,n){return{type:"case-expression",location:ou(),format:"searched",clauses:t,else:n.value,elseLocation:n.location}}function Gr(t,n){return{type:"when-clause",location:ou(),operand:t,value:n}}function Wr(t,n){return{type:"when-clause",location:ou(),operand:t,value:n}}function Br(t){return{type:"else-clause",location:ou(),value:t}}function Yr(t){return{type:"number",location:ou(),value:t}}function Kr(t,n,e){return parseFloat(t+n+e)}function Vr(t,n){return parseFloat(t+n)}function qr(t,n){return parseFloat(t+n)}function kr(t){return parseFloat(t)}function Xr(t,n){return t[0]+n}function Jr(t){return"."+(null!=t?t:"")}function Qr(t,n){return t+n}function to(t){return t.join("")}function no(t,n){return"e"+(null===n?"":n)}function eo(){return"IN"}function ro(){return"IS"}function oo(){return"LIKE"}function uo(){return"ESCAPE"}function io(){return"NOT"}function co(){return"AND"}function lo(){return"OR"}function so(){return"BETWEEN"}function ao(){return"FROM"}function fo(){return"FOR"}function po(){return"SUBSTRING"}function vo(){return"EXTRACT"}function yo(){return"TRIM"}function ho(){return"POSITION"}function go(){return"TIMESTAMP"}function Eo(){return"DATE"}function Co(){return"TIME"}function Ao(){return"LEADING"}function mo(){return"TRAILING"}function Lo(){return"BOTH"}function bo(){return"CAST"}function To(){return"AS"}function wo(){return"INTEGER"}function xo(){return"INT"}function No(){return"SMALLINT"}function Ro(){return"FLOAT"}function Io(){return"REAL"}function Oo(){return"VARCHAR"}function Fo(){return"TO"}function So(){return"INTERVAL"}function Mo(){return"YEAR"}function $o(){return"TIMEZONE_HOUR"}function Do(){return"TIMEZONE_MINUTE"}function Uo(){return"MONTH"}function _o(){return"DAY"}function Ho(){return"HOUR"}function Po(){return"MINUTE"}function Zo(){return"SECOND"}function jo(){return"DOW"}function zo(){return"DOY"}function Go(){return"WEEK"}function Wo(){return"CASE"}function Bo(){return"END"}function Yo(){return"WHEN"}function Ko(){return"THEN"}function Vo(){return"ELSE"}function qo(t){return t}function ko(t){return t.join("")}let Xo=0|e.peg$currPos,Jo=Xo;const Qo=[{line:1,column:1}];let tu,nu=Xo,eu=e.peg$maxFailExpected||[],ru=0|e.peg$silentFails;if(e.startRule){if(!(e.startRule in u))throw new Error("Can't start parsing from rule \""+e.startRule+'".');i=u[e.startRule]}function ou(){return fu(Jo,Xo)}function uu(t,n){throw du(t,n=void 0!==n?n:fu(Jo,Xo))}function iu(t=Xo){const e=n.codePointAt(t);return void 0===e?"":String.fromCodePoint(e)}function cu(t,n){return{type:"literal",text:t,ignoreCase:n}}function lu(t,n,e,r){return{type:"class",parts:t,inverted:n,ignoreCase:e,unicode:r}}function su(){return{type:"end"}}function au(t){let e,r=Qo[t];if(r)return r;if(t>=Qo.length)e=Qo.length-1;else for(e=t;!Qo[--e];);for(r=Qo[e],r={line:r.line,column:r.column};e<t;)10===n.charCodeAt(e)?(r.line++,r.column=1):r.column++,e++;return Qo[t]=r,r}function fu(t,n,e){const r=au(t),u=au(n);return{source:o,start:{offset:t,line:r.line,column:r.column},end:{offset:n,line:u.line,column:u.column}}}function pu(t){Xo<nu||(Xo>nu&&(nu=Xo,eu=[]),eu.push(t))}function du(n,e){return new t(n,null,null,e)}function vu(n,e,r){return new t(t.buildMessage(n,e),n,e,r)}function yu(){let t,n;return t=Xo,Sc(),n=gu(),n!==r?(Sc(),Jo=t,t=ee(n)):(Xo=t,t=r),t}function hu(){let t,n,e,o,u,i,c,l;if(t=Xo,n=Oc(),n!==r){for(Sc(),e=[],o=gu();o!==r;)e.push(o),o=Xo,u=Xo,i=Sc(),c=Ic(),c!==r?(l=Sc(),i=[i,c,l],u=i):(Xo=u,u=r),u!==r?(u=gu(),u===r?(Xo=o,o=r):o=u):o=u;o=Sc(),u=Fc(),u!==r?(Jo=t,t=re(e)):(Xo=t,t=r)}else Xo=t,t=r;return t}function gu(){let t,n,e,o,u,i;if(t=Xo,n=Eu(),n!==r){for(e=[],o=Xo,Sc(),u=Gi(),u!==r?(Sc(),i=Eu(),i!==r?(Jo=o,o=oe(n,u,i)):(Xo=o,o=r)):(Xo=o,o=r);o!==r;)e.push(o),o=Xo,Sc(),u=Gi(),u!==r?(Sc(),i=Eu(),i!==r?(Jo=o,o=oe(n,u,i)):(Xo=o,o=r)):(Xo=o,o=r);Jo=t,t=ue(n,e)}else Xo=t,t=r;return t}function Eu(){let t,n,e,o,u,i;if(t=Xo,n=Cu(),n!==r){for(e=[],o=Xo,Sc(),u=zi(),u!==r?(Sc(),i=Cu(),i!==r?(Jo=o,o=ie(n,u,i)):(Xo=o,o=r)):(Xo=o,o=r);o!==r;)e.push(o),o=Xo,Sc(),u=zi(),u!==r?(Sc(),i=Cu(),i!==r?(Jo=o,o=ie(n,u,i)):(Xo=o,o=r)):(Xo=o,o=r);Jo=t,t=ce(n,e)}else Xo=t,t=r;return t}function Cu(){let t,e,o,u,i;return t=Xo,e=ji(),e===r&&(e=Xo,33===n.charCodeAt(Xo)?(o=c,Xo++):(o=r,0===ru&&pu(Ft)),o!==r?(u=Xo,ru++,61===n.charCodeAt(Xo)?(i=l,Xo++):(i=r,0===ru&&pu(St)),ru--,i===r?u=void 0:(Xo=u,u=r),u!==r?(o=[o,u],e=o):(Xo=e,e=r)):(Xo=e,e=r)),e!==r?(o=Sc(),u=Cu(),u!==r?(Jo=t,t=le(u)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Au()),t}function Au(){let t,n,e,o;return t=Xo,n=Ou(),n!==r?(e=Xo,Sc(),o=mu(),o!==r?e=o:(Xo=e,e=r),e===r&&(e=null),Jo=t,t=se(n,e)):(Xo=t,t=r),t}function mu(){let t;return t=Lu(),t===r&&(t=Iu(),t===r&&(t=wu(),t===r&&(t=Tu(),t===r&&(t=Ru())))),t}function Lu(){let t,n,e,o,u;if(t=Xo,n=[],e=Xo,Sc(),o=bu(),o!==r?(Sc(),u=Ou(),u!==r?(Jo=e,e=ae(o,u)):(Xo=e,e=r)):(Xo=e,e=r),e!==r)for(;e!==r;)n.push(e),e=Xo,Sc(),o=bu(),o!==r?(Sc(),u=Ou(),u!==r?(Jo=e,e=ae(o,u)):(Xo=e,e=r)):(Xo=e,e=r);else n=r;return n!==r&&(Jo=t,n=fe(n)),t=n,t}function bu(){let t;return n.substr(Xo,2)===s?(t=s,Xo+=2):(t=r,0===ru&&pu(Mt)),t===r&&(62===n.charCodeAt(Xo)?(t=a,Xo++):(t=r,0===ru&&pu($t)),t===r&&(n.substr(Xo,2)===f?(t=f,Xo+=2):(t=r,0===ru&&pu(Dt)),t===r&&(n.substr(Xo,2)===p?(t=p,Xo+=2):(t=r,0===ru&&pu(Ut)),t===r&&(t=n.charAt(Xo),Ct.test(t)?Xo++:(t=r,0===ru&&pu(_t)),t===r&&(n.substr(Xo,2)===d?(t=d,Xo+=2):(t=r,0===ru&&pu(Ht))))))),t}function Tu(){let t,n,e,o;return t=Xo,n=Hi(),n!==r?(Sc(),e=ji(),e!==r?(Sc(),o=Ou(),o!==r?(Jo=t,t=pe(n,o)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Xo,n=Hi(),n!==r?(Sc(),e=Ou(),e!==r?(Jo=t,t=de(n,e)):(Xo=t,t=r)):(Xo=t,t=r)),t}function wu(){let t,n,e,o,u,i,c,l;return t=Xo,n=ji(),n!==r?(Sc(),e=Wi(),e!==r?(o=Sc(),u=Xo,i=Ou(),i!==r?(Sc(),c=zi(),c!==r?(Sc(),l=Ou(),l!==r?(Jo=u,u=ve(e,i,l)):(Xo=u,u=r)):(Xo=u,u=r)):(Xo=u,u=r),u!==r?(Jo=t,t=ye(e,u)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Xo,n=Wi(),n!==r?(Sc(),e=Xo,o=Ou(),o!==r?(u=Sc(),i=zi(),i!==r?(Sc(),c=Ou(),c!==r?(Jo=e,e=he(n,o,c)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r),e!==r?(Jo=t,t=ge(n,e)):(Xo=t,t=r)):(Xo=t,t=r)),t}function xu(){let t,n,e,o,u;return t=Xo,n=Xo,e=ji(),e!==r?(o=Sc(),u=Pi(),u!==r?(e=[e,o,u],n=e):(Xo=n,n=r)):(Xo=n,n=r),n!==r&&(Jo=t,n=Ee(n)),t=n,t===r&&(t=Pi()),t}function Nu(){let t,n,e,o,u;return t=Xo,n=Xo,e=ji(),e!==r?(o=Sc(),u=_i(),u!==r?(e=[e,o,u],n=e):(Xo=n,n=r)):(Xo=n,n=r),n!==r&&(Jo=t,n=Ce(n)),t=n,t===r&&(t=_i()),t}function Ru(){let t,n,e,o,u;return t=Xo,n=xu(),n!==r?(Sc(),e=Ou(),e!==r?(Sc(),o=Zi(),o!==r?(Sc(),u=Ci(),u!==r?(Jo=t,t=Ae(n,e,u)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Xo,n=xu(),n!==r?(Sc(),e=Ou(),e!==r?(Jo=t,t=me(n,e)):(Xo=t,t=r)):(Xo=t,t=r)),t}function Iu(){let t,n,e;return t=Xo,n=Nu(),n!==r?(Sc(),e=hu(),e!==r?(Jo=t,t=Le(n,e)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Xo,n=Nu(),n!==r?(Sc(),e=Vu(),e!==r?(Jo=t,t=be(n,e)):(Xo=t,t=r)):(Xo=t,t=r)),t}function Ou(){let t,n,e,o,u,i;if(t=Xo,n=Su(),n!==r){for(e=[],o=Xo,Sc(),u=Fu(),u!==r?(Sc(),i=Su(),i!==r?(Jo=o,o=Te(n,u,i)):(Xo=o,o=r)):(Xo=o,o=r);o!==r;)e.push(o),o=Xo,Sc(),u=Fu(),u!==r?(Sc(),i=Su(),i!==r?(Jo=o,o=Te(n,u,i)):(Xo=o,o=r)):(Xo=o,o=r);Jo=t,t=we(n,e)}else Xo=t,t=r;return t}function Fu(){let t;return t=n.charAt(Xo),At.test(t)?Xo++:(t=r,0===ru&&pu(Pt)),t===r&&(n.substr(Xo,2)===v?(t=v,Xo+=2):(t=r,0===ru&&pu(Zt))),t}function Su(){let t,n,e,o,u,i;if(t=Xo,n=$u(),n!==r){for(e=[],o=Xo,Sc(),u=Mu(),u!==r?(Sc(),i=$u(),i!==r?(Jo=o,o=xe(n,u,i)):(Xo=o,o=r)):(Xo=o,o=r);o!==r;)e.push(o),o=Xo,Sc(),u=Mu(),u!==r?(Sc(),i=$u(),i!==r?(Jo=o,o=xe(n,u,i)):(Xo=o,o=r)):(Xo=o,o=r);Jo=t,t=Ne(n,e)}else Xo=t,t=r;return t}function Mu(){let t;return t=n.charAt(Xo),mt.test(t)?Xo++:(t=r,0===ru&&pu(jt)),t}function $u(){let t,n,e,o;return t=oi(),t===r&&(t=qu(),t===r&&(t=ku(),t===r&&(t=Qu(),t===r&&(t=ni(),t===r&&(t=Xu(),t===r&&(t=ei(),t===r&&(t=Ai(),t===r&&(t=Du(),t===r&&(t=Vu(),t===r&&(t=Xo,n=Oc(),n!==r?(Sc(),e=gu(),e!==r?(Sc(),o=Fc(),o!==r?(Jo=t,t=Re(e)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r))))))))))),t}function Du(){let t,n;return t=Xo,n=Uu(),n!==r&&(Jo=t,n=Ie(n)),t=n,t===r&&(t=Xo,n=zu(),n!==r&&(Jo=t,n=Oe(n)),t=n),t}function Uu(){let t,n;return t=Xo,n=_u(),n!==r&&(Jo=t,n=Fe(n)),t=n,t}function _u(){let t,n,e,o;if(t=Xo,n=Pu(),n!==r){for(e=[],o=ju();o!==r;)e.push(o),o=ju();Jo=t,t=Se(n,e)}else Xo=t,t=r;return t}function Hu(){let t,n,e,o;if(t=Xo,n=Pu(),n!==r){for(e=[],o=Zu();o!==r;)e.push(o),o=Zu();Jo=t,t=Me(n,e)}else Xo=t,t=r;return t}function Pu(){let t;return t=n.charAt(Xo),Lt.test(t)?Xo++:(t=r,0===ru&&pu(zt)),t}function Zu(){let t;return t=n.charAt(Xo),bt.test(t)?Xo++:(t=r,0===ru&&pu(Gt)),t}function ju(){let t;return t=n.charAt(Xo),Tt.test(t)?Xo++:(t=r,0===ru&&pu(Wt)),t}function zu(){let t,n,e,o;return t=Xo,n=Ku(),n!==r?(e=Gu(),o=Ku(),o!==r?(Jo=t,t=$e(e)):(Xo=t,t=r)):(Xo=t,t=r),t}function Gu(){let t,n,e;for(t=Xo,n=[],e=Wu();e!==r;)n.push(e),e=Wu();return Jo=t,n=De(n),t=n,t}function Wu(){let t;return t=Yu(),t===r&&(t=Bu()),t}function Bu(){let t,n,e;return t=Xo,n=Ku(),n!==r?(e=Ku(),e!==r?(Jo=t,t=Ue()):(Xo=t,t=r)):(Xo=t,t=r),t}function Yu(){let t;return t=n.charAt(Xo),Tt.test(t)?Xo++:(t=r,0===ru&&pu(Wt)),t}function Ku(){let t;return t=n.charAt(Xo),wt.test(t)?Xo++:(t=r,0===ru&&pu(Bt)),t}function Vu(){let t,e,o,u;return t=Xo,e=Xo,64===n.charCodeAt(Xo)?(o=y,Xo++):(o=r,0===ru&&pu(Yt)),o!==r?(u=Hu(),u!==r?(o=[o,u],e=o):(Xo=e,e=r)):(Xo=e,e=r),e!==r&&(Jo=t,e=_e(e)),t=e,t}function qu(){let t,n,e,o,u,i,c,l;return t=Xo,n=Vi(),n!==r?(Sc(),e=Xo,o=Oc(),o!==r?(Sc(),u=ri(),u!==r?(Sc(),i=Bi(),i!==r?(Sc(),c=gu(),c!==r?(Sc(),l=Fc(),l!==r?(Jo=e,e=He(u,c)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r),e===r&&(e=Xo,o=Oc(),o!==r?(Sc(),u=ri(),u!==r?(Sc(),i=Ic(),i!==r?(Sc(),c=gu(),c!==r?(Sc(),l=Fc(),l!==r?(Jo=e,e=Pe(u,c)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)),e!==r?(Jo=t,t=Ze(e)):(Xo=t,t=r)):(Xo=t,t=r),t}function ku(){let t,n,e,o,u,i,c,l,s,a,f;return t=Xo,n=Ki(),n!==r?(Sc(),e=Xo,o=Oc(),o!==r?(Sc(),u=gu(),u!==r?(Sc(),i=Bi(),i!==r?(Sc(),c=gu(),c!==r?(Sc(),l=Xo,s=Yi(),s!==r?(a=Sc(),f=gu(),f!==r?(Sc(),l=f):(Xo=l,l=r)):(Xo=l,l=r),l===r&&(l=null),s=Fc(),s!==r?(Jo=e,e=je(u,c,l)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r),e===r&&(e=Xo,o=Oc(),o!==r?(Sc(),u=gu(),u!==r?(Sc(),i=Ic(),i!==r?(Sc(),c=gu(),c!==r?(Sc(),l=Ic(),l!==r?(s=Sc(),a=gu(),a!==r?(f=Fc(),f!==r?(Jo=e,e=ze(u,c,a)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)),e!==r?(Jo=t,t=Ge(e)):(Xo=t,t=r)):(Xo=t,t=r),t}function Xu(){let t,n,e,o,u,i,c,l;return t=Xo,n=rc(),n!==r?(Sc(),e=Xo,o=Oc(),o!==r?(Sc(),u=gu(),u!==r?(Sc(),i=oc(),i!==r?(Sc(),c=Ju(),c!==r?(Sc(),l=Fc(),l!==r?(Jo=e,e=We(u,c)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r),e===r&&(e=Xo,o=Oc(),o!==r?(Sc(),u=gu(),u!==r?(Sc(),i=Ic(),i!==r?(Sc(),c=Ju(),c!==r?(Sc(),l=Fc(),l!==r?(Jo=e,e=Be(u,c)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)),e!==r?(Jo=t,t=Ye(e)):(Xo=t,t=r)):(Xo=t,t=r),t}function Ju(){let t,n,e,o,u;return t=Xo,n=uc(),n===r&&(n=ic()),n!==r&&(Jo=t,n=Ke()),t=n,t===r&&(t=Xo,n=cc(),n!==r&&(Jo=t,n=Ve()),t=n,t===r&&(t=Xo,n=lc(),n!==r&&(Jo=t,n=qe()),t=n,t===r&&(t=Xo,n=sc(),n!==r&&(Jo=t,n=ke()),t=n,t===r&&(t=Xo,n=Ji(),n!==r&&(Jo=t,n=Xe()),t=n,t===r&&(t=Xo,n=Xi(),n!==r&&(Jo=t,n=Je()),t=n,t===r&&(t=Xo,n=Qi(),n!==r&&(Jo=t,n=Qe()),t=n,t===r&&(t=Xo,n=ac(),n!==r?(Sc(),e=Oc(),e!==r?(Sc(),o=Fi(),o!==r?(Sc(),u=Fc(),u!==r?(Jo=t,t=tr(o)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)))))))),t}function Qu(){let t,n,e,o,u,i,c,l,s;return t=Xo,n=qi(),n!==r?(Sc(),e=Xo,o=Oc(),o!==r?(Sc(),u=ti(),Sc(),i=gu(),i!==r?(Sc(),c=Bi(),c!==r?(Sc(),l=gu(),l!==r?(Sc(),s=Fc(),s!==r?(Jo=e,e=nr(u,i,l)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r),e===r&&(e=Xo,o=Oc(),o!==r?(Sc(),u=ti(),Sc(),i=gu(),i!==r?(Sc(),c=Fc(),c!==r?(Jo=e,e=er(u,i)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)),e!==r?(Jo=t,t=rr(e)):(Xo=t,t=r)):(Xo=t,t=r),t}function ti(){let t,n;return t=Xo,n=tc(),n===r&&(n=nc(),n===r&&(n=ec())),n===r&&(n=null),Jo=t,n=or(n),t=n,t}function ni(){let t,n,e,o,u,i,c,l;return t=Xo,n=ki(),n!==r?(Sc(),e=Xo,o=Oc(),o!==r?(Sc(),u=gu(),u!==r?(Sc(),i=_i(),i!==r?(Sc(),c=gu(),c!==r?(Sc(),l=Fc(),l!==r?(Jo=e,e=ur(u,c)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r),e===r&&(e=Xo,o=Oc(),o!==r?(Sc(),u=gu(),u!==r?(Sc(),i=Ic(),i!==r?(Sc(),c=gu(),c!==r?(Sc(),l=Fc(),l!==r?(Jo=e,e=ir(u,c)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)):(Xo=e,e=r)),e!==r?(Jo=t,t=cr(e)):(Xo=t,t=r)):(Xo=t,t=r),t}function ei(){let t,n,e,o;return t=Xo,n=Xo,ru++,e=Vi(),ru--,e===r?n=void 0:(Xo=n,n=r),n!==r?(e=$c(),e!==r?(Sc(),o=hu(),o!==r?(Jo=t,t=lr(e,o)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t}function ri(){let t,n;return t=Xo,n=dc(),n===r&&(n=hc(),n===r&&(n=gc(),n===r&&(n=Ec(),n===r&&(n=Cc(),n===r&&(n=Ac(),n===r&&(n=vc(),n===r&&(n=yc(),n===r&&(n=mc(),n===r&&(n=Lc(),n===r&&(n=bc())))))))))),n!==r&&(Jo=t,n=sr(n)),t=n,t}function oi(){let t;return t=Ci(),t===r&&(t=xi(),t===r&&(t=gi(),t===r&&(t=hi(),t===r&&(t=yi(),t===r&&(t=ui(),t===r&&(t=ci(),t===r&&(t=ii()))))))),t}function ui(){let t,n,e;return t=Xo,n=Xi(),n!==r?(Sc(),e=Ei(),e!==r?(Jo=t,t=ar(e)):(Xo=t,t=r)):(Xo=t,t=r),t}function ii(){let t,n,e;return t=Xo,n=Qi(),n!==r?(Sc(),e=Ei(),e!==r?(Jo=t,t=fr(e)):(Xo=t,t=r)):(Xo=t,t=r),t}function ci(){let t,e,o,u,i;return t=Xo,e=pc(),e!==r?(Sc(),o=n.charAt(Xo),At.test(o)?Xo++:(o=r,0===ru&&pu(Pt)),o!==r?(Sc(),u=Ei(),u!==r?(Sc(),i=li(),i!==r?(Jo=t,t=pr(o,u,i)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Xo,e=pc(),e!==r?(Sc(),o=Ei(),o!==r?(Sc(),u=li(),u!==r?(Jo=t,t=dr(o,u)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)),t}function li(){let t,n,e,o;return t=Xo,n=si(),n!==r?(Sc(),e=fc(),e!==r?(Sc(),o=ai(),o!==r?(Jo=t,t=vr(n,o)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=fi()),t}function si(){let t,n,e,o,u;return t=Xo,n=pi(),n!==r?(Sc(),e=Oc(),e!==r?(Sc(),o=vi(),o!==r?(Sc(),u=Fc(),u!==r?(Jo=t,t=yr(n,o)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Xo,n=pi(),n!==r&&(Jo=t,n=hr(n)),t=n),t}function ai(){let t,n,e,o,u,i,c;return t=Xo,n=pi(),n!==r&&(Jo=t,n=gr(n)),t=n,t===r&&(t=Xo,n=Ac(),n!==r?(Sc(),e=Oc(),e!==r?(Sc(),o=vi(),o!==r?(Sc(),u=Ic(),u!==r?(Sc(),i=di(),i!==r?(Sc(),c=Fc(),c!==r?(Jo=t,t=Er(o,i)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Xo,n=Ac(),n!==r?(Sc(),e=Oc(),e!==r?(Sc(),o=vi(),o!==r?(Sc(),u=Fc(),u!==r?(Jo=t,t=Cr(o)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Xo,n=Ac(),n!==r&&(Jo=t,n=Ar()),t=n))),t}function fi(){let t,n,e,o,u,i,c;return t=Xo,n=pi(),n!==r?(Sc(),e=Oc(),e!==r?(Sc(),o=di(),o!==r?(Sc(),u=Fc(),u!==r?(Jo=t,t=mr(n,o)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Xo,n=pi(),n!==r&&(Jo=t,n=Lr(n)),t=n,t===r&&(t=Xo,n=Ac(),n!==r?(Sc(),e=Oc(),e!==r?(Sc(),o=vi(),o!==r?(Sc(),u=Ic(),u!==r?(Sc(),i=di(),i!==r?(Sc(),c=Fc(),c!==r?(Jo=t,t=br(o,i)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Xo,n=Ac(),n!==r?(Sc(),e=Oc(),e!==r?(Sc(),o=di(),o!==r?(Sc(),u=Fc(),u!==r?(Jo=t,t=Tr(o)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Xo,n=Ac(),n!==r&&(Jo=t,n=wr()),t=n)))),t}function pi(){let t,n;return t=Xo,n=gc(),n!==r&&(Jo=t,n=xr()),t=n,t===r&&(t=Xo,n=Ec(),n!==r&&(Jo=t,n=Nr()),t=n,t===r&&(t=Xo,n=Cc(),n!==r&&(Jo=t,n=Rr()),t=n,t===r&&(t=Xo,n=hc(),n!==r&&(Jo=t,n=Ir()),t=n,t===r&&(t=Xo,n=dc(),n!==r&&(Jo=t,n=Or()),t=n)))),t}function di(){let t,n;return t=Xo,n=Fi(),n!==r&&(Jo=t,n=Fr(n)),t=n,t}function vi(){let t,n;return t=Xo,n=Fi(),n!==r&&(Jo=t,n=Sr(n)),t=n,t}function yi(){let t,n,e;return t=Xo,n=Ji(),n!==r?(Sc(),e=Ei(),e!==r?(Jo=t,t=Mr(e)):(Xo=t,t=r)):(Xo=t,t=r),t}function hi(){let t,n;return t=Xo,n=$i(),n!==r&&(Jo=t,n=$r()),t=n,t}function gi(){let t,n;return t=Xo,n=Di(),n!==r&&(Jo=t,n=Dr()),t=n,t===r&&(t=Xo,n=Ui(),n!==r&&(Jo=t,n=Ur()),t=n),t}function Ei(){let t;return t=Ci(),t===r&&(t=Vu()),t}function Ci(){let t,e,o,u,i;if(t=Xo,39===n.charCodeAt(Xo)?(e=h,Xo++):(e=r,0===ru&&pu(Kt)),e===r&&(n.substr(Xo,2)===g?(e=g,Xo+=2):(e=r,0===ru&&pu(Vt))),e!==r){for(o=[],u=Xo,n.substr(Xo,2)===E?(i=E,Xo+=2):(i=r,0===ru&&pu(qt)),i!==r&&(Jo=u,i=_r()),u=i,u===r&&(u=n.charAt(Xo),xt.test(u)?Xo++:(u=r,0===ru&&pu(kt)));u!==r;)o.push(u),u=Xo,n.substr(Xo,2)===E?(i=E,Xo+=2):(i=r,0===ru&&pu(qt)),i!==r&&(Jo=u,i=_r()),u=i,u===r&&(u=n.charAt(Xo),xt.test(u)?Xo++:(u=r,0===ru&&pu(kt)));39===n.charCodeAt(Xo)?(u=h,Xo++):(u=r,0===ru&&pu(Kt)),u!==r?(Jo=t,t=Hr(o)):(Xo=t,t=r)}else Xo=t,t=r;return t}function Ai(){let t;return t=mi(),t===r&&(t=Li()),t}function mi(){let t,n,e,o,u,i,c;if(t=Xo,n=Tc(),n!==r)if(Sc(),e=gu(),e!==r){for(Sc(),o=[],u=Xo,i=Ti(),i!==r?(c=Sc(),u=i):(Xo=u,u=r);u!==r;)o.push(u),u=Xo,i=Ti(),i!==r?(c=Sc(),u=i):(Xo=u,u=r);u=wc(),u!==r?(Jo=t,t=Pr(e,o)):(Xo=t,t=r)}else Xo=t,t=r;else Xo=t,t=r;if(t===r)if(t=Xo,n=Tc(),n!==r)if(Sc(),e=gu(),e!==r){for(Sc(),o=[],u=Xo,i=Ti(),i!==r?(c=Sc(),u=i):(Xo=u,u=r);u!==r;)o.push(u),u=Xo,i=Ti(),i!==r?(c=Sc(),u=i):(Xo=u,u=r);u=wi(),u!==r?(i=Sc(),c=wc(),c!==r?(Jo=t,t=Zr(e,o,u)):(Xo=t,t=r)):(Xo=t,t=r)}else Xo=t,t=r;else Xo=t,t=r;return t}function Li(){let t,n,e,o,u,i;if(t=Xo,n=Tc(),n!==r){for(Sc(),e=[],o=Xo,u=bi(),u!==r?(i=Sc(),o=u):(Xo=o,o=r);o!==r;)e.push(o),o=Xo,u=bi(),u!==r?(i=Sc(),o=u):(Xo=o,o=r);o=wc(),o!==r?(Jo=t,t=jr(e)):(Xo=t,t=r)}else Xo=t,t=r;if(t===r)if(t=Xo,n=Tc(),n!==r){for(Sc(),e=[],o=Xo,u=bi(),u!==r?(i=Sc(),o=u):(Xo=o,o=r);o!==r;)e.push(o),o=Xo,u=bi(),u!==r?(i=Sc(),o=u):(Xo=o,o=r);o=wi(),o!==r?(u=Sc(),i=wc(),i!==r?(Jo=t,t=zr(e,o)):(Xo=t,t=r)):(Xo=t,t=r)}else Xo=t,t=r;return t}function bi(){let t,n,e,o,u;return t=Xo,n=xc(),n!==r?(Sc(),e=gu(),e!==r?(Sc(),o=Nc(),o!==r?(Sc(),u=gu(),u!==r?(Jo=t,t=Gr(e,u)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t}function Ti(){let t,n,e,o,u;return t=Xo,n=xc(),n!==r?(Sc(),e=gu(),e!==r?(Sc(),o=Nc(),o!==r?(Sc(),u=gu(),u!==r?(Jo=t,t=Wr(e,u)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t}function wi(){let t,n,e;return t=Xo,n=Rc(),n!==r?(Sc(),e=gu(),e!==r?(Jo=t,t=Br(e)):(Xo=t,t=r)):(Xo=t,t=r),t}function xi(){let t,n,e,o;return t=Xo,n=Ni(),n!==r?(e=Xo,ru++,o=Pu(),ru--,o===r?e=void 0:(Xo=e,e=r),e!==r?(Jo=t,t=Yr(n)):(Xo=t,t=r)):(Xo=t,t=r),t}function Ni(){let t,n,e,o;return t=Xo,n=Ri(),n!==r?(e=Ii(),e!==r?(o=Oi(),o!==r?(Jo=t,t=Kr(n,e,o)):(Xo=t,t=r)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Xo,n=Ri(),n!==r?(e=Ii(),e!==r?(Jo=t,t=Vr(n,e)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Xo,n=Ri(),n!==r?(e=Oi(),e!==r?(Jo=t,t=qr(n,e)):(Xo=t,t=r)):(Xo=t,t=r),t===r&&(t=Xo,n=Ri(),n!==r&&(Jo=t,n=kr(n)),t=n))),t}function Ri(){let t,e,o;return t=Fi(),t===r&&(t=Xo,e=n.charAt(Xo),At.test(e)?Xo++:(e=r,0===ru&&pu(Pt)),e!==r?(o=Fi(),o!==r?(Jo=t,t=Xr(e,o)):(Xo=t,t=r)):(Xo=t,t=r)),t}function Ii(){let t,e,o;return t=Xo,46===n.charCodeAt(Xo)?(e=C,Xo++):(e=r,0===ru&&pu(Xt)),e!==r?(o=Fi(),o===r&&(o=null),Jo=t,t=Jr(o)):(Xo=t,t=r),t}function Oi(){let t,n,e;return t=Xo,n=Mi(),n!==r?(e=Fi(),e!==r?(Jo=t,t=Qr(n,e)):(Xo=t,t=r)):(Xo=t,t=r),t}function Fi(){let t,n,e;if(t=Xo,n=[],e=Si(),e!==r)for(;e!==r;)n.push(e),e=Si();else n=r;return n!==r&&(Jo=t,n=to(n)),t=n,t}function Si(){let t;return t=n.charAt(Xo),Nt.test(t)?Xo++:(t=r,0===ru&&pu(Jt)),t}function Mi(){let t,e,o;return t=Xo,e=n.charAt(Xo),Rt.test(e)?Xo++:(e=r,0===ru&&pu(Qt)),e!==r?(o=n.charAt(Xo),At.test(o)?Xo++:(o=r,0===ru&&pu(Pt)),o===r&&(o=null),Jo=t,t=no(e,o)):(Xo=t,t=r),t}function $i(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===A?Xo+=4:(e=r,0===ru&&pu(tn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(e=[e,o],t=e):(Xo=t,t=r)):(Xo=t,t=r),t}function Di(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===m?Xo+=4:(e=r,0===ru&&pu(nn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(e=[e,o],t=e):(Xo=t,t=r)):(Xo=t,t=r),t}function Ui(){let t,e,o,u;return t=Xo,e=n.substr(Xo,5),e.toLowerCase()===L?Xo+=5:(e=r,0===ru&&pu(en)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(e=[e,o],t=e):(Xo=t,t=r)):(Xo=t,t=r),t}function _i(){let t,e,o,u;return t=Xo,e=n.substr(Xo,2),e.toLowerCase()===b?Xo+=2:(e=r,0===ru&&pu(rn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=eo()):(Xo=t,t=r)):(Xo=t,t=r),t}function Hi(){let t,e,o,u;return t=Xo,e=n.substr(Xo,2),e.toLowerCase()===T?Xo+=2:(e=r,0===ru&&pu(on)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=ro()):(Xo=t,t=r)):(Xo=t,t=r),t}function Pi(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===w?Xo+=4:(e=r,0===ru&&pu(un)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=oo()):(Xo=t,t=r)):(Xo=t,t=r),t}function Zi(){let t,e,o,u;return t=Xo,e=n.substr(Xo,6),e.toLowerCase()===x?Xo+=6:(e=r,0===ru&&pu(cn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=uo()):(Xo=t,t=r)):(Xo=t,t=r),t}function ji(){let t,e,o,u;return t=Xo,e=n.substr(Xo,3),e.toLowerCase()===N?Xo+=3:(e=r,0===ru&&pu(ln)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=io()):(Xo=t,t=r)):(Xo=t,t=r),t}function zi(){let t,e,o,u;return t=Xo,e=n.substr(Xo,3),e.toLowerCase()===R?Xo+=3:(e=r,0===ru&&pu(sn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=co()):(Xo=t,t=r)):(Xo=t,t=r),t}function Gi(){let t,e,o,u;return t=Xo,e=n.substr(Xo,2),e.toLowerCase()===I?Xo+=2:(e=r,0===ru&&pu(an)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=lo()):(Xo=t,t=r)):(Xo=t,t=r),t}function Wi(){let t,e,o,u;return t=Xo,e=n.substr(Xo,7),e.toLowerCase()===O?Xo+=7:(e=r,0===ru&&pu(fn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=so()):(Xo=t,t=r)):(Xo=t,t=r),t}function Bi(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===F?Xo+=4:(e=r,0===ru&&pu(pn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=ao()):(Xo=t,t=r)):(Xo=t,t=r),t}function Yi(){let t,e,o,u;return t=Xo,e=n.substr(Xo,3),e.toLowerCase()===S?Xo+=3:(e=r,0===ru&&pu(dn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=fo()):(Xo=t,t=r)):(Xo=t,t=r),t}function Ki(){let t,e,o,u;return t=Xo,e=n.substr(Xo,9),e.toLowerCase()===M?Xo+=9:(e=r,0===ru&&pu(vn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=po()):(Xo=t,t=r)):(Xo=t,t=r),t}function Vi(){let t,e,o,u;return t=Xo,e=n.substr(Xo,7),e.toLowerCase()===$?Xo+=7:(e=r,0===ru&&pu(yn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=vo()):(Xo=t,t=r)):(Xo=t,t=r),t}function qi(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===D?Xo+=4:(e=r,0===ru&&pu(hn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=yo()):(Xo=t,t=r)):(Xo=t,t=r),t}function ki(){let t,e,o,u;return t=Xo,e=n.substr(Xo,8),e.toLowerCase()===U?Xo+=8:(e=r,0===ru&&pu(gn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=ho()):(Xo=t,t=r)):(Xo=t,t=r),t}function Xi(){let t,e,o,u;return t=Xo,e=n.substr(Xo,9),e.toLowerCase()===_?Xo+=9:(e=r,0===ru&&pu(En)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=go()):(Xo=t,t=r)):(Xo=t,t=r),t}function Ji(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===H?Xo+=4:(e=r,0===ru&&pu(Cn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Eo()):(Xo=t,t=r)):(Xo=t,t=r),t}function Qi(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===P?Xo+=4:(e=r,0===ru&&pu(An)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Co()):(Xo=t,t=r)):(Xo=t,t=r),t}function tc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,7),e.toLowerCase()===Z?Xo+=7:(e=r,0===ru&&pu(mn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Ao()):(Xo=t,t=r)):(Xo=t,t=r),t}function nc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,8),e.toLowerCase()===j?Xo+=8:(e=r,0===ru&&pu(Ln)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=mo()):(Xo=t,t=r)):(Xo=t,t=r),t}function ec(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===z?Xo+=4:(e=r,0===ru&&pu(bn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Lo()):(Xo=t,t=r)):(Xo=t,t=r),t}function rc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===G?Xo+=4:(e=r,0===ru&&pu(Tn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=bo()):(Xo=t,t=r)):(Xo=t,t=r),t}function oc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,2),e.toLowerCase()===W?Xo+=2:(e=r,0===ru&&pu(wn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=To()):(Xo=t,t=r)):(Xo=t,t=r),t}function uc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,7),e.toLowerCase()===B?Xo+=7:(e=r,0===ru&&pu(xn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=wo()):(Xo=t,t=r)):(Xo=t,t=r),t}function ic(){let t,e,o,u;return t=Xo,e=n.substr(Xo,3),e.toLowerCase()===Y?Xo+=3:(e=r,0===ru&&pu(Nn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=xo()):(Xo=t,t=r)):(Xo=t,t=r),t}function cc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,8),e.toLowerCase()===K?Xo+=8:(e=r,0===ru&&pu(Rn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=No()):(Xo=t,t=r)):(Xo=t,t=r),t}function lc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,5),e.toLowerCase()===V?Xo+=5:(e=r,0===ru&&pu(In)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Ro()):(Xo=t,t=r)):(Xo=t,t=r),t}function sc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===q?Xo+=4:(e=r,0===ru&&pu(On)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Io()):(Xo=t,t=r)):(Xo=t,t=r),t}function ac(){let t,e,o,u;return t=Xo,e=n.substr(Xo,7),e.toLowerCase()===k?Xo+=7:(e=r,0===ru&&pu(Fn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Oo()):(Xo=t,t=r)):(Xo=t,t=r),t}function fc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,2),e.toLowerCase()===X?Xo+=2:(e=r,0===ru&&pu(Sn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Fo()):(Xo=t,t=r)):(Xo=t,t=r),t}function pc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,8),e.toLowerCase()===J?Xo+=8:(e=r,0===ru&&pu(Mn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=So()):(Xo=t,t=r)):(Xo=t,t=r),t}function dc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===Q?Xo+=4:(e=r,0===ru&&pu($n)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Mo()):(Xo=t,t=r)):(Xo=t,t=r),t}function vc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,13),e.toLowerCase()===tt?Xo+=13:(e=r,0===ru&&pu(Dn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=$o()):(Xo=t,t=r)):(Xo=t,t=r),t}function yc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,15),e.toLowerCase()===nt?Xo+=15:(e=r,0===ru&&pu(Un)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Do()):(Xo=t,t=r)):(Xo=t,t=r),t}function hc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,5),e.toLowerCase()===et?Xo+=5:(e=r,0===ru&&pu(_n)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Uo()):(Xo=t,t=r)):(Xo=t,t=r),t}function gc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,3),e.toLowerCase()===rt?Xo+=3:(e=r,0===ru&&pu(Hn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=_o()):(Xo=t,t=r)):(Xo=t,t=r),t}function Ec(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===ot?Xo+=4:(e=r,0===ru&&pu(Pn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Ho()):(Xo=t,t=r)):(Xo=t,t=r),t}function Cc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,6),e.toLowerCase()===ut?Xo+=6:(e=r,0===ru&&pu(Zn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Po()):(Xo=t,t=r)):(Xo=t,t=r),t}function Ac(){let t,e,o,u;return t=Xo,e=n.substr(Xo,6),e.toLowerCase()===it?Xo+=6:(e=r,0===ru&&pu(jn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Zo()):(Xo=t,t=r)):(Xo=t,t=r),t}function mc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,3),e.toLowerCase()===ct?Xo+=3:(e=r,0===ru&&pu(zn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=jo()):(Xo=t,t=r)):(Xo=t,t=r),t}function Lc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,3),e.toLowerCase()===lt?Xo+=3:(e=r,0===ru&&pu(Gn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=zo()):(Xo=t,t=r)):(Xo=t,t=r),t}function bc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===st?Xo+=4:(e=r,0===ru&&pu(Wn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Go()):(Xo=t,t=r)):(Xo=t,t=r),t}function Tc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===at?Xo+=4:(e=r,0===ru&&pu(Bn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Wo()):(Xo=t,t=r)):(Xo=t,t=r),t}function wc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,3),e.toLowerCase()===ft?Xo+=3:(e=r,0===ru&&pu(Yn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Bo()):(Xo=t,t=r)):(Xo=t,t=r),t}function xc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===pt?Xo+=4:(e=r,0===ru&&pu(Kn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Yo()):(Xo=t,t=r)):(Xo=t,t=r),t}function Nc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===dt?Xo+=4:(e=r,0===ru&&pu(Vn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Ko()):(Xo=t,t=r)):(Xo=t,t=r),t}function Rc(){let t,e,o,u;return t=Xo,e=n.substr(Xo,4),e.toLowerCase()===vt?Xo+=4:(e=r,0===ru&&pu(qn)),e!==r?(o=Xo,ru++,u=Zu(),ru--,u===r?o=void 0:(Xo=o,o=r),o!==r?(Jo=t,t=Vo()):(Xo=t,t=r)):(Xo=t,t=r),t}function Ic(){let t;return 44===n.charCodeAt(Xo)?(t=yt,Xo++):(t=r,0===ru&&pu(kn)),t}function Oc(){let t;return 40===n.charCodeAt(Xo)?(t=ht,Xo++):(t=r,0===ru&&pu(Xn)),t}function Fc(){let t;return 41===n.charCodeAt(Xo)?(t=gt,Xo++):(t=r,0===ru&&pu(Jn)),t}function Sc(){let t,n;for(t=[],n=Mc();n!==r;)t.push(n),n=Mc();return t}function Mc(){let t;return t=n.charAt(Xo),It.test(t)?Xo++:(t=r,0===ru&&pu(Qn)),t}function $c(){let t,e,o,u;if(t=Xo,e=Hu(),e!==r&&(Jo=t,e=qo(e)),t=e,t===r)if(t=Xo,96===n.charCodeAt(Xo)?(e=Et,Xo++):(e=r,0===ru&&pu(te)),e!==r){if(o=[],u=n.charAt(Xo),Ot.test(u)?Xo++:(u=r,0===ru&&pu(ne)),u!==r)for(;u!==r;)o.push(u),u=n.charAt(Xo),Ot.test(u)?Xo++:(u=r,0===ru&&pu(ne));else o=r;o!==r?(96===n.charCodeAt(Xo)?(u=Et,Xo++):(u=r,0===ru&&pu(te)),u!==r?(Jo=t,t=ko(o)):(Xo=t,t=r)):(Xo=t,t=r)}else Xo=t,t=r;return t}function Dc(t,n,e){return{type:"unary-expression",location:e,operator:t,expr:n}}function Uc(t,n,e,r,o){const u={type:"binary-expression",location:o,operator:t,left:n,right:e};return void 0!==r&&(u.escape=r),u}function _c(t,...n){return{type:"expression-list",location:t,value:n}}function Hc(t,n){let e=t;for(const{op:r,expr:o,location:{end:u}}of n)e=Uc(r,e,o,void 0,{...e.location,end:u});return e}function Pc(t){!0!==/^(\d{4})-(\d{1,2})-(\d{1,2})$|^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})(\.[0-9]+)?$|^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})(\.[0-9]+)?[ ]{0,1}(\+|\-)(\d{1,2}):(\d{1,2})$|^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2})?[ ]{0,1}(\+|\-)(\d{1,2}):(\d{1,2})$|^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2})$/.test(t)&&uu("Timestamp literal is invalid")}function Zc(t){!0!==/^(\d{1,2}):(\d{1,2}):(\d{1,2})$|^(\d{1,2}):(\d{1,2})$|^(\d{1,2}):(\d{1,2}):(\d{1,2}).([0-9]+)$/.test(t)&&uu("Time literal is invalid")}function jc(t){!0!==/^(\d{4})-(\d{1,2})-(\d{1,2})$|^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})(\.[0-9]+)?$|^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})(\.[0-9]+)?[ ]{0,1}(\+|\-)(\d{1,2}):(\d{1,2})$|^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2})?[ ]{0,1}(\+|\-)(\d{1,2}):(\d{1,2})$|^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2})$/.test(t)&&uu("Date literal is invalid")}tu=i();const zc=tu!==r&&Xo===n.length;function Gc(){throw tu!==r&&Xo<n.length&&pu(su()),vu(eu,nu<n.length?iu(nu):null,nu<n.length?fu(nu,nu+1):fu(nu,nu))}return e.peg$library?{peg$result:tu,peg$currPos:Xo,peg$FAILED:r,peg$maxFailExpected:eu,peg$maxFailPos:nu,peg$success:zc,peg$throw:zc?void 0:Gc}:zc?tu:void Gc()}class e{static parse(t){return n(t)}}export{e as WhereGrammar};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
function e(e,s){e.type in s&&s[e.type]?.(e)}function*s(e){if(null==e)return;const s=[e];for(;s.length;){const e=s.pop();switch(yield e,e.type){case"when-clause":s.push(e.value),s.push(e.operand);break;case"case-expression":{const a=[];for(const s of e.clauses)a.push(s);"simple"===e.format&&a.push(e.operand),null!=e.else&&a.push(e.else);for(let e=a.length-1;e>=0;e--)s.push(a[e]);break}case"expression-list":for(let a=e.value.length-1;a>=0;a--)s.push(e.value[a]);break;case"unary-expression":s.push(e.expr);break;case"binary-expression":s.push(e.right),s.push(e.left);break;case"function":s.push(e.args);break;case"interval":s.push(e.qualifier),s.push(e.value);break;case"interval-qualifier":s.push(e.end),s.push(e.start)}}}export{s as iterateSqlNodes,e as visitSqlNode};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import{SqlError as e}from"./errorSupport.js";function t(e){return r(e).trim()}function r(t){let s,o,u,l;switch(t.type){case"interval":return a(r(t.value),t.qualifier,t.op);case"case-expression":{let e="CASE ";"simple"===t.format&&(e+=r(t.operand));for(let n=0;n<t.clauses.length;n++)e+=` WHEN ${r(t.clauses[n].operand)} THEN ${r(t.clauses[n].value)}`;return null!==t.else&&(e+=` ELSE ${r(t.else)}`),e+=" END",e}case"expression-list":o=[];for(const e of t.value)o.push(r(e));return o;case"unary-expression":return`(NOT ${r(t.expr)})`;case"binary-expression":switch(t.operator){case"AND":return`(${r(t.left)} AND ${r(t.right)})`;case"OR":return`(${r(t.left)} OR ${r(t.right)})`;case"IS":if("null"!==t.right.type)throw new e("UnsupportedIsRhs");return`(${r(t.left)} IS NULL)`;case"ISNOT":if("null"!==t.right.type)throw new e("UnsupportedIsRhs");return`(${r(t.left)} IS NOT NULL)`;case"IN":return s=[],"expression-list"===t.right.type?(s=r(t.right),`(${r(t.left)} IN (${s.join(",")}))`):(l=r(t.right),Array.isArray(l)?`(${r(t.left)} IN (${l.join(",")}))`:`(${r(t.left)} IN (${l}))`);case"NOT IN":return s=[],"expression-list"===t.right.type?(s=r(t.right),`(${r(t.left)} NOT IN (${s.join(",")}))`):(l=r(t.right),Array.isArray(l)?`(${r(t.left)} NOT IN (${l.join(",")}))`:`(${r(t.left)} NOT IN (${l}))`);case"BETWEEN":case"NOTBETWEEN":return u=r(t.right),`(${r(t.left)} ${t.operator} ${u[0]} AND ${u[1]})`;case"LIKE":return""!==t.escape?`(${r(t.left)} LIKE ${r(t.right)} ESCAPE '${t.escape}')`:`(${r(t.left)} LIKE ${r(t.right)})`;case"NOT LIKE":return""!==t.escape?`(${r(t.left)} NOT LIKE ${r(t.right)} ESCAPE '${t.escape}')`:`(${r(t.left)} NOT LIKE ${r(t.right)})`;case"<>":case"<":case">":case">=":case"<=":case"=":case"*":case"-":case"+":case"/":case"||":return`(${r(t.left)} ${t.operator} ${r(t.right)})`;default:throw new e("UnsupportedOperator",{operator:t.operator})}case"null":return"null";case"boolean":return!0===t.value?"1":"0";case"string":return`'${t.value.toString().replaceAll("'","''")}'`;case"timestamp":return`timestamp '${t.value}'`;case"date":return`date '${t.value}'`;case"time":return`time '${t.value}'`;case"number":return t.value.toString();case"current-time":return n(t.mode);case"current-user":return"CURRENT_USER";case"column-reference":return c(t);case"data-type":return t.value;case"function":{const e=r(t.args);return i(t.name,e)}}throw new e("UnsupportedSyntax",{node:t.type})}function n(e){return"date"===e?"CURRENT_DATE":"time"===e?"CURRENT_TIME":"CURRENT_TIMESTAMP"}function a(e,t,r){let n="";return n="interval-period"===t.type?s(t):s(t.start)+" TO "+s(t.end),`INTERVAL${""!==r?r+" ":""} ${e} ${n}`}function s(e){return e.period.toUpperCase()}function c(e){return!0===e.delimited?`"${e.column.split('"').join('""')}"`:e.column}function i(t,r){switch(t.toLowerCase().trim()){case"cos":case"sin":case"tan":case"cosh":case"tanh":case"sinh":case"acos":case"asin":case"atan":case"floor":case"log10":case"log":case"abs":if(1!==r.length)throw new e("InvalidFunctionParameters",{function:t.toLowerCase().trim()});return`${t.toUpperCase().trim()}(${r[0]})`;case"ceiling":case"ceil":if(1!==r.length)throw new e("InvalidFunctionParameters",{function:"ceiling"});return"CEILING("+r[0]+")";case"mod":case"power":case"nullif":if(2!==r.length)throw new e("InvalidFunctionParameters",{function:t.toLowerCase().trim()});return`${t.toUpperCase().trim()}(${r[0]},${r[1]})`;case"round":if(2===r.length)return"ROUND("+r[0]+","+r[1]+")";if(1===r.length)return"ROUND("+r[0]+")";throw new e("InvalidFunctionParameters",{function:"round"});case"truncate":if(r.length<1||r.length>2)throw new e("InvalidFunctionParameters",{function:"truncate"});return"TRUNCATE("+r[0]+(1===r.length?")":","+r[1]+")");case"char_length":case"len":if(1!==r.length)throw new e("InvalidFunctionParameters",{function:"char_length"});return"CHAR_LENGTH("+r[0]+")";case"coalesce":case"concat":{if(r.length<1)throw new e("InvalidFunctionParameters",{function:t.toLowerCase()});let n=t.toUpperCase().trim()+"(";for(let e=0;e<r.length;e++)0!==e&&(n+=","),n+=r[e];return n+=")",n}case"lower":case"lcase":if(1!==r.length)throw new e("InvalidFunctionParameters",{function:"lower"});return"LOWER("+r[0]+")";case"upper":case"ucase":if(1!==r.length)throw new e("InvalidFunctionParameters",{function:"upper"});return"UPPER("+r[0]+")";case"substring":{let e="SUBSTRING("+r[0]+" FROM "+r[1];return 3===r.length&&(e+=" FOR "+r[2]),e+=")",e}case"extract":return"EXTRACT("+r[0].replaceAll("'","")+" FROM "+r[1]+")";case"cast":{let e="";switch(r[1].type){case"date":e="DATE";break;case"float":e="FLOAT";break;case"integer":e="INTEGER";break;case"real":e="REAL";break;case"smallint":e="SMALLINT";break;case"timestamp":e="TIMESTAMP";break;case"varchar":e="VARCHAR("+r[1].size.toString()+")"}return`CAST(${r[0]} AS ${e})`}}throw new e("InvalidFunctionParameters",{function:t})}export{t as sqlNodeToString,i as translateFunctionToDatabaseSpecific};
|
package/core/sql.d.ts
CHANGED
|
@@ -19,8 +19,7 @@ import type { TimeZone } from "../time/types.js";
|
|
|
19
19
|
* `where` token.
|
|
20
20
|
*
|
|
21
21
|
* @param clause - The SQL where clause expression.
|
|
22
|
-
* @param fieldsIndex - The [fields index](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#fieldsIndex)
|
|
23
|
-
* of the layer. The fields index is used to match the fields found in the where clause against the service, to fix casing for example.
|
|
22
|
+
* @param fieldsIndex - The [fields index](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#fieldsIndex) of the layer. The fields index is used to match the fields found in the where clause against the service, to fix casing for example.
|
|
24
23
|
* @returns Parses a string where clause and returns a promise that resolves to
|
|
25
24
|
* an object with the [WhereClause](https://developers.arcgis.com/javascript/latest/references/core/core/sql/WhereClause/) specification.
|
|
26
25
|
* @example
|
|
@@ -52,7 +51,7 @@ import type { TimeZone } from "../time/types.js";
|
|
|
52
51
|
* console.log(testResult); // true
|
|
53
52
|
* });
|
|
54
53
|
*/
|
|
55
|
-
export function parseWhereClause(clause: string, fieldsIndex
|
|
54
|
+
export function parseWhereClause(clause: string, fieldsIndex?: FieldsIndex | null | undefined): Promise<WhereClause>;
|
|
56
55
|
|
|
57
56
|
/**
|
|
58
57
|
* Builds an SQL IN clause for the given field and list of values. Returns null if no values are provided.
|
package/core/sql.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{isUnknownTimeZone as e}from"./sql/UnknownTimeZone.js";import{isDate as t}from"../support/guards.js";import{getLuxonTimeZone as r}from"../time/timeZoneUtils.js";import{FixedOffsetZone as n,DateTime as s}from"luxon";let i;async function a(){return null==i&&(i=import("./sql/WhereClauseCache.js").then(e=>new e.WhereClauseCache(500,500))),i}function l(){i=null}async function c(e,t){const r=await a(),n=r.get(e,t);if(null==n)throw r.getError(e,t);return n}function o(e,t){return e||=null,t||=null,"1=1"===e?t??e:"1=1"===t?e??t:e&&t?`(${e}) AND (${t})`:e??t}function u(e,t){return e||=null,t||=null,"1=1"===e||"1=1"===t||e===t?"1=1"===e?e:t:e&&t?`(${e}) OR (${t})`:e??t}function
|
|
2
|
+
import{isUnknownTimeZone as e}from"./sql/UnknownTimeZone.js";import{isDate as t}from"../support/guards.js";import{getLuxonTimeZone as r}from"../time/timeZoneUtils.js";import{FixedOffsetZone as n,DateTime as s}from"luxon";let i;async function a(){return null==i&&(i=import("./sql/WhereClauseCache.js").then(e=>new e.WhereClauseCache(500,500))),i}function l(){i=null}async function c(e,t){const r=await a(),n=r.get(e,t);if(null==n)throw r.getError(e,t);return n}function o(e,t){return e||=null,t||=null,"1=1"===e?t??e:"1=1"===t?e??t:e&&t?`(${e}) AND (${t})`:e??t}function u(e,t,r){return`${e} BETWEEN ${t} AND ${r}`}function f(e,t,r){return`${e} NOT BETWEEN ${t} AND ${r}`}function d(e,t){return e||=null,t||=null,"1=1"===e||"1=1"===t||e===t?"1=1"===e?e:t:e&&t?`(${e}) OR (${t})`:e??t}function p(e,t){return 0===t.length?null:`${e} IN (${m(t)})`}function T(e,t){return 0===t.length?null:`${e} NOT IN (${m(t)})`}function m(e){return e.map(e=>"string"==typeof e?y(e):e).join(",")}function y(e,t){return null==e?"NULL":`${t??""}'${e.replaceAll("'","''")}'`}function g(e){return Number.isFinite(e)?String(e):"NULL"}function w(e){const[t,r]=e.split("T");return`${t} ${r.replace("Z","+00:00").replace(/[+-]/,e=>` ${e}`)}`}function F(e){return e.split("T")[0]}function h(e){const t=e.indexOf("T")+1,r=Math.max(e.indexOf("-",t),e.indexOf("+",t),e.indexOf("Z",t));return e.slice(t,r>0?r:void 0)}function E(e,t){const i=null!=t?r(t):n.utcInstance,a=s.fromMillis(e,{zone:i});return a.isValid?a:null}function v(e,t){return E(e,t)?.toSQL({includeOffset:!1})}function $(e,t){return E(e,t)?.toSQL({includeOffset:!0})?.replace("Z","+00:00")}function b(e,t){return E(e,t)?.toSQLDate()}function I(e,t){return E(e,t)?.toSQLTime({includeOffset:!1})}function L(e){return"string"==typeof e?e:e?.type}function O(e){return null==e?"NULL":e?"TRUE":"FALSE"}function D(e,t){if(null==e)return"NULL";const r=L(t);switch(typeof e){case"string":switch(r){case"string":case"esriFieldTypeString":case void 0:return g(Number(e));default:throw new Error(`Cannot convert ${r} to sql numeric literal.`)}case"boolean":return e?"1":"0";case"number":switch(r){case"small-integer":case"esriFieldTypeSmallInteger":case"integer":case"esriFieldTypeInteger":case"single":case"esriFieldTypeSingle":case"double":case"esriFieldTypeDouble":case"big-integer":case"esriFieldTypeBigInteger":case"long":case"esriFieldTypeLong":case"oid":case"esriFieldTypeOID":case void 0:return g(e);default:throw new Error(`Cannot convert ${r} to sql numeric literal.`)}}throw new Error("Cannot convert value to sql numeric literal.")}function S(e,r,n){if(null==e)return"NULL";const s=L(r);switch(typeof e){case"string":switch(s){case"timestamp-offset":case"esriFieldTypeTimestampOffset":return y(w(e));case"date-only":case"esriFieldTypeDateOnly":case"time-only":case"esriFieldTypeTimeOnly":case"string":case"esriFieldTypeString":case"global-id":case"esriFieldTypeGlobalID":case"guid":case"esriFieldTypeGUID":case"xml":case"esriFieldTypeXML":case void 0:return y(e);default:throw new Error(`Cannot convert ${s} to sql string literal.`)}case"boolean":return e?"'true'":"'false'";case"number":switch(s){case"date":case"esriFieldTypeDate":return y(v(e,n));case"small-integer":case"esriFieldTypeSmallInteger":case"integer":case"esriFieldTypeInteger":case"single":case"esriFieldTypeSingle":case"double":case"esriFieldTypeDouble":case"big-integer":case"esriFieldTypeBigInteger":case"long":case"esriFieldTypeLong":case"oid":case"esriFieldTypeOID":case void 0:return Number.isFinite(e)?`'${e}'`:"NULL";default:throw new Error(`Cannot convert ${s} to sql string literal.`)}case"object":if(t(e))return y(v(e.valueOf(),n))}throw new Error("Cannot convert value to sql string literal.")}function M(e,r,n){if(null==e)return"NULL";const s=L(r);switch(typeof e){case"string":switch(s){case"timestamp-offset":case"esriFieldTypeTimestampOffset":return y(F(e),"DATE");case"date-only":case"esriFieldTypeDateOnly":case"string":case"esriFieldTypeString":case void 0:return y(e,"DATE");default:throw new Error(`Cannot convert ${s} to sql date literal.`)}case"number":switch(s){case"date":case"esriFieldTypeDate":case void 0:return y(b(e,n),"DATE");default:throw new Error(`Cannot convert ${s} to sql date literal.`)}case"object":if(t(e))return y(b(e.valueOf(),n),"DATE")}throw new Error("Cannot convert value to sql date literal.")}function C(e,r,n){if(null==e)return"NULL";const s=L(r);switch(typeof e){case"string":switch(s){case"timestamp-offset":case"esriFieldTypeTimestampOffset":return y(h(e),"TIME");case"time-only":case"esriFieldTypeTimeOnly":case"string":case"esriFieldTypeString":case void 0:return y(e,"TIME");default:throw new Error(`Cannot convert ${s} to sql time literal.`)}case"number":switch(s){case"date":case"esriFieldTypeDate":case void 0:return y(I(e,n),"TIME");default:throw new Error(`Cannot convert ${s} to sql time literal.`)}case"object":if(t(e))return y(I(e.valueOf(),n),"TIME")}throw new Error("Cannot convert value to sql time literal.")}function N(e,r,n){if(null==e)return"NULL";const s=L(r);switch(typeof e){case"string":switch(s){case"timestamp-offset":case"esriFieldTypeTimestampOffset":return y(w(e),"TIMESTAMP");case"date-only":case"esriFieldTypeDateOnly":return y(`${e} 00:00:00`,"TIMESTAMP");case"string":case"esriFieldTypeString":case void 0:return y(e,"TIMESTAMP");default:throw new Error(`Cannot convert ${s} to sql timestamp literal.`)}case"number":switch(s){case"date":case"esriFieldTypeDate":case void 0:return y(v(e,n),"TIMESTAMP");default:throw new Error(`Cannot convert ${s} to sql timestamp literal.`)}case"object":if(t(e))return y(v(e.valueOf(),n),"TIMESTAMP")}throw new Error("Cannot convert value to sql timestamp literal.")}function q(e,r,n){if(null==e)return"NULL";const s=L(r);switch(typeof e){case"string":switch(s){case"timestamp-offset":case"esriFieldTypeTimestampOffset":return y(w(e),"TIMESTAMP");case"string":case"esriFieldTypeString":case void 0:return y(e,"TIMESTAMP");default:throw new Error(`Cannot convert ${s} to sql timestamp offset literal.`)}case"number":switch(s){case"date":case"esriFieldTypeDate":case void 0:return y($(e,n),"TIMESTAMP");default:throw new Error(`Cannot convert ${s} to sql timestamp offset literal.`)}case"object":if(t(e))return y($(e.valueOf(),n),"TIMESTAMP")}throw new Error("Cannot convert value to sql timestamp offset literal.")}function A(t,r){return null==t?r:null==r||e(t)||e(r)?t:r}function U(e,r,n){if(null==e)return"NULL";if(null==r&&null==n){switch(typeof e){case"string":return S(e);case"number":return D(e);case"boolean":return O(e);case"object":if(t(e))return N(e)}throw new Error("Cannot convert value to sql literal.")}const s=A(r?.timeZone,n?.timeZone),i=L(r?.type);switch(L(n?.type)??i){case"small-integer":case"esriFieldTypeSmallInteger":case"integer":case"esriFieldTypeInteger":case"single":case"esriFieldTypeSingle":case"double":case"esriFieldTypeDouble":case"big-integer":case"esriFieldTypeBigInteger":case"long":case"esriFieldTypeLong":case"oid":case"esriFieldTypeOID":return D(e,i);case"global-id":case"esriFieldTypeGlobalID":case"guid":case"esriFieldTypeGUID":case"xml":case"esriFieldTypeXML":case"string":case"esriFieldTypeString":return S(e,i,s);case"date":case"esriFieldTypeDate":return N(e,i,s);case"timestamp-offset":case"esriFieldTypeTimestampOffset":return q(e,i,s);case"date-only":case"esriFieldTypeDateOnly":return M(e,i,s);case"time-only":case"esriFieldTypeTimeOnly":return C(e,i,s);default:throw new Error("Unsupported sql target type: "+i)}}function j(e){return/^[a-zA-Z_][a-zA-Z_0-9]*$/.test(e)?e:`"${e.replaceAll('"','""')}"`}export{l as cleanupWhereClauseCache,c as parseWhereClause,o as sqlAnd,u as sqlBetween,O as sqlBooleanLiteral,M as sqlDateLiteral,p as sqlIn,U as sqlLiteral,j as sqlName,f as sqlNotBetween,T as sqlNotIn,D as sqlNumericLiteral,d as sqlOr,S as sqlStringLiteral,C as sqlTimeLiteral,N as sqlTimestampLiteral,q as sqlTimestampOffsetLiteral};
|
package/kernel.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.1";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.1.0-next.
|
|
2
|
+
import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.1";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.1.0-next.13",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
|
package/layers/ImageryLayer.d.ts
CHANGED
|
@@ -79,7 +79,7 @@ export interface ImageryLayerEvents extends RefreshableLayerEvents, LayerEvents
|
|
|
79
79
|
* >
|
|
80
80
|
* > Esri requires that when you use an ArcGIS Online basemap in your app, the map must include Esri attribution and you must be licensed to use the content.
|
|
81
81
|
* > For detailed guidelines on working with attribution, please visit the official [attribution in your app](https://developers.arcgis.com/terms/attribution/) documentation.
|
|
82
|
-
* > For information
|
|
82
|
+
* > For information, see the [Terms of Use documentation](https://developers.arcgis.com/documentation/terms-of-use/).
|
|
83
83
|
*
|
|
84
84
|
* <span id="rendering"></span>
|
|
85
85
|
* ### ImageryLayer rendering
|
|
@@ -264,7 +264,7 @@ export interface MapImageLayerEvents extends RefreshableLayerEvents, LayerEvents
|
|
|
264
264
|
* >
|
|
265
265
|
* > Esri requires that when you use an ArcGIS Online basemap in your app, the map must include Esri attribution and you must be licensed to use the content.
|
|
266
266
|
* > For detailed guidelines on working with attribution, please visit the official [attribution in your app](https://developers.arcgis.com/terms/attribution/) documentation.
|
|
267
|
-
* > For information
|
|
267
|
+
* > For information, see the [Terms of Use documentation](https://developers.arcgis.com/documentation/terms-of-use/).
|
|
268
268
|
*
|
|
269
269
|
* @since 4.0
|
|
270
270
|
* @see [Sublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Sublayer/)
|
package/layers/TileLayer.d.ts
CHANGED
|
@@ -81,7 +81,7 @@ export interface TileLayerEvents extends MapImageLayerEvents {}
|
|
|
81
81
|
* >
|
|
82
82
|
* > Esri requires that when you use an ArcGIS Online basemap in your app, the map must include Esri attribution and you must be licensed to use the content.
|
|
83
83
|
* > For detailed guidelines on working with attribution, please visit the official [attribution in your app](https://developers.arcgis.com/terms/attribution/) documentation.
|
|
84
|
-
* > For information
|
|
84
|
+
* > For information, see the [Terms of Use documentation](https://developers.arcgis.com/documentation/terms-of-use/).
|
|
85
85
|
*
|
|
86
86
|
* @since 4.0
|
|
87
87
|
* @see [MapImageLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MapImageLayer/)
|
package/layers/WebTileLayer.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ export interface WebTileLayerProperties extends LayerProperties, PortalLayerProp
|
|
|
42
42
|
* >
|
|
43
43
|
* > Esri requires that when you use an ArcGIS Online basemap in your app, the map must include Esri attribution and you must be licensed to use the content.
|
|
44
44
|
* > For detailed guidelines on working with attribution, please visit the official [attribution in your app](https://developers.arcgis.com/documentation/mapping-and-location-services/reference/basemap-attribution/) documentation.
|
|
45
|
-
* > For information
|
|
45
|
+
* > For information, see the [Terms of Use documentation](https://developers.arcgis.com/documentation/terms-of-use/).
|
|
46
46
|
*
|
|
47
47
|
* @since 4.0
|
|
48
48
|
* @see [Sample - WebTileLayer (3D)](https://developers.arcgis.com/javascript/latest/sample-code/layers-webtile-3d/)
|