@arcgis/coding-components 4.30.0-next.21 → 4.30.0-next.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/dist/arcgis-coding-components/arcgis-coding-components.esm.js +2 -2
  2. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ar.json +25 -0
  3. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.bg.json +25 -0
  4. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.bs.json +25 -0
  5. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ca.json +25 -0
  6. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.cs.json +25 -0
  7. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.da.json +25 -0
  8. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.de.json +25 -0
  9. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.el.json +25 -0
  10. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.en.json +25 -0
  11. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.es.json +25 -0
  12. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.et.json +25 -0
  13. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.fi.json +25 -0
  14. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.fr.json +25 -0
  15. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.he.json +25 -0
  16. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.hr.json +25 -0
  17. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.hu.json +25 -0
  18. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.id.json +25 -0
  19. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.it.json +25 -0
  20. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ja.json +25 -0
  21. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ko.json +25 -0
  22. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.lt.json +25 -0
  23. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.lv.json +25 -0
  24. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.nb.json +25 -0
  25. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.nl.json +25 -0
  26. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.pl.json +25 -0
  27. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.pt-BR.json +25 -0
  28. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.pt-PT.json +25 -0
  29. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ro.json +25 -0
  30. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ru.json +25 -0
  31. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sk.json +25 -0
  32. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sl.json +25 -0
  33. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sr.json +25 -0
  34. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sv.json +25 -0
  35. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.th.json +25 -0
  36. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.tr.json +25 -0
  37. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.uk.json +25 -0
  38. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.vi.json +25 -0
  39. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.zh-CN.json +25 -0
  40. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.zh-HK.json +25 -0
  41. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.zh-TW.json +25 -0
  42. package/dist/arcgis-coding-components/index.esm.js +2 -2
  43. package/dist/arcgis-coding-components/p-250241d4.entry.js +6 -0
  44. package/dist/arcgis-coding-components/p-3217369b.js +68 -0
  45. package/dist/arcgis-coding-components/{p-1451e0cc.js → p-49bca36f.js} +2 -2
  46. package/dist/arcgis-coding-components/{p-192601ca.js → p-5b2565ca.js} +2 -2
  47. package/dist/arcgis-coding-components/p-600be247.js +6 -0
  48. package/dist/arcgis-coding-components/{p-0e7b5896.js → p-64abf203.js} +2 -2
  49. package/dist/arcgis-coding-components/{p-253f92ea.js → p-68006f08.js} +2 -2
  50. package/dist/arcgis-coding-components/p-716a8741.js +6 -0
  51. package/dist/arcgis-coding-components/{p-b177db92.js → p-9b73a641.js} +3 -3
  52. package/dist/arcgis-coding-components/{p-a63eeed9.js → p-bc0aa910.js} +1 -1
  53. package/dist/arcgis-coding-components/{p-cb5166f2.js → p-c0185a0d.js} +2 -2
  54. package/dist/arcgis-coding-components/{p-5583b25d.js → p-d7560609.js} +2 -2
  55. package/dist/arcgis-coding-components/p-de307b87.js +6 -0
  56. package/dist/arcgis-coding-components/{p-eb16cce2.js → p-f75b073c.js} +2 -2
  57. package/dist/arcgis-coding-components/p-ff1c764c.js +7 -0
  58. package/dist/cjs/Accessor-YDTURKZ7-2cd6deb4.js +1249 -0
  59. package/dist/cjs/{arcade-defaults-9d57f506.js → arcade-defaults-fb1a3fd7.js} +294 -295
  60. package/dist/cjs/{arcade-mode-9079b8e0.js → arcade-mode-2560e670.js} +4 -4
  61. package/dist/cjs/arcgis-arcade-api_6.cjs.entry.js +1347 -89
  62. package/dist/cjs/arcgis-coding-components.cjs.js +3 -3
  63. package/dist/cjs/chunk-OMA4PI5N-60e6be60.js +1286 -0
  64. package/dist/cjs/{css-9aa4569b.js → css-f659c186.js} +1 -1
  65. package/dist/cjs/{cssMode-6f57c416.js → cssMode-6a246ae2.js} +3 -3
  66. package/dist/cjs/decorators-443AWDOE-fb0006fa.js +120 -0
  67. package/dist/cjs/{html-95d3a234.js → html-d999957e.js} +3 -3
  68. package/dist/cjs/{htmlMode-ebd8894d.js → htmlMode-777d5d7e.js} +3 -3
  69. package/dist/cjs/{index-a3f52cf5.js → index-60fec5d8.js} +42 -4
  70. package/dist/cjs/index.cjs.js +3 -3
  71. package/dist/cjs/{javascript-1a01235b.js → javascript-5c4612fc.js} +4 -4
  72. package/dist/cjs/{jsonMode-26ed7799.js → jsonMode-21544f43.js} +3 -3
  73. package/dist/cjs/loader.cjs.js +3 -3
  74. package/dist/cjs/{tsMode-9cfeb9a5.js → tsMode-34b259f1.js} +3 -3
  75. package/dist/cjs/{typescript-f9907455.js → typescript-6f9695a1.js} +3 -3
  76. package/dist/components/Accessor-YDTURKZ7.js +1247 -0
  77. package/dist/components/arcade-api.js +9 -15
  78. package/dist/components/arcade-contribution.js +3 -3
  79. package/dist/components/arcade-defaults.js +10 -10
  80. package/dist/components/arcade-mode.js +3 -3
  81. package/dist/components/arcade-results.js +24 -35
  82. package/dist/components/arcade-suggestions.js +10 -16
  83. package/dist/components/arcade-variables.js +11 -20
  84. package/dist/components/arcgis-arcade-api.js +1 -1
  85. package/dist/components/arcgis-arcade-editor.js +20 -24
  86. package/dist/components/arcgis-arcade-results.js +1 -1
  87. package/dist/components/arcgis-arcade-suggestions.js +1 -1
  88. package/dist/components/arcgis-arcade-variables.js +1 -1
  89. package/dist/components/arcgis-assets.d.ts +1 -1
  90. package/dist/components/arcgis-assets.js +1 -1
  91. package/dist/components/arcgis-code-editor.js +1 -1
  92. package/dist/components/chunk-3I7AEPTU.js +1290 -0
  93. package/dist/components/chunk-OMA4PI5N.js +1257 -0
  94. package/dist/components/code-editor.js +6 -6
  95. package/dist/components/decorators-443AWDOE.js +109 -0
  96. package/dist/components/fields.js +40 -39
  97. package/dist/components/index.js +1 -1
  98. package/dist/components/index2.js +3 -3
  99. package/dist/components/markdown.js +1 -1
  100. package/dist/components/utilities.js +3 -3
  101. package/dist/esm/Accessor-YDTURKZ7-dcaf409b.js +1247 -0
  102. package/dist/esm/{arcade-defaults-1577045c.js → arcade-defaults-9833f532.js} +286 -285
  103. package/dist/esm/{arcade-mode-ec8b7890.js → arcade-mode-a9774d50.js} +4 -4
  104. package/dist/esm/arcgis-arcade-api_6.entry.js +1389 -131
  105. package/dist/esm/arcgis-coding-components.js +4 -4
  106. package/dist/esm/chunk-OMA4PI5N-2da97f52.js +1257 -0
  107. package/dist/esm/{css-6350c0f7.js → css-294de2b5.js} +1 -1
  108. package/dist/esm/{cssMode-629b1349.js → cssMode-8bf465a1.js} +3 -3
  109. package/dist/esm/decorators-443AWDOE-8b8ddc71.js +109 -0
  110. package/dist/esm/{html-979016b0.js → html-df0c0abf.js} +3 -3
  111. package/dist/esm/{htmlMode-dd504dae.js → htmlMode-379ba474.js} +3 -3
  112. package/dist/esm/{index-093931a1.js → index-aafc3e0b.js} +42 -5
  113. package/dist/esm/index.js +3 -3
  114. package/dist/esm/{javascript-7af48cb1.js → javascript-7f02143c.js} +4 -4
  115. package/dist/esm/{jsonMode-eb6b41d1.js → jsonMode-0db8e4ac.js} +3 -3
  116. package/dist/esm/loader.js +4 -4
  117. package/dist/esm/{tsMode-64deb000.js → tsMode-8bd448ad.js} +3 -3
  118. package/dist/esm/{typescript-c9b14542.js → typescript-a14f4a55.js} +3 -3
  119. package/dist/loader/cdn.js +1 -1
  120. package/dist/loader/index.cjs.js +1 -1
  121. package/dist/loader/index.es2017.js +1 -1
  122. package/dist/loader/index.js +1 -1
  123. package/dist/types/components/arcade-api/arcade-api.d.ts +4 -5
  124. package/dist/types/components/arcade-editor/arcade-editor.d.ts +7 -4
  125. package/dist/types/components/arcade-results/arcade-results.d.ts +4 -7
  126. package/dist/types/components/arcade-suggestions/arcade-suggestions.d.ts +4 -5
  127. package/dist/types/components/arcade-variables/arcade-variables.d.ts +4 -6
  128. package/package.json +12 -12
  129. package/dist/arcgis-coding-components/p-81935687.js +0 -68
  130. package/dist/arcgis-coding-components/p-a2190df0.js +0 -7
  131. package/dist/arcgis-coding-components/p-e8c2933f.entry.js +0 -6
  132. package/dist/types/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stencil.config.d.ts +0 -3
  133. package/dist/types/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/support/sass-inline-url-importer.d.ts +0 -9
  134. package/dist/types/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/support/sass-json-importer.d.ts +0 -19
  135. package/dist/types/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/support/stencil-monaco-plugins.d.ts +0 -6
@@ -1,10 +1,10 @@
1
1
  /*!
2
2
  * All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  * See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
- * v4.30.0-next.21
4
+ * v4.30.0-next.23
5
5
  */
6
- import { r as registerInstance, c as createEvent, g as getAssetPath, h, H as Host, a as getElement, F as Fragment } from './index-093931a1.js';
7
- import { g as generateTokensCSSForColorMap, e as editor, S as StandaloneServices, I as IStandaloneThemeService, c as createCommonjsModule, b as commonjsGlobal, i as ie, s as se, d as importRequest, l as languages, f as arcadeDefaults, B, U as Uri, q, W, h as filterCollection, G, j as importArcade, k as h$1, m as U, n as k, K as KeyCode, Z, D, o as supportedFields, p as K, R as Range, x, r as KeyMod } from './arcade-defaults-1577045c.js';
6
+ import { g as getAssetPath, f as forceUpdate, r as registerInstance, c as createEvent, h as h$1, H as Host, a as getElement, F as Fragment } from './index-aafc3e0b.js';
7
+ import { g as generateTokensCSSForColorMap, e as editor, S as StandaloneServices, I as IStandaloneThemeService, c as createCommonjsModule, b as commonjsGlobal, d as de, f as ge, i as importRequest, l as languages, h as arcadeDefaults, U as Uri, W, j as filterCollection, o as oe, k as importArcade, m as h$2, Q, _, K as KeyCode, r as re, t as te, s as supportedFields, n as ne, R as Range, p as b$1, q as KeyMod } from './arcade-defaults-9833f532.js';
8
8
 
