arcadeAsyncRuntime-QOSTXEAK.js 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092
  1. import {
  2. I,
  3. N as N2,
  4. O as O2,
  5. P as P2,
  6. S,
  7. b,
  8. f,
  9. m as m3,
  10. o,
  11. p as p2,
  12. r,
  13. u,
  14. y
  15. } from "./chunk-IT2TKXNZ.js";
  16. import {
  17. d as d2,
  18. s
  19. } from "./chunk-YYN5W6FL.js";
  20. import {
  21. e
  22. } from "./chunk-L5OAV75Q.js";
  23. import "./chunk-YQQTFR2M.js";
  24. import {
  25. d
  26. } from "./chunk-R5LRKX5A.js";
  27. import {
  28. sn
  29. } from "./chunk-V7YK62XD.js";
  30. import "./chunk-UDNYCFF2.js";
  31. import "./chunk-HEFAWVPH.js";
  32. import "./chunk-PJ6KSXOD.js";
  33. import "./chunk-VEAEIBHK.js";
  34. import "./chunk-6SASJ6IM.js";
  35. import "./chunk-3OHML7FO.js";
  36. import "./chunk-FYNVVMWY.js";
  37. import "./chunk-Q52DVFYK.js";
  38. import "./chunk-HBMVUVZX.js";
  39. import "./chunk-2SJEIKRW.js";
  40. import {
  41. A,
  42. D2 as D,
  43. E,
  44. G,
  45. J,
  46. L,
  47. N,
  48. Ne,
  49. O,
  50. P2 as P,
  51. Q,
  52. R,
  53. W,
  54. X,
  55. Y,
  56. _,
  57. h,
  58. i,
  59. j as j2,
  60. k as k2,
  61. ne,
  62. se,
  63. t2 as t,
  64. v2,
  65. w,
  66. z
  67. } from "./chunk-25BNEBXZ.js";
  68. import "./chunk-3ZFH4KQV.js";
  69. import "./chunk-PHRSJJ3U.js";
  70. import "./chunk-PIGRDDRG.js";
  71. import "./chunk-BJHM4JNS.js";
  72. import "./chunk-F6A2QQ26.js";
  73. import "./chunk-7ZIDBK7B.js";
  74. import "./chunk-O4FY3ITT.js";
  75. import "./chunk-UXF37FQ4.js";
  76. import "./chunk-ZOEK6QHJ.js";
  77. import "./chunk-2Z6LERTI.js";
  78. import {
  79. m,
  80. m2,
  81. v2 as v
  82. } from "./chunk-OWVBLVP3.js";
  83. import "./chunk-MXB2XLKV.js";
  84. import "./chunk-XH7RUGVZ.js";
  85. import "./chunk-VNFRAYHO.js";
  86. import "./chunk-R5IG2D6H.js";
  87. import "./chunk-VBRY5KJM.js";
  88. import "./chunk-PDKDCAAD.js";
  89. import {
  90. M2 as M,
  91. j2 as j,
  92. p
  93. } from "./chunk-ECW2QABR.js";
  94. import "./chunk-GCDJLKH4.js";
  95. import {
  96. k2 as k
  97. } from "./chunk-MRJEICT6.js";
  98. import "./chunk-Y3WMVFTW.js";
  99. import "./chunk-SAS7RONY.js";
  100. import "./chunk-WSRBH7BF.js";
  101. import "./chunk-IHXECKQQ.js";
  102. import "./chunk-ULGDPLM2.js";
  103. import "./chunk-EMJ4ZSM2.js";
  104. import "./chunk-IKP3YN53.js";
  105. import "./chunk-GZT4BVFP.js";
  106. import "./chunk-A5ICIBVI.js";
  107. // node_modules/@arcgis/core/arcade/arcadeAsyncRuntime.js
  108. function J2(e2) {
  109. return e2 && typeof e2.then == "function";
  110. }
  111. var Q2 = 100;
  112. async function $(e2, t2) {
  113. const r2 = [];
  114. for (let n = 0; n < t2.arguments.length; n++)
  115. r2.push(await re(e2, t2.arguments[n]));
  116. return r2;
  117. }
  118. async function ee(e2, t2, r2) {
  119. if (t2.preparsed === true)
  120. return r2(e2, null, t2.arguments);
  121. return r2(e2, t2, await $(e2, t2));
  122. }
  123. async function te(e2, t2, r2) {
  124. if (t2.preparsed === true) {
  125. const n2 = r2(e2, null, t2.arguments);
  126. return J2(n2), n2;
  127. }
  128. const n = r2(e2, t2, await $(e2, t2));
  129. return J2(n), n;
  130. }
  131. async function re(e2, t2, r2) {
  132. if (t2.breakpoint && r2 !== true) {
  133. const r3 = t2.breakpoint();
  134. return await r3, re(e2, t2, true);
  135. }
  136. switch (t2.type) {
  137. case "VariableDeclarator":
  138. return Re(e2, t2);
  139. case "VariableDeclaration":
  140. return be(e2, t2, 0);
  141. case "BlockStatement":
  142. return ve(e2, t2);
  143. case "FunctionDeclaration":
  144. return Se(e2, t2);
  145. case "ReturnStatement":
  146. return Te(e2, t2);
  147. case "IfStatement":
  148. return Ne2(e2, t2);
  149. case "ExpressionStatement":
  150. return ye(e2, t2);
  151. case "UpdateExpression":
  152. return me(e2, t2);
  153. case "AssignmentExpression":
  154. return Ee(e2, t2);
  155. case "ForStatement":
  156. return ce(e2, t2);
  157. case "ForInStatement":
  158. return de(e2, t2);
  159. case "BreakStatement":
  160. return A;
  161. case "EmptyStatement":
  162. return j2;
  163. case "ContinueStatement":
  164. return R;
  165. case "TemplateElement":
  166. return je(e2, t2);
  167. case "TemplateLiteral":
  168. return Le(e2, t2);
  169. case "Identifier":
  170. return Pe(e2, t2);
  171. case "MemberExpression":
  172. return Ue(e2, t2);
  173. case "Literal":
  174. return t2.value;
  175. case "CallExpression":
  176. return De(e2, t2);
  177. case "UnaryExpression":
  178. return Ce(e2, t2);
  179. case "BinaryExpression":
  180. return xe(e2, t2);
  181. case "LogicalExpression":
  182. return Me(e2, t2);
  183. case "ArrayExpression":
  184. return Fe(e2, t2);
  185. case "ObjectExpression":
  186. return ne2(e2, t2);
  187. case "Property":
  188. return oe(e2, t2);
  189. default:
  190. throw new Error(b(t2, "RUNTIME", "UNREOGNISED"));
  191. }
  192. }
  193. async function ne2(e2, t2) {
  194. const n = [];
  195. for (let r2 = 0; r2 < t2.properties.length; r2++)
  196. n[r2] = await re(e2, t2.properties[r2]);
  197. const o2 = {};
  198. for (let r2 = 0; r2 < n.length; r2++) {
  199. const e3 = n[r2];
  200. if (v2(e3.value))
  201. throw new Error("Illegal Argument");
  202. if (w(e3.key) === false)
  203. throw new Error("Illegal Argument");
  204. e3.value === j2 ? o2[e3.key.toString()] = null : o2[e3.key.toString()] = e3.value;
  205. }
  206. const a = new d(o2);
  207. return a.immutable = false, a;
  208. }
  209. async function oe(e2, t2) {
  210. const r2 = await re(e2, t2.value);
  211. if (t2.key.type === "Identifier")
  212. return { key: t2.key.name, value: r2 };
  213. return { key: await re(e2, t2.key), value: r2 };
  214. }
  215. async function ae(e2, t2, r2) {
  216. const n = await re(e2, t2.body);
  217. return r2.lastAction = n, r2.lastAction === A || r2.lastAction instanceof D ? (r2.testResult = false, r2) : t2.update !== null ? (await re(e2, t2.update), r2) : r2;
  218. }
  219. async function ie(e2, t2, r2) {
  220. if (t2.test !== null) {
  221. const n = await re(e2, t2.test);
  222. if (e2.abortSignal.aborted === true)
  223. throw new Error("Cancelled");
  224. if (r2.testResult = n, r2.testResult === false)
  225. return r2;
  226. if (r2.testResult !== true)
  227. throw new Error(b(t2, "RUNTIME", "CANNOT_USE_NONBOOLEAN_IN_CONDITION"));
  228. return ae(e2, t2, r2);
  229. }
  230. return ae(e2, t2, r2);
  231. }
  232. function se2(e2, t2, r2, n, o2, a) {
  233. try {
  234. ie(e2, t2, r2).then(() => {
  235. try {
  236. r2.testResult === true ? ++a > Q2 ? (a = 0, setTimeout(() => {
  237. se2(e2, t2, r2, n, o2, a);
  238. }, 0)) : se2(e2, t2, r2, n, o2, a) : r2.lastAction instanceof D ? n(r2.lastAction) : n(j2);
  239. } catch (i2) {
  240. o2(i2);
  241. }
  242. }, (e3) => {
  243. o2(e3);
  244. });
  245. } catch (i2) {
  246. o2(i2);
  247. }
  248. }
  249. function ce(e2, t2) {
  250. try {
  251. return t2.init !== null ? re(e2, t2.init).then(() => new Promise((r2, n) => {
  252. se2(e2, t2, { testResult: true, lastAction: j2 }, (e3) => {
  253. r2(e3);
  254. }, (e3) => {
  255. n(e3);
  256. }, 0);
  257. })) : new Promise((r2, n) => {
  258. se2(e2, t2, { testResult: true, lastAction: j2 }, (e3) => {
  259. r2(e3);
  260. }, (e3) => {
  261. n(e3);
  262. }, 0);
  263. });
  264. } catch (r2) {
  265. return Promise.reject(r2);
  266. }
  267. }
  268. function le(e2, t2, r2, n, o2, a, i2, s2, c, l) {
  269. try {
  270. if (n <= a)
  271. return void s2(j2);
  272. o2.value = i2 === "k" ? r2[a] : a, re(e2, t2.body).then((u2) => {
  273. try {
  274. u2 instanceof D ? s2(u2) : u2 === A ? s2(j2) : ++l > Q2 ? (l = 0, setTimeout(() => {
  275. le(e2, t2, r2, n, o2, a + 1, i2, s2, c, l);
  276. }, 0)) : le(e2, t2, r2, n, o2, a + 1, i2, s2, c, l);
  277. } catch (f2) {
  278. c(f2);
  279. }
  280. }, (e3) => {
  281. c(e3);
  282. });
  283. } catch (u2) {
  284. c(u2);
  285. }
  286. }
  287. function ue(e2, t2, r2, n, o2, a, i2, s2, c) {
  288. try {
  289. if (r2.length() <= o2)
  290. return void i2(j2);
  291. n.value = a === "k" ? r2.get(o2) : o2, re(e2, t2.body).then((l) => {
  292. l instanceof D ? i2(l) : l === A ? i2(j2) : ++c > Q2 ? (c = 0, setTimeout(() => {
  293. ue(e2, t2, r2, n, o2 + 1, a, i2, s2, c);
  294. }, 0)) : ue(e2, t2, r2, n, o2 + 1, a, i2, s2, c);
  295. }, (e3) => {
  296. s2(e3);
  297. });
  298. } catch (l) {
  299. s2(l);
  300. }
  301. }
  302. function fe(e2, t2, r2, n, o2, a) {
  303. try {
  304. if (a === void 0 && (a = "i"), r2.length === 0)
  305. return void n.resolve(j2);
  306. le(e2, t2, r2, r2.length, o2, 0, a, (e3) => {
  307. n.resolve(e3);
  308. }, (e3) => {
  309. n.reject(e3);
  310. }, 0);
  311. } catch (i2) {
  312. n.reject(i2);
  313. }
  314. }
  315. function pe(e2, t2, r2, n, o2, a) {
  316. try {
  317. if (a === void 0 && (a = "i"), r2.length === 0)
  318. return void n.resolve(j2);
  319. ue(e2, t2, r2, o2, 0, a, (e3) => {
  320. n.resolve(e3);
  321. }, (e3) => {
  322. n.reject(e3);
  323. }, 0);
  324. } catch (i2) {
  325. n.reject(i2);
  326. }
  327. }
  328. function we(e2, t2, r2, n, o2) {
  329. try {
  330. fe(e2, t2, r2.keys(), n, o2, "k");
  331. } catch (a) {
  332. n.reject(a);
  333. }
  334. }
  335. function he(e2, t2, r2, o2, a, i2, s2, c) {
  336. try {
  337. e2.next().then((l) => {
  338. try {
  339. if (l === null)
  340. i2(j2);
  341. else {
  342. const u2 = d2.createFromGraphicLikeObject(l.geometry, l.attributes, o2);
  343. u2._underlyingGraphic = l, a.value = u2;
  344. re(t2, r2.body).then((n) => {
  345. try {
  346. n === A ? i2(j2) : n instanceof D ? i2(n) : ++c > Q2 ? (c = 0, setTimeout(() => {
  347. he(e2, t2, r2, o2, a, i2, s2, c);
  348. }, 0)) : he(e2, t2, r2, o2, a, i2, s2, c);
  349. } catch (l2) {
  350. s2(l2);
  351. }
  352. }, (e3) => {
  353. s2(e3);
  354. });
  355. }
  356. } catch (u2) {
  357. s2(u2);
  358. }
  359. }, (e3) => {
  360. s2(e3);
  361. });
  362. } catch (l) {
  363. s2(l);
  364. }
  365. }
  366. async function de(e2, t2) {
  367. return new Promise((n, o2) => {
  368. re(e2, t2.right).then((a) => {
  369. try {
  370. let i2 = null;
  371. i2 = t2.left.type === "VariableDeclaration" ? re(e2, t2.left) : Promise.resolve(), i2.then(() => {
  372. try {
  373. let i3 = "";
  374. if (t2.left.type === "VariableDeclaration") {
  375. const e3 = t2.left.declarations[0].id;
  376. e3.type === "Identifier" && (i3 = e3.name);
  377. } else
  378. t2.left.type === "Identifier" && (i3 = t2.left.name);
  379. if (!i3)
  380. throw new Error(b(t2, "RUNTIME", "INVALIDVARIABLE"));
  381. i3 = i3.toLowerCase();
  382. let s2 = null;
  383. if (e2.localScope !== null && e2.localScope[i3] !== void 0 && (s2 = e2.localScope[i3]), s2 === null && e2.globalScope[i3] !== void 0 && (s2 = e2.globalScope[i3]), s2 === null)
  384. return void o2(new Error(b(t2, "RUNTIME", "VARIABLENOTDECLARED")));
  385. L(a) || w(a) ? fe(e2, t2, a, { reject: o2, resolve: n }, s2) : E(a) ? pe(e2, t2, a, { reject: o2, resolve: n }, s2) : a instanceof d || Y(a) ? we(e2, t2, a, { reject: o2, resolve: n }, s2) : J(a) ? he(a.iterator(e2.abortSignal), e2, t2, a, s2, (e3) => {
  386. n(e3);
  387. }, (e3) => {
  388. o2(e3);
  389. }, 0) : fe(e2, t2, [], { reject: o2, resolve: n }, s2);
  390. } catch (i3) {
  391. o2(i3);
  392. }
  393. }, o2);
  394. } catch (i2) {
  395. o2(i2);
  396. }
  397. }, o2);
  398. });
  399. }
  400. async function me(e2, t2) {
  401. const n = t2.argument;
  402. if (n.type === "MemberExpression") {
  403. const o3 = { t: null }, a2 = await re(e2, n.object);
  404. let i2 = null;
  405. o3.t = a2, n.computed === true ? i2 = await re(e2, n.property) : n.property.type === "Identifier" && (i2 = n.property.name);
  406. const s2 = o3.t;
  407. let c;
  408. if (L(s2)) {
  409. if (!O(i2))
  410. throw new Error("Invalid Parameter");
  411. if (i2 < 0 && (i2 = s2.length + i2), i2 < 0 || i2 >= s2.length)
  412. throw new Error("Assignment outside of array bounds");
  413. c = ne(s2[i2]), s2[i2] = t2.operator === "++" ? c + 1 : c - 1;
  414. } else if (s2 instanceof d) {
  415. if (w(i2) === false)
  416. throw new Error("Dictionary accessor must be a string");
  417. if (s2.hasField(i2) !== true)
  418. throw new Error("Invalid Parameter");
  419. c = ne(s2.field(i2)), s2.setField(i2, t2.operator === "++" ? c + 1 : c - 1);
  420. } else {
  421. if (!Y(s2))
  422. throw E(s2) ? new Error("Array is Immutable") : new Error("Invalid Parameter");
  423. if (w(i2) === false)
  424. throw new Error("Feature accessor must be a string");
  425. if (s2.hasField(i2) !== true)
  426. throw new Error("Invalid Parameter");
  427. c = ne(s2.field(i2)), s2.setField(i2, t2.operator === "++" ? c + 1 : c - 1);
  428. }
  429. return t2.prefix === false ? c : t2.operator === "++" ? c + 1 : c - 1;
  430. }
  431. const o2 = t2.argument.type === "Identifier" ? t2.argument.name.toLowerCase() : "";
  432. if (!o2)
  433. throw new Error("Invalid identifier");
  434. let a;
  435. if (e2.localScope !== null && e2.localScope[o2] !== void 0)
  436. return a = ne(e2.localScope[o2].value), e2.localScope[o2] = { value: t2.operator === "++" ? a + 1 : a - 1, valueset: true, node: t2 }, t2.prefix === false ? a : t2.operator === "++" ? a + 1 : a - 1;
  437. if (e2.globalScope[o2] !== void 0)
  438. return a = ne(e2.globalScope[o2].value), e2.globalScope[o2] = { value: t2.operator === "++" ? a + 1 : a - 1, valueset: true, node: t2 }, t2.prefix === false ? a : t2.operator === "++" ? a + 1 : a - 1;
  439. throw new Error("Variable not recognised");
  440. }
  441. function ge(e2, t2, r2, n) {
  442. switch (t2) {
  443. case "=":
  444. return e2 === j2 ? null : e2;
  445. case "/=":
  446. return ne(r2) / ne(e2);
  447. case "*=":
  448. return ne(r2) * ne(e2);
  449. case "-=":
  450. return ne(r2) - ne(e2);
  451. case "+=":
  452. return w(r2) || w(e2) ? X(r2) + X(e2) : ne(r2) + ne(e2);
  453. case "%=":
  454. return ne(r2) % ne(e2);
  455. default:
  456. throw new Error(b(n, "RUNTIME", "OPERATORNOTRECOGNISED"));
  457. }
  458. }
  459. async function Ee(e2, t2) {
  460. const n = t2.left;
  461. if (n.type === "MemberExpression") {
  462. const o3 = await re(e2, t2.right), a = await re(e2, n.object);
  463. let i2 = null;
  464. if (n.computed === true)
  465. i2 = await re(e2, n.property);
  466. else {
  467. if (n.property.type !== "Identifier")
  468. throw new Error("Expected computed or identifier for assignemnt target");
  469. i2 = n.property.name;
  470. }
  471. if (L(a)) {
  472. if (!O(i2))
  473. throw new Error("Invalid Parameter");
  474. if (i2 < 0 && (i2 = a.length + i2), i2 < 0 || i2 > a.length)
  475. throw new Error("Assignment outside of array bounds");
  476. if (i2 === a.length) {
  477. if (t2.operator !== "=")
  478. throw new Error("Invalid Parameter");
  479. a[i2] = ge(o3, t2.operator, a[i2], t2);
  480. } else
  481. a[i2] = ge(o3, t2.operator, a[i2], t2);
  482. } else if (a instanceof d) {
  483. if (w(i2) === false)
  484. throw new Error("Dictionary accessor must be a string");
  485. if (a.hasField(i2) === true)
  486. a.setField(i2, ge(o3, t2.operator, a.field(i2), t2));
  487. else {
  488. if (t2.operator !== "=")
  489. throw new Error("Invalid Parameter");
  490. a.setField(i2, ge(o3, t2.operator, null, t2));
  491. }
  492. } else {
  493. if (!Y(a))
  494. throw E(a) ? new Error("Array is Immutable") : new Error("Invalid Parameter");
  495. if (w(i2) === false)
  496. throw new Error("Feature accessor must be a string");
  497. if (a.hasField(i2) === true)
  498. a.setField(i2, ge(o3, t2.operator, a.field(i2), t2));
  499. else {
  500. if (t2.operator !== "=")
  501. throw new Error("Invalid Parameter");
  502. a.setField(i2, ge(o3, t2.operator, null, t2));
  503. }
  504. }
  505. return j2;
  506. }
  507. const o2 = n.name.toLowerCase();
  508. if (e2.localScope !== null && e2.localScope[o2] !== void 0) {
  509. const r2 = await re(e2, t2.right);
  510. return e2.localScope[o2] = { value: ge(r2, t2.operator, e2.localScope[o2].value, t2), valueset: true, node: t2.right }, j2;
  511. }
  512. if (e2.globalScope[o2] !== void 0) {
  513. const r2 = await re(e2, t2.right);
  514. return e2.globalScope[o2] = { value: ge(r2, t2.operator, e2.globalScope[o2].value, t2), valueset: true, node: t2.right }, j2;
  515. }
  516. throw new Error("Cannot assign undeclared variable");
  517. }
  518. async function ye(e2, t2) {
  519. if (t2.expression.type === "AssignmentExpression")
  520. return re(e2, t2.expression);
  521. if (t2.expression.type === "CallExpression") {
  522. const r3 = await re(e2, t2.expression);
  523. return r3 === j2 ? j2 : new k2(r3);
  524. }
  525. const r2 = await re(e2, t2.expression);
  526. return r2 === j2 ? j2 : new k2(r2);
  527. }
  528. async function Ne2(e2, t2) {
  529. if (t2.test.type === "AssignmentExpression" || t2.test.type === "UpdateExpression")
  530. throw new Error(b(t2.test, "RUNTIME", "CANNOT_USE_ASSIGNMENT_IN_CONDITION"));
  531. const r2 = await re(e2, t2.test);
  532. if (r2 === true)
  533. return re(e2, t2.consequent);
  534. if (r2 === false)
  535. return t2.alternate !== null ? re(e2, t2.alternate) : j2;
  536. throw new Error(b(t2.test, "RUNTIME", "CANNOT_USE_NONBOOLEAN_IN_CONDITION"));
  537. }
  538. async function ve(e2, t2) {
  539. return Ie(e2, t2, 0);
  540. }
  541. async function Ie(e2, t2, r2) {
  542. if (r2 >= t2.body.length)
  543. return j2;
  544. const n = await re(e2, t2.body[r2]);
  545. return n instanceof D || n === A || n === R || r2 === t2.body.length - 1 ? n : Ie(e2, t2, r2 + 1);
  546. }
  547. async function Te(e2, t2) {
  548. if (t2.argument === null)
  549. return new D(j2);
  550. const r2 = await re(e2, t2.argument);
  551. return new D(r2);
  552. }
  553. async function Se(e2, t2) {
  554. const r2 = t2.id.name.toLowerCase();
  555. return e2.globalScope[r2] = { valueset: true, node: null, value: new t(t2, e2) }, j2;
  556. }
  557. async function be(e2, t2, r2) {
  558. return r2 >= t2.declarations.length ? j2 : (await re(e2, t2.declarations[r2]), r2 === t2.declarations.length - 1 || await be(e2, t2, r2 + 1), j2);
  559. }
  560. async function Re(e2, t2) {
  561. let r2 = null;
  562. if (r2 = t2.init === null ? null : await re(e2, t2.init), e2.localScope !== null) {
  563. if (r2 === j2 && (r2 = null), t2.id.type !== "Identifier")
  564. throw new Error("Can only assign a regular variable");
  565. const n2 = t2.id.name.toLowerCase();
  566. return e2.localScope[n2] = { value: r2, valueset: true, node: t2.init }, j2;
  567. }
  568. if (t2.id.type !== "Identifier")
  569. throw new Error("Can only assign a regular variable");
  570. const n = t2.id.name.toLowerCase();
  571. return r2 === j2 && (r2 = null), e2.globalScope[n] = { value: r2, valueset: true, node: t2.init }, j2;
  572. }
  573. var Oe = 0;
  574. function Ae(e2, t2, n, o2) {
  575. let s2;
  576. switch (t2 = t2.toLowerCase()) {
  577. case "hasz": {
  578. const t3 = e2.hasZ;
  579. return t3 !== void 0 && t3;
  580. }
  581. case "hasm": {
  582. const t3 = e2.hasM;
  583. return t3 !== void 0 && t3;
  584. }
  585. case "spatialreference": {
  586. let t3 = e2.spatialReference._arcadeCacheId;
  587. if (t3 === void 0) {
  588. let r2 = true;
  589. Object.freeze && Object.isFrozen(e2.spatialReference) && (r2 = false), r2 && (Oe++, e2.spatialReference._arcadeCacheId = Oe, t3 = Oe);
  590. }
  591. const n2 = new d({ wkt: e2.spatialReference.wkt, wkid: e2.spatialReference.wkid });
  592. return t3 !== void 0 && (n2._arcadeCacheId = "SPREF" + t3.toString()), n2;
  593. }
  594. }
  595. switch (e2.type) {
  596. case "extent":
  597. switch (t2) {
  598. case "xmin":
  599. case "xmax":
  600. case "ymin":
  601. case "ymax":
  602. case "zmin":
  603. case "zmax":
  604. case "mmin":
  605. case "mmax": {
  606. const r2 = e2[t2];
  607. return r2 !== void 0 ? r2 : null;
  608. }
  609. case "type":
  610. return "Extent";
  611. }
  612. break;
  613. case "polygon":
  614. switch (t2) {
  615. case "rings":
  616. s2 = e2.cache._arcadeCacheId, s2 === void 0 && (Oe++, s2 = Oe, e2.cache._arcadeCacheId = s2);
  617. return new h(e2.rings, e2.spatialReference, e2.hasZ === true, e2.hasM === true, s2);
  618. case "type":
  619. return "Polygon";
  620. }
  621. break;
  622. case "point":
  623. switch (t2) {
  624. case "x":
  625. case "y":
  626. case "z":
  627. case "m":
  628. return e2[t2] !== void 0 ? e2[t2] : null;
  629. case "type":
  630. return "Point";
  631. }
  632. break;
  633. case "polyline":
  634. switch (t2) {
  635. case "paths":
  636. s2 = e2.cache._arcadeCacheId, s2 === void 0 && (Oe++, s2 = Oe, e2.cache._arcadeCacheId = s2);
  637. return new h(e2.paths, e2.spatialReference, e2.hasZ === true, e2.hasM === true, s2);
  638. case "type":
  639. return "Polyline";
  640. }
  641. break;
  642. case "multipoint":
  643. switch (t2) {
  644. case "points":
  645. s2 = e2.cache._arcadeCacheId, s2 === void 0 && (Oe++, s2 = Oe, e2.cache._arcadeCacheId = s2);
  646. return new i(e2.points, e2.spatialReference, e2.hasZ === true, e2.hasM === true, s2, 1);
  647. case "type":
  648. return "Multipoint";
  649. }
  650. }
  651. throw new Error(b(o2, "RUNTIME", "PROPERTYNOTFOUND"));
  652. }
  653. async function Ue(e2, t2) {
  654. const n = await re(e2, t2.object);
  655. if (n === null)
  656. throw new Error(b(t2, "RUNTIME", "NOTFOUND"));
  657. if (t2.computed === false) {
  658. if (t2.property.type === "Identifier") {
  659. if (n instanceof d || Y(n))
  660. return n.field(t2.property.name);
  661. if (n instanceof p)
  662. return Ae(n, t2.property.name, e2, t2);
  663. throw new Error(b(t2, "RUNTIME", "INVALIDTYPE"));
  664. }
  665. throw new Error(b(t2, "RUNTIME", "INVALIDTYPE"));
  666. }
  667. let o2 = await re(e2, t2.property);
  668. if (n instanceof d || Y(n)) {
  669. if (w(o2))
  670. return n.field(o2);
  671. throw new Error(b(t2, "RUNTIME", "INVALIDTYPE"));
  672. }
  673. if (n instanceof p) {
  674. if (w(o2))
  675. return Ae(n, o2, e2, t2);
  676. throw new Error(b(t2, "RUNTIME", "INVALIDTYPE"));
  677. }
  678. if (L(n)) {
  679. if (O(o2) && isFinite(o2) && Math.floor(o2) === o2) {
  680. if (o2 < 0 && (o2 = n.length + o2), o2 >= n.length || o2 < 0)
  681. throw new Error(b(t2, "RUNTIME", "OUTOFBOUNDS"));
  682. return n[o2];
  683. }
  684. throw new Error(b(t2, "RUNTIME", "INVALIDTYPE"));
  685. }
  686. if (E(n)) {
  687. if (O(o2) && isFinite(o2) && Math.floor(o2) === o2) {
  688. if (o2 < 0 && (o2 = n.length() + o2), o2 >= n.length() || o2 < 0)
  689. throw new Error(b(t2, "RUNTIME", "OUTOFBOUNDS"));
  690. return n.get(o2);
  691. }
  692. throw new Error(b(t2, "RUNTIME", "INVALIDTYPE"));
  693. }
  694. if (w(n)) {
  695. if (O(o2) && isFinite(o2) && Math.floor(o2) === o2) {
  696. if (o2 < 0 && (o2 = n.length + o2), o2 >= n.length || o2 < 0)
  697. throw new Error(b(t2, "RUNTIME", "OUTOFBOUNDS"));
  698. return n[o2];
  699. }
  700. throw new Error(b(t2, "RUNTIME", "INVALIDTYPE"));
  701. }
  702. throw new Error(b(t2, "RUNTIME", "INVALIDTYPE"));
  703. }
  704. async function Ce(e2, t2) {
  705. const r2 = await re(e2, t2.argument);
  706. if (_(r2)) {
  707. if (t2.operator === "!")
  708. return !r2;
  709. if (t2.operator === "-")
  710. return -1 * ne(r2);
  711. if (t2.operator === "+")
  712. return 1 * ne(r2);
  713. if (t2.operator === "~")
  714. return ~ne(r2);
  715. throw new Error(b(t2, "RUNTIME", "NOTSUPPORTEDUNARYOPERATOR"));
  716. }
  717. if (t2.operator === "-")
  718. return -1 * ne(r2);
  719. if (t2.operator === "+")
  720. return 1 * ne(r2);
  721. if (t2.operator === "~")
  722. return ~ne(r2);
  723. throw new Error(b(t2, "RUNTIME", "NOTSUPPORTEDUNARYOPERATOR"));
  724. }
  725. async function Fe(e2, t2) {
  726. const r2 = [];
  727. for (let n = 0; n < t2.elements.length; n++)
  728. r2.push(await re(e2, t2.elements[n]));
  729. for (let n = 0; n < r2.length; n++) {
  730. if (v2(r2[n]))
  731. throw new Error(b(t2, "RUNTIME", "FUNCTIONCONTEXTILLEGAL"));
  732. r2[n] === j2 && (r2[n] = null);
  733. }
  734. return r2;
  735. }
  736. async function xe(e2, t2) {
  737. const r2 = [];
  738. r2[0] = await re(e2, t2.left), r2[1] = await re(e2, t2.right);
  739. const n = r2[0], o2 = r2[1];
  740. switch (t2.operator) {
  741. case "|":
  742. case "<<":
  743. case ">>":
  744. case ">>>":
  745. case "^":
  746. case "&":
  747. return Ne(ne(n), ne(o2), t2.operator);
  748. case "==":
  749. return Q(n, o2);
  750. case "!=":
  751. return !Q(n, o2);
  752. case "<":
  753. case ">":
  754. case "<=":
  755. case ">=":
  756. return W(n, o2, t2.operator);
  757. case "+":
  758. return w(n) || w(o2) ? X(n) + X(o2) : ne(n) + ne(o2);
  759. case "-":
  760. return ne(n) - ne(o2);
  761. case "*":
  762. return ne(n) * ne(o2);
  763. case "/":
  764. return ne(n) / ne(o2);
  765. case "%":
  766. return ne(n) % ne(o2);
  767. default:
  768. throw new Error(b(t2, "RUNTIME", "OPERATORNOTRECOGNISED"));
  769. }
  770. }
  771. async function Me(e2, t2) {
  772. if (t2.left.type === "AssignmentExpression" || t2.left.type === "UpdateExpression")
  773. throw new Error(b(t2.left, "RUNTIME", "CANNOT_USE_ASSIGNMENT_IN_CONDITION"));
  774. if (t2.right.type === "AssignmentExpression" || t2.right.type === "UpdateExpression")
  775. throw new Error(b(t2.right, "RUNTIME", "CANNOT_USE_ASSIGNMENT_IN_CONDITION"));
  776. const r2 = await re(e2, t2.left);
  777. let n = null;
  778. if (!_(r2))
  779. throw new Error(b(t2, "RUNTIME", "ONLYBOOLEAN"));
  780. switch (t2.operator) {
  781. case "||":
  782. if (r2 === true)
  783. return r2;
  784. if (n = await re(e2, t2.right), _(n))
  785. return n;
  786. throw new Error(b(t2, "RUNTIME", "ONLYORORAND"));
  787. case "&&":
  788. if (r2 === false)
  789. return r2;
  790. if (n = await re(e2, t2.right), _(n))
  791. return n;
  792. throw new Error(b(t2, "RUNTIME", "ONLYORORAND"));
  793. default:
  794. throw new Error(b(t2, "RUNTIME", "ONLYORORAND"));
  795. }
  796. }
  797. async function Pe(e2, t2) {
  798. const r2 = t2.name.toLowerCase();
  799. if (e2.localScope !== null && e2.localScope[r2] !== void 0) {
  800. const t3 = e2.localScope[r2];
  801. if (t3.valueset === true)
  802. return t3.value;
  803. if (t3.d !== null)
  804. return t3.d;
  805. t3.d = re(e2, t3.node);
  806. const n = await t3.d;
  807. return t3.value = n, t3.valueset = true, n;
  808. }
  809. if (e2.globalScope[r2] !== void 0) {
  810. const t3 = e2.globalScope[r2];
  811. if (t3.valueset === true)
  812. return t3.value;
  813. if (t3.d !== null)
  814. return t3.d;
  815. t3.d = re(e2, t3.node);
  816. const n = await t3.d;
  817. return t3.value = n, t3.valueset = true, n;
  818. }
  819. throw new Error(b(t2, "RUNTIME", "VARIABLENOTFOUND"));
  820. }
  821. async function De(e2, t2) {
  822. if (t2.callee.type !== "Identifier")
  823. throw new Error(b(t2, "RUNTIME", "ONLYNODESSUPPORTED"));
  824. if (e2.localScope !== null && e2.localScope[t2.callee.name.toLowerCase()] !== void 0) {
  825. const r2 = e2.localScope[t2.callee.name.toLowerCase()];
  826. if (r2.value instanceof N)
  827. return r2.value.fn(e2, t2);
  828. if (r2.value instanceof t)
  829. return Ze(e2, t2, r2.value.definition);
  830. throw new Error(b(t2, "RUNTIME", "NOTAFUNCTION"));
  831. }
  832. if (e2.globalScope[t2.callee.name.toLowerCase()] !== void 0) {
  833. const r2 = e2.globalScope[t2.callee.name.toLowerCase()];
  834. if (r2.value instanceof N)
  835. return r2.value.fn(e2, t2);
  836. if (r2.value instanceof t)
  837. return Ze(e2, t2, r2.value.definition);
  838. throw new Error(b(t2, "RUNTIME", "NOTAFUNCTION"));
  839. }
  840. throw new Error(b(t2, "RUNTIME", "NOTFOUND"));
  841. }
  842. async function je(e2, t2) {
  843. return t2.value ? t2.value.cooked : "";
  844. }
  845. async function Le(e2, t2) {
  846. const r2 = [];
  847. for (let a = 0; a < t2.expressions.length; a++) {
  848. const n2 = await re(e2, t2.expressions[a]);
  849. r2[a] = X(n2);
  850. }
  851. let n = "", o2 = 0;
  852. for (const a of t2.quasis)
  853. if (n += a.value ? a.value.cooked : "", a.tail === false) {
  854. n += r2[o2] ? r2[o2] : "", o2++;
  855. }
  856. return n;
  857. }
  858. var ke = {};
  859. function _e(n) {
  860. return n === null ? "" : L(n) || E(n) ? "Array" : z(n) ? "Date" : w(n) ? "String" : _(n) ? "Boolean" : O(n) ? "Number" : n instanceof e ? "Attachment" : n instanceof s ? "Portal" : n instanceof d ? "Dictionary" : Y(n) ? "Feature" : n instanceof j ? "Point" : n instanceof v ? "Polygon" : n instanceof m2 ? "Polyline" : n instanceof m ? "Multipoint" : n instanceof M ? "Extent" : v2(n) ? "Function" : J(n) ? "FeatureSet" : P(n) ? "FeatureSetCollection" : n === j2 ? "" : typeof n == "number" && isNaN(n) ? "Number" : "Unrecognised Type";
  861. }
  862. async function Ve(e2, t2, r2, n) {
  863. const o2 = await re(e2, t2.arguments[r2]);
  864. if (Q(o2, n))
  865. return re(e2, t2.arguments[r2 + 1]);
  866. const a = t2.arguments.length - r2;
  867. return a === 1 ? re(e2, t2.arguments[r2]) : a === 2 ? null : a === 3 ? re(e2, t2.arguments[r2 + 2]) : Ve(e2, t2, r2 + 2, n);
  868. }
  869. async function Ye(e2, t2, r2, n) {
  870. if (n === true)
  871. return re(e2, t2.arguments[r2 + 1]);
  872. if (t2.arguments.length - r2 === 3)
  873. return re(e2, t2.arguments[r2 + 2]);
  874. const o2 = await re(e2, t2.arguments[r2 + 2]);
  875. if (_(o2) === false)
  876. throw new Error("WHEN needs boolean test conditions");
  877. return Ye(e2, t2, r2 + 2, o2);
  878. }
  879. async function Be(e2, t2) {
  880. const r2 = e2.length, n = Math.floor(r2 / 2);
  881. if (r2 === 0)
  882. return [];
  883. if (r2 === 1)
  884. return [e2[0]];
  885. const o2 = [Be(e2.slice(0, n), t2), Be(e2.slice(n, r2), t2)], a = await Promise.all(o2);
  886. return Ge(a[0], a[1], t2, []);
  887. }
  888. async function Ge(e2, t2, r2, n) {
  889. const o2 = n;
  890. if (!(e2.length > 0 || t2.length > 0))
  891. return n;
  892. if (e2.length > 0 && t2.length > 0) {
  893. let a = await r2(e2[0], t2[0]);
  894. return isNaN(a) && (a = 1), a <= 0 ? (o2.push(e2[0]), e2 = e2.slice(1)) : (o2.push(t2[0]), t2 = t2.slice(1)), Ge(e2, t2, r2, n);
  895. }
  896. return e2.length > 0 ? (o2.push(e2[0]), Ge(e2 = e2.slice(1), t2, r2, n)) : t2.length > 0 ? (o2.push(t2[0]), Ge(e2, t2 = t2.slice(1), r2, n)) : void 0;
  897. }
  898. function ze(e2, t2) {
  899. const r2 = e2.length, n = Math.floor(r2 / 2);
  900. return t2 || (t2 = function(e3, t3) {
  901. return e3 < t3 ? -1 : e3 === t3 ? 0 : 1;
  902. }), r2 === 0 ? [] : r2 === 1 ? [e2[0]] : qe(ze(e2.slice(0, n), t2), ze(e2.slice(n, r2), t2), t2);
  903. }
  904. function qe(e2, t2, r2) {
  905. const n = [];
  906. for (; e2.length > 0 || t2.length > 0; )
  907. if (e2.length > 0 && t2.length > 0) {
  908. let o2 = r2(e2[0], t2[0]);
  909. isNaN(o2) && (o2 = 1), o2 <= 0 ? (n.push(e2[0]), e2 = e2.slice(1)) : (n.push(t2[0]), t2 = t2.slice(1));
  910. } else
  911. e2.length > 0 ? (n.push(e2[0]), e2 = e2.slice(1)) : t2.length > 0 && (n.push(t2[0]), t2 = t2.slice(1));
  912. return n;
  913. }
  914. async function He(e2, t2, r2) {
  915. const n = e2.body;
  916. if (r2.length !== e2.params.length)
  917. throw new Error("Invalid Parameter calls to function.");
  918. for (let a = 0; a < r2.length; a++) {
  919. const n2 = e2.params[a];
  920. n2.type === "Identifier" && (t2.localScope[n2.name.toLowerCase()] = { d: null, value: r2[a], valueset: true, node: null });
  921. }
  922. const o2 = await re(t2, n);
  923. if (o2 instanceof D)
  924. return o2.value;
  925. if (o2 === A)
  926. throw new Error("Cannot Break from a Function");
  927. if (o2 === R)
  928. throw new Error("Cannot Continue from a Function");
  929. return o2 instanceof k2 ? o2.value : o2;
  930. }
  931. function Ze(e2, t2, r2) {
  932. return te(e2, t2, function(t3, n, o2) {
  933. const a = { spatialReference: e2.spatialReference, services: e2.services, console: e2.console, lrucache: e2.lrucache, interceptor: e2.interceptor, localScope: {}, abortSignal: e2.abortSignal, globalScope: e2.globalScope, depthCounter: e2.depthCounter + 1 };
  934. if (a.depthCounter > 64)
  935. throw new Error("Exceeded maximum function depth");
  936. return He(r2, a, o2);
  937. });
  938. }
  939. function We(e2) {
  940. const t2 = function() {
  941. const t3 = { abortSignal: e2.context.abortSignal, spatialReference: e2.context.spatialReference, console: e2.context.console, lrucache: e2.context.lrucache, interceptor: e2.context.interceptor, services: e2.context.services, localScope: {}, globalScope: e2.context.globalScope, depthCounter: e2.context.depthCounter + 1 };
  942. if (t3.depthCounter > 64)
  943. throw new Error("Exceeded maximum function depth");
  944. return He(e2.definition, t3, arguments);
  945. };
  946. return t2;
  947. }
  948. y(ke, ee), O2(ke, ee), N2(ke, ee), P2(ke, ee), o(ke, ee), sn({ functions: ke, compiled: false, signatures: null, evaluateIdentifier: null, arcadeCustomFunctionHandler: null, mode: "async", standardFunction: ee, standardFunctionAsync: te }), ke.typeof = function(e2, t2) {
  949. return ee(e2, t2, function(e3, t3, r2) {
  950. G(r2, 1, 1);
  951. const n = _e(r2[0]);
  952. if (n === "Unrecognised Type")
  953. throw new Error("Unrecognised Type");
  954. return n;
  955. });
  956. }, ke.iif = async function(e2, t2) {
  957. G(t2.arguments === null ? [] : t2.arguments, 3, 3);
  958. const r2 = await re(e2, t2.arguments[0]);
  959. if (_(r2) === false)
  960. throw new Error("IF Function must have a boolean test condition");
  961. const n = [];
  962. return n[0] = await re(e2, t2.arguments[1]), n[1] = await re(e2, t2.arguments[2]), r2 ? n[0] : n[1];
  963. }, ke.decode = async function(e2, t2) {
  964. if (t2.arguments.length < 2)
  965. throw new Error("Missing Parameters");
  966. if (t2.arguments.length === 2)
  967. return re(e2, t2.arguments[1]);
  968. if ((t2.arguments.length - 1) % 2 == 0)
  969. throw new Error("Must have a default value result.");
  970. return Ve(e2, t2, 1, await re(e2, t2.arguments[0]));
  971. }, ke.when = async function(e2, t2) {
  972. if (t2.arguments.length < 3)
  973. throw new Error("Missing Parameters");
  974. if (t2.arguments.length % 2 == 0)
  975. throw new Error("Must have a default value result.");
  976. const r2 = await re(e2, t2.arguments[0]);
  977. if (_(r2) === false)
  978. throw new Error("WHEN needs boolean test conditions");
  979. return Ye(e2, t2, 0, r2);
  980. }, ke.sort = function(e2, t2) {
  981. return te(e2, t2, async function(e3, t3, r2) {
  982. G(r2, 1, 2);
  983. let n = r2[0];
  984. if (E(n) && (n = n.toArray()), L(n) === false)
  985. throw new Error("Illegal Argument");
  986. if (r2.length > 1) {
  987. if (v2(r2[1]) === false)
  988. throw new Error("Illegal Argument");
  989. return Be(n, We(r2[1]));
  990. }
  991. let o2 = n;
  992. if (o2.length === 0)
  993. return [];
  994. const a = {};
  995. for (let s2 = 0; s2 < o2.length; s2++) {
  996. const e4 = _e(o2[s2]);
  997. e4 !== "" && (a[e4] = true);
  998. }
  999. if (a.Array === true || a.Dictionary === true || a.Feature === true || a.Point === true || a.Polygon === true || a.Polyline === true || a.Multipoint === true || a.Extent === true || a.Function === true)
  1000. return o2.slice(0);
  1001. let i2 = 0, c = "";
  1002. for (const s2 in a)
  1003. i2++, c = s2;
  1004. return i2 > 1 || c === "String" ? o2 = ze(o2, function(e4, t4) {
  1005. if (e4 == null || e4 === j2)
  1006. return t4 == null || t4 === j2 ? 0 : 1;
  1007. if (t4 == null || t4 === j2)
  1008. return -1;
  1009. const r3 = X(e4), n2 = X(t4);
  1010. return r3 < n2 ? -1 : r3 === n2 ? 0 : 1;
  1011. }) : c === "Number" ? o2 = ze(o2, function(e4, t4) {
  1012. return e4 - t4;
  1013. }) : c === "Boolean" ? o2 = ze(o2, function(e4, t4) {
  1014. return e4 === t4 ? 0 : t4 ? -1 : 1;
  1015. }) : c === "Date" && (o2 = ze(o2, function(e4, t4) {
  1016. return t4 - e4;
  1017. })), o2;
  1018. });
  1019. };
  1020. var Ke = { fixSpatialReference: se, parseArguments: $, standardFunction: ee, standardFunctionAsync: te, evaluateIdentifier: Pe, arcadeCustomFunction: We };
  1021. for (const st in ke)
  1022. ke[st] = { value: new N(ke[st]), valueset: true, node: null };
  1023. var Xe = function() {
  1024. };
  1025. function Je(e2, t2) {
  1026. const o2 = new Xe();
  1027. e2 == null && (e2 = {}), t2 == null && (t2 = {});
  1028. const a = new d({ newline: "\n", tab: " ", singlequote: "'", doublequote: '"', forwardslash: "/", backwardslash: "\\" });
  1029. a.immutable = false, o2.textformatting = { value: a, valueset: true, node: null };
  1030. for (const r2 in t2)
  1031. o2[r2] = { value: new N(t2[r2]), native: true, valueset: true, node: null };
  1032. for (const r2 in e2)
  1033. e2[r2] && e2[r2].declaredClass === "esri.Graphic" ? o2[r2] = { value: d2.createFromGraphic(e2[r2]), valueset: true, node: null } : o2[r2] = { value: e2[r2], valueset: true, node: null };
  1034. return o2;
  1035. }
  1036. function Qe(e2) {
  1037. console.log(e2);
  1038. }
  1039. Xe.prototype = ke, Xe.prototype.infinity = { value: Number.POSITIVE_INFINITY, valueset: true, node: null }, Xe.prototype.pi = { value: Math.PI, valueset: true, node: null };
  1040. var $e = Ke;
  1041. function et(e2) {
  1042. const t2 = { mode: "async", compiled: false, functions: {}, signatures: [], standardFunction: ee, standardFunctionAsync: te, evaluateIdentifier: Pe, arcadeCustomFunctionHandler: We };
  1043. for (let r2 = 0; r2 < e2.length; r2++)
  1044. e2[r2].registerFunctions(t2);
  1045. for (const r2 in t2.functions)
  1046. ke[r2] = { value: new N(t2.functions[r2]), valueset: true, node: null }, Xe.prototype[r2] = ke[r2];
  1047. for (let r2 = 0; r2 < t2.signatures.length; r2++)
  1048. r(t2.signatures[r2], "async");
  1049. }
  1050. async function tt(e2, t2) {
  1051. let r2 = t2.spatialReference;
  1052. r2 == null && (r2 = new k({ wkid: 102100 }));
  1053. const n = Je(t2.vars, t2.customfunctions), a = { spatialReference: r2, services: t2.services, abortSignal: t2.abortSignal === void 0 || t2.abortSignal === null ? { aborted: false } : t2.abortSignal, globalScope: n, console: t2.console ? t2.console : Qe, lrucache: t2.lrucache, interceptor: t2.interceptor, localScope: null, depthCounter: 1 };
  1054. let i2 = await re(a, e2.body[0].body);
  1055. if (i2 instanceof D && (i2 = i2.value), i2 instanceof k2 && (i2 = i2.value), i2 === j2 && (i2 = null), i2 === A)
  1056. throw new Error("Cannot return BREAK");
  1057. if (i2 === R)
  1058. throw new Error("Cannot return CONTINUE");
  1059. if (i2 instanceof N)
  1060. throw new Error("Cannot return FUNCTION");
  1061. if (i2 instanceof t)
  1062. throw new Error("Cannot return FUNCTION");
  1063. return i2;
  1064. }
  1065. function rt(e2, t2) {
  1066. return f(e2);
  1067. }
  1068. function nt(e2, t2) {
  1069. return S(e2, t2, "full");
  1070. }
  1071. function ot(e2, t2) {
  1072. return p2(e2, t2);
  1073. }
  1074. function at(e2, t2) {
  1075. return u(e2, t2);
  1076. }
  1077. function it(e2) {
  1078. return I(e2);
  1079. }
  1080. et([m3]);
  1081. export {
  1082. tt as executeScript,
  1083. et as extend,
  1084. rt as extractFieldLiterals,
  1085. it as findFunctionCalls,
  1086. $e as functionHelper,
  1087. at as referencesFunction,
  1088. ot as referencesMember,
  1089. nt as validateScript
  1090. };
  1091. //# sourceMappingURL=arcadeAsyncRuntime-QOSTXEAK.js.map