featuresetbase-U2SCLWM5.js 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780
  1. import {
  2. g,
  3. t as t3
  4. } from "./chunk-WGHU7NSM.js";
  5. import {
  6. A,
  7. C as C2,
  8. D,
  9. E as E2,
  10. F as F2,
  11. F2 as F3,
  12. G,
  13. N,
  14. W,
  15. a,
  16. a2,
  17. c,
  18. d,
  19. e as e2,
  20. e2 as e3,
  21. k,
  22. q,
  23. v as v2,
  24. x
  25. } from "./chunk-UI53XRRK.js";
  26. import "./chunk-KD6NQDSX.js";
  27. import {
  28. u,
  29. w as w2
  30. } from "./chunk-MDR3KRG4.js";
  31. import "./chunk-DVIKBNBZ.js";
  32. import {
  33. l
  34. } from "./chunk-AXIWHIDY.js";
  35. import {
  36. J as J2
  37. } from "./chunk-PLCWBBQ4.js";
  38. import "./chunk-UEYSTU4P.js";
  39. import {
  40. f
  41. } from "./chunk-4GGDRIJK.js";
  42. import "./chunk-BJT4XIGU.js";
  43. import {
  44. E,
  45. F2 as F,
  46. J,
  47. K,
  48. P2 as P,
  49. R,
  50. V,
  51. Y,
  52. e,
  53. le,
  54. n2 as n,
  55. re,
  56. t,
  57. t2,
  58. v2 as v,
  59. w,
  60. xe
  61. } from "./chunk-FT2BCPUP.js";
  62. import "./chunk-5JZ72JAQ.js";
  63. import "./chunk-BY5BVC57.js";
  64. import {
  65. Ze
  66. } from "./chunk-WM52QDLS.js";
  67. import "./chunk-MEZ7BUMM.js";
  68. import "./chunk-7B57NUGF.js";
  69. import "./chunk-AOQ55JXI.js";
  70. import "./chunk-X42TFXOU.js";
  71. import "./chunk-JFSMKLAQ.js";
  72. import "./chunk-LXOC7SMQ.js";
  73. import "./chunk-DN6W4TJU.js";
  74. import "./chunk-OUUXJOLT.js";
  75. import "./chunk-PLQUCCQV.js";
  76. import "./chunk-JZAS4TIG.js";
  77. import "./chunk-VBR5BOXI.js";
  78. import "./chunk-NBKUI76A.js";
  79. import "./chunk-6334AFGG.js";
  80. import "./chunk-NLLFSKB2.js";
  81. import "./chunk-LC3GBQ56.js";
  82. import "./chunk-5GYJGY4C.js";
  83. import "./chunk-ISHZAVNR.js";
  84. import "./chunk-OXF7W4BJ.js";
  85. import "./chunk-XJHQZ4NT.js";
  86. import "./chunk-CFVLY6NB.js";
  87. import "./chunk-JKFWEHNK.js";
  88. import "./chunk-WOXHUQGM.js";
  89. import "./chunk-FMPQIGFA.js";
  90. import "./chunk-EDHROVWI.js";
  91. import "./chunk-3IRT3YKJ.js";
  92. import "./chunk-SAJAEMIJ.js";
  93. import "./chunk-S6EFEKAU.js";
  94. import "./chunk-2RHPWGZL.js";
  95. import "./chunk-XEQ4FTFC.js";
  96. import "./chunk-JM5OVQAD.js";
  97. import "./chunk-S3GK7VUF.js";
  98. import "./chunk-TU7WVKU4.js";
  99. import "./chunk-WWXZOC2Y.js";
  100. import "./chunk-ZOKNWEG3.js";
  101. import "./chunk-NQA5XJGK.js";
  102. import "./chunk-EKYSPJO6.js";
  103. import "./chunk-JAUFBT5U.js";
  104. import "./chunk-W6U6FKJ3.js";
  105. import "./chunk-7C2KDOAI.js";
  106. import "./chunk-RHFU6KWO.js";
  107. import "./chunk-3FNKD2EB.js";
  108. import "./chunk-ZOO4I2U4.js";
  109. import "./chunk-JPUFJK2B.js";
  110. import "./chunk-HZ2WKB3G.js";
  111. import "./chunk-3HCJD762.js";
  112. import "./chunk-RVCE264D.js";
  113. import "./chunk-HKJ7X3BD.js";
  114. import "./chunk-Y74D3LKQ.js";
  115. import "./chunk-PK4W65H4.js";
  116. import "./chunk-7C23ILQ4.js";
  117. import "./chunk-P6VVVEX6.js";
  118. import "./chunk-3Z755LKF.js";
  119. import "./chunk-LTZ5XXDV.js";
  120. import "./chunk-IEU3AM37.js";
  121. import "./chunk-SKKBVHTF.js";
  122. import "./chunk-DLMAGHHC.js";
  123. import "./chunk-WD4J43GZ.js";
  124. import "./chunk-JOYXMSKE.js";
  125. import "./chunk-SZFMKPVM.js";
  126. import "./chunk-YZVAB3DF.js";
  127. import "./chunk-JLYTER4T.js";
  128. import "./chunk-CRHRHOXH.js";
  129. import "./chunk-ZSW35JPD.js";
  130. import "./chunk-JLSNMUQJ.js";
  131. import "./chunk-ECY35CJI.js";
  132. import "./chunk-PT62335L.js";
  133. import {
  134. y
  135. } from "./chunk-JGBXYDGB.js";
  136. import "./chunk-QEWF7QPH.js";
  137. import "./chunk-PJNBFKPF.js";
  138. import "./chunk-C7742RNZ.js";
  139. import "./chunk-FNA5GLRW.js";
  140. import "./chunk-MCWCB5IY.js";
  141. import "./chunk-TV3CFJQR.js";
  142. import "./chunk-TJV6ODRM.js";
  143. import "./chunk-JUWKPBLS.js";
  144. import "./chunk-WLSB4F4I.js";
  145. import "./chunk-GLSWDDR3.js";
  146. import "./chunk-MIQGEDET.js";
  147. import "./chunk-DUEMJ5XS.js";
  148. import "./chunk-VRLXUHP2.js";
  149. import "./chunk-3LVSQLWJ.js";
  150. import "./chunk-4ONPMX2F.js";
  151. import "./chunk-CRGY2SDS.js";
  152. import "./chunk-4T5ZGMEN.js";
  153. import "./chunk-GN35O2ZO.js";
  154. import "./chunk-XTVKPAWY.js";
  155. import "./chunk-3OSQ6GXO.js";
  156. import "./chunk-3WQOA5CB.js";
  157. import "./chunk-PLWDAYK7.js";
  158. import "./chunk-FZQZIM7U.js";
  159. import "./chunk-CZBRZ6SU.js";
  160. import "./chunk-VGWC3IKZ.js";
  161. import "./chunk-2H5MD622.js";
  162. import "./chunk-3RSFVUKZ.js";
  163. import "./chunk-UVVU4UUO.js";
  164. import "./chunk-HWSWTWZD.js";
  165. import "./chunk-O6VYMEIX.js";
  166. import "./chunk-X4SA4ELJ.js";
  167. import "./chunk-5N7JLUJJ.js";
  168. import "./chunk-ZAY3CMAZ.js";
  169. import "./chunk-P3XKUGLS.js";
  170. import "./chunk-2ZSOO377.js";
  171. import "./chunk-YUA3AHKR.js";
  172. import "./chunk-LU5IJZB4.js";
  173. import "./chunk-7IBV2TRE.js";
  174. import "./chunk-ZLNEXZAN.js";
  175. import "./chunk-5UVJ64RB.js";
  176. import "./chunk-SFEFRQCL.js";
  177. import "./chunk-DXVOOCG4.js";
  178. import "./chunk-3GZSQU56.js";
  179. import "./chunk-ZYRIJWLX.js";
  180. import "./chunk-RYY6632W.js";
  181. import "./chunk-DW42UVIT.js";
  182. import "./chunk-YAEIHDJH.js";
  183. import "./chunk-TJNOJH33.js";
  184. import "./chunk-OSHI574D.js";
  185. import "./chunk-ETGAZ7LF.js";
  186. import "./chunk-75U5LM2V.js";
  187. import "./chunk-RMDDCMKS.js";
  188. import "./chunk-VCH45Q2I.js";
  189. import "./chunk-LBW34VZ2.js";
  190. import "./chunk-GSSTTHIT.js";
  191. import "./chunk-YFSLJIO4.js";
  192. import "./chunk-IM3LVQXV.js";
  193. import "./chunk-55RWC67C.js";
  194. import "./chunk-HZRKBTHJ.js";
  195. import "./chunk-DVUG3KID.js";
  196. import "./chunk-FWSQEIAR.js";
  197. import "./chunk-VEGAOVMY.js";
  198. import "./chunk-6T6G6LCQ.js";
  199. import "./chunk-YEJL5NEF.js";
  200. import "./chunk-PQFTYGF5.js";
  201. import "./chunk-2Z2TG5CU.js";
  202. import "./chunk-6KZ2LTDA.js";
  203. import "./chunk-U2XHEJM7.js";
  204. import "./chunk-SQOPWYIT.js";
  205. import {
  206. C
  207. } from "./chunk-V6P2MAQQ.js";
  208. import "./chunk-E5O6P5I2.js";
  209. import "./chunk-SPWQ3AWG.js";
  210. import "./chunk-2TIUKVZN.js";
  211. import "./chunk-YXWMMD76.js";
  212. import "./chunk-S5KM4IGW.js";
  213. // node_modules/@arcgis/core/arcade/functions/featuresetbase.js
  214. function J3(e4, t4, n2, i) {
  215. if (1 === i.length) {
  216. if (Y(i[0]))
  217. return l(e4, i[0], -1);
  218. if (E(i[0]))
  219. return l(e4, i[0].toArray(), -1);
  220. }
  221. return l(e4, i, -1);
  222. }
  223. async function V2(e4, t4, n2) {
  224. const i = e4.getVariables();
  225. if (i.length > 0) {
  226. const a3 = [];
  227. for (let e5 = 0; e5 < i.length; e5++) {
  228. const r2 = { name: i[e5] };
  229. a3.push(await t4.evaluateIdentifier(n2, r2));
  230. }
  231. const r = {};
  232. for (let e5 = 0; e5 < i.length; e5++)
  233. r[i[e5]] = a3[e5];
  234. return e4.parameters = r, e4;
  235. }
  236. return e4;
  237. }
  238. function q2(e4, t4, n2 = null) {
  239. for (const i in e4)
  240. if (i.toLowerCase() === t4.toLowerCase())
  241. return e4[i];
  242. return n2;
  243. }
  244. function K2(e4) {
  245. if (null === e4)
  246. return null;
  247. const t4 = { type: q2(e4, "type", ""), name: q2(e4, "name", "") };
  248. if ("range" === t4.type)
  249. t4.range = q2(e4, "range", []);
  250. else {
  251. t4.codedValues = [];
  252. for (const n2 of q2(e4, "codedValues", []))
  253. t4.codedValues.push({ name: q2(n2, "name", ""), code: q2(n2, "code", null) });
  254. }
  255. return t4;
  256. }
  257. function X(e4) {
  258. if (null === e4)
  259. return null;
  260. const t4 = {}, n2 = q2(e4, "wkt", null);
  261. null !== n2 && (t4.wkt = n2);
  262. const i = q2(e4, "wkid", null);
  263. return null !== i && (t4.wkid = i), t4;
  264. }
  265. function Y2(e4) {
  266. if (null === e4)
  267. return null;
  268. const t4 = { hasZ: q2(e4, "hasz", false), hasM: q2(e4, "hasm", false) }, n2 = q2(e4, "spatialreference", null);
  269. n2 && (t4.spatialReference = X(n2));
  270. const i = q2(e4, "x", null);
  271. if (null !== i)
  272. return t4.x = i, t4.y = q2(e4, "y", null), t4;
  273. const a3 = q2(e4, "rings", null);
  274. if (null !== a3)
  275. return t4.rings = a3, t4;
  276. const r = q2(e4, "paths", null);
  277. if (null !== r)
  278. return t4.paths = r, t4;
  279. const s = q2(e4, "points", null);
  280. if (null !== s)
  281. return t4.points = s, t4;
  282. for (const o of ["xmin", "xmax", "ymin", "ymax", "zmin", "zmax", "mmin", "mmax"]) {
  283. const n3 = q2(e4, o, null);
  284. null !== n3 && (t4[o] = n3);
  285. }
  286. return t4;
  287. }
  288. function Z(e4, t4) {
  289. for (const n2 of t4)
  290. if (n2 === e4)
  291. return true;
  292. return false;
  293. }
  294. function Q(e4) {
  295. return !!e4.layerDefinition && (!!e4.featureSet && (false !== Z(e4.layerDefinition.geometryType, ["", "esriGeometryPoint", "esriGeometryPolyline", "esriGeometryPolygon", "esriGeometryMultipoint", "esriGeometryEnvelope"]) && (null !== e4.layerDefinition.objectIdField && "" !== e4.layerDefinition.objectIdField && (false !== Y(e4.layerDefinition.fields) && false !== Y(e4.featureSet.features)))));
  296. }
  297. function ee(G2) {
  298. "async" === G2.mode && (G2.functions.getuser = function(a3, r) {
  299. return G2.standardFunctionAsync(a3, r, async (l2, f2, c2) => {
  300. V(c2, 0, 2, a3, r);
  301. let u2 = v(c2[1], ""), d2 = true === u2;
  302. if (u2 = true === u2 || false === u2 ? "" : K(u2), 0 === c2.length || c2[0] instanceof t3) {
  303. let e4 = null;
  304. a3.services && a3.services.portal && (e4 = a3.services.portal), c2.length > 0 && (e4 = D(c2[0], e4));
  305. const n2 = await q(e4, u2, d2);
  306. if (n2) {
  307. const e5 = JSON.parse(JSON.stringify(n2));
  308. for (const t4 of ["lastLogin", "created", "modified"])
  309. void 0 !== e5[t4] && null !== e5[t4] && (e5[t4] = new Date(e5[t4]));
  310. return J2.convertObjectToArcadeDictionary(e5);
  311. }
  312. return null;
  313. }
  314. let m = null;
  315. if (P(c2[0]) && (m = c2[0]), m) {
  316. if (d2 = false, u2)
  317. return null;
  318. await m.load();
  319. const n2 = await m.getOwningSystemUrl();
  320. if (!n2) {
  321. if (!u2) {
  322. const e4 = await m.getIdentityUser();
  323. return e4 ? J2.convertObjectToArcadeDictionary({ username: e4 }) : null;
  324. }
  325. return null;
  326. }
  327. let i = null;
  328. a3.services && a3.services.portal && (i = a3.services.portal), i = D(new t3(n2), i);
  329. const r2 = await q(i, u2, d2);
  330. if (r2) {
  331. const e4 = JSON.parse(JSON.stringify(r2));
  332. for (const t4 of ["lastLogin", "created", "modified"])
  333. void 0 !== e4[t4] && null !== e4[t4] && (e4[t4] = new Date(e4[t4]));
  334. return J2.convertObjectToArcadeDictionary(e4);
  335. }
  336. return null;
  337. }
  338. throw new t(a3, e.InvalidParameter, r);
  339. });
  340. }, G2.signatures.push({ name: "getuser", min: 1, max: 2 }), G2.functions.featuresetbyid = function(e4, t4) {
  341. return G2.standardFunctionAsync(e4, t4, (a3, s, o) => {
  342. if (V(o, 2, 4, e4, t4), o[0] instanceof e2) {
  343. const a4 = K(o[1]);
  344. let r = v(o[2], null);
  345. const s2 = le(v(o[3], true));
  346. if (null === r && (r = ["*"]), false === Y(r))
  347. throw new t(e4, e.InvalidParameter, t4);
  348. return o[0].featureSetById(a4, s2, r);
  349. }
  350. throw new t(e4, e.InvalidParameter, t4);
  351. });
  352. }, G2.signatures.push({ name: "featuresetbyid", min: 2, max: 4 }), G2.functions.getfeatureset = function(e4, t4) {
  353. return G2.standardFunctionAsync(e4, t4, (a3, r, s) => {
  354. if (V(s, 1, 2, e4, t4), J(s[0])) {
  355. let t5 = v(s[1], "datasource");
  356. return null === t5 && (t5 = "datasource"), t5 = K(t5).toLowerCase(), v2(s[0].fullSchema(), t5, e4.lrucache, e4.interceptor, e4.spatialReference);
  357. }
  358. throw new t(e4, e.InvalidParameter, t4);
  359. });
  360. }, G2.signatures.push({ name: "getfeatureset", min: 1, max: 2 }), G2.functions.featuresetbyportalitem = function(t4, a3) {
  361. return G2.standardFunctionAsync(t4, a3, (r, o, l2) => {
  362. if (V(l2, 2, 5, t4, a3), null === l2[0])
  363. throw new t(t4, e.PortalRequired, a3);
  364. if (l2[0] instanceof t3) {
  365. const e4 = K(l2[1]), r2 = K(l2[2]);
  366. let o2 = v(l2[3], null);
  367. const c3 = le(v(l2[4], true));
  368. if (null === o2 && (o2 = ["*"]), false === Y(o2))
  369. throw new t(t4, e.InvalidParameter, a3);
  370. let u3 = null;
  371. return t4.services && t4.services.portal && (u3 = t4.services.portal), u3 = D(l2[0], u3), G(e4, r2, t4.spatialReference, o2, c3, u3, t4.lrucache, t4.interceptor);
  372. }
  373. if (false === w(l2[0]))
  374. throw new t(t4, e.PortalRequired, a3);
  375. const c2 = K(l2[0]), u2 = K(l2[1]);
  376. let d2 = v(l2[2], null);
  377. const m = le(v(l2[3], true));
  378. if (null === d2 && (d2 = ["*"]), false === Y(d2))
  379. throw new t(t4, e.InvalidParameter, a3);
  380. if (t4.services && t4.services.portal)
  381. return G(c2, u2, t4.spatialReference, d2, m, t4.services.portal, t4.lrucache, t4.interceptor);
  382. throw new t(t4, e.PortalRequired, a3);
  383. });
  384. }, G2.signatures.push({ name: "featuresetbyportalitem", min: 2, max: 5 }), G2.functions.featuresetbyname = function(e4, t4) {
  385. return G2.standardFunctionAsync(e4, t4, (a3, s, o) => {
  386. if (V(o, 2, 4, e4, t4), o[0] instanceof e2) {
  387. const a4 = K(o[1]);
  388. let r = v(o[2], null);
  389. const s2 = le(v(o[3], true));
  390. if (null === r && (r = ["*"]), false === Y(r))
  391. throw new t(e4, e.InvalidParameter, t4);
  392. return o[0].featureSetByName(a4, s2, r);
  393. }
  394. throw new t(e4, e.InvalidParameter, t4);
  395. });
  396. }, G2.signatures.push({ name: "featuresetbyname", min: 2, max: 4 }), G2.functions.featureset = function(e4, a3) {
  397. return G2.standardFunction(e4, a3, (r, s, o) => {
  398. V(o, 1, 1, e4, a3);
  399. let l2 = o[0];
  400. const f2 = { layerDefinition: { geometryType: "", objectIdField: "", globalIdField: "", typeIdField: "", fields: [] }, featureSet: { geometryType: "", features: [] } };
  401. if (w(l2))
  402. l2 = JSON.parse(l2), void 0 !== l2.layerDefinition ? (f2.layerDefinition = l2.layerDefinition, f2.featureSet = l2.featureSet, l2.layerDefinition.spatialReference && (f2.layerDefinition.spatialReference = l2.layerDefinition.spatialReference)) : (f2.featureSet.features = l2.features, f2.featureSet.geometryType = l2.geometryType, f2.layerDefinition.geometryType = f2.featureSet.geometryType, f2.layerDefinition.objectIdField = l2.objectIdFieldName, f2.layerDefinition.typeIdField = l2.typeIdFieldName, f2.layerDefinition.globalIdField = l2.globalIdFieldName, f2.layerDefinition.fields = l2.fields, l2.spatialReference && (f2.layerDefinition.spatialReference = l2.spatialReference));
  403. else {
  404. if (!(o[0] instanceof J2))
  405. throw new t(e4, e.InvalidParameter, a3);
  406. {
  407. l2 = JSON.parse(o[0].castToText(true));
  408. const e5 = q2(l2, "layerdefinition");
  409. if (null !== e5) {
  410. f2.layerDefinition.geometryType = q2(e5, "geometrytype", ""), f2.featureSet.geometryType = f2.layerDefinition.geometryType, f2.layerDefinition.globalIdField = q2(e5, "globalidfield", ""), f2.layerDefinition.objectIdField = q2(e5, "objectidfield", ""), f2.layerDefinition.typeIdField = q2(e5, "typeidfield", "");
  411. const t4 = q2(e5, "spatialreference", null);
  412. t4 && (f2.layerDefinition.spatialReference = X(t4));
  413. for (const i of q2(e5, "fields", [])) {
  414. const e6 = { name: q2(i, "name", ""), alias: q2(i, "alias", ""), type: q2(i, "type", ""), nullable: q2(i, "nullable", true), editable: q2(i, "editable", true), length: q2(i, "length", null), domain: K2(q2(i, "domain")) };
  415. f2.layerDefinition.fields.push(e6);
  416. }
  417. const n2 = q2(l2, "featureset", null);
  418. if (n2) {
  419. const e6 = {};
  420. for (const t5 of f2.layerDefinition.fields)
  421. e6[t5.name.toLowerCase()] = t5.name;
  422. for (const t5 of q2(n2, "features", [])) {
  423. const n3 = {}, i = q2(t5, "attributes", {});
  424. for (const t6 in i)
  425. n3[e6[t6.toLowerCase()]] = i[t6];
  426. f2.featureSet.features.push({ attributes: n3, geometry: Y2(q2(t5, "geometry", null)) });
  427. }
  428. }
  429. } else {
  430. f2.layerDefinition.geometryType = q2(l2, "geometrytype", ""), f2.featureSet.geometryType = f2.layerDefinition.geometryType, f2.layerDefinition.objectIdField = q2(l2, "objectidfieldname", ""), f2.layerDefinition.typeIdField = q2(l2, "typeidfieldname", "");
  431. const e6 = q2(l2, "spatialreference", null);
  432. e6 && (f2.layerDefinition.spatialReference = X(e6));
  433. for (const n2 of q2(l2, "fields", [])) {
  434. const e7 = { name: q2(n2, "name", ""), alias: q2(n2, "alias", ""), type: q2(n2, "type", ""), nullable: q2(n2, "nullable", true), editable: q2(n2, "editable", true), length: q2(n2, "length", null), domain: K2(q2(n2, "domain")) };
  435. f2.layerDefinition.fields.push(e7);
  436. }
  437. const t4 = {};
  438. for (const n2 of f2.layerDefinition.fields)
  439. t4[n2.name.toLowerCase()] = n2.name;
  440. for (const n2 of q2(l2, "features", [])) {
  441. const e7 = {}, i = q2(n2, "attributes", {});
  442. for (const n3 in i)
  443. e7[t4[n3.toLowerCase()]] = i[n3];
  444. f2.featureSet.features.push({ attributes: e7, geometry: Y2(q2(n2, "geometry", null)) });
  445. }
  446. }
  447. }
  448. }
  449. if (false === Q(f2))
  450. throw new t(e4, e.InvalidParameter, a3);
  451. return d.create(f2, e4.spatialReference);
  452. });
  453. }, G2.signatures.push({ name: "featureset", min: 1, max: 1 }), G2.functions.filter = function(e4, t4) {
  454. return G2.standardFunctionAsync(e4, t4, async (a3, r, s) => {
  455. if (V(s, 2, 2, e4, t4), Y(s[0]) || E(s[0])) {
  456. const a4 = [];
  457. let r2 = s[0];
  458. r2 instanceof t2 && (r2 = r2.toArray());
  459. let o = null;
  460. if (!F(s[1]))
  461. throw new t(e4, e.InvalidParameter, t4);
  462. o = s[1].createFunction(e4);
  463. for (const e5 of r2) {
  464. const t5 = o(e5);
  465. C(t5) ? true === await t5 && a4.push(e5) : true === t5 && a4.push(e5);
  466. }
  467. return a4;
  468. }
  469. if (P(s[0])) {
  470. const t5 = await s[0].load(), n2 = f.create(s[1], t5.getFieldsIndex()), i = n2.getVariables();
  471. if (i.length > 0) {
  472. const t6 = [];
  473. for (let n3 = 0; n3 < i.length; n3++) {
  474. const a5 = { name: i[n3] };
  475. t6.push(await G2.evaluateIdentifier(e4, a5));
  476. }
  477. const a4 = {};
  478. for (let e5 = 0; e5 < i.length; e5++)
  479. a4[i[e5]] = t6[e5];
  480. return n2.parameters = a4, new c({ parentfeatureset: s[0], whereclause: n2 });
  481. }
  482. return new c({ parentfeatureset: s[0], whereclause: n2 });
  483. }
  484. throw new t(e4, e.InvalidParameter, t4);
  485. });
  486. }, G2.signatures.push({ name: "filter", min: 2, max: 2 }), G2.functions.orderby = function(e4, t4) {
  487. return G2.standardFunctionAsync(e4, t4, async (a3, r, s) => {
  488. if (V(s, 2, 2, e4, t4), P(s[0])) {
  489. const e5 = new e3(s[1]);
  490. return new a({ parentfeatureset: s[0], orderbyclause: e5 });
  491. }
  492. throw new t(e4, e.InvalidParameter, t4);
  493. });
  494. }, G2.signatures.push({ name: "orderby", min: 2, max: 2 }), G2.functions.top = function(e4, t4) {
  495. return G2.standardFunctionAsync(e4, t4, async (a3, r, s) => {
  496. if (V(s, 2, 2, e4, t4), P(s[0]))
  497. return new a2({ parentfeatureset: s[0], topnum: s[1] });
  498. if (Y(s[0]))
  499. return re(s[1]) >= s[0].length ? s[0].slice(0) : s[0].slice(0, re(s[1]));
  500. if (E(s[0]))
  501. return re(s[1]) >= s[0].length() ? s[0].slice(0) : s[0].slice(0, re(s[1]));
  502. throw new t(e4, e.InvalidParameter, t4);
  503. });
  504. }, G2.signatures.push({ name: "top", min: 2, max: 2 }), G2.functions.first = function(e4, t4) {
  505. return G2.standardFunctionAsync(e4, t4, async (n2, i, r) => {
  506. if (V(r, 1, 1, e4, t4), P(r[0])) {
  507. const e5 = await r[0].first(n2.abortSignal);
  508. if (null !== e5) {
  509. const t5 = g.createFromGraphicLikeObject(e5.geometry, e5.attributes, r[0]);
  510. return t5._underlyingGraphic = e5, t5;
  511. }
  512. return e5;
  513. }
  514. return Y(r[0]) ? 0 === r[0].length ? null : r[0][0] : E(r[0]) ? 0 === r[0].length() ? null : r[0].get(0) : null;
  515. });
  516. }, G2.signatures.push({ name: "first", min: 1, max: 1 }), G2.functions.attachments = function(e4, a3) {
  517. return G2.standardFunctionAsync(e4, a3, async (r, s, o) => {
  518. V(o, 1, 2, e4, a3);
  519. const l2 = { minsize: -1, maxsize: -1, types: null, returnMetadata: false };
  520. if (o.length > 1) {
  521. if (o[1] instanceof J2) {
  522. if (o[1].hasField("minsize") && (l2.minsize = re(o[1].field("minsize"))), o[1].hasField("metadata") && (l2.returnMetadata = le(o[1].field("metadata"))), o[1].hasField("maxsize") && (l2.maxsize = re(o[1].field("maxsize"))), o[1].hasField("types")) {
  523. const e5 = xe(o[1].field("types"), false);
  524. e5.length > 0 && (l2.types = e5);
  525. }
  526. } else if (null !== o[1])
  527. throw new t(e4, e.InvalidParameter, a3);
  528. }
  529. if (J(o[0])) {
  530. let t4 = o[0]._layer;
  531. return t4 instanceof Ze && (t4 = F3(t4, e4.spatialReference, ["*"], true, e4.lrucache, e4.interceptor)), null === t4 ? [] : false === P(t4) ? [] : (await t4.load(), t4.queryAttachments(o[0].field(t4.objectIdField), l2.minsize, l2.maxsize, l2.types, l2.returnMetadata));
  532. }
  533. if (null === o[0])
  534. return [];
  535. throw new t(e4, e.InvalidParameter, a3);
  536. });
  537. }, G2.signatures.push({ name: "attachments", min: 1, max: 2 }), G2.functions.featuresetbyrelationshipname = function(e4, t4) {
  538. return G2.standardFunctionAsync(e4, t4, async (a3, r, s) => {
  539. V(s, 2, 4, e4, t4);
  540. const o = s[0], l2 = K(s[1]);
  541. let f2 = v(s[2], null);
  542. const m = le(v(s[3], true));
  543. if (null === f2 && (f2 = ["*"]), false === Y(f2))
  544. throw new t(e4, e.InvalidParameter, t4);
  545. if (null === s[0])
  546. return null;
  547. if (!J(s[0]))
  548. throw new t(e4, e.InvalidParameter, t4);
  549. let p = o._layer;
  550. if (p instanceof Ze && (p = F3(p, e4.spatialReference, ["*"], true, e4.lrucache, e4.interceptor)), null === p)
  551. return null;
  552. if (false === P(p))
  553. return null;
  554. p = await p.load();
  555. const D2 = p.relationshipMetaData().filter((e5) => e5.name === l2);
  556. if (0 === D2.length)
  557. return null;
  558. if (void 0 !== D2[0].relationshipTableId && null !== D2[0].relationshipTableId && D2[0].relationshipTableId > -1)
  559. return k(p, D2[0], o.field(p.objectIdField), p.spatialReference, f2, m, e4.lrucache, e4.interceptor);
  560. let b = p.serviceUrl();
  561. if (!b)
  562. return null;
  563. b = "/" === b.charAt(b.length - 1) ? b + D2[0].relatedTableId.toString() : b + "/" + D2[0].relatedTableId.toString();
  564. const A2 = await N(b, p.spatialReference, f2, m, e4.lrucache, e4.interceptor);
  565. await A2.load();
  566. let N2 = A2.relationshipMetaData();
  567. if (N2 = N2.filter((e5) => e5.id === D2[0].id), false === o.hasField(D2[0].keyField) || null === o.field(D2[0].keyField)) {
  568. const e5 = await p.getFeatureByObjectId(o.field(p.objectIdField), [D2[0].keyField]);
  569. if (e5) {
  570. const t5 = f.create(N2[0].keyField + "= @id", A2.getFieldsIndex());
  571. return t5.parameters = { id: e5.attributes[D2[0].keyField] }, A2.filter(t5);
  572. }
  573. return new u({ parentfeatureset: A2 });
  574. }
  575. const x2 = f.create(N2[0].keyField + "= @id", A2.getFieldsIndex());
  576. return x2.parameters = { id: o.field(D2[0].keyField) }, A2.filter(x2);
  577. });
  578. }, G2.signatures.push({ name: "featuresetbyrelationshipname", min: 2, max: 4 }), G2.functions.featuresetbyassociation = function(e4, t4) {
  579. return G2.standardFunctionAsync(e4, t4, async (a3, r, s) => {
  580. V(s, 2, 3, e4, t4);
  581. const o = s[0], l2 = K(v(s[1], "")).toLowerCase(), f2 = w(s[2]) ? K(s[2]) : null;
  582. if (null === s[0])
  583. return null;
  584. if (!J(s[0]))
  585. throw new t(e4, e.InvalidParameter, t4);
  586. let u2 = o._layer;
  587. if (u2 instanceof Ze && (u2 = F3(u2, e4.spatialReference, ["*"], true, e4.lrucache, e4.interceptor)), null === u2)
  588. return null;
  589. if (false === P(u2))
  590. return null;
  591. await u2.load();
  592. const d2 = u2.serviceUrl(), p = await C2(d2, e4.spatialReference);
  593. let I = null, F4 = null, b = false;
  594. if (null !== f2 && "" !== f2 && void 0 !== f2) {
  595. for (const e5 of p.terminals)
  596. e5.terminalName === f2 && (F4 = e5.terminalId);
  597. null === F4 && (b = true);
  598. }
  599. const A2 = p.associations.getFieldsIndex(), N2 = A2.get("TOGLOBALID").name, x2 = A2.get("FROMGLOBALID").name, P2 = A2.get("TOTERMINALID").name, R2 = A2.get("FROMTERMINALID").name, O = A2.get("FROMNETWORKSOURCEID").name, C3 = A2.get("TONETWORKSOURCEID").name, M = A2.get("ASSOCIATIONTYPE").name, k2 = A2.get("ISCONTENTVISIBLE").name, z = A2.get("OBJECTID").name;
  600. for (const e5 of u2.fields)
  601. if ("global-id" === e5.type) {
  602. I = o.field(e5.name);
  603. break;
  604. }
  605. let G3 = null, U = new x(new y({ name: "percentalong", alias: "percentalong", type: "double" }), f.create("0", p.associations.getFieldsIndex())), J4 = new x(new y({ name: "side", alias: "side", type: "string" }), f.create("''", p.associations.getFieldsIndex()));
  606. const V3 = "globalid", q3 = "globalId", K3 = {};
  607. for (const e5 in p.lkp)
  608. K3[e5] = p.lkp[e5].sourceId;
  609. const X2 = new E2(new y({ name: "classname", alias: "classname", type: "string" }), null, K3);
  610. let Y3 = "";
  611. switch (l2) {
  612. case "midspan": {
  613. Y3 = `((${N2}='${I}') OR ( ${x2}='${I}')) AND (${M} IN (5))`, X2.codefield = f.create(`CASE WHEN (${N2}='${I}') THEN ${O} ELSE ${C3} END`, p.associations.getFieldsIndex());
  614. const e5 = n(A.findField(p.associations.fields, x2));
  615. e5.name = V3, e5.alias = V3, G3 = new x(e5, f.create(`CASE WHEN (${x2}='${I}') THEN ${N2} ELSE ${x2} END`, p.associations.getFieldsIndex())), U = p.unVersion >= 4 ? new F2(A.findField(p.associations.fields, A2.get("PERCENTALONG").name)) : new x(new y({ name: "percentalong", alias: "percentalong", type: "double" }), f.create("0", p.associations.getFieldsIndex()));
  616. break;
  617. }
  618. case "junctionedge": {
  619. Y3 = `((${N2}='${I}') OR ( ${x2}='${I}')) AND (${M} IN (4,6))`, X2.codefield = f.create(`CASE WHEN (${N2}='${I}') THEN ${O} ELSE ${C3} END`, p.associations.getFieldsIndex());
  620. const e5 = n(A.findField(p.associations.fields, x2));
  621. e5.name = V3, e5.alias = V3, G3 = new x(e5, f.create(`CASE WHEN (${x2}='${I}') THEN ${N2} ELSE ${x2} END`, p.associations.getFieldsIndex())), J4 = new x(new y({ name: "side", alias: "side", type: "string" }), f.create(`CASE WHEN (${M}=4) THEN 'from' ELSE 'to' END`, p.associations.getFieldsIndex()));
  622. break;
  623. }
  624. case "connected": {
  625. let e5 = `${N2}='@T'`, t5 = `${x2}='@T'`;
  626. null !== F4 && (e5 += ` AND ${P2}=@A`, t5 += ` AND ${R2}=@A`), Y3 = "((" + e5 + ") OR (" + t5 + "))", Y3 = R(Y3, "@T", I != null ? I : ""), e5 = R(e5, "@T", I != null ? I : ""), null !== F4 && (e5 = R(e5, "@A", F4.toString()), Y3 = R(Y3, "@A", F4.toString())), X2.codefield = f.create("CASE WHEN " + e5 + ` THEN ${O} ELSE ${C3} END`, p.associations.getFieldsIndex());
  627. const n2 = n(A.findField(p.associations.fields, x2));
  628. n2.name = V3, n2.alias = V3, G3 = new x(n2, f.create("CASE WHEN " + e5 + ` THEN ${x2} ELSE ${N2} END`, p.associations.getFieldsIndex()));
  629. break;
  630. }
  631. case "container":
  632. Y3 = `${N2}='${I}' AND ${M} = 2`, null !== F4 && (Y3 += ` AND ${P2} = ` + F4.toString()), X2.codefield = O, Y3 = "( " + Y3 + " )", G3 = new W(A.findField(p.associations.fields, x2), V3, V3);
  633. case "content":
  634. Y3 = `(${x2}='${I}' AND ${M} = 2)`, null !== F4 && (Y3 += ` AND ${R2} = ` + F4.toString()), X2.codefield = C3, Y3 = "( " + Y3 + " )", G3 = new W(A.findField(p.associations.fields, N2), V3, V3);
  635. break;
  636. case "structure":
  637. Y3 = `(${N2}='${I}' AND ${M} = 3)`, null !== F4 && (Y3 += ` AND ${P2} = ` + F4.toString()), X2.codefield = O, Y3 = "( " + Y3 + " )", G3 = new W(A.findField(p.associations.fields, x2), V3, q3);
  638. break;
  639. case "attached":
  640. Y3 = `(${x2}='${I}' AND ${M} = 3)`, null !== F4 && (Y3 += ` AND ${R2} = ` + F4.toString()), X2.codefield = C3, Y3 = "( " + Y3 + " )", G3 = new W(A.findField(p.associations.fields, N2), V3, q3);
  641. break;
  642. default:
  643. throw new t(e4, e.InvalidParameter, t4);
  644. }
  645. b && (Y3 = "1 <> 1");
  646. return new A({ parentfeatureset: p.associations, adaptedFields: [new F2(A.findField(p.associations.fields, z)), new F2(A.findField(p.associations.fields, k2)), G3, J4, X2, U], extraFilter: Y3 ? f.create(Y3, p.associations.getFieldsIndex()) : null });
  647. });
  648. }, G2.signatures.push({ name: "featuresetbyassociation", min: 2, max: 6 }), G2.functions.groupby = function(e4, a3) {
  649. return G2.standardFunctionAsync(e4, a3, async (r, s, o) => {
  650. if (V(o, 3, 3, e4, a3), !P(o[0]))
  651. throw new t(e4, e.InvalidParameter, a3);
  652. const l2 = await o[0].load(), f2 = [], c2 = [];
  653. let u2 = false, d2 = [];
  654. if (w(o[1]))
  655. d2.push(o[1]);
  656. else if (o[1] instanceof J2)
  657. d2.push(o[1]);
  658. else if (Y(o[1]))
  659. d2 = o[1];
  660. else {
  661. if (!E(o[1]))
  662. throw new t(e4, e.InvalidParameter, a3);
  663. d2 = o[1].toArray();
  664. }
  665. for (const m of d2)
  666. if (w(m)) {
  667. const e5 = f.create(K(m), l2.getFieldsIndex()), t4 = true === w2(e5) ? K(m) : "%%%%FIELDNAME";
  668. f2.push({ name: t4, expression: e5 }), "%%%%FIELDNAME" === t4 && (u2 = true);
  669. } else {
  670. if (!(m instanceof J2))
  671. throw new t(e4, e.InvalidParameter, a3);
  672. {
  673. const t4 = m.hasField("name") ? m.field("name") : "%%%%FIELDNAME", r2 = m.hasField("expression") ? m.field("expression") : "";
  674. if ("%%%%FIELDNAME" === t4 && (u2 = true), !t4)
  675. throw new t(e4, e.InvalidParameter, a3);
  676. f2.push({ name: t4, expression: f.create(r2 || t4, l2.getFieldsIndex()) });
  677. }
  678. }
  679. if (d2 = [], w(o[2]))
  680. d2.push(o[2]);
  681. else if (Y(o[2]))
  682. d2 = o[2];
  683. else if (E(o[2]))
  684. d2 = o[2].toArray();
  685. else {
  686. if (!(o[2] instanceof J2))
  687. throw new t(e4, e.InvalidParameter, a3);
  688. d2.push(o[2]);
  689. }
  690. for (const m of d2) {
  691. if (!(m instanceof J2))
  692. throw new t(e4, e.InvalidParameter, a3);
  693. {
  694. const t4 = m.hasField("name") ? m.field("name") : "", r2 = m.hasField("statistic") ? m.field("statistic") : "", s2 = m.hasField("expression") ? m.field("expression") : "";
  695. if (!t4 || !r2 || !s2)
  696. throw new t(e4, e.InvalidParameter, a3);
  697. c2.push({ name: t4, statistic: r2.toLowerCase(), expression: f.create(s2, l2.getFieldsIndex()) });
  698. }
  699. }
  700. if (u2) {
  701. const e5 = {};
  702. for (const n2 of l2.fields)
  703. e5[n2.name.toLowerCase()] = 1;
  704. for (const n2 of f2)
  705. "%%%%FIELDNAME" !== n2.name && (e5[n2.name.toLowerCase()] = 1);
  706. for (const n2 of c2)
  707. "%%%%FIELDNAME" !== n2.name && (e5[n2.name.toLowerCase()] = 1);
  708. let t4 = 0;
  709. for (const n2 of f2)
  710. if ("%%%%FIELDNAME" === n2.name) {
  711. for (; 1 === e5["field_" + t4.toString()]; )
  712. t4++;
  713. e5["field_" + t4.toString()] = 1, n2.name = "FIELD_" + t4.toString();
  714. }
  715. }
  716. for (const t4 of f2)
  717. await V2(t4.expression, G2, e4);
  718. for (const t4 of c2)
  719. await V2(t4.expression, G2, e4);
  720. return o[0].groupby(f2, c2);
  721. });
  722. }, G2.signatures.push({ name: "groupby", min: 3, max: 3 }), G2.functions.distinct = function(e4, a3) {
  723. return G2.standardFunctionAsync(e4, a3, async (r, s, o) => {
  724. if (P(o[0])) {
  725. V(o, 2, 2, e4, a3);
  726. const r2 = await o[0].load(), s2 = [];
  727. let l2 = [];
  728. if (w(o[1]))
  729. l2.push(o[1]);
  730. else if (o[1] instanceof J2)
  731. l2.push(o[1]);
  732. else if (Y(o[1]))
  733. l2 = o[1];
  734. else {
  735. if (!E(o[1]))
  736. throw new t(e4, e.InvalidParameter, a3);
  737. l2 = o[1].toArray();
  738. }
  739. let f2 = false;
  740. for (const o2 of l2)
  741. if (w(o2)) {
  742. const e5 = f.create(K(o2), r2.getFieldsIndex()), t4 = true === w2(e5) ? K(o2) : "%%%%FIELDNAME";
  743. s2.push({ name: t4, expression: e5 }), "%%%%FIELDNAME" === t4 && (f2 = true);
  744. } else {
  745. if (!(o2 instanceof J2))
  746. throw new t(e4, e.InvalidParameter, a3);
  747. {
  748. const t4 = o2.hasField("name") ? o2.field("name") : "%%%%FIELDNAME", l3 = o2.hasField("expression") ? o2.field("expression") : "";
  749. if ("%%%%FIELDNAME" === t4 && (f2 = true), !t4)
  750. throw new t(e4, e.InvalidParameter, a3);
  751. s2.push({ name: t4, expression: f.create(l3 || t4, r2.getFieldsIndex()) });
  752. }
  753. }
  754. if (f2) {
  755. const e5 = {};
  756. for (const n2 of r2.fields)
  757. e5[n2.name.toLowerCase()] = 1;
  758. for (const n2 of s2)
  759. "%%%%FIELDNAME" !== n2.name && (e5[n2.name.toLowerCase()] = 1);
  760. let t4 = 0;
  761. for (const n2 of s2)
  762. if ("%%%%FIELDNAME" === n2.name) {
  763. for (; 1 === e5["field_" + t4.toString()]; )
  764. t4++;
  765. e5["field_" + t4.toString()] = 1, n2.name = "FIELD_" + t4.toString();
  766. }
  767. }
  768. for (const t4 of s2)
  769. await V2(t4.expression, G2, e4);
  770. return o[0].groupby(s2, []);
  771. }
  772. return J3("distinct", r, s, o);
  773. });
  774. });
  775. }
  776. export {
  777. ee as registerFunctions
  778. };
  779. //# sourceMappingURL=featuresetbase-U2SCLWM5.js.map