9
9
  async function colorizeCode(code) {
10
10
  return await editor.colorize(code, "arcade", { tabSize: 2 });
@@ -2937,6 +2937,1287 @@ function convertMarkdownString(value) {
2937
2937
  return result;
2938
2938
  }
2939
2939
 
2940
+ // ../components-utils/dist/index.js
2941
+ var h = class {
2942
+ constructor() {
2943
+ this.resolve = () => {
2944
+ }, this.reject = () => {
2945
+ }, this.promise = new Promise((t, n) => {
2946
+ this.resolve = t, this.reject = n;
2947
+ });
2948
+ }
2949
+ };
2950
+ function w(e, t) {
2951
+ let n = e;
2952
+ for (; n; ) {
2953
+ if (n === t)
2954
+ return true;
2955
+ if (!n.parentNode)
2956
+ return false;
2957
+ n.parentNode instanceof ShadowRoot ? n = n.parentNode.host : n = n.parentNode;
2958
+ }
2959
+ return false;
2960
+ }
2961
+ function b(e, t, n) {
2962
+ let { subscribe: r } = $(t);
2963
+ return r((o) => {
2964
+ o.some((s) => w(e, s.target)) && n();
2965
+ });
2966
+ }
2967
+ var f = {};
2968
+ function $(e) {
2969
+ let t = e.join(","), n = f[t];
2970
+ if (n !== void 0)
2971
+ return n;
2972
+ let r = /* @__PURE__ */ new Set(), o = new MutationObserver((s) => r.forEach((a) => a(s)));
2973
+ o.observe(document.documentElement, { attributes: true, attributeFilter: e, subtree: true });
2974
+ let i = { subscribe(s) {
2975
+ return r.add(s), { remove: () => {
2976
+ r.delete(s), r.size === 0 && (o.disconnect(), f[t] = void 0);
2977
+ } };
2978
+ } };
2979
+ return f[t] = i, i;
2980
+ }
2981
+ function x(e, t) {
2982
+ let n = e;
2983
+ for (; n; ) {
2984
+ let r = n.closest(t);
2985
+ if (r)
2986
+ return r;
2987
+ let o = n.getRootNode();
2988
+ if (o === document)
2989
+ return null;
2990
+ n = o.host;
2991
+ }
2992
+ return null;
2993
+ }
2994
+ function m(e, t, n) {
2995
+ return x(e, `[${t}]`)?.getAttribute(t) ?? n;
2996
+ }
2997
+ var A = (e) => e.charAt(0).toUpperCase() + e.slice(1);
2998
+ var T = (e) => A(e.replaceAll(/([a-z])([A-Z])/gu, "$1 $2"));
2999
+ var v = /* @__PURE__ */ new Set(["ar", "bg", "bs", "ca", "cs", "da", "de", "el", "en", "es", "et", "fi", "fr", "he", "hr", "hu", "id", "it", "ja", "ko", "lt", "lv", "nl", "nb", "pl", "pt-BR", "pt-PT", "ro", "ru", "sk", "sl", "sr", "sv", "th", "tr", "uk", "vi", "zh-CN", "zh-HK", "zh-TW"]);
3000
+ var g = "en";
3001
+ async function j(e, t, n = "") {
3002
+ let r = `${t}/${n}`, o = `${r}${e}.json`;
3003
+ return u[o] ?? (u[o] = S(e, r)), await u[o];
3004
+ }
3005
+ var u = {};
3006
+ async function S(e, t) {
3007
+ let n = `${t}${e}.json`;
3008
+ try {
3009
+ let r = await fetch(n);
3010
+ if (r.ok)
3011
+ return await r.json();
3012
+ } catch (r) {
3013
+ return console.error(r), E;
3014
+ }
3015
+ return e === g ? E : await S(g, t);
3016
+ }
3017
+ var E = new Proxy({}, { get: (e, t) => T(t.toString()) });
3018
+ function M(e) {
3019
+ let t = m(e, "lang", navigator.language || g);
3020
+ if (v.has(t))
3021
+ return { lang: t, t9nLocale: t };
3022
+ let n = t.slice(0, 2);
3023
+ return { lang: t, t9nLocale: v.has(n) ? n : g };
3024
+ }
3025
+ function Y(e, t, n, r) {
3026
+ let o, i = () => void P(e, t, r).then((s) => {
3027
+ (o?.lang !== s.lang || o.t9nLocale !== s.t9nLocale || o.t9nStrings !== s.t9nStrings) && n(s), o = s;
3028
+ }).catch(console.error);
3029
+ return i(), b(e, ["lang"], i);
3030
+ }
3031
+ async function P(e, t, n = e.tagName.toLowerCase().replace("arcgis-", "")) {
3032
+ let { lang: r, t9nLocale: o } = M(e), i = `${t}/${n}/t9n`, s = `${n}.t9n.`, a = await j(o, i, s);
3033
+ return { lang: r, t9nLocale: o, t9nStrings: a };
3034
+ }
3035
+
3036
+ // src/types.ts
3037
+ var controllerSymbol = Symbol("controller");
3038
+
3039
+ // src/utils.ts
3040
+ function safeCall(callback) {
3041
+ try {
3042
+ return callback?.();
3043
+ } catch (error) {
3044
+ console.error(error, callback);
3045
+ }
3046
+ return void 0;
3047
+ }
3048
+ async function safeAsyncCall(callback) {
3049
+ try {
3050
+ return await callback();
3051
+ } catch (error) {
3052
+ console.error(error, callback);
3053
+ }
3054
+ return void 0;
3055
+ }
3056
+ function extendObject(base, extend) {
3057
+ Object.entries(extend).forEach(([key, value]) => {
3058
+ if (key in base)
3059
+ throw new Error(`Unable to extend object because property "${key}" is already defined`);
3060
+ const thisBase = base;
3061
+ thisBase[key] = value;
3062
+ });
3063
+ return base;
3064
+ }
3065
+ var isController = (value) => typeof value === "object" && value !== null && (controllerSymbol in value || "hostConnected" in value || "hostDisconnected" in value || "hostUpdate" in value || "hostUpdated" in value);
3066
+
3067
+ // src/ControllerInternals.ts
3068
+ var ControllerInternals = class {
3069
+ constructor() {
3070
+ this._ambientControllers = [];
3071
+ /**
3072
+ * The type definition has to be duplicated due to the
3073
+ * "'use' is referenced directly or indirectly in its own type annotation."
3074
+ * error
3075
+ */
3076
+ this.use = async (value, watchExports) => {
3077
+ const controller = this._useRefSync(value);
3078
+ if (controller === void 0) {
3079
+ if (typeof watchExports === "function") {
3080
+ const error = new Error(
3081
+ `Unable to resolve a controller from the provided value, so can't watch it's exports. ${unresolvableExports}`
3082
+ );
3083
+ console.error(error);
3084
+ }
3085
+ return value;
3086
+ }
3087
+ await controller.ready;
3088
+ if (typeof watchExports === "function") {
3089
+ if (controller.watchExports === void 0)
3090
+ throw new Error(`The controller must implement watchExports method to support watching exports`);
3091
+ const unsubscribe = controller.watchExports(
3092
+ (exports) => watchExports(exports, unsubscribe)
3093
+ );
3094
+ }
3095
+ return controller.exports;
3096
+ };
3097
+ this.useRef = async (value) => {
3098
+ const controller = this._useRefSync(value);
3099
+ if (controller === void 0)
3100
+ throw new Error(`Unable to resolve a controller from the provided value. ${unresolvableExports}`);
3101
+ await controller.ready;
3102
+ return controller;
3103
+ };
3104
+ this.shouldBypassSetter = false;
3105
+ /**
3106
+ * A map from component instance or component element to component instance.
3107
+ * To get from component instance or component element to component element,
3108
+ * you can just use the .el property
3109
+ */
3110
+ this.elementToInstance = /* @__PURE__ */ new WeakMap();
3111
+ }
3112
+ /*
3113
+ * Allow controllers to implicitly retrive which component they are in, to
3114
+ * improve DX (avoids the need to pass "this" explicitly for each controller)
3115
+ */
3116
+ setAmbientComponent(component) {
3117
+ if (this._ambientComponent === component)
3118
+ return;
3119
+ this._ambientComponent = component;
3120
+ queueMicrotask(() => {
3121
+ if (this._ambientComponent === component)
3122
+ this._ambientComponent = void 0;
3123
+ });
3124
+ }
3125
+ retriveComponent(name) {
3126
+ if (this._ambientComponent === void 0)
3127
+ throw new Error(
3128
+ [
3129
+ `Unable to find out which component ${name || "this"} controller `,
3130
+ "belongs to. This might happen if you tried to create a controller ",
3131
+ "outside the component. If so, please wrap your controller ",
3132
+ "definition in an arrow function, ",
3133
+ "`const myController = ()=>makeController(...);` and call that",
3134
+ "function inside the component `my = myController();`, or ",
3135
+ "define your controller using makeGenericController/GenericController ",
3136
+ "instead.\n",
3137
+ "If you wish to use a controller inside an async controller, ",
3138
+ "make sure you are using controller.use.\n",
3139
+ "You might also have multiple instances of Controllers loaded"
3140
+ ].join("\n")
3141
+ );
3142
+ return this._ambientComponent;
3143
+ }
3144
+ /*
3145
+ * Aids proxyExports() in knowing who is it's host
3146
+ */
3147
+ setParentController(controller) {
3148
+ if (controller === void 0) {
3149
+ this._ambientControllers = [];
3150
+ return;
3151
+ }
3152
+ const index = this._ambientControllers.indexOf(controller);
3153
+ this._ambientControllers = index === -1 ? [...this._ambientControllers, controller] : this._ambientControllers.slice(0, index + 1);
3154
+ queueMicrotask(() => {
3155
+ this._ambientControllers = [];
3156
+ });
3157
+ }
3158
+ retriveParentControllers() {
3159
+ return this._ambientControllers;
3160
+ }
3161
+ /*
3162
+ * Aids controller.use in retrieving controller value when it receives
3163
+ * controller exports, rather than the controller itself
3164
+ */
3165
+ setAmbientChildController(controller) {
3166
+ if (this._ambientChildController === controller)
3167
+ return;
3168
+ this._ambientChildController = controller;
3169
+ queueMicrotask(() => {
3170
+ if (this._ambientChildController === controller)
3171
+ this._ambientChildController = void 0;
3172
+ });
3173
+ }
3174
+ retriveAmbientChildController() {
3175
+ const controller = this._ambientChildController;
3176
+ this._ambientChildController = void 0;
3177
+ return controller;
3178
+ }
3179
+ /**
3180
+ * Try to resolve a controller, without awaiting it's load
3181
+ */
3182
+ _useRefSync(value) {
3183
+ const ambientChildController = this.retriveAmbientChildController();
3184
+ if (ambientChildController !== void 0)
3185
+ return ambientChildController;
3186
+ const component = Controller.internals.retriveComponent();
3187
+ const controller = component.manager.internals.resolveExports(value);
3188
+ if (controller !== void 0)
3189
+ return controller;
3190
+ if (isController(value))
3191
+ return value;
3192
+ return void 0;
3193
+ }
3194
+ };
3195
+ var unresolvableExports = [
3196
+ "The value you passed is not a controller and not a controller exports. If ",
3197
+ "your controller exports a literal value, try making your controller export ",
3198
+ "an object instead"
3199
+ ].join("");
3200
+
3201
+ // src/stencil.ts
3202
+ function retrieveComponentMeta(component) {
3203
+ const constructor = component.constructor;
3204
+ const meta = constructor.__registerControllers?.(component)?.$cmpMeta$ ?? void 0;
3205
+ constructor.__registerControllers = void 0;
3206
+ if (typeof meta !== "object")
3207
+ throw new Error(
3208
+ "Failed to retrive internal component meta. Make sure you have the useComponentsControllers() Rollup Plugin for Stencil Controllers configured in your Stencil config."
3209
+ );
3210
+ component.manager.internals.meta = meta;
3211
+ }
3212
+ function parsePropertyValue(value, type = 0) {
3213
+ if (value == null || typeof type !== "number")
3214
+ return value;
3215
+ if ((type & 4 /* Boolean */) !== 0)
3216
+ return value === "false" ? false : value === "" || !!value;
3217
+ else if ((type & 2 /* Number */) !== 0)
3218
+ return Number.parseFloat(value.toString());
3219
+ else if ((type & 1 /* String */) !== 0)
3220
+ return String(value);
3221
+ else
3222
+ return value;
3223
+ }
3224
+ var makeMemberFilter = (filter) => (component) => {
3225
+ const meta = component.manager.internals.meta;
3226
+ return Object.entries(meta.$members$ ?? {}).filter(([_name, [propType]]) => (propType & filter) !== 0).map(([name]) => name);
3227
+ };
3228
+ var getPropLikeMembers = makeMemberFilter(63 /* PropLike */);
3229
+ var getMemberType = (component, name) => component.manager.internals.meta.$members$?.[name]?.[0];
3230
+ function getPropType(component, name) {
3231
+ const type = getMemberType(component, name);
3232
+ if (type === void 0)
3233
+ return void 0;
3234
+ else if (type & 32 /* State */)
3235
+ return "state";
3236
+ else
3237
+ return "prop";
3238
+ }
3239
+ function addPropertyWatcher(component, property) {
3240
+ const meta = component.manager.internals.meta;
3241
+ meta.$watchers$ ?? (meta.$watchers$ = {});
3242
+ const watchers = meta.$watchers$;
3243
+ if (!(property in watchers))
3244
+ watchers[property] = [];
3245
+ if (!watchers[property].includes(watcherCallbackName))
3246
+ watchers[property].push(watcherCallbackName);
3247
+ }
3248
+ var watcherCallbackName = "dynamicWatcherCallback";
3249
+
3250
+ // src/Controller.ts
3251
+ var _a;
3252
+ var _Controller = class _Controller {
3253
+ constructor(component) {
3254
+ this._ready = new h();
3255
+ this._lifecycleDisconnected = [];
3256
+ this.connectedCalled = false;
3257
+ this.willLoadCalled = false;
3258
+ this.didLoadCalled = false;
3259
+ this[_a] = true;
3260
+ this.ready = this._ready.promise;
3261
+ /*
3262
+ * Setting default exports to "this" so that controllers that don't use
3263
+ * exports/proxyExports(), could still be used as if they did
3264
+ * (i.e with controller.use)
3265
+ */
3266
+ this._exports = makeProvisionalValue(this);
3267
+ this._exportWatchers = /* @__PURE__ */ new Set();
3268
+ const resolvedComponent = toControllerHost(
3269
+ component ?? _Controller.internals.retriveComponent(new.target.name)
3270
+ );
3271
+ Object.defineProperty(this, "component", {
3272
+ writable: false,
3273
+ enumerable: false,
3274
+ configurable: true,
3275
+ value: resolvedComponent
3276
+ });
3277
+ this.component.addController(this);
3278
+ const manager = this.component.manager;
3279
+ this.connected = manager?.connected;
3280
+ this.internals = manager?.internals;
3281
+ _Controller.internals.setParentController(this);
3282
+ if ("hostDestroy" in this)
3283
+ this.component.manager.ensureHasDestroy();
3284
+ if (manager !== void 0)
3285
+ queueMicrotask(() => this.catchUpLifecycle());
3286
+ const controller = this;
3287
+ this._callbacks = {
3288
+ hostConnected: "hostConnected" in this ? [() => controller.hostConnected?.()] : [],
3289
+ hostDisconnected: "hostDisconnected" in this ? [() => controller.hostDisconnected?.()] : [],
3290
+ hostLoad: "hostLoad" in this ? [() => controller.hostLoad?.()] : [],
3291
+ hostLoaded: "hostLoaded" in this ? [() => controller.hostLoaded?.()] : [],
3292
+ hostRender: "hostRender" in this ? [() => controller.hostRender?.()] : [],
3293
+ hostRendered: "hostRendered" in this ? [() => controller.hostRendered?.()] : [],
3294
+ hostUpdate: "hostUpdate" in this ? [() => controller.hostUpdate?.()] : [],
3295
+ hostUpdated: "hostUpdated" in this ? [() => controller.hostUpdated?.()] : [],
3296
+ hostDestroy: "hostDestroy" in this ? [() => controller.hostDestroy?.()] : [],
3297
+ hostLifecycle: "hostLifecycle" in this ? [() => controller.hostLifecycle?.()] : []
3298
+ };
3299
+ }
3300
+ /**
3301
+ * If controller is being added dynamically, after the component
3302
+ * construction, then trigger connected and load right away
3303
+ */
3304
+ catchUpLifecycle() {
3305
+ if (this.connectedCalled)
3306
+ return;
3307
+ this.triggerConnected();
3308
+ this.triggerLoad().then(() => this.triggerLoaded()).catch(console.error);
3309
+ }
3310
+ get exports() {
3311
+ return this._exports;
3312
+ }
3313
+ /**
3314
+ * Set controller's exports property (for usage with proxyExports()) and mark
3315
+ * controller as ready (for usage in other controllers). Also, triggers
3316
+ * re-render of the component
3317
+ */
3318
+ set exports(exports) {
3319
+ if (this._exports !== exports) {
3320
+ this._exports = exports;
3321
+ if (this.connectedCalled)
3322
+ this.component.requestUpdate();
3323
+ this._exportWatchers.forEach((callback) => callback(exports));
3324
+ }
3325
+ this._ready.resolve(exports);
3326
+ }
3327
+ setProvisionalExports(exports) {
3328
+ this._exports = makeProvisionalValue(exports);
3329
+ this._exportWatchers.forEach((callback) => callback(this._exports));
3330
+ }
3331
+ watchExports(callback) {
3332
+ const safeCallback = (exports) => safeCall(() => callback(exports));
3333
+ this._exportWatchers.add(safeCallback);
3334
+ return () => void this._exportWatchers.delete(safeCallback);
3335
+ }
3336
+ /**
3337
+ * A flexible utility for making sure a controller is loaded before it's used,
3338
+ * regardless of how or where a controller was defined:
3339
+ *
3340
+ * @example
3341
+ * makeGenericController(async (component, controller) => {
3342
+ * // Await some controller from the component:
3343
+ * await controller.use(component.someController);
3344
+ * // Initialize new controllers
3345
+ * await controller.use(load(importCoreReactiveUtils));
3346
+ * await controller.use(new ViewModelController(component,newWidgetsHomeHomeViewModel));
3347
+ * await controller.use(someController(component));
3348
+ * });
3349
+ *
3350
+ * @remarks
3351
+ * If your controller is not async, and you are not creating it async, then
3352
+ * you are not required to use controller.use - you can use it directly.
3353
+ * Similarly, accessing controllers after componentWillLoad callback does not
3354
+ * require awaiting them as they are guaranteed to be loaded by then.
3355
+ */
3356
+ get use() {
3357
+ _Controller.internals.setAmbientComponent(this.component);
3358
+ return _Controller.internals.use;
3359
+ }
3360
+ /**
3361
+ * Just like controller.use, but returns the controller itself, rather than it's
3362
+ * exports
3363
+ *
3364
+ * Use cases:
3365
+ * - You have a controller and you want to make sure it's loaded before you
3366
+ * try to use it
3367
+ * - Your contoller is not using exports, so you wish to access some props on
3368
+ * it directly
3369
+ * - You have a controller exports only, and you want to retrieve the
3370
+ * controller itself. This is useful if you wish to call .watchExports() or
3371
+ * some other method on the controller
3372
+ */
3373
+ get useRef() {
3374
+ _Controller.internals.setAmbientComponent(this.component);
3375
+ return _Controller.internals.useRef;
3376
+ }
3377
+ /**
3378
+ * If you need to set a prop/state without triggering the custom setter you
3379
+ * defined with getSet()/dynamicGetSet()/readonly(), set the value inside
3380
+ * of this function
3381
+ *
3382
+ * @example
3383
+ * @Prop({mutable:true}) readOnly = this.manager.readOnly(true);
3384
+ *
3385
+ * someAction(): void {
3386
+ * this.manager.bypassSetter(()=>{
3387
+ * this.readOnly = false;
3388
+ * });
3389
+ * }
3390
+ *
3391
+ */
3392
+ bypassSetter(callback) {
3393
+ _Controller.internals.shouldBypassSetter = true;
3394
+ const result = safeCall(callback);
3395
+ _Controller.internals.shouldBypassSetter = false;
3396
+ return result;
3397
+ }
3398
+ /**
3399
+ * Like this.manager.getSet(), but can be called on any component's
3400
+ * state/prop from anywhere, rather than just from the default value
3401
+ */
3402
+ dynamicGetSet(name, getSet) {
3403
+ this.genericGetSet(name, getSet);
3404
+ }
3405
+ /**
3406
+ * Like dynamicGetSet, but less type-safe. Useful in cases when trying to set
3407
+ * getters/setters in place where property names & types are not known
3408
+ * statically
3409
+ */
3410
+ genericGetSet(property, getSet) {
3411
+ var _a2, _b;
3412
+ const classPrototype = Object.getPrototypeOf(this.component);
3413
+ this.internals.getSetProxy(classPrototype, property, getSet, "class");
3414
+ const htmlPrototype = Object.getPrototypeOf(this.component.el);
3415
+ if (classPrototype !== htmlPrototype)
3416
+ this.internals.getSetProxy(htmlPrototype, property, getSet, "html");
3417
+ const genericGetSet = getSet;
3418
+ if (genericGetSet.get !== void 0) {
3419
+ (_a2 = this.internals.getters)[property] ?? (_a2[property] = []);
3420
+ if (getSet.order === "last")
3421
+ this.internals.getters[property].splice(-1, 0, genericGetSet.get);
3422
+ else
3423
+ this.internals.getters[property].unshift(genericGetSet.get);
3424
+ }
3425
+ if (genericGetSet.set !== void 0) {
3426
+ (_b = this.internals.setters)[property] ?? (_b[property] = []);
3427
+ if (getSet.order === "last")
3428
+ this.internals.setters[property].splice(-1, 0, genericGetSet.set);
3429
+ else
3430
+ this.internals.setters[property].unshift(genericGetSet.set);
3431
+ }
3432
+ }
3433
+ // FEATURE: improve typings
3434
+ /**
3435
+ * Dynamically set a watcher for any @Prop()/@State() property
3436
+ */
3437
+ watch(property, callback) {
3438
+ var _a2;
3439
+ const type = getMemberType(this.component, property);
3440
+ if (type === void 0)
3441
+ throw new Error(
3442
+ `Trying to watch a non-@Prop, non-@State property "${property}". Either convert it into a @State() or use manager.getSet/dynamicGetSet`
3443
+ );
3444
+ addPropertyWatcher(this.component, property);
3445
+ (_a2 = this.internals.watchers)[property] ?? (_a2[property] = []);
3446
+ const watchers = this.internals.watchers[property];
3447
+ const genericCallback = callback;
3448
+ const safeCallback = (newValue, oldValue, propertyName) => safeCall(() => genericCallback(newValue, oldValue, propertyName));
3449
+ watchers.push(safeCallback);
3450
+ return () => {
3451
+ const index = watchers.indexOf(safeCallback);
3452
+ if (index !== -1)
3453
+ watchers.splice(index, 1);
3454
+ };
3455
+ }
3456
+ // Register a lifecycle callback
3457
+ onConnected(callback) {
3458
+ this._callbacks.hostConnected.push(callback);
3459
+ }
3460
+ onDisconnected(callback) {
3461
+ this._callbacks.hostDisconnected.push(callback);
3462
+ }
3463
+ onLoad(callback) {
3464
+ this._callbacks.hostLoad.push(callback);
3465
+ }
3466
+ onLoaded(callback) {
3467
+ this._callbacks.hostLoaded.push(callback);
3468
+ }
3469
+ onRender(callback) {
3470
+ this._callbacks.hostRender.push(callback);
3471
+ }
3472
+ onRendered(callback) {
3473
+ this._callbacks.hostRendered.push(callback);
3474
+ }
3475
+ onUpdate(callback) {
3476
+ this._callbacks.hostUpdate.push(callback);
3477
+ }
3478
+ onUpdated(callback) {
3479
+ this._callbacks.hostUpdated.push(callback);
3480
+ }
3481
+ onDestroy(callback) {
3482
+ this.component.manager.ensureHasDestroy();
3483
+ this._callbacks.hostDestroy.push(callback);
3484
+ }
3485
+ onLifecycle(callback) {
3486
+ this._callbacks.hostLifecycle.push(callback);
3487
+ if (this.connectedCalled && this.component.el.isConnected)
3488
+ this._callLifecycle(callback);
3489
+ }
3490
+ // Call each lifecycle hook
3491
+ triggerConnected() {
3492
+ this._callbacks.hostConnected.forEach(safeCall);
3493
+ this.triggerLifecycle();
3494
+ this.connectedCalled = true;
3495
+ }
3496
+ triggerDisconnected() {
3497
+ this._callbacks.hostDisconnected.forEach(safeCall);
3498
+ this._lifecycleDisconnected.forEach(safeCall);
3499
+ this._lifecycleDisconnected = [];
3500
+ }
3501
+ async triggerLoad() {
3502
+ if (this.willLoadCalled)
3503
+ return;
3504
+ this.willLoadCalled = true;
3505
+ if (this._callbacks.hostLoad.length > 0)
3506
+ await Promise.allSettled(this._callbacks.hostLoad.map(safeAsyncCall));
3507
+ this._ready.resolve(this._exports);
3508
+ }
3509
+ triggerLoaded() {
3510
+ if (this.didLoadCalled)
3511
+ return;
3512
+ this._callbacks.hostLoaded.forEach(safeCall);
3513
+ this.didLoadCalled = true;
3514
+ }
3515
+ async triggerRender() {
3516
+ if (this._callbacks.hostRender.length > 0)
3517
+ await Promise.allSettled(this._callbacks.hostRender.map(safeAsyncCall));
3518
+ }
3519
+ triggerRendered() {
3520
+ this._callbacks.hostRendered.forEach(safeCall);
3521
+ }
3522
+ async triggerUpdate() {
3523
+ if (this._callbacks.hostUpdate.length > 0)
3524
+ await Promise.allSettled(this._callbacks.hostUpdate.map(safeAsyncCall));
3525
+ }
3526
+ triggerUpdated() {
3527
+ this._callbacks.hostUpdated.forEach(safeCall);
3528
+ }
3529
+ triggerDestroy() {
3530
+ this._callbacks.hostDestroy.forEach(safeCall);
3531
+ }
3532
+ triggerLifecycle() {
3533
+ this._callbacks.hostLifecycle.forEach((callback) => this._callLifecycle(callback));
3534
+ }
3535
+ _callLifecycle(callback) {
3536
+ const cleanupRaw = safeCall(callback);
3537
+ const cleanup = Array.isArray(cleanupRaw) ? cleanupRaw : [cleanupRaw];
3538
+ cleanup.forEach((cleanup2) => {
3539
+ if (typeof cleanup2 === "function")
3540
+ this._lifecycleDisconnected.push(cleanup2);
3541
+ else if (typeof cleanup2 === "object" && typeof cleanup2.remove === "function")
3542
+ this._lifecycleDisconnected.push(cleanup2.remove);
3543
+ });
3544
+ }
3545
+ };
3546
+ _a = controllerSymbol;
3547
+ _Controller.internals = new ControllerInternals();
3548
+ var Controller = _Controller;
3549
+ var GenericController = class extends Controller {
3550
+ // Redundant constructor needed to improve typing
3551
+ constructor(component) {
3552
+ super(component);
3553
+ }
3554
+ // Overriding super's watch only to improve typing
3555
+ watch(property, callback) {
3556
+ return super.watch(
3557
+ property,
3558
+ callback
3559
+ );
3560
+ }
3561
+ /**
3562
+ * Silence "Property 'dynamicGetSet' in type
3563
+ * 'GenericController<Exports, Requires>' is not assignable to the same
3564
+ * property in base type 'Controller<Exports>'", as TypeScript is being overly
3565
+ * conservative here with what it allows
3566
+ */
3567
+ dynamicGetSet(property, getSet) {
3568
+ super.genericGetSet(property, getSet);
3569
+ }
3570
+ };
3571
+ function makeProvisionalValue(base) {
3572
+ if (typeof base !== "object" && typeof base !== "function" || base === null)
3573
+ return base;
3574
+ const proxy3 = new Proxy(base, {
3575
+ get(target, prop, receiver) {
3576
+ if (cyclical.has(prop) && prop in target && target[prop] === proxy3)
3577
+ return void 0;
3578
+ if (prop in target || promiseMethods.has(prop) || typeof prop === "symbol")
3579
+ return typeof target === "function" ? target[prop] : Reflect.get(target, prop, receiver);
3580
+ console.error(`Trying to access "${prop.toString()}" on the controller before it's loaded. ${accessBeforeLoad}`);
3581
+ return void 0;
3582
+ },
3583
+ set(target, prop, newValue, reciever) {
3584
+ console.error(`Trying to set "${prop.toString()}" on the controller before it's loaded. ${accessBeforeLoad}`);
3585
+ return Reflect.set(target, prop, newValue, reciever);
3586
+ }
3587
+ });
3588
+ return proxy3;
3589
+ }
3590
+ var promiseMethods = /* @__PURE__ */ new Set(["then", "catch", "finally"]);
3591
+ var cyclical = /* @__PURE__ */ new Set(["exports", "_exports"]);
3592
+ var accessBeforeLoad = [
3593
+ "This might be the case if you are trying to access an async controller in ",
3594
+ "connectedCallback(). Or, if you are using it inside of ",
3595
+ "componentWillLoad()/another controller without controller.use. Example correct ",
3596
+ "usage:\n",
3597
+ "makeController(async (component, controller)=>{ await controller.use(someOtherController); });"
3598
+ ].join("");
3599
+ function toControllerHost(component) {
3600
+ if ("addController" in component)
3601
+ return component;
3602
+ else
3603
+ throw new Error(
3604
+ "Component does not implement ControllerHost. This might be because you forgot to add 'manager: Controller<this> = useControllerManager(this);' in your component, or you tried to use some controller before that line"
3605
+ );
3606
+ }
3607
+
3608
+ // src/trackPropertyKey.ts
3609
+ function trackPropertyKey(object, onResolved, defaultValue) {
3610
+ const keys = Object.keys(object);
3611
+ const keyCount = keys.length;
3612
+ if (keyTrackMap === void 0)
3613
+ queueMicrotask(keyTrackResolve);
3614
+ keyTrackMap ?? (keyTrackMap = /* @__PURE__ */ new Map());
3615
+ let pendingTrackers = keyTrackMap.get(object);
3616
+ if (pendingTrackers === void 0) {
3617
+ pendingTrackers = { callbacks: [], keyCount };
3618
+ keyTrackMap.set(object, pendingTrackers);
3619
+ }
3620
+ if (pendingTrackers.keyCount !== keyCount) {
3621
+ pendingTrackers.callbacks.forEach((resolve) => resolve(keys));
3622
+ pendingTrackers.callbacks = [];
3623
+ pendingTrackers.keyCount = keyCount;
3624
+ }
3625
+ pendingTrackers.callbacks.push((keys2) => {
3626
+ const key = keys2[keyCount];
3627
+ if (key === void 0)
3628
+ onResolved(void 0);
3629
+ else if (object[key] === defaultValue)
3630
+ onResolved(key);
3631
+ else
3632
+ onResolved(void 0);
3633
+ });
3634
+ return defaultValue;
3635
+ }
3636
+ var keyTrackMap = void 0;
3637
+ function keyTrackResolve() {
3638
+ Array.from(keyTrackMap?.entries() ?? []).forEach(([object, { callbacks }]) => {
3639
+ const keys = Object.keys(object);
3640
+ callbacks.forEach((commit) => commit(keys));
3641
+ });
3642
+ keyTrackMap = void 0;
3643
+ }
3644
+
3645
+ // src/ComponentInternals.ts
3646
+ var ComponentInternals = class {
3647
+ constructor(component) {
3648
+ this.trackKey = (hostsCandidates, onResolved, defaultValue) => {
3649
+ const candidateHosts = Array.isArray(hostsCandidates) ? hostsCandidates : [hostsCandidates];
3650
+ let leftToResolve = candidateHosts.length + 1;
3651
+ const resolved = (resolution) => {
3652
+ leftToResolve -= 1;
3653
+ if (resolution !== void 0)
3654
+ leftToResolve = 0;
3655
+ if (leftToResolve === 0)
3656
+ onResolved(resolution);
3657
+ };
3658
+ candidateHosts.forEach(
3659
+ (host) => this.component.manager.trackPropertyKey(
3660
+ host,
3661
+ (key) => resolved(
3662
+ key === void 0 ? void 0 : {
3663
+ key,
3664
+ host,
3665
+ type: "property",
3666
+ domValue: void 0
3667
+ }
3668
+ ),
3669
+ defaultValue
3670
+ )
3671
+ );
3672
+ this.component.manager.trackPropKey((key, domValue) => {
3673
+ const propType = key === void 0 ? void 0 : getPropType(this.component, key);
3674
+ resolved(
3675
+ key === void 0 ? void 0 : {
3676
+ key,
3677
+ host: this.component,
3678
+ type: propType ?? "prop",
3679
+ domValue: propType === "prop" ? domValue : void 0
3680
+ }
3681
+ );
3682
+ }, defaultValue);
3683
+ return defaultValue;
3684
+ };
3685
+ this.trackPropKey = (onResolved, defaultValue) => {
3686
+ if (this._trackedValue !== nothing && this._trackedValue !== defaultValue)
3687
+ this._firePropertyTrackers(void 0, void 0, void 0);
3688
+ if (this._keyTrackers.length === 0)
3689
+ queueMicrotask(() => this._firePropertyTrackers(void 0, void 0, void 0));
3690
+ this._trackedValue = defaultValue;
3691
+ this._keyTrackers.push(
3692
+ (key, value, previousValue) => onResolved(defaultValue === value ? key : void 0, previousValue)
3693
+ );
3694
+ return defaultValue;
3695
+ };
3696
+ this._trackedValue = nothing;
3697
+ this._keyTrackers = [];
3698
+ this.getters = {};
3699
+ this.setters = {};
3700
+ this._exports = /* @__PURE__ */ new WeakMap();
3701
+ Object.defineProperty(this, "component", {
3702
+ writable: false,
3703
+ enumerable: false,
3704
+ configurable: true,
3705
+ value: component
3706
+ });
3707
+ }
3708
+ _firePropertyTrackers(key, value, oldValue) {
3709
+ const trackers = this._keyTrackers;
3710
+ this._trackedValue = nothing;
3711
+ this._keyTrackers = [];
3712
+ trackers.forEach((tracker) => tracker(key, value, oldValue));
3713
+ }
3714
+ /**
3715
+ * Configure a getter or setter for a given @Prop/@State. Note, since props
3716
+ * are defined on the prototype, they are shared between all instances of a
3717
+ * component. Thus instead of passing function reference to
3718
+ * Object.defineProperty, we use instance-owned getters and setters array.
3719
+ */
3720
+ getSetProxy(prototype, name, {
3721
+ get,
3722
+ set
3723
+ }, type) {
3724
+ const component = this.component;
3725
+ const propType = getMemberType(component, name);
3726
+ const descriptor = Object.getOwnPropertyDescriptor(prototype, name);
3727
+ const tolerateNotFound = type === "html";
3728
+ if (descriptor?.set === void 0 || descriptor.get === void 0)
3729
+ if (descriptor !== void 0 && "value" in descriptor)
3730
+ throw new Error(
3731
+ `getSet() should only be used on Stencil's @Prop and @State properties. For internal component properties, use regular get/set syntax. Tried to use it on "${name}" in ${component.el.tagName}`
3732
+ );
3733
+ else if (tolerateNotFound)
3734
+ return;
3735
+ else
3736
+ throw new Error(`Unable to find "${name}" property on the ${component.el.tagName} component`);
3737
+ const { get: originalGet, set: originalSet } = descriptor;
3738
+ const isGetterAlreadyOverwritten = customAccessor in originalGet;
3739
+ const isSetterAlreadyOverwritten = customAccessor in originalSet;
3740
+ const shouldOverwriteGet = !isGetterAlreadyOverwritten && typeof get === "function";
3741
+ const shouldOverwriteSet = !isSetterAlreadyOverwritten && typeof set === "function";
3742
+ if (!shouldOverwriteGet && !shouldOverwriteSet)
3743
+ return;
3744
+ const finalGetter = shouldOverwriteGet ? function getter() {
3745
+ let value = originalGet.call(this);
3746
+ const component2 = Controller.internals.elementToInstance.get(this);
3747
+ const getters = component2?.manager.internals.getters[name] ?? [];
3748
+ for (let i = 0; i < getters.length; i++)
3749
+ value = getters[i](value, name);
3750
+ return value;
3751
+ } : originalGet;
3752
+ const finalSetter = shouldOverwriteSet ? function setter(rawNewValue) {
3753
+ if (Controller.internals.shouldBypassSetter) {
3754
+ originalSet.call(this, rawNewValue);
3755
+ return;
3756
+ }
3757
+ const oldValue = originalGet.call(this);
3758
+ let newValue = parsePropertyValue(rawNewValue, propType);
3759
+ const component2 = Controller.internals.elementToInstance.get(this);
3760
+ const internals = component2?.manager.internals;
3761
+ if (newValue === oldValue)
3762
+ originalSet.call(this, rawNewValue);
3763
+ else {
3764
+ const setters = internals?.setters[name] ?? [];
3765
+ for (let i = 0; i < setters.length; i++)
3766
+ newValue = setters[i](newValue, oldValue, name);
3767
+ originalSet.call(this, newValue);
3768
+ }
3769
+ if ((internals?._keyTrackers.length ?? 0) > 0)
3770
+ internals?._firePropertyTrackers(name, rawNewValue, oldValue);
3771
+ } : originalSet;
3772
+ if (shouldOverwriteGet)
3773
+ Object.defineProperty(finalGetter, customAccessor, { value: true });
3774
+ if (shouldOverwriteSet)
3775
+ Object.defineProperty(finalSetter, customAccessor, { value: true });
3776
+ Object.defineProperty(prototype, name, {
3777
+ ...descriptor,
3778
+ get: finalGetter,
3779
+ set: finalSetter
3780
+ });
3781
+ }
3782
+ /**
3783
+ * Associate an exports object with a controller for reverse lookup in
3784
+ * controller.use
3785
+ */
3786
+ markExports(controller, exports) {
3787
+ if (typeof exports === "object" && exports !== null || typeof exports === "function")
3788
+ this._exports.set(exports, controller);
3789
+ }
3790
+ resolveExports(exports) {
3791
+ if (typeof exports === "object" && exports !== null || typeof exports === "function")
3792
+ return this._exports.get(exports);
3793
+ else
3794
+ return void 0;
3795
+ }
3796
+ };
3797
+ var customAccessor = Symbol("controllersCustomAccessor");
3798
+ var nothing = Symbol("nothing");
3799
+
3800
+ // ../core-adapter/dist/index.js
3801
+ var isAMD = typeof window !== "undefined" && "$arcgis" in window && typeof window.$arcgis === "object" && "import" in window.$arcgis;
3802
+ function isDefaultModule(module) {
3803
+ return module.default !== void 0;
3804
+ }
3805
+ async function importCoreAccessor() {
3806
+ if (isAMD) {
3807
+ return await window.$arcgis.import("esri/core/Accessor");
3808
+ }
3809
+ const module = await import('./Accessor-YDTURKZ7-dcaf409b.js');
3810
+ return isDefaultModule(module) ? module.default : module;
3811
+ }
3812
+ async function importCoreAccessorSupportDecorators() {
3813
+ if (isAMD) {
3814
+ return await window.$arcgis.import("esri/core/accessorSupport/decorators");
3815
+ }
3816
+ const module = await import('./decorators-443AWDOE-8b8ddc71.js');
3817
+ return isDefaultModule(module) ? module.default : module;
3818
+ }
3819
+
3820
+ // src/accessorIntegration.ts
3821
+ var accessorPromise = Promise.all([importCoreAccessor(), importCoreAccessorSupportDecorators()]);
3822
+ async function accessorIntegration(component) {
3823
+ let accessor = void 0;
3824
+ const getSet = {
3825
+ get: (value, propertyName) => {
3826
+ const accessorValue = accessor?.[propertyName];
3827
+ return value ?? accessorValue;
3828
+ },
3829
+ set: (newValue, oldValue, propertyName) => {
3830
+ if (accessor !== void 0)
3831
+ accessor[propertyName] = newValue;
3832
+ return newValue;
3833
+ }
3834
+ };
3835
+ const members = getPropLikeMembers(component);
3836
+ members.forEach((member) => component.manager.genericGetSet(member, getSet));
3837
+ const [Accessor, { subclass, property }] = await accessorPromise;
3838
+ return () => {
3839
+ class AccessorSubclass extends Accessor {
3840
+ }
3841
+ members.forEach(
3842
+ (name) => property({
3843
+ value: component[name]
3844
+ })(AccessorSubclass.prototype, name)
3845
+ );
3846
+ const Subclass = subclass(component.el.tagName)(AccessorSubclass);
3847
+ accessor = new Subclass();
3848
+ };
3849
+ }
3850
+
3851
+ // src/ControllerManager.ts
3852
+ var useControllerManager = (component) => new ControllerManager(component);
3853
+ var ControllerManager = class extends GenericController {
3854
+ constructor(component) {
3855
+ const controllers = /* @__PURE__ */ new Set();
3856
+ const watchers = {};
3857
+ const controllerHost = {
3858
+ addController: (controller) => {
3859
+ controllers.add(controller);
3860
+ },
3861
+ [watcherCallbackName]: (newValue, oldValue, propertyName) => {
3862
+ watchers[propertyName]?.forEach((callback) => callback(newValue, oldValue, propertyName));
3863
+ },
3864
+ removeController: (controller) => {
3865
+ controllers.delete(controller);
3866
+ },
3867
+ requestUpdate: () => forceUpdate(component)
3868
+ };
3869
+ extendObject(component, controllerHost);
3870
+ super(component);
3871
+ this._connected = new h();
3872
+ this.internals = new ComponentInternals(this.component);
3873
+ this.connected = this._connected.promise;
3874
+ this.hasDestroy = false;
3875
+ this.destroyed = false;
3876
+ this._updatePromise = new h();
3877
+ this._originalLifecycles = {};
3878
+ /**
3879
+ * A magical solution to finding out what property name a given controller
3880
+ * on a given object was assigned to. Note, this does not work for properties
3881
+ * that have \@Prop() or \@State() decorator - for those, use
3882
+ * manager.trackPropKey() instead.
3883
+ *
3884
+ * @example
3885
+ * function trackMe<T>(defaultValue:T, component:BaseComponent):T {
3886
+ * component.manager.trackPropertyKey(component, (key)=>console.log(key), defaultValue);
3887
+ * return defaultValue;
3888
+ * }
3889
+ *
3890
+ * class MyComponent extends BaseComponent {
3891
+ * // Will console log "myProp"
3892
+ * myProp = trackMe('a', this);
3893
+ * }
3894
+ *
3895
+ */
3896
+ this.trackPropertyKey = trackPropertyKey;
3897
+ /**
3898
+ * Like manager.trackPropertyKey(), but for props that have \@State() or \@Prop()
3899
+ * decorator
3900
+ *
3901
+ * @example
3902
+ * function trackMe(component:BaseComponent) {
3903
+ * component.manager.trackPropKey((key)=>console.log(key));
3904
+ * }
3905
+ *
3906
+ * class MyComponent extends BaseComponent {
3907
+ * // Will console log "myProp"
3908
+ * @Prop() myProp = trackMe(this);
3909
+ *
3910
+ * // Will console log "myState"
3911
+ * @State() myState = trackMe(this);
3912
+ * }
3913
+ */
3914
+ this.trackPropKey = this.internals.trackPropKey;
3915
+ /**
3916
+ * A combination of trackPropertyKey() and trackPropKey(). For usage when
3917
+ * you want to track a property, but don't know if it will be defined with the
3918
+ * \@Prop() decorator or not
3919
+ */
3920
+ this.trackKey = this.internals.trackKey;
3921
+ this.component.manager = this;
3922
+ retrieveComponentMeta(component);
3923
+ this._controllers = controllers;
3924
+ this.internals.watchers = watchers;
3925
+ this.exports = void 0;
3926
+ this.hasDestroy = "preserveOnDisconnect" in this.component && typeof this.component.destroy === "function";
3927
+ if (this.hasDestroy)
3928
+ this.watch("preserveOnDisconnect", () => this._preserveOnDisconnectWatcher());
3929
+ this._bindLifecycleMethods();
3930
+ Object.defineProperty(component, "updateComplete", {
3931
+ get: async () => await this._updatePromise.promise
3932
+ });
3933
+ this.component.addController(this);
3934
+ this._accessorIntegrationReady = accessorIntegration(this.component);
3935
+ Controller.internals.setParentController(void 0);
3936
+ Controller.internals.setAmbientComponent(component);
3937
+ Controller.internals.elementToInstance.set(component.el, component);
3938
+ Controller.internals.elementToInstance.set(component, component);
3939
+ }
3940
+ _bindLifecycleMethods() {
3941
+ const component = this.component;
3942
+ this._originalLifecycles = {
3943
+ connectedCallback: component.connectedCallback,
3944
+ disconnectedCallback: component.disconnectedCallback,
3945
+ componentWillLoad: component.componentWillLoad,
3946
+ componentDidLoad: component.componentDidLoad,
3947
+ componentWillRender: component.componentWillRender,
3948
+ componentDidRender: component.componentDidRender,
3949
+ componentWillUpdate: component.componentWillUpdate,
3950
+ componentDidUpdate: component.componentDidUpdate,
3951
+ destroy: component.destroy
3952
+ };
3953
+ component.connectedCallback = this._connectedCallback.bind(this);
3954
+ component.disconnectedCallback = this._disconnectedCallback.bind(this);
3955
+ component.componentWillLoad = this._componentWillLoad.bind(this);
3956
+ component.componentDidLoad = this._componentDidLoad.bind(this);
3957
+ component.componentWillRender = this._componentWillRender.bind(this);
3958
+ component.componentDidRender = this._componentDidRender.bind(this);
3959
+ component.componentWillUpdate = this._componentWillUpdate.bind(this);
3960
+ component.componentDidUpdate = this._componentDidUpdate.bind(this);
3961
+ if (this.hasDestroy)
3962
+ component.destroy = this.destroy.bind(this);
3963
+ }
3964
+ /**
3965
+ * Throws an error if component does not implement destroy() lifecycle, but
3966
+ * tries to use it.
3967
+ */
3968
+ ensureHasDestroy() {
3969
+ if (!this.hasDestroy)
3970
+ throw new Error(destroyErrorMessage);
3971
+ }
3972
+ /**
3973
+ * Private because this is not supposed to be called by Component directly.
3974
+ * Instead, _bindLifecycleMethods will take care of that. Otherwise, you risk
3975
+ * calling lifecycle methods twice.
3976
+ */
3977
+ _connectedCallback() {
3978
+ if (this.destroyed) {
3979
+ const tagName = this.component.el.tagName.toLowerCase();
3980
+ this.component.el.remove();
3981
+ throw new Error(
3982
+ `The ${tagName} component has already been destroyed. It can not be used again. If you meant to disconnect and reconnect a component without automatic destroy, set the preserveOnDisconnect prop.`
3983
+ );
3984
+ }
3985
+ keyTrackResolve();
3986
+ this._connected.resolve();
3987
+ this._controllers.forEach(
3988
+ (controller) => "triggerConnected" in controller ? controller.triggerConnected() : safeCall(() => controller.hostConnected?.())
3989
+ );
3990
+ this._originalLifecycles.connectedCallback?.call(this.component);
3991
+ }
3992
+ _disconnectedCallback() {
3993
+ if (this.destroyed)
3994
+ return;
3995
+ this._controllers.forEach(
3996
+ (controller) => "triggerDisconnected" in controller ? controller.triggerDisconnected() : safeCall(() => controller.hostDisconnected?.())
3997
+ );
3998
+ this._originalLifecycles.disconnectedCallback?.call(this.component);
3999
+ if (this.hasDestroy)
4000
+ this._preserveOnDisconnectWatcher();
4001
+ }
4002
+ async _componentWillLoad() {
4003
+ const enableIntegration = await this._accessorIntegrationReady;
4004
+ enableIntegration();
4005
+ await Promise.allSettled(
4006
+ Array.from(
4007
+ this._controllers,
4008
+ async (controller) => "triggerLoad" in controller ? await controller.triggerLoad() : await safeAsyncCall(async () => await controller.hostLoad?.())
4009
+ )
4010
+ );
4011
+ await this._originalLifecycles.componentWillLoad?.call(this.component);
4012
+ }
4013
+ _componentDidLoad() {
4014
+ this._controllers.forEach(
4015
+ (controller) => "triggerLoaded" in controller ? controller.triggerLoaded() : safeCall(() => controller.hostLoaded?.())
4016
+ );
4017
+ this._originalLifecycles.componentDidLoad?.call(this.component);
4018
+ }
4019
+ async _componentWillRender() {
4020
+ await Promise.allSettled(
4021
+ Array.from(
4022
+ this._controllers,
4023
+ async (controller) => "triggerRender" in controller ? await controller.triggerRender() : await safeAsyncCall(async () => await controller.hostRender?.())
4024
+ )
4025
+ );
4026
+ await this._originalLifecycles.componentWillRender?.call(this.component);
4027
+ }
4028
+ _componentDidRender() {
4029
+ this._controllers.forEach(
4030
+ (controller) => "triggerRendered" in controller ? controller.triggerRendered() : safeCall(() => controller.hostRendered?.())
4031
+ );
4032
+ this._originalLifecycles.componentDidRender?.call(this.component);
4033
+ }
4034
+ async _componentWillUpdate() {
4035
+ await Promise.allSettled(
4036
+ Array.from(
4037
+ this._controllers,
4038
+ async (controller) => "triggerUpdate" in controller ? await controller.triggerUpdate() : await safeAsyncCall(async () => await controller.hostUpdate?.())
4039
+ )
4040
+ );
4041
+ await this._originalLifecycles.componentWillUpdate?.call(this.component);
4042
+ }
4043
+ _componentDidUpdate() {
4044
+ this._controllers.forEach(
4045
+ (controller) => "triggerUpdated" in controller ? controller.triggerUpdated() : safeCall(() => controller.hostUpdated?.())
4046
+ );
4047
+ this._originalLifecycles.componentDidUpdate?.call(this.component);
4048
+ const updatePromise = this._updatePromise;
4049
+ this._updatePromise = new h();
4050
+ updatePromise.resolve(true);
4051
+ }
4052
+ async destroy() {
4053
+ this.ensureHasDestroy();
4054
+ if (this.destroyed)
4055
+ return;
4056
+ if (this.component.el.isConnected) {
4057
+ this.hasDestroy = false;
4058
+ this.component.el.remove();
4059
+ this.hasDestroy = true;
4060
+ }
4061
+ this.destroyed = true;
4062
+ this._controllers.forEach(
4063
+ (controller) => "triggerDestroy" in controller ? controller.triggerDestroy() : safeCall(() => controller.hostDestroy?.())
4064
+ );
4065
+ await this._originalLifecycles.destroy?.call(this.component);
4066
+ }
4067
+ _preserveOnDisconnectWatcher() {
4068
+ if (!this.component.el.isConnected && !this.component.preserveOnDisconnect)
4069
+ void this.destroy().catch(console.error);
4070
+ }
4071
+ readonly(value) {
4072
+ return this.getSet(value, {
4073
+ set: (newValue, _oldValue, property) => {
4074
+ throw new Error(
4075
+ `Cannot assign to read-only property "${property}" of ${this.component.el.tagName.toLowerCase()}. Trying to assign "${String(
4076
+ newValue
4077
+ )}"`
4078
+ );
4079
+ }
4080
+ });
4081
+ }
4082
+ /**
4083
+ * Listen for any component's @State()/@Prop() change, and mutate it's
4084
+ * value before it is set.
4085
+ * This is necessary because Stencil's Compiler does not support get/set for
4086
+ * @State()/@Prop().
4087
+ * For private component properties, you should use regular get/set syntax.
4088
+ *
4089
+ * @example
4090
+ * @Prop() exampleProp = this.manager.getSet(defaultValue,{get,set})
4091
+ * @Prop() someProp = this.manager.getSet(
4092
+ * undefined as string | undefined,
4093
+ * {
4094
+ * get: (value)=>value.trim(),
4095
+ * set: (newValue,oldValue) => newValue.trim() ?? oldValue
4096
+ * }
4097
+ * )
4098
+ *
4099
+ * @remarks
4100
+ * Unlike a native get/set, the get function receives the current attribute
4101
+ * value, and can modify it before returning it (or can disregard the current
4102
+ * value and get it from elsewhere instead).
4103
+ * Similarly, setter is called with the new and old value, and is expected to
4104
+ * return the final new value (or return the old value to undo the change)
4105
+ */
4106
+ getSet(defaultValue, getSet) {
4107
+ return this.component.manager.trackPropKey((name) => {
4108
+ if (name === void 0)
4109
+ throw new Error(
4110
+ "Unable to resolve get/set's prop name. Make sure you are using it like @Prop() someProp = this.manager.getSet(defaultValue,{get,set})"
4111
+ );
4112
+ const genericComponent = this.component;
4113
+ const value = genericComponent[name];
4114
+ if (value != null && value !== defaultValue && typeof getSet.set === "function" && getSet.initialSet !== false) {
4115
+ const newValue = getSet.set(value, defaultValue, name);
4116
+ if (newValue !== value)
4117
+ genericComponent[name] = newValue;
4118
+ }
4119
+ this.genericGetSet(name, getSet);
4120
+ }, defaultValue);
4121
+ }
4122
+ };
4123
+ var destroyErrorMessage = `
4124
+ If the component uses a controller that uses destroy() method, then the
4125
+ component must have the following properties:
4126
+ ${// Don't expose internal code in production, and keep bundle smaller:
4127
+ `preserveOnDisconnect and destroy` }
4128
+ `.trim();
4129
+
4130
+ // src/proxyExports.ts
4131
+ var proxyExports = (Class) => (...args) => {
4132
+ const ambientControllers = Controller.internals.retriveParentControllers();
4133
+ const instance = new Class(...args);
4134
+ const initialExports = instance.exports;
4135
+ Controller.internals.setParentController(ambientControllers.at(-1));
4136
+ const internals = instance.component.manager.internals;
4137
+ internals.markExports(instance, initialExports);
4138
+ instance.watchExports((exports) => internals.markExports(instance, exports));
4139
+ Controller.internals.setAmbientChildController(instance);
4140
+ const hostCandidates = [instance.component, ...ambientControllers].reverse();
4141
+ return internals.trackKey(
4142
+ hostCandidates,
4143
+ (resolution) => resolution === void 0 ? void 0 : setProxy(instance, resolution.host, resolution.key, initialExports),
4144
+ initialExports
4145
+ );
4146
+ };
4147
+ function setProxy(controller, host, key, initialExports) {
4148
+ const genericHost = host;
4149
+ const controllerValueChanged = genericHost[key] !== controller.exports;
4150
+ const hostValueChanged = genericHost[key] !== initialExports;
4151
+ const controllerUpdatedExports = initialExports !== controller.exports;
4152
+ if (controllerValueChanged && !hostValueChanged && controllerUpdatedExports)
4153
+ genericHost[key] = controller.exports;
4154
+ controller.watchExports(() => {
4155
+ if (genericHost[key] !== controller.exports)
4156
+ genericHost[key] = controller.exports;
4157
+ });
4158
+ }
4159
+
4160
+ // src/functional.ts
4161
+ var makeController = (constructor) => proxy(void 0, constructor);
4162
+ var FunctionalController = class extends Controller {
4163
+ constructor(component, constructor) {
4164
+ super(component);
4165
+ const originalExports = this.exports;
4166
+ try {
4167
+ Controller.internals.setAmbientComponent(this.component);
4168
+ const value = constructor(this.component, this);
4169
+ const constructorChangedExports = this.exports !== originalExports;
4170
+ if (value instanceof Promise) {
4171
+ if (!constructorChangedExports)
4172
+ this.setProvisionalExports(value);
4173
+ const resolved = value.then((result) => {
4174
+ this.exports = result;
4175
+ super.catchUpLifecycle();
4176
+ }).catch((error) => {
4177
+ this._ready.reject(error);
4178
+ console.error(error);
4179
+ });
4180
+ this.onLoad(async () => await resolved);
4181
+ } else {
4182
+ if (!constructorChangedExports || value !== void 0)
4183
+ this.exports = value;
4184
+ super.catchUpLifecycle();
4185
+ }
4186
+ } catch (error) {
4187
+ this._ready.reject(error);
4188
+ console.error(error);
4189
+ }
4190
+ }
4191
+ /** Noop - will be called in the constructor instead */
4192
+ catchUpLifecycle() {
4193
+ return;
4194
+ }
4195
+ };
4196
+ var proxy = proxyExports(FunctionalController);
4197
+ function useT9n({
4198
+ blocking = false,
4199
+ name
4200
+ } = {}) {
4201
+ return makeController((component, controller) => {
4202
+ controller.onLifecycle(
4203
+ () => Y(
4204
+ component.el,
4205
+ getAssetPath("./assets"),
4206
+ ({ t9nLocale, t9nStrings, lang }) => {
4207
+ controller.exports = { ...t9nStrings, _lang: lang, _t9nLocale: t9nLocale };
4208
+ if (typeof t9nStrings.widgetLabel === "string" && "label" in component)
4209
+ component.label ?? (component.label = t9nStrings.widgetLabel);
4210
+ },
4211
+ name
4212
+ )
4213
+ );
4214
+ if (blocking)
4215
+ return controller.ready;
4216
+ const locale = M(component.el);
4217
+ return { _lang: locale.lang, _t9nLocale: locale.t9nLocale };
4218
+ });
4219
+ }
4220
+
2940
4221
  function isMonacoEnvironmentSetup() {
2941
4222
  return !!window.MonacoEnvironment?.getWorkerUrl;
2942
4223
  }
@@ -2977,7 +4258,7 @@ function setupMonacoEnvironment(assetsPath) {
2977
4258
  break;
2978
4259
  }
2979
4260
  // If we have a relative path or we are on same orgin, we can use the default js implementation
2980
- if (!ie(url) || se(url, globalThis.location.href, true)) {
4261
+ if (!de(url) || ge(url, globalThis.location.href, true)) {
2981
4262
  return new Worker(url, { name: languageId });
2982
4263
  }
2983
4264
  // For cross orgin, we will load the worker code as a string and manufacture a blob
@@ -3084,7 +4365,7 @@ async function getArcadeWorker(uri) {
3084
4365
  * @returns arcade mode module
3085
4366
  */
3086
4367
  async function getMode() {
3087
- return await import('./arcade-mode-ec8b7890.js');
4368
+ return await import('./arcade-mode-a9774d50.js');
3088
4369
  }
3089
4370
  // Register the language in Monaco
3090
4371
  languages.register({
@@ -3114,6 +4395,8 @@ const ArcgisArcadeApi = class {
3114
4395
  registerInstance(this, hostRef);
3115
4396
  this.close = createEvent(this, "close", 3);
3116
4397
  this.itemSelected = createEvent(this, "itemSelected", 3);
4398
+ this.manager = useControllerManager(this);
4399
+ this.messages = useT9n();
3117
4400
  this._emitItemSelected = (e) => {
3118
4401
  const item = e.target?.["data-item"];
3119
4402
  if (!item) {
@@ -3153,9 +4436,6 @@ const ArcgisArcadeApi = class {
3153
4436
  this._updateFilterValue = (e) => {
3154
4437
  this._filterValue = e.target?.value ?? "";
3155
4438
  };
3156
- this._lang = "";
3157
- this._t9nLocale = "";
3158
- this._t9nStrings = undefined;
3159
4439
  this._selectedApiItem = undefined;
3160
4440
  this._filterValue = "";
3161
4441
  this._colorizeStyle = "";
@@ -3169,7 +4449,6 @@ const ArcgisArcadeApi = class {
3169
4449
  async componentWillLoad() {
3170
4450
  this._colorizeStyle = generateColorizeStyles();
3171
4451
  this._themeChangedListner = onColorizeThemeChanged(() => (this._colorizeStyle = generateColorizeStyles()));
3172
- await B(this, getAssetPath("./assets"));
3173
4452
  arcadeDefaults.onModelContextDidChange((key) => {
3174
4453
  if (!this.modelId || key !== Uri.parse(this.modelId).toString()) {
3175
4454
  return;
@@ -3179,7 +4458,6 @@ const ArcgisArcadeApi = class {
3179
4458
  await this._updateApiLibrary();
3180
4459
  }
3181
4460
  disconnectedCallback() {
3182
- q(this);
3183
4461
  this._flowObserver?.disconnect();
3184
4462
  this._themeChangedListner?.dispose();
3185
4463
  }
@@ -3235,14 +4513,14 @@ const ArcgisArcadeApi = class {
3235
4513
  if (!filteredApiItems.length) {
3236
4514
  return null;
3237
4515
  }
3238
- return (h("calcite-list-item-group", { heading: category.title }, filteredApiItems.map((apiItem) => (h("calcite-list-item", { label: G(apiItem.completion.detail), onCalciteListItemSelect: this._emitItemSelected, onKeyPress: this._emitItemSelected, "data-item": apiItem }, h("calcite-action", { slot: "actions-end", text: this._t9nStrings?.expand ?? "Expand", icon: "chevron-right", iconFlipRtl: true, scale: "s", onClick: this._selectItem, "data-item": apiItem }))))));
4516
+ return (h$1("calcite-list-item-group", { heading: category.title }, filteredApiItems.map((apiItem) => (h$1("calcite-list-item", { label: oe(apiItem.completion.detail), onCalciteListItemSelect: this._emitItemSelected, onKeyPress: this._emitItemSelected, "data-item": apiItem }, h$1("calcite-action", { slot: "actions-end", text: this.messages.expand ?? "Expand", icon: "chevron-right", iconFlipRtl: true, scale: "s", onClick: this._selectItem, "data-item": apiItem }))))));
3239
4517
  }
3240
4518
  renderApiItemFlowItem() {
3241
4519
  const apiItem = this._selectedApiItem;
3242
4520
  if (!apiItem) {
3243
4521
  return null;
3244
4522
  }
3245
- return (h("calcite-flow-item", { heading: this._t9nStrings?.constantsandfunctions, beforeBack: this._unselectItem, closable: true, onCalciteFlowItemClose: this._emitClose }, this.hideDocumentationActions ? null : (h("calcite-button", { width: "half", slot: "footer", appearance: "outline", kind: "brand", scale: "s", href: apiItem.link, target: "Arcade Help", "icon-start": "information" }, this._t9nStrings?.moreinformation)), h("calcite-button", { width: "half", slot: "footer", appearance: "outline", kind: "brand", "icon-start": "code", scale: "s", onClick: this._emitItemSelectedAndClose, "data-item": apiItem, ref: (e) => void e?.setFocus() }, this._t9nStrings?.insert ?? "Insert"), h("calcite-block", { open: true, heading: G(apiItem.completion.detail) }, h("div", { innerHTML: convertMarkdownString(apiItem.completion.documentation) }), apiItem.examples ? (h("div", { ref: (e) => {
4523
+ return (h$1("calcite-flow-item", { heading: this.messages.constantsandfunctions, beforeBack: this._unselectItem, closable: true, onCalciteFlowItemClose: this._emitClose }, this.hideDocumentationActions ? null : (h$1("calcite-button", { width: "half", slot: "footer", appearance: "outline", kind: "brand", scale: "s", href: apiItem.link, target: "Arcade Help", "icon-start": "information" }, this.messages.moreinformation)), h$1("calcite-button", { width: "half", slot: "footer", appearance: "outline", kind: "brand", "icon-start": "code", scale: "s", onClick: this._emitItemSelectedAndClose, "data-item": apiItem, ref: (e) => void e?.setFocus() }, this.messages.insert ?? "Insert"), h$1("calcite-block", { open: true, heading: oe(apiItem.completion.detail) }, h$1("div", { innerHTML: convertMarkdownString(apiItem.completion.documentation) }), apiItem.examples ? (h$1("div", { ref: (e) => {
3246
4524
  if (!e) {
3247
4525
  return;
3248
4526
  }
@@ -3253,10 +4531,10 @@ const ArcgisArcadeApi = class {
3253
4531
  render() {
3254
4532
  const categories = (this._apiLibrary ?? []).map((apiCategory) => this.renderApiCategory(apiCategory));
3255
4533
  const empty = categories.every((g) => !g);
3256
- return (h(Host, null, h("style", null, this._colorizeStyle), h("calcite-flow", { ref: (ref) => this.flowFocusHandler(ref) }, h("calcite-flow-item", { heading: this._t9nStrings?.constantsandfunctions, closable: true, onCalciteFlowItemClose: this._emitClose }, h("calcite-input", { value: this._filterValue, icon: "magnifying-glass", clearable: true, onCalciteInputInput: this._updateFilterValue, class: "sticky", scale: "m" }), this._preparingApi ? (h("calcite-loader", { scale: "s", type: "indeterminate", label: this._t9nStrings?.loading ?? "Loading" })) : (h("calcite-list", null, empty ? h("div", { class: "notice-container" }, this._t9nStrings?.noitems ?? "No items") : categories))), this.renderApiItemFlowItem())));
4534
+ return (h$1(Host, null, h$1("style", null, this._colorizeStyle), h$1("calcite-flow", { ref: (ref) => this.flowFocusHandler(ref) }, h$1("calcite-flow-item", { heading: this.messages.constantsandfunctions, closable: true, onCalciteFlowItemClose: this._emitClose }, h$1("calcite-input", { value: this._filterValue, icon: "magnifying-glass", clearable: true, onCalciteInputInput: this._updateFilterValue, class: "sticky", scale: "m" }), this._preparingApi ? (h$1("calcite-loader", { scale: "s", type: "indeterminate", label: this.messages.loading ?? "Loading" })) : (h$1("calcite-list", null, empty ? h$1("div", { class: "notice-container" }, this.messages.noitems ?? "No items") : categories))), this.renderApiItemFlowItem())));
3257
4535
  }
3258
4536
  static get assetsDirs() { return ["assets"]; }
3259
- get _hostElement() { return getElement(this); }
4537
+ get el() { return getElement(this); }
3260
4538
  };
3261
4539
  ArcgisArcadeApi.style = arcadeApiCss;
3262
4540
 
@@ -3489,8 +4767,9 @@ const ArcgisArcadeEditor = class {
3489
4767
  registerInstance(this, hostRef);
3490
4768
  this.scriptChange = createEvent(this, "scriptChange", 3);
3491
4769
  this.diagnosticsChange = createEvent(this, "diagnosticsChange", 3);
3492
- this._componentReadyDefer = new h$1();
3493
- this._modelId = U();
4770
+ this.manager = useControllerManager(this);
4771
+ this._componentReadyDefer = new h$2();
4772
+ this._modelId = Q();
3494
4773
  this._editorProfilePromise = Promise.resolve(undefined);
3495
4774
  this._disposables = [];
3496
4775
  this._executeScript = async () => {
@@ -3539,9 +4818,7 @@ const ArcgisArcadeEditor = class {
3539
4818
  this._insertAsText = (e) => void this._codeEditorElt?.insertText(e.detail).catch(console.error);
3540
4819
  this._onResultPanelChange = (e) => void (this._resultPanel = e.detail);
3541
4820
  this._onExecutionPanelClose = () => void (this._showExecutionPanel = false);
3542
- this._lang = "";
3543
- this._t9nLocale = "";
3544
- this._t9nStrings = undefined;
4821
+ this.messages = useT9n();
3545
4822
  this._standaloneCodeEditor = undefined;
3546
4823
  this._preparingProfile = false;
3547
4824
  this._editorProfile = undefined;
@@ -3621,11 +4898,11 @@ const ArcgisArcadeEditor = class {
3621
4898
  * @internal
3622
4899
  */
3623
4900
  async updateThemeColors(colorRules) {
3624
- const theme = k(this._hostElement);
4901
+ const theme = _(this.el);
3625
4902
  updateThemeColors(theme, colorRules);
3626
4903
  if (colorRules === undefined) {
3627
4904
  colorRulesKeys.forEach((key) => {
3628
- this._hostElement.style.removeProperty(`--arcgis-arcade-editor-${key}`);
4905
+ this.el.style.removeProperty(`--arcgis-arcade-editor-${key}`);
3629
4906
  });
3630
4907
  return;
3631
4908
  }
@@ -3634,7 +4911,7 @@ const ArcgisArcadeEditor = class {
3634
4911
  if (!foreground) {
3635
4912
  return;
3636
4913
  }
3637
- this._hostElement.style.setProperty(`--arcgis-arcade-editor-${key}`, foreground);
4914
+ this.el.style.setProperty(`--arcgis-arcade-editor-${key}`, foreground);
3638
4915
  });
3639
4916
  }
3640
4917
  // #endregion
@@ -3646,10 +4923,9 @@ const ArcgisArcadeEditor = class {
3646
4923
  // However, we need to setup the environment before the code editor is instantiated because
3647
4924
  // we need to access the arcade language service to get the api library.
3648
4925
  setupMonacoEnvironment(assetsPath);
3649
- // Starts a locale observer. It will load the correct t9n strings for the component
3650
- // when the locale changes. We also pass updateEditorProfile. It will be invoked the first
3651
- // and on each locale change. The profile has to be refreshed on locale change as well.
3652
- await B(this, assetsPath, async () => await this._updateEditorProfile());
4926
+ await this._updateEditorProfile();
4927
+ // The profile has to be refreshed on locale change
4928
+ this.manager.watch("messages", () => void this._updateEditorProfile().catch(console.error));
3653
4929
  }
3654
4930
  async componentDidLoad() {
3655
4931
  // Mark on component as ready.
@@ -3677,7 +4953,6 @@ const ArcgisArcadeEditor = class {
3677
4953
  await this._codeEditorElt?.setFocus();
3678
4954
  }
3679
4955
  disconnectedCallback() {
3680
- q(this);
3681
4956
  arcadeDefaults.disposeApiContextForModel(this._modelId);
3682
4957
  arcadeDefaults.disposeEditorProfileForModel(this._modelId);
3683
4958
  while (this._disposables.length) {
@@ -3694,7 +4969,7 @@ const ArcgisArcadeEditor = class {
3694
4969
  try {
3695
4970
  // Set a new profile for the model using the profile definition and the locale.
3696
4971
  await arcadeDefaults.setProfileForModel(this._modelId, this.profile, {
3697
- locale: this._t9nLocale,
4972
+ locale: this.messages._t9nLocale,
3698
4973
  snippets: this.snippets
3699
4974
  });
3700
4975
  // Get the corresponding editor profile for the model.
@@ -3715,38 +4990,38 @@ const ArcgisArcadeEditor = class {
3715
4990
  if (!this.testData) {
3716
4991
  return null;
3717
4992
  }
3718
- return (h("calcite-action-bar", { class: "main-action-bar", layout: "horizontal", scale: "s", expanded: true, "expand-disabled": true }, h("calcite-action-group", { scale: "s" }, h("calcite-action", { text: this._t9nStrings?.run ?? "Run", "text-enabled": true, icon: "play", scale: "s", loading: this._preparingProfile, onClick: this._executeScript }), this._executionResult ? (h("calcite-action", { text: this._t9nStrings?.lastresults ?? "Last results", active: this._showExecutionPanel, "text-enabled": true, icon: "access-string-results", iconFlipRtl: true, scale: "s", onClick: this._toggleShowExecutionPanel })) : null)));
4993
+ return (h$1("calcite-action-bar", { class: "main-action-bar", layout: "horizontal", scale: "s", expanded: true, "expand-disabled": true }, h$1("calcite-action-group", { scale: "s" }, h$1("calcite-action", { text: this.messages.run ?? "Run", "text-enabled": true, icon: "play", scale: "s", loading: this._preparingProfile, onClick: this._executeScript }), this._executionResult ? (h$1("calcite-action", { text: this.messages.lastresults ?? "Last results", active: this._showExecutionPanel, "text-enabled": true, icon: "access-string-results", iconFlipRtl: true, scale: "s", onClick: this._toggleShowExecutionPanel })) : null)));
3719
4994
  }
3720
4995
  //#endregion
3721
4996
  //#region Render Main Panel
3722
4997
  renderMainPanel() {
3723
- return (h("arcgis-code-editor", { class: "flex-adjustable", language: arcadeDefaults.languageId, value: this.script ?? "", modelId: this._modelId, options: this.editorOptions, onValueChange: this._emitScriptChange, ref: (e) => (this._codeEditorElt = e) }));
4998
+ return (h$1("arcgis-code-editor", { class: "flex-adjustable", language: arcadeDefaults.languageId, value: this.script ?? "", modelId: this._modelId, options: this.editorOptions, onValueChange: this._emitScriptChange, ref: (e) => (this._codeEditorElt = e) }));
3724
4999
  }
3725
5000
  //#endregion
3726
5001
  //#region Rendering the Action Bar
3727
5002
  renderAction({ id, label, icon, active, panelName, onClick = this._toggleSidePanel }) {
3728
- return (h(Fragment, null, h("calcite-action", { id: id, text: label, icon: icon, active: active, onClick: onClick, "data-panel-name": panelName }), !this.sideActionBarExpanded && (h("calcite-tooltip", { label: label, "reference-element": id }, h("span", null, label)))));
5003
+ return (h$1(Fragment, null, h$1("calcite-action", { id: id, text: label, icon: icon, active: active, onClick: onClick, "data-panel-name": panelName }), !this.sideActionBarExpanded && (h$1("calcite-tooltip", { label: label, "reference-element": id }, h$1("span", null, label)))));
3729
5004
  }
3730
5005
  renderSideActionBar() {
3731
5006
  if (this.hideSideBar) {
3732
5007
  return null;
3733
5008
  }
3734
- return (h("calcite-action-bar", { class: "side-action-bar border-inline-start", expanded: !!this.sideActionBarExpanded, position: "end", onCalciteActionBarToggle: this._toggleSideActionBarExpanded }, h("calcite-action-group", null, this.renderAction({
5009
+ return (h$1("calcite-action-bar", { class: "side-action-bar border-inline-start", expanded: !!this.sideActionBarExpanded, position: "end", onCalciteActionBarToggle: this._toggleSideActionBarExpanded }, h$1("calcite-action-group", null, this.renderAction({
3735
5010
  id: "profile-variables-action",
3736
- label: this._t9nStrings?.profilevariables ?? "Profile variables",
5011
+ label: this.messages.profilevariables ?? "Profile variables",
3737
5012
  icon: "profile-variables",
3738
5013
  active: this.openedSidePanel === "variables",
3739
5014
  panelName: "variables"
3740
5015
  }), this.renderAction({
3741
5016
  id: "function-action",
3742
- label: this._t9nStrings?.constantsandfunctions ?? "Constants and functions",
5017
+ label: this.messages.constantsandfunctions ?? "Constants and functions",
3743
5018
  icon: "function",
3744
5019
  active: this.openedSidePanel === "api",
3745
5020
  panelName: "api"
3746
5021
  }), this.suggestions?.length
3747
5022
  ? this.renderAction({
3748
5023
  id: "suggestions-action",
3749
- label: this._t9nStrings?.suggestions ?? "Suggestions",
5024
+ label: this.messages.suggestions ?? "Suggestions",
3750
5025
  icon: "lightbulb",
3751
5026
  active: this.openedSidePanel === "suggestions",
3752
5027
  panelName: "suggestions"
@@ -3755,7 +5030,7 @@ const ArcgisArcadeEditor = class {
3755
5030
  ? null
3756
5031
  : this.renderAction({
3757
5032
  id: "developer-website-action",
3758
- label: this._t9nStrings?.help ?? "Help",
5033
+ label: this.messages.help ?? "Help",
3759
5034
  icon: "question",
3760
5035
  active: false,
3761
5036
  panelName: "none",
@@ -3770,11 +5045,11 @@ const ArcgisArcadeEditor = class {
3770
5045
  }
3771
5046
  switch (this.openedSidePanel) {
3772
5047
  case "api":
3773
- return (h("arcgis-arcade-api", { class: "side-panel flex-panel border-inline-start", modelId: this._modelId, hideDocumentationActions: this.hideDocumentationActions, onItemSelected: this._insertAsSnippet, onClose: this._toggleSidePanel, "data-panel-name": "none" }));
5048
+ return (h$1("arcgis-arcade-api", { class: "side-panel flex-panel border-inline-start", modelId: this._modelId, hideDocumentationActions: this.hideDocumentationActions, onItemSelected: this._insertAsSnippet, onClose: this._toggleSidePanel, "data-panel-name": "none" }));
3774
5049
  case "variables":
3775
- return (h("arcgis-arcade-variables", { class: "side-panel flex-panel border-inline-start", loading: this._preparingProfile, modelId: this._modelId, onItemSelected: this._insertAsText, onClose: this._toggleSidePanel, "data-panel-name": "none" }));
5050
+ return (h$1("arcgis-arcade-variables", { class: "side-panel flex-panel border-inline-start", loading: this._preparingProfile, modelId: this._modelId, onItemSelected: this._insertAsText, onClose: this._toggleSidePanel, "data-panel-name": "none" }));
3776
5051
  case "suggestions":
3777
- return (h("arcgis-arcade-suggestions", { class: "side-panel flex-panel border-inline-start", suggestions: this.suggestions, onItemSelected: this._insertAsText, onClose: this._toggleSidePanel, "data-panel-name": "none" }));
5052
+ return (h$1("arcgis-arcade-suggestions", { class: "side-panel flex-panel border-inline-start", suggestions: this.suggestions, onItemSelected: this._insertAsText, onClose: this._toggleSidePanel, "data-panel-name": "none" }));
3778
5053
  default:
3779
5054
  return null;
3780
5055
  }
@@ -3785,15 +5060,15 @@ const ArcgisArcadeEditor = class {
3785
5060
  if (!this._showExecutionPanel) {
3786
5061
  return null;
3787
5062
  }
3788
- return (h("arcgis-arcade-results", { class: "flex-adjustable", openedResultPanel: this._resultPanel, loading: this._executingScript, result: this._executionResult, consoleLogs: this._consoleLogs, onOpenedResultPanelChange: this._onResultPanelChange, onClose: this._onExecutionPanelClose }));
5063
+ return (h$1("arcgis-arcade-results", { class: "flex-adjustable", openedResultPanel: this._resultPanel, loading: this._executingScript, result: this._executionResult, consoleLogs: this._consoleLogs, onOpenedResultPanelChange: this._onResultPanelChange, onClose: this._onExecutionPanelClose }));
3789
5064
  }
3790
5065
  //#endregion
3791
5066
  //#region Render
3792
5067
  render() {
3793
- return (h(Host, null, this.renderMainActionBar(), h("div", { class: "flex-row flex-adjustable" }, h("div", { class: "flex-column flex-adjustable" }, this.renderMainPanel(), this.renderResultsPanel()), this.renderSidePanel(), this.renderSideActionBar())));
5068
+ return (h$1(Host, null, this.renderMainActionBar(), h$1("div", { class: "flex-row flex-adjustable" }, h$1("div", { class: "flex-column flex-adjustable" }, this.renderMainPanel(), this.renderResultsPanel()), this.renderSidePanel(), this.renderSideActionBar())));
3794
5069
  }
3795
5070
  static get assetsDirs() { return ["assets"]; }
3796
- get _hostElement() { return getElement(this); }
5071
+ get el() { return getElement(this); }
3797
5072
  static get watchers() { return {
3798
5073
  "profile": ["_profileChanged"],
3799
5074
  "testData": ["_testDataChanged"],
@@ -3820,44 +5095,44 @@ const expandableTreeItemProps = {
3820
5095
  //#endregion
3821
5096
  //#region Helper Functions
3822
5097
  function renderDictionaryProperty(key) {
3823
- return (h(Fragment, null, h("span", { class: "dictionary-property" }, key), h("span", null, ":\u00A0")));
5098
+ return (h$1(Fragment, null, h$1("span", { class: "dictionary-property" }, key), h$1("span", null, ":\u00A0")));
3824
5099
  }
3825
5100
  function renderDictionaryAsJsonTree(value, subtree = false) {
3826
- return (h("calcite-tree", { slot: subtree ? "children" : undefined, ...treeProps }, h("calcite-tree-item", { class: "string-value" }, JSON.stringify(value.castAsJson(), undefined, 2))));
5101
+ return (h$1("calcite-tree", { slot: subtree ? "children" : undefined, ...treeProps }, h$1("calcite-tree-item", { class: "string-value" }, JSON.stringify(value.castAsJson(), undefined, 2))));
3827
5102
  }
3828
5103
  function renderGeometryTree(value, subtree = false) {
3829
- return (h("calcite-tree", { slot: subtree ? "children" : undefined, ...treeProps }, h("calcite-tree-item", null, h("div", { class: "tree-item-label" }, renderDictionaryProperty("type"), value.type)), h("calcite-tree-item", null, h("div", { class: "tree-item-label" }, renderDictionaryProperty("value"), h("span", { class: "string-value" }, JSON.stringify(value, undefined, 2))))));
5104
+ return (h$1("calcite-tree", { slot: subtree ? "children" : undefined, ...treeProps }, h$1("calcite-tree-item", null, h$1("div", { class: "tree-item-label" }, renderDictionaryProperty("type"), value.type)), h$1("calcite-tree-item", null, h$1("div", { class: "tree-item-label" }, renderDictionaryProperty("value"), h$1("span", { class: "string-value" }, JSON.stringify(value, undefined, 2))))));
3830
5105
  }
3831
5106
  function renderSimpleValue(arcadeResult) {
3832
5107
  switch (arcadeResult.type) {
3833
5108
  case "unknown":
3834
5109
  case "null":
3835
- return h("span", { class: "constant-value" }, arcadeResult.type);
5110
+ return h$1("span", { class: "constant-value" }, arcadeResult.type);
3836
5111
  case "text":
3837
- return h("span", { class: "string-value" }, D(arcadeResult.value));
5112
+ return h$1("span", { class: "string-value" }, te(arcadeResult.value));
3838
5113
  case "number":
3839
- return h("span", { class: "number-value" }, arcadeResult.value.toString());
5114
+ return h$1("span", { class: "number-value" }, arcadeResult.value.toString());
3840
5115
  case "boolean":
3841
- return h("span", { class: "constant-value" }, arcadeResult.value.toString());
5116
+ return h$1("span", { class: "constant-value" }, arcadeResult.value.toString());
3842
5117
  case "date":
3843
- return h("span", { class: "date-value" }, formatArcadeResultDate(arcadeResult));
5118
+ return h$1("span", { class: "date-value" }, formatArcadeResultDate(arcadeResult));
3844
5119
  case "dateOnly":
3845
- return h("span", { class: "string-value" }, D(formatArcadeResultDateOnly(arcadeResult)));
5120
+ return h$1("span", { class: "string-value" }, te(formatArcadeResultDateOnly(arcadeResult)));
3846
5121
  case "time":
3847
- return h("span", { class: "string-value" }, D(formatArcadeResultTimeOnly(arcadeResult)));
5122
+ return h$1("span", { class: "string-value" }, te(formatArcadeResultTimeOnly(arcadeResult)));
3848
5123
  default:
3849
5124
  return null;
3850
5125
  }
3851
5126
  }
3852
5127
  function renderFeatureSetTable(arcadeResult) {
3853
5128
  const fields = supportedFields(arcadeResult.value.fields);
3854
- return (h("table", null, h("thead", null, h("tr", null, fields.map((field) => (h("th", null, field.name))))), h("tbody", null, arcadeResult.features.map((feature) => (h("tr", null, fields.map((field) => {
5129
+ return (h$1("table", null, h$1("thead", null, h$1("tr", null, fields.map((field) => (h$1("th", null, field.name))))), h$1("tbody", null, arcadeResult.features.map((feature) => (h$1("tr", null, fields.map((field) => {
3855
5130
  try {
3856
5131
  const arcadeResult = valueToArcadeResult(feature.field(field.name));
3857
- return h("td", null, renderSimpleValue(arcadeResult));
5132
+ return h$1("td", null, renderSimpleValue(arcadeResult));
3858
5133
  }
3859
5134
  catch {
3860
- return h("td", null);
5135
+ return h$1("td", null);
3861
5136
  }
3862
5137
  })))))));
3863
5138
  }
@@ -3866,6 +5141,9 @@ const ArcgisArcadeResults = class {
3866
5141
  registerInstance(this, hostRef);
3867
5142
  this.openedResultPanelChange = createEvent(this, "openedResultPanelChange", 3);
3868
5143
  this.close = createEvent(this, "close", 3);
5144
+ this.manager = useControllerManager(this);
5145
+ //#region Private Properties
5146
+ this.messages = useT9n();
3869
5147
  this._switchResultPanel = (e) => {
3870
5148
  if (!e.target) {
3871
5149
  return;
@@ -3877,23 +5155,12 @@ const ArcgisArcadeResults = class {
3877
5155
  this.updateResultPanel(panelName);
3878
5156
  };
3879
5157
  this._emitClose = () => this.close.emit();
3880
- this._lang = "";
3881
- this._t9nLocale = "";
3882
- this._t9nStrings = undefined;
3883
5158
  this.loading = true;
3884
5159
  this.openedResultPanel = "output";
3885
5160
  this.result = undefined;
3886
5161
  this.consoleLogs = undefined;
3887
5162
  }
3888
5163
  //#endregion
3889
- // #region Component lifecycle events
3890
- async componentWillLoad() {
3891
- await B(this, getAssetPath("./assets"));
3892
- }
3893
- disconnectedCallback() {
3894
- q(this);
3895
- }
3896
- // #endregion
3897
5164
  //#region Private Methods
3898
5165
  updateResultPanel(resultPanelType) {
3899
5166
  this.openedResultPanel = resultPanelType;
@@ -3906,96 +5173,96 @@ const ArcgisArcadeResults = class {
3906
5173
  return null;
3907
5174
  }
3908
5175
  if (this.loading && !this.consoleLogs?.length) {
3909
- return h("calcite-loader", { scale: "s", type: "indeterminate", label: "" });
5176
+ return h$1("calcite-loader", { scale: "s", type: "indeterminate", label: "" });
3910
5177
  }
3911
- return (h("div", { class: "console-logs-container ltr-container" }, this.consoleLogs?.length ? (this.consoleLogs.map((log) => h("p", null, log))) : (h("p", null, this._t9nStrings?.consolemessage))));
5178
+ return (h$1("div", { class: "console-logs-container ltr-container" }, this.consoleLogs?.length ? this.consoleLogs.map((log) => h$1("p", null, log)) : h$1("p", null, this.messages.consolemessage)));
3912
5179
  }
3913
5180
  renderLogPanel() {
3914
5181
  if (this.openedResultPanel !== "log") {
3915
5182
  return null;
3916
5183
  }
3917
5184
  if (this.loading) {
3918
- return h("calcite-loader", { scale: "s", type: "indeterminate", label: "" });
5185
+ return h$1("calcite-loader", { scale: "s", type: "indeterminate", label: "" });
3919
5186
  }
3920
5187
  const iconClass = this.result?.type === "error" ? "color-error" : "color-success";
3921
- return (h("calcite-list", null, this.result ? (h(Fragment, null, h("calcite-list-item", { label: Z(this._t9nStrings?.lastexecutionformat, {
3922
- timeStamp: new Intl.DateTimeFormat(this._t9nLocale, {
5188
+ return (h$1("calcite-list", null, this.result ? (h$1(Fragment, null, h$1("calcite-list-item", { label: re(this.messages.lastexecutionformat, {
5189
+ timeStamp: new Intl.DateTimeFormat(this.messages._t9nLocale, {
3923
5190
  dateStyle: "medium",
3924
5191
  timeStyle: "medium"
3925
5192
  }).format(this.result.timeStamp)
3926
- }) }, h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })), h("calcite-list-item", { label: Z(this._t9nStrings?.compilationtimeformat, {
3927
- time: new Intl.NumberFormat(this._t9nLocale, {
5193
+ }) }, h$1("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })), h$1("calcite-list-item", { label: re(this.messages.compilationtimeformat, {
5194
+ time: new Intl.NumberFormat(this.messages._t9nLocale, {
3928
5195
  style: "unit",
3929
5196
  unit: "millisecond",
3930
5197
  maximumFractionDigits: 2
3931
5198
  }).format(this.result.compilationTime ?? 0)
3932
- }) }, h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })), h("calcite-list-item", { label: Z(this._t9nStrings?.executiontimeformat, {
3933
- time: new Intl.NumberFormat(this._t9nLocale, {
5199
+ }) }, h$1("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })), h$1("calcite-list-item", { label: re(this.messages.executiontimeformat, {
5200
+ time: new Intl.NumberFormat(this.messages._t9nLocale, {
3934
5201
  style: "unit",
3935
5202
  unit: "millisecond",
3936
5203
  maximumFractionDigits: 2
3937
5204
  }).format(this.result.executionTime ?? 0)
3938
- }) }, h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })))) : (h("calcite-list-item", { label: this._t9nStrings?.runscriptmessage ?? "No output, run the script once." }, h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: "color-info" })))));
5205
+ }) }, h$1("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })))) : (h$1("calcite-list-item", { label: this.messages.runscriptmessage ?? "No output, run the script once." }, h$1("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: "color-info" })))));
3939
5206
  }
3940
5207
  renderOutputPanel() {
3941
5208
  if (this.openedResultPanel !== "output") {
3942
5209
  return null;
3943
5210
  }
3944
5211
  if (this.loading) {
3945
- return h("calcite-loader", { scale: "s", type: "indeterminate", label: "" });
5212
+ return h$1("calcite-loader", { scale: "s", type: "indeterminate", label: "" });
3946
5213
  }
3947
5214
  switch (this.result?.type) {
3948
5215
  case "error":
3949
- return (h("div", { class: "result-value-simple flex-adjustable" }, Z(this._t9nStrings?.executionerrorformat, {
5216
+ return (h$1("div", { class: "result-value-simple flex-adjustable" }, re(this.messages.executionerrorformat, {
3950
5217
  message: this.result.value
3951
5218
  })));
3952
5219
  case "null":
3953
5220
  case "unknown":
3954
- return h("div", { class: "result-value-simple ltr-container" }, renderSimpleValue(this.result));
5221
+ return h$1("div", { class: "result-value-simple ltr-container" }, renderSimpleValue(this.result));
3955
5222
  case "text":
3956
5223
  case "number":
3957
5224
  case "date":
3958
5225
  case "dateOnly":
3959
5226
  case "time":
3960
5227
  case "boolean":
3961
- return (h("div", { class: "result-value-simple ltr-container" }, h("span", { class: "value-type" }, this.result.type, ":\u00A0"), renderSimpleValue(this.result)));
5228
+ return (h$1("div", { class: "result-value-simple ltr-container" }, h$1("span", { class: "value-type" }, this.result.type, ":\u00A0"), renderSimpleValue(this.result)));
3962
5229
  case "array": {
3963
5230
  const items = this.result.value ?? [];
3964
5231
  const firstItems = items.slice(0, MaxArrayItems);
3965
- return (h("div", { class: "result-value-simple ltr-container" }, h("calcite-tree", { ...treeProps }, h("calcite-tree-item", { expanded: true, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, this.renderArrayHeader(this.result)), this.renderArrayTree(firstItems, true)))));
5232
+ return (h$1("div", { class: "result-value-simple ltr-container" }, h$1("calcite-tree", { ...treeProps }, h$1("calcite-tree-item", { expanded: true, ...expandableTreeItemProps }, h$1("div", { class: "tree-item-label" }, this.renderArrayHeader(this.result)), this.renderArrayTree(firstItems, true)))));
3966
5233
  }
3967
5234
  case "geometry":
3968
- return (h("div", { class: "result-value-simple ltr-container" }, h("calcite-tree", { ...treeProps }, h("calcite-tree-item", { expanded: true, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, this.result.type), renderGeometryTree(this.result.value, true)))));
5235
+ return (h$1("div", { class: "result-value-simple ltr-container" }, h$1("calcite-tree", { ...treeProps }, h$1("calcite-tree-item", { expanded: true, ...expandableTreeItemProps }, h$1("div", { class: "tree-item-label" }, this.result.type), renderGeometryTree(this.result.value, true)))));
3969
5236
  case "attachment":
3970
- return (h("div", { class: "result-value-simple ltr-container" }, h("calcite-tree", { ...treeProps }, h("calcite-tree-item", { expanded: true, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, this.result.type), renderDictionaryAsJsonTree(this.result.value, true)))));
5237
+ return (h$1("div", { class: "result-value-simple ltr-container" }, h$1("calcite-tree", { ...treeProps }, h$1("calcite-tree-item", { expanded: true, ...expandableTreeItemProps }, h$1("div", { class: "tree-item-label" }, this.result.type), renderDictionaryAsJsonTree(this.result.value, true)))));
3971
5238
  case "feature":
3972
5239
  case "dictionary":
3973
5240
  case "portal":
3974
- return (h("div", { class: "result-value-simple ltr-container" }, h("calcite-tree", { ...treeProps }, h("calcite-tree-item", { expanded: true, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, this.result.type), this.renderDictionaryTree(this.result.value, true)))));
5241
+ return (h$1("div", { class: "result-value-simple ltr-container" }, h$1("calcite-tree", { ...treeProps }, h$1("calcite-tree-item", { expanded: true, ...expandableTreeItemProps }, h$1("div", { class: "tree-item-label" }, this.result.type), this.renderDictionaryTree(this.result.value, true)))));
3975
5242
  case "featureSet":
3976
- return (h("div", { class: "result-value-table ltr-container" }, this.renderFeatureSetLabel(this.result), renderFeatureSetTable(this.result)));
5243
+ return (h$1("div", { class: "result-value-table ltr-container" }, this.renderFeatureSetLabel(this.result), renderFeatureSetTable(this.result)));
3977
5244
  case "knowledgeGraph":
3978
- return (h("div", { class: "result-value-simple ltr-container" }, h("span", { class: "value-type" }, this.result.type, ":\u00A0"), h("span", { class: "string-value" }, this.result.value.url)));
5245
+ return (h$1("div", { class: "result-value-simple ltr-container" }, h$1("span", { class: "value-type" }, this.result.type, ":\u00A0"), h$1("span", { class: "string-value" }, this.result.value.url)));
3979
5246
  default:
3980
- return (h("div", { class: "result-value-simple flex-adjustable ltr-container" }, this._t9nStrings?.runscriptmessage));
5247
+ return h$1("div", { class: "result-value-simple flex-adjustable ltr-container" }, this.messages.runscriptmessage);
3981
5248
  }
3982
5249
  }
3983
5250
  renderArrayHeader(arcadeResult) {
3984
5251
  const items = arcadeResult.value ?? [];
3985
5252
  const leftoverCount = Math.max(items.length - MaxArrayItems, 0);
3986
- return (h(Fragment, null, h("span", null, `${arcadeResult.type}(${items.length ?? 0})`), leftoverCount > 0 ? (h("span", null, "\u00A0", Z(this._t9nStrings?.showingfirstitemsformat, {
5253
+ return (h$1(Fragment, null, h$1("span", null, `${arcadeResult.type}(${items.length ?? 0})`), leftoverCount > 0 ? (h$1("span", null, "\u00A0", re(this.messages.showingfirstitemsformat, {
3987
5254
  count: MaxArrayItems.toString()
3988
5255
  }))) : null));
3989
5256
  }
3990
5257
  renderArrayTree(items, subtree = false) {
3991
- return (h("calcite-tree", { slot: subtree ? "children" : undefined, ...treeProps }, items.map((value, key) => {
5258
+ return (h$1("calcite-tree", { slot: subtree ? "children" : undefined, ...treeProps }, items.map((value, key) => {
3992
5259
  const arcadeValue = valueToArcadeResult(value);
3993
5260
  return this.renderTreeItem(arcadeValue, key, !subtree);
3994
5261
  })));
3995
5262
  }
3996
5263
  renderDictionaryTree(value, subtree = false) {
3997
5264
  const geometry = value.geometry?.();
3998
- return (h("calcite-tree", { slot: subtree ? "children" : undefined, ...treeProps }, value.keys().map((key) => {
5265
+ return (h$1("calcite-tree", { slot: subtree ? "children" : undefined, ...treeProps }, value.keys().map((key) => {
3999
5266
  const arcadeValue = valueToArcadeResult(value.field(key));
4000
5267
  return this.renderTreeItem(arcadeValue, key);
4001
5268
  }), geometry ? this.renderTreeItem({ type: "geometry", value: geometry }, "geometry") : null));
@@ -4010,34 +5277,34 @@ const ArcgisArcadeResults = class {
4010
5277
  case "dateOnly":
4011
5278
  case "time":
4012
5279
  case "boolean":
4013
- return (h("calcite-tree-item", null, h("div", { class: "tree-item-label" }, renderDictionaryProperty(key), renderSimpleValue(arcadeResult))));
5280
+ return (h$1("calcite-tree-item", null, h$1("div", { class: "tree-item-label" }, renderDictionaryProperty(key), renderSimpleValue(arcadeResult))));
4014
5281
  case "array": {
4015
5282
  const items = arcadeResult.value ?? [];
4016
5283
  const firstItems = items.slice(0, MaxArrayItems);
4017
- return (h("calcite-tree-item", { expanded: expanded, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, renderDictionaryProperty(key), this.renderArrayHeader(arcadeResult)), this.renderArrayTree(firstItems, true)));
5284
+ return (h$1("calcite-tree-item", { expanded: expanded, ...expandableTreeItemProps }, h$1("div", { class: "tree-item-label" }, renderDictionaryProperty(key), this.renderArrayHeader(arcadeResult)), this.renderArrayTree(firstItems, true)));
4018
5285
  }
4019
5286
  case "geometry":
4020
- return (h("calcite-tree-item", { expanded: expanded, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, renderDictionaryProperty(key), h("span", null, arcadeResult.type)), renderGeometryTree(arcadeResult.value, true)));
5287
+ return (h$1("calcite-tree-item", { expanded: expanded, ...expandableTreeItemProps }, h$1("div", { class: "tree-item-label" }, renderDictionaryProperty(key), h$1("span", null, arcadeResult.type)), renderGeometryTree(arcadeResult.value, true)));
4021
5288
  case "attachment":
4022
- return (h("calcite-tree-item", { expanded: expanded, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, renderDictionaryProperty(key), h("span", null, arcadeResult.type)), renderDictionaryAsJsonTree(arcadeResult.value, true)));
5289
+ return (h$1("calcite-tree-item", { expanded: expanded, ...expandableTreeItemProps }, h$1("div", { class: "tree-item-label" }, renderDictionaryProperty(key), h$1("span", null, arcadeResult.type)), renderDictionaryAsJsonTree(arcadeResult.value, true)));
4023
5290
  case "feature":
4024
5291
  case "dictionary":
4025
5292
  case "portal":
4026
- return (h("calcite-tree-item", { expanded: expanded, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, renderDictionaryProperty(key), h("span", null, arcadeResult.type)), this.renderDictionaryTree(arcadeResult.value, true)));
5293
+ return (h$1("calcite-tree-item", { expanded: expanded, ...expandableTreeItemProps }, h$1("div", { class: "tree-item-label" }, renderDictionaryProperty(key), h$1("span", null, arcadeResult.type)), this.renderDictionaryTree(arcadeResult.value, true)));
4027
5294
  default:
4028
5295
  return null;
4029
5296
  }
4030
5297
  }
4031
5298
  renderFeatureSetLabel(arcadeResult) {
4032
- return (h("div", { class: "value-type" }, h("span", null, arcadeResult.type, ":"), arcadeResult.features.length >= BatchSize ? (h("span", null, "\u00A0", Z(this._t9nStrings?.showingfirstitemsformat, {
5299
+ return (h$1("div", { class: "value-type" }, h$1("span", null, arcadeResult.type, ":"), arcadeResult.features.length >= BatchSize ? (h$1("span", null, "\u00A0", re(this.messages.showingfirstitemsformat, {
4033
5300
  count: BatchSize.toString()
4034
5301
  }))) : null));
4035
5302
  }
4036
5303
  render() {
4037
- return (h(Host, null, h("header", { class: "flex-row" }, h("calcite-action-bar", { class: "flex-adjustable", layout: "horizontal", scale: "s", expanded: true, "expand-disabled": true }, h("calcite-action-group", { scale: "s" }, h("calcite-action", { active: this.openedResultPanel === "output", text: this._t9nStrings?.output ?? "Output", "text-enabled": true, scale: "s", icon: "list-show-all", iconFlipRtl: true, onClick: this._switchResultPanel, "data-panel-name": "output" }), h("calcite-action", { active: this.openedResultPanel === "console", text: this._t9nStrings?.console ?? "Console", "text-enabled": true, scale: "s", icon: "console", iconFlipRtl: true, onClick: this._switchResultPanel, "data-panel-name": "console" }), h("calcite-action", { active: this.openedResultPanel === "log", text: this._t9nStrings?.log ?? "Log", "text-enabled": true, scale: "s", icon: "list", iconFlipRtl: true, onClick: this._switchResultPanel, "data-panel-name": "log" }))), h("calcite-action", { scale: "s", icon: "x", text: this._t9nStrings?.close ?? "", onClick: this._emitClose })), h("article", { class: "flex-adjustable" }, this.loading ? (h("calcite-loader", { scale: "s", type: "indeterminate", label: "" })) : (h("div", { class: "flex-column y-scrollable-container" }, this.renderOutputPanel(), this.renderConsolePanel(), this.renderLogPanel())))));
5304
+ return (h$1(Host, null, h$1("header", { class: "flex-row" }, h$1("calcite-action-bar", { class: "flex-adjustable", layout: "horizontal", scale: "s", expanded: true, "expand-disabled": true }, h$1("calcite-action-group", { scale: "s" }, h$1("calcite-action", { active: this.openedResultPanel === "output", text: this.messages.output ?? "Output", "text-enabled": true, scale: "s", icon: "list-show-all", iconFlipRtl: true, onClick: this._switchResultPanel, "data-panel-name": "output" }), h$1("calcite-action", { active: this.openedResultPanel === "console", text: this.messages.console ?? "Console", "text-enabled": true, scale: "s", icon: "console", iconFlipRtl: true, onClick: this._switchResultPanel, "data-panel-name": "console" }), h$1("calcite-action", { active: this.openedResultPanel === "log", text: this.messages.log ?? "Log", "text-enabled": true, scale: "s", icon: "list", iconFlipRtl: true, onClick: this._switchResultPanel, "data-panel-name": "log" }))), h$1("calcite-action", { scale: "s", icon: "x", text: this.messages.close ?? "", onClick: this._emitClose })), h$1("article", { class: "flex-adjustable" }, this.loading ? (h$1("calcite-loader", { scale: "s", type: "indeterminate", label: "" })) : (h$1("div", { class: "flex-column y-scrollable-container" }, this.renderOutputPanel(), this.renderConsolePanel(), this.renderLogPanel())))));
4038
5305
  }
4039
5306
  static get assetsDirs() { return ["assets"]; }
4040
- get _hostElement() { return getElement(this); }
5307
+ get el() { return getElement(this); }
4041
5308
  };
4042
5309
  ArcgisArcadeResults.style = arcadeResultsCss;
4043
5310
 
@@ -4058,6 +5325,8 @@ const ArcgisArcadeSuggestions = class {
4058
5325
  registerInstance(this, hostRef);
4059
5326
  this.close = createEvent(this, "close", 3);
4060
5327
  this.itemSelected = createEvent(this, "itemSelected", 3);
5328
+ this.manager = useControllerManager(this);
5329
+ this.messages = useT9n();
4061
5330
  this._updateFilterValue = (e) => {
4062
5331
  this._filterValue = e.target?.value ?? "";
4063
5332
  };
@@ -4086,9 +5355,6 @@ const ArcgisArcadeSuggestions = class {
4086
5355
  this._beforeBack = async () => {
4087
5356
  this._selectedSuggestion = undefined;
4088
5357
  };
4089
- this._lang = "";
4090
- this._t9nLocale = "";
4091
- this._t9nStrings = undefined;
4092
5358
  this._selectedSuggestion = undefined;
4093
5359
  this._filterValue = "";
4094
5360
  this._colorizeStyle = "";
@@ -4102,12 +5368,10 @@ const ArcgisArcadeSuggestions = class {
4102
5368
  async componentWillLoad() {
4103
5369
  this._colorizeStyle = generateColorizeStyles();
4104
5370
  this._themeChangedListner = onColorizeThemeChanged(() => (this._colorizeStyle = generateColorizeStyles()));
4105
- await B(this, getAssetPath("./assets"));
4106
5371
  }
4107
5372
  disconnectedCallback() {
4108
5373
  this._flowObserver?.disconnect();
4109
5374
  this._themeChangedListner?.dispose();
4110
- q(this);
4111
5375
  }
4112
5376
  // #endregion
4113
5377
  //#region Private Methods
@@ -4136,29 +5400,29 @@ const ArcgisArcadeSuggestions = class {
4136
5400
  return null;
4137
5401
  }
4138
5402
  if (isSuggestionGroups(this.suggestions)) {
4139
- return this.suggestions.map((suggestionGroup) => (h("calcite-list-item-group", { heading: suggestionGroup.label }, this.renderSuggestionListItems(suggestionGroup.suggestions))));
5403
+ return this.suggestions.map((suggestionGroup) => (h$1("calcite-list-item-group", { heading: suggestionGroup.label }, this.renderSuggestionListItems(suggestionGroup.suggestions))));
4140
5404
  }
4141
5405
  return this.renderSuggestionListItems(this.suggestions);
4142
5406
  }
4143
5407
  renderSuggestionListItems(suggestions) {
4144
5408
  suggestions = filterCollection(suggestions, "label", this._filterValue);
4145
5409
  if (!suggestions.length) {
4146
- return h("div", { class: "notice-container" }, this._t9nStrings?.noitems ?? "No item");
5410
+ return h$1("div", { class: "notice-container" }, this.messages.noitems ?? "No item");
4147
5411
  }
4148
- return suggestions.map((suggestion) => (h("calcite-list-item", { label: suggestion.label, description: suggestion.description, onCalciteListItemSelect: this._emitItemSelected, onKeyPress: this._emitItemSelected, "data-item": suggestion }, h("calcite-action", { slot: "actions-end", text: this._t9nStrings?.expand ?? "", scale: "s", icon: "chevron-right", iconFlipRtl: true, onClick: this._showSuggestionDetail, "data-item": suggestion }))));
5412
+ return suggestions.map((suggestion) => (h$1("calcite-list-item", { label: suggestion.label, description: suggestion.description, onCalciteListItemSelect: this._emitItemSelected, onKeyPress: this._emitItemSelected, "data-item": suggestion }, h$1("calcite-action", { slot: "actions-end", text: this.messages.expand ?? "", scale: "s", icon: "chevron-right", iconFlipRtl: true, onClick: this._showSuggestionDetail, "data-item": suggestion }))));
4149
5413
  }
4150
5414
  renderSuggestionFlowItem() {
4151
5415
  const suggestion = this._selectedSuggestion;
4152
5416
  if (!suggestion) {
4153
5417
  return null;
4154
5418
  }
4155
- return (h("calcite-flow-item", { heading: this._t9nStrings?.suggestions, closable: true, onCalciteFlowItemClose: this._emitClose, beforeBack: this._beforeBack }, h("calcite-button", { width: "half", slot: "footer", appearance: "outline", kind: "brand", "icon-start": "code", scale: "s", onClick: this._emitItemSelected, ref: (e) => void e?.setFocus(), "data-item": suggestion }, this._t9nStrings?.insert), h("calcite-block", { open: true, heading: suggestion.label, description: suggestion.description }, h("div", { innerHTML: convertMarkdownString(suggestion.documentation) }), h("pre", null, h("code", { ref: (e) => e === undefined ? undefined : void colorizeCodeElement(e, suggestion.code).catch(console.error) })))));
5419
+ return (h$1("calcite-flow-item", { heading: this.messages.suggestions, closable: true, onCalciteFlowItemClose: this._emitClose, beforeBack: this._beforeBack }, h$1("calcite-button", { width: "half", slot: "footer", appearance: "outline", kind: "brand", "icon-start": "code", scale: "s", onClick: this._emitItemSelected, ref: (e) => void e?.setFocus(), "data-item": suggestion }, this.messages.insert), h$1("calcite-block", { open: true, heading: suggestion.label, description: suggestion.description }, h$1("div", { innerHTML: convertMarkdownString(suggestion.documentation) }), h$1("pre", null, h$1("code", { ref: (e) => e === undefined ? undefined : void colorizeCodeElement(e, suggestion.code).catch(console.error) })))));
4156
5420
  }
4157
5421
  render() {
4158
- return (h(Host, null, h("style", null, this._colorizeStyle), h("calcite-flow", { ref: (ref) => this.flowFocusHandler(ref) }, h("calcite-flow-item", { heading: this._t9nStrings?.suggestions, closable: true, onCalciteFlowItemClose: this._emitClose }, h("calcite-input", { value: this._filterValue, icon: "magnifying-glass", clearable: true, onCalciteInputInput: this._updateFilterValue, class: "sticky", scale: "m" }), h("calcite-list", null, this.renderSuggestionGroups())), this.renderSuggestionFlowItem())));
5422
+ return (h$1(Host, null, h$1("style", null, this._colorizeStyle), h$1("calcite-flow", { ref: (ref) => this.flowFocusHandler(ref) }, h$1("calcite-flow-item", { heading: this.messages.suggestions, closable: true, onCalciteFlowItemClose: this._emitClose }, h$1("calcite-input", { value: this._filterValue, icon: "magnifying-glass", clearable: true, onCalciteInputInput: this._updateFilterValue, class: "sticky", scale: "m" }), h$1("calcite-list", null, this.renderSuggestionGroups())), this.renderSuggestionFlowItem())));
4159
5423
  }
4160
5424
  static get assetsDirs() { return ["assets"]; }
4161
- get _hostElement() { return getElement(this); }
5425
+ get el() { return getElement(this); }
4162
5426
  static get watchers() { return {
4163
5427
  "suggestions": ["suggestionsPropChanged"]
4164
5428
  }; }
@@ -4177,6 +5441,8 @@ const ArcgisArcadeVariables = class {
4177
5441
  registerInstance(this, hostRef);
4178
5442
  this.close = createEvent(this, "close", 3);
4179
5443
  this.itemSelected = createEvent(this, "itemSelected", 3);
5444
+ this.manager = useControllerManager(this);
5445
+ this.messages = useT9n();
4180
5446
  this._updateFilterValue = (e) => {
4181
5447
  this._filterValue = e.target.value;
4182
5448
  };
@@ -4209,9 +5475,6 @@ const ArcgisArcadeVariables = class {
4209
5475
  e.stopPropagation();
4210
5476
  this.addPanelRenderer(this.collectionBasedVariableRenderer(collectionVariable));
4211
5477
  };
4212
- this._lang = "";
4213
- this._t9nLocale = "";
4214
- this._t9nStrings = undefined;
4215
5478
  this._mutationCounter = 1;
4216
5479
  this._flowItemRenderers = [];
4217
5480
  this._filterValue = "";
@@ -4222,12 +5485,7 @@ const ArcgisArcadeVariables = class {
4222
5485
  this._flowItemRenderers = [];
4223
5486
  }
4224
5487
  //#endregion
4225
- // #region Component lifecycle events
4226
- async componentWillLoad() {
4227
- await B(this, getAssetPath("./assets"));
4228
- }
4229
5488
  disconnectedCallback() {
4230
- q(this);
4231
5489
  this._flowObserver?.disconnect();
4232
5490
  }
4233
5491
  // #endregion
@@ -4281,15 +5539,15 @@ const ArcgisArcadeVariables = class {
4281
5539
  });
4282
5540
  loading = true;
4283
5541
  }
4284
- return (h("calcite-flow-item", { heading: this._t9nStrings?.profilevariables, description: collection.breadcrumb, beforeBack: this._beforeBack, closable: true, onCalciteFlowItemClose: this._emitClose }, h("calcite-action", { slot: "header-actions-end", text: this._t9nStrings?.backtotop ?? "Back to top", scale: "m", hidden: topPanel, icon: "chevrons-left", iconFlipRtl: true, onClick: this._backToTop }), h("calcite-input", { value: this._filterValue, icon: "magnifying-glass", clearable: true, onCalciteInputInput: this._updateFilterValue, class: "sticky", scale: "m" }), loading ? (h("calcite-loader", { scale: "s", type: "indeterminate", label: this._t9nStrings?.loading ?? "Loading" })) : (h("calcite-list", null, this.renderEditorVariables(collection)))));
5542
+ return (h$1("calcite-flow-item", { heading: this.messages.profilevariables, description: collection.breadcrumb, beforeBack: this._beforeBack, closable: true, onCalciteFlowItemClose: this._emitClose }, h$1("calcite-action", { slot: "header-actions-end", text: this.messages.backtotop ?? "Back to top", scale: "m", hidden: topPanel, icon: "chevrons-left", iconFlipRtl: true, onClick: this._backToTop }), h$1("calcite-input", { value: this._filterValue, icon: "magnifying-glass", clearable: true, onCalciteInputInput: this._updateFilterValue, class: "sticky", scale: "m" }), loading ? (h$1("calcite-loader", { scale: "s", type: "indeterminate", label: this.messages.loading ?? "Loading" })) : (h$1("calcite-list", null, this.renderEditorVariables(collection)))));
4285
5543
  };
4286
5544
  }
4287
5545
  renderEditorVariables(collection) {
4288
5546
  // Filter the variables. Skip group, we will filter the children later on.
4289
- const filterExpression = K(this._filterValue);
5547
+ const filterExpression = ne(this._filterValue);
4290
5548
  const filteredVariables = collection.variables.filter((variable) => variable.passFilter(filterExpression));
4291
5549
  if (!filteredVariables.length) {
4292
- return h("div", { class: "notice-container" }, this._t9nStrings?.noitems ?? "No item");
5550
+ return h$1("div", { class: "notice-container" }, this.messages.noitems ?? "No item");
4293
5551
  }
4294
5552
  return filteredVariables.map((variable) => this.renderEditorVariable(variable));
4295
5553
  }
@@ -4297,20 +5555,20 @@ const ArcgisArcadeVariables = class {
4297
5555
  switch (variable.type) {
4298
5556
  case "group":
4299
5557
  // Group is a collection but we represent it differently
4300
- return (h("calcite-list-item-group", { heading: variable.getLabel() }, this.renderEditorVariables(variable)));
5558
+ return (h$1("calcite-list-item-group", { heading: variable.getLabel() }, this.renderEditorVariables(variable)));
4301
5559
  default:
4302
- return (h("calcite-list-item", { label: variable.getLabel(), description: variable.getDescription(), onCalciteListItemSelect: this._emitItemSelected, onKeyPress: this._emitItemSelected, "data-item": variable }, variable.isCollection ? (h("calcite-action", { slot: "actions-end", text: this._t9nStrings?.expand ?? "", scale: "s", icon: "chevron-right", iconFlipRtl: true, onClick: this._showCollectionPanel, onKeyPress: stopEnterPropagation, "data-item": variable })) : null, variable.icon ? h("calcite-icon", { icon: variable.icon, scale: "s", slot: "content-start" }) : null));
5560
+ return (h$1("calcite-list-item", { label: variable.getLabel(), description: variable.getDescription(), onCalciteListItemSelect: this._emitItemSelected, onKeyPress: this._emitItemSelected, "data-item": variable }, variable.isCollection ? (h$1("calcite-action", { slot: "actions-end", text: this.messages.expand ?? "", scale: "s", icon: "chevron-right", iconFlipRtl: true, onClick: this._showCollectionPanel, onKeyPress: stopEnterPropagation, "data-item": variable })) : null, variable.icon ? h$1("calcite-icon", { icon: variable.icon, scale: "s", slot: "content-start" }) : null));
4303
5561
  }
4304
5562
  }
4305
5563
  render() {
4306
5564
  const profile = arcadeDefaults.getEditorProfileForModel(this.modelId ?? "");
4307
5565
  if (!this.loading && !profile?.variables.length) {
4308
- return (h("calcite-flow", null, h("calcite-flow-item", { heading: this._t9nStrings?.profilevariables, closable: true, onCalciteFlowItemClose: this._emitClose }, h("div", { class: "notice-container" }, this._t9nStrings?.noprofilevariablesmessage ?? ""))));
5566
+ return (h$1("calcite-flow", null, h$1("calcite-flow-item", { heading: this.messages.profilevariables, closable: true, onCalciteFlowItemClose: this._emitClose }, h$1("div", { class: "notice-container" }, this.messages.noprofilevariablesmessage ?? ""))));
4309
5567
  }
4310
- return (h("calcite-flow", { ref: (ref) => this.flowFocusHandler(ref) }, this.collectionBasedVariableRenderer(profile, true)(), this._flowItemRenderers.map((renderer) => renderer())));
5568
+ return (h$1("calcite-flow", { ref: (ref) => this.flowFocusHandler(ref) }, this.collectionBasedVariableRenderer(profile, true)(), this._flowItemRenderers.map((renderer) => renderer())));
4311
5569
  }
4312
5570
  static get assetsDirs() { return ["assets"]; }
4313
- get _hostElement() { return getElement(this); }
5571
+ get el() { return getElement(this); }
4314
5572
  static get watchers() { return {
4315
5573
  "modelId": ["modelIdPropChanged"]
4316
5574
  }; }
@@ -4337,11 +5595,11 @@ const ArcgisCodeEditor = class {
4337
5595
  constructor(hostRef) {
4338
5596
  registerInstance(this, hostRef);
4339
5597
  this.valueChange = createEvent(this, "valueChange", 3);
4340
- this._componentReadyDefer = new h$1();
5598
+ this._componentReadyDefer = new h$2();
4341
5599
  this._disposables = [];
4342
5600
  this.value = undefined;
4343
5601
  this.language = undefined;
4344
- this.modelId = U();
5602
+ this.modelId = Q();
4345
5603
  this.options = undefined;
4346
5604
  }
4347
5605
  valuePropChange(newValue) {
@@ -4483,7 +5741,7 @@ const ArcgisCodeEditor = class {
4483
5741
  this.valueChange.emit(script);
4484
5742
  });
4485
5743
  // Detect if the host element or its ancestors got a theme attribute mutation
4486
- this._themeObserver = x(this._hostElt, ["class"], () => this.updateTheme());
5744
+ this._themeObserver = b$1(this._hostElt, ["class"], () => this.updateTheme());
4487
5745
  // Update the theme of the Monaco Editor
4488
5746
  this.updateTheme();
4489
5747
  // Creates a resize observer to re-layout the editor on size changing
@@ -4496,7 +5754,7 @@ const ArcgisCodeEditor = class {
4496
5754
  while (this._disposables.length) {
4497
5755
  this._disposables.pop()?.dispose();
4498
5756
  }
4499
- this._themeObserver?.disconnect();
5757
+ this._themeObserver?.remove();
4500
5758
  }
4501
5759
  //#endregion
4502
5760
  // #region Private methods API
@@ -4514,7 +5772,7 @@ const ArcgisCodeEditor = class {
4514
5772
  // This is called the first time and subsequently by the Mutation Observer
4515
5773
  // Figure out the theme by walking the ancestor path.
4516
5774
  // If no theme is found then default to light.
4517
- const theme = k(this._hostElt) === "light" ? "vs" : "vs-dark";
5775
+ const theme = _(this._hostElt) === "light" ? "vs" : "vs-dark";
4518
5776
  if (theme === this._currentTheme) {
4519
5777
  return;
4520
5778
  }
@@ -4553,7 +5811,7 @@ const ArcgisCodeEditor = class {
4553
5811
  //#endregion
4554
5812
  // #region Rendering
4555
5813
  render() {
4556
- return h(Host, null);
5814
+ return h$1(Host, null);
4557
5815
  }
4558
5816
  static get assetsDirs() { return ["assets"]; }
4559
5817
  get _hostElt() { return getElement(this); }