@arcgis/core 4.33.0-next.20250509 → 4.33.0-next.20250511

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 (67) hide show
  1. package/applications/SceneViewer/sceneViewerUtils.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/06eb4832b6c86744e52e.js +1 -0
  4. package/assets/esri/core/workers/chunks/170c346cf5a18adb25b0.js +1 -0
  5. package/assets/esri/core/workers/chunks/253bcc3cc7bc4c2dc6ea.js +1 -0
  6. package/assets/esri/core/workers/chunks/{d874d24568b1acedebc4.js → 297d2c0a9d3f1e978318.js} +1 -1
  7. package/assets/esri/core/workers/chunks/4bd5cbf6e0be2fc7e84d.js +1 -0
  8. package/assets/esri/core/workers/chunks/{b1035bf4a016b1199236.js → 83d6a1b3db7d364d156b.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{7ed9a9c33a08ebba5570.js → 92cbe9af8a6c061bfb57.js} +1 -1
  10. package/assets/esri/core/workers/chunks/a1d697e2be1e892a666a.js +1 -0
  11. package/assets/esri/core/workers/chunks/{61c74a733718d667b071.js → d551f70560a2b1ef5696.js} +1 -1
  12. package/assets/esri/core/workers/chunks/f6a1fec33b0d81acce61.js +1 -0
  13. package/core/has.js +1 -1
  14. package/core/sql/StandardizedFunctions.js +1 -1
  15. package/core/sql/WhereGrammar.js +1 -1
  16. package/geometry/support/meshUtils/External.js +1 -1
  17. package/geometry/support/meshUtils/loadExternal.js +1 -1
  18. package/interfaces.d.ts +340 -14
  19. package/layers/SceneLayer.js +1 -1
  20. package/layers/VideoLayer.js +1 -1
  21. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  22. package/layers/graphics/sources/support/uploadAssets.js +1 -1
  23. package/layers/video/VideoController.js +1 -1
  24. package/package.json +1 -1
  25. package/rest/knowledgeGraph/wasmInterface/wasmToUpdateResponseFactories.js +1 -1
  26. package/rest/support/meshFeatureSet.js +1 -1
  27. package/smartMapping/renderers/size.js +1 -1
  28. package/smartMapping/renderers/support/spikeUtils.js +1 -1
  29. package/support/revision.js +1 -1
  30. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  31. package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
  32. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
  33. package/views/2d/layers/features/layerAdapters/featureServiceUtils.js +1 -1
  34. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  35. package/views/3d/layers/DynamicLayerView3D.js +1 -1
  36. package/views/3d/layers/I3SMeshView3D.js +1 -1
  37. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  38. package/views/3d/layers/SceneLayerView3D.js +1 -1
  39. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  40. package/views/3d/layers/graphics/GraphicsDeconflictor.js +1 -1
  41. package/views/3d/layers/graphics/LabelDeconflictor.js +1 -1
  42. package/views/3d/layers/i3s/I3SQueryEngine.js +1 -1
  43. package/views/3d/layers/i3s/I3SQueryFeatureAdapter.js +1 -1
  44. package/views/3d/layers/i3s/I3SQueryResultGeometry.js +5 -0
  45. package/views/3d/webgl/ManagedFBOResource.js +1 -1
  46. package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +1 -1
  47. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  48. package/views/interactive/keybindings.js +1 -1
  49. package/webdoc/IPSInfo.js +1 -1
  50. package/webdoc/ips/AppleIPSProperties.d.ts +4 -0
  51. package/webdoc/ips/AppleIPSProperties.js +5 -0
  52. package/webdoc/ips/Configuration.d.ts +4 -0
  53. package/webdoc/ips/Configuration.js +5 -0
  54. package/webdoc/ips/GNSSProperties.d.ts +4 -0
  55. package/webdoc/ips/GNSSProperties.js +5 -0
  56. package/webdoc/ips/PathSnappingProperties.d.ts +4 -0
  57. package/webdoc/ips/PathSnappingProperties.js +5 -0
  58. package/webdoc/ips/SmoothingProperties.d.ts +4 -0
  59. package/webdoc/ips/SmoothingProperties.js +5 -0
  60. package/widgets/Legend/support/sizeRampUtils.js +1 -1
  61. package/widgets/support/Selector2D/SelectionOperation.js +1 -1
  62. package/assets/esri/core/workers/chunks/46104db7f77952bb6c12.js +0 -1
  63. package/assets/esri/core/workers/chunks/47bbfc10c2a3b9e4bdd6.js +0 -1
  64. package/assets/esri/core/workers/chunks/49f0e53b3c9ba8451442.js +0 -1
  65. package/assets/esri/core/workers/chunks/5371df31553626528c69.js +0 -1
  66. package/assets/esri/core/workers/chunks/ad9bcd9dae45cdf90cbb.js +0 -1
  67. package/assets/esri/core/workers/chunks/c28d4717ed588c0d8bf1.js +0 -1
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[8368],{1262:(e,t,n)=>{n.d(t,{L8:()=>s,Z7:()=>r});var r,a,o=n(799);(a=r||(r={})).InvalidFunctionParameters="InvalidFunctionParameters",a.InvalidValueForAggregateFunction="InvalidValueForAggregateFunction",a.UnsupportedSqlFunction="UnsupportedSqlFunction",a.UnsupportedOperator="UnsupportedOperator",a.UnsupportedSyntax="UnsupportedSyntax",a.UnsupportedIsRhs="UnsupportedIsRhs",a.UnsupportedIsLhs="UnsupportedIsLhs",a.InvalidDataType="InvalidDataType",a.CannotCastValue="CannotCastValue",a.FunctionNotRecognized="FunctionNotRecognized",a.InvalidTime="InvalidTime",a.InvalidParameterCount="InvalidParameterCount",a.InvalidTimeStamp="InvalidTimeStamp",a.InvalidDate="InvalidDate",a.InvalidOperator="InvalidOperator",a.IllegalInterval="IllegalInterval",a.YearMonthIntervals="YearMonthIntervals",a.PrimarySecondaryQualifiers="PrimarySecondaryQualifiers",a.MissingStatisticParameters="MissingStatisticParameters";const i={[r.InvalidValueForAggregateFunction]:"Invalid value used in aggregate function",[r.MissingStatisticParameters]:"Statistic does not have 1 or 0 Parameters",[r.InvalidFunctionParameters]:"Invalid parameters for call to {function}",[r.UnsupportedIsLhs]:"Unsupported left hand expression in is statement",[r.UnsupportedIsRhs]:"Unsupported right hand expression in is statement",[r.UnsupportedOperator]:"Unsupported operator - {operator}",[r.UnsupportedSyntax]:"Unsupported syntax - {node}",[r.UnsupportedSqlFunction]:"Sql function not found = {function}",[r.InvalidDataType]:"Invalid sql data type",[r.InvalidDate]:"Invalid date encountered",[r.InvalidOperator]:"Invalid operator encountered",[r.InvalidTime]:"Invalid time encountered",[r.IllegalInterval]:"Illegal interval",[r.FunctionNotRecognized]:"Function not recognized",[r.InvalidTimeStamp]:"Invalid timestamp encountered",[r.InvalidParameterCount]:"Invalid parameter count for call to {name}",[r.PrimarySecondaryQualifiers]:"Primary and Secondary SqlInterval qualifiers not supported",[r.YearMonthIntervals]:"Year-Month Intervals not supported",[r.CannotCastValue]:"Cannot cast value to the required data type"};class s extends Error{constructor(e,t){super((0,o.HC)(i[e],t)),this.declaredRootClass="esri.arcade.featureset.support.sqlerror",Error.captureStackTrace&&Error.captureStackTrace(this,s)}}},55612:(e,t,n)=>{n.d(t,{g:()=>i});var r=n(96285);function a(e){return Number.isNaN(e)||0===e?e:Math.trunc(e)}const o="esri.core.sql.SqlTimeStampOffset";class i{constructor(e){this._timeStampOffset=e,this.declaredRootClass=o,this._date=null}static isTimestampOffset(e){return"object"==typeof e&&null!=e&&"declaredRootClass"in e&&e.declaredRootClass===o}toDateTime(){return this._date??=r.c9.fromISO(this._timeStampOffset,{setZone:!0}),this._date}get isValid(){return this.toDateTime().isValid}get timezoneOffsetHour(){return a(this.toDateTime().offset/60)}get timezoneOffsetMinutes(){return a(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(r.c9.fromJSDate(e).toISO({includeOffset:!0}))}static fromDateTime(e){return new i(e.toISO({includeOffset:!0}))}static fromParts(e,t,n=0,r=0,a=0,o=0,s=0,u=!1,l=0,c=0){const f=`${e.toString().padStart(4,"0")}-${t.toString().padStart(2,"0")}-${n.toString().padStart(2,"0")}`;let d="";o<10&&(d="0");let p=`${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${d+o.toString()}`;0!==s&&(p+="."+s.toString().padStart(3,"0"));const m=`${u?"-":"+"}${l.toString().padStart(2,"0")}:${c.toString().padStart(2,"0")}`;return new i(f+"T"+p+m)}toStorageFormat(){return this._timeStampOffset}toString(){return this._timeStampOffset}toSQLValue(){let e=this.toDateTime().toSQL({includeOffset:!0,includeOffsetSpace:!0});return e&&(e=e.replace(".000","")),e}toSQLWithKeyword(){return`timestamp '${this.toSQLValue()}'`}addMilliseconds(e){const t=this.toDateTime().plus(e);return i.fromDateTime(t)}}},74639:(e,t,n)=>{n.d(t,{M:()=>l,s:()=>u});var r=n(44729),a=n(1262),o=n(55612),i=n(15032),s=n(96285);function u(e,t){const n=c[e.toLowerCase()];if(null==n)throw new a.L8(a.Z7.FunctionNotRecognized);if(t.length<n.minParams||t.length>n.maxParams)throw new a.L8(a.Z7.InvalidParameterCount,{name:e.toUpperCase()});return n.evaluate(t)}function l(e,t){const n=c[e.toLowerCase()];return null!=n&&t>=n.minParams&&t<=n.maxParams}const c={min:{minParams:1,maxParams:1,evaluate:e=>p(e[0],"min")},max:{minParams:1,maxParams:1,evaluate:e=>p(e[0],"max")},avg:{minParams:1,maxParams:1,evaluate:e=>f(e[0])},sum:{minParams:1,maxParams:1,evaluate:e=>function(e){if(null===e)return null;let t=0;for(let n=0;n<e.length;n++){const r=e[n];if(null!==r){if(!d(r))throw new a.L8(a.Z7.InvalidValueForAggregateFunction);t+=r}}return t}(e[0])},stddev:{minParams:1,maxParams:1,evaluate:e=>function(e){if(null===e)return null;const t=m(e);return null===t?null:Math.sqrt(t)}(e[0])},count:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:e[0].length},var:{minParams:1,maxParams:1,evaluate:e=>m(e[0])}};function f(e){if(null===e)return null;let t=0,n=0;for(let r=0;r<e.length;r++){const o=e[r];if(null!==o){if(!d(o))throw new a.L8(a.Z7.InvalidValueForAggregateFunction);n++,t+=o}}return 0===n?null:t/e.length}function d(e){return"number"==typeof e}function p(e,t){if(null===e)return null;let n=null,a=null;for(const u of e){let e=u;e=r.n.isDateOnly(u)||i.k.isTimeOnly(u)?u.toNumber():s.c9.isDateTime(u)?u.toMillis():o.g.isTimestampOffset(u)?u.toMilliseconds():u,(null===n||"max"===t&&null!==a&&null!==e&&a<=e||"min"===t&&null!==a&&null!==e&&a>=e)&&(n=u,a=e)}return n}function m(e){if(null===e)return null;if(0===(e=e.filter((e=>null!==e))).length)return null;const t=f(e);if(null===t)return null;let n=0;for(const r of e){if(!d(r))throw new a.L8(a.Z7.InvalidValueForAggregateFunction);n+=(t-r)**2}return n/(e.length-1)}},88368:(e,t,n)=>{n.d(t,{A:()=>ce});var r=n(44208),a=n(74639),o=n(44729),i=n(1262);function s(e){if(null!==e.precision||null!==e.secondary)throw new i.L8(i.Z7.PrimarySecondaryQualifiers)}function u(e,t){if(t.includes(".")){const n=t.split(".");e.second=parseFloat(n[0]),e.millis=parseInt(n[1],10)}else e.second=parseFloat(t)}const l="esri.core.sql.SqlInterval";class c{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 c;return t.second=e/1e3,t}static createFromValueAndQualifier(e,t,n){let r=null;const a=new c;if(a.op="-"===n?"-":"+","interval-period"===t.type){s(t);const n=new RegExp("^[0-9]{1,}$");if("year"===t.period||"month"===t.period)throw new i.L8(i.Z7.YearMonthIntervals);if("second"===t.period){if(!/^[0-9]{1,}([.]{1}[0-9]{1,}){0,1}$/.test(e))throw new i.L8(i.Z7.IllegalInterval);u(a,e)}else{if(!n.test(e))throw new i.L8(i.Z7.IllegalInterval);a[t.period]=parseFloat(e)}}else{if(s(t.start),s(t.end),"year"===t.start.period||"month"===t.start.period||"year"===t.end.period||"month"===t.end.period)throw new i.L8(i.Z7.YearMonthIntervals);switch(t.start.period){case"day":switch(t.end.period){case"hour":if(r=new RegExp("^[0-9]{1,} [0-9]{1,}$"),!r.test(e))throw new i.L8(i.Z7.IllegalInterval);a[t.start.period]=parseFloat(e.split(" ")[0]),a[t.end.period]=parseFloat(e.split(" ")[1]);break;case"minute":if(r=new RegExp("^[0-9]{1,} [0-9]{1,2}:[0-9]{1,}$"),!r.test(e))throw new i.L8(i.Z7.IllegalInterval);{a[t.start.period]=parseFloat(e.split(" ")[0]);const n=e.split(" ")[1].split(":");a.hour=parseFloat(n[0]),a.minute=parseFloat(n[1])}break;case"second":if(r=new RegExp("^[0-9]{1,} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,}([.]{1}[0-9]{1,}){0,1}$"),!r.test(e))throw new i.L8(i.Z7.IllegalInterval);{a[t.start.period]=parseFloat(e.split(" ")[0]);const n=e.split(" ")[1].split(":");a.hour=parseFloat(n[0]),a.minute=parseFloat(n[1]),u(a,n[2])}break;default:throw new i.L8(i.Z7.IllegalInterval)}break;case"hour":switch(t.end.period){case"minute":if(r=new RegExp("^[0-9]{1,}:[0-9]{1,}$"),!r.test(e))throw new i.L8(i.Z7.IllegalInterval);a.hour=parseFloat(e.split(":")[0]),a.minute=parseFloat(e.split(":")[1]);break;case"second":if(r=new RegExp("^[0-9]{1,}:[0-9]{1,2}:[0-9]{1,}([.]{1}[0-9]{1,}){0,1}$"),!r.test(e))throw new i.L8(i.Z7.IllegalInterval);{const t=e.split(":");a.hour=parseFloat(t[0]),a.minute=parseFloat(t[1]),u(a,t[2])}break;default:throw new i.L8(i.Z7.IllegalInterval)}break;case"minute":if("second"!==t.end.period)throw new i.L8(i.Z7.IllegalInterval);if(r=new RegExp("^[0-9]{1,}:[0-9]{1,}([.]{1}[0-9]{1,}){0,1}$"),!r.test(e))throw new i.L8(i.Z7.IllegalInterval);{const t=e.split(":");a.minute=parseFloat(t[0]),u(a,t[1])}break;default:throw new i.L8(i.Z7.IllegalInterval)}}return a}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)}}var f=n(55612),d=n(15032),p=n(3330),m=n(96285);const h=/^(\d{1,2}):(\d{1,2}):(\d{1,2})$/,v=/^(\d{1,2}):(\d{1,2})$/,w=/^(\d{1,2}):(\d{1,2}):(\d{1,2}).([0-9]+)$/,I=/^(\d{4})-(\d{1,2})-(\d{1,2})$/,g=/^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})(\.[0-9]+)?$/,y=/^(\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})$/,L=/^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2})?[ ]{0,1}(\+|-)(\d{1,2}):(\d{1,2})$/,T=/^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2})$/;function N(e,t){if(t instanceof m.bo)return t===p.GB.instance?m.c9.fromMillis(e.getTime(),{zone:p.GB.instance}):m.c9.fromJSDate(e,{zone:t});switch(t){case"system":case"local":case null:return m.c9.fromJSDate(e);default:return"unknown"===t?.toLowerCase()?m.c9.fromMillis(e.getTime(),{zone:p.GB.instance}):m.c9.fromJSDate(e,{zone:t})}}function O(e){return c.isInterval(e)}function E(e){return m.c9.isDateTime(e)}function S(e){return o.n.isDateOnly(e)}function x(e){return d.k.isTimeOnly(e)}function C(e){return f.g.isTimestampOffset(e)}function Z(e){let t=h.exec(e);if(null!==t){const[,e,n,r]=t,a=d.k.fromParts(parseInt(e,10),parseInt(n,10),parseInt(r,10),0);if(null!==a)return a;throw new i.L8(i.Z7.InvalidTime)}if(t=v.exec(e),null!==t){const[,e,n]=t,r=d.k.fromParts(parseInt(e,10),parseInt(n,10),0,0);if(null!==r)return r;throw new i.L8(i.Z7.InvalidTime)}if(t=w.exec(e),null!==t){const[,e,n,r,a]=t,o=d.k.fromParts(parseInt(e,10),parseInt(n,10),parseInt(r,10),parseInt(a,10));if(null!==o)return o;throw new i.L8(i.Z7.InvalidTime)}throw new i.L8(i.Z7.InvalidTime)}function D(e,t,n=!1){let r=g.exec(e);if(null!==r){const[,e,n,a,o,s,u,l]=r,c=m.c9.fromObject({year:parseInt(e,10),month:parseInt(n,10),day:parseInt(a,10),hour:parseInt(o,10),minute:parseInt(s,10),second:parseInt(u,10),millisecond:l?parseInt(l.replace(".",""),10):0},{zone:(0,p.Qo)(t)});if(!1===c.isValid)throw new i.L8(i.Z7.InvalidTimeStamp);return c}if(r=y.exec(e),null!==r){const[,e,t,n,a,o,s,u,l,c,d]=r,p=f.g.fromParts(parseInt(e,10),parseInt(t,10),parseInt(n,10),parseInt(a,10),parseInt(o,10),parseInt(s,10),u?parseInt(u.replace(".",""),10):0,"-"===l,parseInt(c,10),parseInt(d,10));if(!1===p.isValid)throw new i.L8(i.Z7.InvalidTimeStamp);return p}if(r=L.exec(e),null!==r){const[,e,t,n,a,o,s,u,l]=r,c=f.g.fromParts(parseInt(e,10),parseInt(t,10),parseInt(n,10),parseInt(a,10),parseInt(o,10),0,0,"-"===s,parseInt(u,10),parseInt(l,10));if(!1===c.isValid)throw new i.L8(i.Z7.InvalidTimeStamp);return c}if(r=T.exec(e),null!==r){const[,e,n,a,o,s]=r,u=m.c9.fromObject({year:parseInt(e,10),month:parseInt(n,10),day:parseInt(a,10),hour:parseInt(o,10),minute:parseInt(s,10),second:0},{zone:(0,p.Qo)(t)});if(!1===u.isValid)throw new i.L8(i.Z7.InvalidTimeStamp);return u}if(r=I.exec(e),null!==r){const[,e,n,a]=r,o=m.c9.fromObject({year:parseInt(e,10),month:parseInt(n,10),day:parseInt(a,10),hour:0,minute:0,second:0},{zone:(0,p.Qo)(t)});if(!1===o.isValid)throw new i.L8(i.Z7.InvalidTimeStamp);return o}throw new i.L8(i.Z7.InvalidTimeStamp)}function M(e,t){const n=I.exec(e);if(null===n)try{return D(e,t)}catch{throw new i.L8(i.Z7.InvalidDate)}const[,r,a,s]=n,u=o.n.fromParts(parseInt(r,10),parseInt(a,10),parseInt(s,10));if(null===u)throw new i.L8(i.Z7.InvalidDate);return u}var _=n(34727),b=n(799),P=n(54218);function F(e){return!!E(e)||!!C(e)}function A(e){return!!(E(e)||S(e)||C(e)||x(e))}function R(e){if(E(e))return e.toMillis();if(S(e))return e.toNumber();if(C(e))return e.toMilliseconds();throw new i.L8(i.Z7.InvalidDataType)}function $(e,t,n){if(null==e||null==t)return null;if((0,P.Et)(e)){if((0,P.Et)(t))return U(e,t,n);if((0,P.Kg)(t))return function(e,t,n){const r=parseFloat(t);if(!isNaN(r))return U(e,r,n);const a=e.toString();switch(n){case"<>":return a!==t;case"=":return a===t;case">":return a>t;case"<":return a<t;case">=":return a>=t;case"<=":return a<=t}}(e,t,n);if(A(t))throw new i.L8(i.Z7.InvalidOperator);if(S(t))throw new i.L8(i.Z7.InvalidOperator)}else if((0,P.Kg)(e)){if((0,P.Et)(t))return function(e,t,n){const r=parseFloat(e);if(!isNaN(r))return U(r,t,n);const a=t.toString();switch(n){case"<>":return e!==a;case"=":return e===a;case">":return e>a;case"<":return e<a;case">=":return e>=a;case"<=":return e<=a}}(e,t,n);if((0,P.Kg)(t))return function(e,t,n){switch(n){case"<>":return e!==t;case"=":return e===t;case">":return e>t;case"<":return e<t;case">=":return e>=t;case"<=":return e<=t}}(e,t,n);if(E(t))throw new i.L8(i.Z7.InvalidOperator);if(S(t))throw new i.L8(i.Z7.InvalidOperator);if(x(t))throw new i.L8(i.Z7.InvalidOperator);if(C(t))throw new i.L8(i.Z7.InvalidOperator)}else if(E(e)){if(F(t)){if((0,p.Y4)(e.zone)){if(m.c9.isDateTime(t)&&!(0,p.Y4)(t.zone))return k(e,t,n);if(f.g.isTimestampOffset(t))return k(e,t,n)}else if(m.c9.isDateTime(t)&&(0,p.Y4)(t.zone)){if(!(0,p.Y4)(e.zone))return k(e,t,n);if(f.g.isTimestampOffset(e))return k(e,t,n)}return U(R(e),R(t),n)}if((0,P.Kg)(t))throw new i.L8(i.Z7.InvalidOperator);if(S(t))return function(e,t,n){const r=t.toDateTimeLuxon(e.zone);return U((e=e.startOf("day")).toMillis(),r.toMillis(),n)}(e,t,n);if(x(t))throw new i.L8(i.Z7.InvalidOperator);if((0,P.Et)(t))throw new i.L8(i.Z7.InvalidOperator)}else if(S(e)){if(C(t))return function(e,t,n){const r=e.toDateTimeLuxon(t.toDateTime().zone);return t=t.startOfDay(),U(r.toMillis(),t.toMilliseconds(),n)}(e,t,n);if(E(t))return function(e,t,n){const r=e.toDateTimeLuxon(t.zone);return t=t.startOf("day"),U(r.toMillis(),t.toMillis(),n)}(e,t,n);if((0,P.Kg)(t))throw new i.L8(i.Z7.InvalidOperator);if(S(t))return U(e.toNumber(),t.toNumber(),n);if(x(t))throw new i.L8(i.Z7.InvalidOperator);if((0,P.Et)(t))throw new i.L8(i.Z7.InvalidOperator)}else if(x(e)){if(x(t))return U(e.toNumber(),t.toNumber(),n);if((0,P.Kg)(t))throw new i.L8(i.Z7.InvalidOperator);if((0,P.Et)(t))throw new i.L8(i.Z7.InvalidOperator);if(S(t))throw new i.L8(i.Z7.InvalidOperator);if(F(t))throw new i.L8(i.Z7.InvalidOperator)}else if(C(e)){if(F(t))return m.c9.isDateTime(t)&&(0,p.Y4)(t.zone)?k(e,t,n):U(R(e),R(t),n);if((0,P.Kg)(t))throw new i.L8(i.Z7.InvalidOperator);if(S(t))return function(e,t,n){const r=t.toDateTimeLuxon(e.toDateTime().zone);return U((e=e.startOfDay()).toMilliseconds(),r.toMillis(),n)}(e,t,n);if(x(t))throw new i.L8(i.Z7.InvalidOperator);if((0,P.Et)(t))throw new i.L8(i.Z7.InvalidOperator)}switch(n){case"<>":return e!==t;case"=":return e===t;case">":return e>t;case"<":return e<t;case">=":return e>=t;case"<=":return e<=t}}function U(e,t,n){switch(n){case"<>":return e!==t;case"=":return e===t;case">":return e>t;case"<":return e<t;case">=":return e>=t;case"<=":return e<=t}}function k(e,t,n){f.g.isTimestampOffset(e)&&(e=e.toDateTime()),f.g.isTimestampOffset(t)&&(t=t.toDateTime());const r=V(e),a=V(t);switch(n){case"<>":return r!==a;case"=":return r===a;case">":return r>a;case"<":return r<a;case">=":return r>=a;case"<=":return r<=a}}function V(e){return 321408e5*e.year+26784e5*e.month+864e5*e.day+36e5*e.hour+6e4*e.minute+1e3*e.second+e.millisecond}function z(e,t,n){const r=K[e.toLowerCase()];if(null==r)throw new i.L8(i.Z7.FunctionNotRecognized);if(t.length<r.minParams||t.length>r.maxParams)throw new i.L8(i.Z7.InvalidParameterCount,{name:e.toUpperCase()});return r.evaluate(t,n)}function q(e){return!((0,P.$P)(e)||S(e)||E(e)||x(e)||C(e))}function H(e){return S(e)||x(e)?e.toString():C(e)?e.toSQLValue():E(e)?0===e.millisecond?e.toFormat("yyyy-LL-dd HH:mm:ss"):e.toSQL({includeOffset:!1}):(0,P.$P)(e)?H(m.c9.fromJSDate(e)):e.toString()}const K={extract:{minParams:2,maxParams:2,evaluate:([e,t])=>{if(null==t)return null;if((0,P.$P)(t))switch(e.toUpperCase()){case"SECOND":return t.getSeconds();case"MINUTE":return t.getMinutes();case"HOUR":return t.getHours();case"DAY":return t.getDate();case"MONTH":return t.getMonth()+1;case"YEAR":return t.getFullYear();case"TIMEZONE_HOUR":case"TIMEZONE_MINUTE":return 0;case"DOW":return m.c9.fromJSDate(t,{zone:"system"}).weekday;case"DOY":return m.c9.fromJSDate(t,{zone:"system"}).ordinal;case"WEEK":return m.c9.fromJSDate(t,{zone:"system"}).weekNumber}else if(E(t))switch(e.toUpperCase()){case"SECOND":return t.second;case"MINUTE":return t.minute;case"HOUR":return t.hour;case"DAY":return t.day;case"MONTH":return t.month;case"YEAR":return t.year;case"TIMEZONE_HOUR":case"TIMEZONE_MINUTE":throw new i.L8(i.Z7.InvalidFunctionParameters,{function:"EXTRACT"});case"DOW":return t.weekday;case"DOY":return t.ordinal;case"WEEK":return t.weekNumber}else if(S(t))switch(e.toUpperCase()){case"DAY":return t.day;case"MONTH":return t.month;case"YEAR":return t.year;case"TIMEZONE_HOUR":case"TIMEZONE_MINUTE":throw new i.L8(i.Z7.InvalidFunctionParameters,{function:"EXTRACT"});case"DOW":return t.toDateTime("unknown").weekday;case"DOY":return t.toDateTime("unknown").ordinal;case"WEEK":return t.toDateTime("unknown").weekNumber}else if(x(t))switch(e.toUpperCase()){case"SECOND":return t.second;case"MINUTE":return t.minute;case"HOUR":return t.hour}else if(C(t))switch(e.toUpperCase()){case"SECOND":return t.second;case"MINUTE":return t.minute;case"HOUR":return t.hour;case"DAY":return t.day;case"MONTH":return t.month;case"YEAR":return t.year;case"TIMEZONE_HOUR":return t.timezoneOffsetHour;case"TIMEZONE_MINUTE":return t.timezoneOffsetMinutes;case"DOW":return t.toDateTime().weekday;case"DOY":return t.toDateTime().ordinal;case"WEEK":return t.toDateTime().weekNumber}throw new i.L8(i.Z7.InvalidFunctionParameters,{function:"EXTRACT"})}},substring:{minParams:2,maxParams:3,evaluate:e=>{if(2===e.length){const[t,n]=e;return null==t||null==n?null:t.toString().substring(n-1)}if(3===e.length){const[t,n,r]=e;return null==t||null==n||null==r?null:r<=0?"":t.toString().substring(n-1,n+r-1)}}},position:{minParams:2,maxParams:2,evaluate:([e,t])=>null==e||null==t?null:t.indexOf(e)+1},trim:{minParams:2,maxParams:3,evaluate:e=>{const t=3===e.length,n=t?e[1]:" ",r=t?e[2]:e[1];if(null==n||null==r)return null;const a=`(${(0,b.Cj)(n)})`;switch(e[0]){case"BOTH":return r.replaceAll(new RegExp(`^${a}*|${a}*$`,"g"),"");case"LEADING":return r.replaceAll(new RegExp(`^${a}*`,"g"),"");case"TRAILING":return r.replaceAll(new RegExp(`${a}*$`,"g"),"")}throw new i.L8(i.Z7.InvalidFunctionParameters,{function:"TRIM"})}},abs:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:Math.abs(e[0])},ceiling:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:Math.ceil(e[0])},floor:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:Math.floor(e[0])},log:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:Math.log(e[0])},log10:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:Math.log(e[0])*Math.LOG10E},sin:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:Math.sin(e[0])},cos:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:Math.cos(e[0])},tan:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:Math.tan(e[0])},asin:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:Math.asin(e[0])},acos:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:Math.acos(e[0])},atan:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:Math.atan(e[0])},sign:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:e[0]>0?1:e[0]<0?-1:0},power:{minParams:2,maxParams:2,evaluate:e=>null==e[0]||null==e[1]?null:e[0]**e[1]},mod:{minParams:2,maxParams:2,evaluate:e=>null==e[0]||null==e[1]?null:e[0]%e[1]},round:{minParams:1,maxParams:2,evaluate:e=>{const t=e[0],n=2===e.length?10**e[1]:1;return null==t?null:Math.round(t*n)/n}},truncate:{minParams:1,maxParams:2,evaluate:e=>null==e[0]?null:1===e.length||0===e[1]?Math.trunc(e[0]):(0,_.pF)("trunc",e[0],-Number(e[1]))},char_length:{minParams:1,maxParams:1,evaluate:e=>(0,P.Kg)(e[0])?e[0].length:0},concat:{minParams:1,maxParams:1/0,evaluate:e=>{let t="";for(let n=0;n<e.length;n++){if(null==e[n])return null;t+=e[n].toString()}return t}},lower:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:e[0].toString().toLowerCase()},upper:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:e[0].toString().toUpperCase()},coalesce:{minParams:1,maxParams:1/0,evaluate:e=>{for(const t of e)if(null!==t)return t;return null}},cosh:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:Math.cosh(e[0])},sinh:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:Math.sinh(e[0])},tanh:{minParams:1,maxParams:1,evaluate:e=>null==e[0]?null:Math.tanh(e[0])},nullif:{minParams:2,maxParams:2,evaluate:e=>$(e[0],e[1],"=")?null:e[0]},cast:{minParams:2,maxParams:2,evaluate:(e,t)=>{const n=e[0],r=e[1];if(null===n)return null;switch(r.type){case"integer":{if(!q(n))throw new i.L8(i.Z7.CannotCastValue);const e=parseInt(n,10);if(isNaN(e))throw new i.L8(i.Z7.CannotCastValue);return e}case"smallint":{if(!q(n))throw new i.L8(i.Z7.CannotCastValue);const e=parseInt(n,10);if(isNaN(e))throw new i.L8(i.Z7.CannotCastValue);if(e>32767||e<-32767)throw new i.L8(i.Z7.CannotCastValue);return e}case"float":case"real":{if(!q(n))throw new i.L8(i.Z7.CannotCastValue);const e=parseFloat(n);if(isNaN(e))throw new i.L8(i.Z7.CannotCastValue);return e}case"time":return function(e){if((0,P.$P)(e))return d.k.fromDateJS(e);if(E(e))return d.k.fromDateTime(e);if(S(e))throw new i.L8(i.Z7.CannotCastValue);if(x(e))return e;if(C(e))return d.k.fromSqlTimeStampOffset(e);if((0,P.Kg)(e))return Z(e);throw new i.L8(i.Z7.CannotCastValue)}(n);case"date":return function(e){if((0,P.$P)(e))return o.n.fromDateJS(e);if(E(e))return o.n.fromParts(e.year,e.month,e.day);if(S(e))return e;if(x(e))throw new i.L8(i.Z7.CannotCastValue);if(C(e)&&null===o.n.fromParts(e.year,e.month,e.day))throw new i.L8(i.Z7.CannotCastValue);if((0,P.Kg)(e)){const t=o.n.fromReader(e);if(null!==t&&t.isValid)return t}throw new i.L8(i.Z7.CannotCastValue)}(n);case"timestamp":return function(e,t,n){if((0,P.$P)(e))return N(e,t);if(E(e))return e;if(S(e))return e.toDateTimeLuxon("unknown");if(x(e))throw new i.L8(i.Z7.CannotCastValue);if(C(e))return e;if((0,P.Kg)(e))return D(e,"unknown",n);throw new i.L8(i.Z7.CannotCastValue)}(n,t,!0===r.withtimezone);case"varchar":{const e=H(n);if(e.length>r.size)throw new i.L8(i.Z7.CannotCastValue);return e}default:throw new i.L8(i.Z7.InvalidDataType)}}}};function Y(e,t,n,r){if("||"===e)return z("concat",[t,n],r);if(null===t||null===n)return null;if((0,P.Et)(t)){if((0,P.Et)(n))return j(t,n,e);if(O(n))return function(e,t,n){switch(n){case"+":return c.createFromMilliseconds(e+t.valueInMilliseconds());case"-":return c.createFromMilliseconds(e-t.valueInMilliseconds());case"*":return c.createFromMilliseconds(e*t.valueInMilliseconds());case"/":return c.createFromMilliseconds(e/t.valueInMilliseconds())}throw new i.L8(i.Z7.InvalidOperator)}(t,n,e);if(x(n))return function(){throw new i.L8(i.Z7.InvalidOperator)}();if(S(n))return function(){throw new i.L8(i.Z7.InvalidOperator)}();if(C(n))return function(){throw new i.L8(i.Z7.InvalidOperator)}();if(E(n))return function(){throw new i.L8(i.Z7.InvalidOperator)}();if((0,P.Kg)(n))return function(e,t,n){const r=parseFloat(t);if(isNaN(r))throw new i.L8(i.Z7.InvalidOperator);return j(e,r,n)}(t,n,e);throw new i.L8(i.Z7.InvalidOperator)}if(S(t)){if((0,P.Et)(n))return function(e,t,n){const r=1e3*t*24*60*60;switch(n){case"+":return e.plus("milliseconds",r);case"-":return e.plus("milliseconds",-1*r)}throw new i.L8(i.Z7.InvalidOperator)}(t,n,e);if(O(n))return function(e,t,n){switch(n){case"+":return e.plus("milliseconds",t.valueInMilliseconds());case"-":return e.plus("milliseconds",-1*t.valueInMilliseconds())}throw new i.L8(i.Z7.InvalidOperator)}(t,n,e);if(x(n))return function(){throw new i.L8(i.Z7.InvalidOperator)}();if(S(n))return function(e,t,n){if("-"===n)return e.toDateTimeLuxon("UTC").diff(t.toDateTimeLuxon("UTC")).as("days");throw new i.L8(i.Z7.InvalidOperator)}(t,n,e);if(C(n))return function(e,t,n){if("-"===n)return e.toDateTimeLuxon(t.toDateTime().zone).diff(t.toDateTime()).as("days");throw new i.L8(i.Z7.InvalidOperator)}(t,n,e);if(E(n))return function(e,t,n){if("-"===n)return e.toDateTimeLuxon(t.zone).diff(t).as("days");throw new i.L8(i.Z7.InvalidOperator)}(t,n,e);if((0,P.Kg)(n))return function(){throw new i.L8(i.Z7.InvalidOperator)}();throw new i.L8(i.Z7.InvalidOperator)}if(x(t)){if((0,P.Et)(n))return function(e,t,n){const r=1e3*t*24*60*60;switch(n){case"+":return e.plus("milliseconds",r);case"-":return e.plus("milliseconds",-1*r)}throw new i.L8(i.Z7.InvalidOperator)}(t,n,e);if(O(n))return function(e,t,n){switch(n){case"+":return e.plus("milliseconds",t.valueInMilliseconds());case"-":return e.plus("milliseconds",-1*t.valueInMilliseconds())}throw new i.L8(i.Z7.InvalidOperator)}(t,n,e);if(x(n))return function(){throw new i.L8(i.Z7.InvalidOperator)}();if(S(n))return function(){throw new i.L8(i.Z7.InvalidOperator)}();if(C(n))return function(){throw new i.L8(i.Z7.InvalidOperator)}();if(E(n))return function(){throw new i.L8(i.Z7.InvalidOperator)}();if((0,P.Kg)(n))return function(){throw new i.L8(i.Z7.InvalidOperator)}();throw new i.L8(i.Z7.InvalidOperator)}if(O(t)){if((0,P.Et)(n))return function(e,t,n){switch(n){case"+":return c.createFromMilliseconds(e.valueInMilliseconds()+t);case"-":return c.createFromMilliseconds(e.valueInMilliseconds()-t);case"*":return c.createFromMilliseconds(e.valueInMilliseconds()*t);case"/":return c.createFromMilliseconds(e.valueInMilliseconds()/t)}throw new i.L8(i.Z7.InvalidOperator)}(t,n,e);if(O(n))return function(e,t,n){switch(n){case"+":return c.createFromMilliseconds(e.valueInMilliseconds()+t.valueInMilliseconds());case"-":return c.createFromMilliseconds(e.valueInMilliseconds()-t.valueInMilliseconds());case"*":return c.createFromMilliseconds(e.valueInMilliseconds()*t.valueInMilliseconds());case"/":return c.createFromMilliseconds(e.valueInMilliseconds()/t.valueInMilliseconds())}throw new i.L8(i.Z7.InvalidOperator)}(t,n,e);if(x(n))return function(e,t,n){if("+"===n)return t.plus("milliseconds",e.valueInMilliseconds());throw new i.L8(i.Z7.InvalidOperator)}(t,n,e);if(S(n))return function(e,t,n){if("+"===n)return t.plus("milliseconds",e.valueInMilliseconds());throw new i.L8(i.Z7.InvalidOperator)}(t,n,e);if(C(n))return function(e,t,n){if("+"===n)return t.addMilliseconds(e.valueInMilliseconds());throw new i.L8(i.Z7.InvalidOperator)}(t,n,e);if(E(n))return function(e,t,n){switch(n){case"+":return t.plus({milliseconds:e.valueInMilliseconds()});case"-":return e.valueInMilliseconds()-t.toMillis()}throw new i.L8(i.Z7.InvalidOperator)}(t,n,e);if((0,P.Kg)(n))return function(){throw new i.L8(i.Z7.InvalidOperator)}();throw new i.L8(i.Z7.InvalidOperator)}if(E(t)){if((0,P.Et)(n))return function(e,t,n){const r=1e3*t*24*60*60;switch(n){case"+":return e.plus({milliseconds:r});case"-":return e.minus({milliseconds:r})}throw new i.L8(i.Z7.InvalidOperator)}(t,n,e);if(O(n))return function(e,t,n){switch(n){case"+":return e.plus({milliseconds:t.valueInMilliseconds()});case"-":return e.minus({milliseconds:t.valueInMilliseconds()})}throw new i.L8(i.Z7.InvalidOperator)}(t,n,e);if(x(n))return function(){throw new i.L8(i.Z7.InvalidOperator)}();if(S(n))return function(e,t,n){if("-"===n)return e.diff(t.toDateTimeLuxon(e.zone)).as("days");throw new i.L8(i.Z7.InvalidOperator)}(t,n,e);if(C(n))return function(e,t,n){if("-"===n)return e.diff(t.toDateTime()).as("days");throw new i.L8(i.Z7.InvalidOperator)}(t,n,e);if(E(n))return function(e,t,n){if("-"===n)return e.diff(t).as("days");throw new i.L8(i.Z7.InvalidOperator)}(t,n,e);if((0,P.Kg)(n))return function(){throw new i.L8(i.Z7.InvalidOperator)}();throw new i.L8(i.Z7.InvalidOperator)}if(C(t)){if((0,P.Et)(n))return function(e,t,n){const r=1e3*t*24*60*60;switch(n){case"+":return e.addMilliseconds(r);case"-":return e.addMilliseconds(-1*r)}throw new i.L8(i.Z7.InvalidOperator)}(t,n,e);if(O(n))return function(e,t,n){switch(n){case"+":return e.addMilliseconds(t.valueInMilliseconds());case"-":return e.addMilliseconds(-1*t.valueInMilliseconds())}throw new i.L8(i.Z7.InvalidOperator)}(t,n,e);if(x(n))return function(){throw new i.L8(i.Z7.InvalidOperator)}();if(S(n))return function(e,t,n){if("-"===n)return e.toDateTime().diff(t.toDateTimeLuxon(e.toDateTime().zone)).as("days");throw new i.L8(i.Z7.InvalidOperator)}(t,n,e);if(C(n))return function(e,t,n){if("-"===n)return e.toDateTime().diff(t.toDateTime()).as("days");throw new i.L8(i.Z7.InvalidOperator)}(t,n,e);if(E(n))return function(e,t,n){if("-"===n)return e.toDateTime().diff(t).as("days");throw new i.L8(i.Z7.InvalidOperator)}(t,n,e);if((0,P.Kg)(n))return function(){throw new i.L8(i.Z7.InvalidOperator)}();throw new i.L8(i.Z7.InvalidOperator)}if((0,P.Kg)(t)){if((0,P.Et)(n))return function(e,t,n){const r=parseFloat(e);if(isNaN(r))throw new i.L8(i.Z7.InvalidOperator);return j(r,t,n)}(t,n,e);if(O(n))return function(){throw new i.L8(i.Z7.InvalidOperator)}();if(x(n))return function(){throw new i.L8(i.Z7.InvalidOperator)}();if(S(n))return function(){throw new i.L8(i.Z7.InvalidOperator)}();if(C(n))return function(){throw new i.L8(i.Z7.InvalidOperator)}();if(E(n))return function(){throw new i.L8(i.Z7.InvalidOperator)}();if((0,P.Kg)(n))return function(e,t,n){if("+"===n)return e+t;throw new i.L8(i.Z7.InvalidOperator)}(t,n,e);throw new i.L8(i.Z7.InvalidOperator)}throw new i.L8(i.Z7.InvalidOperator)}function j(e,t,n){switch(n){case"+":return e+t;case"-":return e-t;case"*":return e*t;case"/":return e/t}throw new i.L8(i.Z7.InvalidOperator)}class W extends SyntaxError{constructor(e,t,n,r){super(e),this.expected=t,this.found=n,this.location=r,this.name="SyntaxError"}format(e){let t="Error: "+this.message;if(this.location){let n=null;const r=e.find((e=>e.source===this.location.source));r&&(n=r.text.split(/\r\n|\n|\r/g));const a=this.location.start,o=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(a):a,i=this.location.source+":"+o.line+":"+o.column;if(n){const e=this.location.end,r="".padEnd(o.line.toString().length," "),s=n[a.line-1],u=(a.line===e.line?e.column:s.length+1)-a.column||1;t+="\n --\x3e "+i+"\n"+r+" |\n"+o.line+" | "+s+"\n"+r+" | "+"".padEnd(a.column-1," ")+"".padEnd(u,"^")}else t+="\n at "+i}return t}static buildMessage(e,t){function n(e){return e.codePointAt(0).toString(16).toUpperCase()}const r=Object.prototype.hasOwnProperty.call(RegExp.prototype,"unicode")?new RegExp("[\\p{C}\\p{Mn}\\p{Mc}]","gu"):null;function a(e){return r?e.replace(r,(e=>"\\u{"+n(e)+"}")):e}function o(e){return a(e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(e=>"\\x0"+n(e))).replace(/[\x10-\x1F\x7F-\x9F]/g,(e=>"\\x"+n(e))))}function i(e){return a(e.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,(e=>"\\x0"+n(e))).replace(/[\x10-\x1F\x7F-\x9F]/g,(e=>"\\x"+n(e))))}const s={literal:e=>'"'+o(e.text)+'"',class(e){const t=e.parts.map((e=>Array.isArray(e)?i(e[0])+"-"+i(e[1]):i(e)));return"["+(e.inverted?"^":"")+t.join("")+"]"+(e.unicode?"u":"")},any:()=>"any character",end:()=>"end of input",other:e=>e.description};function u(e){return s[e.type](e)}return"Expected "+function(e){const t=e.map(u);if(t.sort(),t.length>0){let e=1;for(let n=1;n<t.length;n++)t[n-1]!==t[n]&&(t[e]=t[n],e++);t.length=e}switch(t.length){case 1:return t[0];case 2:return t[0]+" or "+t[1];default:return t.slice(0,-1).join(", ")+", or "+t[t.length-1]}}(e)+" but "+function(e){return e?'"'+o(e)+'"':"end of input"}(t)+" found."}}function Q(e,t){const n={},r=(t=void 0!==t?t:{}).grammarSource,a={start:Tn};let o=Tn;const i="!",s="=",u=">=",l=">",c="<=",f="<>",d="!=",p="||",m="@",h="'",v="N'",w="''",I=".",g="null",y="true",L="false",T="in",N="is",O="like",E="escape",S="not",x="and",C="or",Z="between",D="from",M="for",_="substring",b="extract",P="trim",F="position",A="timestamp",R="date",$="time",U="leading",k="trailing",V="both",z="cast",q="as",H="integer",K="int",Y="smallint",j="float",Q="real",J="varchar",B="to",G="interval",X="year",ee="timezone_hour",te="timezone_minute",ne="month",re="day",ae="hour",oe="minute",ie="second",se="dow",ue="doy",le="week",ce="case",fe="end",de="when",pe="then",me="else",he=",",ve="(",we=")",Ie="`",ge=/^[<-=]/,ye=/^[+\-]/,Le=/^[*\/]/,Te=/^[A-Za-z_\x80-\uFFFF]/,Ne=/^[A-Za-z0-9_]/,Oe=/^[A-Za-z0-9_.\x80-\uFFFF]/,Ee=/^["]/,Se=/^[^']/,xe=/^[0-9]/,Ce=/^[eE]/,Ze=/^[ \t\n\r]/,De=/^[^`]/,Me=vn("!",!1),_e=vn("=",!1),be=vn(">=",!1),Pe=vn(">",!1),Fe=vn("<=",!1),Ae=vn("<>",!1),Re=wn([["<","="]],!1,!1,!1),$e=vn("!=",!1),Ue=wn(["+","-"],!1,!1,!1),ke=vn("||",!1),Ve=wn(["*","/"],!1,!1,!1),ze=wn([["A","Z"],["a","z"],"_",["€","￿"]],!1,!1,!1),qe=wn([["A","Z"],["a","z"],["0","9"],"_"],!1,!1,!1),He=wn([["A","Z"],["a","z"],["0","9"],"_",".",["€","￿"]],!1,!1,!1),Ke=wn(['"'],!1,!1,!1),Ye=vn("@",!1),je=vn("'",!1),We=vn("N'",!1),Qe=vn("''",!1),Je=wn(["'"],!0,!1,!1),Be=vn(".",!1),Ge=wn([["0","9"]],!1,!1,!1),Xe=wn(["e","E"],!1,!1,!1),et=vn("NULL",!0),tt=vn("TRUE",!0),nt=vn("FALSE",!0),rt=vn("IN",!0),at=vn("IS",!0),ot=vn("LIKE",!0),it=vn("ESCAPE",!0),st=vn("NOT",!0),ut=vn("AND",!0),lt=vn("OR",!0),ct=vn("BETWEEN",!0),ft=vn("FROM",!0),dt=vn("FOR",!0),pt=vn("SUBSTRING",!0),mt=vn("EXTRACT",!0),ht=vn("TRIM",!0),vt=vn("POSITION",!0),wt=vn("TIMESTAMP",!0),It=vn("DATE",!0),gt=vn("TIME",!0),yt=vn("LEADING",!0),Lt=vn("TRAILING",!0),Tt=vn("BOTH",!0),Nt=vn("CAST",!0),Ot=vn("AS",!0),Et=vn("INTEGER",!0),St=vn("INT",!0),xt=vn("SMALLINT",!0),Ct=vn("FLOAT",!0),Zt=vn("REAL",!0),Dt=vn("VARCHAR",!0),Mt=vn("TO",!0),_t=vn("INTERVAL",!0),bt=vn("YEAR",!0),Pt=vn("TIMEZONE_HOUR",!0),Ft=vn("TIMEZONE_MINUTE",!0),At=vn("MONTH",!0),Rt=vn("DAY",!0),$t=vn("HOUR",!0),Ut=vn("MINUTE",!0),kt=vn("SECOND",!0),Vt=vn("DOW",!0),zt=vn("DOY",!0),qt=vn("WEEK",!0),Ht=vn("CASE",!0),Kt=vn("END",!0),Yt=vn("WHEN",!0),jt=vn("THEN",!0),Wt=vn("ELSE",!0),Qt=vn(",",!1),Jt=vn("(",!1),Bt=vn(")",!1),Gt=wn([" ","\t","\n","\r"],!1,!1,!1),Xt=vn("`",!1),en=wn(["`"],!0,!1,!1);function tn(e,t,n){return{op:t,expr:n,location:mn()}}function nn(e,t,n){return{op:t,expr:n,location:mn()}}function rn(e,t){return{op:e,expr:t,location:mn()}}function an(e,t,n){return{op:t,expr:n,location:mn()}}function on(e,t,n){return{op:t,expr:n,location:mn()}}let sn=0|t.peg$currPos,un=sn;const ln=[{line:1,column:1}];let cn,fn=sn,dn=t.peg$maxFailExpected||[],pn=0|t.peg$silentFails;if(t.startRule){if(!(t.startRule in a))throw new Error("Can't start parsing from rule \""+t.startRule+'".');o=a[t.startRule]}function mn(){return gn(un,sn)}function hn(e,t){throw Ln(e,t=void 0!==t?t:gn(un,sn))}function vn(e,t){return{type:"literal",text:e,ignoreCase:t}}function wn(e,t,n,r){return{type:"class",parts:e,inverted:t,ignoreCase:n,unicode:r}}function In(t){let n,r=ln[t];if(r)return r;if(t>=ln.length)n=ln.length-1;else for(n=t;!ln[--n];);for(r=ln[n],r={line:r.line,column:r.column};n<t;)10===e.charCodeAt(n)?(r.line++,r.column=1):r.column++,n++;return ln[t]=r,r}function gn(e,t,n){const a=In(e),o=In(t);return{source:r,start:{offset:e,line:a.line,column:a.column},end:{offset:t,line:o.line,column:o.column}}}function yn(e){sn<fn||(sn>fn&&(fn=sn,dn=[]),dn.push(e))}function Ln(e,t){return new W(e,null,null,t)}function Tn(){let e,t;return e=sn,oa(),t=On(),t!==n?(oa(),un=e,e=t):(sn=e,e=n),e}function Nn(){let e,t,r,a,o,i,s,u;if(e=sn,t=ra(),t!==n){for(oa(),r=[],a=On();a!==n;)r.push(a),a=sn,o=sn,i=oa(),s=na(),s!==n?(u=oa(),i=[i,s,u],o=i):(sn=o,o=n),o!==n?(o=On(),o===n?(sn=a,a=n):a=o):a=o;a=oa(),o=aa(),o!==n?(un=e,e=function(e){return{type:"expression-list",location:mn(),value:e}}(r)):(sn=e,e=n)}else sn=e,e=n;return e}function On(){let e,t,r,a,o,i;if(e=sn,t=En(),t!==n){for(r=[],a=sn,oa(),o=vr(),o!==n?(oa(),i=En(),i!==n?(un=a,a=tn(0,o,i)):(sn=a,a=n)):(sn=a,a=n);a!==n;)r.push(a),a=sn,oa(),o=vr(),o!==n?(oa(),i=En(),i!==n?(un=a,a=tn(0,o,i)):(sn=a,a=n)):(sn=a,a=n);un=e,e=function(e,t){return ca(e,t)}(t,r)}else sn=e,e=n;return e}function En(){let e,t,r,a,o,i;if(e=sn,t=Sn(),t!==n){for(r=[],a=sn,oa(),o=hr(),o!==n?(oa(),i=Sn(),i!==n?(un=a,a=nn(0,o,i)):(sn=a,a=n)):(sn=a,a=n);a!==n;)r.push(a),a=sn,oa(),o=hr(),o!==n?(oa(),i=Sn(),i!==n?(un=a,a=nn(0,o,i)):(sn=a,a=n)):(sn=a,a=n);un=e,e=function(e,t){return ca(e,t)}(t,r)}else sn=e,e=n;return e}function Sn(){let t,r,a,o,u;return t=sn,r=mr(),r===n&&(r=sn,33===e.charCodeAt(sn)?(a=i,sn++):(a=n,0===pn&&yn(Me)),a!==n?(o=sn,pn++,61===e.charCodeAt(sn)?(u=s,sn++):(u=n,0===pn&&yn(_e)),pn--,u===n?o=void 0:(sn=o,o=n),o!==n?(a=[a,o],r=a):(sn=r,r=n)):(sn=r,r=n)),r!==n?(a=oa(),o=Sn(),o!==n?(un=t,t=function(e){return function(e,t,n){return{type:"unary-expression",location:n,operator:"NOT",expr:t}}(0,e,mn())}(o)):(sn=t,t=n)):(sn=t,t=n),t===n&&(t=function(){let e,t,r,a;return e=sn,t=Dn(),t!==n?(r=sn,oa(),a=function(){let e;return e=function(){let e,t,r,a,o;if(e=sn,t=[],r=sn,oa(),a=xn(),a!==n?(oa(),o=Dn(),o!==n?(un=r,r=rn(a,o)):(sn=r,r=n)):(sn=r,r=n),r!==n)for(;r!==n;)t.push(r),r=sn,oa(),a=xn(),a!==n?(oa(),o=Dn(),o!==n?(un=r,r=rn(a,o)):(sn=r,r=n)):(sn=r,r=n);else t=n;return t!==n&&(un=e,t=function(e){return{type:"arithmetic",tail:e}}(t)),e=t,e}(),e===n&&(e=function(){let e,t,r;return e=sn,t=Zn(),t!==n?(oa(),r=Nn(),r!==n?(un=e,e=function(e,t){return{op:e,right:t}}(t,r)):(sn=e,e=n)):(sn=e,e=n),e===n&&(e=sn,t=Zn(),t!==n?(oa(),r=Vn(),r!==n?(un=e,e=function(e,t){return{op:e,right:t}}(t,r)):(sn=e,e=n)):(sn=e,e=n)),e}(),e===n&&(e=function(){let e,t,r,a,o,i,s,u;return e=sn,t=mr(),t!==n?(oa(),r=wr(),r!==n?(a=oa(),o=sn,i=Dn(),i!==n?(oa(),s=hr(),s!==n?(oa(),u=Dn(),u!==n?(un=o,o=function(e,t,n){return la(mn(),t,n)}(0,i,u)):(sn=o,o=n)):(sn=o,o=n)):(sn=o,o=n),o!==n?(un=e,e=function(e,t){return{op:"NOT"+e,right:t}}(r,o)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n),e===n&&(e=sn,t=wr(),t!==n?(oa(),r=sn,a=Dn(),a!==n?(o=oa(),i=hr(),i!==n?(oa(),s=Dn(),s!==n?(un=r,r=function(e,t,n){return la(mn(),t,n)}(0,a,s)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n),r!==n?(un=e,e=function(e,t){return{op:e,right:t}}(t,r)):(sn=e,e=n)):(sn=e,e=n)),e}(),e===n&&(e=function(){let e,t,r,a;return e=sn,t=fr(),t!==n?(oa(),r=mr(),r!==n?(oa(),a=Dn(),a!==n?(un=e,e=function(e,t){return{op:e+"NOT",right:t}}(t,a)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n),e===n&&(e=sn,t=fr(),t!==n?(oa(),r=Dn(),r!==n?(un=e,e=function(e,t){return{op:e,right:t}}(t,r)):(sn=e,e=n)):(sn=e,e=n)),e}(),e===n&&(e=function(){let e,t,r,a,o;return e=sn,t=Cn(),t!==n?(oa(),r=Jn(),r!==n?(oa(),a=pr(),a!==n?(oa(),o=Bn(),o!==n?(un=e,e=function(e,t,n){return{op:e,right:t,escape:n.value}}(t,r,o)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n),e===n&&(e=sn,t=Cn(),t!==n?(oa(),r=Jn(),r!==n?(un=e,e=function(e,t){return{op:e,right:t,escape:""}}(t,r)):(sn=e,e=n)):(sn=e,e=n)),e}())))),e}(),a!==n?r=a:(sn=r,r=n),r===n&&(r=null),un=e,e=function(e,t){return""==t||null==t||null==t?e:"arithmetic"==t.type?ca(e,t.tail):ua(t.op,e,t.right,t.escape,mn())}(t,r)):(sn=e,e=n),e}()),t}function xn(){let t;return e.substr(sn,2)===u?(t=u,sn+=2):(t=n,0===pn&&yn(be)),t===n&&(62===e.charCodeAt(sn)?(t=l,sn++):(t=n,0===pn&&yn(Pe)),t===n&&(e.substr(sn,2)===c?(t=c,sn+=2):(t=n,0===pn&&yn(Fe)),t===n&&(e.substr(sn,2)===f?(t=f,sn+=2):(t=n,0===pn&&yn(Ae)),t===n&&(t=e.charAt(sn),ge.test(t)?sn++:(t=n,0===pn&&yn(Re)),t===n&&(e.substr(sn,2)===d?(t=d,sn+=2):(t=n,0===pn&&yn($e))))))),t}function Cn(){let e,t,r,a,o;return e=sn,t=sn,r=mr(),r!==n?(a=oa(),o=dr(),o!==n?(r=[r,a,o],t=r):(sn=t,t=n)):(sn=t,t=n),t!==n&&(un=e,t=function(e){return e[0]+" "+e[2]}(t)),e=t,e===n&&(e=dr()),e}function Zn(){let e,t,r,a,o;return e=sn,t=sn,r=mr(),r!==n?(a=oa(),o=cr(),o!==n?(r=[r,a,o],t=r):(sn=t,t=n)):(sn=t,t=n),t!==n&&(un=e,t=function(e){return e[0]+" "+e[2]}(t)),e=t,e===n&&(e=cr()),e}function Dn(){let e,t,r,a,o,i;if(e=sn,t=_n(),t!==n){for(r=[],a=sn,oa(),o=Mn(),o!==n?(oa(),i=_n(),i!==n?(un=a,a=an(0,o,i)):(sn=a,a=n)):(sn=a,a=n);a!==n;)r.push(a),a=sn,oa(),o=Mn(),o!==n?(oa(),i=_n(),i!==n?(un=a,a=an(0,o,i)):(sn=a,a=n)):(sn=a,a=n);un=e,e=function(e,t){return ca(e,t)}(t,r)}else sn=e,e=n;return e}function Mn(){let t;return t=e.charAt(sn),ye.test(t)?sn++:(t=n,0===pn&&yn(Ue)),t===n&&(e.substr(sn,2)===p?(t=p,sn+=2):(t=n,0===pn&&yn(ke))),t}function _n(){let e,t,r,a,o,i;if(e=sn,t=Pn(),t!==n){for(r=[],a=sn,oa(),o=bn(),o!==n?(oa(),i=Pn(),i!==n?(un=a,a=on(0,o,i)):(sn=a,a=n)):(sn=a,a=n);a!==n;)r.push(a),a=sn,oa(),o=bn(),o!==n?(oa(),i=Pn(),i!==n?(un=a,a=on(0,o,i)):(sn=a,a=n)):(sn=a,a=n);un=e,e=function(e,t){return ca(e,t)}(t,r)}else sn=e,e=n;return e}function bn(){let t;return t=e.charAt(sn),Le.test(t)?sn++:(t=n,0===pn&&yn(Ve)),t}function Pn(){let e,t,r,a;return e=function(){let e;return e=Bn(),e===n&&(e=function(){let e,t,r,a;return e=sn,t=function(){let e,t,r,a;return e=sn,t=tr(),t!==n?(r=nr(),r!==n?(a=rr(),a!==n?(un=e,e=function(e,t,n){return parseFloat(e+t+n)}(t,r,a)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n),e===n&&(e=sn,t=tr(),t!==n?(r=nr(),r!==n?(un=e,e=function(e,t){return parseFloat(e+t)}(t,r)):(sn=e,e=n)):(sn=e,e=n),e===n&&(e=sn,t=tr(),t!==n?(r=rr(),r!==n?(un=e,e=function(e,t){return parseFloat(e+t)}(t,r)):(sn=e,e=n)):(sn=e,e=n),e===n&&(e=sn,t=tr(),t!==n&&(un=e,t=function(e){return parseFloat(e)}(t)),e=t))),e}(),t!==n?(r=sn,pn++,a=An(),pn--,a===n?r=void 0:(sn=r,r=n),r!==n?(un=e,e=function(e){return{type:"number",location:mn(),value:e}}(t)):(sn=e,e=n)):(sn=e,e=n),e}(),e===n&&(e=function(){let e,t;return e=sn,t=ur(),t!==n&&(un=e,t={type:"boolean",location:mn(),value:!0}),e=t,e===n&&(e=sn,t=lr(),t!==n&&(un=e,t={type:"boolean",location:mn(),value:!1}),e=t),e}(),e===n&&(e=function(){let e,t;return e=sn,t=sr(),t!==n&&(un=e,t={type:"null",location:mn(),value:null}),e=t,e}(),e===n&&(e=function(){let e,t,r;return e=sn,t=Er(),t!==n?(oa(),r=Jn(),r!==n?(un=e,e=function(e){return"string"===e.type&&function(e){!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(e)&&hn("Date literal is invalid")}(e.value),{type:"date",location:mn(),value:e.value}}(r)):(sn=e,e=n)):(sn=e,e=n),e}(),e===n&&(e=function(){let e,t,r;return e=sn,t=Or(),t!==n?(oa(),r=Jn(),r!==n?(un=e,e=function(e){return"string"===e.type&&function(e){!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(e)&&hn("Timestamp literal is invalid")}(e.value),{type:"timestamp",location:mn(),value:e.value}}(r)):(sn=e,e=n)):(sn=e,e=n),e}(),e===n&&(e=Kn(),e===n&&(e=function(){let e,t,r;return e=sn,t=Sr(),t!==n?(oa(),r=Jn(),r!==n?(un=e,e=function(e){return"string"===e.type&&function(e){!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(e)&&hn("Time literal is invalid")}(e.value),{type:"time",location:mn(),value:e.value}}(r)):(sn=e,e=n)):(sn=e,e=n),e}()))))))),e}(),e===n&&(e=function(){let e,t,r,a,o,i,s,u;return e=sn,t=Lr(),t!==n?(oa(),r=sn,a=ra(),a!==n?(oa(),o=Hn(),o!==n?(oa(),i=Ir(),i!==n?(oa(),s=On(),s!==n?(oa(),u=aa(),u!==n?(un=r,r=function(e,t){return la(mn(),e,t)}(o,s)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n),r===n&&(r=sn,a=ra(),a!==n?(oa(),o=Hn(),o!==n?(oa(),i=na(),i!==n?(oa(),s=On(),s!==n?(oa(),u=aa(),u!==n?(un=r,r=function(e,t){return la(mn(),e,t)}(o,s)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n)),r!==n?(un=e,e=function(e){return{type:"function",location:mn(),name:"extract",args:e}}(r)):(sn=e,e=n)):(sn=e,e=n),e}(),e===n&&(e=function(){let e,t,r,a,o,i,s,u,l,c,f;return e=sn,t=yr(),t!==n?(oa(),r=sn,a=ra(),a!==n?(oa(),o=On(),o!==n?(oa(),i=Ir(),i!==n?(oa(),s=On(),s!==n?(oa(),u=sn,l=gr(),l!==n?(c=oa(),f=On(),f!==n?(oa(),u=f):(sn=u,u=n)):(sn=u,u=n),u===n&&(u=null),l=aa(),l!==n?(un=r,r=function(e,t,n){return la(mn(),e,t,...n?[n]:[])}(o,s,u)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n),r===n&&(r=sn,a=ra(),a!==n?(oa(),o=On(),o!==n?(oa(),i=na(),i!==n?(oa(),s=On(),s!==n?(oa(),u=na(),u!==n?(l=oa(),c=On(),c!==n?(f=aa(),f!==n?(un=r,r=function(e,t,n){return la(mn(),e,t,n)}(o,s,c)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n)),r!==n?(un=e,e=function(e){return{type:"function",location:mn(),name:"substring",args:e}}(r)):(sn=e,e=n)):(sn=e,e=n),e}(),e===n&&(e=function(){let e,t,r,a,o,i,s,u,l;return e=sn,t=Tr(),t!==n?(oa(),r=sn,a=ra(),a!==n?(oa(),o=qn(),oa(),i=On(),i!==n?(oa(),s=Ir(),s!==n?(oa(),u=On(),u!==n?(oa(),l=aa(),l!==n?(un=r,r=function(e,t,n){return la(mn(),e,t,n)}(o,i,u)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n),r===n&&(r=sn,a=ra(),a!==n?(oa(),o=qn(),oa(),i=On(),i!==n?(oa(),s=aa(),s!==n?(un=r,r=function(e,t){return la(mn(),e,t)}(o,i)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n)),r!==n?(un=e,e=function(e){return{type:"function",location:mn(),name:"trim",args:e}}(r)):(sn=e,e=n)):(sn=e,e=n),e}(),e===n&&(e=function(){let e,t,r,a,o,i,s,u;return e=sn,t=Nr(),t!==n?(oa(),r=sn,a=ra(),a!==n?(oa(),o=On(),o!==n?(oa(),i=cr(),i!==n?(oa(),s=On(),s!==n?(oa(),u=aa(),u!==n?(un=r,r=function(e,t){return la(mn(),e,t)}(o,s)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n),r===n&&(r=sn,a=ra(),a!==n?(oa(),o=On(),o!==n?(oa(),i=na(),i!==n?(oa(),s=On(),s!==n?(oa(),u=aa(),u!==n?(un=r,r=function(e,t){return la(mn(),e,t)}(o,s)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n)),r!==n?(un=e,e=function(e){return{type:"function",location:mn(),name:"position",args:e}}(r)):(sn=e,e=n)):(sn=e,e=n),e}(),e===n&&(e=function(){let e,t,r,a,o,i,s,u;return e=sn,t=Dr(),t!==n?(oa(),r=sn,a=ra(),a!==n?(oa(),o=On(),o!==n?(oa(),i=Mr(),i!==n?(oa(),s=zn(),s!==n?(oa(),u=aa(),u!==n?(un=r,r=function(e,t){return la(mn(),e,t)}(o,s)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n),r===n&&(r=sn,a=ra(),a!==n?(oa(),o=On(),o!==n?(oa(),i=na(),i!==n?(oa(),s=zn(),s!==n?(oa(),u=aa(),u!==n?(un=r,r=function(e,t){return la(mn(),e,t)}(o,s)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n)):(sn=r,r=n)),r!==n?(un=e,e=function(e){return{type:"function",location:mn(),name:"cast",args:e}}(r)):(sn=e,e=n)):(sn=e,e=n),e}(),e===n&&(e=function(){let e,t,r,a;return e=sn,t=sn,pn++,r=Lr(),pn--,r===n?t=void 0:(sn=t,t=n),t!==n?(r=sa(),r!==n?(oa(),a=Nn(),a!==n?(un=e,e=function(e,t){return{type:"function",location:mn(),name:e,args:t}}(r,a)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n),e}(),e===n&&(e=function(){let e;return e=function(){let e,t,r,a,o,i,s;if(e=sn,t=Br(),t!==n)if(oa(),r=On(),r!==n){for(oa(),a=[],o=sn,i=Xn(),i!==n?(s=oa(),o=i):(sn=o,o=n);o!==n;)a.push(o),o=sn,i=Xn(),i!==n?(s=oa(),o=i):(sn=o,o=n);o=Gr(),o!==n?(un=e,e=function(e,t){return{type:"case-expression",location:mn(),format:"simple",operand:e,clauses:t,else:null,elseLocation:null}}(r,a)):(sn=e,e=n)}else sn=e,e=n;else sn=e,e=n;if(e===n)if(e=sn,t=Br(),t!==n)if(oa(),r=On(),r!==n){for(oa(),a=[],o=sn,i=Xn(),i!==n?(s=oa(),o=i):(sn=o,o=n);o!==n;)a.push(o),o=sn,i=Xn(),i!==n?(s=oa(),o=i):(sn=o,o=n);o=er(),o!==n?(i=oa(),s=Gr(),s!==n?(un=e,e=function(e,t,n){return{type:"case-expression",location:mn(),format:"simple",operand:e,clauses:t,else:n.value,elseLocation:n.location}}(r,a,o)):(sn=e,e=n)):(sn=e,e=n)}else sn=e,e=n;else sn=e,e=n;return e}(),e===n&&(e=function(){let e,t,r,a,o,i;if(e=sn,t=Br(),t!==n){for(oa(),r=[],a=sn,o=Gn(),o!==n?(i=oa(),a=o):(sn=a,a=n);a!==n;)r.push(a),a=sn,o=Gn(),o!==n?(i=oa(),a=o):(sn=a,a=n);a=Gr(),a!==n?(un=e,e=function(e){return{type:"case-expression",location:mn(),format:"searched",clauses:e,else:null,elseLocation:null}}(r)):(sn=e,e=n)}else sn=e,e=n;if(e===n)if(e=sn,t=Br(),t!==n){for(oa(),r=[],a=sn,o=Gn(),o!==n?(i=oa(),a=o):(sn=a,a=n);a!==n;)r.push(a),a=sn,o=Gn(),o!==n?(i=oa(),a=o):(sn=a,a=n);a=er(),a!==n?(o=oa(),i=Gr(),i!==n?(un=e,e=function(e,t){return{type:"case-expression",location:mn(),format:"searched",clauses:e,else:t.value,elseLocation:t.location}}(r,a)):(sn=e,e=n)):(sn=e,e=n)}else sn=e,e=n;return e}()),e}(),e===n&&(e=function(){let e,t;return e=sn,t=function(){let e,t;return e=sn,t=function(){let e,t,r,a;if(e=sn,t=An(),t!==n){for(r=[],a=$n();a!==n;)r.push(a),a=$n();un=e,e=function(e,t){return e+t.join("")}(t,r)}else sn=e,e=n;return e}(),t!==n&&(un=e),e=t,e}(),t!==n&&(un=e,t=function(e){return/^CURRENT_DATE$/i.test(e)?{type:"current-time",location:mn(),mode:"date"}:/^CURRENT_TIMESTAMP$/i.test(e)?{type:"current-time",location:mn(),mode:"timestamp"}:/^CURRENT_TIME$/i.test(e)?{type:"current-time",location:mn(),mode:"time"}:/^CURRENT_USER$/i.test(e)?{type:"current-user",location:mn()}:{type:"column-reference",location:mn(),table:"",column:e}}(t)),e=t,e===n&&(e=sn,t=function(){let e,t,r,a;return e=sn,t=kn(),t!==n?(r=function(){let e,t,r;for(e=sn,t=[],r=Un();r!==n;)t.push(r),r=Un();return un=e,t=function(e){return e.join("")}(t),e=t,e}(),a=kn(),a!==n?(un=e,e=r):(sn=e,e=n)):(sn=e,e=n),e}(),t!==n&&(un=e,t=function(e){return{type:"column-reference",location:mn(),table:"",column:e,delimited:!0}}(t)),e=t),e}(),e===n&&(e=Vn(),e===n&&(e=sn,t=ra(),t!==n?(oa(),r=On(),r!==n?(oa(),a=aa(),a!==n?(un=e,e=function(e){return e.paren=!0,e}(r)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n))))))))))),e}function Fn(){let e,t,r,a;if(e=sn,t=An(),t!==n){for(r=[],a=Rn();a!==n;)r.push(a),a=Rn();un=e,e=function(e,t){return e+t.join("")}(t,r)}else sn=e,e=n;return e}function An(){let t;return t=e.charAt(sn),Te.test(t)?sn++:(t=n,0===pn&&yn(ze)),t}function Rn(){let t;return t=e.charAt(sn),Ne.test(t)?sn++:(t=n,0===pn&&yn(qe)),t}function $n(){let t;return t=e.charAt(sn),Oe.test(t)?sn++:(t=n,0===pn&&yn(He)),t}function Un(){let t;return t=function(){let t;return t=e.charAt(sn),Oe.test(t)?sn++:(t=n,0===pn&&yn(He)),t}(),t===n&&(t=function(){let e,t,r;return e=sn,t=kn(),t!==n?(r=kn(),r!==n?(un=e,e='"'):(sn=e,e=n)):(sn=e,e=n),e}()),t}function kn(){let t;return t=e.charAt(sn),Ee.test(t)?sn++:(t=n,0===pn&&yn(Ke)),t}function Vn(){let t,r,a,o;return t=sn,r=sn,64===e.charCodeAt(sn)?(a=m,sn++):(a=n,0===pn&&yn(Ye)),a!==n?(o=Fn(),o!==n?(a=[a,o],r=a):(sn=r,r=n)):(sn=r,r=n),r!==n&&(un=t,r=function(e){return{type:"parameter",location:mn(),value:e[1]}}(r)),t=r,t}function zn(){let e,t,r,a,o;return e=sn,t=_r(),t===n&&(t=br()),t!==n&&(un=e,t={type:"data-type",location:mn(),value:{type:"integer"}}),e=t,e===n&&(e=sn,t=Pr(),t!==n&&(un=e,t={type:"data-type",location:mn(),value:{type:"smallint"}}),e=t,e===n&&(e=sn,t=Fr(),t!==n&&(un=e,t={type:"data-type",location:mn(),value:{type:"float"}}),e=t,e===n&&(e=sn,t=Ar(),t!==n&&(un=e,t={type:"data-type",location:mn(),value:{type:"real"}}),e=t,e===n&&(e=sn,t=Er(),t!==n&&(un=e,t={type:"data-type",location:mn(),value:{type:"date"}}),e=t,e===n&&(e=sn,t=Or(),t!==n&&(un=e,t={type:"data-type",location:mn(),value:{type:"timestamp"}}),e=t,e===n&&(e=sn,t=Sr(),t!==n&&(un=e,t={type:"data-type",location:mn(),value:{type:"time"}}),e=t,e===n&&(e=sn,t=Rr(),t!==n?(oa(),r=ra(),r!==n?(oa(),a=ar(),a!==n?(oa(),o=aa(),o!==n?(un=e,e=function(e){return{type:"data-type",location:mn(),value:{type:"varchar",size:parseInt(e)}}}(a)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n)))))))),e}function qn(){let e,t;return e=sn,t=xr(),t===n&&(t=Cr(),t===n&&(t=Zr())),t===n&&(t=null),un=e,t=function(e){return{type:"string",location:mn(),value:e??"BOTH"}}(t),e=t,e}function Hn(){let e,t;return e=sn,t=kr(),t===n&&(t=qr(),t===n&&(t=Hr(),t===n&&(t=Kr(),t===n&&(t=Yr(),t===n&&(t=jr(),t===n&&(t=Vr(),t===n&&(t=zr(),t===n&&(t=Wr(),t===n&&(t=Qr(),t===n&&(t=Jr())))))))))),t!==n&&(un=e,t=function(e){return{type:"string",location:mn(),value:e}}(t)),e=t,e}function Kn(){let t,r,a,o,i;return t=sn,r=Ur(),r!==n?(oa(),a=e.charAt(sn),ye.test(a)?sn++:(a=n,0===pn&&yn(Ue)),a!==n?(oa(),o=Jn(),o!==n?(oa(),i=Yn(),i!==n?(un=t,t=function(e,t,n){return{type:"interval",location:mn(),value:t,qualifier:n,op:e}}(a,o,i)):(sn=t,t=n)):(sn=t,t=n)):(sn=t,t=n)):(sn=t,t=n),t===n&&(t=sn,r=Ur(),r!==n?(oa(),a=Jn(),a!==n?(oa(),o=Yn(),o!==n?(un=t,t=function(e,t){return{type:"interval",location:mn(),value:e,qualifier:t,op:""}}(a,o)):(sn=t,t=n)):(sn=t,t=n)):(sn=t,t=n)),t}function Yn(){let e,t,r,a;return e=sn,t=function(){let e,t,r,a,o;return e=sn,t=jn(),t!==n?(oa(),r=ra(),r!==n?(oa(),a=Qn(),a!==n?(oa(),o=aa(),o!==n?(un=e,e=function(e,t){return{type:"interval-period",location:mn(),period:e.value,precision:t,secondary:null}}(t,a)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n),e===n&&(e=sn,t=jn(),t!==n&&(un=e,t=function(e){return{type:"interval-period",location:mn(),period:e.value,precision:null,secondary:null}}(t)),e=t),e}(),t!==n?(oa(),r=$r(),r!==n?(oa(),a=function(){let e,t,r,a,o,i,s;return e=sn,t=jn(),t!==n&&(un=e,t=function(e){return{type:"interval-period",location:mn(),period:e.value,precision:null,secondary:null}}(t)),e=t,e===n&&(e=sn,t=jr(),t!==n?(oa(),r=ra(),r!==n?(oa(),a=Qn(),a!==n?(oa(),o=na(),o!==n?(oa(),i=Wn(),i!==n?(oa(),s=aa(),s!==n?(un=e,e=function(e,t){return{type:"interval-period",location:mn(),period:"second",precision:e,secondary:t}}(a,i)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n),e===n&&(e=sn,t=jr(),t!==n?(oa(),r=ra(),r!==n?(oa(),a=Qn(),a!==n?(oa(),o=aa(),o!==n?(un=e,e=function(e){return{type:"interval-period",location:mn(),period:"second",precision:e,secondary:null}}(a)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n),e===n&&(e=sn,t=jr(),t!==n&&(un=e,t={type:"interval-period",location:mn(),period:"second",precision:null,secondary:null}),e=t))),e}(),a!==n?(un=e,e=function(e,t){return{type:"interval-qualifier",location:mn(),start:e,end:t}}(t,a)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n),e===n&&(e=function(){let e,t,r,a,o,i,s;return e=sn,t=jn(),t!==n?(oa(),r=ra(),r!==n?(oa(),a=Wn(),a!==n?(oa(),o=aa(),o!==n?(un=e,e=function(e,t){return{type:"interval-period",location:mn(),period:e.value,precision:t,secondary:null}}(t,a)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n),e===n&&(e=sn,t=jn(),t!==n&&(un=e,t=function(e){return{type:"interval-period",location:mn(),period:e.value,precision:null,secondary:null}}(t)),e=t,e===n&&(e=sn,t=jr(),t!==n?(oa(),r=ra(),r!==n?(oa(),a=Qn(),a!==n?(oa(),o=na(),o!==n?(oa(),i=Wn(),i!==n?(oa(),s=aa(),s!==n?(un=e,e=function(e,t){return{type:"interval-period",location:mn(),period:"second",precision:e,secondary:t}}(a,i)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n),e===n&&(e=sn,t=jr(),t!==n?(oa(),r=ra(),r!==n?(oa(),a=Wn(),a!==n?(oa(),o=aa(),o!==n?(un=e,e=function(e){return{type:"interval-period",location:mn(),period:"second",precision:e,secondary:null}}(a)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n),e===n&&(e=sn,t=jr(),t!==n&&(un=e,t={type:"interval-period",location:mn(),period:"second",precision:null,secondary:null}),e=t)))),e}()),e}function jn(){let e,t;return e=sn,t=Hr(),t!==n&&(un=e,t={type:"string",location:mn(),value:"day"}),e=t,e===n&&(e=sn,t=Kr(),t!==n&&(un=e,t={type:"string",location:mn(),value:"hour"}),e=t,e===n&&(e=sn,t=Yr(),t!==n&&(un=e,t={type:"string",location:mn(),value:"minute"}),e=t,e===n&&(e=sn,t=qr(),t!==n&&(un=e,t={type:"string",location:mn(),value:"month"}),e=t,e===n&&(e=sn,t=kr(),t!==n&&(un=e,t={type:"string",location:mn(),value:"year"}),e=t)))),e}function Wn(){let e,t;return e=sn,t=ar(),t!==n&&(un=e,t=function(e){return parseFloat(e)}(t)),e=t,e}function Qn(){let e,t;return e=sn,t=ar(),t!==n&&(un=e,t=function(e){return parseFloat(e)}(t)),e=t,e}function Jn(){let e;return e=Bn(),e===n&&(e=Vn()),e}function Bn(){let t,r,a,o,i;if(t=sn,39===e.charCodeAt(sn)?(r=h,sn++):(r=n,0===pn&&yn(je)),r===n&&(e.substr(sn,2)===v?(r=v,sn+=2):(r=n,0===pn&&yn(We))),r!==n){for(a=[],o=sn,e.substr(sn,2)===w?(i=w,sn+=2):(i=n,0===pn&&yn(Qe)),i!==n&&(un=o,i="'"),o=i,o===n&&(o=e.charAt(sn),Se.test(o)?sn++:(o=n,0===pn&&yn(Je)));o!==n;)a.push(o),o=sn,e.substr(sn,2)===w?(i=w,sn+=2):(i=n,0===pn&&yn(Qe)),i!==n&&(un=o,i="'"),o=i,o===n&&(o=e.charAt(sn),Se.test(o)?sn++:(o=n,0===pn&&yn(Je)));39===e.charCodeAt(sn)?(o=h,sn++):(o=n,0===pn&&yn(je)),o!==n?(un=t,t=function(e){return{type:"string",location:mn(),value:e.join("")}}(a)):(sn=t,t=n)}else sn=t,t=n;return t}function Gn(){let e,t,r,a,o;return e=sn,t=Xr(),t!==n?(oa(),r=On(),r!==n?(oa(),a=ea(),a!==n?(oa(),o=On(),o!==n?(un=e,e=function(e,t){return{type:"when-clause",location:mn(),operand:e,value:t}}(r,o)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n),e}function Xn(){let e,t,r,a,o;return e=sn,t=Xr(),t!==n?(oa(),r=On(),r!==n?(oa(),a=ea(),a!==n?(oa(),o=On(),o!==n?(un=e,e=function(e,t){return{type:"when-clause",location:mn(),operand:e,value:t}}(r,o)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n)):(sn=e,e=n),e}function er(){let e,t,r;return e=sn,t=ta(),t!==n?(oa(),r=On(),r!==n?(un=e,e=function(e){return{type:"else-clause",location:mn(),value:e}}(r)):(sn=e,e=n)):(sn=e,e=n),e}function tr(){let t,r,a;return t=ar(),t===n&&(t=sn,r=e.charAt(sn),ye.test(r)?sn++:(r=n,0===pn&&yn(Ue)),r!==n?(a=ar(),a!==n?(un=t,t=function(e,t){return e[0]+t}(r,a)):(sn=t,t=n)):(sn=t,t=n)),t}function nr(){let t,r,a;return t=sn,46===e.charCodeAt(sn)?(r=I,sn++):(r=n,0===pn&&yn(Be)),r!==n?(a=ar(),a===n&&(a=null),un=t,t=function(e){return"."+(null!=e?e:"")}(a)):(sn=t,t=n),t}function rr(){let e,t,r;return e=sn,t=ir(),t!==n?(r=ar(),r!==n?(un=e,e=function(e,t){return e+t}(t,r)):(sn=e,e=n)):(sn=e,e=n),e}function ar(){let e,t,r;if(e=sn,t=[],r=or(),r!==n)for(;r!==n;)t.push(r),r=or();else t=n;return t!==n&&(un=e,t=function(e){return e.join("")}(t)),e=t,e}function or(){let t;return t=e.charAt(sn),xe.test(t)?sn++:(t=n,0===pn&&yn(Ge)),t}function ir(){let t,r,a;return t=sn,r=e.charAt(sn),Ce.test(r)?sn++:(r=n,0===pn&&yn(Xe)),r!==n?(a=e.charAt(sn),ye.test(a)?sn++:(a=n,0===pn&&yn(Ue)),a===n&&(a=null),un=t,t=function(e,t){return"e"+(null===t?"":t)}(0,a)):(sn=t,t=n),t}function sr(){let t,r,a,o;return t=sn,r=e.substr(sn,4),r.toLowerCase()===g?sn+=4:(r=n,0===pn&&yn(et)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(r=[r,a],t=r):(sn=t,t=n)):(sn=t,t=n),t}function ur(){let t,r,a,o;return t=sn,r=e.substr(sn,4),r.toLowerCase()===y?sn+=4:(r=n,0===pn&&yn(tt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(r=[r,a],t=r):(sn=t,t=n)):(sn=t,t=n),t}function lr(){let t,r,a,o;return t=sn,r=e.substr(sn,5),r.toLowerCase()===L?sn+=5:(r=n,0===pn&&yn(nt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(r=[r,a],t=r):(sn=t,t=n)):(sn=t,t=n),t}function cr(){let t,r,a,o;return t=sn,r=e.substr(sn,2),r.toLowerCase()===T?sn+=2:(r=n,0===pn&&yn(rt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="IN"):(sn=t,t=n)):(sn=t,t=n),t}function fr(){let t,r,a,o;return t=sn,r=e.substr(sn,2),r.toLowerCase()===N?sn+=2:(r=n,0===pn&&yn(at)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="IS"):(sn=t,t=n)):(sn=t,t=n),t}function dr(){let t,r,a,o;return t=sn,r=e.substr(sn,4),r.toLowerCase()===O?sn+=4:(r=n,0===pn&&yn(ot)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="LIKE"):(sn=t,t=n)):(sn=t,t=n),t}function pr(){let t,r,a,o;return t=sn,r=e.substr(sn,6),r.toLowerCase()===E?sn+=6:(r=n,0===pn&&yn(it)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="ESCAPE"):(sn=t,t=n)):(sn=t,t=n),t}function mr(){let t,r,a,o;return t=sn,r=e.substr(sn,3),r.toLowerCase()===S?sn+=3:(r=n,0===pn&&yn(st)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="NOT"):(sn=t,t=n)):(sn=t,t=n),t}function hr(){let t,r,a,o;return t=sn,r=e.substr(sn,3),r.toLowerCase()===x?sn+=3:(r=n,0===pn&&yn(ut)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="AND"):(sn=t,t=n)):(sn=t,t=n),t}function vr(){let t,r,a,o;return t=sn,r=e.substr(sn,2),r.toLowerCase()===C?sn+=2:(r=n,0===pn&&yn(lt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="OR"):(sn=t,t=n)):(sn=t,t=n),t}function wr(){let t,r,a,o;return t=sn,r=e.substr(sn,7),r.toLowerCase()===Z?sn+=7:(r=n,0===pn&&yn(ct)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="BETWEEN"):(sn=t,t=n)):(sn=t,t=n),t}function Ir(){let t,r,a,o;return t=sn,r=e.substr(sn,4),r.toLowerCase()===D?sn+=4:(r=n,0===pn&&yn(ft)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="FROM"):(sn=t,t=n)):(sn=t,t=n),t}function gr(){let t,r,a,o;return t=sn,r=e.substr(sn,3),r.toLowerCase()===M?sn+=3:(r=n,0===pn&&yn(dt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="FOR"):(sn=t,t=n)):(sn=t,t=n),t}function yr(){let t,r,a,o;return t=sn,r=e.substr(sn,9),r.toLowerCase()===_?sn+=9:(r=n,0===pn&&yn(pt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="SUBSTRING"):(sn=t,t=n)):(sn=t,t=n),t}function Lr(){let t,r,a,o;return t=sn,r=e.substr(sn,7),r.toLowerCase()===b?sn+=7:(r=n,0===pn&&yn(mt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="EXTRACT"):(sn=t,t=n)):(sn=t,t=n),t}function Tr(){let t,r,a,o;return t=sn,r=e.substr(sn,4),r.toLowerCase()===P?sn+=4:(r=n,0===pn&&yn(ht)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="TRIM"):(sn=t,t=n)):(sn=t,t=n),t}function Nr(){let t,r,a,o;return t=sn,r=e.substr(sn,8),r.toLowerCase()===F?sn+=8:(r=n,0===pn&&yn(vt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="POSITION"):(sn=t,t=n)):(sn=t,t=n),t}function Or(){let t,r,a,o;return t=sn,r=e.substr(sn,9),r.toLowerCase()===A?sn+=9:(r=n,0===pn&&yn(wt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="TIMESTAMP"):(sn=t,t=n)):(sn=t,t=n),t}function Er(){let t,r,a,o;return t=sn,r=e.substr(sn,4),r.toLowerCase()===R?sn+=4:(r=n,0===pn&&yn(It)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="DATE"):(sn=t,t=n)):(sn=t,t=n),t}function Sr(){let t,r,a,o;return t=sn,r=e.substr(sn,4),r.toLowerCase()===$?sn+=4:(r=n,0===pn&&yn(gt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="TIME"):(sn=t,t=n)):(sn=t,t=n),t}function xr(){let t,r,a,o;return t=sn,r=e.substr(sn,7),r.toLowerCase()===U?sn+=7:(r=n,0===pn&&yn(yt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="LEADING"):(sn=t,t=n)):(sn=t,t=n),t}function Cr(){let t,r,a,o;return t=sn,r=e.substr(sn,8),r.toLowerCase()===k?sn+=8:(r=n,0===pn&&yn(Lt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="TRAILING"):(sn=t,t=n)):(sn=t,t=n),t}function Zr(){let t,r,a,o;return t=sn,r=e.substr(sn,4),r.toLowerCase()===V?sn+=4:(r=n,0===pn&&yn(Tt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="BOTH"):(sn=t,t=n)):(sn=t,t=n),t}function Dr(){let t,r,a,o;return t=sn,r=e.substr(sn,4),r.toLowerCase()===z?sn+=4:(r=n,0===pn&&yn(Nt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="CAST"):(sn=t,t=n)):(sn=t,t=n),t}function Mr(){let t,r,a,o;return t=sn,r=e.substr(sn,2),r.toLowerCase()===q?sn+=2:(r=n,0===pn&&yn(Ot)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="AS"):(sn=t,t=n)):(sn=t,t=n),t}function _r(){let t,r,a,o;return t=sn,r=e.substr(sn,7),r.toLowerCase()===H?sn+=7:(r=n,0===pn&&yn(Et)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="INTEGER"):(sn=t,t=n)):(sn=t,t=n),t}function br(){let t,r,a,o;return t=sn,r=e.substr(sn,3),r.toLowerCase()===K?sn+=3:(r=n,0===pn&&yn(St)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="INT"):(sn=t,t=n)):(sn=t,t=n),t}function Pr(){let t,r,a,o;return t=sn,r=e.substr(sn,8),r.toLowerCase()===Y?sn+=8:(r=n,0===pn&&yn(xt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="SMALLINT"):(sn=t,t=n)):(sn=t,t=n),t}function Fr(){let t,r,a,o;return t=sn,r=e.substr(sn,5),r.toLowerCase()===j?sn+=5:(r=n,0===pn&&yn(Ct)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="FLOAT"):(sn=t,t=n)):(sn=t,t=n),t}function Ar(){let t,r,a,o;return t=sn,r=e.substr(sn,4),r.toLowerCase()===Q?sn+=4:(r=n,0===pn&&yn(Zt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="REAL"):(sn=t,t=n)):(sn=t,t=n),t}function Rr(){let t,r,a,o;return t=sn,r=e.substr(sn,7),r.toLowerCase()===J?sn+=7:(r=n,0===pn&&yn(Dt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="VARCHAR"):(sn=t,t=n)):(sn=t,t=n),t}function $r(){let t,r,a,o;return t=sn,r=e.substr(sn,2),r.toLowerCase()===B?sn+=2:(r=n,0===pn&&yn(Mt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="TO"):(sn=t,t=n)):(sn=t,t=n),t}function Ur(){let t,r,a,o;return t=sn,r=e.substr(sn,8),r.toLowerCase()===G?sn+=8:(r=n,0===pn&&yn(_t)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="INTERVAL"):(sn=t,t=n)):(sn=t,t=n),t}function kr(){let t,r,a,o;return t=sn,r=e.substr(sn,4),r.toLowerCase()===X?sn+=4:(r=n,0===pn&&yn(bt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="YEAR"):(sn=t,t=n)):(sn=t,t=n),t}function Vr(){let t,r,a,o;return t=sn,r=e.substr(sn,13),r.toLowerCase()===ee?sn+=13:(r=n,0===pn&&yn(Pt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="TIMEZONE_HOUR"):(sn=t,t=n)):(sn=t,t=n),t}function zr(){let t,r,a,o;return t=sn,r=e.substr(sn,15),r.toLowerCase()===te?sn+=15:(r=n,0===pn&&yn(Ft)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="TIMEZONE_MINUTE"):(sn=t,t=n)):(sn=t,t=n),t}function qr(){let t,r,a,o;return t=sn,r=e.substr(sn,5),r.toLowerCase()===ne?sn+=5:(r=n,0===pn&&yn(At)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="MONTH"):(sn=t,t=n)):(sn=t,t=n),t}function Hr(){let t,r,a,o;return t=sn,r=e.substr(sn,3),r.toLowerCase()===re?sn+=3:(r=n,0===pn&&yn(Rt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="DAY"):(sn=t,t=n)):(sn=t,t=n),t}function Kr(){let t,r,a,o;return t=sn,r=e.substr(sn,4),r.toLowerCase()===ae?sn+=4:(r=n,0===pn&&yn($t)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="HOUR"):(sn=t,t=n)):(sn=t,t=n),t}function Yr(){let t,r,a,o;return t=sn,r=e.substr(sn,6),r.toLowerCase()===oe?sn+=6:(r=n,0===pn&&yn(Ut)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="MINUTE"):(sn=t,t=n)):(sn=t,t=n),t}function jr(){let t,r,a,o;return t=sn,r=e.substr(sn,6),r.toLowerCase()===ie?sn+=6:(r=n,0===pn&&yn(kt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="SECOND"):(sn=t,t=n)):(sn=t,t=n),t}function Wr(){let t,r,a,o;return t=sn,r=e.substr(sn,3),r.toLowerCase()===se?sn+=3:(r=n,0===pn&&yn(Vt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="DOW"):(sn=t,t=n)):(sn=t,t=n),t}function Qr(){let t,r,a,o;return t=sn,r=e.substr(sn,3),r.toLowerCase()===ue?sn+=3:(r=n,0===pn&&yn(zt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="DOY"):(sn=t,t=n)):(sn=t,t=n),t}function Jr(){let t,r,a,o;return t=sn,r=e.substr(sn,4),r.toLowerCase()===le?sn+=4:(r=n,0===pn&&yn(qt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="WEEK"):(sn=t,t=n)):(sn=t,t=n),t}function Br(){let t,r,a,o;return t=sn,r=e.substr(sn,4),r.toLowerCase()===ce?sn+=4:(r=n,0===pn&&yn(Ht)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="CASE"):(sn=t,t=n)):(sn=t,t=n),t}function Gr(){let t,r,a,o;return t=sn,r=e.substr(sn,3),r.toLowerCase()===fe?sn+=3:(r=n,0===pn&&yn(Kt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="END"):(sn=t,t=n)):(sn=t,t=n),t}function Xr(){let t,r,a,o;return t=sn,r=e.substr(sn,4),r.toLowerCase()===de?sn+=4:(r=n,0===pn&&yn(Yt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="WHEN"):(sn=t,t=n)):(sn=t,t=n),t}function ea(){let t,r,a,o;return t=sn,r=e.substr(sn,4),r.toLowerCase()===pe?sn+=4:(r=n,0===pn&&yn(jt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="THEN"):(sn=t,t=n)):(sn=t,t=n),t}function ta(){let t,r,a,o;return t=sn,r=e.substr(sn,4),r.toLowerCase()===me?sn+=4:(r=n,0===pn&&yn(Wt)),r!==n?(a=sn,pn++,o=Rn(),pn--,o===n?a=void 0:(sn=a,a=n),a!==n?(un=t,t="ELSE"):(sn=t,t=n)):(sn=t,t=n),t}function na(){let t;return 44===e.charCodeAt(sn)?(t=he,sn++):(t=n,0===pn&&yn(Qt)),t}function ra(){let t;return 40===e.charCodeAt(sn)?(t=ve,sn++):(t=n,0===pn&&yn(Jt)),t}function aa(){let t;return 41===e.charCodeAt(sn)?(t=we,sn++):(t=n,0===pn&&yn(Bt)),t}function oa(){let e,t;for(e=[],t=ia();t!==n;)e.push(t),t=ia();return e}function ia(){let t;return t=e.charAt(sn),Ze.test(t)?sn++:(t=n,0===pn&&yn(Gt)),t}function sa(){let t,r,a,o;if(t=sn,r=Fn(),r!==n&&(un=t),t=r,t===n)if(t=sn,96===e.charCodeAt(sn)?(r=Ie,sn++):(r=n,0===pn&&yn(Xt)),r!==n){if(a=[],o=e.charAt(sn),De.test(o)?sn++:(o=n,0===pn&&yn(en)),o!==n)for(;o!==n;)a.push(o),o=e.charAt(sn),De.test(o)?sn++:(o=n,0===pn&&yn(en));else a=n;a!==n?(96===e.charCodeAt(sn)?(o=Ie,sn++):(o=n,0===pn&&yn(Xt)),o!==n?(un=t,t=function(e){return e.join("")}(a)):(sn=t,t=n)):(sn=t,t=n)}else sn=t,t=n;return t}function ua(e,t,n,r,a){const o={type:"binary-expression",location:a,operator:e,left:t,right:n};return void 0!==r&&(o.escape=r),o}function la(e,...t){return{type:"expression-list",location:e,value:t}}function ca(e,t){let n=e;for(const{op:e,expr:r,location:{end:a}}of t)n=ua(e,n,r,void 0,{...n.location,end:a});return n}cn=o();const fa=cn!==n&&sn===e.length;function da(){throw cn!==n&&sn<e.length&&yn({type:"end"}),function(e,t,n){return new W(W.buildMessage(e,t),e,t,n)}(dn,fn<e.length?function(t=sn){const n=e.codePointAt(t);return void 0===n?"":String.fromCodePoint(n)}(fn):null,fn<e.length?gn(fn,fn+1):gn(fn,fn))}return t.peg$library?{peg$result:cn,peg$currPos:sn,peg$FAILED:n,peg$maxFailExpected:dn,peg$maxFailPos:fn,peg$success:fa,peg$throw:fa?void 0:da}:fa?cn:void da()}class J{static parse(e){return Q(e)}}function B(e,t){if(null!=e)switch(t(e),e.type){case"when-clause":B(e.operand,t),B(e.value,t);break;case"case-expression":for(const n of e.clauses)B(n,t);"simple"===e.format&&B(e.operand,t),null!==e.else&&B(e.else,t);break;case"expression-list":for(const n of e.value)B(n,t);break;case"unary-expression":B(e.expr,t);break;case"binary-expression":B(e.left,t),B(e.right,t);break;case"function":B(e.args,t);break;case"interval":B(e.value,t),B(e.qualifier,t);break;case"interval-qualifier":B(e.start,t),B(e.end,t)}}const G=new Set(["current_timestamp","current_date","current_time"]);class X{constructor(e){this.staticData=e}makeBool(e){return fe(e)}featureValue(e,t,n,r){return Oe(e,t,n,r)}equalsNull(e){return null===e}applyLike(e,t,n){return Ne(e,t,n)}ensureArray(e){return de(e)}applyIn(e,t){return ve(e,t)}currentTimestamp(e){return we(e)}currentDate(e){return Ie(e)}currentTime(e){return ge(e)}makeSqlInterval(e,t,n){return c.createFromValueAndQualifier(e,t,n)}convertInterval(e){return c.isInterval(e)?e.valueInMilliseconds():e}compare(e,t,n){return $(t,n,e)}calculate(e,t,n,r){return Y(e,t,n,r)}evaluateTime(e){return Z(e)}evaluateTimestamp(e,t,n){return D(e,t,n)}evaluateDate(e,t){return M(e,t)}evaluateFunction(e,t,n){return z(e,t,n)}lookup(e,t){const n=t[e];return void 0===n?null:n}between(e,t){return null==e||null==t[0]||null==t[1]?null:$(e,t[0],">=")&&$(e,t[1],"<=")}notbetween(e,t){return null==e||null==t[0]||null==t[1]?null:$(e,t[0],"<")||$(e,t[1],">")}ternaryNot(e){return pe(e)}ternaryAnd(e,t){return me(e,t)}ternaryOr(e,t){return he(e,t)}}function ee(e,...t){return`this.${e}(${t.join(", ")})`}function te(e){return void 0===e?"void 0":JSON.stringify(e)}function ne({type:e,period:t,precision:n,secondary:r}){return JSON.stringify({type:e,period:t,precision:n,secondary:r})}const re="feature",ae="lookups",oe="attributeAdapter",ie="fieldsIndex",se="timeZone",ue="currentUser";class le{constructor(e){this._parseTree=e,this._staticData=Object.create(null),this._nextStaticDataId=0,this._tempVars=new Set,this._nextTempVarId=0}compile(){const e=this._compileNode(this._parseTree),t=`\n ${this._tempVars.size>0?`var ${Array.from(this._tempVars).join(", ")};`:""}\n return this.convertInterval(${e});\n `;return new Function(re,ae,oe,ie,se,ue,t).bind(new X(this._staticData))}_storeStaticData(e){const t="static$"+this._nextStaticDataId++;return this._staticData[t]=e,t}_compileRefStaticData(e){return`this.staticData[${te(e)}]`}_generateTempVar(){const e="temp$"+this._nextTempVarId++;return this._tempVars.add(e),e}_compileSimpleCase(e){const t=this._compileNode(e.operand),n=this._generateTempVar(),r=[];for(const t of e.clauses){const e=ee("compare",te("="),n,this._compileNode(t.operand)),a=this._compileNode(t.value);r.push(`${e} ? (${a}) :`)}return null!=e.else?r.push(this._compileNode(e.else)):r.push(te(null)),`(${n} = ${t}, ${r.join(" ")})`}_compileSearchedCase(e){const t=[];for(const n of e.clauses){const e=ee("makeBool",this._compileNode(n.operand)),r=this._compileNode(n.value);t.push(`${e} ? (${r}) :`)}return null!=e.else?t.push(this._compileNode(e.else)):t.push(te(null)),t.join(" ")}_compileInExpr(e,t){const n=new Set,r=[];for(const e of t.value)"number"===e.type||"string"===e.type?n.add(e.value):r.push(e);const a=this._compileNode(e),o=ee("ensureArray",this._compileNode({type:"expression-list",location:t.location,value:r}));if(n.size>0){const e=this._compileRefStaticData(this._storeStaticData(n)),t=this._generateTempVar();return r.length>0?`(${t} = ${a}, ${e}.has(${t}) || ${ee("applyIn",t,o)})`:`(${t} = ${a}, ${t} == null ? null : ${e}.has(${t}))`}return ee("applyIn",a,o)}_compileNode(e){switch(e.type){case"interval":return ee("makeSqlInterval",this._compileNode(e.value),"interval-qualifier"===e.qualifier.type?function({type:e,start:t,end:n}){return`{type: ${te(e)}, start: ${ne(t)}, end: ${ne(n)}}`}(e.qualifier):ne(e.qualifier),te(e.op));case"case-expression":return"simple"===e.format?this._compileSimpleCase(e):this._compileSearchedCase(e);case"parameter":return ee("lookup",te(e.value.toLowerCase()),ae);case"expression-list":return`[${e.value.map((e=>this._compileNode(e))).join(", ")}]`;case"unary-expression":return ee("ternaryNot",this._compileNode(e.expr));case"binary-expression":switch(e.operator){case"AND":return ee("ternaryAnd",this._compileNode(e.left),this._compileNode(e.right));case"OR":return ee("ternaryOr",this._compileNode(e.left),this._compileNode(e.right));case"IS":if("null"!==e.right.type)throw new i.L8(i.Z7.UnsupportedIsRhs);return ee("equalsNull",this._compileNode(e.left));case"ISNOT":if("null"!==e.right.type)throw new i.L8(i.Z7.UnsupportedIsRhs);return`!${ee("equalsNull",this._compileNode(e.left))}`;case"IN":return this._compileInExpr(e.left,e.right);case"NOT IN":return ee("ternaryNot",this._compileInExpr(e.left,e.right));case"BETWEEN":return ee("between",this._compileNode(e.left),this._compileNode(e.right));case"NOTBETWEEN":return ee("notbetween",this._compileNode(e.left),this._compileNode(e.right));case"LIKE":return ee("applyLike",this._compileNode(e.left),this._compileNode(e.right),te(e.escape));case"NOT LIKE":return ee("ternaryNot",ee("applyLike",this._compileNode(e.left),this._compileNode(e.right),te(e.escape)));case"<>":case"<":case">":case">=":case"<=":case"=":return ee("compare",te(e.operator),this._compileNode(e.left),this._compileNode(e.right));case"*":case"-":case"+":case"/":case"||":return ee("calculate",te(e.operator),this._compileNode(e.left),this._compileNode(e.right),se);default:throw new i.L8(i.Z7.UnsupportedOperator,{operator:e.operator})}case"null":case"boolean":case"string":case"number":return te(e.value);case"time":try{return this._compileRefStaticData(this._storeStaticData(Z(e.value)))}catch{return ee("evaluateTime",te(e.value))}case"date":try{return this._compileRefStaticData(this._storeStaticData(M(e.value,"unknown")))}catch{return ee("evaluateDate",te(e.value),te("unknown"))}case"timestamp":try{return this._compileRefStaticData(this._storeStaticData(D(e.value,"unknown")))}catch{return ee("evaluateTimestamp",te(e.value),te("unknown"))}case"current-time":return"date"===e.mode?ee("currentDate",se):"time"===e.mode?ee("currentTime",se):ee("currentTimestamp",se);case"current-user":return ue;case"column-reference":return ee("featureValue",re,te(e.column),ie,oe);case"data-type":return function({type:e,size:t,withtimezone:n}){return JSON.stringify({type:e,size:t,withtimezone:n})}(e.value);case"function":return ee("evaluateFunction",te(e.name),this._compileNode(e.args),se)}throw new i.L8(i.Z7.UnsupportedSyntax,{node:e.type})}}class ce{static create(e,t={}){return new ce(e,t.fieldsIndex,t.timeZone??void 0,t.currentUser)}constructor(e,t,n="UTC",r=null){this.fieldsIndex=t,this.timeZone=n,this.currentUser=r,this.parameters={},this._compiledExecutor=null,this._hasDateFunctions=void 0,this.parseTree=J.parse(e);const{isStandardized:a,isAggregate:o,currentUserRequired:i,referencedFieldNames:s}=this._extractExpressionInfo(t);this._referencedFieldNames=s,this.isStandardized=a,this.isAggregate=o,this.currentUserRequired=i}static convertValueToStorageFormat(e,t=null){if(null===t)return(0,P.$P)(e)?e.getTime():E(e)?e.toMillis():C(e)?e.toStorageFormat():x(e)?e.toStorageString():S(e)?e.toStorageFormat():e;switch(t){case"date":return(0,P.$P)(e)?e.getTime():E(e)?e.toMillis():C(e)?e.toMilliseconds():S(e)?e.toNumber():e;case"date-only":return(0,P.$P)(e)?o.n.fromDateJS(e).toString():C(e)?o.n.fromSqlTimeStampOffset(e).toString():E(e)?o.n.fromDateTime(e).toString():e;case"time-only":return(0,P.$P)(e)?d.k.fromDateJS(e).toStorageString():E(e)?d.k.fromDateTime(e).toStorageString():C(e)?d.k.fromSqlTimeStampOffset(e).toStorageString():x(e)?e.toStorageString():e;case"timestamp-offset":if((0,P.$P)(e))return f.g.fromJSDate(e).toStorageFormat();if(E(e))return f.g.fromDateTime(e).toStorageFormat();if(C(e))return e.toStorageFormat()}return e}get fieldNames(){return this._referencedFieldNames}testSet(e,t=Ee,n=this.currentUser){return!!this._evaluateNode(this.parseTree,null,t,e,n)}calculateValue(e,t=Ee,n=this.currentUser){const r=this._evaluateNode(this.parseTree,e,t,null,n);return c.isInterval(r)?r.valueInMilliseconds()/864e5:r}tryGetCompiledExecutor(){if(null!=this._compiledExecutor)return this._compiledExecutor;if((0,r.A)("esri-csp-restrictions"))return null;const e=new le(this.parseTree);return this._compiledExecutor=e.compile(),this._compiledExecutor}calculateValueCompiled(e,t=Ee,n=this.currentUser){const r=this.tryGetCompiledExecutor();return null==r?this.calculateValue(e,t):r(e,this.parameters,t,this.fieldsIndex,this.timeZone,n??null)}testFeature(e,t=Ee,n=this.currentUser){return!!this._evaluateNode(this.parseTree,e,t,null,n)}testFeatureCompiled(e,t=Ee,n=this.currentUser){const r=this.tryGetCompiledExecutor();return null==r?this.testFeature(e,t):!!r(e,this.parameters,t,this.fieldsIndex,this.timeZone,n??null)}get hasDateFunctions(){return null!=this._hasDateFunctions||(this._hasDateFunctions=!1,B(this.parseTree,(e=>{"current-time"===e.type?this._hasDateFunctions=!0:"function"===e.type&&(this._hasDateFunctions=this._hasDateFunctions||G.has(e.name.toLowerCase()))}))),this._hasDateFunctions}getFunctions(){const e=new Set;return B(this.parseTree,(t=>{"function"===t.type&&e.add(t.name.toLowerCase())})),Array.from(e)}getExpressions(){const e=new Map;return B(this.parseTree,(t=>{if("function"===t.type){const n=t.name.toLowerCase(),r=t.args.value[0];if("column-reference"===r.type){const t=r.column,a=`${n}-${t}`;e.has(a)||e.set(a,{aggregateType:n,field:t})}}})),[...e.values()]}getVariables(){const e=new Set;return B(this.parseTree,(t=>{"parameter"===t.type&&e.add(t.value.toLowerCase())})),Array.from(e)}_extractExpressionInfo(e){const t=[],n=new Set;let r=!0,o=!1,i=!1;return B(this.parseTree,(s=>{switch(s.type){case"column-reference":{const r=e?.get(s.column);let a,o;r?a=o=r.name??"":(o=s.column,a=o.toLowerCase()),n.has(a)||(n.add(a),t.push(o)),s.column=o;break}case"current-user":i=!0;break;case"function":{const{name:e,args:t}=s,n=t.value.length;r&&(r=function(e,t){const n=K[e.toLowerCase()];return null!=n&&t>=n.minParams&&t<=n.maxParams}(e,n)),!1===o&&(o=(0,a.M)(e,n));break}}})),{referencedFieldNames:Array.from(t),isStandardized:r,isAggregate:o,currentUserRequired:i}}_evaluateNode(e,t,n,r,o){let s;switch(e.type){case"interval":{const a=this._evaluateNode(e.value,t,n,r,o);return c.createFromValueAndQualifier(a,e.qualifier,e.op)}case"case-expression":if("simple"===e.format){const a=this._evaluateNode(e.operand,t,n,r,o);for(let i=0;i<e.clauses.length;i++)if($(a,this._evaluateNode(e.clauses[i].operand,t,n,r,o),"="))return this._evaluateNode(e.clauses[i].value,t,n,r,o);if(null!==e.else)return this._evaluateNode(e.else,t,n,r,o)}else{for(let a=0;a<e.clauses.length;a++)if(fe(this._evaluateNode(e.clauses[a].operand,t,n,r,o)))return this._evaluateNode(e.clauses[a].value,t,n,r,o);if(null!==e.else)return this._evaluateNode(e.else,t,n,r,o)}return null;case"parameter":return s=this.parameters[e.value.toLowerCase()],(0,P.$P)(s)?m.c9.fromJSDate(s):null!=s&&"object"==typeof s&&"toDateTime"in s?s.toDateTime():s;case"expression-list":{const a=[];for(const i of e.value)a.push(this._evaluateNode(i,t,n,r,o));return a}case"unary-expression":return pe(this._evaluateNode(e.expr,t,n,r,o));case"binary-expression":switch(e.operator){case"AND":return me(this._evaluateNode(e.left,t,n,r,o),this._evaluateNode(e.right,t,n,r,o));case"OR":return he(this._evaluateNode(e.left,t,n,r,o),this._evaluateNode(e.right,t,n,r,o));case"IS":if("null"!==e.right.type)throw new i.L8(i.Z7.UnsupportedIsRhs);return null===this._evaluateNode(e.left,t,n,r,o);case"ISNOT":if("null"!==e.right.type)throw new i.L8(i.Z7.UnsupportedIsRhs);return null!==this._evaluateNode(e.left,t,n,r,o);case"IN":{const a=de(this._evaluateNode(e.right,t,n,r,o));return ve(this._evaluateNode(e.left,t,n,r,o),a)}case"NOT IN":{const a=de(this._evaluateNode(e.right,t,n,r,o));return pe(ve(this._evaluateNode(e.left,t,n,r,o),a))}case"BETWEEN":{const a=this._evaluateNode(e.left,t,n,r,o),i=this._evaluateNode(e.right,t,n,r,o);return null==a||null==i[0]||null==i[1]?null:$(a,i[0],">=")&&$(a,i[1],"<=")}case"NOTBETWEEN":{const a=this._evaluateNode(e.left,t,n,r,o),i=this._evaluateNode(e.right,t,n,r,o);return null==a||null==i[0]||null==i[1]?null:$(a,i[0],"<")||$(a,i[1],">")}case"LIKE":return Ne(this._evaluateNode(e.left,t,n,r,o),this._evaluateNode(e.right,t,n,r,o),e.escape);case"NOT LIKE":return pe(Ne(this._evaluateNode(e.left,t,n,r,o),this._evaluateNode(e.right,t,n,r,o),e.escape));case"<>":case"<":case">":case">=":case"<=":case"=":return $(this._evaluateNode(e.left,t,n,r,o),this._evaluateNode(e.right,t,n,r,o),e.operator);case"-":case"+":case"*":case"/":case"||":return Y(e.operator,this._evaluateNode(e.left,t,n,r,o),this._evaluateNode(e.right,t,n,r,o),this.timeZone)}case"null":case"boolean":case"string":case"number":return e.value;case"date":return e.parsedValue??=M(e.value,"unknown"),e.parsedValue;case"timestamp":return e.parsedValue??=D(e.value,"unknown"),e.parsedValue;case"time":return Z(e.value);case"current-time":return"date"===e.mode?Ie(this.timeZone):"time"===e.mode?ge(this.timeZone):we(this.timeZone);case"current-user":return o??null;case"column-reference":return Oe(t,e.column,this.fieldsIndex,n);case"data-type":return e.value;case"function":{if(this.isAggregate&&(0,a.M)(e.name,e.args.value.length)){const t=[];for(const a of e.args?.value||[]){const e=[];for(const t of r||[])e.push(this._evaluateNode(a,t,n,null,o));t.push(e)}return(0,a.s)(e.name,t)}const i=this._evaluateNode(e.args,t,n,r,o);return z(e.name,i,this.timeZone)}}throw new i.L8(i.Z7.UnsupportedSyntax,{node:e.type})}}function fe(e){return!0===e}function de(e){return Array.isArray(e)?e:[e]}function pe(e){return null!==e?!0!==e:null}function me(e,t){return null!=e&&null!=t?!0===e&&!0===t:!1!==e&&!1!==t&&null}function he(e,t){return null!=e&&null!=t?!0===e||!0===t:!0===e||!0===t||null}function ve(e,t){if(null==e)return null;let n=!1;for(const r of t)if(null==r)n=null;else{if(e===r){n=!0;break}if(A(e)&&A(r)&&(n=$(e,r,"="),n))break}return n}function we(e){return N(new Date,e)}function Ie(e){return o.n.fromNow(e)}function ge(e){const t=N(new Date,e);return d.k.fromDateTime(t)}const ye="-[]/{}()*+?.\\^$|";var Le,Te;function Ne(e,t,n){return null==e?null:function(e,t){const n=t;let r="",a=Le.Normal;for(let t=0;t<e.length;t++){const o=e.charAt(t);switch(a){case Le.Normal:o===n?a=Le.Escaped:ye.includes(o)?r+="\\"+o:r+="%"===o?".*":"_"===o?".":o;break;case Le.Escaped:ye.includes(o)?r+="\\"+o:r+=o,a=Le.Normal}}return new RegExp("^"+r+"$","m")}(t,n).test(e)}function Oe(e,t,n,r){if("getAttributeSQL"in r)return r.getAttributeSQL(e,t);const a=r.getAttribute(e,t);if(null==a)return a;const i=n?.get(t);switch(i?.type){case"esriFieldTypeDate":case"date":return N(new Date(a),n?.getLuxonTimeZone(i.name)??m.mQ.utcInstance);case"esriFieldTypeDateOnly":case"date-only":return o.n.fromReader(a);case"esriFieldTypeTimeOnly":case"time-only":return d.k.fromReader(a);case"esriFieldTypeTimestampOffset":case"timestamp-offset":return new f.g(a)}return a}(Te=Le||(Le={}))[Te.Normal=0]="Normal",Te[Te.Escaped=1]="Escaped";const Ee={getAttribute:(e,t)=>(function(e){return e&&"object"==typeof e.attributes}(e)?e.attributes:e)[t]}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[1737,3513],{4146:(e,t,r)=>{r.d(t,{A:()=>w});var i=r(90237),s=r(78888),o=r(49186),n=r(65529),a=r(4902),l=r(92474),d=r(53966),u=r(74887),p=r(84952),c=r(10107),y=(r(44208),r(87811),r(40608)),h=r(5443),f=r(16930),m=r(92602),g=r(64272);let v=0,w=class extends(n.A.EventedMixin(a.A.IdentifiableMixin(l.A))){constructor(){super(...arguments),this.attributionDataUrl=null,this.fullExtent=new h.A(-180,-90,180,90,f.A.WGS84),this.id=Date.now().toString(16)+"-layer-"+v++,this.legendEnabled=!0,this.listMode="show",this.opacity=1,this.parent=null,this.persistenceEnabled=!1,this.popupEnabled=!0,this.attributionVisible=!0,this.spatialReference=f.A.WGS84,this.title=null,this.type=null,this.url=null,this.visibilityTimeExtent=null,this.visible=!0}static async fromArcGISServerUrl(e){const t="string"==typeof e?{url:e}:e;return(await r.e(7982).then(r.bind(r,27982))).fromUrl(t)}static fromPortalItem(e){return async function(e){const t="portalItem"in e?e:{portalItem:e},{fromItem:i}=await r.e(5613).then(r.bind(r,45613));try{return await i(t)}catch(e){const r=t?.portalItem,i=r?.id||"unset",s=r?.portal?.url||m.A.portalUrl;throw d.A.getLogger("esri.layers.support.fromPortalItem").error("#fromPortalItem()","Failed to create layer from portal item (portal: '"+s+"', id: '"+i+"')",e),e}}(e)}initialize(){this.when().catch((e=>{(0,u.zf)(e)||d.A.getLogger(this).error("#load()",`Failed to load layer (title: '${this.title??"no title"}', id: '${this.id??"no id"}')`,{error:e})}))}destroy(){const e=this.parent;if(e){const t=this;"layers"in e&&e.layers.includes(t)?e.layers.remove(t):"tables"in e&&e.tables.includes(t)?e.tables.remove(t):"baseLayers"in e&&e.baseLayers.includes(t)?e.baseLayers.remove(t):"referenceLayers"in e&&e.referenceLayers.includes(t)&&e.referenceLayers.remove(t),this._set("parent",null)}}get effectiveVisible(){let e=this.visible;const t=this.parent;return e&&t&&"effectiveVisible"in t&&(e&&=t.effectiveVisible),e}get hasAttributionData(){return null!=this.attributionDataUrl}get parsedUrl(){return(0,p.An)(this.url)}createLayerView(e,t){return Promise.reject(new o.A("layer:create-layer-view","Layer does not support creating a layer view"))}async fetchAttributionData(){const e=this.attributionDataUrl;if(this.hasAttributionData&&e)return(await(0,s.A)(e,{query:{f:"json"},responseType:"json"})).data;throw new o.A("layer:no-attribution-data","Layer does not have attribution data")}};(0,i._)([(0,c.MZ)({type:String})],w.prototype,"attributionDataUrl",void 0),(0,i._)([(0,c.MZ)({readOnly:!0})],w.prototype,"effectiveVisible",null),(0,i._)([(0,c.MZ)({type:h.A})],w.prototype,"fullExtent",void 0),(0,i._)([(0,c.MZ)({readOnly:!0})],w.prototype,"hasAttributionData",null),(0,i._)([(0,c.MZ)({type:String,clonable:!1})],w.prototype,"id",void 0),(0,i._)([(0,c.MZ)({type:Boolean,nonNullable:!0})],w.prototype,"legendEnabled",void 0),(0,i._)([(0,c.MZ)({type:["show","hide","hide-children"]})],w.prototype,"listMode",void 0),(0,i._)([(0,c.MZ)({type:Number,range:{min:0,max:1},nonNullable:!0})],w.prototype,"opacity",void 0),(0,i._)([(0,c.MZ)({clonable:!1})],w.prototype,"parent",void 0),(0,i._)([(0,c.MZ)({readOnly:!0})],w.prototype,"parsedUrl",null),(0,i._)([(0,c.MZ)({type:Boolean,readOnly:!0})],w.prototype,"persistenceEnabled",void 0),(0,i._)([(0,c.MZ)({type:Boolean})],w.prototype,"popupEnabled",void 0),(0,i._)([(0,c.MZ)({type:Boolean})],w.prototype,"attributionVisible",void 0),(0,i._)([(0,c.MZ)({type:f.A})],w.prototype,"spatialReference",void 0),(0,i._)([(0,c.MZ)({type:String})],w.prototype,"title",void 0),(0,i._)([(0,c.MZ)({readOnly:!0,json:{read:!1}})],w.prototype,"type",void 0),(0,i._)([(0,c.MZ)()],w.prototype,"url",void 0),(0,i._)([(0,c.MZ)({type:g.T})],w.prototype,"visibilityTimeExtent",void 0),(0,i._)([(0,c.MZ)({type:Boolean,nonNullable:!0})],w.prototype,"visible",void 0),w=(0,i._)([(0,y.$)("esri.layers.Layer")],w)},8303:(e,t,r)=>{r.d(t,{A:()=>I});var i=r(90237),s=r(92602),o=r(70333),n=r(78888),a=r(60999),l=r(49186),d=r(53966),u=r(97768),p=r(74887),c=r(84952),y=r(10107),h=(r(44208),r(87811),r(36005)),f=r(40608),m=r(43937),g=r(77548),v=r(20655),w=r(80812),_=r(41318),b=r(10407);const I=e=>{let t=class extends e{constructor(){super(...arguments),this.resourceReferences={portalItem:null,paths:[]},this.userHasEditingPrivileges=!0,this.userHasFullEditingPrivileges=!1,this.userHasUpdateItemPrivileges=!1}destroy(){this.portalItem=(0,u.pR)(this.portalItem),this.resourceReferences.portalItem=null,this.resourceReferences.paths.length=0}set portalItem(e){e!==this._get("portalItem")&&(this.removeOrigin("portal-item"),this._set("portalItem",e))}readPortalItem(e,t,r){if(t.itemId)return new w.default({id:t.itemId,portal:r?.portal})}writePortalItem(e,t){e?.id&&(t.itemId=e.id)}async loadFromPortal(e,t){if(this.portalItem?.id)try{const{load:i}=await r.e(1204).then(r.bind(r,41204));return(0,p.Te)(t),await i({instance:this,supportedTypes:e.supportedTypes,validateItem:e.validateItem,supportsData:e.supportsData,layerModuleTypeMap:e.layerModuleTypeMap,populateGroupLayer:e.populateGroupLayer},t)}catch(e){throw(0,p.zf)(e)||d.A.getLogger(this).warn(`Failed to load layer (${this.title}, ${this.id}) portal item (${this.portalItem.id})\n ${e}`),e}}async finishLoadEditablePortalLayer(e){this._set("userHasEditingPrivileges",await this._fetchUserHasEditingPrivileges(e).catch((e=>((0,p.QP)(e),!0))))}async setUserPrivileges(e,t){if(!s.A.userPrivilegesApplied)return this.finishLoadEditablePortalLayer(t);if(this.url)try{const{features:{edit:r,fullEdit:i},content:{updateItem:s}}=await this._fetchUserPrivileges(e,t);this._set("userHasEditingPrivileges",r),this._set("userHasFullEditingPrivileges",i),this._set("userHasUpdateItemPrivileges",s)}catch(e){(0,p.QP)(e)}}async _fetchUserPrivileges(e,t){let r=this.portalItem;if(!e||!r||!r.loaded||r.sourceUrl)return this._fetchFallbackUserPrivileges(t);const i=!o.id?.findCredential(this.url),s=e===r.id;if(s&&r.portal.user)return this._getUserPrivileges(r,i);let n,a;if(s)n=r.portal.url;else try{n=await(0,g.wI)(this.url,t)}catch(e){(0,p.QP)(e)}if(!n||!(0,c.b8)(n,r.portal.url))return this._fetchFallbackUserPrivileges(t);try{const e=null!=t?t.signal:null;a=await(o.id?.getCredential(`${n}/sharing`,{prompt:!1,signal:e}))}catch(e){(0,p.QP)(e)}const l=!0,d=!1,u=!1;if(!a)return{features:{edit:l,fullEdit:d},content:{updateItem:u}};try{if(s?await r.reload():(r=new w.default({id:e,portal:{url:n}}),await r.load(t)),r.portal.user)return this._getUserPrivileges(r,i)}catch(e){(0,p.QP)(e)}return{features:{edit:l,fullEdit:d},content:{updateItem:u}}}_getUserPrivileges(e,t){const r=(0,b.It)(e);return t&&(r.features.edit=!0),r}async _fetchFallbackUserPrivileges(e){let t=!0;try{t=await this._fetchUserHasEditingPrivileges(e)}catch(e){(0,p.QP)(e)}return{features:{edit:t,fullEdit:!1},content:{updateItem:!1}}}async _fetchUserHasEditingPrivileges(e){const t=this.url?o.id?.findCredential(this.url):null;if(!t)return!0;const r=M.credential===t?M.user:await this._fetchEditingUser(e);return M.credential=t,M.user=r,null==r?.privileges||r.privileges.includes("features:user:edit")}async _fetchEditingUser(e){const t=this.portalItem?.portal?.user;if(t)return t;const r=o.id?.findServerInfo(this.url??"");if(!r?.owningSystemUrl)return null;const i=`${r.owningSystemUrl}/sharing/rest`,s=v.A.getDefault();if(s&&s.loaded&&(0,c.S8)(s.restUrl)===(0,c.S8)(i))return s.user;const l=`${i}/community/self`,d=null!=e?e.signal:null,u=await(0,a.Ke)((0,n.A)(l,{authMode:"no-prompt",query:{f:"json"},signal:d}));return u.ok?_.A.fromJSON(u.value.data):null}read(e,t){t&&(t.layer=this),super.read(e,t)}write(e,t){const r=t?.portal,i=this.portalItem?.id&&(this.portalItem.portal||v.A.getDefault());return r&&i&&!(0,c.ut)(i.restUrl,r.restUrl)?(t.messages&&t.messages.push(new l.A("layer:cross-portal",`The layer '${this.title} (${this.id})' cannot be persisted because it refers to an item on a different portal than the one being saved to. To save, set layer.portalItem to null or save to the same portal as the item associated with the layer`,{layer:this})),null):super.write(e,{...t,layer:this})}};return(0,i._)([(0,y.MZ)({type:w.default})],t.prototype,"portalItem",null),(0,i._)([(0,h.w)("web-document","portalItem",["itemId"])],t.prototype,"readPortalItem",null),(0,i._)([(0,m.K)("web-document","portalItem",{itemId:{type:String}})],t.prototype,"writePortalItem",null),(0,i._)([(0,y.MZ)({clonable:!1})],t.prototype,"resourceReferences",void 0),(0,i._)([(0,y.MZ)({type:Boolean,readOnly:!0})],t.prototype,"userHasEditingPrivileges",void 0),(0,i._)([(0,y.MZ)({type:Boolean,readOnly:!0})],t.prototype,"userHasFullEditingPrivileges",void 0),(0,i._)([(0,y.MZ)({type:Boolean,readOnly:!0})],t.prototype,"userHasUpdateItemPrivileges",void 0),t=(0,i._)([(0,f.$)("esri.layers.mixins.PortalLayer")],t),t},M={credential:null,user:null}},8947:(e,t,r)=>{r.d(t,{L:()=>n});var i=r(60999),s=r(74887),o=r(67076);async function n(e,t,r){const n=e&&e.getAtOrigin&&e.getAtOrigin("renderer",t.origin);if(n&&"unique-value"===n.type&&n.styleOrigin){const a=await(0,i.Ke)(n.populateFromStyle());if((0,s.Te)(r),!1===a.ok){const r=a.error;t?.messages&&t.messages.push(new o.A("renderer:style-reference",`Failed to create unique value renderer from style reference: ${r.message}`,{error:r,context:t})),e.clear("renderer",t?.origin)}}}},13899:(e,t,r)=>{r.r(t),r.d(t,{default:()=>Ee});var i=r(90237),s=r(52106),o=r(13874),n=r(69540),a=r(5503),l=r(49186),d=r(36563),u=r(53966),p=r(97768),c=r(92071),y=r(74887),h=r(36708),f=r(10107),m=(r(44208),r(87811),r(88620)),g=r(36005),v=r(40608),w=r(35666),_=r(86738),b=r(4146),I=r(55726),M=r(52136),S=r(18768),A=r(69208),x=r(47685),F=r(16131),L=r(8303),T=r(25036),Z=r(58947),O=r(82935),E=r(25482),j=r(30524);function U({associatedLayer:e,serviceUpdateTimeStamp:t}){const r=e?.editingInfo?.lastEditDate,i=e?.serverGens,s=null!=r,o=null!=t,n=s&&o&&t.lastUpdate!==r.getTime();return s&&(n||!o&&i?.minServerGen!==i?.serverGen)}var P=r(96184),R=r(64272),$=r(26253);const N=e=>{let t=class extends e{constructor(){super(...arguments),this.serviceTimeInfo=null}get timeInfo(){const e=this.associatedLayer?.timeInfo;if(null==e)return null;const t=e.clone();return(0,j.sv)(t,this.fieldsIndex),t}set timeInfo(e){(0,j.sv)(e,this.fieldsIndex),this._override("timeInfo",e)}get timeExtent(){return this.associatedLayer?.timeExtent}set timeExtent(e){this._override("timeExtent",e)}get timeOffset(){return this.associatedLayer?.timeOffset}set timeOffset(e){this._override("timeOffset",e)}get datesInUnknownTimezone(){return this.associatedLayer?.datesInUnknownTimezone??!1}set datesInUnknownTimezone(e){this._override("datesInUnknownTimezone",e)}async loadTimeInfoFromService(e){const{serviceTimeInfo:t}=this;if(null==t)return;const{startTimeField:r,endTimeField:i}=t;if(null==r&&null==i)return;if(U({associatedLayer:this.associatedLayer,serviceUpdateTimeStamp:this.serviceUpdateTimeStamp}))return;const s=async t=>{let i=null;try{const r=await(this.fetchStatistics?.(t,e));i=r?.stats}catch{}if(null==i)return null;const{minTimeStr:s,min:o,maxTimeStr:n,max:a}=i,l=t===r?s??o:n??a;return null!=l?new Date(l):null},[o,n]=await Promise.all([s(r),s(i)]);if(null!=r&&null==o||null!=i&&null==n)return;const a=new R.T({start:o,end:n});this.setAtOrigin("timeInfo",new P.A({endField:i,startField:r,fullTimeExtent:a}),"service")}};return(0,i._)([(0,f.MZ)({type:P.A,json:{read:!1,write:!1}})],t.prototype,"timeInfo",null),(0,i._)([(0,f.MZ)({type:R.T,json:{read:!1,write:!1}})],t.prototype,"timeExtent",null),(0,i._)([(0,f.MZ)({type:$.T,json:{read:!1,write:!1}})],t.prototype,"timeOffset",null),(0,i._)([(0,f.MZ)({type:Boolean,nonNullable:!0,json:{read:!1,write:!1}})],t.prototype,"datesInUnknownTimezone",null),(0,i._)([(0,f.MZ)({type:D,readOnly:!0,json:{read:{source:"timeInfo"}}})],t.prototype,"serviceTimeInfo",void 0),t=(0,i._)([(0,v.$)("esri.layers.mixins.TemporalSceneLayer")],t),t};let D=class extends E.A{constructor(){super(...arguments),this.endTimeField=null,this.startTimeField=null}};(0,i._)([(0,f.MZ)({type:String})],D.prototype,"endTimeField",void 0),(0,i._)([(0,f.MZ)({type:String})],D.prototype,"startTimeField",void 0),D=(0,i._)([(0,v.$)("esri.layers.mixins.TemporalSceneLayer.SceneServiceTimeInfo")],D);var C=r(60694),k=r(92009),q=r(4071),H=r(10873),V=r(15426),G=r(40530),B=r(67202),J=r(17036),K=r(95466),Q=r(50805),W=r(20557),z=r(46499),X=r(39383),Y=r(37352),ee=r(4513),te=r(86390);let re=class extends E.A{constructor(){super(...arguments),this.name=null,this.field=null,this.currentRangeExtent=null,this.fullRangeExtent=null,this.type="rangeInfo"}};(0,i._)([(0,f.MZ)({type:String,json:{read:!0,write:{isRequired:!0}}})],re.prototype,"name",void 0),(0,i._)([(0,f.MZ)({type:String,json:{read:!0,write:{isRequired:!0}}})],re.prototype,"field",void 0),(0,i._)([(0,f.MZ)({type:[Number],json:{read:!0,write:!0}})],re.prototype,"currentRangeExtent",void 0),(0,i._)([(0,f.MZ)({type:[Number],json:{read:!0,write:!0}})],re.prototype,"fullRangeExtent",void 0),(0,i._)([(0,f.MZ)({type:["rangeInfo"],readOnly:!0,json:{read:!1,write:{isRequired:!0}}})],re.prototype,"type",void 0),re=(0,i._)([(0,v.$)("esri.layers.support.RangeInfo")],re);var ie,se=r(78888),oe=r(4718),ne=r(87024),ae=r(67076),le=r(39829),de=r(80586);let ue=ie=class extends(E.A.JSONSupportMixin(a.A.ofType(le.A))){constructor(e){super(e)}clone(){return new ie(this.items.map((e=>e.clone())))}write(e,t){return this.toJSON(t)}toJSON(e){const t=e?.layer?.spatialReference;return t?this.toArray().map((r=>{if(!t.equals(r.spatialReference)){if(!(0,de.canProjectWithoutEngine)(r.spatialReference,t))return e?.messages?.push(new ae.A("scenefilter:unsupported","Scene filters with incompatible spatial references are not supported",{modification:this,spatialReference:e.layer.spatialReference,context:e})),null;const i=new le.A;(0,de.projectPolygon)(r,i,t),r=i}const i=r.toJSON(e);return delete i.spatialReference,i})).filter((e=>null!=e)):(e?.messages?.push(new ae.A("scenefilter:unsupported","Writing Scene filters without context layer is not supported",{modification:this,spatialReference:e.layer.spatialReference,context:e})),this.toArray().map((t=>t.toJSON(e))))}static fromJSON(e,t){const r=new ie;return e.forEach((e=>r.add(le.A.fromJSON(e,t)))),r}};ue=ie=(0,i._)([(0,v.$)("esri.layers.support.PolygonCollection")],ue);const pe=ue;var ce,ye=r(97159);let he=ce=class extends E.A{constructor(e){super(e),this.spatialRelationship="disjoint",this.geometries=new pe,this._geometriesSource=null}initialize(){this.addHandles((0,h.on)((()=>this.geometries),"after-changes",(()=>this.geometries=this.geometries),h.OH))}readGeometries(e,t,r){Array.isArray(e)?this.geometries=pe.fromJSON(e,r):this._geometriesSource={url:(0,ye.f)(e,r),context:r}}async loadGeometries(e,t){if(null==this._geometriesSource)return;const{url:r,context:i}=this._geometriesSource,s=await(0,se.A)(r,{responseType:"json",signal:t?.signal}),o=e.toJSON(),n=s.data.map((e=>({...e,spatialReference:o})));this.geometries=pe.fromJSON(n,i),this._geometriesSource=null}clone(){const e=new ce({geometries:(0,oe.o8)(this.geometries),spatialRelationship:this.spatialRelationship});return e._geometriesSource=this._geometriesSource,e}};(0,i._)([(0,f.MZ)({type:["disjoint","contains"],nonNullable:!0,json:{write:{isRequired:!0}}})],he.prototype,"spatialRelationship",void 0),(0,i._)([(0,f.MZ)({type:pe,nonNullable:!0,json:{write:!0,origins:{"web-scene":{write:{isRequired:!0}}}}}),(0,ne.P)({origins:["web-scene","portal-item"],type:"resource",prefix:"geometries",contentAddressed:!0})],he.prototype,"geometries",void 0),(0,i._)([(0,g.w)(["web-scene","portal-item"],"geometries")],he.prototype,"readGeometries",null),he=ce=(0,i._)([(0,v.$)("esri.layers.support.SceneFilter")],he);const fe=he;var me=r(84952),ge=r(8947),ve=r(41214),we=r(61956),_e=r(24212),be=r(30291);async function Ie(e){const t=[];for(const r of e)r.name.toLowerCase().endsWith(".zip")?t.push(Me(r)):t.push(Promise.resolve(r));return(await Promise.all(t)).flat()}async function Me(e){const{BlobReader:t,ZipReader:i,BlobWriter:s}=await Promise.all([r.e(8392),r.e(9588)]).then(r.bind(r,9588)),o=[],n=new i(new t(e));return(await n.getEntries()).forEach((e=>{if(e.directory||/^__MACOS/i.test(e.filename))return;const t=new s,r=e.getData?.(t).then((t=>new File([t],e.filename)));r&&o.push(r)})),Promise.all(o)}var Se=r(4654),Ae=r(45671),xe=r(78553);const Fe=new Set(["3DObject","Point"]),Le=(0,J.p)();let Te=class extends(N((0,x.w6)((0,Z.w6)((0,S.b)((0,F.q)((0,L.A)((0,T.j)((0,c.P)((0,A.d)((0,M.p)(n.A.ClonableMixin(b.A)))))))))))){constructor(...e){super(...e),this.featureReduction=null,this.rangeInfos=null,this.operationalLayerType="ArcGISSceneServiceLayer",this.type="scene",this.fields=null,this.floorInfo=null,this.outFields=null,this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.excludeObjectIds=new a.A,this.definitionExpression=null,this.filter=null,this.path=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.priority=null,this.semantic=null,this.cachedDrawingInfo={color:!1},this.popupEnabled=!0,this.popupTemplate=null,this.attributeTableTemplate=null,this.objectIdField=null,this.globalIdField=null,this._fieldUsageInfo={},this.screenSizePerspectiveEnabled=!0,this.serviceItemId=void 0}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){this._set("renderer",null),this.associatedLayer=(0,p.pR)(this.associatedLayer)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){const r=this.getField(e)?.domain??null;return this.associatedLayer?(0,V.Vq)(this.associatedLayer,e,t,r):r}getFeatureType(e){return e&&this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){return this.associatedLayer?.types??[]}get typeIdField(){return this.associatedLayer?.typeIdField??null}get templates(){return this.associatedLayer?.templates??null}get formTemplate(){return this.associatedLayer?.formTemplate??null}get fieldsIndex(){return new K.A(this.fields)}readNodePages(e,t,r){return"Point"===t.layerType&&(e=t.pointNodePages),null==e||"object"!=typeof e?null:Q.W4.fromJSON(e,r)}set elevationInfo(e){this._set("elevationInfo",e),this.loaded&&this._validateElevationInfo()}get effectiveCapabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.effectiveCapabilities)}get effectiveEditingEnabled(){return null!=this.associatedLayer&&(0,V.C$)(this.associatedLayer)}get geometryType(){return Oe[this.profile]||"mesh"}set renderer(e){(0,j.yp)(e,this.fieldsIndex),this._set("renderer",e)}readCachedDrawingInfo(e){return null!=e&&"object"==typeof e||(e={}),null==e.color&&(e.color=!1),e}get capabilities(){return this._capabilitiesFromAssociatedFeatureLayer(this.associatedLayer?.capabilities)}_capabilitiesFromAssociatedFeatureLayer(e){e=null!=e?e:q.P;const{query:t,queryRelated:r,editing:{supportsGlobalId:i,supportsRollbackOnFailure:s,supportsUploadWithItemId:o,supportsGeometryUpdate:n,supportsReturnServiceEditsInSourceSpatialReference:a},data:{supportsZ:l,supportsM:d,isVersioned:u,supportsAttachment:p},operations:{supportsEditing:c,supportsAdd:y,supportsUpdate:h,supportsDelete:f,supportsQuery:m,supportsQueryAttachments:g,supportsAsyncConvert3D:v}}=e,w=e.operations.supportsChangeTracking,_=!!this.associatedLayer?.infoFor3D;return{query:t,queryRelated:r,editing:{supportsGlobalId:i,supportsReturnServiceEditsInSourceSpatialReference:a,supportsRollbackOnFailure:s,supportsGeometryUpdate:_&&n,supportsUploadWithItemId:o},data:{supportsAttachment:p,supportsZ:l,supportsM:d,isVersioned:u},operations:{supportsQuery:m,supportsQueryAttachments:g,supportsEditing:c&&w,supportsAdd:_&&y&&w,supportsDelete:_&&f&&w,supportsUpdate:h&&w,supportsAsyncConvert3D:v}}}get editingEnabled(){return this._isOverridden("editingEnabled")?this._get("editingEnabled"):this.associatedLayer?.editingEnabled??!1}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}get infoFor3D(){return this.associatedLayer?.infoFor3D??null}get relationships(){return this.associatedLayer?.relationships}get defaultPopupTemplate(){return this.associatedLayer||this.attributeStorageInfo?this.createPopupTemplate():null}readObjectIdField(e,t){return!e&&t.fields&&t.fields.some((t=>("esriFieldTypeOID"===t.type&&(e=t.name),!!e))),e||void 0}readGlobalIdField(e,t){return!e&&t.fields&&t.fields.some((t=>("esriFieldTypeGlobalID"===t.type&&(e=t.name),!!e))),e||void 0}get displayField(){return this.associatedLayer?.displayField??null}readProfile(e,t){const r=t.store.profile;return null!=r&&Ze[r]?Ze[r]:(u.A.getLogger(this).error("Unknown or missing profile",{profile:r,layer:this}),"mesh-pyramids")}get useViewTime(){return this.associatedLayer?.useViewTime??!0}set useViewTime(e){this._override("useViewTime",e)}load(e){return this.addResolvingPromise(this._load(e)),Promise.resolve(this)}async _load(e){const t=null!=e?e.signal:null;await this.loadFromPortal({supportedTypes:["Scene Service"]},e).catch(y.QP),await this._fetchService(t),await Promise.all([this._fetchIndexAndUpdateExtent(this.nodePages,t),this._setAssociatedFeatureLayer(t),this._loadFilterGeometries()]),this._validateElevationInfo(),this._applyAssociatedLayerOverrides(),this._populateFieldUsageInfo(),await this.loadTimeInfoFromService(e),await(0,ge.L)(this,{origin:"service"},t),(0,j.yp)(this.renderer,this.fieldsIndex),await this.finishLoadEditablePortalLayer(e)}async beforeSave(){null!=this.filter&&(this.filter=this.filter.clone(),await this.load())}async _loadFilterGeometries(){if(this.filter)try{await this.filter.loadGeometries(this.spatialReference)}catch(e){u.A.getLogger(this).error("#_loadFilterGeometries()",this,"Failed to load filter geometries. Geometry filter will not be applied for this layer.",{error:e}),this.filter=null}}createQuery(){const e=new we.A;return"mesh"===this.geometryType?this.capabilities.query.supportsReturnMesh&&(e.returnGeometry=!0):(e.returnGeometry=!0,e.returnZ=!0),e.where=this.definitionExpression||"1=1",e.sqlFormat="standard",e.outFields=["*"],e}queryExtent(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryExtent(e||this.createQuery(),t)))}queryFeatureCount(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatureCount(e||this.createQuery(),t)))}queryFeatures(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatures(e||this.createQuery(),t))).then((e=>{if(e?.features)for(const t of e.features)t.layer=this,t.sourceLayer=this;return e}))}async queryRelatedFeatures(e,t){if(await this.load(),!this.associatedLayer)throw new l.A("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){if(await this.load(),!this.associatedLayer)throw new l.A("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeaturesCount(e,t)}async queryCachedAttributes(e,t){const r=(0,j.hL)(this.fieldsIndex,await(0,Ae.TO)(this,(0,Ae.D8)(this)));return(0,Se.s1)(this.parsedUrl?.path??"",this.attributeStorageInfo??[],e,t,r,this.apiKey,this.customParameters)}async queryCachedFeature(e,t){const r=await this.queryCachedAttributes(e,[t]);if(!r||0===r.length)throw new l.A("scenelayer:feature-not-in-cached-data","Feature not found in cached data");const i=new s.A;return i.attributes=r[0],i.layer=this,i.sourceLayer=this,i}queryObjectIds(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryObjectIds(e||this.createQuery(),t)))}queryAttachments(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryAttachments(e,t)))}getFieldUsageInfo(e){const t={supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1};return this.loaded?this._fieldUsageInfo[e]||t:(u.A.getLogger(this).error("#getFieldUsageInfo()","Unavailable until layer is loaded"),t)}createPopupTemplate(e){return(0,be.tn)(this,e)}_getAssociatedLayerForQuery(){const e=this.associatedLayer;return e?.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),!this.associatedLayer)throw new l.A("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});try{await this.associatedLayer.load()}catch(e){throw new l.A("scenelayer:query-not-available","SceneLayer associated feature layer could not be loaded",{layer:this,error:e})}return this.associatedLayer}hasCachedStatistics(e){return null!=this.statisticsInfo&&this.statisticsInfo.some((t=>t.name===e))}async queryCachedStatistics(e,t){return await this.load(t),await this.fetchStatistics(e,t)}async saveAs(e,t){return this._debouncedSaveOperations(Z.Xh.SAVE_AS,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"};return this._debouncedSaveOperations(Z.Xh.SAVE,e)}async applyEdits(e,t){const{applyEdits:i}=await r.e(8628).then(r.bind(r,78628));let s=t;await this.load();const o=this.associatedLayer;if(!o)throw new l.A(`${this.type}-layer:not-editable`,"Service is not editable");await o.load();const{globalIdField:n}=o,a=!!o.infoFor3D,d=s?.globalIdUsed??!0;if(a&&null==n)throw new l.A(`${this.type}-layer:not-editable`,"Valid globalIdField expected on editable SceneLayer");if(a&&!d)throw new l.A(`${this.type}-layer:globalid-required`,"globalIdUsed must not be false for SceneLayer editing as globalIds are required.");return(0,C.Wo)(o.url)&&a&&null!=e.deleteFeatures&&null!=n&&(s={...s,globalIdToObjectId:await(0,V.GA)(o,e.deleteFeatures,n)}),i(this,o.source,e,s)}async uploadAssets(e,t){if(await this.load(),null==this.associatedLayer)throw new l.A(`${this.type}-layer:not-editable`,"Service is not editable");return await this.associatedLayer.load(),this.associatedLayer.uploadAssets(e,t)}on(e,t){return super.on(e,t)}async convertMesh(e,t){t??={};const i=e=>{throw u.A.getLogger(this).error(".convertMesh()",e.message),e};await this.load(),this.infoFor3D||i(new l.A("invalid:layer","SceneLayer has no capability for mesh conversion"));const s=await this.extractAndFilterFiles(e),o=s.reduce(((e,t)=>(0,W.oF)(this.infoFor3D,t)?e+1:e),0);0===o&&i(new I.VP),o>1&&i(new I.XQ);const n=this.spatialReference,a=t.location??new _.A({x:0,y:0,z:0,spatialReference:n}),d=a.spatialReference.isGeographic?"local":"georeferenced",{default:p}=await Promise.all([r.e(3030),r.e(36)]).then(r.bind(r,40036)),c=p.createWithExternalSource(a,{type:"client",files:s},{vertexSpace:d,transform:(0,te.Z)(a.spatialReference),unitConversionDisabled:!0}),[y]=await this.uploadAssets([c],{...t,useAssetOrigin:!t.location});return y}async extractAndFilterFiles(e){await this.load();const t=this.infoFor3D;return t?(await Ie(e)).filter((e=>(0,W.fu)(t,e))):e}validateLayer(e){if(e.layerType&&!Fe.has(e.layerType))throw new l.A("scenelayer:layer-type-not-supported","SceneLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new l.A("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});if(this.version.major>2)throw new l.A("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});!function(e,t){let r=!1,i=!1;if(null==e)r=!0,i=!0;else{const s=t&&t.isGeographic;switch(e){case"east-north-up":case"earth-centered":r=!0,i=s;break;case"vertex-reference-frame":r=!0,i=!s;break;default:r=!1}}if(!r)throw new l.A("scenelayer:unsupported-normal-reference-frame","Normal reference frame is invalid.");if(!i)throw new l.A("scenelayer:incompatible-normal-reference-frame","Normal reference frame is incompatible with layer spatial reference.")}(this.normalReferenceFrame,this.spatialReference)}_getTypeKeywords(){const e=[];if("points"===this.profile)e.push("Point");else{if("mesh-pyramids"!==this.profile)throw new l.A("scenelayer:unknown-profile","SceneLayer:save() encountered an unknown SceneLayer profile: "+this.profile);e.push("3DObject")}return e}_populateFieldUsageInfo(){if(this._fieldUsageInfo={},this.fields)for(const e of this.fields){const t=!!this.attributeStorageInfo?.some((t=>t.name===e.name)),r=!!this.associatedLayer?.fields?.some((t=>t&&e.name===t.name)),i={supportsLabelingInfo:t,supportsRenderer:t,supportsPopupTemplate:t||r,supportsLayerQuery:r};this._fieldUsageInfo[e.name]=i}}_applyAssociatedLayerOverrides(){this._applyAssociatedLayerFieldsOverrides(),this._applyAssociatedLayerPropertyOverrides(),this._applyAssociatedLayerExtentOverride(),this._applyAssociatedLayerPrivileges()}_applyAssociatedLayerFieldsOverrides(){if(!this.associatedLayer?.fields)return;let e=null;for(const t of this.associatedLayer.fields){const r=this.getField(t.name);r?(!r.domain&&t.domain&&(r.domain=t.domain.clone()),r.editable=t.editable,r.nullable=t.nullable,r.length=t.length):(e||(e=this.fields?this.fields.slice():[]),e.push(t.clone()))}e&&this._set("fields",e)}_applyAssociatedLayerPropertyOverrides(){if(!this.associatedLayer)return;const e=["popupTemplate","popupEnabled","attributeTableTemplate"],t=(0,m.oY)(this);for(let r=0;r<e.length;r++){const i=e[r],s=this.originIdOf(i),o=this.associatedLayer.originIdOf(i);s<o&&(o===w.Gr.SERVICE||o===w.Gr.PORTAL_ITEM)&&t.setAtOrigin(i,this.associatedLayer[i],o)}}_applyAssociatedLayerExtentOverride(){const e=this.associatedLayer?.getAtOrigin("fullExtent","service");null!=this.associatedLayer?.infoFor3D&&e&&(0,C.Wo)(this.associatedLayer?.url)&&U(this)&&(0,m.oY)(this).setAtOrigin("fullExtent",e.clone(),w.Gr.SERVICE)}_applyAssociatedLayerPrivileges(){const e=this.associatedLayer;e&&(this._set("userHasEditingPrivileges",e.userHasEditingPrivileges),this._set("userHasFullEditingPrivileges",e.userHasFullEditingPrivileges),this._set("userHasUpdateItemPrivileges",e.userHasUpdateItemPrivileges))}async _setAssociatedFeatureLayer(e){if(["mesh-pyramids","points"].includes(this.profile))try{const{serverUrl:t,layerId:r,portalItem:i}=await(0,k.L)(`${this.url}/layers/${this.layerId}`,{sceneLayerItem:this.portalItem,customParameters:this.customParameters,apiKey:this.apiKey,signal:e}),s=await ee.S.FeatureLayer();this.associatedLayer=new s({url:t,customParameters:this.customParameters,layerId:r,portalItem:i}),await this.associatedLayer.load()}catch(e){(0,y.zf)(e)||this._logWarningOnPopupEnabled()}}async _logWarningOnPopupEnabled(){const e=new AbortController;this.addHandles((0,d.rE)(e));try{await(0,h.C_)((()=>this.popupEnabled&&null!=this.popupTemplate),e.signal)}catch(e){return void(0,y.jH)(e)}const t=`this SceneLayer: ${this.title}`;null==this.attributeStorageInfo?u.A.getLogger(this).warn(`Associated FeatureLayer could not be loaded and no binary attributes found. Popups will not work on ${t}`):u.A.getLogger(this).info(`Associated FeatureLayer could not be loaded. Falling back to binary attributes for Popups on ${t}`)}_validateElevationInfo(){const e=this.elevationInfo;"mesh-pyramids"===this.profile&&(0,_e.XF)(u.A.getLogger(this),(0,_e.$7)("Mesh scene layers","relative-to-scene",e)),(0,_e.XF)(u.A.getLogger(this),(0,_e.tW)("Scene layers",e))}async fetchStatistics(e,t){return await async function({fieldName:e,statisticsInfo:t,errorContext:r,fieldsIndex:i,path:s,customParameters:o,apiKey:n,signal:a}){if(null==t)throw new l.A(`${r}:no-cached-statistics`,"Cached statistics are not available for this layer");const d=i.get(e);if(null==d)throw new l.A(`${r}:field-unexisting`,`Field '${e}' does not exist on the layer`);const u=t.find((e=>e.name===d.name));if(null==u)throw new l.A(`${r}:no-cached-statistics`,"Cached statistics for this attribute are not available");const p=(0,me.fj)(s,u.href),{data:c}=await(0,se.A)(p,{query:{f:"json",...o,token:n},responseType:"json",signal:a});return c}({fieldName:e,statisticsInfo:this.statisticsInfo,errorContext:"scenelayer",fieldsIndex:this.fieldsIndex,path:this.parsedUrl?.path??"",customParameters:this.customParameters,apiKey:this.apiKey,signal:t?.signal})}};(0,i._)([(0,f.MZ)({types:{key:"type",base:G.c,typeMap:{selection:B.A}},json:{origins:{"web-scene":{name:"layerDefinition.featureReduction",write:!0},"portal-item":{name:"layerDefinition.featureReduction",write:!0}}}})],Te.prototype,"featureReduction",void 0),(0,i._)([(0,f.MZ)({type:[re],json:{read:!1,origins:{"web-scene":{name:"layerDefinition.rangeInfos",write:!0},"portal-item":{name:"layerDefinition.rangeInfos",write:!0}}}})],Te.prototype,"rangeInfos",void 0),(0,i._)([(0,f.MZ)({json:{read:!1}})],Te.prototype,"associatedLayer",void 0),(0,i._)([(0,f.MZ)({type:["show","hide"]})],Te.prototype,"listMode",void 0),(0,i._)([(0,f.MZ)({type:["ArcGISSceneServiceLayer"]})],Te.prototype,"operationalLayerType",void 0),(0,i._)([(0,f.MZ)({json:{read:!1},readOnly:!0})],Te.prototype,"type",void 0),(0,i._)([(0,f.MZ)({...Le.fields,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Te.prototype,"fields",void 0),(0,i._)([(0,f.MZ)()],Te.prototype,"types",null),(0,i._)([(0,f.MZ)()],Te.prototype,"typeIdField",null),(0,i._)([(0,f.MZ)()],Te.prototype,"templates",null),(0,i._)([(0,f.MZ)()],Te.prototype,"formTemplate",null),(0,i._)([(0,f.MZ)({readOnly:!0,clonable:!1})],Te.prototype,"fieldsIndex",null),(0,i._)([(0,f.MZ)({type:Y.A,json:{read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo"}}})],Te.prototype,"floorInfo",void 0),(0,i._)([(0,f.MZ)(Le.outFields)],Te.prototype,"outFields",void 0),(0,i._)([(0,f.MZ)({type:Q.W4,readOnly:!0,json:{read:!1}})],Te.prototype,"nodePages",void 0),(0,i._)([(0,g.w)("service","nodePages",["nodePages","pointNodePages"])],Te.prototype,"readNodePages",null),(0,i._)([(0,f.MZ)({type:[Q.uV],readOnly:!0})],Te.prototype,"materialDefinitions",void 0),(0,i._)([(0,f.MZ)({type:[Q.Ot],readOnly:!0})],Te.prototype,"textureSetDefinitions",void 0),(0,i._)([(0,f.MZ)({type:[Q.L0],readOnly:!0})],Te.prototype,"geometryDefinitions",void 0),(0,i._)([(0,f.MZ)({readOnly:!0})],Te.prototype,"serviceUpdateTimeStamp",void 0),(0,i._)([(0,f.MZ)({readOnly:!0})],Te.prototype,"attributeStorageInfo",void 0),(0,i._)([(0,f.MZ)({readOnly:!0})],Te.prototype,"statisticsInfo",void 0),(0,i._)([(0,f.MZ)({type:a.A.ofType(Number),nonNullable:!0,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.excludeObjectIds",write:{enabled:!0}}})],Te.prototype,"excludeObjectIds",void 0),(0,i._)([(0,f.MZ)({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],Te.prototype,"definitionExpression",void 0),(0,i._)([(0,f.MZ)({type:fe,json:{name:"layerDefinition.polygonFilter",write:{enabled:!0,allowNull:!0},origins:{service:{read:!1,write:!1}}}})],Te.prototype,"filter",void 0),(0,i._)([(0,f.MZ)({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],Te.prototype,"path",void 0),(0,i._)([(0,f.MZ)(H.Yj)],Te.prototype,"elevationInfo",null),(0,i._)([(0,f.MZ)({readOnly:!0,json:{read:!1}})],Te.prototype,"effectiveCapabilities",null),(0,i._)([(0,f.MZ)({readOnly:!0})],Te.prototype,"effectiveEditingEnabled",null),(0,i._)([(0,f.MZ)({type:String})],Te.prototype,"geometryType",null),(0,i._)([(0,f.MZ)(H.kF)],Te.prototype,"labelsVisible",void 0),(0,i._)([(0,f.MZ)({type:[z.A],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:{reader:X.w},write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:X.w},write:!0}})],Te.prototype,"labelingInfo",void 0),(0,i._)([(0,f.MZ)(H.fV)],Te.prototype,"legendEnabled",void 0),(0,i._)([(0,f.MZ)({type:Number,json:{origins:{"web-document":{default:1,write:{enabled:!0,target:{opacity:{type:Number},"layerDefinition.drawingInfo.transparency":{type:Number}}},read:{source:["opacity","layerDefinition.drawingInfo.transparency"],reader(e,t){if("number"==typeof e&&e>=0&&e<=1)return e;const r=t.layerDefinition?.drawingInfo?.transparency;return void 0!==r?(0,xe.D)(r):void 0}}},"portal-item":{write:!0},service:{read:!1}}}})],Te.prototype,"opacity",void 0),(0,i._)([(0,f.MZ)({type:["Low","High"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Te.prototype,"priority",void 0),(0,i._)([(0,f.MZ)({type:["Labels"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],Te.prototype,"semantic",void 0),(0,i._)([(0,f.MZ)({types:ve.XJ,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:!0},value:null})],Te.prototype,"renderer",null),(0,i._)([(0,f.MZ)({json:{read:!1}})],Te.prototype,"cachedDrawingInfo",void 0),(0,i._)([(0,g.w)("service","cachedDrawingInfo")],Te.prototype,"readCachedDrawingInfo",null),(0,i._)([(0,f.MZ)({readOnly:!0,json:{read:!1}})],Te.prototype,"capabilities",null),(0,i._)([(0,f.MZ)({type:Boolean,json:{read:!1}})],Te.prototype,"editingEnabled",null),(0,i._)([(0,f.MZ)({readOnly:!0,json:{write:!1,read:!1}})],Te.prototype,"infoFor3D",null),(0,i._)([(0,f.MZ)({readOnly:!0,json:{write:!1,read:!1}})],Te.prototype,"relationships",null),(0,i._)([(0,f.MZ)(H.M6)],Te.prototype,"popupEnabled",void 0),(0,i._)([(0,f.MZ)({type:o.A,json:{name:"popupInfo",write:!0}})],Te.prototype,"popupTemplate",void 0),(0,i._)([(0,f.MZ)({readOnly:!0,json:{read:!1}})],Te.prototype,"defaultPopupTemplate",null),(0,i._)([(0,f.MZ)(H.zQ)],Te.prototype,"attributeTableTemplate",void 0),(0,i._)([(0,f.MZ)({type:String,json:{read:!1}})],Te.prototype,"objectIdField",void 0),(0,i._)([(0,g.w)("service","objectIdField",["objectIdField","fields"])],Te.prototype,"readObjectIdField",null),(0,i._)([(0,f.MZ)({type:String,json:{read:!1}})],Te.prototype,"globalIdField",void 0),(0,i._)([(0,g.w)("service","globalIdField",["globalIdField","fields"])],Te.prototype,"readGlobalIdField",null),(0,i._)([(0,f.MZ)({readOnly:!0,type:String,json:{read:!1}})],Te.prototype,"displayField",null),(0,i._)([(0,f.MZ)({type:String,json:{read:!1}})],Te.prototype,"profile",void 0),(0,i._)([(0,g.w)("service","profile",["store.profile"])],Te.prototype,"readProfile",null),(0,i._)([(0,f.MZ)({readOnly:!0,type:String,json:{origins:{service:{read:{source:"store.normalReferenceFrame"}}},read:!1}})],Te.prototype,"normalReferenceFrame",void 0),(0,i._)([(0,f.MZ)(H.PY)],Te.prototype,"screenSizePerspectiveEnabled",void 0),(0,i._)([(0,f.MZ)({json:{read:!1,origins:{service:{read:!0}}}})],Te.prototype,"serviceItemId",void 0),(0,i._)([(0,f.MZ)(O.B)],Te.prototype,"useViewTime",null),Te=(0,i._)([(0,v.$)("esri.layers.SceneLayer")],Te);const Ze={"mesh-pyramids":"mesh-pyramids",meshpyramids:"mesh-pyramids","features-meshes":"mesh-pyramids",points:"points","features-points":"points",lines:"lines","features-lines":"lines",polygons:"polygons","features-polygons":"polygons"},Oe={"mesh-pyramids":"mesh",points:"point"},Ee=Te},17036:(e,t,r)=>{r.d(t,{p:()=>l});var i=r(44208),s=r(53966),o=r(20437),n=r(95466),a=r(30524);function l(){return{fields:{type:[o.A],value:null,set:function(e){if(e&&(0,i.A)("big-integer-warning-enabled")){const t=e.filter((e=>"big-integer"===e.type||"oid"===e.type&&(e.length||0)>=8));if(t.length){const e=t.map((e=>`'${e.name}'`)).join(", ");s.A.getLogger(this).warn("#fields",`Layer (title: '${this.title??"no title"}', id: '${this.id??"no id"}') references big-integer field(s): ${e}, support for which is experimental. Only integers less than ${Number.MAX_SAFE_INTEGER} (Number.MAX_SAFE_INTEGER) are supported.`)}}this._set("fields",e)}},fieldsIndex:{readOnly:!0,get(){return n.A.fromLayer(this)}},outFields:{type:[String],json:{read:!1},set:function(e){this._userOutFields=e,this.notifyChange("outFields")},get:function(){const e=this._userOutFields;if(!e?.length)return null;if(e.includes("*"))return["*"];if(!this.fields)return e;for(const t of e){const r=this.fieldsIndex?.has(t);r||s.A.getLogger("esri.layers.support.fieldProperties").error("field-attributes-layer:invalid-field",`Invalid field ${t} found in outFields`,{layer:this,outFields:e})}return(0,a.DB)(this.fieldsIndex,e)}}}}},18768:(e,t,r)=>{r.d(t,{b:()=>l});var i=r(90237),s=r(53966),o=r(10107),n=(r(44208),r(87811),r(40608)),a=r(60694);const l=e=>{let t=class extends e{get title(){if(this._get("title")&&"defaults"!==this.originOf("title"))return this._get("title");if(this.url){const e=(0,a.qg)(this.url);if(e?.title)return e.title}return this._get("title")||""}set title(e){this._set("title",e)}set url(e){this._set("url",(0,a.Jf)(e,s.A.getLogger(this)))}};return(0,i._)([(0,o.MZ)()],t.prototype,"title",null),(0,i._)([(0,o.MZ)({type:String})],t.prototype,"url",null),t=(0,i._)([(0,n.$)("esri.layers.mixins.ArcGISService")],t),t}},20557:(e,t,r)=>{r.d(t,{Fm:()=>l,Hz:()=>y,JQ:()=>c,JZ:()=>_,ND:()=>f,R_:()=>n,U9:()=>p,fu:()=>s,nr:()=>h,oF:()=>o,rq:()=>d,z$:()=>u});const i=[["binary","application/octet-stream","bin",""]];function s(e,t){return null!=g(t.name,e?.supportedFormats??[])}function o(e,t){if(!e)return!1;const r=d(t,e.supportedFormats??[]);return null!=r&&e.editFormats.includes(r)}function n(e,t){return v(function(e,t){const r=e.toLowerCase();return m(t).find((e=>w(e)===r))}(e,t))}function a(e,t){return v(g(e,t))}function l(e,t){return w(function(e,t){return m(t).find((t=>v(t)===e))}(e,t))}function d(e,t){return a(e.name,t)??n(e.type,t)}function u(e,t,r){return n(e,r)??a(t,r)}function p({supportedFormats:e}){return u("model/gltf-binary","glb",e)}function c(e){const t=p(e);return null!=t&&e.editFormats.includes(t)}function y(e){if(!e)return null;const t=p(e),r=function({supportedFormats:e}){return u("model/gltf+json","gltf",e)}(e);let i=null;for(const s of e.queryFormats){if(s===t)return s;s===r&&(i=s)}return i}function h({supportedFormats:e}){return u("application/esri3do-SR_world","wld",e)}function f({supportedFormats:e}){return u("application/esri3do-SR_prj","prj",e)}function m(e){return[...i,...e]}function g(e,t){const r=e.toLowerCase();return m(t).find((e=>function(e){return e?.[2].split(",").map((e=>e.toLowerCase()))??[]}(e).some((e=>r.endsWith(e)))))}function v(e){return e?.[0]}function w(e){return e?.[1].toLowerCase()}function _(e){return e.tables?.find((e=>"assetMaps"===e.role))}},20816:(e,t,r)=>{r.d(t,{TA:()=>s,We:()=>a,Z3:()=>o,ZJ:()=>l,w5:()=>d});var i=r(78888);const s=(0,r(13069).vD)(),o=new Map,n=new Map;async function a(e,t,r){if(!e||!r)return!1;if(!t)return!0;const s=new URL(e).host;let n=o.get(s);if(!n){const t=e.replace(/\/FeatureServer/i,"/VersionManagementServer").replace(/\/\d*$/,"");n=(await(0,i.A)(t,{responseType:"json",query:{f:"json"}})).data.defaultVersionName}return n===t}async function l(e,t,i=!1){if(!e||!t)return!0;const o=e.replace(/\/FeatureServer/i,"/VersionManagementServer").replace(/\/\d*$/,""),a=n.get(o)?.entries();if(a)for(const[e,n]of a)if(n.name===t){const t=!n.stack?.hasForwardEdits();if(!t&&i){const[{deleteForwardEdits:t},{default:i}]=await Promise.all([r.e(2186).then(r.bind(r,32186)),r.e(2558).then(r.bind(r,32558))]),a=await t(o,e,new i({sessionId:s,moment:n.moment}));return a.success&&n.stack?.clearForwardEdits(),a.success}return t}return!0}function d(e,t){if(!e)return!1;const r=e.replace(/\/FeatureServer/i,"/VersionManagementServer").replace(/\/\d*$/,""),i=n.get(r)?.entries();if(i)for(const[e,r]of i)if(r.name===t)return"edit"===r.lockType;return!1}new Map},24212:(e,t,r)=>{function i(e,t){return function(e,t){return t?.mode?t.mode:function(e){return e?l:d}(e).mode}(null==e||(e.hasZ??!1),t)}function s(e,t,r){return r&&r.mode!==t?`${e} only support ${t} elevation mode`:null}function o(e,t,r){return r?.mode===t?`${e} do not support ${t} elevation mode`:null}function n(e,t){return null!=t?.featureExpressionInfo&&"0"!==t.featureExpressionInfo.expression?`${e} do not support featureExpressionInfo`:null}function a(e,t){t&&e.warn(".elevationInfo=",t)}r.d(t,{$7:()=>o,B:()=>s,XF:()=>a,tW:()=>n,w7:()=>i}),r(83047),r(16271);const l={mode:"absolute-height",offset:0},d={mode:"on-the-ground",offset:null}},24770:(e,t,r)=>{r.d(t,{$I:()=>m,AU:()=>y,g7:()=>f,i4:()=>u,ui:()=>p,up:()=>v,vt:()=>d,yo:()=>h});var i=r(34727),s=r(58083),o=r(67026),n=r(82534),a=r(38954),l=r(51850);function d(e=v){return[e[0],e[1],e[2],e[3]]}function u(e,t,r=d()){return(0,a.c)(r,e),r[3]=t,r}function p(e,t=d()){const r=(0,s.l)(w,e);return g(t,(0,i.KJ)((0,o.Xd)(t,r))),t}function c(e,t,r=d()){return(0,o.x8)(w,e,m(e)),(0,o.x8)(_,t,m(t)),(0,o.lw)(w,_,w),g(r,(0,i.KJ)((0,o.Xd)(r,w)))}function y(e,t,r,i=d()){return u(l.Cw,e,b),u(l.JP,t,I),u(l.Cb,r,M),c(b,I,b),c(b,M,i),i}function h(e){return e}function f(e){return e[3]}function m(e){return(0,i.kU)(e[3])}function g(e,t){return e[3]=t,e}const v=[0,0,1,0],w=(0,n.vt)(),_=(0,n.vt)(),b=(d(),d()),I=d(),M=d()},25036:(e,t,r)=>{r.d(t,{j:()=>n});var i=r(90237),s=r(10107),o=(r(44208),r(53966),r(87811),r(40608));const n=e=>{let t=class extends e{constructor(){super(...arguments),this.minScale=0,this.maxScale=0}get effectiveScaleRange(){const e={minScale:this.minScale,maxScale:this.maxScale},t=this.parent;t&&"effectiveScaleRange"in t&&function(e,t){e.minScale=e.minScale>0?t.minScale>0?Math.min(e.minScale,t.minScale):e.minScale:t.minScale,e.maxScale=e.maxScale>0?t.maxScale>0?Math.max(e.maxScale,t.maxScale):e.maxScale:t.maxScale}(e,t.effectiveScaleRange);const r=this._get("effectiveScaleRange");return r&&r.minScale===e.minScale&&r.maxScale===e.maxScale?r:e}};return(0,i._)([(0,s.MZ)({type:Number,nonNullable:!0,json:{write:!0}})],t.prototype,"minScale",void 0),(0,i._)([(0,s.MZ)({type:Number,nonNullable:!0,json:{write:!0}})],t.prototype,"maxScale",void 0),(0,i._)([(0,s.MZ)({readOnly:!0})],t.prototype,"effectiveScaleRange",null),t=(0,i._)([(0,o.$)("esri.layers.mixins.ScaleRangeLayer")],t),t}},26253:(e,t,r)=>{r.d(t,{T:()=>p});var i=r(90237),s=r(69540),o=r(25482),n=r(88930),a=r(10107),l=(r(44208),r(53966),r(87811),r(93223)),d=r(40608),u=r(73133);let p=class extends(s.A.ClonableMixin(o.A)){constructor(e){super(e),this.unit="milliseconds",this.value=0}toMilliseconds(){return(0,n.t)(this.value,this.unit,"milliseconds")}};(0,i._)([(0,l.e)(u.j,{nonNullable:!0})],p.prototype,"unit",void 0),(0,i._)([(0,a.MZ)({type:Number,json:{write:!0},nonNullable:!0})],p.prototype,"value",void 0),p=(0,i._)([(0,d.$)("esri.time.TimeInterval")],p)},37352:(e,t,r)=>{r.d(t,{A:()=>d});var i,s=r(90237),o=r(5503),n=r(25482),a=r(10107),l=(r(44208),r(53966),r(87811),r(40608));let d=i=class extends n.A{constructor(e){super(e),this.floorField=null,this.viewAllMode=!1,this.viewAllLevelIds=new o.A}clone(){return new i({floorField:this.floorField,viewAllMode:this.viewAllMode,viewAllLevelIds:this.viewAllLevelIds})}};(0,s._)([(0,a.MZ)({type:String,json:{write:{isRequired:!0}}})],d.prototype,"floorField",void 0),(0,s._)([(0,a.MZ)({json:{read:!1,write:!1}})],d.prototype,"viewAllMode",void 0),(0,s._)([(0,a.MZ)({json:{read:!1,write:!1}})],d.prototype,"viewAllLevelIds",void 0),d=i=(0,s._)([(0,l.$)("esri.layers.support.LayerFloorInfo")],d)},40530:(e,t,r)=>{r.d(t,{c:()=>a});var i=r(90237),s=r(25482),o=r(10107),n=(r(44208),r(53966),r(87811),r(40608));let a=class extends s.A{constructor(){super(...arguments),this.type=null}};(0,i._)([(0,o.MZ)({type:["selection","cluster","binning"],readOnly:!0,json:{read:!1,write:!0}})],a.prototype,"type",void 0),a=(0,i._)([(0,n.$)("esri.layers.support.FeatureReduction")],a)},45671:(e,t,r)=>{r.d(t,{D8:()=>o,TO:()=>s});var i=r(30524);async function s(e,t=e.popupTemplate){if(null==t)return[];const r=await t.getRequiredFields(e.fieldsIndex),{lastEditInfoEnabled:s}=t,{objectIdField:o,typeIdField:n,globalIdField:a,relationships:l}=e;if(r.includes("*"))return["*"];const d=s?(0,i.eX)(e):[],u=(0,i.DB)(e.fieldsIndex,[...r,...d]);return n&&u.push(n),u&&o&&e.fieldsIndex?.has(o)&&!u.includes(o)&&u.push(o),u&&a&&e.fieldsIndex?.has(a)&&!u.includes(a)&&u.push(a),l&&l.forEach((t=>{const{keyField:r}=t;u&&r&&e.fieldsIndex?.has(r)&&!u.includes(r)&&u.push(r)})),u}function o(e,t){return e.popupTemplate?e.popupTemplate:null!=t&&t.defaultPopupTemplateEnabled&&null!=e.defaultPopupTemplate?e.defaultPopupTemplate:null}},47685:(e,t,r)=>{r.d(t,{Mk:()=>y,Zk:()=>p,w6:()=>m});var i=r(90237),s=r(65529),o=r(4718),n=r(74887),a=r(10107),l=(r(44208),r(53966),r(40608)),d=r(20816);const u=new s.A.EventEmitter;function p(e,t,r=null,i=!1){const s=(0,n.Tw)();return i=null==t||i,u.emit("apply-edits",{serviceUrl:e,layerId:t,gdbVersion:r,mayReceiveServiceEdits:i,result:s.promise}),s}const c=Symbol();function y(e){return null!=e&&"object"==typeof e&&c in e}function h(e){return null!=e&&"object"==typeof e&&"gdbVersion"in e}function f(e,t,r){const i=new URL(e).host,s=d.Z3.get(i),o=e=>!e||e===s;return o(t)&&o(r)||t===r}const m=e=>{var t;let r=class extends e{static{t=c}constructor(...e){super(...e),this[t]=!0,this._applyEditsHandler=e=>{const{serviceUrl:t,layerId:r,gdbVersion:i,mayReceiveServiceEdits:s,result:n}=e,a=t===this.url,l=null!=r&&null!=this.layerId&&r===this.layerId,d=h(this),u=h(this)&&f(t,i,this.gdbVersion);if(!a||d&&!u||!l&&!s)return;const p=n.then((e=>{if(this.lastEditsEventDate=new Date,l&&(e.addedFeatures.length||e.updatedFeatures.length||e.deletedFeatures.length||e.addedAttachments.length||e.updatedAttachments.length||e.deletedAttachments.length))return this.emit("edits",(0,o.o8)(e)),e;const r=e.editedFeatures?.find((({layerId:e})=>e===this.layerId));if(r){const{adds:t,updates:i,deletes:s}=r.editedFeatures,n={edits:null,addedAttachments:[],deletedAttachments:[],updatedAttachments:[],addedFeatures:t?t.map((({attributes:e})=>({objectId:this.objectIdField&&e[this.objectIdField],globalId:this.globalIdField&&e[this.globalIdField]}))):[],deletedFeatures:s?s.map((({attributes:e})=>({objectId:this.objectIdField&&e[this.objectIdField],globalId:this.globalIdField&&e[this.globalIdField]}))):[],updatedFeatures:i?i.map((({current:{attributes:e}})=>({objectId:this.objectIdField&&e[this.objectIdField],globalId:this.globalIdField&&e[this.globalIdField]}))):[],editedFeatures:(0,o.o8)(e.editedFeatures),exceededTransferLimit:!1,historicMoment:(0,o.o8)(e.historicMoment)};return this.emit("edits",n),n}const s={edits:null,addedAttachments:[],deletedAttachments:[],updatedAttachments:[],addedFeatures:[],deletedFeatures:[],updatedFeatures:[],editedFeatures:(0,o.o8)(e.editedFeatures),exceededTransferLimit:!1,historicMoment:(0,o.o8)(e.historicMoment)};return"historicMoment"in this&&this._shouldUpdateHistoricMoment(t,i,s.historicMoment)&&this.emit("edits",s),s})).then((e=>("historicMoment"in this&&this._shouldUpdateHistoricMoment(t,i,e.historicMoment)&&(this.historicMoment=e.historicMoment),e)));this.emit("apply-edits",{result:p})},this._updateMomentHandler=e=>{const{serviceUrl:t,gdbVersion:r,moment:i}=e,s=t===this.url,o=h(this),n=h(this)&&f(t,r,this.gdbVersion),a=h(this)&&!f(t,this.gdbVersion,null);s&&o&&n&&a&&"historicMoment"in this&&this.historicMoment!==i&&(this.historicMoment=i)},this.when().then((()=>{this.addHandles(function(e){return u.on("apply-edits",new WeakRef(e))}(this._applyEditsHandler)),"historicMoment"in this&&this.addHandles(function(e){return u.on("update-moment",new WeakRef(e))}(this._updateMomentHandler))}),(()=>{}))}_shouldUpdateHistoricMoment(e,t,r){return"historicMoment"in this&&this.historicMoment!==r&&(0,d.w5)(e,t)}};return(0,i._)([(0,a.MZ)()],r.prototype,"lastEditsEventDate",void 0),r=(0,i._)([(0,l.$)("esri.layers.mixins.EditBusLayer")],r),r}},50805:(e,t,r)=>{r.d(t,{L0:()=>g,Ot:()=>y,W4:()=>l,uV:()=>p});var i=r(90237),s=r(25482),o=r(10107),n=(r(44208),r(53966),r(87811),r(93223)),a=r(40608);let l=class extends s.A{constructor(){super(...arguments),this.nodesPerPage=null,this.rootIndex=0,this.lodSelectionMetricType=null}};(0,i._)([(0,o.MZ)({type:Number})],l.prototype,"nodesPerPage",void 0),(0,i._)([(0,o.MZ)({type:Number})],l.prototype,"rootIndex",void 0),(0,i._)([(0,o.MZ)({type:String})],l.prototype,"lodSelectionMetricType",void 0),l=(0,i._)([(0,a.$)("esri.layers.support.I3SLayerDefinitions.I3SNodePageDefinition")],l);let d=class extends s.A{constructor(){super(...arguments),this.factor=1}};(0,i._)([(0,o.MZ)({type:Number,json:{read:{source:"textureSetDefinitionId"}}})],d.prototype,"id",void 0),(0,i._)([(0,o.MZ)({type:Number})],d.prototype,"factor",void 0),d=(0,i._)([(0,a.$)("esri.layers.support.I3SLayerDefinitions.I3SMaterialTexture")],d);let u=class extends s.A{constructor(){super(...arguments),this.baseColorFactor=[1,1,1,1],this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.metallicFactor=1,this.roughnessFactor=1}};(0,i._)([(0,o.MZ)({type:[Number]})],u.prototype,"baseColorFactor",void 0),(0,i._)([(0,o.MZ)({type:d})],u.prototype,"baseColorTexture",void 0),(0,i._)([(0,o.MZ)({type:d})],u.prototype,"metallicRoughnessTexture",void 0),(0,i._)([(0,o.MZ)({type:Number})],u.prototype,"metallicFactor",void 0),(0,i._)([(0,o.MZ)({type:Number})],u.prototype,"roughnessFactor",void 0),u=(0,i._)([(0,a.$)("esri.layers.support.I3SLayerDefinitions.I3SMaterialPBRMetallicRoughness")],u);let p=class extends s.A{constructor(){super(...arguments),this.alphaMode="opaque",this.alphaCutoff=.25,this.doubleSided=!1,this.cullFace="none",this.normalTexture=null,this.occlusionTexture=null,this.emissiveTexture=null,this.emissiveFactor=null,this.pbrMetallicRoughness=null}};(0,i._)([(0,n.e)({opaque:"opaque",mask:"mask",blend:"blend"})],p.prototype,"alphaMode",void 0),(0,i._)([(0,o.MZ)({type:Number})],p.prototype,"alphaCutoff",void 0),(0,i._)([(0,o.MZ)({type:Boolean})],p.prototype,"doubleSided",void 0),(0,i._)([(0,n.e)({none:"none",back:"back",front:"front"})],p.prototype,"cullFace",void 0),(0,i._)([(0,o.MZ)({type:d})],p.prototype,"normalTexture",void 0),(0,i._)([(0,o.MZ)({type:d})],p.prototype,"occlusionTexture",void 0),(0,i._)([(0,o.MZ)({type:d})],p.prototype,"emissiveTexture",void 0),(0,i._)([(0,o.MZ)({type:[Number]})],p.prototype,"emissiveFactor",void 0),(0,i._)([(0,o.MZ)({type:u})],p.prototype,"pbrMetallicRoughness",void 0),p=(0,i._)([(0,a.$)("esri.layers.support.I3SLayerDefinitions.I3SMaterialDefinition")],p);let c=class extends s.A{};(0,i._)([(0,o.MZ)({type:String,json:{read:{source:["name","index"],reader:(e,t)=>null!=e?e:`${t.index}`}}})],c.prototype,"name",void 0),(0,i._)([(0,n.e)({jpg:"jpg",png:"png",dds:"dds","ktx-etc2":"ktx-etc2",ktx2:"ktx2",basis:"basis"})],c.prototype,"format",void 0),c=(0,i._)([(0,a.$)("esri.layers.support.I3SLayerDefinitions.I3STextureFormat")],c);let y=class extends s.A{constructor(){super(...arguments),this.atlas=!1}};(0,i._)([(0,o.MZ)({type:[c]})],y.prototype,"formats",void 0),(0,i._)([(0,o.MZ)({type:Boolean})],y.prototype,"atlas",void 0),y=(0,i._)([(0,a.$)("esri.layers.support.I3SLayerDefinitions.I3STextureSetDefinition")],y);let h=class extends s.A{};(0,i._)([(0,n.e)({Float32:"Float32",UInt64:"UInt64",UInt32:"UInt32",UInt16:"UInt16",UInt8:"UInt8"})],h.prototype,"type",void 0),(0,i._)([(0,o.MZ)({type:Number})],h.prototype,"component",void 0),h=(0,i._)([(0,a.$)("esri.layers.support.I3SLayerDefinitions.I3SGeometryAttribute")],h);let f=class extends s.A{};(0,i._)([(0,n.e)({draco:"draco"})],f.prototype,"encoding",void 0),(0,i._)([(0,o.MZ)({type:[String]})],f.prototype,"attributes",void 0),f=(0,i._)([(0,a.$)("esri.layers.support.I3SLayerDefinitions.I3SGeometryCompressedAttributes")],f);let m=class extends s.A{constructor(){super(...arguments),this.offset=0}};(0,i._)([(0,o.MZ)({type:Number})],m.prototype,"offset",void 0),(0,i._)([(0,o.MZ)({type:h})],m.prototype,"position",void 0),(0,i._)([(0,o.MZ)({type:h})],m.prototype,"normal",void 0),(0,i._)([(0,o.MZ)({type:h})],m.prototype,"uv0",void 0),(0,i._)([(0,o.MZ)({type:h})],m.prototype,"color",void 0),(0,i._)([(0,o.MZ)({type:h})],m.prototype,"uvRegion",void 0),(0,i._)([(0,o.MZ)({type:h})],m.prototype,"featureId",void 0),(0,i._)([(0,o.MZ)({type:h})],m.prototype,"faceRange",void 0),(0,i._)([(0,o.MZ)({type:f})],m.prototype,"compressedAttributes",void 0),m=(0,i._)([(0,a.$)("esri.layers.support.I3SLayerDefinitions.I3SGeometryBuffer")],m);let g=class extends s.A{};(0,i._)([(0,n.e)({triangle:"triangle"})],g.prototype,"topology",void 0),(0,i._)([(0,o.MZ)()],g.prototype,"geometryBuffers",void 0),g=(0,i._)([(0,a.$)("esri.layers.support.I3SLayerDefinitions.I3SGeometryDefinition")],g)},52136:(e,t,r)=>{r.d(t,{p:()=>n});var i=r(90237),s=r(10107),o=(r(44208),r(53966),r(87811),r(40608));const n=e=>{let t=class extends e{get apiKey(){return this._isOverridden("apiKey")?this._get("apiKey"):"portalItem"in this?this.portalItem?.apiKey:null}set apiKey(e){null!=e?this._override("apiKey",e):(this._clearOverride("apiKey"),this.clear("apiKey","user"))}};return(0,i._)([(0,s.MZ)({type:String})],t.prototype,"apiKey",null),t=(0,i._)([(0,o.$)("esri.layers.mixins.APIKeyMixin")],t),t}},54239:(e,t,r)=>{r.d(t,{A:()=>g});var i,s=r(90237),o=r(4576),n=r(66552),a=r(25482),l=r(83047),d=r(67076),u=r(10107),p=(r(44208),r(53966),r(36005)),c=r(40608),y=r(43937);const h=(0,n.O)()({orthometric:"gravity-related-height",gravity_related_height:"gravity-related-height",ellipsoidal:"ellipsoidal"}),f=h.jsonValues.slice();(0,o.Xy)(f,"orthometric");const m=(0,n.O)()({meter:"meters",foot:"feet","us-foot":"us-feet","clarke-foot":"clarke-feet","clarke-yard":"clarke-yards","clarke-link":"clarke-links","sears-yard":"sears-yards","sears-foot":"sears-feet","sears-chain":"sears-chains","benoit-1895-b-chain":"benoit-1895-b-chains","indian-yard":"indian-yards","indian-1937-yard":"indian-1937-yards","gold-coast-foot":"gold-coast-feet","sears-1922-truncated-chain":"sears-1922-truncated-chains","50-kilometers":"50-kilometers","150-kilometers":"150-kilometers"});let g=i=class extends a.A{constructor(e){super(e),this.heightModel="gravity-related-height",this.heightUnit="meters",this.vertCRS=null}writeHeightModel(e,t,r){return h.write(e,t,r)}readHeightModel(e,t,r){return h.read(e)||(r?.messages&&r.messages.push(function(e,t){return new d.A("height-model:unsupported",`Height model of value '${e}' is not supported`,t)}(e,{context:r})),null)}readHeightUnit(e,t,r){return m.read(e)||(r?.messages&&r.messages.push(v(e,{context:r})),null)}readHeightUnitService(e,t,r){return(0,l.LA)(e)||m.read(e)||(r?.messages&&r.messages.push(v(e,{context:r})),null)}readVertCRS(e,t){return t.vertCRS||t.ellipsoid||t.geoid}clone(){return new i({heightModel:this.heightModel,heightUnit:this.heightUnit,vertCRS:this.vertCRS})}equals(e){return!!e&&(this===e||this.heightModel===e.heightModel&&this.heightUnit===e.heightUnit&&this.vertCRS===e.vertCRS)}static deriveUnitFromSR(e,t){const r=(0,l.k1)(t);return new i({heightModel:e.heightModel,heightUnit:r??void 0,vertCRS:e.vertCRS})}write(e,t){return t={origin:"web-scene",...t},super.write(e,t)}static fromJSON(e){if(!e)return null;const t=new i;return t.read(e,{origin:"web-scene"}),t}};function v(e,t){return new d.A("height-unit:unsupported",`Height unit of value '${e}' is not supported`,t)}(0,s._)([(0,u.MZ)({type:h.apiValues,constructOnly:!0,json:{origins:{"web-scene":{type:f,default:"ellipsoidal",write:{isRequired:!0}}}}})],g.prototype,"heightModel",void 0),(0,s._)([(0,y.K)("web-scene","heightModel")],g.prototype,"writeHeightModel",null),(0,s._)([(0,p.w)(["web-scene","service"],"heightModel")],g.prototype,"readHeightModel",null),(0,s._)([(0,u.MZ)({type:m.apiValues,constructOnly:!0,json:{origins:{"web-scene":{type:m.jsonValues,write:{writer:m.write,isRequired:!0}}}}})],g.prototype,"heightUnit",void 0),(0,s._)([(0,p.w)("web-scene","heightUnit")],g.prototype,"readHeightUnit",null),(0,s._)([(0,p.w)("service","heightUnit")],g.prototype,"readHeightUnitService",null),(0,s._)([(0,u.MZ)({type:String,constructOnly:!0,json:{origins:{"web-scene":{write:!0}}}})],g.prototype,"vertCRS",void 0),(0,s._)([(0,p.w)("service","vertCRS",["vertCRS","ellipsoid","geoid"])],g.prototype,"readVertCRS",null),g=i=(0,s._)([(0,c.$)("esri.geometry.HeightModelInfo")],g)},55726:(e,t,r)=>{r.d(t,{$1:()=>d,H2:()=>y,MT:()=>h,VP:()=>f,WF:()=>u,Wt:()=>n,XQ:()=>m,hK:()=>c,nS:()=>p,uh:()=>a,xY:()=>l});var i=r(49186);const s="upload-assets",o=()=>new Error;class n extends i.A{constructor(){super(`${s}:unsupported`,"Layer does not support asset uploads.",o())}}class a extends i.A{constructor(){super(`${s}:no-glb-support`,"Layer does not support glb.",o())}}class l extends i.A{constructor(){super(`${s}:no-supported-source`,"No supported external source found",o())}}class d extends i.A{constructor(){super(`${s}:not-base-64`,"Expected gltf data in base64 format after conversion.",o())}}class u extends i.A{constructor(){super(`${s}:unable-to-prepare-options`,"Unable to prepare uploadAsset request options.",o())}}class p extends i.A{constructor(e,t){super(`${s}:bad-response`,`Bad response. Uploaded ${e} items and received ${t} results.`,o())}}class c extends i.A{constructor(e,t){super(`${s}-layer:upload-failed`,`Failed to upload mesh file ${e}. Error code: ${t?.code??"-1"}. Error message: ${t?.messages??"unknown"}`,o())}}class y extends i.A{constructor(e){super(`${s}-layer:unsupported-format`,`The service allowed us to upload an asset of FormatID ${e}, but it does not list it in its supported formats.`,o())}}class h extends i.A{constructor(){super(`${s}:convert3D-failed`,"convert3D failed.")}}class f extends i.A{constructor(){super("invalid-input:no-model","No supported model found")}}class m extends i.A{constructor(){super("invalid-input:multiple-models","Multiple supported models found")}}},67202:(e,t,r)=>{r.d(t,{A:()=>l});var i,s=r(90237),o=r(10107),n=(r(44208),r(53966),r(87811),r(40608)),a=r(40530);let l=i=class extends a.c{constructor(e){super(e),this.type="selection"}clone(){return new i}};(0,s._)([(0,o.MZ)({type:["selection"]})],l.prototype,"type",void 0),l=i=(0,s._)([(0,n.$)("esri.layers.support.FeatureReductionSelection")],l)},69208:(e,t,r)=>{r.d(t,{d:()=>n});var i=r(90237),s=r(10107),o=(r(44208),r(53966),r(87811),r(40608));const n=e=>{let t=class extends e{constructor(){super(...arguments),this.customParameters=null}};return(0,i._)([(0,s.MZ)({type:Object,json:{write:{overridePolicy:e=>({enabled:!!(e&&Object.keys(e).length>0)})}}})],t.prototype,"customParameters",void 0),t=(0,i._)([(0,o.$)("esri.layers.mixins.CustomParametersMixin")],t),t}},73133:(e,t,r)=>{r.d(t,{j:()=>i});const i=(0,r(66552).O)()({esriTimeUnitsMilliseconds:"milliseconds",esriTimeUnitsSeconds:"seconds",esriTimeUnitsMinutes:"minutes",esriTimeUnitsHours:"hours",esriTimeUnitsDays:"days",esriTimeUnitsWeeks:"weeks",esriTimeUnitsMonths:"months",esriTimeUnitsYears:"years",esriTimeUnitsDecades:"decades",esriTimeUnitsCenturies:"centuries",esriTimeUnitsUnknown:void 0})},73836:(e,t,r)=>{r.d(t,{A:()=>h});var i,s=r(90237),o=r(25482),n=r(10107),a=(r(44208),r(53966),r(87811),r(40608)),l=r(58083),d=r(9093),u=r(67026),p=r(82534),c=r(51850),y=r(24770);let h=class extends o.A{static{i=this}constructor(e){super(e),this.translation=(0,c.vt)(),this.rotationAxis=(0,c.ci)(y.up),this.rotationAngle=0,this.scale=(0,c.fA)(1,1,1)}get rotation(){return(0,y.i4)(this.rotationAxis,this.rotationAngle)}set rotation(e){this.rotationAxis=(0,c.o8)((0,y.yo)(e)),this.rotationAngle=(0,y.g7)(e)}get localMatrix(){const e=(0,d.vt)();return(0,u.x8)(f,(0,y.yo)(this.rotation),(0,y.$I)(this.rotation)),(0,l.o1)(e,f,this.translation,this.scale),e}get localMatrixInverse(){return(0,l.B8)((0,d.vt)(),this.localMatrix)}equals(e){return this===e||null!=e&&(0,l.t2)(this.localMatrix,e.localMatrix)}clone(){const e={translation:(0,c.o8)(this.translation),rotationAxis:(0,c.o8)(this.rotationAxis),rotationAngle:this.rotationAngle,scale:(0,c.o8)(this.scale)};return new i(e)}};(0,s._)([(0,n.MZ)({type:[Number],nonNullable:!0,json:{write:!0}})],h.prototype,"translation",void 0),(0,s._)([(0,n.MZ)({type:[Number],nonNullable:!0,json:{write:!0}})],h.prototype,"rotationAxis",void 0),(0,s._)([(0,n.MZ)({type:Number,nonNullable:!0,json:{write:!0}})],h.prototype,"rotationAngle",void 0),(0,s._)([(0,n.MZ)({type:[Number],nonNullable:!0,json:{write:!0}})],h.prototype,"scale",void 0),(0,s._)([(0,n.MZ)()],h.prototype,"rotation",null),(0,s._)([(0,n.MZ)()],h.prototype,"localMatrix",null),(0,s._)([(0,n.MZ)()],h.prototype,"localMatrixInverse",null),h=i=(0,s._)([(0,a.$)("esri.geometry.support.MeshTransform")],h);const f=(0,p.vt)()},80200:(e,t,r)=>{r.d(t,{T:()=>i,d:()=>f});const i={Base64:0,Hex:1,String:2,Raw:3},s=8,o=(1<<s)-1;function n(e,t){const r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function a(e){const t=[];for(let r=0,i=e.length*s;r<i;r+=s)t[r>>5]|=(e.charCodeAt(r/s)&o)<<r%32;return t}function l(e){const t=[];for(let r=0,i=32*e.length;r<i;r+=s)t.push(String.fromCharCode(e[r>>5]>>>r%32&o));return t.join("")}function d(e,t,r,i,s,o){return n(function(e,t){return e<<t|e>>>32-t}(n(n(t,e),n(i,o)),s),r)}function u(e,t,r,i,s,o,n){return d(t&r|~t&i,e,t,s,o,n)}function p(e,t,r,i,s,o,n){return d(t&i|r&~i,e,t,s,o,n)}function c(e,t,r,i,s,o,n){return d(t^r^i,e,t,s,o,n)}function y(e,t,r,i,s,o,n){return d(r^(t|~i),e,t,s,o,n)}function h(e,t){e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;let r=1732584193,i=-271733879,s=-1732584194,o=271733878;for(let t=0;t<e.length;t+=16){const a=r,l=i,d=s,h=o;r=u(r,i,s,o,e[t],7,-680876936),o=u(o,r,i,s,e[t+1],12,-389564586),s=u(s,o,r,i,e[t+2],17,606105819),i=u(i,s,o,r,e[t+3],22,-1044525330),r=u(r,i,s,o,e[t+4],7,-176418897),o=u(o,r,i,s,e[t+5],12,1200080426),s=u(s,o,r,i,e[t+6],17,-1473231341),i=u(i,s,o,r,e[t+7],22,-45705983),r=u(r,i,s,o,e[t+8],7,1770035416),o=u(o,r,i,s,e[t+9],12,-1958414417),s=u(s,o,r,i,e[t+10],17,-42063),i=u(i,s,o,r,e[t+11],22,-1990404162),r=u(r,i,s,o,e[t+12],7,1804603682),o=u(o,r,i,s,e[t+13],12,-40341101),s=u(s,o,r,i,e[t+14],17,-1502002290),i=u(i,s,o,r,e[t+15],22,1236535329),r=p(r,i,s,o,e[t+1],5,-165796510),o=p(o,r,i,s,e[t+6],9,-1069501632),s=p(s,o,r,i,e[t+11],14,643717713),i=p(i,s,o,r,e[t],20,-373897302),r=p(r,i,s,o,e[t+5],5,-701558691),o=p(o,r,i,s,e[t+10],9,38016083),s=p(s,o,r,i,e[t+15],14,-660478335),i=p(i,s,o,r,e[t+4],20,-405537848),r=p(r,i,s,o,e[t+9],5,568446438),o=p(o,r,i,s,e[t+14],9,-1019803690),s=p(s,o,r,i,e[t+3],14,-187363961),i=p(i,s,o,r,e[t+8],20,1163531501),r=p(r,i,s,o,e[t+13],5,-1444681467),o=p(o,r,i,s,e[t+2],9,-51403784),s=p(s,o,r,i,e[t+7],14,1735328473),i=p(i,s,o,r,e[t+12],20,-1926607734),r=c(r,i,s,o,e[t+5],4,-378558),o=c(o,r,i,s,e[t+8],11,-2022574463),s=c(s,o,r,i,e[t+11],16,1839030562),i=c(i,s,o,r,e[t+14],23,-35309556),r=c(r,i,s,o,e[t+1],4,-1530992060),o=c(o,r,i,s,e[t+4],11,1272893353),s=c(s,o,r,i,e[t+7],16,-155497632),i=c(i,s,o,r,e[t+10],23,-1094730640),r=c(r,i,s,o,e[t+13],4,681279174),o=c(o,r,i,s,e[t],11,-358537222),s=c(s,o,r,i,e[t+3],16,-722521979),i=c(i,s,o,r,e[t+6],23,76029189),r=c(r,i,s,o,e[t+9],4,-640364487),o=c(o,r,i,s,e[t+12],11,-421815835),s=c(s,o,r,i,e[t+15],16,530742520),i=c(i,s,o,r,e[t+2],23,-995338651),r=y(r,i,s,o,e[t],6,-198630844),o=y(o,r,i,s,e[t+7],10,1126891415),s=y(s,o,r,i,e[t+14],15,-1416354905),i=y(i,s,o,r,e[t+5],21,-57434055),r=y(r,i,s,o,e[t+12],6,1700485571),o=y(o,r,i,s,e[t+3],10,-1894986606),s=y(s,o,r,i,e[t+10],15,-1051523),i=y(i,s,o,r,e[t+1],21,-2054922799),r=y(r,i,s,o,e[t+8],6,1873313359),o=y(o,r,i,s,e[t+15],10,-30611744),s=y(s,o,r,i,e[t+6],15,-1560198380),i=y(i,s,o,r,e[t+13],21,1309151649),r=y(r,i,s,o,e[t+4],6,-145523070),o=y(o,r,i,s,e[t+11],10,-1120210379),s=y(s,o,r,i,e[t+2],15,718787259),i=y(i,s,o,r,e[t+9],21,-343485551),r=n(r,a),i=n(i,l),s=n(s,d),o=n(o,h)}return[r,i,s,o]}function f(e,t=i.Hex){const r=t||i.Base64,o=h(a(e),e.length*s);switch(r){case i.Raw:return o;case i.Hex:return function(e){const t="0123456789abcdef",r=[];for(let i=0,s=4*e.length;i<s;i++)r.push(t.charAt(e[i>>2]>>i%4*8+4&15)+t.charAt(e[i>>2]>>i%4*8&15));return r.join("")}(o);case i.String:return l(o);case i.Base64:return function(e){const t=[];for(let r=0,i=4*e.length;r<i;r+=3){const i=(e[r>>2]>>r%4*8&255)<<16|(e[r+1>>2]>>(r+1)%4*8&255)<<8|e[r+2>>2]>>(r+2)%4*8&255;for(let s=0;s<4;s++)8*r+6*s>32*e.length?t.push("="):t.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(i>>6*(3-s)&63))}return t.join("")}(o)}}},82935:(e,t,r)=>{r.d(t,{B:()=>y,e:()=>h});var i=r(90237),s=r(10107),o=(r(44208),r(53966),r(87811),r(36005)),n=r(40608),a=r(89317),l=r(30524),d=r(96184),u=r(73133),p=r(64272),c=r(26253);const y={type:Boolean,json:{read:{source:"timeAnimation"},write:{target:"timeAnimation",layerContainerTypes:a.K}}},h=e=>{let t=class extends e{constructor(){super(...arguments),this.timeExtent=null,this.timeOffset=null,this.useViewTime=!0}readOffset(e,t){const r=t.timeInfo.exportOptions;if(!r)return null;const i=r.timeOffset,s=u.j.fromJSON(r.timeOffsetUnits);return i&&s?new c.T({value:i,unit:s}):null}set timeInfo(e){(0,l.sv)(e,this.fieldsIndex),this._set("timeInfo",e)}};return(0,i._)([(0,s.MZ)({type:p.T,json:{write:!1}})],t.prototype,"timeExtent",void 0),(0,i._)([(0,s.MZ)({type:c.T})],t.prototype,"timeOffset",void 0),(0,i._)([(0,o.w)("service","timeOffset",["timeInfo.exportOptions"])],t.prototype,"readOffset",null),(0,i._)([(0,s.MZ)({value:null,type:d.A,json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],t.prototype,"timeInfo",null),(0,i._)([(0,s.MZ)(y)],t.prototype,"useViewTime",void 0),t=(0,i._)([(0,n.$)("esri.layers.mixins.TemporalLayer")],t),t}},85648:(e,t,r)=>{r.d(t,{n:()=>s});var i=r(84952);function s(e){return o[function(e){return"json"===e.type?"application/json":"blob"===e.type?e.blob.type:function(e){const t=(0,i.Zo)(e);return l[t]||n}(e.url)}(e)]||a}const o={},n="text/plain",a=o[n],l={png:"image/png",jpeg:"image/jpeg",jpg:"image/jpg",bmp:"image/bmp",gif:"image/gif",json:"application/json",txt:"text/plain",xml:"application/xml",svg:"image/svg+xml",zip:"application/zip",pbf:"application/vnd.mapbox-vector-tile",gz:"application/gzip","bin.gz":"application/octet-stream"};for(const e in l)o[l[e]]=e},86390:(e,t,r)=>{r.d(t,{Z:()=>o});var i=r(83047),s=r(73836);function o(e){const t=1/(0,i.GA)(e,1);return 1!==t?new s.A({scale:[t,t,t]}):void 0}},87024:(e,t,r)=>{r.d(t,{P:()=>y});var i=r(49186),s=r(80200),o=r(76553),n=r(84952),a=r(13069),l=r(96156),d=r(35666),u=r(10107),p=r(85648),c=r(97159);function y(e){const t=e?.origins??[void 0];return(r,i)=>{const s=function(e,t,r){if("resource"===e?.type)return function(e,t,r){const i=(0,l.z4)(t,r);return{type:String,read:(e,t,r)=>{const s=(0,c.r)(e,t,r);return i.type===String?s:"function"==typeof i.type?new i.type({url:s}):void 0},write:{isRequired:i.json?.write?.isRequired,writer(t,s,a,l){if(!l?.resources)return"string"==typeof t?void(s[a]=(0,c.t)(t,l)):void(s[a]=t.write({},l));const u=function(e){return null==e?null:"string"==typeof e?e:e.url}(t),y=(0,c.t)(u,{...l,verifyItemRelativeUrls:l?.verifyItemRelativeUrls?{writtenUrls:l.verifyItemRelativeUrls.writtenUrls,rootPath:void 0}:void 0},c.M.NO),g=i.type!==String&&(!(0,o.H)(this)||l?.origin&&this.originIdOf(r)>(0,d.aB)(l.origin)),v={object:this,propertyName:r,value:t,targetUrl:y,dest:s,targetPropertyName:a,context:l,params:e};l?.portalItem&&y&&!(0,n.oP)(y)?g&&e?.contentAddressed?h(v):g?function(e){const{context:t,targetUrl:r,params:i,value:s,dest:o,targetPropertyName:a}=e;if(!t.portalItem)return;const l=t.portalItem.resourceFromPath(r),d=m(s,r,t),u=(0,p.n)(d),c=(0,n.Zo)(l.path),y=i?.compress??!1;u===c?(t.resources&&f({...e,resource:l,content:d,compress:y,updates:t.resources.toUpdate}),o[a]=r):h(e)}(v):function({context:e,targetUrl:t,dest:r,targetPropertyName:i}){e.portalItem&&e.resources&&(e.resources.toKeep.push({resource:e.portalItem.resourceFromPath(t),compress:!1}),r[i]=t)}(v):l?.portalItem&&(null==y||null!=(0,c.i)(y)||(0,n.w8)(y)||g)?h(v):s[a]=y}}}}(e,t,r);switch(e?.type??"other"){case"other":return{read:!0,write:!0};case"url":{const{read:e,write:t}=c.p;return{read:e,write:t}}}}(e,r,i);for(const e of t){const t=(0,u.rM)(r,e,i);for(const e in s)t[e]=s[e]}}}function h(e){const{targetUrl:t,params:r,value:o,context:l,dest:d,targetPropertyName:u}=e;if(!l.portalItem)return;const y=(0,c.b)(t),h=m(o,t,l);if(r?.contentAddressed&&"json"!==h.type)return void l.messages?.push(new i.A("persistable:contentAddressingUnsupported",`Property "${u}" is trying to serializing a resource with content of type ${h.type} with content addressing. Content addressing is only supported for json resources.`,{content:h}));const g=r?.contentAddressed&&"json"===h.type?(0,s.d)(h.jsonString):y?.filename??(0,a.lk)(),v=(0,n.fj)(r?.prefix??y?.prefix,g),w=`${v}.${(0,p.n)(h)}`;if(r?.contentAddressed&&l.resources&&"json"===h.type){const e=l.resources.toKeep.find((({resource:e})=>e.path===w))??l.resources.toAdd.find((({resource:e})=>e.path===w));if(e)return void(d[u]=e.resource.itemRelativeUrl)}const _=l.portalItem.resourceFromPath(w);(0,n.w8)(t)&&l.resources&&l.resources.pendingOperations.push((0,n.tk)(t).then((e=>{_.path=`${v}.${(0,p.n)({type:"blob",blob:e})}`,d[u]=_.itemRelativeUrl})).catch((()=>{})));const b=r?.compress??!1;l.resources&&f({...e,resource:_,content:h,compress:b,updates:l.resources.toAdd}),d[u]=_.itemRelativeUrl}function f({object:e,propertyName:t,updates:r,resource:i,content:s,compress:o}){r.push({resource:i,content:s,compress:o,finish:r=>{!function(e,t,r){"string"==typeof e[t]?e[t]=r.url:e[t].url=r.url}(e,t,r)}})}function m(e,t,r){return"string"==typeof e?{type:"url",url:t}:{type:"json",jsonString:JSON.stringify(e.toJSON(r))}}},92071:(e,t,r)=>{r.d(t,{P:()=>w,L:()=>_});var i=r(90237),s=r(69622),o=r(76953),n=r(4718),a=r(35666);class l{constructor(){this._propertyOriginMap=new Map,this._originStores=new Array(a.AU),this._values=new Map,this.multipleOriginsSupported=!0}clone(e){const t=new l,r=this._originStores[a.Gr.DEFAULTS];r&&r.forEach(((e,r)=>{t.set(r,(0,n.o8)(e),a.Gr.DEFAULTS)}));for(let r=a.Gr.SERVICE;r<a.AU;r++){const i=this._originStores[r];i&&i.forEach(((i,s)=>{e&&e.has(s)||t.set(s,(0,n.o8)(i),r)}))}return t}get(e,t){const r=void 0===t?this._values:this._originStores[t];return r?r.get(e):void 0}keys(e){const t=null==e?this._values:this._originStores[e];return t?[...t.keys()]:[]}set(e,t,r=a.Gr.USER){let i=this._originStores[r];if(i||(i=new Map,this._originStores[r]=i),i.set(e,t),!this._values.has(e)||this._propertyOriginMap.get(e)<=r){const i=this._values.get(e);return this._values.set(e,t),this._propertyOriginMap.set(e,r),i!==t}return!1}delete(e,t=a.Gr.USER){const r=this._originStores[t];if(!r)return;const i=r.get(e);if(r.delete(e),this._values.has(e)&&this._propertyOriginMap.get(e)===t){this._values.delete(e);for(let r=t-1;r>=0;r--){const t=this._originStores[r];if(t&&t.has(e)){this._values.set(e,t.get(e)),this._propertyOriginMap.set(e,r);break}}}return i}has(e,t){const r=void 0===t?this._values:this._originStores[t];return!!r&&r.has(e)}revert(e,t){for(;t>0&&!this.has(e,t);)--t;const r=this._originStores[t],i=r?.get(e),s=this._values.get(e);return this._values.set(e,i),this._propertyOriginMap.set(e,t),s!==i}originOf(e){return this._propertyOriginMap.get(e)||a.Gr.DEFAULTS}isAtOrigin(e,t){return this.has(e,t)&&this.originOf(e)===t}isBelowOrigin(e,t){return!this.has(e)||this.originOf(e)<t}forEach(e){this._values.forEach(e)}}var d=r(45917),u=r(88620),p=r(40608);const c=e=>{let t=class extends e{constructor(...e){super(...e);const t=(0,u.oY)(this),r=t.store,i=new l;t.store=i,(0,o.k)(t,r,i)}read(e,t){(0,d.L)(this,e,t)}getAtOrigin(e,t){const r=y(this),i=(0,a.aB)(t);if("string"==typeof e)return r.get(e,i);const s={};return e.forEach((e=>{s[e]=r.get(e,i)})),s}originOf(e){return(0,a.OL)(this.originIdOf(e))}originIdOf(e){return y(this).originOf(e)}revert(e,t){const r=y(this),i=(0,a.aB)(t),s=(0,u.oY)(this);let o;o="string"==typeof e?"*"===e?r.keys(i):[e]:e,o.forEach((e=>{s.invalidate(e),r.revert(e,i),s.commit(e)}))}};return t=(0,i._)([(0,p.$)("esri.core.ReadOnlyMultiOriginJSONSupport")],t),t};function y(e){return(0,u.oY)(e).store}let h=class extends(c(s.A)){};h=(0,i._)([(0,p.$)("esri.core.ReadOnlyMultiOriginJSONSupport")],h);var f=r(16649),m=r(49422);const g=e=>{let t=class extends e{constructor(...e){super(...e)}clear(e,t="user"){(0,u.oY)(this).clearOrigin(e,(0,a.aB)(t))}write(e,t){return(0,m.M)(this,e=e||{},t),e}setAtOrigin(e,t,r){(0,u.oY)(this).setAtOrigin(e,t,(0,a.aB)(r))}removeOrigin(e){const t=v(this),r=(0,a.aB)(e),i=t.keys(r);for(const e of i)t.originOf(e)===r&&t.set(e,t.get(e,r),a.Gr.USER)}updateOrigin(e,t){const r=v(this),i=(0,a.aB)(t),s=(0,f.Jt)(this,e);for(let t=i+1;t<a.AU;++t)r.delete(e,t);r.set(e,s,i)}toJSON(e){return this.write({},e)}};return t=(0,i._)([(0,p.$)("esri.core.MultiOriginJSONSupport.WriteableMultiOriginJSONSupport")],t),t.prototype.toJSON.isDefaultToJSON=!0,t};function v(e){return(0,u.oY)(e).store}const w=e=>{let t=class extends(g(c(e))){constructor(...e){super(...e)}};return t=(0,i._)([(0,p.$)("esri.core.MultiOriginJSONSupport")],t),t};let _=class extends(w(s.A)){};_=(0,i._)([(0,p.$)("esri.core.MultiOriginJSONSupport")],_)},96184:(e,t,r)=>{r.d(t,{A:()=>h});var i=r(90237),s=r(69540),o=r(25482),n=r(10107),a=(r(44208),r(53966),r(87811),r(36005)),l=r(40608),d=r(43937),u=r(64272),p=r(26253),c=r(56400);function y(e,t){return p.T.fromJSON({value:e,unit:t})}let h=class extends(s.A.ClonableMixin(o.A)){constructor(e){super(e),this.cumulative=!1,this.endField=null,this.fullTimeExtent=null,this.hasLiveData=!1,this.interval=null,this.startField=null,this.timeZone=null,this.trackIdField=null,this.useTime=!0,this.stops=null}readFullTimeExtent(e,t){return t.timeExtent&&Array.isArray(t.timeExtent)&&2===t.timeExtent.length?u.T.fromArray(t.timeExtent):null}writeFullTimeExtent(e,t){null!=e?.start&&null!=e.end?t.timeExtent=e.toArray():t.timeExtent=null}readInterval(e,t){return t.timeInterval&&t.timeIntervalUnits?y(t.timeInterval,t.timeIntervalUnits):t.defaultTimeInterval&&t.defaultTimeIntervalUnits?y(t.defaultTimeInterval,t.defaultTimeIntervalUnits):null}writeInterval(e,t){t.timeInterval=e?.toJSON().value??null,t.timeIntervalUnits=e?.toJSON().unit??null}};(0,i._)([(0,n.MZ)({type:Boolean,json:{name:"exportOptions.timeDataCumulative",write:!0}})],h.prototype,"cumulative",void 0),(0,i._)([(0,n.MZ)({type:String,json:{name:"endTimeField",write:{enabled:!0,allowNull:!0}}})],h.prototype,"endField",void 0),(0,i._)([(0,n.MZ)({type:u.T,json:{write:{enabled:!0,allowNull:!0}}})],h.prototype,"fullTimeExtent",void 0),(0,i._)([(0,a.w)("fullTimeExtent",["timeExtent"])],h.prototype,"readFullTimeExtent",null),(0,i._)([(0,d.K)("fullTimeExtent")],h.prototype,"writeFullTimeExtent",null),(0,i._)([(0,n.MZ)({type:Boolean,json:{write:!0}})],h.prototype,"hasLiveData",void 0),(0,i._)([(0,n.MZ)({type:p.T,json:{write:{enabled:!0,allowNull:!0}}})],h.prototype,"interval",void 0),(0,i._)([(0,a.w)("interval",["timeInterval","timeIntervalUnits","defaultTimeInterval","defaultTimeIntervalUnits"])],h.prototype,"readInterval",null),(0,i._)([(0,d.K)("interval")],h.prototype,"writeInterval",null),(0,i._)([(0,n.MZ)({type:String,json:{name:"startTimeField",write:{enabled:!0,allowNull:!0}}})],h.prototype,"startField",void 0),(0,i._)([(0,n.MZ)((0,c.P6)("timeReference",!0))],h.prototype,"timeZone",void 0),(0,i._)([(0,n.MZ)({type:String,json:{write:{enabled:!0,allowNull:!0}}})],h.prototype,"trackIdField",void 0),(0,i._)([(0,n.MZ)({type:Boolean,json:{name:"exportOptions.useTime",write:!0}})],h.prototype,"useTime",void 0),(0,i._)([(0,n.MZ)({type:[Date],json:{read:!1}})],h.prototype,"stops",void 0),h=(0,i._)([(0,l.$)("esri.layers.support.TimeInfo")],h)}}]);