UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

3 lines (2 loc) 21.2 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import e from"../config.js";import{version as t}from"../kernel.js";import{ArcadeDate as n,createDateTimeZone as r}from"../arcade/ArcadeDate.js";import{ArcadeModule as i}from"../arcade/ArcadeModule.js";import{ArcadeExecutionError as a}from"../arcade/executionError.js";import{ArcadeFunction as o}from"../arcade/FunctionWrapper.js";import u from"../arcade/ImmutableArray.js";import s from"../arcade/ImmutablePathArray.js";import l from"../arcade/ImmutablePointArray.js";import{esriFieldToJson as f,layerGeometryEsriRestConstants as c}from"../arcade/featureset/support/shared.js";import{format as m,parse as d}from"../core/number.js";import{DateOnly as y}from"../core/sql/DateOnly.js";import{TimeOnly as p}from"../core/sql/TimeOnly.js";import g from"../geometry/Extent.js";import h from"../geometry/Geometry.js";import b from"../geometry/Multipoint.js";import N from"../geometry/Point.js";import S from"../geometry/Polygon.js";import Z from"../geometry/Polyline.js";import T from"../geometry/SpatialReference.js";import{isClockwise as A}from"../geometry/support/coordsUtils.js";import{fromJSON as k}from"../geometry/support/jsonUtils.js";import{getLocale as j}from"../intl/locale.js";import{isBoolean as D,isNumber as x,isString as O,isDate as C,isArray as F,isInteger as w}from"../support/guards.js";import{DateTime as J}from"luxon";import{isGraphic as M}from"../support/graphicInstanceUtils.js";class R{constructor(e){this.value=e}}class v{constructor(e){this.value=e}}const P={type:"VOID"},I=Symbol("BREAK"),_=Symbol("CONTINUE");function Y(e,t,n){return""===t||null==t||t===n||t===n?e:e=e.split(t).join(n)}function L(e){return e instanceof o}function G(e){return e instanceof i}function V(e){return!!O(e)||(!!x(e)||(!!ne(e)||(!!re(e)||(!!ie(e)||(!!D(e)||(null===e||e===P))))))}function z(e,t){return void 0===e?t:e}function E(e){return null==e?"":F(e)||te(e)?"Array":ne(e)?"Date":ie(e)?"Time":re(e)?"DateOnly":O(e)?"String":D(e)?"Boolean":x(e)?"Number":"esri.arcade.Attachment"===e?.declaredClass?"Attachment":"esri.arcade.Portal"===e?.declaredClass?"Portal":"esri.arcade.Dictionary"===e?.declaredClass?"Dictionary":ee(e)?"KnowledgeGraph":e instanceof i?"Module":H(e)?"Feature":e instanceof N?"Point":e instanceof S?"Polygon":e instanceof Z?"Polyline":e instanceof b?"Multipoint":e instanceof g?"Extent":L(e)?"Function":B(e)?"FeatureSet":X(e)?"FeatureSetCollection":W(e)?"Voxel":$(e)?"Pixel":e===P?"":"number"==typeof e&&isNaN(e)?"Number":"Unrecognized Type"}function q(e){return e===P}function U(e){return e instanceof h}function H(e){return"esri.arcade.Feature"===e?.arcadeDeclaredClass}function W(e){return"esri.arcade.Voxel"===e?.arcadeDeclaredClass}function $(e){return"esri.arcade.Pixel"===e?.arcadeDeclaredClass}function B(e){return"esri.arcade.featureset.support.FeatureSet"===e?.declaredRootClass}function K(e){return"esri.arcade.Dictionary"===e?.declaredClass}function Q(e){return K(e)||H(e)||W(e)||$(e)}function X(e){return"esri.arcade.featureSetCollection"===e?.declaredRootClass}function ee(e){return"esri.rest.knowledgeGraph.KnowledgeGraph"===e?.declaredClass}function te(e){return e instanceof u}function ne(e){return e instanceof n}function re(e){return e instanceof y}function ie(e){return e instanceof p}function ae(e){return null!=e&&"object"==typeof e}function oe(e,t,n,r,i){if(e.length<t||e.length>n)throw new a(r,"WrongNumberOfParameters",i)}function ue(e){return null==e||q(e)||""===e}function se(e){return e<0?-Math.round(-e):Math.round(e)}function le(e,t){return isNaN(e)||null==t||""===t?e.toString():(t=Y(t,"‰",""),t=Y(t,"¤",""),m(e,{pattern:t}))}function fe(e,t){return null==t||""===t?e.toISOString(!0):e.toFormat(ce(t),{locale:j(),numberingSystem:"latn"})}function ce(e,t=!1){e=e.replaceAll(/LTS|LT|L{1,4}|l{1,4}/g,"[$&]");let n="";const r=/(\[[^[]*\])|(\\)?([Hh]mm(ss)?|Mo|M{1,4}|Do|DDDo|D{1,4}|d{2,4}|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|Z{1,5}|.)/g;for(const i of e.match(r)||[])switch(i){case"D":n+="d";break;case"DD":n+="dd";break;case"DDD":n+="o";break;case"d":n+="c";break;case"ddd":n+="ccc";break;case"dddd":n+="cccc";break;case"M":n+="L";break;case"MM":n+="LL";break;case"MMM":n+="LLL";break;case"MMMM":n+="LLLL";break;case"YY":n+="yy";break;case"Y":case"YYYY":n+="yyyy";break;case"Q":n+="q";break;case"Z":n+="Z";break;case"ZZ":n+="ZZ";break;case"ZZZ":n+="ZZZ";break;case"ZZZZ":n+=t?"[ZZZZ]":"ZZZZ";break;case"ZZZZZ":n+=t?"[ZZZZZ]":"ZZZZZ";break;case"S":n+="'S'";break;case"SS":n+="'SS'";break;case"SSS":n+="u";break;case"A":case"a":n+="a";break;case"m":case"mm":case"h":case"hh":case"H":case"HH":case"s":case"ss":case"X":case"x":n+=i;break;default:i.length>=2&&i.startsWith("[")&&i.endsWith("]")?n+=`'${i.slice(1,-1)}'`:n+=`'${i}'`}return n}function me(e,t,n){switch(n){case">":return e>t;case"<":return e<t;case">=":return e>=t;case"<=":return e<=t}return!1}function de(e,t,r){if(null===e){if(null===t||t===P)return me(null,null,r);if(x(t))return me(0,t,r);if(O(t))return me(0,Se(t),r);if(D(t))return me(0,Se(t),r);if(ne(t))return me(0,t.toNumber(),r);if(ie(t))return me(e,t.toNumber(),r);if(re(t))return me(e,t.toNumber(),r)}if(e===P){if(null===t||t===P)return me(null,null,r);if(x(t))return me(0,t,r);if(O(t))return me(0,Se(t),r);if(D(t))return me(0,Se(t),r);if(ne(t))return me(0,t.toNumber(),r);if(ie(t))return me(e,t.toNumber(),r);if(re(t))return me(e,t.toNumber(),r)}else if(x(e)){if(x(t))return me(e,t,r);if(D(t))return me(e,Se(t),r);if(null===t||t===P)return me(e,0,r);if(O(t))return me(e,Se(t),r);if(ne(t))return me(e,t.toNumber(),r);if(ie(t))return me(e,t.toNumber(),r);if(re(t))return me(e,t.toNumber(),r)}else if(O(e)){if(O(t))return me(ge(e),ge(t),r);if(ne(t))return me(Se(e),t.toNumber(),r);if(ie(t))return me(Se(e),t.toNumber(),r);if(re(t))return me(Se(e),t.toNumber(),r);if(x(t))return me(Se(e),t,r);if(null===t||t===P)return me(Se(e),0,r);if(D(t))return me(Se(e),Se(t),r)}else if(ne(e)){if(ne(t))return e.timeZone!==t.timeZone&&(e.isUnknownTimeZone?e=n.arcadeDateAndZoneToArcadeDate(e,t.timeZone):t.isUnknownTimeZone&&(t=n.arcadeDateAndZoneToArcadeDate(t,e.timeZone))),me(e.toNumber(),t.toNumber(),r);if(null===t||t===P)return me(e.toNumber(),0,r);if(x(t))return me(e.toNumber(),t,r);if(D(t))return me(e.toNumber(),Se(t),r);if(O(t))return me(e.toNumber(),Se(t),r);if(ie(t))throw new a(null,"CannotCompareDateAndTime",null);if(re(t))return me(e.toNumber(),t.toNumber(),r)}else if(D(e)){if(D(t))return me(e,t,r);if(x(t))return me(Se(e),Se(t),r);if(ne(t))return me(Se(e),t.toNumber(),r);if(ie(t))return me(Se(e),t.toNumber(),r);if(re(t))return me(Se(e),t.toNumber(),r);if(null===t||t===P)return me(Se(e),0,r);if(O(t))return me(Se(e),Se(t),r)}else if(re(e)){if(ne(t))return me(e.toNumber(),t.toNumber(),r);if(null===t||t===P)return me(e.toNumber(),0,r);if(x(t))return me(e.toNumber(),t,r);if(D(t))return me(e.toNumber(),Se(t),r);if(O(t))return me(e.toNumber(),Se(t),r);if(ie(t))throw new a(null,"CannotCompareDateAndTime",null);if(re(t))return me(e.toNumber(),t.toNumber(),r)}else if(ie(e)){if(ne(t))throw new a(null,"CannotCompareDateAndTime",null);if(null===t||t===P)return me(e.toNumber(),0,r);if(x(t))return me(e.toNumber(),t,r);if(D(t))return me(e.toNumber(),Se(t),r);if(O(t))return me(e.toNumber(),Se(t),r);if(ie(t))return me(e.toNumber(),t.toNumber(),r);if(re(t))throw new a(null,"CannotCompareDateAndTime",null)}return!!ye(e,t)&&("<="===r||">="===r)}function ye(e,t){if(e===t)return!0;if(null===e&&t===P||null===t&&e===P)return!0;if(ne(e)&&ne(t))return e.equals(t);if(ie(e)&&ie(t))return e.equals(t);if(re(e)&&re(t))return e.equals(t);if(e instanceof s)return e.equalityTest(t);if(e instanceof l)return e.equalityTest(t);if(e instanceof N&&t instanceof N){const n=e.cache._arcadeCacheId,r=t.cache._arcadeCacheId;if(null!=n)return n===r}if(ae(e)&&ae(t)){if(e._arcadeCacheId===t._arcadeCacheId&&void 0!==e._arcadeCacheId&&null!==e._arcadeCacheId)return!0;if(e._underlyingGraphic===t._underlyingGraphic&&void 0!==e._underlyingGraphic&&null!==e._underlyingGraphic)return!0}return!1}function pe(e,{useNumbersForDates:t}){let n="";for(const r in e){""!==n&&(n+=",");const i=e[r];null==i?n+=JSON.stringify(r)+":null":D(i)||x(i)||O(i)?n+=JSON.stringify(r)+":"+JSON.stringify(i):U(i)?n+=JSON.stringify(r)+":"+be(i):ie(i)||re(i)?n+=`${JSON.stringify(r)}:${JSON.stringify(i.toString())}`:te(i)||Array.isArray(i)?n+=JSON.stringify(r)+":"+be(i,null,t):ne(i)?n+=t?JSON.stringify(r)+":"+JSON.stringify(i.getTime()):JSON.stringify(r)+":"+i.stringify():null!==i&&"object"==typeof i&&"castToText"in i&&(n+=JSON.stringify(r)+":"+i.castToText(t))}return"{"+n+"}"}function ge(e,t){if(O(e))return e;if(null===e)return"";if(x(e))return le(e,t);if(D(e))return e.toString();if(ne(e))return fe(e,t);if(ie(e))return e.toFormat(t);if(re(e))return e.toFormat(t);if(e instanceof h)return JSON.stringify(e.toJSON());if(F(e)){const t=[];for(let n=0;n<e.length;n++)t[n]=Ne(e[n]);return"["+t.join(",")+"]"}if(e instanceof u){const t=[];for(let n=0;n<e.length();n++)t[n]=Ne(e.get(n));return"["+t.join(",")+"]"}return null!==e&&"object"==typeof e&&"castToText"in e?e.castToText():L(e)?"object, Function":e===P?"":G(e)?"object, Module":""}function he(e){const t=[];if(e instanceof u){for(let n=0;n<e.length();n++)t[n]=Se(e.get(n));return t}if(!F(e))return null;for(let n=0;n<e.length;n++)t[n]=Se(e[n]);return t}function be(e,t,n=!1){if(O(e))return e;if(null===e)return"";if(x(e))return le(e,t);if(D(e))return e.toString();if(ne(e))return fe(e,t);if(ie(e))return e.toFormat(t);if(re(e))return e.toFormat(t);if(e instanceof h)return e instanceof g?'{"xmin":'+e.xmin.toString()+',"ymin":'+e.ymin.toString()+","+(e.hasZ?'"zmin":'+e.zmin.toString()+",":"")+(e.hasM?'"mmin":'+e.mmin.toString()+",":"")+'"xmax":'+e.xmax.toString()+',"ymax":'+e.ymax.toString()+","+(e.hasZ?'"zmax":'+e.zmax.toString()+",":"")+(e.hasM?'"mmax":'+e.mmax.toString()+",":"")+'"spatialReference":'+we(e.spatialReference)+"}":we(e.toJSON(),(e,t)=>e.key===t.key?0:"spatialReference"===e.key?1:"spatialReference"===t.key||e.key<t.key?-1:e.key>t.key?1:0);if(F(e)){const t=[];for(let r=0;r<e.length;r++)t[r]=Ne(e[r],n);return"["+t.join(",")+"]"}if(e instanceof u){const t=[];for(let r=0;r<e.length();r++)t[r]=Ne(e.get(r),n);return"["+t.join(",")+"]"}return null!==e&&"object"==typeof e&&"castToText"in e?e.castToText(n):L(e)?"object, Function":e===P?"":G(e)?"object, Module":""}function Ne(e,t=!1){if(null===e)return"null";if(D(e)||O(e))return JSON.stringify(e);if(x(e))return e.toString();if(e instanceof h)return be(e,null,t);if(e instanceof u)return be(e,null,t);if(Array.isArray(e))return be(e,null,t);if(ne(e))return t?JSON.stringify(e.getTime()):JSON.stringify(fe(e,""));if(ie(e))return JSON.stringify(e.toString());if(re(e))return JSON.stringify(e.toString());if(null!==e&&"object"==typeof e){if("castToText"in e)return e.castToText(t)}else if(e===P)return"null";return"null"}function Se(e,t){return x(e)?e:null===e||""===e?0:ne(e)||re(e)||ie(e)?NaN:D(e)?e?1:0:F(e)||""===e||void 0===e?NaN:void 0!==t&&O(e)?(t=Y(t,"‰",""),t=Y(t,"¤",""),d(e,{pattern:t})):e===P?0:Number(e)}function Ze(e,t){if(ne(e))return e;if(O(e)){const r=Te(e,t);if(r)return n.dateTimeToArcadeDate(r)}return null}function Te(e,t){const n=/ (\d\d)/,i=r(t);let a=J.fromISO(e,{zone:i});return a.isValid||n.test(e)&&(e=e.replace(n,"T$1"),a=J.fromISO(e,{zone:t}),a.isValid)?a:null}function Ae(e){return D(e)?e:O(e)?"true"===(e=e.toLowerCase()):!!x(e)&&(0!==e&&!isNaN(e))}function ke(e,t){const n=JSON.parse(e);return n&&!n.spatialReference&&(n.spatialReference=t),k(n)}function je(e,t){return null==e?null:(null!==e.spatialReference&&void 0!==e.spatialReference||(e.spatialReference=t),e)}function De(e){if(null===e)return null;if(e instanceof N)return"NaN"===e.x||null===e.x||isNaN(e.x)?null:e;if(e instanceof S){if(0===(e.curveRings??e.rings).length)return null;for(const t of e.curveRings??e.rings)if(t.length>0)return e;return null}if(e instanceof Z){if(0===(e.curvePaths??e.paths).length)return null;for(const t of e.curvePaths??e.paths)if(t.length>0)return e;return null}return e instanceof b?0===e.points.length?null:e:e instanceof g?"NaN"===e.xmin||null===e.xmin||isNaN(e.xmin)?null:e:null}function xe(e,t){if(!e)return t;if(!e.domain)return t;let n=null,r=null;if(ne(t))n=t.toNumber();else if(re(t))n=t.toString();else if(ie(t))n=t.toStorageString();else if("string"===e.field.type||"esriFieldTypeString"===e.field.type)n=ge(t);else{if(null==t)return null;if(""===t)return t;n=Se(t)}for(let i=0;i<e.domain.codedValues.length;i++){const t=e.domain.codedValues[i];t.code===n&&(r=t)}return null===r?ge(t):r.name}function Oe(e,t){if(!e)return t;if(!e.domain)return t;let n=null;const r=ge(t);for(let i=0;i<e.domain.codedValues.length;i++){const t=e.domain.codedValues[i];t.name===r&&(n=t)}return null===n?t:n.code}function Ce(e,t,n=null,r=null){if(!t)return null;if(!t.fields)return null;let i,o,u=null;for(let a=0;a<t.fields.length;a++){const n=t.fields[a];n.name.toLowerCase()===e.toString().toLowerCase()&&(u=n)}if(null===u)throw new a(null,"FieldNotFound",null,{key:e});let s=t.typeIdField,l="id",f=t.types;if(t.subtypeField&&(s=t.subtypeField,l="code",f=t.subtypes??[]),null===r&&n&&s)r=n.hasField(s)?n.field(s):null;else if(s&&null!==r){let e=!1;for(const t of f||[])if(r===t[l]){e=!0;break}if(!e)for(const t of f||[])if(r===t.name){r=t[l],e=!0;break}e||(r=null,n&&s&&(r=n.hasField(s)?n.field(s):null))}return null!=r&&f.some(e=>e[l]===r&&(i=e.domains?.[u.name],i&&"inherited"===i.type&&(i=Fe(u.name,t),o=!0),!0)),o||i||(i=Fe(e,t)),{field:u,domain:i}}function Fe(e,t){let n;return t.fields.some(t=>(t.name.toLowerCase()===e.toLowerCase()&&(n=t.domain),!!n)),n}function we(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});const n="boolean"==typeof t.cycles&&t.cycles,r=t.cmp&&(i=t.cmp,function(e){return function(t,n){const r={key:t,value:e[t]},a={key:n,value:e[n]};return i(r,a)}});var i;const a=[];return function e(t){if(t?.toJSON&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0===t)return;if("number"==typeof t)return isFinite(t)?""+t:"null";if("object"!=typeof t)return JSON.stringify(t);let i,o;if(Array.isArray(t)){for(o="[",i=0;i<t.length;i++)i&&(o+=","),o+=e(t[i])||"null";return o+"]"}if(null===t)return"null";if(a.includes(t)){if(n)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}const u=a.push(t)-1,s=Object.keys(t).sort(r?.(t));for(o="",i=0;i<s.length;i++){const n=s[i],r=e(t[n]);r&&(o&&(o+=","),o+=JSON.stringify(n)+":"+r)}return a.splice(u,1),"{"+o+"}"}(e)}function Je(e){if(null===e)return null;const t=[];for(const n of e)H(n)?t.push(n.geometry()):t.push(n);return t}function Me(e,t){if(!(t instanceof N))throw new a(null,"InvalidParameter",null);e.push(t.hasZ?t.hasM?[t.x,t.y,t.z,t.m]:[t.x,t.y,t.z]:[t.x,t.y])}function Re(e,t){if(F(e)||te(e)){let n=!1,r=!1,i=[],o=t;if(F(e)){for(const t of e)Me(i,t);i.length>0&&(o=e[0].spatialReference,n=e[0].hasZ,r=e[0].hasM)}else if(e instanceof l)i=e._elements,i.length>0&&(n=e._hasZ,r=e._hasM,o=e.get(0).spatialReference);else{if(!te(e))throw new a(null,"InvalidParameter",null);for(const t of e.toArray())Me(i,t);i.length>0&&(o=e.get(0).spatialReference,n=!0===e.get(0).hasZ,r=!0===e.get(0).hasM)}if(0===i.length)return null;return A(i)||(i=i.slice().reverse()),new S({rings:[i],spatialReference:o,hasZ:n,hasM:r})}return e}function ve(e,t){if(F(e)||te(e)){let n=!1,r=!1,i=[],a=t;if(F(e)){for(const t of e)Me(i,t);i.length>0&&(a=e[0].spatialReference,n=!0===e[0].hasZ,r=!0===e[0].hasM)}else if(e instanceof l)i=e._elements,i.length>0&&(n=e._hasZ,r=e._hasM,a=e.get(0).spatialReference);else if(te(e)){for(const t of e.toArray())Me(i,t);i.length>0&&(a=e.get(0).spatialReference,n=!0===e.get(0).hasZ,r=!0===e.get(0).hasM)}return 0===i.length?null:new Z({paths:[i],spatialReference:a,hasZ:n,hasM:r})}return e}function Pe(e,t){if(F(e)||te(e)){let n=!1,r=!1,i=[],a=t;if(F(e)){for(const t of e)Me(i,t);i.length>0&&(a=e[0].spatialReference,n=!0===e[0].hasZ,r=!0===e[0].hasM)}else if(e instanceof l)i=e._elements,i.length>0&&(n=e._hasZ,r=e._hasM,a=e.get(0).spatialReference);else if(te(e)){for(const t of e.toArray())Me(i,t);i.length>0&&(a=e.get(0).spatialReference,n=!0===e.get(0).hasZ,r=!0===e.get(0).hasM)}return 0===i.length?null:new b({points:i,spatialReference:a,hasZ:n,hasM:r})}return e}function Ie(e,t=!0){if(null==e)return[];if(F(e)){const n=[];for(const r of e){const e=ge(r);(t||""!==e)&&n.push(e)}return n}if(te(e)){const n=[];for(let r=0;r<e.length();r++){const i=ge(e.get(r));(t||""!==i)&&n.push(i)}return n}if(V(e)){const n=ge(e);if(t||""!==n)return[n]}return[]}let _e=0;function Ye(){return _e++,_e%100==0?(_e=0,new Promise(e=>{setTimeout(()=>{e()},0)})):Promise.resolve()}function Le(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 Ge(e,t=null){return null==e?null:D(e)||x(e)||O(e)?e:e instanceof h?!0===t?.keepGeometryType?e:e.toJSON():e instanceof u?e.toArray().map(e=>Ge(e,t)):Array.isArray(e)?e.map(e=>Ge(e,t)):C(e)?e:ne(e)?e.toJSDate():ie(e)?e.toString():re(e)?e.toJSDate():null!==e&&"object"==typeof e&&void 0!==e.castAsJson?e.castAsJson(t):null}async function Ve(e,t,n,r,i){const a=await ze(e,t,n);i[r]=a}async function ze(e,t=null,n=null){if(e instanceof u&&(e=e.toArray()),null==e)return null;if(V(e)||e instanceof h||C(e)||ne(e))return Ge(e,n);if(Array.isArray(e)){const r=[],i=[];for(const a of e)null===a||V(a)||a instanceof h||C(a)||ne(a)?i.push(Ge(a,n)):(i.push(null),r.push(Ve(a,t,n,i.length-1,i)));return r.length>0&&await Promise.all(r),i}return null!==e&&"object"==typeof e&&void 0!==e.castAsJsonAsync?e.castAsJsonAsync(t,n):null}function Ee(e){return qe(e)?e.parent:e}function qe(e){return e&&"declaredClass"in e&&"esri.layers.support.SubtypeSublayer"===e.declaredClass}function Ue(e){return e&&"declaredClass"in e&&"esri.layers.SubtypeGroupLayer"===e.declaredClass}function He(e,t,n){const r=Ee(e.fullSchema());if(null===r)return null;if(!r.fields)return null;return Ce(t,r,e,n)}function We(e){const t=Ee(e.fullSchema());return null===t?null:t.fields?t.subtypeField?{subtypeField:t.subtypeField,subtypes:t.subtypes?t.subtypes.map(e=>({name:e.name,code:e.code})):[]}:t.typeIdField?{subtypeField:t.typeIdField,subtypes:t.types?t.types.map(e=>({name:e.name,code:e.id})):[]}:null:null}function $e(e,t,n,r){const i=Ee(e.fullSchema());if(null===i)return null;if(!i.fields)return null;const a=Ce(t,i,e,r);if(void 0===n)try{n=e.field(t)}catch(o){return null}return xe(a,n)}function Be(e,t,n,r){const i=Ee(e.fullSchema());if(null===i)return null;if(!i.fields)return null;if(void 0===n){try{n=e.field(t)}catch(a){return null}return n}return Oe(Ce(t,i,e,r),n)}function Ke(e){return e?.timeZone??"system"}function Qe(e){const t=Ee(e.fullSchema());if(null===t)return null;if(!t.fields)return null;const n=[];for(const r of t.fields)n.push(f(r));return{objectIdField:t.objectIdField,globalIdField:t.globalIdField??"",geometryType:void 0===c[t.geometryType]?"":c[t.geometryType],fields:n}}function Xe(r,i){const a=n.systemTimeZoneCanonicalName;return"system"===r&&(r=a),{version:et,engineVersion:t,timeZone:r,userTimeZone:a,spatialReference:i instanceof T?i.toJSON():i,application:e.applicationName??"",engine:"web",locale:j()}}const et="1.35",tt=Object.freeze(Object.defineProperty({__proto__:null,ImplicitResult:v,ReturnResult:R,absRound:se,arcadeVersion:et,autoCastArrayOfPointsToMultiPoint:Pe,autoCastArrayOfPointsToPolygon:Re,autoCastArrayOfPointsToPolyline:ve,autoCastFeatureToGeometry:Je,binaryOperator:Le,breakResult:I,castAsJson:Ge,castAsJsonAsync:ze,castRecordToText:pe,continueResult:_,defaultExecutingContext:Xe,defaultTimeZone:Ke,defaultUndefined:z,equalityTest:ye,featureDomainCodeLookup:Be,featureDomainValueLookup:$e,featureFullDomain:He,featureSchema:Qe,featureSubtypes:We,fixNullGeometry:De,fixSpatialReference:je,formatDate:fe,formatNumber:le,getDomain:Ce,getDomainCode:Oe,getDomainValue:xe,getType:E,greaterThanLessThan:de,isArray:F,isBoolean:D,isDate:ne,isDateOnly:re,isDictionary:K,isDictionaryLike:Q,isEmpty:ue,isFeature:H,isFeatureSet:B,isFeatureSetCollection:X,isFunctionParameter:L,isGeometry:U,isGraphic:M,isImmutableArray:te,isInteger:w,isJsDate:C,isKnowledgeGraph:ee,isModule:G,isNumber:x,isObject:ae,isPixel:$,isSimpleType:V,isString:O,isSubtypeGrouplayer:Ue,isSubtypeSublayer:qe,isTime:ie,isVoid:q,isVoxel:W,multiReplace:Y,parseGeometryFromJson:ke,pcCheck:oe,stableStringify:we,standardiseDateFormat:ce,tick:Ye,toBoolean:Ae,toDate:Ze,toNumber:Se,toNumberArray:he,toString:ge,toStringArray:Ie,toStringExplicit:be,voidOperation:P},Symbol.toStringTag,{value:"Module"}));export{Y as $,_ as A,oe as B,Je as C,je as D,Re as E,ve as F,Pe as G,Ae as H,v as I,z as J,Ke as K,ue as L,G as M,Ie as N,E as O,Ze as P,ce as Q,R,se as S,He as T,Be as U,$e as V,Qe as W,We as X,De as Y,W as Z,$ as _,Ge as a,Xe as a0,he as a1,qe as a2,Ye as a3,Ce as a4,xe as a5,Oe as a6,et as a7,fe as a8,le as a9,ae as aa,Ue as ab,ke as ac,we as ad,ze as b,pe as c,V as d,ne as e,re as f,ie as g,U as h,L as i,te as j,H as k,X as l,B as m,K as n,ee as o,tt as p,q,Se as r,ge as s,be as t,de as u,P as v,ye as w,Le as x,Q as y,I as z};