arcadeUtils-Y4XBISY2.js 166 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598
  1. import {
  2. B,
  3. C as C2,
  4. M,
  5. N as N2,
  6. W,
  7. c as c3,
  8. d,
  9. f,
  10. l as l2,
  11. m as m2,
  12. o,
  13. p as p3,
  14. s as s4,
  15. u as u3,
  16. x,
  17. y as y2
  18. } from "./chunk-NS7TRIN4.js";
  19. import {
  20. g
  21. } from "./chunk-WGHU7NSM.js";
  22. import "./chunk-KD6NQDSX.js";
  23. import "./chunk-AXIWHIDY.js";
  24. import {
  25. J as J2
  26. } from "./chunk-PLCWBBQ4.js";
  27. import {
  28. q
  29. } from "./chunk-J3K5NYLA.js";
  30. import "./chunk-C3UFAVPF.js";
  31. import "./chunk-BJT4XIGU.js";
  32. import {
  33. A,
  34. D2 as D,
  35. E,
  36. F2 as F,
  37. G,
  38. J,
  39. K,
  40. N,
  41. Ne,
  42. P2 as P,
  43. Q,
  44. V,
  45. X,
  46. Y,
  47. Z,
  48. _,
  49. c as c2,
  50. e,
  51. e2,
  52. j,
  53. k as k2,
  54. l,
  55. n,
  56. p as p2,
  57. r,
  58. re,
  59. s,
  60. s2,
  61. s3,
  62. t,
  63. u as u2,
  64. ve,
  65. w as w3,
  66. z
  67. } from "./chunk-FT2BCPUP.js";
  68. import "./chunk-5JZ72JAQ.js";
  69. import "./chunk-JKFWEHNK.js";
  70. import "./chunk-EDHROVWI.js";
  71. import "./chunk-3IRT3YKJ.js";
  72. import {
  73. e as e3
  74. } from "./chunk-PK4W65H4.js";
  75. import "./chunk-JGBXYDGB.js";
  76. import "./chunk-QEWF7QPH.js";
  77. import "./chunk-3RSFVUKZ.js";
  78. import "./chunk-5N7JLUJJ.js";
  79. import {
  80. j as j2
  81. } from "./chunk-LU5IJZB4.js";
  82. import "./chunk-7IBV2TRE.js";
  83. import "./chunk-5UVJ64RB.js";
  84. import "./chunk-SFEFRQCL.js";
  85. import "./chunk-ETGAZ7LF.js";
  86. import "./chunk-75U5LM2V.js";
  87. import "./chunk-RMDDCMKS.js";
  88. import {
  89. m2 as m,
  90. u,
  91. v2 as v
  92. } from "./chunk-VCH45Q2I.js";
  93. import "./chunk-YFSLJIO4.js";
  94. import "./chunk-55RWC67C.js";
  95. import "./chunk-HZRKBTHJ.js";
  96. import {
  97. U
  98. } from "./chunk-DVUG3KID.js";
  99. import "./chunk-FWSQEIAR.js";
  100. import "./chunk-VEGAOVMY.js";
  101. import {
  102. p,
  103. w,
  104. w2
  105. } from "./chunk-6T6G6LCQ.js";
  106. import "./chunk-YEJL5NEF.js";
  107. import {
  108. k2 as k
  109. } from "./chunk-PQFTYGF5.js";
  110. import "./chunk-2Z2TG5CU.js";
  111. import "./chunk-6KZ2LTDA.js";
  112. import "./chunk-U2XHEJM7.js";
  113. import "./chunk-SQOPWYIT.js";
  114. import {
  115. C
  116. } from "./chunk-V6P2MAQQ.js";
  117. import "./chunk-E5O6P5I2.js";
  118. import {
  119. has,
  120. y
  121. } from "./chunk-SPWQ3AWG.js";
  122. import "./chunk-2TIUKVZN.js";
  123. import {
  124. c
  125. } from "./chunk-YXWMMD76.js";
  126. import "./chunk-S5KM4IGW.js";
  127. // node_modules/@arcgis/core/arcade/arcadeCompiler.js
  128. var T = class extends r {
  129. constructor(e7, n3) {
  130. super(), this.paramCount = n3, this.fn = e7;
  131. }
  132. createFunction(e7) {
  133. return (...n3) => {
  134. if (n3.length !== this.paramCount)
  135. throw new t(e7, e.WrongNumberOfParameters, null);
  136. return this.fn(...n3);
  137. };
  138. }
  139. call(e7, n3) {
  140. return this.fn(...n3.arguments);
  141. }
  142. marshalledCall(e7, n3, o5, l6) {
  143. return l6(e7, n3, (n4, r4, a3) => {
  144. a3 = a3.map((n5) => !F(n5) || n5 instanceof s2 ? n5 : n(n5, e7, l6));
  145. const s9 = this.call(o5, { arguments: a3 });
  146. return C(s9) ? s9.then((e8) => n(e8, o5, l6)) : s9;
  147. });
  148. }
  149. };
  150. function W2(e7, n3, t4) {
  151. try {
  152. return t4(e7, null, n3.arguments);
  153. } catch (o5) {
  154. throw o5;
  155. }
  156. }
  157. function V2(e7, n3) {
  158. try {
  159. switch (n3.type) {
  160. case "EmptyStatement":
  161. return "lc.voidOperation";
  162. case "VariableDeclarator":
  163. return ue(e7, n3);
  164. case "VariableDeclaration":
  165. return ce(e7, n3);
  166. case "BlockStatement":
  167. case "Program":
  168. return oe(e7, n3);
  169. case "FunctionDeclaration":
  170. return ie(e7, n3);
  171. case "ImportDeclaration":
  172. return re2(e7, n3);
  173. case "ExportNamedDeclaration":
  174. return ae(e7, n3);
  175. case "ReturnStatement":
  176. return le(e7, n3);
  177. case "IfStatement":
  178. return te(e7, n3);
  179. case "ExpressionStatement":
  180. return ee(e7, n3);
  181. case "AssignmentExpression":
  182. return Z2(e7, n3);
  183. case "UpdateExpression":
  184. return Q2(e7, n3);
  185. case "BreakStatement":
  186. return "break";
  187. case "ContinueStatement":
  188. return "continue";
  189. case "TemplateLiteral":
  190. return de(e7, n3);
  191. case "TemplateElement":
  192. return JSON.stringify(n3.value ? n3.value.cooked : "");
  193. case "ForStatement":
  194. return H(e7, n3);
  195. case "ForInStatement":
  196. return Y2(e7, n3);
  197. case "WhileStatement":
  198. return X2(e7, n3);
  199. case "Identifier":
  200. return ye(e7, n3);
  201. case "MemberExpression":
  202. return pe(e7, n3);
  203. case "Literal":
  204. return null === n3.value || void 0 === n3.value ? "null" : JSON.stringify(n3.value);
  205. case "CallExpression":
  206. return be(e7, n3);
  207. case "UnaryExpression":
  208. return me(e7, n3);
  209. case "BinaryExpression":
  210. return fe(e7, n3);
  211. case "LogicalExpression":
  212. return he(e7, n3);
  213. case "ArrayExpression":
  214. return ge(e7, n3);
  215. case "ObjectExpression":
  216. return J3(e7, n3);
  217. case "Property":
  218. return z2(e7, n3);
  219. case "Array":
  220. throw new s(e7, e.NeverReach, n3);
  221. default:
  222. throw new s(e7, e.Unrecognised, n3);
  223. }
  224. } catch (t4) {
  225. throw t4;
  226. }
  227. }
  228. function J3(e7, n3) {
  229. let t4 = "lang.dictionary([";
  230. for (let o5 = 0; o5 < n3.properties.length; o5++) {
  231. const l6 = n3.properties[o5];
  232. se2(l6.key.name);
  233. o5 > 0 && (t4 += ","), t4 += "lang.strCheck(" + ("Identifier" === l6.key.type ? "'" + l6.key.name + "'" : V2(e7, l6.key)) + ",'ObjectExpression'),lang.aCheck(" + V2(e7, l6.value) + ", 'ObjectExpression')";
  234. }
  235. return t4 += "])", t4;
  236. }
  237. function z2(e7, n3) {
  238. throw new s(e7, e.NeverReach, n3);
  239. }
  240. function Y2(e7, n3) {
  241. const t4 = Fe(e7), o5 = Fe(e7), l6 = Fe(e7);
  242. let r4 = "var " + t4 + " = " + V2(e7, n3.right) + ";\n";
  243. "VariableDeclaration" === n3.left.type && (r4 += V2(e7, n3.left));
  244. let a3 = "VariableDeclaration" === n3.left.type ? n3.left.declarations[0].id.name : n3.left.name;
  245. a3 = a3.toLowerCase(), se2(a3);
  246. let s9 = "";
  247. null !== e7.localScope && (void 0 !== e7.localScope[a3] ? s9 = "lscope['" + a3 + "']" : void 0 !== e7.localScope._SymbolsMap[a3] && (s9 = "lscope['" + e7.localScope._SymbolsMap[a3] + "']"));
  248. let i3 = "";
  249. if ("" === s9) {
  250. if (void 0 !== e7.globalScope[a3])
  251. s9 = "gscope['" + a3 + "']";
  252. else if (void 0 !== e7.globalScope._SymbolsMap[a3])
  253. s9 = "gscope['" + e7.globalScope._SymbolsMap[a3] + "']";
  254. else if (null !== e7.localScope)
  255. if (e7.undeclaredGlobalsInFunctions.has(a3))
  256. s9 = "gscope['" + e7.undeclaredGlobalsInFunctions.get(a3).manglename + "']", i3 = e7.undeclaredGlobalsInFunctions.get(a3).manglename;
  257. else {
  258. const t5 = { manglename: Me(e7), node: n3.left };
  259. e7.undeclaredGlobalsInFunctions.set(a3, t5), s9 = "gscope['" + t5.manglename + "']", i3 = t5.manglename;
  260. }
  261. }
  262. return i3 && (r4 += "lang.chkAssig('" + i3 + "',runtimeCtx); \n"), r4 += "if (" + t4 + "===null) { lastStatement = lc.voidOperation; }\n ", r4 += "else if (lc.isArray(" + t4 + ") || lc.isString(" + t4 + ")) {", r4 += "var " + o5 + "=" + t4 + ".length; \n", r4 += "for(var " + l6 + "=0; " + l6 + "<" + o5 + "; " + l6 + "++) {\n", r4 += s9 + "=" + l6 + ";\n", r4 += V2(e7, n3.body), r4 += "\n}\n", r4 += " lastStatement = lc.voidOperation; \n", r4 += " \n}\n", r4 += "else if (lc.isImmutableArray(" + t4 + ")) {", r4 += "var " + o5 + "=" + t4 + ".length(); \n", r4 += "for(var " + l6 + "=0; " + l6 + "<" + o5 + "; " + l6 + "++) {\n", r4 += s9 + "=" + l6 + ";\n", r4 += V2(e7, n3.body), r4 += "\n}\n", r4 += " lastStatement = lc.voidOperation; \n", r4 += " \n}\n", r4 += "else if (( " + t4 + " instanceof lang.Dictionary) || ( " + t4 + " instanceof lang.Feature)) {", r4 += "var " + o5 + "=" + t4 + ".keys(); \n", r4 += "for(var " + l6 + "=0; " + l6 + "<" + o5 + ".length; " + l6 + "++) {\n", r4 += s9 + "=" + o5 + "[" + l6 + "];\n", r4 += V2(e7, n3.body), r4 += "\n}\n", r4 += " lastStatement = lc.voidOperation; \n", r4 += " \n}\n", e7.isAsync && (r4 += "else if (lc.isFeatureSet(" + t4 + ")) {", r4 += "var " + o5 + "=" + t4 + ".iterator(runtimeCtx.abortSignal); \n", r4 += "for(var " + l6 + "=lang. graphicToFeature( yield " + o5 + ".next()," + t4 + "); " + l6 + "!=null; " + l6 + "=lang. graphicToFeature( yield " + o5 + ".next()," + t4 + ")) {\n", r4 += s9 + "=" + l6 + ";\n", r4 += V2(e7, n3.body), r4 += "\n}\n", r4 += " lastStatement = lc.voidOperation; \n", r4 += " \n}\n"), r4 += "else { lastStatement = lc.voidOperation; } \n", r4;
  263. }
  264. function H(e7, n3) {
  265. let t4 = "lastStatement = lc.voidOperation; \n";
  266. null !== n3.init && (t4 += V2(e7, n3.init) + "; ");
  267. const o5 = Fe(e7), l6 = Fe(e7);
  268. return t4 += "var " + o5 + " = true; ", t4 += "\n do { ", null !== n3.update && (t4 += " if (" + o5 + "===false) {\n " + V2(e7, n3.update) + " \n}\n " + o5 + "=false; \n"), null !== n3.test && (t4 += "var " + l6 + " = " + V2(e7, n3.test) + "; ", t4 += "if (" + l6 + "===false) { break; } else if (" + l6 + "!==true) { lang.error('" + e.BooleanConditionRequired + "'); }\n"), t4 += V2(e7, n3.body), null !== n3.update && (t4 += "\n " + V2(e7, n3.update)), t4 += "\n" + o5 + " = true; \n} while(true); lastStatement = lc.voidOperation; ", t4;
  269. }
  270. function Q2(e7, n3) {
  271. let t4 = null, o5 = "";
  272. if ("MemberExpression" === n3.argument.type)
  273. return t4 = V2(e7, n3.argument.object), true === n3.argument.computed ? o5 = V2(e7, n3.argument.property) : (o5 = "'" + n3.argument.property.name + "'", se2(n3.argument.property.name)), "lang.memberupdate(" + t4 + "," + o5 + ",'" + n3.operator + "'," + n3.prefix + ")";
  274. if (t4 = n3.argument.name.toLowerCase(), se2(t4), null !== e7.localScope) {
  275. if (void 0 !== e7.localScope[t4])
  276. return "lang.update(lscope, '" + t4 + "','" + n3.operator + "'," + n3.prefix + ")";
  277. if (void 0 !== e7.localScope._SymbolsMap[t4])
  278. return "lang.update(lscope, '" + e7.localScope._SymbolsMap[t4] + "','" + n3.operator + "'," + n3.prefix + ")";
  279. }
  280. if (void 0 !== e7.globalScope[t4])
  281. return "lang.update(gscope, '" + t4 + "','" + n3.operator + "'," + n3.prefix + ")";
  282. if (void 0 !== e7.globalScope._SymbolsMap[t4])
  283. return "lang.update(gscope, '" + e7.globalScope._SymbolsMap[t4] + "','" + n3.operator + "'," + n3.prefix + ")";
  284. if (null !== e7.localScope) {
  285. if (e7.undeclaredGlobalsInFunctions.has(t4))
  286. return "lang.update(gscope,lang.chkAssig( '" + e7.undeclaredGlobalsInFunctions.get(t4).manglename + "',runtimeCtx),'" + n3.operator + "'," + n3.prefix + ")";
  287. const o6 = { manglename: Me(e7), node: n3.argument };
  288. return e7.undeclaredGlobalsInFunctions.set(t4, o6), "lang.update(gscope, lang.chkAssig('" + o6.manglename + "',runtimeCtx),'" + n3.operator + "'," + n3.prefix + ")";
  289. }
  290. throw new t(e7, e.InvalidIdentifier, n3);
  291. }
  292. function X2(e7, n3) {
  293. let t4 = "lastStatement = lc.voidOperation; \n";
  294. const o5 = Fe(e7);
  295. return t4 += `
  296. var ${o5} = true;
  297. do {
  298. ${o5} = ${V2(e7, n3.test)};
  299. if (${o5}==false) {
  300. break;
  301. }
  302. if (${o5}!==true) {
  303. lang.error('${e.BooleanConditionRequired}');
  304. }
  305. ${V2(e7, n3.body)}
  306. }
  307. while (${o5} !== false);
  308. lastStatement = lc.voidOperation;
  309. `, t4;
  310. }
  311. function Z2(e7, n3) {
  312. const t4 = V2(e7, n3.right);
  313. let o5 = null, l6 = "";
  314. if ("MemberExpression" === n3.left.type)
  315. return o5 = V2(e7, n3.left.object), true === n3.left.computed ? l6 = V2(e7, n3.left.property) : (l6 = "'" + n3.left.property.name + "'", se2(n3.left.property.name)), "lang.assignmember(" + o5 + "," + l6 + ",'" + n3.operator + "'," + t4 + ")";
  316. if (o5 = n3.left.name.toLowerCase(), se2(o5), null !== e7.localScope) {
  317. if (void 0 !== e7.localScope[o5])
  318. return "lscope['" + o5 + "']=lang.assign(" + t4 + ",'" + n3.operator + "', lscope['" + o5 + "'])";
  319. if (void 0 !== e7.localScope._SymbolsMap[o5])
  320. return "lscope['" + e7.localScope._SymbolsMap[o5] + "']=lang.assign(" + t4 + ",'" + n3.operator + "', lscope['" + e7.localScope._SymbolsMap[o5] + "'])";
  321. }
  322. if (void 0 !== e7.globalScope[o5])
  323. return "gscope['" + o5 + "']=lang.assign(" + t4 + ",'" + n3.operator + "', gscope['" + o5 + "'])";
  324. if (void 0 !== e7.globalScope._SymbolsMap[o5])
  325. return "gscope['" + e7.globalScope._SymbolsMap[o5] + "']=lang.assign(" + t4 + ",'" + n3.operator + "', gscope['" + e7.globalScope._SymbolsMap[o5] + "'])";
  326. if (null !== e7.localScope) {
  327. if (e7.undeclaredGlobalsInFunctions.has(o5))
  328. return "gscope[lang.chkAssig('" + e7.undeclaredGlobalsInFunctions.get(o5).manglename + "',runtimeCtx)]=lang.assign(" + t4 + ",'" + n3.operator + "', gscope['" + e7.undeclaredGlobalsInFunctions.get(o5).manglename + "'])";
  329. const l7 = { manglename: Me(e7), node: n3.argument };
  330. return e7.undeclaredGlobalsInFunctions.set(o5, l7), "gscope[lang.chkAssig('" + l7.manglename + "',runtimeCtx)]=lang.assign(" + t4 + ",'" + n3.operator + "', gscope['" + l7.manglename + "'])";
  331. }
  332. throw new t(e7, e.InvalidIdentifier, n3);
  333. }
  334. function ee(e7, n3) {
  335. return "AssignmentExpression" === n3.expression.type ? "lastStatement = lc.voidOperation; " + V2(e7, n3.expression) + "; \n " : (n3.expression.type, "lastStatement = " + V2(e7, n3.expression) + "; ");
  336. }
  337. function ne(e7, n3) {
  338. return "BlockStatement" === n3.type ? V2(e7, n3) : "ReturnStatement" === n3.type || "BreakStatement" === n3.type || "ContinueStatement" === n3.type ? V2(e7, n3) + "; " : "UpdateExpression" === n3.type ? "lastStatement = " + V2(e7, n3) + "; " : "ExpressionStatement" === n3.type ? V2(e7, n3) : "ObjectExpression" === n3.type ? "lastStatement = " + V2(e7, n3) + "; " : V2(e7, n3) + "; ";
  339. }
  340. function te(e7, n3) {
  341. if ("AssignmentExpression" === n3.test.type || "UpdateExpression" === n3.test.type)
  342. throw new s(e7, e.BooleanConditionRequired, n3);
  343. return `if (lang.mustBoolean(${V2(e7, n3.test)}, runtimeCtx) === true) {
  344. ${ne(e7, n3.consequent)}
  345. } ` + (null !== n3.alternate ? "IfStatement" === n3.alternate.type ? " else " + te(e7, n3.alternate) : ` else {
  346. ${ne(e7, n3.alternate)}
  347. }
  348. ` : " else {\n lastStatement = lc.voidOperation;\n }\n");
  349. }
  350. function oe(e7, n3) {
  351. let t4 = "";
  352. for (let o5 = 0; o5 < n3.body.length; o5++)
  353. "EmptyStatement" !== n3.body[o5].type && ("ReturnStatement" === n3.body[o5].type || "BreakStatement" === n3.body[o5].type || "ContinueStatement" === n3.body[o5].type ? t4 += V2(e7, n3.body[o5]) + "; \n" : "UpdateExpression" === n3.body[o5].type || "ObjectExpression" === n3.body[o5].type ? t4 += "lastStatement = " + V2(e7, n3.body[o5]) + "; \n" : t4 += V2(e7, n3.body[o5]) + " \n");
  354. return t4;
  355. }
  356. function le(e7, n3) {
  357. if (null === n3.argument)
  358. return "return lc.voidOperation";
  359. return "return " + V2(e7, n3.argument);
  360. }
  361. function re2(e7, n3) {
  362. var _a;
  363. const t4 = n3.specifiers[0].local.name.toLowerCase();
  364. se2(t4);
  365. const o5 = (_a = e7.libraryResolver) == null ? void 0 : _a.loadLibrary(t4), l6 = Me(e7);
  366. void 0 === e7.moduleFactory[o5.uri] && (e7.moduleFactory[o5.uri] = De(o5.syntax, { interceptor: e7.interceptor, services: e7.services, moduleFactory: e7.moduleFactory, lrucache: e7.lrucache, libraryResolver: e7.libraryResolver, customfunctions: e7.customfunctions, vars: {} }, e7.isAsync)), e7.moduleFactoryMap[l6] = o5.uri;
  367. let r4 = "";
  368. if (r4 = e7.isAsync ? "(yield lang.loadModule('" + l6 + "', runtimeCtx) ); " : "lang.loadModule('" + l6 + "', runtimeCtx); ", void 0 !== e7.globalScope[t4])
  369. return "gscope['" + t4 + "']=" + r4;
  370. if (void 0 !== e7.globalScope._SymbolsMap[t4])
  371. return "gscope['" + e7.globalScope._SymbolsMap[t4] + "']=" + r4;
  372. let a3 = "";
  373. return e7.undeclaredGlobalsInFunctions.has(t4) ? (a3 = e7.undeclaredGlobalsInFunctions.get(t4).manglename, e7.undeclaredGlobalsInFunctions.delete(t4)) : a3 = Me(e7), e7.globalScope._SymbolsMap[t4] = a3, e7.mangleMap[t4] = a3, "gscope[lang.setAssig('" + a3 + "', runtimeCtx)]=" + r4;
  374. }
  375. function ae(e7, n3) {
  376. const t4 = V2(e7, n3.declaration);
  377. if ("FunctionDeclaration" === n3.declaration.type)
  378. e7.exports[n3.declaration.id.name.toLowerCase()] = "function";
  379. else if ("VariableDeclaration" === n3.declaration.type)
  380. for (const o5 of n3.declaration.declarations)
  381. e7.exports[o5.id.name.toLowerCase()] = "variable";
  382. return t4;
  383. }
  384. function se2(e7) {
  385. if ("iif" === e7)
  386. throw new c2();
  387. if ("decode" === e7)
  388. throw new c2();
  389. if ("when" === e7)
  390. throw new c2();
  391. }
  392. function ie(e7, n3) {
  393. const t4 = n3.id.name.toLowerCase();
  394. se2(t4);
  395. let o5 = "", l6 = false;
  396. void 0 !== e7.globalScope[t4] ? o5 = t4 : void 0 !== e7.globalScope._SymbolsMap[t4] ? o5 = e7.globalScope._SymbolsMap[t4] : e7.undeclaredGlobalsInFunctions.has(t4) ? (o5 = e7.undeclaredGlobalsInFunctions.get(t4).manglename, e7.globalScope._SymbolsMap[t4] = o5, e7.mangleMap[t4] = o5, e7.undeclaredGlobalsInFunctions.delete(t4), l6 = true) : (o5 = Me(e7), e7.globalScope._SymbolsMap[t4] = o5, e7.mangleMap[t4] = o5);
  397. const r4 = { isAsync: e7.isAsync, console: e7.console, exports: e7.exports, undeclaredGlobalsInFunctions: e7.undeclaredGlobalsInFunctions, customfunctions: e7.customfunctions, moduleFactory: e7.moduleFactory, moduleFactoryMap: e7.moduleFactoryMap, libraryResolver: e7.libraryResolver, lrucache: e7.lrucache, interceptor: e7.interceptor, services: e7.services, symbols: e7.symbols, mangleMap: e7.mangleMap, localScope: { _SymbolsMap: {} }, depthCounter: e7.depthCounter, globalScope: e7.globalScope };
  398. let a3 = "new lang.UserDefinedCompiledFunction( lang.functionDepthchecker(function() { var lastStatement = lc.voidOperation; \n var lscope = runtimeCtx.localStack[runtimeCtx.localStack.length-1];\n";
  399. for (let s9 = 0; s9 < n3.params.length; s9++) {
  400. const t5 = n3.params[s9].name.toLowerCase();
  401. se2(t5);
  402. const o6 = Me(e7);
  403. r4.localScope._SymbolsMap[t5] = o6, r4.mangleMap[t5] = o6, a3 += "lscope['" + o6 + "']=arguments[" + s9.toString() + "];\n";
  404. }
  405. return true === e7.isAsync ? (a3 += "return lang.__awaiter(this, void 0, void 0, function* () {\n", a3 += oe(r4, n3.body) + "\n return lastStatement; ", a3 += "}); }", a3 += ", runtimeCtx)," + n3.params.length + ")", a3 += "\n lastStatement = lc.voidOperation; \n") : (a3 += oe(r4, n3.body) + "\n return lastStatement; }, runtimeCtx)," + n3.params.length + ")", a3 += "\n lastStatement = lc.voidOperation; \n"), l6 ? "gscope[lang.setAssig('" + o5 + "', runtimeCtx)]=" + a3 : "gscope['" + o5 + "']=" + a3;
  406. }
  407. function ce(e7, n3) {
  408. const t4 = [];
  409. for (let o5 = 0; o5 < n3.declarations.length; o5++)
  410. t4.push(V2(e7, n3.declarations[o5]));
  411. return t4.join("\n") + " \n lastStatement= lc.voidOperation; \n";
  412. }
  413. function ue(e7, n3) {
  414. let t4 = null === n3.init ? null : V2(e7, n3.init);
  415. t4 === k2 && (t4 = null);
  416. const o5 = n3.id.name.toLowerCase();
  417. if (se2(o5), null !== e7.localScope) {
  418. if (void 0 !== e7.localScope[o5])
  419. return "lscope['" + o5 + "']=" + t4 + "; ";
  420. if (void 0 !== e7.localScope._SymbolsMap[o5])
  421. return "lscope['" + e7.localScope._SymbolsMap[o5] + "']=" + t4 + "; ";
  422. {
  423. const n4 = Me(e7);
  424. return e7.localScope._SymbolsMap[o5] = n4, e7.mangleMap[o5] = n4, "lscope['" + n4 + "']=" + t4 + "; ";
  425. }
  426. }
  427. if (void 0 !== e7.globalScope[o5])
  428. return "gscope['" + o5 + "']=" + t4 + "; ";
  429. if (void 0 !== e7.globalScope._SymbolsMap[o5])
  430. return "gscope['" + e7.globalScope._SymbolsMap[o5] + "']=" + t4 + "; ";
  431. if (e7.undeclaredGlobalsInFunctions.has(o5)) {
  432. const n4 = e7.undeclaredGlobalsInFunctions.get(o5).manglename;
  433. return e7.globalScope._SymbolsMap[o5] = n4, e7.mangleMap[o5] = n4, e7.undeclaredGlobalsInFunctions.delete(o5), "gscope[lang.setAssig('" + n4 + "', runtimeCtx)]=" + t4 + "; ";
  434. }
  435. const l6 = Me(e7);
  436. return e7.globalScope._SymbolsMap[o5] = l6, e7.mangleMap[o5] = l6, "gscope['" + l6 + "']=" + t4 + "; ";
  437. }
  438. function pe(e7, n3) {
  439. try {
  440. let t4;
  441. return true === n3.computed ? t4 = V2(e7, n3.property) : (t4 = "'" + n3.property.name + "'", se2(n3.property.name)), "lang.member(" + V2(e7, n3.object) + "," + t4 + ")";
  442. } catch (t4) {
  443. throw t4;
  444. }
  445. }
  446. function me(e7, n3) {
  447. try {
  448. return "lang.unary(" + V2(e7, n3.argument) + ",'" + n3.operator + "')";
  449. } catch (t4) {
  450. throw t4;
  451. }
  452. }
  453. function ge(e7, n3) {
  454. try {
  455. const t4 = [];
  456. for (let o5 = 0; o5 < n3.elements.length; o5++)
  457. "Literal" === n3.elements[o5].type ? t4.push(V2(e7, n3.elements[o5])) : t4.push("lang.aCheck(" + V2(e7, n3.elements[o5]) + ",'ArrayExpression')");
  458. return "[" + t4.join(",") + "]";
  459. } catch (t4) {
  460. throw t4;
  461. }
  462. }
  463. function de(e7, n3) {
  464. try {
  465. const t4 = [];
  466. let o5 = 0;
  467. for (const l6 of n3.quasis)
  468. t4.push(l6.value ? JSON.stringify(l6.value.cooked) : JSON.stringify("")), false === l6.tail && (t4.push(n3.expressions[o5] ? "lang.castString(lang.aCheck(" + V2(e7, n3.expressions[o5]) + ", 'TemplateLiteral'))" : ""), o5++);
  469. return "([" + t4.join(",") + "]).join('')";
  470. } catch (t4) {
  471. throw t4;
  472. }
  473. }
  474. function fe(e7, n3) {
  475. try {
  476. return "lang.binary(" + V2(e7, n3.left) + "," + V2(e7, n3.right) + ",'" + n3.operator + "')";
  477. } catch (t4) {
  478. throw t4;
  479. }
  480. }
  481. function he(e7, n3) {
  482. try {
  483. if ("AssignmentExpression" === n3.left.type || "UpdateExpression" === n3.left.type)
  484. throw new s(e7, e.LogicalExpressionOnlyBoolean, n3);
  485. if ("AssignmentExpression" === n3.right.type || "UpdateExpression" === n3.right.type)
  486. throw new s(e7, e.LogicalExpressionOnlyBoolean, n3);
  487. if ("&&" === n3.operator || "||" === n3.operator)
  488. return "(lang.logicalCheck(" + V2(e7, n3.left) + ") " + n3.operator + " lang.logicalCheck(" + V2(e7, n3.right) + "))";
  489. throw new s(null, e.LogicExpressionOrAnd, null);
  490. } catch (t4) {
  491. throw t4;
  492. }
  493. }
  494. function ye(e7, n3) {
  495. try {
  496. const t4 = n3.name.toLowerCase();
  497. if (se2(t4), null !== e7.localScope) {
  498. if (void 0 !== e7.localScope[t4])
  499. return "lscope['" + t4 + "']";
  500. if (void 0 !== e7.localScope._SymbolsMap[t4])
  501. return "lscope['" + e7.localScope._SymbolsMap[t4] + "']";
  502. }
  503. if (void 0 !== e7.globalScope[t4])
  504. return "gscope['" + t4 + "']";
  505. if (void 0 !== e7.globalScope._SymbolsMap[t4])
  506. return "gscope['" + e7.globalScope._SymbolsMap[t4] + "']";
  507. if (null !== e7.localScope) {
  508. if (e7.undeclaredGlobalsInFunctions.has(t4))
  509. return "gscope[lang.chkAssig('" + e7.undeclaredGlobalsInFunctions.get(t4).manglename + "',runtimeCtx)]";
  510. const o5 = { manglename: Me(e7), node: n3.argument };
  511. return e7.undeclaredGlobalsInFunctions.set(t4, o5), "gscope[lang.chkAssig('" + o5.manglename + "',runtimeCtx)]";
  512. }
  513. throw new s(e7, e.InvalidIdentifier, n3);
  514. } catch (t4) {
  515. throw t4;
  516. }
  517. }
  518. function be(e7, n3) {
  519. try {
  520. if ("MemberExpression" === n3.callee.type) {
  521. let t5;
  522. true === n3.callee.computed ? t5 = V2(e7, n3.callee.property) : (t5 = "'" + n3.callee.property.name + "'", se2(n3.callee.property.name));
  523. let o6 = "[";
  524. for (let l6 = 0; l6 < n3.arguments.length; l6++)
  525. l6 > 0 && (o6 += ", "), o6 += V2(e7, n3.arguments[l6]);
  526. return o6 += "]", e7.isAsync ? "(yield lang.callModuleFunction(" + V2(e7, n3.callee.object) + "," + o6 + "," + t5 + ",runtimeCtx))" : "lang.callModuleFunction(" + V2(e7, n3.callee.object) + "," + o6 + "," + t5 + ",runtimeCtx)";
  527. }
  528. if ("Identifier" !== n3.callee.type)
  529. throw new s(e7, e.FuncionNotFound, n3);
  530. const t4 = n3.callee.name.toLowerCase();
  531. if ("iif" === t4)
  532. return we(e7, n3);
  533. if ("when" === t4)
  534. return Se(e7, n3);
  535. if ("decode" === t4)
  536. return ve2(e7, n3);
  537. let o5 = "";
  538. if (null !== e7.localScope && (void 0 !== e7.localScope[t4] ? o5 = "lscope['" + t4 + "']" : void 0 !== e7.localScope._SymbolsMap[t4] && (o5 = "lscope['" + e7.localScope._SymbolsMap[t4] + "']")), "" === o5) {
  539. if (void 0 !== e7.globalScope[t4])
  540. o5 = "gscope['" + t4 + "']";
  541. else if (void 0 !== e7.globalScope._SymbolsMap[t4])
  542. o5 = "gscope['" + e7.globalScope._SymbolsMap[t4] + "']";
  543. else if (null !== e7.localScope)
  544. if (e7.undeclaredGlobalsInFunctions.has(t4))
  545. o5 = "gscope[lang.chkAssig('" + e7.undeclaredGlobalsInFunctions.get(t4).manglename + "',runtimeCtx)]";
  546. else {
  547. const l6 = { manglename: Me(e7), node: n3.argument };
  548. e7.undeclaredGlobalsInFunctions.set(t4, l6), o5 = "gscope[lang.chkAssig('" + l6.manglename + "',runtimeCtx)]";
  549. }
  550. }
  551. if ("" !== o5) {
  552. let t5 = "[";
  553. for (let o6 = 0; o6 < n3.arguments.length; o6++)
  554. o6 > 0 && (t5 += ", "), t5 += V2(e7, n3.arguments[o6]);
  555. return t5 += "]", e7.isAsync ? "(yield lang.callfunc(" + o5 + "," + t5 + ",runtimeCtx) )" : "lang.callfunc(" + o5 + "," + t5 + ",runtimeCtx)";
  556. }
  557. throw new s(e7, e.FuncionNotFound, n3);
  558. } catch (t4) {
  559. throw t4;
  560. }
  561. }
  562. function we(e7, n3) {
  563. try {
  564. if (3 !== n3.arguments.length)
  565. throw new s(e7, e.WrongNumberOfParameters, n3);
  566. const t4 = Fe(e7);
  567. return `${e7.isAsync ? "(yield (function() { \n return lang.__awaiter(this, void 0, void 0, function* () {" : "function() {"}
  568. var ${t4} = ${V2(e7, n3.arguments[0])};
  569. if (${t4} === true) {
  570. return ${V2(e7, n3.arguments[1])};
  571. }
  572. else if (${t4} === false) {
  573. return ${V2(e7, n3.arguments[2])};
  574. }
  575. else {
  576. lang.error('ExecutionErrorCodes.BooleanConditionRequired');
  577. }
  578. ${e7.isAsync ? "})}()))" : "}()"}`;
  579. } catch (t4) {
  580. throw t4;
  581. }
  582. }
  583. function Se(e7, n3) {
  584. try {
  585. if (n3.arguments.length < 3)
  586. throw new s(e7, e.WrongNumberOfParameters, n3);
  587. if (n3.arguments.length % 2 == 0)
  588. throw new s(e7, e.WrongNumberOfParameters, n3);
  589. const t4 = Fe(e7);
  590. let o5 = "var ";
  591. for (let l6 = 0; l6 < n3.arguments.length - 1; l6 += 2)
  592. o5 += `${t4} = lang.mustBoolean(${V2(e7, n3.arguments[l6])}, runtimeCtx);
  593. if (${t4} === true ) {
  594. return ${V2(e7, n3.arguments[l6 + 1])}
  595. }
  596. `;
  597. return `${e7.isAsync ? "(yield (function() { \n return lang.__awaiter(this, void 0, void 0, function* () {" : "function() {"}
  598. ${o5}
  599. return ${V2(e7, n3.arguments[n3.arguments.length - 1])}
  600. ${e7.isAsync ? "})}()))" : "}()"}`;
  601. } catch (t4) {
  602. throw t4;
  603. }
  604. }
  605. function ve2(e7, n3) {
  606. try {
  607. if (n3.arguments.length < 2)
  608. throw new s(e7, e.WrongNumberOfParameters, n3);
  609. if (2 === n3.arguments.length)
  610. return `(${V2(e7, n3.arguments[1])})`;
  611. if ((n3.arguments.length - 1) % 2 == 0)
  612. throw new s(e7, e.WrongNumberOfParameters, n3);
  613. const t4 = Fe(e7), o5 = Fe(e7);
  614. let l6 = "var ";
  615. for (let r4 = 1; r4 < n3.arguments.length - 1; r4 += 2)
  616. l6 += `${o5} = ${V2(e7, n3.arguments[r4])};
  617. if (lang.binary(${o5}, ${t4}, "==") === true ) {
  618. return ${V2(e7, n3.arguments[r4 + 1])}
  619. }
  620. `;
  621. return `${e7.isAsync ? "(yield (function() { \n return lang.__awaiter(this, void 0, void 0, function* () {" : "function() {"}
  622. var ${t4} = ${V2(e7, n3.arguments[0])};
  623. ${l6}
  624. return ${V2(e7, n3.arguments[n3.arguments.length - 1])}
  625. ${e7.isAsync ? "})}()))" : "}()"}`;
  626. } catch (t4) {
  627. throw t4;
  628. }
  629. }
  630. var xe = {};
  631. function Me(e7) {
  632. return e7.symbols.symbolCounter++, "_T" + e7.symbols.symbolCounter.toString();
  633. }
  634. function Fe(e7) {
  635. return e7.symbols.symbolCounter++, "_Tvar" + e7.symbols.symbolCounter.toString();
  636. }
  637. M(xe, W2), B(xe, W2), N2(xe, W2), C2(xe, W2), f(xe, W2), xe.iif = function(e7, n3) {
  638. try {
  639. return W2(e7, n3, (t4, o5, l6) => {
  640. throw new t(e7, e.Unrecognised, n3);
  641. });
  642. } catch (t4) {
  643. throw t4;
  644. }
  645. }, xe.decode = function(e7, n3) {
  646. try {
  647. return W2(e7, n3, (t4, o5, l6) => {
  648. throw new t(e7, e.Unrecognised, n3);
  649. });
  650. } catch (t4) {
  651. throw t4;
  652. }
  653. }, xe.when = function(e7, n3) {
  654. try {
  655. return W2(e7, n3, (t4, o5, l6) => {
  656. throw new t(e7, e.Unrecognised, n3);
  657. });
  658. } catch (t4) {
  659. throw t4;
  660. }
  661. };
  662. var Ce = {};
  663. for (const Pe in xe)
  664. Ce[Pe] = new e2(xe[Pe]);
  665. q(xe, W2);
  666. for (const Pe in xe)
  667. xe[Pe] = new e2(xe[Pe]);
  668. var Ie = function() {
  669. };
  670. Ie.prototype = xe;
  671. var Ae = function() {
  672. };
  673. function _e(e7, n3, t4) {
  674. const o5 = {};
  675. e7 || (e7 = {}), t4 || (t4 = {}), o5._SymbolsMap = {}, o5.textformatting = 1, o5.infinity = 1, o5.pi = 1;
  676. for (const l6 in n3)
  677. o5[l6] = 1;
  678. for (const l6 in t4)
  679. o5[l6] = 1;
  680. for (const l6 in e7)
  681. o5[l6] = 1;
  682. return o5;
  683. }
  684. function Oe(t4, o5, l6) {
  685. const r4 = l6 ? new Ae() : new Ie();
  686. t4 || (t4 = {}), o5 || (o5 = {});
  687. const a3 = new J2({ newline: "\n", tab: " ", singlequote: "'", doublequote: '"', forwardslash: "/", backwardslash: "\\" });
  688. a3.immutable = false, r4._SymbolsMap = { textformatting: 1, infinity: 1, pi: 1 }, r4.textformatting = a3, r4.infinity = Number.POSITIVE_INFINITY, r4.pi = Math.PI;
  689. for (const e7 in o5)
  690. r4[e7] = o5[e7], r4._SymbolsMap[e7] = 1;
  691. for (const e7 in t4)
  692. r4._SymbolsMap[e7] = 1, t4[e7] && "esri.Graphic" === t4[e7].declaredClass ? r4[e7] = g.createFromGraphic(t4[e7]) : r4[e7] = t4[e7];
  693. return r4;
  694. }
  695. Ae.prototype = Ce;
  696. function Ee(e7, n3) {
  697. const t4 = { mode: n3, compiled: true, functions: {}, signatures: [], standardFunction: W2, standardFunctionAsync: W2, evaluateIdentifier: Be };
  698. for (let o5 = 0; o5 < e7.length; o5++)
  699. e7[o5].registerFunctions(t4);
  700. if ("sync" === n3) {
  701. for (const e8 in t4.functions)
  702. xe[e8] = new e2(t4.functions[e8]), Ie.prototype[e8] = xe[e8];
  703. for (let e8 = 0; e8 < t4.signatures.length; e8++)
  704. o(t4.signatures[e8], "sync");
  705. } else {
  706. for (const e8 in t4.functions)
  707. Ce[e8] = new e2(t4.functions[e8]), Ae.prototype[e8] = Ce[e8];
  708. for (let e8 = 0; e8 < t4.signatures.length; e8++)
  709. o(t4.signatures[e8], "async");
  710. }
  711. }
  712. function Be(e7, n3) {
  713. const t4 = n3.name;
  714. if ("_SymbolsMap" === t4)
  715. throw new t(e7, e.InvalidIdentifier, null);
  716. if (e7.localStack.length > 0) {
  717. if ("_t" !== t4.substr(0, 2).toLowerCase() && void 0 !== e7.localStack[e7.localStack.length - 1][t4])
  718. return e7.localStack[e7.localStack.length - 1][t4];
  719. const n4 = e7.mangleMap[t4];
  720. if (void 0 !== n4 && void 0 !== e7.localStack[e7.localStack.length - 1][n4])
  721. return e7.localStack[e7.localStack.length - 1][n4];
  722. }
  723. if ("_t" !== t4.substr(0, 2).toLowerCase() && void 0 !== e7.globalScope[t4])
  724. return e7.globalScope[t4];
  725. if (1 === e7.globalScope._SymbolsMap[t4])
  726. return e7.globalScope[t4];
  727. const o5 = e7.mangleMap[t4];
  728. return void 0 !== o5 ? e7.globalScope[o5] : void 0;
  729. }
  730. Ee([m2], "sync"), Ee([m2], "async");
  731. var $e = 0;
  732. var je = { error(e7) {
  733. throw new t(null, e7, null);
  734. }, __awaiter: (e7, n3, t4, o5) => new Promise((t5, l6) => {
  735. function r4(e8) {
  736. try {
  737. s9(o5.next(e8));
  738. } catch (n4) {
  739. l6(n4);
  740. }
  741. }
  742. function a3(e8) {
  743. try {
  744. s9(o5.throw(e8));
  745. } catch (n4) {
  746. l6(n4);
  747. }
  748. }
  749. function s9(e8) {
  750. e8.done ? t5(e8.value) : e8.value && e8.value.then ? e8.value.then(r4, a3) : ($e++, $e % 100 == 0 ? setTimeout(() => {
  751. $e = 0, r4(e8.value);
  752. }, 0) : r4(e8.value));
  753. }
  754. s9((o5 = o5.apply(e7, n3 || [])).next());
  755. }), functionDepthchecker: (e7, n3) => function() {
  756. if (n3.depthCounter.depth++, n3.localStack.push([]), n3.depthCounter.depth > 64)
  757. throw new t(null, e.MaximumCallDepth, null);
  758. const t4 = e7.apply(this, arguments);
  759. return C(t4) ? t4.then((e8) => (n3.depthCounter.depth--, n3.localStack.length = n3.localStack.length - 1, e8)) : (n3.depthCounter.depth--, n3.localStack.length = n3.localStack.length - 1, t4);
  760. }, chkAssig(e7, n3) {
  761. if (void 0 === n3.gdefs[e7])
  762. throw new t(n3, e.InvalidIdentifier, null);
  763. return e7;
  764. }, mustBoolean(e7, n3) {
  765. if (true === e7 || false === e7)
  766. return e7;
  767. throw new t(n3, e.BooleanConditionRequired, null);
  768. }, setAssig: (e7, n3) => (n3.gdefs[e7] = 1, e7), castString: (e7) => K(e7), aCheck(e7, n3) {
  769. if (F(e7)) {
  770. if ("ArrayExpression" === n3)
  771. throw new t(null, e.NoFunctionInArray, null);
  772. if ("ObjectExpression" === n3)
  773. throw new t(null, e.NoFunctionInDictionary, null);
  774. throw new t(null, e.NoFunctionInTemplateLiteral, null);
  775. }
  776. return e7 === k2 ? null : e7;
  777. }, Dictionary: J2, Feature: g, UserDefinedCompiledFunction: T, dictionary(n3) {
  778. const o5 = {}, l6 = /* @__PURE__ */ new Map();
  779. for (let e7 = 0; e7 < n3.length; e7 += 2) {
  780. if (F(n3[e7 + 1]))
  781. throw new t(null, e.NoFunctionInDictionary, null);
  782. if (false === w3(n3[e7]))
  783. throw new t(null, e.KeyMustBeString, null);
  784. let r5 = n3[e7].toString();
  785. const s9 = r5.toLowerCase();
  786. l6.has(s9) ? r5 = l6.get(s9) : l6.set(s9, r5), n3[e7 + 1] === k2 ? o5[r5] = null : o5[r5] = n3[e7 + 1];
  787. }
  788. const r4 = new J2(o5);
  789. return r4.immutable = false, r4;
  790. }, strCheck(e7) {
  791. if (false === w3(e7))
  792. throw new t(null, e.KeyMustBeString, null);
  793. return e7;
  794. }, unary(e7, n3) {
  795. if (_(e7)) {
  796. if ("!" === n3)
  797. return !e7;
  798. if ("-" === n3)
  799. return -1 * re(e7);
  800. if ("+" === n3)
  801. return 1 * re(e7);
  802. if ("~" === n3)
  803. return ~re(e7);
  804. throw new t(null, e.UnsupportedUnaryOperator, null);
  805. }
  806. if ("-" === n3)
  807. return -1 * re(e7);
  808. if ("+" === n3)
  809. return 1 * re(e7);
  810. if ("~" === n3)
  811. return ~re(e7);
  812. throw new t(null, e.UnsupportedUnaryOperator, null);
  813. }, logicalCheck(e7) {
  814. if (false === _(e7))
  815. throw new t(null, e.LogicExpressionOrAnd, null);
  816. return e7;
  817. }, logical(e7, n3, t4) {
  818. if (_(e7) && _(n3))
  819. switch (t4) {
  820. case "||":
  821. return e7 || n3;
  822. case "&&":
  823. return e7 && n3;
  824. default:
  825. throw new t(null, e.LogicExpressionOrAnd, null);
  826. }
  827. throw new t(null, e.LogicExpressionOrAnd, null);
  828. }, binary(e7, n3, t4) {
  829. switch (t4) {
  830. case "|":
  831. case "<<":
  832. case ">>":
  833. case ">>>":
  834. case "^":
  835. case "&":
  836. return Ne(re(e7), re(n3), t4);
  837. case "==":
  838. case "=":
  839. return X(e7, n3);
  840. case "!=":
  841. return !X(e7, n3);
  842. case "<":
  843. case ">":
  844. case "<=":
  845. case ">=":
  846. return Q(e7, n3, t4);
  847. case "+":
  848. return w3(e7) || w3(n3) ? K(e7) + K(n3) : re(e7) + re(n3);
  849. case "-":
  850. return re(e7) - re(n3);
  851. case "*":
  852. return re(e7) * re(n3);
  853. case "/":
  854. return re(e7) / re(n3);
  855. case "%":
  856. return re(e7) % re(n3);
  857. default:
  858. throw new t(null, e.UnsupportedOperator, null);
  859. }
  860. }, assign(e7, n3, t4) {
  861. switch (n3) {
  862. case "=":
  863. return e7 === k2 ? null : e7;
  864. case "/=":
  865. return re(t4) / re(e7);
  866. case "*=":
  867. return re(t4) * re(e7);
  868. case "-=":
  869. return re(t4) - re(e7);
  870. case "+=":
  871. return w3(t4) || w3(e7) ? K(t4) + K(e7) : re(t4) + re(e7);
  872. case "%=":
  873. return re(t4) % re(e7);
  874. default:
  875. throw new t(null, e.UnsupportedOperator, null);
  876. }
  877. }, update(e7, n3, t4, o5) {
  878. const l6 = re(e7[n3]);
  879. return e7[n3] = "++" === t4 ? l6 + 1 : l6 - 1, false === o5 ? l6 : "++" === t4 ? l6 + 1 : l6 - 1;
  880. }, graphicToFeature: (e7, t4) => null === e7 ? null : g.createFromGraphicLikeObject(e7.geometry, e7.attributes, t4), memberupdate(n3, t4, o5, l6) {
  881. let r4;
  882. if (Y(n3)) {
  883. if (!Z(t4))
  884. throw new t(null, e.ArrayAccessorMustBeNumber, null);
  885. if (t4 < 0 && (t4 = n3.length + t4), t4 < 0 || t4 >= n3.length)
  886. throw new t(null, e.OutOfBounds, null);
  887. r4 = re(n3[t4]), n3[t4] = "++" === o5 ? r4 + 1 : r4 - 1;
  888. } else if (n3 instanceof J2) {
  889. if (false === w3(t4))
  890. throw new t(null, e.KeyAccessorMustBeString, null);
  891. if (true !== n3.hasField(t4))
  892. throw new t(null, e.FieldNotFound, null, { key: t4 });
  893. r4 = re(n3.field(t4)), n3.setField(t4, "++" === o5 ? r4 + 1 : r4 - 1);
  894. } else if (J(n3)) {
  895. if (false === w3(t4))
  896. throw new t(null, e.KeyAccessorMustBeString, null);
  897. if (true !== n3.hasField(t4))
  898. throw new t(null, e.FieldNotFound, null);
  899. r4 = re(n3.field(t4)), n3.setField(t4, "++" === o5 ? r4 + 1 : r4 - 1);
  900. } else {
  901. if (E(n3))
  902. throw new t(null, e.Immutable, null);
  903. if (!(n3 instanceof Ue))
  904. throw new t(null, e.InvalidIdentifier, null);
  905. if (false === w3(t4))
  906. throw new t(null, e.ModuleAccessorMustBeString, null);
  907. if (true !== n3.hasGlobal(t4))
  908. throw new t(null, e.ModuleExportNotFound, null);
  909. r4 = re(n3.global(t4)), n3.setGlobal(t4, "++" === o5 ? r4 + 1 : r4 - 1);
  910. }
  911. return false === l6 ? r4 : "++" === o5 ? r4 + 1 : r4 - 1;
  912. }, assignmember(n3, t4, o5, l6) {
  913. if (Y(n3)) {
  914. if (!Z(t4))
  915. throw new t(null, e.ArrayAccessorMustBeNumber, null);
  916. if (t4 < 0 && (t4 = n3.length + t4), t4 < 0 || t4 > n3.length)
  917. throw new t(null, e.OutOfBounds, null);
  918. if (t4 === n3.length) {
  919. if ("=" !== o5)
  920. throw new t(null, e.OutOfBounds, null);
  921. n3[t4] = this.assign(l6, o5, n3[t4]);
  922. } else
  923. n3[t4] = this.assign(l6, o5, n3[t4]);
  924. } else if (n3 instanceof J2) {
  925. if (false === w3(t4))
  926. throw new t(null, e.KeyAccessorMustBeString, null);
  927. if (true === n3.hasField(t4))
  928. n3.setField(t4, this.assign(l6, o5, n3.field(t4)));
  929. else {
  930. if ("=" !== o5)
  931. throw new t(null, e.FieldNotFound, null);
  932. n3.setField(t4, this.assign(l6, o5, null));
  933. }
  934. } else if (J(n3)) {
  935. if (false === w3(t4))
  936. throw new t(null, e.KeyAccessorMustBeString, null);
  937. if (true === n3.hasField(t4))
  938. n3.setField(t4, this.assign(l6, o5, n3.field(t4)));
  939. else {
  940. if ("=" !== o5)
  941. throw new t(null, e.FieldNotFound, null);
  942. n3.setField(t4, this.assign(l6, o5, null));
  943. }
  944. } else {
  945. if (E(n3))
  946. throw new t(null, e.Immutable, null);
  947. if (!(n3 instanceof Ue))
  948. throw new t(null, e.InvalidIdentifier, null);
  949. if (false === w3(t4))
  950. throw new t(null, e.ModuleAccessorMustBeString, null);
  951. if (!n3.hasGlobal(t4))
  952. throw new t(null, e.ModuleExportNotFound, null);
  953. n3.setGlobal(t4, this.assign(l6, o5, n3.global(t4)));
  954. }
  955. }, member(n3, t4) {
  956. if (null === n3)
  957. throw new t(null, e.MemberOfNull, null);
  958. if (n3 instanceof J2 || J(n3)) {
  959. if (w3(t4))
  960. return n3.field(t4);
  961. throw new t(null, e.InvalidMemberAccessKey, null);
  962. }
  963. if (n3 instanceof p) {
  964. if (w3(t4))
  965. return W(n3, t4, null, null);
  966. throw new t(null, e.InvalidMemberAccessKey, null);
  967. }
  968. if (Y(n3)) {
  969. if (Z(t4) && isFinite(t4) && Math.floor(t4) === t4) {
  970. if (t4 < 0 && (t4 = n3.length + t4), t4 >= n3.length || t4 < 0)
  971. throw new t(null, e.OutOfBounds, null);
  972. return n3[t4];
  973. }
  974. throw new t(null, e.InvalidMemberAccessKey, null);
  975. }
  976. if (w3(n3)) {
  977. if (Z(t4) && isFinite(t4) && Math.floor(t4) === t4) {
  978. if (t4 < 0 && (t4 = n3.length + t4), t4 >= n3.length || t4 < 0)
  979. throw new t(null, e.OutOfBounds, null);
  980. return n3[t4];
  981. }
  982. throw new t(null, e.InvalidMemberAccessKey, null);
  983. }
  984. if (E(n3)) {
  985. if (Z(t4) && isFinite(t4) && Math.floor(t4) === t4) {
  986. if (t4 < 0 && (t4 = n3.length() + t4), t4 >= n3.length() || t4 < 0)
  987. throw new t(null, e.OutOfBounds, null);
  988. return n3.get(t4);
  989. }
  990. throw new t(null, e.InvalidMemberAccessKey, null);
  991. }
  992. if (n3 instanceof Ue) {
  993. if (w3(t4))
  994. return n3.global(t4);
  995. throw new t(null, e.InvalidMemberAccessKey, null);
  996. }
  997. throw new t(null, e.InvalidMemberAccessKey, null);
  998. }, callfunc: (e7, n3, t4) => e7.call(t4, { arguments: n3, preparsed: true }), loadModule(e7, n3) {
  999. const t4 = n3.moduleFactoryMap[e7];
  1000. if (n3.moduleSingletons[t4])
  1001. return n3.moduleSingletons[t4];
  1002. const o5 = n3.moduleFactory[t4]({ vars: {}, moduleSingletons: n3.moduleSingletons, depthCounter: n3.depthCounter, console: n3.console, abortSignal: n3.abortSignal, isAsync: n3.isAsync, services: n3.services, lrucache: n3.lrucache, interceptor: n3.interceptor }, n3.spatialReference);
  1003. return n3.moduleSingletons[t4] = o5, o5;
  1004. }, callModuleFunction(e7, n3, o5, l6) {
  1005. if (!(e7 instanceof Ue))
  1006. throw new t(null, e.FuncionNotFound, null);
  1007. const r4 = e7.global(o5);
  1008. if (false === F(r4))
  1009. throw new t(null, e.CallNonFunction, null);
  1010. return r4.call(l6, { preparsed: true, arguments: n3 });
  1011. } };
  1012. function Ne2(e7) {
  1013. console.log(e7);
  1014. }
  1015. function Le(e7, n3, c5 = false) {
  1016. null === n3 && (n3 = { vars: {}, customfunctions: {} });
  1017. let u7 = null;
  1018. e7.usesModules && (u7 = new s4(null, e7.loadedModules));
  1019. const p5 = { isAsync: c5, globalScope: _e(n3.vars, c5 ? Ce : xe, n3.customfunctions), moduleFactory: {}, moduleFactoryMap: {}, undeclaredGlobalsInFunctions: /* @__PURE__ */ new Map(), customfunctions: n3.customfunctions, libraryResolver: u7, localScope: null, mangleMap: {}, depthCounter: { depth: 1 }, exports: {}, console: Ne2, lrucache: n3.lrucache, interceptor: n3.interceptor, services: n3.services, symbols: { symbolCounter: 0 } };
  1020. let m5 = V2(p5, e7);
  1021. "" === m5 && (m5 = "lc.voidOperation; "), p5.undeclaredGlobalsInFunctions.size > 0 && p5.undeclaredGlobalsInFunctions.forEach((e8) => {
  1022. throw new s(n3, e.InvalidIdentifier, e8.node);
  1023. });
  1024. let g5 = "";
  1025. g5 = c5 ? "var runtimeCtx=this.prepare(context, true);\n var lc = this.lc; var lang = this.lang; var gscope=runtimeCtx.globalScope; \nreturn lang.__awaiter(this, void 0, void 0, function* () {\n\n function mainBody() {\n var lastStatement=lc.voidOperation;\n return lang.__awaiter(this, void 0, void 0, function* () {\n" + m5 + "\n return lastStatement; }); } \n return this.postProcess(yield mainBody()); }); " : "var runtimeCtx=this.prepare(context, false);\n var lc = this.lc; var lang = this.lang; var gscope=runtimeCtx.globalScope; \n function mainBody() {\n var lastStatement=lc.voidOperation;\n " + m5 + "\n return lastStatement; } \n return this.postProcess(mainBody()); ";
  1026. const d5 = p5.moduleFactory, f3 = p5.moduleFactoryMap, h3 = p5.exports, y5 = {};
  1027. for (const t4 in h3)
  1028. y5[t4] = void 0 !== p5.mangleMap[t4] ? p5.mangleMap[t4] : t4;
  1029. const b3 = { lc: ve, lang: je, mangles: p5.mangleMap, postProcess(e8) {
  1030. if (e8 instanceof D && (e8 = e8.value), e8 instanceof N && (e8 = e8.value), e8 === k2 && (e8 = null), e8 === j)
  1031. throw new t(null, e.IllegalResult, null);
  1032. if (e8 === A)
  1033. throw new t(null, e.IllegalResult, null);
  1034. if (F(e8))
  1035. throw new t(null, e.IllegalResult, null);
  1036. return e8;
  1037. }, prepare(e8, n4) {
  1038. let t4 = e8.spatialReference;
  1039. null == t4 && (t4 = k.WebMercator);
  1040. const o5 = Oe(e8.vars, e8.customfunctions, n4);
  1041. return { localStack: [], isAsync: n4, moduleFactory: d5, moduleFactoryMap: f3, mangleMap: this.mangles, moduleSingletons: {}, exports: h3, gdefs: {}, exportmangle: y5, spatialReference: t4, globalScope: o5, abortSignal: void 0 === e8.abortSignal || null === e8.abortSignal ? { aborted: false } : e8.abortSignal, localScope: null, services: e8.services, console: e8.console ? e8.console : Ne2, lrucache: e8.lrucache, interceptor: e8.interceptor, symbols: { symbolCounter: 0 }, depthCounter: { depth: 1 } };
  1042. } };
  1043. return new Function("context", "spatialReference", g5).bind(b3);
  1044. }
  1045. async function Re() {
  1046. return Ee([await import("./geomasync-CXA76SKZ.js")], "async"), true;
  1047. }
  1048. var Ue = class extends s3 {
  1049. constructor(e7) {
  1050. super(null), this.moduleContext = e7;
  1051. }
  1052. hasGlobal(e7) {
  1053. return void 0 === this.moduleContext.exports[e7] && (e7 = e7.toLowerCase()), void 0 !== this.moduleContext.exports[e7];
  1054. }
  1055. setGlobal(e7, n3) {
  1056. const o5 = this.moduleContext.globalScope, l6 = e7.toLowerCase();
  1057. if (F(n3))
  1058. throw new t(null, e.AssignModuleFunction, null);
  1059. o5[this.moduleContext.exportmangle[l6]] = n3;
  1060. }
  1061. global(e7) {
  1062. const n3 = this.moduleContext.globalScope;
  1063. e7 = e7.toLowerCase();
  1064. const o5 = n3[this.moduleContext.exportmangle[e7]];
  1065. if (void 0 === o5)
  1066. throw new t(null, e.InvalidIdentifier, null);
  1067. if (F(o5) && !(o5 instanceof s2)) {
  1068. const t4 = new s2();
  1069. return t4.fn = o5, t4.parameterEvaluator = W2, t4.context = this.moduleContext, n3[this.moduleContext.exportmangle[e7]] = t4, t4;
  1070. }
  1071. return o5;
  1072. }
  1073. };
  1074. function De(e7, n3, t4 = false) {
  1075. const l6 = { isAsync: t4, moduleFactory: n3.moduleFactory, moduleFactoryMap: {}, libraryResolver: new s4(null, e7.loadedModules), globalScope: _e(n3.vars, t4 ? Ce : xe, n3.customfunctions), customfunctions: n3.customfunctions, localScope: null, mangleMap: {}, undeclaredGlobalsInFunctions: /* @__PURE__ */ new Map(), depthCounter: { depth: 1 }, exports: {}, console: Ne2, lrucache: n3.lrucache, interceptor: n3.interceptor, services: n3.services, symbols: { symbolCounter: 0 } };
  1076. let r4 = V2(l6, e7);
  1077. "" === r4 && (r4 = "lc.voidOperation; ");
  1078. let a3 = "";
  1079. a3 = t4 ? "var runtimeCtx=this.prepare(context, true);\n var lc = this.lc; var lang = this.lang; var gscope=runtimeCtx.globalScope; \nreturn lang.__awaiter(this, void 0, void 0, function* () {\n\n function mainBody() {\n var lastStatement=lc.voidOperation;\n return lang.__awaiter(this, void 0, void 0, function* () {\n" + r4 + "\n return lastStatement; }); } \n yield mainBody(); \n return this.prepareModule(runtimeCtx); }); " : "var runtimeCtx=this.prepare(context, false);\n var lc = this.lc; var lang = this.lang; var gscope=runtimeCtx.globalScope; \n function mainBody() {\n var lastStatement=lc.voidOperation;\n " + r4 + "\n return lastStatement; } \n mainBody(); \n return this.prepareModule(runtimeCtx); ";
  1080. const s9 = l6.moduleFactory, i3 = l6.moduleFactoryMap, c5 = l6.exports, u7 = {};
  1081. for (const o5 in c5)
  1082. u7[o5] = void 0 !== l6.mangleMap[o5] ? l6.mangleMap[o5] : o5;
  1083. const p5 = { lc: ve, lang: je, mangles: l6.mangleMap, prepareModule: (e8) => new Ue(e8), prepare(e8, n4) {
  1084. let t5 = e8.spatialReference;
  1085. null == t5 && (t5 = new k({ wkid: 102100 }));
  1086. const o5 = Oe(e8.vars, e8.customfunctions, n4);
  1087. return { localStack: [], isAsync: n4, exports: c5, exportmangle: u7, gdefs: {}, moduleFactory: s9, moduleFactoryMap: i3, moduleSingletons: e8.moduleSingletons, mangleMap: this.mangles, spatialReference: t5, globalScope: o5, abortSignal: void 0 === e8.abortSignal || null === e8.abortSignal ? { aborted: false } : e8.abortSignal, localScope: null, services: e8.services, console: e8.console ? e8.console : Ne2, lrucache: e8.lrucache, interceptor: e8.interceptor, symbols: { symbolCounter: 0 }, depthCounter: e8.depthCounter };
  1088. } };
  1089. return new Function("context", "spatialReference", a3).bind(p5);
  1090. }
  1091. // node_modules/@arcgis/core/arcade/lib/types.js
  1092. var e4;
  1093. !function(e7) {
  1094. e7.AssignmentExpression = "AssignmentExpression", e7.ArrayExpression = "ArrayExpression", e7.BlockComment = "BlockComment", e7.BlockStatement = "BlockStatement", e7.BinaryExpression = "BinaryExpression", e7.BreakStatement = "BreakStatement", e7.CallExpression = "CallExpression", e7.ContinueStatement = "ContinueStatement", e7.EmptyStatement = "EmptyStatement", e7.ExpressionStatement = "ExpressionStatement", e7.ExportNamedDeclaration = "ExportNamedDeclaration", e7.ExportSpecifier = "ExportSpecifier", e7.ForStatement = "ForStatement", e7.ForInStatement = "ForInStatement", e7.FunctionDeclaration = "FunctionDeclaration", e7.Identifier = "Identifier", e7.IfStatement = "IfStatement", e7.ImportDeclaration = "ImportDeclaration", e7.ImportDefaultSpecifier = "ImportDefaultSpecifier", e7.LineComment = "LineComment", e7.Literal = "Literal", e7.LogicalExpression = "LogicalExpression", e7.MemberExpression = "MemberExpression", e7.ObjectExpression = "ObjectExpression", e7.Program = "Program", e7.Property = "Property", e7.ReturnStatement = "ReturnStatement", e7.TemplateElement = "TemplateElement", e7.TemplateLiteral = "TemplateLiteral", e7.UnaryExpression = "UnaryExpression", e7.UpdateExpression = "UpdateExpression", e7.VariableDeclaration = "VariableDeclaration", e7.VariableDeclarator = "VariableDeclarator", e7.WhileStatement = "WhileStatement";
  1095. }(e4 || (e4 = {}));
  1096. var t2 = ["++", "--"];
  1097. var n2 = ["-", "+", "!", "~"];
  1098. var i = ["=", "/=", "*=", "%=", "+=", "-="];
  1099. var r2 = ["||", "&&"];
  1100. var a = ["|", "&", ">>", "<<", ">>>", "^", "==", "!=", "<", "<=", ">", ">=", "+", "-", "*", "/", "%"];
  1101. var o2 = { "||": 1, "&&": 2, "|": 3, "^": 4, "&": 5, "==": 6, "!=": 6, "<": 7, ">": 7, "<=": 7, ">=": 7, "<<": 8, ">>": 8, ">>>": 8, "+": 9, "-": 9, "*": 10, "/": 10, "%": 10 };
  1102. var c4;
  1103. !function(e7) {
  1104. e7[e7.Unknown = 0] = "Unknown", e7[e7.BooleanLiteral = 1] = "BooleanLiteral", e7[e7.EOF = 2] = "EOF", e7[e7.Identifier = 3] = "Identifier", e7[e7.Keyword = 4] = "Keyword", e7[e7.NullLiteral = 5] = "NullLiteral", e7[e7.NumericLiteral = 6] = "NumericLiteral", e7[e7.Punctuator = 7] = "Punctuator", e7[e7.StringLiteral = 8] = "StringLiteral", e7[e7.Template = 10] = "Template";
  1105. }(c4 || (c4 = {}));
  1106. var s5 = ["Unknown", "Boolean", "<end>", "Identifier", "Keyword", "Null", "Numeric", "Punctuator", "String", "RegularExpression", "Template"];
  1107. var l3;
  1108. !function(e7) {
  1109. e7.InvalidModuleUri = "InvalidModuleUri", e7.ForInOfLoopInitializer = "ForInOfLoopInitializer", e7.IdentiferExpected = "IdentiferExpected", e7.InvalidEscapedReservedWord = "InvalidEscapedReservedWord", e7.InvalidExpression = "InvalidExpression", e7.InvalidFunctionIdentifier = "InvalidFunctionIdentifier", e7.InvalidHexEscapeSequence = "InvalidHexEscapeSequence", e7.InvalidLeftHandSideInAssignment = "InvalidLeftHandSideInAssignment", e7.InvalidLeftHandSideInForIn = "InvalidLeftHandSideInForIn", e7.InvalidTemplateHead = "InvalidTemplateHead", e7.InvalidVariableAssignment = "InvalidVariableAssignment", e7.KeyMustBeString = "KeyMustBeString", e7.NoFunctionInsideBlock = "NoFunctionInsideBlock", e7.NoFunctionInsideFunction = "NoFunctionInsideFunction", e7.ModuleExportRootOnly = "ModuleExportRootOnly", e7.ModuleImportRootOnly = "ModuleImportRootOnly", e7.PunctuatorExpected = "PunctuatorExpected", e7.TemplateOctalLiteral = "TemplateOctalLiteral", e7.UnexpectedEndOfScript = "UnexpectedEndOfScript", e7.UnexpectedIdentifier = "UnexpectedIdentifier", e7.UnexpectedNumber = "UnexpectedNumber", e7.UnexpectedString = "UnexpectedString", e7.UnexpectedTemplate = "UnexpectedTemplate", e7.UnexpectedToken = "UnexpectedToken";
  1110. }(l3 || (l3 = {}));
  1111. var p4 = { [l3.InvalidModuleUri]: "Module uri must be a string literal", [l3.ForInOfLoopInitializer]: "for-in loop variable declaration may not have an initializer", [l3.IdentiferExpected]: "Identifier expected", [l3.InvalidEscapedReservedWord]: "Keyword cannot contain escaped characters", [l3.InvalidExpression]: "Invalid expression", [l3.InvalidFunctionIdentifier]: "Invalid function identifier", [l3.InvalidHexEscapeSequence]: "Invalid hexadecimal escape sequence", [l3.InvalidLeftHandSideInAssignment]: "Invalid left-hand side in assignment", [l3.InvalidLeftHandSideInForIn]: "Invalid left-hand side in for-in", [l3.InvalidTemplateHead]: "Invalid template structure", [l3.InvalidVariableAssignment]: "Invalid variable assignment", [l3.KeyMustBeString]: "Object keys must be a string", [l3.NoFunctionInsideBlock]: "Functions cannot be declared inside of code blocks", [l3.NoFunctionInsideFunction]: "Functions cannot be declared inside another function", [l3.ModuleExportRootOnly]: "Module exports cannot be declared inside of code blocks", [l3.ModuleImportRootOnly]: "Module import cannot be declared inside of code blocks", [l3.PunctuatorExpected]: "'${value}' expected", [l3.TemplateOctalLiteral]: "Octal literals are not allowed in template strings.", [l3.UnexpectedEndOfScript]: "Unexpected end of script", [l3.UnexpectedIdentifier]: "Unexpected identifier", [l3.UnexpectedNumber]: "Unexpected number", [l3.UnexpectedString]: "Unexpected string", [l3.UnexpectedTemplate]: "Unexpected quasi '${value}'", [l3.UnexpectedToken]: "Unexpected token" };
  1112. var d2 = class extends Error {
  1113. constructor({ code: e7, index: t4, line: n3, column: i3, len: r4 = 0, description: a3, data: o5 }) {
  1114. var _a;
  1115. super(`${a3 != null ? a3 : e7}`), this.declaredRootClass = "esri.arcade.lib.parsingerror", this.name = "ParsingError", this.code = e7, this.index = t4, this.line = n3, this.column = i3, this.len = r4, this.data = o5, this.description = a3, this.range = { start: { line: n3, column: i3 - 1 }, end: { line: n3, column: i3 + r4 } }, (_a = Error.captureStackTrace) == null ? void 0 : _a.call(Error, this, d2);
  1116. }
  1117. };
  1118. function u4(t4) {
  1119. return (t4 == null ? void 0 : t4.type) === e4.Program;
  1120. }
  1121. function x2(t4) {
  1122. return (t4 == null ? void 0 : t4.type) === e4.BlockStatement;
  1123. }
  1124. function I(t4) {
  1125. return (t4 == null ? void 0 : t4.type) === e4.BlockComment;
  1126. }
  1127. function y3(t4) {
  1128. return (t4 == null ? void 0 : t4.type) === e4.EmptyStatement;
  1129. }
  1130. function w4(t4) {
  1131. return (t4 == null ? void 0 : t4.type) === e4.VariableDeclarator;
  1132. }
  1133. // node_modules/@arcgis/core/arcade/lib/comment-handler.js
  1134. function i2(t4, n3) {
  1135. return !!n3 && (n3.loc.end.line === t4.loc.start.line && n3.loc.end.column <= t4.loc.start.column);
  1136. }
  1137. function m3(t4, n3) {
  1138. return t4.range[0] >= n3.range[0] && t4.range[1] <= n3.range[1];
  1139. }
  1140. var o3 = class {
  1141. constructor() {
  1142. this.comments = [], this._nodeStack = [], this._newComments = [];
  1143. }
  1144. insertInnerComments(n3) {
  1145. if (!x2(n3) || 0 !== n3.body.length)
  1146. return;
  1147. const e7 = [];
  1148. for (let t4 = this._newComments.length - 1; t4 >= 0; --t4) {
  1149. const s9 = this._newComments[t4];
  1150. n3.range[1] >= s9.range[0] && (e7.unshift(s9), this._newComments.splice(t4, 1));
  1151. }
  1152. e7.length && (n3.innerComments = e7);
  1153. }
  1154. attachTrailingComments(n3) {
  1155. var _a, _b;
  1156. if (!n3)
  1157. return;
  1158. const e7 = this._nodeStack[this._nodeStack.length - 1];
  1159. if (x2(n3) && m3(e7, n3))
  1160. for (let t4 = this._newComments.length - 1; t4 >= 0; --t4) {
  1161. const s10 = this._newComments[t4];
  1162. m3(s10, n3) && (e7.trailingComments = [...(_a = e7.trailingComments) != null ? _a : [], s10], this._newComments.splice(t4, 1));
  1163. }
  1164. let s9 = [];
  1165. if (this._newComments.length > 0)
  1166. for (let t4 = this._newComments.length - 1; t4 >= 0; --t4) {
  1167. const m5 = this._newComments[t4];
  1168. i2(m5, e7) ? (e7.trailingComments = [...(_b = e7.trailingComments) != null ? _b : [], m5], this._newComments.splice(t4, 1)) : i2(m5, n3) && (s9.unshift(m5), this._newComments.splice(t4, 1));
  1169. }
  1170. if (e7 == null ? void 0 : e7.trailingComments) {
  1171. i2(e7.trailingComments[0], n3) && (s9 = [...s9, ...e7.trailingComments], delete e7.trailingComments);
  1172. }
  1173. s9.length > 0 && (n3.trailingComments = s9);
  1174. }
  1175. attachLeadingComments(t4) {
  1176. var _a, _b, _c, _d;
  1177. if (!t4)
  1178. return;
  1179. let s9;
  1180. for (; this._nodeStack.length > 0; ) {
  1181. const n3 = this._nodeStack[this._nodeStack.length - 1];
  1182. if (!(t4.range[0] <= n3.range[0]))
  1183. break;
  1184. s9 = n3, this._nodeStack.pop();
  1185. }
  1186. const i3 = [], m5 = [];
  1187. if (s9) {
  1188. for (let o5 = ((_b = (_a = s9.leadingComments) == null ? void 0 : _a.length) != null ? _b : 0) - 1; o5 >= 0; --o5) {
  1189. const l6 = s9.leadingComments[o5];
  1190. t4.range[0] >= l6.range[1] ? (i3.unshift(l6), s9.leadingComments.splice(o5, 1)) : w4(t4) && !I(l6) && (m5.unshift(l6), s9.leadingComments.splice(o5, 1));
  1191. }
  1192. return 0 === ((_c = s9.leadingComments) == null ? void 0 : _c.length) && delete s9.leadingComments, i3.length && (t4.leadingComments = i3), void (m5.length && (t4.trailingComments = [...m5, ...(_d = t4.trailingComments) != null ? _d : []]));
  1193. }
  1194. for (let n3 = this._newComments.length - 1; n3 >= 0; --n3) {
  1195. const e7 = this._newComments[n3];
  1196. t4.range[0] >= e7.range[0] && (i3.unshift(e7), this._newComments.splice(n3, 1));
  1197. }
  1198. i3.length && (t4.leadingComments = i3);
  1199. }
  1200. attachComments(t4) {
  1201. var _a;
  1202. if (u4(t4) && t4.body.length > 0) {
  1203. const n3 = this._nodeStack[this._nodeStack.length - 1];
  1204. return n3 ? (n3.trailingComments = [...(_a = n3.trailingComments) != null ? _a : [], ...this._newComments], this._newComments.length = 0, void this._nodeStack.pop()) : (t4.trailingComments = [...this._newComments], void (this._newComments.length = 0));
  1205. }
  1206. this.attachTrailingComments(t4), this.attachLeadingComments(t4), this.insertInnerComments(t4), this._nodeStack.push(t4);
  1207. }
  1208. collectComment(t4) {
  1209. this.comments.push(t4), this._newComments.push(t4);
  1210. }
  1211. };
  1212. // node_modules/@arcgis/core/arcade/lib/error-handler.js
  1213. function o4(t4, o5) {
  1214. const e7 = p4[t4];
  1215. return o5 ? e7.replace(/\${(.*?)}/g, (r4, t5) => {
  1216. var _a, _b;
  1217. return (_b = (_a = o5[t5]) == null ? void 0 : _a.toString()) != null ? _b : "";
  1218. }) : e7;
  1219. }
  1220. var e5 = class {
  1221. constructor(r4 = false) {
  1222. this.tolerant = r4, this.errors = [];
  1223. }
  1224. recordError(r4) {
  1225. this.errors.push(r4);
  1226. }
  1227. tolerate(r4) {
  1228. if (!this.tolerant)
  1229. throw r4;
  1230. this.recordError(r4);
  1231. }
  1232. throwError(r4) {
  1233. var _a;
  1234. throw r4.description = (_a = r4.description) != null ? _a : o4(r4.code, r4.data), new d2(r4);
  1235. }
  1236. tolerateError(r4) {
  1237. var _a;
  1238. r4.description = (_a = r4.description) != null ? _a : o4(r4.code, r4.data);
  1239. const e7 = new d2(r4);
  1240. if (!this.tolerant)
  1241. throw e7;
  1242. this.recordError(e7);
  1243. }
  1244. };
  1245. // node_modules/@arcgis/core/arcade/lib/assert.js
  1246. function r3(r4, o5) {
  1247. if (!r4)
  1248. throw new Error("ASSERT: " + o5);
  1249. }
  1250. // node_modules/@arcgis/core/arcade/lib/character.js
  1251. var u5 = { NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7C6\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB67\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDEC0-\uDEEB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/, NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05EF-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u07FD\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D3-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u09FE\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CD0-\u1CD2\u1CD4-\u1CFA\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7C6\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB67\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD27\uDD30-\uDD39\uDF00-\uDF1C\uDF27\uDF30-\uDF50\uDFE0-\uDFF6]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD44-\uDD46\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDC9-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3B-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC5E\uDC5F\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDC00-\uDC3A\uDCA0-\uDCE9\uDCFF\uDDA0-\uDDA7\uDDAA-\uDDD7\uDDDA-\uDDE1\uDDE3\uDDE4\uDE00-\uDE3E\uDE47\uDE50-\uDE99\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD8E\uDD90\uDD91\uDD93-\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF4F-\uDF87\uDF8F-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD00-\uDD2C\uDD30-\uDD3D\uDD40-\uDD49\uDD4E\uDEC0-\uDEF9]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4B\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/ };
  1252. var D2 = { fromCodePoint: (u7) => u7 < 65536 ? String.fromCharCode(u7) : String.fromCharCode(55296 + (u7 - 65536 >> 10)) + String.fromCharCode(56320 + (u7 - 65536 & 1023)), isWhiteSpace: (u7) => 32 === u7 || 9 === u7 || 11 === u7 || 12 === u7 || 160 === u7 || u7 >= 5760 && [5760, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8239, 8287, 12288, 65279].includes(u7), isLineTerminator: (u7) => 10 === u7 || 13 === u7 || 8232 === u7 || 8233 === u7, isIdentifierStart: (F4) => 36 === F4 || 95 === F4 || F4 >= 65 && F4 <= 90 || F4 >= 97 && F4 <= 122 || 92 === F4 || F4 >= 128 && u5.NonAsciiIdentifierStart.test(D2.fromCodePoint(F4)), isIdentifierPart: (F4) => 36 === F4 || 95 === F4 || F4 >= 65 && F4 <= 90 || F4 >= 97 && F4 <= 122 || F4 >= 48 && F4 <= 57 || 92 === F4 || F4 >= 128 && u5.NonAsciiIdentifierPart.test(D2.fromCodePoint(F4)), isDecimalDigit: (u7) => u7 >= 48 && u7 <= 57, isHexDigit: (u7) => u7 >= 48 && u7 <= 57 || u7 >= 65 && u7 <= 70 || u7 >= 97 && u7 <= 102, isOctalDigit: (u7) => u7 >= 48 && u7 <= 55 };
  1253. // node_modules/@arcgis/core/arcade/lib/scanner.js
  1254. function a2(e7) {
  1255. return "0123456789abcdef".indexOf(e7.toLowerCase());
  1256. }
  1257. function d3(e7) {
  1258. return "01234567".indexOf(e7);
  1259. }
  1260. var l4 = [[], [], []];
  1261. t2.forEach((e7) => l4[e7.length - 1].push(e7)), n2.forEach((e7) => l4[e7.length - 1].push(e7)), r2.forEach((e7) => l4[e7.length - 1].push(e7)), i.forEach((e7) => l4[e7.length - 1].push(e7)), a.forEach((e7) => l4[e7.length - 1].push(e7));
  1262. var u6 = class {
  1263. constructor(e7, t4) {
  1264. this.source = e7, this.errorHandler = t4, this._length = e7.length, this.index = 0, this.lineNumber = 1, this.lineStart = 0, this.curlyStack = [];
  1265. }
  1266. saveState() {
  1267. return { index: this.index, lineNumber: this.lineNumber, lineStart: this.lineStart, curlyStack: this.curlyStack.slice() };
  1268. }
  1269. restoreState(e7) {
  1270. this.index = e7.index, this.lineNumber = e7.lineNumber, this.lineStart = e7.lineStart, this.curlyStack = e7.curlyStack;
  1271. }
  1272. eof() {
  1273. return this.index >= this._length;
  1274. }
  1275. throwUnexpectedToken(e7 = l3.UnexpectedToken) {
  1276. this.errorHandler.throwError({ code: e7, index: this.index, line: this.lineNumber, column: this.index - this.lineStart + 1 });
  1277. }
  1278. tolerateUnexpectedToken(e7 = l3.UnexpectedToken) {
  1279. this.errorHandler.tolerateError({ code: e7, index: this.index, line: this.lineNumber, column: this.index - this.lineStart + 1 });
  1280. }
  1281. skipSingleLineComment(e7) {
  1282. const i3 = [], s9 = this.index - e7, n3 = { start: { line: this.lineNumber, column: this.index - this.lineStart - e7 }, end: { line: 0, column: 0 } };
  1283. for (; !this.eof(); ) {
  1284. const r4 = this.source.charCodeAt(this.index);
  1285. if (++this.index, D2.isLineTerminator(r4)) {
  1286. if (n3) {
  1287. n3.end = { line: this.lineNumber, column: this.index - this.lineStart - 1 };
  1288. const t4 = { multiLine: false, start: s9 + e7, end: this.index - 1, range: [s9, this.index - 1], loc: n3 };
  1289. i3.push(t4);
  1290. }
  1291. return 13 === r4 && 10 === this.source.charCodeAt(this.index) && ++this.index, ++this.lineNumber, this.lineStart = this.index, i3;
  1292. }
  1293. }
  1294. if (n3) {
  1295. n3.end = { line: this.lineNumber, column: this.index - this.lineStart };
  1296. const t4 = { multiLine: false, start: s9 + e7, end: this.index, range: [s9, this.index], loc: n3 };
  1297. i3.push(t4);
  1298. }
  1299. return i3;
  1300. }
  1301. skipMultiLineComment() {
  1302. const e7 = [], i3 = this.index - 2, s9 = { start: { line: this.lineNumber, column: this.index - this.lineStart - 2 }, end: { line: 0, column: 0 } };
  1303. for (; !this.eof(); ) {
  1304. const n3 = this.source.charCodeAt(this.index);
  1305. if (D2.isLineTerminator(n3))
  1306. 13 === n3 && 10 === this.source.charCodeAt(this.index + 1) && ++this.index, ++this.lineNumber, ++this.index, this.lineStart = this.index;
  1307. else if (42 === n3) {
  1308. if (47 === this.source.charCodeAt(this.index + 1)) {
  1309. if (this.index += 2, s9) {
  1310. s9.end = { line: this.lineNumber, column: this.index - this.lineStart };
  1311. const t4 = { multiLine: true, start: i3 + 2, end: this.index - 2, range: [i3, this.index], loc: s9 };
  1312. e7.push(t4);
  1313. }
  1314. return e7;
  1315. }
  1316. ++this.index;
  1317. } else
  1318. ++this.index;
  1319. }
  1320. if (s9) {
  1321. s9.end = { line: this.lineNumber, column: this.index - this.lineStart };
  1322. const t4 = { multiLine: true, start: i3 + 2, end: this.index, range: [i3, this.index], loc: s9 };
  1323. e7.push(t4);
  1324. }
  1325. return this.tolerateUnexpectedToken(), e7;
  1326. }
  1327. scanComments() {
  1328. let e7 = [];
  1329. for (; !this.eof(); ) {
  1330. let i3 = this.source.charCodeAt(this.index);
  1331. if (D2.isWhiteSpace(i3))
  1332. ++this.index;
  1333. else if (D2.isLineTerminator(i3))
  1334. ++this.index, 13 === i3 && 10 === this.source.charCodeAt(this.index) && ++this.index, ++this.lineNumber, this.lineStart = this.index;
  1335. else {
  1336. if (47 !== i3)
  1337. break;
  1338. if (i3 = this.source.charCodeAt(this.index + 1), 47 === i3) {
  1339. this.index += 2;
  1340. const t4 = this.skipSingleLineComment(2);
  1341. e7 = [...e7, ...t4];
  1342. } else {
  1343. if (42 !== i3)
  1344. break;
  1345. {
  1346. this.index += 2;
  1347. const t4 = this.skipMultiLineComment();
  1348. e7 = [...e7, ...t4];
  1349. }
  1350. }
  1351. }
  1352. }
  1353. return e7;
  1354. }
  1355. isKeyword(e7) {
  1356. switch ((e7 = e7.toLowerCase()).length) {
  1357. case 2:
  1358. return "if" === e7 || "in" === e7;
  1359. case 3:
  1360. return "var" === e7 || "for" === e7;
  1361. case 4:
  1362. return "else" === e7;
  1363. case 5:
  1364. return "break" === e7 || "while" === e7;
  1365. case 6:
  1366. return "return" === e7 || "import" === e7 || "export" === e7;
  1367. case 8:
  1368. return "function" === e7 || "continue" === e7;
  1369. default:
  1370. return false;
  1371. }
  1372. }
  1373. codePointAt(e7) {
  1374. let t4 = this.source.charCodeAt(e7);
  1375. if (t4 >= 55296 && t4 <= 56319) {
  1376. const i3 = this.source.charCodeAt(e7 + 1);
  1377. if (i3 >= 56320 && i3 <= 57343) {
  1378. t4 = 1024 * (t4 - 55296) + i3 - 56320 + 65536;
  1379. }
  1380. }
  1381. return t4;
  1382. }
  1383. scanHexEscape(e7) {
  1384. const i3 = "u" === e7 ? 4 : 2;
  1385. let s9 = 0;
  1386. for (let n3 = 0; n3 < i3; ++n3) {
  1387. if (this.eof() || !D2.isHexDigit(this.source.charCodeAt(this.index)))
  1388. return null;
  1389. s9 = 16 * s9 + a2(this.source[this.index++]);
  1390. }
  1391. return String.fromCharCode(s9);
  1392. }
  1393. scanUnicodeCodePointEscape() {
  1394. let e7 = this.source[this.index], i3 = 0;
  1395. for ("}" === e7 && this.throwUnexpectedToken(); !this.eof() && (e7 = this.source[this.index++], D2.isHexDigit(e7.charCodeAt(0))); )
  1396. i3 = 16 * i3 + a2(e7);
  1397. return (i3 > 1114111 || "}" !== e7) && this.throwUnexpectedToken(), D2.fromCodePoint(i3);
  1398. }
  1399. getIdentifier() {
  1400. const e7 = this.index++;
  1401. for (; !this.eof(); ) {
  1402. const i3 = this.source.charCodeAt(this.index);
  1403. if (92 === i3)
  1404. return this.index = e7, this.getComplexIdentifier();
  1405. if (i3 >= 55296 && i3 < 57343)
  1406. return this.index = e7, this.getComplexIdentifier();
  1407. if (!D2.isIdentifierPart(i3))
  1408. break;
  1409. ++this.index;
  1410. }
  1411. return this.source.slice(e7, this.index);
  1412. }
  1413. getComplexIdentifier() {
  1414. let e7, i3 = this.codePointAt(this.index), s9 = D2.fromCodePoint(i3);
  1415. for (this.index += s9.length, 92 === i3 && (117 !== this.source.charCodeAt(this.index) && this.throwUnexpectedToken(), ++this.index, "{" === this.source[this.index] ? (++this.index, e7 = this.scanUnicodeCodePointEscape()) : (e7 = this.scanHexEscape("u"), null !== e7 && "\\" !== e7 && D2.isIdentifierStart(e7.charCodeAt(0)) || this.throwUnexpectedToken()), s9 = e7); !this.eof() && (i3 = this.codePointAt(this.index), D2.isIdentifierPart(i3)); )
  1416. e7 = D2.fromCodePoint(i3), s9 += e7, this.index += e7.length, 92 === i3 && (s9 = s9.substring(0, s9.length - 1), 117 !== this.source.charCodeAt(this.index) && this.throwUnexpectedToken(), ++this.index, "{" === this.source[this.index] ? (++this.index, e7 = this.scanUnicodeCodePointEscape()) : (e7 = this.scanHexEscape("u"), null !== e7 && "\\" !== e7 && D2.isIdentifierPart(e7.charCodeAt(0)) || this.throwUnexpectedToken()), s9 += e7);
  1417. return s9;
  1418. }
  1419. octalToDecimal(e7) {
  1420. let i3 = "0" !== e7, s9 = d3(e7);
  1421. return !this.eof() && D2.isOctalDigit(this.source.charCodeAt(this.index)) && (i3 = true, s9 = 8 * s9 + d3(this.source[this.index++]), "0123".includes(e7) && !this.eof() && D2.isOctalDigit(this.source.charCodeAt(this.index)) && (s9 = 8 * s9 + d3(this.source[this.index++]))), { code: s9, octal: i3 };
  1422. }
  1423. scanIdentifier() {
  1424. let e7;
  1425. const t4 = this.index, i3 = 92 === this.source.charCodeAt(t4) ? this.getComplexIdentifier() : this.getIdentifier();
  1426. if (e7 = 1 === i3.length ? c4.Identifier : this.isKeyword(i3) ? c4.Keyword : "null" === i3.toLowerCase() ? c4.NullLiteral : "true" === i3.toLowerCase() || "false" === i3.toLowerCase() ? c4.BooleanLiteral : c4.Identifier, e7 !== c4.Identifier && t4 + i3.length !== this.index) {
  1427. const e8 = this.index;
  1428. this.index = t4, this.tolerateUnexpectedToken(l3.InvalidEscapedReservedWord), this.index = e8;
  1429. }
  1430. return { type: e7, value: i3, lineNumber: this.lineNumber, lineStart: this.lineStart, start: t4, end: this.index };
  1431. }
  1432. scanPunctuator() {
  1433. const e7 = this.index;
  1434. let t4 = this.source[this.index];
  1435. switch (t4) {
  1436. case "(":
  1437. case "{":
  1438. "{" === t4 && this.curlyStack.push("{"), ++this.index;
  1439. break;
  1440. case ".":
  1441. case ")":
  1442. case ";":
  1443. case ",":
  1444. case "[":
  1445. case "]":
  1446. case ":":
  1447. case "?":
  1448. case "~":
  1449. ++this.index;
  1450. break;
  1451. case "}":
  1452. ++this.index, this.curlyStack.pop();
  1453. break;
  1454. default:
  1455. for (let e8 = l4.length; e8 > 0; e8--)
  1456. if (t4 = this.source.substring(this.index, this.index + e8), l4[e8 - 1].includes(t4)) {
  1457. this.index += e8;
  1458. break;
  1459. }
  1460. }
  1461. return this.index === e7 && this.throwUnexpectedToken(), { type: c4.Punctuator, value: t4, lineNumber: this.lineNumber, lineStart: this.lineStart, start: e7, end: this.index };
  1462. }
  1463. scanHexLiteral(e7) {
  1464. let i3 = "";
  1465. for (; !this.eof() && D2.isHexDigit(this.source.charCodeAt(this.index)); )
  1466. i3 += this.source[this.index++];
  1467. return 0 === i3.length && this.throwUnexpectedToken(), D2.isIdentifierStart(this.source.charCodeAt(this.index)) && this.throwUnexpectedToken(), { type: c4.NumericLiteral, value: parseInt("0x" + i3, 16), lineNumber: this.lineNumber, lineStart: this.lineStart, start: e7, end: this.index };
  1468. }
  1469. scanBinaryLiteral(e7) {
  1470. let i3 = "";
  1471. for (; !this.eof(); ) {
  1472. const e8 = this.source[this.index];
  1473. if ("0" !== e8 && "1" !== e8)
  1474. break;
  1475. i3 += this.source[this.index++];
  1476. }
  1477. if (0 === i3.length && this.throwUnexpectedToken(), !this.eof()) {
  1478. const e8 = this.source.charCodeAt(this.index);
  1479. (D2.isIdentifierStart(e8) || D2.isDecimalDigit(e8)) && this.throwUnexpectedToken();
  1480. }
  1481. return { type: c4.NumericLiteral, value: parseInt(i3, 2), lineNumber: this.lineNumber, lineStart: this.lineStart, start: e7, end: this.index };
  1482. }
  1483. scanOctalLiteral(e7, i3) {
  1484. let s9 = "", n3 = false;
  1485. for (D2.isOctalDigit(e7.charCodeAt(0)) ? (n3 = true, s9 = "0" + this.source[this.index++]) : ++this.index; !this.eof() && D2.isOctalDigit(this.source.charCodeAt(this.index)); )
  1486. s9 += this.source[this.index++];
  1487. return n3 || 0 !== s9.length || this.throwUnexpectedToken(), (D2.isIdentifierStart(this.source.charCodeAt(this.index)) || D2.isDecimalDigit(this.source.charCodeAt(this.index))) && this.throwUnexpectedToken(), { type: c4.NumericLiteral, value: parseInt(s9, 8), lineNumber: this.lineNumber, lineStart: this.lineStart, start: i3, end: this.index };
  1488. }
  1489. scanNumericLiteral() {
  1490. const i3 = this.index;
  1491. let s9 = this.source[i3];
  1492. r3(D2.isDecimalDigit(s9.charCodeAt(0)) || "." === s9, "Numeric literal must start with a decimal digit or a decimal point");
  1493. let n3 = "";
  1494. if ("." !== s9) {
  1495. if (n3 = this.source[this.index++], s9 = this.source[this.index], "0" === n3) {
  1496. if ("x" === s9 || "X" === s9)
  1497. return ++this.index, this.scanHexLiteral(i3);
  1498. if ("b" === s9 || "B" === s9)
  1499. return ++this.index, this.scanBinaryLiteral(i3);
  1500. if ("o" === s9 || "O" === s9)
  1501. return this.scanOctalLiteral(s9, i3);
  1502. }
  1503. for (; D2.isDecimalDigit(this.source.charCodeAt(this.index)); )
  1504. n3 += this.source[this.index++];
  1505. s9 = this.source[this.index];
  1506. }
  1507. if ("." === s9) {
  1508. for (n3 += this.source[this.index++]; D2.isDecimalDigit(this.source.charCodeAt(this.index)); )
  1509. n3 += this.source[this.index++];
  1510. s9 = this.source[this.index];
  1511. }
  1512. if ("e" === s9 || "E" === s9)
  1513. if (n3 += this.source[this.index++], s9 = this.source[this.index], "+" !== s9 && "-" !== s9 || (n3 += this.source[this.index++]), D2.isDecimalDigit(this.source.charCodeAt(this.index)))
  1514. for (; D2.isDecimalDigit(this.source.charCodeAt(this.index)); )
  1515. n3 += this.source[this.index++];
  1516. else
  1517. this.throwUnexpectedToken();
  1518. return D2.isIdentifierStart(this.source.charCodeAt(this.index)) && this.throwUnexpectedToken(), { type: c4.NumericLiteral, value: parseFloat(n3), lineNumber: this.lineNumber, lineStart: this.lineStart, start: i3, end: this.index };
  1519. }
  1520. scanStringLiteral() {
  1521. const i3 = this.index;
  1522. let s9 = this.source[i3];
  1523. r3("'" === s9 || '"' === s9, "String literal must starts with a quote"), ++this.index;
  1524. let n3 = false, r4 = "";
  1525. for (; !this.eof(); ) {
  1526. let e7 = this.source[this.index++];
  1527. if (e7 === s9) {
  1528. s9 = "";
  1529. break;
  1530. }
  1531. if ("\\" === e7)
  1532. if (e7 = this.source[this.index++], e7 && D2.isLineTerminator(e7.charCodeAt(0)))
  1533. ++this.lineNumber, "\r" === e7 && "\n" === this.source[this.index] && ++this.index, this.lineStart = this.index;
  1534. else
  1535. switch (e7) {
  1536. case "u":
  1537. if ("{" === this.source[this.index])
  1538. ++this.index, r4 += this.scanUnicodeCodePointEscape();
  1539. else {
  1540. const t4 = this.scanHexEscape(e7);
  1541. null === t4 && this.throwUnexpectedToken(), r4 += t4;
  1542. }
  1543. break;
  1544. case "x": {
  1545. const t4 = this.scanHexEscape(e7);
  1546. null === t4 && this.throwUnexpectedToken(l3.InvalidHexEscapeSequence), r4 += t4;
  1547. break;
  1548. }
  1549. case "n":
  1550. r4 += "\n";
  1551. break;
  1552. case "r":
  1553. r4 += "\r";
  1554. break;
  1555. case "t":
  1556. r4 += " ";
  1557. break;
  1558. case "b":
  1559. r4 += "\b";
  1560. break;
  1561. case "f":
  1562. r4 += "\f";
  1563. break;
  1564. case "v":
  1565. r4 += "\v";
  1566. break;
  1567. case "8":
  1568. case "9":
  1569. r4 += e7, this.tolerateUnexpectedToken();
  1570. break;
  1571. default:
  1572. if (e7 && D2.isOctalDigit(e7.charCodeAt(0))) {
  1573. const t4 = this.octalToDecimal(e7);
  1574. n3 = t4.octal || n3, r4 += String.fromCharCode(t4.code);
  1575. } else
  1576. r4 += e7;
  1577. }
  1578. else {
  1579. if (D2.isLineTerminator(e7.charCodeAt(0)))
  1580. break;
  1581. r4 += e7;
  1582. }
  1583. }
  1584. return "" !== s9 && (this.index = i3, this.throwUnexpectedToken()), { type: c4.StringLiteral, value: r4, lineNumber: this.lineNumber, lineStart: this.lineStart, start: i3, end: this.index };
  1585. }
  1586. scanTemplate() {
  1587. let e7 = "", i3 = false;
  1588. const s9 = this.index, n3 = "`" === this.source[s9];
  1589. let r4 = false, h3 = 2;
  1590. for (++this.index; !this.eof(); ) {
  1591. let s10 = this.source[this.index++];
  1592. if ("`" === s10) {
  1593. h3 = 1, r4 = true, i3 = true;
  1594. break;
  1595. }
  1596. if ("$" !== s10)
  1597. if ("\\" !== s10)
  1598. D2.isLineTerminator(s10.charCodeAt(0)) ? (++this.lineNumber, "\r" === s10 && "\n" === this.source[this.index] && ++this.index, this.lineStart = this.index, e7 += "\n") : e7 += s10;
  1599. else if (s10 = this.source[this.index++], D2.isLineTerminator(s10.charCodeAt(0)))
  1600. ++this.lineNumber, "\r" === s10 && "\n" === this.source[this.index] && ++this.index, this.lineStart = this.index;
  1601. else
  1602. switch (s10) {
  1603. case "n":
  1604. e7 += "\n";
  1605. break;
  1606. case "r":
  1607. e7 += "\r";
  1608. break;
  1609. case "t":
  1610. e7 += " ";
  1611. break;
  1612. case "u":
  1613. if ("{" === this.source[this.index])
  1614. ++this.index, e7 += this.scanUnicodeCodePointEscape();
  1615. else {
  1616. const t4 = this.index, i4 = this.scanHexEscape(s10);
  1617. null !== i4 ? e7 += i4 : (this.index = t4, e7 += s10);
  1618. }
  1619. break;
  1620. case "x": {
  1621. const t4 = this.scanHexEscape(s10);
  1622. null === t4 && this.throwUnexpectedToken(l3.InvalidHexEscapeSequence), e7 += t4;
  1623. break;
  1624. }
  1625. case "b":
  1626. e7 += "\b";
  1627. break;
  1628. case "f":
  1629. e7 += "\f";
  1630. break;
  1631. case "v":
  1632. e7 += "\v";
  1633. break;
  1634. default:
  1635. "0" === s10 ? (D2.isDecimalDigit(this.source.charCodeAt(this.index)) && this.throwUnexpectedToken(l3.TemplateOctalLiteral), e7 += "\0") : D2.isOctalDigit(s10.charCodeAt(0)) ? this.throwUnexpectedToken(l3.TemplateOctalLiteral) : e7 += s10;
  1636. }
  1637. else {
  1638. if ("{" === this.source[this.index]) {
  1639. this.curlyStack.push("${"), ++this.index, i3 = true;
  1640. break;
  1641. }
  1642. e7 += s10;
  1643. }
  1644. }
  1645. return i3 || this.throwUnexpectedToken(), n3 || this.curlyStack.pop(), { type: c4.Template, value: this.source.slice(s9 + 1, this.index - h3), cooked: e7, head: n3, tail: r4, lineNumber: this.lineNumber, lineStart: this.lineStart, start: s9, end: this.index };
  1646. }
  1647. lex() {
  1648. if (this.eof())
  1649. return { type: c4.EOF, value: "", lineNumber: this.lineNumber, lineStart: this.lineStart, start: this.index, end: this.index };
  1650. const e7 = this.source.charCodeAt(this.index);
  1651. return D2.isIdentifierStart(e7) ? this.scanIdentifier() : 40 === e7 || 41 === e7 || 59 === e7 ? this.scanPunctuator() : 39 === e7 || 34 === e7 ? this.scanStringLiteral() : 46 === e7 ? D2.isDecimalDigit(this.source.charCodeAt(this.index + 1)) ? this.scanNumericLiteral() : this.scanPunctuator() : D2.isDecimalDigit(e7) ? this.scanNumericLiteral() : 96 === e7 || 125 === e7 && "${" === this.curlyStack[this.curlyStack.length - 1] ? this.scanTemplate() : e7 >= 55296 && e7 < 57343 && D2.isIdentifierStart(this.codePointAt(this.index)) ? this.scanIdentifier() : this.scanPunctuator();
  1652. }
  1653. };
  1654. // node_modules/@arcgis/core/arcade/lib/parser.js
  1655. var x3;
  1656. var k3;
  1657. function w5(t4, e7 = 0) {
  1658. let r4 = t4.start - t4.lineStart, i3 = t4.lineNumber;
  1659. return r4 < 0 && (r4 += e7, i3--), { index: t4.start, line: i3, column: r4 };
  1660. }
  1661. function g2(t4) {
  1662. return [{ index: t4.range[0], ...t4.loc.start }, { index: t4.range[1], ...t4.loc.end }];
  1663. }
  1664. function y4(t4) {
  1665. var _a;
  1666. return (_a = o2[t4]) != null ? _a : 0;
  1667. }
  1668. !function(t4) {
  1669. t4[t4.None = 0] = "None", t4[t4.Function = 1] = "Function", t4[t4.IfClause = 2] = "IfClause", t4[t4.ForLoop = 4] = "ForLoop", t4[t4.WhileLoop = 8] = "WhileLoop";
  1670. }(x3 || (x3 = {})), function(t4) {
  1671. t4[t4.AsObject = 0] = "AsObject", t4[t4.Automatic = 1] = "Automatic";
  1672. }(k3 || (k3 = {}));
  1673. var T2 = class {
  1674. constructor(r4, n3 = {}, a3) {
  1675. this.delegate = a3, this.hasLineTerminator = false, this.options = { tokens: "boolean" == typeof n3.tokens && n3.tokens, comments: "boolean" == typeof n3.comments && n3.comments, tolerant: "boolean" == typeof n3.tolerant && n3.tolerant }, this.options.comments && (this.commentHandler = new o3()), this.errorHandler = new e5(this.options.tolerant), this.scanner = new u6(r4, this.errorHandler), this.context = { isAssignmentTarget: false, blockContext: x3.None, curlyParsingType: k3.AsObject }, this.rawToken = { type: c4.EOF, value: "", lineNumber: this.scanner.lineNumber, lineStart: 0, start: 0, end: 0 }, this.tokens = [], this.startMarker = { index: 0, line: this.scanner.lineNumber, column: 0 }, this.endMarker = { index: 0, line: this.scanner.lineNumber, column: 0 }, this.readNextRawToken(), this.endMarker = { index: this.scanner.index, line: this.scanner.lineNumber, column: this.scanner.index - this.scanner.lineStart };
  1676. }
  1677. throwIfInvalidType(t4, e7, { validTypes: r4, invalidTypes: i3 }) {
  1678. (r4 == null ? void 0 : r4.some((e8) => t4.type === e8)) || (i3 == null ? void 0 : i3.some((e8) => t4.type === e8)) && this.throwError(l3.InvalidExpression, e7);
  1679. }
  1680. throwError(t4, e7, r4 = this.endMarker) {
  1681. const { index: i3, line: n3, column: s9 } = e7, a3 = r4.index - i3 - 1;
  1682. this.errorHandler.throwError({ code: t4, index: i3, line: n3, column: s9 + 1, len: a3 });
  1683. }
  1684. tolerateError(t4, e7) {
  1685. throw new Error("######################################### !!!");
  1686. }
  1687. unexpectedTokenError(t4 = {}) {
  1688. const { rawToken: e7 } = t4;
  1689. let i3, { code: n3, data: h3 } = t4;
  1690. if (e7) {
  1691. if (!n3)
  1692. switch (e7.type) {
  1693. case c4.EOF:
  1694. n3 = l3.UnexpectedEndOfScript;
  1695. break;
  1696. case c4.Identifier:
  1697. n3 = l3.UnexpectedIdentifier;
  1698. break;
  1699. case c4.NumericLiteral:
  1700. n3 = l3.UnexpectedNumber;
  1701. break;
  1702. case c4.StringLiteral:
  1703. n3 = l3.UnexpectedString;
  1704. break;
  1705. case c4.Template:
  1706. n3 = l3.UnexpectedTemplate;
  1707. }
  1708. i3 = e7.value.toString();
  1709. } else
  1710. i3 = "ILLEGAL";
  1711. n3 = n3 != null ? n3 : l3.UnexpectedToken, h3 || (h3 = { value: i3 });
  1712. const c5 = o4(n3, h3);
  1713. if (e7) {
  1714. const t5 = e7.start, r4 = e7.lineNumber, i4 = e7.start - e7.lineStart + 1;
  1715. return new d2({ code: n3, index: t5, line: r4, column: i4, len: e7.end - e7.start - 1, data: h3, description: c5 });
  1716. }
  1717. const { index: p5, line: l6 } = this.endMarker;
  1718. return new d2({ code: n3, index: p5, line: l6, column: this.endMarker.column + 1, data: h3, description: c5 });
  1719. }
  1720. throwUnexpectedToken(t4 = {}) {
  1721. var _a;
  1722. throw t4.rawToken = (_a = t4.rawToken) != null ? _a : this.rawToken, this.unexpectedTokenError(t4);
  1723. }
  1724. collectComments(t4) {
  1725. const { commentHandler: e7 } = this;
  1726. e7 && (t4 == null ? void 0 : t4.length) && t4.forEach((t5) => {
  1727. const r4 = { type: t5.multiLine ? e4.BlockComment : e4.LineComment, value: this.getSourceValue(t5), range: t5.range, loc: t5.loc };
  1728. e7.collectComment(r4);
  1729. });
  1730. }
  1731. peekAhead(t4) {
  1732. const e7 = () => (this.scanner.scanComments(), this.scanner.lex()), r4 = this.scanner.saveState(), i3 = t4.call(this, e7);
  1733. return this.scanner.restoreState(r4), i3;
  1734. }
  1735. getSourceValue(t4) {
  1736. return this.scanner.source.slice(t4.start, t4.end);
  1737. }
  1738. convertToToken(t4) {
  1739. return { type: s5[t4.type], value: this.getSourceValue(t4), range: [t4.start, t4.end], loc: { start: { line: this.startMarker.line, column: this.startMarker.column }, end: { line: this.scanner.lineNumber, column: this.scanner.index - this.scanner.lineStart } } };
  1740. }
  1741. readNextRawToken() {
  1742. this.endMarker.index = this.scanner.index, this.endMarker.line = this.scanner.lineNumber, this.endMarker.column = this.scanner.index - this.scanner.lineStart;
  1743. const t4 = this.rawToken;
  1744. this.collectComments(this.scanner.scanComments()), this.scanner.index !== this.startMarker.index && (this.startMarker.index = this.scanner.index, this.startMarker.line = this.scanner.lineNumber, this.startMarker.column = this.scanner.index - this.scanner.lineStart), this.rawToken = this.scanner.lex(), this.hasLineTerminator = t4.lineNumber !== this.rawToken.lineNumber, this.options.tokens && this.rawToken.type !== c4.EOF && this.tokens.push(this.convertToToken(this.rawToken));
  1745. }
  1746. captureStartMarker() {
  1747. return { index: this.startMarker.index, line: this.startMarker.line, column: this.startMarker.column };
  1748. }
  1749. getItemLocation(t4) {
  1750. return { range: [t4.index, this.endMarker.index], loc: { start: { line: t4.line, column: t4.column }, end: { line: this.endMarker.line, column: this.endMarker.column } } };
  1751. }
  1752. finalize(t4) {
  1753. var _a, _b;
  1754. return (this.delegate || this.commentHandler) && ((_a = this.commentHandler) == null ? void 0 : _a.attachComments(t4), (_b = this.delegate) == null ? void 0 : _b.call(this, t4)), t4;
  1755. }
  1756. expectPunctuator(t4) {
  1757. const e7 = this.rawToken;
  1758. this.matchPunctuator(t4) ? this.readNextRawToken() : this.throwUnexpectedToken({ rawToken: e7, code: l3.PunctuatorExpected, data: { value: t4 } });
  1759. }
  1760. expectKeyword(t4) {
  1761. this.rawToken.type !== c4.Keyword || this.rawToken.value.toLowerCase() !== t4 ? this.throwUnexpectedToken({ rawToken: this.rawToken }) : this.readNextRawToken();
  1762. }
  1763. expectContextualKeyword(t4) {
  1764. this.rawToken.type !== c4.Identifier || this.rawToken.value.toLowerCase() !== t4 ? this.throwUnexpectedToken({ rawToken: this.rawToken }) : this.readNextRawToken();
  1765. }
  1766. matchKeyword(t4) {
  1767. return this.rawToken.type === c4.Keyword && this.rawToken.value.toLowerCase() === t4;
  1768. }
  1769. matchContextualKeyword(t4) {
  1770. return this.rawToken.type === c4.Identifier && this.rawToken.value === t4;
  1771. }
  1772. matchPunctuator(t4) {
  1773. return this.rawToken.type === c4.Punctuator && this.rawToken.value === t4;
  1774. }
  1775. getMatchingPunctuator(t4) {
  1776. if ("string" == typeof t4 && (t4 = t4.split("")), this.rawToken.type === c4.Punctuator && (t4 == null ? void 0 : t4.length))
  1777. return t4.find(this.matchPunctuator, this);
  1778. }
  1779. isolateCoverGrammar(t4) {
  1780. const e7 = this.context.isAssignmentTarget;
  1781. this.context.isAssignmentTarget = true;
  1782. const r4 = t4.call(this);
  1783. return this.context.isAssignmentTarget = e7, r4;
  1784. }
  1785. inheritCoverGrammar(t4) {
  1786. const e7 = this.context.isAssignmentTarget;
  1787. this.context.isAssignmentTarget = true;
  1788. const r4 = t4.call(this);
  1789. return this.context.isAssignmentTarget = this.context.isAssignmentTarget && e7, r4;
  1790. }
  1791. withBlockContext(t4, e7) {
  1792. const r4 = this.context.blockContext;
  1793. this.context.blockContext = this.context.blockContext | t4;
  1794. const i3 = this.context.curlyParsingType;
  1795. this.context.curlyParsingType = k3.Automatic;
  1796. const n3 = e7.call(this);
  1797. return this.context.blockContext = r4, this.context.curlyParsingType = i3, n3;
  1798. }
  1799. consumeSemicolon() {
  1800. if (this.matchPunctuator(";"))
  1801. this.readNextRawToken();
  1802. else if (!this.hasLineTerminator)
  1803. return this.rawToken.type === c4.EOF || this.matchPunctuator("}") ? (this.endMarker.index = this.startMarker.index, this.endMarker.line = this.startMarker.line, void (this.endMarker.column = this.startMarker.column)) : void this.throwUnexpectedToken({ rawToken: this.rawToken });
  1804. }
  1805. parsePrimaryExpression() {
  1806. const t4 = this.captureStartMarker(), e7 = this.rawToken;
  1807. switch (e7.type) {
  1808. case c4.Identifier:
  1809. return this.readNextRawToken(), this.finalize({ type: e4.Identifier, name: e7.value, ...this.getItemLocation(t4) });
  1810. case c4.NumericLiteral:
  1811. case c4.StringLiteral:
  1812. return this.context.isAssignmentTarget = false, this.readNextRawToken(), this.finalize({ type: e4.Literal, value: e7.value, raw: this.getSourceValue(e7), isString: "string" == typeof e7.value, ...this.getItemLocation(t4) });
  1813. case c4.BooleanLiteral:
  1814. return this.context.isAssignmentTarget = false, this.readNextRawToken(), this.finalize({ type: e4.Literal, value: "true" === e7.value.toLowerCase(), raw: this.getSourceValue(e7), isString: false, ...this.getItemLocation(t4) });
  1815. case c4.NullLiteral:
  1816. return this.context.isAssignmentTarget = false, this.readNextRawToken(), this.finalize({ type: e4.Literal, value: null, raw: this.getSourceValue(e7), isString: false, ...this.getItemLocation(t4) });
  1817. case c4.Template:
  1818. return this.parseTemplateLiteral();
  1819. case c4.Punctuator:
  1820. switch (e7.value) {
  1821. case "(":
  1822. return this.inheritCoverGrammar(this.parseGroupExpression);
  1823. case "[":
  1824. return this.inheritCoverGrammar(this.parseArrayInitializer);
  1825. case "{":
  1826. return this.inheritCoverGrammar(this.parseObjectExpression);
  1827. default:
  1828. return this.throwUnexpectedToken({ rawToken: this.rawToken });
  1829. }
  1830. case c4.Keyword:
  1831. return this.context.isAssignmentTarget = false, this.throwUnexpectedToken({ rawToken: this.rawToken });
  1832. default:
  1833. return this.throwUnexpectedToken({ rawToken: this.rawToken });
  1834. }
  1835. }
  1836. parseArrayInitializer() {
  1837. const t4 = this.captureStartMarker();
  1838. this.expectPunctuator("[");
  1839. const e7 = [];
  1840. for (; !this.matchPunctuator("]"); )
  1841. this.matchPunctuator(",") ? (this.readNextRawToken(), e7.push(null)) : (e7.push(this.inheritCoverGrammar(this.parseAssignmentExpression)), this.matchPunctuator("]") || this.expectPunctuator(","));
  1842. return this.expectPunctuator("]"), this.finalize({ type: e4.ArrayExpression, elements: e7, ...this.getItemLocation(t4) });
  1843. }
  1844. parseObjectPropertyKey() {
  1845. const t4 = this.captureStartMarker(), e7 = this.rawToken;
  1846. switch (e7.type) {
  1847. case c4.StringLiteral:
  1848. return this.readNextRawToken(), this.finalize({ type: e4.Literal, value: e7.value, raw: this.getSourceValue(e7), isString: true, ...this.getItemLocation(t4) });
  1849. case c4.Identifier:
  1850. case c4.BooleanLiteral:
  1851. case c4.NullLiteral:
  1852. case c4.Keyword:
  1853. return this.readNextRawToken(), this.finalize({ type: e4.Identifier, name: e7.value, ...this.getItemLocation(t4) });
  1854. default:
  1855. this.throwError(l3.KeyMustBeString, t4);
  1856. }
  1857. }
  1858. parseObjectProperty() {
  1859. const t4 = this.rawToken, e7 = this.captureStartMarker(), r4 = this.parseObjectPropertyKey();
  1860. let i3 = false, n3 = null;
  1861. return this.matchPunctuator(":") ? (this.readNextRawToken(), n3 = this.inheritCoverGrammar(this.parseAssignmentExpression)) : t4.type === c4.Identifier ? (i3 = true, n3 = this.finalize({ type: e4.Identifier, name: t4.value, ...this.getItemLocation(e7) })) : this.throwUnexpectedToken({ rawToken: this.rawToken }), this.finalize({ type: e4.Property, kind: "init", key: r4, value: n3, shorthand: i3, ...this.getItemLocation(e7) });
  1862. }
  1863. parseObjectExpression() {
  1864. const t4 = this.captureStartMarker();
  1865. this.expectPunctuator("{");
  1866. const e7 = [];
  1867. for (; !this.matchPunctuator("}"); )
  1868. e7.push(this.parseObjectProperty()), this.matchPunctuator("}") || this.expectPunctuator(",");
  1869. return this.expectPunctuator("}"), this.finalize({ type: e4.ObjectExpression, properties: e7, ...this.getItemLocation(t4) });
  1870. }
  1871. parseTemplateElement(t4 = false) {
  1872. const e7 = this.rawToken;
  1873. e7.type !== c4.Template && this.throwUnexpectedToken({ rawToken: e7 }), t4 && !e7.head && this.throwUnexpectedToken({ code: l3.InvalidTemplateHead, rawToken: e7 });
  1874. const r4 = this.captureStartMarker();
  1875. this.readNextRawToken();
  1876. const { value: i3, cooked: n3, tail: o5 } = e7, c5 = this.finalize({ type: e4.TemplateElement, value: { raw: i3, cooked: n3 }, tail: o5, ...this.getItemLocation(r4) });
  1877. return c5.loc.start.column++, c5.loc.end.column = c5.loc.end.column - (o5 ? 1 : 2), c5;
  1878. }
  1879. parseTemplateLiteral() {
  1880. const t4 = this.captureStartMarker(), e7 = [], r4 = [];
  1881. let i3 = this.parseTemplateElement(true);
  1882. for (r4.push(i3); !i3.tail; )
  1883. e7.push(this.parseExpression()), i3 = this.parseTemplateElement(), r4.push(i3);
  1884. return this.finalize({ type: e4.TemplateLiteral, quasis: r4, expressions: e7, ...this.getItemLocation(t4) });
  1885. }
  1886. parseGroupExpression() {
  1887. this.expectPunctuator("(");
  1888. const t4 = this.inheritCoverGrammar(this.parseAssignmentExpression);
  1889. return this.expectPunctuator(")"), t4;
  1890. }
  1891. parseArguments() {
  1892. this.expectPunctuator("(");
  1893. const t4 = [];
  1894. if (!this.matchPunctuator(")"))
  1895. for (; ; ) {
  1896. const e7 = this.isolateCoverGrammar(this.parseAssignmentExpression);
  1897. if (t4.push(e7), this.matchPunctuator(")"))
  1898. break;
  1899. if (this.expectPunctuator(","), this.matchPunctuator(")"))
  1900. break;
  1901. }
  1902. return this.expectPunctuator(")"), t4;
  1903. }
  1904. parseMemberName() {
  1905. const t4 = this.rawToken, e7 = this.captureStartMarker();
  1906. return this.readNextRawToken(), t4.type !== c4.NullLiteral && t4.type !== c4.Identifier && t4.type !== c4.Keyword && t4.type !== c4.BooleanLiteral && this.throwUnexpectedToken({ rawToken: t4 }), this.finalize({ type: e4.Identifier, name: t4.value, ...this.getItemLocation(e7) });
  1907. }
  1908. parseLeftHandSideExpression() {
  1909. const t4 = this.captureStartMarker();
  1910. let e7 = this.inheritCoverGrammar(this.parsePrimaryExpression);
  1911. const r4 = this.captureStartMarker();
  1912. let i3;
  1913. for (; i3 = this.getMatchingPunctuator("([."); )
  1914. switch (i3) {
  1915. case "(": {
  1916. this.context.isAssignmentTarget = false, e7.type !== e4.Identifier && e7.type !== e4.MemberExpression && this.throwError(l3.IdentiferExpected, t4, r4);
  1917. const i4 = this.parseArguments();
  1918. e7 = this.finalize({ type: e4.CallExpression, callee: e7, arguments: i4, ...this.getItemLocation(t4) });
  1919. continue;
  1920. }
  1921. case "[": {
  1922. this.context.isAssignmentTarget = true, this.expectPunctuator("[");
  1923. const r5 = this.isolateCoverGrammar(this.parseExpression);
  1924. this.expectPunctuator("]"), e7 = this.finalize({ type: e4.MemberExpression, computed: true, object: e7, property: r5, ...this.getItemLocation(t4) });
  1925. continue;
  1926. }
  1927. case ".": {
  1928. this.context.isAssignmentTarget = true, this.expectPunctuator(".");
  1929. const r5 = this.parseMemberName();
  1930. e7 = this.finalize({ type: e4.MemberExpression, computed: false, object: e7, property: r5, ...this.getItemLocation(t4) });
  1931. continue;
  1932. }
  1933. }
  1934. return e7;
  1935. }
  1936. parseUpdateExpression() {
  1937. const t4 = this.captureStartMarker();
  1938. let e7 = this.getMatchingPunctuator(t2);
  1939. if (e7) {
  1940. this.readNextRawToken();
  1941. const r5 = this.captureStartMarker(), i4 = this.inheritCoverGrammar(this.parseUnaryExpression);
  1942. return i4.type !== e4.Identifier && i4.type !== e4.MemberExpression && i4.type !== e4.CallExpression && this.throwError(l3.InvalidExpression, r5), this.context.isAssignmentTarget || this.tolerateError(l3.InvalidLeftHandSideInAssignment, t4), this.context.isAssignmentTarget = false, this.finalize({ type: e4.UpdateExpression, operator: e7, argument: i4, prefix: true, ...this.getItemLocation(t4) });
  1943. }
  1944. const r4 = this.captureStartMarker(), i3 = this.inheritCoverGrammar(this.parseLeftHandSideExpression), n3 = this.captureStartMarker();
  1945. return this.hasLineTerminator ? i3 : (e7 = this.getMatchingPunctuator(t2), e7 ? (i3.type !== e4.Identifier && i3.type !== e4.MemberExpression && this.throwError(l3.InvalidExpression, r4, n3), this.context.isAssignmentTarget || this.tolerateError(l3.InvalidLeftHandSideInAssignment, t4), this.readNextRawToken(), this.context.isAssignmentTarget = false, this.finalize({ type: e4.UpdateExpression, operator: e7, argument: i3, prefix: false, ...this.getItemLocation(t4) })) : i3);
  1946. }
  1947. parseUnaryExpression() {
  1948. const t4 = this.getMatchingPunctuator(n2);
  1949. if (t4) {
  1950. const e7 = this.captureStartMarker();
  1951. this.readNextRawToken();
  1952. const r4 = this.inheritCoverGrammar(this.parseUnaryExpression);
  1953. return this.context.isAssignmentTarget = false, this.finalize({ type: e4.UnaryExpression, operator: t4, argument: r4, prefix: true, ...this.getItemLocation(e7) });
  1954. }
  1955. return this.parseUpdateExpression();
  1956. }
  1957. parseBinaryExpression() {
  1958. const t4 = this.rawToken;
  1959. let e7 = this.inheritCoverGrammar(this.parseUnaryExpression);
  1960. if (this.rawToken.type !== c4.Punctuator)
  1961. return e7;
  1962. const r4 = this.rawToken.value;
  1963. let i3 = y4(r4);
  1964. if (0 === i3)
  1965. return e7;
  1966. this.readNextRawToken(), this.context.isAssignmentTarget = false;
  1967. const n3 = [t4, this.rawToken];
  1968. let a3 = e7, o5 = this.inheritCoverGrammar(this.parseUnaryExpression);
  1969. const h3 = [a3, r4, o5], c5 = [i3];
  1970. for (; this.rawToken.type === c4.Punctuator && (i3 = y4(this.rawToken.value)) > 0; ) {
  1971. for (; h3.length > 2 && i3 <= c5[c5.length - 1]; ) {
  1972. o5 = h3.pop();
  1973. const t5 = h3.pop();
  1974. c5.pop(), a3 = h3.pop(), n3.pop();
  1975. const e8 = n3[n3.length - 1], r5 = w5(e8, e8.lineStart);
  1976. h3.push(this.finalize(this.createBinaryOrLogicalExpression(r5, t5, a3, o5)));
  1977. }
  1978. h3.push(this.rawToken.value), c5.push(i3), n3.push(this.rawToken), this.readNextRawToken(), h3.push(this.inheritCoverGrammar(this.parseUnaryExpression));
  1979. }
  1980. let p5 = h3.length - 1;
  1981. e7 = h3[p5];
  1982. let l6 = n3.pop();
  1983. for (; p5 > 1; ) {
  1984. const t5 = n3.pop();
  1985. if (!t5)
  1986. break;
  1987. const r5 = l6 == null ? void 0 : l6.lineStart, i4 = w5(t5, r5), s9 = h3[p5 - 1];
  1988. e7 = this.finalize(this.createBinaryOrLogicalExpression(i4, s9, h3[p5 - 2], e7)), p5 -= 2, l6 = t5;
  1989. }
  1990. return e7;
  1991. }
  1992. createBinaryOrLogicalExpression(t4, e7, r4, i3) {
  1993. const n3 = r2.includes(e7) ? e4.LogicalExpression : e4.BinaryExpression;
  1994. return n3 === e4.BinaryExpression || (r4.type !== e4.AssignmentExpression && r4.type !== e4.UpdateExpression || this.throwError(l3.InvalidExpression, ...g2(r4)), i3.type !== e4.AssignmentExpression && i3.type !== e4.UpdateExpression || this.throwError(l3.InvalidExpression, ...g2(r4))), { type: n3, operator: e7, left: r4, right: i3, ...this.getItemLocation(t4) };
  1995. }
  1996. parseAssignmentExpression() {
  1997. const t4 = this.captureStartMarker(), e7 = this.inheritCoverGrammar(this.parseBinaryExpression), r4 = this.captureStartMarker(), i3 = this.getMatchingPunctuator(i);
  1998. if (!i3)
  1999. return e7;
  2000. e7.type !== e4.Identifier && e7.type !== e4.MemberExpression && this.throwError(l3.InvalidExpression, t4, r4), this.context.isAssignmentTarget || this.tolerateError(l3.InvalidLeftHandSideInAssignment, t4), this.matchPunctuator("=") || (this.context.isAssignmentTarget = false), this.readNextRawToken();
  2001. const n3 = this.isolateCoverGrammar(this.parseAssignmentExpression);
  2002. return this.finalize({ type: e4.AssignmentExpression, left: e7, operator: i3, right: n3, ...this.getItemLocation(t4) });
  2003. }
  2004. parseExpression() {
  2005. return this.isolateCoverGrammar(this.parseAssignmentExpression);
  2006. }
  2007. parseStatements(t4 = null) {
  2008. const e7 = [];
  2009. for (; this.rawToken.type !== c4.EOF && !this.matchPunctuator(t4); ) {
  2010. const t5 = this.parseStatementListItem();
  2011. y3(t5) || e7.push(t5);
  2012. }
  2013. return e7;
  2014. }
  2015. parseStatementListItem() {
  2016. return this.context.isAssignmentTarget = true, this.matchKeyword("function") ? this.parseFunctionDeclaration() : this.matchKeyword("export") ? this.parseExportDeclaration() : this.matchKeyword("import") ? this.parseImportDeclaration() : this.parseStatement();
  2017. }
  2018. parseBlock() {
  2019. const t4 = this.captureStartMarker();
  2020. this.expectPunctuator("{");
  2021. const e7 = this.parseStatements("}");
  2022. return this.expectPunctuator("}"), this.finalize({ type: e4.BlockStatement, body: e7, ...this.getItemLocation(t4) });
  2023. }
  2024. parseObjectStatement() {
  2025. const t4 = this.captureStartMarker(), e7 = this.parseObjectExpression();
  2026. return this.finalize({ type: e4.ExpressionStatement, expression: e7, ...this.getItemLocation(t4) });
  2027. }
  2028. parseBlockOrObjectStatement() {
  2029. if (this.context.curlyParsingType === k3.AsObject)
  2030. return this.parseObjectStatement();
  2031. return this.peekAhead((t4) => {
  2032. let e7 = t4();
  2033. return (e7.type === c4.Identifier || e7.type === c4.StringLiteral) && (e7 = t4(), e7.type === c4.Punctuator && ":" === e7.value);
  2034. }) ? this.parseObjectStatement() : this.parseBlock();
  2035. }
  2036. parseIdentifier() {
  2037. const t4 = this.rawToken;
  2038. if (t4.type !== c4.Identifier)
  2039. return null;
  2040. const e7 = this.captureStartMarker();
  2041. return this.readNextRawToken(), this.finalize({ type: e4.Identifier, name: t4.value, ...this.getItemLocation(e7) });
  2042. }
  2043. parseVariableDeclarator() {
  2044. const t4 = this.captureStartMarker(), e7 = this.parseIdentifier();
  2045. e7 || this.throwUnexpectedToken({ code: l3.IdentiferExpected });
  2046. let r4 = null;
  2047. if (this.matchPunctuator("=")) {
  2048. this.readNextRawToken();
  2049. const t5 = this.rawToken;
  2050. try {
  2051. r4 = this.isolateCoverGrammar(this.parseAssignmentExpression);
  2052. } catch (i3) {
  2053. this.throwUnexpectedToken({ rawToken: t5, code: l3.InvalidVariableAssignment });
  2054. }
  2055. }
  2056. return this.finalize({ type: e4.VariableDeclarator, id: e7, init: r4, ...this.getItemLocation(t4) });
  2057. }
  2058. parseVariableDeclarationList() {
  2059. const t4 = [this.parseVariableDeclarator()];
  2060. for (; this.matchPunctuator(","); )
  2061. this.readNextRawToken(), t4.push(this.parseVariableDeclarator());
  2062. return t4;
  2063. }
  2064. parseVariableDeclaration() {
  2065. const t4 = this.captureStartMarker();
  2066. this.expectKeyword("var");
  2067. const e7 = this.parseVariableDeclarationList();
  2068. return this.consumeSemicolon(), this.finalize({ type: e4.VariableDeclaration, declarations: e7, kind: "var", ...this.getItemLocation(t4) });
  2069. }
  2070. parseEmptyStatement() {
  2071. const t4 = this.captureStartMarker();
  2072. return this.expectPunctuator(";"), this.finalize({ type: e4.EmptyStatement, ...this.getItemLocation(t4) });
  2073. }
  2074. parseExpressionStatement() {
  2075. const t4 = this.captureStartMarker(), e7 = this.parseExpression();
  2076. return this.consumeSemicolon(), this.finalize({ type: e4.ExpressionStatement, expression: e7, ...this.getItemLocation(t4) });
  2077. }
  2078. parseIfClause() {
  2079. return this.withBlockContext(x3.IfClause, this.parseStatement);
  2080. }
  2081. parseIfStatement() {
  2082. const t4 = this.captureStartMarker();
  2083. this.expectKeyword("if"), this.expectPunctuator("(");
  2084. const e7 = this.captureStartMarker(), r4 = this.parseExpression(), i3 = this.captureStartMarker();
  2085. this.expectPunctuator(")"), r4.type !== e4.AssignmentExpression && r4.type !== e4.UpdateExpression || this.throwError(l3.InvalidExpression, e7, i3);
  2086. const n3 = this.parseIfClause();
  2087. let s9 = null;
  2088. return this.matchKeyword("else") && (this.readNextRawToken(), s9 = this.parseIfClause()), this.finalize({ type: e4.IfStatement, test: r4, consequent: n3, alternate: s9, ...this.getItemLocation(t4) });
  2089. }
  2090. parseWhileStatement() {
  2091. const t4 = this.captureStartMarker();
  2092. this.expectKeyword("while"), this.expectPunctuator("(");
  2093. const e7 = this.captureStartMarker(), r4 = this.parseExpression(), i3 = this.captureStartMarker();
  2094. this.expectPunctuator(")"), r4.type !== e4.AssignmentExpression && r4.type !== e4.UpdateExpression || this.throwError(l3.InvalidExpression, e7, i3);
  2095. const n3 = this.withBlockContext(x3.WhileLoop, this.parseStatement);
  2096. return this.finalize({ type: e4.WhileStatement, test: r4, body: n3, ...this.getItemLocation(t4) });
  2097. }
  2098. parseForStatement() {
  2099. let t4 = null, e7 = null, r4 = null, i3 = null, n3 = null;
  2100. const s9 = this.captureStartMarker();
  2101. if (this.expectKeyword("for"), this.expectPunctuator("("), this.matchPunctuator(";"))
  2102. this.readNextRawToken();
  2103. else if (this.matchKeyword("var")) {
  2104. const e8 = this.captureStartMarker();
  2105. this.readNextRawToken();
  2106. const r5 = this.parseVariableDeclarationList();
  2107. if (1 === r5.length && this.matchKeyword("in")) {
  2108. r5[0].init && this.throwError(l3.ForInOfLoopInitializer, e8), i3 = this.finalize({ type: e4.VariableDeclaration, declarations: r5, kind: "var", ...this.getItemLocation(e8) }), this.readNextRawToken(), n3 = this.parseExpression();
  2109. } else
  2110. this.matchKeyword("in") && this.throwError(l3.InvalidLeftHandSideInForIn, e8), t4 = this.finalize({ type: e4.VariableDeclaration, declarations: r5, kind: "var", ...this.getItemLocation(e8) }), this.expectPunctuator(";");
  2111. } else {
  2112. const e8 = this.context.isAssignmentTarget, r5 = this.captureStartMarker();
  2113. t4 = this.inheritCoverGrammar(this.parseAssignmentExpression), this.matchKeyword("in") ? (this.context.isAssignmentTarget || this.tolerateError(l3.InvalidLeftHandSideInForIn, r5), t4.type !== e4.Identifier && this.throwError(l3.InvalidLeftHandSideInForIn, r5), this.readNextRawToken(), i3 = t4, n3 = this.parseExpression(), t4 = null) : (this.context.isAssignmentTarget = e8, this.expectPunctuator(";"));
  2114. }
  2115. i3 || (this.matchPunctuator(";") || (e7 = this.isolateCoverGrammar(this.parseExpression)), this.expectPunctuator(";"), this.matchPunctuator(")") || (r4 = this.isolateCoverGrammar(this.parseExpression))), this.expectPunctuator(")");
  2116. const o5 = this.withBlockContext(x3.ForLoop, () => this.isolateCoverGrammar(this.parseStatement));
  2117. return i3 && n3 ? this.finalize({ type: e4.ForInStatement, left: i3, right: n3, body: o5, ...this.getItemLocation(s9) }) : this.finalize({ type: e4.ForStatement, init: t4, test: e7, update: r4, body: o5, ...this.getItemLocation(s9) });
  2118. }
  2119. parseContinueStatement() {
  2120. const t4 = this.captureStartMarker();
  2121. return this.expectKeyword("continue"), this.consumeSemicolon(), this.finalize({ type: e4.ContinueStatement, ...this.getItemLocation(t4) });
  2122. }
  2123. parseBreakStatement() {
  2124. const t4 = this.captureStartMarker();
  2125. return this.expectKeyword("break"), this.consumeSemicolon(), this.finalize({ type: e4.BreakStatement, ...this.getItemLocation(t4) });
  2126. }
  2127. parseReturnStatement() {
  2128. const t4 = this.captureStartMarker();
  2129. this.expectKeyword("return");
  2130. const e7 = !this.matchPunctuator(";") && !this.matchPunctuator("}") && !this.hasLineTerminator && this.rawToken.type !== c4.EOF || this.rawToken.type === c4.StringLiteral || this.rawToken.type === c4.Template ? this.parseExpression() : null;
  2131. return this.consumeSemicolon(), this.finalize({ type: e4.ReturnStatement, argument: e7, ...this.getItemLocation(t4) });
  2132. }
  2133. parseStatement() {
  2134. switch (this.rawToken.type) {
  2135. case c4.BooleanLiteral:
  2136. case c4.NullLiteral:
  2137. case c4.NumericLiteral:
  2138. case c4.StringLiteral:
  2139. case c4.Template:
  2140. case c4.Identifier:
  2141. return this.parseExpressionStatement();
  2142. case c4.Punctuator:
  2143. return "{" === this.rawToken.value ? this.parseBlockOrObjectStatement() : "(" === this.rawToken.value ? this.parseExpressionStatement() : ";" === this.rawToken.value ? this.parseEmptyStatement() : this.parseExpressionStatement();
  2144. case c4.Keyword:
  2145. switch (this.rawToken.value.toLowerCase()) {
  2146. case "break":
  2147. return this.parseBreakStatement();
  2148. case "continue":
  2149. return this.parseContinueStatement();
  2150. case "for":
  2151. return this.parseForStatement();
  2152. case "function":
  2153. return this.parseFunctionDeclaration();
  2154. case "if":
  2155. return this.parseIfStatement();
  2156. case "return":
  2157. return this.parseReturnStatement();
  2158. case "var":
  2159. return this.parseVariableDeclaration();
  2160. case "while":
  2161. return this.parseWhileStatement();
  2162. default:
  2163. return this.parseExpressionStatement();
  2164. }
  2165. default:
  2166. return this.throwUnexpectedToken({ rawToken: this.rawToken });
  2167. }
  2168. }
  2169. parseFormalParameters() {
  2170. const t4 = [];
  2171. if (this.expectPunctuator("("), !this.matchPunctuator(")"))
  2172. for (; this.rawToken.type !== c4.EOF; ) {
  2173. const e7 = this.parseIdentifier();
  2174. if (e7 || this.throwUnexpectedToken({ rawToken: this.rawToken, code: l3.IdentiferExpected }), t4.push(e7), this.matchPunctuator(")"))
  2175. break;
  2176. if (this.expectPunctuator(","), this.matchPunctuator(")"))
  2177. break;
  2178. }
  2179. return this.expectPunctuator(")"), t4;
  2180. }
  2181. parseFunctionDeclaration() {
  2182. (this.context.blockContext & x3.Function) === x3.Function && this.throwUnexpectedToken({ code: l3.NoFunctionInsideFunction }), (this.context.blockContext & x3.WhileLoop) !== x3.WhileLoop && (this.context.blockContext & x3.IfClause) !== x3.IfClause || this.throwUnexpectedToken({ code: l3.NoFunctionInsideBlock });
  2183. const t4 = this.captureStartMarker();
  2184. this.expectKeyword("function");
  2185. const e7 = this.parseIdentifier();
  2186. e7 || this.throwUnexpectedToken({ code: l3.InvalidFunctionIdentifier });
  2187. const r4 = this.parseFormalParameters(), i3 = this.context.blockContext;
  2188. this.context.blockContext = this.context.blockContext | x3.Function;
  2189. const n3 = this.parseBlock();
  2190. return this.context.blockContext = i3, this.finalize({ type: e4.FunctionDeclaration, id: e7, params: r4, body: n3, ...this.getItemLocation(t4) });
  2191. }
  2192. parseScript() {
  2193. const t4 = this.captureStartMarker(), e7 = this.parseStatements(), r4 = this.finalize({ type: e4.Program, body: e7, ...this.getItemLocation(t4) });
  2194. return this.options.tokens && (r4.tokens = this.tokens), this.options.tolerant && (r4.errors = this.errorHandler.errors), r4;
  2195. }
  2196. parseExportDeclaration() {
  2197. this.context.blockContext !== x3.None && this.throwUnexpectedToken({ code: l3.ModuleExportRootOnly });
  2198. let t4 = null;
  2199. const e7 = this.captureStartMarker();
  2200. return this.expectKeyword("export"), this.matchKeyword("var") ? t4 = this.parseVariableDeclaration() : this.matchKeyword("function") ? t4 = this.parseFunctionDeclaration() : this.throwUnexpectedToken({ code: l3.InvalidExpression }), this.finalize({ type: e4.ExportNamedDeclaration, declaration: t4, specifiers: [], source: null, ...this.getItemLocation(e7) });
  2201. }
  2202. parseModuleSpecifier() {
  2203. const t4 = this.captureStartMarker(), e7 = this.rawToken;
  2204. if (e7.type === c4.StringLiteral)
  2205. return this.readNextRawToken(), this.finalize({ type: e4.Literal, value: e7.value, raw: this.getSourceValue(e7), isString: true, ...this.getItemLocation(t4) });
  2206. this.throwError(l3.InvalidModuleUri, t4);
  2207. }
  2208. parseDefaultSpecifier() {
  2209. const t4 = this.captureStartMarker(), e7 = this.parseIdentifier();
  2210. return e7 || this.throwUnexpectedToken({ code: l3.InvalidFunctionIdentifier }), this.finalize({ type: e4.ImportDefaultSpecifier, local: e7, ...this.getItemLocation(t4) });
  2211. }
  2212. parseImportDeclaration() {
  2213. this.context.blockContext !== x3.None && this.throwUnexpectedToken({ code: l3.ModuleImportRootOnly });
  2214. const t4 = this.captureStartMarker();
  2215. this.expectKeyword("import");
  2216. const e7 = this.parseDefaultSpecifier();
  2217. this.expectContextualKeyword("from");
  2218. const r4 = this.parseModuleSpecifier();
  2219. return this.finalize({ type: e4.ImportDeclaration, specifiers: [e7], source: r4, ...this.getItemLocation(t4) });
  2220. }
  2221. };
  2222. // node_modules/@arcgis/core/arcade/lib/arcade-parser.js
  2223. function s7(r4, s9, t4) {
  2224. return new T2(r4, s9, t4).parseScript();
  2225. }
  2226. // node_modules/@arcgis/core/arcade/parser.js
  2227. function d4(d5, l6 = []) {
  2228. const r4 = s7(d5);
  2229. if (null === r4.body || void 0 === r4.body)
  2230. throw new d2({ index: 0, line: 0, column: 0, data: null, description: "", code: l3.InvalidExpression });
  2231. if (0 === r4.body.length)
  2232. throw new d2({ index: 0, line: 0, column: 0, data: null, description: "", code: l3.InvalidExpression });
  2233. if (0 === r4.body.length)
  2234. throw new d2({ index: 0, line: 0, column: 0, data: null, description: "", code: l3.InvalidExpression });
  2235. return r4.loadedModules = {}, d(r4, l6), r4;
  2236. }
  2237. // node_modules/@arcgis/core/arcade/featureset/support/RecentlyUsedCache.js
  2238. var e6 = class {
  2239. constructor(e7) {
  2240. const s9 = this;
  2241. s9._keys = [], s9._values = [], s9.length = 0, e7 && e7.forEach((e8) => {
  2242. s9.set(e8[0], e8[1]);
  2243. });
  2244. }
  2245. entries() {
  2246. return [].slice.call(this.keys().map((e7, s9) => [e7, this._values[s9]]));
  2247. }
  2248. keys() {
  2249. return [].slice.call(this._keys);
  2250. }
  2251. values() {
  2252. return [].slice.call(this._values);
  2253. }
  2254. has(e7) {
  2255. return this._keys.includes(e7);
  2256. }
  2257. get(e7) {
  2258. const s9 = this._keys.indexOf(e7);
  2259. return s9 > -1 ? this._values[s9] : null;
  2260. }
  2261. deepGet(s9) {
  2262. if (!s9 || !s9.length)
  2263. return null;
  2264. const t4 = (s10, i3) => null == s10 ? null : i3.length ? t4(s10 instanceof e6 ? s10.get(i3[0]) : s10[i3[0]], i3.slice(1)) : s10;
  2265. return t4(this.get(s9[0]), s9.slice(1));
  2266. }
  2267. set(e7, s9) {
  2268. const t4 = this, i3 = this._keys.indexOf(e7);
  2269. return i3 > -1 ? t4._values[i3] = s9 : (t4._keys.push(e7), t4._values.push(s9), t4.length = t4._values.length), this;
  2270. }
  2271. sortedSet(e7, s9, t4, i3) {
  2272. const h3 = this, l6 = this._keys.length, r4 = t4 || 0, n3 = void 0 !== i3 ? i3 : l6 - 1;
  2273. if (0 === l6)
  2274. return h3._keys.push(e7), h3._values.push(s9), h3;
  2275. if (e7 === this._keys[r4])
  2276. return this._values.splice(r4, 0, s9), this;
  2277. if (e7 === this._keys[n3])
  2278. return this._values.splice(n3, 0, s9), this;
  2279. if (e7 > this._keys[n3])
  2280. return this._keys.splice(n3 + 1, 0, e7), this._values.splice(n3 + 1, 0, s9), this;
  2281. if (e7 < this._keys[r4])
  2282. return this._values.splice(r4, 0, s9), this._keys.splice(r4, 0, e7), this;
  2283. if (r4 >= n3)
  2284. return this;
  2285. const u7 = r4 + Math.floor((n3 - r4) / 2);
  2286. return e7 < this._keys[u7] ? this.sortedSet(e7, s9, r4, u7 - 1) : e7 > this._keys[u7] ? this.sortedSet(e7, s9, u7 + 1, n3) : this;
  2287. }
  2288. size() {
  2289. return this.length;
  2290. }
  2291. clear() {
  2292. const e7 = this;
  2293. return e7._keys.length = e7.length = e7._values.length = 0, this;
  2294. }
  2295. delete(e7) {
  2296. const s9 = this, t4 = s9._keys.indexOf(e7);
  2297. return t4 > -1 && (s9._keys.splice(t4, 1), s9._values.splice(t4, 1), s9.length = s9._keys.length, true);
  2298. }
  2299. forEach(e7) {
  2300. this._keys.forEach((s9, t4) => {
  2301. e7(this._values[t4], s9, t4);
  2302. });
  2303. }
  2304. map(e7) {
  2305. return this.keys().map((s9, t4) => e7(this._values[t4], s9, t4));
  2306. }
  2307. filter(e7) {
  2308. const s9 = this;
  2309. return s9._keys.forEach((t4, i3) => {
  2310. false === e7(s9._values[i3], t4, i3) && s9.delete(t4);
  2311. }), this;
  2312. }
  2313. clone() {
  2314. return new e6(this.entries());
  2315. }
  2316. };
  2317. var s8 = class {
  2318. constructor(s9 = 20) {
  2319. this._maxEntries = s9, this._values = new e6();
  2320. }
  2321. delete(e7) {
  2322. this._values.has(e7) && this._values.delete(e7);
  2323. }
  2324. get(e7) {
  2325. let s9 = null;
  2326. return this._values.has(e7) && (s9 = this._values.get(e7), this._values.delete(e7), this._values.set(e7, s9)), s9;
  2327. }
  2328. put(e7, s9) {
  2329. if (this._values.size() >= this._maxEntries) {
  2330. const e8 = this._values.keys()[0];
  2331. this._values.delete(e8);
  2332. }
  2333. this._values.set(e7, s9);
  2334. }
  2335. };
  2336. var t3 = class {
  2337. constructor(e7 = 20) {
  2338. this._maxEntries = e7, this._cache = new s8(this._maxEntries);
  2339. }
  2340. clear() {
  2341. this._cache = new s8(this._maxEntries);
  2342. }
  2343. addToCache(e7, s9) {
  2344. this._cache.put(e7, s9);
  2345. }
  2346. removeFromCache(e7) {
  2347. this._cache.delete(e7);
  2348. }
  2349. getFromCache(e7) {
  2350. return this._cache.get(e7);
  2351. }
  2352. };
  2353. // node_modules/@arcgis/core/arcade/ArcadeModuleResolver.js
  2354. var l5 = class {
  2355. constructor(e7) {
  2356. this.portalUri = e7;
  2357. }
  2358. normalizeModuleUri(e7) {
  2359. const r4 = /^[a-z0-9A-Z]+(@[0-9]+\.[0-9]+\.[0-9]+)?([\?|\/].*)?$/gi, o5 = /(?<portalurl>.+)\/home\/item\.html\?id\=(?<itemid>.+)$/gi, c5 = /(?<portalurl>.+)\/sharing\/rest\/content\/users\/[a-zA-Z0-9]+\/items\/(?<itemid>.+)$/gi, u7 = /(?<portalurl>.+)\/sharing\/rest\/content\/items\/(?<itemid>.+)$/gi, n3 = /(?<itemid>.*)@(?<versionstring>[0-9]+\.[0-9]+\.[0-9]+)([\?|\/].*)?$/gi;
  2360. if (e7.startsWith("portal+")) {
  2361. let l6 = e7.substring(7), a3 = "", m5 = l6, d5 = false;
  2362. for (const e8 of [o5, u7, c5]) {
  2363. const t4 = e8.exec(l6);
  2364. if (null !== t4) {
  2365. const e9 = t4.groups;
  2366. m5 = e9.itemid, a3 = e9.portalurl, d5 = true;
  2367. break;
  2368. }
  2369. }
  2370. if (false === d5) {
  2371. if (!r4.test(l6))
  2372. throw new p2(l.UnsupportedUriProtocol, { uri: e7 });
  2373. m5 = l6, a3 = this.portalUri;
  2374. }
  2375. m5.includes("/") && (m5 = m5.split("/")[0]), m5.includes("?") && (m5 = m5.split("?")[0]);
  2376. let h3 = "current";
  2377. const p5 = n3.exec(m5);
  2378. if (null !== p5) {
  2379. const e8 = p5.groups;
  2380. m5 = e8.itemid, h3 = e8.versionstring;
  2381. }
  2382. return l6 = new j2({ url: a3 }).restUrl + "/content/items/" + m5 + "/resources/" + h3 + ".arc", { url: l6, scheme: "portal", uri: "PO:" + l6 };
  2383. }
  2384. if (e7.startsWith("mock")) {
  2385. if ("mock" === e7) {
  2386. return { url: "", scheme: "mock", data: '\n export var hello = 1;\n export function helloWorld() {\n return "Hello World " + hello;\n }\n ', uri: "mock" };
  2387. }
  2388. const t4 = e7.replace("mock:", "");
  2389. if (void 0 !== l5.mocks[t4])
  2390. return { url: "", scheme: "mock", data: l5.mocks[t4], uri: e7 };
  2391. }
  2392. throw new p2(l.UnrecognisedUri, { uri: e7 });
  2393. }
  2394. async fetchModule(e7) {
  2395. const t4 = l5.cachedModules.getFromCache(e7.uri);
  2396. if (t4)
  2397. return t4;
  2398. const r4 = this.fetchSource(e7);
  2399. l5.cachedModules.addToCache(e7.uri, r4);
  2400. let o5 = null;
  2401. try {
  2402. o5 = await r4;
  2403. } catch (s9) {
  2404. throw l5.cachedModules.removeFromCache(e7.uri), s9;
  2405. }
  2406. return o5;
  2407. }
  2408. async fetchSource(t4) {
  2409. var _a;
  2410. if ("portal" === t4.scheme) {
  2411. const o5 = await U(t4.url, { responseType: "text", query: {} });
  2412. if (o5.data)
  2413. return d4(o5.data, []);
  2414. }
  2415. if ("mock" === t4.scheme)
  2416. return d4((_a = t4.data) != null ? _a : "", []);
  2417. throw new p2(l.UnsupportedUriProtocol);
  2418. }
  2419. static create(e7) {
  2420. return new l5(e7);
  2421. }
  2422. static getDefault() {
  2423. var _a;
  2424. return (_a = this._default) != null ? _a : l5._default = l5._moduleResolverFactory();
  2425. }
  2426. static set moduleResolverClass(e7) {
  2427. this._moduleResolverFactory = e7, this._default = null;
  2428. }
  2429. };
  2430. l5.mocks = {}, l5.cachedModules = new t3(30), l5._default = null, l5._moduleResolverFactory = () => {
  2431. const e7 = j2.getDefault();
  2432. return new l5(e7.url);
  2433. };
  2434. // node_modules/@arcgis/core/arcade/arcadeRuntime.js
  2435. var P3 = class extends r {
  2436. constructor(e7, t4) {
  2437. super(), this.definition = null, this.context = null, this.definition = e7, this.context = t4;
  2438. }
  2439. createFunction(e7) {
  2440. return (...t4) => {
  2441. const n3 = { spatialReference: this.context.spatialReference, console: this.context.console, lrucache: this.context.lrucache, exports: this.context.exports, libraryResolver: this.context.libraryResolver, interceptor: this.context.interceptor, localScope: {}, depthCounter: { depth: e7.depthCounter.depth + 1 }, globalScope: this.context.globalScope };
  2442. if (n3.depthCounter.depth > 64)
  2443. throw new t(e7, e.MaximumCallDepth, null);
  2444. return Ie2(this.definition, n3, t4, null);
  2445. };
  2446. }
  2447. call(e7, t4) {
  2448. return V4(e7, t4, (n3, l6, a3) => {
  2449. const i3 = { spatialReference: e7.spatialReference, globalScope: e7.globalScope, depthCounter: { depth: e7.depthCounter.depth + 1 }, libraryResolver: e7.libraryResolver, exports: e7.exports, console: e7.console, lrucache: e7.lrucache, interceptor: e7.interceptor, localScope: {} };
  2450. if (i3.depthCounter.depth > 64)
  2451. throw new t(e7, e.MaximumCallDepth, t4);
  2452. return Ie2(this.definition, i3, a3, t4);
  2453. });
  2454. }
  2455. marshalledCall(e7, t4, n3, r4) {
  2456. return r4(e7, t4, (o5, l6, a3) => {
  2457. const i3 = { spatialReference: e7.spatialReference, globalScope: n3.globalScope, depthCounter: { depth: e7.depthCounter.depth + 1 }, libraryResolver: e7.libraryResolver, exports: e7.exports, console: e7.console, lrucache: e7.lrucache, interceptor: e7.interceptor, localScope: {} };
  2458. return a3 = a3.map((t5) => !F(t5) || t5 instanceof s2 ? t5 : n(t5, e7, r4)), n(Ie2(this.definition, i3, a3, t4), n3, r4);
  2459. });
  2460. }
  2461. };
  2462. var T4 = class extends s3 {
  2463. constructor(e7) {
  2464. super(e7);
  2465. }
  2466. global(e7) {
  2467. const t4 = this.executingContext.globalScope[e7.toLowerCase()];
  2468. if (t4.valueset || (t4.value = _2(this.executingContext, t4.node), t4.valueset = true), F(t4.value) && !(t4.value instanceof s2)) {
  2469. const e8 = new s2();
  2470. e8.fn = t4.value, e8.parameterEvaluator = V4, e8.context = this.executingContext, t4.value = e8;
  2471. }
  2472. return t4.value;
  2473. }
  2474. setGlobal(e7, t4) {
  2475. if (F(t4))
  2476. throw new t(null, e.AssignModuleFunction, null);
  2477. this.executingContext.globalScope[e7.toLowerCase()] = { value: t4, valueset: true, node: null };
  2478. }
  2479. hasGlobal(e7) {
  2480. return void 0 === this.executingContext.exports[e7] && (e7 = e7.toLowerCase()), void 0 !== this.executingContext.exports[e7];
  2481. }
  2482. loadModule(e7) {
  2483. let n3 = e7.spatialReference;
  2484. null == n3 && (n3 = new k({ wkid: 102100 })), this.moduleScope = Ce2({}, e7.customfunctions), this.executingContext = { spatialReference: n3, globalScope: this.moduleScope, localScope: null, libraryResolver: new s4(e7.libraryResolver._moduleSingletons, this.source.syntax.loadedModules), exports: {}, console: e7.console ? e7.console : Ae2, lrucache: e7.lrucache, interceptor: e7.interceptor, depthCounter: { depth: 1 } }, _2(this.executingContext, this.source.syntax);
  2485. }
  2486. };
  2487. function W3(e7, t4) {
  2488. const n3 = [];
  2489. for (let r4 = 0; r4 < t4.arguments.length; r4++)
  2490. n3.push(_2(e7, t4.arguments[r4]));
  2491. return n3;
  2492. }
  2493. function V4(e7, t4, n3) {
  2494. try {
  2495. return true === t4.preparsed ? n3(e7, null, t4.arguments) : n3(e7, t4, W3(e7, t4));
  2496. } catch (r4) {
  2497. throw r4;
  2498. }
  2499. }
  2500. function _2(e7, t4) {
  2501. try {
  2502. switch (t4 == null ? void 0 : t4.type) {
  2503. case "EmptyStatement":
  2504. return k2;
  2505. case "VariableDeclarator":
  2506. return ue2(e7, t4);
  2507. case "VariableDeclaration":
  2508. return se3(e7, t4);
  2509. case "ImportDeclaration":
  2510. return ae2(e7, t4);
  2511. case "ExportNamedDeclaration":
  2512. return ie2(e7, t4);
  2513. case "BlockStatement":
  2514. case "Program":
  2515. return re3(e7, t4);
  2516. case "FunctionDeclaration":
  2517. return le2(e7, t4);
  2518. case "ReturnStatement":
  2519. return oe2(e7, t4);
  2520. case "IfStatement":
  2521. return ne2(e7, t4);
  2522. case "ExpressionStatement":
  2523. return te2(e7, t4);
  2524. case "AssignmentExpression":
  2525. return ee2(e7, t4);
  2526. case "UpdateExpression":
  2527. return Z3(e7, t4);
  2528. case "BreakStatement":
  2529. return j;
  2530. case "ContinueStatement":
  2531. return A;
  2532. case "TemplateElement":
  2533. return we2(e7, t4);
  2534. case "TemplateLiteral":
  2535. return ge2(e7, t4);
  2536. case "ForStatement":
  2537. return J4(e7, t4);
  2538. case "ForInStatement":
  2539. return H3(e7, t4);
  2540. case "WhileStatement":
  2541. return Q3(e7, t4);
  2542. case "Identifier":
  2543. return ve3(e7, t4);
  2544. case "MemberExpression":
  2545. return ce2(e7, t4);
  2546. case "Literal":
  2547. return t4.value;
  2548. case "CallExpression":
  2549. return ye2(e7, t4);
  2550. case "UnaryExpression":
  2551. return fe2(e7, t4);
  2552. case "BinaryExpression":
  2553. return de2(e7, t4);
  2554. case "LogicalExpression":
  2555. return he2(e7, t4);
  2556. case "ArrayExpression":
  2557. return pe2(e7, t4);
  2558. case "ObjectExpression":
  2559. return Y3(e7, t4);
  2560. case "Property":
  2561. return z3(e7, t4);
  2562. default:
  2563. throw new t(e7, e.Unrecognised, t4);
  2564. }
  2565. } catch (n3) {
  2566. throw u2(e7, t4, n3);
  2567. }
  2568. }
  2569. function Y3(e7, t4) {
  2570. const l6 = {}, a3 = /* @__PURE__ */ new Map();
  2571. for (let n3 = 0; n3 < t4.properties.length; n3++) {
  2572. const i4 = _2(e7, t4.properties[n3]);
  2573. if (F(i4.value))
  2574. throw new t(e7, e.NoFunctionInDictionary, t4);
  2575. if (false === w3(i4.key))
  2576. throw new t(e7, e.KeyMustBeString, t4);
  2577. let s9 = i4.key.toString();
  2578. const u7 = s9.toLowerCase();
  2579. a3.has(u7) ? s9 = a3.get(u7) : a3.set(u7, s9), i4.value === k2 ? l6[s9] = null : l6[s9] = i4.value;
  2580. }
  2581. const i3 = new J2(l6);
  2582. return i3.immutable = false, i3;
  2583. }
  2584. function z3(e7, t4) {
  2585. return { key: "Identifier" === t4.key.type ? t4.key.name : _2(e7, t4.key), value: _2(e7, t4.value) };
  2586. }
  2587. function H3(e7, t4) {
  2588. const l6 = _2(e7, t4.right);
  2589. "VariableDeclaration" === t4.left.type && _2(e7, t4.left);
  2590. let a3 = null, i3 = "";
  2591. if ("VariableDeclaration" === t4.left.type) {
  2592. const e8 = t4.left.declarations[0].id;
  2593. "Identifier" === e8.type && (i3 = e8.name);
  2594. } else
  2595. "Identifier" === t4.left.type && (i3 = t4.left.name);
  2596. if (!i3)
  2597. throw new t(e7, e.InvalidIdentifier, t4);
  2598. if (i3 = i3.toLowerCase(), null != e7.localScope && void 0 !== e7.localScope[i3] && (a3 = e7.localScope[i3]), null === a3 && void 0 !== e7.globalScope[i3] && (a3 = e7.globalScope[i3]), null === a3)
  2599. throw new t(e7, e.InvalidIdentifier, t4);
  2600. if (Y(l6) || w3(l6)) {
  2601. const n3 = l6.length;
  2602. for (let r4 = 0; r4 < n3; r4++) {
  2603. a3.value = r4;
  2604. const n4 = _2(e7, t4.body);
  2605. if (n4 === j)
  2606. break;
  2607. if (n4 instanceof D)
  2608. return n4;
  2609. }
  2610. return k2;
  2611. }
  2612. if (E(l6)) {
  2613. for (let n3 = 0; n3 < l6.length(); n3++) {
  2614. a3.value = n3;
  2615. const r4 = _2(e7, t4.body);
  2616. if (r4 === j)
  2617. break;
  2618. if (r4 instanceof D)
  2619. return r4;
  2620. }
  2621. return k2;
  2622. }
  2623. if (!(l6 instanceof J2 || J(l6)))
  2624. return k2;
  2625. {
  2626. const n3 = l6.keys();
  2627. for (let r4 = 0; r4 < n3.length; r4++) {
  2628. a3.value = n3[r4];
  2629. const o5 = _2(e7, t4.body);
  2630. if (o5 === j)
  2631. break;
  2632. if (o5 instanceof D)
  2633. return o5;
  2634. }
  2635. }
  2636. }
  2637. function J4(e7, t4) {
  2638. null !== t4.init && _2(e7, t4.init);
  2639. const n3 = { testResult: true, lastAction: k2 };
  2640. do {
  2641. X3(e7, t4, n3);
  2642. } while (true === n3.testResult);
  2643. return n3.lastAction instanceof D ? n3.lastAction : k2;
  2644. }
  2645. function Q3(e7, t4) {
  2646. const n3 = { testResult: true, lastAction: k2 };
  2647. if (n3.testResult = _2(e7, t4.test), false === n3.testResult)
  2648. return k2;
  2649. if (true !== n3.testResult)
  2650. throw new t(e7, e.BooleanConditionRequired, t4);
  2651. for (; true === n3.testResult && (n3.lastAction = _2(e7, t4.body), n3.lastAction !== j) && !(n3.lastAction instanceof D); )
  2652. if (n3.testResult = _2(e7, t4.test), true !== n3.testResult && false !== n3.testResult)
  2653. throw new t(e7, e.BooleanConditionRequired, t4);
  2654. return n3.lastAction instanceof D ? n3.lastAction : k2;
  2655. }
  2656. function X3(e7, t4, n3) {
  2657. if (null !== t4.test) {
  2658. if (n3.testResult = _2(e7, t4.test), false === n3.testResult)
  2659. return;
  2660. if (true !== n3.testResult)
  2661. throw new t(e7, e.BooleanConditionRequired, t4);
  2662. }
  2663. n3.lastAction = _2(e7, t4.body), n3.lastAction !== j ? n3.lastAction instanceof D ? n3.testResult = false : null !== t4.update && _2(e7, t4.update) : n3.testResult = false;
  2664. }
  2665. function Z3(e7, t4) {
  2666. let l6, a3 = null, i3 = "";
  2667. if ("MemberExpression" === t4.argument.type) {
  2668. if (a3 = _2(e7, t4.argument.object), true === t4.argument.computed ? i3 = _2(e7, t4.argument.property) : "Identifier" === t4.argument.property.type && (i3 = t4.argument.property.name), Y(a3)) {
  2669. if (!Z(i3))
  2670. throw new t(e7, e.ArrayAccessorMustBeNumber, t4);
  2671. if (i3 < 0 && (i3 = a3.length + i3), i3 < 0 || i3 >= a3.length)
  2672. throw new t(e7, e.OutOfBounds, t4);
  2673. l6 = re(a3[i3]), a3[i3] = "++" === t4.operator ? l6 + 1 : l6 - 1;
  2674. } else if (a3 instanceof J2) {
  2675. if (false === w3(i3))
  2676. throw new t(e7, e.KeyAccessorMustBeString, t4);
  2677. if (true !== a3.hasField(i3))
  2678. throw new t(e7, e.FieldNotFound, t4);
  2679. l6 = re(a3.field(i3)), a3.setField(i3, "++" === t4.operator ? l6 + 1 : l6 - 1);
  2680. } else if (J(a3)) {
  2681. if (false === w3(i3))
  2682. throw new t(e7, e.KeyAccessorMustBeString, t4);
  2683. if (true !== a3.hasField(i3))
  2684. throw new t(e7, e.FieldNotFound, t4);
  2685. l6 = re(a3.field(i3)), a3.setField(i3, "++" === t4.operator ? l6 + 1 : l6 - 1);
  2686. } else {
  2687. if (E(a3))
  2688. throw new t(e7, e.Immutable, t4);
  2689. if (!(a3 instanceof T4))
  2690. throw new t(e7, e.InvalidParameter, t4);
  2691. if (false === w3(i3))
  2692. throw new t(e7, e.ModuleAccessorMustBeString, t4);
  2693. if (true !== a3.hasGlobal(i3))
  2694. throw new t(e7, e.ModuleExportNotFound, t4);
  2695. l6 = re(a3.global(i3)), a3.setGlobal(i3, "++" === t4.operator ? l6 + 1 : l6 - 1);
  2696. }
  2697. return false === t4.prefix ? l6 : "++" === t4.operator ? l6 + 1 : l6 - 1;
  2698. }
  2699. if (a3 = "Identifier" === t4.argument.type ? t4.argument.name.toLowerCase() : "", !a3)
  2700. throw new t(e7, e.InvalidIdentifier, t4);
  2701. if (null != e7.localScope && void 0 !== e7.localScope[a3])
  2702. return l6 = re(e7.localScope[a3].value), e7.localScope[a3] = { value: "++" === t4.operator ? l6 + 1 : l6 - 1, valueset: true, node: t4 }, false === t4.prefix ? l6 : "++" === t4.operator ? l6 + 1 : l6 - 1;
  2703. if (void 0 !== e7.globalScope[a3])
  2704. return l6 = re(e7.globalScope[a3].value), e7.globalScope[a3] = { value: "++" === t4.operator ? l6 + 1 : l6 - 1, valueset: true, node: t4 }, false === t4.prefix ? l6 : "++" === t4.operator ? l6 + 1 : l6 - 1;
  2705. throw new t(e7, e.InvalidIdentifier, t4);
  2706. }
  2707. function $(e7, t4, n3, l6, a3) {
  2708. switch (t4) {
  2709. case "=":
  2710. return e7 === k2 ? null : e7;
  2711. case "/=":
  2712. return re(n3) / re(e7);
  2713. case "*=":
  2714. return re(n3) * re(e7);
  2715. case "-=":
  2716. return re(n3) - re(e7);
  2717. case "+=":
  2718. return w3(n3) || w3(e7) ? K(n3) + K(e7) : re(n3) + re(e7);
  2719. case "%=":
  2720. return re(n3) % re(e7);
  2721. default:
  2722. throw new t(a3, e.UnsupportedOperator, l6);
  2723. }
  2724. }
  2725. function ee2(e7, t4) {
  2726. const l6 = _2(e7, t4.right);
  2727. let a3 = null, i3 = "";
  2728. if ("MemberExpression" === t4.left.type) {
  2729. if (a3 = _2(e7, t4.left.object), true === t4.left.computed)
  2730. i3 = _2(e7, t4.left.property);
  2731. else {
  2732. if ("Identifier" !== t4.left.property.type)
  2733. throw new t(e7, e.InvalidIdentifier, t4);
  2734. i3 = t4.left.property.name;
  2735. }
  2736. if (Y(a3)) {
  2737. if (!Z(i3))
  2738. throw new t(e7, e.ArrayAccessorMustBeNumber, t4);
  2739. if (i3 < 0 && (i3 = a3.length + i3), i3 < 0 || i3 > a3.length)
  2740. throw new t(e7, e.OutOfBounds, t4);
  2741. if (i3 === a3.length) {
  2742. if ("=" !== t4.operator)
  2743. throw new t(e7, e.OutOfBounds, t4);
  2744. a3[i3] = $(l6, t4.operator, a3[i3], t4, e7);
  2745. } else
  2746. a3[i3] = $(l6, t4.operator, a3[i3], t4, e7);
  2747. } else if (a3 instanceof J2) {
  2748. if (false === w3(i3))
  2749. throw new t(e7, e.KeyAccessorMustBeString, t4);
  2750. if (true === a3.hasField(i3))
  2751. a3.setField(i3, $(l6, t4.operator, a3.field(i3), t4, e7));
  2752. else {
  2753. if ("=" !== t4.operator)
  2754. throw new t(e7, e.FieldNotFound, t4, { key: i3 });
  2755. a3.setField(i3, $(l6, t4.operator, null, t4, e7));
  2756. }
  2757. } else if (J(a3)) {
  2758. if (false === w3(i3))
  2759. throw new t(e7, e.KeyAccessorMustBeString, t4);
  2760. if (true === a3.hasField(i3))
  2761. a3.setField(i3, $(l6, t4.operator, a3.field(i3), t4, e7));
  2762. else {
  2763. if ("=" !== t4.operator)
  2764. throw new t(e7, e.FieldNotFound, t4, { key: i3 });
  2765. a3.setField(i3, $(l6, t4.operator, null, t4, e7));
  2766. }
  2767. } else {
  2768. if (E(a3))
  2769. throw new t(e7, e.Immutable, t4);
  2770. if (!(a3 instanceof T4))
  2771. throw new t(e7, e.InvalidIdentifier, t4);
  2772. if (false === w3(i3))
  2773. throw new t(e7, e.ModuleAccessorMustBeString, t4);
  2774. if (true !== a3.hasGlobal(i3))
  2775. throw new t(e7, e.ModuleExportNotFound, t4);
  2776. a3.setGlobal(i3, $(l6, t4.operator, a3.global(i3), t4, e7));
  2777. }
  2778. return k2;
  2779. }
  2780. if (a3 = t4.left.name.toLowerCase(), null != e7.localScope && void 0 !== e7.localScope[a3])
  2781. return e7.localScope[a3] = { value: $(l6, t4.operator, e7.localScope[a3].value, t4, e7), valueset: true, node: t4.right }, k2;
  2782. if (void 0 !== e7.globalScope[a3])
  2783. return e7.globalScope[a3] = { value: $(l6, t4.operator, e7.globalScope[a3].value, t4, e7), valueset: true, node: t4.right }, k2;
  2784. throw new t(e7, e.InvalidIdentifier, t4);
  2785. }
  2786. function te2(e7, t4) {
  2787. if ("AssignmentExpression" === t4.expression.type || "UpdateExpression" === t4.expression.type)
  2788. return _2(e7, t4.expression);
  2789. if ("CallExpression" === t4.expression.type) {
  2790. const n3 = _2(e7, t4.expression);
  2791. return n3 === k2 ? k2 : new N(n3);
  2792. }
  2793. {
  2794. const n3 = _2(e7, t4.expression);
  2795. return n3 === k2 ? k2 : new N(n3);
  2796. }
  2797. }
  2798. function ne2(e7, t4) {
  2799. const n3 = _2(e7, t4.test);
  2800. if (true === n3)
  2801. return _2(e7, t4.consequent);
  2802. if (false === n3)
  2803. return null !== t4.alternate ? _2(e7, t4.alternate) : k2;
  2804. throw new t(e7, e.BooleanConditionRequired, t4);
  2805. }
  2806. function re3(e7, t4) {
  2807. let n3 = k2;
  2808. for (let r4 = 0; r4 < t4.body.length; r4++)
  2809. if (n3 = _2(e7, t4.body[r4]), n3 instanceof D || n3 === j || n3 === A)
  2810. return n3;
  2811. return n3;
  2812. }
  2813. function oe2(e7, t4) {
  2814. if (null === t4.argument)
  2815. return new D(k2);
  2816. const n3 = _2(e7, t4.argument);
  2817. return new D(n3);
  2818. }
  2819. function le2(e7, t4) {
  2820. const n3 = t4.id.name.toLowerCase();
  2821. return e7.globalScope[n3] = { valueset: true, node: null, value: new P3(t4, e7) }, k2;
  2822. }
  2823. function ae2(e7, t4) {
  2824. var _a, _b;
  2825. const n3 = t4.specifiers[0].local.name.toLowerCase(), r4 = e7.libraryResolver.loadLibrary(n3);
  2826. let o5 = null;
  2827. return ((_a = e7.libraryResolver._moduleSingletons) == null ? void 0 : _a.has(r4.uri)) ? o5 = e7.libraryResolver._moduleSingletons.get(r4.uri) : (o5 = new T4(r4), o5.loadModule(e7), (_b = e7.libraryResolver._moduleSingletons) == null ? void 0 : _b.set(r4.uri, o5)), e7.globalScope[n3] = { value: o5, valueset: true, node: t4 }, k2;
  2828. }
  2829. function ie2(e7, t4) {
  2830. if (_2(e7, t4.declaration), "FunctionDeclaration" === t4.declaration.type)
  2831. e7.exports[t4.declaration.id.name.toLowerCase()] = "function";
  2832. else if ("VariableDeclaration" === t4.declaration.type)
  2833. for (const n3 of t4.declaration.declarations)
  2834. e7.exports[n3.id.name.toLowerCase()] = "variable";
  2835. return k2;
  2836. }
  2837. function se3(e7, t4) {
  2838. for (let n3 = 0; n3 < t4.declarations.length; n3++)
  2839. _2(e7, t4.declarations[n3]);
  2840. return k2;
  2841. }
  2842. function ue2(e7, t4) {
  2843. let n3 = null === t4.init ? null : _2(e7, t4.init);
  2844. if (n3 === k2 && (n3 = null), "Identifier" !== t4.id.type)
  2845. throw new t(e7, e.InvalidIdentifier, t4);
  2846. const l6 = t4.id.name.toLowerCase();
  2847. return null != e7.localScope ? e7.localScope[l6] = { value: n3, valueset: true, node: t4.init } : e7.globalScope[l6] = { value: n3, valueset: true, node: t4.init }, k2;
  2848. }
  2849. function ce2(e7, t4) {
  2850. try {
  2851. const l6 = _2(e7, t4.object);
  2852. if (null === l6)
  2853. throw new t(e7, e.MemberOfNull, t4);
  2854. if (false === t4.computed) {
  2855. if ("Identifier" === t4.property.type) {
  2856. if (l6 instanceof J2 || J(l6))
  2857. return l6.field(t4.property.name);
  2858. if (l6 instanceof p)
  2859. return W(l6, t4.property.name, t4, e7);
  2860. if (l6 instanceof T4) {
  2861. if (!l6.hasGlobal(t4.property.name))
  2862. throw new t(e7, e.InvalidIdentifier, t4);
  2863. return l6.global(t4.property.name);
  2864. }
  2865. }
  2866. throw new t(e7, e.InvalidMemberAccessKey, t4);
  2867. }
  2868. {
  2869. let a3 = _2(e7, t4.property);
  2870. if (l6 instanceof J2 || J(l6)) {
  2871. if (w3(a3))
  2872. return l6.field(a3);
  2873. throw new t(e7, e.InvalidMemberAccessKey, t4);
  2874. }
  2875. if (l6 instanceof T4) {
  2876. if (w3(a3))
  2877. return l6.global(a3);
  2878. throw new t(e7, e.InvalidMemberAccessKey, t4);
  2879. }
  2880. if (l6 instanceof p) {
  2881. if (w3(a3))
  2882. return W(l6, a3, t4, e7);
  2883. throw new t(e7, e.InvalidMemberAccessKey, t4);
  2884. }
  2885. if (Y(l6)) {
  2886. if (Z(a3) && isFinite(a3) && Math.floor(a3) === a3) {
  2887. if (a3 < 0 && (a3 = l6.length + a3), a3 >= l6.length || a3 < 0)
  2888. throw new t(e7, e.OutOfBounds, t4);
  2889. return l6[a3];
  2890. }
  2891. throw new t(e7, e.InvalidMemberAccessKey, t4);
  2892. }
  2893. if (w3(l6)) {
  2894. if (Z(a3) && isFinite(a3) && Math.floor(a3) === a3) {
  2895. if (a3 < 0 && (a3 = l6.length + a3), a3 >= l6.length || a3 < 0)
  2896. throw new t(e7, e.OutOfBounds, t4);
  2897. return l6[a3];
  2898. }
  2899. throw new t(e7, e.InvalidMemberAccessKey, t4);
  2900. }
  2901. if (E(l6)) {
  2902. if (Z(a3) && isFinite(a3) && Math.floor(a3) === a3) {
  2903. if (a3 < 0 && (a3 = l6.length() + a3), a3 >= l6.length() || a3 < 0)
  2904. throw new t(e7, e.OutOfBounds, t4);
  2905. return l6.get(a3);
  2906. }
  2907. throw new t(e7, e.InvalidMemberAccessKey, t4);
  2908. }
  2909. throw new t(e7, e.InvalidMemberAccessKey, t4);
  2910. }
  2911. } catch (l6) {
  2912. throw l6;
  2913. }
  2914. }
  2915. function fe2(e7, t4) {
  2916. try {
  2917. const n3 = _2(e7, t4.argument);
  2918. if (_(n3)) {
  2919. if ("!" === t4.operator)
  2920. return !n3;
  2921. if ("-" === t4.operator)
  2922. return -1 * re(n3);
  2923. if ("+" === t4.operator)
  2924. return 1 * re(n3);
  2925. if ("~" === t4.operator)
  2926. return ~re(n3);
  2927. throw new t(e7, e.UnsupportedUnaryOperator, t4);
  2928. }
  2929. if ("~" === t4.operator)
  2930. return ~re(n3);
  2931. if ("-" === t4.operator)
  2932. return -1 * re(n3);
  2933. if ("+" === t4.operator)
  2934. return 1 * re(n3);
  2935. throw new t(e7, e.UnsupportedUnaryOperator, t4);
  2936. } catch (n3) {
  2937. throw n3;
  2938. }
  2939. }
  2940. function pe2(e7, t4) {
  2941. try {
  2942. const n3 = [];
  2943. for (let l6 = 0; l6 < t4.elements.length; l6++) {
  2944. const a3 = _2(e7, t4.elements[l6]);
  2945. if (F(a3))
  2946. throw new t(e7, e.NoFunctionInArray, t4);
  2947. a3 === k2 ? n3.push(null) : n3.push(a3);
  2948. }
  2949. return n3;
  2950. } catch (n3) {
  2951. throw n3;
  2952. }
  2953. }
  2954. function de2(e7, t4) {
  2955. try {
  2956. const n3 = [_2(e7, t4.left), _2(e7, t4.right)], l6 = n3[0], a3 = n3[1];
  2957. switch (t4.operator) {
  2958. case "|":
  2959. case "<<":
  2960. case ">>":
  2961. case ">>>":
  2962. case "^":
  2963. case "&":
  2964. return Ne(re(l6), re(a3), t4.operator);
  2965. case "==":
  2966. return X(l6, a3);
  2967. case "!=":
  2968. return !X(l6, a3);
  2969. case "<":
  2970. case ">":
  2971. case "<=":
  2972. case ">=":
  2973. return Q(l6, a3, t4.operator);
  2974. case "+":
  2975. return w3(l6) || w3(a3) ? K(l6) + K(a3) : re(l6) + re(a3);
  2976. case "-":
  2977. return re(l6) - re(a3);
  2978. case "*":
  2979. return re(l6) * re(a3);
  2980. case "/":
  2981. return re(l6) / re(a3);
  2982. case "%":
  2983. return re(l6) % re(a3);
  2984. default:
  2985. throw new t(e7, e.UnsupportedOperator, t4);
  2986. }
  2987. } catch (n3) {
  2988. throw n3;
  2989. }
  2990. }
  2991. function he2(e7, t4) {
  2992. try {
  2993. const n3 = _2(e7, t4.left);
  2994. if (_(n3))
  2995. switch (t4.operator) {
  2996. case "||":
  2997. if (true === n3)
  2998. return n3;
  2999. {
  3000. const n4 = _2(e7, t4.right);
  3001. if (_(n4))
  3002. return n4;
  3003. throw new t(e7, e.LogicExpressionOrAnd, t4);
  3004. }
  3005. case "&&":
  3006. if (false === n3)
  3007. return n3;
  3008. {
  3009. const n4 = _2(e7, t4.right);
  3010. if (_(n4))
  3011. return n4;
  3012. throw new t(e7, e.LogicExpressionOrAnd, t4);
  3013. }
  3014. default:
  3015. throw new t(e7, e.LogicExpressionOrAnd, t4);
  3016. }
  3017. throw new t(e7, e.LogicalExpressionOnlyBoolean, t4);
  3018. } catch (n3) {
  3019. throw n3;
  3020. }
  3021. }
  3022. function we2(e7, t4) {
  3023. return t4.value ? t4.value.cooked : "";
  3024. }
  3025. function me2(e7, t4, n3) {
  3026. if (F(e7))
  3027. throw new t(t4, e.NoFunctionInTemplateLiteral, n3);
  3028. return e7;
  3029. }
  3030. function ge2(e7, t4) {
  3031. let n3 = "", r4 = 0;
  3032. for (const o5 of t4.quasis)
  3033. if (n3 += o5.value ? o5.value.cooked : "", false === o5.tail) {
  3034. n3 += t4.expressions[r4] ? K(me2(_2(e7, t4.expressions[r4]), e7, t4)) : "", r4++;
  3035. }
  3036. return n3;
  3037. }
  3038. function ve3(e7, t4) {
  3039. let n3;
  3040. try {
  3041. const l6 = t4.name.toLowerCase();
  3042. if (null != e7.localScope && void 0 !== e7.localScope[l6])
  3043. return n3 = e7.localScope[l6], true === n3.valueset || (n3.value = _2(e7, n3.node), n3.valueset = true), n3.value;
  3044. if (void 0 !== e7.globalScope[l6])
  3045. return n3 = e7.globalScope[l6], true === n3.valueset || (n3.value = _2(e7, n3.node), n3.valueset = true), n3.value;
  3046. throw new t(e7, e.InvalidIdentifier, t4);
  3047. } catch (l6) {
  3048. throw l6;
  3049. }
  3050. }
  3051. function ye2(e7, t4) {
  3052. try {
  3053. if ("MemberExpression" === t4.callee.type) {
  3054. const n3 = _2(e7, t4.callee.object);
  3055. if (!(n3 instanceof T4))
  3056. throw new t(e7, e.FuncionNotFound, t4);
  3057. const l6 = false === t4.callee.computed ? t4.callee.property.name : _2(e7, t4.callee.property);
  3058. if (!n3.hasGlobal(l6))
  3059. throw new t(e7, e.FuncionNotFound, t4);
  3060. const a3 = n3.global(l6);
  3061. if (!F(a3))
  3062. throw new t(e7, e.CallNonFunction, t4);
  3063. return a3.call(e7, t4);
  3064. }
  3065. if ("Identifier" !== t4.callee.type)
  3066. throw new t(e7, e.FuncionNotFound, t4);
  3067. if (null != e7.localScope && void 0 !== e7.localScope[t4.callee.name.toLowerCase()]) {
  3068. const n3 = e7.localScope[t4.callee.name.toLowerCase()];
  3069. if (F(n3.value))
  3070. return n3.value.call(e7, t4);
  3071. throw new t(e7, e.CallNonFunction, t4);
  3072. }
  3073. if (void 0 !== e7.globalScope[t4.callee.name.toLowerCase()]) {
  3074. const n3 = e7.globalScope[t4.callee.name.toLowerCase()];
  3075. if (F(n3.value))
  3076. return n3.value.call(e7, t4);
  3077. throw new t(e7, e.CallNonFunction, t4);
  3078. }
  3079. throw new t(e7, e.FuncionNotFound, t4);
  3080. } catch (n3) {
  3081. throw n3;
  3082. }
  3083. }
  3084. var be2 = {};
  3085. function xe2(e7, t4, n3, r4) {
  3086. try {
  3087. const o5 = _2(e7, t4.arguments[n3]);
  3088. if (X(o5, r4))
  3089. return _2(e7, t4.arguments[n3 + 1]);
  3090. {
  3091. const o6 = t4.arguments.length - n3;
  3092. return 1 === o6 ? _2(e7, t4.arguments[n3]) : 2 === o6 ? null : 3 === o6 ? _2(e7, t4.arguments[n3 + 2]) : xe2(e7, t4, n3 + 2, r4);
  3093. }
  3094. } catch (o5) {
  3095. throw o5;
  3096. }
  3097. }
  3098. function Se2(e7, t4, n3, l6) {
  3099. try {
  3100. if (true === l6)
  3101. return _2(e7, t4.arguments[n3 + 1]);
  3102. if (3 === t4.arguments.length - n3)
  3103. return _2(e7, t4.arguments[n3 + 2]);
  3104. {
  3105. const l7 = _2(e7, t4.arguments[n3 + 2]);
  3106. if (false === _(l7))
  3107. throw new t(e7, e.BooleanConditionRequired, t4.arguments[n3 + 2]);
  3108. return Se2(e7, t4, n3 + 2, l7);
  3109. }
  3110. } catch (a3) {
  3111. throw a3;
  3112. }
  3113. }
  3114. function Ie2(e7, t4, n3, l6) {
  3115. try {
  3116. const a3 = e7.body;
  3117. if (n3.length !== e7.params.length)
  3118. throw new t(t4, e.WrongNumberOfParameters, l6);
  3119. if (null != t4.localScope)
  3120. for (let r4 = 0; r4 < n3.length; r4++)
  3121. t4.localScope[e7.params[r4].name.toLowerCase()] = { value: n3[r4], valueset: true, node: null };
  3122. const i3 = _2(t4, a3);
  3123. if (i3 instanceof D)
  3124. return i3.value;
  3125. if (i3 === j)
  3126. throw new t(t4, e.UnexpectedToken, l6);
  3127. if (i3 === A)
  3128. throw new t(t4, e.UnexpectedToken, l6);
  3129. return i3 instanceof N ? i3.value : i3;
  3130. } catch (a3) {
  3131. throw a3;
  3132. }
  3133. }
  3134. M(be2, V4), B(be2, V4), N2(be2, V4), C2(be2, V4), f(be2, V4), q(be2, V4), be2.iif = function(e7, t4) {
  3135. try {
  3136. V(null === t4.arguments ? [] : t4.arguments, 3, 3, e7, t4);
  3137. const n3 = _2(e7, t4.arguments[0]);
  3138. if (false === _(n3))
  3139. throw new t(e7, e.BooleanConditionRequired, t4);
  3140. return _2(e7, true === n3 ? t4.arguments[1] : t4.arguments[2]);
  3141. } catch (n3) {
  3142. throw n3;
  3143. }
  3144. }, be2.decode = function(e7, t4) {
  3145. try {
  3146. if (t4.arguments.length < 2)
  3147. throw new t(e7, e.WrongNumberOfParameters, t4);
  3148. if (2 === t4.arguments.length)
  3149. return _2(e7, t4.arguments[1]);
  3150. {
  3151. if ((t4.arguments.length - 1) % 2 == 0)
  3152. throw new t(e7, e.WrongNumberOfParameters, t4);
  3153. const n3 = _2(e7, t4.arguments[0]);
  3154. return xe2(e7, t4, 1, n3);
  3155. }
  3156. } catch (n3) {
  3157. throw n3;
  3158. }
  3159. }, be2.when = function(e7, t4) {
  3160. try {
  3161. if (t4.arguments.length < 3)
  3162. throw new t(e7, e.WrongNumberOfParameters, t4);
  3163. if (t4.arguments.length % 2 == 0)
  3164. throw new t(e7, e.WrongNumberOfParameters, t4);
  3165. const n3 = _2(e7, t4.arguments[0]);
  3166. if (false === _(n3))
  3167. throw new t(e7, e.BooleanConditionRequired, t4.arguments[0]);
  3168. return Se2(e7, t4, 0, n3);
  3169. } catch (n3) {
  3170. throw n3;
  3171. }
  3172. };
  3173. for (const Le2 in be2)
  3174. be2[Le2] = { value: new e2(be2[Le2]), valueset: true, node: null };
  3175. var Fe2 = function() {
  3176. };
  3177. function Ce2(e7, t4) {
  3178. const r4 = new Fe2();
  3179. e7 || (e7 = {}), t4 || (t4 = {});
  3180. const o5 = new J2({ newline: "\n", tab: " ", singlequote: "'", doublequote: '"', forwardslash: "/", backwardslash: "\\" });
  3181. o5.immutable = false, r4.textformatting = { value: o5, valueset: true, node: null };
  3182. for (const n3 in t4)
  3183. r4[n3] = { value: new e2(t4[n3]), native: true, valueset: true, node: null };
  3184. for (const n3 in e7)
  3185. e7[n3] && "esri.Graphic" === e7[n3].declaredClass ? r4[n3] = { value: g.createFromGraphic(e7[n3]), valueset: true, node: null } : r4[n3] = { value: e7[n3], valueset: true, node: null };
  3186. return r4;
  3187. }
  3188. Fe2.prototype = be2, Fe2.prototype.infinity = { value: Number.POSITIVE_INFINITY, valueset: true, node: null }, Fe2.prototype.pi = { value: Math.PI, valueset: true, node: null };
  3189. function Ae2(e7) {
  3190. console.log(e7);
  3191. }
  3192. function Me2(e7) {
  3193. const t4 = { mode: "sync", compiled: false, functions: {}, signatures: [], standardFunction: V4, evaluateIdentifier: ve3 };
  3194. for (let n3 = 0; n3 < e7.length; n3++)
  3195. e7[n3].registerFunctions(t4);
  3196. for (const n3 in t4.functions)
  3197. be2[n3] = { value: new e2(t4.functions[n3]), valueset: true, node: null }, Fe2.prototype[n3] = be2[n3];
  3198. for (let n3 = 0; n3 < t4.signatures.length; n3++)
  3199. o(t4.signatures[n3], "sync");
  3200. }
  3201. function Ee2(e7, n3) {
  3202. let l6 = n3.spatialReference;
  3203. null == l6 && (l6 = new k({ wkid: 102100 }));
  3204. let a3 = null;
  3205. e7.usesModules && (a3 = new s4(/* @__PURE__ */ new Map(), e7.loadedModules));
  3206. const i3 = { spatialReference: l6, globalScope: Ce2(n3.vars, n3.customfunctions), localScope: null, exports: {}, libraryResolver: a3, console: n3.console ? n3.console : Ae2, lrucache: n3.lrucache, interceptor: n3.interceptor, depthCounter: { depth: 1 } };
  3207. let s9 = _2(i3, e7);
  3208. if (s9 instanceof D && (s9 = s9.value), s9 instanceof N && (s9 = s9.value), s9 === k2 && (s9 = null), s9 === j)
  3209. throw new t(i3, e.IllegalResult, null);
  3210. if (s9 === A)
  3211. throw new t(i3, e.IllegalResult, null);
  3212. if (F(s9))
  3213. throw new t(i3, e.IllegalResult, null);
  3214. return s9;
  3215. }
  3216. Me2([m2]);
  3217. // node_modules/@arcgis/core/chunks/arcade.js
  3218. var b2 = ["feature", "angle", "bearing", "centroid", "envelopeintersects", "extent", "geometry", "isselfintersecting", "ringisclockwise"];
  3219. function g4() {
  3220. return true;
  3221. }
  3222. var A3 = g4();
  3223. var w6 = false;
  3224. var h2 = false;
  3225. var j3 = null;
  3226. var x4 = [];
  3227. function M3(t4, r4) {
  3228. if (true === r4.useAsync || true === t4.isAsync)
  3229. return F3(t4, r4);
  3230. if (has("esri-csp-restrictions")) {
  3231. return function(e7) {
  3232. return Ee2(t4, e7);
  3233. };
  3234. }
  3235. try {
  3236. return Le(t4, r4);
  3237. } catch (n3) {
  3238. if ("esri.arcade.arcadeuncompilableerror" === n3.declaredRootClass)
  3239. return function(e7) {
  3240. return Ee2(t4, e7);
  3241. };
  3242. throw n3;
  3243. }
  3244. }
  3245. function F3(t4, r4) {
  3246. if (null === j3)
  3247. throw new t(null, e.AsyncNotEnabled, null);
  3248. if (has("esri-csp-restrictions") || false === A3) {
  3249. return function(e7) {
  3250. return j3.executeScript(t4, e7);
  3251. };
  3252. }
  3253. try {
  3254. return Le(t4, r4, true);
  3255. } catch (n3) {
  3256. if ("esri.arcade.arcadeuncompilableerror" === n3.declaredRootClass)
  3257. return function(e7) {
  3258. return j3.executeScript(t4, e7);
  3259. };
  3260. throw n3;
  3261. }
  3262. }
  3263. function E3(e7) {
  3264. Me2(e7), Ee(e7, "sync"), null === j3 ? x4.push(e7) : (Ee(e7, "async"), j3.extend(e7));
  3265. }
  3266. function G2(e7, t4 = []) {
  3267. return d4(e7, t4);
  3268. }
  3269. function v3(e7, t4, r4 = []) {
  3270. return U3(d4(e7, r4), t4);
  3271. }
  3272. function U3(e7, t4) {
  3273. if (true === t4.useAsync || true === e7.isAsync) {
  3274. if (null === j3)
  3275. throw new t(null, e.AsyncNotEnabled, null);
  3276. return j3.executeScript(e7, t4);
  3277. }
  3278. return Ee2(e7, t4);
  3279. }
  3280. function _3(e7, t4) {
  3281. return c3(e7, t4);
  3282. }
  3283. function I2(e7, t4) {
  3284. return p3(e7, t4);
  3285. }
  3286. function R2(e7, t4 = false) {
  3287. return void 0 === t4 && (t4 = false), l2(e7);
  3288. }
  3289. function C4(e7) {
  3290. return u3(e7);
  3291. }
  3292. function D4(e7, t4 = []) {
  3293. return void 0 === e7.usesGeometry && d(e7, t4), true === e7.usesGeometry;
  3294. }
  3295. var P4 = null;
  3296. function k5() {
  3297. return P4 || (P4 = z4(), P4);
  3298. }
  3299. async function z4() {
  3300. const [e7, t4] = await Promise.all([import("./geometryEngine-3QP2OBVR.js"), import("./geomsync-6KPFLG3M.js")]);
  3301. return h2 = true, t4.setGeometryEngine(e7), true;
  3302. }
  3303. var L2 = null;
  3304. function N4() {
  3305. return null !== L2 || (L2 = O2()), L2;
  3306. }
  3307. async function O2() {
  3308. await Re(), j3 = await import("./arcadeAsyncRuntime-FS2QAHI6.js");
  3309. for (const e7 of x4)
  3310. j3.extend(e7), Ee(e7, "async");
  3311. return x4 = null, true;
  3312. }
  3313. function T5() {
  3314. return w6;
  3315. }
  3316. function q2() {
  3317. return !!j3;
  3318. }
  3319. function B3() {
  3320. return h2;
  3321. }
  3322. var H4 = null;
  3323. function J5() {
  3324. return H4 || (H4 = K3(), H4);
  3325. }
  3326. async function K3() {
  3327. await N4();
  3328. const [e7, r4, n3, s9, u7] = await Promise.all([import("./featureSetUtils-A7XW72XL.js"), import("./featuresetbase-U2SCLWM5.js"), import("./featuresetgeom-OU6XV5EY.js"), import("./featuresetstats-5WAP4HO2.js"), import("./featuresetstring-6A7U67BI.js")]);
  3329. return te3 = e7, j3.extend([r4, n3, s9, u7]), Ee([r4, n3, s9, u7], "async"), w6 = true, true;
  3330. }
  3331. function Q4(e7, t4 = []) {
  3332. return void 0 === e7.usesFeatureSet && d(e7, t4), true === e7.usesFeatureSet;
  3333. }
  3334. function V5(e7, t4 = []) {
  3335. return void 0 === e7.isAsync && d(e7, t4), true === e7.isAsync;
  3336. }
  3337. function W4(e7, t4) {
  3338. if (t4) {
  3339. for (const r4 of t4)
  3340. if (_3(e7, r4))
  3341. return true;
  3342. return false;
  3343. }
  3344. return false;
  3345. }
  3346. async function X4(e7, t4, r4 = [], n3 = false, s9 = null) {
  3347. return Y4(/* @__PURE__ */ new Set(), e7, t4, r4, n3, s9);
  3348. }
  3349. async function Y4(e7, t4, r4, n3 = [], s9 = false, u7 = null) {
  3350. const a3 = "string" == typeof t4 ? G2(t4) : t4, o5 = [];
  3351. return a3 && (false === B3() && (D4(a3) || s9) && o5.push(k5()), false === q2() && (true === a3.isAsync || r4) && o5.push(N4()), false === T5() && (Q4(a3) || W4(a3, n3)) && o5.push(J5())), o5.length && await Promise.all(o5), await $2(e7, a3, u7, r4, s9), true;
  3352. }
  3353. function Z4(e7, t4 = []) {
  3354. return void 0 === e7.usesModules && d(e7, t4), true === e7.usesModules;
  3355. }
  3356. async function $2(e7, t4, r4 = null, s9 = false, u7 = false) {
  3357. const i3 = x(t4);
  3358. null === r4 && i3.length > 0 && (r4 = l5.getDefault()), t4.loadedModules = {};
  3359. for (const n3 of i3) {
  3360. c(r4);
  3361. const i4 = r4.normalizeModuleUri(n3.source);
  3362. if (e7.has(i4.uri))
  3363. throw new t(null, e.CircularModules, null);
  3364. e7.add(i4.uri);
  3365. const c5 = await r4.fetchModule(i4);
  3366. await Y4(e7, c5, s9, [], u7, r4), e7.delete(i4.uri), c5.isAsync && (t4.isAsync = true), c5.usesFeatureSet && (t4.usesFeatureSet = true), c5.usesGeometry && (t4.usesGeometry = true), t4.loadedModules[n3.libname] = { uri: i4.uri, script: c5 };
  3367. }
  3368. }
  3369. function ee3(e7) {
  3370. if (D4(e7))
  3371. return true;
  3372. const t4 = y2(e7);
  3373. let r4 = false;
  3374. for (let n3 = 0; n3 < t4.length; n3++)
  3375. if (b2.includes(t4[n3])) {
  3376. r4 = true;
  3377. break;
  3378. }
  3379. return r4;
  3380. }
  3381. var te3 = null;
  3382. function re4() {
  3383. return te3;
  3384. }
  3385. var ne3 = Object.freeze(Object.defineProperty({ __proto__: null, compileScript: M3, extend: E3, parseScript: G2, parseAndExecuteScript: v3, executeScript: U3, referencesMember: _3, referencesFunction: I2, extractFieldLiterals: R2, extractExpectedFieldLiterals: C4, scriptUsesGeometryEngine: D4, enableGeometrySupport: k5, enableGeometrySupportImpl: z4, enableAsyncSupport: N4, enableAsyncSupportImpl: O2, isFeatureSetSupportEnabled: T5, isAsyncEnabled: q2, isGeometryEnabled: B3, enableFeatureSetSupport: J5, enableFeatureSetSupportImpl: K3, scriptUsesFeatureSet: Q4, scriptIsAsync: V5, loadScriptDependencies: X4, _loadScriptDependenciesImpl: Y4, scriptUsesModules: Z4, loadDependentModules: $2, scriptTouchesGeometry: ee3, featureSetUtils: re4 }, Symbol.toStringTag, { value: "Module" }));
  3386. // node_modules/@arcgis/core/support/arcadeUtils.js
  3387. var C5 = /^\$(feature|aggregatedFeatures)\./i;
  3388. var M4 = { vars: { $feature: "any", $view: "any" }, spatialReference: null };
  3389. function P5(e7) {
  3390. return e7.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
  3391. }
  3392. function I3(e7) {
  3393. return null == e7 ? null : Y(e7) || E(e7) ? "array" : z(e7) ? "date" : w3(e7) ? "text" : _(e7) ? "boolean" : Z(e7) ? "number" : e7 instanceof J2 ? "dictionary" : J(e7) ? "feature" : e7 instanceof w ? "point" : e7 instanceof v ? "polygon" : e7 instanceof m ? "polyline" : e7 instanceof u ? "multipoint" : e7 instanceof w2 ? "extent" : P(e7) ? "featureSet" : G(e7) ? "featureSetCollection" : null;
  3394. }
  3395. function A4(r4) {
  3396. if (!r4)
  3397. return null;
  3398. try {
  3399. return G2(r4);
  3400. } catch (n3) {
  3401. }
  3402. return null;
  3403. }
  3404. function D5(e7, n3) {
  3405. const t4 = "string" == typeof e7 ? A4(e7) : e7;
  3406. if (!t4)
  3407. return null;
  3408. try {
  3409. return n3 = n3 || y(M4), M3(t4, n3);
  3410. } catch (o5) {
  3411. }
  3412. return null;
  3413. }
  3414. function G3(e7, r4) {
  3415. return { vars: { $feature: null == e7 ? new g() : g.createFromGraphic(e7), $view: r4 && r4.view }, spatialReference: r4 && r4.sr };
  3416. }
  3417. function T6(e7, r4, n3) {
  3418. return g.createFromGraphicLikeObject(r4, e7, n3);
  3419. }
  3420. function U4(e7, r4) {
  3421. null != e7.vars && (e7.vars.$feature = r4);
  3422. }
  3423. function V6(e7, r4) {
  3424. let t4;
  3425. try {
  3426. t4 = U3(e7, r4);
  3427. } catch (o5) {
  3428. t4 = null;
  3429. }
  3430. return t4;
  3431. }
  3432. function L3(e7, r4) {
  3433. let n3;
  3434. try {
  3435. n3 = e7 ? e7(r4) : null;
  3436. } catch (t4) {
  3437. n3 = null;
  3438. }
  3439. return n3;
  3440. }
  3441. function q3(e7, r4) {
  3442. try {
  3443. return e7 ? e7(r4) : Promise.resolve(null);
  3444. } catch (n3) {
  3445. return Promise.resolve(null);
  3446. }
  3447. }
  3448. function J6(e7, r4) {
  3449. if (!e7)
  3450. return [];
  3451. const n3 = "string" == typeof e7 ? A4(e7) : e7;
  3452. if (!n3)
  3453. return [];
  3454. const o5 = C4(n3);
  3455. let s9 = new Array();
  3456. o5.forEach((e8) => {
  3457. C5.test(e8) && (e8 = e8.replace(C5, ""), s9.push(e8));
  3458. });
  3459. const i3 = s9.filter((e8) => e8.includes("*"));
  3460. return s9 = s9.filter((e8) => !i3.includes(e8)), r4 && i3.forEach((e8) => {
  3461. const n4 = new RegExp(`^${e8.split(/\*+/).map(P5).join(".*")}$`, "i");
  3462. r4.forEach((e9) => n4.test(e9) ? s9.push(e9) : null);
  3463. }), [...new Set(s9.sort())];
  3464. }
  3465. function O3(e7) {
  3466. return _3(e7, "$view");
  3467. }
  3468. function B4(e7, r4) {
  3469. return !!e7 && _3(e7, r4);
  3470. }
  3471. function H5(e7) {
  3472. if (!e7 || null == e7.spatialReference && (null == e7.scale || null == e7.viewingMode))
  3473. return;
  3474. return { view: e7.viewingMode && null != e7.scale ? new J2({ viewingMode: e7.viewingMode, scale: e7.scale }) : null, sr: e7.spatialReference };
  3475. }
  3476. function K4({ url: e7, spatialReference: r4, lrucache: n3, interceptor: t4 }) {
  3477. const o5 = re4();
  3478. return o5 ? o5.createFeatureSetCollectionFromService(e7, r4, n3, t4) : null;
  3479. }
  3480. function N5({ layer: e7, spatialReference: r4, outFields: n3, returnGeometry: t4, lrucache: o5, interceptor: s9 }) {
  3481. if (null === e7)
  3482. return null;
  3483. const i3 = re4();
  3484. return i3 ? i3.constructFeatureSet(e7, r4, n3, t4 != null ? t4 : true, o5, s9) : null;
  3485. }
  3486. function Q5(e7) {
  3487. if (null === (e7 == null ? void 0 : e7.map))
  3488. return null;
  3489. const r4 = re4();
  3490. return r4 ? r4.createFeatureSetCollectionFromMap(e7.map, e7.spatialReference, e7.lrucache, e7.interceptor) : null;
  3491. }
  3492. function W5(e7) {
  3493. return J2.convertJsonToArcade(e7);
  3494. }
  3495. function X5(e7, r4, n3 = []) {
  3496. return X4(e7, r4, n3);
  3497. }
  3498. function Y5() {
  3499. return k5();
  3500. }
  3501. function Z5() {
  3502. return J5();
  3503. }
  3504. function _4(e7) {
  3505. return "simple" === e7.type || "class-breaks" === e7.type || "unique-value" === e7.type || "dot-density" === e7.type || "dictionary" === e7.type || "pie-chart" === e7.type;
  3506. }
  3507. function ee4(e7) {
  3508. return "esri.layers.support.LabelClass" === e7.declaredClass;
  3509. }
  3510. function re5(e7) {
  3511. return "esri.PopupTemplate" === e7.declaredClass;
  3512. }
  3513. function ne4(e7, r4) {
  3514. var _a;
  3515. if (!e7)
  3516. return false;
  3517. if ("string" == typeof e7)
  3518. return r4(e7);
  3519. const n3 = e7;
  3520. if (_4(n3)) {
  3521. if ("dot-density" === n3.type) {
  3522. const e9 = (_a = n3.attributes) == null ? void 0 : _a.some((e10) => r4(e10.valueExpression));
  3523. if (e9)
  3524. return e9;
  3525. }
  3526. const e8 = n3.visualVariables, t4 = !!e8 && e8.some((e9) => {
  3527. let n4 = r4(e9.valueExpression);
  3528. return "size" === e9.type && (e3(e9.minSize) && (n4 = n4 || r4(e9.minSize.valueExpression)), e3(e9.maxSize) && (n4 = n4 || r4(e9.maxSize.valueExpression))), n4;
  3529. });
  3530. return !(!("valueExpression" in n3) || !r4(n3.valueExpression)) || t4;
  3531. }
  3532. if (ee4(n3)) {
  3533. const e8 = n3.labelExpressionInfo && n3.labelExpressionInfo.expression;
  3534. return !(!e8 || !r4(e8)) || false;
  3535. }
  3536. return !!re5(n3) && (!!n3.expressionInfos && n3.expressionInfos.some((e8) => r4(e8.expression)) || Array.isArray(n3.content) && n3.content.some((e8) => {
  3537. var _a2;
  3538. return "expression" === e8.type && r4((_a2 = e8.expressionInfo) == null ? void 0 : _a2.expression);
  3539. }));
  3540. }
  3541. function te4(e7) {
  3542. const r4 = A4(e7);
  3543. return !!r4 && ee3(r4);
  3544. }
  3545. function oe3(e7) {
  3546. return ne4(e7, te4);
  3547. }
  3548. function se4(e7) {
  3549. const r4 = A4(e7);
  3550. return !!r4 && D4(r4);
  3551. }
  3552. function ie3(e7) {
  3553. return ne4(e7, se4);
  3554. }
  3555. export {
  3556. J2 as Dictionary,
  3557. ne3 as arcade,
  3558. g as arcadeFeature,
  3559. N5 as convertFeatureLayerToFeatureSet,
  3560. W5 as convertJsonToArcade,
  3561. Q5 as convertMapToFeatureSetCollection,
  3562. K4 as convertServiceUrlToWorkspace,
  3563. G3 as createExecContext,
  3564. T6 as createFeature,
  3565. D5 as createFunction,
  3566. A4 as createSyntaxTree,
  3567. O3 as dependsOnView,
  3568. Z5 as enableFeatureSetOperations,
  3569. Y5 as enableGeometryOperations,
  3570. V6 as evalSyntaxTree,
  3571. q3 as executeAsyncFunction,
  3572. L3 as executeFunction,
  3573. J6 as extractFieldNames,
  3574. I3 as getArcadeType,
  3575. H5 as getViewInfo,
  3576. oe3 as hasGeometryFunctions,
  3577. ie3 as hasGeometryOperations,
  3578. B4 as hasVariable,
  3579. X5 as loadScriptDependencies,
  3580. U4 as updateExecContext
  3581. };
  3582. //# sourceMappingURL=arcadeUtils-Y4XBISY2.js.map