@arcgis/coding-components
Version:
Contains components for editing code in different languages. The currently supported languages are html, css, json, TypeScript, JavaScript, and Arcade.
61 lines (60 loc) • 1.67 kB
JavaScript
import { importRequest as n } from "@arcgis/core-adapter";
import { isURL as i, hasSameOrigin as c } from "@arcgis/components-utils";
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
v4.32.13 */
function a() {
return !!window.MonacoEnvironment?.getWorkerUrl;
}
const s = /* @__PURE__ */ new Map();
function u(r) {
a() || (window.MonacoEnvironment = {
getWorker: async (w, o) => {
let e = s.get(o) ?? `${r}/code-editor/editor.worker.js`;
switch (o) {
case "json":
e = `${r}/code-editor/json.worker.js`;
break;
case "css":
e = `${r}/code-editor/css.worker.js`;
break;
case "html":
e = `${r}/code-editor/html.worker.js`;
break;
case "typescript":
case "javascript":
e = `${r}/code-editor/ts.worker.js`;
break;
case "arcade":
e = `${r}/code-editor/arcade.worker.js`;
break;
case "arcgis-sql-expression":
e = `${r}/code-editor/sql-expr.worker.js`;
break;
}
if (!i(e) || c(e, globalThis.location.href, !0))
return new Worker(e, { name: o });
const t = await (await n())(e, {
responseType: "text"
});
return new Worker(
URL.createObjectURL(
new Blob([t.data], {
type: "text/javascript"
})
)
);
}
});
}
async function j() {
return (await d()).getArcadeDiagnosticService();
}
async function d() {
return await import("./arcade-mode.js");
}
export {
j as a,
d as g,
u as s
};