@arcgis/core 4.32.0-next.20250220 → 4.32.0-next.20250221

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.
Files changed (110) hide show
  1. package/arcade/featureSetUtils.js +1 -1
  2. package/arcade/functions/featuresetbase.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/37323e58dbec303f5054.js +1 -0
  5. package/assets/esri/core/workers/chunks/{7b07410fe98015b80c74.js → 5341b86c2fb5347393c5.js} +1 -1
  6. package/assets/esri/core/workers/chunks/60d5cbfa9e1c6b3c98df.js +1 -0
  7. package/assets/esri/core/workers/chunks/{a5acbdb8347a809a26c0.js → 610c3249fe81e370af8c.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{d98c78e89d70ad0b8628.js → 6ab476f696290d190c6c.js} +1 -1
  9. package/assets/esri/core/workers/chunks/7292bb19b73f601d891b.js +1 -0
  10. package/assets/esri/core/workers/chunks/78c066e8fe167d4ab817.js +1 -0
  11. package/assets/esri/core/workers/chunks/80744ad7f7656ef918db.js +1 -0
  12. package/assets/esri/core/workers/chunks/8bbe8df40df2b8e54562.js +1 -0
  13. package/assets/esri/core/workers/chunks/caf410ed75c40b3703eb.js +1 -0
  14. package/assets/esri/core/workers/chunks/df506c4f81affce248c4.js +1 -0
  15. package/assets/esri/core/workers/chunks/{4be39bc2d2edd94bdb75.js → e481e7d508274bc83c70.js} +1 -1
  16. package/assets/esri/core/workers/chunks/eefa1dfeb63ce965bb40.js +1 -0
  17. package/assets/esri/core/workers/chunks/fd8790291348fb7ead55.js +1 -0
  18. package/assets/esri/themes/base/widgets/_ItemList.scss +14 -0
  19. package/assets/esri/themes/dark/main.css +1 -1
  20. package/assets/esri/themes/light/main.css +1 -1
  21. package/assets/esri/themes/light/view.css +1 -1
  22. package/core/sql/AggregateFunctions.js +1 -1
  23. package/core/sql/DateOnly.js +1 -1
  24. package/core/sql/SqlInterval.js +1 -1
  25. package/core/sql/SqlTimestampOffset.js +1 -1
  26. package/core/sql/TimeOnly.js +1 -1
  27. package/core/sql/WhereClause.js +1 -1
  28. package/core/sql/WhereGrammar.js +1 -1
  29. package/core/sql/sqlCompareUtils.js +1 -1
  30. package/core/sql/sqlDateParsingUtils.js +1 -1
  31. package/editing/sharedTemplates/SharedTemplate.js +1 -1
  32. package/editing/sharedTemplates/SharedTemplateMetadata.js +1 -1
  33. package/editing/sharedTemplates/SharedTemplateProvider.js +1 -1
  34. package/editing/sharedTemplates/executor/support/createServiceEdit.js +1 -1
  35. package/editing/sharedTemplates/support/sharedTemplateErrors.js +1 -1
  36. package/editing/sharedTemplates/templateDefinitions/FeatureTemplateDefinition.js +1 -1
  37. package/editing/sharedTemplates/templateDefinitions/GroupTemplateDefinition.js +1 -1
  38. package/editing/sharedTemplates/templateDefinitions/PresetTemplateDefinition.js +1 -1
  39. package/editing/sharedTemplates/templateDefinitions/TemplateDefinitionBase.js +1 -1
  40. package/editing/sharedTemplates/templateDefinitions/parts/FeatureTemplateRelationshipPart.js +1 -1
  41. package/editing/sharedTemplates/templateDefinitions/parts/GroupTemplatePart.js +1 -1
  42. package/editing/sharedTemplates/templateDefinitions/parts/TemplatePartBase.js +1 -1
  43. package/interfaces.d.ts +448 -63
  44. package/layers/RouteLayer.js +1 -1
  45. package/layers/orientedImagery/core/coverageUtils.js +1 -1
  46. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  47. package/layers/orientedImagery/transformations/rectifyMapPoint.js +1 -1
  48. package/layers/orientedImagery/transformations/utils.js +1 -1
  49. package/layers/orientedImagery/transformations/worldToImage.js +1 -1
  50. package/layers/support/Relationship.js +1 -1
  51. package/networks/RulesTable.js +1 -1
  52. package/package.json +1 -1
  53. package/rest/support/PointBarrier.js +1 -1
  54. package/support/revision.js +1 -1
  55. package/symbols/cim/fitVectorMarker.js +1 -1
  56. package/undoredo/support/Services.js +1 -1
  57. package/views/2d/AnimationManager.js +1 -1
  58. package/views/2d/layers/RouteLayerView2D.js +1 -1
  59. package/views/2d/layers/features/sources/FeatureCache.js +1 -1
  60. package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
  61. package/views/2d/layers/features/sources/strategies/support/snapshotUtils.js +5 -0
  62. package/views/2d/layers/features/support/whereUtils.js +1 -1
  63. package/views/View.js +1 -1
  64. package/views/animation/easing.js +1 -1
  65. package/widgets/Directions.js +1 -1
  66. package/widgets/Editor/AddAssociationWorkflow.js +1 -1
  67. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  68. package/widgets/Editor/CreateFeaturesWorkflowData.js +1 -1
  69. package/widgets/Editor/Edits.js +1 -1
  70. package/widgets/Editor/UpdateWorkflow.js +1 -1
  71. package/widgets/Editor/components/PendingFeatureList.js +1 -1
  72. package/widgets/Editor/workflowUtils.js +1 -1
  73. package/widgets/Editor.js +1 -1
  74. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/AssociationDetails.js +1 -1
  75. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
  76. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  77. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js +1 -1
  78. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/VisibleElements.js +5 -0
  79. package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
  80. package/widgets/FeatureForm/UtilityNetworkAssociationInput.js +1 -1
  81. package/widgets/FeatureForm/VisibleElements.js +5 -0
  82. package/widgets/FeatureForm/featureFormUtils.js +1 -1
  83. package/widgets/FeatureForm.js +1 -1
  84. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  85. package/widgets/OrientedImageryViewer/adapters/sketch/DataCaptureAdapter.js +5 -0
  86. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  87. package/widgets/OrientedImageryViewer/components/ImageOverlays.js +1 -1
  88. package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
  89. package/widgets/OrientedImageryViewer/components/OverlayLayersListViewModel.js +1 -1
  90. package/widgets/OrientedImageryViewer/constants.js +1 -1
  91. package/widgets/OrientedImageryViewer/dataCaptureUtils.js +5 -0
  92. package/widgets/OrientedImageryViewer/symbols.js +1 -1
  93. package/widgets/OrientedImageryViewer.js +1 -1
  94. package/widgets/support/FilterCondition.js +1 -1
  95. package/widgets/support/GoTo.js +1 -1
  96. package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +1 -1
  97. package/widgets/support/goToUtils.js +1 -1
  98. package/widgets/support/symbolPreviewUtils.js +1 -1
  99. package/assets/esri/core/workers/chunks/10ca2107c99fab6bcc3b.js +0 -1
  100. package/assets/esri/core/workers/chunks/122ed10cac9f192e1eec.js +0 -1
  101. package/assets/esri/core/workers/chunks/1b3a52ce3e8e5be4d196.js +0 -1
  102. package/assets/esri/core/workers/chunks/35e4af82a08b4eadbfab.js +0 -1
  103. package/assets/esri/core/workers/chunks/6f007703662e714b2f0a.js +0 -1
  104. package/assets/esri/core/workers/chunks/8232a2c4bdc3011bb9e3.js +0 -1
  105. package/assets/esri/core/workers/chunks/8b8579d81728cb35bb29.js +0 -1
  106. package/assets/esri/core/workers/chunks/934857de20f6f5c15188.js +0 -1
  107. package/assets/esri/core/workers/chunks/b8fae500c69ca2cff62a.js +0 -1
  108. package/assets/esri/core/workers/chunks/ebe832bd57a316364ca1.js +0 -1
  109. package/widgets/OrientedImageryViewer/adapters/sketch/DigitizationAdapter.js +0 -5
  110. package/widgets/OrientedImageryViewer/digitizationUtils.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{DateOnly as n}from"./DateOnly.js";import{SqlError as l,SqlErrorCodes as t}from"./errorSupport.js";import{SqlTimeStampOffset as a}from"./SqlTimestampOffset.js";import{TimeOnly as r}from"./TimeOnly.js";import{DateTime as e}from"luxon";function u(n,a){const r=m[n.toLowerCase()];if(null==r)throw new l(t.FunctionNotRecognized);if(a.length<r.minParams||a.length>r.maxParams)throw new l(t.InvalidParameterCount,{name:n.toUpperCase()});return r.evaluate(a)}function o(n,l){const t=m[n.toLowerCase()];return null!=t&&l>=t.minParams&&l<=t.maxParams}const m={min:{minParams:1,maxParams:1,evaluate:n=>f(n[0],"min")},max:{minParams:1,maxParams:1,evaluate:n=>f(n[0],"max")},avg:{minParams:1,maxParams:1,evaluate:n=>i(n[0])},sum:{minParams:1,maxParams:1,evaluate:n=>c(n[0])},stddev:{minParams:1,maxParams:1,evaluate:n=>g(n[0])},count:{minParams:1,maxParams:1,evaluate:n=>null==n[0]?null:n[0].length},var:{minParams:1,maxParams:1,evaluate:n=>P(n[0])}};function i(n){if(null===n)return null;let a=0,r=0;for(let e=0;e<n.length;e++){const u=n[e];if(null!==u){if(!s(u))throw new l(t.InvalidValueForAggregateFunction);r++,a+=u}}return 0===r?null:a/n.length}function s(n){return"number"==typeof n}function f(l,t){if(null===l)return null;let u=null,o=null;for(const m of l){let l=m;l=m instanceof n||m instanceof r?m.toNumber():m instanceof e?m.toMillis():m instanceof a?m.toMilliseconds():m,(null===u||"max"===t&&null!==o&&null!==l&&o<=l||"min"===t&&null!==o&&null!==l&&o>=l)&&(u=m,o=l)}return u}function c(n){if(null===n)return null;let a=0;for(let r=0;r<n.length;r++){const e=n[r];if(null!==e){if(!s(e))throw new l(t.InvalidValueForAggregateFunction);a+=e}}return a}function g(n){if(null===n)return null;const l=P(n);return null===l?null:Math.sqrt(l)}function P(n){if(null===n)return null;if(0===(n=n.filter((n=>null!==n))).length)return null;const a=i(n);if(null===a)return null;let r=0;for(const e of n){if(!s(e))throw new l(t.InvalidValueForAggregateFunction);r+=(a-e)**2}return r/(n.length-1)}export{u as aggregateFunction,o as isAggregate};
5
+ import{DateOnly as n}from"./DateOnly.js";import{SqlError as l,SqlErrorCodes as t}from"./errorSupport.js";import{SqlTimeStampOffset as e}from"./SqlTimestampOffset.js";import{TimeOnly as a}from"./TimeOnly.js";import{DateTime as r}from"luxon";function u(n,e){const a=o[n.toLowerCase()];if(null==a)throw new l(t.FunctionNotRecognized);if(e.length<a.minParams||e.length>a.maxParams)throw new l(t.InvalidParameterCount,{name:n.toUpperCase()});return a.evaluate(e)}function m(n,l){const t=o[n.toLowerCase()];return null!=t&&l>=t.minParams&&l<=t.maxParams}const o={min:{minParams:1,maxParams:1,evaluate:n=>f(n[0],"min")},max:{minParams:1,maxParams:1,evaluate:n=>f(n[0],"max")},avg:{minParams:1,maxParams:1,evaluate:n=>i(n[0])},sum:{minParams:1,maxParams:1,evaluate:n=>c(n[0])},stddev:{minParams:1,maxParams:1,evaluate:n=>g(n[0])},count:{minParams:1,maxParams:1,evaluate:n=>null==n[0]?null:n[0].length},var:{minParams:1,maxParams:1,evaluate:n=>P(n[0])}};function i(n){if(null===n)return null;let e=0,a=0;for(let r=0;r<n.length;r++){const u=n[r];if(null!==u){if(!s(u))throw new l(t.InvalidValueForAggregateFunction);a++,e+=u}}return 0===a?null:e/n.length}function s(n){return"number"==typeof n}function f(l,t){if(null===l)return null;let u=null,m=null;for(const o of l){let l=o;l=n.isDateOnly(o)||a.isTimeOnly(o)?o.toNumber():r.isDateTime(o)?o.toMillis():e.isTimestampOffset(o)?o.toMilliseconds():o,(null===u||"max"===t&&null!==m&&null!==l&&m<=l||"min"===t&&null!==m&&null!==l&&m>=l)&&(u=o,m=l)}return u}function c(n){if(null===n)return null;let e=0;for(let a=0;a<n.length;a++){const r=n[a];if(null!==r){if(!s(r))throw new l(t.InvalidValueForAggregateFunction);e+=r}}return e}function g(n){if(null===n)return null;const l=P(n);return null===l?null:Math.sqrt(l)}function P(n){if(null===n)return null;if(0===(n=n.filter((n=>null!==n))).length)return null;const e=i(n);if(null===e)return null;let a=0;for(const r of n){if(!s(r))throw new l(t.InvalidValueForAggregateFunction);a+=(e-r)**2}return a/(n.length-1)}export{u as aggregateFunction,m as isAggregate};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{createDateTimeZone as t,ArcadeDate as e}from"../../arcade/ArcadeDate.js";import{getLocale as a}from"../../intl/locale.js";import{DateTime as r,FixedOffsetZone as s}from"luxon";function o(t){t=t.replaceAll(/LTS|LT|L{1,4}|l{1,4}/g,"[$&]");let e="";const a=/(\[[^[]*\])|(\\)?([Hh]mm(ss)?|Mo|M{1,4}|Do|DDDo|D{1,4}|d{2,4}|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;for(const r of t.match(a)||[])switch(r){case"D":e+="d";break;case"DD":e+="dd";break;case"DDD":e+="o";break;case"d":e+="c";break;case"ddd":e+="ccc";break;case"dddd":e+="cccc";break;case"M":e+="L";break;case"MM":e+="LL";break;case"MMM":e+="LLL";break;case"MMMM":e+="LLLL";break;case"YY":e+="yy";break;case"Y":case"YYYY":e+="yyyy";break;case"Q":e+="q";break;case"X":case"x":e+=r;break;default:r.length>=2&&"["===r.slice(0,1)&&"]"===r.slice(-1)?e+=`'${r.slice(1,-1)}'`:e+=`'${r}'`}return e}class n{constructor(t,e,a){this._year=t,this._month=e,this._day=a,this.declaredRootClass="esri.core.sql.dateonly"}get month(){return this._month}get monthJS(){return this._month-1}get year(){return this._year}get day(){return this._day}get isValid(){return this.toDateTime("unknown").isValid}equals(t){return t instanceof n&&t.day===this.day&&t.month===this.month&&t.year===this.year}clone(){return new n(this._year,this._month,this._day)}toDateTime(e){return r.fromObject({day:this.day,month:this.month,year:this.year},{zone:t(e)})}toDateTimeLuxon(e){return r.fromObject({day:this.day,month:this.month,year:this.year},{zone:t(e)})}toString(){return`${this.year.toString().padStart(4,"0")}-${this.month.toString().padStart(2,"0")}-${this.day.toString().padStart(2,"0")}`}toFormat(t=null,r=!0){if(null===t||""===t)return this.toString();if(r&&(t=o(t)),!t)return"";const s=this.toDateTime("unknown");return e.dateTimeToArcadeDate(s).toFormat(t,{locale:a(),numberingSystem:"latn"})}toArcadeDate(){const t=this.toDateTime("unknown");return e.dateTimeToArcadeDate(t)}toNumber(){return this.toDateTime("unknown").toMillis()}toJSDate(){return this.toDateTime("unknown").toJSDate()}toStorageFormat(){return this.toFormat("yyyy-LL-dd",!1)}toSQLValue(){return this.toFormat("yyyy-LL-dd",!1)}toSQLWithKeyword(){return"date '"+this.toFormat("yyyy-LL-dd",!1)+"'"}plus(t,e){return n.fromDateTime(this.toUTCDateTime().plus({[t]:e}))}toUTCDateTime(){return r.utc(this.year,this.month,this.day,0,0,0,0)}difference(t,e){switch(e.toLowerCase()){case"days":case"day":case"d":return this.toUTCDateTime().diff(t.toUTCDateTime(),"days").days;case"months":case"month":return this.toUTCDateTime().diff(t.toUTCDateTime(),"months").months;case"minutes":case"minute":case"m":return"M"===e?this.toUTCDateTime().diff(t.toUTCDateTime(),"months").months:this.toUTCDateTime().diff(t.toUTCDateTime(),"minutes").minutes;case"seconds":case"second":case"s":return this.toUTCDateTime().diff(t.toUTCDateTime(),"seconds").seconds;case"milliseconds":case"millisecond":case"ms":default:return this.toUTCDateTime().diff(t.toUTCDateTime(),"milliseconds").milliseconds;case"hours":case"hour":case"h":return this.toUTCDateTime().diff(t.toUTCDateTime(),"hours").hours;case"years":case"year":case"y":return this.toUTCDateTime().diff(t.toUTCDateTime(),"years").years}}static fromMilliseconds(t){const e=r.fromMillis(t,{zone:s.utcInstance});return e.isValid?n.fromParts(e.year,e.month,e.day):null}static fromSeconds(t){const e=r.fromSeconds(t,{zone:s.utcInstance});return e.isValid?n.fromParts(e.year,e.month,e.day):null}static fromReader(t){if(!t)return null;const e=t.split("-");return 3!==e.length?null:new n(parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10))}static fromParts(t,e,a){const r=new n(t,e,a);return!1===r.isValid?null:r}static fromDateJS(t){return n.fromParts(t.getFullYear(),t.getMonth()+1,t.getDay())}static fromDateTime(t){return n.fromParts(t.year,t.month,t.day)}static fromSqlTimeStampOffset(t){return this.fromDateTime(t.toDateTime())}static fromString(t,e=null){if(""===t)return null;if(null===t)return null;const a=[];if(e)(e=o(e))&&a.push(e);else if(null===e||""===e){const e=r.fromISO(t,{setZone:!0});return e.isValid?n.fromParts(e.year,e.month,e.day):null}for(const s of a){const a=r.fromFormat(t,e??s);if(a.isValid)return new n(a.year,a.month,a.day)}return null}static fromNow(e="system"){const a=r.fromJSDate(new Date).setZone(t(e));return new n(a.year,a.month,a.day)}}export{n as DateOnly,o as standardizeDateOnlyFormat};
5
+ import{createDateTimeZone as t,ArcadeDate as e}from"../../arcade/ArcadeDate.js";import{getLocale as a}from"../../intl/locale.js";import{DateTime as r,FixedOffsetZone as s}from"luxon";function o(t){t=t.replaceAll(/LTS|LT|L{1,4}|l{1,4}/g,"[$&]");let e="";const a=/(\[[^[]*\])|(\\)?([Hh]mm(ss)?|Mo|M{1,4}|Do|DDDo|D{1,4}|d{2,4}|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;for(const r of t.match(a)||[])switch(r){case"D":e+="d";break;case"DD":e+="dd";break;case"DDD":e+="o";break;case"d":e+="c";break;case"ddd":e+="ccc";break;case"dddd":e+="cccc";break;case"M":e+="L";break;case"MM":e+="LL";break;case"MMM":e+="LLL";break;case"MMMM":e+="LLLL";break;case"YY":e+="yy";break;case"Y":case"YYYY":e+="yyyy";break;case"Q":e+="q";break;case"X":case"x":e+=r;break;default:r.length>=2&&"["===r.slice(0,1)&&"]"===r.slice(-1)?e+=`'${r.slice(1,-1)}'`:e+=`'${r}'`}return e}const n="esri.core.sql.dateonly";class i{constructor(t,e,a){this._year=t,this._month=e,this._day=a,this.declaredRootClass=n}static isDateOnly(t){return"object"==typeof t&&null!=t&&"declaredRootClass"in t&&t.declaredRootClass===n}get month(){return this._month}get monthJS(){return this._month-1}get year(){return this._year}get day(){return this._day}get isValid(){return this.toDateTime("unknown").isValid}equals(t){return i.isDateOnly(t)&&t.day===this.day&&t.month===this.month&&t.year===this.year}clone(){return new i(this._year,this._month,this._day)}toDateTime(e){return r.fromObject({day:this.day,month:this.month,year:this.year},{zone:t(e)})}toDateTimeLuxon(e){return r.fromObject({day:this.day,month:this.month,year:this.year},{zone:t(e)})}toString(){return`${this.year.toString().padStart(4,"0")}-${this.month.toString().padStart(2,"0")}-${this.day.toString().padStart(2,"0")}`}toFormat(t=null,r=!0){if(null===t||""===t)return this.toString();if(r&&(t=o(t)),!t)return"";const s=this.toDateTime("unknown");return e.dateTimeToArcadeDate(s).toFormat(t,{locale:a(),numberingSystem:"latn"})}toArcadeDate(){const t=this.toDateTime("unknown");return e.dateTimeToArcadeDate(t)}toNumber(){return this.toDateTime("unknown").toMillis()}toJSDate(){return this.toDateTime("unknown").toJSDate()}toStorageFormat(){return this.toFormat("yyyy-LL-dd",!1)}toSQLValue(){return this.toFormat("yyyy-LL-dd",!1)}toSQLWithKeyword(){return"date '"+this.toFormat("yyyy-LL-dd",!1)+"'"}plus(t,e){return i.fromDateTime(this.toUTCDateTime().plus({[t]:e}))}toUTCDateTime(){return r.utc(this.year,this.month,this.day,0,0,0,0)}difference(t,e){switch(e.toLowerCase()){case"days":case"day":case"d":return this.toUTCDateTime().diff(t.toUTCDateTime(),"days").days;case"months":case"month":return this.toUTCDateTime().diff(t.toUTCDateTime(),"months").months;case"minutes":case"minute":case"m":return"M"===e?this.toUTCDateTime().diff(t.toUTCDateTime(),"months").months:this.toUTCDateTime().diff(t.toUTCDateTime(),"minutes").minutes;case"seconds":case"second":case"s":return this.toUTCDateTime().diff(t.toUTCDateTime(),"seconds").seconds;case"milliseconds":case"millisecond":case"ms":default:return this.toUTCDateTime().diff(t.toUTCDateTime(),"milliseconds").milliseconds;case"hours":case"hour":case"h":return this.toUTCDateTime().diff(t.toUTCDateTime(),"hours").hours;case"years":case"year":case"y":return this.toUTCDateTime().diff(t.toUTCDateTime(),"years").years}}static fromMilliseconds(t){const e=r.fromMillis(t,{zone:s.utcInstance});return e.isValid?i.fromParts(e.year,e.month,e.day):null}static fromSeconds(t){const e=r.fromSeconds(t,{zone:s.utcInstance});return e.isValid?i.fromParts(e.year,e.month,e.day):null}static fromReader(t){if(!t)return null;const e=t.split("-");return 3!==e.length?null:new i(parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10))}static fromParts(t,e,a){const r=new i(t,e,a);return!1===r.isValid?null:r}static fromDateJS(t){return i.fromParts(t.getFullYear(),t.getMonth()+1,t.getDay())}static fromDateTime(t){return i.fromParts(t.year,t.month,t.day)}static fromSqlTimeStampOffset(t){return this.fromDateTime(t.toDateTime())}static fromString(t,e=null){if(""===t)return null;if(null===t)return null;const a=[];if(e)(e=o(e))&&a.push(e);else if(null===e||""===e){const e=r.fromISO(t,{setZone:!0});return e.isValid?i.fromParts(e.year,e.month,e.day):null}for(const s of a){const a=r.fromFormat(t,e??s);if(a.isValid)return new i(a.year,a.month,a.day)}return null}static fromNow(e="system"){const a=r.fromJSDate(new Date).setZone(t(e));return new i(a.year,a.month,a.day)}}export{i as DateOnly,o as standardizeDateOnlyFormat};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{SqlError as e,SqlErrorCodes as t}from"./errorSupport.js";class s{constructor(){this.op="+",this.day=0,this.second=0,this.hour=0,this.month=0,this.year=0,this.minute=0,this.millis=0}static _fixDefaults(s){if(null!==s.precision||null!==s.secondary)throw new e(t.PrimarySecondaryQualifiers)}static _parseSecondsComponent(e,t){if(t.includes(".")){const s=t.split(".");e.second=parseFloat(s[0]),e.millis=parseInt(s[1],10)}else e.second=parseFloat(t)}static createFromMilliseconds(e){const t=new s;return t.second=e/1e3,t}static createFromValueAndQualifier(r,a,l){let o=null;const n=new s;if(n.op="-"===l?"-":"+","interval-period"===a.type){s._fixDefaults(a);const l=new RegExp("^[0-9]{1,}$");if("year"===a.period||"month"===a.period)throw new e(t.YearMonthIntervals);if("second"===a.period){if(!/^[0-9]{1,}([.]{1}[0-9]{1,}){0,1}$/.test(r))throw new e(t.IllegalInterval);s._parseSecondsComponent(n,r)}else{if(!l.test(r))throw new e(t.IllegalInterval);n[a.period]=parseFloat(r)}}else{if(s._fixDefaults(a.start),s._fixDefaults(a.end),"year"===a.start.period||"month"===a.start.period||"year"===a.end.period||"month"===a.end.period)throw new e(t.YearMonthIntervals);switch(a.start.period){case"day":switch(a.end.period){case"hour":if(o=new RegExp("^[0-9]{1,} [0-9]{1,}$"),!o.test(r))throw new e(t.IllegalInterval);n[a.start.period]=parseFloat(r.split(" ")[0]),n[a.end.period]=parseFloat(r.split(" ")[1]);break;case"minute":if(o=new RegExp("^[0-9]{1,} [0-9]{1,2}:[0-9]{1,}$"),!o.test(r))throw new e(t.IllegalInterval);{n[a.start.period]=parseFloat(r.split(" ")[0]);const e=r.split(" ")[1].split(":");n.hour=parseFloat(e[0]),n.minute=parseFloat(e[1])}break;case"second":if(o=new RegExp("^[0-9]{1,} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,}([.]{1}[0-9]{1,}){0,1}$"),!o.test(r))throw new e(t.IllegalInterval);{n[a.start.period]=parseFloat(r.split(" ")[0]);const e=r.split(" ")[1].split(":");n.hour=parseFloat(e[0]),n.minute=parseFloat(e[1]),s._parseSecondsComponent(n,e[2])}break;default:throw new e(t.IllegalInterval)}break;case"hour":switch(a.end.period){case"minute":if(o=new RegExp("^[0-9]{1,}:[0-9]{1,}$"),!o.test(r))throw new e(t.IllegalInterval);n.hour=parseFloat(r.split(":")[0]),n.minute=parseFloat(r.split(":")[1]);break;case"second":if(o=new RegExp("^[0-9]{1,}:[0-9]{1,2}:[0-9]{1,}([.]{1}[0-9]{1,}){0,1}$"),!o.test(r))throw new e(t.IllegalInterval);{const e=r.split(":");n.hour=parseFloat(e[0]),n.minute=parseFloat(e[1]),s._parseSecondsComponent(n,e[2])}break;default:throw new e(t.IllegalInterval)}break;case"minute":if("second"!==a.end.period)throw new e(t.IllegalInterval);if(o=new RegExp("^[0-9]{1,}:[0-9]{1,}([.]{1}[0-9]{1,}){0,1}$"),!o.test(r))throw new e(t.IllegalInterval);{const e=r.split(":");n.minute=parseFloat(e[0]),s._parseSecondsComponent(n,e[1])}break;default:throw new e(t.IllegalInterval)}}return n}valueInMilliseconds(){return("-"===this.op?-1:1)*(this.millis+1e3*this.second+60*this.minute*1e3+60*this.hour*60*1e3+24*this.day*60*60*1e3+this.month*(365/12)*24*60*60*1e3+365*this.year*24*60*60*1e3)}}export{s as SqlInterval};
5
+ import{SqlError as e,SqlErrorCodes as t}from"./errorSupport.js";function r(r){if(null!==r.precision||null!==r.secondary)throw new e(t.PrimarySecondaryQualifiers)}function s(e,t){if(t.includes(".")){const r=t.split(".");e.second=parseFloat(r[0]),e.millis=parseInt(r[1],10)}else e.second=parseFloat(t)}const l="esri.core.sql.SqlInterval";class a{constructor(){this.declaredRootClass=l,this.op="+",this.day=0,this.second=0,this.hour=0,this.month=0,this.year=0,this.minute=0,this.millis=0}static isInterval(e){return"object"==typeof e&&null!=e&&"declaredRootClass"in e&&e.declaredRootClass===l}static createFromMilliseconds(e){const t=new a;return t.second=e/1e3,t}static createFromValueAndQualifier(l,o,n){let i=null;const p=new a;if(p.op="-"===n?"-":"+","interval-period"===o.type){r(o);const a=new RegExp("^[0-9]{1,}$");if("year"===o.period||"month"===o.period)throw new e(t.YearMonthIntervals);if("second"===o.period){if(!/^[0-9]{1,}([.]{1}[0-9]{1,}){0,1}$/.test(l))throw new e(t.IllegalInterval);s(p,l)}else{if(!a.test(l))throw new e(t.IllegalInterval);p[o.period]=parseFloat(l)}}else{if(r(o.start),r(o.end),"year"===o.start.period||"month"===o.start.period||"year"===o.end.period||"month"===o.end.period)throw new e(t.YearMonthIntervals);switch(o.start.period){case"day":switch(o.end.period){case"hour":if(i=new RegExp("^[0-9]{1,} [0-9]{1,}$"),!i.test(l))throw new e(t.IllegalInterval);p[o.start.period]=parseFloat(l.split(" ")[0]),p[o.end.period]=parseFloat(l.split(" ")[1]);break;case"minute":if(i=new RegExp("^[0-9]{1,} [0-9]{1,2}:[0-9]{1,}$"),!i.test(l))throw new e(t.IllegalInterval);{p[o.start.period]=parseFloat(l.split(" ")[0]);const e=l.split(" ")[1].split(":");p.hour=parseFloat(e[0]),p.minute=parseFloat(e[1])}break;case"second":if(i=new RegExp("^[0-9]{1,} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,}([.]{1}[0-9]{1,}){0,1}$"),!i.test(l))throw new e(t.IllegalInterval);{p[o.start.period]=parseFloat(l.split(" ")[0]);const e=l.split(" ")[1].split(":");p.hour=parseFloat(e[0]),p.minute=parseFloat(e[1]),s(p,e[2])}break;default:throw new e(t.IllegalInterval)}break;case"hour":switch(o.end.period){case"minute":if(i=new RegExp("^[0-9]{1,}:[0-9]{1,}$"),!i.test(l))throw new e(t.IllegalInterval);p.hour=parseFloat(l.split(":")[0]),p.minute=parseFloat(l.split(":")[1]);break;case"second":if(i=new RegExp("^[0-9]{1,}:[0-9]{1,2}:[0-9]{1,}([.]{1}[0-9]{1,}){0,1}$"),!i.test(l))throw new e(t.IllegalInterval);{const e=l.split(":");p.hour=parseFloat(e[0]),p.minute=parseFloat(e[1]),s(p,e[2])}break;default:throw new e(t.IllegalInterval)}break;case"minute":if("second"!==o.end.period)throw new e(t.IllegalInterval);if(i=new RegExp("^[0-9]{1,}:[0-9]{1,}([.]{1}[0-9]{1,}){0,1}$"),!i.test(l))throw new e(t.IllegalInterval);{const e=l.split(":");p.minute=parseFloat(e[0]),s(p,e[1])}break;default:throw new e(t.IllegalInterval)}}return p}valueInMilliseconds(){return("-"===this.op?-1:1)*(this.millis+1e3*this.second+60*this.minute*1e3+60*this.hour*60*1e3+24*this.day*60*60*1e3+this.month*(365/12)*24*60*60*1e3+365*this.year*24*60*60*1e3)}}export{a as SqlInterval};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{DateTime as t}from"luxon";function e(t){return Number.isNaN(t)||0===t?t:Math.trunc(t)}class r{constructor(t){this._timeStampOffset=t,this._date=null}toDateTime(){return this._date??=t.fromISO(this._timeStampOffset,{setZone:!0}),this._date}get isValid(){return this.toDateTime().isValid}get timezoneOffsetHour(){return e(this.toDateTime().offset/60)}get timezoneOffsetMinutes(){return e(this.toDateTime().offset%60)}toMilliseconds(){return this.toDateTime().toMillis()}get hour(){return this.toDateTime().hour}get minute(){return this.toDateTime().minute}get second(){return this.toDateTime().second}get day(){return this.toDateTime().day}get month(){return this.toDateTime().month}get year(){return this.toDateTime().year}startOfDay(){return r.fromDateTime(this.toDateTime().startOf("day"))}static fromJSDate(e){return new r(t.fromJSDate(e).toISO({includeOffset:!0}))}static fromDateTime(t){return new r(t.toISO({includeOffset:!0}))}static fromParts(t,e,i=0,a=0,o=0,n=0,s=0,m=!1,u=0,f=0){const S=`${t.toString().padStart(4,"0")}-${e.toString().padStart(2,"0")}-${i.toString().padStart(2,"0")}`;let d="";n<10&&(d="0");let h=`${a.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}:${d+n.toString()}`;0!==s&&(h+="."+s.toString().padStart(3,"0"));const l=`${m?"-":"+"}${u.toString().padStart(2,"0")}:${f.toString().padStart(2,"0")}`;return new r(S+"T"+h+l)}toStorageFormat(){return this._timeStampOffset}toString(){return this._timeStampOffset}toSQLValue(){let t=this.toDateTime().toSQL({includeOffset:!0,includeOffsetSpace:!0});return t&&(t=t.replace(".000","")),t}toSQLWithKeyword(){return`timestamp '${this.toSQLValue()}'`}addMilliseconds(t){const e=this.toDateTime().plus(t);return r.fromDateTime(e)}}export{r as SqlTimeStampOffset};
5
+ import{DateTime as t}from"luxon";function e(t){return Number.isNaN(t)||0===t?t:Math.trunc(t)}const r="esri.core.sql.SqlTimeStampOffset";class i{constructor(t){this._timeStampOffset=t,this.declaredRootClass=r,this._date=null}static isTimestampOffset(t){return"object"==typeof t&&null!=t&&"declaredRootClass"in t&&t.declaredRootClass===r}toDateTime(){return this._date??=t.fromISO(this._timeStampOffset,{setZone:!0}),this._date}get isValid(){return this.toDateTime().isValid}get timezoneOffsetHour(){return e(this.toDateTime().offset/60)}get timezoneOffsetMinutes(){return e(this.toDateTime().offset%60)}toMilliseconds(){return this.toDateTime().toMillis()}get hour(){return this.toDateTime().hour}get minute(){return this.toDateTime().minute}get second(){return this.toDateTime().second}get day(){return this.toDateTime().day}get month(){return this.toDateTime().month}get year(){return this.toDateTime().year}startOfDay(){return i.fromDateTime(this.toDateTime().startOf("day"))}static fromJSDate(e){return new i(t.fromJSDate(e).toISO({includeOffset:!0}))}static fromDateTime(t){return new i(t.toISO({includeOffset:!0}))}static fromParts(t,e,r=0,o=0,a=0,s=0,n=0,m=!1,u=0,f=0){const S=`${t.toString().padStart(4,"0")}-${e.toString().padStart(2,"0")}-${r.toString().padStart(2,"0")}`;let d="";s<10&&(d="0");let l=`${o.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${d+s.toString()}`;0!==n&&(l+="."+n.toString().padStart(3,"0"));const c=`${m?"-":"+"}${u.toString().padStart(2,"0")}:${f.toString().padStart(2,"0")}`;return new i(S+"T"+l+c)}toStorageFormat(){return this._timeStampOffset}toString(){return this._timeStampOffset}toSQLValue(){let t=this.toDateTime().toSQL({includeOffset:!0,includeOffsetSpace:!0});return t&&(t=t.replace(".000","")),t}toSQLWithKeyword(){return`timestamp '${this.toSQLValue()}'`}addMilliseconds(t){const e=this.toDateTime().plus(t);return i.fromDateTime(e)}}export{i as SqlTimeStampOffset};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{isInteger as t}from"../../arcade/kernel.js";import{getLocale as s}from"../../intl/locale.js";import{DateTime as e}from"luxon";function i(t){if(!t)return"";const s=/(a|A|hh?|HH?|mm?|ss?|SSS|S|.)/g;let e="";for(const i of t.match(s)||[])switch(i){case"SSS":case"m":case"mm":case"h":case"hh":case"H":case"HH":case"s":case"ss":e+=i;break;case"A":case"a":e+="a";break;default:e+=`'${i}'`}return e}class n{constructor(t,s,e,i){this._hour=t,this._minute=s,this._second=e,this._millisecond=i,this.declaredRootClass="esri.core.sql.timeonly"}get hour(){return this._hour}get minute(){return this._minute}get second(){return this._second}get millisecond(){return this._millisecond}equals(t){return t instanceof n&&t.hour===this.hour&&t.minute===this.minute&&t.second===this.second&&t.millisecond===this.millisecond}clone(){return new n(this.hour,this.minute,this.second,this.millisecond)}isValid(){return t(this.hour)&&t(this.minute)&&t(this.second)&&t(this.millisecond)&&this.hour>=0&&this.hour<24&&this.minute>=0&&this.minute<60&&this.second>=0&&this.second<60&&this.millisecond>=0&&this.millisecond<1e3}toString(){return`${this.hour.toString().padStart(2,"0")}:${this.minute.toString().padStart(2,"0")}:${this.second.toString().padStart(2,"0")}`+(this.millisecond>0?"."+this.millisecond.toString().padStart(3,"0"):"")}toSQLValue(){return this.toString()}toSQLWithKeyword(){return`time '${this.hour.toString().padStart(2,"0")}:${this.minute.toString().padStart(2,"0")}:${this.second.toString().padStart(2,"0")}${this.millisecond>0?"."+this.millisecond.toString().padStart(3,"0"):""}'`}toStorageString(){return`${this.hour.toString().padStart(2,"0")}:${this.minute.toString().padStart(2,"0")}:${this.second.toString().padStart(2,"0")}`}toFormat(t=null){if(null===t||""===t)return this.toString();if(!(t=i(t)))return"";return e.local(1970,1,1,this._hour,this._minute,this._second,this._millisecond).toFormat(t,{locale:s(),numberingSystem:"latn"})}toNumber(){return this.millisecond+1e3*this.second+1e3*this.minute*60+60*this.hour*60*1e3}static fromParts(t,s,e,i){const r=new n(t,s,e,i);return r.isValid()?r:null}static fromReader(t){if(!t)return null;const s=t.split(":");return 3!==s.length?null:new n(parseInt(s[0],10),parseInt(s[1],10),parseInt(s[2],10),0)}static fromMilliseconds(t){if(t>864e5||t<0)return null;const s=Math.floor(t/1e3%60),e=Math.floor(t/6e4%60),i=Math.floor(t/36e5%24),r=Math.floor(t%1e3);return new n(i,e,s,r)}static fromDateJS(t){return new n(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds())}static fromDateTime(t){return new n(t.hour,t.minute,t.second,t.millisecond)}static fromSqlTimeStampOffset(t){return this.fromDateTime(t.toDateTime())}static fromString(t,s=null){if(""===t)return null;if(null===t)return null;const r=[];s?(s=i(s))&&r.push(s):null!==s&&""!==s||(r.push("HH:mm:ss"),r.push("HH:mm:ss.SSS"),r.push("hh:mm:ss a"),r.push("hh:mm:ss.SSS a"),r.push("HH:mm"),r.push("hh:mm a"),r.push("H:mm"),r.push("h:mm a"),r.push("H:mm:ss"),r.push("h:mm:ss a"),r.push("H:mm:ss.SSS"),r.push("h:mm:ss.SSS a"));for(const i of r){const s=e.fromFormat(t,i);if(s.isValid)return new n(s.hour,s.minute,s.second,s.millisecond)}return null}plus(t,s){switch(t){case"days":case"years":case"months":return this.clone();case"hours":case"minutes":case"seconds":case"milliseconds":return n.fromDateTime(this.toUTCDateTime().plus({[t]:s}))}return null}toUTCDateTime(){return e.utc(1970,1,1,this.hour,this.minute,this.second,this.millisecond)}difference(t,s){switch(s.toLowerCase()){case"days":case"day":case"d":return this.toUTCDateTime().diff(t.toUTCDateTime(),"days").days;case"months":case"month":return this.toUTCDateTime().diff(t.toUTCDateTime(),"months").months;case"minutes":case"minute":case"m":return"M"===s?this.toUTCDateTime().diff(t.toUTCDateTime(),"months").months:this.toUTCDateTime().diff(t.toUTCDateTime(),"minutes").minutes;case"seconds":case"second":case"s":return this.toUTCDateTime().diff(t.toUTCDateTime(),"seconds").seconds;case"milliseconds":case"millisecond":case"ms":default:return this.toUTCDateTime().diff(t.toUTCDateTime(),"milliseconds").milliseconds;case"hours":case"hour":case"h":return this.toUTCDateTime().diff(t.toUTCDateTime(),"hours").hours;case"years":case"year":case"y":return this.toUTCDateTime().diff(t.toUTCDateTime(),"years").years}}}export{n as TimeOnly,i as standardizeTimeFormat};
5
+ import{isInteger as t}from"../../arcade/kernel.js";import{getLocale as s}from"../../intl/locale.js";import{DateTime as e}from"luxon";function i(t){if(!t)return"";const s=/(a|A|hh?|HH?|mm?|ss?|SSS|S|.)/g;let e="";for(const i of t.match(s)||[])switch(i){case"SSS":case"m":case"mm":case"h":case"hh":case"H":case"HH":case"s":case"ss":e+=i;break;case"A":case"a":e+="a";break;default:e+=`'${i}'`}return e}const n="esri.core.sql.timeonly";class r{constructor(t,s,e,i){this._hour=t,this._minute=s,this._second=e,this._millisecond=i,this.declaredRootClass=n}static isTimeOnly(t){return"object"==typeof t&&null!=t&&"declaredRootClass"in t&&t.declaredRootClass===n}get hour(){return this._hour}get minute(){return this._minute}get second(){return this._second}get millisecond(){return this._millisecond}equals(t){return r.isTimeOnly(t)&&t.hour===this.hour&&t.minute===this.minute&&t.second===this.second&&t.millisecond===this.millisecond}clone(){return new r(this.hour,this.minute,this.second,this.millisecond)}isValid(){return t(this.hour)&&t(this.minute)&&t(this.second)&&t(this.millisecond)&&this.hour>=0&&this.hour<24&&this.minute>=0&&this.minute<60&&this.second>=0&&this.second<60&&this.millisecond>=0&&this.millisecond<1e3}toString(){return`${this.hour.toString().padStart(2,"0")}:${this.minute.toString().padStart(2,"0")}:${this.second.toString().padStart(2,"0")}`+(this.millisecond>0?"."+this.millisecond.toString().padStart(3,"0"):"")}toSQLValue(){return this.toString()}toSQLWithKeyword(){return`time '${this.hour.toString().padStart(2,"0")}:${this.minute.toString().padStart(2,"0")}:${this.second.toString().padStart(2,"0")}${this.millisecond>0?"."+this.millisecond.toString().padStart(3,"0"):""}'`}toStorageString(){return`${this.hour.toString().padStart(2,"0")}:${this.minute.toString().padStart(2,"0")}:${this.second.toString().padStart(2,"0")}`}toFormat(t=null){if(null===t||""===t)return this.toString();if(!(t=i(t)))return"";return e.local(1970,1,1,this._hour,this._minute,this._second,this._millisecond).toFormat(t,{locale:s(),numberingSystem:"latn"})}toNumber(){return this.millisecond+1e3*this.second+1e3*this.minute*60+60*this.hour*60*1e3}static fromParts(t,s,e,i){const n=new r(t,s,e,i);return n.isValid()?n:null}static fromReader(t){if(!t)return null;const s=t.split(":");return 3!==s.length?null:new r(parseInt(s[0],10),parseInt(s[1],10),parseInt(s[2],10),0)}static fromMilliseconds(t){if(t>864e5||t<0)return null;const s=Math.floor(t/1e3%60),e=Math.floor(t/6e4%60),i=Math.floor(t/36e5%24),n=Math.floor(t%1e3);return new r(i,e,s,n)}static fromDateJS(t){return new r(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds())}static fromDateTime(t){return new r(t.hour,t.minute,t.second,t.millisecond)}static fromSqlTimeStampOffset(t){return this.fromDateTime(t.toDateTime())}static fromString(t,s=null){if(""===t)return null;if(null===t)return null;const n=[];s?(s=i(s))&&n.push(s):null!==s&&""!==s||(n.push("HH:mm:ss"),n.push("HH:mm:ss.SSS"),n.push("hh:mm:ss a"),n.push("hh:mm:ss.SSS a"),n.push("HH:mm"),n.push("hh:mm a"),n.push("H:mm"),n.push("h:mm a"),n.push("H:mm:ss"),n.push("h:mm:ss a"),n.push("H:mm:ss.SSS"),n.push("h:mm:ss.SSS a"));for(const i of n){const s=e.fromFormat(t,i);if(s.isValid)return new r(s.hour,s.minute,s.second,s.millisecond)}return null}plus(t,s){switch(t){case"days":case"years":case"months":return this.clone();case"hours":case"minutes":case"seconds":case"milliseconds":return r.fromDateTime(this.toUTCDateTime().plus({[t]:s}))}return null}toUTCDateTime(){return e.utc(1970,1,1,this.hour,this.minute,this.second,this.millisecond)}difference(t,s){switch(s.toLowerCase()){case"days":case"day":case"d":return this.toUTCDateTime().diff(t.toUTCDateTime(),"days").days;case"months":case"month":return this.toUTCDateTime().diff(t.toUTCDateTime(),"months").months;case"minutes":case"minute":case"m":return"M"===s?this.toUTCDateTime().diff(t.toUTCDateTime(),"months").months:this.toUTCDateTime().diff(t.toUTCDateTime(),"minutes").minutes;case"seconds":case"second":case"s":return this.toUTCDateTime().diff(t.toUTCDateTime(),"seconds").seconds;case"milliseconds":case"millisecond":case"ms":default:return this.toUTCDateTime().diff(t.toUTCDateTime(),"milliseconds").milliseconds;case"hours":case"hour":case"h":return this.toUTCDateTime().diff(t.toUTCDateTime(),"hours").hours;case"years":case"year":case"y":return this.toUTCDateTime().diff(t.toUTCDateTime(),"years").years}}}export{r as TimeOnly,i as standardizeTimeFormat};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- 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,SqlErrorCodes as s}from"./errorSupport.js";import{sqlCalculateFunction as i}from"./sqlArithmeticUtils.js";import{sqlCompare as n,isDateOrTimeValue as o}from"./sqlCompareUtils.js";import{isDateTime as u,isTimestampOffset as l,isTimeOnly as c,isDateOnly as h,parseTime as p,parseTimestamp as m,parseDate as d,convertToExecutingTimeZone as f}from"./sqlDateParsingUtils.js";import{SqlInterval as v}from"./SqlInterval.js";import{SqlTimeStampOffset as N}from"./SqlTimestampOffset.js";import{evaluateFunction as g,isStandardized as S}from"./StandardizedFunctions.js";import{TimeOnly as T}from"./TimeOnly.js";import{WhereGrammar as y,visitAll as _}from"./WhereGrammar.js";import{isDate as J}from"../../support/guards.js";import{DateTime as w,FixedOffsetZone as I}from"luxon";const O=new Set(["current_timestamp","current_date","current_time"]);class F{static makeBool(e){return Z(e)}static featureValue(e,t,r,a){return R(e,t,r,a)}static equalsNull(e){return null===e}static applyLike(e,t,r){return L(e,t,r)}static ensureArray(e){return x(e)}static applyIn(e,t,r){return U(e,t)}static currentTimestamp(e){return f(new Date,e)}static currentDate(e){return r.fromNow(e)}static currentTime(e){const t=f(new Date,e);return T.fromDateTime(t)}static makeSqlInterval(e,t,r){return v.createFromValueAndQualifier(e,t,r)}static convertInterval(e){return e instanceof v?e.valueInMilliseconds():e}static compare(e,t,r,a){return n(t,r,e)}static calculate(e,t,r,a){return i(e,t,r,a)}static evaluateTime(e){return p(e)}static evaluateTimestamp(e,t,r){return m(e,t,r)}static evaluateDate(e,t){return d(e,t)}static evaluateFunction(e,t,r){return g(e,t,r)}static lookup(e,t){const r=t[e];return void 0===r?null:r}static between(e,t,r){return null==e||null==t[0]||null==t[1]?null:n(e,t[0],">=")&&n(e,t[1],"<=")}static notbetween(e,t,r){return null==e||null==t[0]||null==t[1]?null:n(e,t[0],"<")||n(e,t[1],">")}static ternaryNot(e){return b(e)}static ternaryAnd(e,t){return A(e,t)}static ternaryOr(e,t){return E(e,t)}}class D{constructor(e,t,r="UTC",a=null){this.fieldsIndex=t,this.timeZone=r,this.currentUser=a,this.parameters={},this._hasDateFunctions=void 0,this.parseTree=y.parse(e);const{isStandardized:s,isAggregate:i,currentUserRequired:n,referencedFieldNames:o}=this._extractExpressionInfo(t);this._referencedFieldNames=o,this.isStandardized=s,this.isAggregate=i,this.currentUserRequired=n}static convertValueToStorageFormat(e,t=null){if(null===t)return J(e)?e.getTime():u(e)?e.toMillis():l(e)?e.toStorageFormat():c(e)?e.toStorageString():h(e)?e.toStorageFormat():e;switch(t){case"date":return J(e)?e.getTime():u(e)?e.toMillis():l(e)?e.toMilliseconds():h(e)?e.toNumber():e;case"date-only":return J(e)?r.fromDateJS(e).toString():l(e)?r.fromSqlTimeStampOffset(e).toString():u(e)?r.fromDateTime(e).toString():e;case"time-only":return J(e)?T.fromDateJS(e).toStorageString():u(e)?T.fromDateTime(e).toStorageString():l(e)?T.fromSqlTimeStampOffset(e).toStorageString():c(e)?e.toStorageString():e;case"timestamp-offset":if(J(e))return N.fromJSDate(e).toStorageFormat();if(u(e))return N.fromDateTime(e).toStorageFormat();if(l(e))return e.toStorageFormat()}return e}static create(e,t={}){return new D(e,t.fieldsIndex,t.timeZone??void 0,t.currentUser)}get fieldNames(){return this._referencedFieldNames}testSet(e,t=C,r=this.currentUser){return!!this._evaluateNode(this.parseTree,null,t,e,r)}calculateValue(e,t=C,r=this.currentUser){const a=this._evaluateNode(this.parseTree,e,t,null,r);return a instanceof v?a.valueInMilliseconds()/864e5:a}calculateValueCompiled(e,t=C,r=this.currentUser){return null!=this.parseTree._compiledVersion?this.parseTree._compiledVersion(e,this.parameters,t,this.fieldsIndex,this.timeZone,r??null):has("esri-csp-restrictions")?this.calculateValue(e,t):(this._compileMe(),this.parseTree._compiledVersion(e,this.parameters,t,this.fieldsIndex,this.timeZone,r??null))}testFeature(e,t=C,r=this.currentUser){return!!this._evaluateNode(this.parseTree,e,t,null,r)}testFeatureCompiled(e,t=C,r=this.currentUser){return null!=this.parseTree._compiledVersion?!!this.parseTree._compiledVersion(e,this.parameters,t,this.fieldsIndex,this.timeZone,r??null):has("esri-csp-restrictions")?this.testFeature(e,t):(this._compileMe(),!!this.parseTree._compiledVersion(e,this.parameters,t,this.fieldsIndex,this.timeZone,r??null))}get hasDateFunctions(){return null!=this._hasDateFunctions||(this._hasDateFunctions=!1,_(this.parseTree,(e=>{"current-time"===e.type?this._hasDateFunctions=!0:"function"===e.type&&(this._hasDateFunctions=this._hasDateFunctions||O.has(e.name.toLowerCase()))}))),this._hasDateFunctions}getFunctions(){const e=new Set;return _(this.parseTree,(t=>{"function"===t.type&&e.add(t.name.toLowerCase())})),Array.from(e)}getExpressions(){const e=new Map;return _(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,s=`${r}-${t}`;e.has(s)||e.set(s,{aggregateType:r,field:t})}}})),[...e.values()]}getVariables(){const e=new Set;return _(this.parseTree,(t=>{"parameter"===t.type&&e.add(t.value.toLowerCase())})),Array.from(e)}_compileMe(){const e="return this.convertInterval("+this.evaluateNodeToJavaScript(this.parseTree)+")";this.parseTree._compiledVersion=new Function("feature","lookups","attributeAdapter","fieldsIndex","timeZone","currentUser",e).bind(F)}_extractExpressionInfo(t){const r=[],a=new Set;let s=!0,i=!1,n=!1;return _(this.parseTree,(o=>{switch(o.type){case"column-reference":{const e=t?.get(o.column);let s,i;e?s=i=e.name??"":(i=o.column,s=i.toLowerCase()),a.has(s)||(a.add(s),r.push(i)),o.column=i;break}case"current-user":n=!0;break;case"function":{const{name:t,args:r}=o,a=r.value.length;s&&(s=S(t,a)),!1===i&&(i=e(t,a));break}}})),{referencedFieldNames:Array.from(r),isStandardized:s,isAggregate:i,currentUserRequired:n}}evaluateNodeToJavaScript(e){switch(e.type){case"interval":return"this.makeSqlInterval("+this.evaluateNodeToJavaScript(e.value)+", "+JSON.stringify(e.qualifier)+","+JSON.stringify(e.op)+")";case"case-expression":{let t="";if("simple"===e.format){const r=this.evaluateNodeToJavaScript(e.operand);t="( ";for(let a=0;a<e.clauses.length;a++)t+=" (this.compare('=',"+r+","+this.evaluateNodeToJavaScript(e.clauses[a].operand)+") ? ("+this.evaluateNodeToJavaScript(e.clauses[a].value)+") : ";null!==e.else?t+=this.evaluateNodeToJavaScript(e.else):t+="null",t+=" )"}else{t="( ";for(let r=0;r<e.clauses.length;r++)t+=" this.makeBool("+this.evaluateNodeToJavaScript(e.clauses[r].operand)+")===true ? ("+this.evaluateNodeToJavaScript(e.clauses[r].value)+") : ";null!==e.else?t+=this.evaluateNodeToJavaScript(e.else):t+="null",t+=" )"}return t}case"parameter":return"this.lookup("+JSON.stringify(e.value.toLowerCase())+",lookups)";case"expression-list":{let t="[";for(const r of e.value)"["!==t&&(t+=","),t+=this.evaluateNodeToJavaScript(r);return t+="]",t}case"unary-expression":return"this.ternaryNot("+this.evaluateNodeToJavaScript(e.expr)+")";case"binary-expression":switch(e.operator){case"AND":return"this.ternaryAnd("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+" )";case"OR":return"this.ternaryOr("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+" )";case"IS":if("null"!==e.right.type)throw new a(s.UnsupportedIsRhs);return"this.equalsNull("+this.evaluateNodeToJavaScript(e.left)+")";case"ISNOT":if("null"!==e.right.type)throw new a(s.UnsupportedIsRhs);return"(!(this.equalsNull("+this.evaluateNodeToJavaScript(e.left)+")))";case"IN":return"this.applyIn("+this.evaluateNodeToJavaScript(e.left)+",this.ensureArray("+this.evaluateNodeToJavaScript(e.right)+"), timeZone)";case"NOT IN":return"this.ternaryNot(this.applyIn("+this.evaluateNodeToJavaScript(e.left)+",this.ensureArray("+this.evaluateNodeToJavaScript(e.right)+"), timeZone))";case"BETWEEN":return"this.between("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+", timeZone)";case"NOTBETWEEN":return"this.notbetween("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+", timeZone)";case"LIKE":return"this.applyLike("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+","+JSON.stringify(e.escape)+")";case"NOT LIKE":return"this.ternaryNot(this.applyLike("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+","+JSON.stringify(e.escape)+"))";case"<>":case"<":case">":case">=":case"<=":case"=":return"this.compare("+JSON.stringify(e.operator)+","+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+", timeZone)";case"*":case"-":case"+":case"/":case"||":return"this.calculate("+JSON.stringify(e.operator)+","+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+", timeZone)";default:throw new a(s.UnsupportedOperator,{operator:e.operator})}case"null":case"boolean":case"string":case"number":return JSON.stringify(e.value);case"time":return"this.evaluateTime("+JSON.stringify(e.value)+")";case"date":return"this.evaluateDate("+JSON.stringify(e.value)+", 'unknown')";case"timestamp":return"this.evaluateTimestamp("+JSON.stringify(e.value)+", 'unknown')";case"current-time":return"date"===e.mode?"this.currentDate(timeZone)":"time"===e.mode?"this.currentTime(timeZone)":"this.currentTimestamp(timeZone)";case"current-user":return"currentUser";case"column-reference":return"this.featureValue(feature,"+JSON.stringify(e.column)+",fieldsIndex,attributeAdapter)";case"function":return"this.evaluateFunction("+JSON.stringify(e.name)+","+this.evaluateNodeToJavaScript(e.args)+", timeZone)"}throw new a(s.UnsupportedSyntax,{node:e.type})}_evaluateNode(r,o,u,l,c){let h;switch(r.type){case"interval":{const e=this._evaluateNode(r.value,o,u,l,c);return v.createFromValueAndQualifier(e,r.qualifier,r.op)}case"case-expression":if("simple"===r.format){const e=this._evaluateNode(r.operand,o,u,l,c);for(let t=0;t<r.clauses.length;t++)if(n(e,this._evaluateNode(r.clauses[t].operand,o,u,l,c),"=",this.timeZone))return this._evaluateNode(r.clauses[t].value,o,u,l,c);if(null!==r.else)return this._evaluateNode(r.else,o,u,l,c)}else{for(let e=0;e<r.clauses.length;e++)if(Z(this._evaluateNode(r.clauses[e].operand,o,u,l,c)))return this._evaluateNode(r.clauses[e].value,o,u,l,c);if(null!==r.else)return this._evaluateNode(r.else,o,u,l,c)}return null;case"parameter":return h=this.parameters[r.value.toLowerCase()],J(h)?w.fromJSDate(h):null!=h&&"object"==typeof h&&"toDateTime"in h?h.toDateTime():h;case"expression-list":{const e=[];for(const t of r.value)e.push(this._evaluateNode(t,o,u,l,c));return e}case"unary-expression":return b(this._evaluateNode(r.expr,o,u,l,c));case"binary-expression":switch(r.operator){case"AND":return A(this._evaluateNode(r.left,o,u,l,c),this._evaluateNode(r.right,o,u,l,c));case"OR":return E(this._evaluateNode(r.left,o,u,l,c),this._evaluateNode(r.right,o,u,l,c));case"IS":if("null"!==r.right.type)throw new a(s.UnsupportedIsRhs);return null===this._evaluateNode(r.left,o,u,l,c);case"ISNOT":if("null"!==r.right.type)throw new a(s.UnsupportedIsRhs);return null!==this._evaluateNode(r.left,o,u,l,c);case"IN":{const e=x(this._evaluateNode(r.right,o,u,l,c));return U(this._evaluateNode(r.left,o,u,l,c),e,this.timeZone)}case"NOT IN":{const e=x(this._evaluateNode(r.right,o,u,l,c));return b(U(this._evaluateNode(r.left,o,u,l,c),e,this.timeZone))}case"BETWEEN":{const e=this._evaluateNode(r.left,o,u,l,c),t=this._evaluateNode(r.right,o,u,l,c);return null==e||null==t[0]||null==t[1]?null:n(e,t[0],">=",this.timeZone)&&n(e,t[1],"<=",this.timeZone)}case"NOTBETWEEN":{const e=this._evaluateNode(r.left,o,u,l,c),t=this._evaluateNode(r.right,o,u,l,c);return null==e||null==t[0]||null==t[1]?null:n(e,t[0],"<",this.timeZone)||n(e,t[1],">",this.timeZone)}case"LIKE":return L(this._evaluateNode(r.left,o,u,l,c),this._evaluateNode(r.right,o,u,l,c),r.escape);case"NOT LIKE":return b(L(this._evaluateNode(r.left,o,u,l,c),this._evaluateNode(r.right,o,u,l,c),r.escape));case"<>":case"<":case">":case">=":case"<=":case"=":return n(this._evaluateNode(r.left,o,u,l,c),this._evaluateNode(r.right,o,u,l,c),r.operator,this.timeZone);case"-":case"+":case"*":case"/":case"||":return i(r.operator,this._evaluateNode(r.left,o,u,l,c),this._evaluateNode(r.right,o,u,l,c),this.timeZone)}case"null":case"boolean":case"string":case"number":return r.value;case"date":return r.parsedValue??=d(r.value,"unknown"),r.parsedValue;case"timestamp":return r.parsedValue??=m(r.value,"unknown"),r.parsedValue;case"time":return p(r.value);case"current-time":return"date"===r.mode?F.currentDate(this.timeZone):"time"===r.mode?F.currentTime(this.timeZone):F.currentTimestamp(this.timeZone);case"current-user":return c??null;case"column-reference":return R(o,r.column,this.fieldsIndex,u);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,u,null,c));e.push(r)}return t(r.name,e)}const a=this._evaluateNode(r.args,o,u,l,c);return g(r.name,a,this.timeZone)}}throw new a(s.UnsupportedSyntax,{node:r.type})}}function Z(e){return!0===e}function x(e){return Array.isArray(e)?e:[e]}function b(e){return null!==e?!0!==e:null}function A(e,t){return null!=e&&null!=t?!0===e&&!0===t:!1!==e&&!1!==t&&null}function E(e,t){return null!=e&&null!=t?!0===e||!0===t:!0===e||!0===t||null}function U(e,t,r){if(null==e)return null;let a=!1;for(const s of t)if(null==s)a=null;else{if(e===s){a=!0;break}if(o(e)&&o(s)&&(a=n(e,s,"="),a))break}return a}const k="-[]/{}()*+?.\\^$|";var V;function q(e,t){const r=t;let a="",s=V.Normal;for(let i=0;i<e.length;i++){const t=e.charAt(i);switch(s){case V.Normal:t===r?s=V.Escaped:k.includes(t)?a+="\\"+t:a+="%"===t?".*":"_"===t?".":t;break;case V.Escaped:k.includes(t)?a+="\\"+t:a+=t,s=V.Normal}}return new RegExp("^"+a+"$","m")}function L(e,t,r){if(null==e)return null;return q(t,r).test(e)}function j(e){return e&&"object"==typeof e.attributes}function R(e,t,a,s){if("getAttributeSQL"in s)return s.getAttributeSQL(e,t);const i=s.getAttribute(e,t),n=a?.get(t);return null==i||"esriFieldTypeDate"!==n?.type&&"date"!==n?.type?null==i||"esriFieldTypeDateOnly"!==n?.type&&"date-only"!==n?.type?null==i||"esriFieldTypeTimeOnly"!==n?.type&&"time-only"!==n?.type?null==i||"esriFieldTypeTimestampOffset"!==n?.type&&"timestamp-offset"!==n?.type?i:new N(i):T.fromReader(i):r.fromReader(i):f(new Date(i),a?.getLuxonTimeZone(n.name)??I.utcInstance)}!function(e){e[e.Normal=0]="Normal",e[e.Escaped=1]="Escaped"}(V||(V={}));const C={getAttribute:(e,t)=>(j(e)?e.attributes:e)[t]};export{D as default};
5
+ 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,SqlErrorCodes as s}from"./errorSupport.js";import{sqlCalculateFunction as i}from"./sqlArithmeticUtils.js";import{sqlCompare as n,isDateOrTimeValue as o}from"./sqlCompareUtils.js";import{isDateTime as u,isTimestampOffset as l,isTimeOnly as c,isDateOnly as h,parseTime as p,parseTimestamp as m,parseDate as d,convertToExecutingTimeZone as f}from"./sqlDateParsingUtils.js";import{SqlInterval as v}from"./SqlInterval.js";import{SqlTimeStampOffset as N}from"./SqlTimestampOffset.js";import{evaluateFunction as g,isStandardized as S}from"./StandardizedFunctions.js";import{TimeOnly as T}from"./TimeOnly.js";import{WhereGrammar as y,visitAll as _}from"./WhereGrammar.js";import{isDate as J}from"../../support/guards.js";import{DateTime as w,FixedOffsetZone as I}from"luxon";const O=new Set(["current_timestamp","current_date","current_time"]);class F{static makeBool(e){return Z(e)}static featureValue(e,t,r,a){return R(e,t,r,a)}static equalsNull(e){return null===e}static applyLike(e,t,r){return L(e,t,r)}static ensureArray(e){return x(e)}static applyIn(e,t,r){return U(e,t)}static currentTimestamp(e){return f(new Date,e)}static currentDate(e){return r.fromNow(e)}static currentTime(e){const t=f(new Date,e);return T.fromDateTime(t)}static makeSqlInterval(e,t,r){return v.createFromValueAndQualifier(e,t,r)}static convertInterval(e){return v.isInterval(e)?e.valueInMilliseconds():e}static compare(e,t,r,a){return n(t,r,e)}static calculate(e,t,r,a){return i(e,t,r,a)}static evaluateTime(e){return p(e)}static evaluateTimestamp(e,t,r){return m(e,t,r)}static evaluateDate(e,t){return d(e,t)}static evaluateFunction(e,t,r){return g(e,t,r)}static lookup(e,t){const r=t[e];return void 0===r?null:r}static between(e,t,r){return null==e||null==t[0]||null==t[1]?null:n(e,t[0],">=")&&n(e,t[1],"<=")}static notbetween(e,t,r){return null==e||null==t[0]||null==t[1]?null:n(e,t[0],"<")||n(e,t[1],">")}static ternaryNot(e){return b(e)}static ternaryAnd(e,t){return A(e,t)}static ternaryOr(e,t){return E(e,t)}}class D{constructor(e,t,r="UTC",a=null){this.fieldsIndex=t,this.timeZone=r,this.currentUser=a,this.parameters={},this._hasDateFunctions=void 0,this.parseTree=y.parse(e);const{isStandardized:s,isAggregate:i,currentUserRequired:n,referencedFieldNames:o}=this._extractExpressionInfo(t);this._referencedFieldNames=o,this.isStandardized=s,this.isAggregate=i,this.currentUserRequired=n}static convertValueToStorageFormat(e,t=null){if(null===t)return J(e)?e.getTime():u(e)?e.toMillis():l(e)?e.toStorageFormat():c(e)?e.toStorageString():h(e)?e.toStorageFormat():e;switch(t){case"date":return J(e)?e.getTime():u(e)?e.toMillis():l(e)?e.toMilliseconds():h(e)?e.toNumber():e;case"date-only":return J(e)?r.fromDateJS(e).toString():l(e)?r.fromSqlTimeStampOffset(e).toString():u(e)?r.fromDateTime(e).toString():e;case"time-only":return J(e)?T.fromDateJS(e).toStorageString():u(e)?T.fromDateTime(e).toStorageString():l(e)?T.fromSqlTimeStampOffset(e).toStorageString():c(e)?e.toStorageString():e;case"timestamp-offset":if(J(e))return N.fromJSDate(e).toStorageFormat();if(u(e))return N.fromDateTime(e).toStorageFormat();if(l(e))return e.toStorageFormat()}return e}static create(e,t={}){return new D(e,t.fieldsIndex,t.timeZone??void 0,t.currentUser)}get fieldNames(){return this._referencedFieldNames}testSet(e,t=C,r=this.currentUser){return!!this._evaluateNode(this.parseTree,null,t,e,r)}calculateValue(e,t=C,r=this.currentUser){const a=this._evaluateNode(this.parseTree,e,t,null,r);return v.isInterval(a)?a.valueInMilliseconds()/864e5:a}calculateValueCompiled(e,t=C,r=this.currentUser){return null!=this.parseTree._compiledVersion?this.parseTree._compiledVersion(e,this.parameters,t,this.fieldsIndex,this.timeZone,r??null):has("esri-csp-restrictions")?this.calculateValue(e,t):(this._compileMe(),this.parseTree._compiledVersion(e,this.parameters,t,this.fieldsIndex,this.timeZone,r??null))}testFeature(e,t=C,r=this.currentUser){return!!this._evaluateNode(this.parseTree,e,t,null,r)}testFeatureCompiled(e,t=C,r=this.currentUser){return null!=this.parseTree._compiledVersion?!!this.parseTree._compiledVersion(e,this.parameters,t,this.fieldsIndex,this.timeZone,r??null):has("esri-csp-restrictions")?this.testFeature(e,t):(this._compileMe(),!!this.parseTree._compiledVersion(e,this.parameters,t,this.fieldsIndex,this.timeZone,r??null))}get hasDateFunctions(){return null!=this._hasDateFunctions||(this._hasDateFunctions=!1,_(this.parseTree,(e=>{"current-time"===e.type?this._hasDateFunctions=!0:"function"===e.type&&(this._hasDateFunctions=this._hasDateFunctions||O.has(e.name.toLowerCase()))}))),this._hasDateFunctions}getFunctions(){const e=new Set;return _(this.parseTree,(t=>{"function"===t.type&&e.add(t.name.toLowerCase())})),Array.from(e)}getExpressions(){const e=new Map;return _(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,s=`${r}-${t}`;e.has(s)||e.set(s,{aggregateType:r,field:t})}}})),[...e.values()]}getVariables(){const e=new Set;return _(this.parseTree,(t=>{"parameter"===t.type&&e.add(t.value.toLowerCase())})),Array.from(e)}_compileMe(){const e="return this.convertInterval("+this.evaluateNodeToJavaScript(this.parseTree)+")";this.parseTree._compiledVersion=new Function("feature","lookups","attributeAdapter","fieldsIndex","timeZone","currentUser",e).bind(F)}_extractExpressionInfo(t){const r=[],a=new Set;let s=!0,i=!1,n=!1;return _(this.parseTree,(o=>{switch(o.type){case"column-reference":{const e=t?.get(o.column);let s,i;e?s=i=e.name??"":(i=o.column,s=i.toLowerCase()),a.has(s)||(a.add(s),r.push(i)),o.column=i;break}case"current-user":n=!0;break;case"function":{const{name:t,args:r}=o,a=r.value.length;s&&(s=S(t,a)),!1===i&&(i=e(t,a));break}}})),{referencedFieldNames:Array.from(r),isStandardized:s,isAggregate:i,currentUserRequired:n}}evaluateNodeToJavaScript(e){switch(e.type){case"interval":return"this.makeSqlInterval("+this.evaluateNodeToJavaScript(e.value)+", "+JSON.stringify(e.qualifier)+","+JSON.stringify(e.op)+")";case"case-expression":{let t="";if("simple"===e.format){const r=this.evaluateNodeToJavaScript(e.operand);t="( ";for(let a=0;a<e.clauses.length;a++)t+=" (this.compare('=',"+r+","+this.evaluateNodeToJavaScript(e.clauses[a].operand)+") ? ("+this.evaluateNodeToJavaScript(e.clauses[a].value)+") : ";null!==e.else?t+=this.evaluateNodeToJavaScript(e.else):t+="null",t+=" )"}else{t="( ";for(let r=0;r<e.clauses.length;r++)t+=" this.makeBool("+this.evaluateNodeToJavaScript(e.clauses[r].operand)+")===true ? ("+this.evaluateNodeToJavaScript(e.clauses[r].value)+") : ";null!==e.else?t+=this.evaluateNodeToJavaScript(e.else):t+="null",t+=" )"}return t}case"parameter":return"this.lookup("+JSON.stringify(e.value.toLowerCase())+",lookups)";case"expression-list":{let t="[";for(const r of e.value)"["!==t&&(t+=","),t+=this.evaluateNodeToJavaScript(r);return t+="]",t}case"unary-expression":return"this.ternaryNot("+this.evaluateNodeToJavaScript(e.expr)+")";case"binary-expression":switch(e.operator){case"AND":return"this.ternaryAnd("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+" )";case"OR":return"this.ternaryOr("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+" )";case"IS":if("null"!==e.right.type)throw new a(s.UnsupportedIsRhs);return"this.equalsNull("+this.evaluateNodeToJavaScript(e.left)+")";case"ISNOT":if("null"!==e.right.type)throw new a(s.UnsupportedIsRhs);return"(!(this.equalsNull("+this.evaluateNodeToJavaScript(e.left)+")))";case"IN":return"this.applyIn("+this.evaluateNodeToJavaScript(e.left)+",this.ensureArray("+this.evaluateNodeToJavaScript(e.right)+"), timeZone)";case"NOT IN":return"this.ternaryNot(this.applyIn("+this.evaluateNodeToJavaScript(e.left)+",this.ensureArray("+this.evaluateNodeToJavaScript(e.right)+"), timeZone))";case"BETWEEN":return"this.between("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+", timeZone)";case"NOTBETWEEN":return"this.notbetween("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+", timeZone)";case"LIKE":return"this.applyLike("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+","+JSON.stringify(e.escape)+")";case"NOT LIKE":return"this.ternaryNot(this.applyLike("+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+","+JSON.stringify(e.escape)+"))";case"<>":case"<":case">":case">=":case"<=":case"=":return"this.compare("+JSON.stringify(e.operator)+","+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+", timeZone)";case"*":case"-":case"+":case"/":case"||":return"this.calculate("+JSON.stringify(e.operator)+","+this.evaluateNodeToJavaScript(e.left)+","+this.evaluateNodeToJavaScript(e.right)+", timeZone)";default:throw new a(s.UnsupportedOperator,{operator:e.operator})}case"null":case"boolean":case"string":case"number":return JSON.stringify(e.value);case"time":return"this.evaluateTime("+JSON.stringify(e.value)+")";case"date":return"this.evaluateDate("+JSON.stringify(e.value)+", 'unknown')";case"timestamp":return"this.evaluateTimestamp("+JSON.stringify(e.value)+", 'unknown')";case"current-time":return"date"===e.mode?"this.currentDate(timeZone)":"time"===e.mode?"this.currentTime(timeZone)":"this.currentTimestamp(timeZone)";case"current-user":return"currentUser";case"column-reference":return"this.featureValue(feature,"+JSON.stringify(e.column)+",fieldsIndex,attributeAdapter)";case"function":return"this.evaluateFunction("+JSON.stringify(e.name)+","+this.evaluateNodeToJavaScript(e.args)+", timeZone)"}throw new a(s.UnsupportedSyntax,{node:e.type})}_evaluateNode(r,o,u,l,c){let h;switch(r.type){case"interval":{const e=this._evaluateNode(r.value,o,u,l,c);return v.createFromValueAndQualifier(e,r.qualifier,r.op)}case"case-expression":if("simple"===r.format){const e=this._evaluateNode(r.operand,o,u,l,c);for(let t=0;t<r.clauses.length;t++)if(n(e,this._evaluateNode(r.clauses[t].operand,o,u,l,c),"=",this.timeZone))return this._evaluateNode(r.clauses[t].value,o,u,l,c);if(null!==r.else)return this._evaluateNode(r.else,o,u,l,c)}else{for(let e=0;e<r.clauses.length;e++)if(Z(this._evaluateNode(r.clauses[e].operand,o,u,l,c)))return this._evaluateNode(r.clauses[e].value,o,u,l,c);if(null!==r.else)return this._evaluateNode(r.else,o,u,l,c)}return null;case"parameter":return h=this.parameters[r.value.toLowerCase()],J(h)?w.fromJSDate(h):null!=h&&"object"==typeof h&&"toDateTime"in h?h.toDateTime():h;case"expression-list":{const e=[];for(const t of r.value)e.push(this._evaluateNode(t,o,u,l,c));return e}case"unary-expression":return b(this._evaluateNode(r.expr,o,u,l,c));case"binary-expression":switch(r.operator){case"AND":return A(this._evaluateNode(r.left,o,u,l,c),this._evaluateNode(r.right,o,u,l,c));case"OR":return E(this._evaluateNode(r.left,o,u,l,c),this._evaluateNode(r.right,o,u,l,c));case"IS":if("null"!==r.right.type)throw new a(s.UnsupportedIsRhs);return null===this._evaluateNode(r.left,o,u,l,c);case"ISNOT":if("null"!==r.right.type)throw new a(s.UnsupportedIsRhs);return null!==this._evaluateNode(r.left,o,u,l,c);case"IN":{const e=x(this._evaluateNode(r.right,o,u,l,c));return U(this._evaluateNode(r.left,o,u,l,c),e,this.timeZone)}case"NOT IN":{const e=x(this._evaluateNode(r.right,o,u,l,c));return b(U(this._evaluateNode(r.left,o,u,l,c),e,this.timeZone))}case"BETWEEN":{const e=this._evaluateNode(r.left,o,u,l,c),t=this._evaluateNode(r.right,o,u,l,c);return null==e||null==t[0]||null==t[1]?null:n(e,t[0],">=",this.timeZone)&&n(e,t[1],"<=",this.timeZone)}case"NOTBETWEEN":{const e=this._evaluateNode(r.left,o,u,l,c),t=this._evaluateNode(r.right,o,u,l,c);return null==e||null==t[0]||null==t[1]?null:n(e,t[0],"<",this.timeZone)||n(e,t[1],">",this.timeZone)}case"LIKE":return L(this._evaluateNode(r.left,o,u,l,c),this._evaluateNode(r.right,o,u,l,c),r.escape);case"NOT LIKE":return b(L(this._evaluateNode(r.left,o,u,l,c),this._evaluateNode(r.right,o,u,l,c),r.escape));case"<>":case"<":case">":case">=":case"<=":case"=":return n(this._evaluateNode(r.left,o,u,l,c),this._evaluateNode(r.right,o,u,l,c),r.operator,this.timeZone);case"-":case"+":case"*":case"/":case"||":return i(r.operator,this._evaluateNode(r.left,o,u,l,c),this._evaluateNode(r.right,o,u,l,c),this.timeZone)}case"null":case"boolean":case"string":case"number":return r.value;case"date":return r.parsedValue??=d(r.value,"unknown"),r.parsedValue;case"timestamp":return r.parsedValue??=m(r.value,"unknown"),r.parsedValue;case"time":return p(r.value);case"current-time":return"date"===r.mode?F.currentDate(this.timeZone):"time"===r.mode?F.currentTime(this.timeZone):F.currentTimestamp(this.timeZone);case"current-user":return c??null;case"column-reference":return R(o,r.column,this.fieldsIndex,u);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,u,null,c));e.push(r)}return t(r.name,e)}const a=this._evaluateNode(r.args,o,u,l,c);return g(r.name,a,this.timeZone)}}throw new a(s.UnsupportedSyntax,{node:r.type})}}function Z(e){return!0===e}function x(e){return Array.isArray(e)?e:[e]}function b(e){return null!==e?!0!==e:null}function A(e,t){return null!=e&&null!=t?!0===e&&!0===t:!1!==e&&!1!==t&&null}function E(e,t){return null!=e&&null!=t?!0===e||!0===t:!0===e||!0===t||null}function U(e,t,r){if(null==e)return null;let a=!1;for(const s of t)if(null==s)a=null;else{if(e===s){a=!0;break}if(o(e)&&o(s)&&(a=n(e,s,"="),a))break}return a}const k="-[]/{}()*+?.\\^$|";var V;function q(e,t){const r=t;let a="",s=V.Normal;for(let i=0;i<e.length;i++){const t=e.charAt(i);switch(s){case V.Normal:t===r?s=V.Escaped:k.includes(t)?a+="\\"+t:a+="%"===t?".*":"_"===t?".":t;break;case V.Escaped:k.includes(t)?a+="\\"+t:a+=t,s=V.Normal}}return new RegExp("^"+a+"$","m")}function L(e,t,r){if(null==e)return null;return q(t,r).test(e)}function j(e){return e&&"object"==typeof e.attributes}function R(e,t,a,s){if("getAttributeSQL"in s)return s.getAttributeSQL(e,t);const i=s.getAttribute(e,t),n=a?.get(t);return null==i||"esriFieldTypeDate"!==n?.type&&"date"!==n?.type?null==i||"esriFieldTypeDateOnly"!==n?.type&&"date-only"!==n?.type?null==i||"esriFieldTypeTimeOnly"!==n?.type&&"time-only"!==n?.type?null==i||"esriFieldTypeTimestampOffset"!==n?.type&&"timestamp-offset"!==n?.type?i:new N(i):T.fromReader(i):r.fromReader(i):f(new Date(i),a?.getLuxonTimeZone(n.name)??I.utcInstance)}!function(e){e[e.Normal=0]="Normal",e[e.Escaped=1]="Escaped"}(V||(V={}));const C={getAttribute:(e,t)=>(j(e)?e.attributes:e)[t]};export{D as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- function n(n,t){function r(){this.constructor=n}r.prototype=t.prototype,n.prototype=new r}function t(n,r,e,o){var u=Error.call(this,n);return Object.setPrototypeOf&&Object.setPrototypeOf(u,t.prototype),u.expected=r,u.found=e,u.location=o,u.name="SyntaxError",u}function r(n,t,r){return r=r||" ",n.length>t?n:(t-=n.length,n+(r+=r.repeat(t)).slice(0,t))}function e(n,r){var e,o={},u=(r=void 0!==r?r:{}).grammarSource,i={start:uu},a=uu,c="!",s="=",f=">=",l=">",p="<=",v="<>",d="!=",y="||",h="@",g="'",A="N'",m="''",C=".",b="null",E="true",L="false",T="in",w="is",x="like",N="escape",I="not",R="and",O="or",F="between",S="from",M="for",$="substring",U="extract",_="trim",D="position",H="timestamp",P="date",j="time",Z="leading",k="trailing",z="both",G="cast",B="as",q="integer",V="int",W="smallint",Y="float",K="real",X="varchar",J="to",Q="interval",nn="year",tn="timezone_hour",rn="timezone_minute",en="month",on="day",un="hour",an="minute",cn="second",sn="case",fn="end",ln="when",pn="then",vn="else",dn=",",yn="(",hn=")",gn="`",An=/^[<-=]/,mn=/^[+\-]/,Cn=/^[*\/]/,bn=/^[A-Za-z_\x80-\uFFFF]/,En=/^[A-Za-z0-9_]/,Ln=/^[A-Za-z0-9_.\x80-\uFFFF]/,Tn=/^["]/,wn=/^[^']/,xn=/^[0-9]/,Nn=/^[eE]/,In=/^[ \t\n\r]/,Rn=/^[^`]/,On=Xo("!",!1),Fn=Xo("=",!1),Sn=Xo(">=",!1),Mn=Xo(">",!1),$n=Xo("<=",!1),Un=Xo("<>",!1),_n=Jo([["<","="]],!1,!1),Dn=Xo("!=",!1),Hn=Jo(["+","-"],!1,!1),Pn=Xo("||",!1),jn=Jo(["*","/"],!1,!1),Zn=Jo([["A","Z"],["a","z"],"_",["€","￿"]],!1,!1),kn=Jo([["A","Z"],["a","z"],["0","9"],"_"],!1,!1),zn=Jo([["A","Z"],["a","z"],["0","9"],"_",".",["€","￿"]],!1,!1),Gn=Jo(['"'],!1,!1),Bn=Xo("@",!1),qn=Xo("'",!1),Vn=Xo("N'",!1),Wn=Xo("''",!1),Yn=Jo(["'"],!0,!1),Kn=Xo(".",!1),Xn=Jo([["0","9"]],!1,!1),Jn=Jo(["e","E"],!1,!1),Qn=Xo("NULL",!0),nt=Xo("TRUE",!0),tt=Xo("FALSE",!0),rt=Xo("IN",!0),et=Xo("IS",!0),ot=Xo("LIKE",!0),ut=Xo("ESCAPE",!0),it=Xo("NOT",!0),at=Xo("AND",!0),ct=Xo("OR",!0),st=Xo("BETWEEN",!0),ft=Xo("FROM",!0),lt=Xo("FOR",!0),pt=Xo("SUBSTRING",!0),vt=Xo("EXTRACT",!0),dt=Xo("TRIM",!0),yt=Xo("POSITION",!0),ht=Xo("TIMESTAMP",!0),gt=Xo("DATE",!0),At=Xo("TIME",!0),mt=Xo("LEADING",!0),Ct=Xo("TRAILING",!0),bt=Xo("BOTH",!0),Et=Xo("CAST",!0),Lt=Xo("AS",!0),Tt=Xo("INTEGER",!0),wt=Xo("INT",!0),xt=Xo("SMALLINT",!0),Nt=Xo("FLOAT",!0),It=Xo("REAL",!0),Rt=Xo("VARCHAR",!0),Ot=Xo("TO",!0),Ft=Xo("INTERVAL",!0),St=Xo("YEAR",!0),Mt=Xo("TIMEZONE_HOUR",!0),$t=Xo("TIMEZONE_MINUTE",!0),Ut=Xo("MONTH",!0),_t=Xo("DAY",!0),Dt=Xo("HOUR",!0),Ht=Xo("MINUTE",!0),Pt=Xo("SECOND",!0),jt=Xo("CASE",!0),Zt=Xo("END",!0),kt=Xo("WHEN",!0),zt=Xo("THEN",!0),Gt=Xo("ELSE",!0),Bt=Xo(",",!1),qt=Xo("(",!1),Vt=Xo(")",!1),Wt=Jo([" ","\t","\n","\r"],!1,!1),Yt=Xo("`",!1),Kt=Jo(["`"],!0,!1),Xt=function(n){return n},Jt=function(n){return Ta(Yo(),...n)},Qt=function(n,t,r){return{op:t,expr:r,location:Yo()}},nr=function(n,t){return wa(n,t)},tr=function(n,t,r){return{op:t,expr:r,location:Yo()}},rr=function(n,t){return wa(n,t)},er=function(n){return Ea("NOT",n,Yo())},or=function(n,t){if(""==t||null==t||null==t)return n;return"arithmetic"==t.type?wa(n,t.tail):La(t.op,n,t.right,t.escape,Yo())},ur=function(n,t){return{op:n,expr:t,location:Yo()}},ir=function(n){return{type:"arithmetic",tail:n}},ar=function(n,t){return{op:n+"NOT",right:t}},cr=function(n,t){return{op:n,right:t}},sr=function(n,t,r){return Ta(Yo(),t,r)},fr=function(n,t){return{op:"NOT"+n,right:t}},lr=function(n,t,r){return Ta(Yo(),t,r)},pr=function(n,t){return{op:n,right:t}},vr=function(n){return n[0]+" "+n[2]},dr=function(n){return n[0]+" "+n[2]},yr=function(n,t,r){return{op:n,right:t,escape:r.value}},hr=function(n,t){return{op:n,right:t,escape:""}},gr=function(n,t){return{op:n,right:t}},Ar=function(n,t){return{op:n,right:t}},mr=function(n,t,r){return{op:t,expr:r,location:Yo()}},Cr=function(n,t){return wa(n,t)},br=function(n,t,r){return{op:t,expr:r,location:Yo()}},Er=function(n,t){return wa(n,t)},Lr=function(n){return n.paren=!0,n},Tr=function(n){return/^CURRENT_DATE$/i.test(n)?{type:"current-time",location:Yo(),mode:"date"}:/^CURRENT_TIMESTAMP$/i.test(n)?{type:"current-time",location:Yo(),mode:"timestamp"}:/^CURRENT_TIME$/i.test(n)?{type:"current-time",location:Yo(),mode:"time"}:/^CURRENT_USER$/i.test(n)?{type:"current-user",location:Yo()}:{type:"column-reference",location:Yo(),table:"",column:n}},wr=function(n){return{type:"column-reference",location:Yo(),table:"",column:n,delimited:!0}},xr=function(n){return n},Nr=function(n,t){return n+t.join("")},Ir=function(n,t){return n+t.join("")},Rr=function(n){return n},Or=function(n){return n.join("")},Fr=function(){return'"'},Sr=function(n){return{type:"parameter",location:Yo(),value:n[1]}},Mr=function(n,t){return Ta(Yo(),n,t)},$r=function(n,t){return Ta(Yo(),n,t)},Ur=function(n){return{type:"function",location:Yo(),name:"extract",args:n}},_r=function(n,t,r){return Ta(Yo(),n,t,...r?[r]:[])},Dr=function(n,t,r){return Ta(Yo(),n,t,r)},Hr=function(n){return{type:"function",location:Yo(),name:"substring",args:n}},Pr=function(n,t){return Ta(Yo(),n,t)},jr=function(n,t){return Ta(Yo(),n,t)},Zr=function(n){return{type:"function",location:Yo(),name:"cast",args:n}},kr=function(){return{type:"data-type",location:Yo(),value:{type:"integer"}}},zr=function(){return{type:"data-type",location:Yo(),value:{type:"smallint"}}},Gr=function(){return{type:"data-type",location:Yo(),value:{type:"float"}}},Br=function(){return{type:"data-type",location:Yo(),value:{type:"real"}}},qr=function(){return{type:"data-type",location:Yo(),value:{type:"date"}}},Vr=function(){return{type:"data-type",location:Yo(),value:{type:"timestamp"}}},Wr=function(){return{type:"data-type",location:Yo(),value:{type:"time"}}},Yr=function(n){return{type:"data-type",location:Yo(),value:{type:"varchar",size:parseInt(n)}}},Kr=function(n,t,r){return Ta(Yo(),n,t,r)},Xr=function(n,t){return Ta(Yo(),n,t)},Jr=function(n){return{type:"function",location:Yo(),name:"trim",args:n}},Qr=function(n){return{type:"string",location:Yo(),value:n??"BOTH"}},ne=function(n,t){return Ta(Yo(),n,t)},te=function(n,t){return Ta(Yo(),n,t)},re=function(n){return{type:"function",location:Yo(),name:"position",args:n}},ee=function(n,t){return{type:"function",location:Yo(),name:n,args:t}},oe=function(n){return{type:"string",location:Yo(),value:n}},ue=function(n){return"string"===n.type&&xa(n.value),{type:"timestamp",location:Yo(),value:n.value}},ie=function(n){return"string"===n.type&&Na(n.value),{type:"time",location:Yo(),value:n.value}},ae=function(n,t,r){return{type:"interval",location:Yo(),value:t,qualifier:r,op:n}},ce=function(n,t){return{type:"interval",location:Yo(),value:n,qualifier:t,op:""}},se=function(n,t){return{type:"interval-qualifier",location:Yo(),start:n,end:t}},fe=function(n,t){return{type:"interval-period",location:Yo(),period:n.value,precision:t,secondary:null}},le=function(n){return{type:"interval-period",location:Yo(),period:n.value,precision:null,secondary:null}},pe=function(n){return{type:"interval-period",location:Yo(),period:n.value,precision:null,secondary:null}},ve=function(n,t){return{type:"interval-period",location:Yo(),period:"second",precision:n,secondary:t}},de=function(n){return{type:"interval-period",location:Yo(),period:"second",precision:n,secondary:null}},ye=function(){return{type:"interval-period",location:Yo(),period:"second",precision:null,secondary:null}},he=function(n,t){return{type:"interval-period",location:Yo(),period:n.value,precision:t,secondary:null}},ge=function(n){return{type:"interval-period",location:Yo(),period:n.value,precision:null,secondary:null}},Ae=function(n,t){return{type:"interval-period",location:Yo(),period:"second",precision:n,secondary:t}},me=function(n){return{type:"interval-period",location:Yo(),period:"second",precision:n,secondary:null}},Ce=function(){return{type:"interval-period",location:Yo(),period:"second",precision:null,secondary:null}},be=function(){return{type:"string",location:Yo(),value:"day"}},Ee=function(){return{type:"string",location:Yo(),value:"hour"}},Le=function(){return{type:"string",location:Yo(),value:"minute"}},Te=function(){return{type:"string",location:Yo(),value:"month"}},we=function(){return{type:"string",location:Yo(),value:"year"}},xe=function(n){return parseFloat(n)},Ne=function(n){return parseFloat(n)},Ie=function(n){return"string"===n.type&&Ia(n.value),{type:"date",location:Yo(),value:n.value}},Re=function(){return{type:"null",location:Yo(),value:null}},Oe=function(){return{type:"boolean",location:Yo(),value:!0}},Fe=function(){return{type:"boolean",location:Yo(),value:!1}},Se=function(){return"'"},Me=function(n){return{type:"string",location:Yo(),value:n.join("")}},$e=function(n,t){return{type:"case-expression",location:Yo(),format:"simple",operand:n,clauses:t,else:null,elseLocation:null}},Ue=function(n,t,r){return{type:"case-expression",location:Yo(),format:"simple",operand:n,clauses:t,else:r.value,elseLocation:r.location}},_e=function(n){return{type:"case-expression",location:Yo(),format:"searched",clauses:n,else:null,elseLocation:null}},De=function(n,t){return{type:"case-expression",location:Yo(),format:"searched",clauses:n,else:t.value,elseLocation:t.location}},He=function(n,t){return{type:"when-clause",location:Yo(),operand:n,value:t}},Pe=function(n,t){return{type:"when-clause",location:Yo(),operand:n,value:t}},je=function(n){return{type:"else-clause",location:Yo(),value:n}},Ze=function(n){return{type:"number",location:Yo(),value:n}},ke=function(n,t,r){return parseFloat(n+t+r)},ze=function(n,t){return parseFloat(n+t)},Ge=function(n,t){return parseFloat(n+t)},Be=function(n){return parseFloat(n)},qe=function(n,t){return n[0]+t},Ve=function(n){return"."+(null!=n?n:"")},We=function(n,t){return n+t},Ye=function(n){return n.join("")},Ke=function(n,t){return"e"+(null===t?"":t)},Xe=function(){return"IN"},Je=function(){return"IS"},Qe=function(){return"LIKE"},no=function(){return"ESCAPE"},to=function(){return"NOT"},ro=function(){return"AND"},eo=function(){return"OR"},oo=function(){return"BETWEEN"},uo=function(){return"FROM"},io=function(){return"FOR"},ao=function(){return"SUBSTRING"},co=function(){return"EXTRACT"},so=function(){return"TRIM"},fo=function(){return"POSITION"},lo=function(){return"TIMESTAMP"},po=function(){return"DATE"},vo=function(){return"TIME"},yo=function(){return"LEADING"},ho=function(){return"TRAILING"},go=function(){return"BOTH"},Ao=function(){return"CAST"},mo=function(){return"AS"},Co=function(){return"INTEGER"},bo=function(){return"INT"},Eo=function(){return"SMALLINT"},Lo=function(){return"FLOAT"},To=function(){return"REAL"},wo=function(){return"VARCHAR"},xo=function(){return"TO"},No=function(){return"INTERVAL"},Io=function(){return"YEAR"},Ro=function(){return"TIMEZONE_HOUR"},Oo=function(){return"TIMEZONE_MINUTE"},Fo=function(){return"MONTH"},So=function(){return"DAY"},Mo=function(){return"HOUR"},$o=function(){return"MINUTE"},Uo=function(){return"SECOND"},_o=function(){return"CASE"},Do=function(){return"END"},Ho=function(){return"WHEN"},Po=function(){return"THEN"},jo=function(){return"ELSE"},Zo=function(n){return n},ko=function(n){return n.join("")},zo=0|r.peg$currPos,Go=zo,Bo=[{line:1,column:1}],qo=zo,Vo=r.peg$maxFailExpected||[],Wo=0|r.peg$silentFails;if(r.startRule){if(!(r.startRule in i))throw new Error("Can't start parsing from rule \""+r.startRule+'".');a=i[r.startRule]}function Yo(){return tu(Go,zo)}function Ko(n,t){throw eu(n,t=void 0!==t?t:tu(Go,zo))}function Xo(n,t){return{type:"literal",text:n,ignoreCase:t}}function Jo(n,t,r){return{type:"class",parts:n,inverted:t,ignoreCase:r}}function Qo(){return{type:"end"}}function nu(t){var r,e=Bo[t];if(e)return e;if(t>=Bo.length)r=Bo.length-1;else for(r=t;!Bo[--r];);for(e={line:(e=Bo[r]).line,column:e.column};r<t;)10===n.charCodeAt(r)?(e.line++,e.column=1):e.column++,r++;return Bo[t]=e,e}function tu(n,t,r){var e=nu(n),o=nu(t);return{source:u,start:{offset:n,line:e.line,column:e.column},end:{offset:t,line:o.line,column:o.column}}}function ru(n){zo<qo||(zo>qo&&(qo=zo,Vo=[]),Vo.push(n))}function eu(n,r){return new t(n,null,null,r)}function ou(n,r,e){return new t(t.buildMessage(n,r),n,r,e)}function uu(){var n,t;return n=zo,ma(),(t=au())!==o?(ma(),Go=n,n=Xt(t)):(zo=n,n=o),n}function iu(){var n,t,r,e,u,i;if(n=zo,ga()!==o){for(ma(),t=[],r=au();r!==o;)t.push(r),r=zo,e=zo,u=ma(),(i=ha())!==o?e=u=[u,i,ma()]:(zo=e,e=o),e!==o&&(e=au())===o?(zo=r,r=o):r=e;r=ma(),(e=Aa())!==o?(Go=n,n=Jt(t)):(zo=n,n=o)}else zo=n,n=o;return n}function au(){var n,t,r,e,u,i;if(n=zo,(t=cu())!==o){for(r=[],e=zo,ma(),(u=Mi())!==o?(ma(),(i=cu())!==o?(Go=e,e=Qt(t,u,i)):(zo=e,e=o)):(zo=e,e=o);e!==o;)r.push(e),e=zo,ma(),(u=Mi())!==o?(ma(),(i=cu())!==o?(Go=e,e=Qt(t,u,i)):(zo=e,e=o)):(zo=e,e=o);Go=n,n=nr(t,r)}else zo=n,n=o;return n}function cu(){var n,t,r,e,u,i;if(n=zo,(t=su())!==o){for(r=[],e=zo,ma(),(u=Si())!==o?(ma(),(i=su())!==o?(Go=e,e=tr(t,u,i)):(zo=e,e=o)):(zo=e,e=o);e!==o;)r.push(e),e=zo,ma(),(u=Si())!==o?(ma(),(i=su())!==o?(Go=e,e=tr(t,u,i)):(zo=e,e=o)):(zo=e,e=o);Go=n,n=rr(t,r)}else zo=n,n=o;return n}function su(){var t,r,e,u,i;return t=zo,(r=Fi())===o&&(r=zo,33===n.charCodeAt(zo)?(e=c,zo++):(e=o,0===Wo&&ru(On)),e!==o?(u=zo,Wo++,61===n.charCodeAt(zo)?(i=s,zo++):(i=o,0===Wo&&ru(Fn)),Wo--,i===o?u=void 0:(zo=u,u=o),u!==o?r=e=[e,u]:(zo=r,r=o)):(zo=r,r=o)),r!==o?(e=ma(),(u=su())!==o?(Go=t,t=er(u)):(zo=t,t=o)):(zo=t,t=o),t===o&&(t=fu()),t}function fu(){var n,t,r,e;return n=zo,(t=Cu())!==o?(r=zo,ma(),(e=lu())!==o?r=e:(zo=r,r=o),r===o&&(r=null),Go=n,n=or(t,r)):(zo=n,n=o),n}function lu(){var n;return(n=pu())===o&&(n=mu())===o&&(n=yu())===o&&(n=du())===o&&(n=Au()),n}function pu(){var n,t,r,e,u;if(n=zo,t=[],r=zo,ma(),(e=vu())!==o?(ma(),(u=Cu())!==o?(Go=r,r=ur(e,u)):(zo=r,r=o)):(zo=r,r=o),r!==o)for(;r!==o;)t.push(r),r=zo,ma(),(e=vu())!==o?(ma(),(u=Cu())!==o?(Go=r,r=ur(e,u)):(zo=r,r=o)):(zo=r,r=o);else t=o;return t!==o&&(Go=n,t=ir(t)),n=t}function vu(){var t;return n.substr(zo,2)===f?(t=f,zo+=2):(t=o,0===Wo&&ru(Sn)),t===o&&(62===n.charCodeAt(zo)?(t=l,zo++):(t=o,0===Wo&&ru(Mn)),t===o&&(n.substr(zo,2)===p?(t=p,zo+=2):(t=o,0===Wo&&ru($n)),t===o&&(n.substr(zo,2)===v?(t=v,zo+=2):(t=o,0===Wo&&ru(Un)),t===o&&(t=n.charAt(zo),An.test(t)?zo++:(t=o,0===Wo&&ru(_n)),t===o&&(n.substr(zo,2)===d?(t=d,zo+=2):(t=o,0===Wo&&ru(Dn))))))),t}function du(){var n,t,r,e;return n=zo,(t=Ii())!==o?(ma(),(r=Fi())!==o?(ma(),(e=Cu())!==o?(Go=n,n=ar(t,e)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o),n===o&&(n=zo,(t=Ii())!==o?(ma(),(r=Cu())!==o?(Go=n,n=cr(t,r)):(zo=n,n=o)):(zo=n,n=o)),n}function yu(){var n,t,r,e,u,i,a,c;return n=zo,(t=Fi())!==o?(ma(),(r=$i())!==o?(e=ma(),u=zo,(i=Cu())!==o?(ma(),(a=Si())!==o?(ma(),(c=Cu())!==o?(Go=u,u=sr(r,i,c)):(zo=u,u=o)):(zo=u,u=o)):(zo=u,u=o),u!==o?(Go=n,n=fr(r,u)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o),n===o&&(n=zo,(t=$i())!==o?(ma(),r=zo,(e=Cu())!==o?(u=ma(),(i=Si())!==o?(ma(),(a=Cu())!==o?(Go=r,r=lr(t,e,a)):(zo=r,r=o)):(zo=r,r=o)):(zo=r,r=o),r!==o?(Go=n,n=pr(t,r)):(zo=n,n=o)):(zo=n,n=o)),n}function hu(){var n,t,r,e,u;return n=zo,t=zo,(r=Fi())!==o?(e=ma(),(u=Ri())!==o?t=r=[r,e,u]:(zo=t,t=o)):(zo=t,t=o),t!==o&&(Go=n,t=vr(t)),(n=t)===o&&(n=Ri()),n}function gu(){var n,t,r,e,u;return n=zo,t=zo,(r=Fi())!==o?(e=ma(),(u=Ni())!==o?t=r=[r,e,u]:(zo=t,t=o)):(zo=t,t=o),t!==o&&(Go=n,t=dr(t)),(n=t)===o&&(n=Ni()),n}function Au(){var n,t,r,e;return n=zo,(t=hu())!==o?(ma(),(r=ci())!==o?(ma(),Oi()!==o?(ma(),(e=si())!==o?(Go=n,n=yr(t,r,e)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o),n===o&&(n=zo,(t=hu())!==o?(ma(),(r=ci())!==o?(Go=n,n=hr(t,r)):(zo=n,n=o)):(zo=n,n=o)),n}function mu(){var n,t,r;return n=zo,(t=gu())!==o?(ma(),(r=iu())!==o?(Go=n,n=gr(t,r)):(zo=n,n=o)):(zo=n,n=o),n===o&&(n=zo,(t=gu())!==o?(ma(),(r=Hu())!==o?(Go=n,n=Ar(t,r)):(zo=n,n=o)):(zo=n,n=o)),n}function Cu(){var n,t,r,e,u,i;if(n=zo,(t=Eu())!==o){for(r=[],e=zo,ma(),(u=bu())!==o?(ma(),(i=Eu())!==o?(Go=e,e=mr(t,u,i)):(zo=e,e=o)):(zo=e,e=o);e!==o;)r.push(e),e=zo,ma(),(u=bu())!==o?(ma(),(i=Eu())!==o?(Go=e,e=mr(t,u,i)):(zo=e,e=o)):(zo=e,e=o);Go=n,n=Cr(t,r)}else zo=n,n=o;return n}function bu(){var t;return t=n.charAt(zo),mn.test(t)?zo++:(t=o,0===Wo&&ru(Hn)),t===o&&(n.substr(zo,2)===y?(t=y,zo+=2):(t=o,0===Wo&&ru(Pn))),t}function Eu(){var n,t,r,e,u,i;if(n=zo,(t=Tu())!==o){for(r=[],e=zo,ma(),(u=Lu())!==o?(ma(),(i=Tu())!==o?(Go=e,e=br(t,u,i)):(zo=e,e=o)):(zo=e,e=o);e!==o;)r.push(e),e=zo,ma(),(u=Lu())!==o?(ma(),(i=Tu())!==o?(Go=e,e=br(t,u,i)):(zo=e,e=o)):(zo=e,e=o);Go=n,n=Er(t,r)}else zo=n,n=o;return n}function Lu(){var t;return t=n.charAt(zo),Cn.test(t)?zo++:(t=o,0===Wo&&ru(jn)),t}function Tu(){var n,t;return(n=Wu())===o&&(n=Pu())===o&&(n=ju())===o&&(n=zu())===o&&(n=Bu())===o&&(n=Zu())===o&&(n=qu())===o&&(n=fi())===o&&(n=wu())===o&&(n=Hu())===o&&(n=zo,ga()!==o?(ma(),(t=au())!==o?(ma(),Aa()!==o?(Go=n,n=Lr(t)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)),n}function wu(){var n,t;return n=zo,(t=xu())!==o&&(Go=n,t=Tr(t)),(n=t)===o&&(n=zo,(t=Su())!==o&&(Go=n,t=wr(t)),n=t),n}function xu(){var n,t;return n=zo,(t=Nu())!==o&&(Go=n,t=xr(t)),n=t}function Nu(){var n,t,r,e;if(n=zo,(t=Ru())!==o){for(r=[],e=Fu();e!==o;)r.push(e),e=Fu();Go=n,n=Nr(t,r)}else zo=n,n=o;return n}function Iu(){var n,t,r,e;if(n=zo,(t=Ru())!==o){for(r=[],e=Ou();e!==o;)r.push(e),e=Ou();Go=n,n=Ir(t,r)}else zo=n,n=o;return n}function Ru(){var t;return t=n.charAt(zo),bn.test(t)?zo++:(t=o,0===Wo&&ru(Zn)),t}function Ou(){var t;return t=n.charAt(zo),En.test(t)?zo++:(t=o,0===Wo&&ru(kn)),t}function Fu(){var t;return t=n.charAt(zo),Ln.test(t)?zo++:(t=o,0===Wo&&ru(zn)),t}function Su(){var n,t;return n=zo,Du()!==o?(t=Mu(),Du()!==o?(Go=n,n=Rr(t)):(zo=n,n=o)):(zo=n,n=o),n}function Mu(){var n,t,r;for(n=zo,t=[],r=$u();r!==o;)t.push(r),r=$u();return Go=n,n=t=Or(t)}function $u(){var n;return(n=_u())===o&&(n=Uu()),n}function Uu(){var n;return n=zo,Du()!==o&&Du()!==o?(Go=n,n=Fr()):(zo=n,n=o),n}function _u(){var t;return t=n.charAt(zo),Ln.test(t)?zo++:(t=o,0===Wo&&ru(zn)),t}function Du(){var t;return t=n.charAt(zo),Tn.test(t)?zo++:(t=o,0===Wo&&ru(Gn)),t}function Hu(){var t,r,e,u;return t=zo,r=zo,64===n.charCodeAt(zo)?(e=h,zo++):(e=o,0===Wo&&ru(Bn)),e!==o&&(u=Iu())!==o?r=e=[e,u]:(zo=r,r=o),r!==o&&(Go=t,r=Sr(r)),t=r}function Pu(){var n,t,r,e;return n=zo,Hi()!==o?(ma(),t=zo,ga()!==o?(ma(),(r=Vu())!==o?(ma(),Ui()!==o?(ma(),(e=au())!==o?(ma(),Aa()!==o?(Go=t,t=Mr(r,e)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o),t===o&&(t=zo,ga()!==o?(ma(),(r=Vu())!==o?(ma(),ha()!==o?(ma(),(e=au())!==o?(ma(),Aa()!==o?(Go=t,t=$r(r,e)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)),t!==o?(Go=n,n=Ur(t)):(zo=n,n=o)):(zo=n,n=o),n}function ju(){var n,t,r,e,u,i,a;return n=zo,Di()!==o?(ma(),t=zo,ga()!==o?(ma(),(r=au())!==o?(ma(),Ui()!==o?(ma(),(e=au())!==o?(ma(),u=zo,_i()!==o?(i=ma(),(a=au())!==o?(ma(),u=a):(zo=u,u=o)):(zo=u,u=o),u===o&&(u=null),Aa()!==o?(Go=t,t=_r(r,e,u)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o),t===o&&(t=zo,ga()!==o?(ma(),(r=au())!==o?(ma(),ha()!==o?(ma(),(e=au())!==o?(ma(),(u=ha())!==o?(ma(),(i=au())!==o&&(a=Aa())!==o?(Go=t,t=Dr(r,e,i)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)),t!==o?(Go=n,n=Hr(t)):(zo=n,n=o)):(zo=n,n=o),n}function Zu(){var n,t,r,e;return n=zo,Vi()!==o?(ma(),t=zo,ga()!==o?(ma(),(r=au())!==o?(ma(),Wi()!==o?(ma(),(e=ku())!==o?(ma(),Aa()!==o?(Go=t,t=Pr(r,e)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o),t===o&&(t=zo,ga()!==o?(ma(),(r=au())!==o?(ma(),ha()!==o?(ma(),(e=ku())!==o?(ma(),Aa()!==o?(Go=t,t=jr(r,e)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)),t!==o?(Go=n,n=Zr(t)):(zo=n,n=o)):(zo=n,n=o),n}function ku(){var n,t,r;return n=zo,(t=Yi())===o&&(t=Ki()),t!==o&&(Go=n,t=kr()),(n=t)===o&&(n=zo,(t=Xi())!==o&&(Go=n,t=zr()),(n=t)===o&&(n=zo,(t=Ji())!==o&&(Go=n,t=Gr()),(n=t)===o&&(n=zo,(t=Qi())!==o&&(Go=n,t=Br()),(n=t)===o&&(n=zo,(t=ki())!==o&&(Go=n,t=qr()),(n=t)===o&&(n=zo,(t=Zi())!==o&&(Go=n,t=Vr()),(n=t)===o&&(n=zo,(t=zi())!==o&&(Go=n,t=Wr()),(n=t)===o&&(n=zo,(t=na())!==o?(ma(),ga()!==o?(ma(),(r=bi())!==o?(ma(),Aa()!==o?(Go=n,n=Yr(r)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)))))))),n}function zu(){var n,t,r,e,u;return n=zo,Pi()!==o?(ma(),t=zo,ga()!==o?(ma(),r=Gu(),ma(),(e=au())!==o?(ma(),Ui()!==o?(ma(),(u=au())!==o?(ma(),Aa()!==o?(Go=t,t=Kr(r,e,u)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o),t===o&&(t=zo,ga()!==o?(ma(),r=Gu(),ma(),(e=au())!==o?(ma(),Aa()!==o?(Go=t,t=Xr(r,e)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)),t!==o?(Go=n,n=Jr(t)):(zo=n,n=o)):(zo=n,n=o),n}function Gu(){var n,t;return n=zo,(t=Gi())===o&&(t=Bi())===o&&(t=qi()),t===o&&(t=null),Go=n,n=t=Qr(t)}function Bu(){var n,t,r,e;return n=zo,ji()!==o?(ma(),t=zo,ga()!==o?(ma(),(r=au())!==o?(ma(),Ni()!==o?(ma(),(e=au())!==o?(ma(),Aa()!==o?(Go=t,t=ne(r,e)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o),t===o&&(t=zo,ga()!==o?(ma(),(r=au())!==o?(ma(),ha()!==o?(ma(),(e=au())!==o?(ma(),Aa()!==o?(Go=t,t=te(r,e)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)),t!==o?(Go=n,n=re(t)):(zo=n,n=o)):(zo=n,n=o),n}function qu(){var n,t,r,e;return n=zo,t=zo,Wo++,r=Hi(),Wo--,r===o?t=void 0:(zo=t,t=o),t!==o&&(r=ba())!==o?(ma(),(e=iu())!==o?(Go=n,n=ee(r,e)):(zo=n,n=o)):(zo=n,n=o),n}function Vu(){var n,t;return n=zo,(t=ea())===o&&(t=ia())===o&&(t=aa())===o&&(t=ca())===o&&(t=sa())===o&&(t=fa())===o&&(t=oa())===o&&(t=ua()),t!==o&&(Go=n,t=oe(t)),n=t}function Wu(){var n;return(n=si())===o&&(n=hi())===o&&(n=ai())===o&&(n=ii())===o&&(n=ui())===o&&(n=Yu())===o&&(n=Xu())===o&&(n=Ku()),n}function Yu(){var n,t;return n=zo,Zi()!==o?(ma(),(t=ci())!==o?(Go=n,n=ue(t)):(zo=n,n=o)):(zo=n,n=o),n}function Ku(){var n,t;return n=zo,zi()!==o?(ma(),(t=ci())!==o?(Go=n,n=ie(t)):(zo=n,n=o)):(zo=n,n=o),n}function Xu(){var t,r,e,u;return t=zo,ra()!==o?(ma(),r=n.charAt(zo),mn.test(r)?zo++:(r=o,0===Wo&&ru(Hn)),r!==o?(ma(),(e=ci())!==o?(ma(),(u=Ju())!==o?(Go=t,t=ae(r,e,u)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o),t===o&&(t=zo,ra()!==o?(ma(),(r=ci())!==o?(ma(),(e=Ju())!==o?(Go=t,t=ce(r,e)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)),t}function Ju(){var n,t,r;return n=zo,(t=Qu())!==o?(ma(),ta()!==o?(ma(),(r=ni())!==o?(Go=n,n=se(t,r)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o),n===o&&(n=ti()),n}function Qu(){var n,t,r;return n=zo,(t=ri())!==o?(ma(),ga()!==o?(ma(),(r=oi())!==o?(ma(),Aa()!==o?(Go=n,n=fe(t,r)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o),n===o&&(n=zo,(t=ri())!==o&&(Go=n,t=le(t)),n=t),n}function ni(){var n,t,r,e;return n=zo,(t=ri())!==o&&(Go=n,t=pe(t)),(n=t)===o&&(n=zo,(t=fa())!==o?(ma(),ga()!==o?(ma(),(r=oi())!==o?(ma(),ha()!==o?(ma(),(e=ei())!==o?(ma(),Aa()!==o?(Go=n,n=ve(r,e)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o),n===o&&(n=zo,(t=fa())!==o?(ma(),ga()!==o?(ma(),(r=oi())!==o?(ma(),Aa()!==o?(Go=n,n=de(r)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o),n===o&&(n=zo,(t=fa())!==o&&(Go=n,t=ye()),n=t))),n}function ti(){var n,t,r,e;return n=zo,(t=ri())!==o?(ma(),ga()!==o?(ma(),(r=ei())!==o?(ma(),Aa()!==o?(Go=n,n=he(t,r)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o),n===o&&(n=zo,(t=ri())!==o&&(Go=n,t=ge(t)),(n=t)===o&&(n=zo,(t=fa())!==o?(ma(),ga()!==o?(ma(),(r=oi())!==o?(ma(),ha()!==o?(ma(),(e=ei())!==o?(ma(),Aa()!==o?(Go=n,n=Ae(r,e)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o),n===o&&(n=zo,(t=fa())!==o?(ma(),ga()!==o?(ma(),(r=ei())!==o?(ma(),Aa()!==o?(Go=n,n=me(r)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o),n===o&&(n=zo,(t=fa())!==o&&(Go=n,t=Ce()),n=t)))),n}function ri(){var n,t;return n=zo,(t=aa())!==o&&(Go=n,t=be()),(n=t)===o&&(n=zo,(t=ca())!==o&&(Go=n,t=Ee()),(n=t)===o&&(n=zo,(t=sa())!==o&&(Go=n,t=Le()),(n=t)===o&&(n=zo,(t=ia())!==o&&(Go=n,t=Te()),(n=t)===o&&(n=zo,(t=ea())!==o&&(Go=n,t=we()),n=t)))),n}function ei(){var n,t;return n=zo,(t=bi())!==o&&(Go=n,t=xe(t)),n=t}function oi(){var n,t;return n=zo,(t=bi())!==o&&(Go=n,t=Ne(t)),n=t}function ui(){var n,t;return n=zo,ki()!==o?(ma(),(t=ci())!==o?(Go=n,n=Ie(t)):(zo=n,n=o)):(zo=n,n=o),n}function ii(){var n,t;return n=zo,(t=Ti())!==o&&(Go=n,t=Re()),n=t}function ai(){var n,t;return n=zo,(t=wi())!==o&&(Go=n,t=Oe()),(n=t)===o&&(n=zo,(t=xi())!==o&&(Go=n,t=Fe()),n=t),n}function ci(){var n;return(n=si())===o&&(n=Hu()),n}function si(){var t,r,e,u,i;if(t=zo,39===n.charCodeAt(zo)?(r=g,zo++):(r=o,0===Wo&&ru(qn)),r===o&&(n.substr(zo,2)===A?(r=A,zo+=2):(r=o,0===Wo&&ru(Vn))),r!==o){for(e=[],u=zo,n.substr(zo,2)===m?(i=m,zo+=2):(i=o,0===Wo&&ru(Wn)),i!==o&&(Go=u,i=Se()),(u=i)===o&&(u=n.charAt(zo),wn.test(u)?zo++:(u=o,0===Wo&&ru(Yn)));u!==o;)e.push(u),u=zo,n.substr(zo,2)===m?(i=m,zo+=2):(i=o,0===Wo&&ru(Wn)),i!==o&&(Go=u,i=Se()),(u=i)===o&&(u=n.charAt(zo),wn.test(u)?zo++:(u=o,0===Wo&&ru(Yn)));39===n.charCodeAt(zo)?(u=g,zo++):(u=o,0===Wo&&ru(qn)),u!==o?(Go=t,t=Me(e)):(zo=t,t=o)}else zo=t,t=o;return t}function fi(){var n;return(n=li())===o&&(n=pi()),n}function li(){var n,t,r,e,u;if(n=zo,la()!==o)if(ma(),(t=au())!==o){for(ma(),r=[],e=zo,(u=di())!==o?(ma(),e=u):(zo=e,e=o);e!==o;)r.push(e),e=zo,(u=di())!==o?(ma(),e=u):(zo=e,e=o);(e=pa())!==o?(Go=n,n=$e(t,r)):(zo=n,n=o)}else zo=n,n=o;else zo=n,n=o;if(n===o)if(n=zo,la()!==o)if(ma(),(t=au())!==o){for(ma(),r=[],e=zo,(u=di())!==o?(ma(),e=u):(zo=e,e=o);e!==o;)r.push(e),e=zo,(u=di())!==o?(ma(),e=u):(zo=e,e=o);(e=yi())!==o?(u=ma(),pa()!==o?(Go=n,n=Ue(t,r,e)):(zo=n,n=o)):(zo=n,n=o)}else zo=n,n=o;else zo=n,n=o;return n}function pi(){var n,t,r,e;if(n=zo,la()!==o){for(ma(),t=[],r=zo,(e=vi())!==o?(ma(),r=e):(zo=r,r=o);r!==o;)t.push(r),r=zo,(e=vi())!==o?(ma(),r=e):(zo=r,r=o);(r=pa())!==o?(Go=n,n=_e(t)):(zo=n,n=o)}else zo=n,n=o;if(n===o)if(n=zo,la()!==o){for(ma(),t=[],r=zo,(e=vi())!==o?(ma(),r=e):(zo=r,r=o);r!==o;)t.push(r),r=zo,(e=vi())!==o?(ma(),r=e):(zo=r,r=o);(r=yi())!==o?(e=ma(),pa()!==o?(Go=n,n=De(t,r)):(zo=n,n=o)):(zo=n,n=o)}else zo=n,n=o;return n}function vi(){var n,t,r;return n=zo,va()!==o?(ma(),(t=au())!==o?(ma(),da()!==o?(ma(),(r=au())!==o?(Go=n,n=He(t,r)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o),n}function di(){var n,t,r;return n=zo,va()!==o?(ma(),(t=au())!==o?(ma(),da()!==o?(ma(),(r=au())!==o?(Go=n,n=Pe(t,r)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o),n}function yi(){var n,t;return n=zo,ya()!==o?(ma(),(t=au())!==o?(Go=n,n=je(t)):(zo=n,n=o)):(zo=n,n=o),n}function hi(){var n,t,r,e;return n=zo,(t=gi())!==o?(r=zo,Wo++,e=Ru(),Wo--,e===o?r=void 0:(zo=r,r=o),r!==o?(Go=n,n=Ze(t)):(zo=n,n=o)):(zo=n,n=o),n}function gi(){var n,t,r,e;return n=zo,(t=Ai())!==o&&(r=mi())!==o&&(e=Ci())!==o?(Go=n,n=ke(t,r,e)):(zo=n,n=o),n===o&&(n=zo,(t=Ai())!==o&&(r=mi())!==o?(Go=n,n=ze(t,r)):(zo=n,n=o),n===o&&(n=zo,(t=Ai())!==o&&(r=Ci())!==o?(Go=n,n=Ge(t,r)):(zo=n,n=o),n===o&&(n=zo,(t=Ai())!==o&&(Go=n,t=Be(t)),n=t))),n}function Ai(){var t,r,e;return(t=bi())===o&&(t=zo,r=n.charAt(zo),mn.test(r)?zo++:(r=o,0===Wo&&ru(Hn)),r!==o&&(e=bi())!==o?(Go=t,t=qe(r,e)):(zo=t,t=o)),t}function mi(){var t,r,e;return t=zo,46===n.charCodeAt(zo)?(r=C,zo++):(r=o,0===Wo&&ru(Kn)),r!==o?((e=bi())===o&&(e=null),Go=t,t=Ve(e)):(zo=t,t=o),t}function Ci(){var n,t,r;return n=zo,(t=Li())!==o&&(r=bi())!==o?(Go=n,n=We(t,r)):(zo=n,n=o),n}function bi(){var n,t,r;if(n=zo,t=[],(r=Ei())!==o)for(;r!==o;)t.push(r),r=Ei();else t=o;return t!==o&&(Go=n,t=Ye(t)),n=t}function Ei(){var t;return t=n.charAt(zo),xn.test(t)?zo++:(t=o,0===Wo&&ru(Xn)),t}function Li(){var t,r,e;return t=zo,r=n.charAt(zo),Nn.test(r)?zo++:(r=o,0===Wo&&ru(Jn)),r!==o?(e=n.charAt(zo),mn.test(e)?zo++:(e=o,0===Wo&&ru(Hn)),e===o&&(e=null),Go=t,t=Ke(r,e)):(zo=t,t=o),t}function Ti(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===b?zo+=4:(r=o,0===Wo&&ru(Qn)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?t=r=[r,e]:(zo=t,t=o)):(zo=t,t=o),t}function wi(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===E?zo+=4:(r=o,0===Wo&&ru(nt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?t=r=[r,e]:(zo=t,t=o)):(zo=t,t=o),t}function xi(){var t,r,e,u;return t=zo,(r=n.substr(zo,5)).toLowerCase()===L?zo+=5:(r=o,0===Wo&&ru(tt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?t=r=[r,e]:(zo=t,t=o)):(zo=t,t=o),t}function Ni(){var t,r,e,u;return t=zo,(r=n.substr(zo,2)).toLowerCase()===T?zo+=2:(r=o,0===Wo&&ru(rt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Xe()):(zo=t,t=o)):(zo=t,t=o),t}function Ii(){var t,r,e,u;return t=zo,(r=n.substr(zo,2)).toLowerCase()===w?zo+=2:(r=o,0===Wo&&ru(et)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Je()):(zo=t,t=o)):(zo=t,t=o),t}function Ri(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===x?zo+=4:(r=o,0===Wo&&ru(ot)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Qe()):(zo=t,t=o)):(zo=t,t=o),t}function Oi(){var t,r,e,u;return t=zo,(r=n.substr(zo,6)).toLowerCase()===N?zo+=6:(r=o,0===Wo&&ru(ut)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=no()):(zo=t,t=o)):(zo=t,t=o),t}function Fi(){var t,r,e,u;return t=zo,(r=n.substr(zo,3)).toLowerCase()===I?zo+=3:(r=o,0===Wo&&ru(it)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=to()):(zo=t,t=o)):(zo=t,t=o),t}function Si(){var t,r,e,u;return t=zo,(r=n.substr(zo,3)).toLowerCase()===R?zo+=3:(r=o,0===Wo&&ru(at)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=ro()):(zo=t,t=o)):(zo=t,t=o),t}function Mi(){var t,r,e,u;return t=zo,(r=n.substr(zo,2)).toLowerCase()===O?zo+=2:(r=o,0===Wo&&ru(ct)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=eo()):(zo=t,t=o)):(zo=t,t=o),t}function $i(){var t,r,e,u;return t=zo,(r=n.substr(zo,7)).toLowerCase()===F?zo+=7:(r=o,0===Wo&&ru(st)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=oo()):(zo=t,t=o)):(zo=t,t=o),t}function Ui(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===S?zo+=4:(r=o,0===Wo&&ru(ft)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=uo()):(zo=t,t=o)):(zo=t,t=o),t}function _i(){var t,r,e,u;return t=zo,(r=n.substr(zo,3)).toLowerCase()===M?zo+=3:(r=o,0===Wo&&ru(lt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=io()):(zo=t,t=o)):(zo=t,t=o),t}function Di(){var t,r,e,u;return t=zo,(r=n.substr(zo,9)).toLowerCase()===$?zo+=9:(r=o,0===Wo&&ru(pt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=ao()):(zo=t,t=o)):(zo=t,t=o),t}function Hi(){var t,r,e,u;return t=zo,(r=n.substr(zo,7)).toLowerCase()===U?zo+=7:(r=o,0===Wo&&ru(vt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=co()):(zo=t,t=o)):(zo=t,t=o),t}function Pi(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===_?zo+=4:(r=o,0===Wo&&ru(dt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=so()):(zo=t,t=o)):(zo=t,t=o),t}function ji(){var t,r,e,u;return t=zo,(r=n.substr(zo,8)).toLowerCase()===D?zo+=8:(r=o,0===Wo&&ru(yt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=fo()):(zo=t,t=o)):(zo=t,t=o),t}function Zi(){var t,r,e,u;return t=zo,(r=n.substr(zo,9)).toLowerCase()===H?zo+=9:(r=o,0===Wo&&ru(ht)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=lo()):(zo=t,t=o)):(zo=t,t=o),t}function ki(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===P?zo+=4:(r=o,0===Wo&&ru(gt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=po()):(zo=t,t=o)):(zo=t,t=o),t}function zi(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===j?zo+=4:(r=o,0===Wo&&ru(At)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=vo()):(zo=t,t=o)):(zo=t,t=o),t}function Gi(){var t,r,e,u;return t=zo,(r=n.substr(zo,7)).toLowerCase()===Z?zo+=7:(r=o,0===Wo&&ru(mt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=yo()):(zo=t,t=o)):(zo=t,t=o),t}function Bi(){var t,r,e,u;return t=zo,(r=n.substr(zo,8)).toLowerCase()===k?zo+=8:(r=o,0===Wo&&ru(Ct)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=ho()):(zo=t,t=o)):(zo=t,t=o),t}function qi(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===z?zo+=4:(r=o,0===Wo&&ru(bt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=go()):(zo=t,t=o)):(zo=t,t=o),t}function Vi(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===G?zo+=4:(r=o,0===Wo&&ru(Et)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Ao()):(zo=t,t=o)):(zo=t,t=o),t}function Wi(){var t,r,e,u;return t=zo,(r=n.substr(zo,2)).toLowerCase()===B?zo+=2:(r=o,0===Wo&&ru(Lt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=mo()):(zo=t,t=o)):(zo=t,t=o),t}function Yi(){var t,r,e,u;return t=zo,(r=n.substr(zo,7)).toLowerCase()===q?zo+=7:(r=o,0===Wo&&ru(Tt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Co()):(zo=t,t=o)):(zo=t,t=o),t}function Ki(){var t,r,e,u;return t=zo,(r=n.substr(zo,3)).toLowerCase()===V?zo+=3:(r=o,0===Wo&&ru(wt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=bo()):(zo=t,t=o)):(zo=t,t=o),t}function Xi(){var t,r,e,u;return t=zo,(r=n.substr(zo,8)).toLowerCase()===W?zo+=8:(r=o,0===Wo&&ru(xt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Eo()):(zo=t,t=o)):(zo=t,t=o),t}function Ji(){var t,r,e,u;return t=zo,(r=n.substr(zo,5)).toLowerCase()===Y?zo+=5:(r=o,0===Wo&&ru(Nt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Lo()):(zo=t,t=o)):(zo=t,t=o),t}function Qi(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===K?zo+=4:(r=o,0===Wo&&ru(It)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=To()):(zo=t,t=o)):(zo=t,t=o),t}function na(){var t,r,e,u;return t=zo,(r=n.substr(zo,7)).toLowerCase()===X?zo+=7:(r=o,0===Wo&&ru(Rt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=wo()):(zo=t,t=o)):(zo=t,t=o),t}function ta(){var t,r,e,u;return t=zo,(r=n.substr(zo,2)).toLowerCase()===J?zo+=2:(r=o,0===Wo&&ru(Ot)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=xo()):(zo=t,t=o)):(zo=t,t=o),t}function ra(){var t,r,e,u;return t=zo,(r=n.substr(zo,8)).toLowerCase()===Q?zo+=8:(r=o,0===Wo&&ru(Ft)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=No()):(zo=t,t=o)):(zo=t,t=o),t}function ea(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===nn?zo+=4:(r=o,0===Wo&&ru(St)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Io()):(zo=t,t=o)):(zo=t,t=o),t}function oa(){var t,r,e,u;return t=zo,(r=n.substr(zo,13)).toLowerCase()===tn?zo+=13:(r=o,0===Wo&&ru(Mt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Ro()):(zo=t,t=o)):(zo=t,t=o),t}function ua(){var t,r,e,u;return t=zo,(r=n.substr(zo,15)).toLowerCase()===rn?zo+=15:(r=o,0===Wo&&ru($t)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Oo()):(zo=t,t=o)):(zo=t,t=o),t}function ia(){var t,r,e,u;return t=zo,(r=n.substr(zo,5)).toLowerCase()===en?zo+=5:(r=o,0===Wo&&ru(Ut)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Fo()):(zo=t,t=o)):(zo=t,t=o),t}function aa(){var t,r,e,u;return t=zo,(r=n.substr(zo,3)).toLowerCase()===on?zo+=3:(r=o,0===Wo&&ru(_t)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=So()):(zo=t,t=o)):(zo=t,t=o),t}function ca(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===un?zo+=4:(r=o,0===Wo&&ru(Dt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Mo()):(zo=t,t=o)):(zo=t,t=o),t}function sa(){var t,r,e,u;return t=zo,(r=n.substr(zo,6)).toLowerCase()===an?zo+=6:(r=o,0===Wo&&ru(Ht)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=$o()):(zo=t,t=o)):(zo=t,t=o),t}function fa(){var t,r,e,u;return t=zo,(r=n.substr(zo,6)).toLowerCase()===cn?zo+=6:(r=o,0===Wo&&ru(Pt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Uo()):(zo=t,t=o)):(zo=t,t=o),t}function la(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===sn?zo+=4:(r=o,0===Wo&&ru(jt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=_o()):(zo=t,t=o)):(zo=t,t=o),t}function pa(){var t,r,e,u;return t=zo,(r=n.substr(zo,3)).toLowerCase()===fn?zo+=3:(r=o,0===Wo&&ru(Zt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Do()):(zo=t,t=o)):(zo=t,t=o),t}function va(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===ln?zo+=4:(r=o,0===Wo&&ru(kt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Ho()):(zo=t,t=o)):(zo=t,t=o),t}function da(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===pn?zo+=4:(r=o,0===Wo&&ru(zt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Po()):(zo=t,t=o)):(zo=t,t=o),t}function ya(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===vn?zo+=4:(r=o,0===Wo&&ru(Gt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=jo()):(zo=t,t=o)):(zo=t,t=o),t}function ha(){var t;return 44===n.charCodeAt(zo)?(t=dn,zo++):(t=o,0===Wo&&ru(Bt)),t}function ga(){var t;return 40===n.charCodeAt(zo)?(t=yn,zo++):(t=o,0===Wo&&ru(qt)),t}function Aa(){var t;return 41===n.charCodeAt(zo)?(t=hn,zo++):(t=o,0===Wo&&ru(Vt)),t}function ma(){var n,t;for(n=[],t=Ca();t!==o;)n.push(t),t=Ca();return n}function Ca(){var t;return t=n.charAt(zo),In.test(t)?zo++:(t=o,0===Wo&&ru(Wt)),t}function ba(){var t,r,e,u;if(t=zo,(r=Iu())!==o&&(Go=t,r=Zo(r)),(t=r)===o)if(t=zo,96===n.charCodeAt(zo)?(r=gn,zo++):(r=o,0===Wo&&ru(Yt)),r!==o){if(e=[],u=n.charAt(zo),Rn.test(u)?zo++:(u=o,0===Wo&&ru(Kt)),u!==o)for(;u!==o;)e.push(u),u=n.charAt(zo),Rn.test(u)?zo++:(u=o,0===Wo&&ru(Kt));else e=o;e!==o?(96===n.charCodeAt(zo)?(u=gn,zo++):(u=o,0===Wo&&ru(Yt)),u!==o?(Go=t,t=ko(e)):(zo=t,t=o)):(zo=t,t=o)}else zo=t,t=o;return t}function Ea(n,t,r){return{type:"unary-expression",location:r,operator:n,expr:t}}function La(n,t,r,e,o){const u={type:"binary-expression",location:o,operator:n,left:t,right:r};return void 0!==e&&(u.escape=e),u}function Ta(n,...t){return{type:"expression-list",location:n,value:t}}function wa(n,t){let r=n;for(const{op:e,expr:o,location:{end:u}}of t)r=La(e,r,o,void 0,{...r.location,end:u});return r}function xa(n){!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(n)&&Ko("Timestamp literal is invalid")}function Na(n){!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(n)&&Ko("Time literal is invalid")}function Ia(n){!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(n)&&Ko("Date literal is invalid")}if(e=a(),r.peg$library)return{peg$result:e,peg$currPos:zo,peg$FAILED:o,peg$maxFailExpected:Vo,peg$maxFailPos:qo};if(e!==o&&zo===n.length)return e;throw e!==o&&zo<n.length&&ru(Qo()),ou(Vo,qo<n.length?n.charAt(qo):null,qo<n.length?tu(qo,qo+1):tu(qo,qo))}n(t,Error),t.prototype.format=function(n){var t="Error: "+this.message;if(this.location){var e,o=null;for(e=0;e<n.length;e++)if(n[e].source===this.location.source){o=n[e].text.split(/\r\n|\n|\r/g);break}var u=this.location.start,i=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(u):u,a=this.location.source+":"+i.line+":"+i.column;if(o){var c=this.location.end,s=r("",i.line.toString().length," "),f=o[u.line-1],l=(u.line===c.line?c.column:f.length+1)-u.column||1;t+="\n --\x3e "+a+"\n"+s+" |\n"+i.line+" | "+f+"\n"+s+" | "+r("",u.column-1," ")+r("",l,"^")}else t+="\n at "+a}return t},t.buildMessage=function(n,t){var r={literal:function(n){return'"'+o(n.text)+'"'},class:function(n){var t=n.parts.map((function(n){return Array.isArray(n)?u(n[0])+"-"+u(n[1]):u(n)}));return"["+(n.inverted?"^":"")+t.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(n){return n.description}};function e(n){return n.charCodeAt(0).toString(16).toUpperCase()}function o(n){return n.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(n){return"\\x0"+e(n)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(n){return"\\x"+e(n)}))}function u(n){return n.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,(function(n){return"\\x0"+e(n)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(n){return"\\x"+e(n)}))}function i(n){return r[n.type](n)}function a(n){var t,r,e=n.map(i);if(e.sort(),e.length>0){for(t=1,r=1;t<e.length;t++)e[t-1]!==e[t]&&(e[r]=e[t],r++);e.length=r}switch(e.length){case 1:return e[0];case 2:return e[0]+" or "+e[1];default:return e.slice(0,-1).join(", ")+", or "+e[e.length-1]}}function c(n){return n?'"'+o(n)+'"':"end of input"}return"Expected "+a(n)+" but "+c(t)+" found."};class o{static parse(n){return e(n)}}function u(n,t){if(null!=n)switch(t(n),n.type){case"when-clause":u(n.operand,t),u(n.value,t);break;case"case-expression":for(const r of n.clauses)u(r,t);"simple"===n.format&&u(n.operand,t),null!==n.else&&u(n.else,t);break;case"expression-list":for(const r of n.value)u(r,t);break;case"unary-expression":u(n.expr,t);break;case"binary-expression":u(n.left,t),u(n.right,t);break;case"function":u(n.args,t);break;case"interval":u(n.value,t),u(n.qualifier,t);break;case"interval-qualifier":u(n.start,t),u(n.end,t)}}export{o as WhereGrammar,u as visitAll};
5
+ function n(n,t){function r(){this.constructor=n}r.prototype=t.prototype,n.prototype=new r}function t(n,r,e,o){var u=Error.call(this,n);return Object.setPrototypeOf&&Object.setPrototypeOf(u,t.prototype),u.expected=r,u.found=e,u.location=o,u.name="SyntaxError",u}function r(n,t,r){return r=r||" ",n.length>t?n:(t-=n.length,n+(r+=r.repeat(t)).slice(0,t))}function e(n,r){var e,o={},u=(r=void 0!==r?r:{}).grammarSource,i={start:uu},a=uu,c="!",s="=",f=">=",l=">",p="<=",v="<>",d="!=",y="||",h="@",g="'",A="N'",m="''",C=".",b="null",E="true",L="false",T="in",w="is",x="like",N="escape",I="not",R="and",O="or",F="between",S="from",M="for",$="substring",U="extract",_="trim",D="position",H="timestamp",P="date",j="time",Z="leading",k="trailing",z="both",G="cast",B="as",q="integer",V="int",W="smallint",Y="float",K="real",X="varchar",J="to",Q="interval",nn="year",tn="timezone_hour",rn="timezone_minute",en="month",on="day",un="hour",an="minute",cn="second",sn="case",fn="end",ln="when",pn="then",vn="else",dn=",",yn="(",hn=")",gn="`",An=/^[<-=]/,mn=/^[+\-]/,Cn=/^[*\/]/,bn=/^[A-Za-z_\x80-\uFFFF]/,En=/^[A-Za-z0-9_]/,Ln=/^[A-Za-z0-9_.\x80-\uFFFF]/,Tn=/^["]/,wn=/^[^']/,xn=/^[0-9]/,Nn=/^[eE]/,In=/^[ \t\n\r]/,Rn=/^[^`]/,On=Xo("!",!1),Fn=Xo("=",!1),Sn=Xo(">=",!1),Mn=Xo(">",!1),$n=Xo("<=",!1),Un=Xo("<>",!1),_n=Jo([["<","="]],!1,!1),Dn=Xo("!=",!1),Hn=Jo(["+","-"],!1,!1),Pn=Xo("||",!1),jn=Jo(["*","/"],!1,!1),Zn=Jo([["A","Z"],["a","z"],"_",["€","￿"]],!1,!1),kn=Jo([["A","Z"],["a","z"],["0","9"],"_"],!1,!1),zn=Jo([["A","Z"],["a","z"],["0","9"],"_",".",["€","￿"]],!1,!1),Gn=Jo(['"'],!1,!1),Bn=Xo("@",!1),qn=Xo("'",!1),Vn=Xo("N'",!1),Wn=Xo("''",!1),Yn=Jo(["'"],!0,!1),Kn=Xo(".",!1),Xn=Jo([["0","9"]],!1,!1),Jn=Jo(["e","E"],!1,!1),Qn=Xo("NULL",!0),nt=Xo("TRUE",!0),tt=Xo("FALSE",!0),rt=Xo("IN",!0),et=Xo("IS",!0),ot=Xo("LIKE",!0),ut=Xo("ESCAPE",!0),it=Xo("NOT",!0),at=Xo("AND",!0),ct=Xo("OR",!0),st=Xo("BETWEEN",!0),ft=Xo("FROM",!0),lt=Xo("FOR",!0),pt=Xo("SUBSTRING",!0),vt=Xo("EXTRACT",!0),dt=Xo("TRIM",!0),yt=Xo("POSITION",!0),ht=Xo("TIMESTAMP",!0),gt=Xo("DATE",!0),At=Xo("TIME",!0),mt=Xo("LEADING",!0),Ct=Xo("TRAILING",!0),bt=Xo("BOTH",!0),Et=Xo("CAST",!0),Lt=Xo("AS",!0),Tt=Xo("INTEGER",!0),wt=Xo("INT",!0),xt=Xo("SMALLINT",!0),Nt=Xo("FLOAT",!0),It=Xo("REAL",!0),Rt=Xo("VARCHAR",!0),Ot=Xo("TO",!0),Ft=Xo("INTERVAL",!0),St=Xo("YEAR",!0),Mt=Xo("TIMEZONE_HOUR",!0),$t=Xo("TIMEZONE_MINUTE",!0),Ut=Xo("MONTH",!0),_t=Xo("DAY",!0),Dt=Xo("HOUR",!0),Ht=Xo("MINUTE",!0),Pt=Xo("SECOND",!0),jt=Xo("CASE",!0),Zt=Xo("END",!0),kt=Xo("WHEN",!0),zt=Xo("THEN",!0),Gt=Xo("ELSE",!0),Bt=Xo(",",!1),qt=Xo("(",!1),Vt=Xo(")",!1),Wt=Jo([" ","\t","\n","\r"],!1,!1),Yt=Xo("`",!1),Kt=Jo(["`"],!0,!1),Xt=function(n){return n},Jt=function(n){return{type:"expression-list",location:Yo(),value:n}},Qt=function(n,t,r){return{op:t,expr:r,location:Yo()}},nr=function(n,t){return wa(n,t)},tr=function(n,t,r){return{op:t,expr:r,location:Yo()}},rr=function(n,t){return wa(n,t)},er=function(n){return Ea("NOT",n,Yo())},or=function(n,t){if(""==t||null==t||null==t)return n;return"arithmetic"==t.type?wa(n,t.tail):La(t.op,n,t.right,t.escape,Yo())},ur=function(n,t){return{op:n,expr:t,location:Yo()}},ir=function(n){return{type:"arithmetic",tail:n}},ar=function(n,t){return{op:n+"NOT",right:t}},cr=function(n,t){return{op:n,right:t}},sr=function(n,t,r){return Ta(Yo(),t,r)},fr=function(n,t){return{op:"NOT"+n,right:t}},lr=function(n,t,r){return Ta(Yo(),t,r)},pr=function(n,t){return{op:n,right:t}},vr=function(n){return n[0]+" "+n[2]},dr=function(n){return n[0]+" "+n[2]},yr=function(n,t,r){return{op:n,right:t,escape:r.value}},hr=function(n,t){return{op:n,right:t,escape:""}},gr=function(n,t){return{op:n,right:t}},Ar=function(n,t){return{op:n,right:t}},mr=function(n,t,r){return{op:t,expr:r,location:Yo()}},Cr=function(n,t){return wa(n,t)},br=function(n,t,r){return{op:t,expr:r,location:Yo()}},Er=function(n,t){return wa(n,t)},Lr=function(n){return n.paren=!0,n},Tr=function(n){return/^CURRENT_DATE$/i.test(n)?{type:"current-time",location:Yo(),mode:"date"}:/^CURRENT_TIMESTAMP$/i.test(n)?{type:"current-time",location:Yo(),mode:"timestamp"}:/^CURRENT_TIME$/i.test(n)?{type:"current-time",location:Yo(),mode:"time"}:/^CURRENT_USER$/i.test(n)?{type:"current-user",location:Yo()}:{type:"column-reference",location:Yo(),table:"",column:n}},wr=function(n){return{type:"column-reference",location:Yo(),table:"",column:n,delimited:!0}},xr=function(n){return n},Nr=function(n,t){return n+t.join("")},Ir=function(n,t){return n+t.join("")},Rr=function(n){return n},Or=function(n){return n.join("")},Fr=function(){return'"'},Sr=function(n){return{type:"parameter",location:Yo(),value:n[1]}},Mr=function(n,t){return Ta(Yo(),n,t)},$r=function(n,t){return Ta(Yo(),n,t)},Ur=function(n){return{type:"function",location:Yo(),name:"extract",args:n}},_r=function(n,t,r){return Ta(Yo(),n,t,...r?[r]:[])},Dr=function(n,t,r){return Ta(Yo(),n,t,r)},Hr=function(n){return{type:"function",location:Yo(),name:"substring",args:n}},Pr=function(n,t){return Ta(Yo(),n,t)},jr=function(n,t){return Ta(Yo(),n,t)},Zr=function(n){return{type:"function",location:Yo(),name:"cast",args:n}},kr=function(){return{type:"data-type",location:Yo(),value:{type:"integer"}}},zr=function(){return{type:"data-type",location:Yo(),value:{type:"smallint"}}},Gr=function(){return{type:"data-type",location:Yo(),value:{type:"float"}}},Br=function(){return{type:"data-type",location:Yo(),value:{type:"real"}}},qr=function(){return{type:"data-type",location:Yo(),value:{type:"date"}}},Vr=function(){return{type:"data-type",location:Yo(),value:{type:"timestamp"}}},Wr=function(){return{type:"data-type",location:Yo(),value:{type:"time"}}},Yr=function(n){return{type:"data-type",location:Yo(),value:{type:"varchar",size:parseInt(n)}}},Kr=function(n,t,r){return Ta(Yo(),n,t,r)},Xr=function(n,t){return Ta(Yo(),n,t)},Jr=function(n){return{type:"function",location:Yo(),name:"trim",args:n}},Qr=function(n){return{type:"string",location:Yo(),value:n??"BOTH"}},ne=function(n,t){return Ta(Yo(),n,t)},te=function(n,t){return Ta(Yo(),n,t)},re=function(n){return{type:"function",location:Yo(),name:"position",args:n}},ee=function(n,t){return{type:"function",location:Yo(),name:n,args:t}},oe=function(n){return{type:"string",location:Yo(),value:n}},ue=function(n){return"string"===n.type&&xa(n.value),{type:"timestamp",location:Yo(),value:n.value}},ie=function(n){return"string"===n.type&&Na(n.value),{type:"time",location:Yo(),value:n.value}},ae=function(n,t,r){return{type:"interval",location:Yo(),value:t,qualifier:r,op:n}},ce=function(n,t){return{type:"interval",location:Yo(),value:n,qualifier:t,op:""}},se=function(n,t){return{type:"interval-qualifier",location:Yo(),start:n,end:t}},fe=function(n,t){return{type:"interval-period",location:Yo(),period:n.value,precision:t,secondary:null}},le=function(n){return{type:"interval-period",location:Yo(),period:n.value,precision:null,secondary:null}},pe=function(n){return{type:"interval-period",location:Yo(),period:n.value,precision:null,secondary:null}},ve=function(n,t){return{type:"interval-period",location:Yo(),period:"second",precision:n,secondary:t}},de=function(n){return{type:"interval-period",location:Yo(),period:"second",precision:n,secondary:null}},ye=function(){return{type:"interval-period",location:Yo(),period:"second",precision:null,secondary:null}},he=function(n,t){return{type:"interval-period",location:Yo(),period:n.value,precision:t,secondary:null}},ge=function(n){return{type:"interval-period",location:Yo(),period:n.value,precision:null,secondary:null}},Ae=function(n,t){return{type:"interval-period",location:Yo(),period:"second",precision:n,secondary:t}},me=function(n){return{type:"interval-period",location:Yo(),period:"second",precision:n,secondary:null}},Ce=function(){return{type:"interval-period",location:Yo(),period:"second",precision:null,secondary:null}},be=function(){return{type:"string",location:Yo(),value:"day"}},Ee=function(){return{type:"string",location:Yo(),value:"hour"}},Le=function(){return{type:"string",location:Yo(),value:"minute"}},Te=function(){return{type:"string",location:Yo(),value:"month"}},we=function(){return{type:"string",location:Yo(),value:"year"}},xe=function(n){return parseFloat(n)},Ne=function(n){return parseFloat(n)},Ie=function(n){return"string"===n.type&&Ia(n.value),{type:"date",location:Yo(),value:n.value}},Re=function(){return{type:"null",location:Yo(),value:null}},Oe=function(){return{type:"boolean",location:Yo(),value:!0}},Fe=function(){return{type:"boolean",location:Yo(),value:!1}},Se=function(){return"'"},Me=function(n){return{type:"string",location:Yo(),value:n.join("")}},$e=function(n,t){return{type:"case-expression",location:Yo(),format:"simple",operand:n,clauses:t,else:null,elseLocation:null}},Ue=function(n,t,r){return{type:"case-expression",location:Yo(),format:"simple",operand:n,clauses:t,else:r.value,elseLocation:r.location}},_e=function(n){return{type:"case-expression",location:Yo(),format:"searched",clauses:n,else:null,elseLocation:null}},De=function(n,t){return{type:"case-expression",location:Yo(),format:"searched",clauses:n,else:t.value,elseLocation:t.location}},He=function(n,t){return{type:"when-clause",location:Yo(),operand:n,value:t}},Pe=function(n,t){return{type:"when-clause",location:Yo(),operand:n,value:t}},je=function(n){return{type:"else-clause",location:Yo(),value:n}},Ze=function(n){return{type:"number",location:Yo(),value:n}},ke=function(n,t,r){return parseFloat(n+t+r)},ze=function(n,t){return parseFloat(n+t)},Ge=function(n,t){return parseFloat(n+t)},Be=function(n){return parseFloat(n)},qe=function(n,t){return n[0]+t},Ve=function(n){return"."+(null!=n?n:"")},We=function(n,t){return n+t},Ye=function(n){return n.join("")},Ke=function(n,t){return"e"+(null===t?"":t)},Xe=function(){return"IN"},Je=function(){return"IS"},Qe=function(){return"LIKE"},no=function(){return"ESCAPE"},to=function(){return"NOT"},ro=function(){return"AND"},eo=function(){return"OR"},oo=function(){return"BETWEEN"},uo=function(){return"FROM"},io=function(){return"FOR"},ao=function(){return"SUBSTRING"},co=function(){return"EXTRACT"},so=function(){return"TRIM"},fo=function(){return"POSITION"},lo=function(){return"TIMESTAMP"},po=function(){return"DATE"},vo=function(){return"TIME"},yo=function(){return"LEADING"},ho=function(){return"TRAILING"},go=function(){return"BOTH"},Ao=function(){return"CAST"},mo=function(){return"AS"},Co=function(){return"INTEGER"},bo=function(){return"INT"},Eo=function(){return"SMALLINT"},Lo=function(){return"FLOAT"},To=function(){return"REAL"},wo=function(){return"VARCHAR"},xo=function(){return"TO"},No=function(){return"INTERVAL"},Io=function(){return"YEAR"},Ro=function(){return"TIMEZONE_HOUR"},Oo=function(){return"TIMEZONE_MINUTE"},Fo=function(){return"MONTH"},So=function(){return"DAY"},Mo=function(){return"HOUR"},$o=function(){return"MINUTE"},Uo=function(){return"SECOND"},_o=function(){return"CASE"},Do=function(){return"END"},Ho=function(){return"WHEN"},Po=function(){return"THEN"},jo=function(){return"ELSE"},Zo=function(n){return n},ko=function(n){return n.join("")},zo=0|r.peg$currPos,Go=zo,Bo=[{line:1,column:1}],qo=zo,Vo=r.peg$maxFailExpected||[],Wo=0|r.peg$silentFails;if(r.startRule){if(!(r.startRule in i))throw new Error("Can't start parsing from rule \""+r.startRule+'".');a=i[r.startRule]}function Yo(){return tu(Go,zo)}function Ko(n,t){throw eu(n,t=void 0!==t?t:tu(Go,zo))}function Xo(n,t){return{type:"literal",text:n,ignoreCase:t}}function Jo(n,t,r){return{type:"class",parts:n,inverted:t,ignoreCase:r}}function Qo(){return{type:"end"}}function nu(t){var r,e=Bo[t];if(e)return e;if(t>=Bo.length)r=Bo.length-1;else for(r=t;!Bo[--r];);for(e={line:(e=Bo[r]).line,column:e.column};r<t;)10===n.charCodeAt(r)?(e.line++,e.column=1):e.column++,r++;return Bo[t]=e,e}function tu(n,t,r){var e=nu(n),o=nu(t);return{source:u,start:{offset:n,line:e.line,column:e.column},end:{offset:t,line:o.line,column:o.column}}}function ru(n){zo<qo||(zo>qo&&(qo=zo,Vo=[]),Vo.push(n))}function eu(n,r){return new t(n,null,null,r)}function ou(n,r,e){return new t(t.buildMessage(n,r),n,r,e)}function uu(){var n,t;return n=zo,ma(),(t=au())!==o?(ma(),Go=n,n=Xt(t)):(zo=n,n=o),n}function iu(){var n,t,r,e,u,i;if(n=zo,ga()!==o){for(ma(),t=[],r=au();r!==o;)t.push(r),r=zo,e=zo,u=ma(),(i=ha())!==o?e=u=[u,i,ma()]:(zo=e,e=o),e!==o&&(e=au())===o?(zo=r,r=o):r=e;r=ma(),(e=Aa())!==o?(Go=n,n=Jt(t)):(zo=n,n=o)}else zo=n,n=o;return n}function au(){var n,t,r,e,u,i;if(n=zo,(t=cu())!==o){for(r=[],e=zo,ma(),(u=Mi())!==o?(ma(),(i=cu())!==o?(Go=e,e=Qt(t,u,i)):(zo=e,e=o)):(zo=e,e=o);e!==o;)r.push(e),e=zo,ma(),(u=Mi())!==o?(ma(),(i=cu())!==o?(Go=e,e=Qt(t,u,i)):(zo=e,e=o)):(zo=e,e=o);Go=n,n=nr(t,r)}else zo=n,n=o;return n}function cu(){var n,t,r,e,u,i;if(n=zo,(t=su())!==o){for(r=[],e=zo,ma(),(u=Si())!==o?(ma(),(i=su())!==o?(Go=e,e=tr(t,u,i)):(zo=e,e=o)):(zo=e,e=o);e!==o;)r.push(e),e=zo,ma(),(u=Si())!==o?(ma(),(i=su())!==o?(Go=e,e=tr(t,u,i)):(zo=e,e=o)):(zo=e,e=o);Go=n,n=rr(t,r)}else zo=n,n=o;return n}function su(){var t,r,e,u,i;return t=zo,(r=Fi())===o&&(r=zo,33===n.charCodeAt(zo)?(e=c,zo++):(e=o,0===Wo&&ru(On)),e!==o?(u=zo,Wo++,61===n.charCodeAt(zo)?(i=s,zo++):(i=o,0===Wo&&ru(Fn)),Wo--,i===o?u=void 0:(zo=u,u=o),u!==o?r=e=[e,u]:(zo=r,r=o)):(zo=r,r=o)),r!==o?(e=ma(),(u=su())!==o?(Go=t,t=er(u)):(zo=t,t=o)):(zo=t,t=o),t===o&&(t=fu()),t}function fu(){var n,t,r,e;return n=zo,(t=Cu())!==o?(r=zo,ma(),(e=lu())!==o?r=e:(zo=r,r=o),r===o&&(r=null),Go=n,n=or(t,r)):(zo=n,n=o),n}function lu(){var n;return(n=pu())===o&&(n=mu())===o&&(n=yu())===o&&(n=du())===o&&(n=Au()),n}function pu(){var n,t,r,e,u;if(n=zo,t=[],r=zo,ma(),(e=vu())!==o?(ma(),(u=Cu())!==o?(Go=r,r=ur(e,u)):(zo=r,r=o)):(zo=r,r=o),r!==o)for(;r!==o;)t.push(r),r=zo,ma(),(e=vu())!==o?(ma(),(u=Cu())!==o?(Go=r,r=ur(e,u)):(zo=r,r=o)):(zo=r,r=o);else t=o;return t!==o&&(Go=n,t=ir(t)),n=t}function vu(){var t;return n.substr(zo,2)===f?(t=f,zo+=2):(t=o,0===Wo&&ru(Sn)),t===o&&(62===n.charCodeAt(zo)?(t=l,zo++):(t=o,0===Wo&&ru(Mn)),t===o&&(n.substr(zo,2)===p?(t=p,zo+=2):(t=o,0===Wo&&ru($n)),t===o&&(n.substr(zo,2)===v?(t=v,zo+=2):(t=o,0===Wo&&ru(Un)),t===o&&(t=n.charAt(zo),An.test(t)?zo++:(t=o,0===Wo&&ru(_n)),t===o&&(n.substr(zo,2)===d?(t=d,zo+=2):(t=o,0===Wo&&ru(Dn))))))),t}function du(){var n,t,r,e;return n=zo,(t=Ii())!==o?(ma(),(r=Fi())!==o?(ma(),(e=Cu())!==o?(Go=n,n=ar(t,e)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o),n===o&&(n=zo,(t=Ii())!==o?(ma(),(r=Cu())!==o?(Go=n,n=cr(t,r)):(zo=n,n=o)):(zo=n,n=o)),n}function yu(){var n,t,r,e,u,i,a,c;return n=zo,(t=Fi())!==o?(ma(),(r=$i())!==o?(e=ma(),u=zo,(i=Cu())!==o?(ma(),(a=Si())!==o?(ma(),(c=Cu())!==o?(Go=u,u=sr(r,i,c)):(zo=u,u=o)):(zo=u,u=o)):(zo=u,u=o),u!==o?(Go=n,n=fr(r,u)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o),n===o&&(n=zo,(t=$i())!==o?(ma(),r=zo,(e=Cu())!==o?(u=ma(),(i=Si())!==o?(ma(),(a=Cu())!==o?(Go=r,r=lr(t,e,a)):(zo=r,r=o)):(zo=r,r=o)):(zo=r,r=o),r!==o?(Go=n,n=pr(t,r)):(zo=n,n=o)):(zo=n,n=o)),n}function hu(){var n,t,r,e,u;return n=zo,t=zo,(r=Fi())!==o?(e=ma(),(u=Ri())!==o?t=r=[r,e,u]:(zo=t,t=o)):(zo=t,t=o),t!==o&&(Go=n,t=vr(t)),(n=t)===o&&(n=Ri()),n}function gu(){var n,t,r,e,u;return n=zo,t=zo,(r=Fi())!==o?(e=ma(),(u=Ni())!==o?t=r=[r,e,u]:(zo=t,t=o)):(zo=t,t=o),t!==o&&(Go=n,t=dr(t)),(n=t)===o&&(n=Ni()),n}function Au(){var n,t,r,e;return n=zo,(t=hu())!==o?(ma(),(r=ci())!==o?(ma(),Oi()!==o?(ma(),(e=si())!==o?(Go=n,n=yr(t,r,e)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o),n===o&&(n=zo,(t=hu())!==o?(ma(),(r=ci())!==o?(Go=n,n=hr(t,r)):(zo=n,n=o)):(zo=n,n=o)),n}function mu(){var n,t,r;return n=zo,(t=gu())!==o?(ma(),(r=iu())!==o?(Go=n,n=gr(t,r)):(zo=n,n=o)):(zo=n,n=o),n===o&&(n=zo,(t=gu())!==o?(ma(),(r=Hu())!==o?(Go=n,n=Ar(t,r)):(zo=n,n=o)):(zo=n,n=o)),n}function Cu(){var n,t,r,e,u,i;if(n=zo,(t=Eu())!==o){for(r=[],e=zo,ma(),(u=bu())!==o?(ma(),(i=Eu())!==o?(Go=e,e=mr(t,u,i)):(zo=e,e=o)):(zo=e,e=o);e!==o;)r.push(e),e=zo,ma(),(u=bu())!==o?(ma(),(i=Eu())!==o?(Go=e,e=mr(t,u,i)):(zo=e,e=o)):(zo=e,e=o);Go=n,n=Cr(t,r)}else zo=n,n=o;return n}function bu(){var t;return t=n.charAt(zo),mn.test(t)?zo++:(t=o,0===Wo&&ru(Hn)),t===o&&(n.substr(zo,2)===y?(t=y,zo+=2):(t=o,0===Wo&&ru(Pn))),t}function Eu(){var n,t,r,e,u,i;if(n=zo,(t=Tu())!==o){for(r=[],e=zo,ma(),(u=Lu())!==o?(ma(),(i=Tu())!==o?(Go=e,e=br(t,u,i)):(zo=e,e=o)):(zo=e,e=o);e!==o;)r.push(e),e=zo,ma(),(u=Lu())!==o?(ma(),(i=Tu())!==o?(Go=e,e=br(t,u,i)):(zo=e,e=o)):(zo=e,e=o);Go=n,n=Er(t,r)}else zo=n,n=o;return n}function Lu(){var t;return t=n.charAt(zo),Cn.test(t)?zo++:(t=o,0===Wo&&ru(jn)),t}function Tu(){var n,t;return(n=Wu())===o&&(n=Pu())===o&&(n=ju())===o&&(n=zu())===o&&(n=Bu())===o&&(n=Zu())===o&&(n=qu())===o&&(n=fi())===o&&(n=wu())===o&&(n=Hu())===o&&(n=zo,ga()!==o?(ma(),(t=au())!==o?(ma(),Aa()!==o?(Go=n,n=Lr(t)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)),n}function wu(){var n,t;return n=zo,(t=xu())!==o&&(Go=n,t=Tr(t)),(n=t)===o&&(n=zo,(t=Su())!==o&&(Go=n,t=wr(t)),n=t),n}function xu(){var n,t;return n=zo,(t=Nu())!==o&&(Go=n,t=xr(t)),n=t}function Nu(){var n,t,r,e;if(n=zo,(t=Ru())!==o){for(r=[],e=Fu();e!==o;)r.push(e),e=Fu();Go=n,n=Nr(t,r)}else zo=n,n=o;return n}function Iu(){var n,t,r,e;if(n=zo,(t=Ru())!==o){for(r=[],e=Ou();e!==o;)r.push(e),e=Ou();Go=n,n=Ir(t,r)}else zo=n,n=o;return n}function Ru(){var t;return t=n.charAt(zo),bn.test(t)?zo++:(t=o,0===Wo&&ru(Zn)),t}function Ou(){var t;return t=n.charAt(zo),En.test(t)?zo++:(t=o,0===Wo&&ru(kn)),t}function Fu(){var t;return t=n.charAt(zo),Ln.test(t)?zo++:(t=o,0===Wo&&ru(zn)),t}function Su(){var n,t;return n=zo,Du()!==o?(t=Mu(),Du()!==o?(Go=n,n=Rr(t)):(zo=n,n=o)):(zo=n,n=o),n}function Mu(){var n,t,r;for(n=zo,t=[],r=$u();r!==o;)t.push(r),r=$u();return Go=n,n=t=Or(t)}function $u(){var n;return(n=_u())===o&&(n=Uu()),n}function Uu(){var n;return n=zo,Du()!==o&&Du()!==o?(Go=n,n=Fr()):(zo=n,n=o),n}function _u(){var t;return t=n.charAt(zo),Ln.test(t)?zo++:(t=o,0===Wo&&ru(zn)),t}function Du(){var t;return t=n.charAt(zo),Tn.test(t)?zo++:(t=o,0===Wo&&ru(Gn)),t}function Hu(){var t,r,e,u;return t=zo,r=zo,64===n.charCodeAt(zo)?(e=h,zo++):(e=o,0===Wo&&ru(Bn)),e!==o&&(u=Iu())!==o?r=e=[e,u]:(zo=r,r=o),r!==o&&(Go=t,r=Sr(r)),t=r}function Pu(){var n,t,r,e;return n=zo,Hi()!==o?(ma(),t=zo,ga()!==o?(ma(),(r=Vu())!==o?(ma(),Ui()!==o?(ma(),(e=au())!==o?(ma(),Aa()!==o?(Go=t,t=Mr(r,e)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o),t===o&&(t=zo,ga()!==o?(ma(),(r=Vu())!==o?(ma(),ha()!==o?(ma(),(e=au())!==o?(ma(),Aa()!==o?(Go=t,t=$r(r,e)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)),t!==o?(Go=n,n=Ur(t)):(zo=n,n=o)):(zo=n,n=o),n}function ju(){var n,t,r,e,u,i,a;return n=zo,Di()!==o?(ma(),t=zo,ga()!==o?(ma(),(r=au())!==o?(ma(),Ui()!==o?(ma(),(e=au())!==o?(ma(),u=zo,_i()!==o?(i=ma(),(a=au())!==o?(ma(),u=a):(zo=u,u=o)):(zo=u,u=o),u===o&&(u=null),Aa()!==o?(Go=t,t=_r(r,e,u)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o),t===o&&(t=zo,ga()!==o?(ma(),(r=au())!==o?(ma(),ha()!==o?(ma(),(e=au())!==o?(ma(),(u=ha())!==o?(ma(),(i=au())!==o&&(a=Aa())!==o?(Go=t,t=Dr(r,e,i)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)),t!==o?(Go=n,n=Hr(t)):(zo=n,n=o)):(zo=n,n=o),n}function Zu(){var n,t,r,e;return n=zo,Vi()!==o?(ma(),t=zo,ga()!==o?(ma(),(r=au())!==o?(ma(),Wi()!==o?(ma(),(e=ku())!==o?(ma(),Aa()!==o?(Go=t,t=Pr(r,e)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o),t===o&&(t=zo,ga()!==o?(ma(),(r=au())!==o?(ma(),ha()!==o?(ma(),(e=ku())!==o?(ma(),Aa()!==o?(Go=t,t=jr(r,e)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)),t!==o?(Go=n,n=Zr(t)):(zo=n,n=o)):(zo=n,n=o),n}function ku(){var n,t,r;return n=zo,(t=Yi())===o&&(t=Ki()),t!==o&&(Go=n,t=kr()),(n=t)===o&&(n=zo,(t=Xi())!==o&&(Go=n,t=zr()),(n=t)===o&&(n=zo,(t=Ji())!==o&&(Go=n,t=Gr()),(n=t)===o&&(n=zo,(t=Qi())!==o&&(Go=n,t=Br()),(n=t)===o&&(n=zo,(t=ki())!==o&&(Go=n,t=qr()),(n=t)===o&&(n=zo,(t=Zi())!==o&&(Go=n,t=Vr()),(n=t)===o&&(n=zo,(t=zi())!==o&&(Go=n,t=Wr()),(n=t)===o&&(n=zo,(t=na())!==o?(ma(),ga()!==o?(ma(),(r=bi())!==o?(ma(),Aa()!==o?(Go=n,n=Yr(r)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)))))))),n}function zu(){var n,t,r,e,u;return n=zo,Pi()!==o?(ma(),t=zo,ga()!==o?(ma(),r=Gu(),ma(),(e=au())!==o?(ma(),Ui()!==o?(ma(),(u=au())!==o?(ma(),Aa()!==o?(Go=t,t=Kr(r,e,u)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o),t===o&&(t=zo,ga()!==o?(ma(),r=Gu(),ma(),(e=au())!==o?(ma(),Aa()!==o?(Go=t,t=Xr(r,e)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)),t!==o?(Go=n,n=Jr(t)):(zo=n,n=o)):(zo=n,n=o),n}function Gu(){var n,t;return n=zo,(t=Gi())===o&&(t=Bi())===o&&(t=qi()),t===o&&(t=null),Go=n,n=t=Qr(t)}function Bu(){var n,t,r,e;return n=zo,ji()!==o?(ma(),t=zo,ga()!==o?(ma(),(r=au())!==o?(ma(),Ni()!==o?(ma(),(e=au())!==o?(ma(),Aa()!==o?(Go=t,t=ne(r,e)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o),t===o&&(t=zo,ga()!==o?(ma(),(r=au())!==o?(ma(),ha()!==o?(ma(),(e=au())!==o?(ma(),Aa()!==o?(Go=t,t=te(r,e)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)),t!==o?(Go=n,n=re(t)):(zo=n,n=o)):(zo=n,n=o),n}function qu(){var n,t,r,e;return n=zo,t=zo,Wo++,r=Hi(),Wo--,r===o?t=void 0:(zo=t,t=o),t!==o&&(r=ba())!==o?(ma(),(e=iu())!==o?(Go=n,n=ee(r,e)):(zo=n,n=o)):(zo=n,n=o),n}function Vu(){var n,t;return n=zo,(t=ea())===o&&(t=ia())===o&&(t=aa())===o&&(t=ca())===o&&(t=sa())===o&&(t=fa())===o&&(t=oa())===o&&(t=ua()),t!==o&&(Go=n,t=oe(t)),n=t}function Wu(){var n;return(n=si())===o&&(n=hi())===o&&(n=ai())===o&&(n=ii())===o&&(n=ui())===o&&(n=Yu())===o&&(n=Xu())===o&&(n=Ku()),n}function Yu(){var n,t;return n=zo,Zi()!==o?(ma(),(t=ci())!==o?(Go=n,n=ue(t)):(zo=n,n=o)):(zo=n,n=o),n}function Ku(){var n,t;return n=zo,zi()!==o?(ma(),(t=ci())!==o?(Go=n,n=ie(t)):(zo=n,n=o)):(zo=n,n=o),n}function Xu(){var t,r,e,u;return t=zo,ra()!==o?(ma(),r=n.charAt(zo),mn.test(r)?zo++:(r=o,0===Wo&&ru(Hn)),r!==o?(ma(),(e=ci())!==o?(ma(),(u=Ju())!==o?(Go=t,t=ae(r,e,u)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o),t===o&&(t=zo,ra()!==o?(ma(),(r=ci())!==o?(ma(),(e=Ju())!==o?(Go=t,t=ce(r,e)):(zo=t,t=o)):(zo=t,t=o)):(zo=t,t=o)),t}function Ju(){var n,t,r;return n=zo,(t=Qu())!==o?(ma(),ta()!==o?(ma(),(r=ni())!==o?(Go=n,n=se(t,r)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o),n===o&&(n=ti()),n}function Qu(){var n,t,r;return n=zo,(t=ri())!==o?(ma(),ga()!==o?(ma(),(r=oi())!==o?(ma(),Aa()!==o?(Go=n,n=fe(t,r)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o),n===o&&(n=zo,(t=ri())!==o&&(Go=n,t=le(t)),n=t),n}function ni(){var n,t,r,e;return n=zo,(t=ri())!==o&&(Go=n,t=pe(t)),(n=t)===o&&(n=zo,(t=fa())!==o?(ma(),ga()!==o?(ma(),(r=oi())!==o?(ma(),ha()!==o?(ma(),(e=ei())!==o?(ma(),Aa()!==o?(Go=n,n=ve(r,e)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o),n===o&&(n=zo,(t=fa())!==o?(ma(),ga()!==o?(ma(),(r=oi())!==o?(ma(),Aa()!==o?(Go=n,n=de(r)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o),n===o&&(n=zo,(t=fa())!==o&&(Go=n,t=ye()),n=t))),n}function ti(){var n,t,r,e;return n=zo,(t=ri())!==o?(ma(),ga()!==o?(ma(),(r=ei())!==o?(ma(),Aa()!==o?(Go=n,n=he(t,r)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o),n===o&&(n=zo,(t=ri())!==o&&(Go=n,t=ge(t)),(n=t)===o&&(n=zo,(t=fa())!==o?(ma(),ga()!==o?(ma(),(r=oi())!==o?(ma(),ha()!==o?(ma(),(e=ei())!==o?(ma(),Aa()!==o?(Go=n,n=Ae(r,e)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o),n===o&&(n=zo,(t=fa())!==o?(ma(),ga()!==o?(ma(),(r=ei())!==o?(ma(),Aa()!==o?(Go=n,n=me(r)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o),n===o&&(n=zo,(t=fa())!==o&&(Go=n,t=Ce()),n=t)))),n}function ri(){var n,t;return n=zo,(t=aa())!==o&&(Go=n,t=be()),(n=t)===o&&(n=zo,(t=ca())!==o&&(Go=n,t=Ee()),(n=t)===o&&(n=zo,(t=sa())!==o&&(Go=n,t=Le()),(n=t)===o&&(n=zo,(t=ia())!==o&&(Go=n,t=Te()),(n=t)===o&&(n=zo,(t=ea())!==o&&(Go=n,t=we()),n=t)))),n}function ei(){var n,t;return n=zo,(t=bi())!==o&&(Go=n,t=xe(t)),n=t}function oi(){var n,t;return n=zo,(t=bi())!==o&&(Go=n,t=Ne(t)),n=t}function ui(){var n,t;return n=zo,ki()!==o?(ma(),(t=ci())!==o?(Go=n,n=Ie(t)):(zo=n,n=o)):(zo=n,n=o),n}function ii(){var n,t;return n=zo,(t=Ti())!==o&&(Go=n,t=Re()),n=t}function ai(){var n,t;return n=zo,(t=wi())!==o&&(Go=n,t=Oe()),(n=t)===o&&(n=zo,(t=xi())!==o&&(Go=n,t=Fe()),n=t),n}function ci(){var n;return(n=si())===o&&(n=Hu()),n}function si(){var t,r,e,u,i;if(t=zo,39===n.charCodeAt(zo)?(r=g,zo++):(r=o,0===Wo&&ru(qn)),r===o&&(n.substr(zo,2)===A?(r=A,zo+=2):(r=o,0===Wo&&ru(Vn))),r!==o){for(e=[],u=zo,n.substr(zo,2)===m?(i=m,zo+=2):(i=o,0===Wo&&ru(Wn)),i!==o&&(Go=u,i=Se()),(u=i)===o&&(u=n.charAt(zo),wn.test(u)?zo++:(u=o,0===Wo&&ru(Yn)));u!==o;)e.push(u),u=zo,n.substr(zo,2)===m?(i=m,zo+=2):(i=o,0===Wo&&ru(Wn)),i!==o&&(Go=u,i=Se()),(u=i)===o&&(u=n.charAt(zo),wn.test(u)?zo++:(u=o,0===Wo&&ru(Yn)));39===n.charCodeAt(zo)?(u=g,zo++):(u=o,0===Wo&&ru(qn)),u!==o?(Go=t,t=Me(e)):(zo=t,t=o)}else zo=t,t=o;return t}function fi(){var n;return(n=li())===o&&(n=pi()),n}function li(){var n,t,r,e,u;if(n=zo,la()!==o)if(ma(),(t=au())!==o){for(ma(),r=[],e=zo,(u=di())!==o?(ma(),e=u):(zo=e,e=o);e!==o;)r.push(e),e=zo,(u=di())!==o?(ma(),e=u):(zo=e,e=o);(e=pa())!==o?(Go=n,n=$e(t,r)):(zo=n,n=o)}else zo=n,n=o;else zo=n,n=o;if(n===o)if(n=zo,la()!==o)if(ma(),(t=au())!==o){for(ma(),r=[],e=zo,(u=di())!==o?(ma(),e=u):(zo=e,e=o);e!==o;)r.push(e),e=zo,(u=di())!==o?(ma(),e=u):(zo=e,e=o);(e=yi())!==o?(u=ma(),pa()!==o?(Go=n,n=Ue(t,r,e)):(zo=n,n=o)):(zo=n,n=o)}else zo=n,n=o;else zo=n,n=o;return n}function pi(){var n,t,r,e;if(n=zo,la()!==o){for(ma(),t=[],r=zo,(e=vi())!==o?(ma(),r=e):(zo=r,r=o);r!==o;)t.push(r),r=zo,(e=vi())!==o?(ma(),r=e):(zo=r,r=o);(r=pa())!==o?(Go=n,n=_e(t)):(zo=n,n=o)}else zo=n,n=o;if(n===o)if(n=zo,la()!==o){for(ma(),t=[],r=zo,(e=vi())!==o?(ma(),r=e):(zo=r,r=o);r!==o;)t.push(r),r=zo,(e=vi())!==o?(ma(),r=e):(zo=r,r=o);(r=yi())!==o?(e=ma(),pa()!==o?(Go=n,n=De(t,r)):(zo=n,n=o)):(zo=n,n=o)}else zo=n,n=o;return n}function vi(){var n,t,r;return n=zo,va()!==o?(ma(),(t=au())!==o?(ma(),da()!==o?(ma(),(r=au())!==o?(Go=n,n=He(t,r)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o),n}function di(){var n,t,r;return n=zo,va()!==o?(ma(),(t=au())!==o?(ma(),da()!==o?(ma(),(r=au())!==o?(Go=n,n=Pe(t,r)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o)):(zo=n,n=o),n}function yi(){var n,t;return n=zo,ya()!==o?(ma(),(t=au())!==o?(Go=n,n=je(t)):(zo=n,n=o)):(zo=n,n=o),n}function hi(){var n,t,r,e;return n=zo,(t=gi())!==o?(r=zo,Wo++,e=Ru(),Wo--,e===o?r=void 0:(zo=r,r=o),r!==o?(Go=n,n=Ze(t)):(zo=n,n=o)):(zo=n,n=o),n}function gi(){var n,t,r,e;return n=zo,(t=Ai())!==o&&(r=mi())!==o&&(e=Ci())!==o?(Go=n,n=ke(t,r,e)):(zo=n,n=o),n===o&&(n=zo,(t=Ai())!==o&&(r=mi())!==o?(Go=n,n=ze(t,r)):(zo=n,n=o),n===o&&(n=zo,(t=Ai())!==o&&(r=Ci())!==o?(Go=n,n=Ge(t,r)):(zo=n,n=o),n===o&&(n=zo,(t=Ai())!==o&&(Go=n,t=Be(t)),n=t))),n}function Ai(){var t,r,e;return(t=bi())===o&&(t=zo,r=n.charAt(zo),mn.test(r)?zo++:(r=o,0===Wo&&ru(Hn)),r!==o&&(e=bi())!==o?(Go=t,t=qe(r,e)):(zo=t,t=o)),t}function mi(){var t,r,e;return t=zo,46===n.charCodeAt(zo)?(r=C,zo++):(r=o,0===Wo&&ru(Kn)),r!==o?((e=bi())===o&&(e=null),Go=t,t=Ve(e)):(zo=t,t=o),t}function Ci(){var n,t,r;return n=zo,(t=Li())!==o&&(r=bi())!==o?(Go=n,n=We(t,r)):(zo=n,n=o),n}function bi(){var n,t,r;if(n=zo,t=[],(r=Ei())!==o)for(;r!==o;)t.push(r),r=Ei();else t=o;return t!==o&&(Go=n,t=Ye(t)),n=t}function Ei(){var t;return t=n.charAt(zo),xn.test(t)?zo++:(t=o,0===Wo&&ru(Xn)),t}function Li(){var t,r,e;return t=zo,r=n.charAt(zo),Nn.test(r)?zo++:(r=o,0===Wo&&ru(Jn)),r!==o?(e=n.charAt(zo),mn.test(e)?zo++:(e=o,0===Wo&&ru(Hn)),e===o&&(e=null),Go=t,t=Ke(r,e)):(zo=t,t=o),t}function Ti(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===b?zo+=4:(r=o,0===Wo&&ru(Qn)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?t=r=[r,e]:(zo=t,t=o)):(zo=t,t=o),t}function wi(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===E?zo+=4:(r=o,0===Wo&&ru(nt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?t=r=[r,e]:(zo=t,t=o)):(zo=t,t=o),t}function xi(){var t,r,e,u;return t=zo,(r=n.substr(zo,5)).toLowerCase()===L?zo+=5:(r=o,0===Wo&&ru(tt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?t=r=[r,e]:(zo=t,t=o)):(zo=t,t=o),t}function Ni(){var t,r,e,u;return t=zo,(r=n.substr(zo,2)).toLowerCase()===T?zo+=2:(r=o,0===Wo&&ru(rt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Xe()):(zo=t,t=o)):(zo=t,t=o),t}function Ii(){var t,r,e,u;return t=zo,(r=n.substr(zo,2)).toLowerCase()===w?zo+=2:(r=o,0===Wo&&ru(et)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Je()):(zo=t,t=o)):(zo=t,t=o),t}function Ri(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===x?zo+=4:(r=o,0===Wo&&ru(ot)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Qe()):(zo=t,t=o)):(zo=t,t=o),t}function Oi(){var t,r,e,u;return t=zo,(r=n.substr(zo,6)).toLowerCase()===N?zo+=6:(r=o,0===Wo&&ru(ut)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=no()):(zo=t,t=o)):(zo=t,t=o),t}function Fi(){var t,r,e,u;return t=zo,(r=n.substr(zo,3)).toLowerCase()===I?zo+=3:(r=o,0===Wo&&ru(it)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=to()):(zo=t,t=o)):(zo=t,t=o),t}function Si(){var t,r,e,u;return t=zo,(r=n.substr(zo,3)).toLowerCase()===R?zo+=3:(r=o,0===Wo&&ru(at)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=ro()):(zo=t,t=o)):(zo=t,t=o),t}function Mi(){var t,r,e,u;return t=zo,(r=n.substr(zo,2)).toLowerCase()===O?zo+=2:(r=o,0===Wo&&ru(ct)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=eo()):(zo=t,t=o)):(zo=t,t=o),t}function $i(){var t,r,e,u;return t=zo,(r=n.substr(zo,7)).toLowerCase()===F?zo+=7:(r=o,0===Wo&&ru(st)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=oo()):(zo=t,t=o)):(zo=t,t=o),t}function Ui(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===S?zo+=4:(r=o,0===Wo&&ru(ft)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=uo()):(zo=t,t=o)):(zo=t,t=o),t}function _i(){var t,r,e,u;return t=zo,(r=n.substr(zo,3)).toLowerCase()===M?zo+=3:(r=o,0===Wo&&ru(lt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=io()):(zo=t,t=o)):(zo=t,t=o),t}function Di(){var t,r,e,u;return t=zo,(r=n.substr(zo,9)).toLowerCase()===$?zo+=9:(r=o,0===Wo&&ru(pt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=ao()):(zo=t,t=o)):(zo=t,t=o),t}function Hi(){var t,r,e,u;return t=zo,(r=n.substr(zo,7)).toLowerCase()===U?zo+=7:(r=o,0===Wo&&ru(vt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=co()):(zo=t,t=o)):(zo=t,t=o),t}function Pi(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===_?zo+=4:(r=o,0===Wo&&ru(dt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=so()):(zo=t,t=o)):(zo=t,t=o),t}function ji(){var t,r,e,u;return t=zo,(r=n.substr(zo,8)).toLowerCase()===D?zo+=8:(r=o,0===Wo&&ru(yt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=fo()):(zo=t,t=o)):(zo=t,t=o),t}function Zi(){var t,r,e,u;return t=zo,(r=n.substr(zo,9)).toLowerCase()===H?zo+=9:(r=o,0===Wo&&ru(ht)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=lo()):(zo=t,t=o)):(zo=t,t=o),t}function ki(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===P?zo+=4:(r=o,0===Wo&&ru(gt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=po()):(zo=t,t=o)):(zo=t,t=o),t}function zi(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===j?zo+=4:(r=o,0===Wo&&ru(At)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=vo()):(zo=t,t=o)):(zo=t,t=o),t}function Gi(){var t,r,e,u;return t=zo,(r=n.substr(zo,7)).toLowerCase()===Z?zo+=7:(r=o,0===Wo&&ru(mt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=yo()):(zo=t,t=o)):(zo=t,t=o),t}function Bi(){var t,r,e,u;return t=zo,(r=n.substr(zo,8)).toLowerCase()===k?zo+=8:(r=o,0===Wo&&ru(Ct)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=ho()):(zo=t,t=o)):(zo=t,t=o),t}function qi(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===z?zo+=4:(r=o,0===Wo&&ru(bt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=go()):(zo=t,t=o)):(zo=t,t=o),t}function Vi(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===G?zo+=4:(r=o,0===Wo&&ru(Et)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Ao()):(zo=t,t=o)):(zo=t,t=o),t}function Wi(){var t,r,e,u;return t=zo,(r=n.substr(zo,2)).toLowerCase()===B?zo+=2:(r=o,0===Wo&&ru(Lt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=mo()):(zo=t,t=o)):(zo=t,t=o),t}function Yi(){var t,r,e,u;return t=zo,(r=n.substr(zo,7)).toLowerCase()===q?zo+=7:(r=o,0===Wo&&ru(Tt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Co()):(zo=t,t=o)):(zo=t,t=o),t}function Ki(){var t,r,e,u;return t=zo,(r=n.substr(zo,3)).toLowerCase()===V?zo+=3:(r=o,0===Wo&&ru(wt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=bo()):(zo=t,t=o)):(zo=t,t=o),t}function Xi(){var t,r,e,u;return t=zo,(r=n.substr(zo,8)).toLowerCase()===W?zo+=8:(r=o,0===Wo&&ru(xt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Eo()):(zo=t,t=o)):(zo=t,t=o),t}function Ji(){var t,r,e,u;return t=zo,(r=n.substr(zo,5)).toLowerCase()===Y?zo+=5:(r=o,0===Wo&&ru(Nt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Lo()):(zo=t,t=o)):(zo=t,t=o),t}function Qi(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===K?zo+=4:(r=o,0===Wo&&ru(It)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=To()):(zo=t,t=o)):(zo=t,t=o),t}function na(){var t,r,e,u;return t=zo,(r=n.substr(zo,7)).toLowerCase()===X?zo+=7:(r=o,0===Wo&&ru(Rt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=wo()):(zo=t,t=o)):(zo=t,t=o),t}function ta(){var t,r,e,u;return t=zo,(r=n.substr(zo,2)).toLowerCase()===J?zo+=2:(r=o,0===Wo&&ru(Ot)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=xo()):(zo=t,t=o)):(zo=t,t=o),t}function ra(){var t,r,e,u;return t=zo,(r=n.substr(zo,8)).toLowerCase()===Q?zo+=8:(r=o,0===Wo&&ru(Ft)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=No()):(zo=t,t=o)):(zo=t,t=o),t}function ea(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===nn?zo+=4:(r=o,0===Wo&&ru(St)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Io()):(zo=t,t=o)):(zo=t,t=o),t}function oa(){var t,r,e,u;return t=zo,(r=n.substr(zo,13)).toLowerCase()===tn?zo+=13:(r=o,0===Wo&&ru(Mt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Ro()):(zo=t,t=o)):(zo=t,t=o),t}function ua(){var t,r,e,u;return t=zo,(r=n.substr(zo,15)).toLowerCase()===rn?zo+=15:(r=o,0===Wo&&ru($t)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Oo()):(zo=t,t=o)):(zo=t,t=o),t}function ia(){var t,r,e,u;return t=zo,(r=n.substr(zo,5)).toLowerCase()===en?zo+=5:(r=o,0===Wo&&ru(Ut)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Fo()):(zo=t,t=o)):(zo=t,t=o),t}function aa(){var t,r,e,u;return t=zo,(r=n.substr(zo,3)).toLowerCase()===on?zo+=3:(r=o,0===Wo&&ru(_t)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=So()):(zo=t,t=o)):(zo=t,t=o),t}function ca(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===un?zo+=4:(r=o,0===Wo&&ru(Dt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Mo()):(zo=t,t=o)):(zo=t,t=o),t}function sa(){var t,r,e,u;return t=zo,(r=n.substr(zo,6)).toLowerCase()===an?zo+=6:(r=o,0===Wo&&ru(Ht)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=$o()):(zo=t,t=o)):(zo=t,t=o),t}function fa(){var t,r,e,u;return t=zo,(r=n.substr(zo,6)).toLowerCase()===cn?zo+=6:(r=o,0===Wo&&ru(Pt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Uo()):(zo=t,t=o)):(zo=t,t=o),t}function la(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===sn?zo+=4:(r=o,0===Wo&&ru(jt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=_o()):(zo=t,t=o)):(zo=t,t=o),t}function pa(){var t,r,e,u;return t=zo,(r=n.substr(zo,3)).toLowerCase()===fn?zo+=3:(r=o,0===Wo&&ru(Zt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Do()):(zo=t,t=o)):(zo=t,t=o),t}function va(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===ln?zo+=4:(r=o,0===Wo&&ru(kt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Ho()):(zo=t,t=o)):(zo=t,t=o),t}function da(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===pn?zo+=4:(r=o,0===Wo&&ru(zt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=Po()):(zo=t,t=o)):(zo=t,t=o),t}function ya(){var t,r,e,u;return t=zo,(r=n.substr(zo,4)).toLowerCase()===vn?zo+=4:(r=o,0===Wo&&ru(Gt)),r!==o?(e=zo,Wo++,u=Ou(),Wo--,u===o?e=void 0:(zo=e,e=o),e!==o?(Go=t,t=jo()):(zo=t,t=o)):(zo=t,t=o),t}function ha(){var t;return 44===n.charCodeAt(zo)?(t=dn,zo++):(t=o,0===Wo&&ru(Bt)),t}function ga(){var t;return 40===n.charCodeAt(zo)?(t=yn,zo++):(t=o,0===Wo&&ru(qt)),t}function Aa(){var t;return 41===n.charCodeAt(zo)?(t=hn,zo++):(t=o,0===Wo&&ru(Vt)),t}function ma(){var n,t;for(n=[],t=Ca();t!==o;)n.push(t),t=Ca();return n}function Ca(){var t;return t=n.charAt(zo),In.test(t)?zo++:(t=o,0===Wo&&ru(Wt)),t}function ba(){var t,r,e,u;if(t=zo,(r=Iu())!==o&&(Go=t,r=Zo(r)),(t=r)===o)if(t=zo,96===n.charCodeAt(zo)?(r=gn,zo++):(r=o,0===Wo&&ru(Yt)),r!==o){if(e=[],u=n.charAt(zo),Rn.test(u)?zo++:(u=o,0===Wo&&ru(Kt)),u!==o)for(;u!==o;)e.push(u),u=n.charAt(zo),Rn.test(u)?zo++:(u=o,0===Wo&&ru(Kt));else e=o;e!==o?(96===n.charCodeAt(zo)?(u=gn,zo++):(u=o,0===Wo&&ru(Yt)),u!==o?(Go=t,t=ko(e)):(zo=t,t=o)):(zo=t,t=o)}else zo=t,t=o;return t}function Ea(n,t,r){return{type:"unary-expression",location:r,operator:n,expr:t}}function La(n,t,r,e,o){const u={type:"binary-expression",location:o,operator:n,left:t,right:r};return void 0!==e&&(u.escape=e),u}function Ta(n,...t){return{type:"expression-list",location:n,value:t}}function wa(n,t){let r=n;for(const{op:e,expr:o,location:{end:u}}of t)r=La(e,r,o,void 0,{...r.location,end:u});return r}function xa(n){!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(n)&&Ko("Timestamp literal is invalid")}function Na(n){!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(n)&&Ko("Time literal is invalid")}function Ia(n){!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(n)&&Ko("Date literal is invalid")}if(e=a(),r.peg$library)return{peg$result:e,peg$currPos:zo,peg$FAILED:o,peg$maxFailExpected:Vo,peg$maxFailPos:qo};if(e!==o&&zo===n.length)return e;throw e!==o&&zo<n.length&&ru(Qo()),ou(Vo,qo<n.length?n.charAt(qo):null,qo<n.length?tu(qo,qo+1):tu(qo,qo))}n(t,Error),t.prototype.format=function(n){var t="Error: "+this.message;if(this.location){var e,o=null;for(e=0;e<n.length;e++)if(n[e].source===this.location.source){o=n[e].text.split(/\r\n|\n|\r/g);break}var u=this.location.start,i=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(u):u,a=this.location.source+":"+i.line+":"+i.column;if(o){var c=this.location.end,s=r("",i.line.toString().length," "),f=o[u.line-1],l=(u.line===c.line?c.column:f.length+1)-u.column||1;t+="\n --\x3e "+a+"\n"+s+" |\n"+i.line+" | "+f+"\n"+s+" | "+r("",u.column-1," ")+r("",l,"^")}else t+="\n at "+a}return t},t.buildMessage=function(n,t){var r={literal:function(n){return'"'+o(n.text)+'"'},class:function(n){var t=n.parts.map((function(n){return Array.isArray(n)?u(n[0])+"-"+u(n[1]):u(n)}));return"["+(n.inverted?"^":"")+t.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(n){return n.description}};function e(n){return n.charCodeAt(0).toString(16).toUpperCase()}function o(n){return n.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(n){return"\\x0"+e(n)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(n){return"\\x"+e(n)}))}function u(n){return n.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,(function(n){return"\\x0"+e(n)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(n){return"\\x"+e(n)}))}function i(n){return r[n.type](n)}function a(n){var t,r,e=n.map(i);if(e.sort(),e.length>0){for(t=1,r=1;t<e.length;t++)e[t-1]!==e[t]&&(e[r]=e[t],r++);e.length=r}switch(e.length){case 1:return e[0];case 2:return e[0]+" or "+e[1];default:return e.slice(0,-1).join(", ")+", or "+e[e.length-1]}}function c(n){return n?'"'+o(n)+'"':"end of input"}return"Expected "+a(n)+" but "+c(t)+" found."};class o{static parse(n){return e(n)}}function u(n,t){if(null!=n)switch(t(n),n.type){case"when-clause":u(n.operand,t),u(n.value,t);break;case"case-expression":for(const r of n.clauses)u(r,t);"simple"===n.format&&u(n.operand,t),null!==n.else&&u(n.else,t);break;case"expression-list":for(const r of n.value)u(r,t);break;case"unary-expression":u(n.expr,t);break;case"binary-expression":u(n.left,t),u(n.right,t);break;case"function":u(n.args,t);break;case"interval":u(n.value,t),u(n.qualifier,t);break;case"interval-qualifier":u(n.start,t),u(n.end,t)}}export{o as WhereGrammar,u as visitAll};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{SqlError as r,SqlErrorCodes as e}from"./errorSupport.js";import{isDateTime as t,isTimestampOffset as n,isDateOnly as i,isTimeOnly as o}from"./sqlDateParsingUtils.js";import{SqlTimeStampOffset as a}from"./SqlTimestampOffset.js";import{isUnknownTimeZone as s}from"./UnknownTimeZone.js";import{isNumber as u,isString as f}from"../../support/guards.js";import{DateTime as c}from"luxon";const l=321408e5,w=26784e5,p=864e5,m=36e5,d=6e4;function h(r){return!!t(r)||!!n(r)}function O(r){return!!t(r)||(!!i(r)||(!!n(r)||!!o(r)))}function v(o){if(t(o))return o.toMillis();if(i(o))return o.toNumber();if(n(o))return o.toMilliseconds();throw new r(e.InvalidDataType)}function I(l,w,p,m){if(null==l||null==w)return null;if(u(l)){if(u(w))return D(l,w,p);if(f(w))return T(l,w,p);if(O(w))throw new r(e.InvalidOperator);if(i(w))throw new r(e.InvalidOperator)}else if(f(l)){if(u(w))return M(l,w,p);if(f(w))return z(l,w,p);if(t(w))throw new r(e.InvalidOperator);if(i(w))throw new r(e.InvalidOperator);if(o(w))throw new r(e.InvalidOperator);if(n(w))throw new r(e.InvalidOperator)}else if(t(l)){if(h(w)){if(l instanceof c&&s(l.zone)){if(w instanceof c&&!1===s(w.zone))return j(l,w,p);if(w instanceof a)return j(l,w,p)}else if(w instanceof c&&s(w.zone)){if(l instanceof c&&!1===s(l.zone))return j(l,w,p);if(l instanceof a)return j(l,w,p)}return D(v(l),v(w),p)}if(f(w))throw new r(e.InvalidOperator);if(i(w))return N(l,w,p);if(o(w))throw new r(e.InvalidOperator);if(u(w))throw new r(e.InvalidOperator)}else if(i(l)){if(n(w))return b(l,w,p);if(t(w))return x(l,w,p);if(f(w))throw new r(e.InvalidOperator);if(i(w))return D(l.toNumber(),w.toNumber(),p);if(o(w))throw new r(e.InvalidOperator);if(u(w))throw new r(e.InvalidOperator)}else if(o(l)){if(o(w))return D(l.toNumber(),w.toNumber(),p);if(f(w))throw new r(e.InvalidOperator);if(u(w))throw new r(e.InvalidOperator);if(i(w))throw new r(e.InvalidOperator);if(h(w))throw new r(e.InvalidOperator)}else if(n(l)){if(h(w))return w instanceof c&&s(w.zone)?j(l,w,p):D(v(l),v(w),p);if(f(w))throw new r(e.InvalidOperator);if(i(w))return y(l,w,p);if(o(w))throw new r(e.InvalidOperator);if(u(w))throw new r(e.InvalidOperator)}switch(p){case"<>":return l!==w;case"=":return l===w;case">":return l>w;case"<":return l<w;case">=":return l>=w;case"<=":return l<=w}}function D(r,e,t){switch(t){case"<>":return r!==e;case"=":return r===e;case">":return r>e;case"<":return r<e;case">=":return r>=e;case"<=":return r<=e}}function T(r,e,t){const n=parseFloat(e);if(!isNaN(n))return D(r,n,t);const i=r.toString();switch(t){case"<>":return i!==e;case"=":return i===e;case">":return i>e;case"<":return i<e;case">=":return i>=e;case"<=":return i<=e}}function M(r,e,t){const n=parseFloat(r);if(!isNaN(n))return D(n,e,t);const i=e.toString();switch(t){case"<>":return r!==i;case"=":return r===i;case">":return r>i;case"<":return r<i;case">=":return r>=i;case"<=":return r<=i}}function z(r,e,t){switch(t){case"<>":return r!==e;case"=":return r===e;case">":return r>e;case"<":return r<e;case">=":return r>=e;case"<=":return r<=e}}function N(r,e,t){const n=e.toDateTimeLuxon(r.zone);return D((r=r.startOf("day")).toMillis(),n.toMillis(),t)}function y(r,e,t){const n=e.toDateTimeLuxon(r.toDateTime().zone);return D((r=r.startOfDay()).toMilliseconds(),n.toMillis(),t)}function x(r,e,t){const n=r.toDateTimeLuxon(e.zone);return e=e.startOf("day"),D(n.toMillis(),e.toMillis(),t)}function b(r,e,t){const n=r.toDateTimeLuxon(e.toDateTime().zone);return e=e.startOfDay(),D(n.toMillis(),e.toMilliseconds(),t)}function j(r,e,t){r instanceof a&&(r=r.toDateTime()),e instanceof a&&(e=e.toDateTime());const n=g(r),i=g(e);switch(t){case"<>":return n!==i;case"=":return n===i;case">":return n>i;case"<":return n<i;case">=":return n>=i;case"<=":return n<=i}}function g(r){return r.year*l+r.month*w+r.day*p+r.hour*m+r.minute*d+1e3*r.second+r.millisecond}export{v as dateValueInMilliseconds,O as isDateOrTimeValue,h as isDateTimeComparableValue,I as sqlCompare};
5
+ import{SqlError as r,SqlErrorCodes as e}from"./errorSupport.js";import{isDateTime as t,isTimestampOffset as n,isDateOnly as i,isTimeOnly as o}from"./sqlDateParsingUtils.js";import{SqlTimeStampOffset as a}from"./SqlTimestampOffset.js";import{isUnknownTimeZone as s}from"./UnknownTimeZone.js";import{isNumber as u,isString as f}from"../../support/guards.js";import{DateTime as c}from"luxon";const l=321408e5,w=26784e5,m=864e5,p=36e5,d=6e4;function h(r){return!!t(r)||!!n(r)}function O(r){return!!t(r)||(!!i(r)||(!!n(r)||!!o(r)))}function v(o){if(t(o))return o.toMillis();if(i(o))return o.toNumber();if(n(o))return o.toMilliseconds();throw new r(e.InvalidDataType)}function I(l,w,m,p){if(null==l||null==w)return null;if(u(l)){if(u(w))return T(l,w,m);if(f(w))return D(l,w,m);if(O(w))throw new r(e.InvalidOperator);if(i(w))throw new r(e.InvalidOperator)}else if(f(l)){if(u(w))return M(l,w,m);if(f(w))return z(l,w,m);if(t(w))throw new r(e.InvalidOperator);if(i(w))throw new r(e.InvalidOperator);if(o(w))throw new r(e.InvalidOperator);if(n(w))throw new r(e.InvalidOperator)}else if(t(l)){if(h(w)){if(s(l.zone)){if(c.isDateTime(w)&&!s(w.zone))return j(l,w,m);if(a.isTimestampOffset(w))return j(l,w,m)}else if(c.isDateTime(w)&&s(w.zone)){if(!s(l.zone))return j(l,w,m);if(a.isTimestampOffset(l))return j(l,w,m)}return T(v(l),v(w),m)}if(f(w))throw new r(e.InvalidOperator);if(i(w))return N(l,w,m);if(o(w))throw new r(e.InvalidOperator);if(u(w))throw new r(e.InvalidOperator)}else if(i(l)){if(n(w))return b(l,w,m);if(t(w))return x(l,w,m);if(f(w))throw new r(e.InvalidOperator);if(i(w))return T(l.toNumber(),w.toNumber(),m);if(o(w))throw new r(e.InvalidOperator);if(u(w))throw new r(e.InvalidOperator)}else if(o(l)){if(o(w))return T(l.toNumber(),w.toNumber(),m);if(f(w))throw new r(e.InvalidOperator);if(u(w))throw new r(e.InvalidOperator);if(i(w))throw new r(e.InvalidOperator);if(h(w))throw new r(e.InvalidOperator)}else if(n(l)){if(h(w))return c.isDateTime(w)&&s(w.zone)?j(l,w,m):T(v(l),v(w),m);if(f(w))throw new r(e.InvalidOperator);if(i(w))return y(l,w,m);if(o(w))throw new r(e.InvalidOperator);if(u(w))throw new r(e.InvalidOperator)}switch(m){case"<>":return l!==w;case"=":return l===w;case">":return l>w;case"<":return l<w;case">=":return l>=w;case"<=":return l<=w}}function T(r,e,t){switch(t){case"<>":return r!==e;case"=":return r===e;case">":return r>e;case"<":return r<e;case">=":return r>=e;case"<=":return r<=e}}function D(r,e,t){const n=parseFloat(e);if(!isNaN(n))return T(r,n,t);const i=r.toString();switch(t){case"<>":return i!==e;case"=":return i===e;case">":return i>e;case"<":return i<e;case">=":return i>=e;case"<=":return i<=e}}function M(r,e,t){const n=parseFloat(r);if(!isNaN(n))return T(n,e,t);const i=e.toString();switch(t){case"<>":return r!==i;case"=":return r===i;case">":return r>i;case"<":return r<i;case">=":return r>=i;case"<=":return r<=i}}function z(r,e,t){switch(t){case"<>":return r!==e;case"=":return r===e;case">":return r>e;case"<":return r<e;case">=":return r>=e;case"<=":return r<=e}}function N(r,e,t){const n=e.toDateTimeLuxon(r.zone);return T((r=r.startOf("day")).toMillis(),n.toMillis(),t)}function y(r,e,t){const n=e.toDateTimeLuxon(r.toDateTime().zone);return T((r=r.startOfDay()).toMilliseconds(),n.toMillis(),t)}function x(r,e,t){const n=r.toDateTimeLuxon(e.zone);return e=e.startOf("day"),T(n.toMillis(),e.toMillis(),t)}function b(r,e,t){const n=r.toDateTimeLuxon(e.toDateTime().zone);return e=e.startOfDay(),T(n.toMillis(),e.toMilliseconds(),t)}function j(r,e,t){a.isTimestampOffset(r)&&(r=r.toDateTime()),a.isTimestampOffset(e)&&(e=e.toDateTime());const n=g(r),i=g(e);switch(t){case"<>":return n!==i;case"=":return n===i;case">":return n>i;case"<":return n<i;case">=":return n>=i;case"<=":return n<=i}}function g(r){return r.year*l+r.month*w+r.day*m+r.hour*p+r.minute*d+1e3*r.second+r.millisecond}export{v as dateValueInMilliseconds,O as isDateOrTimeValue,h as isDateTimeComparableValue,I as sqlCompare};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{DateOnly as n}from"./DateOnly.js";import{SqlError as e,SqlErrorCodes as t}from"./errorSupport.js";import{SqlInterval as r}from"./SqlInterval.js";import{SqlTimeStampOffset as a}from"./SqlTimestampOffset.js";import{TimeOnly as s}from"./TimeOnly.js";import{UnknownTimeZone as o,substituteUnknownTimezone as i}from"./UnknownTimeZone.js";import{Zone as l,DateTime as d}from"luxon";const p=/^(\d{1,2}):(\d{1,2}):(\d{1,2})$/,f=/^(\d{1,2}):(\d{1,2})$/,m=/^(\d{1,2}):(\d{1,2}):(\d{1,2}).([0-9]+)$/,I=/^(\d{4})-(\d{1,2})-(\d{1,2})$/,c=/^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})(\.[0-9]+)?$/,u=/^(\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})$/,w=/^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2})?[ ]{0,1}(\+|-)(\d{1,2}):(\d{1,2})$/,h=/^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2})$/;function T(n,e){if(e instanceof l)return e===o.instance?d.fromMillis(n.getTime(),{zone:o.instance}):d.fromJSDate(n,{zone:e});switch(e){case"system":case"local":case null:return d.fromJSDate(n);default:return"unknown"===e?.toLowerCase()?d.fromMillis(n.getTime(),{zone:o.instance}):d.fromJSDate(n,{zone:e})}}function v(n){return n instanceof r}function S(n){return n instanceof d}function x(e){return e instanceof n}function y(n){return n instanceof s}function j(n){return n instanceof a}function $(n){let r=p.exec(n);if(null!==r){const[,n,a,o]=r,i=s.fromParts(parseInt(n,10),parseInt(a,10),parseInt(o,10),0);if(null!==i)return i;throw new e(t.InvalidTime)}if(r=f.exec(n),null!==r){const[,n,a]=r,o=s.fromParts(parseInt(n,10),parseInt(a,10),0,0);if(null!==o)return o;throw new e(t.InvalidTime)}if(r=m.exec(n),null!==r){const[,n,a,o,i]=r,l=s.fromParts(parseInt(n,10),parseInt(a,10),parseInt(o,10),parseInt(i,10));if(null!==l)return l;throw new e(t.InvalidTime)}throw new e(t.InvalidTime)}function z(n,r,s=!1){let o=c.exec(n);if(null!==o){const[,n,a,s,l,p,f,m]=o,I=d.fromObject({year:parseInt(n,10),month:parseInt(a,10),day:parseInt(s,10),hour:parseInt(l,10),minute:parseInt(p,10),second:parseInt(f,10),millisecond:m?parseInt(m.replace(".",""),10):0},{zone:i(r)});if(!1===I.isValid)throw new e(t.InvalidTimeStamp);return I}if(o=u.exec(n),null!==o){const[,n,r,s,i,l,d,p,f,m,I]=o,c=a.fromParts(parseInt(n,10),parseInt(r,10),parseInt(s,10),parseInt(i,10),parseInt(l,10),parseInt(d,10),p?parseInt(p.replace(".",""),10):0,"-"===f,parseInt(m,10),parseInt(I,10));if(!1===c.isValid)throw new e(t.InvalidTimeStamp);return c}if(o=w.exec(n),null!==o){const[,n,r,s,i,l,d,p,f]=o,m=a.fromParts(parseInt(n,10),parseInt(r,10),parseInt(s,10),parseInt(i,10),parseInt(l,10),0,0,"-"===d,parseInt(p,10),parseInt(f,10));if(!1===m.isValid)throw new e(t.InvalidTimeStamp);return m}if(o=h.exec(n),null!==o){const[,n,a,s,l,p]=o,f=d.fromObject({year:parseInt(n,10),month:parseInt(a,10),day:parseInt(s,10),hour:parseInt(l,10),minute:parseInt(p,10),second:0},{zone:i(r)});if(!1===f.isValid)throw new e(t.InvalidTimeStamp);return f}if(o=I.exec(n),null!==o){const[,n,a,s]=o,l=d.fromObject({year:parseInt(n,10),month:parseInt(a,10),day:parseInt(s,10),hour:0,minute:0,second:0},{zone:i(r)});if(!1===l.isValid)throw new e(t.InvalidTimeStamp);return l}throw new e(t.InvalidTimeStamp)}function D(r,a){const s=I.exec(r);if(null===s)try{return z(r,a)}catch{throw new e(t.InvalidDate)}const[,o,i,l]=s,d=n.fromParts(parseInt(o,10),parseInt(i,10),parseInt(l,10));if(null===d)throw new e(t.InvalidDate);return d}export{T as convertToExecutingTimeZone,x as isDateOnly,S as isDateTime,v as isSqlInterval,y as isTimeOnly,j as isTimestampOffset,D as parseDate,$ as parseTime,z as parseTimestamp};
5
+ import{DateOnly as n}from"./DateOnly.js";import{SqlError as e,SqlErrorCodes as t}from"./errorSupport.js";import{SqlInterval as r}from"./SqlInterval.js";import{SqlTimeStampOffset as a}from"./SqlTimestampOffset.js";import{TimeOnly as s}from"./TimeOnly.js";import{UnknownTimeZone as i,substituteUnknownTimezone as o}from"./UnknownTimeZone.js";import{Zone as l,DateTime as p}from"luxon";const d=/^(\d{1,2}):(\d{1,2}):(\d{1,2})$/,m=/^(\d{1,2}):(\d{1,2})$/,I=/^(\d{1,2}):(\d{1,2}):(\d{1,2}).([0-9]+)$/,f=/^(\d{4})-(\d{1,2})-(\d{1,2})$/,u=/^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})(\.[0-9]+)?$/,c=/^(\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})$/,w=/^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2})?[ ]{0,1}(\+|-)(\d{1,2}):(\d{1,2})$/,h=/^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2})$/;function T(n,e){if(e instanceof l)return e===i.instance?p.fromMillis(n.getTime(),{zone:i.instance}):p.fromJSDate(n,{zone:e});switch(e){case"system":case"local":case null:return p.fromJSDate(n);default:return"unknown"===e?.toLowerCase()?p.fromMillis(n.getTime(),{zone:i.instance}):p.fromJSDate(n,{zone:e})}}function v(n){return r.isInterval(n)}function y(n){return p.isDateTime(n)}function S(e){return n.isDateOnly(e)}function x(n){return s.isTimeOnly(n)}function j(n){return a.isTimestampOffset(n)}function O(n){let r=d.exec(n);if(null!==r){const[,n,a,i]=r,o=s.fromParts(parseInt(n,10),parseInt(a,10),parseInt(i,10),0);if(null!==o)return o;throw new e(t.InvalidTime)}if(r=m.exec(n),null!==r){const[,n,a]=r,i=s.fromParts(parseInt(n,10),parseInt(a,10),0,0);if(null!==i)return i;throw new e(t.InvalidTime)}if(r=I.exec(n),null!==r){const[,n,a,i,o]=r,l=s.fromParts(parseInt(n,10),parseInt(a,10),parseInt(i,10),parseInt(o,10));if(null!==l)return l;throw new e(t.InvalidTime)}throw new e(t.InvalidTime)}function D(n,r,s=!1){let i=u.exec(n);if(null!==i){const[,n,a,s,l,d,m,I]=i,f=p.fromObject({year:parseInt(n,10),month:parseInt(a,10),day:parseInt(s,10),hour:parseInt(l,10),minute:parseInt(d,10),second:parseInt(m,10),millisecond:I?parseInt(I.replace(".",""),10):0},{zone:o(r)});if(!1===f.isValid)throw new e(t.InvalidTimeStamp);return f}if(i=c.exec(n),null!==i){const[,n,r,s,o,l,p,d,m,I,f]=i,u=a.fromParts(parseInt(n,10),parseInt(r,10),parseInt(s,10),parseInt(o,10),parseInt(l,10),parseInt(p,10),d?parseInt(d.replace(".",""),10):0,"-"===m,parseInt(I,10),parseInt(f,10));if(!1===u.isValid)throw new e(t.InvalidTimeStamp);return u}if(i=w.exec(n),null!==i){const[,n,r,s,o,l,p,d,m]=i,I=a.fromParts(parseInt(n,10),parseInt(r,10),parseInt(s,10),parseInt(o,10),parseInt(l,10),0,0,"-"===p,parseInt(d,10),parseInt(m,10));if(!1===I.isValid)throw new e(t.InvalidTimeStamp);return I}if(i=h.exec(n),null!==i){const[,n,a,s,l,d]=i,m=p.fromObject({year:parseInt(n,10),month:parseInt(a,10),day:parseInt(s,10),hour:parseInt(l,10),minute:parseInt(d,10),second:0},{zone:o(r)});if(!1===m.isValid)throw new e(t.InvalidTimeStamp);return m}if(i=f.exec(n),null!==i){const[,n,a,s]=i,l=p.fromObject({year:parseInt(n,10),month:parseInt(a,10),day:parseInt(s,10),hour:0,minute:0,second:0},{zone:o(r)});if(!1===l.isValid)throw new e(t.InvalidTimeStamp);return l}throw new e(t.InvalidTimeStamp)}function $(r,a){const s=f.exec(r);if(null===s)try{return D(r,a)}catch{throw new e(t.InvalidDate)}const[,i,o,l]=s,p=n.fromParts(parseInt(i,10),parseInt(o,10),parseInt(l,10));if(null===p)throw new e(t.InvalidDate);return p}export{T as convertToExecutingTimeZone,S as isDateOnly,y as isDateTime,v as isSqlInterval,x as isTimeOnly,j as isTimestampOffset,$ as parseDate,O as parseTime,D as parseTimestamp};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{neverReached as o}from"../../core/compilerUtils.js";import r from"../../core/Error.js";import t from"../../core/Loadable.js";import i from"../../core/Promise.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{reader as a}from"../../core/accessorSupport/decorators/reader.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import m from"./SharedTemplateMetadata.js";import{SharedTemplateRequiredPropsNotSetError as n}from"./support/sharedTemplateErrors.js";import{FeatureTemplateDefinition as d}from"./templateDefinitions/FeatureTemplateDefinition.js";import{GroupTemplateDefinition as f}from"./templateDefinitions/GroupTemplateDefinition.js";import{PresetTemplateDefinition as l}from"./templateDefinitions/PresetTemplateDefinition.js";const c=e=>u.fromJSON(e);let u=class extends(t.LoadableMixin(i.EsriPromiseMixin(m))){constructor(e){super(e),this.definition=null,this.type="feature",this.view=null}readDefinition(e,t){switch(t.type){case"feature":return d.fromJSON(e);case"group":return f.fromJSON(e);case"preset":return l.fromJSON(e);default:throw o(t.type),new r("shared-template:no-definition","No value for 'definition' provided to 'SharedTemplate' constructor")}}load(e){return this.addResolvingPromise(this._load(e)),Promise.resolve(this)}async _load(e){const{definition:o,featureService:r,view:t}=this;if(!o||!r||!t)throw new n;o.featureService=r,o.makeSharedTemplateFromJSON=c,o.view=t,await(this.definition?.load(e))}};e([s()],u.prototype,"definition",void 0),e([a("definition")],u.prototype,"readDefinition",null),e([s()],u.prototype,"layer",void 0),e([s()],u.prototype,"type",void 0),e([s()],u.prototype,"view",void 0),u=e([p("esri.editing.sharedTemplates.SharedTemplate")],u);const h=u;export{h as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{neverReached as o}from"../../core/compilerUtils.js";import t from"../../core/Error.js";import r from"../../core/Loadable.js";import i from"../../core/Promise.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{reader as a}from"../../core/accessorSupport/decorators/reader.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import n from"./SharedTemplateMetadata.js";import{SharedTemplateRequiredPropsNotSetError as m}from"./support/sharedTemplateErrors.js";import{FeatureTemplateDefinition as l}from"./templateDefinitions/FeatureTemplateDefinition.js";import{GroupTemplateDefinition as f}from"./templateDefinitions/GroupTemplateDefinition.js";import{PresetTemplateDefinition as d}from"./templateDefinitions/PresetTemplateDefinition.js";import{isFeatureTemplateDefinition as c}from"./templateDefinitions/templateDefinitionUtils.js";const u=e=>h.fromJSON(e);let h=class extends(r.LoadableMixin(i.EsriPromiseMixin(n))){constructor(e){super(e),this.definition=null,this.layer=null,this.type="feature",this.view=null}readDefinition(e,r){switch(r.type){case"feature":return l.fromJSON(e);case"group":return f.fromJSON(e);case"preset":return d.fromJSON(e);default:throw o(r.type),new t("shared-template:no-definition","No value for 'definition' provided to 'SharedTemplate' constructor")}}load(e){return this.addResolvingPromise(this._load(e)),Promise.resolve(this)}async _load(e){const{definition:o,featureService:t,layer:r,view:i}=this;if(!(o&&t&&r&&i))throw new m;o.featureService=t,o.makeSharedTemplateFromJSON=u,o.view=i,await(this.definition?.load(e)),c(o)&&o.initializeRelationshipMetadata(r)}};e([s()],h.prototype,"definition",void 0),e([a("definition")],h.prototype,"readDefinition",null),e([s()],h.prototype,"layer",void 0),e([s()],h.prototype,"type",void 0),e([s()],h.prototype,"view",void 0),h=e([p("esri.editing.sharedTemplates.SharedTemplate")],h);const j=h;export{j as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import o from"../../core/JSONSupport.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{reader as r}from"../../core/accessorSupport/decorators/reader.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{namedEditingToolGUIDDict as p}from"./support/toolNames.js";let a=class extends o{constructor(){super(...arguments),this.type="feature",this.templateId=null,this.defaultTool=null,this.description=null,this.globalId="",this.hash="",this.layerIds=[],this.name="",this.subtypeCode=null,this.status=null,this.userIdentity=null,this.tags=[],this.visible=!0}readDefaultTool(t){return null==t?null:p.fromJSON(t.toLowerCase())}readLayerIds(t,o){return null!=o.layerIds?o.layerIds.split(",").map((t=>parseInt(t.trim(),10))):null!=o.layerId?[o.layerId]:[]}readTags(t,o){const e=o.tag;return null==e?[]:e.split(";").map((t=>t.trim()))}};t([e()],a.prototype,"type",void 0),t([e({json:{read:!1,write:!1}})],a.prototype,"featureService",void 0),t([e()],a.prototype,"thumbnail",void 0),t([e()],a.prototype,"templateId",void 0),t([e()],a.prototype,"defaultTool",void 0),t([r("defaultTool",["defaultTool"])],a.prototype,"readDefaultTool",null),t([e()],a.prototype,"description",void 0),t([e()],a.prototype,"globalId",void 0),t([e()],a.prototype,"hash",void 0),t([e()],a.prototype,"layerIds",void 0),t([r("layerIds",["layerIds","layerId"])],a.prototype,"readLayerIds",null),t([e()],a.prototype,"name",void 0),t([e({json:{name:"subtype"}})],a.prototype,"subtypeCode",void 0),t([e()],a.prototype,"status",void 0),t([e()],a.prototype,"userIdentity",void 0),t([e()],a.prototype,"tags",void 0),t([r("tags",["tag"])],a.prototype,"readTags",null),t([e()],a.prototype,"visible",void 0),a=t([s("esri.editing.sharedTemplates.SharedTemplateMetadata")],a);const l=a;export{l as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import o from"../../core/JSONSupport.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{reader as r}from"../../core/accessorSupport/decorators/reader.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{namedEditingToolGUIDDict as p}from"./support/toolNames.js";let a=class extends o{constructor(t){super(t),this.type="feature",this.templateId=null,this.defaultTool=null,this.description=null,this.globalId="",this.hash="",this.layerIds=[],this.name="",this.subtypeCode=null,this.status=null,this.userIdentity=null,this.tags=[],this.visible=!0}readThumbnail(t){return null==t||""===t?null:{contentType:"png",imageData:t,height:64,width:64}}readDefaultTool(t){return null==t?null:p.fromJSON(t.toLowerCase())}readLayerIds(t,o){return null!=o.layerIds?o.layerIds.split(",").map((t=>parseInt(t.trim(),10))):null!=o.layerId?[o.layerId]:[]}readTags(t,o){const e=o.tag;return null==e?[]:e.split(";").map((t=>t.trim()))}};t([e()],a.prototype,"type",void 0),t([e({json:{read:!1,write:!1}})],a.prototype,"featureService",void 0),t([e()],a.prototype,"thumbnail",void 0),t([r("thumbnail")],a.prototype,"readThumbnail",null),t([e()],a.prototype,"templateId",void 0),t([e()],a.prototype,"defaultTool",void 0),t([r("defaultTool")],a.prototype,"readDefaultTool",null),t([e()],a.prototype,"description",void 0),t([e()],a.prototype,"globalId",void 0),t([e()],a.prototype,"hash",void 0),t([e()],a.prototype,"layerIds",void 0),t([r("layerIds",["layerIds","layerId"])],a.prototype,"readLayerIds",null),t([e()],a.prototype,"name",void 0),t([e({json:{name:"subtype"}})],a.prototype,"subtypeCode",void 0),t([e()],a.prototype,"status",void 0),t([e()],a.prototype,"userIdentity",void 0),t([e()],a.prototype,"tags",void 0),t([r("tags",["tag"])],a.prototype,"readTags",null),t([e()],a.prototype,"visible",void 0),a=t([s("esri.editing.sharedTemplates.SharedTemplateMetadata")],a);const l=a;export{l as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import r from"../../core/Accessor.js";import{makeHandle as o}from"../../core/handleUtils.js";import{getOrCreateMapValue as s}from"../../core/MapUtils.js";import{abortMaybe as a}from"../../core/maybe.js";import{onAbort as i,throwIfAborted as n,createAbortError as l,throwIfAbortError as c,createResolver as p}from"../../core/promiseUtils.js";import{watch as m}from"../../core/reactiveUtils.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import{isSharedPresetTemplate as u,isSharedFeatureTemplate as h}from"../templateUtils.js";import{SharedTemplateMissingTemplatesError as y,SharedTemplateLayerResolverError as v,SharedTemplateRequestError as w,SharedTemplateLayerUnavailableError as S}from"./support/sharedTemplateErrors.js";import{isFeatureLayer as g,isSubtypeGroupLayer as b}from"../../layers/support/layerUtils.js";const _=new Map;function j(e,t){return s(_,e,(()=>{const r=new R({layerResolver:t?.layerResolver??U(e),makeSharedTemplateFromJSON:t.makeSharedTemplateFromJSON,view:e});return e.addHandles(o((()=>{_.delete(e),r.destroy()}))),r}))}let R=class extends r{constructor(e){super(e),this._abortController=null,this._cache=new Map,this._pending=new Map,this.layerResolver=null,this.makeSharedTemplateFromJSON=null,this.view=null}initialize(){this.addHandles(m((()=>this.view.spatialReference),(()=>this._reset())))}destroy(){this._abortController=a(this._abortController)}async getTemplates({templateIds:e,featureService:t,signal:r}){const o=this._cache,s=this._pending,a=[],l=new Set,c=new Set,p=Symbol();for(const i of new Set(e)){const e=k(t,i);if(o.has(e))a.push(o.get(e));else if(s.has(e)){const t=s.get(e);t.subscribers.add(p),c.add(t)}else l.add(i),s.set(e,C())}if(a.length===e.length)return a;const m=()=>{for(const{subscribers:e}of c)e.delete(p)},d=i(r,m);try{const e=await this._loadTemplates({templateIds:Array.from(l),featureService:t,signal:r}),o=await Promise.all(Array.from(c).map((({resolver:e})=>e.promise)));a.push(...e),a.push(...o)}catch(f){m();for(const e of l){const r=k(t,e),o=s.get(r);o?.resolver.reject(f),s.delete(r)}throw f}finally{d?.remove()}return n(r),a}async _loadTemplates({templateIds:e,featureService:t,signal:r}){if(0===e.length)return[];const o=this._cache,s=this._pending,a=this._abortController=new AbortController,n=i(r,(()=>{for(const r of e){if(I(s.get(k(t,r))))return}a.abort()})),c=await T({featureService:t,templateIds:e,signal:a.signal,spatialReference:this.view.spatialReference});if(c.length<e.length)throw new y(e,c);const p=await Promise.all(c.map((e=>this._makeTemplate({json:e,featureService:t}))));for(const i of p){const e=k(t,i.templateId),a=s.get(e);!r?.aborted||I(a)?(o.set(e,i),a?.resolver.resolve(i)):a?.resolver.reject(l()),s.delete(e)}return n?.remove(),p}async _makeTemplate({json:e,featureService:t}){const{view:r}=this,o=this.makeSharedTemplateFromJSON(e);o.featureService=t,o.view=r;const{layerIds:s,subtypeCode:a}=o;try{o.layer=await this.layerResolver({featureService:t,layerIds:s,subtypeCode:a})}catch(i){throw new v(o.templateId,i)}if(u(o)&&o.definition){o.definition.spatialReference=r.spatialReference;for(const e of o.definition.allParts)e.geometry&&(e.geometry.spatialReference=r.spatialReference)}if(h(o)&&o.definition?.defaultValues){const e=o.definition.defaultValues,t={},{fieldsIndex:r}=o.layer;for(const s in o.definition.defaultValues)t[r.get(s)?.name??s]=e[s];o.definition.defaultValues=t}return o}_reset(){this._abortController?.abort(),this._cache.clear(),this._pending.clear()}};async function T({templateIds:e,featureService:r,spatialReference:o,signal:s}){const a=`${r.url}/sharedTemplates/templates`,i=await t(a,{query:{f:"json",outSR:o,ids:e.join(",")},signal:s}).catch((t=>{throw c(t),new w(e,t)}));return i.data?.templates??[]}function I(e){return null!=e&&e.subscribers.size>0}function C(){return{resolver:p(),subscribers:new Set}}function k(e,t){return`${e.url}/${t}`}function O(e){return g(e)||b(e)}function U(e){return async({featureService:t,layerIds:r})=>{const o=new Set(r),s=e.map.allLayers.find((e=>e.url===t.url&&O(e)&&o.has(e.layerId)));if(null==s)throw new S(r);return s}}e([d()],R.prototype,"_abortController",void 0),e([d()],R.prototype,"_cache",void 0),e([d()],R.prototype,"_pending",void 0),e([d({constructOnly:!0})],R.prototype,"layerResolver",void 0),e([d({constructOnly:!0})],R.prototype,"makeSharedTemplateFromJSON",void 0),e([d({constructOnly:!0})],R.prototype,"view",void 0),R=e([f("esri.editing.sharedTemplates.SharedTemplateProvider")],R);export{R as SharedTemplateProvider,j as getSharedTemplateProvider};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import r from"../../core/Accessor.js";import{makeHandle as o}from"../../core/handleUtils.js";import{getOrCreateMapValue as s}from"../../core/MapUtils.js";import{abortMaybe as a}from"../../core/maybe.js";import{onAbort as i,throwIfAborted as n,createAbortError as l,throwIfAbortError as c,createResolver as p}from"../../core/promiseUtils.js";import{watch as m}from"../../core/reactiveUtils.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import{isSharedPresetTemplate as u,isSharedFeatureTemplate as h}from"../templateUtils.js";import{SharedTemplateMissingTemplatesError as y,SharedTemplateLayerResolverError as v,SharedTemplateRequestError as w,SharedTemplateLayerUnavailableError as S}from"./support/sharedTemplateErrors.js";import{isFeatureLayer as g,isSubtypeGroupLayer as b}from"../../layers/support/layerUtils.js";const _=new Map;function j(e,t){return s(_,e,(()=>{const r=new R({layerResolver:t?.layerResolver??U(e),makeSharedTemplateFromJSON:t.makeSharedTemplateFromJSON,view:e});return e.addHandles(o((()=>{_.delete(e),r.destroy()}))),r}))}let R=class extends r{constructor(e){super(e),this._abortController=null,this._cache=new Map,this._pending=new Map,this.layerResolver=null,this.makeSharedTemplateFromJSON=null,this.view=null}initialize(){this.addHandles(m((()=>this.view.spatialReference),(()=>this._reset())))}destroy(){this._abortController=a(this._abortController)}async getTemplates({templateIds:e,featureService:t,signal:r}){const o=this._cache,s=this._pending,a=[],l=new Set,c=new Set,p=Symbol();for(const i of new Set(e)){const e=k(t,i);if(o.has(e))a.push(o.get(e));else if(s.has(e)){const t=s.get(e);t.subscribers.add(p),c.add(t)}else l.add(i),s.set(e,C())}if(a.length===e.length)return a;const m=()=>{for(const{subscribers:e}of c)e.delete(p)},d=i(r,m);try{const e=await this._loadTemplates({templateIds:Array.from(l),featureService:t,signal:r}),o=await Promise.all(Array.from(c).map((({resolver:e})=>e.promise)));a.push(...e),a.push(...o)}catch(f){m();for(const e of l){const r=k(t,e),o=s.get(r);o?.resolver.reject(f),s.delete(r)}throw f}finally{d?.remove()}return n(r),a}async _loadTemplates({templateIds:e,featureService:t,signal:r}){if(0===e.length)return[];const o=this._cache,s=this._pending,a=this._abortController=new AbortController,n=i(r,(()=>{for(const r of e){if(I(s.get(k(t,r))))return}a.abort()})),c=await T({featureService:t,templateIds:e,signal:a.signal,spatialReference:this.view.spatialReference});if(c.length<e.length)throw new y(e,c);const p=await Promise.all(c.map((e=>this._makeTemplate({json:e,featureService:t}))));for(const i of p){const e=k(t,i.templateId),a=s.get(e);!r?.aborted||I(a)?(o.set(e,i),a?.resolver.resolve(i)):a?.resolver.reject(l()),s.delete(e)}return n?.remove(),p}async _makeTemplate({json:e,featureService:t}){const{view:r}=this,o=this.makeSharedTemplateFromJSON(e);o.featureService=t,o.view=r;const{layerIds:s,subtypeCode:a}=o;try{o.layer=await this.layerResolver({featureService:t,layerIds:s,subtypeCode:a})}catch(i){throw new v(o.templateId,i)}if(u(o)&&o.definition){o.definition.spatialReference=r.spatialReference;for(const e of o.definition.allParts)e.geometry&&(e.geometry.spatialReference=r.spatialReference)}if(h(o)&&o.definition?.defaultValues){const e=o.definition.defaultValues,t={},{fieldsIndex:r}=o.layer;for(const s in o.definition.defaultValues)t[r.get(s)?.name??s]=e[s];o.definition.defaultValues=t}return o}_reset(){this._abortController?.abort(),this._cache.clear(),this._pending.clear()}};async function T({templateIds:e,featureService:r,spatialReference:o,signal:s}){const a=`${r.url}/sharedTemplates/templates`,i=await t(a,{query:{f:"json",outSR:o,ids:e.join(",")},signal:s}).catch((t=>{throw c(t),new w(e,t)}));return i.data?.templates??[]}function I(e){return null!=e&&e.subscribers.size>0}function C(){return{resolver:p(),subscribers:new Set}}function k(e,t){return`${e.url}/${t}`}function O(e){return g(e)||b(e)}function U(e){return async({featureService:t,layerIds:r})=>{const o=new Set(r),{allLayers:s,allTables:a}=e.map,i=s.concat(a).find((e=>e.url===t.url&&O(e)&&o.has(e.layerId)));if(null==i)throw new S(r);return i}}e([d()],R.prototype,"_abortController",void 0),e([d()],R.prototype,"_cache",void 0),e([d()],R.prototype,"_pending",void 0),e([d({constructOnly:!0})],R.prototype,"layerResolver",void 0),e([d({constructOnly:!0})],R.prototype,"makeSharedTemplateFromJSON",void 0),e([d({constructOnly:!0})],R.prototype,"view",void 0),R=e([f("esri.editing.sharedTemplates.SharedTemplateProvider")],R);export{R as SharedTemplateProvider,j as getSharedTemplateProvider};