Skip to content

A plugin marketplace for GitHub Copilot and other AI agents that provides Power Platform development plugins, including reusable skills, agents, and commands for building and deploying solutions.

feat(model-apps)!: take up the SDK's injected-storage and async surface (#590)

Akshay Maloo11b0088adc71
diff --git a/plugins/model-apps/CHANGELOG.md b/plugins/model-apps/CHANGELOG.md
index c2ce722dc..15c2a68a2 100644
--- a/plugins/model-apps/CHANGELOG.md
+++ b/plugins/model-apps/CHANGELOG.md
@@ -12,6 +12,11 @@ downloads that round-trip Choice columns.
### Added
+- **The vendored SDK moves to injected storage, and the plugin takes it up.** The SDK removed
+ `workspacePath`; every call site now builds a store with `createNodeWorkspaceStorage(...)`. Nothing
+ changes for authors — this is an internal uptake — but it is a breaking change for anything calling
+ these scripts as a library.
+
- **Richer form layouts: multi-column tabs, cell spans, and per-container visibility.** A tab can
now hold several form-columns (`tabs[].columns[]` with a `width`), a field entry can set
`colspan`/`rowspan`, and `expanded`/`visible`/`showLabel` are author-controlled. Layout keys are
@@ -33,6 +38,13 @@ downloads that round-trip Choice columns.
### Fixed
+- **A business rule's `dataType` now reaches Dataverse as a real type.** The new SDK forwards the
+ type hint verbatim instead of ignoring it, and the plugin was sending the App Spec's word
+ (`Money`, `Picklist`, and `String` by default) where Dataverse expects a numeric
+ `WorkflowAttributeType`. Live-measured: the platform **accepts** the bad value rather than
+ rejecting it, so affected rules deployed and activated with a wrongly-typed condition. Rebuild any
+ app with `businessRules[]` that was built against the previous release.
+
- **Editing a form with an explicit layout reshapes it, instead of flattening it** ([#575]). Every
field was appended to the first section of the first tab, nothing was ever created or resized, and
declaring explicit `tabs` simultaneously switched **pruning** on — so an author moving a deployed
diff --git a/plugins/model-apps/references/app-spec-schema.md b/plugins/model-apps/references/app-spec-schema.md
index 3f14b2485..7e5f053ff 100644
--- a/plugins/model-apps/references/app-spec-schema.md
+++ b/plugins/model-apps/references/app-spec-schema.md
@@ -675,8 +675,10 @@ why they need naming here at all.
A tab declares **either** `sections` **or** `columns`, never both. `columns` on a **tab** is the list
of form-columns; `columns` on a **section** is its 1–4 grid width — a number on a tab is rejected
rather than silently discarded. Any other key is **rejected** — including `showLabel`/`labelPosition`
-on a tab and `labelPosition`/`locked` on a section, which the SDK's serializer silently discards, so
-accepting them would promise a layout Dataverse never renders.
+on a tab and `labelPosition`/`locked` on a section, which FormXml has no place for, so accepting them
+would promise a layout Dataverse never renders. The SDK refuses these too, but this plugin rejects
+them at **author time** — before any workspace or network call — and names the real mechanism rather
+than reporting a JSON pointer into the compiled form.
**Names are identity, and a field is placed once per form.** Two tabs — or two sections — on one
form may not share a `name`, and a column may not be placed twice, whether in two different sections
diff --git a/plugins/model-apps/scripts/_vendor-build/build.js b/plugins/model-apps/scripts/_vendor-build/build.js
index fd08fa66f..ad0405814 100644
--- a/plugins/model-apps/scripts/_vendor-build/build.js
+++ b/plugins/model-apps/scripts/_vendor-build/build.js
@@ -31,6 +31,16 @@ if (!argSdk) {
process.exit(2);
}
const SDK_ENTRY = path.join(argSdk, 'packages/cds-maker-sdk/lib/index.js');
+/**
+ * The optional filesystem adapter, a SEPARATE entry point since the SDK made injected storage
+ * mandatory (`@maker-studio/cds-maker-sdk/node`).
+ *
+ * This vendored bundle is `platform: 'node'`, so pulling `fs` in is correct here — the plugin runs
+ * in Node and needs a real workspace on disk. It is bundled ALONGSIDE the core rather than instead
+ * of it, so a single `require('./vendor/cds-maker-sdk.cjs')` still yields everything the plugin
+ * uses: `createMakerSdk` plus `createNodeWorkspaceStorage`.
+ */
+const SDK_NODE_ENTRY = path.join(argSdk, 'packages/cds-maker-sdk/lib/node/index.js');
const OUTFILE = path.resolve(__dirname, '../vendor/cds-maker-sdk.cjs');
const PROVENANCE = path.resolve(__dirname, '../vendor/PROVENANCE.json');
const esbuild = require('esbuild');
@@ -39,6 +49,11 @@ if (!fs.existsSync(SDK_ENTRY)) {
console.error('SDK entry not found:', SDK_ENTRY);
process.exit(2);
}
+if (!fs.existsSync(SDK_NODE_ENTRY)) {
+ console.error('SDK /node adapter entry not found:', SDK_NODE_ENTRY);
+ console.error('The SDK requires an injected workspaceStorage; the plugin builds one from this.');
+ process.exit(2);
+}
/* Record WHICH upstream source produced the committed bundle.
*
@@ -198,7 +213,16 @@ const stubPlugin = {
esbuild
.build({
- entryPoints: [SDK_ENTRY],
+ // A virtual entry that re-exports BOTH published entry points, so the vendored artifact keeps
+ // its single-`require` shape. `resolveDir` is the SDK's lib directory, so the two relative
+ // specifiers below resolve exactly as they would from inside the package.
+ stdin: {
+ contents:
+ "export * from './index.js';\n" + "export * from './node/index.js';\n",
+ resolveDir: path.dirname(SDK_ENTRY),
+ sourcefile: 'vendor-entry.js',
+ loader: 'js',
+ },
bundle: true,
platform: 'node',
format: 'cjs',
diff --git a/plugins/model-apps/scripts/ai-preflight.js b/plugins/model-apps/scripts/ai-preflight.js
index 490c0ccc5..0996fce14 100644
--- a/plugins/model-apps/scripts/ai-preflight.js
+++ b/plugins/model-apps/scripts/ai-preflight.js
@@ -127,12 +127,12 @@ async function main() {
let report;
try {
- const { createMakerSdk } = require('./vendor/cds-maker-sdk.cjs');
+ const { createMakerSdk, createNodeWorkspaceStorage } = require('./vendor/cds-maker-sdk.cjs');
const httpClient = createAzHttpClient(env);
- const sdk = createMakerSdk({ workspacePath: workspaceDir, instanceUrl: env, httpClient });
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(workspaceDir), instanceUrl: env, httpClient });
// Keep SDK construction inside the protected region too: a constructor failure happens after the
// temp directory exists, so the finally must own both construction and init to avoid leaks.
- sdk.initWorkspace();
+ await sdk.initWorkspace();
const readinessOpts = app ? { appUniqueName: app } : {};
const readiness = await sdk.getAiReadiness(readinessOpts);
diff --git a/plugins/model-apps/scripts/build-model-app.js b/plugins/model-apps/scripts/build-model-app.js
index 7bf842675..4bac532e2 100644
--- a/plugins/model-apps/scripts/build-model-app.js
+++ b/plugins/model-apps/scripts/build-model-app.js
@@ -46,34 +46,53 @@ const { makeGenpageCli } = require('./lib/genpage-cli.js');
// (findTables/findColumns/fetchEntityMetadata) and every artifact
// (views/charts/forms/app) lands here, so the app folder accumulates the
// metadata for reuse/edits. Construction is offline (no token until first call).
-function makeSdk(env, spec, workspaceDir, languageCode) {
- const { createMakerSdk } = require('./vendor/cds-maker-sdk.cjs');
+async function makeSdk(env, spec, workspaceDir, languageCode) {
+ const { createMakerSdk, createNodeWorkspaceStorage } = require('./vendor/cds-maker-sdk.cjs');
const httpClient = createAzHttpClient(env);
const sdkTempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'model-app-'));
- const sdk = createMakerSdk({
- workspacePath: sdkTempDir, // unused (no workspace ops)
- instanceUrl: env,
- httpClient,
- solutionUniqueName: spec.solution && spec.solution.uniqueName,
- // #455: the App, Form and Dashboard adapters bake this in at construction, so it is the ONLY
- // way to stop sitemap titles and FormXML labels being written at a hardcoded 1033. Omitted
- // (undefined) means the SDK's own DEFAULT_LCID, which preserves the previous behaviour exactly.
- ...(languageCode ? { languageCode } : {}),
- });
- fs.mkdirSync(workspaceDir, { recursive: true });
- const provisionSdk = createMakerSdk({
- workspacePath: workspaceDir,
- instanceUrl: env,
- httpClient,
- // Must match the `sdk` instance above: `pushArtifact` refuses a push whose stored artifact
- // language disagrees with the SDK performing it (for language-sensitive registrations), so two
- // instances at different LCIDs would make every push of a fetched artifact fail.
- ...(languageCode ? { languageCode } : {}),
- });
- provisionSdk.initWorkspace();
const cleanup = () => {
fs.rmSync(sdkTempDir, { recursive: true, force: true });
};
+ // Everything fallible after the directory exists runs INSIDE this guard, because the caller's
+ // `finally { cleanup() }` only becomes reachable once this function RETURNS — so anything that
+ // throws before the return strands the throwaway workspace for the life of the machine.
+ //
+ // That deliberately includes the `createMakerSdk` CONSTRUCTORS, not just `initWorkspace`: the
+ // constructor now builds the injected-storage adapter (`createNodeWorkspaceStorage`), so it
+ // touches the filesystem and can fail on its own. Guarding only the init left both constructions
+ // outside the net. Matches provision-solution.js and ai-preflight.js, which already keep
+ // construction inside their protected region for this exact reason.
+ //
+ // `workspaceDir` is deliberately NOT removed — it is the caller's durable workspace, not a
+ // throwaway, so a failed run must leave it exactly as it found it.
+ let sdk;
+ let provisionSdk;
+ try {
+ sdk = createMakerSdk({
+ workspaceStorage: createNodeWorkspaceStorage(sdkTempDir), // unused (no workspace ops)
+ instanceUrl: env,
+ httpClient,
+ solutionUniqueName: spec.solution && spec.solution.uniqueName,
+ // #455: the App, Form and Dashboard adapters bake this in at construction, so it is the ONLY
+ // way to stop sitemap titles and FormXML labels being written at a hardcoded 1033. Omitted
+ // (undefined) means the SDK's own DEFAULT_LCID, which preserves the previous behaviour exactly.
+ ...(languageCode ? { languageCode } : {}),
+ });
+ fs.mkdirSync(workspaceDir, { recursive: true });
+ provisionSdk = createMakerSdk({
+ workspaceStorage: createNodeWorkspaceStorage(workspaceDir),
+ instanceUrl: env,
+ httpClient,
+ // Must match the `sdk` instance above: `pushArtifact` refuses a push whose stored artifact
+ // language disagrees with the SDK performing it (for language-sensitive registrations), so two
+ // instances at different LCIDs would make every push of a fetched artifact fail.
+ ...(languageCode ? { languageCode } : {}),
+ });
+ await provisionSdk.initWorkspace();
+ } catch (err) {
+ cleanup();
+ throw err;
+ }
// Only the two SDK instances and the cleanup are returned. The raw `httpClient` used to come back
// with them so the caller could wire verify's role-privilege reader — that read had no SDK surface
// and had to compose an absolute `EntityDefinitions(...)?$select=Privileges` request itself. The
@@ -582,7 +601,7 @@ async function main() {
opts.preResolvedLanguageCode = authoringLanguageCode;
// Construct for both dry-run and apply: proves the vendored bundle + adapter wire up
// (offline), and apply needs it. A spec validation error short-circuits before any write.
- const { sdk, provisionSdk, cleanup } = makeSdk(env, spec, workspaceDir, authoringLanguageCode);
+ const { sdk, provisionSdk, cleanup } = await makeSdk(env, spec, workspaceDir, authoringLanguageCode);
// Durable build journal (apply runs only): a per-run record of steps + where a run halted,
// written to <workspace>/build-log.jsonl. Resume = re-run the same command (idempotent).
const journal = opts.apply
diff --git a/plugins/model-apps/scripts/download-model-app.js b/plugins/model-apps/scripts/download-model-app.js
index 9712903ee..caee8ad2a 100644
--- a/plugins/model-apps/scripts/download-model-app.js
+++ b/plugins/model-apps/scripts/download-model-app.js
@@ -308,12 +308,12 @@ function relationshipsSkippedWarning(skipped) {
return `${lines.join('\n')}\n`;
}
-function makeProvision(env, workspaceDir) {
- const { createMakerSdk } = require('./vendor/cds-maker-sdk.cjs');
+async function makeProvision(env, workspaceDir) {
+ const { createMakerSdk, createNodeWorkspaceStorage } = require('./vendor/cds-maker-sdk.cjs');
const httpClient = createAzHttpClient(env);
fs.mkdirSync(workspaceDir, { recursive: true });
- const sdk = createMakerSdk({ workspacePath: workspaceDir, instanceUrl: env, httpClient });
- sdk.initWorkspace();
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(workspaceDir), instanceUrl: env, httpClient });
+ await sdk.initWorkspace();
return sdk;
}
@@ -2111,7 +2111,7 @@ async function main() {
// the one the download itself uses, so a transient 5xx here would otherwise fail a run that would
// have succeeded. Surface it and continue.
if (auth.inconclusive) process.stderr.write(`⚠ ${auth.error}\n`);
- const sdk = makeProvision(env, path.join(outDir, '.maker-workspace'));
+ const sdk = await makeProvision(env, path.join(outDir, '.maker-workspace'));
const resolved = await resolveAppId(sdk, appArg);
if (resolved.error) { emitResult(false, { ok: false, error: resolved.error }); return; }
const appId = resolved.appId;
diff --git a/plugins/model-apps/scripts/lib/app-spec.js b/plugins/model-apps/scripts/lib/app-spec.js
index 633abc717..c2fb49765 100644
--- a/plugins/model-apps/scripts/lib/app-spec.js
+++ b/plugins/model-apps/scripts/lib/app-spec.js
@@ -1114,10 +1114,18 @@ function validateFormSecurityRoles(f, spec, errors) {
//
// `tabs[]`/`sections[]` had no allow-list at all, so an invented or misspelled key validated clean
// and then vanished — the same class of silent loss that let `entities[].localizedLabels` ship as a
-// no-op. Worse here, several plausible keys are accepted by the SDK's normalizers and then DROPPED
-// by its serializer: measured against the vendored bundle, a tab emits only name/expanded/visible
-// + label, and a section only name/showlabel/visible/columns + label. Anything else never reaches
-// the FormXml, so accepting it would promise a layout Dataverse will not render.
+// no-op. A tab reaches FormXml with only name/expanded/visible + label, and a section with only
+// name/showlabel/visible/columns + label; anything else would promise a layout Dataverse will not
+// render.
+//
+// The SDK now REFUSES an unrecognised tab/section key rather than dropping it — measured against the
+// vendored bundle, `addElement` throws `'<key>' is not a tab property, and would be SILENTLY DROPPED
+// at serialization` for `showLabel`/`labelPosition` on a tab and `labelPosition`/`locked` on a
+// section. That is the upstream half of this rule, and it did NOT make this gate redundant: this one
+// fails at AUTHOR time, before any workspace or network call, and names the real mechanism in
+// FORM_LAYOUT_KEY_HINTS instead of pointing at a JSON pointer. Keeping both means a typo is caught
+// at the earliest point that can see it, and a re-vendor that loses the upstream check cannot
+// silently reopen the hole.
const FORM_TAB_KEYS = new Set(['name', 'label', 'expanded', 'visible', 'sections', 'columns']);
const FORM_TAB_COLUMN_KEYS = new Set(['width', 'sections']);
const FORM_SECTION_KEYS = new Set(['name', 'label', 'columns', 'showLabel', 'visible', 'fields']);
@@ -1167,8 +1175,9 @@ function formColumnsOf(tab) {
return [{ width: '100%', sections: Array.isArray(tab.sections) ? tab.sections : [] }];
}
-// Keys an author reasonably reaches for that the serializer silently discards. Naming the real
-// mechanism is the difference between an actionable error and a scavenger hunt.
+// Keys an author reasonably reaches for that FormXml has no place for. Naming the real mechanism is
+// the difference between an actionable error and a scavenger hunt — the SDK's own refusal reports a
+// JSON pointer into the compiled intent, which an author who wrote a spec cannot map back to a key.
const FORM_LAYOUT_KEY_HINTS = {
showLabel: " — a TAB has no label toggle in FormXml; use the tab's `label`, or move the toggle to a section's `showLabel`",
labelPosition: ' — label position is not expressible per tab/section through this SDK',
diff --git a/plugins/model-apps/scripts/lib/entity-provision.js b/plugins/model-apps/scripts/lib/entity-provision.js
index 0d946b543..2540847b8 100644
--- a/plugins/model-apps/scripts/lib/entity-provision.js
+++ b/plugins/model-apps/scripts/lib/entity-provision.js
@@ -663,7 +663,7 @@ async function provisionSolution({ sdk, provision, runner, solution }) {
async function resolveAuthoringLanguage({ envUrl, languageCode, spec, warn, readOrg, provisionedLanguages }) {
const readOrgLcid = readOrg || ((url) => readOrgLanguageCode(url));
const probe = provisionedLanguages || (() => readProvisionedLanguages(envUrl));
- return resolveLanguageCode({
+ return await resolveLanguageCode({
// resolveLanguageCode only needs `.queryRecords('organization', …)`; adapt the transport read to
// that shape rather than duplicating the precedence ladder, so the two paths cannot drift.
provision: {
diff --git a/plugins/model-apps/scripts/lib/sdk-build.js b/plugins/model-apps/scripts/lib/sdk-build.js
index 8e9bf8676..1927b1e0b 100644
--- a/plugins/model-apps/scripts/lib/sdk-build.js
+++ b/plugins/model-apps/scripts/lib/sdk-build.js
@@ -1017,9 +1017,42 @@ function formIdentityKey(f) {
// `valueType` is always `'Value'`: the SDK's other axes (`Field`, `Lookup`, `Expression`, `Clear`)
// need shapes the App Spec does not model, so exposing the name would offer authors a choice they
// cannot use. The App Spec calls the type hint `dataType` rather than the SDK's `valueWorkflowType`,
-// because `valueType` already means that other thing here — and note it is currently DECORATIVE:
-// measured across every accepted token, on both the condition and the action path, the SDK types
-// every literal as String. See BUSINESS_RULE_DATA_TYPES in app-spec.js.
+// because `valueType` already means that other thing here. See BUSINESS_RULE_DATA_TYPES in
+// app-spec.js.
+//
+// `dataType` is NO LONGER decorative on the CONDITION path, and that changed under us in the SDK
+// uptake. The previous bundle consulted `valueWorkflowType` only for `valueType: 'Clear'` and
+// hard-typed every ordinary literal as `WorkflowAttributeType.String`; the current bundle uses the
+// field for ALL value types, VERBATIM, with no name -> enum mapping of its own
+// (`… : e.valueWorkflowType ?? WorkflowAttributeType.String`).
+//
+// `WorkflowAttributeType` is a NUMERIC-STRING enum — `{ Boolean:'0' … Money:'7', Picklist:'10',
+// String:'14' … }` — so passing the App Spec's human token would put an out-of-domain value on the
+// wire. MEASURED against the vendored bundle before this mapping existed, the condition literal
+// carried `"String"`, `"Money"`, and even `"NotAWorkflowType"` straight through, while the SDK's own
+// fallback for the same field is `'14'`. Note this hit EVERY rule, not only ones that authored a
+// `dataType`, because the default below is the token `'String'` rather than the enum value.
+//
+// LIVE-MEASURED that this fails SILENTLY rather than loudly: a build carrying the raw tokens
+// deployed all four probe rules with 0 failures and activated them. The platform does not reject the
+// value, so nothing upstream of a user noticing the rule never fires would surface it — and
+// `--verify` cannot, because it checks existence, duplicate count and statecode, never the rule's
+// WFOM.
+//
+// The ACTION path still types every literal as String on the SDK side, so it is unaffected — the
+// asymmetry is deliberate and pinned in business-rules.test.js.
+const WORKFLOW_ATTRIBUTE_TYPE = {
+ boolean: '0', customer: '1', datetime: '2', decimal: '3', float: '4', double: '4', integer: '5',
+ lookup: '6', money: '7', owner: '8', partylist: '9', picklist: '10', key: '11', state: '12',
+ status: '13', string: '14', memo: '14', uniqueidentifier: '15', entitynamereference: '16',
+ entity: '17', entitycollection: '18', multiselectpicklist: '23',
+};
+// Unknown tokens fall back to String rather than being forwarded. The spec gate already restricts
+// `dataType` to BUSINESS_RULE_DATA_TYPES, so this is unreachable from a valid spec; forwarding an
+// unmapped token would reopen exactly the out-of-domain write this mapping exists to close.
+function workflowAttributeType(dataType) {
+ return WORKFLOW_ATTRIBUTE_TYPE[String(dataType || 'String').toLowerCase()] || '14';
+}
function businessRuleDef(rule) {
const ids = (prefix) => { let n = 0; return () => `${prefix}${++n}`; };
const clauseId = ids('c');
@@ -1043,14 +1076,14 @@ function businessRuleDef(rule) {
field: String(c.field).toLowerCase(),
operator: c.operator,
valueType: 'Value',
- ...(valueless(c.operator) ? {} : { value: String(c.value), valueWorkflowType: c.dataType || 'String' }),
+ ...(valueless(c.operator) ? {} : { value: String(c.value), valueWorkflowType: workflowAttributeType(c.dataType) }),
})),
trueBranch: (rule.actions || []).map((a) => {
const node = { id: actionId(), type: a.type, displayName: a.label || `${a.type} ${a.field}`, field: String(a.field).toLowerCase() };
if (a.type === 'SetVisibility') node.visible = a.visible;
else if (a.type === 'LockUnlock') node.lock = a.lock;
else if (a.type === 'SetBusinessRequired') node.required = a.required;
- else if (a.type === 'SetFieldValue') { node.value = String(a.value); node.valueType = 'Value'; node.valueWorkflowType = a.dataType || 'String'; }
+ else if (a.type === 'SetFieldValue') { node.value = String(a.value); node.valueType = 'Value'; node.valueWorkflowType = workflowAttributeType(a.dataType); }
return node;
}),
falseBranch: [],
@@ -1530,7 +1563,7 @@ async function runSdkBuild(spec, opts = {}) {
// `description` is new on forms in this SDK uptake (dashboards, rows in the same systemform
// table, always had it). Passed only when the spec sets one: omitted on push it is not written,
// so an existing server-side description survives an edit that did not set one.
- const art = provision.createArtifact('form', { name: def.name, entityLogicalName: def.entityLogicalName, formType: def.formType, status: def.status, ...(def.description ? { description: def.description } : {}) });
+ const art = await provision.createArtifact('form', { name: def.name, entityLogicalName: def.entityLogicalName, formType: def.formType, status: def.status, ...(def.description ? { description: def.description } : {}) });
const tabs = def.tabs || [];
// Sequential (not Promise.all): tab ORDER is the on-form order, and addElement appends.
for (const tab of tabs) await provision.addElement('form', art.id, '/tabs', tab);
@@ -2238,10 +2271,10 @@ async function runSdkBuild(spec, opts = {}) {
// parent lookups to an un-deletable form and strand references that block teardown. Gap 2 is
// instead handled by making our form the entity's default (see promoteDefaultForm below).
const existingId = await resolveExistingFormId(provision, def);
- if (existingId) return reconcileForm(existingId, def);
+ if (existingId) return await reconcileForm(existingId, def);
} else if (type === 'view') {
const existingId = await provision.findArtifact('view', { name: def.name, entity: def.entityLogicalName });
- if (existingId) return reconcileView(existingId, def, !!(meta && meta.authoredQuery));
+ if (existingId) return await reconcileView(existingId, def, !!(meta && meta.authoredQuery));
}
// A form cannot be created from a full authored definition (the adapter's createDefault
// serializes authored tabs BEFORE minting ids and throws on the id-less cells); build its body
@@ -2252,7 +2285,7 @@ async function runSdkBuild(spec, opts = {}) {
id = await createFormShell(def);
await addSubgrids(id, def.__subgrids);
} else {
- id = provision.createArtifact(type, def).id;
+ id = (await provision.createArtifact(type, def)).id;
}
const pushed = requireSuccessfulPush(await provision.pushArtifact(type, id), `${type} ${def.name}`, opts.warn);
await provision.addSolutionComponent({ componentId: pushed.id, componentType: COMPONENT_TYPE[type], solutionUniqueName: sol.uniqueName });
@@ -2367,7 +2400,7 @@ async function runSdkBuild(spec, opts = {}) {
return existingId;
}
return runner.run('charts', `chart "${def.name}"`, async () => {
- const art = provision.createArtifact('chart', def);
+ const art = await provision.createArtifact('chart', def);
const pushed = requireSuccessfulPush(await provision.pushArtifact('chart', art.id), `chart ${def.name}`, opts.warn);
await provision.addSolutionComponent({ componentId: pushed.id, componentType: COMPONENT_TYPE.chart, solutionUniqueName: sol.uniqueName });
// Created here, so it IS workspace-resident and publishable.
@@ -2694,45 +2727,33 @@ async function runSdkBuild(spec, opts = {}) {
}
await runner.run('business-rules', `business rule "${rule.name}" on ${rule.entity}`, async () => {
const def = businessRuleDef(rule);
- const art = provision.createArtifact('businessRule', def);
+ const art = await provision.createArtifact('businessRule', def);
// The condition tree is a nested object, so it goes on through the generic element surface
// rather than the create payload — mirroring how the SDK's own workflow test authors one.
await provision.updateElement('businessRule', art.id, '/rootCondition', def.rootCondition);
- // The push CANNOT tell you a rule is wrong. A mis-shaped condition tree is MERGED onto the
- // node, ignored by the serializer, and written as a rule with no clauses and no actions:
- // HTTP 204, activated, and it never fires. That trap is pinned in sdk-uptake-contract.test.js
- // ("a wrongly-shaped condition produces an EMPTY rule rather than erroring") and, until this
- // SDK, the spec gate was the only thing standing in front of it.
- //
- // The SDK now exposes the business-rule designer's OWN completeness validator — the same one
- // the designer gates its Save button on — and states plainly that nothing on the push path
- // runs it, so run it here, BEFORE the write.
+ // The push USED to be unable to tell you a rule was wrong: a mis-shaped condition tree was
+ // MERGED onto the node, ignored by the serializer, and written as a rule with no clauses and
+ // no actions — HTTP 204, activated, and it never fired.
//
- // Strict about FINDINGS, best-effort about the VALIDATOR. Findings halt: a rule that reports
- // success and never fires is exactly the silent-wrong-artifact class this engine exists to
- // prevent, and it is invisible afterwards. But a bundle without the method, or a validator
- // that throws, must not block a build it cannot judge.
+ // That trap is CLOSED at the source as of the injected-storage re-vendor. The SDK now runs
+ // the business-rule designer's own completeness validator internally on EVERY save — create
+ // and update, Active and Draft — so an incomplete or mis-shaped rule is REFUSED by
+ // `pushArtifact` below, naming the offending clause, and nothing reaches the wire.
+ // Measured and pinned in sdk-uptake-contract.test.js ("a wrongly-shaped condition is now
+ // REFUSED at push, closing the empty-rule trap"), which asserts both the refusal and that no
+ // request was made.
//
- // Field metadata is deliberately NOT passed: without it the SDK SUPPRESSES the
- // metadata-dependent checks (Clear eligibility, value-type compatibility, max length) rather
- // than failing them, and the structural checks are the ones that close the trap above.
- // Passing them would cost an attribute read per rule for checks the spec gate already covers.
+ // ⚠ The explicit validation call that used to sit HERE is therefore gone, and its removal is
+ // a TIGHTENING rather than a loss of coverage. It invoked the SDK's old business-rule
+ // validator method, which no longer exists. The old call was best-effort by design (a bundle
+ // without the method must not block a build it cannot judge), so it silently degraded to NO
+ // validation whenever the vendored bundle predated it. Re-adding a defensive
+ // `typeof ... === 'function'` block would now be dead code that never runs and implies
+ // coverage living elsewhere.
//
- // MEASURED against this bundle: every shape this spec surface can author — all 16 operators,
- // all 4 action types, every scope and status, multi-condition and multi-action — reports zero
- // issues, so this cannot reject a rule that was previously buildable.
- if (typeof provision.validateBusinessRule === 'function') {
- let issues = null;
- try {
- issues = provision.validateBusinessRule(Object.assign({}, art, { rootCondition: def.rootCondition }));
- } catch { /* a diagnostic that cannot run must never fail the build */ }
- if (Array.isArray(issues) && issues.length) {
- const detail = issues.map((i) => `${(i && i.rule) || 'issue'}: ${(i && i.message) || ''}`.trim()).join('; ');
- throw new BuildHalt(
- `business rule "${rule.name}" on ${rule.entity} is incomplete and would deploy as a rule that never fires — ${detail}`,
- { phase: 'business-rules', code: 'business-rule-incomplete', recoverable: false });
- }
- }
+ // NOTE: the method name is deliberately NOT written in call form anywhere in this file.
+ // `sdk-surface-contract.test.js` scans engine source for `sdk.<method>(` and would read a
+ // mention in prose as a live call, then demand it back on the vendored bundle.
const pushed = requireSuccessfulPush(await provision.pushArtifact('businessRule', art.id), `business rule ${rule.name}`, opts.warn);
result.created.businessRules[`${entityLogical}|${rule.name}`] = pushed.id;
await provision.addSolutionComponent({ componentId: pushed.id, componentType: COMPONENT_TYPE.workflow, solutionUniqueName: sol.uniqueName });
@@ -2928,7 +2949,7 @@ async function runSdkBuild(spec, opts = {}) {
// The whole flow — including its stages and steps — is carried on the CREATE payload. The
// adapter normalizes and id-stamps the stage/step tree there, so unlike a business rule's
// condition tree there is no element-surface follow-up to make.
- const art = provision.createArtifact('bpf', bpfDef(flow));
+ const art = await provision.createArtifact('bpf', bpfDef(flow));
const pushed = requireSuccessfulPush(await provision.pushArtifact('bpf', art.id), `business process flow ${flow.name}`, opts.warn);
result.created.businessProcessFlows[key] = pushed.id;
// On the CREATE path the derivation is authoritative: the build supplied `flow.name`, the
@@ -2961,7 +2982,7 @@ async function runSdkBuild(spec, opts = {}) {
}
await runner.run('commands', `command bar for ${entityLogical} (${cmds.length} button(s))`, async () => {
const def = commandDef(entityLogical, cmds, result.created.webResources);
- const art = provision.createArtifact('command', def);
+ const art = await provision.createArtifact('command', def);
const pushed = requireSuccessfulPush(await provision.pushArtifact('command', art.id), `command ${entityLogical}`, opts.warn);
result.created.commands[entityLogical] = pushed.id;
});
@@ -2988,7 +3009,7 @@ async function runSdkBuild(spec, opts = {}) {
continue;
}
await runner.run('dashboards', `dashboard "${dash.name}" (${(dash.tiles || []).length} tile(s))`, async () => {
- const art = provision.createArtifact('dashboard', { name: dash.name, ...(dash.description ? { description: dash.description } : {}) });
+ const art = await provision.createArtifact('dashboard', { name: dash.name, ...(dash.description ? { description: dash.description } : {}) });
// for..of, not forEach: addElement is async, and a forEach callback would fire the adds
// without awaiting them — the push below could then race an unfinished tile insert.
const tiles = dash.tiles || [];
@@ -3066,7 +3087,7 @@ async function runSdkBuild(spec, opts = {}) {
}
// Create: the full def (siteMap + explicit components + iconWebResourceId) serializes unchanged
// through createArtifact, and push emits appmodule -> sitemap -> AddAppComponents -> publish.
- const art = provision.createArtifact('app', def);
+ const art = await provision.createArtifact('app', def);
const pushed = requireSuccessfulPush(await provision.pushArtifact('app', art.id), `app ${def.name}`, opts.warn);
await provision.addSolutionComponent({ componentId: pushed.id, componentType: COMPONENT_TYPE.app, solutionUniqueName: sol.uniqueName });
// The app module and its sitemap are DISTINCT solution components — adding the appmodule does
diff --git a/plugins/model-apps/scripts/provision-entities.js b/plugins/model-apps/scripts/provision-entities.js
index 670266a94..e20f76ebe 100644
--- a/plugins/model-apps/scripts/provision-entities.js
+++ b/plugins/model-apps/scripts/provision-entities.js
@@ -19,24 +19,40 @@ const { parseArgs, validateFlags, readAliasedFlag, readJsonArg, emitResult, read
// solution via the MSCRM.SolutionUniqueName header).
// provision — header-less; used for discovery reads (findTables/findColumns/
// fetchEntityMetadata/queryRecords).
-function makeSdk(env, input) {
- const { createMakerSdk } = require('./vendor/cds-maker-sdk.cjs');
+async function makeSdk(env, input) {
+ const { createMakerSdk, createNodeWorkspaceStorage } = require('./vendor/cds-maker-sdk.cjs');
const httpClient = createAzHttpClient(env);
const sdkTempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'provision-'));
const provisionTempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'provision-'));
- const sdk = createMakerSdk({
- workspacePath: sdkTempDir,
- instanceUrl: env,
- httpClient,
- solutionUniqueName: input.solution && input.solution.uniqueName,
- });
- sdk.initWorkspace();
- const provision = createMakerSdk({ workspacePath: provisionTempDir, instanceUrl: env, httpClient });
- provision.initWorkspace();
const cleanup = () => {
fs.rmSync(sdkTempDir, { recursive: true, force: true });
fs.rmSync(provisionTempDir, { recursive: true, force: true });
};
+ // Everything fallible after the directories exist runs INSIDE this guard, because the caller's
+ // `finally { cleanup() }` only becomes reachable once this function RETURNS — so anything that
+ // throws before the return strands both temp directories for the life of the machine.
+ //
+ // That deliberately includes the `createMakerSdk` CONSTRUCTORS, not just `initWorkspace`: the
+ // constructor now builds the injected-storage adapter (`createNodeWorkspaceStorage`), so it
+ // touches the filesystem and can fail on its own. Guarding only the init left the first
+ // construction outside the net. Matches provision-solution.js and ai-preflight.js, which already
+ // keep construction inside their protected region for this exact reason.
+ let sdk;
+ let provision;
+ try {
+ sdk = createMakerSdk({
+ workspaceStorage: createNodeWorkspaceStorage(sdkTempDir),
+ instanceUrl: env,
+ httpClient,
+ solutionUniqueName: input.solution && input.solution.uniqueName,
+ });
+ await sdk.initWorkspace();
+ provision = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(provisionTempDir), instanceUrl: env, httpClient });
+ await provision.initWorkspace();
+ } catch (err) {
+ cleanup();
+ throw err;
+ }
return { sdk, provision, cleanup };
}
@@ -316,7 +332,7 @@ async function main() {
};
// Construct SDK clients (offline until first call)
- const { sdk, provision, cleanup } = makeSdk(env, input);
+ const { sdk, provision, cleanup } = await makeSdk(env, input);
let r;
try {
diff --git a/plugins/model-apps/scripts/provision-solution.js b/plugins/model-apps/scripts/provision-solution.js
index 71601c390..58bbaec80 100644
--- a/plugins/model-apps/scripts/provision-solution.js
+++ b/plugins/model-apps/scripts/provision-solution.js
@@ -153,17 +153,17 @@ async function main() {
let result;
let error;
try {
- const { createMakerSdk } = require('./vendor/cds-maker-sdk.cjs');
+ const { createMakerSdk, createNodeWorkspaceStorage } = require('./vendor/cds-maker-sdk.cjs');
const httpClient = createAzHttpClient(envUrl);
const sdk = createMakerSdk({
- workspacePath: sdkTempDir, // unused workspace (no metadata persistence needed)
+ workspaceStorage: createNodeWorkspaceStorage(sdkTempDir), // unused workspace (no metadata persistence needed)
instanceUrl: envUrl,
httpClient,
});
// initWorkspace() is INSIDE the try so the finally below always removes the temp workspace, even
// if SDK construction or init itself throws (otherwise a failed constructor leaked sdkTempDir).
// Consistent with teardown-model-app's fail-safe pattern; harmless for the Dataverse-only ops here.
- sdk.initWorkspace();
+ await sdk.initWorkspace();
result = await runProvisionSolution(
{
envUrl,
diff --git a/plugins/model-apps/scripts/teardown-model-app.js b/plugins/model-apps/scripts/teardown-model-app.js
index a06cc3dd7..34a438fcd 100644
--- a/plugins/model-apps/scripts/teardown-model-app.js
+++ b/plugins/model-apps/scripts/teardown-model-app.js
@@ -28,19 +28,19 @@ const { parseArgs, validateFlags, readJsonArg, emitResult } = require('./lib/dat
const snapStore = require('./lib/apply-snapshot-store.js');
// Build an SDK client for teardown. Uses the same az-token HttpClient as build-model-app.js.
-function makeSdk(env) {
- const { createMakerSdk } = require('./vendor/cds-maker-sdk.cjs');
+async function makeSdk(env) {
+ const { createMakerSdk, createNodeWorkspaceStorage } = require('./vendor/cds-maker-sdk.cjs');
const httpClient = createAzHttpClient(env);
// Teardown uses a minimal SDK client (no workspace, no solution header) — just queryRecords
// and delete methods. Use a throw-away temp dir since initWorkspace is mandatory.
const sdkTempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'teardown-'));
try {
const sdk = createMakerSdk({
- workspacePath: sdkTempDir,
+ workspaceStorage: createNodeWorkspaceStorage(sdkTempDir),
instanceUrl: env,
httpClient,
});
- sdk.initWorkspace();
+ await sdk.initWorkspace();
const cleanup = () => {
fs.rmSync(sdkTempDir, { recursive: true, force: true });
};
@@ -146,7 +146,7 @@ async function main() {
const apply = flags.apply === true;
const allowDestructive = flags['allow-destructive'] === true;
const workspaceDir = workspaceArg || path.join(path.dirname(specPath), '.maker-workspace');
- const { sdk, cleanup } = makeSdk(env);
+ const { sdk, cleanup } = await makeSdk(env);
let r;
let thrown = null;
try {
diff --git a/plugins/model-apps/scripts/tests/ai-app-features-real-bundle.test.js b/plugins/model-apps/scripts/tests/ai-app-features-real-bundle.test.js
index b44688279..8a7a4d0aa 100644
--- a/plugins/model-apps/scripts/tests/ai-app-features-real-bundle.test.js
+++ b/plugins/model-apps/scripts/tests/ai-app-features-real-bundle.test.js
@@ -40,8 +40,8 @@ test.after(() => { for (const d of tempDirs) fs.rmSync(d, { recursive: true, for
* failProof - throw from the /appsettings query (models missing read access).
* failWrite - throw from POST /SaveSettingValue.
*/
-function freshSdk(opts = {}) {
- const { createMakerSdk } = require(BUNDLE);
+async function freshSdk(opts = {}) {
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'ai-real-'));
tempDirs.push(dir);
const calls = [];
@@ -79,15 +79,15 @@ function freshSdk(opts = {}) {
delete: async () => ({ status: 204, headers: {}, body: {} }),
put: async () => ({ status: 204, headers: {}, body: {} }),
};
- const sdk = createMakerSdk({ workspacePath: dir, instanceUrl: 'https://example.crm.dynamics.com', httpClient });
- sdk.initWorkspace();
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(dir), instanceUrl: 'https://example.crm.dynamics.com', httpClient });
+ await sdk.initWorkspace();
return { sdk, calls, proofCount: () => proofAttempts };
}
// `verifyDelayMs: 0` keeps the retry budget instant — the real default backs off up to ~3s.
const FAST = { verifyDelayMs: 0 };
test('REAL BUNDLE: a proven app-scope override row is the only thing that yields `applied`', async () => {
- const { sdk } = freshSdk({ gate: '2', effective: '2', overrideRows: [{ value: '2' }] });
+ const { sdk } = await freshSdk({ gate: '2', effective: '2', overrideRows: [{ value: '2' }] });
const r = await sdk.setAppAiFeatures(APP, { formFill: true }, FAST);
assert.deepStrictEqual(r.applied, ['formFill']);
assert.deepStrictEqual([r.notPersisted, r.unverified, r.failed], [[], [], []]);
@@ -101,7 +101,7 @@ test('REAL BUNDLE: an ENV-fallback match with NO override row is notPersisted, n
// that is what makes the env-fallback read look like success. So `effective` must be the value the
// request resolves to ('2' = enabled for this family); stubbing '1' would mean the read disagrees
// with the request anyway, and the test would pass for the wrong reason.
- const { sdk } = freshSdk({ gate: '2', effective: '2', overrideRows: [] });
+ const { sdk } = await freshSdk({ gate: '2', effective: '2', overrideRows: [] });
const r = await sdk.setAppAiFeatures(APP, { formFill: true }, FAST);
assert.deepStrictEqual(r.applied, [], 'an env-fallback read must never count as applied');
assert.deepStrictEqual(r.notPersisted, ['formFill']);
@@ -111,7 +111,7 @@ test('REAL BUNDLE: an ENV-fallback match with NO override row is notPersisted, n
test('REAL BUNDLE: a write that becomes visible late is retried and reported applied', async () => {
// Eventual consistency: an immediate read can miss a write that DID land. Reporting that as failed
// produced a false `notPersisted` on first apply (a re-run then looked clean).
- const { sdk, proofCount } = freshSdk({ gate: '2', effective: '2', overrideRows: (n) => (n >= 3 ? [{ value: '2' }] : []) });
+ const { sdk, proofCount } = await freshSdk({ gate: '2', effective: '2', overrideRows: (n) => (n >= 3 ? [{ value: '2' }] : []) });
const r = await sdk.setAppAiFeatures(APP, { formFill: true }, FAST);
assert.deepStrictEqual(r.applied, ['formFill'], 'the retry budget must absorb read lag');
assert.strictEqual(proofCount(), 3, 'stops as soon as the override is observed');
@@ -123,7 +123,7 @@ test('REAL BUNDLE: an unreadable override row is `unverified`, never applied and
// decides whether this path is reached at all — since AB#6688904 the write and the proof always
// run — so `gate` here is inert and `'2'` is used purely so a fixture for a `formFill: true`
// request does not read as "disabled".
- const { sdk } = freshSdk({ gate: '2', effective: '2', failProof: true });
+ const { sdk } = await freshSdk({ gate: '2', effective: '2', failProof: true });
const r = await sdk.setAppAiFeatures(APP, { formFill: true }, FAST);
assert.deepStrictEqual(r.unverified, ['formFill']);
assert.deepStrictEqual([r.applied, r.notPersisted], [[], []]);
@@ -131,7 +131,7 @@ test('REAL BUNDLE: an unreadable override row is `unverified`, never applied and
});
test('REAL BUNDLE: a throwing write lands in `failed` and does not abort the batch', async () => {
- const { sdk } = freshSdk({ gate: '2', effective: '2', failWrite: true });
+ const { sdk } = await freshSdk({ gate: '2', effective: '2', failWrite: true });
const r = await sdk.setAppAiFeatures(APP, { formFill: true, nlChart: true }, FAST);
assert.deepStrictEqual(r.failed.sort(), ['formFill', 'nlChart'], 'every feature still reports');
assert.deepStrictEqual(r.applied, []);
@@ -149,7 +149,7 @@ test('REAL BUNDLE: a throwing write lands in `failed` and does not abort the bat
test('REAL BUNDLE: a gate that is off no longer pre-empts the write — it is issued, then explained as `skipped`', async () => {
// `nlSearch` has a genuinely distinct gate (`EnableNLGridSearch`) from its per-app setting
// (`NLGridSearchSetting`), so a gate-off diagnosis is meaningful for it.
- const { sdk, calls } = freshSdk({ gate: '0', effective: '0', overrideRows: [] });
+ const { sdk, calls } = await freshSdk({ gate: '0', effective: '0', overrideRows: [] });
const r = await sdk.setAppAiFeatures(APP, { nlSearch: true }, FAST);
assert.deepStrictEqual(r.skipped, ['nlSearch'], 'an absent override plus a gate reading off is `skipped`');
const writes = calls.filter((c) => c.method === 'POST' && c.url.includes('SaveSettingValue'));
@@ -163,7 +163,7 @@ test('REAL BUNDLE: a SELF-GATED feature has no gate to blame — an absent overr
// `formFill` reads `FormFillBarUXEnabled` for BOTH its gate and its per-app value. `0` there is the
// platform default on a new app, not an admin saying no, so there is nothing to diagnose with and
// the honest bucket is `notPersisted`. Reporting `skipped` here would re-tell the AB#6688904 story.
- const { sdk, calls } = freshSdk({ gate: '0', effective: '0', overrideRows: [] });
+ const { sdk, calls } = await freshSdk({ gate: '0', effective: '0', overrideRows: [] });
const r = await sdk.setAppAiFeatures(APP, { formFill: true }, FAST);
assert.deepStrictEqual(r.skipped, [], 'a self-gated feature can never be `skipped`');
assert.deepStrictEqual(r.notPersisted, ['formFill']);
@@ -171,7 +171,7 @@ test('REAL BUNDLE: a SELF-GATED feature has no gate to blame — an absent overr
});
test('REAL BUNDLE: disabling is never gated — it writes even when the org gate is off', async () => {
- const { sdk, calls } = freshSdk({ gate: '0', effective: '1', overrideRows: [{ value: '1' }] });
+ const { sdk, calls } = await freshSdk({ gate: '0', effective: '1', overrideRows: [{ value: '1' }] });
const r = await sdk.setAppAiFeatures(APP, { formFill: false }, FAST);
assert.deepStrictEqual(r.applied, ['formFill'], 'an explicit disable must always be applied');
const write = calls.find((c) => c.method === 'POST' && c.url.includes('SaveSettingValue'));
@@ -181,7 +181,7 @@ test('REAL BUNDLE: disabling is never gated — it writes even when the org gate
test('REAL BUNDLE: an explicit integer value (2 = on for everyone) is written verbatim', async () => {
// The plugin's spec schema allows this precisely because the SDK does; a boolean-only contract made
// the platform's documented `2` inexpressible (ADO 6560699).
- const { sdk, calls } = freshSdk({ gate: '2', effective: '2', overrideRows: [{ value: '2' }] });
+ const { sdk, calls } = await freshSdk({ gate: '2', effective: '2', overrideRows: [{ value: '2' }] });
const r = await sdk.setAppAiFeatures(APP, { formFill: 2 }, FAST);
assert.deepStrictEqual(r.applied, ['formFill']);
assert.strictEqual(calls.find((c) => c.method === 'POST' && c.url.includes('SaveSettingValue')).body.Value, '2');
@@ -190,7 +190,7 @@ test('REAL BUNDLE: an explicit integer value (2 = on for everyone) is written ve
test('REAL BUNDLE: an out-of-range or non-numeric value throws BEFORE any write is issued', async () => {
// The plugin's validateAppSpec bound mirrors this, so a spec never reaches a half-applied batch.
for (const bad of [-1, 1.5, 1000001, 'off']) {
- const { sdk, calls } = freshSdk({ gate: '1', effective: '1', overrideRows: [{ value: '1' }] });
+ const { sdk, calls } = await freshSdk({ gate: '1', effective: '1', overrideRows: [{ value: '1' }] });
await assert.rejects(() => sdk.setAppAiFeatures(APP, { formFill: bad }, FAST), /must be a boolean or an integer/, `expected ${bad} to be rejected`);
assert.strictEqual(calls.filter((c) => c.method === 'POST').length, 0, `no write may be issued for ${bad}`);
}
@@ -199,7 +199,7 @@ test('REAL BUNDLE: an out-of-range or non-numeric value throws BEFORE any write
test('REAL BUNDLE: an empty appUniqueName throws rather than writing at ORGANIZATION scope', async () => {
// Silently omitting AppUniqueName changes the feature for the WHOLE environment. The plugin always
// passes appUniqueName(spec), but this is the backstop that makes a regression there loud.
- const { sdk, calls } = freshSdk({ gate: '1', effective: '1', overrideRows: [{ value: '1' }] });
+ const { sdk, calls } = await freshSdk({ gate: '1', effective: '1', overrideRows: [{ value: '1' }] });
await assert.rejects(() => sdk.setAppAiFeatures('', { formFill: true }, FAST), /non-empty appUniqueName/);
assert.strictEqual(calls.filter((c) => c.method === 'POST').length, 0);
});
@@ -208,7 +208,7 @@ test('REAL BUNDLE: the override proof is scoped to THIS app and THIS setting', a
// '2' (enabled), not '1' (disabled), for a `formFill: true` request — see the note above on the
// gate vs per-app encodings. Measured to behave identically; this only removes the contradiction
// between what the fixture says and what the request asks for.
- const { sdk, calls } = freshSdk({ gate: '2', effective: '2', overrideRows: [{ value: '2' }] });
+ const { sdk, calls } = await freshSdk({ gate: '2', effective: '2', overrideRows: [{ value: '2' }] });
await sdk.setAppAiFeatures(APP, { formFill: true }, FAST);
const proof = calls.find((c) => c.url.includes('/appsettings'));
assert.ok(proof, 'the override row must actually be queried');
@@ -230,7 +230,7 @@ test('REAL BUNDLE: the override proof is scoped to THIS app and THIS setting', a
test('REAL BUNDLE: a supplied appModuleId proves the override PRE-PUBLISH (app not yet listable)', async () => {
// `noApp: true` models the pre-publish reality: the by-name appmodule query returns NO rows.
// Without appModuleId this is unverifiable; with it, the proof succeeds.
- const { sdk } = freshSdk({ noApp: true, gate: '2', effective: '2', overrideRows: [{ value: '2' }] });
+ const { sdk } = await freshSdk({ noApp: true, gate: '2', effective: '2', overrideRows: [{ value: '2' }] });
const r = await sdk.setAppAiFeatures(APP, { formFill: true }, { ...FAST, appModuleId: APP_ID });
assert.deepStrictEqual(r.applied, ['formFill'], `expected applied, got ${JSON.stringify(r)}`);
assert.deepStrictEqual([r.notPersisted, r.unverified, r.failed], [[], [], []]);
@@ -240,7 +240,7 @@ test('REAL BUNDLE: a supplied appModuleId proves the override PRE-PUBLISH (app n
test('REAL BUNDLE: WITHOUT appModuleId the same pre-publish app cannot be proven (regression witness)', async () => {
// The behaviour the build worked around. Kept so a future SDK change that makes the by-name
// lookup work pre-publish is noticed here rather than silently making the option pointless.
- const { sdk } = freshSdk({ noApp: true, gate: '1', effective: '1', overrideRows: [{ value: '1' }] });
+ const { sdk } = await freshSdk({ noApp: true, gate: '1', effective: '1', overrideRows: [{ value: '1' }] });
const r = await sdk.setAppAiFeatures(APP, { formFill: true }, FAST);
assert.deepStrictEqual(r.applied, [], `a pre-publish app must not be provable by name: ${JSON.stringify(r)}`);
assert.ok(
@@ -252,7 +252,7 @@ test('REAL BUNDLE: WITHOUT appModuleId the same pre-publish app cannot be proven
test('REAL BUNDLE: a supplied appModuleId that DISAGREES with the published app is rejected, not trusted', async () => {
// Fail-closed identity check: if the app IS readable by name and resolves to a different id, the
// caller's id is stale/wrong and writing under it would configure the wrong app.
- const { sdk } = freshSdk({ gate: '1', effective: '1', overrideRows: [{ value: '1' }] });
+ const { sdk } = await freshSdk({ gate: '1', effective: '1', overrideRows: [{ value: '1' }] });
await assert.rejects(
() => sdk.setAppAiFeatures(APP, { formFill: true }, { ...FAST, appModuleId: '99999999-9999-9999-9999-999999999999' }),
/INVALID_ARGUMENT|different|mismatch/i
@@ -260,7 +260,7 @@ test('REAL BUNDLE: a supplied appModuleId that DISAGREES with the published app
});
test('REAL BUNDLE: a malformed appModuleId is rejected up front', async () => {
- const { sdk } = freshSdk({ gate: '1', effective: '1', overrideRows: [{ value: '1' }] });
+ const { sdk } = await freshSdk({ gate: '1', effective: '1', overrideRows: [{ value: '1' }] });
await assert.rejects(() => sdk.setAppAiFeatures(APP, { formFill: true }, { ...FAST, appModuleId: 'not-a-guid' }));
});
@@ -283,7 +283,7 @@ test('REAL BUNDLE: the boolean-to-numeric mapping is per-family, not a flat 1/0'
for (const [feature, want] of Object.entries(EXPECTED)) {
for (const [flag, expected] of [[true, want.onValue], [false, want.offValue]]) {
// Gate reported ON so the SDK writes in both directions (enabling is gated; disabling is not).
- const { sdk, calls } = freshSdk({ gate: '2', effective: '2', overrideRows: [{ appsettingid: 'a1', value: expected }] });
+ const { sdk, calls } = await freshSdk({ gate: '2', effective: '2', overrideRows: [{ appsettingid: 'a1', value: expected }] });
await sdk.setAppAiFeatures(APP, { [feature]: flag }, { appModuleId: APP_ID, verifyAttempts: 1, verifyDelayMs: 1 });
const save = calls.find((c) => c.method === 'POST' && /SaveSettingValue/i.test(c.url));
assert.ok(save, `${feature}=${flag}: a SaveSettingValue must be issued`);
@@ -296,7 +296,7 @@ test('REAL BUNDLE: the boolean-to-numeric mapping is per-family, not a flat 1/0'
test('REAL BUNDLE: disabling is NOT gated — a false is written even when the org gate is off', async () => {
// This asymmetry is why an incorrect `false` is the more damaging mistake: it always lands.
- const { sdk, calls } = freshSdk({ gate: '0', effective: '0', overrideRows: [{ appsettingid: 'a1', value: '1' }] });
+ const { sdk, calls } = await freshSdk({ gate: '0', effective: '0', overrideRows: [{ appsettingid: 'a1', value: '1' }] });
await sdk.setAppAiFeatures(APP, { formFill: false }, { appModuleId: APP_ID, verifyAttempts: 1, verifyDelayMs: 1 });
const save = calls.find((c) => c.method === 'POST' && /SaveSettingValue/i.test(c.url));
assert.ok(save, 'a disable must be written even with the gate off');
diff --git a/plugins/model-apps/scripts/tests/ai-preflight.test.js b/plugins/model-apps/scripts/tests/ai-preflight.test.js
index 8003f895f..5219d0529 100644
--- a/plugins/model-apps/scripts/tests/ai-preflight.test.js
+++ b/plugins/model-apps/scripts/tests/ai-preflight.test.js
@@ -100,7 +100,11 @@ function loadPreflightCli({ parseResult, readiness, sdkThrows = null }) {
if (id === 'node:os') return { tmpdir: () => 'D:\\Projects\\power-platform-skills-sdk\\.test-workspace' };
if (id === 'node:path') return path;
if (id === './vendor/cds-maker-sdk.cjs') {
- return {
+ return {
+ // The CLI builds its store explicitly via the /node adapter now, so the mocked bundle
+ // must expose it too. The marker carries the root so the assertions below can still
+ // check WHERE the throwaway workspace was placed.
+ createNodeWorkspaceStorage: (root) => ({ __mockWorkspaceRoot: root }),
createMakerSdk: (cfg) => {
events.push({ type: 'createMakerSdk', cfg });
if (sdkThrows) throw sdkThrows;
diff --git a/plugins/model-apps/scripts/tests/app-delete-real-bundle.test.js b/plugins/model-apps/scripts/tests/app-delete-real-bundle.test.js
index 2b902e746..2f78c84b7 100644
--- a/plugins/model-apps/scripts/tests/app-delete-real-bundle.test.js
+++ b/plugins/model-apps/scripts/tests/app-delete-real-bundle.test.js
@@ -96,8 +96,8 @@ function sitemapRow(opts = {}) {
* batchStatusFor - per-Content-ID status override for the batch response
* batchBody - replace the batch response body entirely (models an unparseable answer)
*/
-function freshSdk(opts = {}) {
- const { createMakerSdk } = require(BUNDLE);
+async function freshSdk(opts = {}) {
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'appdel-'));
tempDirs.push(dir);
const calls = [];
@@ -138,8 +138,8 @@ function freshSdk(opts = {}) {
return { status: 200, headers: {}, body: respBody };
};
}
- const sdk = createMakerSdk({ workspacePath: dir, instanceUrl: 'https://example.crm.dynamics.com', httpClient });
- sdk.initWorkspace();
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(dir), instanceUrl: 'https://example.crm.dynamics.com', httpClient });
+ await sdk.initWorkspace();
return { sdk, calls };
}
@@ -155,7 +155,7 @@ function deletedPaths(calls) {
}
test('REAL BUNDLE: deleting an app also deletes its sitemap row (the unique name is not burned)', async () => {
- const { sdk, calls } = freshSdk();
+ const { sdk, calls } = await freshSdk();
const r = await sdk.deleteAppCascade(APP_ID, APP_UNIQUE_ID);
const urls = deletedPaths(calls);
assert.ok(urls.some((u) => u.includes(`/appmodules(${APP_ID})`)), `app not deleted: ${JSON.stringify(urls)}`);
@@ -166,7 +166,7 @@ test('REAL BUNDLE: deleting an app also deletes its sitemap row (the unique name
test('REAL BUNDLE: both rows are deleted in ONE atomic $batch change set, never as two calls', async () => {
// The whole point of the atomic path: two sequential DELETEs can strand the sitemap if the
// process dies (or the second call fails) between them, which burns the unique name forever.
- const { sdk, calls } = freshSdk();
+ const { sdk, calls } = await freshSdk();
await sdk.deleteAppCascade(APP_ID, APP_UNIQUE_ID);
const b = batches(calls);
assert.strictEqual(b.length, 1, `expected exactly one $batch, got ${b.length}`);
@@ -184,7 +184,7 @@ test('REAL BUNDLE: both rows are deleted in ONE atomic $batch change set, never
test('REAL BUNDLE: the sitemap is resolved BEFORE the app delete, never after', async () => {
// Afterwards the `uniquename` -> sitemap link is unrecoverable, so ordering is the whole
// guarantee: read first, then destroy.
- const { sdk, calls } = freshSdk();
+ const { sdk, calls } = await freshSdk();
await sdk.deleteAppCascade(APP_ID, APP_UNIQUE_ID);
const sitemapLookup = calls.findIndex((c) => c.method === 'GET' && c.url.includes('/sitemaps'));
const appDelete = calls.findIndex(
@@ -199,7 +199,7 @@ test('REAL BUNDLE: an INCONCLUSIVE sitemap lookup refuses to delete the app (fai
// The dangerous case: the lookup fails transiently. Deleting anyway strands the sitemap and burns
// the name permanently, so the delete must not run on a guess. Teardown surfaces the rejection.
for (const opts of [{ appReadStatus: 503 }, { sitemapLookupStatus: 503 }]) {
- const { sdk, calls } = freshSdk(opts);
+ const { sdk, calls } = await freshSdk(opts);
await assert.rejects(() => sdk.deleteAppCascade(APP_ID, APP_UNIQUE_ID), `expected a rejection for ${JSON.stringify(opts)}`);
assert.ok(
!deletedPaths(calls).some((u) => u.includes('/appmodules(')),
@@ -211,7 +211,7 @@ test('REAL BUNDLE: an INCONCLUSIVE sitemap lookup refuses to delete the app (fai
test("REAL BUNDLE: a sitemap that no longer carries this app's unique name is NOT deleted", async () => {
// Ownership is name equality only. If the row was re-pointed between the read and the delete it
// belongs to a different app now, and destroying it would be cross-app data loss.
- const { sdk, calls } = freshSdk({ foreignSitemap: true });
+ const { sdk, calls } = await freshSdk({ foreignSitemap: true });
await assert.rejects(() => sdk.deleteAppCascade(APP_ID, APP_UNIQUE_ID), /no longer this app|APP_SITEMAP_UNRESOLVED/);
assert.strictEqual(deletedPaths(calls).length, 0, 'nothing may be deleted when ownership cannot be proven');
});
@@ -219,7 +219,7 @@ test("REAL BUNDLE: a sitemap that no longer carries this app's unique name is NO
test('REAL BUNDLE: an app read with no ETag refuses to delete (the DELETE cannot be made conditional)', async () => {
// Without an If-Match the delete is unconditional, so a row renamed or re-pointed between the
// read and the delete would be destroyed anyway. Refuse instead.
- const { sdk, calls } = freshSdk({ noAppEtag: true, noSitemap: true });
+ const { sdk, calls } = await freshSdk({ noAppEtag: true, noSitemap: true });
await assert.rejects(() => sdk.deleteAppCascade(APP_ID, APP_UNIQUE_ID), /ETag|APP_SITEMAP_UNRESOLVED/);
assert.strictEqual(deletedPaths(calls).length, 0, 'nothing may be deleted without a concurrency token');
});
@@ -227,7 +227,7 @@ test('REAL BUNDLE: an app read with no ETag refuses to delete (the DELETE cannot
test('REAL BUNDLE: an HttpClient without postRaw REFUSES the delete rather than doing it non-atomically', async () => {
// This is why lib/sdk-http-client.js must implement postRaw: the SDK does NOT silently degrade
// to two sequential deletes. A plugin transport missing postRaw breaks teardown outright.
- const { sdk, calls } = freshSdk({ omitPostRaw: true });
+ const { sdk, calls } = await freshSdk({ omitPostRaw: true });
await assert.rejects(() => sdk.deleteAppCascade(APP_ID, APP_UNIQUE_ID), /APP_DELETE_NOT_ATOMIC|atomic/);
assert.strictEqual(deletedPaths(calls).length, 0, 'a non-atomic fallback delete must never happen');
});
@@ -235,18 +235,18 @@ test('REAL BUNDLE: an HttpClient without postRaw REFUSES the delete rather than
test('REAL BUNDLE: a failed operation INSIDE the change set is not reported as a successful delete', async () => {
// The batch envelope can return 200 while an embedded operation failed; reading only the outer
// status would report a delete that never happened.
- const { sdk } = freshSdk({ batchStatusFor: (id) => (id === '2' ? 400 : 204) });
+ const { sdk } = await freshSdk({ batchStatusFor: (id) => (id === '2' ? 400 : 204) });
await assert.rejects(() => sdk.deleteAppCascade(APP_ID, APP_UNIQUE_ID));
});
test('REAL BUNDLE: an unparseable batch response is treated as UNKNOWN, not as success', async () => {
// A 200 with a body that is not a multipart envelope proves nothing about what the server did.
- const { sdk } = freshSdk({ batchBody: 'OK' });
+ const { sdk } = await freshSdk({ batchBody: 'OK' });
await assert.rejects(() => sdk.deleteAppCascade(APP_ID, APP_UNIQUE_ID));
});
test('REAL BUNDLE: an app that owns no sitemap still deletes cleanly', async () => {
- const { sdk, calls } = freshSdk({ noSitemap: true });
+ const { sdk, calls } = await freshSdk({ noSitemap: true });
const r = await sdk.deleteAppCascade(APP_ID, APP_UNIQUE_ID);
assert.ok(deletedPaths(calls).some((u) => u.includes(`/appmodules(${APP_ID})`)), 'the app is still deleted');
assert.ok(r.success, `cascade reported failure: ${JSON.stringify(r.failures)}`);
@@ -258,7 +258,7 @@ test('REAL BUNDLE: an app that owns no sitemap still deletes cleanly', async ()
// plugin ships, so a transport bug (re-serializing the payload, JSON-parsing the response, or
// dropping the boundary Content-Type) fails HERE instead of live during a teardown.
test('REAL BUNDLE + REAL TRANSPORT: the plugin HttpClient satisfies the SDK atomic-delete contract', async () => {
- const { createMakerSdk } = require(BUNDLE);
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'appdel-'));
tempDirs.push(dir);
const wire = [];
@@ -273,8 +273,8 @@ test('REAL BUNDLE + REAL TRANSPORT: the plugin HttpClient satisfies the SDK atom
return { statusCode: 200, headers: {}, body: JSON.stringify({ value: [] }) };
};
const httpClient = createAzHttpClient('https://example.crm.dynamics.com', { getToken: () => 'TOK', request });
- const sdk = createMakerSdk({ workspacePath: dir, instanceUrl: 'https://example.crm.dynamics.com', httpClient });
- sdk.initWorkspace();
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(dir), instanceUrl: 'https://example.crm.dynamics.com', httpClient });
+ await sdk.initWorkspace();
const r = await sdk.deleteAppCascade(APP_ID, APP_UNIQUE_ID);
assert.ok(r.success, `cascade reported failure: ${JSON.stringify(r.failures)}`);
diff --git a/plugins/model-apps/scripts/tests/app-entity-components-real-bundle.test.js b/plugins/model-apps/scripts/tests/app-entity-components-real-bundle.test.js
index a9ad5e0ee..a21944df7 100644
--- a/plugins/model-apps/scripts/tests/app-entity-components-real-bundle.test.js
+++ b/plugins/model-apps/scripts/tests/app-entity-components-real-bundle.test.js
@@ -67,8 +67,8 @@ function specFor(tables) {
* componentStatus - HTTP status for the component read-back
* noAppUnique - the app read returns no `appmoduleidunique`
*/
-function freshSdk(tables, opts = {}) {
- const { createMakerSdk } = require(BUNDLE);
+async function freshSdk(tables, opts = {}) {
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'entcomp-'));
tempDirs.push(dir);
const reqs = [];
@@ -103,14 +103,14 @@ function freshSdk(tables, opts = {}) {
delete: async () => ({ status: 204, headers: {}, body: {} }),
put: async () => ({ status: 204, headers: {}, body: {} }),
};
- const sdk = createMakerSdk({ workspacePath: dir, instanceUrl: 'https://example.crm.dynamics.com', httpClient });
- sdk.initWorkspace();
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(dir), instanceUrl: 'https://example.crm.dynamics.com', httpClient });
+ await sdk.initWorkspace();
return { sdk, reqs };
}
async function pushApp(sdk, tables) {
const def = appDef(specFor(tables), { forms: {}, views: {}, charts: {}, dashboards: {} });
- const art = sdk.createArtifact('app', { name: def.name, uniqueName: 'contoso_customermanagement', description: '', siteMap: def.siteMap, components: def.components, iconWebResourceId: APP_ICON_ID });
+ const art = await sdk.createArtifact('app', { name: def.name, uniqueName: 'contoso_customermanagement', description: '', siteMap: def.siteMap, components: def.components, iconWebResourceId: APP_ICON_ID });
return sdk.pushArtifact('app', art.id);
}
const addComponentsCall = (reqs) => reqs.find((r) => r.method === 'POST' && /AddAppComponents/i.test(r.url));
@@ -119,7 +119,7 @@ test('REAL BUNDLE: sitemap tables are pinned as OData REFERENCES, never as `enti
// The regression that shipped: an `@odata.type` instance payload naming the `entity` table pinned
// the metadata table itself, producing `schemaName="entity"` in the export.
const tables = ['account', 'contact', 'activitypointer'];
- const { sdk, reqs } = freshSdk(tables);
+ const { sdk, reqs } = await freshSdk(tables);
await pushApp(sdk, tables);
const call = addComponentsCall(reqs);
assert.ok(call, 'AddAppComponents must be called');
@@ -139,7 +139,7 @@ test('REAL BUNDLE: every declared table is pinned — none is silently dropped',
// explicable as one having been dropped before the call. N components must produce N rows;
// AddAppComponents does not de-duplicate.
const tables = ['account', 'contact', 'activitypointer'];
- const { sdk, reqs } = freshSdk(tables);
+ const { sdk, reqs } = await freshSdk(tables);
await pushApp(sdk, tables);
const comps = addComponentsCall(reqs).body.Components || [];
const refs = comps.map((c) => c['@odata.id']).filter(Boolean);
@@ -151,7 +151,7 @@ test('REAL BUNDLE: an UNRESOLVABLE table refuses the whole push rather than pinn
// "the rest" would leave nav pointing at a table the app does not contain. The refusal must NAME
// the table so the message is actionable.
const tables = ['account', 'contact'];
- const { sdk, reqs } = freshSdk(tables, { unresolvable: 'contact' });
+ const { sdk, reqs } = await freshSdk(tables, { unresolvable: 'contact' });
await assert.rejects(() => pushApp(sdk, tables), (e) => {
assert.ok(/contact/.test(e.message), `the refusal must name the table: ${e.message}`);
return true;
@@ -164,7 +164,7 @@ test('REAL BUNDLE: components are READ BACK and a missing one fails, even though
// A 2xx says the request was accepted, not which rows it wrote. Model a platform that accepts the
// write and stores only one of the two tables.
const tables = ['account', 'contact'];
- const { sdk } = freshSdk(tables, { componentRows: [{ objectid: META.account, componenttype: 1 }] });
+ const { sdk } = await freshSdk(tables, { componentRows: [{ objectid: META.account, componenttype: 1 }] });
await assert.rejects(() => pushApp(sdk, tables), (e) => {
assert.ok(/contact/.test(e.message), `the failure must name the missing table: ${e.message}`);
return true;
@@ -177,7 +177,7 @@ test('REAL BUNDLE: the exact 6612527 corruption is caught — components present
// carry the `entity` table's MetadataId instead of account's/contact's.
const ENTITY_TABLE_META = 'eeeeeeee-0000-0000-0000-00000000000e';
const tables = ['account', 'contact'];
- const { sdk } = freshSdk(tables, {
+ const { sdk } = await freshSdk(tables, {
componentRows: [
{ objectid: ENTITY_TABLE_META, componenttype: 1 },
{ objectid: ENTITY_TABLE_META, componenttype: 1 },
@@ -192,7 +192,7 @@ test('REAL BUNDLE: the exact 6612527 corruption is caught — components present
test('REAL BUNDLE: an INCONCLUSIVE read-back fails closed (cannot check is not fine)', async () => {
for (const opts of [{ componentStatus: 503 }, { noAppUnique: true }]) {
const tables = ['account'];
- const { sdk } = freshSdk(tables, opts);
+ const { sdk } = await freshSdk(tables, opts);
await assert.rejects(() => pushApp(sdk, tables), `expected a refusal for ${JSON.stringify(opts)}`);
}
});
@@ -200,13 +200,13 @@ test('REAL BUNDLE: an INCONCLUSIVE read-back fails closed (cannot check is not f
test('REAL BUNDLE: an app with no sitemap tables neither pins nor verifies (no phantom work)', async () => {
// A page-only app has nothing to pin; the verification must not invent a failure, and the SDK
// should not spend a network call on an empty component list.
- const { sdk, reqs } = freshSdk([]);
+ const { sdk, reqs } = await freshSdk([]);
const def = appDef(
{ solution: { uniqueName: 'EntCompB', publisherPrefix: 'contoso' }, app: { name: 'Pageless', description: '' }, entities: [],
appShell: { areas: [{ label: 'Main', groups: [{ label: 'G', subAreas: [{ url: 'https://x/y', title: 'Link' }] }] }] } },
{ forms: {}, views: {}, charts: {}, dashboards: {} }
);
- const art = sdk.createArtifact('app', { name: def.name, uniqueName: 'contoso_pageless', description: '', siteMap: def.siteMap, components: def.components, iconWebResourceId: APP_ICON_ID });
+ const art = await sdk.createArtifact('app', { name: def.name, uniqueName: 'contoso_pageless', description: '', siteMap: def.siteMap, components: def.components, iconWebResourceId: APP_ICON_ID });
await assert.doesNotReject(sdk.pushArtifact('app', art.id));
const call = addComponentsCall(reqs);
const refs = call ? (call.body.Components || []).filter((c) => c['@odata.id']) : [];
diff --git a/plugins/model-apps/scripts/tests/artifact-descriptions.test.js b/plugins/model-apps/scripts/tests/artifact-descriptions.test.js
index 7fdf01f7d..a89df6daf 100644
--- a/plugins/model-apps/scripts/tests/artifact-descriptions.test.js
+++ b/plugins/model-apps/scripts/tests/artifact-descriptions.test.js
@@ -236,8 +236,8 @@ test('app.description may be empty (legacy shape) but a new surface may not', ()
const dirs = [];
test.after(() => { for (const d of dirs) fs.rmSync(d, { recursive: true, force: true }); });
-function sdkWithCapture() {
- const { createMakerSdk } = require(BUNDLE);
+async function sdkWithCapture() {
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'desc-'));
dirs.push(dir);
const writes = [];
@@ -252,8 +252,8 @@ function sdkWithCapture() {
put: async () => ({ status: 204, headers: {}, body: {} }),
delete: async () => ({ status: 204, headers: {}, body: {} }),
};
- const sdk = createMakerSdk({ workspacePath: dir, instanceUrl: 'https://contoso.crm.dynamics.com', httpClient });
- sdk.initWorkspace();
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(dir), instanceUrl: 'https://contoso.crm.dynamics.com', httpClient });
+ await sdk.initWorkspace();
return { sdk, writes };
}
@@ -267,13 +267,30 @@ test('REAL BUNDLE: description survives to the wire for every artifact we set it
chart: { name: 'C', description: MARK, entityLogicalName: 'account', chartType: 'Column', isDefault: false, series: [{ field: 'name', aggregate: 'count' }], categories: [{ field: 'name' }] },
form: { name: 'F', description: MARK, entityLogicalName: 'account', formType: 'main', status: 'draft' },
dashboard: { name: 'D', description: MARK },
- businessRule: { name: 'BR', description: MARK, entityLogicalName: 'account', scope: 'Entity', status: 'Draft' },
+ // ⚠ This rule must be COMPLETE — one condition and one action. It used to be a bare
+ // `{ name, description, entityLogicalName, scope, status }`, which worked only because the SDK
+ // would happily push a rule with no clauses and no actions. It no longer will: the designer's
+ // completeness validator runs on every save, so a skeleton rule is refused and NOTHING reaches
+ // the wire — making this test fail for a reason that has nothing to do with descriptions.
+ //
+ // The distinction matters: that was FIXTURE damage, not product damage. A rule the designer
+ // itself would refuse to save is not a case this test ever meant to cover.
+ businessRule: businessRuleDef({
+ name: 'BR', description: MARK, entity: 'account',
+ conditions: [{ field: 'name', operator: 'Equals', value: 'x', dataType: 'String' }],
+ actions: [{ type: 'SetVisibility', field: 'name', visible: false }],
+ }),
app: { name: 'A', uniqueName: 'cr_descapp', description: MARK, iconWebResourceId: '11111111-1111-1111-1111-111111111111' },
};
for (const [type, def] of Object.entries(cases)) {
- const { sdk, writes } = sdkWithCapture();
- const art = sdk.createArtifact(type, def);
+ const { sdk, writes } = await sdkWithCapture();
+ const art = await sdk.createArtifact(type, def);
assert.strictEqual(art.description, MARK, `${type}: the typed surface keeps description`);
+ // A business rule carries its condition tree through the generic element surface, not the
+ // create payload — mirroring how the build authors one.
+ if (type === 'businessRule') {
+ await sdk.updateElement('businessRule', art.id, '/rootCondition', def.rootCondition);
+ }
// The push may fail late (the fake client returns no usable id); the write we care about has
// already been recorded by then, so the outcome of the push is deliberately not asserted.
try { await sdk.pushArtifact(type, art.id); } catch { /* payload already captured */ }
@@ -283,11 +300,11 @@ test('REAL BUNDLE: description survives to the wire for every artifact we set it
// ------------------------------------------------------------------ 5. the two deliberate exclusions
-test('REAL BUNDLE: a command does NOT accept a description — so the build never sends one', () => {
+test('REAL BUNDLE: a command does NOT accept a description — so the build never sends one', async () => {
// Pins why `commands[]` is absent from everything above. If a future bundle adds it, this fails
// and the omission gets revisited on purpose instead of staying an unexplained gap.
- const { sdk } = sdkWithCapture();
- const art = sdk.createArtifact('command', { name: 'CMD', description: 'ignored', entityLogicalName: 'account', buttons: [] });
+ const { sdk } = await sdkWithCapture();
+ const art = await sdk.createArtifact('command', { name: 'CMD', description: 'ignored', entityLogicalName: 'account', buttons: [] });
assert.ok(!('description' in art), 'the command surface drops description; wiring one would be inert');
});
@@ -301,7 +318,7 @@ test('REAL BUNDLE: a view accepts /description as an updateElement pointer, and
// A re-vendor that changed either would otherwise go green. AGENTS.md treats re-vendoring as a
// normal operation, so this is pinned here rather than assumed.
const ID = '33333333-3333-3333-3333-333333333333';
- const { createMakerSdk } = require(BUNDLE);
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'view496-'));
dirs.push(dir);
const writes = [];
@@ -315,7 +332,7 @@ test('REAL BUNDLE: a view accepts /description as an updateElement pointer, and
+ '<row name="result" id="new_itemid"><cell name="new_name" width="150"/></row></grid>',
};
const sdk = createMakerSdk({
- workspacePath: dir,
+ workspaceStorage: createNodeWorkspaceStorage(dir),
instanceUrl: 'https://contoso.crm.dynamics.com',
httpClient: {
get: async (url) => (/savedqueries\(/.test(String(url))
@@ -327,7 +344,7 @@ test('REAL BUNDLE: a view accepts /description as an updateElement pointer, and
delete: async () => ({ status: 204, headers: {}, body: {} }),
},
});
- sdk.initWorkspace();
+ await sdk.initWorkspace();
await sdk.fetchArtifact('view', ID);
const fetched = await sdk.getArtifact('view', ID);
@@ -350,13 +367,13 @@ const AUTHOR_PROSE = 'Handles field work orders end to end.';
// * each entity's privilege must have a DISTINCT PrivilegeId, or the SDK refuses the role with
// "share the Dataverse privilege ... but request different scopes" (the persona's own table is
// user-scoped while the injected `appmodule` read is organization-scoped).
-function roleSdk() {
- const { createMakerSdk } = require(BUNDLE);
+async function roleSdk() {
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'role-'));
dirs.push(dir);
const calls = [];
const sdk = createMakerSdk({
- workspacePath: dir,
+ workspaceStorage: createNodeWorkspaceStorage(dir),
instanceUrl: 'https://contoso.crm.dynamics.com',
httpClient: {
get: async (url) => {
@@ -377,7 +394,7 @@ function roleSdk() {
delete: async () => ({ status: 204, headers: {}, body: {} }),
},
});
- sdk.initWorkspace();
+ await sdk.initWorkspace();
return { sdk, calls };
}
@@ -397,7 +414,7 @@ test('a persona NEVER sends a description — it would break the SDK ownership g
// of this guard asserted the literal `description:It.SDK_ROLE_MARKER`, where `It` is a namespace
// alias the MINIFIER assigns — it became `Pt` on the next re-vendor and the test failed for a
// reason that had nothing to do with the behaviour it was protecting. Drive the call instead.
- const { sdk, calls } = roleSdk();
+ const { sdk, calls } = await roleSdk();
await sdk.createPersonaRole(spec);
const create = calls.find((c) => c.verb === 'POST' && /\/roles$/.test(String(c.url)));
diff --git a/plugins/model-apps/scripts/tests/build-model-app.test.js b/plugins/model-apps/scripts/tests/build-model-app.test.js
index 370f124bc..b2de53a56 100644
--- a/plugins/model-apps/scripts/tests/build-model-app.test.js
+++ b/plugins/model-apps/scripts/tests/build-model-app.test.js
@@ -612,7 +612,9 @@ test('makeSdk\u2019s return shape and main\u2019s destructure stay in agreement'
const src = fs.readFileSync(path.join(__dirname, '..', 'build-model-app.js'), 'utf8');
const returned = /return \{ ([^}]*) \};/.exec(src.slice(src.indexOf('function makeSdk')));
assert.ok(returned, 'expected makeSdk to return an object literal');
- const destructured = /const \{ ([^}]*) \} = makeSdk\(/.exec(src);
+ // `await` is optional in the pattern: `makeSdk` became async when the SDK's workspace calls did,
+ // and this guard is about the KEY SETS agreeing, not about how the promise is unwrapped.
+ const destructured = /const \{ ([^}]*) \} = (?:await\s+)?makeSdk\(/.exec(src);
assert.ok(destructured, 'expected main to destructure makeSdk()');
const names = (s) => s.split(',').map((x) => x.trim()).filter(Boolean).sort();
assert.deepStrictEqual(names(destructured[1]), names(returned[1]),
diff --git a/plugins/model-apps/scripts/tests/business-process-flows.test.js b/plugins/model-apps/scripts/tests/business-process-flows.test.js
index 038a0f85b..1e75abd03 100644
--- a/plugins/model-apps/scripts/tests/business-process-flows.test.js
+++ b/plugins/model-apps/scripts/tests/business-process-flows.test.js
@@ -141,8 +141,8 @@ test('REAL BUNDLE: the derived uniquename really does ignore the table and the p
// that drifts would silently stop catching the collision it exists to catch.
const { bpfUniqueName } = require('../lib/app-spec.js');
for (const [name, entity] of [['Ticket Handling', 'new_ticket'], ['ticket-handling', 'new_case'], ['!!!', 'new_ticket']]) {
- const { sdk, writes } = realSdk();
- const art = sdk.createArtifact('bpf', bpfDef({ name, entity, status: 'Draft', stages: [{ name: 'S', steps: [{ name: 'P' }] }] }));
+ const { sdk, writes } = await realSdk();
+ const art = await sdk.createArtifact('bpf', bpfDef({ name, entity, status: 'Draft', stages: [{ name: 'S', steps: [{ name: 'P' }] }] }));
await sdk.pushArtifact('bpf', art.id);
const post = writes.find((w) => w.verb === 'POST' && /\/workflows$/.test(w.url));
assert.strictEqual(post.body.uniquename, bpfUniqueName(name), `${name} on ${entity}`);
@@ -293,13 +293,13 @@ test('every BPF query in build, verify and teardown goes through bpfFilter', ()
// --- 3. real bundle -----------------------------------------------------------------------------
-function realSdk() {
+async function realSdk() {
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'bpf-'));
dirs.push(dir);
const writes = [];
- const { createMakerSdk } = require(BUNDLE);
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const sdk = createMakerSdk({
- workspacePath: dir, instanceUrl: 'https://contoso.crm.dynamics.com',
+ workspaceStorage: createNodeWorkspaceStorage(dir), instanceUrl: 'https://contoso.crm.dynamics.com',
httpClient: {
get: async () => ({ status: 200, headers: {}, body: { value: [] } }),
post: async (url, body) => { writes.push({ verb: 'POST', url: String(url), body }); return { status: 200, headers: {}, body: { workflowid: '44444444-4444-4444-4444-444444444444' } }; },
@@ -308,7 +308,7 @@ function realSdk() {
delete: async () => ({ status: 204, headers: {}, body: {} }),
},
});
- sdk.initWorkspace();
+ await sdk.initWorkspace();
return { sdk, writes };
}
@@ -316,8 +316,8 @@ test('REAL BUNDLE: a BPF is authored through the generic artifact lifecycle', as
// There is no dedicated BPF method on the SDK surface — it is createArtifact -> pushArtifact, and
// the whole stage/step tree rides on the create payload (unlike a business rule's condition tree,
// which needs an updateElement). Pinning that tells a future implementer which surface to build on.
- const { sdk } = realSdk();
- const art = sdk.createArtifact('bpf', bpfDef(FLOW));
+ const { sdk } = await realSdk();
+ const art = await sdk.createArtifact('bpf', bpfDef(FLOW));
assert.ok(art && art.id, 'createArtifact returns an artifact with an id');
assert.deepStrictEqual(Object.keys(art).sort(), ['entityLogicalName', 'id', 'name', 'stages', 'status']);
// The adapter stamps ids on stages and steps; the plugin deliberately does not mint them.
@@ -329,8 +329,8 @@ test('REAL BUNDLE: a BPF is authored through the generic artifact lifecycle', as
});
test('REAL BUNDLE: the wire payload is a category-4 BusinessFlow definition carrying the stages', async () => {
- const { sdk, writes } = realSdk();
- const art = sdk.createArtifact('bpf', bpfDef({ ...FLOW, status: 'Draft', description: 'd' }));
+ const { sdk, writes } = await realSdk();
+ const art = await sdk.createArtifact('bpf', bpfDef({ ...FLOW, status: 'Draft', description: 'd' }));
await sdk.pushArtifact('bpf', art.id);
const post = writes.find((w) => w.verb === 'POST' && /\/workflows$/.test(w.url));
@@ -357,8 +357,8 @@ test('REAL BUNDLE: the wire payload is a category-4 BusinessFlow definition carr
test('REAL BUNDLE: an Active flow is activated in the same push (statecode 1 / statuscode 2)', async () => {
// Activation is a SECOND, non-atomic request. It is what makes the process appear on the form, so
// a re-vendor that stopped issuing it would deploy flows nobody can see.
- const { sdk, writes } = realSdk();
- const art = sdk.createArtifact('bpf', bpfDef({ ...FLOW, status: 'Active' }));
+ const { sdk, writes } = await realSdk();
+ const art = await sdk.createArtifact('bpf', bpfDef({ ...FLOW, status: 'Active' }));
await sdk.pushArtifact('bpf', art.id);
const patch = writes.find((w) => w.verb === 'PATCH' && /workflows\(/.test(w.url));
assert.ok(patch, `an activation PATCH must follow the create; got ${JSON.stringify(writes.map((w) => w.verb + ' ' + w.url))}`);
@@ -366,8 +366,8 @@ test('REAL BUNDLE: an Active flow is activated in the same push (statecode 1 / s
});
test('REAL BUNDLE: a Draft flow is NOT activated', async () => {
- const { sdk, writes } = realSdk();
- const art = sdk.createArtifact('bpf', bpfDef({ ...FLOW, status: 'Draft' }));
+ const { sdk, writes } = await realSdk();
+ const art = await sdk.createArtifact('bpf', bpfDef({ ...FLOW, status: 'Draft' }));
await sdk.pushArtifact('bpf', art.id);
assert.strictEqual(writes.some((w) => w.verb === 'PATCH'), false, 'Draft must not be activated');
});
@@ -381,8 +381,8 @@ test('REAL BUNDLE: XML carrying character data still parses (the headless text-n
//
// This asserts the SHIPPED bundle is fixed. A re-vendor that reintroduces it fails here rather
// than in a user's build.
- const { sdk } = realSdk();
- const art = sdk.createArtifact('bpf', bpfDef(FLOW));
+ const { sdk } = await realSdk();
+ const art = await sdk.createArtifact('bpf', bpfDef(FLOW));
await assert.doesNotReject(() => sdk.pushArtifact('bpf', art.id));
});
diff --git a/plugins/model-apps/scripts/tests/business-rule-real-bundle.test.js b/plugins/model-apps/scripts/tests/business-rule-real-bundle.test.js
index 87ce43002..cecc69541 100644
--- a/plugins/model-apps/scripts/tests/business-rule-real-bundle.test.js
+++ b/plugins/model-apps/scripts/tests/business-rule-real-bundle.test.js
@@ -41,8 +41,8 @@ const fs = require('node:fs');
const BUNDLE = path.resolve(__dirname, '..', 'vendor', 'cds-maker-sdk.cjs');
const dirs = [];
-function sdkWithCapture() {
- const { createMakerSdk } = require(BUNDLE);
+async function sdkWithCapture() {
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'br-'));
dirs.push(dir);
const writes = [];
@@ -56,16 +56,16 @@ function sdkWithCapture() {
put: async () => ({ status: 204, headers: {}, body: {} }),
delete: async () => ({ status: 204, headers: {}, body: {} }),
};
- const sdk = createMakerSdk({ workspacePath: dir, instanceUrl: 'https://contoso.crm.dynamics.com', httpClient });
- sdk.initWorkspace();
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(dir), instanceUrl: 'https://contoso.crm.dynamics.com', httpClient });
+ await sdk.initWorkspace();
return { sdk, writes };
}
// "IF account.name equals 'x' THEN hide fax" — the smallest rule that is actually meaningful.
// A rule with a null rootCondition is what the server rejected live, so the fixture is deliberately
// a complete one: condition + clause + a true-branch action.
-function authorRule(sdk) {
- const art = sdk.createArtifact('businessRule', {
+async function authorRule(sdk) {
+ const art = await sdk.createArtifact('businessRule', {
name: 'Contract Rule', entityLogicalName: 'account', scope: 'Entity', status: 'Draft',
});
return { art, condition: {
@@ -82,8 +82,8 @@ test('REAL BUNDLE: a business rule is authored through the generic artifact life
// There is no dedicated business-rule API on MakerSdkApi — it is createArtifact -> updateElement
// -> pushArtifact, like every other artifact. Pinning that is what tells a future implementer
// which surface to build against.
- const { sdk } = sdkWithCapture();
- const { art, condition } = authorRule(sdk);
+ const { sdk } = await sdkWithCapture();
+ const { art, condition } = await authorRule(sdk);
assert.ok(art && art.id, 'createArtifact returns an artifact with an id');
assert.deepStrictEqual(
Object.keys(art).sort(),
@@ -101,8 +101,8 @@ test('REAL BUNDLE: a business rule is authored through the generic artifact life
test('REAL BUNDLE: the push targets the BOUND CreateProcessWithWfomJson action', async () => {
// The boundness matters twice over: it is why an unbound probe 404s and proves nothing, and a
// re-vendor that switched to an unbound or renamed endpoint would silently 404 at build time.
- const { sdk, writes } = sdkWithCapture();
- const { art, condition } = authorRule(sdk);
+ const { sdk, writes } = await sdkWithCapture();
+ const { art, condition } = await authorRule(sdk);
await sdk.updateElement('businessRule', art.id, '/rootCondition', condition);
await sdk.pushArtifact('businessRule', art.id);
@@ -118,8 +118,8 @@ test('REAL BUNDLE: the SDK compiles typed input into server WfomJson (not a pass
// The whole value of the typed surface is that a caller writes a condition tree and the SDK emits
// the server's workflow-object-model JSON. If it ever became a passthrough, callers would have to
// hand-write WfomJson — a silent, very expensive contract change.
- const { sdk, writes } = sdkWithCapture();
- const { art, condition } = authorRule(sdk);
+ const { sdk, writes } = await sdkWithCapture();
+ const { art, condition } = await authorRule(sdk);
await sdk.updateElement('businessRule', art.id, '/rootCondition', condition);
await sdk.pushArtifact('businessRule', art.id);
@@ -155,8 +155,8 @@ test('REAL BUNDLE: the SDK compiles typed input into server WfomJson (not a pass
test('REAL BUNDLE: an invalid condition is rejected at authoring time, not at the server', async () => {
// Local validation is what turns "HTTP 400: An unexpected error occurred" — which is exactly what
// the server returns for a malformed rule — into an actionable message. Verify it actually fires.
- const { sdk } = sdkWithCapture();
- const { art } = authorRule(sdk);
+ const { sdk } = await sdkWithCapture();
+ const { art } = await authorRule(sdk);
await assert.rejects(
async () => await sdk.updateElement('businessRule', art.id, '/rootCondition', {
id: 'c1', displayName: '', logic: 'XOR', clauses: [], trueBranch: [], falseBranch: [],
diff --git a/plugins/model-apps/scripts/tests/business-rules.test.js b/plugins/model-apps/scripts/tests/business-rules.test.js
index 39325080b..4ece2cdad 100644
--- a/plugins/model-apps/scripts/tests/business-rules.test.js
+++ b/plugins/model-apps/scripts/tests/business-rules.test.js
@@ -136,8 +136,12 @@ test('businessRuleDef maps onto the SDK node shape (clauses + trueBranch), not t
assert.strictEqual(rc.logic, 'AND');
// The keys that matter. `thenActions`/`lhs`/`rhs` would be merged and ignored.
assert.deepStrictEqual(Object.keys(rc).sort(), ['clauses', 'displayName', 'falseBranch', 'id', 'logic', 'trueBranch']);
+ // `valueWorkflowType` is the SDK's WorkflowAttributeType ENUM VALUE, not the App Spec's token:
+ // 'Picklist' -> '10'. The SDK forwards this field verbatim into the serialized expression, and the
+ // enum has no 'Picklist' member, so emitting the token would put an out-of-domain value on the
+ // wire. See workflowAttributeType() in sdk-build.js.
assert.deepStrictEqual(rc.clauses, [{
- id: 'c1', field: 'new_status', operator: 'Equals', valueType: 'Value', value: '100000001', valueWorkflowType: 'Picklist',
+ id: 'c1', field: 'new_status', operator: 'Equals', valueType: 'Value', value: '100000001', valueWorkflowType: '10',
}]);
assert.deepStrictEqual(rc.trueBranch.map((a) => [a.type, a.field, a.visible ?? a.lock ?? a.required ?? a.value]), [
['SetVisibility', 'new_notes', false],
@@ -160,12 +164,12 @@ test('a presence operator still MAPS correctly (the mapper is fine; the platform
// --- 3. real bundle ---------------------------------------------------------------------------
test('REAL BUNDLE: the mapped rule reaches the wire as WfomJson naming the authored columns', async () => {
- const { createMakerSdk } = require(BUNDLE);
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'br-spec-'));
dirs.push(dir);
const calls = [];
const sdk = createMakerSdk({
- workspacePath: dir, instanceUrl: 'https://contoso.crm.dynamics.com',
+ workspaceStorage: createNodeWorkspaceStorage(dir), instanceUrl: 'https://contoso.crm.dynamics.com',
httpClient: {
get: async () => ({ status: 200, headers: {}, body: { value: [] } }),
post: async (url, body) => {
@@ -177,10 +181,10 @@ test('REAL BUNDLE: the mapped rule reaches the wire as WfomJson naming the autho
delete: async () => ({ status: 204, headers: {}, body: {} }),
},
});
- sdk.initWorkspace();
+ await sdk.initWorkspace();
const def = businessRuleDef(RULE);
- const art = sdk.createArtifact('businessRule', def);
+ const art = await sdk.createArtifact('businessRule', def);
await sdk.updateElement('businessRule', art.id, '/rootCondition', def.rootCondition);
const pushed = await sdk.pushArtifact('businessRule', art.id);
assert.strictEqual(pushed.saved, true);
@@ -205,14 +209,14 @@ test('REAL BUNDLE: a valueless operator emits an EMPTY operand list and the IsNu
// and would silently answer false for a populated column.
//
// Measured opcodes (WorkflowConditionOperator in the bundle): NotNull "1", IsNull "0".
- const { createMakerSdk } = require(BUNDLE);
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'br-null-'));
dirs.push(dir);
for (const [operator, expectedOpcode] of [['ContainsData', '1'], ['DoesNotContainData', '0']]) {
const calls = [];
const sdk = createMakerSdk({
- workspacePath: fs.mkdtempSync(path.join(dir, 'w')), instanceUrl: 'https://contoso.crm.dynamics.com',
+ workspaceStorage: createNodeWorkspaceStorage(fs.mkdtempSync(path.join(dir, 'w'))), instanceUrl: 'https://contoso.crm.dynamics.com',
httpClient: {
get: async () => ({ status: 200, headers: {}, body: { value: [] } }),
post: async (url, body) => {
@@ -224,14 +228,14 @@ test('REAL BUNDLE: a valueless operator emits an EMPTY operand list and the IsNu
delete: async () => ({ status: 204, headers: {}, body: {} }),
},
});
- sdk.initWorkspace();
+ await sdk.initWorkspace();
const def = businessRuleDef({
name: 'Presence Rule', entity: 'new_ticket',
conditions: [{ field: 'new_notes', operator }],
actions: [{ type: 'SetVisibility', field: 'new_owner', visible: false }],
});
- const art = sdk.createArtifact('businessRule', def);
+ const art = await sdk.createArtifact('businessRule', def);
await sdk.updateElement('businessRule', art.id, '/rootCondition', def.rootCondition);
await sdk.pushArtifact('businessRule', art.id);
@@ -248,34 +252,56 @@ test('REAL BUNDLE: a valueless operator emits an EMPTY operand list and the IsNu
// --- peer-review findings: verified and fixed ---------------------------------------------------
-test('REAL BUNDLE: dataType does NOT reach the wire — the SDK types every literal as String', async () => {
- // `dataType` used to be pinned against the XAML compiler's literal-type map. This uptake DELETED
- // that compiler, and the JSON path that replaced it does not consult the type at all: measured
- // across all 13 tokens the spec accepts (plus a made-up one), on BOTH the condition path and the
- // SetFieldValue action path, the SDK emits WorkflowAttributeType String ("14") every time.
+test('REAL BUNDLE: dataType maps to a WorkflowAttributeType on CONDITIONS and is ignored on SetFieldValue ACTIONS', async () => {
+ // ⚠ THIS TEST WAS REWRITTEN TWICE BY MEASUREMENT, which is precisely why it existed.
//
- // `let r = valueType==='Lookup' ? ... : valueType==='Clear' ? (valueWorkflowType ?? String)
- // : WorkflowAttributeType.String`
+ // Originally it asserted `dataType` was DECORATIVE everywhere, because the JSON path that replaced
+ // the deleted XAML compiler typed every literal as WorkflowAttributeType String ("14"). Its own
+ // comment said: "if the SDK begins emitting a real type, this fails and whoever sees it must
+ // re-read the surface rather than discover the change in production." That happened on the
+ // injected-storage re-vendor.
//
- // So the field is currently DECORATIVE. It is still accepted and still validated — narrowly, so a
- // typo is caught and so the surface stays forward-compatible if the SDK starts honouring it — but
- // nothing downstream may claim it changes the deployed rule. This test exists to make that claim
- // impossible to make by accident: if the SDK begins emitting a real type, this fails and whoever
- // sees it must re-read the surface rather than discover the change in production.
- const { createMakerSdk } = require(BUNDLE);
+ // The FIRST rewrite pinned what it saw — the authored token reaching the wire verbatim — and read
+ // that as "dataType is honoured". It was not: `WorkflowAttributeType` is a NUMERIC-STRING enum
+ // (`{ Boolean:'0' … Money:'7', Picklist:'10', String:'14' … }`), so `"String"` and even
+ // `"NotAWorkflowType"` were OUT-OF-DOMAIN values, and the SDK's own fallback for the same field is
+ // `'14'`. Pinning pass-through of a non-member value is the opposite of honoured; it froze a
+ // silent wrong write. `businessRuleDef` now maps the spec token through the enum.
+ //
+ // MEASURED against this bundle after the mapping:
+ //
+ // CONDITION path — `conditionExpression.right[0].type` is the ENUM VALUE for the authored
+ // token ('Money' -> '7', 'Picklist' -> '10'), and '14' when none is authored,
+ // which is what the previous bundle hard-coded for every literal.
+ // ACTION path — the SetFieldValue step still emits "14" for EVERY token, so dataType really
+ // is ignored there.
+ //
+ // The two paths therefore DISAGREE, and that asymmetry is the thing worth pinning: an author who
+ // sets `dataType: 'Integer'` on a SetFieldValue action gets a String literal on the wire, while
+ // the same token on a condition is typed. Do not "simplify" this test by asserting one rule for
+ // both paths — that would re-hide the difference.
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'br-dt-'));
dirs.push(dir);
- const STRING_TOKEN = '14'; // WorkflowAttributeType.String, read from the bundle's own enum.
+ // The metadata-derived EXPRESSION type. 0 because this client serves no field metadata.
+ const UNTYPED_TOKEN = '0';
+ // What the SetFieldValue action path emits for every token: WorkflowAttributeType.String.
+ const ACTION_STRING_TOKEN = '14';
const { BUSINESS_RULE_DATA_TYPES } = require('../lib/app-spec.js');
- // Every token the spec accepts, plus one that is not a type at all — if the SDK ever starts
- // consulting the field, a made-up value is the case most likely to behave differently.
- const TOKENS = [...BUSINESS_RULE_DATA_TYPES, 'NotAWorkflowType'];
+ // The enum the SDK serializes into, restated here INDEPENDENTLY of the engine's own table so this
+ // is an oracle rather than a restatement of `workflowAttributeType`.
+ const EXPECTED_ENUM = {
+ String: '14', Memo: '14', Boolean: '0', DateTime: '2', Decimal: '3', Double: '4', Float: '4',
+ Integer: '5', Money: '7', Picklist: '10', State: '12', Status: '13', Lookup: '6', Customer: '1',
+ Owner: '8', UniqueIdentifier: '15', MultiSelectPicklist: '23',
+ };
+ const TOKENS = [...BUSINESS_RULE_DATA_TYPES];
const push = async (def) => {
const calls = [];
const sdk = createMakerSdk({
- workspacePath: fs.mkdtempSync(path.join(dir, 'w')), instanceUrl: 'https://contoso.crm.dynamics.com',
+ workspaceStorage: createNodeWorkspaceStorage(fs.mkdtempSync(path.join(dir, 'w'))), instanceUrl: 'https://contoso.crm.dynamics.com',
httpClient: {
get: async () => ({ status: 200, headers: {}, body: { value: [] } }),
post: async (url, body) => {
@@ -287,8 +313,8 @@ test('REAL BUNDLE: dataType does NOT reach the wire — the SDK types every lite
delete: async () => ({ status: 204, headers: {}, body: {} }),
},
});
- sdk.initWorkspace();
- const art = sdk.createArtifact('businessRule', def);
+ await sdk.initWorkspace();
+ const art = await sdk.createArtifact('businessRule', def);
await sdk.updateElement('businessRule', art.id, '/rootCondition', def.rootCondition);
await sdk.pushArtifact('businessRule', art.id);
return JSON.parse(calls.find((c) => /CreateProcessWithWfomJson/i.test(String(c.url))).body.WfomJson);
@@ -300,28 +326,64 @@ test('REAL BUNDLE: dataType does NOT reach the wire — the SDK types every lite
...RULE, conditions: [{ field: 'new_status', operator: 'Equals', value: '1', dataType }],
}));
const expr = condWfom.steps.list[0].steps.list[0].conditionExpression;
- assert.strictEqual(expr.type, STRING_TOKEN, `condition dataType '${dataType}' unexpectedly reached the wire as ${expr.type}`);
- assert.strictEqual(expr.right[0].type, STRING_TOKEN, `condition dataType '${dataType}' unexpectedly typed the literal as ${expr.right[0].type}`);
-
- // 2. the SetFieldValue ACTION path, which reads a DIFFERENT field on a different code path — the
- // SDK does pass `valueWorkflowType` into the action serializer, so this is the one that could
- // plausibly differ, and asserting only the condition path would not have shown it.
+ // The EXPRESSION type is metadata-derived and stays untyped here — this client serves no field
+ // metadata. It is deliberately asserted so a future change that starts deriving it from the
+ // authored token (rather than from the field) shows up as a failure.
+ assert.strictEqual(expr.type, UNTYPED_TOKEN,
+ `condition dataType '${dataType}': the EXPRESSION type should stay metadata-derived, got ${expr.type}`);
+ // The LITERAL operand type is the ENUM VALUE for the authored token, never the token itself.
+ // `WorkflowAttributeType` has no `String`/`Money` members — only '14'/'7' — so a raw token here
+ // would be an out-of-domain value that Dataverse either rejects or coerces.
+ const want = EXPECTED_ENUM[dataType];
+ assert.ok(want, `test gap: no expected enum value recorded for accepted token '${dataType}'`);
+ assert.strictEqual(expr.right[0].type, want,
+ `condition dataType '${dataType}' should serialize as WorkflowAttributeType ${want}, got ${expr.right[0].type}`);
+
+ // 2. the SetFieldValue ACTION path, a DIFFERENT field on a different code path — and the one
+ // that does NOT honour the token. Asserted explicitly so the asymmetry is pinned rather
+ // than assumed away.
const actWfom = await push(businessRuleDef({
...RULE,
conditions: [{ field: 'new_notes', operator: 'ContainsData' }],
actions: [{ type: 'SetFieldValue', field: 'new_owner', value: 'x', dataType }],
}));
- const types = [...JSON.stringify(actWfom.steps.list[0].steps.list[0].steps.list[0]).matchAll(/"type":"(\d+)"/g)].map((m) => m[1]);
+ const serialized = JSON.stringify(actWfom.steps.list[0].steps.list[0].steps.list[0]);
+ const types = [...serialized.matchAll(/"type":"?([A-Za-z0-9]+)"?/g)].map((m) => m[1]);
assert.ok(types.length > 0, `action dataType '${dataType}': no type token found on the wire`);
- assert.deepStrictEqual([...new Set(types)], [STRING_TOKEN],
- `action dataType '${dataType}' unexpectedly reached the wire as ${JSON.stringify([...new Set(types)])}`);
+ assert.deepStrictEqual([...new Set(types)], [ACTION_STRING_TOKEN],
+ `action dataType '${dataType}' should still be IGNORED (String), got ${JSON.stringify([...new Set(types)])}`);
+ assert.ok(!serialized.includes(`"${dataType}"`) || dataType === 'String',
+ `action dataType '${dataType}' must NOT reach the wire verbatim — that would make the two paths agree, and this test would need rewriting`);
}
- // The spec-level list stays a CLOSED set even though the SDK ignores it, so a typo is still a
- // spec-gate error rather than a silently-accepted no-op.
+ // The DEFAULT, which is the case that actually hit every rule. `businessRuleDef` defaults the
+ // token to 'String', and before the enum mapping that put the literal "String" on the wire for
+ // every business rule this plugin has ever written — not just ones that authored a dataType.
+ // '14' is what the PREVIOUS bundle hard-coded, so this pins the restoration of that behaviour.
+ const defaultWfom = await push(businessRuleDef({
+ ...RULE, conditions: [{ field: 'new_status', operator: 'Equals', value: '1' }],
+ }));
+ assert.strictEqual(defaultWfom.steps.list[0].steps.list[0].conditionExpression.right[0].type, '14',
+ 'a condition with NO authored dataType must serialize as String (14), the value the previous bundle hard-coded');
+
+ // An unmapped token must FALL BACK to String rather than be forwarded. The spec gate makes this
+ // unreachable from a valid spec, but forwarding would reopen the out-of-domain write, so the
+ // fallback is asserted rather than assumed.
+ const bogusWfom = await push(businessRuleDef({
+ ...RULE, conditions: [{ field: 'new_status', operator: 'Equals', value: '1', dataType: 'NotAWorkflowType' }],
+ }));
+ const bogusType = bogusWfom.steps.list[0].steps.list[0].conditionExpression.right[0].type;
+ assert.strictEqual(bogusType, '14',
+ `an unmapped dataType must fall back to String (14), not reach the wire as '${bogusType}'`);
+
+ // The spec-level list being closed is load-bearing: it is what keeps a typo from reaching the
+ // mapping at all, and every accepted token must have an enum value to map to.
assert.ok(Array.isArray(BUSINESS_RULE_DATA_TYPES) && BUSINESS_RULE_DATA_TYPES.length > 0);
+ for (const t of BUSINESS_RULE_DATA_TYPES) {
+ assert.ok(EXPECTED_ENUM[t], `accepted dataType '${t}' has no WorkflowAttributeType mapping`);
+ }
assert.ok(!BUSINESS_RULE_DATA_TYPES.includes('DateTime'),
- 'DateTime stays out: it was never exercised, and the SDK ignoring the field today is not a reason to promise a type we have not tested');
+ 'DateTime stays out: it was never exercised on this path');
});
test('a DateTime dataType is rejected at the spec gate, not mid-build', () => {
@@ -441,61 +503,60 @@ test('a rule the designer calls incomplete HALTS before anything is written', as
const { sdk } = require('./helpers/mock-sdk.js').makeSimpleMockSdk();
const { provision } = provisionWithRules([]);
const pushes = [];
- // `provisionWithRules` does not record pushes, and an assertion against a call list that can never
- // contain the value is vacuous — so record it here rather than assert on nothing.
- provision.pushArtifact = async (...a) => { pushes.push(a); return { id: 'br-new', saved: true, publish: { kind: 'notRequested' } }; };
- provision.validateBusinessRule = () => ([
- { pointer: '/rootCondition (root)', rule: 'business-rule-NO_ACTION', message: 'A business rule must include at least one action step.' },
- ]);
+ // ⚠ The refusal moved. This test used to stub `provision.validateBusinessRule` so the BUILD would
+ // run it and halt. That method no longer exists — the SDK validates internally on every save — so
+ // the refusal now arrives as a REJECTED `pushArtifact`, and what must still hold is that the build
+ // surfaces it and writes nothing.
+ provision.pushArtifact = async (...a) => {
+ pushes.push(a);
+ const err = new Error(
+ 'Validation failed for businessRule/x:\n • /rootCondition (root): A business rule must include ' +
+ 'at least one action step. [business-rule-NO_ACTION]'
+ );
+ err.code = 'VALIDATION_FAILED';
+ throw err;
+ };
const err = await runBuild(ruleOnlySpec(), {
sdk, provisionSdk: provision, apply: true, phases: ['business-rules'], warn: () => {},
}).then(() => null, (e) => e);
assert.ok(err, 'an incomplete rule must not be pushed');
- assert.match(err.message, /never fires/, `the halt must say what the rule would do; got: ${err && err.message}`);
assert.match(err.message, /NO_ACTION/, "the designer's own finding is the actionable part");
- assert.deepStrictEqual(pushes, [], 'the refusal must come BEFORE the write, not after it');
+ assert.strictEqual(pushes.length, 1, 'exactly one push was attempted, and it was refused');
+ // The rule must not be recorded as created off the back of a refused push.
+ assert.doesNotMatch(String(err.message), /^\s*$/, 'the halt carries the reason');
});
-test('the validator is best-effort: an older bundle without it, or one that throws, still builds', async () => {
- // A DIAGNOSTIC must never be the thing that breaks a build. The bundle is re-vendored routinely and
- // the plugin supports the generation before this method existed, so absence is a normal state —
- // and a validator that itself faults tells us nothing about the rule.
- const { sdk } = require('./helpers/mock-sdk.js').makeSimpleMockSdk();
- for (const [label, mutate] of [
- ['absent', (p) => { delete p.validateBusinessRule; }],
- ['throws', (p) => { p.validateBusinessRule = () => { throw new Error('validator exploded'); }; }],
- ['returns a non-array', (p) => { p.validateBusinessRule = () => undefined; }],
- ]) {
- const { provision } = provisionWithRules([]);
- mutate(provision);
- const res = await runBuild(ruleOnlySpec(), {
- sdk, provisionSdk: provision, apply: true, phases: ['business-rules'], warn: () => {},
- });
- assert.strictEqual(res.ok, true, `validator ${label} must not fail the build`);
- const only = ruleOnlySpec().businessRules[0];
- assert.strictEqual(res.created.businessRules[`${only.entity.toLowerCase()}|${only.name}`], 'br-new',
- `validator ${label}: the rule must still be authored`);
- assert.deepStrictEqual(res.skipped.businessRules, [], `validator ${label}: and not recorded as skipped`);
- }
-});
+// ⚠ REMOVED: 'the validator is best-effort: an older bundle without it, or one that throws, still
+// builds'.
+//
+// Its entire premise is gone. It asserted that the plugin's OPT-IN call to
+// `provision.validateBusinessRule` degraded gracefully when the vendored bundle predated the method
+// or the validator itself faulted — correct while validation was a best-effort diagnostic the
+// PLUGIN chose to run.
+//
+// Validation is no longer optional or plugin-driven: the SDK runs it internally on every
+// business-rule save, so there is no "absent" or "throws" state left to tolerate. A replacement
+// test would have to stub the SDK into not validating, which asserts the opposite of the guarantee
+// this change bought. The coverage that matters now lives in the two tests above: an incomplete
+// rule halts the build, and every shape the spec surface can author is accepted by the real push.
-test('REAL BUNDLE: the validator accepts EVERY shape this spec surface can author', () => {
+test('REAL BUNDLE: the validator accepts EVERY shape this spec surface can author', async () => {
// The one way wiring the validator could regress a working build is if it rejected something the
// App Spec already allows. So the assertion is over the spec surface's OWN declared sets rather
// than a hand-picked sample — a future operator or action type added to app-spec.js is covered the
// day it is added, without anyone remembering to extend this test.
const { BUSINESS_RULE_OPERATORS, BUSINESS_RULE_VALUELESS_OPERATORS, BUSINESS_RULE_ACTION_TYPES, BUSINESS_RULE_SCOPES, BUSINESS_RULE_DATA_TYPES } = require('../lib/app-spec.js');
- const { createMakerSdk } = require(BUNDLE);
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'brval-'));
dirs.push(dir);
const noop = async () => ({ status: 200, headers: {}, body: { value: [] } });
const sdk = createMakerSdk({
- workspacePath: dir, instanceUrl: 'https://contoso.crm.dynamics.com',
+ workspaceStorage: createNodeWorkspaceStorage(dir), instanceUrl: 'https://contoso.crm.dynamics.com',
httpClient: { get: noop, post: noop, patch: noop, put: noop, delete: noop },
});
- sdk.initWorkspace();
+ await sdk.initWorkspace();
// The payload each action type carries — mirrors BUSINESS_RULE_ACTIONS in app-spec.js.
const ACTION_PAYLOAD = { SetVisibility: { visible: false }, LockUnlock: { lock: true }, SetBusinessRequired: { required: true }, SetFieldValue: { value: 'x', dataType: 'String' } };
@@ -526,20 +587,32 @@ test('REAL BUNDLE: the validator accepts EVERY shape this spec surface can autho
const rejected = [];
for (const [label, rule] of shapes) {
const def = businessRuleDef(rule);
- const art = sdk.createArtifact('businessRule', def);
- const issues = sdk.validateBusinessRule(Object.assign({}, art, { rootCondition: def.rootCondition }));
- if (issues && issues.length) rejected.push(`${label}: ${JSON.stringify(issues)}`);
+ const art = await sdk.createArtifact('businessRule', def);
+ await sdk.updateElement('businessRule', art.id, '/rootCondition', def.rootCondition);
+ // ⚠ This used to call `sdk.validateBusinessRule(...)` directly. That method is gone: the SDK now
+ // runs the designer's validator INTERNALLY on every save, so the equivalent — and stronger —
+ // check is that the real push path accepts the shape. A rejection surfaces as a throw.
+ try {
+ await sdk.pushArtifact('businessRule', art.id);
+ } catch (e) {
+ rejected.push(`${label}: ${e && e.message}`);
+ }
}
assert.deepStrictEqual(rejected, [],
- `the build HALTS on findings, so a rejected authorable shape is a build the spec gate said was fine:\n${rejected.join('\n')}`);
+ `the push REFUSES on findings, so a rejected authorable shape is a build the spec gate said was fine:\n${rejected.join('\n')}`);
assert.ok(shapes.length >= 20, `the matrix must be broad enough to mean something; got ${shapes.length}`);
// Negative control: without this the assertion above is satisfied by a validator that finds
// nothing at all, and the gate would be inert while looking healthy.
- const empty = sdk.createArtifact('businessRule', { name: 'Empty', entityLogicalName: 'new_ticket', scope: 'Entity', status: 'Draft' });
- const control = sdk.validateBusinessRule(empty);
- assert.ok(control && control.length > 0, 'the validator must actually report on a rule with no clauses and no actions');
- assert.match(JSON.stringify(control), /NO_ACTION/, 'and name the missing action step');
+ const empty = await sdk.createArtifact('businessRule', { name: 'Empty', entityLogicalName: 'new_ticket', scope: 'Entity', status: 'Draft' });
+ let controlErr = null;
+ try {
+ await sdk.pushArtifact('businessRule', empty.id);
+ } catch (e) {
+ controlErr = e;
+ }
+ assert.ok(controlErr, 'the validator must actually refuse a rule with no clauses and no actions');
+ assert.match(String(controlErr.message), /NO_ACTION/, 'and name the missing action step');
});
test('a rebuild REMOVES duplicates an earlier build left behind', async () => {
@@ -965,12 +1038,12 @@ test('REAL BUNDLE: BOTH conditions of a multi-clause rule reach the wire, joined
// rule that fires under half the intended circumstances, and every structural check would pass.
//
// WorkflowConditionOperator.LogicalAnd is "2" in the bundle's own enum.
- const { createMakerSdk } = require(BUNDLE);
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'br-multi-'));
dirs.push(dir);
const calls = [];
const sdk = createMakerSdk({
- workspacePath: dir, instanceUrl: 'https://contoso.crm.dynamics.com',
+ workspaceStorage: createNodeWorkspaceStorage(dir), instanceUrl: 'https://contoso.crm.dynamics.com',
httpClient: {
get: async () => ({ status: 200, headers: {}, body: { value: [] } }),
post: async (url, body) => { calls.push({ url, body }); return { status: 204, headers: { 'odata-entityid': 'https://x/workflows(55555555-5555-5555-5555-555555555555)' }, body: {} }; },
@@ -979,7 +1052,7 @@ test('REAL BUNDLE: BOTH conditions of a multi-clause rule reach the wire, joined
delete: async () => ({ status: 204, headers: {}, body: {} }),
},
});
- sdk.initWorkspace();
+ await sdk.initWorkspace();
const def = businessRuleDef({
...RULE,
@@ -990,7 +1063,7 @@ test('REAL BUNDLE: BOTH conditions of a multi-clause rule reach the wire, joined
});
assert.strictEqual(def.rootCondition.clauses.length, 2, 'the mapper must carry both clauses');
- const art = sdk.createArtifact('businessRule', def);
+ const art = await sdk.createArtifact('businessRule', def);
await sdk.updateElement('businessRule', art.id, '/rootCondition', def.rootCondition);
await sdk.pushArtifact('businessRule', art.id);
diff --git a/plugins/model-apps/scripts/tests/column-capabilities.test.js b/plugins/model-apps/scripts/tests/column-capabilities.test.js
index 21dcbd40e..dece17a77 100644
--- a/plugins/model-apps/scripts/tests/column-capabilities.test.js
+++ b/plugins/model-apps/scripts/tests/column-capabilities.test.js
@@ -366,7 +366,7 @@ function realSdk({ get } = {}) {
return { status: 204, headers: {}, body: {} };
};
const sdk = require(BUNDLE).createMakerSdk({
- workspacePath: dir,
+ workspaceStorage: require(BUNDLE).createNodeWorkspaceStorage(dir),
instanceUrl: 'https://contoso.crm.dynamics.com',
httpClient: {
get: get || (async (url) => { requests.push({ verb: 'get', url }); return { status: 200, headers: {}, body: { value: [] } }; }),
diff --git a/plugins/model-apps/scripts/tests/column-visualization.test.js b/plugins/model-apps/scripts/tests/column-visualization.test.js
index 42a5a5dc0..dceb3b12a 100644
--- a/plugins/model-apps/scripts/tests/column-visualization.test.js
+++ b/plugins/model-apps/scripts/tests/column-visualization.test.js
@@ -259,11 +259,11 @@ test('the shipped SDK exposes the visualization surface the build calls', () =>
// not exported, so a `prototype` check would only ever prove the export shape.
const os = require('node:os');
const fs = require('node:fs');
- const { createMakerSdk } = require(BUNDLE);
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'cv-surface-'));
try {
const sdk = createMakerSdk({
- workspacePath: dir,
+ workspaceStorage: createNodeWorkspaceStorage(dir),
instanceUrl: 'https://contoso.crm.dynamics.com',
httpClient: {
get: async () => ({ status: 200, headers: {}, body: { value: [] } }),
diff --git a/plugins/model-apps/scripts/tests/command-real-bundle.test.js b/plugins/model-apps/scripts/tests/command-real-bundle.test.js
index e76542763..cd65f7922 100644
--- a/plugins/model-apps/scripts/tests/command-real-bundle.test.js
+++ b/plugins/model-apps/scripts/tests/command-real-bundle.test.js
@@ -28,14 +28,29 @@ const fs = require('node:fs');
const BUNDLE = path.resolve(__dirname, '..', 'vendor', 'cds-maker-sdk.cjs');
const dirs = [];
-function sdkWithCapture() {
- const { createMakerSdk } = require(BUNDLE);
+async function sdkWithCapture() {
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'cmd-'));
dirs.push(dir);
const writes = [];
let minted = 0;
const httpClient = {
- get: async () => ({ status: 200, headers: {}, body: { value: [] } }),
+ // ⚠ EntityDefinitions must resolve. The SDK now REFUSES to write an app action whose
+ // `ContextEntity` bind cannot be set (`COMMAND_CONTEXT_ENTITY_UNRESOLVED`): a row written
+ // without it is created but permanently unreadable, because `commandApi.get` filters on
+ // `_contextentity_value`. A harness that serves `{ value: [] }` for everything therefore no
+ // longer models a working environment — it models a broken one, and every command test would
+ // fail on the guard rather than on what it means to assert.
+ get: async (url) => {
+ if (/EntityDefinitions/i.test(String(url))) {
+ return {
+ status: 200,
+ headers: {},
+ body: { MetadataId: 'eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', LogicalName: 'account', value: [{ MetadataId: 'eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee', LogicalName: 'account' }] },
+ };
+ }
+ return { status: 200, headers: {}, body: { value: [] } };
+ },
post: async (url, body) => {
writes.push({ verb: 'post', url: String(url), body });
minted += 1;
@@ -46,8 +61,8 @@ function sdkWithCapture() {
put: async () => ({ status: 204, headers: {}, body: {} }),
delete: async () => ({ status: 204, headers: {}, body: {} }),
};
- const sdk = createMakerSdk({ workspacePath: dir, instanceUrl: 'https://contoso.crm.dynamics.com', httpClient });
- sdk.initWorkspace();
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(dir), instanceUrl: 'https://contoso.crm.dynamics.com', httpClient });
+ await sdk.initWorkspace();
return { sdk, writes };
}
@@ -62,8 +77,8 @@ function commandDef(controls, location = 'MainGrid') {
test.after(() => { for (const d of dirs) fs.rmSync(d, { recursive: true, force: true }); });
test('REAL BUNDLE: a custom button with a JavaScript on-click reaches the wire', async () => {
- const { sdk, writes } = sdkWithCapture();
- const art = sdk.createArtifact('command', commandDef([{
+ const { sdk, writes } = await sdkWithCapture();
+ const art = await sdk.createArtifact('command', commandDef([{
id: 'cr_hello',
type: 'Button',
label: 'Say Hello',
@@ -92,8 +107,8 @@ test('REAL BUNDLE: Button, FlyoutAnchor and SplitButton all emit writes', async
// "Custom buttons are supported" is otherwise a claim with no executable meaning, and a re-vendor
// could narrow the accepted set without any existing test noticing.
for (const type of ['Button', 'FlyoutAnchor', 'SplitButton']) {
- const { sdk, writes } = sdkWithCapture();
- const art = sdk.createArtifact('command', commandDef([{ id: `cr_${type.toLowerCase()}`, type, label: type }]));
+ const { sdk, writes } = await sdkWithCapture();
+ const art = await sdk.createArtifact('command', commandDef([{ id: `cr_${type.toLowerCase()}`, type, label: type }]));
const pushed = await sdk.pushArtifact('command', art.id);
assert.strictEqual(pushed.saved, true, `${type} pushes cleanly`);
assert.ok(writes.length > 0, `${type} actually emitted writes rather than silently no-op'ing`);
@@ -104,8 +119,8 @@ test('REAL BUNDLE: hidden/disabled reach the wire as real booleans, not rules or
// The limit worth recording: `hidden: true` is a fixed state, not a rule. Rule-evaluated
// visibility on modern commands is Power Fx + a component library and cannot be authored
// headlessly, so an author must not expect "hide when status = closed" to be expressible here.
- const { sdk, writes } = sdkWithCapture();
- const art = sdk.createArtifact('command', commandDef([
+ const { sdk, writes } = await sdkWithCapture();
+ const art = await sdk.createArtifact('command', commandDef([
{ id: 'cr_static', type: 'Button', label: 'Static', hidden: true, disabled: true },
]));
const pushed = await sdk.pushArtifact('command', art.id);
diff --git a/plugins/model-apps/scripts/tests/concurrency-stress.test.js b/plugins/model-apps/scripts/tests/concurrency-stress.test.js
index b9953b009..bad625037 100644
--- a/plugins/model-apps/scripts/tests/concurrency-stress.test.js
+++ b/plugins/model-apps/scripts/tests/concurrency-stress.test.js
@@ -45,8 +45,8 @@ function deferringHttpClient(counter) {
};
}
-function freshSdk() {
- const { createMakerSdk } = require(BUNDLE);
+async function freshSdk() {
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'concurrency-'));
tempDirs.push(dir);
let n = 0;
@@ -55,24 +55,26 @@ function freshSdk() {
next: () => `11111111-1111-1111-1111-${String(++n).padStart(12, '0')}`,
};
const sdk = createMakerSdk({
- workspacePath: dir,
+ workspaceStorage: createNodeWorkspaceStorage(dir),
instanceUrl: 'https://example.crm.dynamics.com',
httpClient: deferringHttpClient(counter),
});
- sdk.initWorkspace();
+ await sdk.initWorkspace();
return { sdk, dir, counter };
}
const readManifest = (dir) => JSON.parse(fs.readFileSync(path.join(dir, 'manifest.json'), 'utf8'));
test('STRESS: 40 concurrent artifact mutations all survive in the shared manifest (no lost update)', async () => {
- const { sdk, dir } = freshSdk();
+ const { sdk, dir } = await freshSdk();
const N = 40;
- // Create first (createArtifact is synchronous), so the concurrent phase is pure async mutation.
+ // Create SEQUENTIALLY first, awaiting each, so the concurrent phase below is pure async mutation
+ // rather than a mix of creates and updates. (`createArtifact` became async in the injected-storage
+ // uptake; the await is what makes this setup ordered, not a claim about the SDK being sync.)
const ids = [];
for (let i = 0; i < N; i++) {
- ids.push(sdk.createArtifact('view', { name: `View ${i}`, entityLogicalName: 'account', columns: [] }).id);
+ ids.push((await sdk.createArtifact('view', { name: `View ${i}`, entityLogicalName: 'account', columns: [] })).id);
}
// Now mutate ALL of them concurrently. Each updateElement writes the artifact AND rewrites the
@@ -103,8 +105,8 @@ test('STRESS: 40 concurrent artifact mutations all survive in the shared manifes
});
test('STRESS: concurrent mutation + push of the same artifact serializes (no interleaved corruption)', async () => {
- const { sdk } = freshSdk();
- const id = sdk.createArtifact('view', { name: 'Contended', entityLogicalName: 'account', columns: [] }).id;
+ const { sdk } = await freshSdk();
+ const id = (await sdk.createArtifact('view', { name: 'Contended', entityLogicalName: 'account', columns: [] })).id;
// Same artifact, many writers. The SDK takes a per-artifact lock, so these must serialize; the
// point is that the LAST write wins cleanly rather than two writes merging into a torn value.
@@ -122,10 +124,10 @@ test('STRESS: interleaved reads of 40 artifacts each return their OWN artifact',
// Guards against a shared-read-buffer bug in the revalidating read path: with reads now async, a
// cache keyed or reused incorrectly would hand chain A the artifact chain B asked for. Cheap to
// assert, and impossible to notice from a single-artifact test.
- const { sdk } = freshSdk();
+ const { sdk } = await freshSdk();
const ids = [];
for (let i = 0; i < 40; i++) {
- ids.push(sdk.createArtifact('form', { name: `Form ${i}`, entityLogicalName: 'account', formType: 'main', status: 'draft' }).id);
+ ids.push((await sdk.createArtifact('form', { name: `Form ${i}`, entityLogicalName: 'account', formType: 'main', status: 'draft' })).id);
}
// sdk-async-ok: concurrent by design, the promises go to Promise.all.
const reads = await Promise.all(ids.map((id) => sdk.getArtifact('form', id)));
diff --git a/plugins/model-apps/scripts/tests/dashboard-roundtrip.test.js b/plugins/model-apps/scripts/tests/dashboard-roundtrip.test.js
index 2e6965694..a257bd3d0 100644
--- a/plugins/model-apps/scripts/tests/dashboard-roundtrip.test.js
+++ b/plugins/model-apps/scripts/tests/dashboard-roundtrip.test.js
@@ -30,8 +30,8 @@ const DASH_ID = '33333333-3333-3333-3333-333333333333';
const dirs = [];
test.after(() => { for (const d of dirs) fs.rmSync(d, { recursive: true, force: true }); });
-function harness() {
- const { createMakerSdk } = require(BUNDLE);
+async function harness() {
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'dash-478-'));
dirs.push(dir);
const store = {};
@@ -55,8 +55,8 @@ function harness() {
put: async () => ({ status: 204, headers: {}, body: {} }),
delete: async () => ({ status: 204, headers: {}, body: {} }),
};
- const sdk = createMakerSdk({ workspacePath: dir, instanceUrl: 'https://contoso.crm.dynamics.com', httpClient });
- sdk.initWorkspace();
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(dir), instanceUrl: 'https://contoso.crm.dynamics.com', httpClient });
+ await sdk.initWorkspace();
return { sdk, store };
}
@@ -73,8 +73,8 @@ const TILES = {
for (const [label, tile] of Object.entries(TILES)) {
test(`REAL BUNDLE: a dashboard with a ${label} survives serialize -> deserialize`, async () => {
- const { sdk, store } = harness();
- const art = sdk.createArtifact('dashboard', { name: 'Field Ops' });
+ const { sdk, store } = await harness();
+ const art = await sdk.createArtifact('dashboard', { name: 'Field Ops' });
await sdk.addElement('dashboard', art.id, '/components', tile);
await sdk.pushArtifact('dashboard', art.id);
diff --git a/plugins/model-apps/scripts/tests/default-view-createdon.test.js b/plugins/model-apps/scripts/tests/default-view-createdon.test.js
index 0bb3d0f94..6e075dbb4 100644
--- a/plugins/model-apps/scripts/tests/default-view-createdon.test.js
+++ b/plugins/model-apps/scripts/tests/default-view-createdon.test.js
@@ -40,8 +40,8 @@ const STOCK_VIEW = {
'<cell name="new_name" width="300"/><cell name="createdon" width="150"/></row></grid>',
};
-function freshSdk(capture) {
- const { createMakerSdk } = require(BUNDLE);
+async function freshSdk(capture) {
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'view7-'));
tempDirs.push(dir);
const httpClient = {
@@ -56,8 +56,8 @@ function freshSdk(capture) {
delete: async () => ({ status: 204, headers: {}, body: {} }),
put: async () => ({ status: 204, headers: {}, body: {} }),
};
- const sdk = createMakerSdk({ workspacePath: dir, instanceUrl: 'https://example.crm.dynamics.com', httpClient });
- sdk.initWorkspace();
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(dir), instanceUrl: 'https://example.crm.dynamics.com', httpClient });
+ await sdk.initWorkspace();
return sdk;
}
@@ -74,7 +74,7 @@ test('#7 enriching a default view REPLACES the stock createdon column (dropped f
assert.ok(!cols.includes('createdon'), 'our column set never contains createdon');
const capture = [];
- const sdk = freshSdk(capture);
+ const sdk = await freshSdk(capture);
const id = STOCK_VIEW.savedqueryid;
// Exactly what provision.enrichDefaultViews does: fetch the live view, replace /columns, push.
await sdk.fetchArtifact('view', id);
diff --git a/plugins/model-apps/scripts/tests/entity-provision.test.js b/plugins/model-apps/scripts/tests/entity-provision.test.js
index 1ac6a86c0..a32c7eedd 100644
--- a/plugins/model-apps/scripts/tests/entity-provision.test.js
+++ b/plugins/model-apps/scripts/tests/entity-provision.test.js
@@ -720,7 +720,8 @@ test('#544 a cross-entity $parent does not trigger wave splitting', async () =>
assert.strictEqual(orgCalls.length, 1, 'both org rows seed in one call');
});
-test('#544 a self-reference CYCLE fails with a message naming the rows, not a hang', async () => { const spec = hierarchySpec();
+test('#544 a self-reference CYCLE fails with a message naming the rows, not a hang', async () => {
+ const spec = hierarchySpec();
spec.sampleData.new_org[0].$parent = { entity: 'new_org', match: { new_name: 'Grandchild' } };
await assert.rejects(runHierarchy(spec), (err) => {
assert.match(err.message, /cycle/i);
diff --git a/plugins/model-apps/scripts/tests/golden.test.js b/plugins/model-apps/scripts/tests/golden.test.js
index 8e816a0ee..c8af01b3b 100644
--- a/plugins/model-apps/scripts/tests/golden.test.js
+++ b/plugins/model-apps/scripts/tests/golden.test.js
@@ -33,7 +33,7 @@ for (const name of ['project-tracker', 'support-desk']) {
}
test('sitemap-XML golden: area + subarea icons', async () => {
- const { createMakerSdk } = require('../vendor/cds-maker-sdk.cjs');
+ const { createMakerSdk, createNodeWorkspaceStorage } = require('../vendor/cds-maker-sdk.cjs');
const os = require('node:os');
const spec = {
solution: { uniqueName: 'GoldA', publisherPrefix: 'new' },
@@ -83,9 +83,9 @@ test('sitemap-XML golden: area + subarea icons', async () => {
delete: async () => ({ status: 204, headers: {}, body: {} }),
put: async () => ({ status: 204, headers: {}, body: {} }),
};
- const sdk = createMakerSdk({ workspacePath: ws, instanceUrl: 'https://example.crm.dynamics.com', httpClient });
- sdk.initWorkspace();
- const art = sdk.createArtifact('app', { name: spec.app.name, uniqueName: 'new_goldenapp', description: '', siteMap: def.siteMap, components: def.components, iconWebResourceId: APP_ICON_ID });
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(ws), instanceUrl: 'https://example.crm.dynamics.com', httpClient });
+ await sdk.initWorkspace();
+ const art = await sdk.createArtifact('app', { name: spec.app.name, uniqueName: 'new_goldenapp', description: '', siteMap: def.siteMap, components: def.components, iconWebResourceId: APP_ICON_ID });
await sdk.pushArtifact('app', art.id);
fs.rmSync(ws, { recursive: true, force: true });
assertGolden('sitemap.icons.xml', xml + '\n');
diff --git a/plugins/model-apps/scripts/tests/hardening2-real-bundle.test.js b/plugins/model-apps/scripts/tests/hardening2-real-bundle.test.js
index c6793bf38..7bdfc606b 100644
--- a/plugins/model-apps/scripts/tests/hardening2-real-bundle.test.js
+++ b/plugins/model-apps/scripts/tests/hardening2-real-bundle.test.js
@@ -23,8 +23,8 @@ test.after(() => { for (const d of tempDirs) fs.rmSync(d, { recursive: true, for
// A real SDK bound to a capturing httpClient. `meta` maps a logical entity name -> attribute-type map
// so the adapter's push-time metadata defaulting (T4) resolves a field's control classId.
-function freshSdk(capture, meta) {
- const { createMakerSdk } = require(BUNDLE);
+async function freshSdk(capture, meta) {
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'h2-real-'));
tempDirs.push(dir);
const httpClient = {
@@ -42,15 +42,15 @@ function freshSdk(capture, meta) {
delete: async () => ({ status: 204, headers: {}, body: {} }),
put: async () => ({ status: 204, headers: {}, body: {} }),
};
- const sdk = createMakerSdk({ workspacePath: dir, instanceUrl: 'https://example.crm.dynamics.com', httpClient });
- sdk.initWorkspace();
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(dir), instanceUrl: 'https://example.crm.dynamics.com', httpClient });
+ await sdk.initWorkspace();
return sdk;
}
// Mirror the engine's createFormShell sequence: minimal create, append each compiled tab (ids minted
// by addElement), drop the seed tab. Returns the form id.
async function buildFormShell(sdk, intent) {
- const art = sdk.createArtifact('form', { name: intent.name, entityLogicalName: intent.entityLogicalName, formType: intent.formType, status: intent.status });
+ const art = await sdk.createArtifact('form', { name: intent.name, entityLogicalName: intent.entityLogicalName, formType: intent.formType, status: intent.status });
for (const tab of intent.tabs) await sdk.addElement('form', art.id, '/tabs', tab);
await sdk.removeElement('form', art.id, '/tabs/0');
return art.id;
@@ -67,7 +67,7 @@ const custSpec = {
test('PARITY: the rewired form path reproduces the pre-swap golden facts (fields, order, required, notes)', async () => {
const golden = JSON.parse(fs.readFileSync(path.join(__dirname, 'fixtures', 'parity-golden.json'), 'utf8')).form;
const cap = [];
- const sdk = freshSdk(cap);
+ const sdk = await freshSdk(cap);
const intent = ai.compileFormIntent(custSpec, custSpec.forms[0], { notesClassId: NOTES_CLASS_ID });
const id = await buildFormShell(sdk, intent);
await sdk.pushArtifact('form', id);
@@ -87,7 +87,7 @@ test('multi-tab / multi-section explicit layout serializes every tab, section an
] }],
};
const cap = [];
- const sdk = freshSdk(cap);
+ const sdk = await freshSdk(cap);
const intent = ai.compileFormIntent(spec, spec.forms[0], { notesClassId: NOTES_CLASS_ID });
assert.strictEqual(intent.tabs.length, 2, 'two tabs compiled');
const id = await buildFormShell(sdk, intent);
@@ -118,7 +118,7 @@ test('#8 authored column width: a synthesized form column with NO explicit width
] }],
};
const cap = [];
- const sdk = freshSdk(cap);
+ const sdk = await freshSdk(cap);
const intent = ai.compileFormIntent(spec, spec.forms[0], { notesClassId: NOTES_CLASS_ID });
// Remove the plugin-set width from every tab column so ONLY the SDK default can supply it.
for (const tab of intent.tabs) for (const col of (tab.columns || [])) delete col.width;
@@ -137,7 +137,7 @@ test('metadata-derived control types: passing only fieldName lets the adapter cl
const spec = { entities: [{ schemaName: 'new_customer', primaryAttribute: { schemaName: 'new_name', displayName: 'Name' }, columns: [] }],
forms: [{ entity: 'new_customer', name: 'M', tabs: [{ label: 'G', sections: [{ label: 'S', columns: 1, fields: ['new_name', 'new_ownerid'] }] }] }] };
const cap = [];
- const sdk = freshSdk(cap, meta);
+ const sdk = await freshSdk(cap, meta);
const intent = ai.compileFormIntent(spec, spec.forms[0], {});
const id = await buildFormShell(sdk, intent);
await sdk.pushArtifact('form', id);
@@ -154,7 +154,7 @@ test('metadata-derived control types: passing only fieldName lets the adapter cl
test('#5 sub-grid is added as its OWN full-width section and serializes relationship, target, view id + title', async () => {
const cap = [];
- const sdk = freshSdk(cap);
+ const sdk = await freshSdk(cap);
const intent = ai.compileFormIntent(custSpec, custSpec.forms[0], { notesClassId: NOTES_CLASS_ID });
const id = await buildFormShell(sdk, intent);
// The engine now appends a whole sub-grid SECTION to a column's /sections (not a cell into an
@@ -171,7 +171,7 @@ test('#5 sub-grid is added as its OWN full-width section and serializes relation
test('events author + MERGE at /bag/c: appending to an existing <events> region adds a second handler without a duplicate root', async () => {
const cap = [];
- const sdk = freshSdk(cap);
+ const sdk = await freshSdk(cap);
const intent = ai.compileFormIntent(custSpec, custSpec.forms[0], { notesClassId: NOTES_CLASS_ID });
const id = await buildFormShell(sdk, intent);
// First handler -> new region.
@@ -191,7 +191,7 @@ test('events author + MERGE at /bag/c: appending to an existing <events> region
test('field removal: removeElement on the cell pointer drops the field from the pushed formxml', async () => {
const cap = [];
- const sdk = freshSdk(cap);
+ const sdk = await freshSdk(cap);
const intent = ai.compileFormIntent(custSpec, custSpec.forms[0], { notesClassId: NOTES_CLASS_ID });
const id = await buildFormShell(sdk, intent);
const ptr = ai.findFieldCellPointer(await sdk.getArtifact('form', id), 'new_tier');
@@ -204,7 +204,7 @@ test('field removal: removeElement on the cell pointer drops the field from the
});
test('412 conflict: pushArtifact resolves to { success:false, error } (the signal requireSuccessfulPush halts on)', async () => {
- const { createMakerSdk } = require(BUNDLE);
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'h2-412-'));
tempDirs.push(dir);
const FID = '22222222-2222-2222-2222-222222222222';
@@ -216,8 +216,8 @@ test('412 conflict: pushArtifact resolves to { success:false, error } (the signa
delete: async () => ({ status: 204, headers: {}, body: {} }),
put: async () => ({ status: 204, headers: {}, body: {} }),
};
- const sdk = createMakerSdk({ workspacePath: dir, instanceUrl: 'https://example.crm.dynamics.com', httpClient });
- sdk.initWorkspace();
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(dir), instanceUrl: 'https://example.crm.dynamics.com', httpClient });
+ await sdk.initWorkspace();
await sdk.fetchArtifact('form', FID);
await sdk.updateElement('form', FID, '/tabs/0', { expanded: false });
const result = await sdk.pushArtifact('form', FID);
@@ -238,7 +238,7 @@ const fcell = (fn) => ({ control: { fieldName: fn, isRequired: false } });
const META3 = { new_customer: { new_name: 'String', new_tier: 'Picklist', new_note: 'Memo', new_amt: 'Money' } };
async function seedTwoSectionForm(sdk) {
- const art = sdk.createArtifact('form', { name: 'T', entityLogicalName: 'new_customer', formType: 'Main' });
+ const art = await sdk.createArtifact('form', { name: 'T', entityLogicalName: 'new_customer', formType: 'Main' });
await sdk.addElement('form', art.id, '/tabs', { name: 'tab_general', label: 'General', expanded: true, visible: true,
columns: [{ width: '100%', sections: [
secIntent('section_general', 'General', 1, [fcell('new_name'), fcell('new_tier')]),
@@ -249,7 +249,7 @@ async function seedTwoSectionForm(sdk) {
}
test('REAL BUNDLE topology: an existing form gains a tab and a section, and a section widens in place', async () => {
- const sdk = freshSdk(null, META3);
+ const sdk = await freshSdk(null, META3);
const id = await seedTwoSectionForm(sdk);
await sdk.addElement('form', id, '/tabs', { name: 'tab_audit', label: 'Audit', expanded: true, visible: true,
columns: [{ width: '100%', sections: [secIntent('section_audit', 'Audit', 2, [])] }] });
@@ -265,7 +265,7 @@ test('REAL BUNDLE topology: an existing form gains a tab and a section, and a se
test('REAL BUNDLE topology: a field cell moves between sections and serializes under the new one', async () => {
const cap = [];
- const sdk = freshSdk(cap, META3);
+ const sdk = await freshSdk(cap, META3);
const id = await seedTwoSectionForm(sdk);
// section_more is deployed EMPTY, so a row must be seeded before a cell can move into it.
await sdk.addElement('form', id, '/tabs/0/columns/0/sections/1/rows', { cells: [] });
@@ -285,8 +285,8 @@ test('REAL BUNDLE topology: a field cell moves between sections and serializes u
test('REAL BUNDLE layout: multi-column tabs and cell spans reach the serialized formxml', async () => {
const cap = [];
- const sdk = freshSdk(cap, META3);
- const art = sdk.createArtifact('form', { name: 'W', entityLogicalName: 'new_customer', formType: 'Main' });
+ const sdk = await freshSdk(cap, META3);
+ const art = await sdk.createArtifact('form', { name: 'W', entityLogicalName: 'new_customer', formType: 'Main' });
await sdk.addElement('form', art.id, '/tabs', { name: 'tab_w', label: 'W', expanded: true, visible: true, columns: [
{ width: '60%', sections: [secIntent('sec_l', 'L', 2, [Object.assign(fcell('new_name'), { colspan: 2 }), fcell('new_tier')])] },
{ width: '40%', sections: [secIntent('sec_r', 'R', 1, [Object.assign(fcell('new_note'), { rowspan: 2 })])] },
@@ -301,3 +301,46 @@ test('REAL BUNDLE layout: multi-column tabs and cell spans reach the serialized
assert.ok(nameCell, 'an authored colspan reaches the cell attribute');
assert.ok(/<cell[^>]*rowspan="2"[^>]*>[\s\S]*?datafieldname="new_note"/.test(formxml), 'an authored rowspan reaches the cell attribute');
});
+
+// ---------------------------------------------------------------------------
+// UNKNOWN FORM KEYS. The SDK now REFUSES a tab/section property it does not recognise instead of
+// dropping it at serialization. `validateFormLayoutKeys` (app-spec.js) rejects the same keys at
+// author time, and the two are deliberately kept BOTH: the spec gate fails before any workspace or
+// network call and names the real mechanism, while this upstream check is the backstop for anything
+// that reaches the SDK by another route.
+//
+// Pinned here because the refusal lives in the VENDORED BUNDLE: a re-vendor that lost it would
+// silently reopen the silent-drop hole, and every spec-level test would still pass.
+// ---------------------------------------------------------------------------
+
+test('REAL BUNDLE: an unrecognised tab or section property is refused, not silently dropped', async () => {
+ const baseSection = { name: 's0', label: 'S', visible: true, showLabel: true, columns: 1, rows: [] };
+ const attempt = async (tabExtra, sectionExtra) => {
+ const sdk = await freshSdk(null, META3);
+ const art = await sdk.createArtifact('form', { name: 'K', entityLogicalName: 'new_customer', formType: 'Main' });
+ try {
+ await sdk.addElement('form', art.id, '/tabs', Object.assign(
+ { name: 't0', label: 'T', visible: true, columns: [{ width: '100%', sections: [Object.assign({}, baseSection, sectionExtra)] }] },
+ tabExtra));
+ return null;
+ } catch (e) { return String(e && e.message); }
+ };
+
+ // The four keys app-spec.js names in FORM_LAYOUT_KEY_HINTS, i.e. the ones an author actually
+ // reaches for. Each must be refused rather than accepted-and-dropped.
+ for (const [what, tabExtra, sectionExtra] of [
+ ['tab showLabel', { showLabel: false }, null],
+ ['tab labelPosition', { labelPosition: 'top' }, null],
+ ['section labelPosition', null, { labelPosition: 'top' }],
+ ['section locked', null, { locked: true }],
+ ]) {
+ const err = await attempt(tabExtra, sectionExtra);
+ assert.ok(err, `${what}: the SDK must refuse it, not accept and drop it`);
+ assert.match(err, /not a (tab|section) property/, `${what}: refusal should name the offending property — got ${err}`);
+ }
+
+ // And the converse, which is what keeps the plugin's allow-list from being over-restrictive: every
+ // key the compiler actually emits is still accepted.
+ assert.strictEqual(await attempt({ expanded: true }, { columns: 2 }), null,
+ 'the properties the compiler emits must remain accepted');
+});
\ No newline at end of file
diff --git a/plugins/model-apps/scripts/tests/header-nav-real-bundle.test.js b/plugins/model-apps/scripts/tests/header-nav-real-bundle.test.js
index bb39bbb3b..291b6463b 100644
--- a/plugins/model-apps/scripts/tests/header-nav-real-bundle.test.js
+++ b/plugins/model-apps/scripts/tests/header-nav-real-bundle.test.js
@@ -31,8 +31,8 @@ const dirs = [];
// The setting write is an upsert keyed by (settingdefinitionid, parentappmoduleid), so the SDK first
// looks the definition up and probes for an existing row. Answer both, then record the write.
-function sdkWithCapture({ existingRow = null } = {}) {
- const { createMakerSdk } = require(BUNDLE);
+async function sdkWithCapture({ existingRow = null } = {}) {
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'hdrnav-'));
dirs.push(dir);
const writes = [];
@@ -52,8 +52,8 @@ function sdkWithCapture({ existingRow = null } = {}) {
put: async () => ({ status: 204, headers: {}, body: {} }),
delete: async () => ({ status: 204, headers: {}, body: {} }),
};
- const sdk = createMakerSdk({ workspacePath: dir, instanceUrl: 'https://contoso.crm.dynamics.com', httpClient });
- sdk.initWorkspace();
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(dir), instanceUrl: 'https://contoso.crm.dynamics.com', httpClient });
+ await sdk.initWorkspace();
return { sdk, writes };
}
@@ -65,7 +65,7 @@ const settingValueOf = (writes) => {
test.after(() => { for (const d of dirs) fs.rmSync(d, { recursive: true, force: true }); });
test('REAL BUNDLE: enabling the header/navigation refresh writes the tri-state ON value "2"', async () => {
- const { sdk, writes } = sdkWithCapture();
+ const { sdk, writes } = await sdkWithCapture();
const outcome = await sdk.setHeaderAndNavigationRefresh(APP_ID, true);
assert.ok(['created', 'updated', 'unchanged'].includes(outcome), `unexpected outcome: ${JSON.stringify(outcome)}`);
const value = settingValueOf(writes);
@@ -75,12 +75,12 @@ test('REAL BUNDLE: enabling the header/navigation refresh writes the tri-state O
});
test('REAL BUNDLE: disabling writes "1", and ON/OFF are not the same value', async () => {
- const { sdk, writes } = sdkWithCapture();
+ const { sdk, writes } = await sdkWithCapture();
await sdk.setHeaderAndNavigationRefresh(APP_ID, false);
const off = settingValueOf(writes);
assert.strictEqual(off, '1', 'OFF is "1"');
- const on = sdkWithCapture();
+ const on = await sdkWithCapture();
await on.sdk.setHeaderAndNavigationRefresh(APP_ID, true);
// The guard that matters if the constants are ever swapped or collapsed: if ON and OFF serialized
// identically, every single-value assertion above could still pass on one branch.
@@ -90,7 +90,7 @@ test('REAL BUNDLE: disabling writes "1", and ON/OFF are not the same value', asy
test('REAL BUNDLE: the setting row is bound to the app module id', async () => {
// The row is keyed by (settingdefinitionid, parentappmoduleid). Binding the wrong id would write a
// real row that simply governs nothing — a silent no-op with a success return.
- const { sdk, writes } = sdkWithCapture();
+ const { sdk, writes } = await sdkWithCapture();
await sdk.setHeaderAndNavigationRefresh(APP_ID, true);
const body = writes.find((w) => w.body && typeof w.body.value === 'string')?.body || {};
const bind = JSON.stringify(body);
@@ -104,7 +104,7 @@ test('REAL BUNDLE: a non-boolean is rejected rather than coerced', async () => {
//
// Wrapped in an async thunk because the SDK validates SYNCHRONOUSLY — it throws before returning a
// promise, which `assert.rejects` alone does not treat as a rejection.
- const { sdk } = sdkWithCapture();
+ const { sdk } = await sdkWithCapture();
for (const bad of ['true', 'false', 1, 0, null]) {
await assert.rejects(
async () => sdk.setHeaderAndNavigationRefresh(APP_ID, bad),
@@ -112,7 +112,7 @@ test('REAL BUNDLE: a non-boolean is rejected rather than coerced', async () => {
);
}
// And the happy path still works, so the guard is not simply rejecting everything.
- const ok = sdkWithCapture();
+ const ok = await sdkWithCapture();
await ok.sdk.setHeaderAndNavigationRefresh(APP_ID, true);
assert.strictEqual(settingValueOf(ok.writes), '2');
});
@@ -125,8 +125,8 @@ test('REAL BUNDLE: a NEW app gets the header/navigation refresh ON by default',
// author who wants the classic header/navigation needs an ACTIVE off-write — which is why the
// build honours `false` instead of skipping it. If a future SDK flips this default, this test is
// what tells us before a user's app silently changes appearance.
- const { sdk, writes } = sdkWithCapture();
- const app = sdk.createArtifact('app', { name: 'Default App', uniqueName: 'cr_defaultapp', iconWebResourceId: APP_ICON_ID });
+ const { sdk, writes } = await sdkWithCapture();
+ const app = await sdk.createArtifact('app', { name: 'Default App', uniqueName: 'cr_defaultapp', iconWebResourceId: APP_ICON_ID });
assert.strictEqual(app.headerAndNavigationRefresh, true,
'the SDK defaults the app artifact field to true');
@@ -140,8 +140,8 @@ test('REAL BUNDLE: a NEW app gets the header/navigation refresh ON by default',
test('REAL BUNDLE: setting headerAndNavigationRefresh false on the app writes the OFF value', async () => {
// The opt-out path. '1' is OFF for this tri-state; if this ever wrote '2' or nothing, an author
// asking for the classic experience would silently get the new one.
- const { sdk, writes } = sdkWithCapture();
- const app = sdk.createArtifact('app', { name: 'Off App', uniqueName: 'cr_offapp', headerAndNavigationRefresh: false, iconWebResourceId: APP_ICON_ID });
+ const { sdk, writes } = await sdkWithCapture();
+ const app = await sdk.createArtifact('app', { name: 'Off App', uniqueName: 'cr_offapp', headerAndNavigationRefresh: false, iconWebResourceId: APP_ICON_ID });
assert.strictEqual(app.headerAndNavigationRefresh, false, 'the explicit false survives onto the artifact');
await sdk.pushArtifact('app', app.id);
diff --git a/plugins/model-apps/scripts/tests/lcid-real-bundle.test.js b/plugins/model-apps/scripts/tests/lcid-real-bundle.test.js
index d9319b992..3ccbb6439 100644
--- a/plugins/model-apps/scripts/tests/lcid-real-bundle.test.js
+++ b/plugins/model-apps/scripts/tests/lcid-real-bundle.test.js
@@ -53,19 +53,19 @@ const dirs = [];
// Offline client that records every write so the serialized payload can be inspected. Reads answer
// with an empty envelope; nothing here needs a live org.
-function sdkAt(languageCode) {
- const { createMakerSdk } = require(BUNDLE);
+async function sdkAt(languageCode) {
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'lcid-'));
dirs.push(dir);
const capture = [];
const rec = (verb) => async (url, body) => { capture.push({ verb, url, body }); return {}; };
const sdk = createMakerSdk({
- workspacePath: dir,
+ workspaceStorage: createNodeWorkspaceStorage(dir),
instanceUrl: 'https://contoso.crm.dynamics.com',
httpClient: { get: async () => ({}), post: rec('post'), patch: rec('patch'), put: rec('put'), delete: rec('delete') },
...(languageCode ? { languageCode } : {}),
});
- sdk.initWorkspace();
+ await sdk.initWorkspace();
return { sdk, capture };
}
@@ -73,8 +73,8 @@ const langsIn = (s) => [...new Set(String(s || '').match(/languagecode="\d+"/g)
const lcidsIn = (s) => [...new Set(String(s || '').match(/LCID="\d+"/g) || [])];
async function pushedForm(languageCode) {
- const { sdk, capture } = sdkAt(languageCode);
- const form = sdk.createArtifact('form', { entityLogicalName: 'account', name: 'LCID Form' });
+ const { sdk, capture } = await sdkAt(languageCode);
+ const form = await sdk.createArtifact('form', { entityLogicalName: 'account', name: 'LCID Form' });
await sdk.pushArtifact('form', form.id);
const write = capture.find((c) => c.body && typeof c.body.formxml === 'string');
assert.ok(write, 'a write carrying FormXML was issued; got ' + JSON.stringify(capture.map((c) => c.url)));
@@ -98,8 +98,8 @@ test('REAL BUNDLE: omitting languageCode preserves the previous 1033 behaviour e
test('REAL BUNDLE: the sitemap title LCID follows the configured language too (#455)', async () => {
// The sitemap is the other half of #455 — <Titles><Title LCID="…"> was hardcoded alongside FormXML.
- const { sdk, capture } = sdkAt(1036);
- const app = sdk.createArtifact('app', { name: 'LCID App', iconWebResourceId: APP_ICON_ID });
+ const { sdk, capture } = await sdkAt(1036);
+ const app = await sdk.createArtifact('app', { name: 'LCID App', iconWebResourceId: APP_ICON_ID });
await sdk.pushArtifact('app', app.id);
const write = capture.find((c) => c.body && typeof c.body.sitemapxml === 'string');
assert.ok(write, 'a write carrying sitemap XML was issued; got ' + JSON.stringify(capture.map((c) => c.url)));
@@ -127,8 +127,8 @@ test('REAL BUNDLE: languageCode is a live contract — two LCIDs must not serial
// failure mode this whole file exists to prevent.
async function pushedDashboard(languageCode) {
const { dashboardComponent } = require(path.resolve(__dirname, '..', 'lib', 'sdk-build.js'));
- const { sdk, capture } = sdkAt(languageCode);
- const art = sdk.createArtifact('dashboard', { name: 'LCID Dashboard' });
+ const { sdk, capture } = await sdkAt(languageCode);
+ const art = await sdk.createArtifact('dashboard', { name: 'LCID Dashboard' });
// A tile must carry a NAME: the name becomes the cell's <label description="…">, and a dashboard
// with no labelled tile emits no <labels> at all — which is exactly why this was uncoverable
// before. One list tile and one chart tile, so both branches of dashboardComponent are exercised.
diff --git a/plugins/model-apps/scripts/tests/provision-solution.test.js b/plugins/model-apps/scripts/tests/provision-solution.test.js
index 283098f93..a9062cb7d 100644
--- a/plugins/model-apps/scripts/tests/provision-solution.test.js
+++ b/plugins/model-apps/scripts/tests/provision-solution.test.js
@@ -306,6 +306,10 @@ function solutionHarness({ argv, sdkFactoryThrows = null, initThrows = null, rmT
},
'./lib/sdk-http-client': { createAzHttpClient: () => ({}) },
'./vendor/cds-maker-sdk.cjs': {
+ // The CLI builds its store explicitly via the /node adapter, so the mocked bundle must
+ // expose it. The marker carries the root so assertions can still check WHERE the throwaway
+ // workspace was placed.
+ createNodeWorkspaceStorage: (root) => ({ __mockWorkspaceRoot: root }),
createMakerSdk: () => {
if (sdkFactoryThrows) throw new Error(sdkFactoryThrows);
return {
diff --git a/plugins/model-apps/scripts/tests/sdk-async-surface.test.js b/plugins/model-apps/scripts/tests/sdk-async-surface.test.js
index 1045fedfc..66b6286a0 100644
--- a/plugins/model-apps/scripts/tests/sdk-async-surface.test.js
+++ b/plugins/model-apps/scripts/tests/sdk-async-surface.test.js
@@ -55,8 +55,10 @@ const SCRIPTS_DIR = path.resolve(__dirname, '..');
// test fails if the bundle disagrees with this list, in either direction.
const ASYNC_SDK_METHODS = [
'addElement',
+ 'createArtifact',
'findElements',
'getArtifact',
+ 'initWorkspace',
'moveElement',
'queryTree',
'removeElement',
@@ -555,7 +557,7 @@ test('a STALE_ARTIFACT from the async surface HALTS the build (fails closed, wit
// do, rather than continuing and shipping a half-applied artifact. This pins that, so a future
// refactor of the error path cannot quietly downgrade it to a warning.
const { makeRunner, BuildHalt } = require(path.resolve(SCRIPTS_DIR, 'lib', 'entity-provision.js'));
- const { SdkError } = require(BUNDLE);
+ const { SdkError, createNodeWorkspaceStorage } = require(BUNDLE);
const events = [];
const runner = makeRunner({ emit: (e) => events.push(e), total: 1 });
@@ -757,7 +759,7 @@ test('sanitizeSubject output can NEVER match a merge prefix (the actual contract
});
test('the real vendored bundle agrees with ASYNC_SDK_METHODS (no drift in either direction)', async () => {
- const { createMakerSdk } = require(BUNDLE);
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'async-surface-'));
try {
const httpClient = {
@@ -767,9 +769,9 @@ test('the real vendored bundle agrees with ASYNC_SDK_METHODS (no drift in either
delete: async () => ({ status: 204, headers: {}, body: {} }),
put: async () => ({ status: 204, headers: {}, body: {} }),
};
- const sdk = createMakerSdk({ workspacePath: dir, instanceUrl: 'https://example.crm.dynamics.com', httpClient });
- sdk.initWorkspace();
- const art = sdk.createArtifact('form', { name: 'F', entityLogicalName: 'account', formType: 'main', status: 'draft' });
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(dir), instanceUrl: 'https://example.crm.dynamics.com', httpClient });
+ await sdk.initWorkspace();
+ const art = await sdk.createArtifact('form', { name: 'F', entityLogicalName: 'account', formType: 'main', status: 'draft' });
for (const method of ASYNC_SDK_METHODS) {
assert.strictEqual(typeof sdk[method], 'function', `${method} exists on the bundle`);
@@ -789,17 +791,30 @@ test('the real vendored bundle agrees with ASYNC_SDK_METHODS (no drift in either
await Promise.resolve(returned).catch(() => {});
}
- // The counter-examples that make "in either direction" true rather than a slogan. These are
- // called SYNCHRONOUSLY throughout the plugin, in many places, without `await`. If the SDK ever
- // makes one of them async, every one of those call sites becomes the same silent-corruption bug
- // — and nothing else in the suite would notice, because the async list above would still be
- // satisfied. A review pointed out this test proved only one direction; this is the other.
- assert.ok(!(art && typeof art.then === 'function'),
- 'createArtifact is still synchronous — the plugin uses its return value directly');
- const ws = sdk.initWorkspace();
- assert.ok(!(ws && typeof ws.then === 'function'),
- 'initWorkspace is still synchronous — every engine calls it un-awaited before any other work; '
- + 'if it became async, the workspace could be unready when the first artifact call runs');
+ // `createArtifact` and `initWorkspace` MOVED into this list on the injected-storage re-vendor.
+ // They are the two methods the uptake had to re-await at ~10 call sites, so leaving them out
+ // would have left the tripwire blind exactly where the risk had just moved: a future
+ // `provision.createArtifact(type, def).id` lands as `undefined` with no error.
+ //
+ // They also used to be the "still synchronous" counter-examples below, asserted as
+ // `!(await x).then` — which `await` makes unfalsifiable, so both assertions passed while their
+ // messages stated the opposite of the truth. The counter-example is now a genuinely
+ // synchronous method, probed WITHOUT `await`.
+ // The counter-example that makes "in either direction" true rather than a slogan, probed WITHOUT
+ // `await` so the check can actually fail. `assignMissingIds` is one of only three genuinely
+ // synchronous methods left on the bundle (with `assertLanguageMatches`/`assertStructurallyValid`)
+ // — measured by calling every SDK method and classifying the return.
+ //
+ // Asserted to EXIST rather than guarded with `typeof`: a guarded probe silently becomes a no-op
+ // the moment the method is renamed, which is exactly how the previous version of this check
+ // rotted.
+ const stillSync = 'assignMissingIds';
+ assert.strictEqual(typeof sdk[stillSync], 'function',
+ `${stillSync} must exist on the bundle — this counter-example is the only thing proving the async list is not just "everything"`);
+ const syncReturn = sdk[stillSync]({ tabs: [] });
+ assert.ok(!(syncReturn && typeof syncReturn.then === 'function'),
+ `${stillSync} is still synchronous. If it became async, its un-awaited call sites become the same `
+ + 'silent-corruption bug the list above exists to prevent — add it to ASYNC_SDK_METHODS and await it.');
} finally {
fs.rmSync(dir, { recursive: true, force: true });
}
@@ -829,3 +844,44 @@ test('an unparseable file is REPORTED, never silently skipped', () => {
const hits = findUnawaitedCalls('const x = ;;;(');
assert.ok(hits.some((h) => h.kind === 'parse error'), 'a parse failure must surface as a finding');
});
+
+// --- temp-workspace lifecycle: SDK CONSTRUCTION must sit inside the cleanup guard ---------------
+//
+// Every CLI entry point mints a throwaway workspace directory and hands the caller a `cleanup`
+// callback. The caller's `finally { cleanup() }` only becomes reachable once the factory RETURNS, so
+// anything that throws before the return strands the directory for the life of the machine.
+//
+// Guarding only `initWorkspace` is NOT enough, and that was a real (caught-in-review) miss: since the
+// injected-storage uptake the `createMakerSdk` CONSTRUCTOR builds the filesystem adapter
+// (`createNodeWorkspaceStorage`), so it touches disk and can fail on its own. Two entry points had
+// the constructor outside the net while their comments claimed otherwise.
+//
+// Checked by SOURCE SCAN because the factories are CLI-internal — none is exported, so there is no
+// seam to drive a construction failure through. The property checked is the one that matters
+// (construction happens inside a guarded region that cleans up), not a brittle line-order heuristic:
+// an earlier attempt compared `const cleanup` and `initWorkspace` offsets and wrongly flagged
+// teardown-model-app.js, which declares cleanup after the init but inside a try whose catch removes
+// the directory.
+test('every CLI that mints a throwaway workspace constructs the SDK INSIDE its cleanup guard', () => {
+ const dir = path.join(__dirname, '..');
+ const files = fs.readdirSync(dir).filter((f) => f.endsWith('.js'));
+ const checked = [];
+ for (const file of files) {
+ const src = fs.readFileSync(path.join(dir, file), 'utf8');
+ const mk = src.indexOf('mkdtempSync');
+ if (mk < 0 || !/createMakerSdk\(/.test(src)) continue;
+ const tryAt = src.indexOf('try {', mk);
+ const ctorAt = src.indexOf('createMakerSdk(', mk);
+ assert.ok(tryAt >= 0 && tryAt < ctorAt,
+ `${file}: the createMakerSdk construction after mkdtempSync must be inside a try — the constructor builds the `
+ + 'filesystem adapter and can throw, and the caller\'s finally is unreachable until this function returns');
+ // …and the guard must actually reclaim the directory, not merely swallow the error.
+ const after = src.slice(tryAt);
+ assert.ok(/catch[\s\S]{0,200}?(cleanup\(\)|rmSync)/.test(after) || /finally[\s\S]{0,200}?(cleanup\(\)|rmSync)/.test(after),
+ `${file}: the guard around SDK construction must remove the throwaway directory (cleanup()/rmSync) before rethrowing`);
+ checked.push(file);
+ }
+ // A scan that matches nothing "passes" forever. These are the five entry points that own a
+ // throwaway workspace today; if one is renamed the count changes and this fails loudly.
+ assert.ok(checked.length >= 5, `expected to scan at least 5 entry points, scanned ${checked.length}: ${checked.join(', ')}`);
+});
\ No newline at end of file
diff --git a/plugins/model-apps/scripts/tests/sdk-build.test.js b/plugins/model-apps/scripts/tests/sdk-build.test.js
index 006e62f87..890761c10 100644
--- a/plugins/model-apps/scripts/tests/sdk-build.test.js
+++ b/plugins/model-apps/scripts/tests/sdk-build.test.js
@@ -3768,7 +3768,7 @@ test('pages: app-shell-only run (pages EXCLUDED) HALTS rather than orphan live g
'a page-less app-shell-only rewrite over an app with live genpages must HALT without --allow-destructive',
);
// With --allow-destructive it proceeds (detaches by writing the page-less sitemap).
- const { sdk, calls } = mk();
+ const { sdk, calls } = await mk();
await runSdkBuild(spec, { sdk, apply: true, allowDestructive: true, env: 'https://x', appDir, phases: ['solution', 'data-model', 'app-shell'] });
assert.ok(find(calls, 'updateElement').some((c) => c.args[2] === '/siteMap'), 'with --allow-destructive the page-less sitemap is written (detach)');
} finally { fs.rmSync(appDir, { recursive: true, force: true }); }
diff --git a/plugins/model-apps/scripts/tests/sdk-surface-contract.test.js b/plugins/model-apps/scripts/tests/sdk-surface-contract.test.js
index b6105fd34..08256290c 100644
--- a/plugins/model-apps/scripts/tests/sdk-surface-contract.test.js
+++ b/plugins/model-apps/scripts/tests/sdk-surface-contract.test.js
@@ -100,18 +100,18 @@ const SKILL_SDK_SURFACE = [
'updateRecord',
'updateTable',
'updateWebResource',
- // The business-rule designer's OWN completeness validator. Nothing on the push path runs it, and a
- // rule the compiler could not understand deploys as an EMPTY rule with HTTP 204 — so losing this
- // method silently re-opens a trap that has no other detector.
- 'validateBusinessRule',
+ // ⚠ `validateBusinessRule` was REMOVED from this list deliberately. The SDK no longer exposes it:
+ // the designer's completeness validator now runs INTERNALLY on every business-rule save, so an
+ // incomplete rule is refused by `pushArtifact` rather than by an opt-in call. Re-adding it here
+ // would fail this guard against a correct bundle.
];
function realSdk() {
- const { createMakerSdk } = require(BUNDLE);
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const noop = async () => ({});
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'sdk-surface-'));
const sdk = createMakerSdk({
- workspacePath: dir,
+ workspaceStorage: createNodeWorkspaceStorage(dir),
instanceUrl: 'https://example.crm.dynamics.com',
httpClient: { get: noop, post: noop, patch: noop, delete: noop, put: noop },
});
diff --git a/plugins/model-apps/scripts/tests/sdk-uptake-contract.test.js b/plugins/model-apps/scripts/tests/sdk-uptake-contract.test.js
index 08e990eb6..02ccd0fcd 100644
--- a/plugins/model-apps/scripts/tests/sdk-uptake-contract.test.js
+++ b/plugins/model-apps/scripts/tests/sdk-uptake-contract.test.js
@@ -21,14 +21,14 @@ const dirs = [];
// Offline SDK whose POST handler the test supplies, so a server fault can be simulated exactly.
// GET answers an empty collection: that is what an org with no image web resource looks like, which
// is precisely the state the icon contract below is about.
-function sdkWith({ post, get, del } = {}) {
- const { createMakerSdk } = require(BUNDLE);
+async function sdkWith({ post, get, del } = {}) {
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'uptake-'));
dirs.push(dir);
const calls = [];
const ok204 = { status: 204, headers: { 'odata-entityid': 'https://x/workflows(55555555-5555-5555-5555-555555555555)' }, body: {} };
const sdk = createMakerSdk({
- workspacePath: dir,
+ workspaceStorage: createNodeWorkspaceStorage(dir),
instanceUrl: 'https://contoso.crm.dynamics.com',
httpClient: {
get: async (url) => { calls.push({ verb: 'GET', url }); return (get && get(url)) || { status: 200, headers: {}, body: { value: [] } }; },
@@ -38,7 +38,7 @@ function sdkWith({ post, get, del } = {}) {
delete: async (url) => { calls.push({ verb: 'DELETE', url }); return (del && del(url)) || { status: 204, headers: {}, body: {} }; },
},
});
- sdk.initWorkspace();
+ await sdk.initWorkspace();
return { sdk, calls };
}
@@ -47,7 +47,7 @@ test.after(() => { for (const d of dirs) fs.rmSync(d, { recursive: true, force:
// The smallest complete business rule, authored the way the build authors one: create the artifact,
// set the condition tree through the generic element surface, push. Shared by the #482 tests below.
async function authorDupGuard(sdk) {
- const art = sdk.createArtifact('businessRule', {
+ const art = await sdk.createArtifact('businessRule', {
name: 'Dup Guard', entityLogicalName: 'account', scope: 'Entity', status: 'Draft',
});
await sdk.updateElement('businessRule', art.id, '/rootCondition', {
@@ -70,8 +70,8 @@ test('REAL BUNDLE: creating an app with no icon and no image web resource fails
// `appDef` passes `iconWebResourceId`), so this pins a boundary we depend on NOT crossing. If a
// future bundle silently restored the old fallback, an app could again be created pointing at a
// JavaScript file.
- const { sdk } = sdkWith();
- const app = sdk.createArtifact('app', { name: 'No Icon App', uniqueName: 'cr_noiconapp' });
+ const { sdk } = await sdkWith();
+ const app = await sdk.createArtifact('app', { name: 'No Icon App', uniqueName: 'cr_noiconapp' });
await assert.rejects(
() => sdk.pushArtifact('app', app.id),
(err) => {
@@ -87,8 +87,8 @@ test('REAL BUNDLE: an explicit iconWebResourceId is used verbatim and skips disc
// ignored it would silently re-introduce the cross-solution managed-icon dependency the plugin
// generates its own SVG to avoid.
const ICON = '11111111-2222-3333-4444-555555555555';
- const { sdk, calls } = sdkWith();
- const app = sdk.createArtifact('app', { name: 'Icon App', uniqueName: 'cr_iconapp', iconWebResourceId: ICON });
+ const { sdk, calls } = await sdkWith();
+ const app = await sdk.createArtifact('app', { name: 'Icon App', uniqueName: 'cr_iconapp', iconWebResourceId: ICON });
await sdk.pushArtifact('app', app.id);
const write = calls.find((c) => c.verb === 'POST' && c.body && c.body.webresourceid);
assert.ok(write, 'the appmodule write carries a webresourceid; urls: ' + JSON.stringify(calls.map((c) => c.url)));
@@ -108,8 +108,8 @@ const BR_ENTITY = 'lvz_ticket';
// go in `clauses` and actions in `trueBranch`. Passing `operator`/`lhs`/`rhs`/`thenActions` (a very
// natural guess) merges those keys onto the node, the compiler ignores them, and you get a rule with
// an EMPTY condition that still creates 204 — a wrong artifact behind a success. Pinned below.
-function authorRule(sdk) {
- const art = sdk.createArtifact('businessRule', {
+async function authorRule(sdk) {
+ const art = await sdk.createArtifact('businessRule', {
name: 'Hide notes when closed', entityLogicalName: BR_ENTITY, scope: 'Entity', status: 'Active',
});
return art;
@@ -122,8 +122,8 @@ const CONDITION = {
};
test('REAL BUNDLE: a business rule goes through the SUPPORTED bound member first', async () => {
- const { sdk, calls } = sdkWith();
- const art = authorRule(sdk);
+ const { sdk, calls } = await sdkWith();
+ const art = await authorRule(sdk);
await sdk.updateElement('businessRule', art.id, '/rootCondition', CONDITION);
const res = await sdk.pushArtifact('businessRule', art.id);
assert.strictEqual(res.saved, true);
@@ -155,12 +155,12 @@ test('REAL BUNDLE: a qualifying 400 no longer falls back — it throws, and writ
// Pinned here because the failure mode of losing this is invisible: a re-vendored bundle that
// resurrected the fallback would make every one of these pushes "succeed" again, with narrowed
// rules nobody asked for.
- const { sdk, calls } = sdkWith({
+ const { sdk, calls } = await sdkWith({
post: (url) => (/WithWfomJson/i.test(url)
? { status: 400, headers: {}, body: { error: { code: '0x80040216', message: 'System failure in WorkflowService' } } }
: undefined),
});
- const art = authorRule(sdk);
+ const art = await authorRule(sdk);
await sdk.updateElement('businessRule', art.id, '/rootCondition', CONDITION);
await assert.rejects(() => sdk.pushArtifact('businessRule', art.id), 'the 400 must propagate, not be papered over');
@@ -182,12 +182,12 @@ test('REAL BUNDLE: a NON-qualifying failure must NOT fall back (a second write c
// that into a build halt. Asserting "throws" for it would have been asserting the wrong contract.
const THROWS = [[401, null], [403, null], [429, null], [500, null], [400, '0x80040265']];
for (const [status, code] of THROWS) {
- const { sdk, calls } = sdkWith({
+ const { sdk, calls } = await sdkWith({
post: (url) => (/WithWfomJson/i.test(url)
? { status, headers: {}, body: { error: { code: code || '0x0', message: 'unrelated' } } }
: undefined),
});
- const art = authorRule(sdk);
+ const art = await authorRule(sdk);
await sdk.updateElement('businessRule', art.id, '/rootCondition', CONDITION);
await assert.rejects(() => sdk.pushArtifact('businessRule', art.id), `HTTP ${status} must propagate`);
assert.strictEqual(
@@ -196,10 +196,10 @@ test('REAL BUNDLE: a NON-qualifying failure must NOT fall back (a second write c
}
// 412: reported by value, still no second write.
- const { sdk, calls } = sdkWith({
+ const { sdk, calls } = await sdkWith({
post: (url) => (/WithWfomJson/i.test(url) ? { status: 412, headers: {}, body: {} } : undefined),
});
- const art = authorRule(sdk);
+ const art = await authorRule(sdk);
await sdk.updateElement('businessRule', art.id, '/rootCondition', CONDITION);
const res = await sdk.pushArtifact('businessRule', art.id);
assert.strictEqual(res.saved, false, 'a version conflict is reported by value, not swallowed');
@@ -226,10 +226,10 @@ test('REAL BUNDLE: a 404 on the bound member is refused with a STABLE, matchable
// `saved` staying FALSE is the load-bearing half — "skipped" must never read as "written". The
// plugin reads the code off the CAUSE CHAIN so both shapes reach the same skip; asserting only
// one of them here is what let the by-value form turn into a build halt on most environments.
- const { sdk, calls } = sdkWith({
+ const { sdk, calls } = await sdkWith({
post: (url) => (/WithWfomJson/i.test(url) ? { status: 404, headers: {}, body: {} } : undefined),
});
- const art = authorRule(sdk);
+ const art = await authorRule(sdk);
await sdk.updateElement('businessRule', art.id, '/rootCondition', CONDITION);
const res = await sdk.pushArtifact('businessRule', art.id).then((r) => r, (e) => ({ threw: e }));
@@ -249,31 +249,41 @@ test('REAL BUNDLE: a 404 on the bound member is refused with a STABLE, matchable
'and nothing else may be written in its place');
});
-test('REAL BUNDLE: a wrongly-shaped condition produces an EMPTY rule rather than erroring', async () => {
- // Recorded because it cost real time and would cost it again. `operator`/`lhs`/`rhs`/`thenActions`
- // is the natural guess at the shape; `updateElement` merges those keys onto the node, the
- // serializer ignores them, and the push SUCCEEDS with a workflow object model that mentions none of
- // the author's columns.
+test('REAL BUNDLE: a wrongly-shaped condition is now REFUSED at push, closing the empty-rule trap', async () => {
+ // ⚠ THIS TEST WAS INVERTED DELIBERATELY. It used to assert the opposite — that the push SUCCEEDS
+ // and writes a rule mentioning none of the author's columns ("the push succeeds — that is the
+ // trap"). That was an accurate record of the SDK's old behaviour and it cost real time to find:
+ // `operator`/`lhs`/`rhs`/`thenActions` is the natural guess at the shape, `updateElement` merged
+ // those keys onto the node, the serializer ignored them, and the result was HTTP 204 for a rule
+ // that could never fire.
//
- // So a caller CANNOT rely on an error to tell them the shape is wrong. The plugin's App Spec
- // validation exists precisely because of this: it checks `conditions`/`actions` itself before
- // anything is pushed.
- const { sdk, calls } = sdkWith();
- const art = authorRule(sdk);
+ // The SDK now runs the business-rule designer's own completeness validator on EVERY save, so the
+ // trap is closed at the source: the push is refused and the operator is told which clause and
+ // action are missing. Keeping the old assertion would pin the SDK to the defect.
+ const { sdk, calls } = await sdkWith();
+ const art = await authorRule(sdk);
await sdk.updateElement('businessRule', art.id, '/rootCondition', {
operator: 'Equal',
lhs: { type: 'Field', attributeLogicalName: 'lvz_status' },
rhs: { type: 'Value', value: 'Closed' },
thenActions: [{ type: 'SetVisibility', attributeLogicalName: 'lvz_notes', visible: false }],
});
- const res = await sdk.pushArtifact('businessRule', art.id);
- assert.strictEqual(res.saved, true, 'the push succeeds — that is the trap');
+ await assert.rejects(
+ sdk.pushArtifact('businessRule', art.id),
+ (err) => {
+ assert.match(err.message, /Validation failed/i, `expected a validation refusal; got: ${err.message}`);
+ // The operator must be told WHAT is missing, not merely that something is.
+ assert.match(err.message, /clause/i, 'the message names the missing clause');
+ assert.match(err.message, /action/i, 'the message names the missing action');
+ return true;
+ }
+ );
+
+ // The decisive assertion: nothing reached the wire. A refusal that still wrote the rule would be
+ // worse than the old trap, because it would report failure AND leave the artifact behind.
const bound = calls.find((c) => c.verb === 'POST' && /CreateProcessWithWfomJson/i.test(String(c.url)));
- assert.ok(bound, 'a rule is still written');
- const wfom = String(bound.body.WfomJson);
- assert.doesNotMatch(wfom, /lvz_status/, 'the guessed shape contributes NO condition');
- assert.doesNotMatch(wfom, /lvz_notes/, 'and NO action');
+ assert.strictEqual(bound, undefined, 'the incomplete rule is never written');
});
// ---------------------------------------------------------------------------------------------
@@ -339,7 +349,7 @@ test('REAL BUNDLE: AI_APP_SETTING matches the SDK per-app setting map exactly',
//
// https://github.com/microsoft/power-platform-skills/issues/482
test('REAL BUNDLE: the happy path writes the rule EXACTLY once', async () => {
- const { sdk, calls } = sdkWith();
+ const { sdk, calls } = await sdkWith();
const res = await authorDupGuard(sdk);
assert.strictEqual(res.saved, true);
@@ -369,7 +379,7 @@ test('REAL BUNDLE: no failure of the bound member produces a second write', asyn
[500, null],
];
for (const [status, code] of FAILURES) {
- const { sdk, calls } = sdkWith({
+ const { sdk, calls } = await sdkWith({
post: (url) => (/CreateProcessWithWfomJson/i.test(url)
? { status, headers: {}, body: code ? { error: { code, message: 'fault' } } : {} }
: undefined),
diff --git a/plugins/model-apps/scripts/tests/sitemap-icon-real-bundle.test.js b/plugins/model-apps/scripts/tests/sitemap-icon-real-bundle.test.js
index 6eebf3903..0764b9a62 100644
--- a/plugins/model-apps/scripts/tests/sitemap-icon-real-bundle.test.js
+++ b/plugins/model-apps/scripts/tests/sitemap-icon-real-bundle.test.js
@@ -50,8 +50,8 @@ const tempDirs = [];
test.after(() => { for (const d of tempDirs) fs.rmSync(d, { recursive: true, force: true }); });
/** A real SDK over a fake Dataverse holding {@link DEPLOYED_SITEMAP_XML}. */
-function freshSdk() {
- const { createMakerSdk } = require(BUNDLE);
+async function freshSdk() {
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'sitemap-icon-'));
tempDirs.push(dir);
const posted = [];
@@ -91,8 +91,8 @@ function freshSdk() {
delete: async () => ({ status: 204, headers: {}, body: {} }),
put: async () => ({ status: 204, headers: {}, body: {} }),
};
- const sdk = createMakerSdk({ workspacePath: dir, instanceUrl: 'https://example.crm.dynamics.com', httpClient });
- sdk.initWorkspace();
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(dir), instanceUrl: 'https://example.crm.dynamics.com', httpClient });
+ await sdk.initWorkspace();
return { sdk, lastSitemapXml: () => posted[posted.length - 1] || '' };
}
@@ -100,7 +100,7 @@ function freshSdk() {
const subAreaTag = (xml) => (/<SubArea\b[^>]*>/.exec(xml) || [''])[0];
test('REAL BUNDLE: the plugin\u2019s whole-/siteMap replace cannot carry a dropped Icon forward', async () => {
- const { sdk, lastSitemapXml } = freshSdk();
+ const { sdk, lastSitemapXml } = await freshSdk();
const deployed = await sdk.fetchArtifact('app', APP_ID);
assert.strictEqual(deployed.siteMap.areas[0].groups[0].subAreas[0].icon, 'contoso_legacy.png',
'precondition: the deployed app really does carry the legacy raster icon');
@@ -130,7 +130,7 @@ test('REAL BUNDLE: an IN-PLACE reconcile drops a removed Icon while keeping the
// The shape that actually regressed. Before the fix this serialized BOTH `Icon="contoso_legacy.png"`
// and the new `VectorIcon`, and the deployed app went on rendering the stale raster — MEASURED
// against the pre-uptake bundle, which fails this test.
- const { sdk, lastSitemapXml } = freshSdk();
+ const { sdk, lastSitemapXml } = await freshSdk();
const art = await sdk.fetchArtifact('app', APP_ID);
const sub = art.siteMap.areas[0].groups[0].subAreas[0];
delete sub.icon;
diff --git a/plugins/model-apps/scripts/tests/teardown-model-app.test.js b/plugins/model-apps/scripts/tests/teardown-model-app.test.js
index f6c63ddaf..93f5c3d29 100644
--- a/plugins/model-apps/scripts/tests/teardown-model-app.test.js
+++ b/plugins/model-apps/scripts/tests/teardown-model-app.test.js
@@ -271,7 +271,11 @@ function loadTeardownCli({
};
}
if (id === './vendor/cds-maker-sdk.cjs') {
- return {
+ return {
+ // The CLI builds its store explicitly via the /node adapter now, so the mocked bundle
+ // must expose it too. The marker carries the root so the assertions below can still
+ // check WHERE the throwaway workspace was placed.
+ createNodeWorkspaceStorage: (root) => ({ __mockWorkspaceRoot: root }),
createMakerSdk: (cfg) => {
events.push({ type: 'createMakerSdk', cfg });
if (sdkThrows) throw sdkThrows;
@@ -336,7 +340,7 @@ test('teardown CLI applies, clears the local workspace only after a clean run, a
const sdkCleanupIndex = harness.events.findIndex((e) => e.type === 'rmSync' && e.dir === harness.sdkTemp);
const workspaceCleanupIndex = harness.events.findIndex((e) => e.type === 'rmSync' && e.dir === workspaceDir);
- assert.ok(harness.events.some((e) => e.type === 'createMakerSdk' && e.cfg.workspacePath === harness.sdkTemp));
+ assert.ok(harness.events.some((e) => e.type === 'createMakerSdk' && e.cfg.workspaceStorage.__mockWorkspaceRoot === harness.sdkTemp));
assert.ok(harness.events.some((e) => e.type === 'runTeardown' && e.opts.apply === true));
assert.ok(harness.events.some((e) => e.type === 'tombstoneSnapshot' && e.workspaceDir === workspaceDir));
assert.ok(harness.events.some((e) => e.type === 'deleteSnapshot' && e.workspaceDir === workspaceDir));
diff --git a/plugins/model-apps/scripts/tests/vendor-sdk-smoke.test.js b/plugins/model-apps/scripts/tests/vendor-sdk-smoke.test.js
index b7017e928..cf95f95f6 100644
--- a/plugins/model-apps/scripts/tests/vendor-sdk-smoke.test.js
+++ b/plugins/model-apps/scripts/tests/vendor-sdk-smoke.test.js
@@ -41,8 +41,8 @@ test.after(() => {
}
});
-function freshSdk(capture) {
- const { createMakerSdk } = require(BUNDLE);
+async function freshSdk(capture) {
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const ws = mkTempWorkspace('sdk-smoke-');
const httpClient = {
get: async () => ({ status: 200, headers: {}, body: {} }),
@@ -54,8 +54,8 @@ function freshSdk(capture) {
delete: async () => ({ status: 204, headers: {}, body: {} }),
put: async () => ({ status: 204, headers: {}, body: {} }),
};
- const sdk = createMakerSdk({ workspacePath: ws, instanceUrl: 'https://example.crm.dynamics.com', httpClient });
- sdk.initWorkspace();
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(ws), instanceUrl: 'https://example.crm.dynamics.com', httpClient });
+ await sdk.initWorkspace();
return sdk;
}
@@ -66,23 +66,23 @@ test('vendored bundle exports createMakerSdk', () => {
assert.strictEqual(typeof mod.createMakerSdk, 'function');
});
-test('createArtifact serializes every artifact type headlessly (no browser)', () => {
- const sdk = freshSdk();
+test('createArtifact serializes every artifact type headlessly (no browser)', async () => {
+ const sdk = await freshSdk();
for (const [type, def] of [
['view', { entityLogicalName: 'account', name: 'Smoke View' }],
['chart', { entityLogicalName: 'account', name: 'Smoke Chart' }],
['form', { entityLogicalName: 'account', name: 'Smoke Form' }],
['app', { name: 'Smoke App' }],
]) {
- const a = sdk.createArtifact(type, def);
+ const a = await sdk.createArtifact(type, def);
assert.ok(a && a.id, `${type} artifact should have an id`);
}
});
test('pushArtifact builds a real FormXML payload headlessly', async () => {
const capture = [];
- const sdk = freshSdk(capture);
- const form = sdk.createArtifact('form', { entityLogicalName: 'account', name: 'Push Test Form' });
+ const sdk = await freshSdk(capture);
+ const form = await sdk.createArtifact('form', { entityLogicalName: 'account', name: 'Push Test Form' });
const result = await sdk.pushArtifact('form', form.id);
// The SDK renamed PushResult.success -> saved to force call sites to distinguish "the write
// committed" from "the runtime serves it" (`shipped`, true only on a VERIFIED publish). Accept
@@ -96,7 +96,7 @@ test('pushArtifact builds a real FormXML payload headlessly', async () => {
test('createWebResource posts base64 content + the right webresourcetype (Tier 2)', async () => {
const capture = [];
- const sdk = freshSdk(capture);
+ const sdk = await freshSdk(capture);
await sdk.createWebResource({ name: 'new_smoke.js', displayName: 'Smoke', type: 'js', content: 'function f(){return 1;}', publish: false });
const post = capture.find((c) => /webresourceset/.test(c.url));
assert.ok(post, 'a POST to /webresourceset was issued');
@@ -107,23 +107,23 @@ test('createWebResource posts base64 content + the right webresourcetype (Tier 2
});
test('vendored SDK exposes the AI methods', () => {
- const { createMakerSdk } = require(BUNDLE);
- const sdk = createMakerSdk({ workspacePath: require('os').tmpdir(), instanceUrl: 'https://x/', httpClient: { get: async () => ({}), post: async () => ({}), patch: async () => ({}), delete: async () => ({}), put: async () => ({}) } });
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(require('os').tmpdir()), instanceUrl: 'https://x/', httpClient: { get: async () => ({}), post: async () => ({}), patch: async () => ({}), delete: async () => ({}), put: async () => ({}) } });
for (const m of ['retrieveSetting', 'saveSettingValue', 'getAiReadiness', 'setAppAiFeatures', 'configureRowSummary', 'removeRowSummary']) {
assert.strictEqual(typeof sdk[m], 'function', `sdk.${m} should be a function`);
}
});
test('vendored SDK exposes the consolidation methods', () => {
- const { createMakerSdk } = require('../vendor/cds-maker-sdk.cjs');
- const sdk = createMakerSdk({ workspacePath: require('os').tmpdir(), instanceUrl: 'https://x/', httpClient: { get: async () => ({}), post: async () => ({}), patch: async () => ({}), delete: async () => ({}), put: async () => ({}) } });
+ const { createMakerSdk, createNodeWorkspaceStorage } = require('../vendor/cds-maker-sdk.cjs');
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(require('os').tmpdir()), instanceUrl: 'https://x/', httpClient: { get: async () => ({}), post: async () => ({}), patch: async () => ({}), delete: async () => ({}), put: async () => ({}) } });
for (const m of ['resolveArtifact', 'findArtifact', 'deleteAppCascade', 'seedRecordGraph', 'enrichDefaultViews']) {
assert.strictEqual(typeof sdk[m], 'function', `sdk.${m} should be a function`);
}
});
-test('CONTRACT: a canonical /bag/c <events> region wires a handler into the retained FormXML headlessly (Tier 2)', () => {
- const { createMakerSdk } = require(BUNDLE);
+test('CONTRACT: a canonical /bag/c <events> region wires a handler into the retained FormXML headlessly (Tier 2)', async () => {
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const ws = mkTempWorkspace('sdk-evt-');
const FID = '22222222-2222-2222-2222-222222222222';
const formXml = '<form><tabs><tab name="general"><columns><column><sections><section><rows /></section></sections></column></columns></tab></tabs></form>';
@@ -135,8 +135,8 @@ test('CONTRACT: a canonical /bag/c <events> region wires a handler into the reta
delete: async () => ({ status: 204, headers: {}, body: {} }),
put: async () => ({ status: 204, headers: {}, body: {} }),
};
- const sdk = createMakerSdk({ workspacePath: ws, instanceUrl: 'https://example.crm.dynamics.com', httpClient });
- sdk.initWorkspace();
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(ws), instanceUrl: 'https://example.crm.dynamics.com', httpClient });
+ await sdk.initWorkspace();
return sdk.fetchArtifact('form', FID).then(async (fetched) => {
assert.ok(fetched, 'form fetched');
// The engine wires form JS by adding the root-bag <events> region via the generic surface (the
@@ -151,7 +151,7 @@ test('CONTRACT: a canonical /bag/c <events> region wires a handler into the reta
});
test('CONTRACT: removeElement drops a bound field from a fetched form (reconcile can DELETE a field, not only add)', async () => {
- const { createMakerSdk } = require(BUNDLE);
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const ws = mkTempWorkspace('sdk-rmfield-');
const FID = '22222222-2222-2222-2222-222222222222';
// A fetched form whose retained formxml carries two bound fields (name + tier). The skill's form
@@ -171,8 +171,8 @@ test('CONTRACT: removeElement drops a bound field from a fetched form (reconcile
delete: async () => ({ status: 204, headers: {}, body: {} }),
put: async () => ({ status: 204, headers: {}, body: {} }),
};
- const sdk = createMakerSdk({ workspacePath: ws, instanceUrl: 'https://example.crm.dynamics.com', httpClient });
- sdk.initWorkspace();
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(ws), instanceUrl: 'https://example.crm.dynamics.com', httpClient });
+ await sdk.initWorkspace();
await sdk.fetchArtifact('form', FID);
const ptr = findFieldCellPointer(await sdk.getArtifact('form', FID), 'new_tier');
assert.ok(ptr, 'the cell hosting the dropped field is located in the canonical tree');
@@ -210,11 +210,11 @@ function captureClient() {
};
return { client, reqs };
}
-function sdkWith(client) {
- const { createMakerSdk } = require(BUNDLE);
+async function sdkWith(client) {
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const ws = mkTempWorkspace('sdk-contract-');
- const sdk = createMakerSdk({ workspacePath: ws, instanceUrl: 'https://example.crm.dynamics.com', httpClient: client });
- sdk.initWorkspace();
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(ws), instanceUrl: 'https://example.crm.dynamics.com', httpClient: client });
+ await sdk.initWorkspace();
return sdk;
}
// The wire $filter, decoded exactly once by URLSearchParams. Equals the raw OData filter whether the
@@ -226,7 +226,7 @@ function filterOf(url) {
test('CONTRACT: queryRecords transmits a raw quoted-string OData filter that round-trips (raw filters stay supported; no double-encoding)', async () => {
const { client, reqs } = captureClient();
- const sdk = sdkWith(client);
+ const sdk = await sdkWith(client);
const raw = `uniquename eq 'new_a b' and ismanaged eq false`;
await sdk.queryRecords('appmodule', { select: ['appmoduleid', 'name'], filter: raw, top: 1 });
const get = reqs.find((r) => r.method === 'GET' && /appmodules\?/.test(r.url));
@@ -236,7 +236,7 @@ test('CONTRACT: queryRecords transmits a raw quoted-string OData filter that rou
test('CONTRACT: queryRecords transmits an UNQUOTED GUID-literal filter unchanged (the solutioncomponent/sitemap pattern the skill uses)', async () => {
const { client, reqs } = captureClient();
- const sdk = sdkWith(client);
+ const sdk = await sdkWith(client);
const raw = `objectid eq 11111111-1111-1111-1111-111111111111`;
await sdk.queryRecords('solutioncomponent', { select: ['_solutionid_value'], filter: raw, top: 1 });
const get = reqs.find((r) => r.method === 'GET' && /solutioncomponents\?/.test(r.url));
@@ -245,7 +245,7 @@ test('CONTRACT: queryRecords transmits an UNQUOTED GUID-literal filter unchanged
test('CONTRACT: name-based SDK methods accept logical/unique names verbatim (never forced through GUID validation)', async () => {
const { client, reqs } = captureClient();
- const sdk = sdkWith(client);
+ const sdk = await sdkWith(client);
// The skill passes NAMES (not GUIDs) to these — a GUID normalizer applied here would reject them.
await sdk.resolveArtifact('app', { uniqueName: 'new_app' }); // teardown/verify resolve-by-name
await sdk.setEntityIcon('contoso_widget', { vector: 'contoso_icon', publish: false }); // table icon by logical name
@@ -265,7 +265,7 @@ test('CONTRACT: name-based SDK methods accept logical/unique names verbatim (nev
});
test('CONTRACT: free-text sitemap titles/URLs are XML-escaped, not rejected (a safe DOM factory must escape VALUES, only validate NAMES)', async () => {
- const { createMakerSdk } = require(BUNDLE);
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const { appDef } = require('../lib/sdk-build.js');
const spec = {
solution: { uniqueName: 'EscA', publisherPrefix: 'new' },
@@ -301,9 +301,9 @@ test('CONTRACT: free-text sitemap titles/URLs are XML-escaped, not rejected (a s
delete: async () => ({ status: 204, headers: {}, body: {} }),
put: async () => ({ status: 204, headers: {}, body: {} }),
};
- const sdk = createMakerSdk({ workspacePath: ws, instanceUrl: 'https://example.crm.dynamics.com', httpClient });
- sdk.initWorkspace();
- const art = sdk.createArtifact('app', { name: spec.app.name, uniqueName: 'new_escapp', description: spec.app.description, siteMap: def.siteMap, components: def.components, iconWebResourceId: APP_ICON_ID });
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(ws), instanceUrl: 'https://example.crm.dynamics.com', httpClient });
+ await sdk.initWorkspace();
+ const art = await sdk.createArtifact('app', { name: spec.app.name, uniqueName: 'new_escapp', description: spec.app.description, siteMap: def.siteMap, components: def.components, iconWebResourceId: APP_ICON_ID });
await assert.doesNotReject(sdk.pushArtifact('app', art.id), 'special-char titles/URLs must serialize, not throw');
assert.ok(sitemapXml, 'the sitemap was serialized and posted');
assert.match(sitemapXml, /&amp;/, 'ampersands in titles/URLs are escaped');
@@ -370,7 +370,7 @@ test('CONTRACT: vendored deleteAppCascade returns a structured { success, delete
},
put: async () => ({ status: 204, headers: {}, body: {} }),
};
- const sdk = sdkWith(client);
+ const sdk = await sdkWith(client);
const result = await sdk.deleteAppCascade(APP_ID, APP_UNIQUE);
assert.ok(result && typeof result === 'object', 'deleteAppCascade returns a structured result (not void)');
assert.ok(Array.isArray(result.deleted) && result.deleted.some((d) => d.type === 'app'), 'the primary app delete is reported in deleted[]');
@@ -408,7 +408,7 @@ test('CONTRACT: vendored seedRecordGraph returns { createdIds: { <entity>: [ids]
delete: async () => ({ status: 204, headers: {}, body: {} }),
put: async () => ({ status: 204, headers: {}, body: {} }),
};
- const sdk = sdkWith(client);
+ const sdk = await sdkWith(client);
const group = {
entityLogical: 'new_widget',
matchOn: 'new_name',
@@ -443,7 +443,7 @@ test('CONTRACT: seedRecordGraph resolves a bind against options.createdIds BY IN
delete: async () => ({ status: 204, headers: {}, body: {} }),
put: async () => ({ status: 204, headers: {}, body: {} }),
};
- const sdk = sdkWith(client);
+ const sdk = await sdkWith(client);
const selfBind = { navProperty: 'new_ParentOrgId', parentEntity: 'new_org', parentIndex: 0 };
// (1) A self-bind whose parent is in the SAME group cannot resolve — the ids are published only
@@ -480,7 +480,7 @@ test('CONTRACT: updateTable({ quickCreateEnabled }) PUTs IsQuickCreateEnabled on
// "Allow quick create" so an authored Quick Create form is reachable from the inline "+ New". The SDK
// GET-then-PUTs the full EntityDefinitions row with IsQuickCreateEnabled set (a plain Edm.Boolean flag).
const { client, reqs } = captureClient();
- const sdk = sdkWith(client);
+ const sdk = await sdkWith(client);
await sdk.updateTable('contoso_widget', { quickCreateEnabled: true });
const put = reqs.find((r) => r.method === 'PUT' && /EntityDefinitions\(/i.test(r.url));
assert.ok(put, 'updateTable issues a PUT to EntityDefinitions');
@@ -504,7 +504,7 @@ test('CONTRACT: queryRecords({ paginate:true }) follows @odata.nextLink to compl
delete: async () => ({ status: 204, headers: {}, body: {} }),
put: async () => ({ status: 204, headers: {}, body: {} }),
};
- const sdk = sdkWith(client);
+ const sdk = await sdkWith(client);
const rows = await sdk.queryRecords('appmodule', { select: ['appmoduleid'], paginate: true });
assert.deepStrictEqual(rows.map((r) => r.appmoduleid), ['a1', 'a2'], 'both pages are returned (nextLink was followed)');
assert.strictEqual(reqs.filter((u) => /appmodules/.test(u)).length, 2, 'exactly two data pages were fetched');
@@ -515,7 +515,7 @@ test('CONTRACT: queryRecords rejects paginate combined with top or fetchXml (bot
// @odata.nextLink. Either combined with paginate would silently return one page, so the SDK throws
// BEFORE any request — the scan must never pass top alongside paginate.
const { client } = captureClient();
- const sdk = sdkWith(client);
+ const sdk = await sdkWith(client);
await assert.rejects(() => sdk.queryRecords('appmodule', { paginate: true, top: 1 }), /paginate.*top/i, 'paginate + top is rejected');
await assert.rejects(() => sdk.queryRecords('appmodule', { paginate: true, fetchXml: '<fetch/>' }), /paginate.*fetchXml|fetchXml.*paginate/i, 'paginate + fetchXml is rejected');
});
@@ -536,21 +536,21 @@ test('CONTRACT: queryRecords({ paginate:true }) THROWS on a malformed page inste
},
post: async () => ({ status: 204, headers: {}, body: {} }), patch: async () => ({ status: 204, headers: {}, body: {} }), delete: async () => ({ status: 204, headers: {}, body: {} }), put: async () => ({ status: 204, headers: {}, body: {} }),
};
- await assert.rejects(() => sdkWith(midClient).queryRecords('appmodule', { paginate: true }), /malformed page|value/i, 'a null mid-pagination value throws, not a silent page-1-only result');
+ await assert.rejects(async () => (await sdkWith(midClient)).queryRecords('appmodule', { paginate: true }), /malformed page|value/i, 'a null mid-pagination value throws, not a silent page-1-only result');
// (b) bare-string `value` on the FIRST page → THROW (never fabricate single-char "rows" via for..of).
const strClient = {
get: async (url) => { if (/EntityDefinitions\(LogicalName=/i.test(url)) return meta(url); return { status: 200, headers: {}, body: { value: 'abc' } }; },
post: async () => ({ status: 204, headers: {}, body: {} }), patch: async () => ({ status: 204, headers: {}, body: {} }), delete: async () => ({ status: 204, headers: {}, body: {} }), put: async () => ({ status: 204, headers: {}, body: {} }),
};
- await assert.rejects(() => sdkWith(strClient).queryRecords('appmodule', { paginate: true }), /malformed page|value/i, 'a bare-string value throws (no char-row fabrication)');
+ await assert.rejects(async () => (await sdkWith(strClient)).queryRecords('appmodule', { paginate: true }), /malformed page|value/i, 'a bare-string value throws (no char-row fabrication)');
// (c) the single-page (non-paginate) path is UNCHANGED — a missing value is leniently treated as empty.
const lenientClient = {
get: async (url) => { if (/EntityDefinitions\(LogicalName=/i.test(url)) return meta(url); return { status: 200, headers: {}, body: {} }; },
post: async () => ({ status: 204, headers: {}, body: {} }), patch: async () => ({ status: 204, headers: {}, body: {} }), delete: async () => ({ status: 204, headers: {}, body: {} }), put: async () => ({ status: 204, headers: {}, body: {} }),
};
- const rows = await sdkWith(lenientClient).queryRecords('appmodule', {});
+ const rows = await (await sdkWith(lenientClient)).queryRecords('appmodule', {});
assert.deepStrictEqual(rows, [], 'the non-paginate single-page path stays lenient (missing value → empty)');
});
@@ -570,7 +570,7 @@ test('CONTRACT: createGlobalOptionSet is idempotent by Name — reuses an existi
delete: async () => ({ status: 204, headers: {}, body: {} }),
put: async () => ({ status: 204, headers: {}, body: {} }),
};
- const reuseSdk = sdkWith(existingClient);
+ const reuseSdk = await sdkWith(existingClient);
const reused = await reuseSdk.createGlobalOptionSet({ name: 'new_sev', displayName: 'Sev', options: [{ value: 100000000, label: 'Low' }] });
assert.strictEqual(reused.metadataId, 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', 'the existing set MetadataId is returned');
assert.strictEqual(reqs.filter((r) => r.method === 'POST').length, 0, 'no duplicate-Name POST is issued when the set already exists');
@@ -584,7 +584,7 @@ test('CONTRACT: createGlobalOptionSet is idempotent by Name — reuses an existi
delete: async () => ({ status: 204, headers: {}, body: {} }),
put: async () => ({ status: 204, headers: {}, body: {} }),
};
- const freshSdk2 = sdkWith(absentClient);
+ const freshSdk2 = await sdkWith(absentClient);
await freshSdk2.createGlobalOptionSet({ name: 'new_sev', displayName: 'Sev', options: [{ value: 100000000, label: 'Low' }] });
assert.strictEqual(created.length, 1, 'an absent set (404 probe) is created with one POST');
assert.ok(/GlobalOptionSetDefinitions/i.test(created[0].url), 'the create POSTs to GlobalOptionSetDefinitions');
@@ -592,8 +592,8 @@ test('CONTRACT: createGlobalOptionSet is idempotent by Name — reuses an existi
// --- Security authoring surface (Group N P1) -----------------------------------------------
-test('CONTRACT: the vendored facade exposes the security-authoring methods the engine calls', () => {
- const sdk = freshSdk();
+test('CONTRACT: the vendored facade exposes the security-authoring methods the engine calls', async () => {
+ const sdk = await freshSdk();
for (const m of ['createPersonaRole', 'createSecurityRole', 'deleteSecurityRole', 'associateRecords']) {
assert.strictEqual(typeof sdk[m], 'function', `facade must expose ${m}()`);
}
@@ -614,7 +614,7 @@ test('CONTRACT: the vendored bundle still carries the exact SDK role-ownership m
// surviving serialization onto an ENTITY subarea. Reading the minified bundle cannot prove that; only
// the serialized payload can, so assert the bytes the SDK would POST.
test('CONTRACT: a platform-ref VectorIcon on an Entity subarea reaches the serialized sitemap XML', async () => {
- const { createMakerSdk } = require(BUNDLE);
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
const { appDef } = require('../lib/sdk-build.js');
const { buildSmokeSpec } = require('../smoke-eval.js');
const spec = buildSmokeSpec('t');
@@ -644,9 +644,9 @@ test('CONTRACT: a platform-ref VectorIcon on an Entity subarea reaches the seria
delete: async () => ({ status: 204, headers: {}, body: {} }),
put: async () => ({ status: 204, headers: {}, body: {} }),
};
- const sdk = createMakerSdk({ workspacePath: mkTempWorkspace('sdk-vecicon-'), instanceUrl: 'https://example.crm.dynamics.com', httpClient });
- sdk.initWorkspace();
- const art = sdk.createArtifact('app', { name: spec.app.name, uniqueName: 'new_vecapp', description: '', siteMap: def.siteMap, components: def.components, iconWebResourceId: APP_ICON_ID });
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(mkTempWorkspace('sdk-vecicon-')), instanceUrl: 'https://example.crm.dynamics.com', httpClient });
+ await sdk.initWorkspace();
+ const art = await sdk.createArtifact('app', { name: spec.app.name, uniqueName: 'new_vecapp', description: '', siteMap: def.siteMap, components: def.components, iconWebResourceId: APP_ICON_ID });
await assert.doesNotReject(sdk.pushArtifact('app', art.id), 'the smoke spec must push without a component-verification refusal');
assert.ok(sitemapXml, 'the sitemap was serialized and posted');
@@ -662,7 +662,7 @@ test('CONTRACT: a platform-ref VectorIcon on an Entity subarea reaches the seria
// drop cannot be delegated to the bundle. If a future re-vendor ADDS a guard, this test fails and
// tells us the defense moved, rather than silently leaving two layers that both assume the other.
test('CONTRACT: the vendored SDK does NOT filter a bare Fluent VectorIcon — appDef is the only guard', async () => {
- const { createMakerSdk } = require(BUNDLE);
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(BUNDLE);
let sitemapXml = '';
const TABLE_METADATA_ID = '22222222-2222-2222-2222-222222222222';
const httpClient = {
@@ -681,12 +681,12 @@ test('CONTRACT: the vendored SDK does NOT filter a bare Fluent VectorIcon — ap
delete: async () => ({ status: 204, headers: {}, body: {} }),
put: async () => ({ status: 204, headers: {}, body: {} }),
};
- const sdk = createMakerSdk({ workspacePath: mkTempWorkspace('sdk-vecraw-'), instanceUrl: 'https://example.crm.dynamics.com', httpClient });
- sdk.initWorkspace();
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(mkTempWorkspace('sdk-vecraw-')), instanceUrl: 'https://example.crm.dynamics.com', httpClient });
+ await sdk.initWorkspace();
const siteMap = { areas: [{ id: 'area_0', title: 'Main', groups: [{ id: 'g0', title: 'G', subAreas: [
{ id: 's0', title: 'Orders', type: 'Entity', entity: 'new_torder', vectorIcon: 'Grid' },
] }] }] };
- const art = sdk.createArtifact('app', { name: 'Raw Token', uniqueName: 'new_rawtoken', description: '', siteMap, components: { forms: [], views: [], charts: [] }, iconWebResourceId: APP_ICON_ID });
+ const art = await sdk.createArtifact('app', { name: 'Raw Token', uniqueName: 'new_rawtoken', description: '', siteMap, components: { forms: [], views: [], charts: [] }, iconWebResourceId: APP_ICON_ID });
await sdk.pushArtifact('app', art.id);
assert.match(sitemapXml, /<SubArea[^>]*Entity="new_torder"[^>]*VectorIcon="Grid"/, 'the bundle serializes a bare token when handed one — so the plugin must not hand it one');
});
@@ -718,7 +718,7 @@ test('CONTRACT: vendored publishArtifact RESOLVES with publish.kind on failure
postRaw: async () => ({ status: 200, headers: {}, body: '' }),
};
const FID = '11111111-1111-1111-1111-111111111111';
- const sdk = sdkWith(client);
+ const sdk = await sdkWith(client);
await sdk.fetchArtifact('form', FID);
let threw = null;
diff --git a/plugins/model-apps/scripts/tests/verify-model-app.test.js b/plugins/model-apps/scripts/tests/verify-model-app.test.js
index 39ecc02aa..5f782ff61 100644
--- a/plugins/model-apps/scripts/tests/verify-model-app.test.js
+++ b/plugins/model-apps/scripts/tests/verify-model-app.test.js
@@ -349,7 +349,11 @@ function loadVerifyCli({ parseResult, validateResult = { ok: true }, verifyResul
};
}
if (id === './vendor/cds-maker-sdk.cjs') {
- return {
+ return {
+ // The CLI builds its store explicitly via the /node adapter now, so the mocked bundle
+ // must expose it too. The marker carries the root so the assertions below can still
+ // check WHERE the throwaway workspace was placed.
+ createNodeWorkspaceStorage: (root) => ({ __mockWorkspaceRoot: root }),
createMakerSdk: (cfg) => {
events.push({ type: 'createMakerSdk', cfg });
if (sdkThrows) throw sdkThrows;
@@ -472,7 +476,7 @@ test('verify CLI accepts a positional spec, uses the default workspace, and prin
assert.match(stderr, /✓ verify PASS \(1\/1 present\)/);
assert.strictEqual(emitted.ok, true);
assert.deepStrictEqual(emitted.payload.missing, []);
- assert.ok(harness.events.some((e) => e.type === 'createMakerSdk' && e.cfg.workspacePath === path.join(__dirname, '..', '..', 'samples', '.maker-workspace')));
+ assert.ok(harness.events.some((e) => e.type === 'createMakerSdk' && e.cfg.workspaceStorage.__mockWorkspaceRoot === path.join(__dirname, '..', '..', 'samples', '.maker-workspace')));
});
test('verify CLI entrypoint converts SDK startup errors into emitResult failures', async () => {
@@ -549,7 +553,7 @@ test('entityPrivileges REAL BUNDLE: the SDK method exists and returns the shape
// The seam that matters. A hand-written SDK stub proves only that the mapping is self-consistent;
// it would stay green if `getEntityPrivileges` were renamed or dropped by a re-vendor, or if it
// returned a different shape. Drive the actual bundle over a fake Dataverse instead.
- const { createMakerSdk } = require(path.resolve(__dirname, '..', 'vendor', 'cds-maker-sdk.cjs'));
+ const { createMakerSdk, createNodeWorkspaceStorage } = require(path.resolve(__dirname, '..', 'vendor', 'cds-maker-sdk.cjs'));
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'entpriv-real-'));
const urls = [];
const httpClient = {
@@ -572,8 +576,8 @@ test('entityPrivileges REAL BUNDLE: the SDK method exists and returns the shape
delete: async () => ({ status: 204, headers: {}, body: {} }),
put: async () => ({ status: 204, headers: {}, body: {} }),
};
- const sdk = createMakerSdk({ workspacePath: dir, instanceUrl: 'https://contoso.crm.dynamics.com', httpClient });
- sdk.initWorkspace();
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(dir), instanceUrl: 'https://contoso.crm.dynamics.com', httpClient });
+ await sdk.initWorkspace();
const privs = await readerFor(sdk, 'app', {}).entityPrivileges('CO_Ticket');
diff --git a/plugins/model-apps/scripts/vendor/PROVENANCE.json b/plugins/model-apps/scripts/vendor/PROVENANCE.json
index 5d1dcc61b..fc0d62e26 100644
--- a/plugins/model-apps/scripts/vendor/PROVENANCE.json
+++ b/plugins/model-apps/scripts/vendor/PROVENANCE.json
@@ -1,14 +1,14 @@
{
- "commit": "331b9f56705b8f5887f73bd40a1cceddc9fbf2e1",
- "subject": "Revert 'fix: scheduled trigger skips its first run when the start time is in the future'",
+ "commit": "9719a713a0e9cec3353ff042a1bf22c34c7ce6ed",
+ "subject": "Fix Monitoring Hub time-series routing",
"dirtySdkPackage": 0,
- "libBuiltAt": "2026-09-11T02:08:20.161Z",
- "newestSrcAt": "2026-09-11T02:03:26.756Z",
+ "libBuiltAt": "2026-09-17T00:49:27.419Z",
+ "newestSrcAt": "2026-09-16T22:30:59.712Z",
"libIsStale": false,
"nostub": false,
"esbuildVersion": "0.28.1",
- "nodeVersion": "v22.13.1",
- "builtAt": "2026-09-11T02:08:49.251Z",
- "bundleSha256": "e51103ce286d9b7749b1c542e5313d837374978c3584184c47f48d2886d9e248",
- "bundleBytes": 695310
+ "nodeVersion": "v20.20.2",
+ "builtAt": "2026-09-17T00:49:41.071Z",
+ "bundleSha256": "7b3394af03f9cb701e5ac23dcd5064fbf9e31870712d642872aff0b9d0fd442b",
+ "bundleBytes": 702409
}
diff --git a/plugins/model-apps/scripts/vendor/cds-maker-sdk.cjs b/plugins/model-apps/scripts/vendor/cds-maker-sdk.cjs
index 951079cfc..df01b4f01 100644
--- a/plugins/model-apps/scripts/vendor/cds-maker-sdk.cjs
+++ b/plugins/model-apps/scripts/vendor/cds-maker-sdk.cjs
@@ -25,37 +25,37 @@
}
globalThis.document=globalThis.document||globalThis.window.document;
})();
-"use strict";var hP=Object.create;var ds=Object.defineProperty;var gP=Object.getOwnPropertyDescriptor;var vP=Object.getOwnPropertyNames;var yP=Object.getPrototypeOf,bP=Object.prototype.hasOwnProperty;var I=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var g=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Rr=(e,t)=>{for(var r in t)ds(e,r,{get:t[r],enumerable:!0})},uh=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of vP(t))!bP.call(e,i)&&i!==r&&ds(e,i,{get:()=>t[i],enumerable:!(n=gP(t,i))||n.enumerable});return e};var se=(e,t,r)=>(r=e!=null?hP(yP(e)):{},uh(t||!e||!e.__esModule?ds(r,"default",{value:e,enumerable:!0}):r,e)),Fr=e=>uh(ds({},"__esModule",{value:!0}),e);var Mn=g(C=>{"use strict";Object.defineProperty(C,"__esModule",{value:!0});C.DateTimeBehavior=C.PrecisionSource=C.StringFormatName=C.SourceType=C.ImeMode=C.SolutionEntityTypeCodeExtToComponentTypeCode=C.SolutionComponentTypeCodeToEntityTypeCodeExt=C.SolutionComponentVirtualAttributeSubtype=C.EntityTypeCode=C.SolutionComponentTypeCodeExt=C.RootComponentBehavior=C.SolutionComponentTypeCode=C.EntityKeyIndexStatus=C.ViewStateCode=C.ViewStatusCode=C.RelationshipSecurityTypes=C.CascadeType=C.RelationshipTypeExt=C.RelationshipType=C.AppSubType=C.BusinessProcessType=C.WorkflowCategory=C.WorkflowScope=C.WorkflowTypeCode=C.StatusCodeEnabledDisabled=C.StateCodeEnabledDisabled=C.StatusCode=C.StateCode=C.OptionSetType=C.AttributeTypeCodeNum=C.AttributeFormatName=C.AttributeFormatCode=C.AttributeTypeName=C.AttributeTypeCode=C.PluginSourceType=C.AuthType=C.PluginIsolationMode=C.ComponentState=C.ChartType=C.ChartsType=C.ViewType=C.AttributeType=C.ActivationState=C.FormPresentation=C.FormType=C.TableTypeCode=C.TableTypes=C.ActivityTypeMask=C.PrincipalType=C.OwnershipTypes=void 0;C.QueryType=C.KnownCustomSolutionComponentEntitySetName=C.TeamTypeEnum=C.EnvironmentVariableDefinitionTypeEnum=C.ConnectorTypeEnum=C.RoleInheritance=C.DefaultRoleTemplates=C.DeleteDependencyErrorCode=C.ServiceEndpointConnectionMode=C.ServiceEndpointContract=C.ServiceNamespaceFormat=C.ConnectionRoleCategory=C.ReportTypeCode=C.SdkMessageProcessingMode=C.SupportedDeployment=C.SdkMessageProcessingStage=C.WebResourceTypeCode=C.IntegerFormat=C.DateTimeFormat=void 0;var ch;(function(e){e.None="None",e.UserOwned="UserOwned",e.TeamOwned="TeamOwned",e.BusinessOwned="BusinessOwned",e.OrganizationOwned="OrganizationOwned",e.BusinessParented="BusinessParented",e.Filtered="Filtered"})(ch||(C.OwnershipTypes=ch={}));var dh;(function(e){e.User="Microsoft.Dynamics.CRM.systemuser",e.Team="Microsoft.Dynamics.CRM.team"})(dh||(C.PrincipalType=dh={}));var ph;(function(e){e[e.DoNotDisplayInActivityMenus=0]="DoNotDisplayInActivityMenus",e[e.DisplayInActivityMenus=1]="DisplayInActivityMenus"})(ph||(C.ActivityTypeMask=ph={}));var fh;(function(e){e.Activity="Activity",e.Virtual="Virtual",e.Standard="Standard",e.Elastic="Elastic"})(fh||(C.TableTypes=fh={}));var mh;(function(e){e.Standard="Standard",e.Virtual="Virtual",e.Elastic="Elastic"})(mh||(C.TableTypeCode=mh={}));var hh;(function(e){e[e.Dashboard=0]="Dashboard",e[e.AppointmentBook=1]="AppointmentBook",e[e.Main=2]="Main",e[e.MiniCampaignBO=3]="MiniCampaignBO",e[e.Preview=4]="Preview",e[e.MobileExpress=5]="MobileExpress",e[e.QuickViewForm=6]="QuickViewForm",e[e.QuickCreate=7]="QuickCreate",e[e.Dialog=8]="Dialog",e[e.TaskFlowForm=9]="TaskFlowForm",e[e.InteractionCentricDashboard=10]="InteractionCentricDashboard",e[e.Card=11]="Card",e[e.MainInteractiveExperience=12]="MainInteractiveExperience",e[e.Other=100]="Other",e[e.MainBackup=101]="MainBackup",e[e.AppointmentBookBackup=102]="AppointmentBookBackup",e[e.PowerBIDashboard=103]="PowerBIDashboard"})(hh||(C.FormType=hh={}));var gh;(function(e){e[e.ClassicForm=0]="ClassicForm",e[e.AirForm=1]="AirForm",e[e.ConvertedICForm=2]="ConvertedICForm"})(gh||(C.FormPresentation=gh={}));var vh;(function(e){e[e.Inactive=0]="Inactive",e[e.Active=1]="Active"})(vh||(C.ActivationState=vh={}));var yh;(function(e){e[e.String=0]="String",e[e.Number=1]="Number",e[e.Picklist=2]="Picklist"})(yh||(C.AttributeType=yh={}));var bh;(function(e){e[e.Public=0]="Public",e[e.AdvancedFind=1]="AdvancedFind",e[e.Associated=2]="Associated",e[e.QuickFind=4]="QuickFind",e[e.Lookup=64]="Lookup"})(bh||(C.ViewType=bh={}));var wh;(function(e){e[e.ASPChart=0]="ASPChart",e[e.PowerBI=1]="PowerBI"})(wh||(C.ChartsType=wh={}));var Ah;(function(e){e[e.DataAndInteractionCentric=0]="DataAndInteractionCentric",e[e.InteractionCentric=1]="InteractionCentric"})(Ah||(C.ChartType=Ah={}));var Ch;(function(e){e[e.Published=0]="Published",e[e.Unpublished=1]="Unpublished",e[e.Deleted=2]="Deleted",e[e.DeletedUnpublished=3]="DeletedUnpublished"})(Ch||(C.ComponentState=Ch={}));var Sh;(function(e){e[e.None=1]="None",e[e.Sandbox=2]="Sandbox",e[e.External=3]="External"})(Sh||(C.PluginIsolationMode=Sh={}));var Eh;(function(e){e[e.BasicAuth=0]="BasicAuth"})(Eh||(C.AuthType=Eh={}));var Nh;(function(e){e[e.Database=0]="Database",e[e.Disk=1]="Disk",e[e.Normal=2]="Normal",e[e.AzureWebApp=3]="AzureWebApp"})(Nh||(C.PluginSourceType=Nh={}));var Dh;(function(e){e.Boolean="Boolean",e.Customer="Customer",e.Date="Date",e.DateTime="DateTime",e.DateTimeNoTimeZone="DateTimeNoTimeZone",e.Decimal="Decimal",e.Double="Double",e.Integer="Integer",e.Lookup="Lookup",e.Memo="Memo",e.Money="Money",e.Owner="Owner",e.PartyList="PartyList",e.Picklist="Picklist",e.State="State",e.Status="Status",e.String="String",e.Uniqueidentifier="Uniqueidentifier",e.CalendarRules="CalendarRules",e.Virtual="Virtual",e.BigInt="BigInt",e.ManagedProperty="ManagedProperty",e.EntityName="EntityName"})(Dh||(C.AttributeTypeCode=Dh={}));var Ih;(function(e){e.DateTimeType="DateTimeType",e.ImageType="ImageType",e.IntegerType="IntegerType",e.FileType="FileType",e.BooleanType="BooleanType",e.CustomerType="CustomerType",e.MemoType="MemoType",e.MultiSelectPicklistType="MultiSelectPicklistType",e.MoneyType="MoneyType",e.DecimalType="DecimalType",e.DoubleType="DoubleType",e.LookupType="LookupType",e.BigIntType="BigIntType",e.UniqueidentifierType="UniqueidentifierType",e.StringType="StringType",e.OwnerType="OwnerType",e.PicklistType="PicklistType",e.StateType="StateType",e.StatusType="StatusType",e.EntityNameType="EntityNameType"})(Ih||(C.AttributeTypeName=Ih={}));var _h;(function(e){e.Email="Email",e.Text="Text",e.TextArea="TextArea",e.Url="Url",e.TickerSymbol="TickerSymbol",e.PhoneticGuide="PhoneticGuide",e.VersionNumber="VersionNumber",e.Phone="Phone",e.Json="Json",e.RichText="RichText",e.DateOnly="DateOnly",e.DateAndTime="DateAndTime",e.None="None",e.Duration="Duration",e.TimeZone="TimeZone",e.Language="Language",e.Locale="Locale"})(_h||(C.AttributeFormatCode=_h={}));var Ph;(function(e){e.Text="Text",e.TextArea="TextArea",e.Email="Email",e.Url="Url",e.Phone="Phone",e.Json="Json",e.RichText="RichText",e.TickerSymbol="TickerSymbol",e.PhoneticGuide="PhoneticGuide",e.VersionNumber="VersionNumber",e.DateOnly="DateOnly",e.DateAndTime="DateAndTime"})(Ph||(C.AttributeFormatName=Ph={}));var Th;(function(e){e[e.Boolean=0]="Boolean",e[e.Customer=1]="Customer",e[e.DateTime=2]="DateTime",e[e.Decimal=3]="Decimal",e[e.Double=4]="Double",e[e.Integer=5]="Integer",e[e.Lookup=6]="Lookup",e[e.Memo=7]="Memo",e[e.Money=8]="Money",e[e.Owner=9]="Owner",e[e.PartyList=10]="PartyList",e[e.Picklist=11]="Picklist",e[e.State=12]="State",e[e.Status=13]="Status",e[e.String=14]="String",e[e.Uniqueidentifier=15]="Uniqueidentifier",e[e.CalendarRules=16]="CalendarRules",e[e.Virtual=17]="Virtual",e[e.BigInt=18]="BigInt",e[e.ManagedProperty=19]="ManagedProperty",e[e.EntityName=20]="EntityName"})(Th||(C.AttributeTypeCodeNum=Th={}));var Oh;(function(e){e.Picklist="Picklist",e.State="State",e.Status="Status",e.Boolean="Boolean"})(Oh||(C.OptionSetType=Oh={}));var Rh;(function(e){e[e.Draft=0]="Draft",e[e.Activated=1]="Activated"})(Rh||(C.StateCode=Rh={}));var Fh;(function(e){e[e.Draft=1]="Draft",e[e.Activated=2]="Activated"})(Fh||(C.StatusCode=Fh={}));var xh;(function(e){e[e.Enabled=0]="Enabled",e[e.Disabled=1]="Disabled"})(xh||(C.StateCodeEnabledDisabled=xh={}));var Lh;(function(e){e[e.Enabled=1]="Enabled",e[e.Disabled=2]="Disabled"})(Lh||(C.StatusCodeEnabledDisabled=Lh={}));var kh;(function(e){e[e.Definition=1]="Definition",e[e.Activation=2]="Activation",e[e.Template=3]="Template"})(kh||(C.WorkflowTypeCode=kh={}));var Mh;(function(e){e[e.User=1]="User",e[e.BusinessUnit=2]="BusinessUnit",e[e.ParentChildBusinessUnit=3]="ParentChildBusinessUnit",e[e.Organization=4]="Organization"})(Mh||(C.WorkflowScope=Mh={}));var Uh;(function(e){e[e.Workflow=0]="Workflow",e[e.Dialog=1]="Dialog",e[e.BusinessRule=2]="BusinessRule",e[e.Action=3]="Action",e[e.BusinessProcessFlow=4]="BusinessProcessFlow",e[e.Flow=5]="Flow",e[e.UIFlow=6]="UIFlow"})(Uh||(C.WorkflowCategory=Uh={}));var Bh;(function(e){e[e.None=-1]="None",e[e.BusinessFlow=0]="BusinessFlow",e[e.TaskFlow=1]="TaskFlow"})(Bh||(C.BusinessProcessType=Bh={}));var $h;(function(e){e[e.CanvasApp=0]="CanvasApp",e[e.ComponentLibrary=1]="ComponentLibrary",e[e.CustomCanvasPage=2]="CustomCanvasPage",e[e.UnifiedApp=3]="UnifiedApp",e[e.CodeApp=4]="CodeApp",e[e.MobileApp=5]="MobileApp"})($h||(C.AppSubType=$h={}));var qh;(function(e){e.OneToManyRelationship="OneToManyRelationship",e.ManyToManyRelationship="ManyToManyRelationship"})(qh||(C.RelationshipType=qh={}));var Vh;(function(e){e.ManyToOneRelationship="ManyToOneRelationship",e.OneToManyRelationship="OneToManyRelationship",e.ManyToManyRelationship="ManyToManyRelationship"})(Vh||(C.RelationshipTypeExt=Vh={}));var Gh;(function(e){e.NoCascade="NoCascade",e.Cascade="Cascade",e.Active="Active",e.UserOwned="UserOwned",e.RemoveLink="RemoveLink",e.Restrict="Restrict"})(Gh||(C.CascadeType=Gh={}));var zh;(function(e){e.None="None",e.Append="Append",e.ParentChild="ParentChild",e.Pointer="Pointer",e.Inheritance="Inheritance"})(zh||(C.RelationshipSecurityTypes=zh={}));var Wh;(function(e){e[e.Active=1]="Active",e[e.Inactive=2]="Inactive"})(Wh||(C.ViewStatusCode=Wh={}));var jh;(function(e){e[e.Active=0]="Active",e[e.Inactive=1]="Inactive"})(jh||(C.ViewStateCode=jh={}));var Hh;(function(e){e.Active="Active",e.Failed="Failed",e.InProgress="InProgress",e.Pending="Pending"})(Hh||(C.EntityKeyIndexStatus=Hh={}));var Qh;(function(e){e[e.Entity=1]="Entity",e[e.Attribute=2]="Attribute",e[e.OptionSet=9]="OptionSet",e[e.EntityRelationship=10]="EntityRelationship",e[e.EntityKey=14]="EntityKey",e[e.Role=20]="Role",e[e.DisplayString=22]="DisplayString",e[e.SavedQuery=26]="SavedQuery",e[e.Workflow=29]="Workflow",e[e.Report=31]="Report",e[e.Template=36]="Template",e[e.ContractTemplate=37]="ContractTemplate",e[e.KbArticleTemplate=38]="KbArticleTemplate",e[e.MailMergeTemplate=39]="MailMergeTemplate",e[e.RibbonCustomization=50]="RibbonCustomization",e[e.SavedQueryVisualization=59]="SavedQueryVisualization",e[e.SystemForm=60]="SystemForm",e[e.WebResource=61]="WebResource",e[e.SiteMap=62]="SiteMap",e[e.ConnectionRole=63]="ConnectionRole",e[e.HierarchyRule=65]="HierarchyRule",e[e.CustomControl=66]="CustomControl",e[e.FieldSecurityProfile=70]="FieldSecurityProfile",e[e.AppModule=80]="AppModule",e[e.PluginAssembly=91]="PluginAssembly",e[e.SdkMessageProcessingStep=92]="SdkMessageProcessingStep",e[e.ServiceEndpoint=95]="ServiceEndpoint",e[e.RoutingRule=150]="RoutingRule",e[e.SLA=152]="SLA",e[e.ConvertRule=154]="ConvertRule",e[e.MobileOfflineProfile=161]="MobileOfflineProfile",e[e.EntityDataProvider=181]="EntityDataProvider",e[e.EntityDataSource=183]="EntityDataSource",e[e.SdkMessage=201]="SdkMessage",e[e.CanvasApp=300]="CanvasApp",e[e.Connector=372]="Connector",e[e.EnvironmentVariableDefinition=380]="EnvironmentVariableDefinition",e[e.EnvironmentVariableValue=381]="EnvironmentVariableValue",e[e.AIModel=401]="AIModel",e[e.Dataflow=418]="Dataflow",e[e.DataflowEntities=419]="DataflowEntities",e[e.DualWriteEntityMap=500]="DualWriteEntityMap",e[e.DataIntegrationConnection=501]="DataIntegrationConnection",e[e.ExportToDataLakeConfig=510]="ExportToDataLakeConfig",e[e.Tour=10061]="Tour"})(Qh||(C.SolutionComponentTypeCode=Qh={}));var Jh;(function(e){e[e.IncludeSubcomponents=0]="IncludeSubcomponents",e[e.DoNotIncludeSubcomponents=1]="DoNotIncludeSubcomponents",e[e.IncludeAsShellOnly=2]="IncludeAsShellOnly"})(Jh||(C.RootComponentBehavior=Jh={}));var ps;(function(e){e[e.Entity=1]="Entity",e[e.Attribute=2]="Attribute",e[e.OptionSet=9]="OptionSet",e[e.EntityRelationship=10]="EntityRelationship",e[e.EntityKey=14]="EntityKey",e[e.Role=20]="Role",e[e.DisplayString=22]="DisplayString",e[e.SavedQuery=26]="SavedQuery",e[e.Workflow=29]="Workflow",e[e.Report=31]="Report",e[e.Template=36]="Template",e[e.ContractTemplate=37]="ContractTemplate",e[e.KbArticleTemplate=38]="KbArticleTemplate",e[e.MailMergeTemplate=39]="MailMergeTemplate",e[e.RibbonCustomization=50]="RibbonCustomization",e[e.SavedQueryVisualization=59]="SavedQueryVisualization",e[e.SystemForm=60]="SystemForm",e[e.WebResource=61]="WebResource",e[e.SiteMap=62]="SiteMap",e[e.ConnectionRole=63]="ConnectionRole",e[e.HierarchyRule=65]="HierarchyRule",e[e.CustomControl=66]="CustomControl",e[e.FieldSecurityProfile=70]="FieldSecurityProfile",e[e.AppModule=80]="AppModule",e[e.PluginAssembly=91]="PluginAssembly",e[e.SdkMessageProcessingStep=92]="SdkMessageProcessingStep",e[e.ServiceEndpoint=95]="ServiceEndpoint",e[e.RoutingRule=150]="RoutingRule",e[e.SLA=152]="SLA",e[e.ConvertRule=154]="ConvertRule",e[e.MobileOfflineProfile=161]="MobileOfflineProfile",e[e.EntityDataProvider=181]="EntityDataProvider",e[e.EntityDataSource=183]="EntityDataSource",e[e.SdkMessage=201]="SdkMessage",e[e.CanvasApp=300]="CanvasApp",e[e.Connector=372]="Connector",e[e.EnvironmentVariableDefinition=380]="EnvironmentVariableDefinition",e[e.EnvironmentVariableValue=381]="EnvironmentVariableValue",e[e.AIModel=401]="AIModel",e[e.Dataflow=418]="Dataflow",e[e.DataflowEntities=419]="DataflowEntities",e[e.DualWriteEntityMap=500]="DualWriteEntityMap",e[e.DataIntegrationConnection=501]="DataIntegrationConnection",e[e.ExportToDataLakeConfig=510]="ExportToDataLakeConfig",e[e.DataWorkspace=10282]="DataWorkspace",e[e.Dashboard=100001]="Dashboard",e[e.InteractionCentricDashboard=100002]="InteractionCentricDashboard",e[e.Dialog=100003]="Dialog",e[e.PowerBIDashboard=100004]="PowerBIDashboard",e[e.BusinessRule=100021]="BusinessRule",e[e.ProcessFlow=100024]="ProcessFlow",e[e.Flow=100025]="Flow",e[e.UIFlow=100026]="UIFlow",e[e.ProcessNoFlow=100031]="ProcessNoFlow",e[e.AllDashboards=100032]="AllDashboards",e[e.FormsOnly=100033]="FormsOnly",e[e.ComponentLibrary=100034]="ComponentLibrary",e[e.CanvasAppsOnly=100035]="CanvasAppsOnly",e[e.CustomCanvasPage=100038]="CustomCanvasPage",e[e.CodeApp=100039]="CodeApp",e[e.MobileApp=100046]="MobileApp",e[e.ProcessNoFlowNoUIFlowNoBusinessRule=100036]="ProcessNoFlowNoUIFlowNoBusinessRule",e[e.ActionDefinition=100040]="ActionDefinition",e[e.ActionTemplate=100041]="ActionTemplate",e[e.DialogDefinition=100042]="DialogDefinition",e[e.DialogTemplate=100043]="DialogTemplate",e[e.WorkflowDefinition=100044]="WorkflowDefinition",e[e.WorkflowTemplate=100045]="WorkflowTemplate"})(ps||(C.SolutionComponentTypeCodeExt=ps={}));var fs;(function(e){e[e.Entity=9801]="Entity",e[e.Attribute=9802]="Attribute",e[e.OptionSet=9804]="OptionSet",e[e.EntityRelationship=9805]="EntityRelationship",e[e.EntityKey=9812]="EntityKey",e[e.Role=1036]="Role",e[e.DisplayString=4102]="DisplayString",e[e.SavedQuery=1039]="SavedQuery",e[e.Workflow=4703]="Workflow",e[e.Report=9100]="Report",e[e.Template=2010]="Template",e[e.ContractTemplate=2011]="ContractTemplate",e[e.KbArticleTemplate=1016]="KbArticleTemplate",e[e.MailMergeTemplate=9106]="MailMergeTemplate",e[e.SavedQueryVisualization=1111]="SavedQueryVisualization",e[e.SystemForm=1030]="SystemForm",e[e.WebResource=9333]="WebResource",e[e.SiteMap=4709]="SiteMap",e[e.ConnectionRole=3231]="ConnectionRole",e[e.HierarchyRule=8840]="HierarchyRule",e[e.CustomControl=9753]="CustomControl",e[e.FieldSecurityProfile=1200]="FieldSecurityProfile",e[e.AppModule=9006]="AppModule",e[e.PluginAssembly=4605]="PluginAssembly",e[e.SdkMessageProcessingStep=4608]="SdkMessageProcessingStep",e[e.ServiceEndpoint=4618]="ServiceEndpoint",e[e.RoutingRule=8181]="RoutingRule",e[e.SLA=9750]="SLA",e[e.ConvertRule=9300]="ConvertRule",e[e.MobileOfflineProfile=9866]="MobileOfflineProfile",e[e.EntityDataSource=85]="EntityDataSource",e[e.SdkMessage=4606]="SdkMessage",e[e.RibbonCustomization=1120]="RibbonCustomization",e[e.EntityDataProvider=181]="EntityDataProvider",e[e.CanvasApp=300]="CanvasApp",e[e.Connector=372]="Connector",e[e.MaskingRule=373]="MaskingRule",e[e.AttributeMaskingRule=374]="AttributeMaskingRule",e[e.EnvironmentVariableDefinition=380]="EnvironmentVariableDefinition",e[e.EnvironmentVariableValue=381]="EnvironmentVariableValue",e[e.AIModel=401]="AIModel",e[e.Plan=10283]="Plan",e[e.Dataflow=418]="Dataflow",e[e.DataflowEntities=419]="DataflowEntities",e[e.DualWriteEntityMap=500]="DualWriteEntityMap",e[e.DataIntegrationConnection=501]="DataIntegrationConnection",e[e.ExportToDataLakeConfig=510]="ExportToDataLakeConfig",e[e.TeamTemplate=511]="TeamTemplate",e[e.DataWorkspace=10282]="DataWorkspace",e[e.Dashboard=1030]="Dashboard",e[e.InteractionCentricDashboard=1032]="InteractionCentricDashboard",e[e.PowerBIDashboard=1034]="PowerBIDashboard",e[e.Dialog=1030]="Dialog",e[e.WebResourceImage=9333]="WebResourceImage",e[e.WebResourceSilverlight=9333]="WebResourceSilverlight",e[e.WebResourceCode=9333]="WebResourceCode",e[e.WebResourceData=9333]="WebResourceData",e[e.BusinessRule=4703]="BusinessRule",e[e.ActionDefinition=4703]="ActionDefinition",e[e.ActionTemplate=4703]="ActionTemplate",e[e.DialogDefinition=4703]="DialogDefinition",e[e.DialogTemplate=4703]="DialogTemplate",e[e.WorkflowDefinition=4703]="WorkflowDefinition",e[e.WorkflowTemplate=4703]="WorkflowTemplate",e[e.ProcessFlow=4703]="ProcessFlow",e[e.Flow=4703]="Flow",e[e.UIFlow=4703]="UIFlow",e[e.ProcessNoFlow=4703]="ProcessNoFlow",e[e.ProcessNoFlowNoUIFlowNoBusinessRule=4703]="ProcessNoFlowNoUIFlowNoBusinessRule",e[e.AllDashboards=1030]="AllDashboards",e[e.FormsOnly=1030]="FormsOnly",e[e.ComponentLibrary=300]="ComponentLibrary",e[e.CanvasAppsOnly=300]="CanvasAppsOnly",e[e.CustomCanvasPage=300]="CustomCanvasPage",e[e.CodeApp=300]="CodeApp",e[e.MobileApp=300]="MobileApp",e[e.Chatbot=10030]="Chatbot",e[e.Card=10276]="Card"})(fs||(C.EntityTypeCode=fs={}));var Xh;(function(e){e.MultiSelectPicklist="MultiSelectPicklist",e.File="File",e.Image="Image"})(Xh||(C.SolutionComponentVirtualAttributeSubtype=Xh={}));function wP(e){let t=ps[e];return fs[t]}C.SolutionComponentTypeCodeToEntityTypeCodeExt=wP;function AP(e){let t=fs[e];return ps[t]}C.SolutionEntityTypeCodeExtToComponentTypeCode=AP;var Kh;(function(e){e.Active="Active",e.Auto="Auto",e.Disabled="Disabled",e.Inactive="Inactive"})(Kh||(C.ImeMode=Kh={}));var Yh;(function(e){e[e.Simple=0]="Simple",e[e.Calculated=1]="Calculated",e[e.Rollup=2]="Rollup",e[e.Formula=3]="Formula",e[e.Prompt=4]="Prompt"})(Yh||(C.SourceType=Yh={}));var Zh;(function(e){e.Email="Email",e.Phone="Phone",e.PhoneticGuide="PhoneticGuide",e.Text="Text",e.TextArea="TextArea",e.TickerSymbol="TickerSymbol",e.Url="Url",e.VersionNumber="VersionNumber"})(Zh||(C.StringFormatName=Zh={}));var eg;(function(e){e[e.PrecisionProperty=0]="PrecisionProperty",e[e.Organization=1]="Organization",e[e.TransactionCurrency=2]="TransactionCurrency"})(eg||(C.PrecisionSource=eg={}));var tg;(function(e){e.UserLocal="UserLocal",e.DateOnly="DateOnly",e.TimeZoneIndependent="TimeZoneIndependent"})(tg||(C.DateTimeBehavior=tg={}));var rg;(function(e){e.DateOnly="DateOnly",e.DateAndTime="DateAndTime"})(rg||(C.DateTimeFormat=rg={}));var ng;(function(e){e.None="None",e.Duration="Duration",e.TimeZone="TimeZone",e.Language="Language",e.Locale="Locale"})(ng||(C.IntegerFormat=ng={}));var ig;(function(e){e[e.HTML=1]="HTML",e[e.CSS=2]="CSS",e[e.JScript=3]="JScript",e[e.XML=4]="XML",e[e.PNG=5]="PNG",e[e.JPG=6]="JPG",e[e.GIF=7]="GIF",e[e.Silverlight=8]="Silverlight",e[e.XSL=9]="XSL",e[e.ICO=10]="ICO",e[e.SVG=11]="SVG",e[e.RESX=12]="RESX"})(ig||(C.WebResourceTypeCode=ig={}));var ag;(function(e){e[e.Initial=5]="Initial",e[e.PreValidation=10]="PreValidation",e[e.InternalPreOperationBeforeExternal=15]="InternalPreOperationBeforeExternal",e[e.PreOperation=20]="PreOperation",e[e.InternalPreOperationAfterExternal=25]="InternalPreOperationAfterExternal",e[e.MainOperation=30]="MainOperation",e[e.InternalPostOperationBeforeExternal=35]="InternalPostOperationBeforeExternal",e[e.PostOperation=40]="PostOperation",e[e.InternalPostOperationAfterExternal=45]="InternalPostOperationAfterExternal",e[e.PostOperationDeprecated=50]="PostOperationDeprecated",e[e.FinalPostOperation=55]="FinalPostOperation"})(ag||(C.SdkMessageProcessingStage=ag={}));var og;(function(e){e[e.ServerOnly=0]="ServerOnly",e[e.OutlookClientOnly=1]="OutlookClientOnly",e[e.Both=2]="Both"})(og||(C.SupportedDeployment=og={}));var sg;(function(e){e[e.Synchronous=0]="Synchronous",e[e.Asynchronous=1]="Asynchronous"})(sg||(C.SdkMessageProcessingMode=sg={}));var lg;(function(e){e[e.ReportingServicesReport=1]="ReportingServicesReport",e[e.OtherReport=2]="OtherReport",e[e.LinkedReport=3]="LinkedReport"})(lg||(C.ReportTypeCode=lg={}));var ug;(function(e){e[e.Business=1]="Business",e[e.Family=2]="Family",e[e.Social=3]="Social",e[e.Sales=4]="Sales",e[e.Other=5]="Other",e[e.Stakeholder=1e3]="Stakeholder",e[e.SalesTeam=1001]="SalesTeam",e[e.Service=1002]="Service"})(ug||(C.ConnectionRoleCategory=ug={}));var cg;(function(e){e[e.Name=1]="Name",e[e.Address=2]="Address"})(cg||(C.ServiceNamespaceFormat=cg={}));var dg;(function(e){e[e.OneWay=1]="OneWay",e[e.Queue=2]="Queue",e[e.Rest=3]="Rest",e[e.TwoWay=4]="TwoWay",e[e.Topic=5]="Topic",e[e.PersistentQueue=6]="PersistentQueue",e[e.EventHub=7]="EventHub",e[e.WebHook=8]="WebHook"})(dg||(C.ServiceEndpointContract=dg={}));var pg;(function(e){e[e.Normal=1]="Normal",e[e.Federated=2]="Federated"})(pg||(C.ServiceEndpointConnectionMode=pg={}));var fg;(function(e){e.CannotDeleteInUseComponent="0x8004f01f",e.CannotDeleteInUseAttribute="0x80048418",e.CannotDeleteInUseOptionSet="0x80048417",e.CannotDeleteInUseEntity="0x80048420",e.CannotUninstallWithDependencies="0x8004F01D"})(fg||(C.DeleteDependencyErrorCode=fg={}));var mg;(function(e){e.SystemAdministrator="627090FF-40A3-4053-8790-584EDC5BE201",e.SystemCustomizer="119F245C-3CC8-4B62-B31C-D1A046CED15D"})(mg||(C.DefaultRoleTemplates=mg={}));var hg;(function(e){e[e.DefaultTeamPrivilege=0]="DefaultTeamPrivilege",e[e.DirectUserAndTeamPrivilege=1]="DirectUserAndTeamPrivilege"})(hg||(C.RoleInheritance=hg={}));var gg;(function(e){e[e.NotSpecified=0]="NotSpecified",e[e.CustomConnector=1]="CustomConnector"})(gg||(C.ConnectorTypeEnum=gg={}));var vg;(function(e){e[e.String=1e8]="String",e[e.Number=100000001]="Number",e[e.Boolean=100000002]="Boolean",e[e.JSON=100000003]="JSON",e[e.ConnectionReference=100000004]="ConnectionReference",e[e.Secret=100000005]="Secret"})(vg||(C.EnvironmentVariableDefinitionTypeEnum=vg={}));var yg;(function(e){e[e.Owner=0]="Owner",e[e.Access=1]="Access",e[e.AADSecurityGroup=2]="AADSecurityGroup",e[e.AADOfficeGroup=3]="AADOfficeGroup"})(yg||(C.TeamTypeEnum=yg={}));var bg;(function(e){e.Bots="bots"})(bg||(C.KnownCustomSolutionComponentEntitySetName=bg={}));var wg;(function(e){e[e.MainApplicationView=0]="MainApplicationView",e[e.AdvancedSearch=1]="AdvancedSearch",e[e.SubGrid=2]="SubGrid",e[e.QuickFindSearch=4]="QuickFindSearch",e[e.Reporting=8]="Reporting",e[e.OfflineFilters=16]="OfflineFilters",e[e.MASearch=32]="MASearch",e[e.LookupView=64]="LookupView",e[e.SMAppointmentBookView=128]="SMAppointmentBookView",e[e.OutlookFilters=256]="OutlookFilters",e[e.AddressBookFilters=512]="AddressBookFilters",e[e.SavedQueryTypeOther=2048]="SavedQueryTypeOther",e[e.InteractiveWorkflowView=4096]="InteractiveWorkflowView",e[e.OfflineTemplate=8192]="OfflineTemplate",e[e.OutlookTemplate=131072]="OutlookTemplate",e[e.CustomDefinedView=16384]="CustomDefinedView"})(wg||(C.QueryType=wg={}))});var ie=g(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.IncompatibleWorkspaceError=Y.PathTraversalError=Y.AmbiguousArtifactError=Y.JsonPointerError=Y.NotImplementedError=Y.WorkspaceNotInitializedError=Y.ConnectionError=Y.VersionConflictError=Y.LocalEditsWouldBeLostError=Y.StaleArtifactError=Y.InvalidArgumentError=Y.ValidationError=Y.PathNotFoundError=Y.ArtifactNotFoundError=Y.readPartialTokens=Y.withPartialTokens=Y.SdkError=void 0;var et=class extends Error{constructor(t,r){super(r),this.code=t,Object.setPrototypeOf(this,new.target.prototype),this.name=new.target.name}};Y.SdkError=et;var Ag=Symbol.for("cds-maker-sdk.partialWriteTokens");function CP(e,t){return typeof e=="object"&&e!==null&&(e[Ag]=t),e}Y.withPartialTokens=CP;function SP(e){let t=e;for(let r=0;t&&typeof t=="object"&&r<8;r++){let n=t[Ag];if(n&&typeof n=="object")return n;t=t.cause}}Y.readPartialTokens=SP;var uc=class extends et{constructor(t,r){super("ARTIFACT_NOT_FOUND",`Artifact ${t}/${r} not found in workspace`),this.type=t,this.id=r}};Y.ArtifactNotFoundError=uc;var cc=class extends et{constructor(t,r,n){super("PATH_NOT_FOUND",`Path ${n} not found in ${t}/${r}`),this.type=t,this.id=r,this.pointer=n}};Y.PathNotFoundError=cc;var dc=class extends et{constructor(t,r,n,i){var a,o,s,l;let u=Array.isArray(n)?n:[{pointer:n,rule:i??"invalid",message:i??"invalid"}];super("VALIDATION_ERROR",`Validation failed for ${t}/${r}:
+var WT=Object.create;var gs=Object.defineProperty;var HT=Object.getOwnPropertyDescriptor;var jT=Object.getOwnPropertyNames;var QT=Object.getPrototypeOf,JT=Object.prototype.hasOwnProperty;var I=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var g=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Br=(e,t)=>{for(var r in t)gs(e,r,{get:t[r],enumerable:!0})},hs=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of jT(t))!JT.call(e,i)&&i!==r&&gs(e,i,{get:()=>t[i],enumerable:!(n=HT(t,i))||n.enumerable});return e},cn=(e,t,r)=>(hs(e,t,"default"),r&&hs(r,t,"default")),re=(e,t,r)=>(r=e!=null?WT(QT(e)):{},hs(t||!e||!e.__esModule?gs(r,"default",{value:e,enumerable:!0}):r,e)),fr=e=>hs(gs({},"__esModule",{value:!0}),e);var Gn=g(C=>{"use strict";Object.defineProperty(C,"__esModule",{value:!0});C.DateTimeBehavior=C.PrecisionSource=C.StringFormatName=C.SourceType=C.ImeMode=C.SolutionEntityTypeCodeExtToComponentTypeCode=C.SolutionComponentTypeCodeToEntityTypeCodeExt=C.SolutionComponentVirtualAttributeSubtype=C.EntityTypeCode=C.SolutionComponentTypeCodeExt=C.RootComponentBehavior=C.SolutionComponentTypeCode=C.EntityKeyIndexStatus=C.ViewStateCode=C.ViewStatusCode=C.RelationshipSecurityTypes=C.CascadeType=C.RelationshipTypeExt=C.RelationshipType=C.AppSubType=C.BusinessProcessType=C.WorkflowCategory=C.WorkflowScope=C.WorkflowTypeCode=C.StatusCodeEnabledDisabled=C.StateCodeEnabledDisabled=C.StatusCode=C.StateCode=C.OptionSetType=C.AttributeTypeCodeNum=C.AttributeFormatName=C.AttributeFormatCode=C.AttributeTypeName=C.AttributeTypeCode=C.PluginSourceType=C.AuthType=C.PluginIsolationMode=C.ComponentState=C.ChartType=C.ChartsType=C.ViewType=C.AttributeType=C.ActivationState=C.FormPresentation=C.FormType=C.TableTypeCode=C.TableTypes=C.ActivityTypeMask=C.PrincipalType=C.OwnershipTypes=void 0;C.QueryType=C.KnownCustomSolutionComponentEntitySetName=C.TeamTypeEnum=C.EnvironmentVariableDefinitionTypeEnum=C.ConnectorTypeEnum=C.RoleInheritance=C.DefaultRoleTemplates=C.DeleteDependencyErrorCode=C.ServiceEndpointConnectionMode=C.ServiceEndpointContract=C.ServiceNamespaceFormat=C.ConnectionRoleCategory=C.ReportTypeCode=C.SdkMessageProcessingMode=C.SupportedDeployment=C.SdkMessageProcessingStage=C.WebResourceTypeCode=C.IntegerFormat=C.DateTimeFormat=void 0;var Jm;(function(e){e.None="None",e.UserOwned="UserOwned",e.TeamOwned="TeamOwned",e.BusinessOwned="BusinessOwned",e.OrganizationOwned="OrganizationOwned",e.BusinessParented="BusinessParented",e.Filtered="Filtered"})(Jm||(C.OwnershipTypes=Jm={}));var Km;(function(e){e.User="Microsoft.Dynamics.CRM.systemuser",e.Team="Microsoft.Dynamics.CRM.team"})(Km||(C.PrincipalType=Km={}));var Xm;(function(e){e[e.DoNotDisplayInActivityMenus=0]="DoNotDisplayInActivityMenus",e[e.DisplayInActivityMenus=1]="DisplayInActivityMenus"})(Xm||(C.ActivityTypeMask=Xm={}));var Ym;(function(e){e.Activity="Activity",e.Virtual="Virtual",e.Standard="Standard",e.Elastic="Elastic"})(Ym||(C.TableTypes=Ym={}));var Zm;(function(e){e.Standard="Standard",e.Virtual="Virtual",e.Elastic="Elastic"})(Zm||(C.TableTypeCode=Zm={}));var eh;(function(e){e[e.Dashboard=0]="Dashboard",e[e.AppointmentBook=1]="AppointmentBook",e[e.Main=2]="Main",e[e.MiniCampaignBO=3]="MiniCampaignBO",e[e.Preview=4]="Preview",e[e.MobileExpress=5]="MobileExpress",e[e.QuickViewForm=6]="QuickViewForm",e[e.QuickCreate=7]="QuickCreate",e[e.Dialog=8]="Dialog",e[e.TaskFlowForm=9]="TaskFlowForm",e[e.InteractionCentricDashboard=10]="InteractionCentricDashboard",e[e.Card=11]="Card",e[e.MainInteractiveExperience=12]="MainInteractiveExperience",e[e.Other=100]="Other",e[e.MainBackup=101]="MainBackup",e[e.AppointmentBookBackup=102]="AppointmentBookBackup",e[e.PowerBIDashboard=103]="PowerBIDashboard"})(eh||(C.FormType=eh={}));var th;(function(e){e[e.ClassicForm=0]="ClassicForm",e[e.AirForm=1]="AirForm",e[e.ConvertedICForm=2]="ConvertedICForm"})(th||(C.FormPresentation=th={}));var rh;(function(e){e[e.Inactive=0]="Inactive",e[e.Active=1]="Active"})(rh||(C.ActivationState=rh={}));var nh;(function(e){e[e.String=0]="String",e[e.Number=1]="Number",e[e.Picklist=2]="Picklist"})(nh||(C.AttributeType=nh={}));var ih;(function(e){e[e.Public=0]="Public",e[e.AdvancedFind=1]="AdvancedFind",e[e.Associated=2]="Associated",e[e.QuickFind=4]="QuickFind",e[e.Lookup=64]="Lookup"})(ih||(C.ViewType=ih={}));var ah;(function(e){e[e.ASPChart=0]="ASPChart",e[e.PowerBI=1]="PowerBI"})(ah||(C.ChartsType=ah={}));var oh;(function(e){e[e.DataAndInteractionCentric=0]="DataAndInteractionCentric",e[e.InteractionCentric=1]="InteractionCentric"})(oh||(C.ChartType=oh={}));var sh;(function(e){e[e.Published=0]="Published",e[e.Unpublished=1]="Unpublished",e[e.Deleted=2]="Deleted",e[e.DeletedUnpublished=3]="DeletedUnpublished"})(sh||(C.ComponentState=sh={}));var lh;(function(e){e[e.None=1]="None",e[e.Sandbox=2]="Sandbox",e[e.External=3]="External"})(lh||(C.PluginIsolationMode=lh={}));var uh;(function(e){e[e.BasicAuth=0]="BasicAuth"})(uh||(C.AuthType=uh={}));var ch;(function(e){e[e.Database=0]="Database",e[e.Disk=1]="Disk",e[e.Normal=2]="Normal",e[e.AzureWebApp=3]="AzureWebApp"})(ch||(C.PluginSourceType=ch={}));var dh;(function(e){e.Boolean="Boolean",e.Customer="Customer",e.Date="Date",e.DateTime="DateTime",e.DateTimeNoTimeZone="DateTimeNoTimeZone",e.Decimal="Decimal",e.Double="Double",e.Integer="Integer",e.Lookup="Lookup",e.Memo="Memo",e.Money="Money",e.Owner="Owner",e.PartyList="PartyList",e.Picklist="Picklist",e.State="State",e.Status="Status",e.String="String",e.Uniqueidentifier="Uniqueidentifier",e.CalendarRules="CalendarRules",e.Virtual="Virtual",e.BigInt="BigInt",e.ManagedProperty="ManagedProperty",e.EntityName="EntityName"})(dh||(C.AttributeTypeCode=dh={}));var ph;(function(e){e.DateTimeType="DateTimeType",e.ImageType="ImageType",e.IntegerType="IntegerType",e.FileType="FileType",e.BooleanType="BooleanType",e.CustomerType="CustomerType",e.MemoType="MemoType",e.MultiSelectPicklistType="MultiSelectPicklistType",e.MoneyType="MoneyType",e.DecimalType="DecimalType",e.DoubleType="DoubleType",e.LookupType="LookupType",e.BigIntType="BigIntType",e.UniqueidentifierType="UniqueidentifierType",e.StringType="StringType",e.OwnerType="OwnerType",e.PicklistType="PicklistType",e.StateType="StateType",e.StatusType="StatusType",e.EntityNameType="EntityNameType"})(ph||(C.AttributeTypeName=ph={}));var fh;(function(e){e.Email="Email",e.Text="Text",e.TextArea="TextArea",e.Url="Url",e.TickerSymbol="TickerSymbol",e.PhoneticGuide="PhoneticGuide",e.VersionNumber="VersionNumber",e.Phone="Phone",e.Json="Json",e.RichText="RichText",e.DateOnly="DateOnly",e.DateAndTime="DateAndTime",e.None="None",e.Duration="Duration",e.TimeZone="TimeZone",e.Language="Language",e.Locale="Locale"})(fh||(C.AttributeFormatCode=fh={}));var mh;(function(e){e.Text="Text",e.TextArea="TextArea",e.Email="Email",e.Url="Url",e.Phone="Phone",e.Json="Json",e.RichText="RichText",e.TickerSymbol="TickerSymbol",e.PhoneticGuide="PhoneticGuide",e.VersionNumber="VersionNumber",e.DateOnly="DateOnly",e.DateAndTime="DateAndTime"})(mh||(C.AttributeFormatName=mh={}));var hh;(function(e){e[e.Boolean=0]="Boolean",e[e.Customer=1]="Customer",e[e.DateTime=2]="DateTime",e[e.Decimal=3]="Decimal",e[e.Double=4]="Double",e[e.Integer=5]="Integer",e[e.Lookup=6]="Lookup",e[e.Memo=7]="Memo",e[e.Money=8]="Money",e[e.Owner=9]="Owner",e[e.PartyList=10]="PartyList",e[e.Picklist=11]="Picklist",e[e.State=12]="State",e[e.Status=13]="Status",e[e.String=14]="String",e[e.Uniqueidentifier=15]="Uniqueidentifier",e[e.CalendarRules=16]="CalendarRules",e[e.Virtual=17]="Virtual",e[e.BigInt=18]="BigInt",e[e.ManagedProperty=19]="ManagedProperty",e[e.EntityName=20]="EntityName"})(hh||(C.AttributeTypeCodeNum=hh={}));var gh;(function(e){e.Picklist="Picklist",e.State="State",e.Status="Status",e.Boolean="Boolean"})(gh||(C.OptionSetType=gh={}));var vh;(function(e){e[e.Draft=0]="Draft",e[e.Activated=1]="Activated"})(vh||(C.StateCode=vh={}));var yh;(function(e){e[e.Draft=1]="Draft",e[e.Activated=2]="Activated"})(yh||(C.StatusCode=yh={}));var bh;(function(e){e[e.Enabled=0]="Enabled",e[e.Disabled=1]="Disabled"})(bh||(C.StateCodeEnabledDisabled=bh={}));var wh;(function(e){e[e.Enabled=1]="Enabled",e[e.Disabled=2]="Disabled"})(wh||(C.StatusCodeEnabledDisabled=wh={}));var Ah;(function(e){e[e.Definition=1]="Definition",e[e.Activation=2]="Activation",e[e.Template=3]="Template"})(Ah||(C.WorkflowTypeCode=Ah={}));var Ch;(function(e){e[e.User=1]="User",e[e.BusinessUnit=2]="BusinessUnit",e[e.ParentChildBusinessUnit=3]="ParentChildBusinessUnit",e[e.Organization=4]="Organization"})(Ch||(C.WorkflowScope=Ch={}));var Sh;(function(e){e[e.Workflow=0]="Workflow",e[e.Dialog=1]="Dialog",e[e.BusinessRule=2]="BusinessRule",e[e.Action=3]="Action",e[e.BusinessProcessFlow=4]="BusinessProcessFlow",e[e.Flow=5]="Flow",e[e.UIFlow=6]="UIFlow"})(Sh||(C.WorkflowCategory=Sh={}));var Eh;(function(e){e[e.None=-1]="None",e[e.BusinessFlow=0]="BusinessFlow",e[e.TaskFlow=1]="TaskFlow"})(Eh||(C.BusinessProcessType=Eh={}));var Nh;(function(e){e[e.CanvasApp=0]="CanvasApp",e[e.ComponentLibrary=1]="ComponentLibrary",e[e.CustomCanvasPage=2]="CustomCanvasPage",e[e.UnifiedApp=3]="UnifiedApp",e[e.CodeApp=4]="CodeApp",e[e.MobileApp=5]="MobileApp"})(Nh||(C.AppSubType=Nh={}));var Dh;(function(e){e.OneToManyRelationship="OneToManyRelationship",e.ManyToManyRelationship="ManyToManyRelationship"})(Dh||(C.RelationshipType=Dh={}));var Ih;(function(e){e.ManyToOneRelationship="ManyToOneRelationship",e.OneToManyRelationship="OneToManyRelationship",e.ManyToManyRelationship="ManyToManyRelationship"})(Ih||(C.RelationshipTypeExt=Ih={}));var _h;(function(e){e.NoCascade="NoCascade",e.Cascade="Cascade",e.Active="Active",e.UserOwned="UserOwned",e.RemoveLink="RemoveLink",e.Restrict="Restrict"})(_h||(C.CascadeType=_h={}));var Th;(function(e){e.None="None",e.Append="Append",e.ParentChild="ParentChild",e.Pointer="Pointer",e.Inheritance="Inheritance"})(Th||(C.RelationshipSecurityTypes=Th={}));var Ph;(function(e){e[e.Active=1]="Active",e[e.Inactive=2]="Inactive"})(Ph||(C.ViewStatusCode=Ph={}));var Oh;(function(e){e[e.Active=0]="Active",e[e.Inactive=1]="Inactive"})(Oh||(C.ViewStateCode=Oh={}));var Rh;(function(e){e.Active="Active",e.Failed="Failed",e.InProgress="InProgress",e.Pending="Pending"})(Rh||(C.EntityKeyIndexStatus=Rh={}));var Fh;(function(e){e[e.Entity=1]="Entity",e[e.Attribute=2]="Attribute",e[e.OptionSet=9]="OptionSet",e[e.EntityRelationship=10]="EntityRelationship",e[e.EntityKey=14]="EntityKey",e[e.Role=20]="Role",e[e.DisplayString=22]="DisplayString",e[e.SavedQuery=26]="SavedQuery",e[e.Workflow=29]="Workflow",e[e.Report=31]="Report",e[e.Template=36]="Template",e[e.ContractTemplate=37]="ContractTemplate",e[e.KbArticleTemplate=38]="KbArticleTemplate",e[e.MailMergeTemplate=39]="MailMergeTemplate",e[e.RibbonCustomization=50]="RibbonCustomization",e[e.SavedQueryVisualization=59]="SavedQueryVisualization",e[e.SystemForm=60]="SystemForm",e[e.WebResource=61]="WebResource",e[e.SiteMap=62]="SiteMap",e[e.ConnectionRole=63]="ConnectionRole",e[e.HierarchyRule=65]="HierarchyRule",e[e.CustomControl=66]="CustomControl",e[e.FieldSecurityProfile=70]="FieldSecurityProfile",e[e.AppModule=80]="AppModule",e[e.PluginAssembly=91]="PluginAssembly",e[e.SdkMessageProcessingStep=92]="SdkMessageProcessingStep",e[e.ServiceEndpoint=95]="ServiceEndpoint",e[e.RoutingRule=150]="RoutingRule",e[e.SLA=152]="SLA",e[e.ConvertRule=154]="ConvertRule",e[e.MobileOfflineProfile=161]="MobileOfflineProfile",e[e.EntityDataProvider=181]="EntityDataProvider",e[e.EntityDataSource=183]="EntityDataSource",e[e.SdkMessage=201]="SdkMessage",e[e.CanvasApp=300]="CanvasApp",e[e.Connector=372]="Connector",e[e.EnvironmentVariableDefinition=380]="EnvironmentVariableDefinition",e[e.EnvironmentVariableValue=381]="EnvironmentVariableValue",e[e.AIModel=401]="AIModel",e[e.Dataflow=418]="Dataflow",e[e.DataflowEntities=419]="DataflowEntities",e[e.DualWriteEntityMap=500]="DualWriteEntityMap",e[e.DataIntegrationConnection=501]="DataIntegrationConnection",e[e.ExportToDataLakeConfig=510]="ExportToDataLakeConfig",e[e.Tour=10061]="Tour"})(Fh||(C.SolutionComponentTypeCode=Fh={}));var xh;(function(e){e[e.IncludeSubcomponents=0]="IncludeSubcomponents",e[e.DoNotIncludeSubcomponents=1]="DoNotIncludeSubcomponents",e[e.IncludeAsShellOnly=2]="IncludeAsShellOnly"})(xh||(C.RootComponentBehavior=xh={}));var vs;(function(e){e[e.Entity=1]="Entity",e[e.Attribute=2]="Attribute",e[e.OptionSet=9]="OptionSet",e[e.EntityRelationship=10]="EntityRelationship",e[e.EntityKey=14]="EntityKey",e[e.Role=20]="Role",e[e.DisplayString=22]="DisplayString",e[e.SavedQuery=26]="SavedQuery",e[e.Workflow=29]="Workflow",e[e.Report=31]="Report",e[e.Template=36]="Template",e[e.ContractTemplate=37]="ContractTemplate",e[e.KbArticleTemplate=38]="KbArticleTemplate",e[e.MailMergeTemplate=39]="MailMergeTemplate",e[e.RibbonCustomization=50]="RibbonCustomization",e[e.SavedQueryVisualization=59]="SavedQueryVisualization",e[e.SystemForm=60]="SystemForm",e[e.WebResource=61]="WebResource",e[e.SiteMap=62]="SiteMap",e[e.ConnectionRole=63]="ConnectionRole",e[e.HierarchyRule=65]="HierarchyRule",e[e.CustomControl=66]="CustomControl",e[e.FieldSecurityProfile=70]="FieldSecurityProfile",e[e.AppModule=80]="AppModule",e[e.PluginAssembly=91]="PluginAssembly",e[e.SdkMessageProcessingStep=92]="SdkMessageProcessingStep",e[e.ServiceEndpoint=95]="ServiceEndpoint",e[e.RoutingRule=150]="RoutingRule",e[e.SLA=152]="SLA",e[e.ConvertRule=154]="ConvertRule",e[e.MobileOfflineProfile=161]="MobileOfflineProfile",e[e.EntityDataProvider=181]="EntityDataProvider",e[e.EntityDataSource=183]="EntityDataSource",e[e.SdkMessage=201]="SdkMessage",e[e.CanvasApp=300]="CanvasApp",e[e.Connector=372]="Connector",e[e.EnvironmentVariableDefinition=380]="EnvironmentVariableDefinition",e[e.EnvironmentVariableValue=381]="EnvironmentVariableValue",e[e.AIModel=401]="AIModel",e[e.Dataflow=418]="Dataflow",e[e.DataflowEntities=419]="DataflowEntities",e[e.DualWriteEntityMap=500]="DualWriteEntityMap",e[e.DataIntegrationConnection=501]="DataIntegrationConnection",e[e.ExportToDataLakeConfig=510]="ExportToDataLakeConfig",e[e.DataWorkspace=10282]="DataWorkspace",e[e.Dashboard=100001]="Dashboard",e[e.InteractionCentricDashboard=100002]="InteractionCentricDashboard",e[e.Dialog=100003]="Dialog",e[e.PowerBIDashboard=100004]="PowerBIDashboard",e[e.BusinessRule=100021]="BusinessRule",e[e.ProcessFlow=100024]="ProcessFlow",e[e.Flow=100025]="Flow",e[e.UIFlow=100026]="UIFlow",e[e.ProcessNoFlow=100031]="ProcessNoFlow",e[e.AllDashboards=100032]="AllDashboards",e[e.FormsOnly=100033]="FormsOnly",e[e.ComponentLibrary=100034]="ComponentLibrary",e[e.CanvasAppsOnly=100035]="CanvasAppsOnly",e[e.CustomCanvasPage=100038]="CustomCanvasPage",e[e.CodeApp=100039]="CodeApp",e[e.MobileApp=100046]="MobileApp",e[e.ProcessNoFlowNoUIFlowNoBusinessRule=100036]="ProcessNoFlowNoUIFlowNoBusinessRule",e[e.ActionDefinition=100040]="ActionDefinition",e[e.ActionTemplate=100041]="ActionTemplate",e[e.DialogDefinition=100042]="DialogDefinition",e[e.DialogTemplate=100043]="DialogTemplate",e[e.WorkflowDefinition=100044]="WorkflowDefinition",e[e.WorkflowTemplate=100045]="WorkflowTemplate"})(vs||(C.SolutionComponentTypeCodeExt=vs={}));var ys;(function(e){e[e.Entity=9801]="Entity",e[e.Attribute=9802]="Attribute",e[e.OptionSet=9804]="OptionSet",e[e.EntityRelationship=9805]="EntityRelationship",e[e.EntityKey=9812]="EntityKey",e[e.Role=1036]="Role",e[e.DisplayString=4102]="DisplayString",e[e.SavedQuery=1039]="SavedQuery",e[e.Workflow=4703]="Workflow",e[e.Report=9100]="Report",e[e.Template=2010]="Template",e[e.ContractTemplate=2011]="ContractTemplate",e[e.KbArticleTemplate=1016]="KbArticleTemplate",e[e.MailMergeTemplate=9106]="MailMergeTemplate",e[e.SavedQueryVisualization=1111]="SavedQueryVisualization",e[e.SystemForm=1030]="SystemForm",e[e.WebResource=9333]="WebResource",e[e.SiteMap=4709]="SiteMap",e[e.ConnectionRole=3231]="ConnectionRole",e[e.HierarchyRule=8840]="HierarchyRule",e[e.CustomControl=9753]="CustomControl",e[e.FieldSecurityProfile=1200]="FieldSecurityProfile",e[e.AppModule=9006]="AppModule",e[e.PluginAssembly=4605]="PluginAssembly",e[e.SdkMessageProcessingStep=4608]="SdkMessageProcessingStep",e[e.ServiceEndpoint=4618]="ServiceEndpoint",e[e.RoutingRule=8181]="RoutingRule",e[e.SLA=9750]="SLA",e[e.ConvertRule=9300]="ConvertRule",e[e.MobileOfflineProfile=9866]="MobileOfflineProfile",e[e.EntityDataSource=85]="EntityDataSource",e[e.SdkMessage=4606]="SdkMessage",e[e.RibbonCustomization=1120]="RibbonCustomization",e[e.EntityDataProvider=181]="EntityDataProvider",e[e.CanvasApp=300]="CanvasApp",e[e.Connector=372]="Connector",e[e.MaskingRule=373]="MaskingRule",e[e.AttributeMaskingRule=374]="AttributeMaskingRule",e[e.EnvironmentVariableDefinition=380]="EnvironmentVariableDefinition",e[e.EnvironmentVariableValue=381]="EnvironmentVariableValue",e[e.AIModel=401]="AIModel",e[e.Plan=10283]="Plan",e[e.Dataflow=418]="Dataflow",e[e.DataflowEntities=419]="DataflowEntities",e[e.DualWriteEntityMap=500]="DualWriteEntityMap",e[e.DataIntegrationConnection=501]="DataIntegrationConnection",e[e.ExportToDataLakeConfig=510]="ExportToDataLakeConfig",e[e.TeamTemplate=511]="TeamTemplate",e[e.DataWorkspace=10282]="DataWorkspace",e[e.Dashboard=1030]="Dashboard",e[e.InteractionCentricDashboard=1032]="InteractionCentricDashboard",e[e.PowerBIDashboard=1034]="PowerBIDashboard",e[e.Dialog=1030]="Dialog",e[e.WebResourceImage=9333]="WebResourceImage",e[e.WebResourceSilverlight=9333]="WebResourceSilverlight",e[e.WebResourceCode=9333]="WebResourceCode",e[e.WebResourceData=9333]="WebResourceData",e[e.BusinessRule=4703]="BusinessRule",e[e.ActionDefinition=4703]="ActionDefinition",e[e.ActionTemplate=4703]="ActionTemplate",e[e.DialogDefinition=4703]="DialogDefinition",e[e.DialogTemplate=4703]="DialogTemplate",e[e.WorkflowDefinition=4703]="WorkflowDefinition",e[e.WorkflowTemplate=4703]="WorkflowTemplate",e[e.ProcessFlow=4703]="ProcessFlow",e[e.Flow=4703]="Flow",e[e.UIFlow=4703]="UIFlow",e[e.ProcessNoFlow=4703]="ProcessNoFlow",e[e.ProcessNoFlowNoUIFlowNoBusinessRule=4703]="ProcessNoFlowNoUIFlowNoBusinessRule",e[e.AllDashboards=1030]="AllDashboards",e[e.FormsOnly=1030]="FormsOnly",e[e.ComponentLibrary=300]="ComponentLibrary",e[e.CanvasAppsOnly=300]="CanvasAppsOnly",e[e.CustomCanvasPage=300]="CustomCanvasPage",e[e.CodeApp=300]="CodeApp",e[e.MobileApp=300]="MobileApp",e[e.Chatbot=10030]="Chatbot",e[e.Card=10276]="Card"})(ys||(C.EntityTypeCode=ys={}));var Lh;(function(e){e.MultiSelectPicklist="MultiSelectPicklist",e.File="File",e.Image="Image"})(Lh||(C.SolutionComponentVirtualAttributeSubtype=Lh={}));function KT(e){let t=vs[e];return ys[t]}C.SolutionComponentTypeCodeToEntityTypeCodeExt=KT;function XT(e){let t=ys[e];return vs[t]}C.SolutionEntityTypeCodeExtToComponentTypeCode=XT;var kh;(function(e){e.Active="Active",e.Auto="Auto",e.Disabled="Disabled",e.Inactive="Inactive"})(kh||(C.ImeMode=kh={}));var Mh;(function(e){e[e.Simple=0]="Simple",e[e.Calculated=1]="Calculated",e[e.Rollup=2]="Rollup",e[e.Formula=3]="Formula",e[e.Prompt=4]="Prompt"})(Mh||(C.SourceType=Mh={}));var Bh;(function(e){e.Email="Email",e.Phone="Phone",e.PhoneticGuide="PhoneticGuide",e.Text="Text",e.TextArea="TextArea",e.TickerSymbol="TickerSymbol",e.Url="Url",e.VersionNumber="VersionNumber"})(Bh||(C.StringFormatName=Bh={}));var Uh;(function(e){e[e.PrecisionProperty=0]="PrecisionProperty",e[e.Organization=1]="Organization",e[e.TransactionCurrency=2]="TransactionCurrency"})(Uh||(C.PrecisionSource=Uh={}));var $h;(function(e){e.UserLocal="UserLocal",e.DateOnly="DateOnly",e.TimeZoneIndependent="TimeZoneIndependent"})($h||(C.DateTimeBehavior=$h={}));var qh;(function(e){e.DateOnly="DateOnly",e.DateAndTime="DateAndTime"})(qh||(C.DateTimeFormat=qh={}));var Vh;(function(e){e.None="None",e.Duration="Duration",e.TimeZone="TimeZone",e.Language="Language",e.Locale="Locale"})(Vh||(C.IntegerFormat=Vh={}));var Gh;(function(e){e[e.HTML=1]="HTML",e[e.CSS=2]="CSS",e[e.JScript=3]="JScript",e[e.XML=4]="XML",e[e.PNG=5]="PNG",e[e.JPG=6]="JPG",e[e.GIF=7]="GIF",e[e.Silverlight=8]="Silverlight",e[e.XSL=9]="XSL",e[e.ICO=10]="ICO",e[e.SVG=11]="SVG",e[e.RESX=12]="RESX"})(Gh||(C.WebResourceTypeCode=Gh={}));var zh;(function(e){e[e.Initial=5]="Initial",e[e.PreValidation=10]="PreValidation",e[e.InternalPreOperationBeforeExternal=15]="InternalPreOperationBeforeExternal",e[e.PreOperation=20]="PreOperation",e[e.InternalPreOperationAfterExternal=25]="InternalPreOperationAfterExternal",e[e.MainOperation=30]="MainOperation",e[e.InternalPostOperationBeforeExternal=35]="InternalPostOperationBeforeExternal",e[e.PostOperation=40]="PostOperation",e[e.InternalPostOperationAfterExternal=45]="InternalPostOperationAfterExternal",e[e.PostOperationDeprecated=50]="PostOperationDeprecated",e[e.FinalPostOperation=55]="FinalPostOperation"})(zh||(C.SdkMessageProcessingStage=zh={}));var Wh;(function(e){e[e.ServerOnly=0]="ServerOnly",e[e.OutlookClientOnly=1]="OutlookClientOnly",e[e.Both=2]="Both"})(Wh||(C.SupportedDeployment=Wh={}));var Hh;(function(e){e[e.Synchronous=0]="Synchronous",e[e.Asynchronous=1]="Asynchronous"})(Hh||(C.SdkMessageProcessingMode=Hh={}));var jh;(function(e){e[e.ReportingServicesReport=1]="ReportingServicesReport",e[e.OtherReport=2]="OtherReport",e[e.LinkedReport=3]="LinkedReport"})(jh||(C.ReportTypeCode=jh={}));var Qh;(function(e){e[e.Business=1]="Business",e[e.Family=2]="Family",e[e.Social=3]="Social",e[e.Sales=4]="Sales",e[e.Other=5]="Other",e[e.Stakeholder=1e3]="Stakeholder",e[e.SalesTeam=1001]="SalesTeam",e[e.Service=1002]="Service"})(Qh||(C.ConnectionRoleCategory=Qh={}));var Jh;(function(e){e[e.Name=1]="Name",e[e.Address=2]="Address"})(Jh||(C.ServiceNamespaceFormat=Jh={}));var Kh;(function(e){e[e.OneWay=1]="OneWay",e[e.Queue=2]="Queue",e[e.Rest=3]="Rest",e[e.TwoWay=4]="TwoWay",e[e.Topic=5]="Topic",e[e.PersistentQueue=6]="PersistentQueue",e[e.EventHub=7]="EventHub",e[e.WebHook=8]="WebHook"})(Kh||(C.ServiceEndpointContract=Kh={}));var Xh;(function(e){e[e.Normal=1]="Normal",e[e.Federated=2]="Federated"})(Xh||(C.ServiceEndpointConnectionMode=Xh={}));var Yh;(function(e){e.CannotDeleteInUseComponent="0x8004f01f",e.CannotDeleteInUseAttribute="0x80048418",e.CannotDeleteInUseOptionSet="0x80048417",e.CannotDeleteInUseEntity="0x80048420",e.CannotUninstallWithDependencies="0x8004F01D"})(Yh||(C.DeleteDependencyErrorCode=Yh={}));var Zh;(function(e){e.SystemAdministrator="627090FF-40A3-4053-8790-584EDC5BE201",e.SystemCustomizer="119F245C-3CC8-4B62-B31C-D1A046CED15D"})(Zh||(C.DefaultRoleTemplates=Zh={}));var eg;(function(e){e[e.DefaultTeamPrivilege=0]="DefaultTeamPrivilege",e[e.DirectUserAndTeamPrivilege=1]="DirectUserAndTeamPrivilege"})(eg||(C.RoleInheritance=eg={}));var tg;(function(e){e[e.NotSpecified=0]="NotSpecified",e[e.CustomConnector=1]="CustomConnector"})(tg||(C.ConnectorTypeEnum=tg={}));var rg;(function(e){e[e.String=1e8]="String",e[e.Number=100000001]="Number",e[e.Boolean=100000002]="Boolean",e[e.JSON=100000003]="JSON",e[e.ConnectionReference=100000004]="ConnectionReference",e[e.Secret=100000005]="Secret"})(rg||(C.EnvironmentVariableDefinitionTypeEnum=rg={}));var ng;(function(e){e[e.Owner=0]="Owner",e[e.Access=1]="Access",e[e.AADSecurityGroup=2]="AADSecurityGroup",e[e.AADOfficeGroup=3]="AADOfficeGroup"})(ng||(C.TeamTypeEnum=ng={}));var ig;(function(e){e.Bots="bots"})(ig||(C.KnownCustomSolutionComponentEntitySetName=ig={}));var ag;(function(e){e[e.MainApplicationView=0]="MainApplicationView",e[e.AdvancedSearch=1]="AdvancedSearch",e[e.SubGrid=2]="SubGrid",e[e.QuickFindSearch=4]="QuickFindSearch",e[e.Reporting=8]="Reporting",e[e.OfflineFilters=16]="OfflineFilters",e[e.MASearch=32]="MASearch",e[e.LookupView=64]="LookupView",e[e.SMAppointmentBookView=128]="SMAppointmentBookView",e[e.OutlookFilters=256]="OutlookFilters",e[e.AddressBookFilters=512]="AddressBookFilters",e[e.SavedQueryTypeOther=2048]="SavedQueryTypeOther",e[e.InteractiveWorkflowView=4096]="InteractiveWorkflowView",e[e.OfflineTemplate=8192]="OfflineTemplate",e[e.OutlookTemplate=131072]="OutlookTemplate",e[e.CustomDefinedView=16384]="CustomDefinedView"})(ag||(C.QueryType=ag={}))});var ne=g(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.IncompatibleWorkspaceError=Y.PathTraversalError=Y.AmbiguousArtifactError=Y.JsonPointerError=Y.NotImplementedError=Y.WorkspaceNotInitializedError=Y.ConnectionError=Y.VersionConflictError=Y.LocalEditsWouldBeLostError=Y.StaleArtifactError=Y.InvalidArgumentError=Y.ValidationError=Y.PathNotFoundError=Y.ArtifactNotFoundError=Y.readPartialTokens=Y.withPartialTokens=Y.SdkError=void 0;var Xe=class extends Error{constructor(t,r){super(r),this.code=t,Object.setPrototypeOf(this,new.target.prototype),this.name=new.target.name}};Y.SdkError=Xe;var og=Symbol.for("cds-maker-sdk.partialWriteTokens");function YT(e,t){return typeof e=="object"&&e!==null&&(e[og]=t),e}Y.withPartialTokens=YT;function ZT(e){let t=e;for(let r=0;t&&typeof t=="object"&&r<8;r++){let n=t[og];if(n&&typeof n=="object")return n;t=t.cause}}Y.readPartialTokens=ZT;var uc=class extends Xe{constructor(t,r){super("ARTIFACT_NOT_FOUND",`Artifact ${t}/${r} not found in workspace`),this.type=t,this.id=r}};Y.ArtifactNotFoundError=uc;var cc=class extends Xe{constructor(t,r,n){super("PATH_NOT_FOUND",`Path ${n} not found in ${t}/${r}`),this.type=t,this.id=r,this.pointer=n}};Y.PathNotFoundError=cc;var dc=class extends Xe{constructor(t,r,n,i){var a,o,s,l;let u=Array.isArray(n)?n:[{pointer:n,rule:i??"invalid",message:i??"invalid"}];super("VALIDATION_ERROR",`Validation failed for ${t}/${r}:
`+u.map(c=>` \u2022 ${c.pointer}: ${c.message} [${c.rule}]`).join(`
-`)),this.type=t,this.id=r,this.issues=u,this.pointer=(o=(a=u[0])===null||a===void 0?void 0:a.pointer)!==null&&o!==void 0?o:"",this.rule=(l=(s=u[0])===null||s===void 0?void 0:s.rule)!==null&&l!==void 0?l:"invalid"}};Y.ValidationError=dc;var pc=class extends et{constructor(t){super("INVALID_ARGUMENT",t)}};Y.InvalidArgumentError=pc;var fc=class extends et{constructor(t,r,n){super("STALE_ARTIFACT",`Cannot apply the edit at ${n} to ${t}/${r}: the cached copy was stale and the server copy has since changed, so any pointer derived from the old copy may now identify a different node. The local copy has been refreshed \u2014 re-read the artifact, re-derive the pointer, and retry.`),this.type=t,this.id=r,this.pointer=n}};Y.StaleArtifactError=fc;var mc=class extends et{constructor(t,r,n,i){super("LOCAL_EDITS_WOULD_BE_LOST",`Refusing to fetch ${t}/${r}: the local copy has unpushed edits AND the server has moved since it was fetched (local=${n??"(none)"}, server=${i??"(none)"}). Overwriting now would discard your edits and replace them with another writer's changes. Push or discard your edits first, or pass { overwrite: true } to deliberately reset the local copy to the server version.`),this.type=t,this.id=r,this.localEtag=n,this.serverEtag=i}};Y.LocalEditsWouldBeLostError=mc;var hc=class extends et{constructor(t,r,n,i,a){super("VERSION_CONFLICT",`Version conflict for ${t}/${r}: local=${n??"(none)"}, server=${i??"(none)"}. Re-fetch and reapply changes.${a?` ${a}`:""}`),this.type=t,this.id=r,this.localEtag=n,this.serverEtag=i,this.detail=a}};Y.VersionConflictError=hc;var gc=class extends et{constructor(t,r,n,i){super("CONNECTION_ERROR",r>0?`HTTP ${r} from ${t}: ${n}`:`Transport failure reaching ${t}: ${n}`),this.url=t,this.statusCode=r,this.cause=i}};Y.ConnectionError=gc;var vc=class extends et{constructor(t){super("WORKSPACE_NOT_INITIALIZED",`Workspace not initialized at ${t}. Call initWorkspace() first.`),this.workspacePath=t}};Y.WorkspaceNotInitializedError=vc;var yc=class extends et{constructor(t,r){super("NOT_IMPLEMENTED",`Operation '${t}' is not implemented yet${r?`: ${r}`:""}.`),this.operation=t}};Y.NotImplementedError=yc;var bc=class extends et{constructor(t,r){super("INVALID_JSON_POINTER",`Invalid JSON Pointer '${t}': ${r}`),this.pointer=t}};Y.JsonPointerError=bc;var wc=class extends et{constructor(t,r,n){super("AMBIGUOUS_ARTIFACT",`Found ${n} ${t} rows matching '${r}'; a name is not a unique key. Resolve by id / alternate key instead of relying on name-based idempotency.`),this.kind=t,this.identity=r,this.matchCount=n}};Y.AmbiguousArtifactError=wc;var Ac=class extends et{constructor(t,r){super("PATH_TRAVERSAL",`Refusing to resolve a path outside the workspace root: '${t}' is not within '${r}'.`),this.target=t,this.root=r}};Y.PathTraversalError=Ac;var Cc=class extends et{constructor(t,r){super("INCOMPATIBLE_WORKSPACE",`Workspace schema version ${t} is newer than this SDK supports (v${r}). Upgrade the SDK, or re-create the workspace with this version.`),this.workspaceVersion=t,this.supportedVersion=r}};Y.IncompatibleWorkspaceError=Cc});var ee=g(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.odataQuery=Fe.normalizeGuid=Fe.createSafeXmlElement=Fe.assertNoControlChars=Fe.assertODataName=Fe.assertXmlName=Fe.xmlText=Fe.odataPathLiteral=Fe.odataLiteral=void 0;var ms=ie();function Cg(e){return String(e??"").replace(/'/g,"''")}Fe.odataLiteral=Cg;function EP(e){return encodeURIComponent(Cg(e))}Fe.odataPathLiteral=EP;function NP(e){return String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}Fe.xmlText=NP;function Sg(e,t){let r=String(e??""),n=/^[A-Za-z_][0-9A-Za-z_.-]*$/,i=r.split(":");if(!(i.length<=2&&i.every(o=>n.test(o))&&!/^xmlns/i.test(r)))throw new ms.InvalidArgumentError(`${t} must be a valid XML element name (got '${e}')`);return e}Fe.assertXmlName=Sg;function DP(e,t){let r=String(e??"");if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(r))throw new ms.InvalidArgumentError(`${t} must be a valid OData identifier (letters, digits, underscore): got '${e}'`);return e}Fe.assertODataName=DP;function IP(e,t){if(/[\u0000-\u001F\u007F]/.test(String(e??"")))throw new ms.InvalidArgumentError(`${t} must not contain control characters (including CR/LF): they would inject additional lines into the request`);return e}Fe.assertNoControlChars=IP;function _P(e,t,r){return e.createElement(Sg(t,r))}Fe.createSafeXmlElement=_P;var PP=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;function TP(e,t){let r=String(e??""),n=r.length===38&&r.startsWith("{")&&r.endsWith("}")?r.slice(1,-1):r;if(!PP.test(n))throw new ms.InvalidArgumentError(`${t} must be a valid GUID (got '${e}')`);return n.toLowerCase()}Fe.normalizeGuid=TP;function OP(e){let t=[];for(let[r,n]of e)n!=null&&n!==""&&t.push(`${r}=${encodeURIComponent(String(n))}`);return t.length>0?`?${t.join("&")}`:""}Fe.odataQuery=OP});var be=g(te=>{"use strict";Object.defineProperty(te,"__esModule",{value:!0});te.nowIso=te.isAlreadyDeleted=te.deleteRecord=te.ensureSuccess=te.resolveCreatedId=te.requireCreatedId=te.withClientMintedId=te.readCreatedId=te.readEtag=te.requireEtag=te.echoWrite=te.UPDATE_NO_ETAG_CODE=te.VERSION_CONFLICT_CODE=void 0;var pi=ie(),xa=ee();te.VERSION_CONFLICT_CODE="VERSION_CONFLICT";te.UPDATE_NO_ETAG_CODE="ARTIFACT_UPDATE_NO_ETAG";function RP(e,t){return{query:`?$select=${encodeURIComponent(e)}`,options:{headers:{...t??{},Prefer:"return=representation"}}}}te.echoWrite=RP;function FP(e,t,r){if(!e)throw new pi.SdkError(te.UPDATE_NO_ETAG_CODE,`Refusing to push ${t} '${r}': no concurrency token is held for it, so the write could not be made conditional and would silently overwrite a concurrent edit. Re-fetch the ${t} and re-apply the change.`);return e}te.requireEtag=FP;function xP(e){var t;let r=(t=e.headers)!==null&&t!==void 0?t:{};for(let i of Object.keys(r))if(i.toLowerCase()==="etag")return r[i];let n=e.body;return n&&typeof n["@odata.etag"]=="string"?n["@odata.etag"]:null}te.readEtag=xP;function Sc(e,t){var r;let n=e.body;if(n&&typeof n[t]=="string")return(0,xa.normalizeGuid)(n[t],t);let i=(r=e.headers)!==null&&r!==void 0?r:{};for(let a of Object.keys(i))if(a.toLowerCase()==="odata-entityid"){let o=/\(([0-9a-fA-F-]{36})\)/.exec(i[a]);if(o)return(0,xa.normalizeGuid)(o[1],t)}return null}te.readCreatedId=Sc;function LP(e,t,r){return r?{...e,[t]:(0,xa.normalizeGuid)(r,t)}:e}te.withClientMintedId=LP;function kP(e,t,r){let n=Sc(e,t);if(!n)throw new pi.InvalidArgumentError(`Dataverse did not return an id for the created ${r}`);return n}te.requireCreatedId=kP;function MP(e,t,r,n){let i=Sc(e,t);if(i)return i;if(n)return(0,xa.normalizeGuid)(n,t);throw new pi.InvalidArgumentError(`Dataverse did not return an id for the created ${r}`)}te.resolveCreatedId=MP;function Eg(e,t){if(e.status===412)throw new pi.SdkError(te.VERSION_CONFLICT_CODE,`Version conflict (412) from ${t}`);if(e.status<200||e.status>=300)throw new pi.ConnectionError(t,e.status,UP(e.body),e.body);return e}te.ensureSuccess=Eg;function UP(e){if(typeof e=="string"&&e.length>0)return e;if(e!==null&&typeof e=="object"){let t=e;if(t.error&&typeof t.error.message=="string")return t.error.message;if(typeof t.Message=="string")return t.Message;if(typeof t.message=="string")return t.message}return"request failed"}async function BP(e,t,r,n){let i=(0,xa.normalizeGuid)(r,"id"),a=`/${t}(${i})`;Eg(await e.delete(a,n?{headers:{"If-Match":n}}:void 0),e.apiUrl(a))}te.deleteRecord=BP;function $P(e){return e instanceof pi.ConnectionError&&e.statusCode===404}te.isAlreadyDeleted=$P;function qP(){return new Date().toISOString()}te.nowIso=qP});var Kt=g(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0});fi.describeMalformedValue=fi.collectPages=void 0;var Ng=be(),Ec=ie();async function VP(e,t,r){let n=[],i=new Set,a=e.apiUrl(t),o=(0,Ng.ensureSuccess)(await e.get(t),a);for(;;){let s=o.body,l=s?.value;if(!Array.isArray(l))throw new Ec.ConnectionError(a,o.status,`${r}: paginated read returned a malformed page \u2014 expected an OData 'value' array but got ${Nc(l)}; refusing to return partial results.`);for(let c of l)n.push(c);let u=s?.["@odata.nextLink"];if(u==null)break;if(typeof u!="string"||u.length===0)throw new Ec.ConnectionError(a,o.status,`${r}: paginated read returned a malformed @odata.nextLink (${Nc(u)}); cannot follow it, and refusing to return partial results.`);if(i.has(u))throw new Ec.InvalidArgumentError(`${r}: aborting pagination \u2014 the server returned a repeated @odata.nextLink ('${u}'), which would loop indefinitely.`);i.add(u),a=u,o=(0,Ng.ensureSuccess)(await e.getAbsolute(u),u)}return n}fi.collectPages=VP;function Nc(e){return e===null?"null":e===void 0?"undefined (missing)":`a ${typeof e}`}fi.describeMalformedValue=Nc});var Dc=g(ur=>{"use strict";Object.defineProperty(ur,"__esModule",{value:!0});ur.businessRuleApi=ur.BUSINESS_RULE_LEFT_DEACTIVATED_CODE=ur.WFOM_API_UNAVAILABLE_CODE=void 0;var xr=Mn(),GP=Kt(),tt=be(),an=ee(),gs=ie();ur.WFOM_API_UNAVAILABLE_CODE="BUSINESS_RULE_API_UNAVAILABLE";ur.BUSINESS_RULE_LEFT_DEACTIVATED_CODE="BUSINESS_RULE_LEFT_DEACTIVATED";async function Dg(e,t,r,n){let i=`/workflows(${jP})/Microsoft.Dynamics.CRM.${t}`;try{return(0,tt.ensureSuccess)(await e.post(i,{Entity:r.Entity,WfomJson:r.WfomJson},{headers:n}),e.apiUrl(i))}catch(a){throw a?.statusCode!==404?a:new gs.SdkError(ur.WFOM_API_UNAVAILABLE_CODE,`Business-rule authoring (preview) is not enabled on this environment yet: it does not expose 'Microsoft.Dynamics.CRM.${t}'. The bound members are still rolling out, so re-check once the release flag reaches this environment. Nothing was written. The SDK does NOT fall back to generating workflow XAML: that covered only 4 of the 7 action types and would silently save a rule different from the one you wrote.`)}}async function zP(e,t){let r=`/workflows(${t})${(0,an.odataQuery)([["$select","workflowid,statecode,statuscode"]])}`;try{let n=await e.get(r);if(n.status<200||n.status>=300)return null;let i=n.body;return{etag:(0,tt.readEtag)(n),statecode:typeof i?.statecode=="number"?i.statecode:null,statuscode:typeof i?.statuscode=="number"?i.statuscode:null}}catch{return null}}async function WP(e,t,r){let n=await zP(e,t);if(n===null||n.etag===null)throw new gs.SdkError(tt.VERSION_CONFLICT_CODE,`Refusing to update business rule '${t}': its current version could not be read, so the write could not be verified as conditional. The supported update api does not enforce If-Match, so proceeding would risk silently overwriting a concurrent edit. Re-fetch the rule and try again.`);if(n.etag!==r)throw new gs.SdkError(tt.VERSION_CONFLICT_CODE,`Version conflict updating business rule '${t}': it changed on the server since it was fetched (held ${r}, server ${n.etag}). Re-fetch the rule and re-apply the change.`);return{statecode:n.statecode,statuscode:n.statuscode}}var jP="00000000-0000-0000-0000-000000000000",hs={"Content-Type":"application/json",Accept:"application/json","OData-Version":"4.0","OData-MaxVersion":"4.0"},HP="workflowid,name,description,primaryentity,statecode,category,type",QP="category eq 2 and type eq 1";async function Ig(e,t,r){var n;if(r==="Draft")return null;let i=(0,an.normalizeGuid)(t,"workflowid"),a=r==="Active",o={statecode:a?xr.StateCode.Activated:xr.StateCode.Draft,statuscode:a?xr.StatusCode.Activated:xr.StatusCode.Draft},s=`/workflows(${i})`,l=(0,tt.ensureSuccess)(await e.patch(s,o,{headers:hs}),e.apiUrl(s));return(n=(0,tt.readEtag)(l))!==null&&n!==void 0?n:await La(e,i)}async function La(e,t){let r=`/workflows(${t})${(0,an.odataQuery)([["$select","workflowid"]])}`;try{let n=await e.get(r);return n.status>=200&&n.status<300?(0,tt.readEtag)(n):null}catch{return null}}async function JP(e,t,r){let n=await La(e,t),i=await r(),a=(0,tt.readEtag)(i);if(a)return{response:i,etag:a};let o=await La(e,t);return{response:i,etag:n!==null&&n===o?o:null}}ur.businessRuleApi={async get(e,t){let r=(0,an.normalizeGuid)(t,"id"),n=`/workflows(${r})/Microsoft.Dynamics.CRM.RetrieveProcessWithWfomJson`,{response:i,etag:a}=await JP(e,r,async()=>(0,tt.ensureSuccess)(await e.get(n),e.apiUrl(n)));return{raw:i.body,etag:a}},async list(e,t){let r=[QP];t?.entityLogicalName&&r.push(`primaryentity eq '${(0,an.odataLiteral)(t.entityLogicalName)}'`);let n=`/workflows${(0,an.odataQuery)([["$select",HP],["$filter",r.join(" and ")]])}`;return(await(0,GP.collectPages)(e,n,"listArtifacts('businessRule')")).map(a=>{var o,s;return{type:"businessRule",id:(o=a.workflowid)!==null&&o!==void 0?o:"",name:(s=a.name)!==null&&s!==void 0?s:"",entityLogicalName:a.primaryentity,isDirty:!1}})},async create(e,t){var r;let n=t,i=(0,an.normalizeGuid)(n.Entity.workflowid,"workflowid"),a=await Dg(e,"CreateProcessWithWfomJson",n,hs),o=(0,tt.resolveCreatedId)(a,"workflowid","business rule",i),s=null;try{s=await Ig(e,o,n.status)}catch(l){try{await(0,tt.deleteRecord)(e,"workflows",o)}catch{}throw l}return{id:o,etag:(r=s??(0,tt.readEtag)(a))!==null&&r!==void 0?r:await La(e,o)}},async update(e,t,r,n){var i,a;let o=r,s=(0,an.normalizeGuid)(t,"id"),l=`/workflows(${s})`,u={...hs,"If-Match":(0,tt.requireEtag)(n,"business rule",s)},c=await WP(e,s,u["If-Match"]),d=c.statecode===xr.StateCode.Activated;d&&(0,tt.ensureSuccess)(await e.patch(l,{statecode:xr.StateCode.Draft,statuscode:xr.StatusCode.Draft},{headers:u}),e.apiUrl(l));let p;try{p=await Dg(e,"UpdateProcessWithWfomJson",o,u)}catch(h){if(d)try{(0,tt.ensureSuccess)(await e.patch(l,{statecode:xr.StateCode.Activated,statuscode:(i=c.statuscode)!==null&&i!==void 0?i:xr.StatusCode.Activated},{headers:hs}),e.apiUrl(l))}catch(y){throw new gs.SdkError(ur.BUSINESS_RULE_LEFT_DEACTIVATED_CODE,`The business-rule write failed AND the rule could not be re-activated, so '${s}' is left DEACTIVATED (Draft) on the server. Re-activate it before relying on it. Original write failure: ${h instanceof Error?h.message:String(h)}. Restore failure: ${y instanceof Error?y.message:String(y)}`)}throw h}let f=await Ig(e,s,o.status);return{id:s,etag:(a=f??(0,tt.readEtag)(p))!==null&&a!==void 0?a:await La(e,s)}},delete(e,t){return(0,tt.deleteRecord)(e,"workflows",t)}}});var _g=g(Ic=>{"use strict";Object.defineProperty(Ic,"__esModule",{value:!0});Ic.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var Pg=g(_c=>{"use strict";Object.defineProperty(_c,"__esModule",{value:!0});_c.default="00000000-0000-0000-0000-000000000000"});var Tg=g(Pc=>{"use strict";Object.defineProperty(Pc,"__esModule",{value:!0});Pc.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i});var ka=g(Tc=>{"use strict";Object.defineProperty(Tc,"__esModule",{value:!0});var XP=Tg();function KP(e){return typeof e=="string"&&XP.default.test(e)}Tc.default=KP});var Ma=g(Oc=>{"use strict";Object.defineProperty(Oc,"__esModule",{value:!0});var YP=ka();function ZP(e){if(!(0,YP.default)(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}Oc.default=ZP});var Lr=g(Ua=>{"use strict";Object.defineProperty(Ua,"__esModule",{value:!0});Ua.unsafeStringify=void 0;var eT=ka(),rt=[];for(let e=0;e<256;++e)rt.push((e+256).toString(16).slice(1));function Og(e,t=0){return(rt[e[t+0]]+rt[e[t+1]]+rt[e[t+2]]+rt[e[t+3]]+"-"+rt[e[t+4]]+rt[e[t+5]]+"-"+rt[e[t+6]]+rt[e[t+7]]+"-"+rt[e[t+8]]+rt[e[t+9]]+"-"+rt[e[t+10]]+rt[e[t+11]]+rt[e[t+12]]+rt[e[t+13]]+rt[e[t+14]]+rt[e[t+15]]).toLowerCase()}Ua.unsafeStringify=Og;function tT(e,t=0){let r=Og(e,t);if(!(0,eT.default)(r))throw TypeError("Stringified UUID is invalid");return r}Ua.default=tT});var bs=g(Rc=>{"use strict";Object.defineProperty(Rc,"__esModule",{value:!0});var rT=require("crypto"),ys=new Uint8Array(256),vs=ys.length;function nT(){return vs>ys.length-16&&((0,rT.randomFillSync)(ys),vs=0),ys.slice(vs,vs+=16)}Rc.default=nT});var Fc=g($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});$a.updateV1State=void 0;var Rg=bs(),iT=Lr(),Ba={};function aT(e,t,r){let n,i=e?._v6??!1;if(e){let a=Object.keys(e);a.length===1&&a[0]==="_v6"&&(e=void 0)}if(e)n=Fg(e.random??e.rng?.()??(0,Rg.default)(),e.msecs,e.nsecs,e.clockseq,e.node,t,r);else{let a=Date.now(),o=(0,Rg.default)();xg(Ba,a,o),n=Fg(o,Ba.msecs,Ba.nsecs,i?void 0:Ba.clockseq,i?void 0:Ba.node,t,r)}return t??(0,iT.unsafeStringify)(n)}function xg(e,t,r){return e.msecs??=-1/0,e.nsecs??=0,t===e.msecs?(e.nsecs++,e.nsecs>=1e4&&(e.node=void 0,e.nsecs=0)):t>e.msecs?e.nsecs=0:t<e.msecs&&(e.node=void 0),e.node||(e.node=r.slice(10,16),e.node[0]|=1,e.clockseq=(r[8]<<8|r[9])&16383),e.msecs=t,e}$a.updateV1State=xg;function Fg(e,t,r,n,i,a,o=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(!a)a=new Uint8Array(16),o=0;else if(o<0||o+16>a.length)throw new RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`);t??=Date.now(),r??=0,n??=(e[8]<<8|e[9])&16383,i??=e.slice(10,16),t+=122192928e5;let s=((t&268435455)*1e4+r)%4294967296;a[o++]=s>>>24&255,a[o++]=s>>>16&255,a[o++]=s>>>8&255,a[o++]=s&255;let l=t/4294967296*1e4&268435455;a[o++]=l>>>8&255,a[o++]=l&255,a[o++]=l>>>24&15|16,a[o++]=l>>>16&255,a[o++]=n>>>8|128,a[o++]=n&255;for(let u=0;u<6;++u)a[o++]=i[u];return a}$a.default=aT});var Lc=g(xc=>{"use strict";Object.defineProperty(xc,"__esModule",{value:!0});var oT=Ma(),sT=Lr();function lT(e){let t=typeof e=="string"?(0,oT.default)(e):e,r=uT(t);return typeof e=="string"?(0,sT.unsafeStringify)(r):r}xc.default=lT;function uT(e){return Uint8Array.of((e[6]&15)<<4|e[7]>>4&15,(e[7]&15)<<4|(e[4]&240)>>4,(e[4]&15)<<4|(e[5]&240)>>4,(e[5]&15)<<4|(e[0]&240)>>4,(e[0]&15)<<4|(e[1]&240)>>4,(e[1]&15)<<4|(e[2]&240)>>4,96|e[2]&15,e[3],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}});var Lg=g(kc=>{"use strict";Object.defineProperty(kc,"__esModule",{value:!0});var cT=require("crypto");function dT(e){return Array.isArray(e)?e=Buffer.from(e):typeof e=="string"&&(e=Buffer.from(e,"utf8")),(0,cT.createHash)("md5").update(e).digest()}kc.default=dT});var qa=g(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.URL=kr.DNS=kr.stringToBytes=void 0;var kg=Ma(),pT=Lr();function Mg(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t}kr.stringToBytes=Mg;kr.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";kr.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function fT(e,t,r,n,i,a){let o=typeof r=="string"?Mg(r):r,s=typeof n=="string"?(0,kg.default)(n):n;if(typeof n=="string"&&(n=(0,kg.default)(n)),n?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let l=new Uint8Array(16+o.length);if(l.set(s),l.set(o,s.length),l=t(l),l[6]=l[6]&15|e,l[8]=l[8]&63|128,i){if(a=a||0,a<0||a+16>i.length)throw new RangeError(`UUID byte range ${a}:${a+15} is out of buffer bounds`);for(let u=0;u<16;++u)i[a+u]=l[u];return i}return(0,pT.unsafeStringify)(l)}kr.default=fT});var Bg=g(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.URL=Un.DNS=void 0;var mT=Lg(),Mc=qa(),Ug=qa();Object.defineProperty(Un,"DNS",{enumerable:!0,get:function(){return Ug.DNS}});Object.defineProperty(Un,"URL",{enumerable:!0,get:function(){return Ug.URL}});function Uc(e,t,r,n){return(0,Mc.default)(48,mT.default,e,t,r,n)}Uc.DNS=Mc.DNS;Uc.URL=Mc.URL;Un.default=Uc});var $g=g(Bc=>{"use strict";Object.defineProperty(Bc,"__esModule",{value:!0});var hT=require("crypto");Bc.default={randomUUID:hT.randomUUID}});var Vg=g($c=>{"use strict";Object.defineProperty($c,"__esModule",{value:!0});var qg=$g(),gT=bs(),vT=Lr();function yT(e,t,r){if(qg.default.randomUUID&&!t&&!e)return qg.default.randomUUID();e=e||{};let n=e.random??e.rng?.()??(0,gT.default)();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return(0,vT.unsafeStringify)(n)}$c.default=yT});var Gg=g(qc=>{"use strict";Object.defineProperty(qc,"__esModule",{value:!0});var bT=require("crypto");function wT(e){return Array.isArray(e)?e=Buffer.from(e):typeof e=="string"&&(e=Buffer.from(e,"utf8")),(0,bT.createHash)("sha1").update(e).digest()}qc.default=wT});var Wg=g(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.URL=Bn.DNS=void 0;var AT=Gg(),Vc=qa(),zg=qa();Object.defineProperty(Bn,"DNS",{enumerable:!0,get:function(){return zg.DNS}});Object.defineProperty(Bn,"URL",{enumerable:!0,get:function(){return zg.URL}});function Gc(e,t,r,n){return(0,Vc.default)(80,AT.default,e,t,r,n)}Gc.DNS=Vc.DNS;Gc.URL=Vc.URL;Bn.default=Gc});var jg=g(zc=>{"use strict";Object.defineProperty(zc,"__esModule",{value:!0});var CT=Lr(),ST=Fc(),ET=Lc();function NT(e,t,r){e??={},r??=0;let n=(0,ST.default)({...e,_v6:!0},new Uint8Array(16));if(n=(0,ET.default)(n),t){if(r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;i++)t[r+i]=n[i];return t}return(0,CT.unsafeStringify)(n)}zc.default=NT});var Hg=g(Wc=>{"use strict";Object.defineProperty(Wc,"__esModule",{value:!0});var DT=Ma(),IT=Lr();function _T(e){let t=typeof e=="string"?(0,DT.default)(e):e,r=PT(t);return typeof e=="string"?(0,IT.unsafeStringify)(r):r}Wc.default=_T;function PT(e){return Uint8Array.of((e[3]&15)<<4|e[4]>>4&15,(e[4]&15)<<4|(e[5]&240)>>4,(e[5]&15)<<4|e[6]&15,e[7],(e[1]&15)<<4|(e[2]&240)>>4,(e[2]&15)<<4|(e[3]&240)>>4,16|(e[0]&240)>>4,(e[0]&15)<<4|(e[1]&240)>>4,e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}});var Kg=g(Va=>{"use strict";Object.defineProperty(Va,"__esModule",{value:!0});Va.updateV7State=void 0;var Qg=bs(),TT=Lr(),jc={};function OT(e,t,r){let n;if(e)n=Jg(e.random??e.rng?.()??(0,Qg.default)(),e.msecs,e.seq,t,r);else{let i=Date.now(),a=(0,Qg.default)();Xg(jc,i,a),n=Jg(a,jc.msecs,jc.seq,t,r)}return t??(0,TT.unsafeStringify)(n)}function Xg(e,t,r){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=r[6]<<23|r[7]<<16|r[8]<<8|r[9],e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}Va.updateV7State=Xg;function Jg(e,t,r,n,i=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(!n)n=new Uint8Array(16),i=0;else if(i<0||i+16>n.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),r??=e[6]*127<<24|e[7]<<16|e[8]<<8|e[9],n[i++]=t/1099511627776&255,n[i++]=t/4294967296&255,n[i++]=t/16777216&255,n[i++]=t/65536&255,n[i++]=t/256&255,n[i++]=t&255,n[i++]=112|r>>>28&15,n[i++]=r>>>20&255,n[i++]=128|r>>>14&63,n[i++]=r>>>6&255,n[i++]=r<<2&255|e[10]&3,n[i++]=e[11],n[i++]=e[12],n[i++]=e[13],n[i++]=e[14],n[i++]=e[15],n}Va.default=OT});var Yg=g(Hc=>{"use strict";Object.defineProperty(Hc,"__esModule",{value:!0});var RT=ka();function FT(e){if(!(0,RT.default)(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)}Hc.default=FT});var ws=g(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.version=re.validate=re.v7=re.v6ToV1=re.v6=re.v5=re.v4=re.v3=re.v1ToV6=re.v1=re.stringify=re.parse=re.NIL=re.MAX=void 0;var xT=_g();Object.defineProperty(re,"MAX",{enumerable:!0,get:function(){return xT.default}});var LT=Pg();Object.defineProperty(re,"NIL",{enumerable:!0,get:function(){return LT.default}});var kT=Ma();Object.defineProperty(re,"parse",{enumerable:!0,get:function(){return kT.default}});var MT=Lr();Object.defineProperty(re,"stringify",{enumerable:!0,get:function(){return MT.default}});var UT=Fc();Object.defineProperty(re,"v1",{enumerable:!0,get:function(){return UT.default}});var BT=Lc();Object.defineProperty(re,"v1ToV6",{enumerable:!0,get:function(){return BT.default}});var $T=Bg();Object.defineProperty(re,"v3",{enumerable:!0,get:function(){return $T.default}});var qT=Vg();Object.defineProperty(re,"v4",{enumerable:!0,get:function(){return qT.default}});var VT=Wg();Object.defineProperty(re,"v5",{enumerable:!0,get:function(){return VT.default}});var GT=jg();Object.defineProperty(re,"v6",{enumerable:!0,get:function(){return GT.default}});var zT=Hg();Object.defineProperty(re,"v6ToV1",{enumerable:!0,get:function(){return zT.default}});var WT=Kg();Object.defineProperty(re,"v7",{enumerable:!0,get:function(){return WT.default}});var jT=ka();Object.defineProperty(re,"validate",{enumerable:!0,get:function(){return jT.default}});var HT=Yg();Object.defineProperty(re,"version",{enumerable:!0,get:function(){return HT.default}})});function As(e,t){return e==="SetFieldValue"&&t!==void 0&&QT.has(t.attributeType)&&(t.requiredLevel==="None"||t.requiredLevel==="Recommended")}var QT,Qc=I(()=>{"use strict";QT=new Set(["Integer","Double","Decimal","Money","String","Memo","DateTime","Picklist","Lookup"])});function Zg(e){return e!=="Entity"&&e!=="AllForms"&&typeof e=="string"&&e.trim()!==""}function Jc(e){return Zg(e)?1:2}function Xc(e){return Zg(e)?e:void 0}function e0(e,t){let r=Xc(e.scope);return{"@odata.type":"#Microsoft.Dynamics.CRM.workflow",name:e.name,description:e.description,workflowid:t,ondemand:!1,subprocess:!1,triggeroncreate:!1,triggerondelete:!1,category:mi.WorkflowCategory.BusinessRule,type:mi.WorkflowTypeCode.Definition,mode:1,scope:mi.WorkflowScope.Organization,primaryentity:e.entityLogicalName,iscrmuiworkflow:!0,processtriggerscope:Jc(e.scope),...r!==void 0?{processtriggerformid:r}:{}}}var mi,t0=I(()=>{"use strict";mi=se(Mn());});function r0(e,t=0){return(nt[e[t+0]]+nt[e[t+1]]+nt[e[t+2]]+nt[e[t+3]]+"-"+nt[e[t+4]]+nt[e[t+5]]+"-"+nt[e[t+6]]+nt[e[t+7]]+"-"+nt[e[t+8]]+nt[e[t+9]]+"-"+nt[e[t+10]]+nt[e[t+11]]+nt[e[t+12]]+nt[e[t+13]]+nt[e[t+14]]+nt[e[t+15]]).toLowerCase()}var nt,n0=I(()=>{nt=[];for(let e=0;e<256;++e)nt.push((e+256).toString(16).slice(1))});function Kc(){return Cs>Ss.length-16&&((0,i0.randomFillSync)(Ss),Cs=0),Ss.slice(Cs,Cs+=16)}var i0,Ss,Cs,a0=I(()=>{i0=require("crypto"),Ss=new Uint8Array(256),Cs=Ss.length});var o0,Yc,s0=I(()=>{o0=require("crypto"),Yc={randomUUID:o0.randomUUID}});function JT(e,t,r){if(Yc.randomUUID&&!t&&!e)return Yc.randomUUID();e=e||{};let n=e.random??e.rng?.()??Kc();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return r0(n)}var dt,l0=I(()=>{s0();a0();n0();dt=JT});var Zc=I(()=>{l0()});var u0=I(()=>{"use strict";});var ed=g(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.WorkflowConditionOperator=Lt.WorkflowAttributeType=Lt.SystemStep=Lt.FieldRequiredLevelTypes=Lt.AttributeDateTimeBehavior=void 0;Lt.AttributeDateTimeBehavior={None:0,Dynamic:1,DateOnly:2,StaticTimeZoneInvariant:3,UserLocal:4};Lt.FieldRequiredLevelTypes={None:"0",Required:"1",Recommended:"2"};Lt.SystemStep={IdentifyContact:"IdentifyContact",IdentifyAccount:"IdentifyAccount",IdentifyCustomer:"IdentifyCustomer",IdentifyCase:"IdentifyCase",Solution:"Solution",Resolve:"Resolve"};Lt.WorkflowAttributeType={Boolean:"0",Customer:"1",DateTime:"2",Decimal:"3",Float:"4",Integer:"5",Lookup:"6",Money:"7",Owner:"8",PartyList:"9",Picklist:"10",Key:"11",State:"12",Status:"13",String:"14",UniqueIdentifier:"15",EntityNameReference:"16",Entity:"17",EntityCollection:"18",BpfProcess:"19",BpfStageCategory:"20",BpfStage:"21",EntityReferenceCollection:"22",MultiSelectPicklist:"23",BigType:"24"};Lt.WorkflowConditionOperator={IsNull:"0",NotNull:"1",LogicalAnd:"2",LogicalOr:"3",IN:"4",NotIn:"5",NotInNull:"51",Equal:"6",NotEqual:"7",Contains:"8",DoesNotContain:"9",BeginsWith:"10",DoesNotBeginWith:"11",EndsWith:"12",DoesNotEndWith:"13",GreaterThan:"14",GreaterThanOrEqual:"15",LessThan:"16",LessThanOrEqual:"17",EqualUserId:"18",NotEqualUserId:"19",On:"20",NotOn:"21",OnOrAfter:"22",OnOrBefore:"23",Yesterday:"24",Today:"25",Tomorrow:"26",NextSevenDays:"27",LastSevenDays:"28",NextWeek:"29",LastWeek:"30",ThisWeek:"31",NextMonth:"32",LastMonth:"33",ThisMonth:"34",NextYear:"35",LastYear:"36",ThisYear:"37",Anytime:"38",LastXHours:"39",NextXHours:"40",LastXDays:"41",NextXDays:"42",LastXWeeks:"43",NextXWeeks:"44",LastXMonths:"45",NextXMonths:"46",LastXYears:"47",NextXYears:"48",Under:"49",NotUnder:"50"}});function f0(e){switch(e){case"Boolean":return fe.WorkflowAttributeType.Boolean;case"Customer":return fe.WorkflowAttributeType.Customer;case"DateTime":return fe.WorkflowAttributeType.DateTime;case"Decimal":return fe.WorkflowAttributeType.Decimal;case"Double":return fe.WorkflowAttributeType.Float;case"Integer":return fe.WorkflowAttributeType.Integer;case"Lookup":return fe.WorkflowAttributeType.Lookup;case"Money":return fe.WorkflowAttributeType.Money;case"Owner":return fe.WorkflowAttributeType.Owner;case"Picklist":return fe.WorkflowAttributeType.Picklist;case"State":return fe.WorkflowAttributeType.State;case"Status":return fe.WorkflowAttributeType.Status;case"Uniqueidentifier":case"UniqueIdentifier":return fe.WorkflowAttributeType.UniqueIdentifier;case"BigInt":return fe.WorkflowAttributeType.BigType;default:return fe.WorkflowAttributeType.String}}function w0(e){return e&&e!==fe.WorkflowAttributeType.String?e:void 0}function YT(e){return{__class:b0,parameterName:"primaryEntity",entityName:e}}function c0(e){return{__class:rd,type:td,typeSet:!1,behavior:fe.AttributeDateTimeBehavior.None,method:m0,parameters:[e]}}function d0(e,t,r=fe.WorkflowAttributeType.String){return{__class:g0,type:r,behavior:fe.AttributeDateTimeBehavior.None,typeSet:!1,entity:YT(t),attributeName:e}}function ZT(e,t=fe.WorkflowAttributeType.String){return{__class:v0,type:t,behavior:fe.AttributeDateTimeBehavior.None,typeSet:!1,primitiveValue:e}}function eO(e){return{__class:y0,type:td,typeSet:!1,behavior:fe.AttributeDateTimeBehavior.None,days:e,hours:"0",minutes:"0",months:"0",years:"0"}}function A0(e,t){let r=XT[e.operator],n=c0(d0(e.leftField,t,e.leftWorkflowType)),i;e.dateArithmetic?i=eO(e.right.value??"0"):e.right.kind==="field"?i=d0(e.right.field??"",t,e.right.workflowType):i=ZT(e.right.value??"",e.right.workflowType??e.leftWorkflowType);let a=c0(i);return{__class:rd,type:td,typeSet:!1,behavior:fe.AttributeDateTimeBehavior.None,method:h0,parameters:[r,n,a]}}function C0(e){return typeof e=="object"&&e.__class===rd}function tO(e){return typeof e=="object"&&e.__class===y0}function Es(e){return C0(e)&&e.method===m0&&e.parameters.length>0?Es(e.parameters[0]):e}function p0(e){if(typeof e!="object"||e.__class!==g0)return null;let t=e.entity;if(t&&t.__class&&t.__class!==b0)return null;let r=e.attributeName;return r?{field:r,workflowType:w0(e.type)}:null}function S0(e){if(!e)return null;let t=Es(e);if(!C0(t)||t.method!==h0||t.parameters.length!==3)return null;let r=t.parameters[0],n=KT[String(r)];if(!n)return null;let i=p0(Es(t.parameters[1]));if(!i)return null;let a=Es(t.parameters[2]);if(tO(a))return n!=="+"&&n!=="-"?null:{leftField:i.field,leftWorkflowType:i.workflowType,operator:n,right:{kind:"value",value:String(a.days??"")},dateArithmetic:!0};let o=p0(a);if(o)return{leftField:i.field,leftWorkflowType:i.workflowType,operator:n,right:{kind:"field",field:o.field,workflowType:o.workflowType}};if(typeof a=="object"&&a.__class===v0){let s=a.primitiveValue;return{leftField:i.field,leftWorkflowType:i.workflowType,operator:n,right:{kind:"value",value:s!=null?String(s):"",workflowType:w0(a.type)}}}return null}function hi(e){return!e||!e.leftField?!1:e.right.kind==="field"?!!(e.right.field&&e.right.field.trim()):!!(e.right.value&&e.right.value.trim())}var fe,m0,h0,td,g0,v0,rd,y0,b0,XT,KT,Ns=I(()=>{"use strict";fe=se(ed());m0="0",h0="3",td="0",g0="EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions",v0="PrimitiveExpression:#Microsoft.Crm.Workflow.Expressions",rd="MethodCallExpression:#Microsoft.Crm.Workflow.Expressions",y0="TimeSpanExpression:#Microsoft.Crm.Workflow.Expressions",b0="PrimaryEntity:#Microsoft.Crm.Workflow.Expressions";XT={"+":0,"-":1,"*":2,"/":3},KT={0:"+",1:"-",2:"*",3:"/"}});function E0(e){return e.__class==="BinaryExpression:#Microsoft.Crm.Workflow.Expressions"}function rO(e){return e.__class==="ConditionBranchStep:#Microsoft.Crm.Workflow.ObjectModel"}function Ga(){return{list:[]}}function N0(e,t,r){return e&&e.list.length>0?{list:[{...e.list[0],description:t},...e.list.slice(1)]}:{list:[{labelId:dt(),languageCode:r,description:t}]}}function od(e){return{__class:"PrimaryEntity:#Microsoft.Crm.Workflow.Expressions",parameterName:"primaryEntity",entityName:e}}function sd(e,t,r){return{__class:"EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions",type:r,behavior:G.AttributeDateTimeBehavior.None,typeSet:!1,entity:od(t),attributeName:e}}function za(e,t){return{__class:"PrimitiveExpression:#Microsoft.Crm.Workflow.Expressions",type:t,behavior:G.AttributeDateTimeBehavior.None,typeSet:!1,primitiveValue:e}}function R0(e){return{__class:"LookupExpression:#Microsoft.Crm.Workflow.Expressions",type:e.workflowType??G.WorkflowAttributeType.Lookup,behavior:G.AttributeDateTimeBehavior.None,typeSet:!1,entityType:e.entityType,label:e.label,staticValue:za(e.id.replace(/[{}]/g,""),G.WorkflowAttributeType.UniqueIdentifier)}}function D0(e,t){let r=e.valueType==="Lookup"?e.lookupValue?.workflowType??G.WorkflowAttributeType.Lookup:e.valueType==="Clear"?e.valueWorkflowType??G.WorkflowAttributeType.String:G.WorkflowAttributeType.String,n=ad[e.operator]??G.WorkflowConditionOperator.Equal,i=sd(e.field,t,r),a;if(e.operator==="ContainsData"||e.operator==="DoesNotContainData")a=[];else if(e.valueType==="Field"&&e.valueField)a=[sd(e.valueField,t,r)];else if(e.valueType==="Lookup"){if(!e.lookupValue)throw new Error("Lookup condition is missing its record value.");a=[R0(e.lookupValue)]}else e.valueType==="Clear"?a=[za(null,r)]:e.valueType==="Expression"?a=[Is(e.valueType,e.value,e.valueField,t,e.expression,e.rawExpression)]:a=[za(e.value??"",r)];return{__class:"BinaryExpression:#Microsoft.Crm.Workflow.Expressions",type:r,behavior:G.AttributeDateTimeBehavior.None,typeSet:!1,conditionOperatoroperator:n,left:i,right:a}}function nO(e,t,r){if(e.length===0)return null;if(e.length===1)return D0(e[0],r);let n=t==="AND"?G.WorkflowConditionOperator.LogicalAnd:G.WorkflowConditionOperator.LogicalOr,[i,...a]=e.map(o=>D0(o,r));return{__class:"BinaryExpression:#Microsoft.Crm.Workflow.Expressions",type:G.WorkflowAttributeType.String,behavior:G.AttributeDateTimeBehavior.None,typeSet:!1,conditionOperatoroperator:n,left:i,right:a}}function Ds(e){if(!e)return{valueType:"Value",value:""};if(e.__class==="EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions")return{valueType:"Field",valueField:e.attributeName};if(e.__class==="PrimitiveExpression:#Microsoft.Crm.Workflow.Expressions")return e.primitiveValue==null?{valueType:"Clear",valueWorkflowType:e.type}:{valueType:"Value",value:e.primitiveValue!=null?String(e.primitiveValue):""};if(e.__class==="LookupExpression:#Microsoft.Crm.Workflow.Expressions"){let t=e.staticValue,r=typeof t=="object"&&t?.__class==="PrimitiveExpression:#Microsoft.Crm.Workflow.Expressions"?t.primitiveValue:t;return{valueType:"Lookup",lookupValue:{entityType:e.entityType,id:String(r??""),label:e.label,...e.type!==G.WorkflowAttributeType.Lookup?{workflowType:e.type}:{}}}}if(e.__class==="MethodCallExpression:#Microsoft.Crm.Workflow.Expressions"){let t=S0(e);return t?{valueType:"Expression",expression:t}:{valueType:"Expression",rawExpression:e}}return{valueType:"Value",value:""}}function nd(e){let t=O0[e.conditionOperatoroperator]??"Equals",r=e.left.__class==="EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions"?e.left.attributeName:"",i=t==="ContainsData"||t==="DoesNotContainData"?{valueType:"Value"}:Ds(e.right[0]);return{id:dt(),field:r,fieldDisplayName:r,operator:t,...i}}function I0(e){if(!e||e.__class!=="BinaryExpression:#Microsoft.Crm.Workflow.Expressions")return{clauses:[],logic:"AND"};let t=e.conditionOperatoroperator;if(t===G.WorkflowConditionOperator.LogicalAnd||t===G.WorkflowConditionOperator.LogicalOr){let r=t===G.WorkflowConditionOperator.LogicalAnd?"AND":"OR";return{clauses:[...E0(e.left)?[nd(e.left)]:[],...e.right.filter(E0).map(nd)],logic:r}}return{clauses:[nd(e)],logic:"AND"}}function Is(e,t,r,n,i,a,o,s){if(e==="Field"&&r)return sd(r,n,G.WorkflowAttributeType.String);if(e==="Expression"){if(i)return A0(i,n);if(a!=null)return a}return e==="Lookup"&&o?R0(o):e==="Clear"?za(null,s??G.WorkflowAttributeType.String):za(t??"",G.WorkflowAttributeType.String)}function id(e,t){return{propertyName:e,propertyValueExpr:t}}function gi(e){return`Step_${e.value++}`}function kt(e,t){let r=(t.counts[e]??0)+1,n=`${e}${r}`;for(;t.used.has(n);)r+=1,n=`${e}${r}`;return t.counts[e]=r,t.used.add(n),n}function _0(e,t,r){return e&&!r.used.has(e)?(r.used.add(e),e):kt(t,r)}function iO(e){return e===T0.StateCode.Activated?"Active":"Draft"}function aO(e,t){let r=e.processtriggerscope,n=e.processtriggerformid;return r===1&&n?n:r===2?"Entity":t??"Entity"}function F0(e,t=1033){return new vi({languageCode:t}).serialize(e)}function x0(e){return new vi().deserialize(e)}var T0,G,ad,O0,ld,vi,ud=I(()=>{"use strict";Zc();T0=se(Mn());u0();Ns();G=se(ed());ad={Equals:G.WorkflowConditionOperator.Equal,DoesNotEqual:G.WorkflowConditionOperator.NotEqual,IsGreaterThan:G.WorkflowConditionOperator.GreaterThan,IsLessThan:G.WorkflowConditionOperator.LessThan,IsGreaterThanEqualTo:G.WorkflowConditionOperator.GreaterThanOrEqual,IsLessThanEqualTo:G.WorkflowConditionOperator.LessThanOrEqual,Contains:G.WorkflowConditionOperator.Contains,DoesNotContain:G.WorkflowConditionOperator.DoesNotContain,BeginsWith:G.WorkflowConditionOperator.BeginsWith,DoesNotBeginWith:G.WorkflowConditionOperator.DoesNotBeginWith,EndsWith:G.WorkflowConditionOperator.EndsWith,DoesNotEndWith:G.WorkflowConditionOperator.DoesNotEndWith,On:G.WorkflowConditionOperator.On,NotOn:G.WorkflowConditionOperator.NotOn,ContainsData:G.WorkflowConditionOperator.NotNull,DoesNotContainData:G.WorkflowConditionOperator.IsNull},O0={};for(let e of Object.keys(ad))O0[ad[e]]=e;ld={setFieldValue:"Set Field Value",setDefaultValue:"Set Default Value",lockUnlock:"Lock/Unlock",setBusinessRequired:"Set Business Required",setVisibility:"Set Visibility",recommendation:"Recommendation",showErrorMessage:"Show Error Message",condition:"Condition"};vi=class{resolveLabel;languageCode;entityName="";stepCounter={value:0};idCounter={counts:{},used:new Set};constructor(t={}){this.resolveLabel=t.resolveLabel??(r=>ld[r]),this.languageCode=t.languageCode??1033}label(t){return this.resolveLabel(t)}serialize(t){let r=t.wfomRoot;this.entityName=t.entityLogicalName,this.stepCounter={value:r?Number(r.nextStepIndex):1},this.idCounter={counts:{},used:new Set};let n=t.scope!=="Entity"&&t.scope!=="AllForms"?t.scope:null,i=t.rootCondition?[this.serializeConditionNode(t.rootCondition)]:[],a={__class:"WorkflowStep:#Microsoft.Crm.Workflow.ObjectModel",id:r?.id??t.ruleId??dt(),name:r?.name??"Step_0",description:r!==void 0?r.description:t.description||null,stepLabels:Ga(),argumentsArray:[],primaryEntityName:r?.primaryEntityName??this.entityName,nextStepIndex:String(this.stepCounter.value),isCrmUIWorkflow:!0,category:r?.category??"2",businessProcessType:r?.businessProcessType??"0",mode:r?.mode??"0",title:r?.title??t.name,formId:n,workflowEntityId:r?.workflowEntityId??t.ruleId??"",variables:r?.variables??[],inputs:r?.inputs??[],steps:{list:i}};return JSON.stringify(a)}makeApplyActionStep(t){return{__class:"SetAttributeValueStep:#Microsoft.Crm.Workflow.ObjectModel",id:kt("SetAttributeValueStep",this.idCounter),description:t.displayName||"New Action",name:t.stepName??gi(this.stepCounter),stepLabels:{list:[]},specification:id(t.field,Is(t.valueType,t.value,t.valueField,this.entityName,t.expression,t.rawExpression,t.lookupValue,t.valueWorkflowType)),entity:od(this.entityName)}}makeRecommendationActionStep(t,r,n){let i=r.map(l=>this.makeApplyActionStep(l)),a=t??"",o=n?.stepLabels,s=N0(o,a,this.languageCode);return{__class:"ActionStep:#Microsoft.Crm.Workflow.ObjectModel",id:_0(n?.id,"ActionStep",this.idCounter),name:n?.name??gi(this.stepCounter),description:n?.description??"Action step",stepLabels:s,steps:{list:i},actionId:null,actionType:n?.actionType??"4",processId:n?.processId??dt(),uniqueName:n?.uniqueName??`id_${dt().replace(/-/g,"")}ActionStep`}}serializeAction(t){let r=od(this.entityName),n=t.stepName??gi(this.stepCounter),i=t.stepLabels??Ga(),a={name:n,stepLabels:i,description:t.displayName},o=t.type;switch(o){case"SetFieldValue":return{...a,id:kt("SetAttributeValueStep",this.idCounter),__class:"SetAttributeValueStep:#Microsoft.Crm.Workflow.ObjectModel",entity:r,specification:id(t.field,Is(t.valueType,t.value,t.valueField,this.entityName,t.expression,t.rawExpression,t.lookupValue,t.valueWorkflowType))};case"SetDefaultValue":return{...a,id:kt("SetDefaultValueStep",this.idCounter),__class:"SetDefaultValueStep:#Microsoft.Crm.Workflow.ObjectModel",entity:r,specification:id(t.field,Is(t.valueType,t.value,t.valueField,this.entityName,t.expression,t.rawExpression,t.lookupValue,t.valueWorkflowType))};case"LockUnlock":return{...a,id:kt("SetDisplayModeStep",this.idCounter),__class:"SetDisplayModeStep:#Microsoft.Crm.Workflow.ObjectModel",controlId:t.field,controlType:"standard",isReadOnly:t.lock,entity:r};case"SetBusinessRequired":return{...a,id:kt("SetFieldRequiredLevelStep",this.idCounter),__class:"SetFieldRequiredLevelStep:#Microsoft.Crm.Workflow.ObjectModel",controlId:t.field,controlType:"standard",requiredLevel:t.required?G.FieldRequiredLevelTypes.Required:G.FieldRequiredLevelTypes.None,entity:r};case"SetVisibility":return{...a,id:kt("SetVisibilityStep",this.idCounter),__class:"SetVisibilityStep:#Microsoft.Crm.Workflow.ObjectModel",controlId:t.field,controlType:"standard",isVisible:t.visible,entity:r};case"ShowErrorMessage":{let s=t.errorMessage||t.displayName,l=t.stepLabels&&t.stepLabels.list.length>0?t.stepLabels:{list:[{labelId:dt(),languageCode:this.languageCode,description:s}]};return{...a,id:kt("SetMessageStep",this.idCounter),__class:"SetMessageStep:#Microsoft.Crm.Workflow.ObjectModel",stepLabels:l,name:s,controlId:t.field,entity:r,level:t.messageLevel??"error",actionSteps:t.messageActionSteps??{list:[]}}}case"Recommendation":{let s=t.messageText??t.recommendationTitle??t.displayName,l=N0(t.stepLabels,s,this.languageCode),u={list:[this.makeRecommendationActionStep(t.acceptanceText,t.applyActions??[],t.recommendationActionStepMeta)]};return{...a,id:kt("SetMessageStep",this.idCounter),__class:"SetMessageStep:#Microsoft.Crm.Workflow.ObjectModel",stepLabels:l,description:t.recommendationTitle||t.displayName,controlId:t.field,entity:r,level:"RECOMMENDATION",actionSteps:u}}default:throw new Error(`Unsupported action type: ${o}`)}}serializeConditionNode(t){let r=t.stepName??gi(this.stepCounter),n=kt("ConditionStep",this.idCounter),i=[],a=t,o=!0;for(;a;){let s=nO(a.clauses,a.logic,this.entityName),l=o?a.branchName??gi(this.stepCounter):gi(this.stepCounter),c={__class:"ConditionBranchStep:#Microsoft.Crm.Workflow.ObjectModel",id:o?_0(a.branchId,"ConditionBranchStep",this.idCounter):kt("ConditionBranchStep",this.idCounter),name:l,description:a.displayName,stepLabels:Ga(),conditionExpression:s??void 0,steps:{list:a.trueBranch.map(p=>this.serializeBranchItem(p))}};i.push(c);let d=a.falseBranch;if(d.length===1&&d[0].kind==="condition"){a=d[0],o=!1;continue}d.length>0&&i.push(this.makeTerminalElseBranch(d)),a=void 0}return{__class:"ConditionStep:#Microsoft.Crm.Workflow.ObjectModel",id:n,name:r,description:"",stepLabels:Ga(),containsElsebranch:i.length>1,steps:{list:i}}}makeTerminalElseBranch(t){return{__class:"ConditionBranchStep:#Microsoft.Crm.Workflow.ObjectModel",id:kt("ConditionBranchStep",this.idCounter),name:"Else",description:null,stepLabels:Ga(),conditionExpression:void 0,steps:{list:t.map(r=>this.serializeBranchItem(r))}}}serializeBranchItem(t){return t.kind==="condition"?this.serializeConditionNode(t):this.serializeAction(t)}deserialize(t){let r=t,n=null,i;if(t.wfomJson)try{let a=JSON.parse(t.wfomJson);i={id:a.id==="WorkflowStep0"||!a.id?t.workflowid??dt():a.id,name:a.name,description:a.description,nextStepIndex:a.nextStepIndex,category:a.category==="0"||a.category===0?"2":a.category,businessProcessType:a.businessProcessType,mode:a.mode,title:a.title||t.name||"",primaryEntityName:a.primaryEntityName==="1"||!a.primaryEntityName?t.primaryentity??"":a.primaryEntityName,workflowEntityId:a.workflowEntityId==="00000000-0000-0000-0000-000000000000"||!a.workflowEntityId?t.workflowid??"":a.workflowEntityId,formId:a.formId,variables:a.variables,inputs:a.inputs};let s=(a.steps?.list??[]).find(l=>l.__class==="ConditionStep:#Microsoft.Crm.Workflow.ObjectModel");s&&(n=this.deserializeConditionStep(s))}catch{}return{ruleId:t.workflowid??null,name:t.name??"",description:t.description??"",entityLogicalName:t.primaryentity??"",scope:aO(r,i?.formId),status:iO(t.statecode),rootCondition:n,wfomRoot:i}}deserializeConditionStep(t){let r=(t.steps?.list??[]).filter(rO);return this.buildConditionNodeFromBranches(r,t,!0)}buildConditionNodeFromBranches(t,r,n){let[i,...a]=t,{clauses:o,logic:s}=I0(i?.conditionExpression),l=this.deserializeBranch(i?.steps?.list??[]),u=this.deserializeElseChain(a,r),c=i?.description||i?.name||r.description||r.name||this.label("condition");return{kind:"condition",id:(n?r.id:i?.id)??dt(),displayName:c,clauses:o,logic:s,trueBranch:l,falseBranch:u,isCollapsed:!1,stepName:n?r.name:void 0,branchId:n?i?.id:void 0,branchName:n?i?.name:void 0}}deserializeElseChain(t,r){if(t.length===0)return[];let[n]=t,{clauses:i}=I0(n.conditionExpression);return i.length===0?this.deserializeBranch(n.steps?.list??[]):[this.buildConditionNodeFromBranches(t,r,!1)]}deserializeBranch(t){return t.map(r=>r.__class==="ConditionStep:#Microsoft.Crm.Workflow.ObjectModel"?this.deserializeConditionStep(r):this.deserializeAction(r)).filter(r=>r!==null)}parseRecommendationApplyActions(t){let n=(t?.list??[])[0];if(!n)return{applyActions:[]};let i={id:n.id,name:n.name,description:n.description??void 0,stepLabels:n.stepLabels,processId:n.processId,uniqueName:n.uniqueName,actionType:n.actionType},a=n.stepLabels?.list,o=a&&a.length>0?a[0].description??"":"";return{applyActions:(n.steps?.list??[]).filter(l=>l.__class==="SetAttributeValueStep:#Microsoft.Crm.Workflow.ObjectModel").map(l=>{let u=l.specification;return{id:l.id||dt(),field:u?.propertyName??"",stepName:l.name??void 0,displayName:l.description??void 0,...Ds(u?.propertyValueExpr)}}),meta:i,acceptanceText:o}}deserializeAction(t){switch(t.__class){case"SetAttributeValueStep:#Microsoft.Crm.Workflow.ObjectModel":{let r=Ds(t.specification.propertyValueExpr);return{kind:"action",id:t.id,type:"SetFieldValue",displayName:t.description||t.name||this.label("setFieldValue"),stepName:t.name,stepLabels:t.stepLabels,field:t.specification.propertyName,...r}}case"SetDefaultValueStep:#Microsoft.Crm.Workflow.ObjectModel":{let r=Ds(t.specification.propertyValueExpr);return{kind:"action",id:t.id,type:"SetDefaultValue",displayName:t.description||t.name||this.label("setDefaultValue"),stepName:t.name,stepLabels:t.stepLabels,field:t.specification.propertyName,...r}}case"SetDisplayModeStep:#Microsoft.Crm.Workflow.ObjectModel":return{kind:"action",id:t.id,type:"LockUnlock",displayName:t.description||t.name||this.label("lockUnlock"),stepName:t.name,stepLabels:t.stepLabels,field:t.controlId,lock:t.isReadOnly};case"SetFieldRequiredLevelStep:#Microsoft.Crm.Workflow.ObjectModel":return{kind:"action",id:t.id,type:"SetBusinessRequired",displayName:t.description||t.name||this.label("setBusinessRequired"),stepName:t.name,stepLabels:t.stepLabels,field:t.controlId,required:t.requiredLevel!==G.FieldRequiredLevelTypes.None};case"SetVisibilityStep:#Microsoft.Crm.Workflow.ObjectModel":return{kind:"action",id:t.id,type:"SetVisibility",displayName:t.description||t.name||this.label("setVisibility"),stepName:t.name,stepLabels:t.stepLabels,field:t.controlId,visible:t.isVisible};case"SetMessageStep:#Microsoft.Crm.Workflow.ObjectModel":{let r=t.stepLabels?.list,n=r&&r.length>0?r[0].description??"":"";if((t.level??"").toUpperCase()==="RECOMMENDATION"){let{applyActions:i,meta:a,acceptanceText:o}=this.parseRecommendationApplyActions(t.actionSteps);return{kind:"action",id:t.id,type:"Recommendation",displayName:t.description||this.label("recommendation"),stepName:t.name,stepLabels:t.stepLabels,field:t.controlId,recommendationTitle:t.description||"",messageText:n,acceptanceText:o,applyActions:i,recommendationActionStepMeta:a}}return{kind:"action",id:t.id,type:"ShowErrorMessage",displayName:t.description||this.label("showErrorMessage"),stepName:t.name,stepLabels:t.stepLabels,field:t.controlId,errorMessage:n||t.name||"",messageLevel:t.level??void 0,messageActionSteps:t.actionSteps}}case"ActionStep:#Microsoft.Crm.Workflow.ObjectModel":{let{applyActions:r,meta:n,acceptanceText:i}=this.parseRecommendationApplyActions({list:[t]});return{kind:"action",id:t.id,type:"Recommendation",displayName:t.name||this.label("recommendation"),stepName:t.name,stepLabels:t.stepLabels,field:t.actionControl?.controlId??"",recommendationTitle:t.name||"",messageText:t.description||"",acceptanceText:i,applyActions:r,recommendationActionStepMeta:n}}default:return null}}}});function on(e){return!oO.has(e)}function U0(e){return fO.has(e)}function _s(e){return k0.has(e)?sO:dO.has(e)?lO:M0.has(e)?uO:cO}function B0(e){return _s(e)[0]}function $0(e,t){return _s(t).includes(e)}function L0(e){return k0.has(e)?"string":e==="Money"?"money":e==="Integer"||e==="BigInt"?"integer":e==="Decimal"||e==="Double"?"decimal":M0.has(e)?"date":pO.has(e)?"boolean":"other"}function Ps(e,t){let r=L0(e),n=L0(t);return r==="other"||n==="other"?e===t:r===n}var oO,sO,lO,uO,cO,k0,dO,M0,pO,fO,cd=I(()=>{"use strict";oO=new Set(["ContainsData","DoesNotContainData"]);sO=["Equals","DoesNotEqual","Contains","DoesNotContain","BeginsWith","DoesNotBeginWith","EndsWith","DoesNotEndWith","ContainsData","DoesNotContainData"],lO=["Equals","DoesNotEqual","IsGreaterThan","IsGreaterThanEqualTo","IsLessThan","IsLessThanEqualTo","ContainsData","DoesNotContainData"],uO=["On","NotOn","IsGreaterThan","IsGreaterThanEqualTo","IsLessThan","IsLessThanEqualTo","ContainsData","DoesNotContainData"],cO=["Equals","DoesNotEqual","ContainsData","DoesNotContainData"],k0=new Set(["String","Memo","EntityName"]),dO=new Set(["Integer","BigInt","Money","Decimal","Double"]),M0=new Set(["DateTime"]),pO=new Set(["Boolean"]),fO=new Set(["Equals","DoesNotEqual"])});function pd(e){return mO.has(e.type)}function dd(e,t,r,n,i,a,o){let s=i.get(r);!s||!hO.has(s.attributeType)||n!=="Value"||o?.operator&&!U0(o.operator)||a.push({nodeId:e,kind:"INVALID_VALUE_TYPE_FOR_FIELD",message:`${t}: please select a record for this lookup field; a typed text value cannot be saved.`,target:o?.target,itemId:o?.itemId,messageKey:"Validation.InvalidValueTypeForField",messageParams:{label:t}})}function q0(e,t,r,n,i,a,o,s){if(i!=="Clear")return;let l=a.get(n);As(r,l)||o.push({nodeId:e,kind:"INVALID_CLEAR_FOR_FIELD",message:`${t}: Clear is only supported for optional fields with a legacy-compatible type.`,target:s?.target,itemId:s?.itemId,messageKey:"Validation.InvalidClearForField",messageParams:{label:t}})}function Os(e){if(!e)return!1;for(let t of[...e.trueBranch,...e.falseBranch])if(t.kind==="action"){if(pd(t))return!0}else if(Os(t))return!0;return!1}function fd(e,t){if(e.id===t)return e;for(let r of[...e.trueBranch,...e.falseBranch]){if(r.id===t)return r;if(r.kind==="condition"){let n=fd(r,t);if(n)return n}}return null}function yi(e,t){for(let r=0;r<e.trueBranch.length;r++){let n=e.trueBranch[r];if(n.id===t)return{node:e,branch:"true",index:r};if(n.kind==="condition"){let i=yi(n,t);if(i)return i}}for(let r=0;r<e.falseBranch.length;r++){let n=e.falseBranch[r];if(n.id===t)return{node:e,branch:"false",index:r};if(n.kind==="condition"){let i=yi(n,t);if(i)return i}}return null}function md(e,t){return{...e,trueBranch:V0(e.trueBranch,t),falseBranch:V0(e.falseBranch,t)}}function V0(e,t){return e.filter(r=>r.id!==t).map(r=>r.kind==="condition"?md(r,t):r)}function sn(e,t,r){return e.id===t?r(e):{...e,trueBranch:e.trueBranch.map(n=>n.kind==="condition"?sn(n,t,r):n),falseBranch:e.falseBranch.map(n=>n.kind==="condition"?sn(n,t,r):n)}}function Ts(e,t,r){return{...e,trueBranch:e.trueBranch.map(n=>n.kind==="action"&&n.id===t?r(n):n.kind==="condition"?Ts(n,t,r):n),falseBranch:e.falseBranch.map(n=>n.kind==="action"&&n.id===t?r(n):n.kind==="condition"?Ts(n,t,r):n)}}function G0(e,t,r,n){return sn(e,t,i=>({...i,trueBranch:r==="true"?[...i.trueBranch,n]:i.trueBranch,falseBranch:r==="false"?[...i.falseBranch,n]:i.falseBranch}))}function gO(e){return e.length===1&&e[0].kind==="condition"}function z0(e,t,r){return sn(e,t,n=>W0(n,r))}function W0(e,t){if(gO(e.falseBranch))return{...e,falseBranch:[W0(e.falseBranch[0],t)]};let r=hd(t);return r.falseBranch=e.falseBranch,{...e,falseBranch:[r]}}function j0(e,t){let r=yi(e,t);if(!r||r.branch!=="false")return e;let n=r.node.falseBranch[r.index];if(!n||n.kind!=="condition")return e;let i=n.falseBranch;return sn(e,r.node.id,a=>({...a,falseBranch:i}))}function H0(e,t,r){let n=yi(e,t);if(!n)return e;let i=a=>{let o=[...a],s=o[n.index+r];return s?(o[n.index+r]=o[n.index],o[n.index]=s,o):a};return sn(e,n.node.id,a=>({...a,trueBranch:n.branch==="true"?i(a.trueBranch):a.trueBranch,falseBranch:n.branch==="false"?i(a.falseBranch):a.falseBranch}))}function hd(e){return{kind:"condition",id:dt(),displayName:e??"New Condition",clauses:[],logic:"AND",trueBranch:[],falseBranch:[],isCollapsed:!1}}function Q0(e,t){let r={kind:"action",id:dt(),type:e,displayName:t??`New ${e}`};switch(e){case"Recommendation":return{...r,type:"Recommendation",field:"",recommendationTitle:"",messageText:"",applyActions:[{id:dt(),field:"",valueType:"Value",value:""}]};case"LockUnlock":return{...r,type:"LockUnlock",field:"",lock:!0};case"ShowErrorMessage":return{...r,type:"ShowErrorMessage",field:"",errorMessage:""};case"SetFieldValue":return{...r,type:"SetFieldValue",field:"",valueType:"Value",value:""};case"SetDefaultValue":return{...r,type:"SetDefaultValue",field:"",valueType:"Value",value:""};case"SetBusinessRequired":return{...r,type:"SetBusinessRequired",field:"",required:!0};case"SetVisibility":return{...r,type:"SetVisibility",field:"",visible:!0};default:return{...r,type:"SetFieldValue",field:"",valueType:"Value",value:""}}}function J0(e){if(!e)return[];let t=[];return X0(e,t),[...new Set(t)]}function X0(e,t){e.clauses.forEach(r=>{r.field&&t.push(r.field)}),[...e.trueBranch,...e.falseBranch].forEach(r=>{r.kind==="condition"?X0(r,t):"field"in r&&r.field&&t.push(r.field)})}function K0(e,t=[]){if(!e)return[{nodeId:"root",kind:"NO_CONDITION",message:"A business rule must include at least one condition.",target:"node"}];let r=[],n=new Map(t.map(i=>[i.logicalName,i]));return Y0(e,r,n),Os(e)||r.push({nodeId:"root",kind:"NO_ACTION",message:"A business rule must include at least one action step.",target:"node"}),r}function Y0(e,t,r){e.clauses.length===0&&t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_FIELD",message:"Add at least one clause to this condition.",target:"node",messageKey:"Validation.AddClause"}),e.clauses.forEach(n=>{if(!n.field)t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_FIELD",message:"Please select a field for this clause.",target:"clauseField",itemId:n.id});else if(on(n.operator)&&n.valueType==="Value"&&!n.value)t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_VALUE",message:"Please enter a value for this clause.",target:"clauseValue",itemId:n.id});else if(on(n.operator)&&n.valueType==="Value"&&n.value){let i=r.get(n.field);i?.maxLength&&n.value.length>i.maxLength&&t.push({nodeId:e.id,kind:"CLAUSE_VALUE_TOO_LONG",message:`Value exceeds the field's maximum length of ${i.maxLength} characters.`,target:"clauseValue",itemId:n.id,messageParams:{maxLength:i.maxLength}})}else on(n.operator)&&n.valueType==="Expression"&&!n.rawExpression&&!hi(n.expression)&&t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_VALUE",message:"Please complete the formula for this clause.",target:"clauseValue",itemId:n.id,messageKey:"Validation.CompleteClauseFormula"});on(n.operator)&&n.valueType==="Lookup"&&(!n.lookupValue?.entityType||!n.lookupValue.id||!n.lookupValue.label)&&t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_VALUE",message:"Please select a lookup record for this clause.",target:"clauseValue",itemId:n.id,messageKey:"Validation.EmptyClauseLookupValue"}),on(n.operator)&&dd(e.id,"Condition",n.field,n.valueType,r,t,{operator:n.operator,target:"clauseValue",itemId:n.id})}),[...e.trueBranch,...e.falseBranch].forEach(n=>{if(n.kind==="condition")Y0(n,t,r);else{if(!("field"in n)||!n.field)t.push({nodeId:n.id,kind:"EMPTY_ACTION_FIELD",message:`${n.type}: a target field is required.`,target:"actionField",messageParams:{actionType:n.type}});else if((n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&(n.valueType??"Value")==="Value"&&!n.value?.trim())t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:`${n.type}: please provide a value.`,target:"actionValue",messageParams:{actionType:n.type}});else if((n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&n.valueType==="Value"&&n.value){let i=r.get(n.field);i?.maxLength&&n.value.length>i.maxLength&&t.push({nodeId:n.id,kind:"ACTION_VALUE_TOO_LONG",message:`${n.type}: value exceeds the field's maximum length of ${i.maxLength} characters.`,target:"actionValue",messageParams:{actionType:n.type,maxLength:i.maxLength}})}else if((n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&n.valueType==="Field"){if(!n.valueField)t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:`${n.type}: please select a field to copy from.`,target:"actionValue",messageKey:"Validation.SelectActionSourceField",messageParams:{actionType:n.type}});else if(r.size>0){let i=r.get(n.field),a=r.get(n.valueField);i&&a&&!Ps(i.attributeType,a.attributeType)&&t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:`${n.type}: the source field's type is not compatible with the target field.`,target:"actionValue",messageKey:"Validation.IncompatibleActionSourceField",messageParams:{actionType:n.type}})}}else(n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&n.valueType==="Expression"?!n.rawExpression&&!hi(n.expression)&&t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:`${n.type}: please complete the formula.`,target:"actionValue",messageKey:"Validation.CompleteActionFormula",messageParams:{actionType:n.type}}):(n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&n.valueType==="Lookup"&&(!n.lookupValue?.entityType||!n.lookupValue.id||!n.lookupValue.label)&&t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:`${n.type}: please complete the lookup record.`,target:"actionValue",messageKey:"Validation.EmptyActionLookupValue",messageParams:{actionType:n.type}});if((n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&n.field&&(dd(n.id,n.type,n.field,n.valueType,r,t,{target:"actionValue"}),q0(n.id,n.type,n.type,n.field,n.valueType,r,t,{target:"actionValue"})),n.type==="ShowErrorMessage"&&!n.errorMessage?.trim()&&t.push({nodeId:n.id,kind:"EMPTY_ACTION_MESSAGE",message:"Show error message: please enter an error message.",target:"actionMessage"}),n.type==="Recommendation"){let i=n.applyActions??[];n.recommendationTitle?.trim()||t.push({nodeId:n.id,kind:"EMPTY_RECOMMENDATION_TITLE",message:"Recommendation: please enter a recommendation title.",target:"recommendationTitle"}),n.messageText?.trim()||t.push({nodeId:n.id,kind:"EMPTY_RECOMMENDATION_MESSAGE",message:"Recommendation: please enter a recommendation message.",target:"recommendationMessage"}),i.length===0&&t.push({nodeId:n.id,kind:"RECOMMENDATION_NO_APPLY_ACTION",message:"Recommendation: add at least one action to apply.",target:"node"}),i.forEach(a=>{a.field?a.valueType==="Field"?a.valueField||t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:"Recommendation: please select a field to copy from.",target:"applyActionValue",itemId:a.id,messageKey:"Validation.RecommendationApplySourceField"}):a.valueType==="Expression"?!a.rawExpression&&!hi(a.expression)&&t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:"Recommendation: please complete the formula.",target:"applyActionValue",itemId:a.id,messageKey:"Validation.RecommendationApplyFormula"}):a.valueType==="Lookup"?(!a.lookupValue?.entityType||!a.lookupValue.id||!a.lookupValue.label)&&t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:"Recommendation: please complete the lookup record.",target:"applyActionValue",itemId:a.id,messageKey:"Validation.RecommendationApplyLookupValue"}):a.valueType==="Clear"||a.value?.trim()||t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:"Recommendation: please enter a value for each action to apply.",target:"applyActionValue",itemId:a.id,messageKey:"Validation.RecommendationApplyValue"}):t.push({nodeId:n.id,kind:"EMPTY_ACTION_FIELD",message:"Recommendation: a target field is required for each action to apply.",target:"applyActionField",itemId:a.id,messageKey:"Validation.RecommendationApplyField"}),a.field&&(dd(n.id,"Recommendation",a.field,a.valueType,r,t,{target:"applyActionValue",itemId:a.id}),q0(n.id,"Recommendation","SetFieldValue",a.field,a.valueType,r,t,{target:"applyActionValue",itemId:a.id}))})}}})}var mO,hO,gd=I(()=>{"use strict";Zc();Qc();cd();Ns();mO=new Set(["LockUnlock","ShowErrorMessage","SetFieldValue","SetDefaultValue","SetBusinessRequired","SetVisibility"]);hO=new Set(["Lookup","Customer","Owner"])});var Z0={};Rr(Z0,{DEFAULT_DESERIALIZE_LABELS:()=>ld,WorkflowJsonMapper:()=>vi,addElseIfInTree:()=>z0,appendToBranch:()=>G0,areFieldKindsCompatible:()=>Ps,attributeTypeToWorkflowType:()=>f0,buildWorkflowEntity:()=>e0,collectUsedFields:()=>J0,createEmptyAction:()=>Q0,createEmptyCondition:()=>hd,deserializeWorkflowJson:()=>x0,findNode:()=>fd,findParent:()=>yi,getDefaultOperatorForFieldType:()=>B0,getOperatorsForFieldType:()=>_s,hasAnyTriggerGeneratingAction:()=>Os,isExpressionModelComplete:()=>hi,isOperatorCompatible:()=>$0,isTriggerGeneratingAction:()=>pd,moveBranchItemInTree:()=>H0,operatorNeedsValue:()=>on,processTriggerFormIdFromScope:()=>Xc,processTriggerScopeFromScope:()=>Jc,removeElseIfInTree:()=>j0,removeNodeFromTree:()=>md,serializeToWorkflowJson:()=>F0,supportsClearForActionType:()=>As,updateActionInTree:()=>Ts,updateConditionInTree:()=>sn,validateBusinessRule:()=>K0});var ev=I(()=>{"use strict";Qc();t0();ud();ud();gd();gd();cd();Ns();});var Yt=g(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.publishBoundEntity=ze.boundEntityPublishScope=ze.publishGenPageById=ze.publishDashboardById=ze.publishWebResourceById=ze.publishEntity=ze.publishAppModule=ze.publishXml=void 0;var vO=be(),Wa=ee(),tv="/PublishXml";async function bi(e,t){(0,vO.ensureSuccess)(await e.post(tv,{ParameterXml:t}),e.apiUrl(tv))}ze.publishXml=bi;function yO(e,t){return bi(e,`<importexportxml><appmodules><appmodule>${(0,Wa.xmlText)(t)}</appmodule></appmodules></importexportxml>`)}ze.publishAppModule=yO;function rv(e,t){return bi(e,`<importexportxml><entities><entity>${(0,Wa.xmlText)(t)}</entity></entities></importexportxml>`)}ze.publishEntity=rv;function bO(e,t){return bi(e,`<importexportxml><webresources><webresource>${(0,Wa.xmlText)(t)}</webresource></webresources></importexportxml>`)}ze.publishWebResourceById=bO;function wO(e,t){return bi(e,`<importexportxml><dashboards><dashboard>${(0,Wa.xmlText)(t)}</dashboard></dashboards></importexportxml>`)}ze.publishDashboardById=wO;function AO(e,t){return bi(e,`<importexportxml><uxagentprojects><uxagentproject>${(0,Wa.xmlText)(t)}</uxagentproject></uxagentprojects></importexportxml>`)}ze.publishGenPageById=AO;function CO(e){let t=e?.entityLogicalName;return t?{envelope:"entity",entityLogicalName:t,blastRadiusWarning:"ENTITY_ENVELOPE_ALSO_SHIPS_UNRELATED_UNPUBLISHED_CHANGES"}:{envelope:"entity"}}ze.boundEntityPublishScope=CO;function SO(e,t){let r=t?.entityLogicalName;return r?rv(e,r):Promise.resolve()}ze.publishBoundEntity=SO});var vd=g(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});Rs.cloneJson=void 0;function EO(e){return JSON.parse(JSON.stringify(e))}Rs.cloneJson=EO});var cr=g(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.childObjects=yt.optionalGuidId=yt.optionalEnum=yt.eachObject=yt.issue=yt.isJsonObject=void 0;function nv(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}yt.isJsonObject=nv;function ja(e,t,r,n){return n?{pointer:e,rule:t,message:r,fatal:n}:{pointer:e,rule:t,message:r}}yt.issue=ja;function iv(e,t,r,n){if(!Array.isArray(e))return[];let i=[];return e.forEach((a,o)=>{nv(a)?i.push({node:a,index:o}):n.push(ja(`${t}/${o}`,`${r}-must-be-object`,`a ${r} must be a JSON object, got ${a===null?"null":typeof a}`))}),i}yt.eachObject=iv;function NO(e,t,r,n,i,a){let o=e[t];o!==void 0&&(typeof o!="string"||!r.includes(o))&&a.push(ja(`${n}/${t}`,i,`${t} must be one of ${r.map(s=>`'${s}'`).join(", ")}, got ${JSON.stringify(o)}`))}yt.optionalEnum=NO;var DO=/^(?:\{[0-9a-fA-F]{8}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{12}\}|[0-9a-fA-F]{8}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{12})$/;function IO(e,t,r,n,i){let a=e[t];typeof a=="string"&&a!==""&&!DO.test(a)&&i.push(ja(`${r}/${t}`,n,`${t} must be a GUID or empty, got '${a}'`))}yt.optionalGuidId=IO;function _O(e,t,r,n,i){let a=e[t],o=`${r}/${t}`;return a===void 0?[]:Array.isArray(a)?iv(a,o,n,i):(i.push(ja(o,`${n}-list-must-be-array`,`${t} must be an array when present, got ${typeof a}`)),[])}yt.childObjects=_O});var bt=g(wi=>{"use strict";Object.defineProperty(wi,"__esModule",{value:!0});wi.assignMissingIds=wi.newId=void 0;var PO=ws();function av(){return(0,PO.v4)()}wi.newId=av;function TO(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var OO=new Set(["parameters","bag","expression","rawExpression","lookupValue","stepLabels"]);function RO(e){return yd(e),e}wi.assignMissingIds=RO;function yd(e){if(Array.isArray(e)){e.forEach(t=>yd(t));return}if(TO(e)){(typeof e.id!="string"||e.id.length===0)&&(e.id=av());for(let t of Object.keys(e))t==="id"||OO.has(t)||yd(e[t])}}});var wd=g(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.BUSINESS_RULE_NULL_GUID=ln.businessRuleRegistration=ln.BusinessRuleAdapter=void 0;var ov=ws(),Ha=(ev(),Fr(Z0)),sv=Yt(),lv=ie(),FO=vd(),dr=cr(),xO=Dc(),LO=bt();function kO(e){return pv((0,FO.cloneJson)(e))}function pv(e){var t,r;let n=i=>(i??[]).map(a=>MO(a)?pv(a):a);return{...e,logic:(t=e.logic)!==null&&t!==void 0?t:"AND",clauses:(r=e.clauses)!==null&&r!==void 0?r:[],trueBranch:n(e.trueBranch),falseBranch:n(e.falseBranch)}}function MO(e){return Object.prototype.hasOwnProperty.call(e,"type")?!1:Object.prototype.hasOwnProperty.call(e,"clauses")||Object.prototype.hasOwnProperty.call(e,"trueBranch")||Object.prototype.hasOwnProperty.call(e,"falseBranch")||Object.prototype.hasOwnProperty.call(e,"logic")}function UO(e){var t;if(e===null||typeof e!="object"||Array.isArray(e))throw new lv.ValidationError("businessRule","(new)","/rootCondition",`rootCondition must be a condition object or null, got ${Array.isArray(e)?"array":typeof e}`);if(Object.prototype.hasOwnProperty.call(e,"type"))throw new lv.ValidationError("businessRule",(t=e.id)!==null&&t!==void 0?t:"(new)","/rootCondition","rootCondition looks like an ACTION (it carries 'type'), but it must be a condition. Wrap the action in a condition's trueBranch instead \u2014 a bare action would compile to an empty rule that saves successfully and does nothing.");return e}var BO="00000000-0000-0000-0000-000000000000";ln.BUSINESS_RULE_NULL_GUID=BO;var $O=new Set(["Recommendation","LockUnlock","ShowErrorMessage","SetFieldValue","SetDefaultValue","SetBusinessRequired","SetVisibility"]),qO=["ruleId","name","description","entityLogicalName","scope","status","rootCondition"],VO=["kind","id","displayName","logic","clauses","trueBranch","falseBranch"],GO=["id","field","fieldDisplayName","operator","valueType","value","valueField","lookupValue","expression","rawExpression","valueWorkflowType"];function Zt(e,t){return e===void 0?t:{...e,...t}}var $n=["kind","id","type","displayName","field","stepName","stepLabels"],uv=["valueType","valueWorkflowType","value","valueField","lookupValue","expression","rawExpression"],zO={Recommendation:[...$n,"recommendationTitle","messageText","acceptanceText","applyActions","recommendationActionStepMeta"],LockUnlock:[...$n,"lock"],ShowErrorMessage:[...$n,"errorMessage","messageLevel","messageActionSteps"],SetFieldValue:[...$n,...uv],SetDefaultValue:[...$n,...uv],SetBusinessRequired:[...$n,"required"],SetVisibility:[...$n,"visible"]};function W(e,t){return t===void 0?{}:{[e]:t}}function fv(e){var t;return e===void 0?void 0:{...e,label:(t=e.label)!==null&&t!==void 0?t:""}}function bd(e){return{valueType:e.valueType,...W("valueWorkflowType",e.valueWorkflowType),...W("value",e.value),...W("valueField",e.valueField),...W("lookupValue",fv(e.lookupValue)),...W("expression",e.expression),...W("rawExpression",e.rawExpression)}}function mv(e,t){let r=new Set(t),n={};for(let[i,a]of Object.entries(e))r.has(i)||a!==void 0&&(n[i]=a);return Object.keys(n).length>0?n:void 0}var WO=["id","field","valueType","valueWorkflowType","value","valueField","lookupValue","expression","rawExpression","stepName","displayName"];function jO(e){return Zt(e.bag,{id:e.id,field:e.field,...bd(e),...W("stepName",e.stepName),...W("displayName",e.displayName)})}function HO(e){let t=mv(e,WO);return{id:e.id,field:e.field,valueType:e.valueType,...W("valueWorkflowType",e.valueWorkflowType),...W("value",e.value),...W("valueField",e.valueField),...W("lookupValue",e.lookupValue),...W("expression",e.expression),...W("rawExpression",e.rawExpression),...W("stepName",e.stepName),...W("displayName",e.displayName),...W("bag",t)}}function cv(e){return{valueType:e.valueType,...W("valueWorkflowType",e.valueWorkflowType),...W("value",e.value),...W("valueField",e.valueField),...W("lookupValue",e.lookupValue),...W("expression",e.expression),...W("rawExpression",e.rawExpression)}}function dv(e){throw new Error(`Unsupported business-rule action type: ${e.type}`)}var QO=new Set(["INVALID_CLEAR_FOR_FIELD","INVALID_VALUE_TYPE_FOR_FIELD","CLAUSE_VALUE_TOO_LONG","ACTION_VALUE_TOO_LONG"]),JO=new Set;function XO(e){let t=n=>{var i;return(0,dr.isJsonObject)(n)&&(n.label===""||n.label===void 0)?{...n,label:String((i=n.id)!==null&&i!==void 0?i:"")}:n},r=n=>{if(!(0,dr.isJsonObject)(n))return n;let i={...n};"lookupValue"in i&&(i.lookupValue=t(i.lookupValue)),Array.isArray(i.applyActions)&&(i.applyActions=i.applyActions.map(r));for(let a of["clauses","trueBranch","falseBranch"])Array.isArray(i[a])&&(i[a]=i[a].map(r));return i};return r(e)}var Fs=class{toArtifact(t){let r=this.residualBag(t,qO),n={id:t.ruleId,name:t.name,description:t.description,entityLogicalName:t.entityLogicalName,scope:t.scope,status:t.status,rootCondition:t.rootCondition?this.conditionToJson(t.rootCondition):null};return r&&(n.bag=r),n}fromArtifact(t){let r=t.rootCondition?this.conditionFromJson(t.rootCondition):null;return Zt(t.bag,{ruleId:t.id,name:t.name,description:t.description,entityLogicalName:t.entityLogicalName,scope:t.scope,status:t.status,rootCondition:r})}fromApiResponse(t){var r;let n=t??{},i={...(r=n.Entity)!==null&&r!==void 0?r:{},wfomJson:n.WfomJson},a=(0,Ha.deserializeWorkflowJson)(i);return this.toArtifact(a)}toApiPayload(t){var r;let n=this.fromArtifact(t);n.wfomRoot&&(n.wfomRoot={...n.wfomRoot,name:t.name,title:t.name,primaryEntityName:t.entityLogicalName||n.wfomRoot.primaryEntityName});let i=(0,Ha.serializeToWorkflowJson)(n),a=(r=n.ruleId)!==null&&r!==void 0?r:(0,ov.v4)();return{Entity:this.buildWorkflowEntity(n,a),WfomJson:i,status:t.status}}createDefault(t){var r,n,i,a,o,s;let l={ruleId:(r=t.id)!==null&&r!==void 0?r:null,name:(n=t.name)!==null&&n!==void 0?n:"New business rule",description:(i=t.description)!==null&&i!==void 0?i:"",entityLogicalName:(a=t.entityLogicalName)!==null&&a!==void 0?a:"",scope:(o=t.scope)!==null&&o!==void 0?o:"Entity",status:(s=t.status)!==null&&s!==void 0?s:"Draft",rootCondition:t.rootCondition===void 0?(0,Ha.createEmptyCondition)():t.rootCondition===null?null:this.conditionFromJson(kO(UO(t.rootCondition)))},u=this.toArtifact(l);return u.id||(u.id=(0,ov.v4)()),u}assignMissingIds(t){return(0,LO.assignMissingIds)(t)}validate(t){let r=[],n=t.rootCondition;return n==null?r:(0,dr.isJsonObject)(n)?(hv(n,"/rootCondition",r),r):(r.push((0,dr.issue)("/rootCondition","condition-must-be-object",`rootCondition must be a JSON object or null, got ${typeof n}`)),r)}semanticIssues(t,r=[]){let n;try{n=this.fromArtifact(t)}catch(o){return[(0,dr.issue)("/rootCondition","rule-not-representable",o instanceof Error?o.message:String(o))]}let i=n.rootCondition===null?null:XO(n.rootCondition),a=r.length===0?QO:JO;return(0,Ha.validateBusinessRule)(i,r).filter(o=>!a.has(o.kind)).map(o=>(0,dr.issue)(`/rootCondition (${o.nodeId})`,`business-rule-${o.kind}`,o.message))}residualBag(t,r){return mv(t,r)}buildWorkflowEntity(t,r){return(0,Ha.buildWorkflowEntity)(t,r)}conditionToJson(t){let r=this.residualBag(t,VO),n={id:t.id,displayName:t.displayName,logic:t.logic,clauses:t.clauses.map(i=>this.clauseToJson(i)),trueBranch:t.trueBranch.map(i=>this.branchItemToJson(i)),falseBranch:t.falseBranch.map(i=>this.branchItemToJson(i))};return r&&(n.bag=r),n}clauseToJson(t){let r=this.residualBag(t,GO),n={id:t.id,field:t.field,fieldDisplayName:t.fieldDisplayName,operator:t.operator,valueType:t.valueType,...t.value!==void 0?{value:t.value}:{},...t.valueField!==void 0?{valueField:t.valueField}:{},...t.lookupValue!==void 0?{lookupValue:t.lookupValue}:{},...t.expression!==void 0?{expression:t.expression}:{},...t.rawExpression!==void 0?{rawExpression:t.rawExpression}:{},...t.valueWorkflowType!==void 0?{valueWorkflowType:t.valueWorkflowType}:{}};return r&&(n.bag=r),n}branchItemToJson(t){return t.kind==="condition"?this.conditionToJson(t):this.actionToJson(t)}actionToJson(t){let r=this.residualBag(t,zO[t.type]),n={kind:"action",id:t.id,displayName:t.displayName,field:t.field,...W("stepName",t.stepName),...W("stepLabels",t.stepLabels),...W("bag",r)};switch(t.type){case"Recommendation":return{...n,type:"Recommendation",recommendationTitle:t.recommendationTitle,messageText:t.messageText,...W("acceptanceText",t.acceptanceText),applyActions:t.applyActions.map(HO),...W("recommendationActionStepMeta",t.recommendationActionStepMeta)};case"LockUnlock":return{...n,type:"LockUnlock",lock:t.lock};case"ShowErrorMessage":return{...n,type:"ShowErrorMessage",errorMessage:t.errorMessage,...W("messageLevel",t.messageLevel),...W("messageActionSteps",t.messageActionSteps)};case"SetFieldValue":return{...n,type:"SetFieldValue",...cv(t)};case"SetDefaultValue":return{...n,type:"SetDefaultValue",...cv(t)};case"SetBusinessRequired":return{...n,type:"SetBusinessRequired",required:t.required};case"SetVisibility":return{...n,type:"SetVisibility",visible:t.visible};default:return dv(t)}}conditionFromJson(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:{};return Zt(n,{kind:"condition",isCollapsed:typeof n.isCollapsed=="boolean"?n.isCollapsed:!1,id:t.id,displayName:t.displayName,logic:t.logic,clauses:t.clauses.map(i=>this.clauseFromJson(i)),trueBranch:t.trueBranch.map(i=>this.branchItemFromJson(i)),falseBranch:t.falseBranch.map(i=>this.branchItemFromJson(i))})}clauseFromJson(t){var r;return Zt(t.bag,{id:t.id,field:t.field,fieldDisplayName:(r=t.fieldDisplayName)!==null&&r!==void 0?r:t.field,operator:t.operator,valueType:t.valueType,...W("value",t.value),...W("valueField",t.valueField),...W("lookupValue",fv(t.lookupValue)),...W("expression",t.expression),...W("rawExpression",t.rawExpression),...W("valueWorkflowType",t.valueWorkflowType)})}branchItemFromJson(t){return this.isConditionJson(t)?this.conditionFromJson(t):this.actionFromJson(t)}actionFromJson(t){if(!$O.has(t.type))throw new Error(`Unsupported business-rule action type: ${t.type}`);YO(t);let r={kind:"action",id:t.id,displayName:t.displayName,field:t.field,...W("stepName",t.stepName),...W("stepLabels",t.stepLabels)};switch(t.type){case"Recommendation":return Zt(t.bag,{...r,type:"Recommendation",recommendationTitle:t.recommendationTitle,messageText:t.messageText,...W("acceptanceText",t.acceptanceText),applyActions:t.applyActions.map(jO),...W("recommendationActionStepMeta",t.recommendationActionStepMeta)});case"LockUnlock":return Zt(t.bag,{...r,type:"LockUnlock",lock:t.lock});case"ShowErrorMessage":return Zt(t.bag,{...r,type:"ShowErrorMessage",errorMessage:t.errorMessage,...W("messageLevel",t.messageLevel),...W("messageActionSteps",t.messageActionSteps)});case"SetFieldValue":return Zt(t.bag,{...r,type:"SetFieldValue",...bd(t)});case"SetDefaultValue":return Zt(t.bag,{...r,type:"SetDefaultValue",...bd(t)});case"SetBusinessRequired":return Zt(t.bag,{...r,type:"SetBusinessRequired",required:t.required});case"SetVisibility":return Zt(t.bag,{...r,type:"SetVisibility",visible:t.visible});default:return dv(t)}}isConditionJson(t){return Object.prototype.hasOwnProperty.call(t,"clauses")&&Object.prototype.hasOwnProperty.call(t,"logic")&&!Object.prototype.hasOwnProperty.call(t,"type")}};ln.BusinessRuleAdapter=Fs;function hv(e,t,r){(0,dr.optionalEnum)(e,"logic",["AND","OR"],t,"condition-logic-invalid",r),(0,dr.childObjects)(e,"clauses",t,"clause",r);for(let n of["trueBranch","falseBranch"])(0,dr.childObjects)(e,n,t,"branchItem",r).forEach(({node:a,index:o})=>{"clauses"in a||"trueBranch"in a||"falseBranch"in a?hv(a,`${t}/${n}/${o}`,r):KO(a,`${t}/${n}/${o}`,r)})}function KO(e,t,r){e.type==="SetDefaultValue"&&e.valueType==="Clear"&&r.push((0,dr.issue)(`${t}/valueType`,"clear-only-set-field-value","Clear is only supported for SetFieldValue actions."))}function YO(e){if(e.type==="SetDefaultValue"&&e.valueType==="Clear")throw new Error("Clear is only supported for SetFieldValue actions.")}function ZO(){return{adapter:new Fs,api:xO.businessRuleApi,publish:(e,t,r)=>(0,sv.publishBoundEntity)(e,r),publishScope:(e,t)=>(0,sv.boundEntityPublishScope)(t)}}ln.businessRuleRegistration=ZO});var ks=g(Ls=>{"use strict";Object.defineProperty(Ls,"__esModule",{value:!0});Ls.JsonPointer=void 0;var Tt=ie(),xs=class e{static isReservedToken(t){return e.RESERVED_TOKENS.has(t)}static decodeToken(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}static encodeToken(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}static parse(t){if(t==="")return[];if(t[0]!=="/")throw new Tt.JsonPointerError(t,'non-empty pointers must start with "/"');return t.substring(1).split("/").map(r=>{if(/~(?![01])/.test(r))throw new Tt.JsonPointerError(t,`invalid '~' escape in token '${r}' (expected ~0 or ~1)`);return e.decodeToken(r)})}static compile(t){return t.length===0?"":"/"+t.map(r=>e.encodeToken(r)).join("/")}static resolve(t,r){let n=e.parse(r),i=t;for(let a of n)if(Array.isArray(i)){let o=e.toArrayIndex(a,i.length);if(o===void 0)return;i=i[o]}else if(i!==null&&typeof i=="object"){let o=i;if(e.isReservedToken(a)||!Object.prototype.hasOwnProperty.call(o,a))return;i=o[a]}else return;return i}static set(t,r,n){let i=e.parse(r);if(i.length===0)throw new Tt.JsonPointerError(r,"cannot set the document root");let{parent:a,lastToken:o}=e.resolveParent(t,i,r);if(Array.isArray(a)){let s=e.toArrayIndex(o,a.length);if(s===void 0)throw new Tt.JsonPointerError(r,`'${o}' is not a valid array index`);if(s>a.length)throw new Tt.JsonPointerError(r,`array index '${o}' is out of range`);a[s]=n}else{if(e.isReservedToken(o))throw new Tt.JsonPointerError(r,`refusing to write reserved property '${o}'`);a[o]=n}}static remove(t,r){let n=e.parse(r);if(n.length===0)throw new Tt.JsonPointerError(r,"cannot remove the document root");let{parent:i,lastToken:a}=e.resolveParent(t,n,r);if(Array.isArray(i)){let o=e.toArrayIndex(a,i.length);if(o===void 0||o>=i.length)throw new Tt.JsonPointerError(r,`array index '${a}' is out of range`);i.splice(o,1)}else{if(e.isReservedToken(a))throw new Tt.JsonPointerError(r,`refusing to remove reserved property '${a}'`);delete i[a]}}static add(t,r,n,i){let a=e.parse(r);if(a.length>0&&a[a.length-1]==="-"){let l=e.compile(a.slice(0,-1)),u=e.resolve(t,l);if(!Array.isArray(u))throw new Tt.JsonPointerError(r,"add target must be an array");u.push(n);return}let o=e.resolve(t,r);if(!Array.isArray(o))throw new Tt.JsonPointerError(r,"add target must be an array");let s=i===void 0?o.length:i;if(s<0||s>o.length)throw new Tt.JsonPointerError(r,`insert index ${s} is out of range`);o.splice(s,0,n)}static parent(t){let r=e.parse(t);return r.pop(),e.compile(r)}static lastToken(t){let r=e.parse(t);return r.length===0?"":r[r.length-1]}static append(t,r){return`${t}/${e.encodeToken(String(r))}`}static resolveParent(t,r,n){let i=r[r.length-1],a=e.compile(r.slice(0,-1)),o=e.resolve(t,a);if(o===null||typeof o!="object")throw new Tt.JsonPointerError(n,"parent path does not resolve to an object or array");return{parent:o,lastToken:i}}static toArrayIndex(t,r){if(t==="-")return r;if(/^(0|[1-9][0-9]*)$/.test(t))return Number(t)}};Ls.JsonPointer=xs;xs.RESERVED_TOKENS=new Set(["__proto__","prototype","constructor"])});var vv=g(Ms=>{"use strict";Object.defineProperty(Ms,"__esModule",{value:!0});Ms.findElements=void 0;var gv=ks();function eR(e,t){let r=[];return Ad(e,"",t,r),r}Ms.findElements=eR;function Ad(e,t,r,n){if(!(e===null||typeof e!="object"))if(r(e,t)&&n.push({pointer:t,value:e}),Array.isArray(e))e.forEach((i,a)=>{Ad(i,gv.JsonPointer.append(t,a),r,n)});else for(let i of Object.keys(e))Ad(e[i],gv.JsonPointer.append(t,i),r,n)}});var wv=g(Me=>{"use strict";var tR=Me&&Me.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),rR=Me&&Me.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),bv=Me&&Me.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&tR(t,e,r);return rR(t,e),t};Object.defineProperty(Me,"__esModule",{value:!0});Me.canonicalArtifactId=Me.retryTransientIo=Me.WorkspaceManager=Me.WORKSPACE_SCHEMA_VERSION=void 0;var Pe=bv(require("fs")),xe=bv(require("path")),Ai=ie();Me.WORKSPACE_SCHEMA_VERSION=1;var Us={form:"forms",view:"views",businessRule:"business-rules",app:"apps",command:"commands",chart:"charts",dashboard:"dashboards",genPage:"gen-pages",bpf:"business-process-flows"},nR="manifest.json",Bs=".metadata",yv="entities",Cd=class{constructor(t,r){this.workspacePath=t,this.instanceUrl=r}getRoot(){return this.workspacePath}getArtifactDir(t){return xe.join(this.workspacePath,Us[t])}getArtifactFilePath(t,r){return this.assertSafeId(r),this.assertWithinRoot(xe.join(this.getArtifactDir(t),`${Qa(r)}.json`))}getMetaFilePath(t,r){return this.assertSafeId(r),this.assertWithinRoot(xe.join(this.workspacePath,Bs,Us[t],`${Qa(r)}.meta.json`))}getEntityMetaFilePath(t){return this.assertSafeId(t),this.assertWithinRoot(xe.join(this.workspacePath,Bs,yv,`${t}.json`))}assertSafeId(t){if(typeof t!="string"||t.length===0||/[\u0000-\u001f]/.test(t)||t.includes("/")||t.includes("\\")||t.includes(":")||t==="."||t===".."||t.includes("..")||xe.basename(t)!==t)throw new Ai.PathTraversalError(String(t),this.workspacePath)}assertWithinRoot(t){let r=xe.resolve(this.workspacePath),n=xe.resolve(t);if(n!==r&&!n.startsWith(r+xe.sep))throw new Ai.PathTraversalError(t,this.workspacePath);let i=Pe.existsSync(r)?Pe.realpathSync(r):r,a=n,o=[];for(;!Pe.existsSync(a);){o.unshift(xe.basename(a));let l=xe.dirname(a);if(l===a)break;a=l}let s=xe.resolve(Pe.realpathSync(a),...o);if(s!==i&&!s.startsWith(i+xe.sep))throw new Ai.PathTraversalError(t,this.workspacePath);return n}get manifestPath(){return xe.join(this.workspacePath,nR)}init(){for(let t of Object.keys(Us))Pe.mkdirSync(this.getArtifactDir(t),{recursive:!0}),Pe.mkdirSync(xe.dirname(this.getMetaFilePath(t,"x")),{recursive:!0});if(Pe.mkdirSync(xe.join(this.workspacePath,Bs,yv),{recursive:!0}),!this.exists(this.manifestPath)){let t={instanceUrl:this.instanceUrl,createdAt:new Date().toISOString(),artifacts:[]};this.writeManifest(t)}}isInitialized(){return this.exists(this.manifestPath)}ensureInitialized(){if(!this.isInitialized())throw new Ai.WorkspaceNotInitializedError(this.workspacePath)}clean(){for(let r of Object.keys(Us))Ed(this.getArtifactDir(r));Ed(xe.join(this.workspacePath,Bs));let t=this.getManifest();t.artifacts=[],t.lastSyncAt=void 0,this.init(),this.writeManifest(t)}readArtifact(t,r){return this.ensureInitialized(),this.readJson(this.getArtifactFilePath(t,r))}writeArtifact(t,r,n){this.ensureInitialized(),this.writeJson(this.getArtifactFilePath(t,r),n),this.upsertManifestEntry(t,r,n)}deleteArtifact(t,r){this.ensureInitialized(),this.removeFile(this.getArtifactFilePath(t,r)),this.removeFile(this.getMetaFilePath(t,r));let n=Qa(r),i=this.getManifest();i.artifacts=i.artifacts.filter(a=>!(a.type===t&&a.id===n)),this.writeManifest(i)}listArtifacts(t,r){return this.ensureInitialized(),this.getManifest().artifacts.filter(n=>!(t&&n.type!==t||r?.entityLogicalName&&n.entityLogicalName!==r.entityLogicalName))}readEntityMetadata(t){this.ensureInitialized();let r=this.readJson(this.getEntityMetaFilePath(t));return!r||typeof r.schemaName!="string"||typeof r.primaryNameAttribute!="string"||typeof r.primaryIdAttribute!="string"||typeof r.isCustomEntity!="boolean"?null:r}writeEntityMetadata(t,r){this.ensureInitialized(),this.writeJson(this.getEntityMetaFilePath(t),r)}getManifest(){this.ensureInitialized();let t=this.readJson(this.manifestPath);if(!t)throw new Ai.WorkspaceNotInitializedError(this.workspacePath);if(t.schemaVersion!==void 0&&t.schemaVersion>Me.WORKSPACE_SCHEMA_VERSION)throw new Ai.IncompatibleWorkspaceError(t.schemaVersion,Me.WORKSPACE_SCHEMA_VERSION);return t}writeManifest(t){this.writeJson(this.manifestPath,{...t,schemaVersion:Me.WORKSPACE_SCHEMA_VERSION})}updateManifest(t){let r=this.getManifest();this.writeManifest({...r,...t})}upsertManifestEntry(t,r,n){let i=this.getManifest(),a=Qa(r),o=n,s=typeof o.name=="string"?o.name:`${t}:${a}`,l=typeof o.entityLogicalName=="string"?o.entityLogicalName:void 0,u=i.artifacts.find(c=>c.type===t&&c.id===a);u?(u.name=s,u.entityLogicalName=l):i.artifacts.push({type:t,id:a,name:s,entityLogicalName:l,isDirty:!1}),this.writeManifest(i)}readJson(t){if(!this.exists(t))return null;let r;try{r=Sd(()=>Pe.readFileSync(t,"utf8"))}catch(n){if(n.code==="ENOENT")return null;throw n}return JSON.parse(r)}writeJson(t,r){let n=xe.dirname(t);Pe.mkdirSync(n,{recursive:!0});let i=xe.join(n,`.${xe.basename(t)}.${Date.now()}.${Math.random().toString(36).slice(2)}.tmp`);try{Pe.writeFileSync(i,`${JSON.stringify(r,null,2)}
-`,"utf8"),Sd(()=>Pe.renameSync(i,t))}catch(a){try{Pe.existsSync(i)&&Pe.unlinkSync(i)}catch{}throw a}}removeFile(t){this.exists(t)&&Pe.unlinkSync(t)}exists(t){return Pe.existsSync(t)}};Me.WorkspaceManager=Cd;var iR=new Set(["EPERM","EACCES","EBUSY","UNKNOWN"]),aR=5,oR=10;function Sd(e){for(let t=1;;t+=1)try{return e()}catch(r){let n=r.code;if(t>=aR||!n||!iR.has(n))throw r;sR(oR*t)}}Me.retryTransientIo=Sd;function sR(e){try{Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)}catch{let t=Date.now()+e;for(;Date.now()<t;);}}function Qa(e){let r=/^\{?([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})\}?$/.exec(e);return r?r[1].toLowerCase():e.toLowerCase()}Me.canonicalArtifactId=Qa;function Ed(e){let t;try{t=Pe.lstatSync(e)}catch{return}if(t.isSymbolicLink()){try{Pe.unlinkSync(e)}catch{Pe.rmdirSync(e)}return}if(!t.isDirectory()){Pe.unlinkSync(e);return}for(let r of Pe.readdirSync(e))Ed(xe.join(e,r));Pe.rmdirSync(e)}});var Nd=g(Ci=>{"use strict";Object.defineProperty(Ci,"__esModule",{value:!0});Ci.deepEqual=Ci.deepDiff=void 0;var lR=ks();function uR(e,t){let r=[];return Cv(e,t,"",r,0),r}Ci.deepDiff=uR;var $s=Symbol("missing"),qs=512;function Cv(e,t,r,n,i){if(e===t)return;if(i>qs)throw new RangeError(`deepDiff exceeded the maximum supported depth of ${qs}`);let a=Vs(e),o=Vs(t);if(a&&o&&Array.isArray(e)===Array.isArray(t)){let s=cR(e,t);for(let l of s){let u=Av(e,l),c=Av(t,l),d=lR.JsonPointer.append(r,l);u===$s?n.push({pointer:d,type:"added",newValue:c}):c===$s?n.push({pointer:d,type:"removed",oldValue:u}):Cv(u,c,d,n,i+1)}return}Sv(e,t)||n.push({pointer:r,type:"modified",oldValue:e,newValue:t})}function Vs(e){return e!==null&&typeof e=="object"}function cR(e,t){if(Array.isArray(e)&&Array.isArray(t)){let n=Math.max(e.length,t.length),i=[];for(let a=0;a<n;a++)i.push(String(a));return i}let r=new Set([...Object.keys(e),...Object.keys(t)]);return Array.from(r)}function Av(e,t){if(Array.isArray(e)){let r=Number(t);return r<e.length?e[r]:$s}return t in e?e[t]:$s}function Sv(e,t){return Ev(e,t,0)}Ci.deepEqual=Sv;function Ev(e,t,r){if(e===t)return!0;if(r>qs)throw new RangeError(`deepEqual exceeded the maximum supported depth of ${qs}`);if(!Vs(e)||!Vs(t)||Array.isArray(e)!==Array.isArray(t))return!1;let n=Object.keys(e),i=Object.keys(t);return n.length!==i.length?!1:n.every(a=>a in t&&Ev(e[a],t[a],r+1))}});var Dv=g(Gs=>{"use strict";Object.defineProperty(Gs,"__esModule",{value:!0});Gs.VersionManager=void 0;var Nv=Nd(),Dd=class{constructor(t){this.workspace=t}storeMeta(t,r,n){this.workspace.writeJson(this.workspace.getMetaFilePath(t,r),n)}getMeta(t,r){return this.workspace.readJson(this.workspace.getMetaFilePath(t,r))}isDirty(t,r){let n=this.workspace.readArtifact(t,r);if(n===null)return!1;let i=this.getMeta(t,r);return i?!(0,Nv.deepEqual)(i.snapshot,n):!0}diff(t,r){let n=this.workspace.readArtifact(t,r),i=this.getMeta(t,r),a;return n===null?a=i?[{pointer:"",type:"removed",oldValue:i.snapshot}]:[]:i?a=(0,Nv.deepDiff)(i.snapshot,n):a=[{pointer:"",type:"added",newValue:n}],{artifactType:t,artifactId:r,changes:a}}checkConflict(t,r,n){let i=this.getMeta(t,r);return!i||i.etag===null?!1:i.etag!==n}};Gs.VersionManager=Dd});var _v=g((Id,Iv)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof Id=="object"?Iv.exports=t():e.compareVersions=t()})(Id,function(){var e=/^v?(?:\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+))?(?:-[\da-z\-]+(?:\.[\da-z\-]+)*)?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;function t(a,o){return a.indexOf(o)===-1?a.length:a.indexOf(o)}function r(a){var o=a.replace(/^v/,"").replace(/\+.*$/,""),s=t(o,"-"),l=o.substring(0,s).split(".");return l.push(o.substring(s+1)),l}function n(a){return isNaN(Number(a))?a:Number(a)}function i(a){if(typeof a!="string")throw new TypeError("Invalid argument expected string");if(!e.test(a))throw new Error("Invalid argument not valid semver ('"+a+"' received)")}return function(o,s){[o,s].forEach(i);for(var l=r(o),u=r(s),c=0;c<Math.max(l.length-1,u.length-1);c++){var d=parseInt(l[c]||0,10),p=parseInt(u[c]||0,10);if(d>p)return 1;if(p>d)return-1}var f=l[l.length-1],h=u[u.length-1];if(f&&h){var y=f.split(".").map(n),w=h.split(".").map(n);for(c=0;c<Math.max(y.length,w.length);c++){if(y[c]===void 0||typeof w[c]=="string"&&typeof y[c]=="number")return-1;if(w[c]===void 0||typeof y[c]=="string"&&typeof w[c]=="number"||y[c]>w[c])return 1;if(w[c]>y[c])return-1}}else if(f||h)return f?-1:1;return 0}})});var Fv=g(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.EnvironmentFlowHostingType=Ne.EnvironmentDisableReasonCode=Ne.EnvironmentMigrationConstants=Ne.EnvironmentProvisioningStates=Ne.EnvironmentLocations=Ne.EnvironmentCreationTypeConstants=Ne.EnvironmentType=Ne.EnvironmentSkuConstants=Ne.environmentPermissions=Ne.DatabaseType=void 0;var Pv;(function(e){e.CommonDataService="CommonDataService",e.None="None"})(Pv||(Ne.DatabaseType=Pv={}));Ne.environmentPermissions={CreatePowerApp:"CreatePowerApp",ReadEnvironment:"ReadEnvironment",GenerateResourceStorage:"GenerateResourceStorage",CreateGateway:"CreateGateway",CreateFlow:"CreateFlow",CreateCustomApi:"CreateCustomApi",AdminReadEnvironment:"AdminReadEnvironment",UpdateEnvironment:"UpdateEnvironment",DeleteEnvironment:"DeleteEnvironment",ExportEnvironmentPackage:"ExportEnvironmentPackage",SetDLPPolicy:"SetDLPPolicy",ListAnyPowerApp:"ListAnyPowerApp",ListAnyFlow:"ListAnyFlow",DeleteAnyPowerApp:"DeleteAnyPowerApp",DeleteAnyFlow:"DeleteAnyFlow",AddEnvironmentRoleAssignment:"AddEnvironmentRoleAssignment",ReadEnvironmentRoleInformation:"ReadEnvironmentRoleInformation",RemoveEnvironmentRoleAssignment:"RemoveEnvironmentRoleAssignment",ModifyDatabaseRoleAssignments:"ModifyDatabaseRoleAssignments",CreateDatabase:"CreateDatabase",ListDatabaseEntities:"ListDatabaseEntities",CreateDatabaseEntities:"CreateDatabaseEntities",UpdateDatabaseEntities:"UpdateDatabaseEntities",DeleteDatabaseEntities:"DeleteDatabaseEntities"};Ne.EnvironmentSkuConstants={NotSpecified:"NotSpecified",Standard:"Standard",Premium:"Premium",Developer:"Developer",Basic:"Basic",Production:"Production",Sandbox:"Sandbox",Trial:"Trial",Default:"Default",Teams:"Teams",Platform:"Platform"};var Tv;(function(e){e[e.CDS2=0]="CDS2",e[e.CDS1=1]="CDS1",e[e.Empty=2]="Empty"})(Tv||(Ne.EnvironmentType=Tv={}));Ne.EnvironmentCreationTypeConstants={NotSpecified:"NotSpecified",Legacy:"Legacy",DefaultTenant:"DefaultTenant",User:"User",CommonDataModelLegacy:"CommonDataModelLegacy"};Ne.EnvironmentLocations={global:"global",unitedStates:"unitedstates",southamerica:"southamerica",europe:"europe",canada:"canada",preview:"unitedstatesfirstrelease",asia:"asia",japan:"japan",australia:"australia",india:"india",unitedkingdom:"unitedkingdom",france:"france",germany:"germany",brazil:"brazil",usgov:"usgov",usgovhigh:"usgovhigh",uae:"unitedarabemirates",switzerland:"switzerland",mooncake:"china",korea:"korea",norway:"norway",southafrica:"southafrica",dod:"usdod",singapore:"singapore",sweden:"sweden",italy:"italy",poland:"poland"};Ne.EnvironmentProvisioningStates={NotSpecified:"NotSpecified",Succeeded:"Succeeded",Deleting:"Deleting",Deleted:"Deleted",FailedDeleting:"FailedDeleting",LinkedDatabaseProvisioning:"LinkedDatabaseProvisioning",LinkedDatabaseFailedProvisioning:"LinkedDatabaseFailedProvisioning",LinkedDatabaseFailedConfiguring:"LinkedDatabaseFailedConfiguring",LinkedDatabaseUnavailable:"LinkedDatabaseUnavailable",Creating:"Creating"};Ne.EnvironmentMigrationConstants={phases:{completed:"Completed"}};var Ov;(function(e){e.NotSpecified="NotSpecified",e.NoValidLicense="NoValidLicense",e.SuspendedLicense="SuspendedLicense",e.TrialExpiration="TrialExpiration",e.UserRequested="UserRequested",e.InstanceStateUpdate="InstanceStateUpdated",e.InactivityThreshold="InactivityThreshold",e.OperationsInitiated="OperationsInitiated",e.EnvironmentLifecycleOperation="EnvironmentLifecycleOperation",e.TenantPolicyEvaluation="TenantPolicyEvaluation"})(Ov||(Ne.EnvironmentDisableReasonCode=Ov={}));var Rv;(function(e){e.LogicApps="LogicApps",e.SelfHostSingleTenant="SelfHostSingleTenant",e.SelfHostMultiTenant="SelfHostMultiTenant"})(Rv||(Ne.EnvironmentFlowHostingType=Rv={}))});var qv=g(A=>{"use strict";var dR=A&&A.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(A,"__esModule",{value:!0});A.hasCommonDataServiceDatabase=A.getEnvironmentDiscoveryUrl=A.getEnvironmentWebApiUrl=A.getEnvironmentInstanceApiUrl=A.getEnvironmentLanguageCode=A.getEnvironmentUpdateCadence=A.checkVersions=A.isCds2EnvironmentVersionAtLeast=A.getSecurityOrConnectedGroupId=A.hasSecurityGroupId=A.doesCds2VersionSupportApiVersion9_1=A.doesCds2EnvironmentSupportApiVersion9_1=A.cdsVersionSupportingOSColorEdit=A.getEnvironmentDisplayName=A.getEnvironmentName=A.isEnvironmentInFirstReleaseCluster=A.isEnvironmentInPreprodCluster=A.isEnvironmentInTestCluster=A.isLiteEnvironmentUpgrading=A.isEnvironmentExpired=A.isEnvironmentInDeletedState=A.isEnvironmentInCreatingState=A.isDatabaseInProvisioningState=A.canUserCreateDatabase=A.isDisabledEnvironment=A.isDefaultEnvironment=A.isTrialEnvironment=A.isPlatformEnvironment=A.isTeamsEnvironment=A.isSandboxEnvironment=A.isProdEnvironment=A.isDevEnvironment=A.getEnvironmentType=A.getCrmInstanceName=A.getCrmInstanceUrl=A.getCrmAppDesignerUrl=A.getDevResourcesUrl=A.isEnvironmentInSuccessfulState=A.getAllThemesUrl=A.getAllPublishersUrl=A.getAllSolutionsUrl=A.getSecurityRolesUrl=A.getSecurityUsersUrl=A.environmentHasCds2Database=A.DEFAULT_SOLUTION_UNIQUE_NAME=A.DEFAULT_SOLUTION_ID=A.crmBapSolutionId=A.doesUserHavePermission=A.getLinkedEnvironmentMetadata=A.getCrmVersion=void 0;A.doesUserHaveFlowRunOnlyPermission=A.isUserPautoMakerWithoutDataAccess=A.isUserPautoMakerWithDataAccess=A.doesUserHaveCreateFlowPermission=A.equalsIgnoreCase=A.doesUserHaveCreateDatabasePermission=A.doesUserHaveDatabaseTablePermissions=A.isUserMakerWithoutDataAccess=A.isUserMakerWithDataAccess=A.doesUserHaveCreateAppPermission=A.doesUserHaveAdminPermission=void 0;var pR=dR(_v()),le=Fv(),Ja=Pd();function fR(e){let t=Ur(e);return t&&t.version}A.getCrmVersion=fR;function Ur(e){return e&&e.properties&&e.properties.linkedEnvironmentMetadata}A.getLinkedEnvironmentMetadata=Ur;function Mr(e,t){return e?!!e[t]:!1}A.doesUserHavePermission=Mr;A.crmBapSolutionId="00000001-0000-0000-0001-00000000009b";A.DEFAULT_SOLUTION_ID="fd140aaf-4df4-11dd-bd17-0019b9312238";A.DEFAULT_SOLUTION_UNIQUE_NAME="Default";function qn(e){return!!Ur(e)&&xv(e)}A.environmentHasCds2Database=qn;function mR(e){if(e&&qn(e)){let t=un(e);return(0,Ja.getCrmAdminSecurityRolesUrl)(t)}return""}A.getSecurityUsersUrl=mR;function hR(e){if(e&&qn(e)){let t=un(e);return(0,Ja.getCrmAdminSecurityUsersUrl)(t)}return""}A.getSecurityRolesUrl=hR;function gR(e){if(e&&qn(e)){let t=un(e);(0,Ja.getCrmAllSolutionsUrl)(t)}return""}A.getAllSolutionsUrl=gR;function vR(e){if(e&&qn(e)){let t=un(e);return(0,Ja.getCrmAllPublishersUrl)(t)}return""}A.getAllPublishersUrl=vR;function yR(e){return e&&qn(e)?un(e):""}A.getAllThemesUrl=yR;function xv(e){return!!e&&e.properties&&!!e.properties.provisioningState&&e.properties.provisioningState.toUpperCase()===le.EnvironmentProvisioningStates.Succeeded.toUpperCase()}A.isEnvironmentInSuccessfulState=xv;function bR(e){if(e&&qn(e)){let t=un(e);return(0,Ja.getCrmDevResourcesUrl)(t)}return""}A.getDevResourcesUrl=bR;function wR(e){return`${e}designer/app/{${A.crmBapSolutionId}}/CreateNewApp}}`}A.getCrmAppDesignerUrl=wR;function un(e){let t=Ur(e);if(t){let r=t.instanceUrl;return r?r.endsWith("/")?r:r+"/":""}return""}A.getCrmInstanceUrl=un;function AR(e){let t=Ur(e);return t?t.uniqueName:""}A.getCrmInstanceName=AR;function CR(e){return Ur(e)?le.EnvironmentType.CDS2:e&&e.properties&&e.properties.namespace?le.EnvironmentType.CDS1:le.EnvironmentType.Empty}A.getEnvironmentType=CR;function SR(e){return e&&e.properties&&e.properties.environmentSku===le.EnvironmentSkuConstants.Developer}A.isDevEnvironment=SR;function ER(e){return e&&e.properties&&e.properties.environmentSku===le.EnvironmentSkuConstants.Production}A.isProdEnvironment=ER;function NR(e){return e&&e.properties&&e.properties.environmentSku===le.EnvironmentSkuConstants.Sandbox}A.isSandboxEnvironment=NR;function Xa(e){return e&&e.properties&&e.properties.environmentSku===le.EnvironmentSkuConstants.Teams}A.isTeamsEnvironment=Xa;function DR(e){return e&&e.properties&&e.properties.environmentSku===le.EnvironmentSkuConstants.Platform}A.isPlatformEnvironment=DR;var IR=e=>{var t;return((t=e.properties)===null||t===void 0?void 0:t.environmentSku)===le.EnvironmentSkuConstants.Trial};A.isTrialEnvironment=IR;function _R(e){return e&&e.properties&&(e.properties.isDefault||e.properties.creationType===le.EnvironmentCreationTypeConstants.DefaultTenant)}A.isDefaultEnvironment=_R;function PR(e){return e&&e.properties&&!!e.properties.states&&!!e.properties.states.runtime&&e.properties.states.runtime.id==="Disabled"}A.isDisabledEnvironment=PR;function TR(e){return e&&e.properties&&Mr(e.properties.permissions,le.environmentPermissions.CreateDatabase)}A.canUserCreateDatabase=TR;function OR(e){return!!(e&&e.properties&&e.properties.provisioningState&&$v(e.properties.provisioningState,le.EnvironmentProvisioningStates.LinkedDatabaseProvisioning))}A.isDatabaseInProvisioningState=OR;function RR(e){return!!e&&!!e.properties&&e.properties.provisioningState===le.EnvironmentProvisioningStates.Creating}A.isEnvironmentInCreatingState=RR;function FR(e){return e&&e.properties&&(e.properties.provisioningState===le.EnvironmentProvisioningStates.Deleted||e.properties.provisioningState===le.EnvironmentProvisioningStates.Deleting||e.properties.provisioningState===le.EnvironmentProvisioningStates.FailedDeleting)}A.isEnvironmentInDeletedState=FR;function xR(e){return!!e&&!!e.properties&&!!e.properties.expirationTime&&Date.parse(e.properties.expirationTime)<Date.now()}A.isEnvironmentExpired=xR;function LR(e){return!!e&&!!e.properties&&!!e.properties.linkedEnvironmentMetadata&&e.properties.linkedEnvironmentMetadata.platformSku==="Lite"&&!!e.properties.states&&!!e.properties.states.management&&e.properties.states.management.id==="Running"&&!!e.properties.ongoingOperation&&!!e.properties.ongoingOperation.type&&e.properties.ongoingOperation.type.id==="Promote"}A.isLiteEnvironmentUpgrading=LR;function kR(e){return!!e&&!!e.properties&&!!e.properties.cluster&&e.properties.cluster.category==="Test"}A.isEnvironmentInTestCluster=kR;function MR(e){return!!e&&!!e.properties&&!!e.properties.cluster&&e.properties.cluster.category==="Preprod"}A.isEnvironmentInPreprodCluster=MR;function UR(e){return!!e&&!!e.properties&&!!e.properties.cluster&&e.properties.cluster.category==="FirstRelease"}A.isEnvironmentInFirstReleaseCluster=UR;function BR(e){return e&&e.name||""}A.getEnvironmentName=BR;function $R(e){return e&&e.properties&&e.properties.displayName||""}A.getEnvironmentDisplayName=$R;var Lv="9.1.0.8202";A.cdsVersionSupportingOSColorEdit="9.1.0000.20708";function qR(e){return Uv(e,Lv)}A.doesCds2EnvironmentSupportApiVersion9_1=qR;function VR(e){return _d(e,Lv)}A.doesCds2VersionSupportApiVersion9_1=VR;function kv(e){let t=Ur(e);if(t)return t.securityGroupId}function Mv(e){return e&&e.properties&&e.properties.connectedGroups}function GR(e,t){let r=Mv(e);return!!r&&!!r.find(n=>n.id===t)||kv(e)===t}A.hasSecurityGroupId=GR;function zR(e){let t=Mv(e);return t&&t.length>0&&t[0].id?t[0].id:kv(e)}A.getSecurityOrConnectedGroupId=zR;function Uv(e,t){let r=e.version;return r?_d(r,t):!1}A.isCds2EnvironmentVersionAtLeast=Uv;function _d(e,t){return t?e?(0,pR.default)(e,t)>=0:!1:!0}A.checkVersions=_d;function WR(e){return e&&e.properties&&e.properties.updateCadence&&e.properties.updateCadence.id||"NotSpecified"}A.getEnvironmentUpdateCadence=WR;function jR(e){let t=Ur(e);return t?Number(t.baseLanguage):0}A.getEnvironmentLanguageCode=jR;function Bv(e){let t=Ur(e);return t?t.instanceApiUrl:void 0}A.getEnvironmentInstanceApiUrl=Bv;function HR(e){let t=Bv(e);return t?t+"/api/data/v9.2":""}A.getEnvironmentWebApiUrl=HR;function QR(e){let t=un(e);if(t==="")return"";let r=t.split("/");if(r.length!==4)return"";let n=r[2].split(".");return n[0]="globaldisco",r[2]=n.join("."),r.join("/")+"api/discovery/v2.0/Instances"}A.getEnvironmentDiscoveryUrl=QR;var JR=e=>{var t;return((t=e.properties)===null||t===void 0?void 0:t.databaseType)===le.DatabaseType.CommonDataService};A.hasCommonDataServiceDatabase=JR;var XR=e=>{var t;return Mr((t=e.properties)===null||t===void 0?void 0:t.permissions,le.environmentPermissions.AdminReadEnvironment)};A.doesUserHaveAdminPermission=XR;var KR=e=>{var t;return Mr((t=e.properties)===null||t===void 0?void 0:t.permissions,le.environmentPermissions.CreatePowerApp)};A.doesUserHaveCreateAppPermission=KR;var YR=e=>(0,A.doesUserHaveAdminPermission)(e)&&(0,A.hasCommonDataServiceDatabase)(e)?!0:(0,A.doesUserHaveCreateAppPermission)(e)?Xa(e)||(0,A.doesUserHaveDatabaseTablePermissions)(e):!1;A.isUserMakerWithDataAccess=YR;var ZR=e=>(0,A.doesUserHaveCreateAppPermission)(e)&&!Xa(e)&&!(0,A.doesUserHaveDatabaseTablePermissions)(e)&&(!(0,A.doesUserHaveAdminPermission)(e)||!(0,A.hasCommonDataServiceDatabase)(e));A.isUserMakerWithoutDataAccess=ZR;var eF=e=>[le.environmentPermissions.CreateDatabaseEntities,le.environmentPermissions.ListDatabaseEntities,le.environmentPermissions.UpdateDatabaseEntities,le.environmentPermissions.DeleteDatabaseEntities].every(t=>{var r;return Mr((r=e.properties)===null||r===void 0?void 0:r.permissions,t)});A.doesUserHaveDatabaseTablePermissions=eF;var tF=e=>{var t;return Mr((t=e.properties)===null||t===void 0?void 0:t.permissions,le.environmentPermissions.CreateDatabase)};A.doesUserHaveCreateDatabasePermission=tF;function $v(e,t){return!e&&!t?!0:!e||!t?!1:e.toUpperCase()===t.toUpperCase()}A.equalsIgnoreCase=$v;var rF=e=>{var t;return Mr((t=e.properties)===null||t===void 0?void 0:t.permissions,le.environmentPermissions.CreateFlow)};A.doesUserHaveCreateFlowPermission=rF;var nF=e=>(0,A.doesUserHaveAdminPermission)(e)&&(0,A.hasCommonDataServiceDatabase)(e)?!0:(0,A.doesUserHaveCreateFlowPermission)(e)?Xa(e)||(0,A.doesUserHaveDatabaseTablePermissions)(e):!1;A.isUserPautoMakerWithDataAccess=nF;var iF=e=>(0,A.doesUserHaveCreateFlowPermission)(e)&&!Xa(e)&&!(0,A.doesUserHaveDatabaseTablePermissions)(e)&&(!(0,A.doesUserHaveAdminPermission)(e)||!(0,A.hasCommonDataServiceDatabase)(e));A.isUserPautoMakerWithoutDataAccess=iF;var aF=e=>{var t,r;return!Mr((t=e.properties)===null||t===void 0?void 0:t.permissions,le.environmentPermissions.CreateFlow)&&Mr((r=e.properties)===null||r===void 0?void 0:r.permissions,le.environmentPermissions.ReadEnvironment)};A.doesUserHaveFlowRunOnlyPermission=aF});var Pd=g(b=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0});b.getRequiredComponentsQueryUrl=b.solutionComponentCountSummariesQueryUrl=b.solutionComponentSummariesQueryUrl=b.solutionComponentConfigurationsQueryUrl=b.chartsQueryUrl=b.workflowsQueryUrl=b.entityDefinitionsQueryUrl=b.solutionComponentDefinitionsQueryUrl=b.getCreateNewArticleTemplateUrl=b.getCreateNewPublisherUrl=b.getEnableSecurityRolesUrl=b.getArticleTemplateUrl=b.getFieldSecurityProfileDesignerUrl=b.getSecurityRoleDesignerUrl=b.getMailMergeTemplateDesignerUrl=b.getEmailTemplateDesignerUrl=b.getConnectionRoleDesignerUrl=b.getSiteMapDesignerUrl=b.getWebResourceFileUrl=b.getWebResourceDesignerUrl=b.getReportDesignerUrl=b.getBusinessProcessFlowDesignerUrl=b.getProcessShareUrl=b.getProcessDesignerUrl=b.getChartDesignerUrl=b.getOpenModernEntityDashboardUrl=b.getNewModernEntityDashboardUrl=b.getNewModernDashboardUrl=b.getOpenModernDashboardUrl=b.getDashboardDesignerUrl=b.getAppModuleDesignerUrl=b.privilegesQueryUrls=b.xrmApiUrl=b.getPlayAppModuleUrl=b.getCrmAdminSecurityUsersUrl=b.getCrmAdminSecurityRolesUrl=b.getCrmMyAppsUrl=b.getCrmAppDesignerUrl=b.getCrmDevResourcesUrl=b.getCrmAllPublishersUrl=b.getCrmAllSolutionsUrl=b.getSolutionPublisherUrl=b.getExportTranslationFileName=b.getExportSolutionTranslationUrl=b.getImportSolutionTranslationUrl=b.getShowSolutionDependenciesUrl=b.getShowComponentDependenciesUrl=b.cdsServiceUrl=b.ODATA_NEXT_LINK=b.ODATA_MAX_PAGE_SIZE=void 0;b.retrieveOrganizationResources=b.getUCIEntityRecordEditUrl=b.getUCIEntityRecordBaseUrl=b.getBusinessRuleDesignerUri=b.retrieveUnpublishedSuffix=b.getSavePowerSettingUri=b.getPowerSettingUri=b.getPowerSettingsUri=b.RetrievePlatform=b.getAppSettingOverrideUri=b.AppSettingOverrideName=b.getOrgSettingOverrideUri=b.OrgSettingOverrideName=b.getSettingDefinitionsUri=b.retrieveFeatureControlSettingsByNamespaceUrl=b.retrieveDeploymentPipelineConfigAppUrl=b.SPNPrincipalIdUrl=b.retrieveDeploymentEnvironmentInfoUrl=b.devSolutionInfoUrl=b.deployOperationStatusUrl=b.getAIGeneratedDeploymentNotesUrl=b.deploymentStageRunUrl=b.validatePackageAsyncUrl=b.deployPackageAsyncUrl=b.updateDeploymentStageRunUrl=b.createDeploymentStageRunUrl=b.retrieveDeploymentStagesUrl=b.retrievePipelinesUrl=b.retrieveDeploymentPipelineInfoUrl=b.getDeploymentStageRunsUrl=b.appDeploymentUrls=b.getProvisionLanguageUrl=b.getSolutionQueryUrl=b.getSolutionsByUniqueNameQueryUrl=b.solutionsQueryUrl=b.getDependentComponentsWithMetadataQueryUrl=void 0;var Vv=qv();b.ODATA_MAX_PAGE_SIZE="odata.maxpagesize";b.ODATA_NEXT_LINK="@odata.nextLink";b.cdsServiceUrl="https://cds-org/";var Ya;(function(e){e.AllSolutions="11",e.AllPublishers="10",e.DevResources="05"})(Ya||(Ya={}));function oF(e,t,r,n){return`${e}tools/dependency/dependencyviewdialog.aspx?appSolutionId=%7b${t}%7d&dType=1&objectid=%7b${r}%7d&objecttype=${n}&operationtype=showdependency`}b.getShowComponentDependenciesUrl=oF;function sF(e,t){let r=`dType=1&isproactivecheck=true&objecttype=7100&operationtype=dependenciesforuninstall&objectid=${t}`;return`${e}tools/dependency/dependencyviewdialog.aspx?${r}`}b.getShowSolutionDependenciesUrl=sF;function lF(e,t){return`${e}tools/muiProvisioning/Dialogs/LangTranslationsImport.aspx?dType=1&appSolutionId=${t}`}b.getImportSolutionTranslationUrl=lF;function uF(e,t){return`${e}_grid/cmds/dlg_exportsolution.aspx?command=exporttranslation&appSolutionId=${t}`}b.getExportSolutionTranslationUrl=uF;function cF(e,t){return e!==void 0&&t!==void 0&&`CrmTranslations_${e}_${t.replace(/[.]/g,"_")}.zip`||""}b.getExportTranslationFileName=cF;function dF(e,t,r){return r?`${e}tools/publisher/edit.aspx?appSolutionId=%7b${r}%7d&id=%7b${t}%7d`:`${e}tools/publisher/edit.aspx?id=%7b${t}%7d`}b.getSolutionPublisherUrl=dF;function Td(e,t){return`${e}tools/systemcustomization/systemCustomization.aspx?pid=${t}`}function pF(e){return Td(e,Ya.AllSolutions)}b.getCrmAllSolutionsUrl=pF;function fF(e){return Td(e,Ya.AllPublishers)}b.getCrmAllPublishersUrl=fF;function mF(e){return Td(e,Ya.DevResources)}b.getCrmDevResourcesUrl=mF;function hF(e,t=Vv.crmBapSolutionId){return`${e}designer/app/${t}#/CreateNewApp`}b.getCrmAppDesignerUrl=hF;function gF(e){return`${e}apps`}b.getCrmMyAppsUrl=gF;function vF(e){return Gv(e,"role")+"&forceUCI=0"}b.getCrmAdminSecurityRolesUrl=vF;function yF(e){return`${Gv(e,"systemuser")}&forceclassic=1`}b.getCrmAdminSecurityUsersUrl=yF;function Gv(e,t){return`${e}main.aspx?pagetype=entitylist&etn=${t}`}function bF(e,t){return`${e}main.aspx?appid=${t}`}b.getPlayAppModuleUrl=bF;b.xrmApiUrl="api/data/v9.0";b.privilegesQueryUrls={systemUserInfo:e=>`${e}${b.xrmApiUrl}/WhoAmI`,userPrivileges:(e,t)=>`${e}${b.xrmApiUrl}/systemusers(${t})/Microsoft.Dynamics.CRM.RetrieveUserPrivileges`,systemPrivileges:e=>`${e}${b.xrmApiUrl}/privileges/Microsoft.Dynamics.CRM.RetrievePrivilegeSet`};function wF(e,t,r=Vv.crmBapSolutionId){return`${e}designer/app/${r}/${t}/AppDesignerCanvas/${t}`}b.getAppModuleDesignerUrl=wF;function AF(e,t,r,n){return`${e}main.aspx?appSolutionId=%7b${r}%7d&extraqs=%26formId%3d%7b${t}%7d%26dashboardType%3d1030&pagetype=${`${n?"ic":""}dashboardeditor`}`}b.getDashboardDesignerUrl=AF;function CF(e,t,r){return`/e/${e}/s/${t}/dashboard/${r}`}b.getOpenModernDashboardUrl=CF;function SF(e,t,r){let n=r!==void 0?r.toString():void 0;return`/e/${e}/s/${t}/dashboard/new${n?`/${n}`:""}`}b.getNewModernDashboardUrl=SF;function EF(e,t,r,n){let i=n!==void 0?n.toString():void 0;return`/e/${e}/s/${t}/n/${r}/dashboard/new${i?`/${i}`:""}`}b.getNewModernEntityDashboardUrl=EF;function NF(e,t,r,n){return`/e/${e}/s/${t}/n/${r}/dashboard/${n}`}b.getOpenModernEntityDashboardUrl=NF;function DF(e,t,r,n){return`${e}main.aspx?appSolutionId=%7b${t}%7d&extraqs=etc=${r||""}`+(n?`%26id=${n}`:"")+"&pagetype=vizdesigner"}b.getChartDesignerUrl=DF;function IF(e,t,r){return`${e}sfa/workflow/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}b.getProcessDesignerUrl=IF;function _F(e,t,r){return`${e}sfa/workflow/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}b.getProcessShareUrl=_F;function PF(e,t){return`${e}Tools/ProcessControl/UnifiedProcessDesigner.aspx?id=${t}`}b.getBusinessProcessFlowDesignerUrl=PF;function TF(e,t,r){return`${e}CRMReports/reportproperty.aspx?appSolutionId=%7b${r}%7d&disablePersonal=true&id=%7b${t}%7d`}b.getReportDesignerUrl=TF;function OF(e,t,r){return`${e}main.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&etc=9333&id=%7b${t}%7d&pagetype=webresourceedit`}b.getWebResourceDesignerUrl=OF;function RF(e,t){return`${e}WebResources/${t}`}b.getWebResourceFileUrl=RF;function FF(e,t,r){return`${e}designer/sitemap/${r}/${t}/SiteMapHome/${t}`}b.getSiteMapDesignerUrl=FF;function xF(e,t,r){return`${e}connections/connectionroles/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}b.getConnectionRoleDesignerUrl=xF;function LF(e,t,r){return`${e}tools/emailtemplateeditor/emailtemplateeditor.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}b.getEmailTemplateDesignerUrl=LF;function kF(e,t,r){return`${e}tools/mailmerge/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}b.getMailMergeTemplateDesignerUrl=kF;function MF(e,t,r){return`${e}biz/roles/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}b.getSecurityRoleDesignerUrl=MF;function UF(e,t,r){return`${e}biz/fieldsecurityprofiles/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}b.getFieldSecurityProfileDesignerUrl=UF;function BF(e,t,r){return`${e}tools/kbtemplateeditor/kbtemplateeditor.aspx?_CreateFromId=%7b${t}%7d&_CreateFromType=7100&appSolutionId=%7b${t}%7d&id=%7b${r}%7d`}b.getArticleTemplateUrl=BF;function $F(e,t,r,n){return`${e}tools/FormEditor/Dialogs/FormRoleAssignment.aspx?appSolutionId=%7b${t}%7d&dType=1&formId=%7b${r}%7d&objectTypeCode=0&type=${n}`}b.getEnableSecurityRolesUrl=$F;function qF(e){return`${e}tools/publisher/edit.aspx`}b.getCreateNewPublisherUrl=qF;function VF(e,t){return`${e}tools/kbtemplateeditor/kbtemplateeditor.aspx?appSolutionId=${t}`}b.getCreateNewArticleTemplateUrl=VF;b.solutionComponentDefinitionsQueryUrl="api/data/v9.0/solutioncomponentdefinitions";b.entityDefinitionsQueryUrl="api/data/v9.0/EntityDefinitions?$select=EntitySetName,DisplayName,LogicalName&$filter=";b.workflowsQueryUrl="api/data/v9.0/workflows";b.chartsQueryUrl="/api/data/v9.0/savedqueryvisualizations";b.solutionComponentConfigurationsQueryUrl="/api/data/v9.1/solutioncomponentconfigurations?$filter=isdisplayable eq true&$select=name";b.solutionComponentSummariesQueryUrl="/api/data/v9.0/msdyn_solutioncomponentsummaries";b.solutionComponentCountSummariesQueryUrl="/api/data/v9.0/msdyn_solutioncomponentcountsummaries";function GF(e,t){return`${b.xrmApiUrl}/RetrieveRequiredComponents(ObjectId=${e},ComponentType=${t})`}b.getRequiredComponentsQueryUrl=GF;function zF(e,t){return`${b.cdsServiceUrl}${b.xrmApiUrl}/RetrieveDependentComponentsWithMetadata(ObjectId=${e},ComponentType=${t})`}b.getDependentComponentsWithMetadataQueryUrl=zF;b.solutionsQueryUrl="/api/data/v9.0/solutions?$expand=publisherid&$filter=(isvisible eq true)";function WF(e){return`/api/data/v9.0/solutions?$expand=publisherid&$filter=(uniquename eq '${e}')`}b.getSolutionsByUniqueNameQueryUrl=WF;function jF(e){return`/api/data/v9.0/solutions(${e})?$expand=publisherid`}b.getSolutionQueryUrl=jF;function HF(e){return`${e}api/data/v9.1/ProvisionLanguageForUser`}b.getProvisionLanguageUrl=HF;b.appDeploymentUrls={associateEnvironmentToPipelineUrl:e=>`/api/data/v9.0/deploymentpipelines(${e})/deploymentpipeline_deploymentenvironment/$ref`,deploymentArtifactsUrl:"/api/data/v9.0/deploymentartifacts",deploymentEnvironmentUrl:"/api/data/v9.0/deploymentenvironments",deploymentPipelinesUrl:"/api/data/v9.0/deploymentpipelines",deploymentStagesUrl:"/api/data/v9.0/deploymentstages",retrieveDeploymentPipelinesUrl:e=>`/api/data/v9.0/RetrieveDeploymentPipelines(SourceEnvironmentId='${e}')`,deletePipelinesUrl:e=>`/api/data/v9.0/deploymentpipelines(${e})`};function QF(e,t,r,n=!1,i=!1,a=!1,o=!1,s=!1,l=!1,u=!1){return`/api/data/v9.1/deploymentstageruns
+`)),this.type=t,this.id=r,this.issues=u,this.pointer=(o=(a=u[0])===null||a===void 0?void 0:a.pointer)!==null&&o!==void 0?o:"",this.rule=(l=(s=u[0])===null||s===void 0?void 0:s.rule)!==null&&l!==void 0?l:"invalid"}};Y.ValidationError=dc;var pc=class extends Xe{constructor(t){super("INVALID_ARGUMENT",t)}};Y.InvalidArgumentError=pc;var fc=class extends Xe{constructor(t,r,n){super("STALE_ARTIFACT",`Cannot apply the edit at ${n} to ${t}/${r}: the cached copy was stale and the server copy has since changed, so any pointer derived from the old copy may now identify a different node. The local copy has been refreshed \u2014 re-read the artifact, re-derive the pointer, and retry.`),this.type=t,this.id=r,this.pointer=n}};Y.StaleArtifactError=fc;var mc=class extends Xe{constructor(t,r,n,i){super("LOCAL_EDITS_WOULD_BE_LOST",`Refusing to fetch ${t}/${r}: the local copy has unpushed edits AND the server has moved since it was fetched (local=${n??"(none)"}, server=${i??"(none)"}). Overwriting now would discard your edits and replace them with another writer's changes. Push or discard your edits first, or pass { overwrite: true } to deliberately reset the local copy to the server version.`),this.type=t,this.id=r,this.localEtag=n,this.serverEtag=i}};Y.LocalEditsWouldBeLostError=mc;var hc=class extends Xe{constructor(t,r,n,i,a){super("VERSION_CONFLICT",`Version conflict for ${t}/${r}: local=${n??"(none)"}, server=${i??"(none)"}. Re-fetch and reapply changes.${a?` ${a}`:""}`),this.type=t,this.id=r,this.localEtag=n,this.serverEtag=i,this.detail=a}};Y.VersionConflictError=hc;var gc=class extends Xe{constructor(t,r,n,i){super("CONNECTION_ERROR",r>0?`HTTP ${r} from ${t}: ${n}`:`Transport failure reaching ${t}: ${n}`),this.url=t,this.statusCode=r,this.cause=i}};Y.ConnectionError=gc;var vc=class extends Xe{constructor(t){super("WORKSPACE_NOT_INITIALIZED",`Workspace not initialized at ${t}. Call initWorkspace() first.`),this.workspacePath=t}};Y.WorkspaceNotInitializedError=vc;var yc=class extends Xe{constructor(t,r){super("NOT_IMPLEMENTED",`Operation '${t}' is not implemented yet${r?`: ${r}`:""}.`),this.operation=t}};Y.NotImplementedError=yc;var bc=class extends Xe{constructor(t,r){super("INVALID_JSON_POINTER",`Invalid JSON Pointer '${t}': ${r}`),this.pointer=t}};Y.JsonPointerError=bc;var wc=class extends Xe{constructor(t,r,n){super("AMBIGUOUS_ARTIFACT",`Found ${n} ${t} rows matching '${r}'; a name is not a unique key. Resolve by id / alternate key instead of relying on name-based idempotency.`),this.kind=t,this.identity=r,this.matchCount=n}};Y.AmbiguousArtifactError=wc;var Ac=class extends Xe{constructor(t,r){super("PATH_TRAVERSAL",`Refusing to resolve a path outside the workspace root: '${t}' is not within '${r}'.`),this.target=t,this.root=r}};Y.PathTraversalError=Ac;var Cc=class extends Xe{constructor(t,r){super("INCOMPATIBLE_WORKSPACE",`Workspace schema version ${t} is newer than this SDK supports (v${r}). Upgrade the SDK, or re-create the workspace with this version.`),this.workspaceVersion=t,this.supportedVersion=r}};Y.IncompatibleWorkspaceError=Cc});var ie=g(Re=>{"use strict";Object.defineProperty(Re,"__esModule",{value:!0});Re.odataQuery=Re.normalizeGuid=Re.createSafeXmlElement=Re.assertNoControlChars=Re.assertODataName=Re.assertXmlName=Re.xmlText=Re.odataPathLiteral=Re.odataLiteral=void 0;var bs=ne();function sg(e){return String(e??"").replace(/'/g,"''")}Re.odataLiteral=sg;function eP(e){return encodeURIComponent(sg(e))}Re.odataPathLiteral=eP;function tP(e){return String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}Re.xmlText=tP;function lg(e,t){let r=String(e??""),n=/^[A-Za-z_][0-9A-Za-z_.-]*$/,i=r.split(":");if(!(i.length<=2&&i.every(o=>n.test(o))&&!/^xmlns/i.test(r)))throw new bs.InvalidArgumentError(`${t} must be a valid XML element name (got '${e}')`);return e}Re.assertXmlName=lg;function rP(e,t){let r=String(e??"");if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(r))throw new bs.InvalidArgumentError(`${t} must be a valid OData identifier (letters, digits, underscore): got '${e}'`);return e}Re.assertODataName=rP;function nP(e,t){if(/[\u0000-\u001F\u007F]/.test(String(e??"")))throw new bs.InvalidArgumentError(`${t} must not contain control characters (including CR/LF): they would inject additional lines into the request`);return e}Re.assertNoControlChars=nP;function iP(e,t,r){return e.createElement(lg(t,r))}Re.createSafeXmlElement=iP;var aP=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;function oP(e,t){let r=String(e??""),n=r.length===38&&r.startsWith("{")&&r.endsWith("}")?r.slice(1,-1):r;if(!aP.test(n))throw new bs.InvalidArgumentError(`${t} must be a valid GUID (got '${e}')`);return n.toLowerCase()}Re.normalizeGuid=oP;function sP(e){let t=[];for(let[r,n]of e)n!=null&&n!==""&&t.push(`${r}=${encodeURIComponent(String(n))}`);return t.length>0?`?${t.join("&")}`:""}Re.odataQuery=sP});var be=g(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.nowIso=ae.isAlreadyDeleted=ae.deleteRecord=ae.ensureSuccess=ae.resolveCreatedId=ae.requireCreatedId=ae.withClientMintedId=ae.readCreatedId=ae.readEtag=ae.requireEtag=ae.echoWrite=ae.UPDATE_NO_ETAG_CODE=ae.VERSION_CONFLICT_CODE=void 0;var gi=ne(),qa=ie();ae.VERSION_CONFLICT_CODE="VERSION_CONFLICT";ae.UPDATE_NO_ETAG_CODE="ARTIFACT_UPDATE_NO_ETAG";function lP(e,t){return{query:`?$select=${encodeURIComponent(e)}`,options:{headers:{...t??{},Prefer:"return=representation"}}}}ae.echoWrite=lP;function uP(e,t,r){if(!e)throw new gi.SdkError(ae.UPDATE_NO_ETAG_CODE,`Refusing to push ${t} '${r}': no concurrency token is held for it, so the write could not be made conditional and would silently overwrite a concurrent edit. Re-fetch the ${t} and re-apply the change.`);return e}ae.requireEtag=uP;function cP(e){var t;let r=(t=e.headers)!==null&&t!==void 0?t:{};for(let i of Object.keys(r))if(i.toLowerCase()==="etag")return r[i];let n=e.body;return n&&typeof n["@odata.etag"]=="string"?n["@odata.etag"]:null}ae.readEtag=cP;function Sc(e,t){var r;let n=e.body;if(n&&typeof n[t]=="string")return(0,qa.normalizeGuid)(n[t],t);let i=(r=e.headers)!==null&&r!==void 0?r:{};for(let a of Object.keys(i))if(a.toLowerCase()==="odata-entityid"){let o=/\(([0-9a-fA-F-]{36})\)/.exec(i[a]);if(o)return(0,qa.normalizeGuid)(o[1],t)}return null}ae.readCreatedId=Sc;function dP(e,t,r){return r?{...e,[t]:(0,qa.normalizeGuid)(r,t)}:e}ae.withClientMintedId=dP;function pP(e,t,r){let n=Sc(e,t);if(!n)throw new gi.InvalidArgumentError(`Dataverse did not return an id for the created ${r}`);return n}ae.requireCreatedId=pP;function fP(e,t,r,n){let i=Sc(e,t);if(i)return i;if(n)return(0,qa.normalizeGuid)(n,t);throw new gi.InvalidArgumentError(`Dataverse did not return an id for the created ${r}`)}ae.resolveCreatedId=fP;function ug(e,t){if(e.status===412)throw new gi.SdkError(ae.VERSION_CONFLICT_CODE,`Version conflict (412) from ${t}`);if(e.status<200||e.status>=300)throw new gi.ConnectionError(t,e.status,mP(e.body),e.body);return e}ae.ensureSuccess=ug;function mP(e){if(typeof e=="string"&&e.length>0)return e;if(e!==null&&typeof e=="object"){let t=e;if(t.error&&typeof t.error.message=="string")return t.error.message;if(typeof t.Message=="string")return t.Message;if(typeof t.message=="string")return t.message}return"request failed"}async function hP(e,t,r,n){let i=(0,qa.normalizeGuid)(r,"id"),a=`/${t}(${i})`;ug(await e.delete(a,n?{headers:{"If-Match":n}}:void 0),e.apiUrl(a))}ae.deleteRecord=hP;function gP(e){return e instanceof gi.ConnectionError&&e.statusCode===404}ae.isAlreadyDeleted=gP;function vP(){return new Date().toISOString()}ae.nowIso=vP});var er=g(vi=>{"use strict";Object.defineProperty(vi,"__esModule",{value:!0});vi.describeMalformedValue=vi.collectPages=void 0;var cg=be(),Ec=ne();async function yP(e,t,r){let n=[],i=new Set,a=e.apiUrl(t),o=(0,cg.ensureSuccess)(await e.get(t),a);for(;;){let s=o.body,l=s?.value;if(!Array.isArray(l))throw new Ec.ConnectionError(a,o.status,`${r}: paginated read returned a malformed page \u2014 expected an OData 'value' array but got ${Nc(l)}; refusing to return partial results.`);for(let c of l)n.push(c);let u=s?.["@odata.nextLink"];if(u==null)break;if(typeof u!="string"||u.length===0)throw new Ec.ConnectionError(a,o.status,`${r}: paginated read returned a malformed @odata.nextLink (${Nc(u)}); cannot follow it, and refusing to return partial results.`);if(i.has(u))throw new Ec.InvalidArgumentError(`${r}: aborting pagination \u2014 the server returned a repeated @odata.nextLink ('${u}'), which would loop indefinitely.`);i.add(u),a=u,o=(0,cg.ensureSuccess)(await e.getAbsolute(u),u)}return n}vi.collectPages=yP;function Nc(e){return e===null?"null":e===void 0?"undefined (missing)":`a ${typeof e}`}vi.describeMalformedValue=Nc});var Dc=g(mr=>{"use strict";Object.defineProperty(mr,"__esModule",{value:!0});mr.businessRuleApi=mr.BUSINESS_RULE_LEFT_DEACTIVATED_CODE=mr.WFOM_API_UNAVAILABLE_CODE=void 0;var Ur=Gn(),bP=er(),Ye=be(),dn=ie(),As=ne();mr.WFOM_API_UNAVAILABLE_CODE="BUSINESS_RULE_API_UNAVAILABLE";mr.BUSINESS_RULE_LEFT_DEACTIVATED_CODE="BUSINESS_RULE_LEFT_DEACTIVATED";async function dg(e,t,r,n){let i=`/workflows(${CP})/Microsoft.Dynamics.CRM.${t}`;try{return(0,Ye.ensureSuccess)(await e.post(i,{Entity:r.Entity,WfomJson:r.WfomJson},{headers:n}),e.apiUrl(i))}catch(a){throw a?.statusCode!==404?a:new As.SdkError(mr.WFOM_API_UNAVAILABLE_CODE,`Business-rule authoring (preview) is not enabled on this environment yet: it does not expose 'Microsoft.Dynamics.CRM.${t}'. The bound members are still rolling out, so re-check once the release flag reaches this environment. Nothing was written. The SDK does NOT fall back to generating workflow XAML: that covered only 4 of the 7 action types and would silently save a rule different from the one you wrote.`)}}async function wP(e,t){let r=`/workflows(${t})${(0,dn.odataQuery)([["$select","workflowid,statecode,statuscode"]])}`;try{let n=await e.get(r);if(n.status<200||n.status>=300)return null;let i=n.body;return{etag:(0,Ye.readEtag)(n),statecode:typeof i?.statecode=="number"?i.statecode:null,statuscode:typeof i?.statuscode=="number"?i.statuscode:null}}catch{return null}}async function AP(e,t,r){let n=await wP(e,t);if(n===null||n.etag===null)throw new As.SdkError(Ye.VERSION_CONFLICT_CODE,`Refusing to update business rule '${t}': its current version could not be read, so the write could not be verified as conditional. The supported update api does not enforce If-Match, so proceeding would risk silently overwriting a concurrent edit. Re-fetch the rule and try again.`);if(n.etag!==r)throw new As.SdkError(Ye.VERSION_CONFLICT_CODE,`Version conflict updating business rule '${t}': it changed on the server since it was fetched (held ${r}, server ${n.etag}). Re-fetch the rule and re-apply the change.`);return{statecode:n.statecode,statuscode:n.statuscode}}var CP="00000000-0000-0000-0000-000000000000",ws={"Content-Type":"application/json",Accept:"application/json","OData-Version":"4.0","OData-MaxVersion":"4.0"},SP="workflowid,name,description,primaryentity,statecode,category,type",EP="category eq 2 and type eq 1";async function pg(e,t,r){var n;if(r==="Draft")return null;let i=(0,dn.normalizeGuid)(t,"workflowid"),a=r==="Active",o={statecode:a?Ur.StateCode.Activated:Ur.StateCode.Draft,statuscode:a?Ur.StatusCode.Activated:Ur.StatusCode.Draft},s=`/workflows(${i})`,l=(0,Ye.ensureSuccess)(await e.patch(s,o,{headers:ws}),e.apiUrl(s));return(n=(0,Ye.readEtag)(l))!==null&&n!==void 0?n:await Va(e,i)}async function Va(e,t){let r=`/workflows(${t})${(0,dn.odataQuery)([["$select","workflowid"]])}`;try{let n=await e.get(r);return n.status>=200&&n.status<300?(0,Ye.readEtag)(n):null}catch{return null}}async function NP(e,t,r){let n=await Va(e,t),i=await r(),a=(0,Ye.readEtag)(i);if(a)return{response:i,etag:a};let o=await Va(e,t);return{response:i,etag:n!==null&&n===o?o:null}}mr.businessRuleApi={async get(e,t){let r=(0,dn.normalizeGuid)(t,"id"),n=`/workflows(${r})/Microsoft.Dynamics.CRM.RetrieveProcessWithWfomJson`,{response:i,etag:a}=await NP(e,r,async()=>(0,Ye.ensureSuccess)(await e.get(n),e.apiUrl(n)));return{raw:i.body,etag:a}},async list(e,t){let r=[EP];t?.entityLogicalName&&r.push(`primaryentity eq '${(0,dn.odataLiteral)(t.entityLogicalName)}'`);let n=`/workflows${(0,dn.odataQuery)([["$select",SP],["$filter",r.join(" and ")]])}`;return(await(0,bP.collectPages)(e,n,"listArtifacts('businessRule')")).map(a=>{var o,s;return{type:"businessRule",id:(o=a.workflowid)!==null&&o!==void 0?o:"",name:(s=a.name)!==null&&s!==void 0?s:"",entityLogicalName:a.primaryentity,isDirty:!1}})},async create(e,t){var r;let n=t,i=(0,dn.normalizeGuid)(n.Entity.workflowid,"workflowid"),a=await dg(e,"CreateProcessWithWfomJson",n,ws),o=(0,Ye.resolveCreatedId)(a,"workflowid","business rule",i),s=null;try{s=await pg(e,o,n.status)}catch(l){try{await(0,Ye.deleteRecord)(e,"workflows",o)}catch{}throw l}return{id:o,etag:(r=s??(0,Ye.readEtag)(a))!==null&&r!==void 0?r:await Va(e,o)}},async update(e,t,r,n){var i,a;let o=r,s=(0,dn.normalizeGuid)(t,"id"),l=`/workflows(${s})`,u={...ws,"If-Match":(0,Ye.requireEtag)(n,"business rule",s)},c=await AP(e,s,u["If-Match"]),d=c.statecode===Ur.StateCode.Activated;d&&(0,Ye.ensureSuccess)(await e.patch(l,{statecode:Ur.StateCode.Draft,statuscode:Ur.StatusCode.Draft},{headers:u}),e.apiUrl(l));let p;try{p=await dg(e,"UpdateProcessWithWfomJson",o,u)}catch(h){if(d)try{(0,Ye.ensureSuccess)(await e.patch(l,{statecode:Ur.StateCode.Activated,statuscode:(i=c.statuscode)!==null&&i!==void 0?i:Ur.StatusCode.Activated},{headers:ws}),e.apiUrl(l))}catch(v){throw new As.SdkError(mr.BUSINESS_RULE_LEFT_DEACTIVATED_CODE,`The business-rule write failed AND the rule could not be re-activated, so '${s}' is left DEACTIVATED (Draft) on the server. Re-activate it before relying on it. Original write failure: ${h instanceof Error?h.message:String(h)}. Restore failure: ${v instanceof Error?v.message:String(v)}`)}throw h}let f=await pg(e,s,o.status);return{id:s,etag:(a=f??(0,Ye.readEtag)(p))!==null&&a!==void 0?a:await Va(e,s)}},delete(e,t){return(0,Ye.deleteRecord)(e,"workflows",t)}}});var Es=g(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.JsonPointer=void 0;var Ft=ne(),Cs=class e{static isReservedToken(t){return e.RESERVED_TOKENS.has(t)}static decodeToken(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}static encodeToken(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}static parse(t){if(t==="")return[];if(t[0]!=="/")throw new Ft.JsonPointerError(t,'non-empty pointers must start with "/"');return t.substring(1).split("/").map(r=>{if(/~(?![01])/.test(r))throw new Ft.JsonPointerError(t,`invalid '~' escape in token '${r}' (expected ~0 or ~1)`);return e.decodeToken(r)})}static compile(t){return t.length===0?"":"/"+t.map(r=>e.encodeToken(r)).join("/")}static resolve(t,r){let n=e.parse(r),i=t;for(let a of n)if(Array.isArray(i)){let o=e.toArrayIndex(a,i.length);if(o===void 0)return;i=i[o]}else if(i!==null&&typeof i=="object"){let o=i;if(e.isReservedToken(a)||!Object.prototype.hasOwnProperty.call(o,a))return;i=o[a]}else return;return i}static set(t,r,n){let i=e.parse(r);if(i.length===0)throw new Ft.JsonPointerError(r,"cannot set the document root");let{parent:a,lastToken:o}=e.resolveParent(t,i,r);if(Array.isArray(a)){let s=e.toArrayIndex(o,a.length);if(s===void 0)throw new Ft.JsonPointerError(r,`'${o}' is not a valid array index`);if(s>a.length)throw new Ft.JsonPointerError(r,`array index '${o}' is out of range`);a[s]=n}else{if(e.isReservedToken(o))throw new Ft.JsonPointerError(r,`refusing to write reserved property '${o}'`);a[o]=n}}static remove(t,r){let n=e.parse(r);if(n.length===0)throw new Ft.JsonPointerError(r,"cannot remove the document root");let{parent:i,lastToken:a}=e.resolveParent(t,n,r);if(Array.isArray(i)){let o=e.toArrayIndex(a,i.length);if(o===void 0||o>=i.length)throw new Ft.JsonPointerError(r,`array index '${a}' is out of range`);i.splice(o,1)}else{if(e.isReservedToken(a))throw new Ft.JsonPointerError(r,`refusing to remove reserved property '${a}'`);delete i[a]}}static add(t,r,n,i){let a=e.parse(r);if(a.length>0&&a[a.length-1]==="-"){let l=e.compile(a.slice(0,-1)),u=e.resolve(t,l);if(!Array.isArray(u))throw new Ft.JsonPointerError(r,"add target must be an array");u.push(n);return}let o=e.resolve(t,r);if(!Array.isArray(o))throw new Ft.JsonPointerError(r,"add target must be an array");let s=i===void 0?o.length:i;if(s<0||s>o.length)throw new Ft.JsonPointerError(r,`insert index ${s} is out of range`);o.splice(s,0,n)}static parent(t){let r=e.parse(t);return r.pop(),e.compile(r)}static lastToken(t){let r=e.parse(t);return r.length===0?"":r[r.length-1]}static append(t,r){return`${t}/${e.encodeToken(String(r))}`}static resolveParent(t,r,n){let i=r[r.length-1],a=e.compile(r.slice(0,-1)),o=e.resolve(t,a);if(o===null||typeof o!="object")throw new Ft.JsonPointerError(n,"parent path does not resolve to an object or array");return{parent:o,lastToken:i}}static toArrayIndex(t,r){if(t==="-")return r;if(/^(0|[1-9][0-9]*)$/.test(t))return Number(t)}};Ss.JsonPointer=Cs;Cs.RESERVED_TOKENS=new Set(["__proto__","prototype","constructor"])});var mg=g(Ns=>{"use strict";Object.defineProperty(Ns,"__esModule",{value:!0});Ns.findElements=void 0;var fg=Es();function DP(e,t){let r=[];return Ic(e,"",t,r),r}Ns.findElements=DP;function Ic(e,t,r,n){if(!(e===null||typeof e!="object"))if(r(e,t)&&n.push({pointer:t,value:e}),Array.isArray(e))e.forEach((i,a)=>{Ic(i,fg.JsonPointer.append(t,a),r,n)});else for(let i of Object.keys(e))Ic(e[i],fg.JsonPointer.append(t,i),r,n)}});var _c=g(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.assertMutationResult=hr.assertExistsResult=hr.assertReadResult=hr.assertStorageContract=void 0;var IP=["readText","writeTextAtomic","deleteFile","deleteByPrefix"],_P=["ensureContainer","exists"];function TP(e){if(typeof e!="object"||e===null)throw new Error("workspaceStorage must be an object implementing WorkspaceStorage.");for(let t of IP)if(typeof e[t]!="function")throw new Error(`workspaceStorage is missing the required method '${t}'.`);for(let t of _P){let r=e[t];if(r!==void 0&&typeof r!="function")throw new Error(`workspaceStorage.${t} must be a function when present.`)}return e}hr.assertStorageContract=TP;function PP(e,t){if(e===null||typeof e=="string")return e;throw new Error(`workspaceStorage.readText must resolve to a string or null for ${t}; got ${typeof e}. Absence is null \u2014 resolving undefined would make a present value look absent.`)}hr.assertReadResult=PP;function OP(e,t){if(typeof e=="boolean")return e;throw new Error(`workspaceStorage.exists must resolve to a boolean for ${t}; got ${typeof e}. A truthy non-boolean would make an absent value look present.`)}hr.assertExistsResult=OP;function RP(e,t){if(e!==void 0)throw new Error(`workspaceStorage.${t} must resolve to undefined; got ${typeof e}. A status-returning implementation would let a failed write be reported as a completed one.`)}hr.assertMutationResult=RP});var Tc=g(yi=>{"use strict";Object.defineProperty(yi,"__esModule",{value:!0});yi.retryTransientIoAsync=yi.retryTransientIo=void 0;var FP=new Set(["EPERM","EACCES","EBUSY","UNKNOWN"]),xP=5,hg=10;function LP(e){for(let t=1;;t+=1)try{return e()}catch(r){if(!gg(r,t))throw r;MP(hg*t)}}yi.retryTransientIo=LP;async function kP(e){for(let t=1;;t+=1)try{return await e()}catch(r){if(!gg(r,t))throw r;await new Promise(n=>setTimeout(n,hg*t))}}yi.retryTransientIoAsync=kP;function gg(e,t){let r=e.code;return t<xP&&!!r&&FP.has(r)}function MP(e){try{Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)}catch{let t=Date.now()+e;for(;Date.now()<t;);}}});var bg=g(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.canonicalArtifactId=xt.WorkspaceManager=xt.WORKSPACE_SCHEMA_VERSION=xt.retryTransientIo=void 0;var bt=_c(),Ds=ne(),BP=Tc();Object.defineProperty(xt,"retryTransientIo",{enumerable:!0,get:function(){return BP.retryTransientIo}});function vg(e){let t=e;return typeof t.pathFor=="function"&&typeof t.getRoot=="function"?e:null}xt.WORKSPACE_SCHEMA_VERSION=1;var pn={form:"forms",view:"views",businessRule:"business-rules",app:"apps",command:"commands",chart:"charts",dashboard:"dashboards",genPage:"gen-pages",bpf:"business-process-flows"},UP="manifest.json",Ga=".metadata",yg="entities",Pc=class{withManifest(t){let r=this.manifestQueue.then(t,t);return this.manifestQueue=r.then(()=>{},()=>{}),r}constructor(t,r,n){if(this.workspaceLabel=t,this.instanceUrl=r,this.manifestQueue=Promise.resolve(),n==null)throw new Error("WorkspaceManager requires a WorkspaceStorage. Node callers can build one with `createNodeWorkspaceStorage(path)` from '@maker-studio/cds-maker-sdk/node'.");this.storage=n}artifactKey(t,r){return this.assertSafeId(r),[pn[t],`${za(r)}.json`]}metaKey(t,r){return this.assertSafeId(r),[Ga,pn[t],`${za(r)}.meta.json`]}entityKey(t){return this.assertSafeId(t),[Ga,yg,`${t}.json`]}fsStore(){let t=vg(this.storage);if(!t)throw new Error("This workspace is not filesystem-backed, so it has no physical paths. Use the artifact/metadata/manifest accessors instead of the path helpers.");return t}getRoot(){let t=vg(this.storage);return t?t.getRoot():this.workspaceLabel}getArtifactDir(t){return this.fsStore().pathFor([pn[t]])}getArtifactFilePath(t,r){return this.fsStore().pathFor(this.artifactKey(t,r))}getMetaFilePath(t,r){return this.fsStore().pathFor(this.metaKey(t,r))}getEntityMetaFilePath(t){return this.fsStore().pathFor(this.entityKey(t))}assertSafeId(t){if(typeof t!="string"||t.length===0||/[\u0000-\u001f]/.test(t)||t.includes("/")||t.includes("\\")||t.includes(":")||t==="."||t===".."||t.includes(".."))throw new Ds.PathTraversalError(String(t),this.workspaceLabel)}get manifestKey(){return[UP]}async init(){if(this.storage.ensureContainer){for(let t of Object.keys(pn))(0,bt.assertMutationResult)(await this.storage.ensureContainer([pn[t]]),"ensureContainer"),(0,bt.assertMutationResult)(await this.storage.ensureContainer([Ga,pn[t]]),"ensureContainer");(0,bt.assertMutationResult)(await this.storage.ensureContainer([Ga,yg]),"ensureContainer")}if(!await this.isInitialized()){let t={instanceUrl:this.instanceUrl,createdAt:new Date().toISOString(),artifacts:[]};await this.writeManifest(t)}}async isInitialized(){return this.storage.exists?(0,bt.assertExistsResult)(await this.storage.exists(this.manifestKey),"manifest.json"):(0,bt.assertReadResult)(await this.storage.readText(this.manifestKey),"manifest.json")!==null}async ensureInitialized(){if(!await this.isInitialized())throw new Ds.WorkspaceNotInitializedError(this.workspaceLabel)}async clean(){for(let r of Object.keys(pn))(0,bt.assertMutationResult)(await this.storage.deleteByPrefix([pn[r]]),"deleteByPrefix");(0,bt.assertMutationResult)(await this.storage.deleteByPrefix([Ga]),"deleteByPrefix");let t=await this.getManifest();t.artifacts=[],t.lastSyncAt=void 0,await this.init(),await this.writeManifest(t)}async readArtifact(t,r){return await this.ensureInitialized(),this.readJson(this.artifactKey(t,r))}async writeArtifact(t,r,n){await this.ensureInitialized(),await this.writeJson(this.artifactKey(t,r),n),await this.upsertManifestEntry(t,r,n)}async deleteArtifact(t,r){await this.ensureInitialized(),(0,bt.assertMutationResult)(await this.storage.deleteFile(this.artifactKey(t,r)),"deleteFile"),(0,bt.assertMutationResult)(await this.storage.deleteFile(this.metaKey(t,r)),"deleteFile");let n=za(r);await this.withManifest(async()=>{let i=await this.getManifest();i.artifacts=i.artifacts.filter(a=>!(a.type===t&&a.id===n)),await this.writeManifest(i)})}async readMeta(t,r){return this.readJson(this.metaKey(t,r))}async writeMeta(t,r,n){await this.writeJson(this.metaKey(t,r),n)}async listArtifacts(t,r){return await this.ensureInitialized(),(await this.getManifest()).artifacts.filter(n=>!(t&&n.type!==t||r?.entityLogicalName&&n.entityLogicalName!==r.entityLogicalName))}async readEntityMetadata(t){await this.ensureInitialized();let r=await this.readJson(this.entityKey(t));return!r||typeof r.schemaName!="string"||typeof r.primaryNameAttribute!="string"||typeof r.primaryIdAttribute!="string"||typeof r.isCustomEntity!="boolean"?null:r}async writeEntityMetadata(t,r){await this.ensureInitialized(),await this.writeJson(this.entityKey(t),r)}async getManifest(){await this.ensureInitialized();let t=await this.readJson(this.manifestKey);if(!t)throw new Ds.WorkspaceNotInitializedError(this.workspaceLabel);if(t.schemaVersion!==void 0&&t.schemaVersion>xt.WORKSPACE_SCHEMA_VERSION)throw new Ds.IncompatibleWorkspaceError(t.schemaVersion,xt.WORKSPACE_SCHEMA_VERSION);return t}async writeManifest(t){await this.writeJson(this.manifestKey,{...t,schemaVersion:xt.WORKSPACE_SCHEMA_VERSION})}async updateManifest(t){await this.withManifest(async()=>{let r=await this.getManifest();await this.writeManifest({...r,...t})})}async upsertManifestEntry(t,r,n){await this.withManifest(async()=>{let i=await this.getManifest(),a=za(r),o=n,s=typeof o.name=="string"?o.name:`${t}:${a}`,l=typeof o.entityLogicalName=="string"?o.entityLogicalName:void 0,u=i.artifacts.find(c=>c.type===t&&c.id===a);u?(u.name=s,u.entityLogicalName=l):i.artifacts.push({type:t,id:a,name:s,entityLogicalName:l,isDirty:!1}),await this.writeManifest(i)})}async readJson(t){let r=(0,bt.assertReadResult)(await this.storage.readText(t),t.join("/"));return r===null?null:JSON.parse(r)}async writeJson(t,r){(0,bt.assertMutationResult)(await this.storage.writeTextAtomic(t,`${JSON.stringify(r,null,2)}
+`),"writeTextAtomic")}async removeFile(t){(0,bt.assertMutationResult)(await this.storage.deleteFile(t),"deleteFile")}async exists(t){return this.storage.exists?(0,bt.assertExistsResult)(await this.storage.exists(t),t.join("/")):(0,bt.assertReadResult)(await this.storage.readText(t),t.join("/"))!==null}};xt.WorkspaceManager=Pc;function za(e){let r=/^\{?([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})\}?$/.exec(e);return r?r[1].toLowerCase():e.toLowerCase()}xt.canonicalArtifactId=za});var Oc=g(bi=>{"use strict";Object.defineProperty(bi,"__esModule",{value:!0});bi.deepEqual=bi.deepDiff=void 0;var $P=Es();function qP(e,t){let r=[];return Ag(e,t,"",r,0),r}bi.deepDiff=qP;var Is=Symbol("missing"),_s=512;function Ag(e,t,r,n,i){if(e===t)return;if(i>_s)throw new RangeError(`deepDiff exceeded the maximum supported depth of ${_s}`);let a=Ts(e),o=Ts(t);if(a&&o&&Array.isArray(e)===Array.isArray(t)){let s=VP(e,t);for(let l of s){let u=wg(e,l),c=wg(t,l),d=$P.JsonPointer.append(r,l);u===Is?n.push({pointer:d,type:"added",newValue:c}):c===Is?n.push({pointer:d,type:"removed",oldValue:u}):Ag(u,c,d,n,i+1)}return}Cg(e,t)||n.push({pointer:r,type:"modified",oldValue:e,newValue:t})}function Ts(e){return e!==null&&typeof e=="object"}function VP(e,t){if(Array.isArray(e)&&Array.isArray(t)){let n=Math.max(e.length,t.length),i=[];for(let a=0;a<n;a++)i.push(String(a));return i}let r=new Set([...Object.keys(e),...Object.keys(t)]);return Array.from(r)}function wg(e,t){if(Array.isArray(e)){let r=Number(t);return r<e.length?e[r]:Is}return t in e?e[t]:Is}function Cg(e,t){return Sg(e,t,0)}bi.deepEqual=Cg;function Sg(e,t,r){if(e===t)return!0;if(r>_s)throw new RangeError(`deepEqual exceeded the maximum supported depth of ${_s}`);if(!Ts(e)||!Ts(t)||Array.isArray(e)!==Array.isArray(t))return!1;let n=Object.keys(e),i=Object.keys(t);return n.length!==i.length?!1:n.every(a=>a in t&&Sg(e[a],t[a],r+1))}});var Ng=g(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});Ps.VersionManager=void 0;var Eg=Oc(),Rc=class{constructor(t){this.workspace=t}async storeMeta(t,r,n){var i;let a=await this.getMeta(t,r),o=((i=n.snapshot)===null||i===void 0?void 0:i.status)==="Active",s=a?.everActivated===!0||o;await this.workspace.writeMeta(t,r,s?{...n,everActivated:s}:n)}async getMeta(t,r){return this.workspace.readMeta(t,r)}async isDirty(t,r){let n=await this.workspace.readArtifact(t,r);if(n===null)return!1;let i=await this.getMeta(t,r);return i?!(0,Eg.deepEqual)(i.snapshot,n):!0}async diff(t,r){let n=await this.workspace.readArtifact(t,r),i=await this.getMeta(t,r),a;return n===null?a=i?[{pointer:"",type:"removed",oldValue:i.snapshot}]:[]:i?a=(0,Eg.deepDiff)(i.snapshot,n):a=[{pointer:"",type:"added",newValue:n}],{artifactType:t,artifactId:r,changes:a}}async checkConflict(t,r,n){let i=await this.getMeta(t,r);return!i||i.etag===null?!1:i.etag!==n}};Ps.VersionManager=Rc});var Ig=g((Fc,Dg)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof Fc=="object"?Dg.exports=t():e.compareVersions=t()})(Fc,function(){var e=/^v?(?:\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+))?(?:-[\da-z\-]+(?:\.[\da-z\-]+)*)?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;function t(a,o){return a.indexOf(o)===-1?a.length:a.indexOf(o)}function r(a){var o=a.replace(/^v/,"").replace(/\+.*$/,""),s=t(o,"-"),l=o.substring(0,s).split(".");return l.push(o.substring(s+1)),l}function n(a){return isNaN(Number(a))?a:Number(a)}function i(a){if(typeof a!="string")throw new TypeError("Invalid argument expected string");if(!e.test(a))throw new Error("Invalid argument not valid semver ('"+a+"' received)")}return function(o,s){[o,s].forEach(i);for(var l=r(o),u=r(s),c=0;c<Math.max(l.length-1,u.length-1);c++){var d=parseInt(l[c]||0,10),p=parseInt(u[c]||0,10);if(d>p)return 1;if(p>d)return-1}var f=l[l.length-1],h=u[u.length-1];if(f&&h){var v=f.split(".").map(n),w=h.split(".").map(n);for(c=0;c<Math.max(v.length,w.length);c++){if(v[c]===void 0||typeof w[c]=="string"&&typeof v[c]=="number")return-1;if(w[c]===void 0||typeof v[c]=="string"&&typeof w[c]=="number"||v[c]>w[c])return 1;if(w[c]>v[c])return-1}}else if(f||h)return f?-1:1;return 0}})});var Rg=g(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.EnvironmentFlowHostingType=Ee.EnvironmentDisableReasonCode=Ee.EnvironmentMigrationConstants=Ee.EnvironmentProvisioningStates=Ee.EnvironmentLocations=Ee.EnvironmentCreationTypeConstants=Ee.EnvironmentType=Ee.EnvironmentSkuConstants=Ee.environmentPermissions=Ee.DatabaseType=void 0;var _g;(function(e){e.CommonDataService="CommonDataService",e.None="None"})(_g||(Ee.DatabaseType=_g={}));Ee.environmentPermissions={CreatePowerApp:"CreatePowerApp",ReadEnvironment:"ReadEnvironment",GenerateResourceStorage:"GenerateResourceStorage",CreateGateway:"CreateGateway",CreateFlow:"CreateFlow",CreateCustomApi:"CreateCustomApi",AdminReadEnvironment:"AdminReadEnvironment",UpdateEnvironment:"UpdateEnvironment",DeleteEnvironment:"DeleteEnvironment",ExportEnvironmentPackage:"ExportEnvironmentPackage",SetDLPPolicy:"SetDLPPolicy",ListAnyPowerApp:"ListAnyPowerApp",ListAnyFlow:"ListAnyFlow",DeleteAnyPowerApp:"DeleteAnyPowerApp",DeleteAnyFlow:"DeleteAnyFlow",AddEnvironmentRoleAssignment:"AddEnvironmentRoleAssignment",ReadEnvironmentRoleInformation:"ReadEnvironmentRoleInformation",RemoveEnvironmentRoleAssignment:"RemoveEnvironmentRoleAssignment",ModifyDatabaseRoleAssignments:"ModifyDatabaseRoleAssignments",CreateDatabase:"CreateDatabase",ListDatabaseEntities:"ListDatabaseEntities",CreateDatabaseEntities:"CreateDatabaseEntities",UpdateDatabaseEntities:"UpdateDatabaseEntities",DeleteDatabaseEntities:"DeleteDatabaseEntities"};Ee.EnvironmentSkuConstants={NotSpecified:"NotSpecified",Standard:"Standard",Premium:"Premium",Developer:"Developer",Basic:"Basic",Production:"Production",Sandbox:"Sandbox",Trial:"Trial",Default:"Default",Teams:"Teams",Platform:"Platform"};var Tg;(function(e){e[e.CDS2=0]="CDS2",e[e.CDS1=1]="CDS1",e[e.Empty=2]="Empty"})(Tg||(Ee.EnvironmentType=Tg={}));Ee.EnvironmentCreationTypeConstants={NotSpecified:"NotSpecified",Legacy:"Legacy",DefaultTenant:"DefaultTenant",User:"User",CommonDataModelLegacy:"CommonDataModelLegacy"};Ee.EnvironmentLocations={global:"global",unitedStates:"unitedstates",southamerica:"southamerica",europe:"europe",canada:"canada",preview:"unitedstatesfirstrelease",asia:"asia",japan:"japan",australia:"australia",india:"india",unitedkingdom:"unitedkingdom",france:"france",germany:"germany",brazil:"brazil",usgov:"usgov",usgovhigh:"usgovhigh",uae:"unitedarabemirates",switzerland:"switzerland",mooncake:"china",korea:"korea",norway:"norway",southafrica:"southafrica",dod:"usdod",singapore:"singapore",sweden:"sweden",italy:"italy",poland:"poland"};Ee.EnvironmentProvisioningStates={NotSpecified:"NotSpecified",Succeeded:"Succeeded",Deleting:"Deleting",Deleted:"Deleted",FailedDeleting:"FailedDeleting",LinkedDatabaseProvisioning:"LinkedDatabaseProvisioning",LinkedDatabaseFailedProvisioning:"LinkedDatabaseFailedProvisioning",LinkedDatabaseFailedConfiguring:"LinkedDatabaseFailedConfiguring",LinkedDatabaseUnavailable:"LinkedDatabaseUnavailable",Creating:"Creating"};Ee.EnvironmentMigrationConstants={phases:{completed:"Completed"}};var Pg;(function(e){e.NotSpecified="NotSpecified",e.NoValidLicense="NoValidLicense",e.SuspendedLicense="SuspendedLicense",e.TrialExpiration="TrialExpiration",e.UserRequested="UserRequested",e.InstanceStateUpdate="InstanceStateUpdated",e.InactivityThreshold="InactivityThreshold",e.OperationsInitiated="OperationsInitiated",e.EnvironmentLifecycleOperation="EnvironmentLifecycleOperation",e.TenantPolicyEvaluation="TenantPolicyEvaluation"})(Pg||(Ee.EnvironmentDisableReasonCode=Pg={}));var Og;(function(e){e.LogicApps="LogicApps",e.SelfHostSingleTenant="SelfHostSingleTenant",e.SelfHostMultiTenant="SelfHostMultiTenant"})(Og||(Ee.EnvironmentFlowHostingType=Og={}))});var $g=g(A=>{"use strict";var GP=A&&A.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(A,"__esModule",{value:!0});A.hasCommonDataServiceDatabase=A.getEnvironmentDiscoveryUrl=A.getEnvironmentWebApiUrl=A.getEnvironmentInstanceApiUrl=A.getEnvironmentLanguageCode=A.getEnvironmentUpdateCadence=A.checkVersions=A.isCds2EnvironmentVersionAtLeast=A.getSecurityOrConnectedGroupId=A.hasSecurityGroupId=A.doesCds2VersionSupportApiVersion9_1=A.doesCds2EnvironmentSupportApiVersion9_1=A.cdsVersionSupportingOSColorEdit=A.getEnvironmentDisplayName=A.getEnvironmentName=A.isEnvironmentInFirstReleaseCluster=A.isEnvironmentInPreprodCluster=A.isEnvironmentInTestCluster=A.isLiteEnvironmentUpgrading=A.isEnvironmentExpired=A.isEnvironmentInDeletedState=A.isEnvironmentInCreatingState=A.isDatabaseInProvisioningState=A.canUserCreateDatabase=A.isDisabledEnvironment=A.isDefaultEnvironment=A.isTrialEnvironment=A.isPlatformEnvironment=A.isTeamsEnvironment=A.isSandboxEnvironment=A.isProdEnvironment=A.isDevEnvironment=A.getEnvironmentType=A.getCrmInstanceName=A.getCrmInstanceUrl=A.getCrmAppDesignerUrl=A.getDevResourcesUrl=A.isEnvironmentInSuccessfulState=A.getAllThemesUrl=A.getAllPublishersUrl=A.getAllSolutionsUrl=A.getSecurityRolesUrl=A.getSecurityUsersUrl=A.environmentHasCds2Database=A.DEFAULT_SOLUTION_UNIQUE_NAME=A.DEFAULT_SOLUTION_ID=A.crmBapSolutionId=A.doesUserHavePermission=A.getLinkedEnvironmentMetadata=A.getCrmVersion=void 0;A.doesUserHaveFlowRunOnlyPermission=A.isUserPautoMakerWithoutDataAccess=A.isUserPautoMakerWithDataAccess=A.doesUserHaveCreateFlowPermission=A.equalsIgnoreCase=A.doesUserHaveCreateDatabasePermission=A.doesUserHaveDatabaseTablePermissions=A.isUserMakerWithoutDataAccess=A.isUserMakerWithDataAccess=A.doesUserHaveCreateAppPermission=A.doesUserHaveAdminPermission=void 0;var zP=GP(Ig()),ce=Rg(),Wa=Lc();function WP(e){let t=qr(e);return t&&t.version}A.getCrmVersion=WP;function qr(e){return e&&e.properties&&e.properties.linkedEnvironmentMetadata}A.getLinkedEnvironmentMetadata=qr;function $r(e,t){return e?!!e[t]:!1}A.doesUserHavePermission=$r;A.crmBapSolutionId="00000001-0000-0000-0001-00000000009b";A.DEFAULT_SOLUTION_ID="fd140aaf-4df4-11dd-bd17-0019b9312238";A.DEFAULT_SOLUTION_UNIQUE_NAME="Default";function zn(e){return!!qr(e)&&Fg(e)}A.environmentHasCds2Database=zn;function HP(e){if(e&&zn(e)){let t=fn(e);return(0,Wa.getCrmAdminSecurityRolesUrl)(t)}return""}A.getSecurityUsersUrl=HP;function jP(e){if(e&&zn(e)){let t=fn(e);return(0,Wa.getCrmAdminSecurityUsersUrl)(t)}return""}A.getSecurityRolesUrl=jP;function QP(e){if(e&&zn(e)){let t=fn(e);(0,Wa.getCrmAllSolutionsUrl)(t)}return""}A.getAllSolutionsUrl=QP;function JP(e){if(e&&zn(e)){let t=fn(e);return(0,Wa.getCrmAllPublishersUrl)(t)}return""}A.getAllPublishersUrl=JP;function KP(e){return e&&zn(e)?fn(e):""}A.getAllThemesUrl=KP;function Fg(e){return!!e&&e.properties&&!!e.properties.provisioningState&&e.properties.provisioningState.toUpperCase()===ce.EnvironmentProvisioningStates.Succeeded.toUpperCase()}A.isEnvironmentInSuccessfulState=Fg;function XP(e){if(e&&zn(e)){let t=fn(e);return(0,Wa.getCrmDevResourcesUrl)(t)}return""}A.getDevResourcesUrl=XP;function YP(e){return`${e}designer/app/{${A.crmBapSolutionId}}/CreateNewApp}}`}A.getCrmAppDesignerUrl=YP;function fn(e){let t=qr(e);if(t){let r=t.instanceUrl;return r?r.endsWith("/")?r:r+"/":""}return""}A.getCrmInstanceUrl=fn;function ZP(e){let t=qr(e);return t?t.uniqueName:""}A.getCrmInstanceName=ZP;function e1(e){return qr(e)?ce.EnvironmentType.CDS2:e&&e.properties&&e.properties.namespace?ce.EnvironmentType.CDS1:ce.EnvironmentType.Empty}A.getEnvironmentType=e1;function t1(e){return e&&e.properties&&e.properties.environmentSku===ce.EnvironmentSkuConstants.Developer}A.isDevEnvironment=t1;function r1(e){return e&&e.properties&&e.properties.environmentSku===ce.EnvironmentSkuConstants.Production}A.isProdEnvironment=r1;function n1(e){return e&&e.properties&&e.properties.environmentSku===ce.EnvironmentSkuConstants.Sandbox}A.isSandboxEnvironment=n1;function Ha(e){return e&&e.properties&&e.properties.environmentSku===ce.EnvironmentSkuConstants.Teams}A.isTeamsEnvironment=Ha;function i1(e){return e&&e.properties&&e.properties.environmentSku===ce.EnvironmentSkuConstants.Platform}A.isPlatformEnvironment=i1;var a1=e=>{var t;return((t=e.properties)===null||t===void 0?void 0:t.environmentSku)===ce.EnvironmentSkuConstants.Trial};A.isTrialEnvironment=a1;function o1(e){return e&&e.properties&&(e.properties.isDefault||e.properties.creationType===ce.EnvironmentCreationTypeConstants.DefaultTenant)}A.isDefaultEnvironment=o1;function s1(e){return e&&e.properties&&!!e.properties.states&&!!e.properties.states.runtime&&e.properties.states.runtime.id==="Disabled"}A.isDisabledEnvironment=s1;function l1(e){return e&&e.properties&&$r(e.properties.permissions,ce.environmentPermissions.CreateDatabase)}A.canUserCreateDatabase=l1;function u1(e){return!!(e&&e.properties&&e.properties.provisioningState&&Ug(e.properties.provisioningState,ce.EnvironmentProvisioningStates.LinkedDatabaseProvisioning))}A.isDatabaseInProvisioningState=u1;function c1(e){return!!e&&!!e.properties&&e.properties.provisioningState===ce.EnvironmentProvisioningStates.Creating}A.isEnvironmentInCreatingState=c1;function d1(e){return e&&e.properties&&(e.properties.provisioningState===ce.EnvironmentProvisioningStates.Deleted||e.properties.provisioningState===ce.EnvironmentProvisioningStates.Deleting||e.properties.provisioningState===ce.EnvironmentProvisioningStates.FailedDeleting)}A.isEnvironmentInDeletedState=d1;function p1(e){return!!e&&!!e.properties&&!!e.properties.expirationTime&&Date.parse(e.properties.expirationTime)<Date.now()}A.isEnvironmentExpired=p1;function f1(e){return!!e&&!!e.properties&&!!e.properties.linkedEnvironmentMetadata&&e.properties.linkedEnvironmentMetadata.platformSku==="Lite"&&!!e.properties.states&&!!e.properties.states.management&&e.properties.states.management.id==="Running"&&!!e.properties.ongoingOperation&&!!e.properties.ongoingOperation.type&&e.properties.ongoingOperation.type.id==="Promote"}A.isLiteEnvironmentUpgrading=f1;function m1(e){return!!e&&!!e.properties&&!!e.properties.cluster&&e.properties.cluster.category==="Test"}A.isEnvironmentInTestCluster=m1;function h1(e){return!!e&&!!e.properties&&!!e.properties.cluster&&e.properties.cluster.category==="Preprod"}A.isEnvironmentInPreprodCluster=h1;function g1(e){return!!e&&!!e.properties&&!!e.properties.cluster&&e.properties.cluster.category==="FirstRelease"}A.isEnvironmentInFirstReleaseCluster=g1;function v1(e){return e&&e.name||""}A.getEnvironmentName=v1;function y1(e){return e&&e.properties&&e.properties.displayName||""}A.getEnvironmentDisplayName=y1;var xg="9.1.0.8202";A.cdsVersionSupportingOSColorEdit="9.1.0000.20708";function b1(e){return Mg(e,xg)}A.doesCds2EnvironmentSupportApiVersion9_1=b1;function w1(e){return xc(e,xg)}A.doesCds2VersionSupportApiVersion9_1=w1;function Lg(e){let t=qr(e);if(t)return t.securityGroupId}function kg(e){return e&&e.properties&&e.properties.connectedGroups}function A1(e,t){let r=kg(e);return!!r&&!!r.find(n=>n.id===t)||Lg(e)===t}A.hasSecurityGroupId=A1;function C1(e){let t=kg(e);return t&&t.length>0&&t[0].id?t[0].id:Lg(e)}A.getSecurityOrConnectedGroupId=C1;function Mg(e,t){let r=e.version;return r?xc(r,t):!1}A.isCds2EnvironmentVersionAtLeast=Mg;function xc(e,t){return t?e?(0,zP.default)(e,t)>=0:!1:!0}A.checkVersions=xc;function S1(e){return e&&e.properties&&e.properties.updateCadence&&e.properties.updateCadence.id||"NotSpecified"}A.getEnvironmentUpdateCadence=S1;function E1(e){let t=qr(e);return t?Number(t.baseLanguage):0}A.getEnvironmentLanguageCode=E1;function Bg(e){let t=qr(e);return t?t.instanceApiUrl:void 0}A.getEnvironmentInstanceApiUrl=Bg;function N1(e){let t=Bg(e);return t?t+"/api/data/v9.2":""}A.getEnvironmentWebApiUrl=N1;function D1(e){let t=fn(e);if(t==="")return"";let r=t.split("/");if(r.length!==4)return"";let n=r[2].split(".");return n[0]="globaldisco",r[2]=n.join("."),r.join("/")+"api/discovery/v2.0/Instances"}A.getEnvironmentDiscoveryUrl=D1;var I1=e=>{var t;return((t=e.properties)===null||t===void 0?void 0:t.databaseType)===ce.DatabaseType.CommonDataService};A.hasCommonDataServiceDatabase=I1;var _1=e=>{var t;return $r((t=e.properties)===null||t===void 0?void 0:t.permissions,ce.environmentPermissions.AdminReadEnvironment)};A.doesUserHaveAdminPermission=_1;var T1=e=>{var t;return $r((t=e.properties)===null||t===void 0?void 0:t.permissions,ce.environmentPermissions.CreatePowerApp)};A.doesUserHaveCreateAppPermission=T1;var P1=e=>(0,A.doesUserHaveAdminPermission)(e)&&(0,A.hasCommonDataServiceDatabase)(e)?!0:(0,A.doesUserHaveCreateAppPermission)(e)?Ha(e)||(0,A.doesUserHaveDatabaseTablePermissions)(e):!1;A.isUserMakerWithDataAccess=P1;var O1=e=>(0,A.doesUserHaveCreateAppPermission)(e)&&!Ha(e)&&!(0,A.doesUserHaveDatabaseTablePermissions)(e)&&(!(0,A.doesUserHaveAdminPermission)(e)||!(0,A.hasCommonDataServiceDatabase)(e));A.isUserMakerWithoutDataAccess=O1;var R1=e=>[ce.environmentPermissions.CreateDatabaseEntities,ce.environmentPermissions.ListDatabaseEntities,ce.environmentPermissions.UpdateDatabaseEntities,ce.environmentPermissions.DeleteDatabaseEntities].every(t=>{var r;return $r((r=e.properties)===null||r===void 0?void 0:r.permissions,t)});A.doesUserHaveDatabaseTablePermissions=R1;var F1=e=>{var t;return $r((t=e.properties)===null||t===void 0?void 0:t.permissions,ce.environmentPermissions.CreateDatabase)};A.doesUserHaveCreateDatabasePermission=F1;function Ug(e,t){return!e&&!t?!0:!e||!t?!1:e.toUpperCase()===t.toUpperCase()}A.equalsIgnoreCase=Ug;var x1=e=>{var t;return $r((t=e.properties)===null||t===void 0?void 0:t.permissions,ce.environmentPermissions.CreateFlow)};A.doesUserHaveCreateFlowPermission=x1;var L1=e=>(0,A.doesUserHaveAdminPermission)(e)&&(0,A.hasCommonDataServiceDatabase)(e)?!0:(0,A.doesUserHaveCreateFlowPermission)(e)?Ha(e)||(0,A.doesUserHaveDatabaseTablePermissions)(e):!1;A.isUserPautoMakerWithDataAccess=L1;var k1=e=>(0,A.doesUserHaveCreateFlowPermission)(e)&&!Ha(e)&&!(0,A.doesUserHaveDatabaseTablePermissions)(e)&&(!(0,A.doesUserHaveAdminPermission)(e)||!(0,A.hasCommonDataServiceDatabase)(e));A.isUserPautoMakerWithoutDataAccess=k1;var M1=e=>{var t,r;return!$r((t=e.properties)===null||t===void 0?void 0:t.permissions,ce.environmentPermissions.CreateFlow)&&$r((r=e.properties)===null||r===void 0?void 0:r.permissions,ce.environmentPermissions.ReadEnvironment)};A.doesUserHaveFlowRunOnlyPermission=M1});var Lc=g(b=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0});b.getRequiredComponentsQueryUrl=b.solutionComponentCountSummariesQueryUrl=b.solutionComponentSummariesQueryUrl=b.solutionComponentConfigurationsQueryUrl=b.chartsQueryUrl=b.workflowsQueryUrl=b.entityDefinitionsQueryUrl=b.solutionComponentDefinitionsQueryUrl=b.getCreateNewArticleTemplateUrl=b.getCreateNewPublisherUrl=b.getEnableSecurityRolesUrl=b.getArticleTemplateUrl=b.getFieldSecurityProfileDesignerUrl=b.getSecurityRoleDesignerUrl=b.getMailMergeTemplateDesignerUrl=b.getEmailTemplateDesignerUrl=b.getConnectionRoleDesignerUrl=b.getSiteMapDesignerUrl=b.getWebResourceFileUrl=b.getWebResourceDesignerUrl=b.getReportDesignerUrl=b.getBusinessProcessFlowDesignerUrl=b.getProcessShareUrl=b.getProcessDesignerUrl=b.getChartDesignerUrl=b.getOpenModernEntityDashboardUrl=b.getNewModernEntityDashboardUrl=b.getNewModernDashboardUrl=b.getOpenModernDashboardUrl=b.getDashboardDesignerUrl=b.getAppModuleDesignerUrl=b.privilegesQueryUrls=b.xrmApiUrl=b.getPlayAppModuleUrl=b.getCrmAdminSecurityUsersUrl=b.getCrmAdminSecurityRolesUrl=b.getCrmMyAppsUrl=b.getCrmAppDesignerUrl=b.getCrmDevResourcesUrl=b.getCrmAllPublishersUrl=b.getCrmAllSolutionsUrl=b.getSolutionPublisherUrl=b.getExportTranslationFileName=b.getExportSolutionTranslationUrl=b.getImportSolutionTranslationUrl=b.getShowSolutionDependenciesUrl=b.getShowComponentDependenciesUrl=b.cdsServiceUrl=b.ODATA_NEXT_LINK=b.ODATA_MAX_PAGE_SIZE=void 0;b.retrieveOrganizationResources=b.getUCIEntityRecordEditUrl=b.getUCIEntityRecordBaseUrl=b.getBusinessRuleDesignerUri=b.retrieveUnpublishedSuffix=b.getSavePowerSettingUri=b.getPowerSettingUri=b.getPowerSettingsUri=b.RetrievePlatform=b.getAppSettingOverrideUri=b.AppSettingOverrideName=b.getOrgSettingOverrideUri=b.OrgSettingOverrideName=b.getSettingDefinitionsUri=b.retrieveFeatureControlSettingsByNamespaceUrl=b.retrieveDeploymentPipelineConfigAppUrl=b.SPNPrincipalIdUrl=b.retrieveDeploymentEnvironmentInfoUrl=b.devSolutionInfoUrl=b.deployOperationStatusUrl=b.getAIGeneratedDeploymentNotesUrl=b.deploymentStageRunUrl=b.validatePackageAsyncUrl=b.deployPackageAsyncUrl=b.updateDeploymentStageRunUrl=b.createDeploymentStageRunUrl=b.retrieveDeploymentStagesUrl=b.retrievePipelinesUrl=b.retrieveDeploymentPipelineInfoUrl=b.getDeploymentStageRunsUrl=b.appDeploymentUrls=b.getProvisionLanguageUrl=b.getSolutionQueryUrl=b.getSolutionsByUniqueNameQueryUrl=b.solutionsQueryUrl=b.getDependentComponentsWithMetadataQueryUrl=void 0;var qg=$g();b.ODATA_MAX_PAGE_SIZE="odata.maxpagesize";b.ODATA_NEXT_LINK="@odata.nextLink";b.cdsServiceUrl="https://cds-org/";var Qa;(function(e){e.AllSolutions="11",e.AllPublishers="10",e.DevResources="05"})(Qa||(Qa={}));function B1(e,t,r,n){return`${e}tools/dependency/dependencyviewdialog.aspx?appSolutionId=%7b${t}%7d&dType=1&objectid=%7b${r}%7d&objecttype=${n}&operationtype=showdependency`}b.getShowComponentDependenciesUrl=B1;function U1(e,t){let r=`dType=1&isproactivecheck=true&objecttype=7100&operationtype=dependenciesforuninstall&objectid=${t}`;return`${e}tools/dependency/dependencyviewdialog.aspx?${r}`}b.getShowSolutionDependenciesUrl=U1;function $1(e,t){return`${e}tools/muiProvisioning/Dialogs/LangTranslationsImport.aspx?dType=1&appSolutionId=${t}`}b.getImportSolutionTranslationUrl=$1;function q1(e,t){return`${e}_grid/cmds/dlg_exportsolution.aspx?command=exporttranslation&appSolutionId=${t}`}b.getExportSolutionTranslationUrl=q1;function V1(e,t){return e!==void 0&&t!==void 0&&`CrmTranslations_${e}_${t.replace(/[.]/g,"_")}.zip`||""}b.getExportTranslationFileName=V1;function G1(e,t,r){return r?`${e}tools/publisher/edit.aspx?appSolutionId=%7b${r}%7d&id=%7b${t}%7d`:`${e}tools/publisher/edit.aspx?id=%7b${t}%7d`}b.getSolutionPublisherUrl=G1;function kc(e,t){return`${e}tools/systemcustomization/systemCustomization.aspx?pid=${t}`}function z1(e){return kc(e,Qa.AllSolutions)}b.getCrmAllSolutionsUrl=z1;function W1(e){return kc(e,Qa.AllPublishers)}b.getCrmAllPublishersUrl=W1;function H1(e){return kc(e,Qa.DevResources)}b.getCrmDevResourcesUrl=H1;function j1(e,t=qg.crmBapSolutionId){return`${e}designer/app/${t}#/CreateNewApp`}b.getCrmAppDesignerUrl=j1;function Q1(e){return`${e}apps`}b.getCrmMyAppsUrl=Q1;function J1(e){return Vg(e,"role")+"&forceUCI=0"}b.getCrmAdminSecurityRolesUrl=J1;function K1(e){return`${Vg(e,"systemuser")}&forceclassic=1`}b.getCrmAdminSecurityUsersUrl=K1;function Vg(e,t){return`${e}main.aspx?pagetype=entitylist&etn=${t}`}function X1(e,t){return`${e}main.aspx?appid=${t}`}b.getPlayAppModuleUrl=X1;b.xrmApiUrl="api/data/v9.0";b.privilegesQueryUrls={systemUserInfo:e=>`${e}${b.xrmApiUrl}/WhoAmI`,userPrivileges:(e,t)=>`${e}${b.xrmApiUrl}/systemusers(${t})/Microsoft.Dynamics.CRM.RetrieveUserPrivileges`,systemPrivileges:e=>`${e}${b.xrmApiUrl}/privileges/Microsoft.Dynamics.CRM.RetrievePrivilegeSet`};function Y1(e,t,r=qg.crmBapSolutionId){return`${e}designer/app/${r}/${t}/AppDesignerCanvas/${t}`}b.getAppModuleDesignerUrl=Y1;function Z1(e,t,r,n){return`${e}main.aspx?appSolutionId=%7b${r}%7d&extraqs=%26formId%3d%7b${t}%7d%26dashboardType%3d1030&pagetype=${`${n?"ic":""}dashboardeditor`}`}b.getDashboardDesignerUrl=Z1;function eO(e,t,r){return`/e/${e}/s/${t}/dashboard/${r}`}b.getOpenModernDashboardUrl=eO;function tO(e,t,r){let n=r!==void 0?r.toString():void 0;return`/e/${e}/s/${t}/dashboard/new${n?`/${n}`:""}`}b.getNewModernDashboardUrl=tO;function rO(e,t,r,n){let i=n!==void 0?n.toString():void 0;return`/e/${e}/s/${t}/n/${r}/dashboard/new${i?`/${i}`:""}`}b.getNewModernEntityDashboardUrl=rO;function nO(e,t,r,n){return`/e/${e}/s/${t}/n/${r}/dashboard/${n}`}b.getOpenModernEntityDashboardUrl=nO;function iO(e,t,r,n){return`${e}main.aspx?appSolutionId=%7b${t}%7d&extraqs=etc=${r||""}`+(n?`%26id=${n}`:"")+"&pagetype=vizdesigner"}b.getChartDesignerUrl=iO;function aO(e,t,r){return`${e}sfa/workflow/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}b.getProcessDesignerUrl=aO;function oO(e,t,r){return`${e}sfa/workflow/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}b.getProcessShareUrl=oO;function sO(e,t){return`${e}Tools/ProcessControl/UnifiedProcessDesigner.aspx?id=${t}`}b.getBusinessProcessFlowDesignerUrl=sO;function lO(e,t,r){return`${e}CRMReports/reportproperty.aspx?appSolutionId=%7b${r}%7d&disablePersonal=true&id=%7b${t}%7d`}b.getReportDesignerUrl=lO;function uO(e,t,r){return`${e}main.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&etc=9333&id=%7b${t}%7d&pagetype=webresourceedit`}b.getWebResourceDesignerUrl=uO;function cO(e,t){return`${e}WebResources/${t}`}b.getWebResourceFileUrl=cO;function dO(e,t,r){return`${e}designer/sitemap/${r}/${t}/SiteMapHome/${t}`}b.getSiteMapDesignerUrl=dO;function pO(e,t,r){return`${e}connections/connectionroles/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}b.getConnectionRoleDesignerUrl=pO;function fO(e,t,r){return`${e}tools/emailtemplateeditor/emailtemplateeditor.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}b.getEmailTemplateDesignerUrl=fO;function mO(e,t,r){return`${e}tools/mailmerge/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}b.getMailMergeTemplateDesignerUrl=mO;function hO(e,t,r){return`${e}biz/roles/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}b.getSecurityRoleDesignerUrl=hO;function gO(e,t,r){return`${e}biz/fieldsecurityprofiles/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}b.getFieldSecurityProfileDesignerUrl=gO;function vO(e,t,r){return`${e}tools/kbtemplateeditor/kbtemplateeditor.aspx?_CreateFromId=%7b${t}%7d&_CreateFromType=7100&appSolutionId=%7b${t}%7d&id=%7b${r}%7d`}b.getArticleTemplateUrl=vO;function yO(e,t,r,n){return`${e}tools/FormEditor/Dialogs/FormRoleAssignment.aspx?appSolutionId=%7b${t}%7d&dType=1&formId=%7b${r}%7d&objectTypeCode=0&type=${n}`}b.getEnableSecurityRolesUrl=yO;function bO(e){return`${e}tools/publisher/edit.aspx`}b.getCreateNewPublisherUrl=bO;function wO(e,t){return`${e}tools/kbtemplateeditor/kbtemplateeditor.aspx?appSolutionId=${t}`}b.getCreateNewArticleTemplateUrl=wO;b.solutionComponentDefinitionsQueryUrl="api/data/v9.0/solutioncomponentdefinitions";b.entityDefinitionsQueryUrl="api/data/v9.0/EntityDefinitions?$select=EntitySetName,DisplayName,LogicalName&$filter=";b.workflowsQueryUrl="api/data/v9.0/workflows";b.chartsQueryUrl="/api/data/v9.0/savedqueryvisualizations";b.solutionComponentConfigurationsQueryUrl="/api/data/v9.1/solutioncomponentconfigurations?$filter=isdisplayable eq true&$select=name";b.solutionComponentSummariesQueryUrl="/api/data/v9.0/msdyn_solutioncomponentsummaries";b.solutionComponentCountSummariesQueryUrl="/api/data/v9.0/msdyn_solutioncomponentcountsummaries";function AO(e,t){return`${b.xrmApiUrl}/RetrieveRequiredComponents(ObjectId=${e},ComponentType=${t})`}b.getRequiredComponentsQueryUrl=AO;function CO(e,t){return`${b.cdsServiceUrl}${b.xrmApiUrl}/RetrieveDependentComponentsWithMetadata(ObjectId=${e},ComponentType=${t})`}b.getDependentComponentsWithMetadataQueryUrl=CO;b.solutionsQueryUrl="/api/data/v9.0/solutions?$expand=publisherid&$filter=(isvisible eq true)";function SO(e){return`/api/data/v9.0/solutions?$expand=publisherid&$filter=(uniquename eq '${e}')`}b.getSolutionsByUniqueNameQueryUrl=SO;function EO(e){return`/api/data/v9.0/solutions(${e})?$expand=publisherid`}b.getSolutionQueryUrl=EO;function NO(e){return`${e}api/data/v9.1/ProvisionLanguageForUser`}b.getProvisionLanguageUrl=NO;b.appDeploymentUrls={associateEnvironmentToPipelineUrl:e=>`/api/data/v9.0/deploymentpipelines(${e})/deploymentpipeline_deploymentenvironment/$ref`,deploymentArtifactsUrl:"/api/data/v9.0/deploymentartifacts",deploymentEnvironmentUrl:"/api/data/v9.0/deploymentenvironments",deploymentPipelinesUrl:"/api/data/v9.0/deploymentpipelines",deploymentStagesUrl:"/api/data/v9.0/deploymentstages",retrieveDeploymentPipelinesUrl:e=>`/api/data/v9.0/RetrieveDeploymentPipelines(SourceEnvironmentId='${e}')`,deletePipelinesUrl:e=>`/api/data/v9.0/deploymentpipelines(${e})`};function DO(e,t,r,n=!1,i=!1,a=!1,o=!1,s=!1,l=!1,u=!1){return`/api/data/v9.1/deploymentstageruns
?$select=artifactname,artifactversion,deploymentstagerunid,devenvironmentid,endtime,errormessage,${s?"_artifactid_value,isredeployment,":""}${n?"deploymentnotes,":""}operation,operationdetails,operationstatus,${l?"retrycount,":""}${i?"scheduledtime,":""}${u?"solutionid,":""}stagerunstatus,starttime,suboperation,targetenvironmentid,${a?"predeploymentstepnotes,":""}validationresults,${o?"approvalcomments,":""}_devdeploymentenvironment_value,_targetdeploymentenvironment_value
&$expand=deploymentstageid($select=deploymentstageid,name,_deploymentpipelineid_value),targetdeploymentenvironment($select=deploymentenvironmentid,environmentid,name),createdby($select=azureactivedirectoryobjectid,fullname,ownerid,systemuserid)${l?",RetryUser($select=azureactivedirectoryobjectid,fullname,ownerid,systemuserid)":""}
&$filter=deploymentstageid/_deploymentpipelineid_value eq ${e} and devenvironmentid eq '${t}' and artifactname eq '${r}' and ((operation ne 200000201) or (operation eq 200000201 and operationstatus eq 200000003))
- &$orderby=starttime desc`}b.getDeploymentStageRunsUrl=QF;function JF(e,t,r){return`/api/data/v9.1/RetrieveDeploymentPipelineInfo(DeploymentPipelineId=${e},SourceEnvironmentId='${t}',ArtifactName='${r}')`}b.retrieveDeploymentPipelineInfoUrl=JF;function XF(e){return`/api/data/v9.0/deploymentenvironments
+ &$orderby=starttime desc`}b.getDeploymentStageRunsUrl=DO;function IO(e,t,r){return`/api/data/v9.1/RetrieveDeploymentPipelineInfo(DeploymentPipelineId=${e},SourceEnvironmentId='${t}',ArtifactName='${r}')`}b.retrieveDeploymentPipelineInfoUrl=IO;function _O(e){return`/api/data/v9.0/deploymentenvironments
?$select=deploymentenvironmentid,environmentid,environmenttype,name
&$expand=deploymentpipeline_deploymentenvironment($select=name,description,deploymentpipelineid;$orderby=name asc)
- &$filter=(environmentid eq '${e}')`}b.retrievePipelinesUrl=XF;function KF(e){return`/api/data/v9.0/deploymentstages
+ &$filter=(environmentid eq '${e}')`}b.retrievePipelinesUrl=_O;function TO(e){return`/api/data/v9.0/deploymentstages
?$filter=(_deploymentpipelineid_value eq ${e})
&$select=name,description,deploymentstageid,_previousdeploymentstageid_value
- &$expand=targetdeploymentenvironmentid($select=deploymentenvironmentid,environmentid,name)`}b.retrieveDeploymentStagesUrl=KF;function YF(){return"/api/data/v9.0/deploymentstageruns?$select=deploymentstagerunid"}b.createDeploymentStageRunUrl=YF;function ZF(e){return`/api/data/v9.0/deploymentstageruns(${e})`}b.updateDeploymentStageRunUrl=ZF;function ex(){return"/api/data/v9.0/DeployPackageAsync"}b.deployPackageAsyncUrl=ex;function tx(){return"/api/data/v9.0/ValidatePackageAsync"}b.validatePackageAsyncUrl=tx;function rx(e,t=!1,r=!1){return`/api/data/v9.0/deploymentstageruns(${e})
- ?$select=deploymentstagerunid,stagerunstatus,errormessage,operation,operationdetails,operationstatus,${t?"scheduledtime,":""}targetenvironmentid,validationresults,artifactname,deploymentsettingsjson${r?"&$expand=createdby($select=azureactivedirectoryobjectid,fullname,ownerid,systemuserid)":""}`}b.deploymentStageRunUrl=rx;function nx(e){return`/api/data/v9.0/deploymentstageruns(${e})
- ?$select=aigenerateddeploymentnotes,deploymentstagerunid`}b.getAIGeneratedDeploymentNotesUrl=nx;function ix(e){let t="";for(let r=0;r<e.length;r++)r===e.length-1?t=t.concat(`deploymentstagerunid eq ${e[r]}`):t=t.concat(`deploymentstagerunid eq ${e[r]} or `);return`/api/data/v9.0/deploymentstageruns
+ &$expand=targetdeploymentenvironmentid($select=deploymentenvironmentid,environmentid,name)`}b.retrieveDeploymentStagesUrl=TO;function PO(){return"/api/data/v9.0/deploymentstageruns?$select=deploymentstagerunid"}b.createDeploymentStageRunUrl=PO;function OO(e){return`/api/data/v9.0/deploymentstageruns(${e})`}b.updateDeploymentStageRunUrl=OO;function RO(){return"/api/data/v9.0/DeployPackageAsync"}b.deployPackageAsyncUrl=RO;function FO(){return"/api/data/v9.0/ValidatePackageAsync"}b.validatePackageAsyncUrl=FO;function xO(e,t=!1,r=!1){return`/api/data/v9.0/deploymentstageruns(${e})
+ ?$select=deploymentstagerunid,stagerunstatus,errormessage,operation,operationdetails,operationstatus,${t?"scheduledtime,":""}targetenvironmentid,validationresults,artifactname,deploymentsettingsjson${r?"&$expand=createdby($select=azureactivedirectoryobjectid,fullname,ownerid,systemuserid)":""}`}b.deploymentStageRunUrl=xO;function LO(e){return`/api/data/v9.0/deploymentstageruns(${e})
+ ?$select=aigenerateddeploymentnotes,deploymentstagerunid`}b.getAIGeneratedDeploymentNotesUrl=LO;function kO(e){let t="";for(let r=0;r<e.length;r++)r===e.length-1?t=t.concat(`deploymentstagerunid eq ${e[r]}`):t=t.concat(`deploymentstagerunid eq ${e[r]} or `);return`/api/data/v9.0/deploymentstageruns
?$filter=(${t})
- &$select=_deploymentstageid_value,deploymentstagerunid,stagerunstatus,operation,operationstatus,suboperation,artifactname`}b.deployOperationStatusUrl=ix;function ax(e){return`/api/data/v9.0/solutions(${e})
- ?$select=solutionid,uniquename,version`}b.devSolutionInfoUrl=ax;function ox(e){return`/api/data/v9.0/deploymentenvironments
+ &$select=_deploymentstageid_value,deploymentstagerunid,stagerunstatus,operation,operationstatus,suboperation,artifactname`}b.deployOperationStatusUrl=kO;function MO(e){return`/api/data/v9.0/solutions(${e})
+ ?$select=solutionid,uniquename,version`}b.devSolutionInfoUrl=MO;function BO(e){return`/api/data/v9.0/deploymentenvironments
?$select=deploymentenvironmentid,environmentid,environmenttype,name
- &$filter=(environmentid eq '${e}')`}b.retrieveDeploymentEnvironmentInfoUrl=ox;var sx=e=>`/api/data/v9.0/systemusers
+ &$filter=(environmentid eq '${e}')`}b.retrieveDeploymentEnvironmentInfoUrl=BO;var UO=e=>`/api/data/v9.0/systemusers
?$select=azureactivedirectoryobjectid
- &$filter=(applicationid eq '${e}')`;b.SPNPrincipalIdUrl=sx;function lx(){return"/api/data/v9.0/appmodules?$filter=(uniquename eq 'AppDeploymentConfiguration')"}b.retrieveDeploymentPipelineConfigAppUrl=lx;b.retrieveFeatureControlSettingsByNamespaceUrl="/api/data/v9.1/RetrieveFeatureControlSettingsByNamespace";function ux(e){return`/api/data/v9.0/settingdefinitions${e}`}b.getSettingDefinitionsUri=ux;b.OrgSettingOverrideName="organizationsettings";function cx(e,t=!1){let r=`/api/data/v9.0/${b.OrgSettingOverrideName}${e}`;return t?`${b.cdsServiceUrl}${r}`:r}b.getOrgSettingOverrideUri=cx;b.AppSettingOverrideName="appsettings";function dx(e,t=!1){let r=`/api/data/v9.0/${b.AppSettingOverrideName}${e}`;return t?`${b.cdsServiceUrl.replace("/$","")}${r}`:r}b.getAppSettingOverrideUri=dx;var Ka;(function(e){e[e.All=0]="All",e[e.IsPlatformOnly=1]="IsPlatformOnly",e[e.NotPlatformOnly=2]="NotPlatformOnly"})(Ka||(b.RetrievePlatform=Ka={}));function px(e,t,r,n=Ka.All,i=!1){let a=[];e&&a.push(`AppUniqueName='${e}'`),t!=null&&a.push(`ReleaseLevel=${t}`),r&&a.push(`RetrieveHiddenSettings=${r}`),n!==Ka.All&&a.push(`RetrievePlatformSettings=${n===Ka.IsPlatformOnly?1:0}`);let o="/api/data/v9.0/RetrieveUnpublishedOverridableSettingsInfo";return a.length&&(o=`${o}(${a.join(",")})`),i?`${b.cdsServiceUrl}${o}`:o}b.getPowerSettingsUri=px;function fx(e,t,r,n=!1){let i=[`SettingName='${e}'`];t!==void 0&&i.push(`SolutionName='${t}'`),r!==void 0&&i.push(`AppUniqueName='${r}'`);let a="/api/data/v9.0/RetrieveUnpublishedSettingInfo";return i.length&&(a=`${a}(${i.join(",")})`),n?`${b.cdsServiceUrl}${a}`:a}b.getPowerSettingUri=fx;function mx(e=!1){let t="/api/data/v9.0/SaveSettingValue()";return e?`${b.cdsServiceUrl}${t}`:t}b.getSavePowerSettingUri=mx;b.retrieveUnpublishedSuffix="Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()";function hx(e){return`tools/systemcustomization/businessrules/businessRulesDesigner.aspx?BRlaunchpoint=BRGrid&appSolutionId={${e}}`}b.getBusinessRuleDesignerUri=hx;function zv({environmentInstanceUrl:e,entityLogicalName:t}){return e&&t?`${e}main.aspx?cmdbar=true&forceUCI=1&navbar=off&newWindow=true&pageType=entityRecord&etn=${t}`:void 0}b.getUCIEntityRecordBaseUrl=zv;function gx({baseUrl:e,environmentInstanceUrl:t,entityLogicalName:r,recordId:n}){let i=e||zv({environmentInstanceUrl:t,entityLogicalName:r});return i&&n?`${i}&id=${n}`:void 0}b.getUCIEntityRecordEditUrl=gx;b.retrieveOrganizationResources=`${b.cdsServiceUrl}api/data/v9.0/RetrieveOrganizationResources`});var Wv=g(zs=>{"use strict";Object.defineProperty(zs,"__esModule",{value:!0});zs.DataverseClient=void 0;var vx=Pd(),Vn=ie(),Od=class{constructor(t,r,n){this.instanceUrl=t,this.httpClient=r,this.solutionUniqueName=n}withSolution(t){return this.solutionUniqueName?{...t,headers:{...t?.headers,"MSCRM.SolutionUniqueName":this.solutionUniqueName}}:t}apiUrl(t){let r=this.instanceUrl.replace(/\/+$/,""),n=t.startsWith("/")?t:`/${t}`;return`${r}/${vx.xrmApiUrl}${n}`}async send(t,r){try{return await r()}catch(n){throw n instanceof Vn.SdkError?n:new Vn.ConnectionError(t,0,n instanceof Error?n.message:String(n),n)}}get(t,r){let n=this.apiUrl(t);return this.send(n,()=>this.httpClient.get(n,r))}getAbsolute(t,r){return this.assertSameOrigin(t),this.send(t,()=>this.httpClient.get(t,r))}assertSameOrigin(t){let r,n;try{r=new URL(t),n=new URL(this.instanceUrl)}catch{throw new Vn.InvalidArgumentError(`Refusing to follow a malformed absolute URL: '${t}'`)}if(r.protocol!==n.protocol||r.host!==n.host)throw new Vn.InvalidArgumentError(`Refusing to follow a cross-origin link ('${r.origin}' is not the configured instance '${n.origin}'); server-driven pagination must stay on-instance.`)}post(t,r,n){let i=this.apiUrl(t);return this.send(i,()=>this.httpClient.post(i,r,this.withSolution(n)))}get supportsAtomicBatch(){return typeof this.httpClient.postRaw=="function"}get solutionName(){return this.solutionUniqueName}postBatch(t,r,n){if(!this.httpClient.postRaw)throw new Vn.InvalidArgumentError("The injected HttpClient does not implement postRaw(), required for atomic $batch change sets");let i=this.apiUrl("/$batch"),a={...n,headers:{...n?.headers,"Content-Type":`multipart/mixed;boundary=${r}`}};return this.send(i,()=>this.httpClient.postRaw(i,t,a))}patch(t,r,n){let i=this.apiUrl(t);return this.send(i,()=>this.httpClient.patch(i,r,this.withSolution(n)))}get supportsBinaryPatch(){return typeof this.httpClient.patchRaw=="function"}patchRaw(t,r,n){if(!this.httpClient.patchRaw)throw new Vn.InvalidArgumentError("The injected HttpClient does not implement patchRaw(), required to upload file content (a Dataverse File column cannot be written through a JSON body)");let i=this.apiUrl(t);return this.send(i,()=>this.httpClient.patchRaw(i,r,this.withSolution(n)))}put(t,r,n){if(!this.httpClient.put)throw new Vn.InvalidArgumentError("The injected HttpClient does not implement put(), required for metadata replace operations (e.g. updateColumn)");let i=this.apiUrl(t);return this.send(i,()=>this.httpClient.put(i,r,this.withSolution(n)))}delete(t,r){let n=this.apiUrl(t);return this.send(n,()=>this.httpClient.delete(n,this.withSolution(r)))}};zs.DataverseClient=Od});var jv=g(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.findColumns=dn.findTables=dn.fetchEntityMetadataFromApi=void 0;var Rd=be(),pr=ee();function Za(e){var t,r;return(r=(t=e?.UserLocalizedLabel)===null||t===void 0?void 0:t.Label)!==null&&r!==void 0?r:""}function Si(e){let t=e?.LocalizedLabels;if(!Array.isArray(t)||t.length<2)return;let r={};for(let n of t)typeof n?.LanguageCode=="number"&&typeof n.Label=="string"&&(r[n.LanguageCode]=n.Label);return Object.keys(r).length?r:void 0}async function Ei(e,t){var r,n;let i=await e.get(t);return i.status<200||i.status>=300?[]:(n=(r=i.body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[]}function cn(e){return`/EntityDefinitions(LogicalName='${(0,pr.odataLiteral)(e)}')`}async function yx(e,t,r){let n=await Ei(e,`${cn(t)}/Attributes/Microsoft.Dynamics.CRM.StringAttributeMetadata${(0,pr.odataQuery)([["$select","LogicalName,MaxLength"]])}`);for(let i of n){let a=r.get(i.LogicalName);a&&typeof i.MaxLength=="number"&&(a.maxLength=i.MaxLength)}}async function bx(e,t,r){var n;let i=await Ei(e,`${cn(t)}/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata${(0,pr.odataQuery)([["$select","LogicalName"],["$expand","OptionSet($select=Options)"]])}`);for(let a of i){let o=r.get(a.LogicalName);o&&(!((n=a.OptionSet)===null||n===void 0)&&n.Options)&&(o.options=a.OptionSet.Options.map(s=>{var l;return{value:(l=s.Value)!==null&&l!==void 0?l:0,label:Za(s.Label),...Si(s.Label)?{localizedLabel:Si(s.Label)}:{}}}))}}async function wx(e,t,r){let n=await Ei(e,`${cn(t)}/Attributes/Microsoft.Dynamics.CRM.LookupAttributeMetadata${(0,pr.odataQuery)([["$select","LogicalName,Targets"]])}`);for(let i of n){let a=r.get(i.LogicalName);a&&i.Targets&&(a.targets=i.Targets)}}async function Ax(e,t){var r,n,i,a;let o=[],s=await Ei(e,`${cn(t)}/OneToManyRelationships${(0,pr.odataQuery)([["$select","SchemaName,ReferencingEntity,ReferencingAttribute"]])}`);for(let c of s)o.push({schemaName:c.SchemaName,type:"OneToMany",relatedEntity:(r=c.ReferencingEntity)!==null&&r!==void 0?r:"",relatedAttribute:(n=c.ReferencingAttribute)!==null&&n!==void 0?n:""});let l=await Ei(e,`${cn(t)}/ManyToOneRelationships${(0,pr.odataQuery)([["$select","SchemaName,ReferencedEntity,ReferencedAttribute"]])}`);for(let c of l)o.push({schemaName:c.SchemaName,type:"ManyToOne",relatedEntity:(i=c.ReferencedEntity)!==null&&i!==void 0?i:"",relatedAttribute:(a=c.ReferencedAttribute)!==null&&a!==void 0?a:""});let u=await Ei(e,`${cn(t)}/ManyToManyRelationships${(0,pr.odataQuery)([["$select","SchemaName,Entity1LogicalName,Entity2LogicalName"]])}`);for(let c of u){let d=c.Entity1LogicalName===t?c.Entity2LogicalName:c.Entity1LogicalName;o.push({schemaName:c.SchemaName,type:"ManyToMany",relatedEntity:d??"",relatedAttribute:""})}return o}async function Cx(e,t){var r,n,i,a,o;let s=`${cn(t)}`+(0,pr.odataQuery)([["$select","LogicalName,SchemaName,DisplayName,EntitySetName,IsCustomEntity,PrimaryNameAttribute,PrimaryIdAttribute"],["$expand","Attributes($select=LogicalName,DisplayName,AttributeType,IsCustomAttribute)"]]),u=(0,Rd.ensureSuccess)(await e.get(s),e.apiUrl(s)).body,c=((r=u.Attributes)!==null&&r!==void 0?r:[]).map(f=>{var h;return{logicalName:f.LogicalName,displayName:Za(f.DisplayName),...Si(f.DisplayName)?{localizedDisplayName:Si(f.DisplayName)}:{},attributeType:(h=f.AttributeType)!==null&&h!==void 0?h:"Unknown",isCustomAttribute:!!f.IsCustomAttribute}}),d=new Map(c.map(f=>[f.logicalName,f])),[,,,p]=await Promise.all([yx(e,t,d),bx(e,t,d),wx(e,t,d),Ax(e,t)]);return{logicalName:u.LogicalName,schemaName:(n=u.SchemaName)!==null&&n!==void 0?n:u.LogicalName,displayName:Za(u.DisplayName),...Si(u.DisplayName)?{localizedDisplayName:Si(u.DisplayName)}:{},entitySetName:(i=u.EntitySetName)!==null&&i!==void 0?i:"",primaryNameAttribute:(a=u.PrimaryNameAttribute)!==null&&a!==void 0?a:"",primaryIdAttribute:(o=u.PrimaryIdAttribute)!==null&&o!==void 0?o:"",isCustomEntity:!!u.IsCustomEntity,attributes:c,relationships:p}}dn.fetchEntityMetadataFromApi=Cx;async function Sx(e,t,r){var n,i;let a=`/EntityDefinitions${(0,pr.odataQuery)([["$select","LogicalName,SchemaName,EntitySetName,DisplayName,IsCustomEntity"]])}`,s=(i=(n=(0,Rd.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[],l=(t??"").toLowerCase(),u=s.filter(c=>!r?.customOnly||c.IsCustomEntity).map(c=>{var d,p;return{logicalName:c.LogicalName,schemaName:(d=c.SchemaName)!==null&&d!==void 0?d:c.LogicalName,displayName:Za(c.DisplayName),entitySetName:(p=c.EntitySetName)!==null&&p!==void 0?p:"",isCustom:!!c.IsCustomEntity}}).filter(c=>c.logicalName.toLowerCase().includes(l)||c.schemaName.toLowerCase().includes(l)||c.displayName.toLowerCase().includes(l));return typeof r?.top=="number"?u.slice(0,r.top):u}dn.findTables=Sx;async function Ex(e,t,r,n){var i,a;let o=`${cn(t)}/Attributes`+(0,pr.odataQuery)([["$select","LogicalName,SchemaName,DisplayName,AttributeType,IsCustomAttribute"]]),l=(a=(i=(0,Rd.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||i===void 0?void 0:i.value)!==null&&a!==void 0?a:[],u=(r??"").toLowerCase(),c=l.map(d=>{var p,f;return{logicalName:d.LogicalName,schemaName:(p=d.SchemaName)!==null&&p!==void 0?p:d.LogicalName,displayName:Za(d.DisplayName),attributeType:(f=d.AttributeType)!==null&&f!==void 0?f:"Unknown",isCustom:!!d.IsCustomAttribute}}).filter(d=>d.logicalName.toLowerCase().includes(u)||d.schemaName.toLowerCase().includes(u)||d.displayName.toLowerCase().includes(u));return typeof n?.top=="number"?c.slice(0,n.top):c}dn.findColumns=Ex});var Ni=g(Ws=>{"use strict";Object.defineProperty(Ws,"__esModule",{value:!0});Ws.DEFAULT_LCID=void 0;Ws.DEFAULT_LCID=1033});var Fd=g(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.postChangeSet=pn.parseChangeSetStatuses=pn.renderChangeSet=void 0;var js=ie(),Nx=be(),Hv=bt(),Qv=ee();function Jv(e,t){let r=`batch_${(0,Hv.newId)()}`,n=`changeset_${(0,Hv.newId)()}`,i=t.map((s,l)=>String(l+1)),a=t.map((s,l)=>{let u=s.body===void 0?void 0:JSON.stringify(s.body);return(0,Qv.assertNoControlChars)(s.path,"batch operation path"),s.etag&&(0,Qv.assertNoControlChars)(s.etag,"batch operation etag"),[`--${n}`,"Content-Type: application/http","Content-Transfer-Encoding: binary",`Content-ID: ${i[l]}`,"",`${s.method} ${e.apiUrl(s.path)} HTTP/1.1`,...u===void 0?[]:["Content-Type: application/json;type=entry"],...e.solutionName?[`MSCRM.SolutionUniqueName: ${e.solutionName}`]:[],...s.etag?[`If-Match: ${s.etag}`]:[],"",...u===void 0?[]:[u]].join(`\r
+ &$filter=(applicationid eq '${e}')`;b.SPNPrincipalIdUrl=UO;function $O(){return"/api/data/v9.0/appmodules?$filter=(uniquename eq 'AppDeploymentConfiguration')"}b.retrieveDeploymentPipelineConfigAppUrl=$O;b.retrieveFeatureControlSettingsByNamespaceUrl="/api/data/v9.1/RetrieveFeatureControlSettingsByNamespace";function qO(e){return`/api/data/v9.0/settingdefinitions${e}`}b.getSettingDefinitionsUri=qO;b.OrgSettingOverrideName="organizationsettings";function VO(e,t=!1){let r=`/api/data/v9.0/${b.OrgSettingOverrideName}${e}`;return t?`${b.cdsServiceUrl}${r}`:r}b.getOrgSettingOverrideUri=VO;b.AppSettingOverrideName="appsettings";function GO(e,t=!1){let r=`/api/data/v9.0/${b.AppSettingOverrideName}${e}`;return t?`${b.cdsServiceUrl.replace("/$","")}${r}`:r}b.getAppSettingOverrideUri=GO;var ja;(function(e){e[e.All=0]="All",e[e.IsPlatformOnly=1]="IsPlatformOnly",e[e.NotPlatformOnly=2]="NotPlatformOnly"})(ja||(b.RetrievePlatform=ja={}));function zO(e,t,r,n=ja.All,i=!1){let a=[];e&&a.push(`AppUniqueName='${e}'`),t!=null&&a.push(`ReleaseLevel=${t}`),r&&a.push(`RetrieveHiddenSettings=${r}`),n!==ja.All&&a.push(`RetrievePlatformSettings=${n===ja.IsPlatformOnly?1:0}`);let o="/api/data/v9.0/RetrieveUnpublishedOverridableSettingsInfo";return a.length&&(o=`${o}(${a.join(",")})`),i?`${b.cdsServiceUrl}${o}`:o}b.getPowerSettingsUri=zO;function WO(e,t,r,n=!1){let i=[`SettingName='${e}'`];t!==void 0&&i.push(`SolutionName='${t}'`),r!==void 0&&i.push(`AppUniqueName='${r}'`);let a="/api/data/v9.0/RetrieveUnpublishedSettingInfo";return i.length&&(a=`${a}(${i.join(",")})`),n?`${b.cdsServiceUrl}${a}`:a}b.getPowerSettingUri=WO;function HO(e=!1){let t="/api/data/v9.0/SaveSettingValue()";return e?`${b.cdsServiceUrl}${t}`:t}b.getSavePowerSettingUri=HO;b.retrieveUnpublishedSuffix="Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()";function jO(e){return`tools/systemcustomization/businessrules/businessRulesDesigner.aspx?BRlaunchpoint=BRGrid&appSolutionId={${e}}`}b.getBusinessRuleDesignerUri=jO;function Gg({environmentInstanceUrl:e,entityLogicalName:t}){return e&&t?`${e}main.aspx?cmdbar=true&forceUCI=1&navbar=off&newWindow=true&pageType=entityRecord&etn=${t}`:void 0}b.getUCIEntityRecordBaseUrl=Gg;function QO({baseUrl:e,environmentInstanceUrl:t,entityLogicalName:r,recordId:n}){let i=e||Gg({environmentInstanceUrl:t,entityLogicalName:r});return i&&n?`${i}&id=${n}`:void 0}b.getUCIEntityRecordEditUrl=QO;b.retrieveOrganizationResources=`${b.cdsServiceUrl}api/data/v9.0/RetrieveOrganizationResources`});var zg=g(Os=>{"use strict";Object.defineProperty(Os,"__esModule",{value:!0});Os.DataverseClient=void 0;var JO=Lc(),Wn=ne(),Mc=class{constructor(t,r,n){this.instanceUrl=t,this.httpClient=r,this.solutionUniqueName=n}withSolution(t){return this.solutionUniqueName?{...t,headers:{...t?.headers,"MSCRM.SolutionUniqueName":this.solutionUniqueName}}:t}apiUrl(t){let r=this.instanceUrl.replace(/\/+$/,""),n=t.startsWith("/")?t:`/${t}`;return`${r}/${JO.xrmApiUrl}${n}`}async send(t,r){try{return await r()}catch(n){throw n instanceof Wn.SdkError?n:new Wn.ConnectionError(t,0,n instanceof Error?n.message:String(n),n)}}get(t,r){let n=this.apiUrl(t);return this.send(n,()=>this.httpClient.get(n,r))}getAbsolute(t,r){return this.assertSameOrigin(t),this.send(t,()=>this.httpClient.get(t,r))}assertSameOrigin(t){let r,n;try{r=new URL(t),n=new URL(this.instanceUrl)}catch{throw new Wn.InvalidArgumentError(`Refusing to follow a malformed absolute URL: '${t}'`)}if(r.protocol!==n.protocol||r.host!==n.host)throw new Wn.InvalidArgumentError(`Refusing to follow a cross-origin link ('${r.origin}' is not the configured instance '${n.origin}'); server-driven pagination must stay on-instance.`)}post(t,r,n){let i=this.apiUrl(t);return this.send(i,()=>this.httpClient.post(i,r,this.withSolution(n)))}get supportsAtomicBatch(){return typeof this.httpClient.postRaw=="function"}get solutionName(){return this.solutionUniqueName}postBatch(t,r,n){if(!this.httpClient.postRaw)throw new Wn.InvalidArgumentError("The injected HttpClient does not implement postRaw(), required for atomic $batch change sets");let i=this.apiUrl("/$batch"),a={...n,headers:{...n?.headers,"Content-Type":`multipart/mixed;boundary=${r}`}};return this.send(i,()=>this.httpClient.postRaw(i,t,a))}patch(t,r,n){let i=this.apiUrl(t);return this.send(i,()=>this.httpClient.patch(i,r,this.withSolution(n)))}get supportsBinaryPatch(){return typeof this.httpClient.patchRaw=="function"}patchRaw(t,r,n){if(!this.httpClient.patchRaw)throw new Wn.InvalidArgumentError("The injected HttpClient does not implement patchRaw(), required to upload file content (a Dataverse File column cannot be written through a JSON body)");let i=this.apiUrl(t);return this.send(i,()=>this.httpClient.patchRaw(i,r,this.withSolution(n)))}put(t,r,n){if(!this.httpClient.put)throw new Wn.InvalidArgumentError("The injected HttpClient does not implement put(), required for metadata replace operations (e.g. updateColumn)");let i=this.apiUrl(t);return this.send(i,()=>this.httpClient.put(i,r,this.withSolution(n)))}delete(t,r){let n=this.apiUrl(t);return this.send(n,()=>this.httpClient.delete(n,this.withSolution(r)))}};Os.DataverseClient=Mc});var Wg=g(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});hn.findColumns=hn.findTables=hn.fetchEntityMetadataFromApi=void 0;var Bc=be(),gr=ie();function Ja(e){var t,r;return(r=(t=e?.UserLocalizedLabel)===null||t===void 0?void 0:t.Label)!==null&&r!==void 0?r:""}function wi(e){let t=e?.LocalizedLabels;if(!Array.isArray(t)||t.length<2)return;let r={};for(let n of t)typeof n?.LanguageCode=="number"&&typeof n.Label=="string"&&(r[n.LanguageCode]=n.Label);return Object.keys(r).length?r:void 0}async function Ai(e,t){var r,n;let i=await e.get(t);return i.status<200||i.status>=300?[]:(n=(r=i.body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[]}function mn(e){return`/EntityDefinitions(LogicalName='${(0,gr.odataLiteral)(e)}')`}async function KO(e,t,r){let n=await Ai(e,`${mn(t)}/Attributes/Microsoft.Dynamics.CRM.StringAttributeMetadata${(0,gr.odataQuery)([["$select","LogicalName,MaxLength"]])}`);for(let i of n){let a=r.get(i.LogicalName);a&&typeof i.MaxLength=="number"&&(a.maxLength=i.MaxLength)}}async function XO(e,t,r){var n;let i=await Ai(e,`${mn(t)}/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata${(0,gr.odataQuery)([["$select","LogicalName"],["$expand","OptionSet($select=Options)"]])}`);for(let a of i){let o=r.get(a.LogicalName);o&&(!((n=a.OptionSet)===null||n===void 0)&&n.Options)&&(o.options=a.OptionSet.Options.map(s=>{var l;return{value:(l=s.Value)!==null&&l!==void 0?l:0,label:Ja(s.Label),...wi(s.Label)?{localizedLabel:wi(s.Label)}:{}}}))}}async function YO(e,t,r){let n=await Ai(e,`${mn(t)}/Attributes/Microsoft.Dynamics.CRM.LookupAttributeMetadata${(0,gr.odataQuery)([["$select","LogicalName,Targets"]])}`);for(let i of n){let a=r.get(i.LogicalName);a&&i.Targets&&(a.targets=i.Targets)}}async function ZO(e,t){var r,n,i,a;let o=[],s=await Ai(e,`${mn(t)}/OneToManyRelationships${(0,gr.odataQuery)([["$select","SchemaName,ReferencingEntity,ReferencingAttribute"]])}`);for(let c of s)o.push({schemaName:c.SchemaName,type:"OneToMany",relatedEntity:(r=c.ReferencingEntity)!==null&&r!==void 0?r:"",relatedAttribute:(n=c.ReferencingAttribute)!==null&&n!==void 0?n:""});let l=await Ai(e,`${mn(t)}/ManyToOneRelationships${(0,gr.odataQuery)([["$select","SchemaName,ReferencedEntity,ReferencedAttribute"]])}`);for(let c of l)o.push({schemaName:c.SchemaName,type:"ManyToOne",relatedEntity:(i=c.ReferencedEntity)!==null&&i!==void 0?i:"",relatedAttribute:(a=c.ReferencedAttribute)!==null&&a!==void 0?a:""});let u=await Ai(e,`${mn(t)}/ManyToManyRelationships${(0,gr.odataQuery)([["$select","SchemaName,Entity1LogicalName,Entity2LogicalName"]])}`);for(let c of u){let d=c.Entity1LogicalName===t?c.Entity2LogicalName:c.Entity1LogicalName;o.push({schemaName:c.SchemaName,type:"ManyToMany",relatedEntity:d??"",relatedAttribute:""})}return o}async function eR(e,t){var r,n,i,a,o;let s=`${mn(t)}`+(0,gr.odataQuery)([["$select","LogicalName,SchemaName,DisplayName,EntitySetName,IsCustomEntity,PrimaryNameAttribute,PrimaryIdAttribute"],["$expand","Attributes($select=LogicalName,DisplayName,AttributeType,IsCustomAttribute)"]]),u=(0,Bc.ensureSuccess)(await e.get(s),e.apiUrl(s)).body,c=((r=u.Attributes)!==null&&r!==void 0?r:[]).map(f=>{var h;return{logicalName:f.LogicalName,displayName:Ja(f.DisplayName),...wi(f.DisplayName)?{localizedDisplayName:wi(f.DisplayName)}:{},attributeType:(h=f.AttributeType)!==null&&h!==void 0?h:"Unknown",isCustomAttribute:!!f.IsCustomAttribute}}),d=new Map(c.map(f=>[f.logicalName,f])),[,,,p]=await Promise.all([KO(e,t,d),XO(e,t,d),YO(e,t,d),ZO(e,t)]);return{logicalName:u.LogicalName,schemaName:(n=u.SchemaName)!==null&&n!==void 0?n:u.LogicalName,displayName:Ja(u.DisplayName),...wi(u.DisplayName)?{localizedDisplayName:wi(u.DisplayName)}:{},entitySetName:(i=u.EntitySetName)!==null&&i!==void 0?i:"",primaryNameAttribute:(a=u.PrimaryNameAttribute)!==null&&a!==void 0?a:"",primaryIdAttribute:(o=u.PrimaryIdAttribute)!==null&&o!==void 0?o:"",isCustomEntity:!!u.IsCustomEntity,attributes:c,relationships:p}}hn.fetchEntityMetadataFromApi=eR;async function tR(e,t,r){var n,i;let a=`/EntityDefinitions${(0,gr.odataQuery)([["$select","LogicalName,SchemaName,EntitySetName,DisplayName,IsCustomEntity"]])}`,s=(i=(n=(0,Bc.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[],l=(t??"").toLowerCase(),u=s.filter(c=>!r?.customOnly||c.IsCustomEntity).map(c=>{var d,p;return{logicalName:c.LogicalName,schemaName:(d=c.SchemaName)!==null&&d!==void 0?d:c.LogicalName,displayName:Ja(c.DisplayName),entitySetName:(p=c.EntitySetName)!==null&&p!==void 0?p:"",isCustom:!!c.IsCustomEntity}}).filter(c=>c.logicalName.toLowerCase().includes(l)||c.schemaName.toLowerCase().includes(l)||c.displayName.toLowerCase().includes(l));return typeof r?.top=="number"?u.slice(0,r.top):u}hn.findTables=tR;async function rR(e,t,r,n){var i,a;let o=`${mn(t)}/Attributes`+(0,gr.odataQuery)([["$select","LogicalName,SchemaName,DisplayName,AttributeType,IsCustomAttribute"]]),l=(a=(i=(0,Bc.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||i===void 0?void 0:i.value)!==null&&a!==void 0?a:[],u=(r??"").toLowerCase(),c=l.map(d=>{var p,f;return{logicalName:d.LogicalName,schemaName:(p=d.SchemaName)!==null&&p!==void 0?p:d.LogicalName,displayName:Ja(d.DisplayName),attributeType:(f=d.AttributeType)!==null&&f!==void 0?f:"Unknown",isCustom:!!d.IsCustomAttribute}}).filter(d=>d.logicalName.toLowerCase().includes(u)||d.schemaName.toLowerCase().includes(u)||d.displayName.toLowerCase().includes(u));return typeof n?.top=="number"?c.slice(0,n.top):c}hn.findColumns=rR});var Ci=g(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});Rs.DEFAULT_LCID=void 0;Rs.DEFAULT_LCID=1033});var ct=g(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.assignMissingIds=Si.newId=void 0;function Hg(){return globalThis.crypto.randomUUID().toLowerCase()}Si.newId=Hg;function nR(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var iR=new Set(["parameters","bag","expression","rawExpression","lookupValue","stepLabels"]);function aR(e){return Uc(e),e}Si.assignMissingIds=aR;function Uc(e){if(Array.isArray(e)){e.forEach(t=>Uc(t));return}if(nR(e)){(typeof e.id!="string"||e.id.length===0)&&(e.id=Hg());for(let t of Object.keys(e))t==="id"||iR.has(t)||Uc(e[t])}}});var $c=g(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.postChangeSet=gn.parseChangeSetStatuses=gn.renderChangeSet=void 0;var Fs=ne(),oR=be(),jg=ct(),Qg=ie();function Jg(e,t){let r=`batch_${(0,jg.newId)()}`,n=`changeset_${(0,jg.newId)()}`,i=t.map((s,l)=>String(l+1)),a=t.map((s,l)=>{let u=s.body===void 0?void 0:JSON.stringify(s.body);return(0,Qg.assertNoControlChars)(s.path,"batch operation path"),s.etag&&(0,Qg.assertNoControlChars)(s.etag,"batch operation etag"),[`--${n}`,"Content-Type: application/http","Content-Transfer-Encoding: binary",`Content-ID: ${i[l]}`,"",`${s.method} ${e.apiUrl(s.path)} HTTP/1.1`,...u===void 0?[]:["Content-Type: application/json;type=entry"],...e.solutionName?[`MSCRM.SolutionUniqueName: ${e.solutionName}`]:[],...s.etag?[`If-Match: ${s.etag}`]:[],"",...u===void 0?[]:[u]].join(`\r
`)});return{body:[`--${r}`,`Content-Type: multipart/mixed;boundary=${n}`,"",...a,`--${n}--`,`--${r}--`,""].join(`\r
-`),batchId:r,contentIds:i}}pn.renderChangeSet=Jv;function Xv(e,t){var r,n,i,a;if(typeof e!="string"||e.length===0)return;let o=(r=/^--(\S+)\r?\n/.exec(e))===null||r===void 0?void 0:r[1];if(o===void 0||!e.trimEnd().endsWith(`--${o}--`))return;let s=(n=/Content-Type:\s*multipart\/mixed;\s*boundary=(\S+)/i.exec(e))===null||n===void 0?void 0:n[1];if(s===void 0||s===o)return;let l=e.split(`--${s}`);if(l.length<2||!/^--(\r?\n|$)/.test(l[l.length-1]))return;let u=new Set(t),c=[],d=new Set;for(let p of l.slice(1)){if(p.startsWith("--"))break;let f=p.indexOf(`\r
+`),batchId:r,contentIds:i}}gn.renderChangeSet=Jg;function Kg(e,t){var r,n,i,a;if(typeof e!="string"||e.length===0)return;let o=(r=/^--(\S+)\r?\n/.exec(e))===null||r===void 0?void 0:r[1];if(o===void 0||!e.trimEnd().endsWith(`--${o}--`))return;let s=(n=/Content-Type:\s*multipart\/mixed;\s*boundary=(\S+)/i.exec(e))===null||n===void 0?void 0:n[1];if(s===void 0||s===o)return;let l=e.split(`--${s}`);if(l.length<2||!/^--(\r?\n|$)/.test(l[l.length-1]))return;let u=new Set(t),c=[],d=new Set;for(let p of l.slice(1)){if(p.startsWith("--"))break;let f=p.indexOf(`\r
\r
-`);if(f===-1)return;let h=p.slice(0,f),y=p.slice(f+4);if(!/^Content-Type:\s*application\/http\b/im.test(h))return;let w=/^HTTP\/1\.[01] (\d{3})\b/.exec(y);if(!w||((i=y.match(/^HTTP\/1\.[01] \d{3}\b/gm))!==null&&i!==void 0?i:[]).length!==1)return;let N=(a=/^Content-ID:\s*(\S+)/im.exec(h))===null||a===void 0?void 0:a[1];if(N===void 0||d.has(N)||!u.has(N))return;d.add(N),c.push(Number(w[1]))}return c.length===0?void 0:c}pn.parseChangeSetStatuses=Xv;async function Dx(e,t,r){if(t.length===0)return;let{body:n,batchId:i,contentIds:a}=Jv(e,t),o=await e.postBatch(n,i),s=e.apiUrl("/$batch");if((0,Nx.ensureSuccess)(o,s),typeof o.body!="string"||o.body.length===0)throw new js.ConnectionError(s,o.status,`atomic write of ${r} cannot be confirmed: the $batch response had no readable body, so the change set's outcome is unknown`);let l=Xv(o.body,a);if(l===void 0)throw new js.ConnectionError(s,o.status,`atomic write of ${r} cannot be confirmed: the $batch response could not be parsed as a change set, so the outcome is unknown`);if(l.length!==t.length)throw new js.ConnectionError(s,o.status,`atomic write of ${r} cannot be confirmed: the change set reported ${l.length} result(s) for ${t.length} operation(s)`);let u=l.find(c=>c<200||c>=300);if(u!==void 0)throw new js.ConnectionError(s,u,`atomic write of ${r} was rolled back: the change set reported HTTP ${u}`)}pn.postChangeSet=Dx});var Hs=g(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.updateTable=Q.deleteAlternateKey=Q.createAlternateKey=Q.deleteGlobalOptionSet=Q.createGlobalOptionSet=Q.deleteRelationship=Q.deleteColumn=Q.updateColumn=Q.deleteTable=Q.createRelationship=Q.insertStatusValue=Q.createCustomerColumn=Q.createColumns=Q.setColumnVisualization=Q.getColumnVisualization=Q.createColumn=Q.createTable=Q.resolveEntitySetName=Q.pluralFallback=void 0;var ne=be(),H=ee(),fr=Ni(),de=ie(),Ix=Fd(),_x={String:"Microsoft.Dynamics.CRM.StringAttributeMetadata",Memo:"Microsoft.Dynamics.CRM.MemoAttributeMetadata",Integer:"Microsoft.Dynamics.CRM.IntegerAttributeMetadata",Decimal:"Microsoft.Dynamics.CRM.DecimalAttributeMetadata",Money:"Microsoft.Dynamics.CRM.MoneyAttributeMetadata",Boolean:"Microsoft.Dynamics.CRM.BooleanAttributeMetadata",DateTime:"Microsoft.Dynamics.CRM.DateTimeAttributeMetadata",Picklist:"Microsoft.Dynamics.CRM.PicklistAttributeMetadata",Lookup:"Microsoft.Dynamics.CRM.LookupAttributeMetadata"};function Te(e,t){return{"@odata.type":"Microsoft.Dynamics.CRM.Label",LocalizedLabels:Px(e,t)}}var Kv=65535;function Px(e,t){let r=(a,o)=>({"@odata.type":"Microsoft.Dynamics.CRM.LocalizedLabel",Label:a,LanguageCode:o});if(typeof e=="string")return[r(e,t)];let n=Object.entries(e);if(!n.length)throw new de.InvalidArgumentError("a localized label must contain at least one language");let i=new Set;return n.map(([a,o])=>{if(!/^[1-9]\d*$/.test(a))throw new de.InvalidArgumentError(`localized label key '${a}' is not an LCID (expected a canonical positive integer, e.g. 1033)`);let s=Number(a);if(s>Kv)throw new de.InvalidArgumentError(`localized label LCID ${s} is out of range (1-${Kv})`);if(i.has(s))throw new de.InvalidArgumentError(`localized label LCID ${s} is specified more than once`);if(i.add(s),typeof o!="string")throw new de.InvalidArgumentError(`localized label for LCID ${s} must be a string`);return r(o,s)})}function ty(e){return typeof e=="string"?`${e}s`:Object.fromEntries(Object.entries(e).map(([t,r])=>{if(typeof r!="string")throw new de.InvalidArgumentError(`localized label for LCID ${t} must be a string`);return[t,`${r}s`]}))}Q.pluralFallback=ty;function eo(e){return{Value:e,CanBeChanged:!0,ManagedPropertyLogicalName:"canmodifyrequirementlevelsettings"}}function kd(e){let t=e.indexOf("_");return t>0?e.slice(0,t):e}function Yv(e,t,r){let n=e[t];n&&typeof n=="object"?n.Value=r:e[t]={Value:r}}function to(e){let t=(0,ne.readCreatedId)(e,"MetadataId");if(!t)throw new de.InvalidArgumentError("Dataverse did not return a MetadataId for the created metadata component");return t}function Tx(e,t,r){var n,i,a,o,s,l,u,c,d,p,f,h,y,w,N,D,x,F,X,V,M,U,B,z;if(t.defaultValue!==void 0&&e!=="boolean")throw new de.InvalidArgumentError(`createColumn: 'defaultValue' applies to boolean columns, but '${t.schemaName}' is of type '${e}'.`);if(t.integerFormat!==void 0&&e!=="integer")throw new de.InvalidArgumentError(`createColumn: 'integerFormat' applies to integer columns, but '${t.schemaName}' is of type '${e}'.`);switch(e){case"string":return{"@odata.type":"Microsoft.Dynamics.CRM.StringAttributeMetadata",AttributeType:"String",AttributeTypeName:{Value:"StringType"},MaxLength:(n=t.maxLength)!==null&&n!==void 0?n:100,FormatName:{Value:(i=t.stringFormat)!==null&&i!==void 0?i:"Text"}};case"memo":return{"@odata.type":"Microsoft.Dynamics.CRM.MemoAttributeMetadata",AttributeType:"Memo",AttributeTypeName:{Value:"MemoType"},MaxLength:(a=t.maxLength)!==null&&a!==void 0?a:2e3,Format:"TextArea"};case"integer":return{"@odata.type":"Microsoft.Dynamics.CRM.IntegerAttributeMetadata",AttributeType:"Integer",AttributeTypeName:{Value:"IntegerType"},Format:(o=t.integerFormat)!==null&&o!==void 0?o:"None",MinValue:(s=t.minValue)!==null&&s!==void 0?s:-2147483648,MaxValue:(l=t.maxValue)!==null&&l!==void 0?l:2147483647};case"bigint":return{"@odata.type":"Microsoft.Dynamics.CRM.BigIntAttributeMetadata",AttributeType:"BigInt",AttributeTypeName:{Value:"BigIntType"}};case"double":return{"@odata.type":"Microsoft.Dynamics.CRM.DoubleAttributeMetadata",AttributeType:"Double",AttributeTypeName:{Value:"DoubleType"},Precision:(u=t.precision)!==null&&u!==void 0?u:2,MinValue:(c=t.minValue)!==null&&c!==void 0?c:-1e11,MaxValue:(d=t.maxValue)!==null&&d!==void 0?d:1e11};case"decimal":return{"@odata.type":"Microsoft.Dynamics.CRM.DecimalAttributeMetadata",AttributeType:"Decimal",AttributeTypeName:{Value:"DecimalType"},Precision:(p=t.precision)!==null&&p!==void 0?p:2,MinValue:(f=t.minValue)!==null&&f!==void 0?f:-1e11,MaxValue:(h=t.maxValue)!==null&&h!==void 0?h:1e11};case"money":return{"@odata.type":"Microsoft.Dynamics.CRM.MoneyAttributeMetadata",AttributeType:"Money",AttributeTypeName:{Value:"MoneyType"},Precision:(y=t.precision)!==null&&y!==void 0?y:2,PrecisionSource:2,MinValue:(w=t.minValue)!==null&&w!==void 0?w:0,MaxValue:(N=t.maxValue)!==null&&N!==void 0?N:1e9};case"boolean":return{"@odata.type":"Microsoft.Dynamics.CRM.BooleanAttributeMetadata",AttributeType:"Boolean",AttributeTypeName:{Value:"BooleanType"},DefaultValue:(D=t.defaultValue)!==null&&D!==void 0?D:!1,OptionSet:{"@odata.type":"Microsoft.Dynamics.CRM.BooleanOptionSetMetadata",TrueOption:{Value:1,Label:Te((x=t.trueLabel)!==null&&x!==void 0?x:"Yes",r)},FalseOption:{Value:0,Label:Te((F=t.falseLabel)!==null&&F!==void 0?F:"No",r)}}};case"dateTime":return{"@odata.type":"Microsoft.Dynamics.CRM.DateTimeAttributeMetadata",AttributeType:"DateTime",AttributeTypeName:{Value:"DateTimeType"},Format:(X=t.dateFormat)!==null&&X!==void 0?X:"DateAndTime"};case"choice":return Zv(t,r,!1);case"multiChoice":return Zv(t,r,!0);case"file":return{"@odata.type":"Microsoft.Dynamics.CRM.FileAttributeMetadata",AttributeType:"Virtual",AttributeTypeName:{Value:"FileType"},MaxSizeInKB:(V=t.maxSizeKb)!==null&&V!==void 0?V:10240};case"image":return{"@odata.type":"Microsoft.Dynamics.CRM.ImageAttributeMetadata",AttributeType:"Virtual",AttributeTypeName:{Value:"ImageType"},IsPrimaryImage:(M=t.isPrimaryImage)!==null&&M!==void 0?M:!1,MaxSizeInKB:(U=t.maxSizeKb)!==null&&U!==void 0?U:10240};case"autonumber":return{"@odata.type":"Microsoft.Dynamics.CRM.StringAttributeMetadata",AttributeType:"String",AttributeTypeName:{Value:"StringType"},FormatName:{Value:"Text"},MaxLength:(B=t.maxLength)!==null&&B!==void 0?B:100,AutoNumberFormat:(z=t.autoNumberFormat)!==null&&z!==void 0?z:""};default:throw new de.InvalidArgumentError(`unsupported column type '${String(e)}'`)}}function Zv(e,t,r){let i={"@odata.type":r?"Microsoft.Dynamics.CRM.MultiSelectPicklistAttributeMetadata":"Microsoft.Dynamics.CRM.PicklistAttributeMetadata",AttributeType:r?"Virtual":"Picklist",AttributeTypeName:{Value:r?"MultiSelectPicklistType":"PicklistType"}};if(e.globalChoiceMetadataId)return i["[email protected]"]=`/GlobalOptionSetDefinitions(${(0,H.normalizeGuid)(e.globalChoiceMetadataId,"globalChoiceMetadataId")})`,i;if(!e.options||e.options.length===0)throw new de.InvalidArgumentError(`choice column '${e.schemaName}' requires at least one option (or a globalChoiceMetadataId)`);return i.OptionSet={"@odata.type":"Microsoft.Dynamics.CRM.OptionSetMetadata",IsGlobal:!1,OptionSetType:"Picklist",Options:e.options.map(a=>({Value:a.value,Label:Te(a.label,t)}))},i}var xd=new WeakMap;async function Ox(e,t){var r,n;let i=(r=xd.get(e))===null||r===void 0?void 0:r.get(t);if(i)return i;let a=`/EntityDefinitions(LogicalName='${(0,H.odataLiteral)(t)}')${(0,H.odataQuery)([["$select","EntitySetName"]])}`,s=(n=(0,ne.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||n===void 0?void 0:n.EntitySetName;if(!s)throw new de.InvalidArgumentError(`could not resolve EntitySetName for '${t}'`);(0,H.assertODataName)(s,`server-derived EntitySetName for '${t}'`);let l=xd.get(e);return l||(l=new Map,xd.set(e,l)),l.set(t,s),s}Q.resolveEntitySetName=Ox;async function Rx(e,t){var r,n,i,a,o,s,l,u,c,d,p,f,h,y,w;let N=(r=t.languageCode)!==null&&r!==void 0?r:fr.DEFAULT_LCID,D=kd(t.schemaName),x=(n=t.primaryColumnSchemaName)!==null&&n!==void 0?n:`${D}_Name`,F={"@odata.type":"Microsoft.Dynamics.CRM.StringAttributeMetadata",AttributeType:"String",AttributeTypeName:{Value:"StringType"},SchemaName:x,RequiredLevel:eo("None"),MaxLength:(i=t.primaryColumnMaxLength)!==null&&i!==void 0?i:100,FormatName:{Value:"Text"},DisplayName:Te((a=t.primaryColumnDisplayName)!==null&&a!==void 0?a:"Name",N),IsPrimaryName:!0};t.primaryColumnAutoNumberFormat&&(F.AutoNumberFormat=t.primaryColumnAutoNumberFormat),t.columns&&iy(t.columns,"createTable");let X={"@odata.type":"Microsoft.Dynamics.CRM.EntityMetadata",SchemaName:t.schemaName,DisplayName:Te(t.displayName,N),DisplayCollectionName:Te((o=t.pluralName)!==null&&o!==void 0?o:ty(t.displayName),N),OwnershipType:(s=t.ownership)!==null&&s!==void 0?s:"UserOwned",IsActivity:!1,HasActivities:(l=t.hasActivities)!==null&&l!==void 0?l:!1,HasNotes:(u=t.hasNotes)!==null&&u!==void 0?u:!1,Attributes:[F,...((c=t.columns)!==null&&c!==void 0?c:[]).map(Ge=>Md(Ge,N))]};t.description&&(X.Description=Te(t.description,N));let V="/EntityDefinitions",M=(0,ne.ensureSuccess)(await e.post(V,X),e.apiUrl(V)),U=to(M),B=`/EntityDefinitions(${U})`+(0,H.odataQuery)([["$select","LogicalName,EntitySetName,PrimaryIdAttribute,PrimaryNameAttribute"]]),z=Math.max(1,Math.trunc((d=t.readBackAttempts)!==null&&d!==void 0?d:6)),$=Math.max(0,(p=t.readBackDelayMs)!==null&&p!==void 0?p:1e3),Ee;for(let Ge=1;Ge<=z;Ge+=1){let Ze=await e.get(B);if(Ze.status>=200&&Ze.status<300){Ee=Ze;break}Ze.status!==404&&(0,ne.ensureSuccess)(Ze,e.apiUrl(B)),Ge<z&&$>0&&await new Promise(pe=>setTimeout(pe,$))}if(!Ee)throw new de.SdkError("TABLE_METADATA_NOT_VISIBLE",`Table '${t.schemaName}' WAS CREATED (MetadataId ${U}) but its metadata was still not readable after ${z} attempt(s). Do NOT re-run the create \u2014 it will collide on the schema name. Re-read /EntityDefinitions(${U}) once the environment catches up, or raise 'readBackAttempts'.`);let ye=Ee.body;return{logicalName:(f=ye.LogicalName)!==null&&f!==void 0?f:t.schemaName.toLowerCase(),metadataId:U,entitySetName:(h=ye.EntitySetName)!==null&&h!==void 0?h:"",primaryIdAttribute:(y=ye.PrimaryIdAttribute)!==null&&y!==void 0?y:`${t.schemaName.toLowerCase()}id`,primaryNameAttribute:(w=ye.PrimaryNameAttribute)!==null&&w!==void 0?w:x.toLowerCase()}}Q.createTable=Rx;function Md(e,t){var r,n;let i=(r=e.languageCode)!==null&&r!==void 0?r:t,a={...Tx(e.type,e,i),SchemaName:e.schemaName,RequiredLevel:eo((n=e.required)!==null&&n!==void 0?n:"None"),DisplayName:Te(e.displayName,i)};return e.description&&(a.Description=Te(e.description,i)),e.sourceType&&e.sourceType!=="Simple"&&(a.SourceType=e.sourceType==="Rollup"?2:1,e.formulaDefinition&&(a.FormulaDefinition=e.formulaDefinition)),ry(a,e),a}function ry(e,t){t.isValidForCreate!==void 0&&(e.IsValidForCreate=t.isValidForCreate),t.isValidForUpdate!==void 0&&(e.IsValidForUpdate=t.isValidForUpdate),t.isValidForRead!==void 0&&(e.IsValidForRead=t.isValidForRead)}async function Fx(e,t,r){var n;let i=Md(r,(n=r.languageCode)!==null&&n!==void 0?n:fr.DEFAULT_LCID),a=`/EntityDefinitions(LogicalName='${(0,H.odataLiteral)(t)}')/Attributes`,o=(0,ne.ensureSuccess)(await e.post(a,i),e.apiUrl(a)),s={logicalName:r.schemaName.toLowerCase(),metadataId:to(o)};if(r.visualization&&r.visualization!=="None")try{await sy(e,t,s.logicalName,s.metadataId,r.visualization)}catch(l){let u=new de.SdkError("COLUMN_VISUALIZATION_BIND_FAILED",`Column '${s.logicalName}' on '${t}' was created, but binding its '${r.visualization}' grid visualization failed; the column exists WITHOUT a visualization. Retry with setColumnVisualization('${t}', '${s.logicalName}', '${r.visualization}'). Cause: ${l instanceof Error?l.message:String(l)}`);throw u.cause=l,u}return s}Q.createColumn=Fx;var Di="/controlconfigurations",ny="CustomRenderersConfiguration",Ld={RadialDial:"c3d4e5f6-a7b8-9012-cdef-345678901234",LineChart:"a1b2c3d4-e5f6-7890-abcd-ef1234567890",HeatMap:"e7f8a9b0-c1d2-4e3f-5a6b-7c8d9e0f1a2b",StarRating:"b5e4c3d2-f1a0-4e2b-8a7c-9d3f5c1e6b04"};function iy(e,t){let r=e.find(n=>n.visualization&&n.visualization!=="None");if(r)throw new de.InvalidArgumentError(`${t}: setting 'visualization' on an inline column ('${r.schemaName}') is not supported \u2014 the attribute metadata and its control-configuration row are separate writes. Create the column, then call setColumnVisualization; or use the single-column createColumn.`)}function ay(e){return JSON.stringify({type:Ld[e]})}function xx(e){if(!e)return"None";let t;try{t=JSON.parse(e)}catch{return"None"}let r=t?.type,n=Object.keys(Ld).find(i=>Ld[i]===r);return n??"None"}async function oy(e,t,r){var n,i;let a=`entitylogicalname eq '${(0,H.odataLiteral)(t)}' and Attribute/logicalname eq '${(0,H.odataLiteral)(r)}'`,o=`${Di}${(0,H.odataQuery)([["$select","name,uniquename,metadatajson"],["$expand","Attribute($select=name,logicalname)"],["$filter",a]])}`,l=(i=(n=(0,ne.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[],u=r.toLowerCase();return l.filter(c=>{var d,p;return((p=(d=c.Attribute)===null||d===void 0?void 0:d.logicalname)===null||p===void 0?void 0:p.toLowerCase())===u})}async function Lx(e,t,r){var n;let i=`/EntityDefinitions(LogicalName='${(0,H.odataLiteral)(t)}')/Attributes(LogicalName='${(0,H.odataLiteral)(r)}')${(0,H.odataQuery)([["$select","MetadataId"]])}`,o=(n=(0,ne.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)===null||n===void 0?void 0:n.MetadataId;if(!o)throw new de.InvalidArgumentError(`cannot resolve column '${r}' on '${t}' to set its visualization`);return(0,H.normalizeGuid)(o,"MetadataId")}async function sy(e,t,r,n,i){let a={name:ny,uniquename:`msdyn_${t}_${r}_customrenderers`,metadatajson:ay(i),"[email protected]":`/attributes(${(0,H.normalizeGuid)(n,"MetadataId")})`,entitylogicalname:t};(0,ne.ensureSuccess)(await e.post(Di,a),e.apiUrl(Di))}async function kx(e,t,r){var n;let i=await oy(e,t,r);return xx((n=i[0])===null||n===void 0?void 0:n.metadatajson)}Q.getColumnVisualization=kx;async function Mx(e,t,r,n){let a=(await oy(e,t,r)).map(u=>u.controlconfigurationid).filter(u=>!!u);if(n==="None"){for(let u of a){let c=`${Di}(${(0,H.normalizeGuid)(u,"controlconfigurationid")})`;(0,ne.ensureSuccess)(await e.delete(c),e.apiUrl(c))}return}let[o,...s]=a,l=await Lx(e,t,r);if(o){let u=`${Di}(${(0,H.normalizeGuid)(o,"controlconfigurationid")})`,c={name:ny,metadatajson:ay(n),"[email protected]":`/attributes(${l})`,entitylogicalname:t};(0,ne.ensureSuccess)(await e.patch(u,c),e.apiUrl(u))}else await sy(e,t,r,l,n);for(let u of s){let c=`${Di}(${(0,H.normalizeGuid)(u,"controlconfigurationid")})`;(0,ne.ensureSuccess)(await e.delete(c),e.apiUrl(c))}}Q.setColumnVisualization=Mx;async function Ux(e,t,r){if(r.length===0)return;if(iy(r,"createColumns"),!e.supportsAtomicBatch)throw new de.InvalidArgumentError(`createColumns writes ${r.length} columns on '${t}' as ONE atomic change set, which needs a verbatim request body. Implement HttpClient.postRaw, or call createColumn per column and accept that a failure can leave the table partly extended.`);let n=`/EntityDefinitions(LogicalName='${(0,H.odataLiteral)(t)}')/Attributes`;await(0,Ix.postChangeSet)(e,r.map(i=>{var a;return{method:"POST",path:n,body:Md(i,(a=i.languageCode)!==null&&a!==void 0?a:fr.DEFAULT_LCID)}}),`${r.length} column(s) on '${t}'`)}Q.createColumns=Ux;async function Bx(e,t,r){var n,i,a,o;let s=(n=r.languageCode)!==null&&n!==void 0?n:fr.DEFAULT_LCID,l=kd(r.schemaName),u=(i=r.accountRelationshipName)!==null&&i!==void 0?i:`${l}_${t}_account`,c=(a=r.contactRelationshipName)!==null&&a!==void 0?a:`${l}_${t}_contact`,d={Lookup:{"@odata.type":"Microsoft.Dynamics.CRM.ComplexLookupAttributeMetadata",SchemaName:r.schemaName,DisplayName:Te(r.displayName,s),RequiredLevel:eo((o=r.required)!==null&&o!==void 0?o:"None"),Targets:["account","contact"]},OneToManyRelationships:[{"@odata.type":"Microsoft.Dynamics.CRM.ComplexOneToManyRelationshipMetadata",SchemaName:u,ReferencedEntity:"account",ReferencingEntity:t},{"@odata.type":"Microsoft.Dynamics.CRM.ComplexOneToManyRelationshipMetadata",SchemaName:c,ReferencedEntity:"contact",ReferencingEntity:t}]};return(0,ne.ensureSuccess)(await e.post("/CreateCustomerRelationships",d),e.apiUrl("/CreateCustomerRelationships")),{logicalName:r.schemaName.toLowerCase(),metadataId:""}}Q.createCustomerColumn=Bx;async function $x(e,t,r){var n,i,a,o,s;let l=(n=r.languageCode)!==null&&n!==void 0?n:fr.DEFAULT_LCID,u={EntityLogicalName:t,AttributeLogicalName:"statuscode",Label:Te(r.label,l),StateCode:(i=r.stateCode)!==null&&i!==void 0?i:0};typeof r.value=="number"&&(u.Value=r.value),r.color&&(u.Color=r.color);let c=(0,ne.ensureSuccess)(await e.post("/InsertStatusValue",u),e.apiUrl("/InsertStatusValue"));return Number((s=(o=(a=c.body)===null||a===void 0?void 0:a.NewOptionValue)!==null&&o!==void 0?o:r.value)!==null&&s!==void 0?s:0)}Q.insertStatusValue=$x;async function qx(e,t){var r,n,i,a,o;let s=(r=t.languageCode)!==null&&r!==void 0?r:fr.DEFAULT_LCID,l,u;if(t.type==="OneToMany"){if(!t.referencedEntity||!t.referencingEntity)throw new de.InvalidArgumentError("OneToMany relationship requires referencedEntity and referencingEntity");let p=(n=t.lookupSchemaName)!==null&&n!==void 0?n:`${kd(t.schemaName)}_${t.referencedEntity}Id`;u=p.toLowerCase(),l={"@odata.type":"Microsoft.Dynamics.CRM.OneToManyRelationshipMetadata",SchemaName:t.schemaName,ReferencedEntity:t.referencedEntity,ReferencingEntity:t.referencingEntity,Lookup:{"@odata.type":"Microsoft.Dynamics.CRM.LookupAttributeMetadata",AttributeType:"Lookup",AttributeTypeName:{Value:"LookupType"},SchemaName:p,RequiredLevel:eo((i=t.lookupRequired)!==null&&i!==void 0?i:"None"),DisplayName:Te((a=t.lookupDisplayName)!==null&&a!==void 0?a:t.referencedEntity,s)}}}else{if(!t.entity1||!t.entity2)throw new de.InvalidArgumentError("ManyToMany relationship requires entity1 and entity2");l={"@odata.type":"Microsoft.Dynamics.CRM.ManyToManyRelationshipMetadata",SchemaName:t.schemaName,IntersectEntityName:(o=t.intersectEntityName)!==null&&o!==void 0?o:t.schemaName.toLowerCase(),Entity1LogicalName:t.entity1,Entity2LogicalName:t.entity2}}let c="/RelationshipDefinitions",d=(0,ne.ensureSuccess)(await e.post(c,l),e.apiUrl(c));return{schemaName:t.schemaName,metadataId:to(d),lookupLogicalName:u}}Q.createRelationship=qx;async function Vx(e,t){let r=`/EntityDefinitions(LogicalName='${(0,H.odataLiteral)(t)}')`;(0,ne.ensureSuccess)(await e.delete(r),e.apiUrl(r))}Q.deleteTable=Vx;async function Gx(e,t,r,n){var i,a;let o=(i=n.languageCode)!==null&&i!==void 0?i:fr.DEFAULT_LCID,s=`/EntityDefinitions(LogicalName='${(0,H.odataLiteral)(t)}')/Attributes`,l=`${s}(LogicalName='${(0,H.odataLiteral)(r)}')${(0,H.odataQuery)([["$select","MetadataId,AttributeType"]])}`,c=(0,ne.ensureSuccess)(await e.get(l),e.apiUrl(l)).body,d=_x[(a=c.AttributeType)!==null&&a!==void 0?a:""];if(!c.MetadataId||!d)throw new de.InvalidArgumentError(`cannot update column '${r}' on '${t}' (type '${c.AttributeType}' not supported)`);let p=(0,H.normalizeGuid)(c.MetadataId,"MetadataId"),f=`${s}(${p})/${d}`,h=(0,ne.ensureSuccess)(await e.get(f),e.apiUrl(f)).body;for(let w of Object.keys(h))w.startsWith("@odata.")&&delete h[w];if(h["@odata.type"]=d,n.displayName!==void 0&&(h.DisplayName=Te(n.displayName,o)),n.description!==void 0&&(h.Description=Te(n.description,o)),n.required!==void 0&&(h.RequiredLevel=eo(n.required)),n.maxLength!==void 0&&(h.MaxLength=n.maxLength),n.autoNumberFormat!==void 0&&(h.AutoNumberFormat=n.autoNumberFormat),n.defaultValue!==void 0&&c.AttributeType!=="Boolean")throw new de.InvalidArgumentError(`updateColumn: 'defaultValue' applies to Boolean columns, but '${r}' on '${t}' is of type '${c.AttributeType}'.`);if(n.integerFormat!==void 0&&c.AttributeType!=="Integer")throw new de.InvalidArgumentError(`updateColumn: 'integerFormat' applies to Integer columns, but '${r}' on '${t}' is of type '${c.AttributeType}'.`);n.defaultValue!==void 0&&(h.DefaultValue=n.defaultValue),n.integerFormat!==void 0&&(h.Format=n.integerFormat),ry(h,n);let y=`${s}(${p})`;(0,ne.ensureSuccess)(await e.put(y,h,{headers:{"MSCRM.MergeLabels":"true"}}),e.apiUrl(y))}Q.updateColumn=Gx;async function zx(e,t,r){var n;let i=`/EntityDefinitions(LogicalName='${(0,H.odataLiteral)(t)}')/Attributes`,a=`${i}(LogicalName='${(0,H.odataLiteral)(r)}')${(0,H.odataQuery)([["$select","MetadataId"]])}`,s=(n=(0,ne.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||n===void 0?void 0:n.MetadataId;if(!s)throw new de.InvalidArgumentError(`column '${r}' not found on '${t}'`);let l=`${i}(${(0,H.normalizeGuid)(s,"MetadataId")})`;(0,ne.ensureSuccess)(await e.delete(l),e.apiUrl(l))}Q.deleteColumn=zx;async function Wx(e,t){var r,n,i;let a=`/RelationshipDefinitions${(0,H.odataQuery)([["$filter",`SchemaName eq '${(0,H.odataLiteral)(t)}'`],["$select","MetadataId"]])}`,s=(i=(n=(r=(0,ne.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||r===void 0?void 0:r.value)===null||n===void 0?void 0:n[0])===null||i===void 0?void 0:i.MetadataId;if(!s)throw new de.InvalidArgumentError(`relationship '${t}' not found`);let l=`/RelationshipDefinitions(${(0,H.normalizeGuid)(s,"MetadataId")})`;(0,ne.ensureSuccess)(await e.delete(l),e.apiUrl(l))}Q.deleteRelationship=Wx;async function ey(e,t){var r;let n=`/GlobalOptionSetDefinitions(Name='${(0,H.odataPathLiteral)(t)}')${(0,H.odataQuery)([["$select","MetadataId"]])}`,i=await e.get(n);if(i.status===404)return;let o=(r=(0,ne.ensureSuccess)(i,e.apiUrl(n)).body)===null||r===void 0?void 0:r.MetadataId;return o?(0,H.normalizeGuid)(o,"MetadataId"):void 0}async function jx(e,t){var r;let n=t.name.toLowerCase(),i=await ey(e,n);if(i)return{name:n,metadataId:i};let a=(r=t.languageCode)!==null&&r!==void 0?r:fr.DEFAULT_LCID,o={"@odata.type":"Microsoft.Dynamics.CRM.OptionSetMetadata",Name:n,DisplayName:Te(t.displayName,a),IsGlobal:!0,OptionSetType:"Picklist",Options:t.options.map(l=>({Value:l.value,Label:Te(l.label,a)}))};t.description&&(o.Description=Te(t.description,a));let s="/GlobalOptionSetDefinitions";try{let l=(0,ne.ensureSuccess)(await e.post(s,o),e.apiUrl(s));return{name:n,metadataId:to(l)}}catch(l){let u;try{u=await ey(e,n)}catch{u=void 0}if(u)return{name:n,metadataId:u};throw l}}Q.createGlobalOptionSet=jx;async function Hx(e,t){let r=`/GlobalOptionSetDefinitions(Name='${(0,H.odataLiteral)(t.toLowerCase())}')`;(0,ne.ensureSuccess)(await e.delete(r),e.apiUrl(r))}Q.deleteGlobalOptionSet=Hx;async function Qx(e,t,r){var n;let i=(n=r.languageCode)!==null&&n!==void 0?n:fr.DEFAULT_LCID,a={"@odata.type":"Microsoft.Dynamics.CRM.EntityKeyMetadata",SchemaName:r.schemaName,DisplayName:Te(r.displayName,i),KeyAttributes:r.keyAttributes},o=`/EntityDefinitions(LogicalName='${(0,H.odataLiteral)(t)}')/Keys`,s=(0,ne.ensureSuccess)(await e.post(o,a),e.apiUrl(o));return{logicalName:r.schemaName.toLowerCase(),metadataId:to(s)}}Q.createAlternateKey=Qx;async function Jx(e,t,r){var n;let i=`/EntityDefinitions(LogicalName='${(0,H.odataLiteral)(t)}')/Keys`,a=`${i}(LogicalName='${(0,H.odataLiteral)(r.toLowerCase())}')${(0,H.odataQuery)([["$select","MetadataId"]])}`,s=(n=(0,ne.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||n===void 0?void 0:n.MetadataId;if(!s)throw new de.InvalidArgumentError(`alternate key '${r}' not found on '${t}'`);let l=`${i}(${(0,H.normalizeGuid)(s,"MetadataId")})`;(0,ne.ensureSuccess)(await e.delete(l),e.apiUrl(l))}Q.deleteAlternateKey=Jx;async function Xx(e,t,r){var n;let i=(n=r.languageCode)!==null&&n!==void 0?n:fr.DEFAULT_LCID,a=`/EntityDefinitions(LogicalName='${(0,H.odataLiteral)(t)}')`,s=(0,ne.ensureSuccess)(await e.get(a),e.apiUrl(a)).body,l=s.MetadataId;if(!l)throw new de.InvalidArgumentError(`table '${t}' not found`);let u=(0,H.normalizeGuid)(l,"MetadataId");for(let d of Object.keys(s))d.startsWith("@odata.")&&delete s[d];s["@odata.type"]="Microsoft.Dynamics.CRM.EntityMetadata",r.displayName!==void 0&&(s.DisplayName=Te(r.displayName,i)),r.pluralName!==void 0&&(s.DisplayCollectionName=Te(r.pluralName,i)),r.description!==void 0&&(s.Description=Te(r.description,i)),r.auditEnabled!==void 0&&Yv(s,"IsAuditEnabled",r.auditEnabled),r.duplicateDetectionEnabled!==void 0&&Yv(s,"IsDuplicateDetectionEnabled",r.duplicateDetectionEnabled),r.changeTrackingEnabled!==void 0&&(s.ChangeTrackingEnabled=r.changeTrackingEnabled),r.quickCreateEnabled!==void 0&&(s.IsQuickCreateEnabled=r.quickCreateEnabled),r.iconVectorName!==void 0&&(s.IconVectorName=r.iconVectorName),r.iconSmallName!==void 0&&(s.IconSmallName=r.iconSmallName),r.iconMediumName!==void 0&&(s.IconMediumName=r.iconMediumName),r.iconLargeName!==void 0&&(s.IconLargeName=r.iconLargeName);let c=`/EntityDefinitions(${u})`;(0,ne.ensureSuccess)(await e.put(c,s,{headers:{"MSCRM.MergeLabels":"true"}}),e.apiUrl(c))}Q.updateTable=Xx});var mn=g(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.rebuildRaw=wt.assembleChildren=wt.spliceChildren=wt.mergeAttrs=wt.rawFromNode=wt.emptyBag=void 0;var fn=ie(),ly=1e6,Js=512;function Kx(){return{a:[],c:[]}}wt.emptyBag=Kx;function uy(e,t=0){if(t>Js)throw new fn.InvalidArgumentError(`Artifact node tree exceeds the maximum depth of ${Js}`);return{n:e.getNodeName(),a:e.getAllProperties().map(r=>[r.key,r.value]),c:e.getAllChildren().map(r=>uy(r,t+1))}}wt.rawFromNode=uy;function Yx(e,t,r=[]){let n=new Map;for(let[s,l]of t)n.set(s,l);let i=new Set(r.filter(s=>!n.has(s))),a=new Set,o=[];for(let[s,l]of e)i.has(s)||(n.has(s)?o.push([s,n.get(s)]):o.push([s,l]),a.add(s));for(let[s,l]of t)a.has(s)||(o.push([s,l]),a.add(s));return o}wt.mergeAttrs=Yx;function Qs(e,t){let r=new Set;for(let s of e){let l=s.i;if(!Number.isInteger(l)||l<0||l>ly)throw new fn.InvalidArgumentError(`Bag child index must be an integer in [0, ${ly}] (got ${String(l)})`);if(r.has(l))throw new fn.InvalidArgumentError(`Duplicate bag child index ${l}`);r.add(l)}let n=[...e].sort((s,l)=>s.i-l.i),i=[],a=0,o=0;for(let s of n){for(;o<s.i&&a<t.length;)i.push(t[a]),a+=1,o+=1;o<s.i&&(o=s.i),i.push(s.node),o+=1}for(;a<t.length;)i.push(t[a]),a+=1;return i}wt.spliceChildren=Qs;function Zx(e,t){if(e.w){let r={n:e.w.n,a:e.w.a.map(n=>[n[0],n[1]]),c:Qs(e.w.c,t)};return Qs(e.c,[r])}return Qs(e.c,t)}wt.assembleChildren=Zx;function cy(e,t,r,n=0){if(n>Js)throw new fn.InvalidArgumentError(`Artifact node tree exceeds the maximum depth of ${Js}`);eL(e,n);let i=t.make(e.n,r);for(let[a,o]of e.a)t.setProp(i,a,o);for(let a of e.c)t.addChild(i,cy(a,t,i,n+1));return i}wt.rebuildRaw=cy;function eL(e,t){if(e===null||typeof e!="object"||Array.isArray(e))throw new fn.InvalidArgumentError(`Malformed hybrid node at depth ${t}: expected a JSON object`);let r=e;if(typeof r.n!="string")throw new fn.InvalidArgumentError(`Malformed hybrid node at depth ${t}: 'n' (tag name) must be a string`);if(!Array.isArray(r.a)||!Array.isArray(r.c))throw new fn.InvalidArgumentError(`Malformed hybrid node '${r.n}': 'a' and 'c' must be arrays`);for(let n of r.a)if(!Array.isArray(n)||n.length!==2||typeof n[0]!="string"||typeof n[1]!="string")throw new fn.InvalidArgumentError(`Malformed hybrid node '${r.n}': each attribute must be a [string, string] pair`)}});var Gn=g(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.projectElementBag=Oe.serializeNode=Oe.domEngine=Oe.nodeLikeFromDom=Oe.parseXmlRoot=Oe.EMPTY_FORM_SENTINEL=Oe.TEXT_SENTINEL=void 0;var tL=mn(),ro=ie();Oe.TEXT_SENTINEL="#text";Oe.EMPTY_FORM_SENTINEL="#empty";var Ks=new WeakSet;function rL(e,t){let r=e&&e.trim()!==""?e:t,i=new DOMParser().parseFromString(r,"text/xml").documentElement;if(!i)throw new ro.InvalidArgumentError("XML source has no root element (empty or malformed input)");return iL(i),aL(i),lL(i,r),i}Oe.parseXmlRoot=rL;var nL=new Set([1,3]);function iL(e){let t=[e];for(;t.length>0;){let n=t.pop().childNodes;for(let i=0;i<n.length;i+=1){let a=n[i];if(!nL.has(a.nodeType))throw new ro.InvalidArgumentError(`Unsupported XML node type ${a.nodeType} (CDATA / comment / processing-instruction) is outside the hybrid projection's lossless grammar and cannot be round-tripped`);a.nodeType===1&&t.push(a)}}}function aL(e){var t,r;let n=(t=e.ownerDocument)!==null&&t!==void 0?t:e.parentNode;if(!n)return;let i=n.childNodes;for(let a=0;a<i.length;a+=1){let o=i[a];if(o!==e&&!(o.nodeType===3&&((r=o.nodeValue)!==null&&r!==void 0?r:"").trim()===""))throw new ro.InvalidArgumentError(`Unsupported document-level XML node (type ${o.nodeType}: declaration / comment / processing-instruction outside the root element) cannot be round-tripped`)}}function oL(e){let t=[],r=/<([^>]*)>/g;for(let n=r.exec(e);n!==null;n=r.exec(e)){let i=n[1];i.startsWith("/")||i.startsWith("?")||i.startsWith("!")||t.push(i.endsWith("/"))}return t}function sL(e){let t=[],r=[e];for(;r.length>0;){let n=r.pop();t.push(n);let i=n.childNodes;for(let a=i.length-1;a>=0;a-=1){let o=i[a];o.nodeType===1&&r.push(o)}}return t}function py(e){let t=e.childNodes;for(let r=0;r<t.length;r+=1){let n=t[r].nodeType;if(n===1||n===3)return!0}return!1}function lL(e,t){let r=oL(t),n=sL(e),i=Math.min(r.length,n.length);for(let a=0;a<i;a+=1){if(r[a])continue;let o=n[a];py(o)||Ks.add(o)}}function Ud(e){let t=e.nodeType===3;return{getNodeName:()=>t?Oe.TEXT_SENTINEL:e.tagName,getAllProperties:()=>{var r;if(t)return[{key:Oe.TEXT_SENTINEL,value:(r=e.nodeValue)!==null&&r!==void 0?r:""}];let n=e.attributes,i=[];for(let a=0;a<n.length;a+=1)i.push({key:n[a].name,value:n[a].value});return Ks.has(e)&&!py(e)&&i.push({key:Oe.EMPTY_FORM_SENTINEL,value:"1"}),i},getAllChildren:()=>{if(t)return[];let r=[],n=e.childNodes;for(let i=0;i<n.length;i+=1){let a=n[i];(a.nodeType===1||a.nodeType===3)&&r.push(Ud(a))}return r}}}Oe.nodeLikeFromDom=Ud;function uL(e){return{make:t=>t===Oe.TEXT_SENTINEL?e.createTextNode(""):e.createElement(t),setProp:(t,r,n)=>{t.nodeType===3?t.nodeValue=n:r===Oe.EMPTY_FORM_SENTINEL?Ks.add(t):t.setAttribute(r,n)},addChild:(t,r)=>{t.appendChild(r)}}}Oe.domEngine=uL;function fy(e){for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);if(r<=31&&r!==9&&r!==10&&r!==13||r===65534||r===65535)throw Xs(r);if(r>=55296&&r<=56319){let n=e.charCodeAt(t+1);if(!(n>=56320&&n<=57343))throw Xs(r);t+=1;continue}if(r>=56320&&r<=57343)throw Xs(r)}}function Xs(e){let t=e.toString(16).toUpperCase().padStart(4,"0");return new ro.InvalidArgumentError(`Value contains U+${t}, a character not permitted in XML 1.0 (control char / lone surrogate / non-character); it cannot be serialized losslessly`)}function cL(e){return fy(e),String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/\r/g,"&#xD;").replace(/\n/g,"&#xA;").replace(/\t/g,"&#x9;")}function dL(e){return fy(e),String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function pL(e){return my(e,0)}Oe.serializeNode=pL;var dy=512;function my(e,t){var r;if(t>dy)throw new ro.InvalidArgumentError(`XML nesting exceeds the maximum supported depth of ${dy}`);if(e.nodeType===3)return dL((r=e.nodeValue)!==null&&r!==void 0?r:"");let n=e,i="<"+n.tagName,a=n.attributes;for(let l=0;l<a.length;l+=1)i+=" "+a[l].name+'="'+cL(a[l].value)+'"';let o=[],s=n.childNodes;for(let l=0;l<s.length;l+=1){let u=s[l];(u.nodeType===1||u.nodeType===3)&&o.push(u)}if(o.length===0)return Ks.has(n)?i+"></"+n.tagName+">":i+" />";i+=">";for(let l of o)i+=my(l,t+1);return i+"</"+n.tagName+">"}function fL(e){let t=Ud(e);return{a:t.getAllProperties().map(r=>[r.key,r.value]),c:t.getAllChildren().map((r,n)=>({i:n,node:(0,tL.rawFromNode)(r)}))}}Oe.projectElementBag=fL});var qd=g(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});hn.getFormSecurityRoles=hn.setFormSecurityRoles=hn.formApi=void 0;var mL=Kt(),me=be(),Mt=ee(),Ii=ie(),Bd=Gn(),hL="formid,formxml,name,type,objecttypecode,formpresentation,formactivationstate,uniquename,description,versionnumber",gL="formid,name,type,objecttypecode",vL=2,yL={Main:vL,QuickView:6,QuickCreate:7,Card:11};hn.formApi={async get(e,t){let n=`/systemforms(${(0,Mt.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Mt.odataQuery)([["$select",hL]]),i=(0,me.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,me.readEtag)(i)}},async list(e,t){var r;let n=!((r=t?.formTypes)===null||r===void 0)&&r.length?t.formTypes:["Main"],i=[...new Set(n.map(u=>yL[u]))],o=[i.length===1?`type eq ${i[0]}`:`(${i.map(u=>`type eq ${u}`).join(" or ")})`];t?.entityLogicalName&&o.push(`objecttypecode eq '${(0,Mt.odataLiteral)(t.entityLogicalName)}'`);let s=`/systemforms${(0,Mt.odataQuery)([["$select",gL],["$filter",o.join(" and ")]])}`;return(await(0,mL.collectPages)(e,s,"listArtifacts('form')")).map(u=>{var c,d;return{type:"form",id:(c=u.formid)!==null&&c!==void 0?c:"",name:(d=u.name)!==null&&d!==void 0?d:"",entityLogicalName:u.objecttypecode,isDirty:!1}})},async create(e,t,r){let n=(0,me.echoWrite)("formid"),i=`/systemforms${n.query}`,a=(0,me.ensureSuccess)(await e.post(i,(0,me.withClientMintedId)(t,"formid",r),n.options),e.apiUrl(i));return{id:(0,me.resolveCreatedId)(a,"formid","form",r),etag:(0,me.readEtag)(a)}},async update(e,t,r,n){let i=(0,Mt.normalizeGuid)(t,"id");await vy(e,i,gy(i),n);let a=await hy(e,i),o=(0,me.echoWrite)("formid",{"If-Match":(0,me.requireEtag)(a,"form",i)}),s=`/systemforms(${i})${o.query}`;return(0,me.ensureSuccess)(await e.patch(s,r,o.options),e.apiUrl(s)),{id:i,etag:await wL(e,i)}},delete(e,t){return(0,me.deleteRecord)(e,"systemforms",t)}};var $d="DisplayConditions";async function bL(e,t,r){var n,i,a,o,s;if(r.everyone&&r.roleIds&&r.roleIds.length>0)throw new Ii.InvalidArgumentError("setFormSecurityRoles: `everyone` and `roleIds` are mutually exclusive \u2014 the platform models <Everyone /> as a replacement for the <Role> list, not an addition to it.");let l=(0,Mt.normalizeGuid)(t,"formId"),u=`/systemforms(${l})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Mt.odataQuery)([["$select","formid,formxml"]]),c=(0,me.ensureSuccess)(await e.get(u),e.apiUrl(u)),d=(0,me.readEtag)(c),p=c.body,f=p?.formxml;if(!f)throw new Ii.InvalidArgumentError(`form '${l}' returned no formxml, so its roles cannot be set`);let h=(0,Bd.parseXmlRoot)(f,"<form/>"),y=h.ownerDocument;if(!y)throw new Ii.InvalidArgumentError(`form '${l}' produced no owner document`);let w=yy(h,$d),N=(n=w?.getAttribute("Order"))!==null&&n!==void 0?n:void 0,D=(i=w?.getAttribute("FallbackForm"))!==null&&i!==void 0?i:void 0;w&&h.removeChild(w);let x=!!r.everyone||((o=(a=r.roleIds)===null||a===void 0?void 0:a.length)!==null&&o!==void 0?o:0)>0;if(!x&&(r.order!==void 0||r.fallbackForm!==void 0)){if(!w)throw new Ii.InvalidArgumentError("setFormSecurityRoles: `order`/`fallbackForm` were supplied without `roleIds` or `everyone`, but this form has no <DisplayConditions> to attach them to. Pass the roles as well.");r.order!==void 0&&w.setAttribute("Order",String(r.order)),r.fallbackForm!==void 0&&w.setAttribute("FallbackForm",String(r.fallbackForm)),h.appendChild(w)}else if(x){let U=y.createElement($d),B=r.order!==void 0?String(r.order):N;B!==void 0&&U.setAttribute("Order",B);let z=r.fallbackForm!==void 0?String(r.fallbackForm):D??"false";if(U.setAttribute("FallbackForm",z),r.everyone)U.appendChild(y.createElement("Everyone"));else for(let $ of(s=r.roleIds)!==null&&s!==void 0?s:[]){let Ee=y.createElement("Role");Ee.setAttribute("Id",`{${(0,Mt.normalizeGuid)($,"roleId")}}`),U.appendChild(Ee)}h.appendChild(U)}let X=(0,Bd.serializeNode)(h);await vy(e,l,u,d);let V=await hy(e,l),M=`/systemforms(${l})`;(0,me.ensureSuccess)(await e.patch(M,{formxml:X},{headers:{"Content-Type":"application/json","If-Match":(0,me.requireEtag)(V,"form",l)}}),e.apiUrl(M))}hn.setFormSecurityRoles=bL;async function hy(e,t){let r=`/systemforms(${t})${(0,Mt.odataQuery)([["$select","formid"]])}`;return(0,me.readEtag)((0,me.ensureSuccess)(await e.get(r),e.apiUrl(r)))}function gy(e){return`/systemforms(${e})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Mt.odataQuery)([["$select","formid"]])}async function wL(e,t){let r=gy(t);return(0,me.readEtag)((0,me.ensureSuccess)(await e.get(r),e.apiUrl(r)))}async function vy(e,t,r,n){(0,me.requireEtag)(n,"form",t);let i=(0,me.readEtag)((0,me.ensureSuccess)(await e.get(r),e.apiUrl(r)));if(i===null)throw new Ii.SdkError(me.VERSION_CONFLICT_CODE,`Refusing to write form '${t}': its current version could not be read, so the write could not be verified as conditional and would risk silently overwriting a concurrent edit.`);if(i!==n)throw new Ii.SdkError(me.VERSION_CONFLICT_CODE,`Version conflict writing form '${t}': its formxml changed on the server since it was read (held ${n}, server ${i}). Re-fetch the form and re-apply the change.`)}function yy(e,t){let r=e.childNodes;for(let n=0;n<r.length;n+=1){let i=r[n];if(i.nodeType===1&&i.tagName===t)return i}}async function AL(e,t){var r,n;let a=`/systemforms(${(0,Mt.normalizeGuid)(t,"formId")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Mt.odataQuery)([["$select","formid,formxml"]]),s=(r=(0,me.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||r===void 0?void 0:r.formxml;if(!s)return;let l=(0,Bd.parseXmlRoot)(s,"<form/>"),u=yy(l,$d);if(!u)return;let c=[],d=!1,p=u.childNodes;for(let h=0;h<p.length;h+=1){let y=p[h];if(y.nodeType!==1)continue;let w=y;if(w.tagName==="Everyone")d=!0;else if(w.tagName==="Role"){let N=(n=w.getAttribute("Id"))!==null&&n!==void 0?n:"";N&&c.push(N.replace(/[{}]/g,"").toLowerCase())}}let f=u.getAttribute("Order");return{...d?{everyone:!0}:{},...c.length>0?{roleIds:c}:{},fallbackForm:u.getAttribute("FallbackForm")==="true",...f!==null&&f!==""?{order:Number(f)}:{}}}hn.getFormSecurityRoles=AL});var el=g(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.disassociateRecords=De.associateRecords=De.createRecordsBulk=De.upsertRecord=De.queryAllRecords=De.queryRecords=De.getRecord=De.deleteRecord=De.updateRecord=De.createRecord=void 0;var CL=Kt(),er=be(),it=ee(),Ys=ie(),mr=Hs();function Zs(e){let t=e,r=!1,n={};for(let i of Object.keys(t)){let a=t[i];Array.isArray(a)&&a.every(o=>typeof o=="number")?(n[i]=a.join(","),r=!0):n[i]=a}return r?n:e}async function SL(e,t,r){let i=`/${await(0,mr.resolveEntitySetName)(e,t)}`,a=(0,er.ensureSuccess)(await e.post(i,Zs(r)),e.apiUrl(i)),o=(0,er.readCreatedId)(a,`${t}id`);if(!o)throw new Ys.InvalidArgumentError(`Dataverse did not return an id for the created '${t}' row`);return{id:o,entityType:t}}De.createRecord=SL;async function EL(e,t,r,n){let i=(0,it.normalizeGuid)(r,"id"),o=`/${await(0,mr.resolveEntitySetName)(e,t)}(${i})`;(0,er.ensureSuccess)(await e.patch(o,Zs(n)),e.apiUrl(o))}De.updateRecord=EL;async function NL(e,t,r){let n=(0,it.normalizeGuid)(r,"id"),a=`/${await(0,mr.resolveEntitySetName)(e,t)}(${n})`;(0,er.ensureSuccess)(await e.delete(a),e.apiUrl(a))}De.deleteRecord=NL;async function DL(e,t,r,n){var i;let a=(0,it.normalizeGuid)(r,"id"),o=await(0,mr.resolveEntitySetName)(e,t),s=(0,it.odataQuery)([["$select",n&&n.length>0?n.join(","):void 0]]),l=`/${o}(${a})${s}`;return(i=(0,er.ensureSuccess)(await e.get(l),e.apiUrl(l)).body)!==null&&i!==void 0?i:{}}De.getRecord=DL;function IL(e){return e?.fetchXml?(0,it.odataQuery)([["fetchXml",e.fetchXml]]):(0,it.odataQuery)([["$select",e?.select&&e.select.length>0?e.select.join(","):void 0],["$filter",e?.filter],["$orderby",e?.orderBy],["$expand",e?.expand],["$top",e?.top]])}async function by(e,t,r){var n,i;if(r?.paginate){if(r.top!==void 0)throw new Ys.InvalidArgumentError("queryRecords: `paginate` cannot be combined with `top` \u2014 Dataverse honors $top as a hard cap and omits @odata.nextLink, so the result would be silently capped at one page.");if(r.fetchXml)throw new Ys.InvalidArgumentError("queryRecords: `paginate` is not supported with `fetchXml` \u2014 FetchXML paging uses a paging cookie (page / fetchxmlpagingcookie), not @odata.nextLink. Page the FetchXML manually, or use an OData query.")}let o=`/${await(0,mr.resolveEntitySetName)(e,t)}${IL(r)}`;return r?.paginate?(0,CL.collectPages)(e,o,"queryRecords"):(i=(n=(0,er.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[]}De.queryRecords=by;async function _L(e,t,r){return by(e,t,{...r,paginate:!0})}De.queryAllRecords=_L;function PL(e){if("id"in e)return`(${(0,it.normalizeGuid)(e.id,"id")})`;let t=typeof e.value=="string"?`'${(0,it.odataPathLiteral)(e.value)}'`:e.value;return`(${(0,it.assertODataName)(e.key,"alternate key name")}=${t})`}async function TL(e,t,r,n){let i=PL(r),o=`/${await(0,mr.resolveEntitySetName)(e,t)}${i}`,s=(0,er.ensureSuccess)(await e.patch(o,Zs(n)),e.apiUrl(o)),l=s.status===201,u=(0,er.readCreatedId)(s,`${t}id`);return{id:u??("id"in r?(0,it.normalizeGuid)(r.id,"id"):""),created:l}}De.upsertRecord=TL;async function OL(e,t,r){var n,i;if(r.length===0)return[];let a=await(0,mr.resolveEntitySetName)(e,t),o=r.map(c=>({"@odata.type":`Microsoft.Dynamics.CRM.${t}`,...Zs(c)})),s=`/${a}/Microsoft.Dynamics.CRM.CreateMultiple`,u=(i=(n=(0,er.ensureSuccess)(await e.post(s,{Targets:o}),e.apiUrl(s)).body)===null||n===void 0?void 0:n.Ids)!==null&&i!==void 0?i:[];if(u.length!==r.length)throw new Ys.InvalidArgumentError(`CreateMultiple on '${t}' returned ${u.length} id(s) for ${r.length} row(s)`);return u}De.createRecordsBulk=OL;async function RL(e,t,r,n){let i=(0,it.normalizeGuid)(r,"id"),a=(0,it.normalizeGuid)(n.targetId,"targetId"),o=await(0,mr.resolveEntitySetName)(e,t),s=await(0,mr.resolveEntitySetName)(e,n.targetEntity),l=(0,it.assertODataName)(n.relationshipName,"relationshipName"),u=`/${o}(${i})/${l}/$ref`,c={"@odata.id":e.apiUrl(`/${s}(${a})`)};(0,er.ensureSuccess)(await e.post(u,c),e.apiUrl(u))}De.associateRecords=RL;async function FL(e,t,r,n,i){let a=(0,it.normalizeGuid)(r,"id"),o=(0,it.normalizeGuid)(i,"targetId"),s=await(0,mr.resolveEntitySetName)(e,t),l=(0,it.assertODataName)(n,"relationshipName"),u=`/${s}(${a})/${l}(${o})/$ref`;(0,er.ensureSuccess)(await e.delete(u),e.apiUrl(u))}De.disassociateRecords=FL});var Cy=g(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.deleteWebResource=hr.getWebResource=hr.updateWebResource=hr.createWebResource=void 0;var xL=Yt(),no=be(),tl=ee(),Vd=ie(),LL={html:1,css:2,js:3,xml:4,png:5,jpg:6,gif:7,xsl:9,ico:10,svg:11,resx:12};function kL(e){let t=globalThis;if(t.Buffer)return t.Buffer.from(e,"utf8").toString("base64");if(t.btoa){let r=globalThis.TextEncoder;if(r){let n=new r().encode(e),i="",a=32768;for(let o=0;o<n.length;o+=a)i+=String.fromCharCode(...n.subarray(o,o+a));return t.btoa(i)}return t.btoa(e)}throw new Vd.InvalidArgumentError("no base64 encoder available; pass contentBase64 instead of content")}function wy(e){if(e.contentBase64!==void 0)return e.contentBase64;if(e.content!==void 0)return kL(e.content)}async function Ay(e,t){return(0,xL.publishWebResourceById)(e,t)}async function ML(e,t){var r;let n=wy(t);if(n===void 0)throw new Vd.InvalidArgumentError(`web resource '${t.name}' requires content or contentBase64`);let i={name:t.name,displayname:(r=t.displayName)!==null&&r!==void 0?r:t.name,webresourcetype:LL[t.type],content:n};t.description&&(i.description=t.description);let a=(0,no.ensureSuccess)(await e.post("/webresourceset",i),e.apiUrl("/webresourceset")),o=(0,no.readCreatedId)(a,"webresourceid");if(!o)throw new Vd.InvalidArgumentError(`Dataverse did not return an id for web resource '${t.name}'`);return t.publish!==!1&&await Ay(e,o),{id:o,name:t.name}}hr.createWebResource=ML;async function UL(e,t,r){let n=(0,tl.normalizeGuid)(t,"id"),i={},a=wy(r);a!==void 0&&(i.content=a),r.displayName!==void 0&&(i.displayname=r.displayName),r.description!==void 0&&(i.description=r.description);let o=`/webresourceset(${n})`;(0,no.ensureSuccess)(await e.patch(o,i),e.apiUrl(o)),r.publish!==!1&&await Ay(e,n)}hr.updateWebResource=UL;async function BL(e,t){var r;let i=`/webresourceset(${(0,tl.normalizeGuid)(t,"id")})${(0,tl.odataQuery)([["$select","name,displayname,webresourcetype,content,description"]])}`;return(r=(0,no.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)!==null&&r!==void 0?r:{}}hr.getWebResource=BL;async function $L(e,t){let n=`/webresourceset(${(0,tl.normalizeGuid)(t,"id")})`;(0,no.ensureSuccess)(await e.delete(n),e.apiUrl(n))}hr.deleteWebResource=$L});var rl=g(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.applyAppSettings=We.setAppSetting=We.readAppSettings=We.resolveSettingDefinitions=We.APP_SETTING_UNSET=We.APP_SETTING_OFF=We.APP_SETTING_ON=We.HEADER_AND_NAVIGATION_REFRESH=void 0;var _i=be(),Br=ee();We.HEADER_AND_NAVIGATION_REFRESH="HeaderAndNavigationRefresh";We.APP_SETTING_ON="2";We.APP_SETTING_OFF="1";We.APP_SETTING_UNSET="0";function Ny(e,t){return"/appsettings/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,Br.odataQuery)([["$select",e],["$filter",t]])}async function Dy(e,t){var r,n;let i=[...new Set(t.filter(Boolean))],a=new Map;if(i.length===0)return a;let o=i.map(c=>`uniquename eq '${(0,Br.odataLiteral)(c)}'`).join(" or "),s=`/settingdefinitions${(0,Br.odataQuery)([["$select","settingdefinitionid,uniquename,displayname"],["$filter",o]])}`,u=((n=(r=(0,_i.ensureSuccess)(await e.get(s),e.apiUrl(s)).body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[]).filter(Boolean);for(let c of u)c.uniquename&&a.set(c.uniquename,c);return a}We.resolveSettingDefinitions=Dy;async function qL(e,t){var r,n,i,a;let o=(0,Br.normalizeGuid)(t,"App id"),s=Ny("appsettingid,value,_settingdefinitionid_value",`_parentappmoduleid_value eq ${o}`),u=((n=(r=(0,_i.ensureSuccess)(await e.get(s),e.apiUrl(s)).body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[]).filter(Boolean);if(u.length===0)return[];let c=[...new Set(u.map(p=>p._settingdefinitionid_value).filter(Boolean))],d=new Map;if(c.length>0){let p=c.map(y=>`settingdefinitionid eq ${(0,Br.normalizeGuid)(y,"Setting definition id")}`).join(" or "),f=`/settingdefinitions${(0,Br.odataQuery)([["$select","settingdefinitionid,uniquename,displayname"],["$filter",p]])}`,h=(0,_i.ensureSuccess)(await e.get(f),e.apiUrl(f));for(let y of((a=(i=h.body)===null||i===void 0?void 0:i.value)!==null&&a!==void 0?a:[]).filter(Boolean))y.settingdefinitionid&&d.set(y.settingdefinitionid.toLowerCase(),y)}return u.map(p=>{var f,h,y,w,N;let D=d.get(((f=p._settingdefinitionid_value)!==null&&f!==void 0?f:"").toLowerCase());return{id:(h=p.appsettingid)!==null&&h!==void 0?h:"",name:(w=(y=D?.uniquename)!==null&&y!==void 0?y:p._settingdefinitionid_value)!==null&&w!==void 0?w:"",value:(N=p.value)!==null&&N!==void 0?N:"",...D?.displayname?{displayName:D.displayname}:{}}})}We.readAppSettings=qL;async function Sy(e,t,r){var n,i,a;let o=Ny("appsettingid,value",`_parentappmoduleid_value eq ${t} and _settingdefinitionid_value eq ${r}`),l=((i=(n=(0,_i.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[]).filter(Boolean)[0];return l?.appsettingid?{id:l.appsettingid,value:(a=l.value)!==null&&a!==void 0?a:""}:void 0}async function Iy(e,t,r,n){let i=(0,Br.normalizeGuid)(t,"App id"),o=(await Dy(e,[r])).get(r),s=o?.settingdefinitionid;if(!s)throw new Error(`App setting '${r}' is not available in this environment: no settingdefinition row has that uniquename. The feature may be version-gated or its solution may not be installed.`);let l=(0,Br.normalizeGuid)(s,"Setting definition id"),u=await Sy(e,i,l);if(u)return Ey(e,u,n);let c="/appsettings",d={"[email protected]":`/appmodules(${i})`,"[email protected]":`/settingdefinitions(${l})`,value:n},p,f;try{if(p=await e.post(c,d),p.status>=200&&p.status<300)return"created"}catch(y){f=y}let h;try{h=await Sy(e,i,l)}catch{h=void 0}if(h)return Ey(e,h,n);throw p&&(0,_i.ensureSuccess)(p,e.apiUrl(c)),f}We.setAppSetting=Iy;async function Ey(e,t,r){if(t.value===r)return"unchanged";let n=`/appsettings(${(0,Br.normalizeGuid)(t.id,"App setting id")})`;return(0,_i.ensureSuccess)(await e.patch(n,{value:r}),e.apiUrl(n)),"updated"}async function VL(e,t,r){var n;let i=[];for(let[a,o]of Object.entries(r??{}))try{await Iy(e,t,a,o)}catch(s){i.push(`App setting '${a}' was not applied: ${(n=s?.message)!==null&&n!==void 0?n:String(s)} The app was created; set it later with setAppSetting().`)}return i}We.applyAppSettings=VL});var il=g(nl=>{"use strict";Object.defineProperty(nl,"__esModule",{value:!0});nl.HEADER_NAV_BOOLEAN_RULE=void 0;nl.HEADER_NAV_BOOLEAN_RULE="headerAndNavigationRefresh-must-be-boolean"});var Py=g(Z=>{"use strict";Object.defineProperty(Z,"__esModule",{value:!0});Z.deleteSolution=Z.importSolution=Z.exportSolution=Z.removeSolutionComponent=Z.addSolutionComponent=Z.setSolutionVersion=Z.createSolution=Z.createPublisher=Z.getSolution=Z.fetchSolutionComponents=Z.SolutionComponentType=void 0;var _y=Kt(),tr=be(),At=ee(),zn=ie();Z.SolutionComponentType={SavedQuery:26,Workflow:29,SavedQueryVisualization:59,SystemForm:60,AppModule:80,UxAgentProject:10372};var GL=[Z.SolutionComponentType.SavedQuery,Z.SolutionComponentType.Workflow,Z.SolutionComponentType.SavedQueryVisualization,Z.SolutionComponentType.SystemForm,Z.SolutionComponentType.AppModule,Z.SolutionComponentType.UxAgentProject];async function zL(e,t){let r=(0,At.normalizeGuid)(t,"solutionId"),n=GL.map(s=>`msdyn_componenttype eq ${s}`).join(" or "),i=`/msdyn_solutioncomponentsummaries${(0,At.odataQuery)([["$select","msdyn_objectid,msdyn_componenttype,msdyn_workflowcategory,msdyn_displayname,msdyn_name"],["$filter",`msdyn_solutionid eq ${r} and (${n})`]])}`,o=(await(0,_y.collectPages)(e,i,"fetchSolutionComponents")).filter(s=>typeof s.msdyn_objectid=="string").map(s=>({objectId:s.msdyn_objectid,componentType:Number(s.msdyn_componenttype),workflowCategory:s.msdyn_workflowcategory==null?void 0:Number(s.msdyn_workflowcategory),displayName:s.msdyn_displayname,name:s.msdyn_name}));return[...o,...await WL(e,r,o)]}Z.fetchSolutionComponents=zL;async function WL(e,t,r){let n=new Set(r.map(s=>s.objectId.toLowerCase())),i=`/solutioncomponents${(0,At.odataQuery)([["$select","objectid,componenttype"],["$filter",`_solutionid_value eq ${t} and componenttype eq ${Z.SolutionComponentType.UxAgentProject}`]])}`,a=await(0,_y.collectPages)(e,i,"fetchSolutionComponents(draft pages)"),o=[];for(let s of a){let l=typeof s.objectid=="string"?s.objectid:void 0;l&&!n.has(l.toLowerCase())&&(n.add(l.toLowerCase()),o.push({objectId:l,componentType:Z.SolutionComponentType.UxAgentProject}))}return o}function jL(e){let t=e.length===38&&e.startsWith("{")&&e.endsWith("}")?e.slice(1,-1):e;return/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(t)}async function HL(e,t){var r,n,i,a,o,s,l,u,c,d;let p=String(t??"").trim();if(!p)throw new zn.InvalidArgumentError("getSolution: a solution unique name or id is required.");let f=jL(p)?`solutionid eq ${(0,At.normalizeGuid)(p,"solutionId")}`:`uniquename eq '${(0,At.odataLiteral)(p)}'`,h=`/solutions${(0,At.odataQuery)([["$select","solutionid,uniquename,friendlyname,version,ismanaged"],["$expand","publisherid($select=publisherid,uniquename,customizationprefix,customizationoptionvalueprefix)"],["$filter",f]])}`,N=((n=(r=(0,tr.ensureSuccess)(await e.get(h),e.apiUrl(h)).body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[])[0];if(!N?.solutionid)throw new zn.InvalidArgumentError(`No solution found for '${t}'.`);let D=N.publisherid;if(!D?.publisherid)throw new zn.InvalidArgumentError(`Solution '${(i=N.uniquename)!==null&&i!==void 0?i:t}' returned no owning publisher, so its customization prefix cannot be determined; refusing to report an empty prefix that could be mistaken for "no prefix".`);if(!("customizationprefix"in D))throw new zn.InvalidArgumentError(`Solution '${(a=N.uniquename)!==null&&a!==void 0?a:t}' returned a publisher without a customizationprefix property (partial expansion), so its prefix cannot be determined.`);return{solutionId:(0,At.normalizeGuid)(N.solutionid,"solutionId"),uniqueName:(o=N.uniquename)!==null&&o!==void 0?o:"",friendlyName:(s=N.friendlyname)!==null&&s!==void 0?s:"",version:(l=N.version)!==null&&l!==void 0?l:"",isManaged:!!N.ismanaged,publisherId:(0,At.normalizeGuid)(D.publisherid,"publisherId"),publisherUniqueName:(u=D.uniquename)!==null&&u!==void 0?u:"",publisherPrefix:(c=D.customizationprefix)!==null&&c!==void 0?c:"",publisherOptionValuePrefix:(d=D.customizationoptionvalueprefix)!==null&&d!==void 0?d:0}}Z.getSolution=HL;async function QL(e,t){var r;let n={uniquename:t.uniqueName,friendlyname:t.friendlyName,customizationprefix:t.prefix,customizationoptionvalueprefix:(r=t.optionValuePrefix)!==null&&r!==void 0?r:1e4};t.description&&(n.description=t.description);let i=(0,tr.ensureSuccess)(await e.post("/publishers",n),e.apiUrl("/publishers")),a=(0,tr.readCreatedId)(i,"publisherid");if(!a)throw new zn.InvalidArgumentError(`Dataverse did not return an id for publisher '${t.uniqueName}'`);return{id:a,uniqueName:t.uniqueName}}Z.createPublisher=QL;async function JL(e,t){var r;let n=(0,At.normalizeGuid)(t.publisherId,"publisherId"),i={uniquename:t.uniqueName,friendlyname:t.friendlyName,version:(r=t.version)!==null&&r!==void 0?r:"1.0.0.0","[email protected]":`/publishers(${n})`};t.description&&(i.description=t.description);let a=(0,tr.ensureSuccess)(await e.post("/solutions",i),e.apiUrl("/solutions")),o=(0,tr.readCreatedId)(a,"solutionid");if(!o)throw new zn.InvalidArgumentError(`Dataverse did not return an id for solution '${t.uniqueName}'`);return{id:o,uniqueName:t.uniqueName}}Z.createSolution=JL;async function XL(e,t,r){let i=`/solutions(${(0,At.normalizeGuid)(t,"solutionId")})`;(0,tr.ensureSuccess)(await e.patch(i,{version:r}),e.apiUrl(i))}Z.setSolutionVersion=XL;async function KL(e,t){var r;let i={ComponentId:(0,At.normalizeGuid)(t.componentId,"componentId"),ComponentType:t.componentType,SolutionUniqueName:t.solutionUniqueName,AddRequiredComponents:(r=t.addRequiredComponents)!==null&&r!==void 0?r:!1};t.doNotIncludeSubcomponents!==void 0&&(i.DoNotIncludeSubcomponents=t.doNotIncludeSubcomponents),(0,tr.ensureSuccess)(await e.post("/AddSolutionComponent",i),e.apiUrl("/AddSolutionComponent"))}Z.addSolutionComponent=KL;async function YL(e,t,r,n){let a={SolutionComponent:{"@odata.type":"Microsoft.Dynamics.CRM.solutioncomponent",solutioncomponentid:(0,At.normalizeGuid)(t,"componentId")},ComponentType:r,SolutionUniqueName:n};(0,tr.ensureSuccess)(await e.post("/RemoveSolutionComponent",a),e.apiUrl("/RemoveSolutionComponent"))}Z.removeSolutionComponent=YL;async function ZL(e,t){var r,n;let i={SolutionName:t.solutionName,Managed:(r=t.managed)!==null&&r!==void 0?r:!1},o=(n=(0,tr.ensureSuccess)(await e.post("/ExportSolution",i),e.apiUrl("/ExportSolution")).body)===null||n===void 0?void 0:n.ExportSolutionFile;if(!o)throw new zn.InvalidArgumentError(`ExportSolution returned no file for '${t.solutionName}'`);return{base64:o}}Z.exportSolution=ZL;async function ek(e,t){var r,n;let i={OverwriteUnmanagedCustomizations:(r=t.overwriteUnmanagedCustomizations)!==null&&r!==void 0?r:!0,PublishWorkflows:(n=t.publishWorkflows)!==null&&n!==void 0?n:!0,CustomizationFile:t.base64};t.importJobId&&(i.ImportJobId=(0,At.normalizeGuid)(t.importJobId,"importJobId")),(0,tr.ensureSuccess)(await e.post("/ImportSolution",i),e.apiUrl("/ImportSolution"))}Z.importSolution=ek;async function tk(e,t){let n=`/solutions(${(0,At.normalizeGuid)(t,"solutionId")})`;(0,tr.ensureSuccess)(await e.delete(n),e.apiUrl(n))}Z.deleteSolution=tk});var sl=g(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.appApi=gn.deleteAppResolvingOnce=gn.unpublishedAppModulesQuery=void 0;var Qd=Kt(),rk=Xd(),Ty=Yt(),nk=rl(),Ae=be(),ae=ee(),Hd=bt(),ik=Fd(),he=ie(),ak=(0,ae.odataQuery)([["$select","appmoduleid,name,uniquename,description"]]),Gd="appmoduleid,name,uniquename,description";function My(e,t,r){return"/appmodules/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,ae.odataQuery)([["$select",e],["$filter",t],["$top",r]])}gn.unpublishedAppModulesQuery=My;function zd(e,t){return My(e,t?`appmoduleid eq ${t}`:void 0,t?1:void 0)}function ol(e,t){return"/sitemaps/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,ae.odataQuery)([["$select",t],["$filter",`sitemapid eq ${e}`],["$top",1]])}function Pi(e){var t;let r=(t=e.body)===null||t===void 0?void 0:t.value;if(Array.isArray(r))return r[0]}function al(e){let t=e?.["@odata.etag"];return typeof t=="string"?t:null}function io(e){let t=new Set,r=[];for(let n of e??[])n&&!t.has(n)&&(t.add(n),r.push(n));return r}function ok(e){return`cdsapp_${(e||"").replace(/[^a-zA-Z0-9]/g,"")||"app"}`}async function Uy(e,t){var r,n;let i=u=>{throw new he.SdkError("APP_SITEMAP_UNRESOLVED",`The sitemap lookup for app uniquename '${t??""}' ${u}, so it cannot be determined whether this app has a sitemap. Retry; if the app is newly created, publish it first (an unpublished app is not readable).`)};if(!t)return i("cannot run because the app record carried no uniquename");let a=`/sitemaps${(0,ae.odataQuery)([["$select","sitemapid"],["$filter",`sitemapnameunique eq '${(0,ae.odataLiteral)(t)}'`],["$top",1]])}`,o;try{o=await e.get(a)}catch(u){return i(`failed (${u.message})`)}if(o.status<200||o.status>=300)return i(`returned HTTP ${o.status}`);let s=(r=o.body)===null||r===void 0?void 0:r.value;if(!Array.isArray(s))return i("returned a malformed body");let l=(n=s[0])===null||n===void 0?void 0:n.sitemapid;return s.length>0&&!l?i("returned a row with no sitemapid"):l}async function sk(e){let t=s=>{var l,u,c;return(c=(u=(l=s.body)===null||l===void 0?void 0:l.value)===null||u===void 0?void 0:u[0])===null||c===void 0?void 0:c.webresourceid},r=s=>`/webresourceset${(0,ae.odataQuery)([["$select","webresourceid"],["$top",1],["$filter",s]])}`,n="(webresourcetype eq 5 or webresourcetype eq 6 or webresourcetype eq 7 or webresourcetype eq 10 or webresourcetype eq 11)",i=t(await e.get(r("webresourcetype eq 5 and ismanaged eq false and contains(name,'icon')")));if(i)return{id:i,managed:!1};let a=t(await e.get(r(`${n} and ismanaged eq false`)));if(a)return{id:a,managed:!1};let o=t(await e.get(r(n)));return o?{id:o,managed:!0}:void 0}function Jd(e){return e instanceof Error?e.message:String(e)}async function lk(e,t){var r,n,i;try{let a=`/roles${(0,ae.odataQuery)([["$select","roleid"],["$filter","name eq 'System Administrator'"],["$top",1]])}`,s=(i=(n=(r=(0,Ae.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||r===void 0?void 0:r.value)===null||n===void 0?void 0:n[0])===null||i===void 0?void 0:i.roleid;if(!s)return"App roles: no 'System Administrator' role was found in this environment, so the app was created with NO security role associated \u2014 it will not be visible or playable until a role is granted access to it.";let l=`/appmodules(${t})/appmoduleroles_association/$ref`;return(0,Ae.ensureSuccess)(await e.post(l,{"@odata.id":e.apiUrl(`/roles(${s})`)}),e.apiUrl(l)),null}catch(a){return`App roles: could not associate the 'System Administrator' role with the app (${Jd(a)}); it will not be visible or playable until a role is granted access to it.`}}async function uk(e,t){let r=[];async function n(s,l,u){try{return(await(0,Qd.collectPages)(e,s,`app assets (${u} for '${t}')`)).map(d=>String(d[l])).filter(d=>d&&d!=="undefined")}catch(c){return r.push(`App components: could not enumerate ${u} for table '${t}' (${Jd(c)}); they were NOT added to the app.`),[]}}let[i,a,o]=await Promise.all([n(`/systemforms${(0,ae.odataQuery)([["$select","formid"],["$filter",`objecttypecode eq '${(0,ae.odataLiteral)(t)}' and type eq 2 and formactivationstate eq 1`]])}`,"formid","forms"),n(`/savedqueries${(0,ae.odataQuery)([["$select","savedqueryid"],["$filter",`returnedtypecode eq '${(0,ae.odataLiteral)(t)}' and querytype eq 0 and statecode eq 0`]])}`,"savedqueryid","views"),n(`/savedqueryvisualizations${(0,ae.odataQuery)([["$select","savedqueryvisualizationid"],["$filter",`primaryentitytypecode eq '${(0,ae.odataLiteral)(t)}'`]])}`,"savedqueryvisualizationid","charts")]);return{forms:i,views:a,charts:o,warnings:r}}var Oy=new WeakMap;async function ck(e,t){let r=Oy.get(e);r||(r=new Map,Oy.set(e,r));let n=r.get(t);if(n!==void 0)return n;let i=await dk(e,t);return i&&r.set(t,i),i}async function Ry(e,t,r){let n=new Array(e.length),i=0;async function a(){for(let o=i;o<e.length;o=i)i=o+1,n[o]=await r(e[o])}return await Promise.all(Array.from({length:Math.min(t,e.length)},()=>a())),n}async function dk(e,t){let r=`/EntityDefinitions(LogicalName='${(0,ae.odataLiteral)(t)}')${(0,ae.odataQuery)([["$select","MetadataId,EntitySetName"]])}`,n=await e.get(r);if(n.status>=200&&n.status<300){let i=n.body;if(i?.MetadataId&&i.EntitySetName)return{logicalName:t,metadataId:i.MetadataId,entitySetName:i.EntitySetName}}}async function Fy(e,t){let r=[],n=io(t.entities),i=4,a=await Ry(n,i,f=>ck(e,f)),o=n.filter((f,h)=>!a[h]);if(o.length>0)throw new he.SdkError("APP_ENTITY_COMPONENT_UNRESOLVED",`Refusing to build app components: table(s) ${o.map(f=>`'${f}'`).join(", ")} could not be resolved to an EntityDefinitions MetadataId + EntitySetName. Pinning the rest would produce an app whose navigation references a table the app does not contain. Verify the table name(s) exist in this environment and retry.`);let s=a.filter(f=>!!f);for(let f of s)r.push({"@odata.id":`${f.entitySetName}(${f.metadataId})`});for(let f of io(t.components.forms))r.push({"@odata.type":"Microsoft.Dynamics.CRM.systemform",formid:f});for(let f of io(t.components.views))r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedquery",savedqueryid:f});for(let f of io(t.components.charts))r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedqueryvisualization",savedqueryvisualizationid:f});for(let f of io(t.components.dashboards))r.push({"@odata.type":"Microsoft.Dynamics.CRM.systemform",formid:f});let l=new Set(t.components.forms),u=new Set(t.components.views),c=new Set(t.components.charts),d=await Ry(n,i,f=>uk(e,f)),p=d.flatMap(f=>f.warnings);for(let f of d){for(let h of f.forms)l.has(h)||(l.add(h),r.push({"@odata.type":"Microsoft.Dynamics.CRM.systemform",formid:h}));for(let h of f.views)u.has(h)||(u.add(h),r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedquery",savedqueryid:h}));for(let h of f.charts)c.has(h)||(c.add(h),r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedqueryvisualization",savedqueryvisualizationid:h}))}return{components:r,tables:s,warnings:p}}async function xy(e,t,r){if(r.length===0)return;let n="/AddAppComponents";(0,Ae.ensureSuccess)(await e.post(n,{AppId:t,Components:r}),e.apiUrl(n))}function pk(e){return"/appmodules/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,ae.odataQuery)([["$select","appmoduleid,appmoduleidunique"],["$filter",`appmoduleid eq ${e}`],["$top",1]])}async function Ly(e,t,r){var n;if(r.length===0)return;let i=pk(t),a=await e.get(i);if(a.status<200||a.status>=300)throw new he.SdkError("APP_COMPONENTS_UNVERIFIED",`App '${t}': its components were written but could not be verified \u2014 the unpublished-aware read returned HTTP ${a.status}. Re-push to retry.`);let o=Pi(a),s=o?.appmoduleidunique;if(typeof s!="string"||!s)throw new he.SdkError("APP_COMPONENTS_UNVERIFIED",`App '${t}': its components were written but could not be verified \u2014 the app did not return an 'appmoduleidunique' to file components under. Re-push to retry.`);let l=`/appmodulecomponents${(0,ae.odataQuery)([["$select","objectid,componenttype"],["$filter",`_appmoduleidunique_value eq ${(0,ae.normalizeGuid)(s,`App '${t}' appmoduleidunique`)} and componenttype eq 1`]])}`,u=await e.get(l);if(u.status<200||u.status>=300)throw new he.SdkError("APP_COMPONENTS_UNVERIFIED",`App '${t}': its table components were written but could not be verified \u2014 reading them back returned HTTP ${u.status}. Re-push to retry.`);let c=(n=u.body)===null||n===void 0?void 0:n.value;if(!Array.isArray(c))throw new he.SdkError("APP_COMPONENTS_UNVERIFIED",`App '${t}': its table components were written but could not be verified \u2014 the read-back returned no readable result set. Re-push to retry.`);let d=new Set(c.map(f=>f.objectid).filter(f=>typeof f=="string").map(f=>f.toLowerCase())),p=r.filter(f=>!d.has(f.metadataId.toLowerCase()));if(p.length>0)throw new he.SdkError("APP_COMPONENTS_NOT_PERSISTED",`App '${t}': ${p.length} declared table(s) are NOT components of the app after AddAppComponents reported success \u2014 ${p.map(f=>`'${f.logicalName}' (expected objectid ${f.metadataId})`).join(", ")}. The app's navigation would reference content the app does not contain.`)}async function fk(e,t,r){let n=`/appmodules(${t})`,i=`/sitemaps(${r.sitemapId})`;try{if(!await mk(e,r.sitemapId)){r.serverRefusedSitemap&&(0,Ae.ensureSuccess)(await e.delete(n),e.apiUrl(n));return}e.supportsAtomicBatch&&await $y(e,[{path:n,etag:r.appEtag},{path:i,etag:r.sitemapEtag}])}catch{}}async function mk(e,t){var r;let n=ol(t,"sitemapid"),i=await e.get(n);if(i.status<200||i.status>=300)throw new he.SdkError("APP_SITEMAP_UNRESOLVED",`The unpublished-aware read of sitemap '${t}' returned HTTP ${i.status}, so it cannot be determined whether the row exists.`);let a=(r=i.body)===null||r===void 0?void 0:r.value;if(!Array.isArray(a))throw new he.SdkError("APP_SITEMAP_UNRESOLVED",`The unpublished-aware read of sitemap '${t}' returned no readable result set, so it cannot be determined whether the row exists.`);return a.length>0}async function By(e,t){var r;let n=(0,ae.normalizeGuid)(t,"id"),i=h=>{throw new he.SdkError("APP_SITEMAP_UNRESOLVED",`Refusing to delete app '${n}': ${h} Deleting the app would destroy the only pointer to its sitemap, stranding that row and reserving its unique name forever. Retry; if the app is newly created, publish it first (an unpublished app is not readable).`)},a=`/appmodules(${n})${ak}`,o;try{o=await e.get(a)}catch(h){return i(`reading the app failed (${h.message}).`)}if(o.status<200||o.status>=300)return i(o.status===404?"reading the app returned HTTP 404, which does NOT prove it is absent \u2014 Dataverse also reports an unpublished app that way, and such an app still owns a sitemap.":`reading the app returned HTTP ${o.status}.`);let s=(r=o.body)===null||r===void 0?void 0:r.uniquename;if(!s)return i("the app record carried no uniquename, so its sitemap cannot be located.");let l=await Uy(e,s);if(!l)return{uniquename:s,appEtag:(0,Ae.readEtag)(o)};let u=(0,ae.normalizeGuid)(l,"sitemapId"),c=ol(u,"sitemapid,sitemapnameunique,sitemapxml"),d;try{d=await e.get(c)}catch(h){return i(`reading sitemap '${u}' failed (${h.message}).`)}if(d.status<200||d.status>=300)return i(`reading sitemap '${u}' returned HTTP ${d.status}.`);let p=Pi(d);if(!p)return i(`sitemap '${u}' was not returned by the unpublished-aware read.`);if(p.sitemapnameunique!==s)return i(`sitemap '${u}' now carries sitemapnameunique '${String(p.sitemapnameunique)}', not '${s}', so it is no longer this app's sitemap.`);let f=p.sitemapxml;return typeof f!="string"?i(`sitemap '${u}' returned no sitemapxml.`):{sitemapId:u,uniquename:s,sitemapXml:f,appEtag:(0,Ae.readEtag)(o),sitemapEtag:al(p)}}async function hk(e,t,r){let n=(0,ae.normalizeGuid)(t,"id"),i=await By(e,n);await r?.(i.sitemapXml),await qy(e,n,i)}gn.deleteAppResolvingOnce=hk;async function $y(e,t){let r=`batch_${(0,Hd.newId)()}`,n=`changeset_${(0,Hd.newId)()}`,i=t.map((d,p)=>[`--${n}`,"Content-Type: application/http","Content-Transfer-Encoding: binary",`Content-ID: ${p+1}`,"",`DELETE ${e.apiUrl(d.path)} HTTP/1.1`,...d.etag?[`If-Match: ${d.etag}`]:[],""].join(`\r
+`);if(f===-1)return;let h=p.slice(0,f),v=p.slice(f+4);if(!/^Content-Type:\s*application\/http\b/im.test(h))return;let w=/^HTTP\/1\.[01] (\d{3})\b/.exec(v);if(!w||((i=v.match(/^HTTP\/1\.[01] \d{3}\b/gm))!==null&&i!==void 0?i:[]).length!==1)return;let E=(a=/^Content-ID:\s*(\S+)/im.exec(h))===null||a===void 0?void 0:a[1];if(E===void 0||d.has(E)||!u.has(E))return;d.add(E),c.push(Number(w[1]))}return c.length===0?void 0:c}gn.parseChangeSetStatuses=Kg;async function sR(e,t,r){if(t.length===0)return;let{body:n,batchId:i,contentIds:a}=Jg(e,t),o=await e.postBatch(n,i),s=e.apiUrl("/$batch");if((0,oR.ensureSuccess)(o,s),typeof o.body!="string"||o.body.length===0)throw new Fs.ConnectionError(s,o.status,`atomic write of ${r} cannot be confirmed: the $batch response had no readable body, so the change set's outcome is unknown`);let l=Kg(o.body,a);if(l===void 0)throw new Fs.ConnectionError(s,o.status,`atomic write of ${r} cannot be confirmed: the $batch response could not be parsed as a change set, so the outcome is unknown`);if(l.length!==t.length)throw new Fs.ConnectionError(s,o.status,`atomic write of ${r} cannot be confirmed: the change set reported ${l.length} result(s) for ${t.length} operation(s)`);let u=l.find(c=>c<200||c>=300);if(u!==void 0)throw new Fs.ConnectionError(s,u,`atomic write of ${r} was rolled back: the change set reported HTTP ${u}`)}gn.postChangeSet=sR});var xs=g(J=>{"use strict";Object.defineProperty(J,"__esModule",{value:!0});J.updateTable=J.deleteAlternateKey=J.createAlternateKey=J.deleteGlobalOptionSet=J.createGlobalOptionSet=J.deleteRelationship=J.deleteColumn=J.updateColumn=J.deleteTable=J.createRelationship=J.insertStatusValue=J.createCustomerColumn=J.createColumns=J.setColumnVisualization=J.getColumnVisualization=J.createColumn=J.createTable=J.resolveEntitySetName=J.pluralFallback=void 0;var oe=be(),Q=ie(),vr=Ci(),fe=ne(),lR=$c(),uR={String:"Microsoft.Dynamics.CRM.StringAttributeMetadata",Memo:"Microsoft.Dynamics.CRM.MemoAttributeMetadata",Integer:"Microsoft.Dynamics.CRM.IntegerAttributeMetadata",Decimal:"Microsoft.Dynamics.CRM.DecimalAttributeMetadata",Money:"Microsoft.Dynamics.CRM.MoneyAttributeMetadata",Boolean:"Microsoft.Dynamics.CRM.BooleanAttributeMetadata",DateTime:"Microsoft.Dynamics.CRM.DateTimeAttributeMetadata",Picklist:"Microsoft.Dynamics.CRM.PicklistAttributeMetadata",Lookup:"Microsoft.Dynamics.CRM.LookupAttributeMetadata"};function _e(e,t){return{"@odata.type":"Microsoft.Dynamics.CRM.Label",LocalizedLabels:cR(e,t)}}var Xg=65535;function cR(e,t){let r=(a,o)=>({"@odata.type":"Microsoft.Dynamics.CRM.LocalizedLabel",Label:a,LanguageCode:o});if(typeof e=="string")return[r(e,t)];let n=Object.entries(e);if(!n.length)throw new fe.InvalidArgumentError("a localized label must contain at least one language");let i=new Set;return n.map(([a,o])=>{if(!/^[1-9]\d*$/.test(a))throw new fe.InvalidArgumentError(`localized label key '${a}' is not an LCID (expected a canonical positive integer, e.g. 1033)`);let s=Number(a);if(s>Xg)throw new fe.InvalidArgumentError(`localized label LCID ${s} is out of range (1-${Xg})`);if(i.has(s))throw new fe.InvalidArgumentError(`localized label LCID ${s} is specified more than once`);if(i.add(s),typeof o!="string")throw new fe.InvalidArgumentError(`localized label for LCID ${s} must be a string`);return r(o,s)})}function t0(e){return typeof e=="string"?`${e}s`:Object.fromEntries(Object.entries(e).map(([t,r])=>{if(typeof r!="string")throw new fe.InvalidArgumentError(`localized label for LCID ${t} must be a string`);return[t,`${r}s`]}))}J.pluralFallback=t0;function Ka(e){return{Value:e,CanBeChanged:!0,ManagedPropertyLogicalName:"canmodifyrequirementlevelsettings"}}function Gc(e){let t=e.indexOf("_");return t>0?e.slice(0,t):e}function Yg(e,t,r){let n=e[t];n&&typeof n=="object"?n.Value=r:e[t]={Value:r}}function Xa(e){let t=(0,oe.readCreatedId)(e,"MetadataId");if(!t)throw new fe.InvalidArgumentError("Dataverse did not return a MetadataId for the created metadata component");return t}function dR(e,t,r){var n,i,a,o,s,l,u,c,d,p,f,h,v,w,E,D,x,F,j,L,V,B,U,z;if(t.defaultValue!==void 0&&e!=="boolean")throw new fe.InvalidArgumentError(`createColumn: 'defaultValue' applies to boolean columns, but '${t.schemaName}' is of type '${e}'.`);if(t.integerFormat!==void 0&&e!=="integer")throw new fe.InvalidArgumentError(`createColumn: 'integerFormat' applies to integer columns, but '${t.schemaName}' is of type '${e}'.`);switch(e){case"string":return{"@odata.type":"Microsoft.Dynamics.CRM.StringAttributeMetadata",AttributeType:"String",AttributeTypeName:{Value:"StringType"},MaxLength:(n=t.maxLength)!==null&&n!==void 0?n:100,FormatName:{Value:(i=t.stringFormat)!==null&&i!==void 0?i:"Text"}};case"memo":return{"@odata.type":"Microsoft.Dynamics.CRM.MemoAttributeMetadata",AttributeType:"Memo",AttributeTypeName:{Value:"MemoType"},MaxLength:(a=t.maxLength)!==null&&a!==void 0?a:2e3,Format:"TextArea"};case"integer":return{"@odata.type":"Microsoft.Dynamics.CRM.IntegerAttributeMetadata",AttributeType:"Integer",AttributeTypeName:{Value:"IntegerType"},Format:(o=t.integerFormat)!==null&&o!==void 0?o:"None",MinValue:(s=t.minValue)!==null&&s!==void 0?s:-2147483648,MaxValue:(l=t.maxValue)!==null&&l!==void 0?l:2147483647};case"bigint":return{"@odata.type":"Microsoft.Dynamics.CRM.BigIntAttributeMetadata",AttributeType:"BigInt",AttributeTypeName:{Value:"BigIntType"}};case"double":return{"@odata.type":"Microsoft.Dynamics.CRM.DoubleAttributeMetadata",AttributeType:"Double",AttributeTypeName:{Value:"DoubleType"},Precision:(u=t.precision)!==null&&u!==void 0?u:2,MinValue:(c=t.minValue)!==null&&c!==void 0?c:-1e11,MaxValue:(d=t.maxValue)!==null&&d!==void 0?d:1e11};case"decimal":return{"@odata.type":"Microsoft.Dynamics.CRM.DecimalAttributeMetadata",AttributeType:"Decimal",AttributeTypeName:{Value:"DecimalType"},Precision:(p=t.precision)!==null&&p!==void 0?p:2,MinValue:(f=t.minValue)!==null&&f!==void 0?f:-1e11,MaxValue:(h=t.maxValue)!==null&&h!==void 0?h:1e11};case"money":return{"@odata.type":"Microsoft.Dynamics.CRM.MoneyAttributeMetadata",AttributeType:"Money",AttributeTypeName:{Value:"MoneyType"},Precision:(v=t.precision)!==null&&v!==void 0?v:2,PrecisionSource:2,MinValue:(w=t.minValue)!==null&&w!==void 0?w:0,MaxValue:(E=t.maxValue)!==null&&E!==void 0?E:1e9};case"boolean":return{"@odata.type":"Microsoft.Dynamics.CRM.BooleanAttributeMetadata",AttributeType:"Boolean",AttributeTypeName:{Value:"BooleanType"},DefaultValue:(D=t.defaultValue)!==null&&D!==void 0?D:!1,OptionSet:{"@odata.type":"Microsoft.Dynamics.CRM.BooleanOptionSetMetadata",TrueOption:{Value:1,Label:_e((x=t.trueLabel)!==null&&x!==void 0?x:"Yes",r)},FalseOption:{Value:0,Label:_e((F=t.falseLabel)!==null&&F!==void 0?F:"No",r)}}};case"dateTime":return{"@odata.type":"Microsoft.Dynamics.CRM.DateTimeAttributeMetadata",AttributeType:"DateTime",AttributeTypeName:{Value:"DateTimeType"},Format:(j=t.dateFormat)!==null&&j!==void 0?j:"DateAndTime"};case"choice":return Zg(t,r,!1);case"multiChoice":return Zg(t,r,!0);case"file":return{"@odata.type":"Microsoft.Dynamics.CRM.FileAttributeMetadata",AttributeType:"Virtual",AttributeTypeName:{Value:"FileType"},MaxSizeInKB:(L=t.maxSizeKb)!==null&&L!==void 0?L:10240};case"image":return{"@odata.type":"Microsoft.Dynamics.CRM.ImageAttributeMetadata",AttributeType:"Virtual",AttributeTypeName:{Value:"ImageType"},IsPrimaryImage:(V=t.isPrimaryImage)!==null&&V!==void 0?V:!1,MaxSizeInKB:(B=t.maxSizeKb)!==null&&B!==void 0?B:10240};case"autonumber":return{"@odata.type":"Microsoft.Dynamics.CRM.StringAttributeMetadata",AttributeType:"String",AttributeTypeName:{Value:"StringType"},FormatName:{Value:"Text"},MaxLength:(U=t.maxLength)!==null&&U!==void 0?U:100,AutoNumberFormat:(z=t.autoNumberFormat)!==null&&z!==void 0?z:""};default:throw new fe.InvalidArgumentError(`unsupported column type '${String(e)}'`)}}function Zg(e,t,r){let i={"@odata.type":r?"Microsoft.Dynamics.CRM.MultiSelectPicklistAttributeMetadata":"Microsoft.Dynamics.CRM.PicklistAttributeMetadata",AttributeType:r?"Virtual":"Picklist",AttributeTypeName:{Value:r?"MultiSelectPicklistType":"PicklistType"}};if(e.globalChoiceMetadataId)return i["[email protected]"]=`/GlobalOptionSetDefinitions(${(0,Q.normalizeGuid)(e.globalChoiceMetadataId,"globalChoiceMetadataId")})`,i;if(!e.options||e.options.length===0)throw new fe.InvalidArgumentError(`choice column '${e.schemaName}' requires at least one option (or a globalChoiceMetadataId)`);return i.OptionSet={"@odata.type":"Microsoft.Dynamics.CRM.OptionSetMetadata",IsGlobal:!1,OptionSetType:"Picklist",Options:e.options.map(a=>({Value:a.value,Label:_e(a.label,t)}))},i}var qc=new WeakMap;async function pR(e,t){var r,n;let i=(r=qc.get(e))===null||r===void 0?void 0:r.get(t);if(i)return i;let a=`/EntityDefinitions(LogicalName='${(0,Q.odataLiteral)(t)}')${(0,Q.odataQuery)([["$select","EntitySetName"]])}`,s=(n=(0,oe.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||n===void 0?void 0:n.EntitySetName;if(!s)throw new fe.InvalidArgumentError(`could not resolve EntitySetName for '${t}'`);(0,Q.assertODataName)(s,`server-derived EntitySetName for '${t}'`);let l=qc.get(e);return l||(l=new Map,qc.set(e,l)),l.set(t,s),s}J.resolveEntitySetName=pR;async function fR(e,t){var r,n,i,a,o,s,l,u,c,d,p,f,h,v,w;let E=(r=t.languageCode)!==null&&r!==void 0?r:vr.DEFAULT_LCID,D=Gc(t.schemaName),x=(n=t.primaryColumnSchemaName)!==null&&n!==void 0?n:`${D}_Name`,F={"@odata.type":"Microsoft.Dynamics.CRM.StringAttributeMetadata",AttributeType:"String",AttributeTypeName:{Value:"StringType"},SchemaName:x,RequiredLevel:Ka("None"),MaxLength:(i=t.primaryColumnMaxLength)!==null&&i!==void 0?i:100,FormatName:{Value:"Text"},DisplayName:_e((a=t.primaryColumnDisplayName)!==null&&a!==void 0?a:"Name",E),IsPrimaryName:!0};t.primaryColumnAutoNumberFormat&&(F.AutoNumberFormat=t.primaryColumnAutoNumberFormat),t.columns&&i0(t.columns,"createTable");let j={"@odata.type":"Microsoft.Dynamics.CRM.EntityMetadata",SchemaName:t.schemaName,DisplayName:_e(t.displayName,E),DisplayCollectionName:_e((o=t.pluralName)!==null&&o!==void 0?o:t0(t.displayName),E),OwnershipType:(s=t.ownership)!==null&&s!==void 0?s:"UserOwned",IsActivity:!1,HasActivities:(l=t.hasActivities)!==null&&l!==void 0?l:!1,HasNotes:(u=t.hasNotes)!==null&&u!==void 0?u:!1,Attributes:[F,...((c=t.columns)!==null&&c!==void 0?c:[]).map(pe=>zc(pe,E))]};t.description&&(j.Description=_e(t.description,E));let L="/EntityDefinitions",V=(0,oe.ensureSuccess)(await e.post(L,j),e.apiUrl(L)),B=Xa(V),U=`/EntityDefinitions(${B})`+(0,Q.odataQuery)([["$select","LogicalName,EntitySetName,PrimaryIdAttribute,PrimaryNameAttribute"]]),z=Math.max(1,Math.trunc((d=t.readBackAttempts)!==null&&d!==void 0?d:6)),$=Math.max(0,(p=t.readBackDelayMs)!==null&&p!==void 0?p:1e3),Oe;for(let pe=1;pe<=z;pe+=1){let Ke=await e.get(U);if(Ke.status>=200&&Ke.status<300){Oe=Ke;break}Ke.status!==404&&(0,oe.ensureSuccess)(Ke,e.apiUrl(U)),pe<z&&$>0&&await new Promise(Z=>setTimeout(Z,$))}if(!Oe)throw new fe.SdkError("TABLE_METADATA_NOT_VISIBLE",`Table '${t.schemaName}' WAS CREATED (MetadataId ${B}) but its metadata was still not readable after ${z} attempt(s). Do NOT re-run the create \u2014 it will collide on the schema name. Re-read /EntityDefinitions(${B}) once the environment catches up, or raise 'readBackAttempts'.`);let vt=Oe.body;return{logicalName:(f=vt.LogicalName)!==null&&f!==void 0?f:t.schemaName.toLowerCase(),metadataId:B,entitySetName:(h=vt.EntitySetName)!==null&&h!==void 0?h:"",primaryIdAttribute:(v=vt.PrimaryIdAttribute)!==null&&v!==void 0?v:`${t.schemaName.toLowerCase()}id`,primaryNameAttribute:(w=vt.PrimaryNameAttribute)!==null&&w!==void 0?w:x.toLowerCase()}}J.createTable=fR;function zc(e,t){var r,n;let i=(r=e.languageCode)!==null&&r!==void 0?r:t,a={...dR(e.type,e,i),SchemaName:e.schemaName,RequiredLevel:Ka((n=e.required)!==null&&n!==void 0?n:"None"),DisplayName:_e(e.displayName,i)};return e.description&&(a.Description=_e(e.description,i)),e.sourceType&&e.sourceType!=="Simple"&&(a.SourceType=e.sourceType==="Rollup"?2:1,e.formulaDefinition&&(a.FormulaDefinition=e.formulaDefinition)),r0(a,e),a}function r0(e,t){t.isValidForCreate!==void 0&&(e.IsValidForCreate=t.isValidForCreate),t.isValidForUpdate!==void 0&&(e.IsValidForUpdate=t.isValidForUpdate),t.isValidForRead!==void 0&&(e.IsValidForRead=t.isValidForRead)}async function mR(e,t,r){var n;let i=zc(r,(n=r.languageCode)!==null&&n!==void 0?n:vr.DEFAULT_LCID),a=`/EntityDefinitions(LogicalName='${(0,Q.odataLiteral)(t)}')/Attributes`,o=(0,oe.ensureSuccess)(await e.post(a,i),e.apiUrl(a)),s={logicalName:r.schemaName.toLowerCase(),metadataId:Xa(o)};if(r.visualization&&r.visualization!=="None")try{await s0(e,t,s.logicalName,s.metadataId,r.visualization)}catch(l){let u=new fe.SdkError("COLUMN_VISUALIZATION_BIND_FAILED",`Column '${s.logicalName}' on '${t}' was created, but binding its '${r.visualization}' grid visualization failed; the column exists WITHOUT a visualization. Retry with setColumnVisualization('${t}', '${s.logicalName}', '${r.visualization}'). Cause: ${l instanceof Error?l.message:String(l)}`);throw u.cause=l,u}return s}J.createColumn=mR;var Ei="/controlconfigurations",n0="CustomRenderersConfiguration",Vc={RadialDial:"c3d4e5f6-a7b8-9012-cdef-345678901234",LineChart:"a1b2c3d4-e5f6-7890-abcd-ef1234567890",HeatMap:"e7f8a9b0-c1d2-4e3f-5a6b-7c8d9e0f1a2b",StarRating:"b5e4c3d2-f1a0-4e2b-8a7c-9d3f5c1e6b04"};function i0(e,t){let r=e.find(n=>n.visualization&&n.visualization!=="None");if(r)throw new fe.InvalidArgumentError(`${t}: setting 'visualization' on an inline column ('${r.schemaName}') is not supported \u2014 the attribute metadata and its control-configuration row are separate writes. Create the column, then call setColumnVisualization; or use the single-column createColumn.`)}function a0(e){return JSON.stringify({type:Vc[e]})}function hR(e){if(!e)return"None";let t;try{t=JSON.parse(e)}catch{return"None"}let r=t?.type,n=Object.keys(Vc).find(i=>Vc[i]===r);return n??"None"}async function o0(e,t,r){var n,i;let a=`entitylogicalname eq '${(0,Q.odataLiteral)(t)}' and Attribute/logicalname eq '${(0,Q.odataLiteral)(r)}'`,o=`${Ei}${(0,Q.odataQuery)([["$select","name,uniquename,metadatajson"],["$expand","Attribute($select=name,logicalname)"],["$filter",a]])}`,l=(i=(n=(0,oe.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[],u=r.toLowerCase();return l.filter(c=>{var d,p;return((p=(d=c.Attribute)===null||d===void 0?void 0:d.logicalname)===null||p===void 0?void 0:p.toLowerCase())===u})}async function gR(e,t,r){var n;let i=`/EntityDefinitions(LogicalName='${(0,Q.odataLiteral)(t)}')/Attributes(LogicalName='${(0,Q.odataLiteral)(r)}')${(0,Q.odataQuery)([["$select","MetadataId"]])}`,o=(n=(0,oe.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)===null||n===void 0?void 0:n.MetadataId;if(!o)throw new fe.InvalidArgumentError(`cannot resolve column '${r}' on '${t}' to set its visualization`);return(0,Q.normalizeGuid)(o,"MetadataId")}async function s0(e,t,r,n,i){let a={name:n0,uniquename:`msdyn_${t}_${r}_customrenderers`,metadatajson:a0(i),"[email protected]":`/attributes(${(0,Q.normalizeGuid)(n,"MetadataId")})`,entitylogicalname:t};(0,oe.ensureSuccess)(await e.post(Ei,a),e.apiUrl(Ei))}async function vR(e,t,r){var n;let i=await o0(e,t,r);return hR((n=i[0])===null||n===void 0?void 0:n.metadatajson)}J.getColumnVisualization=vR;async function yR(e,t,r,n){let a=(await o0(e,t,r)).map(u=>u.controlconfigurationid).filter(u=>!!u);if(n==="None"){for(let u of a){let c=`${Ei}(${(0,Q.normalizeGuid)(u,"controlconfigurationid")})`;(0,oe.ensureSuccess)(await e.delete(c),e.apiUrl(c))}return}let[o,...s]=a,l=await gR(e,t,r);if(o){let u=`${Ei}(${(0,Q.normalizeGuid)(o,"controlconfigurationid")})`,c={name:n0,metadatajson:a0(n),"[email protected]":`/attributes(${l})`,entitylogicalname:t};(0,oe.ensureSuccess)(await e.patch(u,c),e.apiUrl(u))}else await s0(e,t,r,l,n);for(let u of s){let c=`${Ei}(${(0,Q.normalizeGuid)(u,"controlconfigurationid")})`;(0,oe.ensureSuccess)(await e.delete(c),e.apiUrl(c))}}J.setColumnVisualization=yR;async function bR(e,t,r){if(r.length===0)return;if(i0(r,"createColumns"),!e.supportsAtomicBatch)throw new fe.InvalidArgumentError(`createColumns writes ${r.length} columns on '${t}' as ONE atomic change set, which needs a verbatim request body. Implement HttpClient.postRaw, or call createColumn per column and accept that a failure can leave the table partly extended.`);let n=`/EntityDefinitions(LogicalName='${(0,Q.odataLiteral)(t)}')/Attributes`;await(0,lR.postChangeSet)(e,r.map(i=>{var a;return{method:"POST",path:n,body:zc(i,(a=i.languageCode)!==null&&a!==void 0?a:vr.DEFAULT_LCID)}}),`${r.length} column(s) on '${t}'`)}J.createColumns=bR;async function wR(e,t,r){var n,i,a,o;let s=(n=r.languageCode)!==null&&n!==void 0?n:vr.DEFAULT_LCID,l=Gc(r.schemaName),u=(i=r.accountRelationshipName)!==null&&i!==void 0?i:`${l}_${t}_account`,c=(a=r.contactRelationshipName)!==null&&a!==void 0?a:`${l}_${t}_contact`,d={Lookup:{"@odata.type":"Microsoft.Dynamics.CRM.ComplexLookupAttributeMetadata",SchemaName:r.schemaName,DisplayName:_e(r.displayName,s),RequiredLevel:Ka((o=r.required)!==null&&o!==void 0?o:"None"),Targets:["account","contact"]},OneToManyRelationships:[{"@odata.type":"Microsoft.Dynamics.CRM.ComplexOneToManyRelationshipMetadata",SchemaName:u,ReferencedEntity:"account",ReferencingEntity:t},{"@odata.type":"Microsoft.Dynamics.CRM.ComplexOneToManyRelationshipMetadata",SchemaName:c,ReferencedEntity:"contact",ReferencingEntity:t}]};return(0,oe.ensureSuccess)(await e.post("/CreateCustomerRelationships",d),e.apiUrl("/CreateCustomerRelationships")),{logicalName:r.schemaName.toLowerCase(),metadataId:""}}J.createCustomerColumn=wR;async function AR(e,t,r){var n,i,a,o,s;let l=(n=r.languageCode)!==null&&n!==void 0?n:vr.DEFAULT_LCID,u={EntityLogicalName:t,AttributeLogicalName:"statuscode",Label:_e(r.label,l),StateCode:(i=r.stateCode)!==null&&i!==void 0?i:0};typeof r.value=="number"&&(u.Value=r.value),r.color&&(u.Color=r.color);let c=(0,oe.ensureSuccess)(await e.post("/InsertStatusValue",u),e.apiUrl("/InsertStatusValue"));return Number((s=(o=(a=c.body)===null||a===void 0?void 0:a.NewOptionValue)!==null&&o!==void 0?o:r.value)!==null&&s!==void 0?s:0)}J.insertStatusValue=AR;async function CR(e,t){var r,n,i,a,o;let s=(r=t.languageCode)!==null&&r!==void 0?r:vr.DEFAULT_LCID,l,u;if(t.type==="OneToMany"){if(!t.referencedEntity||!t.referencingEntity)throw new fe.InvalidArgumentError("OneToMany relationship requires referencedEntity and referencingEntity");let p=(n=t.lookupSchemaName)!==null&&n!==void 0?n:`${Gc(t.schemaName)}_${t.referencedEntity}Id`;u=p.toLowerCase(),l={"@odata.type":"Microsoft.Dynamics.CRM.OneToManyRelationshipMetadata",SchemaName:t.schemaName,ReferencedEntity:t.referencedEntity,ReferencingEntity:t.referencingEntity,Lookup:{"@odata.type":"Microsoft.Dynamics.CRM.LookupAttributeMetadata",AttributeType:"Lookup",AttributeTypeName:{Value:"LookupType"},SchemaName:p,RequiredLevel:Ka((i=t.lookupRequired)!==null&&i!==void 0?i:"None"),DisplayName:_e((a=t.lookupDisplayName)!==null&&a!==void 0?a:t.referencedEntity,s)}}}else{if(!t.entity1||!t.entity2)throw new fe.InvalidArgumentError("ManyToMany relationship requires entity1 and entity2");l={"@odata.type":"Microsoft.Dynamics.CRM.ManyToManyRelationshipMetadata",SchemaName:t.schemaName,IntersectEntityName:(o=t.intersectEntityName)!==null&&o!==void 0?o:t.schemaName.toLowerCase(),Entity1LogicalName:t.entity1,Entity2LogicalName:t.entity2}}let c="/RelationshipDefinitions",d=(0,oe.ensureSuccess)(await e.post(c,l),e.apiUrl(c));return{schemaName:t.schemaName,metadataId:Xa(d),lookupLogicalName:u}}J.createRelationship=CR;async function SR(e,t){let r=`/EntityDefinitions(LogicalName='${(0,Q.odataLiteral)(t)}')`;(0,oe.ensureSuccess)(await e.delete(r),e.apiUrl(r))}J.deleteTable=SR;async function ER(e,t,r,n){var i,a;let o=(i=n.languageCode)!==null&&i!==void 0?i:vr.DEFAULT_LCID,s=`/EntityDefinitions(LogicalName='${(0,Q.odataLiteral)(t)}')/Attributes`,l=`${s}(LogicalName='${(0,Q.odataLiteral)(r)}')${(0,Q.odataQuery)([["$select","MetadataId,AttributeType"]])}`,c=(0,oe.ensureSuccess)(await e.get(l),e.apiUrl(l)).body,d=uR[(a=c.AttributeType)!==null&&a!==void 0?a:""];if(!c.MetadataId||!d)throw new fe.InvalidArgumentError(`cannot update column '${r}' on '${t}' (type '${c.AttributeType}' not supported)`);let p=(0,Q.normalizeGuid)(c.MetadataId,"MetadataId"),f=`${s}(${p})/${d}`,h=(0,oe.ensureSuccess)(await e.get(f),e.apiUrl(f)).body;for(let w of Object.keys(h))w.startsWith("@odata.")&&delete h[w];if(h["@odata.type"]=d,n.displayName!==void 0&&(h.DisplayName=_e(n.displayName,o)),n.description!==void 0&&(h.Description=_e(n.description,o)),n.required!==void 0&&(h.RequiredLevel=Ka(n.required)),n.maxLength!==void 0&&(h.MaxLength=n.maxLength),n.autoNumberFormat!==void 0&&(h.AutoNumberFormat=n.autoNumberFormat),n.defaultValue!==void 0&&c.AttributeType!=="Boolean")throw new fe.InvalidArgumentError(`updateColumn: 'defaultValue' applies to Boolean columns, but '${r}' on '${t}' is of type '${c.AttributeType}'.`);if(n.integerFormat!==void 0&&c.AttributeType!=="Integer")throw new fe.InvalidArgumentError(`updateColumn: 'integerFormat' applies to Integer columns, but '${r}' on '${t}' is of type '${c.AttributeType}'.`);n.defaultValue!==void 0&&(h.DefaultValue=n.defaultValue),n.integerFormat!==void 0&&(h.Format=n.integerFormat),r0(h,n);let v=`${s}(${p})`;(0,oe.ensureSuccess)(await e.put(v,h,{headers:{"MSCRM.MergeLabels":"true"}}),e.apiUrl(v))}J.updateColumn=ER;async function NR(e,t,r){var n;let i=`/EntityDefinitions(LogicalName='${(0,Q.odataLiteral)(t)}')/Attributes`,a=`${i}(LogicalName='${(0,Q.odataLiteral)(r)}')${(0,Q.odataQuery)([["$select","MetadataId"]])}`,s=(n=(0,oe.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||n===void 0?void 0:n.MetadataId;if(!s)throw new fe.InvalidArgumentError(`column '${r}' not found on '${t}'`);let l=`${i}(${(0,Q.normalizeGuid)(s,"MetadataId")})`;(0,oe.ensureSuccess)(await e.delete(l),e.apiUrl(l))}J.deleteColumn=NR;async function DR(e,t){var r,n,i;let a=`/RelationshipDefinitions${(0,Q.odataQuery)([["$filter",`SchemaName eq '${(0,Q.odataLiteral)(t)}'`],["$select","MetadataId"]])}`,s=(i=(n=(r=(0,oe.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||r===void 0?void 0:r.value)===null||n===void 0?void 0:n[0])===null||i===void 0?void 0:i.MetadataId;if(!s)throw new fe.InvalidArgumentError(`relationship '${t}' not found`);let l=`/RelationshipDefinitions(${(0,Q.normalizeGuid)(s,"MetadataId")})`;(0,oe.ensureSuccess)(await e.delete(l),e.apiUrl(l))}J.deleteRelationship=DR;async function e0(e,t){var r;let n=`/GlobalOptionSetDefinitions(Name='${(0,Q.odataPathLiteral)(t)}')${(0,Q.odataQuery)([["$select","MetadataId"]])}`,i=await e.get(n);if(i.status===404)return;let o=(r=(0,oe.ensureSuccess)(i,e.apiUrl(n)).body)===null||r===void 0?void 0:r.MetadataId;return o?(0,Q.normalizeGuid)(o,"MetadataId"):void 0}async function IR(e,t){var r;let n=t.name.toLowerCase(),i=await e0(e,n);if(i)return{name:n,metadataId:i};let a=(r=t.languageCode)!==null&&r!==void 0?r:vr.DEFAULT_LCID,o={"@odata.type":"Microsoft.Dynamics.CRM.OptionSetMetadata",Name:n,DisplayName:_e(t.displayName,a),IsGlobal:!0,OptionSetType:"Picklist",Options:t.options.map(l=>({Value:l.value,Label:_e(l.label,a)}))};t.description&&(o.Description=_e(t.description,a));let s="/GlobalOptionSetDefinitions";try{let l=(0,oe.ensureSuccess)(await e.post(s,o),e.apiUrl(s));return{name:n,metadataId:Xa(l)}}catch(l){let u;try{u=await e0(e,n)}catch{u=void 0}if(u)return{name:n,metadataId:u};throw l}}J.createGlobalOptionSet=IR;async function _R(e,t){let r=`/GlobalOptionSetDefinitions(Name='${(0,Q.odataLiteral)(t.toLowerCase())}')`;(0,oe.ensureSuccess)(await e.delete(r),e.apiUrl(r))}J.deleteGlobalOptionSet=_R;async function TR(e,t,r){var n;let i=(n=r.languageCode)!==null&&n!==void 0?n:vr.DEFAULT_LCID,a={"@odata.type":"Microsoft.Dynamics.CRM.EntityKeyMetadata",SchemaName:r.schemaName,DisplayName:_e(r.displayName,i),KeyAttributes:r.keyAttributes},o=`/EntityDefinitions(LogicalName='${(0,Q.odataLiteral)(t)}')/Keys`,s=(0,oe.ensureSuccess)(await e.post(o,a),e.apiUrl(o));return{logicalName:r.schemaName.toLowerCase(),metadataId:Xa(s)}}J.createAlternateKey=TR;async function PR(e,t,r){var n;let i=`/EntityDefinitions(LogicalName='${(0,Q.odataLiteral)(t)}')/Keys`,a=`${i}(LogicalName='${(0,Q.odataLiteral)(r.toLowerCase())}')${(0,Q.odataQuery)([["$select","MetadataId"]])}`,s=(n=(0,oe.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||n===void 0?void 0:n.MetadataId;if(!s)throw new fe.InvalidArgumentError(`alternate key '${r}' not found on '${t}'`);let l=`${i}(${(0,Q.normalizeGuid)(s,"MetadataId")})`;(0,oe.ensureSuccess)(await e.delete(l),e.apiUrl(l))}J.deleteAlternateKey=PR;async function OR(e,t,r){var n;let i=(n=r.languageCode)!==null&&n!==void 0?n:vr.DEFAULT_LCID,a=`/EntityDefinitions(LogicalName='${(0,Q.odataLiteral)(t)}')`,s=(0,oe.ensureSuccess)(await e.get(a),e.apiUrl(a)).body,l=s.MetadataId;if(!l)throw new fe.InvalidArgumentError(`table '${t}' not found`);let u=(0,Q.normalizeGuid)(l,"MetadataId");for(let d of Object.keys(s))d.startsWith("@odata.")&&delete s[d];s["@odata.type"]="Microsoft.Dynamics.CRM.EntityMetadata",r.displayName!==void 0&&(s.DisplayName=_e(r.displayName,i)),r.pluralName!==void 0&&(s.DisplayCollectionName=_e(r.pluralName,i)),r.description!==void 0&&(s.Description=_e(r.description,i)),r.auditEnabled!==void 0&&Yg(s,"IsAuditEnabled",r.auditEnabled),r.duplicateDetectionEnabled!==void 0&&Yg(s,"IsDuplicateDetectionEnabled",r.duplicateDetectionEnabled),r.changeTrackingEnabled!==void 0&&(s.ChangeTrackingEnabled=r.changeTrackingEnabled),r.quickCreateEnabled!==void 0&&(s.IsQuickCreateEnabled=r.quickCreateEnabled),r.iconVectorName!==void 0&&(s.IconVectorName=r.iconVectorName),r.iconSmallName!==void 0&&(s.IconSmallName=r.iconSmallName),r.iconMediumName!==void 0&&(s.IconMediumName=r.iconMediumName),r.iconLargeName!==void 0&&(s.IconLargeName=r.iconLargeName);let c=`/EntityDefinitions(${u})`;(0,oe.ensureSuccess)(await e.put(c,s,{headers:{"MSCRM.MergeLabels":"true"}}),e.apiUrl(c))}J.updateTable=OR});var yn=g(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.rebuildRaw=wt.assembleChildren=wt.spliceChildren=wt.mergeAttrs=wt.rawFromNode=wt.emptyBag=void 0;var vn=ne(),l0=1e6,ks=512;function RR(){return{a:[],c:[]}}wt.emptyBag=RR;function u0(e,t=0){if(t>ks)throw new vn.InvalidArgumentError(`Artifact node tree exceeds the maximum depth of ${ks}`);return{n:e.getNodeName(),a:e.getAllProperties().map(r=>[r.key,r.value]),c:e.getAllChildren().map(r=>u0(r,t+1))}}wt.rawFromNode=u0;function FR(e,t,r=[]){let n=new Map;for(let[s,l]of t)n.set(s,l);let i=new Set(r.filter(s=>!n.has(s))),a=new Set,o=[];for(let[s,l]of e)i.has(s)||(n.has(s)?o.push([s,n.get(s)]):o.push([s,l]),a.add(s));for(let[s,l]of t)a.has(s)||(o.push([s,l]),a.add(s));return o}wt.mergeAttrs=FR;function Ls(e,t){let r=new Set;for(let s of e){let l=s.i;if(!Number.isInteger(l)||l<0||l>l0)throw new vn.InvalidArgumentError(`Bag child index must be an integer in [0, ${l0}] (got ${String(l)})`);if(r.has(l))throw new vn.InvalidArgumentError(`Duplicate bag child index ${l}`);r.add(l)}let n=[...e].sort((s,l)=>s.i-l.i),i=[],a=0,o=0;for(let s of n){for(;o<s.i&&a<t.length;)i.push(t[a]),a+=1,o+=1;o<s.i&&(o=s.i),i.push(s.node),o+=1}for(;a<t.length;)i.push(t[a]),a+=1;return i}wt.spliceChildren=Ls;function xR(e,t){if(e.w){let r={n:e.w.n,a:e.w.a.map(n=>[n[0],n[1]]),c:Ls(e.w.c,t)};return Ls(e.c,[r])}return Ls(e.c,t)}wt.assembleChildren=xR;function c0(e,t,r,n=0){if(n>ks)throw new vn.InvalidArgumentError(`Artifact node tree exceeds the maximum depth of ${ks}`);LR(e,n);let i=t.make(e.n,r);for(let[a,o]of e.a)t.setProp(i,a,o);for(let a of e.c)t.addChild(i,c0(a,t,i,n+1));return i}wt.rebuildRaw=c0;function LR(e,t){if(e===null||typeof e!="object"||Array.isArray(e))throw new vn.InvalidArgumentError(`Malformed hybrid node at depth ${t}: expected a JSON object`);let r=e;if(typeof r.n!="string")throw new vn.InvalidArgumentError(`Malformed hybrid node at depth ${t}: 'n' (tag name) must be a string`);if(!Array.isArray(r.a)||!Array.isArray(r.c))throw new vn.InvalidArgumentError(`Malformed hybrid node '${r.n}': 'a' and 'c' must be arrays`);for(let n of r.a)if(!Array.isArray(n)||n.length!==2||typeof n[0]!="string"||typeof n[1]!="string")throw new vn.InvalidArgumentError(`Malformed hybrid node '${r.n}': each attribute must be a [string, string] pair`)}});var Hn=g(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.projectElementBag=Te.serializeNode=Te.domEngine=Te.nodeLikeFromDom=Te.parseXmlRoot=Te.EMPTY_FORM_SENTINEL=Te.TEXT_SENTINEL=void 0;var kR=yn(),Ya=ne();Te.TEXT_SENTINEL="#text";Te.EMPTY_FORM_SENTINEL="#empty";var Bs=new WeakSet;function MR(e,t){let r=e&&e.trim()!==""?e:t,i=new DOMParser().parseFromString(r,"text/xml").documentElement;if(!i)throw new Ya.InvalidArgumentError("XML source has no root element (empty or malformed input)");return UR(i),$R(i),GR(i,r),i}Te.parseXmlRoot=MR;var BR=new Set([1,3]);function UR(e){let t=[e];for(;t.length>0;){let n=t.pop().childNodes;for(let i=0;i<n.length;i+=1){let a=n[i];if(!BR.has(a.nodeType))throw new Ya.InvalidArgumentError(`Unsupported XML node type ${a.nodeType} (CDATA / comment / processing-instruction) is outside the hybrid projection's lossless grammar and cannot be round-tripped`);a.nodeType===1&&t.push(a)}}}function $R(e){var t,r;let n=(t=e.ownerDocument)!==null&&t!==void 0?t:e.parentNode;if(!n)return;let i=n.childNodes;for(let a=0;a<i.length;a+=1){let o=i[a];if(o!==e&&!(o.nodeType===3&&((r=o.nodeValue)!==null&&r!==void 0?r:"").trim()===""))throw new Ya.InvalidArgumentError(`Unsupported document-level XML node (type ${o.nodeType}: declaration / comment / processing-instruction outside the root element) cannot be round-tripped`)}}function qR(e){let t=[],r=/<([^>]*)>/g;for(let n=r.exec(e);n!==null;n=r.exec(e)){let i=n[1];i.startsWith("/")||i.startsWith("?")||i.startsWith("!")||t.push(i.endsWith("/"))}return t}function VR(e){let t=[],r=[e];for(;r.length>0;){let n=r.pop();t.push(n);let i=n.childNodes;for(let a=i.length-1;a>=0;a-=1){let o=i[a];o.nodeType===1&&r.push(o)}}return t}function p0(e){let t=e.childNodes;for(let r=0;r<t.length;r+=1){let n=t[r].nodeType;if(n===1||n===3)return!0}return!1}function GR(e,t){let r=qR(t),n=VR(e),i=Math.min(r.length,n.length);for(let a=0;a<i;a+=1){if(r[a])continue;let o=n[a];p0(o)||Bs.add(o)}}function Wc(e){let t=e.nodeType===3;return{getNodeName:()=>t?Te.TEXT_SENTINEL:e.tagName,getAllProperties:()=>{var r;if(t)return[{key:Te.TEXT_SENTINEL,value:(r=e.nodeValue)!==null&&r!==void 0?r:""}];let n=e.attributes,i=[];for(let a=0;a<n.length;a+=1)i.push({key:n[a].name,value:n[a].value});return Bs.has(e)&&!p0(e)&&i.push({key:Te.EMPTY_FORM_SENTINEL,value:"1"}),i},getAllChildren:()=>{if(t)return[];let r=[],n=e.childNodes;for(let i=0;i<n.length;i+=1){let a=n[i];(a.nodeType===1||a.nodeType===3)&&r.push(Wc(a))}return r}}}Te.nodeLikeFromDom=Wc;function zR(e){return{make:t=>t===Te.TEXT_SENTINEL?e.createTextNode(""):e.createElement(t),setProp:(t,r,n)=>{t.nodeType===3?t.nodeValue=n:r===Te.EMPTY_FORM_SENTINEL?Bs.add(t):t.setAttribute(r,n)},addChild:(t,r)=>{t.appendChild(r)}}}Te.domEngine=zR;function f0(e){for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);if(r<=31&&r!==9&&r!==10&&r!==13||r===65534||r===65535)throw Ms(r);if(r>=55296&&r<=56319){let n=e.charCodeAt(t+1);if(!(n>=56320&&n<=57343))throw Ms(r);t+=1;continue}if(r>=56320&&r<=57343)throw Ms(r)}}function Ms(e){let t=e.toString(16).toUpperCase().padStart(4,"0");return new Ya.InvalidArgumentError(`Value contains U+${t}, a character not permitted in XML 1.0 (control char / lone surrogate / non-character); it cannot be serialized losslessly`)}function WR(e){return f0(e),String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/\r/g,"&#xD;").replace(/\n/g,"&#xA;").replace(/\t/g,"&#x9;")}function HR(e){return f0(e),String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function jR(e){return m0(e,0)}Te.serializeNode=jR;var d0=512;function m0(e,t){var r;if(t>d0)throw new Ya.InvalidArgumentError(`XML nesting exceeds the maximum supported depth of ${d0}`);if(e.nodeType===3)return HR((r=e.nodeValue)!==null&&r!==void 0?r:"");let n=e,i="<"+n.tagName,a=n.attributes;for(let l=0;l<a.length;l+=1)i+=" "+a[l].name+'="'+WR(a[l].value)+'"';let o=[],s=n.childNodes;for(let l=0;l<s.length;l+=1){let u=s[l];(u.nodeType===1||u.nodeType===3)&&o.push(u)}if(o.length===0)return Bs.has(n)?i+"></"+n.tagName+">":i+" />";i+=">";for(let l of o)i+=m0(l,t+1);return i+"</"+n.tagName+">"}function QR(e){let t=Wc(e);return{a:t.getAllProperties().map(r=>[r.key,r.value]),c:t.getAllChildren().map((r,n)=>({i:n,node:(0,kR.rawFromNode)(r)}))}}Te.projectElementBag=QR});var Qc=g(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.getFormSecurityRoles=bn.setFormSecurityRoles=bn.formApi=void 0;var JR=er(),me=be(),$t=ie(),Ni=ne(),Hc=Hn(),KR="formid,formxml,name,type,objecttypecode,formpresentation,formactivationstate,uniquename,description,versionnumber",XR="formid,name,type,objecttypecode",YR=2,ZR={Main:YR,QuickView:6,QuickCreate:7,Card:11};bn.formApi={async get(e,t){let n=`/systemforms(${(0,$t.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,$t.odataQuery)([["$select",KR]]),i=(0,me.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,me.readEtag)(i)}},async list(e,t){var r;let n=!((r=t?.formTypes)===null||r===void 0)&&r.length?t.formTypes:["Main"],i=[...new Set(n.map(u=>ZR[u]))],o=[i.length===1?`type eq ${i[0]}`:`(${i.map(u=>`type eq ${u}`).join(" or ")})`];t?.entityLogicalName&&o.push(`objecttypecode eq '${(0,$t.odataLiteral)(t.entityLogicalName)}'`);let s=`/systemforms${(0,$t.odataQuery)([["$select",XR],["$filter",o.join(" and ")]])}`;return(await(0,JR.collectPages)(e,s,"listArtifacts('form')")).map(u=>{var c,d;return{type:"form",id:(c=u.formid)!==null&&c!==void 0?c:"",name:(d=u.name)!==null&&d!==void 0?d:"",entityLogicalName:u.objecttypecode,isDirty:!1}})},async create(e,t,r){let n=(0,me.echoWrite)("formid"),i=`/systemforms${n.query}`,a=(0,me.ensureSuccess)(await e.post(i,(0,me.withClientMintedId)(t,"formid",r),n.options),e.apiUrl(i));return{id:(0,me.resolveCreatedId)(a,"formid","form",r),etag:(0,me.readEtag)(a)}},async update(e,t,r,n){let i=(0,$t.normalizeGuid)(t,"id");await v0(e,i,g0(i),n);let a=await h0(e,i),o=(0,me.echoWrite)("formid",{"If-Match":(0,me.requireEtag)(a,"form",i)}),s=`/systemforms(${i})${o.query}`;return(0,me.ensureSuccess)(await e.patch(s,r,o.options),e.apiUrl(s)),{id:i,etag:await tF(e,i)}},delete(e,t){return(0,me.deleteRecord)(e,"systemforms",t)}};var jc="DisplayConditions";async function eF(e,t,r){var n,i,a,o,s;if(r.everyone&&r.roleIds&&r.roleIds.length>0)throw new Ni.InvalidArgumentError("setFormSecurityRoles: `everyone` and `roleIds` are mutually exclusive \u2014 the platform models <Everyone /> as a replacement for the <Role> list, not an addition to it.");let l=(0,$t.normalizeGuid)(t,"formId"),u=`/systemforms(${l})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,$t.odataQuery)([["$select","formid,formxml"]]),c=(0,me.ensureSuccess)(await e.get(u),e.apiUrl(u)),d=(0,me.readEtag)(c),p=c.body,f=p?.formxml;if(!f)throw new Ni.InvalidArgumentError(`form '${l}' returned no formxml, so its roles cannot be set`);let h=(0,Hc.parseXmlRoot)(f,"<form/>"),v=h.ownerDocument;if(!v)throw new Ni.InvalidArgumentError(`form '${l}' produced no owner document`);let w=y0(h,jc),E=(n=w?.getAttribute("Order"))!==null&&n!==void 0?n:void 0,D=(i=w?.getAttribute("FallbackForm"))!==null&&i!==void 0?i:void 0;w&&h.removeChild(w);let x=!!r.everyone||((o=(a=r.roleIds)===null||a===void 0?void 0:a.length)!==null&&o!==void 0?o:0)>0;if(!x&&(r.order!==void 0||r.fallbackForm!==void 0)){if(!w)throw new Ni.InvalidArgumentError("setFormSecurityRoles: `order`/`fallbackForm` were supplied without `roleIds` or `everyone`, but this form has no <DisplayConditions> to attach them to. Pass the roles as well.");r.order!==void 0&&w.setAttribute("Order",String(r.order)),r.fallbackForm!==void 0&&w.setAttribute("FallbackForm",String(r.fallbackForm)),h.appendChild(w)}else if(x){let B=v.createElement(jc),U=r.order!==void 0?String(r.order):E;U!==void 0&&B.setAttribute("Order",U);let z=r.fallbackForm!==void 0?String(r.fallbackForm):D??"false";if(B.setAttribute("FallbackForm",z),r.everyone)B.appendChild(v.createElement("Everyone"));else for(let $ of(s=r.roleIds)!==null&&s!==void 0?s:[]){let Oe=v.createElement("Role");Oe.setAttribute("Id",`{${(0,$t.normalizeGuid)($,"roleId")}}`),B.appendChild(Oe)}h.appendChild(B)}let j=(0,Hc.serializeNode)(h);await v0(e,l,u,d);let L=await h0(e,l),V=`/systemforms(${l})`;(0,me.ensureSuccess)(await e.patch(V,{formxml:j},{headers:{"Content-Type":"application/json","If-Match":(0,me.requireEtag)(L,"form",l)}}),e.apiUrl(V))}bn.setFormSecurityRoles=eF;async function h0(e,t){let r=`/systemforms(${t})${(0,$t.odataQuery)([["$select","formid"]])}`;return(0,me.readEtag)((0,me.ensureSuccess)(await e.get(r),e.apiUrl(r)))}function g0(e){return`/systemforms(${e})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,$t.odataQuery)([["$select","formid"]])}async function tF(e,t){let r=g0(t);return(0,me.readEtag)((0,me.ensureSuccess)(await e.get(r),e.apiUrl(r)))}async function v0(e,t,r,n){(0,me.requireEtag)(n,"form",t);let i=(0,me.readEtag)((0,me.ensureSuccess)(await e.get(r),e.apiUrl(r)));if(i===null)throw new Ni.SdkError(me.VERSION_CONFLICT_CODE,`Refusing to write form '${t}': its current version could not be read, so the write could not be verified as conditional and would risk silently overwriting a concurrent edit.`);if(i!==n)throw new Ni.SdkError(me.VERSION_CONFLICT_CODE,`Version conflict writing form '${t}': its formxml changed on the server since it was read (held ${n}, server ${i}). Re-fetch the form and re-apply the change.`)}function y0(e,t){let r=e.childNodes;for(let n=0;n<r.length;n+=1){let i=r[n];if(i.nodeType===1&&i.tagName===t)return i}}async function rF(e,t){var r,n;let a=`/systemforms(${(0,$t.normalizeGuid)(t,"formId")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,$t.odataQuery)([["$select","formid,formxml"]]),s=(r=(0,me.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||r===void 0?void 0:r.formxml;if(!s)return;let l=(0,Hc.parseXmlRoot)(s,"<form/>"),u=y0(l,jc);if(!u)return;let c=[],d=!1,p=u.childNodes;for(let h=0;h<p.length;h+=1){let v=p[h];if(v.nodeType!==1)continue;let w=v;if(w.tagName==="Everyone")d=!0;else if(w.tagName==="Role"){let E=(n=w.getAttribute("Id"))!==null&&n!==void 0?n:"";E&&c.push(E.replace(/[{}]/g,"").toLowerCase())}}let f=u.getAttribute("Order");return{...d?{everyone:!0}:{},...c.length>0?{roleIds:c}:{},fallbackForm:u.getAttribute("FallbackForm")==="true",...f!==null&&f!==""?{order:Number(f)}:{}}}bn.getFormSecurityRoles=rF});var qs=g(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.disassociateRecords=Ne.associateRecords=Ne.createRecordsBulk=Ne.upsertRecord=Ne.queryAllRecords=Ne.queryRecords=Ne.getRecord=Ne.deleteRecord=Ne.updateRecord=Ne.createRecord=void 0;var nF=er(),tr=be(),et=ie(),Us=ne(),yr=xs();function $s(e){let t=e,r=!1,n={};for(let i of Object.keys(t)){let a=t[i];Array.isArray(a)&&a.every(o=>typeof o=="number")?(n[i]=a.join(","),r=!0):n[i]=a}return r?n:e}async function iF(e,t,r){let i=`/${await(0,yr.resolveEntitySetName)(e,t)}`,a=(0,tr.ensureSuccess)(await e.post(i,$s(r)),e.apiUrl(i)),o=(0,tr.readCreatedId)(a,`${t}id`);if(!o)throw new Us.InvalidArgumentError(`Dataverse did not return an id for the created '${t}' row`);return{id:o,entityType:t}}Ne.createRecord=iF;async function aF(e,t,r,n){let i=(0,et.normalizeGuid)(r,"id"),o=`/${await(0,yr.resolveEntitySetName)(e,t)}(${i})`;(0,tr.ensureSuccess)(await e.patch(o,$s(n)),e.apiUrl(o))}Ne.updateRecord=aF;async function oF(e,t,r){let n=(0,et.normalizeGuid)(r,"id"),a=`/${await(0,yr.resolveEntitySetName)(e,t)}(${n})`;(0,tr.ensureSuccess)(await e.delete(a),e.apiUrl(a))}Ne.deleteRecord=oF;async function sF(e,t,r,n){var i;let a=(0,et.normalizeGuid)(r,"id"),o=await(0,yr.resolveEntitySetName)(e,t),s=(0,et.odataQuery)([["$select",n&&n.length>0?n.join(","):void 0]]),l=`/${o}(${a})${s}`;return(i=(0,tr.ensureSuccess)(await e.get(l),e.apiUrl(l)).body)!==null&&i!==void 0?i:{}}Ne.getRecord=sF;function lF(e){return e?.fetchXml?(0,et.odataQuery)([["fetchXml",e.fetchXml]]):(0,et.odataQuery)([["$select",e?.select&&e.select.length>0?e.select.join(","):void 0],["$filter",e?.filter],["$orderby",e?.orderBy],["$expand",e?.expand],["$top",e?.top]])}async function b0(e,t,r){var n,i;if(r?.paginate){if(r.top!==void 0)throw new Us.InvalidArgumentError("queryRecords: `paginate` cannot be combined with `top` \u2014 Dataverse honors $top as a hard cap and omits @odata.nextLink, so the result would be silently capped at one page.");if(r.fetchXml)throw new Us.InvalidArgumentError("queryRecords: `paginate` is not supported with `fetchXml` \u2014 FetchXML paging uses a paging cookie (page / fetchxmlpagingcookie), not @odata.nextLink. Page the FetchXML manually, or use an OData query.")}let o=`/${await(0,yr.resolveEntitySetName)(e,t)}${lF(r)}`;return r?.paginate?(0,nF.collectPages)(e,o,"queryRecords"):(i=(n=(0,tr.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[]}Ne.queryRecords=b0;async function uF(e,t,r){return b0(e,t,{...r,paginate:!0})}Ne.queryAllRecords=uF;function cF(e){if("id"in e)return`(${(0,et.normalizeGuid)(e.id,"id")})`;let t=typeof e.value=="string"?`'${(0,et.odataPathLiteral)(e.value)}'`:e.value;return`(${(0,et.assertODataName)(e.key,"alternate key name")}=${t})`}async function dF(e,t,r,n){let i=cF(r),o=`/${await(0,yr.resolveEntitySetName)(e,t)}${i}`,s=(0,tr.ensureSuccess)(await e.patch(o,$s(n)),e.apiUrl(o)),l=s.status===201,u=(0,tr.readCreatedId)(s,`${t}id`);return{id:u??("id"in r?(0,et.normalizeGuid)(r.id,"id"):""),created:l}}Ne.upsertRecord=dF;async function pF(e,t,r){var n,i;if(r.length===0)return[];let a=await(0,yr.resolveEntitySetName)(e,t),o=r.map(c=>({"@odata.type":`Microsoft.Dynamics.CRM.${t}`,...$s(c)})),s=`/${a}/Microsoft.Dynamics.CRM.CreateMultiple`,u=(i=(n=(0,tr.ensureSuccess)(await e.post(s,{Targets:o}),e.apiUrl(s)).body)===null||n===void 0?void 0:n.Ids)!==null&&i!==void 0?i:[];if(u.length!==r.length)throw new Us.InvalidArgumentError(`CreateMultiple on '${t}' returned ${u.length} id(s) for ${r.length} row(s)`);return u}Ne.createRecordsBulk=pF;async function fF(e,t,r,n){let i=(0,et.normalizeGuid)(r,"id"),a=(0,et.normalizeGuid)(n.targetId,"targetId"),o=await(0,yr.resolveEntitySetName)(e,t),s=await(0,yr.resolveEntitySetName)(e,n.targetEntity),l=(0,et.assertODataName)(n.relationshipName,"relationshipName"),u=`/${o}(${i})/${l}/$ref`,c={"@odata.id":e.apiUrl(`/${s}(${a})`)};(0,tr.ensureSuccess)(await e.post(u,c),e.apiUrl(u))}Ne.associateRecords=fF;async function mF(e,t,r,n,i){let a=(0,et.normalizeGuid)(r,"id"),o=(0,et.normalizeGuid)(i,"targetId"),s=await(0,yr.resolveEntitySetName)(e,t),l=(0,et.assertODataName)(n,"relationshipName"),u=`/${s}(${a})/${l}(${o})/$ref`;(0,tr.ensureSuccess)(await e.delete(u),e.apiUrl(u))}Ne.disassociateRecords=mF});var rr=g(qe=>{"use strict";Object.defineProperty(qe,"__esModule",{value:!0});qe.publishBoundEntity=qe.boundEntityPublishScope=qe.publishGenPageById=qe.publishDashboardById=qe.publishWebResourceById=qe.publishEntity=qe.publishAppModule=qe.publishXml=void 0;var hF=be(),Za=ie(),w0="/PublishXml";async function Di(e,t){(0,hF.ensureSuccess)(await e.post(w0,{ParameterXml:t}),e.apiUrl(w0))}qe.publishXml=Di;function gF(e,t){return Di(e,`<importexportxml><appmodules><appmodule>${(0,Za.xmlText)(t)}</appmodule></appmodules></importexportxml>`)}qe.publishAppModule=gF;function A0(e,t){return Di(e,`<importexportxml><entities><entity>${(0,Za.xmlText)(t)}</entity></entities></importexportxml>`)}qe.publishEntity=A0;function vF(e,t){return Di(e,`<importexportxml><webresources><webresource>${(0,Za.xmlText)(t)}</webresource></webresources></importexportxml>`)}qe.publishWebResourceById=vF;function yF(e,t){return Di(e,`<importexportxml><dashboards><dashboard>${(0,Za.xmlText)(t)}</dashboard></dashboards></importexportxml>`)}qe.publishDashboardById=yF;function bF(e,t){return Di(e,`<importexportxml><uxagentprojects><uxagentproject>${(0,Za.xmlText)(t)}</uxagentproject></uxagentprojects></importexportxml>`)}qe.publishGenPageById=bF;function wF(e){let t=e?.entityLogicalName;return t?{envelope:"entity",entityLogicalName:t,blastRadiusWarning:"ENTITY_ENVELOPE_ALSO_SHIPS_UNRELATED_UNPUBLISHED_CHANGES"}:{envelope:"entity"}}qe.boundEntityPublishScope=wF;function AF(e,t){let r=t?.entityLogicalName;return r?A0(e,r):Promise.resolve()}qe.publishBoundEntity=AF});var Kc=g(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.base64ToBytes=wn.bytesToBase64=wn.utf8ToBase64=void 0;var C0=32768,At="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function Jc(){return globalThis}function CF(e){let t=[];for(let r=0;r<e.length;r+=1){let n=e.charCodeAt(r);if(n>=55296&&n<=56319){let i=r+1<e.length?e.charCodeAt(r+1):0;i>=56320&&i<=57343?(n=(n-55296<<10)+(i-56320)+65536,r+=1):n=65533}else n>=56320&&n<=57343&&(n=65533);n<128?t.push(n):n<2048?t.push(192|n>>6,128|n&63):n<65536?t.push(224|n>>12,128|n>>6&63,128|n&63):t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|n&63)}return Uint8Array.from(t)}function SF(e){let t="";for(let r=0;r<e.length;r+=C0)t+=String.fromCharCode(...e.subarray(r,r+C0));return t}function EF(e){let t="";for(let r=0;r<e.length;r+=1){let n=String.fromCharCode(e.charCodeAt(r)&255);if(n==="=")break;n==="-"?t+="+":n==="_"?t+="/":At.indexOf(n)>=0&&(t+=n)}for(t.length%4===1&&(t=t.slice(0,-1));t.length%4!==0;)t+="=";return t}function NF(e){let t="",r=0;for(;r+2<e.length;r+=3){let i=e[r]<<16|e[r+1]<<8|e[r+2];t+=At[i>>18&63]+At[i>>12&63]+At[i>>6&63]+At[i&63]}let n=e.length-r;if(n===1){let i=e[r]<<16;t+=`${At[i>>18&63]}${At[i>>12&63]}==`}else if(n===2){let i=e[r]<<16|e[r+1]<<8,a=At[i>>18&63],o=At[i>>12&63],s=At[i>>6&63];t+=`${a}${o}${s}=`}return t}function DF(e){let t=e.endsWith("==")?2:e.endsWith("=")?1:0,r=e.length/4*3-t,n=new Uint8Array(r>0?r:0),i=0;for(let a=0;a<e.length;a+=4){let o=At.indexOf(e[a])<<18|At.indexOf(e[a+1])<<12|(e[a+2]==="="?0:At.indexOf(e[a+2]))<<6|(e[a+3]==="="?0:At.indexOf(e[a+3]));i<r&&(n[i++]=o>>16&255),i<r&&(n[i++]=o>>8&255),i<r&&(n[i++]=o&255)}return n}function IF(e){let t=Jc();if(t.Buffer)return t.Buffer.from(e,"utf8").toString("base64");let r=t.TextEncoder;return S0(r?new r().encode(e):CF(e))}wn.utf8ToBase64=IF;function S0(e){let t=Jc();return t.Buffer?t.Buffer.from(e).toString("base64"):t.btoa?t.btoa(SF(e)):NF(e)}wn.bytesToBase64=S0;function _F(e){let t=Jc();if(t.Buffer)return new Uint8Array(t.Buffer.from(e,"base64"));let r=EF(e);if(t.atob){let n=t.atob(r);return Uint8Array.from(n,i=>i.charCodeAt(0))}return DF(r)}wn.base64ToBytes=_F});var I0=g(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.deleteWebResource=br.getWebResource=br.updateWebResource=br.createWebResource=void 0;var TF=rr(),eo=be(),Vs=ie(),PF=Kc(),E0=ne(),OF={html:1,css:2,js:3,xml:4,png:5,jpg:6,gif:7,xsl:9,ico:10,svg:11,resx:12};function N0(e){if(e.contentBase64!==void 0)return e.contentBase64;if(e.content!==void 0)return(0,PF.utf8ToBase64)(e.content)}async function D0(e,t){return(0,TF.publishWebResourceById)(e,t)}async function RF(e,t){var r;let n=N0(t);if(n===void 0)throw new E0.InvalidArgumentError(`web resource '${t.name}' requires content or contentBase64`);let i={name:t.name,displayname:(r=t.displayName)!==null&&r!==void 0?r:t.name,webresourcetype:OF[t.type],content:n};t.description&&(i.description=t.description);let a=(0,eo.ensureSuccess)(await e.post("/webresourceset",i),e.apiUrl("/webresourceset")),o=(0,eo.readCreatedId)(a,"webresourceid");if(!o)throw new E0.InvalidArgumentError(`Dataverse did not return an id for web resource '${t.name}'`);return t.publish!==!1&&await D0(e,o),{id:o,name:t.name}}br.createWebResource=RF;async function FF(e,t,r){let n=(0,Vs.normalizeGuid)(t,"id"),i={},a=N0(r);a!==void 0&&(i.content=a),r.displayName!==void 0&&(i.displayname=r.displayName),r.description!==void 0&&(i.description=r.description);let o=`/webresourceset(${n})`;(0,eo.ensureSuccess)(await e.patch(o,i),e.apiUrl(o)),r.publish!==!1&&await D0(e,n)}br.updateWebResource=FF;async function xF(e,t){var r;let i=`/webresourceset(${(0,Vs.normalizeGuid)(t,"id")})${(0,Vs.odataQuery)([["$select","name,displayname,webresourcetype,content,description"]])}`;return(r=(0,eo.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)!==null&&r!==void 0?r:{}}br.getWebResource=xF;async function LF(e,t){let n=`/webresourceset(${(0,Vs.normalizeGuid)(t,"id")})`;(0,eo.ensureSuccess)(await e.delete(n),e.apiUrl(n))}br.deleteWebResource=LF});var Gs=g(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.applyAppSettings=Ve.setAppSetting=Ve.readAppSettings=Ve.resolveSettingDefinitions=Ve.APP_SETTING_UNSET=Ve.APP_SETTING_OFF=Ve.APP_SETTING_ON=Ve.HEADER_AND_NAVIGATION_REFRESH=void 0;var Ii=be(),Vr=ie();Ve.HEADER_AND_NAVIGATION_REFRESH="HeaderAndNavigationRefresh";Ve.APP_SETTING_ON="2";Ve.APP_SETTING_OFF="1";Ve.APP_SETTING_UNSET="0";function P0(e,t){return"/appsettings/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,Vr.odataQuery)([["$select",e],["$filter",t]])}async function O0(e,t){var r,n;let i=[...new Set(t.filter(Boolean))],a=new Map;if(i.length===0)return a;let o=i.map(c=>`uniquename eq '${(0,Vr.odataLiteral)(c)}'`).join(" or "),s=`/settingdefinitions${(0,Vr.odataQuery)([["$select","settingdefinitionid,uniquename,displayname"],["$filter",o]])}`,u=((n=(r=(0,Ii.ensureSuccess)(await e.get(s),e.apiUrl(s)).body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[]).filter(Boolean);for(let c of u)c.uniquename&&a.set(c.uniquename,c);return a}Ve.resolveSettingDefinitions=O0;async function kF(e,t){var r,n,i,a;let o=(0,Vr.normalizeGuid)(t,"App id"),s=P0("appsettingid,value,_settingdefinitionid_value",`_parentappmoduleid_value eq ${o}`),u=((n=(r=(0,Ii.ensureSuccess)(await e.get(s),e.apiUrl(s)).body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[]).filter(Boolean);if(u.length===0)return[];let c=[...new Set(u.map(p=>p._settingdefinitionid_value).filter(Boolean))],d=new Map;if(c.length>0){let p=c.map(v=>`settingdefinitionid eq ${(0,Vr.normalizeGuid)(v,"Setting definition id")}`).join(" or "),f=`/settingdefinitions${(0,Vr.odataQuery)([["$select","settingdefinitionid,uniquename,displayname"],["$filter",p]])}`,h=(0,Ii.ensureSuccess)(await e.get(f),e.apiUrl(f));for(let v of((a=(i=h.body)===null||i===void 0?void 0:i.value)!==null&&a!==void 0?a:[]).filter(Boolean))v.settingdefinitionid&&d.set(v.settingdefinitionid.toLowerCase(),v)}return u.map(p=>{var f,h,v,w,E;let D=d.get(((f=p._settingdefinitionid_value)!==null&&f!==void 0?f:"").toLowerCase());return{id:(h=p.appsettingid)!==null&&h!==void 0?h:"",name:(w=(v=D?.uniquename)!==null&&v!==void 0?v:p._settingdefinitionid_value)!==null&&w!==void 0?w:"",value:(E=p.value)!==null&&E!==void 0?E:"",...D?.displayname?{displayName:D.displayname}:{}}})}Ve.readAppSettings=kF;async function _0(e,t,r){var n,i,a;let o=P0("appsettingid,value",`_parentappmoduleid_value eq ${t} and _settingdefinitionid_value eq ${r}`),l=((i=(n=(0,Ii.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[]).filter(Boolean)[0];return l?.appsettingid?{id:l.appsettingid,value:(a=l.value)!==null&&a!==void 0?a:""}:void 0}async function R0(e,t,r,n){let i=(0,Vr.normalizeGuid)(t,"App id"),o=(await O0(e,[r])).get(r),s=o?.settingdefinitionid;if(!s)throw new Error(`App setting '${r}' is not available in this environment: no settingdefinition row has that uniquename. The feature may be version-gated or its solution may not be installed.`);let l=(0,Vr.normalizeGuid)(s,"Setting definition id"),u=await _0(e,i,l);if(u)return T0(e,u,n);let c="/appsettings",d={"[email protected]":`/appmodules(${i})`,"[email protected]":`/settingdefinitions(${l})`,value:n},p,f;try{if(p=await e.post(c,d),p.status>=200&&p.status<300)return"created"}catch(v){f=v}let h;try{h=await _0(e,i,l)}catch{h=void 0}if(h)return T0(e,h,n);throw p&&(0,Ii.ensureSuccess)(p,e.apiUrl(c)),f}Ve.setAppSetting=R0;async function T0(e,t,r){if(t.value===r)return"unchanged";let n=`/appsettings(${(0,Vr.normalizeGuid)(t.id,"App setting id")})`;return(0,Ii.ensureSuccess)(await e.patch(n,{value:r}),e.apiUrl(n)),"updated"}async function MF(e,t,r){var n;let i=[];for(let[a,o]of Object.entries(r??{}))try{await R0(e,t,a,o)}catch(s){i.push(`App setting '${a}' was not applied: ${(n=s?.message)!==null&&n!==void 0?n:String(s)} The app was created; set it later with setAppSetting().`)}return i}Ve.applyAppSettings=MF});var Ws=g(zs=>{"use strict";Object.defineProperty(zs,"__esModule",{value:!0});zs.HEADER_NAV_BOOLEAN_RULE=void 0;zs.HEADER_NAV_BOOLEAN_RULE="headerAndNavigationRefresh-must-be-boolean"});var x0=g(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.deleteSolution=ee.importSolution=ee.exportSolution=ee.removeSolutionComponent=ee.addSolutionComponent=ee.setSolutionVersion=ee.createSolution=ee.createPublisher=ee.getSolution=ee.fetchSolutionComponents=ee.SolutionComponentType=void 0;var F0=er(),nr=be(),Ct=ie(),jn=ne();ee.SolutionComponentType={SavedQuery:26,Workflow:29,SavedQueryVisualization:59,SystemForm:60,AppModule:80,UxAgentProject:10372};var BF=[ee.SolutionComponentType.SavedQuery,ee.SolutionComponentType.Workflow,ee.SolutionComponentType.SavedQueryVisualization,ee.SolutionComponentType.SystemForm,ee.SolutionComponentType.AppModule,ee.SolutionComponentType.UxAgentProject];async function UF(e,t){let r=(0,Ct.normalizeGuid)(t,"solutionId"),n=BF.map(s=>`msdyn_componenttype eq ${s}`).join(" or "),i=`/msdyn_solutioncomponentsummaries${(0,Ct.odataQuery)([["$select","msdyn_objectid,msdyn_componenttype,msdyn_workflowcategory,msdyn_displayname,msdyn_name"],["$filter",`msdyn_solutionid eq ${r} and (${n})`]])}`,o=(await(0,F0.collectPages)(e,i,"fetchSolutionComponents")).filter(s=>typeof s.msdyn_objectid=="string").map(s=>({objectId:s.msdyn_objectid,componentType:Number(s.msdyn_componenttype),workflowCategory:s.msdyn_workflowcategory==null?void 0:Number(s.msdyn_workflowcategory),displayName:s.msdyn_displayname,name:s.msdyn_name}));return[...o,...await $F(e,r,o)]}ee.fetchSolutionComponents=UF;async function $F(e,t,r){let n=new Set(r.map(s=>s.objectId.toLowerCase())),i=`/solutioncomponents${(0,Ct.odataQuery)([["$select","objectid,componenttype"],["$filter",`_solutionid_value eq ${t} and componenttype eq ${ee.SolutionComponentType.UxAgentProject}`]])}`,a=await(0,F0.collectPages)(e,i,"fetchSolutionComponents(draft pages)"),o=[];for(let s of a){let l=typeof s.objectid=="string"?s.objectid:void 0;l&&!n.has(l.toLowerCase())&&(n.add(l.toLowerCase()),o.push({objectId:l,componentType:ee.SolutionComponentType.UxAgentProject}))}return o}function qF(e){let t=e.length===38&&e.startsWith("{")&&e.endsWith("}")?e.slice(1,-1):e;return/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(t)}async function VF(e,t){var r,n,i,a,o,s,l,u,c,d;let p=String(t??"").trim();if(!p)throw new jn.InvalidArgumentError("getSolution: a solution unique name or id is required.");let f=qF(p)?`solutionid eq ${(0,Ct.normalizeGuid)(p,"solutionId")}`:`uniquename eq '${(0,Ct.odataLiteral)(p)}'`,h=`/solutions${(0,Ct.odataQuery)([["$select","solutionid,uniquename,friendlyname,version,ismanaged"],["$expand","publisherid($select=publisherid,uniquename,customizationprefix,customizationoptionvalueprefix)"],["$filter",f]])}`,E=((n=(r=(0,nr.ensureSuccess)(await e.get(h),e.apiUrl(h)).body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[])[0];if(!E?.solutionid)throw new jn.InvalidArgumentError(`No solution found for '${t}'.`);let D=E.publisherid;if(!D?.publisherid)throw new jn.InvalidArgumentError(`Solution '${(i=E.uniquename)!==null&&i!==void 0?i:t}' returned no owning publisher, so its customization prefix cannot be determined; refusing to report an empty prefix that could be mistaken for "no prefix".`);if(!("customizationprefix"in D))throw new jn.InvalidArgumentError(`Solution '${(a=E.uniquename)!==null&&a!==void 0?a:t}' returned a publisher without a customizationprefix property (partial expansion), so its prefix cannot be determined.`);return{solutionId:(0,Ct.normalizeGuid)(E.solutionid,"solutionId"),uniqueName:(o=E.uniquename)!==null&&o!==void 0?o:"",friendlyName:(s=E.friendlyname)!==null&&s!==void 0?s:"",version:(l=E.version)!==null&&l!==void 0?l:"",isManaged:!!E.ismanaged,publisherId:(0,Ct.normalizeGuid)(D.publisherid,"publisherId"),publisherUniqueName:(u=D.uniquename)!==null&&u!==void 0?u:"",publisherPrefix:(c=D.customizationprefix)!==null&&c!==void 0?c:"",publisherOptionValuePrefix:(d=D.customizationoptionvalueprefix)!==null&&d!==void 0?d:0}}ee.getSolution=VF;async function GF(e,t){var r;let n={uniquename:t.uniqueName,friendlyname:t.friendlyName,customizationprefix:t.prefix,customizationoptionvalueprefix:(r=t.optionValuePrefix)!==null&&r!==void 0?r:1e4};t.description&&(n.description=t.description);let i=(0,nr.ensureSuccess)(await e.post("/publishers",n),e.apiUrl("/publishers")),a=(0,nr.readCreatedId)(i,"publisherid");if(!a)throw new jn.InvalidArgumentError(`Dataverse did not return an id for publisher '${t.uniqueName}'`);return{id:a,uniqueName:t.uniqueName}}ee.createPublisher=GF;async function zF(e,t){var r;let n=(0,Ct.normalizeGuid)(t.publisherId,"publisherId"),i={uniquename:t.uniqueName,friendlyname:t.friendlyName,version:(r=t.version)!==null&&r!==void 0?r:"1.0.0.0","[email protected]":`/publishers(${n})`};t.description&&(i.description=t.description);let a=(0,nr.ensureSuccess)(await e.post("/solutions",i),e.apiUrl("/solutions")),o=(0,nr.readCreatedId)(a,"solutionid");if(!o)throw new jn.InvalidArgumentError(`Dataverse did not return an id for solution '${t.uniqueName}'`);return{id:o,uniqueName:t.uniqueName}}ee.createSolution=zF;async function WF(e,t,r){let i=`/solutions(${(0,Ct.normalizeGuid)(t,"solutionId")})`;(0,nr.ensureSuccess)(await e.patch(i,{version:r}),e.apiUrl(i))}ee.setSolutionVersion=WF;async function HF(e,t){var r;let i={ComponentId:(0,Ct.normalizeGuid)(t.componentId,"componentId"),ComponentType:t.componentType,SolutionUniqueName:t.solutionUniqueName,AddRequiredComponents:(r=t.addRequiredComponents)!==null&&r!==void 0?r:!1};t.doNotIncludeSubcomponents!==void 0&&(i.DoNotIncludeSubcomponents=t.doNotIncludeSubcomponents),(0,nr.ensureSuccess)(await e.post("/AddSolutionComponent",i),e.apiUrl("/AddSolutionComponent"))}ee.addSolutionComponent=HF;async function jF(e,t,r,n){let a={SolutionComponent:{"@odata.type":"Microsoft.Dynamics.CRM.solutioncomponent",solutioncomponentid:(0,Ct.normalizeGuid)(t,"componentId")},ComponentType:r,SolutionUniqueName:n};(0,nr.ensureSuccess)(await e.post("/RemoveSolutionComponent",a),e.apiUrl("/RemoveSolutionComponent"))}ee.removeSolutionComponent=jF;async function QF(e,t){var r,n;let i={SolutionName:t.solutionName,Managed:(r=t.managed)!==null&&r!==void 0?r:!1},o=(n=(0,nr.ensureSuccess)(await e.post("/ExportSolution",i),e.apiUrl("/ExportSolution")).body)===null||n===void 0?void 0:n.ExportSolutionFile;if(!o)throw new jn.InvalidArgumentError(`ExportSolution returned no file for '${t.solutionName}'`);return{base64:o}}ee.exportSolution=QF;async function JF(e,t){var r,n;let i={OverwriteUnmanagedCustomizations:(r=t.overwriteUnmanagedCustomizations)!==null&&r!==void 0?r:!0,PublishWorkflows:(n=t.publishWorkflows)!==null&&n!==void 0?n:!0,CustomizationFile:t.base64};t.importJobId&&(i.ImportJobId=(0,Ct.normalizeGuid)(t.importJobId,"importJobId")),(0,nr.ensureSuccess)(await e.post("/ImportSolution",i),e.apiUrl("/ImportSolution"))}ee.importSolution=JF;async function KF(e,t){let n=`/solutions(${(0,Ct.normalizeGuid)(t,"solutionId")})`;(0,nr.ensureSuccess)(await e.delete(n),e.apiUrl(n))}ee.deleteSolution=KF});var Qs=g(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.appApi=An.deleteAppResolvingOnce=An.unpublishedAppModulesQuery=void 0;var rd=er(),XF=id(),L0=rr(),YF=Gs(),we=be(),se=ie(),td=ct(),ZF=$c(),he=ne(),ex=(0,se.odataQuery)([["$select","appmoduleid,name,uniquename,description,aiappdescription"]]),Xc="appmoduleid,name,uniquename,description,aiappdescription";function V0(e,t,r){return"/appmodules/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,se.odataQuery)([["$select",e],["$filter",t],["$top",r]])}An.unpublishedAppModulesQuery=V0;function Yc(e,t){return V0(e,t?`appmoduleid eq ${t}`:void 0,t?1:void 0)}function js(e,t){return"/sitemaps/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,se.odataQuery)([["$select",t],["$filter",`sitemapid eq ${e}`],["$top",1]])}function _i(e){var t;let r=(t=e.body)===null||t===void 0?void 0:t.value;if(Array.isArray(r))return r[0]}function Hs(e){let t=e?.["@odata.etag"];return typeof t=="string"?t:null}function to(e){let t=new Set,r=[];for(let n of e??[])n&&!t.has(n)&&(t.add(n),r.push(n));return r}function tx(e){return`cdsapp_${(e||"").replace(/[^a-zA-Z0-9]/g,"")||"app"}`}async function G0(e,t){var r,n;let i=u=>{throw new he.SdkError("APP_SITEMAP_UNRESOLVED",`The sitemap lookup for app uniquename '${t??""}' ${u}, so it cannot be determined whether this app has a sitemap. Retry; if the app is newly created, publish it first (an unpublished app is not readable).`)};if(!t)return i("cannot run because the app record carried no uniquename");let a=`/sitemaps${(0,se.odataQuery)([["$select","sitemapid"],["$filter",`sitemapnameunique eq '${(0,se.odataLiteral)(t)}'`],["$top",1]])}`,o;try{o=await e.get(a)}catch(u){return i(`failed (${u.message})`)}if(o.status<200||o.status>=300)return i(`returned HTTP ${o.status}`);let s=(r=o.body)===null||r===void 0?void 0:r.value;if(!Array.isArray(s))return i("returned a malformed body");let l=(n=s[0])===null||n===void 0?void 0:n.sitemapid;return s.length>0&&!l?i("returned a row with no sitemapid"):l}async function rx(e){let t=s=>{var l,u,c;return(c=(u=(l=s.body)===null||l===void 0?void 0:l.value)===null||u===void 0?void 0:u[0])===null||c===void 0?void 0:c.webresourceid},r=s=>`/webresourceset${(0,se.odataQuery)([["$select","webresourceid"],["$top",1],["$filter",s]])}`,n="(webresourcetype eq 5 or webresourcetype eq 6 or webresourcetype eq 7 or webresourcetype eq 10 or webresourcetype eq 11)",i=t(await e.get(r("webresourcetype eq 5 and ismanaged eq false and contains(name,'icon')")));if(i)return{id:i,managed:!1};let a=t(await e.get(r(`${n} and ismanaged eq false`)));if(a)return{id:a,managed:!1};let o=t(await e.get(r(n)));return o?{id:o,managed:!0}:void 0}function nd(e){return e instanceof Error?e.message:String(e)}async function nx(e,t){var r,n,i;try{let a=`/roles${(0,se.odataQuery)([["$select","roleid"],["$filter","name eq 'System Administrator'"],["$top",1]])}`,s=(i=(n=(r=(0,we.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||r===void 0?void 0:r.value)===null||n===void 0?void 0:n[0])===null||i===void 0?void 0:i.roleid;if(!s)return"App roles: no 'System Administrator' role was found in this environment, so the app was created with NO security role associated \u2014 it will not be visible or playable until a role is granted access to it.";let l=`/appmodules(${t})/appmoduleroles_association/$ref`;return(0,we.ensureSuccess)(await e.post(l,{"@odata.id":e.apiUrl(`/roles(${s})`)}),e.apiUrl(l)),null}catch(a){return`App roles: could not associate the 'System Administrator' role with the app (${nd(a)}); it will not be visible or playable until a role is granted access to it.`}}async function ix(e,t){let r=[];async function n(s,l,u){try{return(await(0,rd.collectPages)(e,s,`app assets (${u} for '${t}')`)).map(d=>String(d[l])).filter(d=>d&&d!=="undefined")}catch(c){return r.push(`App components: could not enumerate ${u} for table '${t}' (${nd(c)}); they were NOT added to the app.`),[]}}let[i,a,o]=await Promise.all([n(`/systemforms${(0,se.odataQuery)([["$select","formid"],["$filter",`objecttypecode eq '${(0,se.odataLiteral)(t)}' and type eq 2 and formactivationstate eq 1`]])}`,"formid","forms"),n(`/savedqueries${(0,se.odataQuery)([["$select","savedqueryid"],["$filter",`returnedtypecode eq '${(0,se.odataLiteral)(t)}' and querytype eq 0 and statecode eq 0`]])}`,"savedqueryid","views"),n(`/savedqueryvisualizations${(0,se.odataQuery)([["$select","savedqueryvisualizationid"],["$filter",`primaryentitytypecode eq '${(0,se.odataLiteral)(t)}'`]])}`,"savedqueryvisualizationid","charts")]);return{forms:i,views:a,charts:o,warnings:r}}var k0=new WeakMap;async function ax(e,t){let r=k0.get(e);r||(r=new Map,k0.set(e,r));let n=r.get(t);if(n!==void 0)return n;let i=await ox(e,t);return i&&r.set(t,i),i}async function M0(e,t,r){let n=new Array(e.length),i=0;async function a(){for(let o=i;o<e.length;o=i)i=o+1,n[o]=await r(e[o])}return await Promise.all(Array.from({length:Math.min(t,e.length)},()=>a())),n}async function ox(e,t){let r=`/EntityDefinitions(LogicalName='${(0,se.odataLiteral)(t)}')${(0,se.odataQuery)([["$select","MetadataId,EntitySetName"]])}`,n=await e.get(r);if(n.status>=200&&n.status<300){let i=n.body;if(i?.MetadataId&&i.EntitySetName)return{logicalName:t,metadataId:i.MetadataId,entitySetName:i.EntitySetName}}}async function B0(e,t){let r=[],n=to(t.entities),i=4,a=await M0(n,i,f=>ax(e,f)),o=n.filter((f,h)=>!a[h]);if(o.length>0)throw new he.SdkError("APP_ENTITY_COMPONENT_UNRESOLVED",`Refusing to build app components: table(s) ${o.map(f=>`'${f}'`).join(", ")} could not be resolved to an EntityDefinitions MetadataId + EntitySetName. Pinning the rest would produce an app whose navigation references a table the app does not contain. Verify the table name(s) exist in this environment and retry.`);let s=a.filter(f=>!!f);for(let f of s)r.push({"@odata.id":`${f.entitySetName}(${f.metadataId})`});for(let f of to(t.components.forms))r.push({"@odata.type":"Microsoft.Dynamics.CRM.systemform",formid:f});for(let f of to(t.components.views))r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedquery",savedqueryid:f});for(let f of to(t.components.charts))r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedqueryvisualization",savedqueryvisualizationid:f});for(let f of to(t.components.dashboards))r.push({"@odata.type":"Microsoft.Dynamics.CRM.systemform",formid:f});let l=new Set(t.components.forms),u=new Set(t.components.views),c=new Set(t.components.charts),d=await M0(n,i,f=>ix(e,f)),p=d.flatMap(f=>f.warnings);for(let f of d){for(let h of f.forms)l.has(h)||(l.add(h),r.push({"@odata.type":"Microsoft.Dynamics.CRM.systemform",formid:h}));for(let h of f.views)u.has(h)||(u.add(h),r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedquery",savedqueryid:h}));for(let h of f.charts)c.has(h)||(c.add(h),r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedqueryvisualization",savedqueryvisualizationid:h}))}return{components:r,tables:s,warnings:p}}async function U0(e,t,r){if(r.length===0)return;let n="/AddAppComponents";(0,we.ensureSuccess)(await e.post(n,{AppId:t,Components:r}),e.apiUrl(n))}function sx(e){return"/appmodules/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,se.odataQuery)([["$select","appmoduleid,appmoduleidunique"],["$filter",`appmoduleid eq ${e}`],["$top",1]])}async function $0(e,t,r){var n;if(r.length===0)return;let i=sx(t),a=await e.get(i);if(a.status<200||a.status>=300)throw new he.SdkError("APP_COMPONENTS_UNVERIFIED",`App '${t}': its components were written but could not be verified \u2014 the unpublished-aware read returned HTTP ${a.status}. Re-push to retry.`);let o=_i(a),s=o?.appmoduleidunique;if(typeof s!="string"||!s)throw new he.SdkError("APP_COMPONENTS_UNVERIFIED",`App '${t}': its components were written but could not be verified \u2014 the app did not return an 'appmoduleidunique' to file components under. Re-push to retry.`);let l=`/appmodulecomponents${(0,se.odataQuery)([["$select","objectid,componenttype"],["$filter",`_appmoduleidunique_value eq ${(0,se.normalizeGuid)(s,`App '${t}' appmoduleidunique`)} and componenttype eq 1`]])}`,u=await e.get(l);if(u.status<200||u.status>=300)throw new he.SdkError("APP_COMPONENTS_UNVERIFIED",`App '${t}': its table components were written but could not be verified \u2014 reading them back returned HTTP ${u.status}. Re-push to retry.`);let c=(n=u.body)===null||n===void 0?void 0:n.value;if(!Array.isArray(c))throw new he.SdkError("APP_COMPONENTS_UNVERIFIED",`App '${t}': its table components were written but could not be verified \u2014 the read-back returned no readable result set. Re-push to retry.`);let d=new Set(c.map(f=>f.objectid).filter(f=>typeof f=="string").map(f=>f.toLowerCase())),p=r.filter(f=>!d.has(f.metadataId.toLowerCase()));if(p.length>0)throw new he.SdkError("APP_COMPONENTS_NOT_PERSISTED",`App '${t}': ${p.length} declared table(s) are NOT components of the app after AddAppComponents reported success \u2014 ${p.map(f=>`'${f.logicalName}' (expected objectid ${f.metadataId})`).join(", ")}. The app's navigation would reference content the app does not contain.`)}async function lx(e,t,r){let n=`/appmodules(${t})`,i=`/sitemaps(${r.sitemapId})`;try{let a=await ux(e,r.sitemapId,r.sitemapNameUnique);if(a==="absent"){r.serverRefusedSitemap&&(0,we.ensureSuccess)(await e.delete(n),e.apiUrl(n));return}if(a==="foreign"){r.serverRefusedSitemap&&(0,we.ensureSuccess)(await e.delete(n),e.apiUrl(n));return}e.supportsAtomicBatch&&await W0(e,[{path:n,etag:r.appEtag},{path:i,etag:r.sitemapEtag}])}catch{}}async function ux(e,t,r){var n,i,a;let o=js(t,"sitemapid,sitemapnameunique"),s=await e.get(o);if(s.status<200||s.status>=300)throw new he.SdkError("APP_SITEMAP_UNRESOLVED",`The unpublished-aware read of sitemap '${t}' returned HTTP ${s.status}, so it cannot be determined whether the row exists.`);let l=(n=s.body)===null||n===void 0?void 0:n.value;if(!Array.isArray(l))throw new he.SdkError("APP_SITEMAP_UNRESOLVED",`The unpublished-aware read of sitemap '${t}' returned no readable result set, so it cannot be determined whether the row exists.`);return l.length===0?"absent":String((a=(i=l[0])===null||i===void 0?void 0:i.sitemapnameunique)!==null&&a!==void 0?a:"")===r?"ours":"foreign"}async function z0(e,t){var r;let n=(0,se.normalizeGuid)(t,"id"),i=h=>{throw new he.SdkError("APP_SITEMAP_UNRESOLVED",`Refusing to delete app '${n}': ${h} Deleting the app would destroy the only pointer to its sitemap, stranding that row and reserving its unique name forever. Retry; if the app is newly created, publish it first (an unpublished app is not readable).`)},a=`/appmodules(${n})${ex}`,o;try{o=await e.get(a)}catch(h){return i(`reading the app failed (${h.message}).`)}if(o.status<200||o.status>=300)return i(o.status===404?"reading the app returned HTTP 404, which does NOT prove it is absent \u2014 Dataverse also reports an unpublished app that way, and such an app still owns a sitemap.":`reading the app returned HTTP ${o.status}.`);let s=(r=o.body)===null||r===void 0?void 0:r.uniquename;if(!s)return i("the app record carried no uniquename, so its sitemap cannot be located.");let l=await G0(e,s);if(!l)return{uniquename:s,appEtag:(0,we.readEtag)(o)};let u=(0,se.normalizeGuid)(l,"sitemapId"),c=js(u,"sitemapid,sitemapnameunique,sitemapxml"),d;try{d=await e.get(c)}catch(h){return i(`reading sitemap '${u}' failed (${h.message}).`)}if(d.status<200||d.status>=300)return i(`reading sitemap '${u}' returned HTTP ${d.status}.`);let p=_i(d);if(!p)return i(`sitemap '${u}' was not returned by the unpublished-aware read.`);if(p.sitemapnameunique!==s)return i(`sitemap '${u}' now carries sitemapnameunique '${String(p.sitemapnameunique)}', not '${s}', so it is no longer this app's sitemap.`);let f=p.sitemapxml;return typeof f!="string"?i(`sitemap '${u}' returned no sitemapxml.`):{sitemapId:u,uniquename:s,sitemapXml:f,appEtag:(0,we.readEtag)(o),sitemapEtag:Hs(p)}}async function cx(e,t,r){let n=(0,se.normalizeGuid)(t,"id"),i=await z0(e,n);await r?.(i.sitemapXml),await H0(e,n,i)}An.deleteAppResolvingOnce=cx;async function W0(e,t){let r=`batch_${(0,td.newId)()}`,n=`changeset_${(0,td.newId)()}`,i=t.map((d,p)=>[`--${n}`,"Content-Type: application/http","Content-Transfer-Encoding: binary",`Content-ID: ${p+1}`,"",`DELETE ${e.apiUrl(d.path)} HTTP/1.1`,...d.etag?[`If-Match: ${d.etag}`]:[],""].join(`\r
`)),a=[`--${r}`,`Content-Type: multipart/mixed;boundary=${n}`,"",...i,`--${n}--`,`--${r}--`,""].join(`\r
-`),o=await e.postBatch(a,r),s=e.apiUrl("/$batch");(0,Ae.ensureSuccess)(o,s);let l=`app '${t[0].path}'`;if(typeof o.body!="string"||o.body.length===0)throw new he.ConnectionError(s,o.status,`atomic delete of ${l} cannot be confirmed: the $batch response had no readable body, so the change set's outcome is unknown`);let u=(0,ik.parseChangeSetStatuses)(o.body,i.map((d,p)=>String(p+1)));if(u===void 0)throw new he.ConnectionError(s,o.status,`atomic delete of ${l} cannot be confirmed: the $batch response could not be parsed as a change set, so the outcome is unknown`);let c=u.find(d=>d<200||d>=300);if(c!==void 0)throw new he.ConnectionError(s,c,`atomic delete of ${l} was rolled back: the change set reported HTTP ${c}`);if(u.length!==i.length)throw new he.ConnectionError(s,o.status,`atomic delete of ${l} cannot be confirmed: the $batch response reported ${u.length} operation result(s), expected exactly ${i.length}`)}async function Wd(e,t){try{let r=ol(t,"sitemapid"),n=await e.get(r);return n.status<200||n.status>=300?null:al(Pi(n))}catch{return null}}function gk(e){return e>=400&&e<500&&e!==408&&e!==429}function jd(e,t,r){if(!e)throw new he.SdkError("APP_SITEMAP_UNRESOLVED",`Refusing to delete app '${t}': the ${r} read returned no ETag, so the delete cannot be made conditional on the row that was actually inspected. Without that condition a row renamed or re-pointed between the read and the delete would be destroyed. Retry.`);return e}async function qy(e,t,r){let n=`/appmodules(${t})`;if(!r.sitemapId){await vk(e,n,jd(r.appEtag,t,"app"));return}if(!e.supportsAtomicBatch)throw new he.SdkError("APP_DELETE_NOT_ATOMIC",`Refusing to delete app '${t}': it owns a sitemap, and the injected HttpClient cannot send a raw body, so the two rows would have to be deleted as separate requests. A failure between them strands the sitemap and permanently reserves the app's unique name. Implement HttpClient.postRaw so the SDK can delete them atomically.`);await $y(e,[{path:n,etag:jd(r.appEtag,t,"app")},{path:`/sitemaps(${r.sitemapId})`,etag:jd(r.sitemapEtag,t,"sitemap")}])}async function vk(e,t,r){(0,Ae.ensureSuccess)(await e.delete(t,{headers:{"If-Match":r}}),e.apiUrl(t))}async function ky(e,t){if(!/GenPageId/i.test(t))return;let r;try{r=[...new Set((0,rk.collectGenPageIds)(t))]}catch(o){throw new he.SdkError("SITEMAP_TARGET_UNVERIFIABLE",`Refusing to push the app: its sitemap xml could not be parsed, so the generative pages it navigates to cannot be verified (${Jd(o)}).`)}if(r.length===0)return;let n=new Set,i=50;for(let o=0;o<r.length;o+=i){let s=r.slice(o,o+i),l="/uxagentprojects/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,ae.odataQuery)([["$select","uxagentprojectid"],["$filter",s.map(c=>`uxagentprojectid eq ${c}`).join(" or ")]]),u=await(0,Qd.collectPages)(e,l,"sitemap generative-page preflight");for(let c of u){let d=c.uxagentprojectid;typeof d=="string"&&d.trim()!==""&&n.add((0,ae.normalizeGuid)(d,"uxagentprojectid"))}}let a=r.filter(o=>!n.has(o));if(a.length>0)throw new he.SdkError("SITEMAP_TARGET_NOT_FOUND",`Refusing to push the app: its sitemap navigates to generative page(s) ${a.map(o=>`'${o}'`).join(", ")} that do not exist in this environment. Push the page before the app that links to it.`)}function yk(e){var t,r;if(e.status!==400)return!1;let n=e.body;return String((r=(t=n?.error)===null||t===void 0?void 0:t.message)!==null&&r!==void 0?r:"").includes("retrieval of version numbers failed")}gn.appApi={async get(e,t){var r;let n=(0,ae.normalizeGuid)(t,"id"),i=zd(Gd,n),a=(0,Ae.ensureSuccess)(await e.get(i),e.apiUrl(i)),o=(r=Pi(a))!==null&&r!==void 0?r:{};if(!o.appmoduleid)throw new he.SdkError("APP_NOT_FOUND",`App '${n}' was not found (checked the unpublished-aware projection, which includes drafts).`);let s=await Uy(e,o.uniquename),l=s?(0,ae.normalizeGuid)(s,"sitemapId"):void 0,u=null;if(l){let d=ol(l,"sitemapid,sitemapname,sitemapnameunique,sitemapxml"),p=(0,Ae.ensureSuccess)(await e.get(d),e.apiUrl(d)),f=Pi(p);if(f&&f.sitemapnameunique!==o.uniquename)throw new he.SdkError("APP_SITEMAP_UNRESOLVED",`Refusing to fetch app '${n}': sitemap '${l}' now carries sitemapnameunique '${String(f.sitemapnameunique)}', not '${String(o.uniquename)}', so it is no longer this app's sitemap. Retry.`);o.$sitemap=f??{},u=al(f)}let c=al(o);return{raw:o,etag:u,...o.appmoduleid?{siblingEtags:{[(0,ae.normalizeGuid)(o.appmoduleid,"appmoduleid")]:c}}:{}}},async list(e,t){let r=zd(Gd);return(await(0,Qd.collectPages)(e,r,"listArtifacts('app')")).map(i=>{var a,o;return{type:"app",id:(a=i.appmoduleid)!==null&&a!==void 0?a:"",name:(o=i.name)!==null&&o!==void 0?o:"",isDirty:!1}})},async create(e,t,r){let n=t;await ky(e,n.sitemapxml);let i=n.iconWebResourceId?void 0:await sk(e),a=n.iconWebResourceId||i?.id;if(!a)throw new he.SdkError("APP_ICON_UNRESOLVED",`Cannot create app '${n.appModuleName}': its icon (\`appmodule.webresourceid\`) is a REQUIRED attribute and this environment has no image web resource to use. Pass \`iconWebResourceId\` explicitly, or add an image (PNG/JPG/GIF/ICO/SVG) web resource to the environment.`);let o=null;i?.managed&&(o=`No unmanaged image web resource was available, so the app icon resolved to a MANAGED one (${i.id}). That creates a cross-solution dependency which can fail to import into an environment without the owning managed solution. Pass \`iconWebResourceId\` with an in-solution image to avoid it.`);let s=n.appModuleUniqueName||ok(n.appModuleId),l={name:n.appModuleName,uniquename:s,clienttype:4,formfactor:1,navigationtype:0};n.appModuleDescription&&(l.description=n.appModuleDescription),a&&(l.webresourceid=a);let u="/appmodules",c=(0,Ae.ensureSuccess)(await e.post(u,(0,Ae.withClientMintedId)(l,"appmoduleid",r)),e.apiUrl(u)),d=(0,Ae.resolveCreatedId)(c,"appmoduleid","app module",r),p=null,f=[];o&&f.push(o);let h={kind:"notRequested"},y=(0,Hd.newId)(),w=!1;try{let D="/sitemaps",x=await e.post(D,{sitemapid:y,sitemapnameunique:s,sitemapname:n.sitemapname,sitemapxml:n.sitemapxml});w=gk(x.status);let F=(0,Ae.ensureSuccess)(x,e.apiUrl(D));p=(0,Ae.readEtag)(F),p||(p=await Wd(e,y));let X=await Fy(e,n);f.push(...X.warnings);let V=X.components;V.unshift({"@odata.type":"Microsoft.Dynamics.CRM.sitemap",sitemapid:y}),await xy(e,d,V),await Ly(e,d,X.tables);let M=await lk(e,d);M&&f.push(M),n.appSettings&&Object.keys(n.appSettings).length>0&&f.push(...await(0,nk.applyAppSettings)(e,d,n.appSettings)),n.published!==!1&&(await(0,Ty.publishAppModule)(e,d),h={kind:"submitted"})}catch(D){throw await fk(e,d,{sitemapId:y,serverRefusedSitemap:w,appEtag:(0,Ae.readEtag)(c),sitemapEtag:p}),D}let N=null;if(h.kind==="submitted")try{let D=await e.get(`/appmodules(${d})?$select=appmoduleid`);D.status>=200&&D.status<300&&(N=(0,Ae.readEtag)(D))}catch{}return{id:d,etag:p,serverIdentity:{sitemapId:y},siblingEtags:{[d]:N},publish:h,...f.length>0?{warnings:f}:{}}},async update(e,t,r,n,i,a){var o,s,l,u,c,d,p;let f=r,h=(0,ae.normalizeGuid)(t,"id");if(await ky(e,f.sitemapxml),!f.sitemapId)throw new he.ValidationError("app",h,"/sitemapId","missing sitemap identity \u2014 re-fetch the app before pushing edits");let y=(0,ae.normalizeGuid)(f.sitemapId,"sitemapId");if(!n)throw new he.SdkError("APP_UPDATE_NO_ETAG",`Refusing to push app '${h}': no concurrency token is held for its sitemap row, so the write could not be made conditional and would silently overwrite a concurrent edit. Re-fetch the app and re-apply the change.`);let w=await Fy(e,f),N=`/appmodules(${h})`,D=(o=a?.[h])!==null&&o!==void 0?o:null,x=!0,F=!1;try{let ye=zd(Gd,h),Ge=await e.get(ye);if(Ge.status>=200&&Ge.status<300){let Ze=(s=Pi(Ge))!==null&&s!==void 0?s:{};F=!0,x=String((l=Ze.name)!==null&&l!==void 0?l:"")!==String((u=f.appModuleName)!==null&&u!==void 0?u:"")||String((c=Ze.description)!==null&&c!==void 0?c:"")!==String((d=f.appModuleDescription)!==null&&d!==void 0?d:"")}}catch{}let X=D;if(x){let ye=F?D:null,Ge=ye?(0,Ae.echoWrite)("appmoduleid",{"If-Match":ye}):{query:"",options:void 0},Ze=await e.patch(`${N}${Ge.query}`,{name:f.appModuleName,description:f.appModuleDescription},Ge.options);if(yk(Ze))throw new he.SdkError("APP_DRAFT_HEADER_NOT_WRITABLE",`Refusing to update app '${h}': its appmodule row is UNPUBLISHED, and Dataverse cannot resolve version numbers for a draft appmodule (HTTP 400). A draft header cannot be PATCHed at all \u2014 a plain retry fails too, as an upsert-create ("webresourceid cannot be NULL"). Publish the app first, then push the header edit. Nothing was modified by this call.`);(0,Ae.ensureSuccess)(Ze,e.apiUrl(N)),X=(0,Ae.readEtag)(Ze)}let V={"If-Match":n},M=`/sitemaps(${y})`,U;try{U=(0,Ae.ensureSuccess)(await e.patch(M,{sitemapxml:f.sitemapxml,sitemapname:f.sitemapname},V?{headers:V}:void 0),e.apiUrl(M))}catch(ye){throw(0,he.withPartialTokens)(ye,{siblingEtags:{[h]:X}})}let B=[...w.warnings];try{await xy(e,h,w.components),await Ly(e,h,w.tables)}catch(ye){B.push(`App '${h}': one or more components were not pinned (${ye.message}). Navigation may reference content not included in the app; re-push to retry.`)}let z={kind:"notRequested"},$=X,Ee=(0,Ae.readEtag)(U);if(f.published===!0){try{await(0,Ty.publishAppModule)(e,h),z={kind:"submitted"}}catch(ye){z={kind:"failed",error:ye},B.push(`App '${h}': saved, but publishing failed (${ye.message}). The app remains unpublished; re-push to retry.`)}if(z.kind==="submitted"){$=null;try{let ye=await e.get(`/appmodules(${h})?$select=appmoduleid`);ye.status>=200&&ye.status<300&&($=(0,Ae.readEtag)(ye)),Ee=(p=await Wd(e,y))!==null&&p!==void 0?p:Ee}catch{}}}return{id:h,etag:Ee??await Wd(e,y),siblingEtags:{[h]:$},publish:z,...B.length>0?{warnings:B}:{}}},async delete(e,t){let r=(0,ae.normalizeGuid)(t,"id");await qy(e,r,await By(e,r))}}});var ao=g(Ti=>{"use strict";function bk(e,t,r){if(r===void 0&&(r=Array.prototype),e&&typeof r.find=="function")return r.find.call(e,t);for(var n=0;n<e.length;n++)if(Object.prototype.hasOwnProperty.call(e,n)){var i=e[n];if(t.call(void 0,i,n,e))return i}}function Kd(e,t){return t===void 0&&(t=Object),t&&typeof t.freeze=="function"?t.freeze(e):e}function wk(e,t){if(e===null||typeof e!="object")throw new TypeError("target is not an object");for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}var Vy=Kd({HTML:"text/html",isHTML:function(e){return e===Vy.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Gy=Kd({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===Gy.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});Ti.assign=wk;Ti.find=bk;Ti.freeze=Kd;Ti.MIME_TYPE=Vy;Ti.NAMESPACE=Gy});var up=g(Gr=>{var Ky=ao(),gr=Ky.find,oo=Ky.NAMESPACE;function Ak(e){return e!==""}function Ck(e){return e?e.split(/[\t\n\f\r ]+/).filter(Ak):[]}function Sk(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function zy(e){if(!e)return[];var t=Ck(e);return Object.keys(t.reduce(Sk,{}))}function Ek(e){return function(t){return e&&e.indexOf(t)!==-1}}function lo(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function St(e,t){var r=e.prototype;if(!(r instanceof t)){let i=function(){};var n=i;i.prototype=t.prototype,i=new i,lo(r,i),e.prototype=r=i}r.constructor!=e&&(typeof e!="function"&&console.error("unknown Class:"+e),r.constructor=e)}var Et={},Ut=Et.ELEMENT_NODE=1,Ri=Et.ATTRIBUTE_NODE=2,ul=Et.TEXT_NODE=3,Yy=Et.CDATA_SECTION_NODE=4,Zy=Et.ENTITY_REFERENCE_NODE=5,Nk=Et.ENTITY_NODE=6,Yd=Et.PROCESSING_INSTRUCTION_NODE=7,Zd=Et.COMMENT_NODE=8,eb=Et.DOCUMENT_NODE=9,tb=Et.DOCUMENT_TYPE_NODE=10,$r=Et.DOCUMENT_FRAGMENT_NODE=11,Dk=Et.NOTATION_NODE=12,at={},He={},yj=at.INDEX_SIZE_ERR=(He[1]="Index size error",1),bj=at.DOMSTRING_SIZE_ERR=(He[2]="DOMString size error",2),Ct=at.HIERARCHY_REQUEST_ERR=(He[3]="Hierarchy request error",3),wj=at.WRONG_DOCUMENT_ERR=(He[4]="Wrong document",4),Ik=at.INVALID_CHARACTER_ERR=(He[5]="Invalid character",5),Aj=at.NO_DATA_ALLOWED_ERR=(He[6]="No data allowed",6),Cj=at.NO_MODIFICATION_ALLOWED_ERR=(He[7]="No modification allowed",7),rb=at.NOT_FOUND_ERR=(He[8]="Not found",8),Sj=at.NOT_SUPPORTED_ERR=(He[9]="Not supported",9),Wy=at.INUSE_ATTRIBUTE_ERR=(He[10]="Attribute in use",10),Oi=at.INVALID_STATE_ERR=(He[11]="Invalid state",11),Ej=at.SYNTAX_ERR=(He[12]="Syntax error",12),Nj=at.INVALID_MODIFICATION_ERR=(He[13]="Invalid modification",13),Dj=at.NAMESPACE_ERR=(He[14]="Invalid namespace",14),Ij=at.INVALID_ACCESS_ERR=(He[15]="Invalid access",15);function ue(e,t){if(t instanceof Error)var r=t;else r=this,Error.call(this,He[e]),this.message=He[e],Error.captureStackTrace&&Error.captureStackTrace(this,ue);return r.code=e,t&&(this.message=this.message+": "+t),r}ue.prototype=Error.prototype;lo(at,ue);function qr(){}qr.prototype={length:0,item:function(e){return e>=0&&e<this.length?this[e]:null},toString:function(e,t,r){for(var n=!!r&&!!r.requireWellFormed,i=[],a=0;a<this.length;a++)lp(this[a],i,e,t,null,n);return i.join("")},filter:function(e){return Array.prototype.filter.call(this,e)},indexOf:function(e){return Array.prototype.indexOf.call(this,e)}};function Fi(e,t){this._node=e,this._refresh=t,ep(this)}function ep(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var r=e._refresh(e._node);if(mb(e,"length",r.length),!e.$$length||r.length<e.$$length)for(var n=r.length;n in e;n++)Object.prototype.hasOwnProperty.call(e,n)&&delete e[n];lo(r,e),e._inc=t}}Fi.prototype.item=function(e){return ep(this),this[e]||null};St(Fi,qr);function cl(){}function nb(e,t){for(var r=e.length;r--;)if(e[r]===t)return r}function jy(e,t,r,n){if(n?t[nb(t,n)]=r:t[t.length++]=r,e){r.ownerElement=e;var i=e.ownerDocument;i&&(n&&ob(i,e,n),_k(i,e,r))}}function Hy(e,t,r){var n=nb(t,r);if(n>=0){for(var i=t.length-1;n<i;)t[n]=t[++n];if(t.length=i,e){var a=e.ownerDocument;a&&(ob(a,e,r),r.ownerElement=null)}}else throw new ue(rb,new Error(e.tagName+"@"+r))}cl.prototype={length:0,item:qr.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var r=this[t];if(r.nodeName==e)return r}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new ue(Wy);var r=this.getNamedItem(e.nodeName);return jy(this._ownerElement,this,e,r),r},setNamedItemNS:function(e){var t=e.ownerElement,r;if(t&&t!=this._ownerElement)throw new ue(Wy);return r=this.getNamedItemNS(e.namespaceURI,e.localName),jy(this._ownerElement,this,e,r),r},removeNamedItem:function(e){var t=this.getNamedItem(e);return Hy(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var r=this.getNamedItemNS(e,t);return Hy(this._ownerElement,this,r),r},getNamedItemNS:function(e,t){for(var r=this.length;r--;){var n=this[r];if(n.localName==t&&n.namespaceURI==e)return n}return null}};function ib(){}ib.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,r){var n=new uo;if(n.implementation=this,n.childNodes=new qr,n.doctype=r||null,r&&n.appendChild(r),t){var i=n.createElementNS(e,t);n.appendChild(i)}return n},createDocumentType:function(e,t,r){var n=new ml;return n.name=e,n.nodeName=e,n.publicId=t||"",n.systemId=r||"",n}};function oe(){}oe.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return pl(this,e,t)},replaceChild:function(e,t){pl(this,e,t,lb),t&&this.removeChild(t)},removeChild:function(e){return sb(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(e){return fb(this.ownerDocument||this,this,e)},normalize:function(){je(this,null,{enter:function(e){for(var t=e.firstChild;t;){var r=t.nextSibling;r!==null&&r.nodeType===ul&&t.nodeType===ul?(e.removeChild(r),t.appendData(r.data)):t=r}return!0}})},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){for(var t=this;t;){var r=t._nsMap;if(r){for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)&&r[n]===e)return n}t=t.nodeType==Ri?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var r=t._nsMap;if(r&&Object.prototype.hasOwnProperty.call(r,e))return r[e];t=t.nodeType==Ri?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){var t=this.lookupPrefix(e);return t==null}};function ab(e){return e=="<"&&"&lt;"||e==">"&&"&gt;"||e=="&"&&"&amp;"||e=='"'&&"&quot;"||"&#"+e.charCodeAt()+";"}lo(Et,oe);lo(Et,oe.prototype);function dl(e,t){return je(e,null,{enter:function(r){return t(r)?je.STOP:!0}})===je.STOP}function je(e,t,r){for(var n=[{node:e,context:t,phase:je.ENTER}];n.length>0;){var i=n.pop();if(i.phase===je.ENTER){var a=r.enter(i.node,i.context);if(a===je.STOP)return je.STOP;if(n.push({node:i.node,context:a,phase:je.EXIT}),a==null)continue;for(var o=i.node.lastChild;o;)n.push({node:o,context:a,phase:je.ENTER}),o=o.previousSibling}else r.exit&&r.exit(i.node,i.context)}}je.STOP=Symbol("walkDOM.STOP");je.ENTER=0;je.EXIT=1;function uo(){this.ownerDocument=this}function _k(e,t,r){e&&e._inc++;var n=r.namespaceURI;n===oo.XMLNS&&(t._nsMap[r.prefix?r.localName:""]=r.value)}function ob(e,t,r,n){e&&e._inc++;var i=r.namespaceURI;i===oo.XMLNS&&delete t._nsMap[r.prefix?r.localName:""]}function tp(e,t,r){if(e&&e._inc){e._inc++;var n=t.childNodes;if(r)n[n.length++]=r;else{for(var i=t.firstChild,a=0;i;)n[a++]=i,i=i.nextSibling;n.length=a,delete n[n.length]}}}function sb(e,t){var r=t.previousSibling,n=t.nextSibling;return r?r.nextSibling=n:e.firstChild=n,n?n.previousSibling=r:e.lastChild=r,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,tp(e.ownerDocument,e),t}function Pk(e){return e&&(e.nodeType===oe.DOCUMENT_NODE||e.nodeType===oe.DOCUMENT_FRAGMENT_NODE||e.nodeType===oe.ELEMENT_NODE)}function Tk(e){return e&&(vr(e)||rp(e)||Vr(e)||e.nodeType===oe.DOCUMENT_FRAGMENT_NODE||e.nodeType===oe.COMMENT_NODE||e.nodeType===oe.PROCESSING_INSTRUCTION_NODE)}function Vr(e){return e&&e.nodeType===oe.DOCUMENT_TYPE_NODE}function vr(e){return e&&e.nodeType===oe.ELEMENT_NODE}function rp(e){return e&&e.nodeType===oe.TEXT_NODE}function Qy(e,t){var r=e.childNodes||[];if(gr(r,vr)||Vr(t))return!1;var n=gr(r,Vr);return!(t&&n&&r.indexOf(n)>r.indexOf(t))}function Jy(e,t){var r=e.childNodes||[];function n(a){return vr(a)&&a!==t}if(gr(r,n))return!1;var i=gr(r,Vr);return!(t&&i&&r.indexOf(i)>r.indexOf(t))}function Ok(e,t,r){if(!Pk(e))throw new ue(Ct,"Unexpected parent node type "+e.nodeType);if(r&&r.parentNode!==e)throw new ue(rb,"child not in parent");if(!Tk(t)||Vr(t)&&e.nodeType!==oe.DOCUMENT_NODE)throw new ue(Ct,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function Rk(e,t,r){var n=e.childNodes||[],i=t.childNodes||[];if(t.nodeType===oe.DOCUMENT_FRAGMENT_NODE){var a=i.filter(vr);if(a.length>1||gr(i,rp))throw new ue(Ct,"More than one element or text in fragment");if(a.length===1&&!Qy(e,r))throw new ue(Ct,"Element in fragment can not be inserted before doctype")}if(vr(t)&&!Qy(e,r))throw new ue(Ct,"Only one element can be added and only after doctype");if(Vr(t)){if(gr(n,Vr))throw new ue(Ct,"Only one doctype is allowed");var o=gr(n,vr);if(r&&n.indexOf(o)<n.indexOf(r))throw new ue(Ct,"Doctype can only be inserted before an element");if(!r&&o)throw new ue(Ct,"Doctype can not be appended since element is present")}}function lb(e,t,r){var n=e.childNodes||[],i=t.childNodes||[];if(t.nodeType===oe.DOCUMENT_FRAGMENT_NODE){var a=i.filter(vr);if(a.length>1||gr(i,rp))throw new ue(Ct,"More than one element or text in fragment");if(a.length===1&&!Jy(e,r))throw new ue(Ct,"Element in fragment can not be inserted before doctype")}if(vr(t)&&!Jy(e,r))throw new ue(Ct,"Only one element can be added and only after doctype");if(Vr(t)){let l=function(u){return Vr(u)&&u!==r};var s=l;if(gr(n,l))throw new ue(Ct,"Only one doctype is allowed");var o=gr(n,vr);if(r&&n.indexOf(o)<n.indexOf(r))throw new ue(Ct,"Doctype can only be inserted before an element")}}function pl(e,t,r,n){Ok(e,t,r),e.nodeType===oe.DOCUMENT_NODE&&(n||Rk)(e,t,r);var i=t.parentNode;if(i&&i.removeChild(t),t.nodeType===$r){var a=t.firstChild;if(a==null)return t;var o=t.lastChild}else a=o=t;var s=r?r.previousSibling:e.lastChild;a.previousSibling=s,o.nextSibling=r,s?s.nextSibling=a:e.firstChild=a,r==null?e.lastChild=o:r.previousSibling=o;do{a.parentNode=e;var l=e.ownerDocument||e;so(a,l)}while(a!==o&&(a=a.nextSibling));return tp(e.ownerDocument||e,e),t.nodeType==$r&&(t.firstChild=t.lastChild=null),t}function so(e,t){if(e.ownerDocument!==t){if(e.ownerDocument=t,e.nodeType===Ut&&e.attributes)for(var r=0;r<e.attributes.length;r++){var n=e.attributes.item(r);n&&(n.ownerDocument=t)}for(var i=e.firstChild;i;)so(i,t),i=i.nextSibling}}function Fk(e,t){t.parentNode&&t.parentNode.removeChild(t),t.parentNode=e,t.previousSibling=e.lastChild,t.nextSibling=null,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,e.lastChild=t,tp(e.ownerDocument,e,t);var r=e.ownerDocument||e;return so(t,r),t}uo.prototype={nodeName:"#document",nodeType:eb,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==$r){for(var r=e.firstChild;r;){var n=r.nextSibling;this.insertBefore(r,t),r=n}return e}return pl(this,e,t),so(e,this),this.documentElement===null&&e.nodeType===Ut&&(this.documentElement=e),e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),sb(this,e)},replaceChild:function(e,t){pl(this,e,t,lb),so(e,this),t&&this.removeChild(t),vr(e)&&(this.documentElement=e)},importNode:function(e,t){return xk(this,e,t)},getElementById:function(e){var t=null;return dl(this.documentElement,function(r){if(r.nodeType==Ut&&r.getAttribute("id")==e)return t=r,!0}),t},getElementsByClassName:function(e){var t=zy(e);return new Fi(this,function(r){var n=[];return t.length>0&&dl(r.documentElement,function(i){if(i!==r&&i.nodeType===Ut){var a=i.getAttribute("class");if(a){var o=e===a;if(!o){var s=zy(a);o=t.every(Ek(s))}o&&n.push(i)}}}),n})},createElement:function(e){var t=new Wn;t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new qr;var r=t.attributes=new cl;return r._ownerElement=t,t},createDocumentFragment:function(){var e=new hl;return e.ownerDocument=this,e.childNodes=new qr,e},createTextNode:function(e){var t=new np;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new ip;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){if(e.indexOf("]]>")!==-1)throw new ue(Ik,'data contains "]]>"');var t=new ap;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var r=new sp;return r.ownerDocument=this,r.tagName=r.nodeName=r.target=e,r.nodeValue=r.data=t,r},createAttribute:function(e){var t=new fl;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new op;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var r=new Wn,n=t.split(":"),i=r.attributes=new cl;return r.childNodes=new qr,r.ownerDocument=this,r.nodeName=t,r.tagName=t,r.namespaceURI=e,n.length==2?(r.prefix=n[0],r.localName=n[1]):r.localName=t,i._ownerElement=r,r},createAttributeNS:function(e,t){var r=new fl,n=t.split(":");return r.ownerDocument=this,r.nodeName=t,r.name=t,r.namespaceURI=e,r.specified=!0,n.length==2?(r.prefix=n[0],r.localName=n[1]):r.localName=t,r}};St(uo,oe);function Wn(){this._nsMap={}}Wn.prototype={nodeType:Ut,hasAttribute:function(e){return this.getAttributeNode(e)!=null},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var r=this.ownerDocument.createAttribute(e);r.value=r.nodeValue=""+t,this.setAttributeNode(r)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===$r?this.insertBefore(e,null):Fk(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var r=this.getAttributeNodeNS(e,t);r&&this.removeAttributeNode(r)},hasAttributeNS:function(e,t){return this.getAttributeNodeNS(e,t)!=null},getAttributeNS:function(e,t){var r=this.getAttributeNodeNS(e,t);return r&&r.value||""},setAttributeNS:function(e,t,r){var n=this.ownerDocument.createAttributeNS(e,t);n.value=n.nodeValue=""+r,this.setAttributeNode(n)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new Fi(this,function(t){var r=[];return dl(t,function(n){n!==t&&n.nodeType==Ut&&(e==="*"||n.tagName==e)&&r.push(n)}),r})},getElementsByTagNameNS:function(e,t){return new Fi(this,function(r){var n=[];return dl(r,function(i){i!==r&&i.nodeType===Ut&&(e==="*"||i.namespaceURI===e)&&(t==="*"||i.localName==t)&&n.push(i)}),n})}};uo.prototype.getElementsByTagName=Wn.prototype.getElementsByTagName;uo.prototype.getElementsByTagNameNS=Wn.prototype.getElementsByTagNameNS;St(Wn,oe);function fl(){}fl.prototype.nodeType=Ri;St(fl,oe);function co(){}co.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(He[Ct])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,r){var n=this.data.substring(0,e),i=this.data.substring(e+t);r=n+r+i,this.nodeValue=this.data=r,this.length=r.length}};St(co,oe);function np(){}np.prototype={nodeName:"#text",nodeType:ul,splitText:function(e){var t=this.data,r=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var n=this.ownerDocument.createTextNode(r);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}};St(np,co);function ip(){}ip.prototype={nodeName:"#comment",nodeType:Zd};St(ip,co);function ap(){}ap.prototype={nodeName:"#cdata-section",nodeType:Yy};St(ap,co);function ml(){}ml.prototype.nodeType=tb;St(ml,oe);function ub(){}ub.prototype.nodeType=Dk;St(ub,oe);function cb(){}cb.prototype.nodeType=Nk;St(cb,oe);function op(){}op.prototype.nodeType=Zy;St(op,oe);function hl(){}hl.prototype.nodeName="#document-fragment";hl.prototype.nodeType=$r;St(hl,oe);function sp(){}sp.prototype.nodeType=Yd;St(sp,oe);function db(){}db.prototype.serializeToString=function(e,t,r,n){return pb.call(e,t,r,n)};oe.prototype.toString=pb;function pb(e,t,r){var n=!!r&&!!r.requireWellFormed,i=[],a=this.nodeType==9&&this.documentElement||this,o=a.prefix,s=a.namespaceURI;if(s&&o==null){var o=a.lookupPrefix(s);if(o==null)var l=[{namespace:s,prefix:null}]}return lp(this,i,e,t,l,n),i.join("")}function Xy(e,t,r){var n=e.prefix||"",i=e.namespaceURI;if(!i||n==="xml"&&i===oo.XML||i===oo.XMLNS)return!1;for(var a=r.length;a--;){var o=r[a];if(o.prefix===n)return o.namespace!==i}return!0}function ll(e,t,r){e.push(" ",t,'="',r.replace(/[<>&"\t\n\r]/g,ab),'"')}function lp(e,t,r,n,i,a){i||(i=[]),je(e,{ns:i,isHTML:r},{enter:function(o,s){var l=s.ns,u=s.isHTML;if(n)if(o=n(o),o){if(typeof o=="string")return t.push(o),null}else return null;switch(o.nodeType){case Ut:var c=o.attributes,d=c.length,p=o.tagName;u=oo.isHTML(o.namespaceURI)||u;var f=p;if(!u&&!o.prefix&&o.namespaceURI){for(var h,y=0;y<c.length;y++)if(c.item(y).name==="xmlns"){h=c.item(y).value;break}if(!h)for(var w=l.length-1;w>=0;w--){var N=l[w];if(N.prefix===""&&N.namespace===o.namespaceURI){h=N.namespace;break}}if(h!==o.namespaceURI)for(var w=l.length-1;w>=0;w--){var N=l[w];if(N.namespace===o.namespaceURI){N.prefix&&(f=N.prefix+":"+p);break}}}t.push("<",f);for(var D=l.slice(),x=0;x<d;x++){var F=c.item(x);F.prefix=="xmlns"?D.push({prefix:F.localName,namespace:F.value}):F.nodeName=="xmlns"&&D.push({prefix:"",namespace:F.value})}for(var x=0;x<d;x++){var F=c.item(x);if(Xy(F,u,D)){var X=F.prefix||"",V=F.namespaceURI;ll(t,X?"xmlns:"+X:"xmlns",V),D.push({prefix:X,namespace:V})}var M=n?n(F):F;M&&(typeof M=="string"?t.push(M):ll(t,M.name,M.value))}if(p===f&&Xy(o,u,D)){var U=o.prefix||"",V=o.namespaceURI;ll(t,U?"xmlns:"+U:"xmlns",V),D.push({prefix:U,namespace:V})}var B=o.firstChild;if(B||u&&!/^(?:meta|link|img|br|hr|input)$/i.test(p)){if(t.push(">"),u&&/^script$/i.test(p)){for(;B;)B.data?t.push(B.data):lp(B,t,u,n,D.slice(),a),B=B.nextSibling;return t.push("</",p,">"),null}return{ns:D,isHTML:u,tag:f}}else return t.push("/>"),null;case eb:case $r:return{ns:l.slice(),isHTML:u,tag:null};case Ri:return ll(t,o.name,o.value),null;case ul:return t.push(o.data.replace(/[<&>]/g,ab)),null;case Yy:if(a&&o.data.indexOf("]]>")!==-1)throw new ue(Oi,'The CDATASection data contains "]]>"');return t.push("<![CDATA[",o.data.replace(/]]>/g,"]]]]><![CDATA[>"),"]]>"),null;case Zd:if(a&&o.data.indexOf("-->")!==-1)throw new ue(Oi,'The comment node data contains "-->"');return t.push("<!--",o.data,"-->"),null;case tb:if(a){if(o.publicId&&!/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(o.publicId))throw new ue(Oi,"DocumentType publicId is not a valid PubidLiteral");if(o.systemId&&!/^("[^"]*"|'[^']*')$/.test(o.systemId))throw new ue(Oi,"DocumentType systemId is not a valid SystemLiteral");if(o.internalSubset&&o.internalSubset.indexOf("]>")!==-1)throw new ue(Oi,'DocumentType internalSubset contains "]>"')}var z=o.publicId,$=o.systemId;if(t.push("<!DOCTYPE ",o.name),z)t.push(" PUBLIC ",z),$&&$!="."&&t.push(" ",$),t.push(">");else if($&&$!=".")t.push(" SYSTEM ",$,">");else{var Ee=o.internalSubset;Ee&&t.push(" [",Ee,"]"),t.push(">")}return null;case Yd:if(a&&o.data.indexOf("?>")!==-1)throw new ue(Oi,'The ProcessingInstruction data contains "?>"');return t.push("<?",o.target," ",o.data,"?>"),null;case Zy:return t.push("&",o.nodeName,";"),null;default:return t.push("??",o.nodeName),null}},exit:function(o,s){s&&s.tag&&t.push("</",s.tag,">")}})}function xk(e,t,r){var n;return je(t,null,{enter:function(i,a){var o=i.cloneNode(!1);o.ownerDocument=e,o.parentNode=null,a===null?n=o:a.appendChild(o);var s=i.nodeType===Ri||r;return s?o:null}}),n}function fb(e,t,r){var n;return je(t,null,{enter:function(i,a){var o=new i.constructor;for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)){var l=i[s];typeof l!="object"&&l!=o[s]&&(o[s]=l)}i.childNodes&&(o.childNodes=new qr),o.ownerDocument=e;var u=r;switch(o.nodeType){case Ut:var c=i.attributes,d=o.attributes=new cl,p=c.length;d._ownerElement=o;for(var f=0;f<p;f++)o.setAttributeNode(fb(e,c.item(f),!0));break;case Ri:u=!0}return a!==null?a.appendChild(o):n=o,u?o:null}}),n}function mb(e,t,r){e[t]=r}try{Object.defineProperty&&(Object.defineProperty(Fi.prototype,"length",{get:function(){return ep(this),this.$$length}}),Object.defineProperty(oe.prototype,"textContent",{get:function(){if(this.nodeType===Ut||this.nodeType===$r){var e=[];return je(this,null,{enter:function(t){if(t.nodeType===Ut||t.nodeType===$r)return!0;if(t.nodeType===Yd||t.nodeType===Zd)return null;e.push(t.nodeValue)}}),e.join("")}return this.nodeValue},set:function(e){switch(this.nodeType){case Ut:case $r:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),mb=function(e,t,r){e["$$"+t]=r})}catch{}Gr.DocumentType=ml;Gr.DOMException=ue;Gr.DOMImplementation=ib;Gr.Element=Wn;Gr.Node=oe;Gr.NodeList=qr;Gr.walkDOM=je;Gr.XMLSerializer=db});var gb=g(po=>{"use strict";var hb=ao().freeze;po.XML_ENTITIES=hb({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});po.HTML_ENTITIES=hb({Aacute:"\xC1",aacute:"\xE1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",Acy:"\u0410",acy:"\u0430",AElig:"\xC6",aelig:"\xE6",af:"\u2061",Afr:"\u{1D504}",afr:"\u{1D51E}",Agrave:"\xC0",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03B1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2A3F",AMP:"&",amp:"&",And:"\u2A53",and:"\u2227",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1D538}",aopf:"\u{1D552}",ap:"\u2248",apacir:"\u2A6F",apE:"\u2A70",ape:"\u224A",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",Aring:"\xC5",aring:"\xE5",Ascr:"\u{1D49C}",ascr:"\u{1D4B6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",Backslash:"\u2216",Barv:"\u2AE7",barvee:"\u22BD",Barwed:"\u2306",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",Because:"\u2235",because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",Beta:"\u0392",beta:"\u03B2",beth:"\u2136",between:"\u226C",Bfr:"\u{1D505}",bfr:"\u{1D51F}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bNot:"\u2AED",bnot:"\u2310",Bopf:"\u{1D539}",bopf:"\u{1D553}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxbox:"\u29C9",boxDL:"\u2557",boxDl:"\u2556",boxdL:"\u2555",boxdl:"\u2510",boxDR:"\u2554",boxDr:"\u2553",boxdR:"\u2552",boxdr:"\u250C",boxH:"\u2550",boxh:"\u2500",boxHD:"\u2566",boxHd:"\u2564",boxhD:"\u2565",boxhd:"\u252C",boxHU:"\u2569",boxHu:"\u2567",boxhU:"\u2568",boxhu:"\u2534",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxUL:"\u255D",boxUl:"\u255C",boxuL:"\u255B",boxul:"\u2518",boxUR:"\u255A",boxUr:"\u2559",boxuR:"\u2558",boxur:"\u2514",boxV:"\u2551",boxv:"\u2502",boxVH:"\u256C",boxVh:"\u256B",boxvH:"\u256A",boxvh:"\u253C",boxVL:"\u2563",boxVl:"\u2562",boxvL:"\u2561",boxvl:"\u2524",boxVR:"\u2560",boxVr:"\u255F",boxvR:"\u255E",boxvr:"\u251C",bprime:"\u2035",Breve:"\u02D8",breve:"\u02D8",brvbar:"\xA6",Bscr:"\u212C",bscr:"\u{1D4B7}",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",Bumpeq:"\u224E",bumpeq:"\u224F",Cacute:"\u0106",cacute:"\u0107",Cap:"\u22D2",cap:"\u2229",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",Ccaron:"\u010C",ccaron:"\u010D",Ccedil:"\xC7",ccedil:"\xE7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",Cdot:"\u010A",cdot:"\u010B",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",CenterDot:"\xB7",centerdot:"\xB7",Cfr:"\u212D",cfr:"\u{1D520}",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03A7",chi:"\u03C7",cir:"\u25CB",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",CircleDot:"\u2299",circledR:"\xAE",circledS:"\u24C8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",Colon:"\u2237",colon:":",Colone:"\u2A74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",Congruent:"\u2261",Conint:"\u222F",conint:"\u222E",ContourIntegral:"\u222E",Copf:"\u2102",copf:"\u{1D554}",coprod:"\u2210",Coproduct:"\u2210",COPY:"\xA9",copy:"\xA9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21B5",Cross:"\u2A2F",cross:"\u2717",Cscr:"\u{1D49E}",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",Cup:"\u22D3",cup:"\u222A",cupbrcap:"\u2A48",CupCap:"\u224D",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",Dagger:"\u2021",dagger:"\u2020",daleth:"\u2138",Darr:"\u21A1",dArr:"\u21D3",darr:"\u2193",dash:"\u2010",Dashv:"\u2AE4",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",Dcaron:"\u010E",dcaron:"\u010F",Dcy:"\u0414",dcy:"\u0434",DD:"\u2145",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21CA",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",Delta:"\u0394",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",Dfr:"\u{1D507}",dfr:"\u{1D521}",dHar:"\u2965",dharl:"\u21C3",dharr:"\u21C2",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",diam:"\u22C4",Diamond:"\u22C4",diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",DifferentialD:"\u2146",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",Dopf:"\u{1D53B}",dopf:"\u{1D555}",Dot:"\xA8",dot:"\u02D9",DotDot:"\u20DC",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",Downarrow:"\u21D3",downarrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",Dscr:"\u{1D49F}",dscr:"\u{1D4B9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29F6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",DZcy:"\u040F",dzcy:"\u045F",dzigrarr:"\u27FF",Eacute:"\xC9",eacute:"\xE9",easter:"\u2A6E",Ecaron:"\u011A",ecaron:"\u011B",ecir:"\u2256",Ecirc:"\xCA",ecirc:"\xEA",ecolon:"\u2255",Ecy:"\u042D",ecy:"\u044D",eDDot:"\u2A77",Edot:"\u0116",eDot:"\u2251",edot:"\u0117",ee:"\u2147",efDot:"\u2252",Efr:"\u{1D508}",efr:"\u{1D522}",eg:"\u2A9A",Egrave:"\xC8",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",ENG:"\u014A",eng:"\u014B",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1D53C}",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",Equal:"\u2A75",equals:"=",EqualTilde:"\u2242",equest:"\u225F",Equilibrium:"\u21CC",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erarr:"\u2971",erDot:"\u2253",Escr:"\u2130",escr:"\u212F",esdot:"\u2250",Esim:"\u2A73",esim:"\u2242",Eta:"\u0397",eta:"\u03B7",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",ExponentialE:"\u2147",exponentiale:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",Ffr:"\u{1D509}",ffr:"\u{1D523}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",Fopf:"\u{1D53D}",fopf:"\u{1D557}",ForAll:"\u2200",forall:"\u2200",fork:"\u22D4",forkv:"\u2AD9",Fouriertrf:"\u2131",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",Fscr:"\u2131",fscr:"\u{1D4BB}",gacute:"\u01F5",Gamma:"\u0393",gamma:"\u03B3",Gammad:"\u03DC",gammad:"\u03DD",gap:"\u2A86",Gbreve:"\u011E",gbreve:"\u011F",Gcedil:"\u0122",Gcirc:"\u011C",gcirc:"\u011D",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",gE:"\u2267",ge:"\u2265",gEl:"\u2A8C",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",Gfr:"\u{1D50A}",gfr:"\u{1D524}",Gg:"\u22D9",gg:"\u226B",ggg:"\u22D9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gl:"\u2277",gla:"\u2AA5",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gnE:"\u2269",gne:"\u2A88",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",Gopf:"\u{1D53E}",gopf:"\u{1D558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",Gt:"\u226B",GT:">",gt:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",Hacek:"\u02C7",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",HARDcy:"\u042A",hardcy:"\u044A",hArr:"\u21D4",harr:"\u2194",harrcir:"\u2948",harrw:"\u21AD",Hat:"^",hbar:"\u210F",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",Hfr:"\u210C",hfr:"\u{1D525}",HilbertSpace:"\u210B",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",Hopf:"\u210D",hopf:"\u{1D559}",horbar:"\u2015",HorizontalLine:"\u2500",Hscr:"\u210B",hscr:"\u{1D4BD}",hslash:"\u210F",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xCD",iacute:"\xED",ic:"\u2063",Icirc:"\xCE",icirc:"\xEE",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",Ifr:"\u2111",ifr:"\u{1D526}",Igrave:"\xCC",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Im:"\u2111",Imacr:"\u012A",imacr:"\u012B",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",Int:"\u222C",int:"\u222B",intcal:"\u22BA",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012E",iogon:"\u012F",Iopf:"\u{1D540}",iopf:"\u{1D55A}",Iota:"\u0399",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",Iscr:"\u2110",iscr:"\u{1D4BE}",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xCF",iuml:"\xEF",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1D50D}",jfr:"\u{1D527}",jmath:"\u0237",Jopf:"\u{1D541}",jopf:"\u{1D55B}",Jscr:"\u{1D4A5}",jscr:"\u{1D4BF}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041A",kcy:"\u043A",Kfr:"\u{1D50E}",kfr:"\u{1D528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040C",kjcy:"\u045C",Kopf:"\u{1D542}",kopf:"\u{1D55C}",Kscr:"\u{1D4A6}",kscr:"\u{1D4C0}",lAarr:"\u21DA",Lacute:"\u0139",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",Lambda:"\u039B",lambda:"\u03BB",Lang:"\u27EA",lang:"\u27E8",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",Larr:"\u219E",lArr:"\u21D0",larr:"\u2190",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",lAtail:"\u291B",latail:"\u2919",late:"\u2AAD",lates:"\u2AAD\uFE00",lBarr:"\u290E",lbarr:"\u290C",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",Lcaron:"\u013D",lcaron:"\u013E",Lcedil:"\u013B",lcedil:"\u013C",lceil:"\u2308",lcub:"{",Lcy:"\u041B",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",lE:"\u2266",le:"\u2264",LeftAngleBracket:"\u27E8",LeftArrow:"\u2190",Leftarrow:"\u21D0",leftarrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",LeftRightArrow:"\u2194",Leftrightarrow:"\u21D4",leftrightarrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",lEg:"\u2A8B",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2AA1",lesssim:"\u2272",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",lfisht:"\u297C",lfloor:"\u230A",Lfr:"\u{1D50F}",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",Ll:"\u22D8",ll:"\u226A",llarr:"\u21C7",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",Lmidot:"\u013F",lmidot:"\u0140",lmoust:"\u23B0",lmoustache:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lnE:"\u2268",lne:"\u2A87",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",LongLeftArrow:"\u27F5",Longleftarrow:"\u27F8",longleftarrow:"\u27F5",LongLeftRightArrow:"\u27F7",Longleftrightarrow:"\u27FA",longleftrightarrow:"\u27F7",longmapsto:"\u27FC",LongRightArrow:"\u27F6",Longrightarrow:"\u27F9",longrightarrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",Lopf:"\u{1D543}",lopf:"\u{1D55D}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",Lscr:"\u2112",lscr:"\u{1D4C1}",Lsh:"\u21B0",lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",Lstrok:"\u0141",lstrok:"\u0142",Lt:"\u226A",LT:"<",lt:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",ltrPar:"\u2996",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",Mcy:"\u041C",mcy:"\u043C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",Mopf:"\u{1D544}",mopf:"\u{1D55E}",mp:"\u2213",Mscr:"\u2133",mscr:"\u{1D4C2}",mstpos:"\u223E",Mu:"\u039C",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",Ncy:"\u041D",ncy:"\u043D",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",neArr:"\u21D7",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:`
-`,nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nhArr:"\u21CE",nharr:"\u21AE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlArr:"\u21CD",nlarr:"\u219A",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nLeftarrow:"\u21CD",nleftarrow:"\u219A",nLeftrightarrow:"\u21CE",nleftrightarrow:"\u21AE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nLt:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",Nopf:"\u2115",nopf:"\u{1D55F}",Not:"\u2AEC",not:"\xAC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrArr:"\u21CF",nrarr:"\u219B",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nRightarrow:"\u21CF",nrightarrow:"\u219B",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nVDash:"\u22AF",nVdash:"\u22AE",nvDash:"\u22AD",nvdash:"\u22AC",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwArr:"\u21D6",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xD3",oacute:"\xF3",oast:"\u229B",ocir:"\u229A",Ocirc:"\xD4",ocirc:"\xF4",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29BF",Ofr:"\u{1D512}",ofr:"\u{1D52C}",ogon:"\u02DB",Ograve:"\xD2",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",Omacr:"\u014C",omacr:"\u014D",Omega:"\u03A9",omega:"\u03C9",Omicron:"\u039F",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",Oopf:"\u{1D546}",oopf:"\u{1D560}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",Or:"\u2A54",or:"\u2228",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",Oscr:"\u{1D4AA}",oscr:"\u2134",Oslash:"\xD8",oslash:"\xF8",osol:"\u2298",Otilde:"\xD5",otilde:"\xF5",Otimes:"\u2A37",otimes:"\u2297",otimesas:"\u2A36",Ouml:"\xD6",ouml:"\xF6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",Pcy:"\u041F",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",Pfr:"\u{1D513}",pfr:"\u{1D52D}",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",Pi:"\u03A0",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",PlusMinus:"\xB1",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",Poincareplane:"\u210C",pointint:"\u2A15",Popf:"\u2119",popf:"\u{1D561}",pound:"\xA3",Pr:"\u2ABB",pr:"\u227A",prap:"\u2AB7",prcue:"\u227C",prE:"\u2AB3",pre:"\u2AAF",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",Prime:"\u2033",prime:"\u2032",primes:"\u2119",prnap:"\u2AB9",prnE:"\u2AB5",prnsim:"\u22E8",prod:"\u220F",Product:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",Proportion:"\u2237",Proportional:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",Pscr:"\u{1D4AB}",pscr:"\u{1D4C5}",Psi:"\u03A8",psi:"\u03C8",puncsp:"\u2008",Qfr:"\u{1D514}",qfr:"\u{1D52E}",qint:"\u2A0C",Qopf:"\u211A",qopf:"\u{1D562}",qprime:"\u2057",Qscr:"\u{1D4AC}",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",QUOT:'"',quot:'"',rAarr:"\u21DB",race:"\u223D\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",Rang:"\u27EB",rang:"\u27E9",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",Rarr:"\u21A0",rArr:"\u21D2",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21A3",rarrw:"\u219D",rAtail:"\u291C",ratail:"\u291A",ratio:"\u2236",rationals:"\u211A",RBarr:"\u2910",rBarr:"\u290F",rbarr:"\u290D",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",Re:"\u211C",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",REG:"\xAE",reg:"\xAE",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",rfisht:"\u297D",rfloor:"\u230B",Rfr:"\u211C",rfr:"\u{1D52F}",rHar:"\u2964",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",RightAngleBracket:"\u27E9",RightArrow:"\u2192",Rightarrow:"\u21D2",rightarrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",Ropf:"\u211D",ropf:"\u{1D563}",roplus:"\u2A2E",rotimes:"\u2A35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",Rrightarrow:"\u21DB",rsaquo:"\u203A",Rscr:"\u211B",rscr:"\u{1D4C7}",Rsh:"\u21B1",rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",RuleDelayed:"\u29F4",ruluhar:"\u2968",rx:"\u211E",Sacute:"\u015A",sacute:"\u015B",sbquo:"\u201A",Sc:"\u2ABC",sc:"\u227B",scap:"\u2AB8",Scaron:"\u0160",scaron:"\u0161",sccue:"\u227D",scE:"\u2AB4",sce:"\u2AB0",Scedil:"\u015E",scedil:"\u015F",Scirc:"\u015C",scirc:"\u015D",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",Scy:"\u0421",scy:"\u0441",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",searhk:"\u2925",seArr:"\u21D8",searr:"\u2198",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1D516}",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",SOFTcy:"\u042C",softcy:"\u044C",sol:"/",solb:"\u29C4",solbar:"\u233F",Sopf:"\u{1D54A}",sopf:"\u{1D564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",Sqrt:"\u221A",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",Square:"\u25A1",square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",Sscr:"\u{1D4AE}",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",Star:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",Sub:"\u22D0",sub:"\u2282",subdot:"\u2ABD",subE:"\u2AC5",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",Subset:"\u22D0",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",SuchThat:"\u220B",Sum:"\u2211",sum:"\u2211",sung:"\u266A",Sup:"\u22D1",sup:"\u2283",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",supdot:"\u2ABE",supdsub:"\u2AD8",supE:"\u2AC6",supe:"\u2287",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",Supset:"\u22D1",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swarhk:"\u2926",swArr:"\u21D9",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",Tab:" ",target:"\u2316",Tau:"\u03A4",tau:"\u03C4",tbrk:"\u23B4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",Tfr:"\u{1D517}",tfr:"\u{1D531}",there4:"\u2234",Therefore:"\u2234",therefore:"\u2234",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223C",THORN:"\xDE",thorn:"\xFE",Tilde:"\u223C",tilde:"\u02DC",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",Topf:"\u{1D54B}",topf:"\u{1D565}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",TRADE:"\u2122",trade:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",TripleDot:"\u20DB",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",Tscr:"\u{1D4AF}",tscr:"\u{1D4C9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040B",tshcy:"\u045B",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Uacute:"\xDA",uacute:"\xFA",Uarr:"\u219F",uArr:"\u21D1",uarr:"\u2191",Uarrocir:"\u2949",Ubrcy:"\u040E",ubrcy:"\u045E",Ubreve:"\u016C",ubreve:"\u016D",Ucirc:"\xDB",ucirc:"\xFB",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21C5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",Ufr:"\u{1D518}",ufr:"\u{1D532}",Ugrave:"\xD9",ugrave:"\xF9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",Umacr:"\u016A",umacr:"\u016B",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1D54C}",uopf:"\u{1D566}",UpArrow:"\u2191",Uparrow:"\u21D1",uparrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",UpDownArrow:"\u2195",Updownarrow:"\u21D5",updownarrow:"\u2195",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03D2",upsi:"\u03C5",upsih:"\u03D2",Upsilon:"\u03A5",upsilon:"\u03C5",UpTee:"\u22A5",UpTeeArrow:"\u21A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",Uring:"\u016E",uring:"\u016F",urtri:"\u25F9",Uscr:"\u{1D4B0}",uscr:"\u{1D4CA}",utdot:"\u22F0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",Uuml:"\xDC",uuml:"\xFC",uwangle:"\u29A7",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",vArr:"\u21D5",varr:"\u2195",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",Vbar:"\u2AEB",vBar:"\u2AE8",vBarv:"\u2AE9",Vcy:"\u0412",vcy:"\u0432",VDash:"\u22AB",Vdash:"\u22A9",vDash:"\u22A8",vdash:"\u22A2",Vdashl:"\u2AE6",Vee:"\u22C1",vee:"\u2228",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",Verbar:"\u2016",verbar:"|",Vert:"\u2016",vert:"|",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",Vopf:"\u{1D54D}",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",Vscr:"\u{1D4B1}",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2A5F",Wedge:"\u22C0",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1D51A}",wfr:"\u{1D534}",Wopf:"\u{1D54E}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1D4B2}",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",Xfr:"\u{1D51B}",xfr:"\u{1D535}",xhArr:"\u27FA",xharr:"\u27F7",Xi:"\u039E",xi:"\u03BE",xlArr:"\u27F8",xlarr:"\u27F5",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",Xopf:"\u{1D54F}",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrArr:"\u27F9",xrarr:"\u27F6",Xscr:"\u{1D4B3}",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",Yacute:"\xDD",yacute:"\xFD",YAcy:"\u042F",yacy:"\u044F",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042B",ycy:"\u044B",yen:"\xA5",Yfr:"\u{1D51C}",yfr:"\u{1D536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1D550}",yopf:"\u{1D56A}",Yscr:"\u{1D4B4}",yscr:"\u{1D4CE}",YUcy:"\u042E",yucy:"\u044E",Yuml:"\u0178",yuml:"\xFF",Zacute:"\u0179",zacute:"\u017A",Zcaron:"\u017D",zcaron:"\u017E",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017B",zdot:"\u017C",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zeta:"\u03B6",Zfr:"\u2128",zfr:"\u{1D537}",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21DD",Zopf:"\u2124",zopf:"\u{1D56B}",Zscr:"\u{1D4B5}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"});po.entityMap=po.HTML_ENTITIES});var Eb=g(dp=>{var go=ao().NAMESPACE,cp=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,vb=new RegExp("[\\-\\.0-9"+cp.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),yb=new RegExp("^"+cp.source+vb.source+"*(?::"+cp.source+vb.source+"*)?$"),fo=0,vn=1,xi=2,mo=3,Li=4,ki=5,ho=6,gl=7;function Mi(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,Mi)}Mi.prototype=new Error;Mi.prototype.name=Mi.name;function Ab(){}Ab.prototype={parse:function(e,t,r){var n=this.domBuilder;n.startDocument(),Cb(t,t={}),Lk(e,t,r,n,this.errorHandler),n.endDocument()}};function Lk(e,t,r,n,i){function a(pe){if(pe>65535){pe-=65536;var vt=55296+(pe>>10),lc=56320+(pe&1023);return String.fromCharCode(vt,lc)}else return String.fromCharCode(pe)}function o(pe){var vt=pe.slice(1,-1);return Object.hasOwnProperty.call(r,vt)?r[vt]:vt.charAt(0)==="#"?a(parseInt(vt.substr(1).replace("x","0x"))):(i.error("entity not found:"+pe),pe)}function s(pe){if(pe>y){var vt=e.substring(y,pe).replace(/&#?\w+;/g,o);p&&l(y),n.characters(vt,0,pe-y),y=pe}}function l(pe,vt){for(;pe>=c&&(vt=d.exec(e));)u=vt.index,c=u+vt[0].length,p.lineNumber++;p.columnNumber=pe-u+1}for(var u=0,c=0,d=/.*(?:\r\n?|\n)|.*$/g,p=n.locator,f=[{currentNSMap:t}],h={},y=0;;){try{var w=e.indexOf("<",y);if(w<0){if(!e.substr(y).match(/^\s*$/)){var N=n.doc,D=N.createTextNode(e.substr(y));N.appendChild(D),n.currentElement=D}return}switch(w>y&&s(w),e.charAt(w+1)){case"/":var $=e.indexOf(">",w+3),x=e.substring(w+2,$).replace(/[ \t\n\r]+$/g,""),F=f.pop();$<0?(x=e.substring(w+2).replace(/[\s<].*/,""),i.error("end tag name: "+x+" is not complete:"+F.tagName),$=w+1+x.length):x.match(/\s</)&&(x=x.replace(/[\s<].*/,""),i.error("end tag name: "+x+" maybe not complete"),$=w+1+x.length);var X=F.localNSMap,V=F.tagName==x,M=V||F.tagName&&F.tagName.toLowerCase()==x.toLowerCase();if(M){if(n.endElement(F.uri,F.localName,x),X)for(var U in X)Object.prototype.hasOwnProperty.call(X,U)&&n.endPrefixMapping(U);V||i.fatalError("end tag name: "+x+" is not match the current start tagName:"+F.tagName)}else f.push(F);$++;break;case"?":p&&l(w),$=$k(e,w,n);break;case"!":p&&l(w),$=Bk(e,w,n,i);break;default:p&&l(w);var B=new Sb,z=f[f.length-1].currentNSMap,$=kk(e,w,B,z,o,i),Ee=B.length;if(!B.closed&&Uk(e,$,B.tagName,h)&&(B.closed=!0,r.nbsp||i.warning("unclosed xml attribute")),p&&Ee){for(var ye=bb(p,{}),Ge=0;Ge<Ee;Ge++){var Ze=B[Ge];l(Ze.offset),Ze.locator=bb(p,{})}n.locator=ye,wb(B,n,z)&&f.push(B),n.locator=p}else wb(B,n,z)&&f.push(B);go.isHTML(B.uri)&&!B.closed?$=Mk(e,$,B.tagName,o,n):$++}}catch(pe){if(pe instanceof Mi)throw pe;i.error("element parse error: "+pe),$=-1}$>y?y=$:s(Math.max(w,y)+1)}}function bb(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function kk(e,t,r,n,i,a){function o(f,h,y){r.attributeNames.hasOwnProperty(f)&&a.fatalError("Attribute "+f+" redefined"),r.addValue(f,h.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,i),y)}for(var s,l,u=++t,c=fo;;){var d=e.charAt(u);switch(d){case"=":if(c===vn)s=e.slice(t,u),c=mo;else if(c===xi)c=mo;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(c===mo||c===vn)if(c===vn&&(a.warning('attribute value must after "="'),s=e.slice(t,u)),t=u+1,u=e.indexOf(d,t),u>0)l=e.slice(t,u),o(s,l,t-1),c=ki;else throw new Error("attribute value no end '"+d+"' match");else if(c==Li)l=e.slice(t,u),o(s,l,t),a.warning('attribute "'+s+'" missed start quot('+d+")!!"),t=u+1,c=ki;else throw new Error('attribute value must after "="');break;case"/":switch(c){case fo:r.setTagName(e.slice(t,u));case ki:case ho:case gl:c=gl,r.closed=!0;case Li:case vn:break;case xi:r.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return a.error("unexpected end of input"),c==fo&&r.setTagName(e.slice(t,u)),u;case">":switch(c){case fo:r.setTagName(e.slice(t,u));case ki:case ho:case gl:break;case Li:case vn:l=e.slice(t,u),l.slice(-1)==="/"&&(r.closed=!0,l=l.slice(0,-1));case xi:c===xi&&(l=s),c==Li?(a.warning('attribute "'+l+'" missed quot(")!'),o(s,l,t)):((!go.isHTML(n[""])||!l.match(/^(?:disabled|checked|selected)$/i))&&a.warning('attribute "'+l+'" missed value!! "'+l+'" instead!!'),o(l,l,t));break;case mo:throw new Error("attribute value missed!!")}return u;case"\x80":d=" ";default:if(d<=" ")switch(c){case fo:r.setTagName(e.slice(t,u)),c=ho;break;case vn:s=e.slice(t,u),c=xi;break;case Li:var l=e.slice(t,u);a.warning('attribute "'+l+'" missed quot(")!!'),o(s,l,t);case ki:c=ho;break}else switch(c){case xi:var p=r.tagName;(!go.isHTML(n[""])||!s.match(/^(?:disabled|checked|selected)$/i))&&a.warning('attribute "'+s+'" missed value!! "'+s+'" instead2!!'),o(s,s,t),t=u,c=vn;break;case ki:a.warning('attribute space is required"'+s+'"!!');case ho:c=vn,t=u;break;case mo:c=Li,t=u;break;case gl:throw new Error("elements closed character '/' and '>' must be connected to")}}u++}}function wb(e,t,r){for(var n=e.tagName,i=null,d=e.length;d--;){var a=e[d],o=a.qName,s=a.value,p=o.indexOf(":");if(p>0)var l=a.prefix=o.slice(0,p),u=o.slice(p+1),c=l==="xmlns"&&u;else u=o,l=null,c=o==="xmlns"&&"";a.localName=u,c!==!1&&(i==null&&(i={},Cb(r,r={})),r[c]=i[c]=s,a.uri=go.XMLNS,t.startPrefixMapping(c,s))}for(var d=e.length;d--;){a=e[d];var l=a.prefix;l&&(l==="xml"&&(a.uri=go.XML),l!=="xmlns"&&(a.uri=r[l||""]))}var p=n.indexOf(":");p>0?(l=e.prefix=n.slice(0,p),u=e.localName=n.slice(p+1)):(l=null,u=e.localName=n);var f=e.uri=r[l||""];if(t.startElement(f,u,n,e),e.closed){if(t.endElement(f,u,n),i)for(l in i)Object.prototype.hasOwnProperty.call(i,l)&&t.endPrefixMapping(l)}else return e.currentNSMap=r,e.localNSMap=i,!0}function Mk(e,t,r,n,i){if(/^(?:script|textarea)$/i.test(r)){var a=e.indexOf("</"+r+">",t),o=e.substring(t+1,a);if(/[&<]/.test(o))return/^script$/i.test(r)?(i.characters(o,0,o.length),a):(o=o.replace(/&#?\w+;/g,n),i.characters(o,0,o.length),a)}return t+1}function Uk(e,t,r,n){var i=n[r];return i==null&&(i=e.lastIndexOf("</"+r+">"),i<t&&(i=e.lastIndexOf("</"+r)),n[r]=i),i<t}function Cb(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function Bk(e,t,r,n){var i=e.charAt(t+2);switch(i){case"-":if(e.charAt(t+3)==="-"){var a=e.indexOf("-->",t+4);return a>t?(r.comment(e,t+4,a-t-4),a+3):(n.error("Unclosed comment"),-1)}else return-1;default:if(e.substr(t+3,6)=="CDATA["){var a=e.indexOf("]]>",t+9);return r.startCDATA(),r.characters(e,t+9,a-t-9),r.endCDATA(),a+3}var o=qk(e,t),s=o.length;if(s>1&&/!doctype/i.test(o[0][0])){var l=o[1][0],u=!1,c=!1;s>3&&(/^public$/i.test(o[2][0])?(u=o[3][0],c=s>4&&o[4][0]):/^system$/i.test(o[2][0])&&(c=o[3][0]));var d=o[s-1];return r.startDTD(l,u,c),r.endDTD(),d.index+d[0].length}}return-1}function $k(e,t,r){var n=e.indexOf("?>",t);if(n){var i=e.substring(t,n).match(/^<\?(\S*)\s*([\s\S]*?)$/);if(i){var a=i[0].length;return r.processingInstruction(i[1],i[2]),n+2}else return-1}return-1}function Sb(){this.attributeNames={}}Sb.prototype={setTagName:function(e){if(!yb.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,r){if(!yb.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:r}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}};function qk(e,t){var r,n=[],i=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(i.lastIndex=t,i.exec(e);r=i.exec(e);)if(n.push(r),r[1])return n}dp.XMLReader=Ab;dp.ParseError=Mi});var Ob=g(yl=>{var Vk=ao(),Gk=up(),Nb=gb(),_b=Eb(),zk=Gk.DOMImplementation,Db=Vk.NAMESPACE,Wk=_b.ParseError,jk=_b.XMLReader;function Pb(e){return e.replace(/\r[\n\u0085]/g,`
+`),o=await e.postBatch(a,r),s=e.apiUrl("/$batch");(0,we.ensureSuccess)(o,s);let l=`app '${t[0].path}'`;if(typeof o.body!="string"||o.body.length===0)throw new he.ConnectionError(s,o.status,`atomic delete of ${l} cannot be confirmed: the $batch response had no readable body, so the change set's outcome is unknown`);let u=(0,ZF.parseChangeSetStatuses)(o.body,i.map((d,p)=>String(p+1)));if(u===void 0)throw new he.ConnectionError(s,o.status,`atomic delete of ${l} cannot be confirmed: the $batch response could not be parsed as a change set, so the outcome is unknown`);let c=u.find(d=>d<200||d>=300);if(c!==void 0)throw new he.ConnectionError(s,c,`atomic delete of ${l} was rolled back: the change set reported HTTP ${c}`);if(u.length!==i.length)throw new he.ConnectionError(s,o.status,`atomic delete of ${l} cannot be confirmed: the $batch response reported ${u.length} operation result(s), expected exactly ${i.length}`)}async function Zc(e,t){try{let r=js(t,"sitemapid"),n=await e.get(r);return n.status<200||n.status>=300?null:Hs(_i(n))}catch{return null}}function dx(e){return e>=400&&e<500&&e!==408&&e!==429}function ed(e,t,r){if(!e)throw new he.SdkError("APP_SITEMAP_UNRESOLVED",`Refusing to delete app '${t}': the ${r} read returned no ETag, so the delete cannot be made conditional on the row that was actually inspected. Without that condition a row renamed or re-pointed between the read and the delete would be destroyed. Retry.`);return e}async function H0(e,t,r){let n=`/appmodules(${t})`;if(!r.sitemapId){await px(e,n,ed(r.appEtag,t,"app"));return}if(!e.supportsAtomicBatch)throw new he.SdkError("APP_DELETE_NOT_ATOMIC",`Refusing to delete app '${t}': it owns a sitemap, and the injected HttpClient cannot send a raw body, so the two rows would have to be deleted as separate requests. A failure between them strands the sitemap and permanently reserves the app's unique name. Implement HttpClient.postRaw so the SDK can delete them atomically.`);await W0(e,[{path:n,etag:ed(r.appEtag,t,"app")},{path:`/sitemaps(${r.sitemapId})`,etag:ed(r.sitemapEtag,t,"sitemap")}])}async function px(e,t,r){(0,we.ensureSuccess)(await e.delete(t,{headers:{"If-Match":r}}),e.apiUrl(t))}async function q0(e,t){if(!/GenPageId/i.test(t))return;let r;try{r=[...new Set((0,XF.collectGenPageIds)(t))]}catch(o){throw new he.SdkError("SITEMAP_TARGET_UNVERIFIABLE",`Refusing to push the app: its sitemap xml could not be parsed, so the generative pages it navigates to cannot be verified (${nd(o)}).`)}if(r.length===0)return;let n=new Set,i=50;for(let o=0;o<r.length;o+=i){let s=r.slice(o,o+i),l="/uxagentprojects/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,se.odataQuery)([["$select","uxagentprojectid"],["$filter",s.map(c=>`uxagentprojectid eq ${c}`).join(" or ")]]),u=await(0,rd.collectPages)(e,l,"sitemap generative-page preflight");for(let c of u){let d=c.uxagentprojectid;typeof d=="string"&&d.trim()!==""&&n.add((0,se.normalizeGuid)(d,"uxagentprojectid"))}}let a=r.filter(o=>!n.has(o));if(a.length>0)throw new he.SdkError("SITEMAP_TARGET_NOT_FOUND",`Refusing to push the app: its sitemap navigates to generative page(s) ${a.map(o=>`'${o}'`).join(", ")} that do not exist in this environment. Push the page before the app that links to it.`)}function fx(e){var t,r;if(e.status!==400)return!1;let n=e.body;return String((r=(t=n?.error)===null||t===void 0?void 0:t.message)!==null&&r!==void 0?r:"").includes("retrieval of version numbers failed")}An.appApi={async get(e,t){var r;let n=(0,se.normalizeGuid)(t,"id"),i=Yc(Xc,n),a=(0,we.ensureSuccess)(await e.get(i),e.apiUrl(i)),o=(r=_i(a))!==null&&r!==void 0?r:{};if(!o.appmoduleid)throw new he.SdkError("APP_NOT_FOUND",`App '${n}' was not found (checked the unpublished-aware projection, which includes drafts).`);let s=await G0(e,o.uniquename),l=s?(0,se.normalizeGuid)(s,"sitemapId"):void 0,u=null;if(l){let d=js(l,"sitemapid,sitemapname,sitemapnameunique,sitemapxml"),p=(0,we.ensureSuccess)(await e.get(d),e.apiUrl(d)),f=_i(p);if(f&&f.sitemapnameunique!==o.uniquename)throw new he.SdkError("APP_SITEMAP_UNRESOLVED",`Refusing to fetch app '${n}': sitemap '${l}' now carries sitemapnameunique '${String(f.sitemapnameunique)}', not '${String(o.uniquename)}', so it is no longer this app's sitemap. Retry.`);o.$sitemap=f??{},u=Hs(f)}let c=Hs(o);return{raw:o,etag:u,...o.appmoduleid?{siblingEtags:{[(0,se.normalizeGuid)(o.appmoduleid,"appmoduleid")]:c}}:{}}},async list(e,t){let r=Yc(Xc);return(await(0,rd.collectPages)(e,r,"listArtifacts('app')")).map(i=>{var a,o;return{type:"app",id:(a=i.appmoduleid)!==null&&a!==void 0?a:"",name:(o=i.name)!==null&&o!==void 0?o:"",isDirty:!1}})},async create(e,t,r){let n=t;await q0(e,n.sitemapxml);let i=n.iconWebResourceId?void 0:await rx(e),a=n.iconWebResourceId||i?.id;if(!a)throw new he.SdkError("APP_ICON_UNRESOLVED",`Cannot create app '${n.appModuleName}': its icon (\`appmodule.webresourceid\`) is a REQUIRED attribute and this environment has no image web resource to use. Pass \`iconWebResourceId\` explicitly, or add an image (PNG/JPG/GIF/ICO/SVG) web resource to the environment.`);let o=null;i?.managed&&(o=`No unmanaged image web resource was available, so the app icon resolved to a MANAGED one (${i.id}). That creates a cross-solution dependency which can fail to import into an environment without the owning managed solution. Pass \`iconWebResourceId\` with an in-solution image to avoid it.`);let s=n.appModuleUniqueName||tx(n.appModuleId),l={name:n.appModuleName,uniquename:s,clienttype:4,formfactor:1,navigationtype:0};n.appModuleDescription&&(l.description=n.appModuleDescription),n.appModuleAiDescription&&(l.aiappdescription=n.appModuleAiDescription),a&&(l.webresourceid=a);let u="/appmodules",c=(0,we.ensureSuccess)(await e.post(u,(0,we.withClientMintedId)(l,"appmoduleid",r)),e.apiUrl(u)),d=(0,we.resolveCreatedId)(c,"appmoduleid","app module",r),p=null,f=[];o&&f.push(o);let h={kind:"notRequested"},v=n.sitemapId?(0,se.normalizeGuid)(n.sitemapId,"sitemapId"):(0,td.newId)(),w=!1;try{let D="/sitemaps",x=await e.post(D,{sitemapid:v,sitemapnameunique:s,sitemapname:n.sitemapname,sitemapxml:n.sitemapxml});w=dx(x.status);let F=(0,we.ensureSuccess)(x,e.apiUrl(D));p=(0,we.readEtag)(F),p||(p=await Zc(e,v));let j=await B0(e,n);f.push(...j.warnings);let L=j.components;L.unshift({"@odata.type":"Microsoft.Dynamics.CRM.sitemap",sitemapid:v}),await U0(e,d,L),await $0(e,d,j.tables);let V=await nx(e,d);V&&f.push(V),n.appSettings&&Object.keys(n.appSettings).length>0&&f.push(...await(0,YF.applyAppSettings)(e,d,n.appSettings)),n.published!==!1&&(await(0,L0.publishAppModule)(e,d),h={kind:"submitted"})}catch(D){throw await lx(e,d,{sitemapId:v,sitemapNameUnique:s,serverRefusedSitemap:w,appEtag:(0,we.readEtag)(c),sitemapEtag:p}),D}let E=null;if(h.kind==="submitted")try{let D=await e.get(`/appmodules(${d})?$select=appmoduleid`);D.status>=200&&D.status<300&&(E=(0,we.readEtag)(D))}catch{}return{id:d,etag:p,serverIdentity:{sitemapId:v},siblingEtags:{[d]:E},publish:h,...f.length>0?{warnings:f}:{}}},async update(e,t,r,n,i,a){var o,s,l,u,c,d,p,f;let h=r,v=(0,se.normalizeGuid)(t,"id");if(await q0(e,h.sitemapxml),!h.sitemapId)throw new he.ValidationError("app",v,"/sitemapId","missing sitemap identity \u2014 re-fetch the app before pushing edits");let w=(0,se.normalizeGuid)(h.sitemapId,"sitemapId");if(!n)throw new he.SdkError("APP_UPDATE_NO_ETAG",`Refusing to push app '${v}': no concurrency token is held for its sitemap row, so the write could not be made conditional and would silently overwrite a concurrent edit. Re-fetch the app and re-apply the change.`);let E=await B0(e,h),D=`/appmodules(${v})`,x=(o=a?.[v])!==null&&o!==void 0?o:null,F=!0,j=!1;try{let pe=Yc(Xc,v),Ke=await e.get(pe);if(Ke.status>=200&&Ke.status<300){let Z=(s=_i(Ke))!==null&&s!==void 0?s:{};j=!0,F=String((l=Z.name)!==null&&l!==void 0?l:"")!==String((u=h.appModuleName)!==null&&u!==void 0?u:"")||String((c=Z.description)!==null&&c!==void 0?c:"")!==String((d=h.appModuleDescription)!==null&&d!==void 0?d:"")||h.appModuleAiDescription!==void 0&&String((p=Z.aiappdescription)!==null&&p!==void 0?p:"")!==String(h.appModuleAiDescription)}}catch{}let L=x;if(F){let pe=j?x:null,Ke=pe?(0,we.echoWrite)("appmoduleid",{"If-Match":pe}):{query:"",options:void 0},Z=await e.patch(`${D}${Ke.query}`,{name:h.appModuleName,description:h.appModuleDescription,...h.appModuleAiDescription!==void 0?{aiappdescription:h.appModuleAiDescription}:{}},Ke.options);if(fx(Z))throw new he.SdkError("APP_DRAFT_HEADER_NOT_WRITABLE",`Refusing to update app '${v}': its appmodule row is UNPUBLISHED, and Dataverse cannot resolve version numbers for a draft appmodule (HTTP 400). A draft header cannot be PATCHed at all \u2014 a plain retry fails too, as an upsert-create ("webresourceid cannot be NULL"). Publish the app first, then push the header edit. Nothing was modified by this call.`);(0,we.ensureSuccess)(Z,e.apiUrl(D)),L=(0,we.readEtag)(Z)}let V={"If-Match":n},B=`/sitemaps(${w})`,U;try{U=(0,we.ensureSuccess)(await e.patch(B,{sitemapxml:h.sitemapxml,sitemapname:h.sitemapname},V?{headers:V}:void 0),e.apiUrl(B))}catch(pe){throw(0,he.withPartialTokens)(pe,{siblingEtags:{[v]:L}})}let z=[...E.warnings];try{await U0(e,v,E.components),await $0(e,v,E.tables)}catch(pe){z.push(`App '${v}': one or more components were not pinned (${pe.message}). Navigation may reference content not included in the app; re-push to retry.`)}let $={kind:"notRequested"},Oe=L,vt=(0,we.readEtag)(U);if(h.published===!0){try{await(0,L0.publishAppModule)(e,v),$={kind:"submitted"}}catch(pe){$={kind:"failed",error:pe},z.push(`App '${v}': saved, but publishing failed (${pe.message}). The app remains unpublished; re-push to retry.`)}if($.kind==="submitted"){Oe=null;try{let pe=await e.get(`/appmodules(${v})?$select=appmoduleid`);pe.status>=200&&pe.status<300&&(Oe=(0,we.readEtag)(pe)),vt=(f=await Zc(e,w))!==null&&f!==void 0?f:vt}catch{}}}return{id:v,etag:vt??await Zc(e,w),siblingEtags:{[v]:Oe},publish:$,...z.length>0?{warnings:z}:{}}},async delete(e,t){let r=(0,se.normalizeGuid)(t,"id");await H0(e,r,await z0(e,r))}}});var ro=g(Ti=>{"use strict";function mx(e,t,r){if(r===void 0&&(r=Array.prototype),e&&typeof r.find=="function")return r.find.call(e,t);for(var n=0;n<e.length;n++)if(Object.prototype.hasOwnProperty.call(e,n)){var i=e[n];if(t.call(void 0,i,n,e))return i}}function ad(e,t){return t===void 0&&(t=Object),t&&typeof t.freeze=="function"?t.freeze(e):e}function hx(e,t){if(e===null||typeof e!="object")throw new TypeError("target is not an object");for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}var j0=ad({HTML:"text/html",isHTML:function(e){return e===j0.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Q0=ad({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===Q0.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});Ti.assign=hx;Ti.find=mx;Ti.freeze=ad;Ti.MIME_TYPE=j0;Ti.NAMESPACE=Q0});var vd=g(Hr=>{var rv=ro(),wr=rv.find,no=rv.NAMESPACE;function gx(e){return e!==""}function vx(e){return e?e.split(/[\t\n\f\r ]+/).filter(gx):[]}function yx(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function J0(e){if(!e)return[];var t=vx(e);return Object.keys(t.reduce(yx,{}))}function bx(e){return function(t){return e&&e.indexOf(t)!==-1}}function ao(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function Et(e,t){var r=e.prototype;if(!(r instanceof t)){let i=function(){};var n=i;i.prototype=t.prototype,i=new i,ao(r,i),e.prototype=r=i}r.constructor!=e&&(typeof e!="function"&&console.error("unknown Class:"+e),r.constructor=e)}var Nt={},qt=Nt.ELEMENT_NODE=1,Oi=Nt.ATTRIBUTE_NODE=2,Ks=Nt.TEXT_NODE=3,nv=Nt.CDATA_SECTION_NODE=4,iv=Nt.ENTITY_REFERENCE_NODE=5,wx=Nt.ENTITY_NODE=6,od=Nt.PROCESSING_INSTRUCTION_NODE=7,sd=Nt.COMMENT_NODE=8,av=Nt.DOCUMENT_NODE=9,ov=Nt.DOCUMENT_TYPE_NODE=10,Gr=Nt.DOCUMENT_FRAGMENT_NODE=11,Ax=Nt.NOTATION_NODE=12,tt={},ze={},Iz=tt.INDEX_SIZE_ERR=(ze[1]="Index size error",1),_z=tt.DOMSTRING_SIZE_ERR=(ze[2]="DOMString size error",2),St=tt.HIERARCHY_REQUEST_ERR=(ze[3]="Hierarchy request error",3),Tz=tt.WRONG_DOCUMENT_ERR=(ze[4]="Wrong document",4),Cx=tt.INVALID_CHARACTER_ERR=(ze[5]="Invalid character",5),Pz=tt.NO_DATA_ALLOWED_ERR=(ze[6]="No data allowed",6),Oz=tt.NO_MODIFICATION_ALLOWED_ERR=(ze[7]="No modification allowed",7),sv=tt.NOT_FOUND_ERR=(ze[8]="Not found",8),Rz=tt.NOT_SUPPORTED_ERR=(ze[9]="Not supported",9),K0=tt.INUSE_ATTRIBUTE_ERR=(ze[10]="Attribute in use",10),Pi=tt.INVALID_STATE_ERR=(ze[11]="Invalid state",11),Fz=tt.SYNTAX_ERR=(ze[12]="Syntax error",12),xz=tt.INVALID_MODIFICATION_ERR=(ze[13]="Invalid modification",13),Lz=tt.NAMESPACE_ERR=(ze[14]="Invalid namespace",14),kz=tt.INVALID_ACCESS_ERR=(ze[15]="Invalid access",15);function de(e,t){if(t instanceof Error)var r=t;else r=this,Error.call(this,ze[e]),this.message=ze[e],Error.captureStackTrace&&Error.captureStackTrace(this,de);return r.code=e,t&&(this.message=this.message+": "+t),r}de.prototype=Error.prototype;ao(tt,de);function zr(){}zr.prototype={length:0,item:function(e){return e>=0&&e<this.length?this[e]:null},toString:function(e,t,r){for(var n=!!r&&!!r.requireWellFormed,i=[],a=0;a<this.length;a++)gd(this[a],i,e,t,null,n);return i.join("")},filter:function(e){return Array.prototype.filter.call(this,e)},indexOf:function(e){return Array.prototype.indexOf.call(this,e)}};function Ri(e,t){this._node=e,this._refresh=t,ld(this)}function ld(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var r=e._refresh(e._node);if(bv(e,"length",r.length),!e.$$length||r.length<e.$$length)for(var n=r.length;n in e;n++)Object.prototype.hasOwnProperty.call(e,n)&&delete e[n];ao(r,e),e._inc=t}}Ri.prototype.item=function(e){return ld(this),this[e]||null};Et(Ri,zr);function Xs(){}function lv(e,t){for(var r=e.length;r--;)if(e[r]===t)return r}function X0(e,t,r,n){if(n?t[lv(t,n)]=r:t[t.length++]=r,e){r.ownerElement=e;var i=e.ownerDocument;i&&(n&&dv(i,e,n),Sx(i,e,r))}}function Y0(e,t,r){var n=lv(t,r);if(n>=0){for(var i=t.length-1;n<i;)t[n]=t[++n];if(t.length=i,e){var a=e.ownerDocument;a&&(dv(a,e,r),r.ownerElement=null)}}else throw new de(sv,new Error(e.tagName+"@"+r))}Xs.prototype={length:0,item:zr.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var r=this[t];if(r.nodeName==e)return r}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new de(K0);var r=this.getNamedItem(e.nodeName);return X0(this._ownerElement,this,e,r),r},setNamedItemNS:function(e){var t=e.ownerElement,r;if(t&&t!=this._ownerElement)throw new de(K0);return r=this.getNamedItemNS(e.namespaceURI,e.localName),X0(this._ownerElement,this,e,r),r},removeNamedItem:function(e){var t=this.getNamedItem(e);return Y0(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var r=this.getNamedItemNS(e,t);return Y0(this._ownerElement,this,r),r},getNamedItemNS:function(e,t){for(var r=this.length;r--;){var n=this[r];if(n.localName==t&&n.namespaceURI==e)return n}return null}};function uv(){}uv.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,r){var n=new oo;if(n.implementation=this,n.childNodes=new zr,n.doctype=r||null,r&&n.appendChild(r),t){var i=n.createElementNS(e,t);n.appendChild(i)}return n},createDocumentType:function(e,t,r){var n=new tl;return n.name=e,n.nodeName=e,n.publicId=t||"",n.systemId=r||"",n}};function ue(){}ue.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return Zs(this,e,t)},replaceChild:function(e,t){Zs(this,e,t,fv),t&&this.removeChild(t)},removeChild:function(e){return pv(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(e){return yv(this.ownerDocument||this,this,e)},normalize:function(){Ge(this,null,{enter:function(e){for(var t=e.firstChild;t;){var r=t.nextSibling;r!==null&&r.nodeType===Ks&&t.nodeType===Ks?(e.removeChild(r),t.appendData(r.data)):t=r}return!0}})},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){for(var t=this;t;){var r=t._nsMap;if(r){for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)&&r[n]===e)return n}t=t.nodeType==Oi?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var r=t._nsMap;if(r&&Object.prototype.hasOwnProperty.call(r,e))return r[e];t=t.nodeType==Oi?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){var t=this.lookupPrefix(e);return t==null}};function cv(e){return e=="<"&&"&lt;"||e==">"&&"&gt;"||e=="&"&&"&amp;"||e=='"'&&"&quot;"||"&#"+e.charCodeAt()+";"}ao(Nt,ue);ao(Nt,ue.prototype);function Ys(e,t){return Ge(e,null,{enter:function(r){return t(r)?Ge.STOP:!0}})===Ge.STOP}function Ge(e,t,r){for(var n=[{node:e,context:t,phase:Ge.ENTER}];n.length>0;){var i=n.pop();if(i.phase===Ge.ENTER){var a=r.enter(i.node,i.context);if(a===Ge.STOP)return Ge.STOP;if(n.push({node:i.node,context:a,phase:Ge.EXIT}),a==null)continue;for(var o=i.node.lastChild;o;)n.push({node:o,context:a,phase:Ge.ENTER}),o=o.previousSibling}else r.exit&&r.exit(i.node,i.context)}}Ge.STOP=Symbol("walkDOM.STOP");Ge.ENTER=0;Ge.EXIT=1;function oo(){this.ownerDocument=this}function Sx(e,t,r){e&&e._inc++;var n=r.namespaceURI;n===no.XMLNS&&(t._nsMap[r.prefix?r.localName:""]=r.value)}function dv(e,t,r,n){e&&e._inc++;var i=r.namespaceURI;i===no.XMLNS&&delete t._nsMap[r.prefix?r.localName:""]}function ud(e,t,r){if(e&&e._inc){e._inc++;var n=t.childNodes;if(r)n[n.length++]=r;else{for(var i=t.firstChild,a=0;i;)n[a++]=i,i=i.nextSibling;n.length=a,delete n[n.length]}}}function pv(e,t){var r=t.previousSibling,n=t.nextSibling;return r?r.nextSibling=n:e.firstChild=n,n?n.previousSibling=r:e.lastChild=r,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,ud(e.ownerDocument,e),t}function Ex(e){return e&&(e.nodeType===ue.DOCUMENT_NODE||e.nodeType===ue.DOCUMENT_FRAGMENT_NODE||e.nodeType===ue.ELEMENT_NODE)}function Nx(e){return e&&(Ar(e)||cd(e)||Wr(e)||e.nodeType===ue.DOCUMENT_FRAGMENT_NODE||e.nodeType===ue.COMMENT_NODE||e.nodeType===ue.PROCESSING_INSTRUCTION_NODE)}function Wr(e){return e&&e.nodeType===ue.DOCUMENT_TYPE_NODE}function Ar(e){return e&&e.nodeType===ue.ELEMENT_NODE}function cd(e){return e&&e.nodeType===ue.TEXT_NODE}function Z0(e,t){var r=e.childNodes||[];if(wr(r,Ar)||Wr(t))return!1;var n=wr(r,Wr);return!(t&&n&&r.indexOf(n)>r.indexOf(t))}function ev(e,t){var r=e.childNodes||[];function n(a){return Ar(a)&&a!==t}if(wr(r,n))return!1;var i=wr(r,Wr);return!(t&&i&&r.indexOf(i)>r.indexOf(t))}function Dx(e,t,r){if(!Ex(e))throw new de(St,"Unexpected parent node type "+e.nodeType);if(r&&r.parentNode!==e)throw new de(sv,"child not in parent");if(!Nx(t)||Wr(t)&&e.nodeType!==ue.DOCUMENT_NODE)throw new de(St,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function Ix(e,t,r){var n=e.childNodes||[],i=t.childNodes||[];if(t.nodeType===ue.DOCUMENT_FRAGMENT_NODE){var a=i.filter(Ar);if(a.length>1||wr(i,cd))throw new de(St,"More than one element or text in fragment");if(a.length===1&&!Z0(e,r))throw new de(St,"Element in fragment can not be inserted before doctype")}if(Ar(t)&&!Z0(e,r))throw new de(St,"Only one element can be added and only after doctype");if(Wr(t)){if(wr(n,Wr))throw new de(St,"Only one doctype is allowed");var o=wr(n,Ar);if(r&&n.indexOf(o)<n.indexOf(r))throw new de(St,"Doctype can only be inserted before an element");if(!r&&o)throw new de(St,"Doctype can not be appended since element is present")}}function fv(e,t,r){var n=e.childNodes||[],i=t.childNodes||[];if(t.nodeType===ue.DOCUMENT_FRAGMENT_NODE){var a=i.filter(Ar);if(a.length>1||wr(i,cd))throw new de(St,"More than one element or text in fragment");if(a.length===1&&!ev(e,r))throw new de(St,"Element in fragment can not be inserted before doctype")}if(Ar(t)&&!ev(e,r))throw new de(St,"Only one element can be added and only after doctype");if(Wr(t)){let l=function(u){return Wr(u)&&u!==r};var s=l;if(wr(n,l))throw new de(St,"Only one doctype is allowed");var o=wr(n,Ar);if(r&&n.indexOf(o)<n.indexOf(r))throw new de(St,"Doctype can only be inserted before an element")}}function Zs(e,t,r,n){Dx(e,t,r),e.nodeType===ue.DOCUMENT_NODE&&(n||Ix)(e,t,r);var i=t.parentNode;if(i&&i.removeChild(t),t.nodeType===Gr){var a=t.firstChild;if(a==null)return t;var o=t.lastChild}else a=o=t;var s=r?r.previousSibling:e.lastChild;a.previousSibling=s,o.nextSibling=r,s?s.nextSibling=a:e.firstChild=a,r==null?e.lastChild=o:r.previousSibling=o;do{a.parentNode=e;var l=e.ownerDocument||e;io(a,l)}while(a!==o&&(a=a.nextSibling));return ud(e.ownerDocument||e,e),t.nodeType==Gr&&(t.firstChild=t.lastChild=null),t}function io(e,t){if(e.ownerDocument!==t){if(e.ownerDocument=t,e.nodeType===qt&&e.attributes)for(var r=0;r<e.attributes.length;r++){var n=e.attributes.item(r);n&&(n.ownerDocument=t)}for(var i=e.firstChild;i;)io(i,t),i=i.nextSibling}}function _x(e,t){t.parentNode&&t.parentNode.removeChild(t),t.parentNode=e,t.previousSibling=e.lastChild,t.nextSibling=null,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,e.lastChild=t,ud(e.ownerDocument,e,t);var r=e.ownerDocument||e;return io(t,r),t}oo.prototype={nodeName:"#document",nodeType:av,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==Gr){for(var r=e.firstChild;r;){var n=r.nextSibling;this.insertBefore(r,t),r=n}return e}return Zs(this,e,t),io(e,this),this.documentElement===null&&e.nodeType===qt&&(this.documentElement=e),e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),pv(this,e)},replaceChild:function(e,t){Zs(this,e,t,fv),io(e,this),t&&this.removeChild(t),Ar(e)&&(this.documentElement=e)},importNode:function(e,t){return Tx(this,e,t)},getElementById:function(e){var t=null;return Ys(this.documentElement,function(r){if(r.nodeType==qt&&r.getAttribute("id")==e)return t=r,!0}),t},getElementsByClassName:function(e){var t=J0(e);return new Ri(this,function(r){var n=[];return t.length>0&&Ys(r.documentElement,function(i){if(i!==r&&i.nodeType===qt){var a=i.getAttribute("class");if(a){var o=e===a;if(!o){var s=J0(a);o=t.every(bx(s))}o&&n.push(i)}}}),n})},createElement:function(e){var t=new Qn;t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new zr;var r=t.attributes=new Xs;return r._ownerElement=t,t},createDocumentFragment:function(){var e=new rl;return e.ownerDocument=this,e.childNodes=new zr,e},createTextNode:function(e){var t=new dd;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new pd;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){if(e.indexOf("]]>")!==-1)throw new de(Cx,'data contains "]]>"');var t=new fd;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var r=new hd;return r.ownerDocument=this,r.tagName=r.nodeName=r.target=e,r.nodeValue=r.data=t,r},createAttribute:function(e){var t=new el;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new md;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var r=new Qn,n=t.split(":"),i=r.attributes=new Xs;return r.childNodes=new zr,r.ownerDocument=this,r.nodeName=t,r.tagName=t,r.namespaceURI=e,n.length==2?(r.prefix=n[0],r.localName=n[1]):r.localName=t,i._ownerElement=r,r},createAttributeNS:function(e,t){var r=new el,n=t.split(":");return r.ownerDocument=this,r.nodeName=t,r.name=t,r.namespaceURI=e,r.specified=!0,n.length==2?(r.prefix=n[0],r.localName=n[1]):r.localName=t,r}};Et(oo,ue);function Qn(){this._nsMap={}}Qn.prototype={nodeType:qt,hasAttribute:function(e){return this.getAttributeNode(e)!=null},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var r=this.ownerDocument.createAttribute(e);r.value=r.nodeValue=""+t,this.setAttributeNode(r)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===Gr?this.insertBefore(e,null):_x(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var r=this.getAttributeNodeNS(e,t);r&&this.removeAttributeNode(r)},hasAttributeNS:function(e,t){return this.getAttributeNodeNS(e,t)!=null},getAttributeNS:function(e,t){var r=this.getAttributeNodeNS(e,t);return r&&r.value||""},setAttributeNS:function(e,t,r){var n=this.ownerDocument.createAttributeNS(e,t);n.value=n.nodeValue=""+r,this.setAttributeNode(n)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new Ri(this,function(t){var r=[];return Ys(t,function(n){n!==t&&n.nodeType==qt&&(e==="*"||n.tagName==e)&&r.push(n)}),r})},getElementsByTagNameNS:function(e,t){return new Ri(this,function(r){var n=[];return Ys(r,function(i){i!==r&&i.nodeType===qt&&(e==="*"||i.namespaceURI===e)&&(t==="*"||i.localName==t)&&n.push(i)}),n})}};oo.prototype.getElementsByTagName=Qn.prototype.getElementsByTagName;oo.prototype.getElementsByTagNameNS=Qn.prototype.getElementsByTagNameNS;Et(Qn,ue);function el(){}el.prototype.nodeType=Oi;Et(el,ue);function so(){}so.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(ze[St])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,r){var n=this.data.substring(0,e),i=this.data.substring(e+t);r=n+r+i,this.nodeValue=this.data=r,this.length=r.length}};Et(so,ue);function dd(){}dd.prototype={nodeName:"#text",nodeType:Ks,splitText:function(e){var t=this.data,r=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var n=this.ownerDocument.createTextNode(r);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}};Et(dd,so);function pd(){}pd.prototype={nodeName:"#comment",nodeType:sd};Et(pd,so);function fd(){}fd.prototype={nodeName:"#cdata-section",nodeType:nv};Et(fd,so);function tl(){}tl.prototype.nodeType=ov;Et(tl,ue);function mv(){}mv.prototype.nodeType=Ax;Et(mv,ue);function hv(){}hv.prototype.nodeType=wx;Et(hv,ue);function md(){}md.prototype.nodeType=iv;Et(md,ue);function rl(){}rl.prototype.nodeName="#document-fragment";rl.prototype.nodeType=Gr;Et(rl,ue);function hd(){}hd.prototype.nodeType=od;Et(hd,ue);function gv(){}gv.prototype.serializeToString=function(e,t,r,n){return vv.call(e,t,r,n)};ue.prototype.toString=vv;function vv(e,t,r){var n=!!r&&!!r.requireWellFormed,i=[],a=this.nodeType==9&&this.documentElement||this,o=a.prefix,s=a.namespaceURI;if(s&&o==null){var o=a.lookupPrefix(s);if(o==null)var l=[{namespace:s,prefix:null}]}return gd(this,i,e,t,l,n),i.join("")}function tv(e,t,r){var n=e.prefix||"",i=e.namespaceURI;if(!i||n==="xml"&&i===no.XML||i===no.XMLNS)return!1;for(var a=r.length;a--;){var o=r[a];if(o.prefix===n)return o.namespace!==i}return!0}function Js(e,t,r){e.push(" ",t,'="',r.replace(/[<>&"\t\n\r]/g,cv),'"')}function gd(e,t,r,n,i,a){i||(i=[]),Ge(e,{ns:i,isHTML:r},{enter:function(o,s){var l=s.ns,u=s.isHTML;if(n)if(o=n(o),o){if(typeof o=="string")return t.push(o),null}else return null;switch(o.nodeType){case qt:var c=o.attributes,d=c.length,p=o.tagName;u=no.isHTML(o.namespaceURI)||u;var f=p;if(!u&&!o.prefix&&o.namespaceURI){for(var h,v=0;v<c.length;v++)if(c.item(v).name==="xmlns"){h=c.item(v).value;break}if(!h)for(var w=l.length-1;w>=0;w--){var E=l[w];if(E.prefix===""&&E.namespace===o.namespaceURI){h=E.namespace;break}}if(h!==o.namespaceURI)for(var w=l.length-1;w>=0;w--){var E=l[w];if(E.namespace===o.namespaceURI){E.prefix&&(f=E.prefix+":"+p);break}}}t.push("<",f);for(var D=l.slice(),x=0;x<d;x++){var F=c.item(x);F.prefix=="xmlns"?D.push({prefix:F.localName,namespace:F.value}):F.nodeName=="xmlns"&&D.push({prefix:"",namespace:F.value})}for(var x=0;x<d;x++){var F=c.item(x);if(tv(F,u,D)){var j=F.prefix||"",L=F.namespaceURI;Js(t,j?"xmlns:"+j:"xmlns",L),D.push({prefix:j,namespace:L})}var V=n?n(F):F;V&&(typeof V=="string"?t.push(V):Js(t,V.name,V.value))}if(p===f&&tv(o,u,D)){var B=o.prefix||"",L=o.namespaceURI;Js(t,B?"xmlns:"+B:"xmlns",L),D.push({prefix:B,namespace:L})}var U=o.firstChild;if(U||u&&!/^(?:meta|link|img|br|hr|input)$/i.test(p)){if(t.push(">"),u&&/^script$/i.test(p)){for(;U;)U.data?t.push(U.data):gd(U,t,u,n,D.slice(),a),U=U.nextSibling;return t.push("</",p,">"),null}return{ns:D,isHTML:u,tag:f}}else return t.push("/>"),null;case av:case Gr:return{ns:l.slice(),isHTML:u,tag:null};case Oi:return Js(t,o.name,o.value),null;case Ks:return t.push(o.data.replace(/[<&>]/g,cv)),null;case nv:if(a&&o.data.indexOf("]]>")!==-1)throw new de(Pi,'The CDATASection data contains "]]>"');return t.push("<![CDATA[",o.data.replace(/]]>/g,"]]]]><![CDATA[>"),"]]>"),null;case sd:if(a&&o.data.indexOf("-->")!==-1)throw new de(Pi,'The comment node data contains "-->"');return t.push("<!--",o.data,"-->"),null;case ov:if(a){if(o.publicId&&!/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(o.publicId))throw new de(Pi,"DocumentType publicId is not a valid PubidLiteral");if(o.systemId&&!/^("[^"]*"|'[^']*')$/.test(o.systemId))throw new de(Pi,"DocumentType systemId is not a valid SystemLiteral");if(o.internalSubset&&o.internalSubset.indexOf("]>")!==-1)throw new de(Pi,'DocumentType internalSubset contains "]>"')}var z=o.publicId,$=o.systemId;if(t.push("<!DOCTYPE ",o.name),z)t.push(" PUBLIC ",z),$&&$!="."&&t.push(" ",$),t.push(">");else if($&&$!=".")t.push(" SYSTEM ",$,">");else{var Oe=o.internalSubset;Oe&&t.push(" [",Oe,"]"),t.push(">")}return null;case od:if(a&&o.data.indexOf("?>")!==-1)throw new de(Pi,'The ProcessingInstruction data contains "?>"');return t.push("<?",o.target," ",o.data,"?>"),null;case iv:return t.push("&",o.nodeName,";"),null;default:return t.push("??",o.nodeName),null}},exit:function(o,s){s&&s.tag&&t.push("</",s.tag,">")}})}function Tx(e,t,r){var n;return Ge(t,null,{enter:function(i,a){var o=i.cloneNode(!1);o.ownerDocument=e,o.parentNode=null,a===null?n=o:a.appendChild(o);var s=i.nodeType===Oi||r;return s?o:null}}),n}function yv(e,t,r){var n;return Ge(t,null,{enter:function(i,a){var o=new i.constructor;for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)){var l=i[s];typeof l!="object"&&l!=o[s]&&(o[s]=l)}i.childNodes&&(o.childNodes=new zr),o.ownerDocument=e;var u=r;switch(o.nodeType){case qt:var c=i.attributes,d=o.attributes=new Xs,p=c.length;d._ownerElement=o;for(var f=0;f<p;f++)o.setAttributeNode(yv(e,c.item(f),!0));break;case Oi:u=!0}return a!==null?a.appendChild(o):n=o,u?o:null}}),n}function bv(e,t,r){e[t]=r}try{Object.defineProperty&&(Object.defineProperty(Ri.prototype,"length",{get:function(){return ld(this),this.$$length}}),Object.defineProperty(ue.prototype,"textContent",{get:function(){if(this.nodeType===qt||this.nodeType===Gr){var e=[];return Ge(this,null,{enter:function(t){if(t.nodeType===qt||t.nodeType===Gr)return!0;if(t.nodeType===od||t.nodeType===sd)return null;e.push(t.nodeValue)}}),e.join("")}return this.nodeValue},set:function(e){switch(this.nodeType){case qt:case Gr:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),bv=function(e,t,r){e["$$"+t]=r})}catch{}Hr.DocumentType=tl;Hr.DOMException=de;Hr.DOMImplementation=uv;Hr.Element=Qn;Hr.Node=ue;Hr.NodeList=zr;Hr.walkDOM=Ge;Hr.XMLSerializer=gv});var Av=g(lo=>{"use strict";var wv=ro().freeze;lo.XML_ENTITIES=wv({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});lo.HTML_ENTITIES=wv({Aacute:"\xC1",aacute:"\xE1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",Acy:"\u0410",acy:"\u0430",AElig:"\xC6",aelig:"\xE6",af:"\u2061",Afr:"\u{1D504}",afr:"\u{1D51E}",Agrave:"\xC0",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03B1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2A3F",AMP:"&",amp:"&",And:"\u2A53",and:"\u2227",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1D538}",aopf:"\u{1D552}",ap:"\u2248",apacir:"\u2A6F",apE:"\u2A70",ape:"\u224A",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",Aring:"\xC5",aring:"\xE5",Ascr:"\u{1D49C}",ascr:"\u{1D4B6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",Backslash:"\u2216",Barv:"\u2AE7",barvee:"\u22BD",Barwed:"\u2306",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",Because:"\u2235",because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",Beta:"\u0392",beta:"\u03B2",beth:"\u2136",between:"\u226C",Bfr:"\u{1D505}",bfr:"\u{1D51F}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bNot:"\u2AED",bnot:"\u2310",Bopf:"\u{1D539}",bopf:"\u{1D553}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxbox:"\u29C9",boxDL:"\u2557",boxDl:"\u2556",boxdL:"\u2555",boxdl:"\u2510",boxDR:"\u2554",boxDr:"\u2553",boxdR:"\u2552",boxdr:"\u250C",boxH:"\u2550",boxh:"\u2500",boxHD:"\u2566",boxHd:"\u2564",boxhD:"\u2565",boxhd:"\u252C",boxHU:"\u2569",boxHu:"\u2567",boxhU:"\u2568",boxhu:"\u2534",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxUL:"\u255D",boxUl:"\u255C",boxuL:"\u255B",boxul:"\u2518",boxUR:"\u255A",boxUr:"\u2559",boxuR:"\u2558",boxur:"\u2514",boxV:"\u2551",boxv:"\u2502",boxVH:"\u256C",boxVh:"\u256B",boxvH:"\u256A",boxvh:"\u253C",boxVL:"\u2563",boxVl:"\u2562",boxvL:"\u2561",boxvl:"\u2524",boxVR:"\u2560",boxVr:"\u255F",boxvR:"\u255E",boxvr:"\u251C",bprime:"\u2035",Breve:"\u02D8",breve:"\u02D8",brvbar:"\xA6",Bscr:"\u212C",bscr:"\u{1D4B7}",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",Bumpeq:"\u224E",bumpeq:"\u224F",Cacute:"\u0106",cacute:"\u0107",Cap:"\u22D2",cap:"\u2229",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",Ccaron:"\u010C",ccaron:"\u010D",Ccedil:"\xC7",ccedil:"\xE7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",Cdot:"\u010A",cdot:"\u010B",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",CenterDot:"\xB7",centerdot:"\xB7",Cfr:"\u212D",cfr:"\u{1D520}",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03A7",chi:"\u03C7",cir:"\u25CB",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",CircleDot:"\u2299",circledR:"\xAE",circledS:"\u24C8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",Colon:"\u2237",colon:":",Colone:"\u2A74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",Congruent:"\u2261",Conint:"\u222F",conint:"\u222E",ContourIntegral:"\u222E",Copf:"\u2102",copf:"\u{1D554}",coprod:"\u2210",Coproduct:"\u2210",COPY:"\xA9",copy:"\xA9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21B5",Cross:"\u2A2F",cross:"\u2717",Cscr:"\u{1D49E}",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",Cup:"\u22D3",cup:"\u222A",cupbrcap:"\u2A48",CupCap:"\u224D",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",Dagger:"\u2021",dagger:"\u2020",daleth:"\u2138",Darr:"\u21A1",dArr:"\u21D3",darr:"\u2193",dash:"\u2010",Dashv:"\u2AE4",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",Dcaron:"\u010E",dcaron:"\u010F",Dcy:"\u0414",dcy:"\u0434",DD:"\u2145",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21CA",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",Delta:"\u0394",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",Dfr:"\u{1D507}",dfr:"\u{1D521}",dHar:"\u2965",dharl:"\u21C3",dharr:"\u21C2",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",diam:"\u22C4",Diamond:"\u22C4",diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",DifferentialD:"\u2146",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",Dopf:"\u{1D53B}",dopf:"\u{1D555}",Dot:"\xA8",dot:"\u02D9",DotDot:"\u20DC",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",Downarrow:"\u21D3",downarrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",Dscr:"\u{1D49F}",dscr:"\u{1D4B9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29F6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",DZcy:"\u040F",dzcy:"\u045F",dzigrarr:"\u27FF",Eacute:"\xC9",eacute:"\xE9",easter:"\u2A6E",Ecaron:"\u011A",ecaron:"\u011B",ecir:"\u2256",Ecirc:"\xCA",ecirc:"\xEA",ecolon:"\u2255",Ecy:"\u042D",ecy:"\u044D",eDDot:"\u2A77",Edot:"\u0116",eDot:"\u2251",edot:"\u0117",ee:"\u2147",efDot:"\u2252",Efr:"\u{1D508}",efr:"\u{1D522}",eg:"\u2A9A",Egrave:"\xC8",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",ENG:"\u014A",eng:"\u014B",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1D53C}",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",Equal:"\u2A75",equals:"=",EqualTilde:"\u2242",equest:"\u225F",Equilibrium:"\u21CC",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erarr:"\u2971",erDot:"\u2253",Escr:"\u2130",escr:"\u212F",esdot:"\u2250",Esim:"\u2A73",esim:"\u2242",Eta:"\u0397",eta:"\u03B7",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",ExponentialE:"\u2147",exponentiale:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",Ffr:"\u{1D509}",ffr:"\u{1D523}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",Fopf:"\u{1D53D}",fopf:"\u{1D557}",ForAll:"\u2200",forall:"\u2200",fork:"\u22D4",forkv:"\u2AD9",Fouriertrf:"\u2131",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",Fscr:"\u2131",fscr:"\u{1D4BB}",gacute:"\u01F5",Gamma:"\u0393",gamma:"\u03B3",Gammad:"\u03DC",gammad:"\u03DD",gap:"\u2A86",Gbreve:"\u011E",gbreve:"\u011F",Gcedil:"\u0122",Gcirc:"\u011C",gcirc:"\u011D",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",gE:"\u2267",ge:"\u2265",gEl:"\u2A8C",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",Gfr:"\u{1D50A}",gfr:"\u{1D524}",Gg:"\u22D9",gg:"\u226B",ggg:"\u22D9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gl:"\u2277",gla:"\u2AA5",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gnE:"\u2269",gne:"\u2A88",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",Gopf:"\u{1D53E}",gopf:"\u{1D558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",Gt:"\u226B",GT:">",gt:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",Hacek:"\u02C7",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",HARDcy:"\u042A",hardcy:"\u044A",hArr:"\u21D4",harr:"\u2194",harrcir:"\u2948",harrw:"\u21AD",Hat:"^",hbar:"\u210F",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",Hfr:"\u210C",hfr:"\u{1D525}",HilbertSpace:"\u210B",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",Hopf:"\u210D",hopf:"\u{1D559}",horbar:"\u2015",HorizontalLine:"\u2500",Hscr:"\u210B",hscr:"\u{1D4BD}",hslash:"\u210F",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xCD",iacute:"\xED",ic:"\u2063",Icirc:"\xCE",icirc:"\xEE",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",Ifr:"\u2111",ifr:"\u{1D526}",Igrave:"\xCC",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Im:"\u2111",Imacr:"\u012A",imacr:"\u012B",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",Int:"\u222C",int:"\u222B",intcal:"\u22BA",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012E",iogon:"\u012F",Iopf:"\u{1D540}",iopf:"\u{1D55A}",Iota:"\u0399",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",Iscr:"\u2110",iscr:"\u{1D4BE}",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xCF",iuml:"\xEF",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1D50D}",jfr:"\u{1D527}",jmath:"\u0237",Jopf:"\u{1D541}",jopf:"\u{1D55B}",Jscr:"\u{1D4A5}",jscr:"\u{1D4BF}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041A",kcy:"\u043A",Kfr:"\u{1D50E}",kfr:"\u{1D528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040C",kjcy:"\u045C",Kopf:"\u{1D542}",kopf:"\u{1D55C}",Kscr:"\u{1D4A6}",kscr:"\u{1D4C0}",lAarr:"\u21DA",Lacute:"\u0139",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",Lambda:"\u039B",lambda:"\u03BB",Lang:"\u27EA",lang:"\u27E8",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",Larr:"\u219E",lArr:"\u21D0",larr:"\u2190",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",lAtail:"\u291B",latail:"\u2919",late:"\u2AAD",lates:"\u2AAD\uFE00",lBarr:"\u290E",lbarr:"\u290C",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",Lcaron:"\u013D",lcaron:"\u013E",Lcedil:"\u013B",lcedil:"\u013C",lceil:"\u2308",lcub:"{",Lcy:"\u041B",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",lE:"\u2266",le:"\u2264",LeftAngleBracket:"\u27E8",LeftArrow:"\u2190",Leftarrow:"\u21D0",leftarrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",LeftRightArrow:"\u2194",Leftrightarrow:"\u21D4",leftrightarrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",lEg:"\u2A8B",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2AA1",lesssim:"\u2272",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",lfisht:"\u297C",lfloor:"\u230A",Lfr:"\u{1D50F}",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",Ll:"\u22D8",ll:"\u226A",llarr:"\u21C7",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",Lmidot:"\u013F",lmidot:"\u0140",lmoust:"\u23B0",lmoustache:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lnE:"\u2268",lne:"\u2A87",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",LongLeftArrow:"\u27F5",Longleftarrow:"\u27F8",longleftarrow:"\u27F5",LongLeftRightArrow:"\u27F7",Longleftrightarrow:"\u27FA",longleftrightarrow:"\u27F7",longmapsto:"\u27FC",LongRightArrow:"\u27F6",Longrightarrow:"\u27F9",longrightarrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",Lopf:"\u{1D543}",lopf:"\u{1D55D}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",Lscr:"\u2112",lscr:"\u{1D4C1}",Lsh:"\u21B0",lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",Lstrok:"\u0141",lstrok:"\u0142",Lt:"\u226A",LT:"<",lt:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",ltrPar:"\u2996",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",Mcy:"\u041C",mcy:"\u043C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",Mopf:"\u{1D544}",mopf:"\u{1D55E}",mp:"\u2213",Mscr:"\u2133",mscr:"\u{1D4C2}",mstpos:"\u223E",Mu:"\u039C",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",Ncy:"\u041D",ncy:"\u043D",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",neArr:"\u21D7",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:`
+`,nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nhArr:"\u21CE",nharr:"\u21AE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlArr:"\u21CD",nlarr:"\u219A",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nLeftarrow:"\u21CD",nleftarrow:"\u219A",nLeftrightarrow:"\u21CE",nleftrightarrow:"\u21AE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nLt:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",Nopf:"\u2115",nopf:"\u{1D55F}",Not:"\u2AEC",not:"\xAC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrArr:"\u21CF",nrarr:"\u219B",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nRightarrow:"\u21CF",nrightarrow:"\u219B",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nVDash:"\u22AF",nVdash:"\u22AE",nvDash:"\u22AD",nvdash:"\u22AC",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwArr:"\u21D6",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xD3",oacute:"\xF3",oast:"\u229B",ocir:"\u229A",Ocirc:"\xD4",ocirc:"\xF4",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29BF",Ofr:"\u{1D512}",ofr:"\u{1D52C}",ogon:"\u02DB",Ograve:"\xD2",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",Omacr:"\u014C",omacr:"\u014D",Omega:"\u03A9",omega:"\u03C9",Omicron:"\u039F",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",Oopf:"\u{1D546}",oopf:"\u{1D560}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",Or:"\u2A54",or:"\u2228",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",Oscr:"\u{1D4AA}",oscr:"\u2134",Oslash:"\xD8",oslash:"\xF8",osol:"\u2298",Otilde:"\xD5",otilde:"\xF5",Otimes:"\u2A37",otimes:"\u2297",otimesas:"\u2A36",Ouml:"\xD6",ouml:"\xF6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",Pcy:"\u041F",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",Pfr:"\u{1D513}",pfr:"\u{1D52D}",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",Pi:"\u03A0",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",PlusMinus:"\xB1",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",Poincareplane:"\u210C",pointint:"\u2A15",Popf:"\u2119",popf:"\u{1D561}",pound:"\xA3",Pr:"\u2ABB",pr:"\u227A",prap:"\u2AB7",prcue:"\u227C",prE:"\u2AB3",pre:"\u2AAF",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",Prime:"\u2033",prime:"\u2032",primes:"\u2119",prnap:"\u2AB9",prnE:"\u2AB5",prnsim:"\u22E8",prod:"\u220F",Product:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",Proportion:"\u2237",Proportional:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",Pscr:"\u{1D4AB}",pscr:"\u{1D4C5}",Psi:"\u03A8",psi:"\u03C8",puncsp:"\u2008",Qfr:"\u{1D514}",qfr:"\u{1D52E}",qint:"\u2A0C",Qopf:"\u211A",qopf:"\u{1D562}",qprime:"\u2057",Qscr:"\u{1D4AC}",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",QUOT:'"',quot:'"',rAarr:"\u21DB",race:"\u223D\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",Rang:"\u27EB",rang:"\u27E9",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",Rarr:"\u21A0",rArr:"\u21D2",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21A3",rarrw:"\u219D",rAtail:"\u291C",ratail:"\u291A",ratio:"\u2236",rationals:"\u211A",RBarr:"\u2910",rBarr:"\u290F",rbarr:"\u290D",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",Re:"\u211C",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",REG:"\xAE",reg:"\xAE",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",rfisht:"\u297D",rfloor:"\u230B",Rfr:"\u211C",rfr:"\u{1D52F}",rHar:"\u2964",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",RightAngleBracket:"\u27E9",RightArrow:"\u2192",Rightarrow:"\u21D2",rightarrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",Ropf:"\u211D",ropf:"\u{1D563}",roplus:"\u2A2E",rotimes:"\u2A35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",Rrightarrow:"\u21DB",rsaquo:"\u203A",Rscr:"\u211B",rscr:"\u{1D4C7}",Rsh:"\u21B1",rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",RuleDelayed:"\u29F4",ruluhar:"\u2968",rx:"\u211E",Sacute:"\u015A",sacute:"\u015B",sbquo:"\u201A",Sc:"\u2ABC",sc:"\u227B",scap:"\u2AB8",Scaron:"\u0160",scaron:"\u0161",sccue:"\u227D",scE:"\u2AB4",sce:"\u2AB0",Scedil:"\u015E",scedil:"\u015F",Scirc:"\u015C",scirc:"\u015D",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",Scy:"\u0421",scy:"\u0441",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",searhk:"\u2925",seArr:"\u21D8",searr:"\u2198",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1D516}",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",SOFTcy:"\u042C",softcy:"\u044C",sol:"/",solb:"\u29C4",solbar:"\u233F",Sopf:"\u{1D54A}",sopf:"\u{1D564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",Sqrt:"\u221A",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",Square:"\u25A1",square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",Sscr:"\u{1D4AE}",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",Star:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",Sub:"\u22D0",sub:"\u2282",subdot:"\u2ABD",subE:"\u2AC5",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",Subset:"\u22D0",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",SuchThat:"\u220B",Sum:"\u2211",sum:"\u2211",sung:"\u266A",Sup:"\u22D1",sup:"\u2283",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",supdot:"\u2ABE",supdsub:"\u2AD8",supE:"\u2AC6",supe:"\u2287",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",Supset:"\u22D1",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swarhk:"\u2926",swArr:"\u21D9",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",Tab:" ",target:"\u2316",Tau:"\u03A4",tau:"\u03C4",tbrk:"\u23B4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",Tfr:"\u{1D517}",tfr:"\u{1D531}",there4:"\u2234",Therefore:"\u2234",therefore:"\u2234",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223C",THORN:"\xDE",thorn:"\xFE",Tilde:"\u223C",tilde:"\u02DC",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",Topf:"\u{1D54B}",topf:"\u{1D565}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",TRADE:"\u2122",trade:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",TripleDot:"\u20DB",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",Tscr:"\u{1D4AF}",tscr:"\u{1D4C9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040B",tshcy:"\u045B",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Uacute:"\xDA",uacute:"\xFA",Uarr:"\u219F",uArr:"\u21D1",uarr:"\u2191",Uarrocir:"\u2949",Ubrcy:"\u040E",ubrcy:"\u045E",Ubreve:"\u016C",ubreve:"\u016D",Ucirc:"\xDB",ucirc:"\xFB",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21C5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",Ufr:"\u{1D518}",ufr:"\u{1D532}",Ugrave:"\xD9",ugrave:"\xF9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",Umacr:"\u016A",umacr:"\u016B",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1D54C}",uopf:"\u{1D566}",UpArrow:"\u2191",Uparrow:"\u21D1",uparrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",UpDownArrow:"\u2195",Updownarrow:"\u21D5",updownarrow:"\u2195",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03D2",upsi:"\u03C5",upsih:"\u03D2",Upsilon:"\u03A5",upsilon:"\u03C5",UpTee:"\u22A5",UpTeeArrow:"\u21A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",Uring:"\u016E",uring:"\u016F",urtri:"\u25F9",Uscr:"\u{1D4B0}",uscr:"\u{1D4CA}",utdot:"\u22F0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",Uuml:"\xDC",uuml:"\xFC",uwangle:"\u29A7",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",vArr:"\u21D5",varr:"\u2195",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",Vbar:"\u2AEB",vBar:"\u2AE8",vBarv:"\u2AE9",Vcy:"\u0412",vcy:"\u0432",VDash:"\u22AB",Vdash:"\u22A9",vDash:"\u22A8",vdash:"\u22A2",Vdashl:"\u2AE6",Vee:"\u22C1",vee:"\u2228",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",Verbar:"\u2016",verbar:"|",Vert:"\u2016",vert:"|",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",Vopf:"\u{1D54D}",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",Vscr:"\u{1D4B1}",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2A5F",Wedge:"\u22C0",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1D51A}",wfr:"\u{1D534}",Wopf:"\u{1D54E}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1D4B2}",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",Xfr:"\u{1D51B}",xfr:"\u{1D535}",xhArr:"\u27FA",xharr:"\u27F7",Xi:"\u039E",xi:"\u03BE",xlArr:"\u27F8",xlarr:"\u27F5",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",Xopf:"\u{1D54F}",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrArr:"\u27F9",xrarr:"\u27F6",Xscr:"\u{1D4B3}",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",Yacute:"\xDD",yacute:"\xFD",YAcy:"\u042F",yacy:"\u044F",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042B",ycy:"\u044B",yen:"\xA5",Yfr:"\u{1D51C}",yfr:"\u{1D536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1D550}",yopf:"\u{1D56A}",Yscr:"\u{1D4B4}",yscr:"\u{1D4CE}",YUcy:"\u042E",yucy:"\u044E",Yuml:"\u0178",yuml:"\xFF",Zacute:"\u0179",zacute:"\u017A",Zcaron:"\u017D",zcaron:"\u017E",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017B",zdot:"\u017C",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zeta:"\u03B6",Zfr:"\u2128",zfr:"\u{1D537}",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21DD",Zopf:"\u2124",zopf:"\u{1D56B}",Zscr:"\u{1D4B5}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"});lo.entityMap=lo.HTML_ENTITIES});var Tv=g(bd=>{var fo=ro().NAMESPACE,yd=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,Cv=new RegExp("[\\-\\.0-9"+yd.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Sv=new RegExp("^"+yd.source+Cv.source+"*(?::"+yd.source+Cv.source+"*)?$"),uo=0,Cn=1,Fi=2,co=3,xi=4,Li=5,po=6,nl=7;function ki(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,ki)}ki.prototype=new Error;ki.prototype.name=ki.name;function Dv(){}Dv.prototype={parse:function(e,t,r){var n=this.domBuilder;n.startDocument(),Iv(t,t={}),Px(e,t,r,n,this.errorHandler),n.endDocument()}};function Px(e,t,r,n,i){function a(Z){if(Z>65535){Z-=65536;var yt=55296+(Z>>10),lc=56320+(Z&1023);return String.fromCharCode(yt,lc)}else return String.fromCharCode(Z)}function o(Z){var yt=Z.slice(1,-1);return Object.hasOwnProperty.call(r,yt)?r[yt]:yt.charAt(0)==="#"?a(parseInt(yt.substr(1).replace("x","0x"))):(i.error("entity not found:"+Z),Z)}function s(Z){if(Z>v){var yt=e.substring(v,Z).replace(/&#?\w+;/g,o);p&&l(v),n.characters(yt,0,Z-v),v=Z}}function l(Z,yt){for(;Z>=c&&(yt=d.exec(e));)u=yt.index,c=u+yt[0].length,p.lineNumber++;p.columnNumber=Z-u+1}for(var u=0,c=0,d=/.*(?:\r\n?|\n)|.*$/g,p=n.locator,f=[{currentNSMap:t}],h={},v=0;;){try{var w=e.indexOf("<",v);if(w<0){if(!e.substr(v).match(/^\s*$/)){var E=n.doc,D=E.createTextNode(e.substr(v));E.appendChild(D),n.currentElement=D}return}switch(w>v&&s(w),e.charAt(w+1)){case"/":var $=e.indexOf(">",w+3),x=e.substring(w+2,$).replace(/[ \t\n\r]+$/g,""),F=f.pop();$<0?(x=e.substring(w+2).replace(/[\s<].*/,""),i.error("end tag name: "+x+" is not complete:"+F.tagName),$=w+1+x.length):x.match(/\s</)&&(x=x.replace(/[\s<].*/,""),i.error("end tag name: "+x+" maybe not complete"),$=w+1+x.length);var j=F.localNSMap,L=F.tagName==x,V=L||F.tagName&&F.tagName.toLowerCase()==x.toLowerCase();if(V){if(n.endElement(F.uri,F.localName,x),j)for(var B in j)Object.prototype.hasOwnProperty.call(j,B)&&n.endPrefixMapping(B);L||i.fatalError("end tag name: "+x+" is not match the current start tagName:"+F.tagName)}else f.push(F);$++;break;case"?":p&&l(w),$=Lx(e,w,n);break;case"!":p&&l(w),$=xx(e,w,n,i);break;default:p&&l(w);var U=new _v,z=f[f.length-1].currentNSMap,$=Ox(e,w,U,z,o,i),Oe=U.length;if(!U.closed&&Fx(e,$,U.tagName,h)&&(U.closed=!0,r.nbsp||i.warning("unclosed xml attribute")),p&&Oe){for(var vt=Ev(p,{}),pe=0;pe<Oe;pe++){var Ke=U[pe];l(Ke.offset),Ke.locator=Ev(p,{})}n.locator=vt,Nv(U,n,z)&&f.push(U),n.locator=p}else Nv(U,n,z)&&f.push(U);fo.isHTML(U.uri)&&!U.closed?$=Rx(e,$,U.tagName,o,n):$++}}catch(Z){if(Z instanceof ki)throw Z;i.error("element parse error: "+Z),$=-1}$>v?v=$:s(Math.max(w,v)+1)}}function Ev(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function Ox(e,t,r,n,i,a){function o(f,h,v){r.attributeNames.hasOwnProperty(f)&&a.fatalError("Attribute "+f+" redefined"),r.addValue(f,h.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,i),v)}for(var s,l,u=++t,c=uo;;){var d=e.charAt(u);switch(d){case"=":if(c===Cn)s=e.slice(t,u),c=co;else if(c===Fi)c=co;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(c===co||c===Cn)if(c===Cn&&(a.warning('attribute value must after "="'),s=e.slice(t,u)),t=u+1,u=e.indexOf(d,t),u>0)l=e.slice(t,u),o(s,l,t-1),c=Li;else throw new Error("attribute value no end '"+d+"' match");else if(c==xi)l=e.slice(t,u),o(s,l,t),a.warning('attribute "'+s+'" missed start quot('+d+")!!"),t=u+1,c=Li;else throw new Error('attribute value must after "="');break;case"/":switch(c){case uo:r.setTagName(e.slice(t,u));case Li:case po:case nl:c=nl,r.closed=!0;case xi:case Cn:break;case Fi:r.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return a.error("unexpected end of input"),c==uo&&r.setTagName(e.slice(t,u)),u;case">":switch(c){case uo:r.setTagName(e.slice(t,u));case Li:case po:case nl:break;case xi:case Cn:l=e.slice(t,u),l.slice(-1)==="/"&&(r.closed=!0,l=l.slice(0,-1));case Fi:c===Fi&&(l=s),c==xi?(a.warning('attribute "'+l+'" missed quot(")!'),o(s,l,t)):((!fo.isHTML(n[""])||!l.match(/^(?:disabled|checked|selected)$/i))&&a.warning('attribute "'+l+'" missed value!! "'+l+'" instead!!'),o(l,l,t));break;case co:throw new Error("attribute value missed!!")}return u;case"\x80":d=" ";default:if(d<=" ")switch(c){case uo:r.setTagName(e.slice(t,u)),c=po;break;case Cn:s=e.slice(t,u),c=Fi;break;case xi:var l=e.slice(t,u);a.warning('attribute "'+l+'" missed quot(")!!'),o(s,l,t);case Li:c=po;break}else switch(c){case Fi:var p=r.tagName;(!fo.isHTML(n[""])||!s.match(/^(?:disabled|checked|selected)$/i))&&a.warning('attribute "'+s+'" missed value!! "'+s+'" instead2!!'),o(s,s,t),t=u,c=Cn;break;case Li:a.warning('attribute space is required"'+s+'"!!');case po:c=Cn,t=u;break;case co:c=xi,t=u;break;case nl:throw new Error("elements closed character '/' and '>' must be connected to")}}u++}}function Nv(e,t,r){for(var n=e.tagName,i=null,d=e.length;d--;){var a=e[d],o=a.qName,s=a.value,p=o.indexOf(":");if(p>0)var l=a.prefix=o.slice(0,p),u=o.slice(p+1),c=l==="xmlns"&&u;else u=o,l=null,c=o==="xmlns"&&"";a.localName=u,c!==!1&&(i==null&&(i={},Iv(r,r={})),r[c]=i[c]=s,a.uri=fo.XMLNS,t.startPrefixMapping(c,s))}for(var d=e.length;d--;){a=e[d];var l=a.prefix;l&&(l==="xml"&&(a.uri=fo.XML),l!=="xmlns"&&(a.uri=r[l||""]))}var p=n.indexOf(":");p>0?(l=e.prefix=n.slice(0,p),u=e.localName=n.slice(p+1)):(l=null,u=e.localName=n);var f=e.uri=r[l||""];if(t.startElement(f,u,n,e),e.closed){if(t.endElement(f,u,n),i)for(l in i)Object.prototype.hasOwnProperty.call(i,l)&&t.endPrefixMapping(l)}else return e.currentNSMap=r,e.localNSMap=i,!0}function Rx(e,t,r,n,i){if(/^(?:script|textarea)$/i.test(r)){var a=e.indexOf("</"+r+">",t),o=e.substring(t+1,a);if(/[&<]/.test(o))return/^script$/i.test(r)?(i.characters(o,0,o.length),a):(o=o.replace(/&#?\w+;/g,n),i.characters(o,0,o.length),a)}return t+1}function Fx(e,t,r,n){var i=n[r];return i==null&&(i=e.lastIndexOf("</"+r+">"),i<t&&(i=e.lastIndexOf("</"+r)),n[r]=i),i<t}function Iv(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function xx(e,t,r,n){var i=e.charAt(t+2);switch(i){case"-":if(e.charAt(t+3)==="-"){var a=e.indexOf("-->",t+4);return a>t?(r.comment(e,t+4,a-t-4),a+3):(n.error("Unclosed comment"),-1)}else return-1;default:if(e.substr(t+3,6)=="CDATA["){var a=e.indexOf("]]>",t+9);return r.startCDATA(),r.characters(e,t+9,a-t-9),r.endCDATA(),a+3}var o=kx(e,t),s=o.length;if(s>1&&/!doctype/i.test(o[0][0])){var l=o[1][0],u=!1,c=!1;s>3&&(/^public$/i.test(o[2][0])?(u=o[3][0],c=s>4&&o[4][0]):/^system$/i.test(o[2][0])&&(c=o[3][0]));var d=o[s-1];return r.startDTD(l,u,c),r.endDTD(),d.index+d[0].length}}return-1}function Lx(e,t,r){var n=e.indexOf("?>",t);if(n){var i=e.substring(t,n).match(/^<\?(\S*)\s*([\s\S]*?)$/);if(i){var a=i[0].length;return r.processingInstruction(i[1],i[2]),n+2}else return-1}return-1}function _v(){this.attributeNames={}}_v.prototype={setTagName:function(e){if(!Sv.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,r){if(!Sv.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:r}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}};function kx(e,t){var r,n=[],i=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(i.lastIndex=t,i.exec(e);r=i.exec(e);)if(n.push(r),r[1])return n}bd.XMLReader=Dv;bd.ParseError=ki});var kv=g(al=>{var Mx=ro(),Bx=vd(),Pv=Av(),Fv=Tv(),Ux=Bx.DOMImplementation,Ov=Mx.NAMESPACE,$x=Fv.ParseError,qx=Fv.XMLReader;function xv(e){return e.replace(/\r[\n\u0085]/g,`
`).replace(/[\r\u0085\u2028]/g,`
-`)}function Tb(e){this.options=e||{locator:{}}}Tb.prototype.parseFromString=function(e,t){var r=this.options,n=new jk,i=r.domBuilder||new vo,a=r.errorHandler,o=r.locator,s=r.xmlns||{},l=/\/x?html?$/.test(t),u=l?Nb.HTML_ENTITIES:Nb.XML_ENTITIES;o&&i.setDocumentLocator(o),n.errorHandler=Hk(a,i,o),n.domBuilder=r.domBuilder||i,l&&(s[""]=Db.HTML),s.xml=s.xml||Db.XML;var c=r.normalizeLineEndings||Pb;return e&&typeof e=="string"?n.parse(c(e),s,u):n.errorHandler.error("invalid doc source"),i.doc};function Hk(e,t,r){if(!e){if(t instanceof vo)return t;e=t}var n={},i=e instanceof Function;r=r||{};function a(o){var s=e[o];!s&&i&&(s=e.length==2?function(l){e(o,l)}:e),n[o]=s&&function(l){s("[xmldom "+o+"] "+l+pp(r))}||function(){}}return a("warning"),a("error"),a("fatalError"),n}function vo(){this.cdata=!1}function Ui(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}vo.prototype={startDocument:function(){this.doc=new zk().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,r,n){var i=this.doc,a=i.createElementNS(e,r||t),o=n.length;vl(this,a),this.currentElement=a,this.locator&&Ui(this.locator,a);for(var s=0;s<o;s++){var e=n.getURI(s),l=n.getValue(s),r=n.getQName(s),u=i.createAttributeNS(e,r);this.locator&&Ui(n.getLocator(s),u),u.value=u.nodeValue=l,a.setAttributeNode(u)}},endElement:function(e,t,r){var n=this.currentElement,i=n.tagName;this.currentElement=n.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var r=this.doc.createProcessingInstruction(e,t);this.locator&&Ui(this.locator,r),vl(this,r)},ignorableWhitespace:function(e,t,r){},characters:function(e,t,r){if(e=Ib.apply(this,arguments),e){if(this.cdata)var n=this.doc.createCDATASection(e);else var n=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(e)&&this.doc.appendChild(n),this.locator&&Ui(this.locator,n)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,r){e=Ib.apply(this,arguments);var n=this.doc.createComment(e);this.locator&&Ui(this.locator,n),vl(this,n)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,r){var n=this.doc.implementation;if(n&&n.createDocumentType){var i=n.createDocumentType(e,t,r);this.locator&&Ui(this.locator,i),vl(this,i),this.doc.doctype=i}},warning:function(e){console.warn("[xmldom warning] "+e,pp(this.locator))},error:function(e){console.error("[xmldom error] "+e,pp(this.locator))},fatalError:function(e){throw new Wk(e,this.locator)}};function pp(e){if(e)return`
-@`+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function Ib(e,t,r){return typeof e=="string"?e.substr(t,r):e.length>=t+r||t?new java.lang.String(e,t,r)+"":e}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){vo.prototype[e]=function(){return null}});function vl(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}yl.__DOMHandler=vo;yl.normalizeLineEndings=Pb;yl.DOMParser=Tb});var wl=g(bl=>{var Rb=up();bl.DOMImplementation=Rb.DOMImplementation;bl.XMLSerializer=Rb.XMLSerializer;bl.DOMParser=Ob().DOMParser});var Xd=g(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});Bi.deleteAppCascade=Bi.collectGenPageIds=void 0;var Qk=sl(),Jk=ie(),fp=ee(),Xk=wl();function Fb(e){let t=[],r=s=>l=>t.push(`${s}: ${l}`),i=new Xk.DOMParser({errorHandler:{warning:r("warning"),error:r("error"),fatalError:r("fatalError")}}).parseFromString(e,"text/xml").documentElement;if(!i||t.length>0)throw new Jk.InvalidArgumentError(`The app sitemap xml could not be parsed cleanly, so its generative-page children cannot be determined${t.length>0?` (${t[0]})`:""}`);let a=[],o=s=>{if(s.nodeName==="SubArea"){let u=s.getAttribute("GenPageId");u&&a.push((0,fp.normalizeGuid)(u,"GenPageId"))}let l=s.childNodes;for(let u=0;u<l.length;u+=1){let c=l[u];c.nodeType===1&&o(c)}};return o(i),a}Bi.collectGenPageIds=Fb;async function Kk(e,t,r){let n=(0,fp.normalizeGuid)(t,"appModuleId");(0,fp.normalizeGuid)(r,"appModuleIdUnique");let i=[],a=[],o=[];await(0,Qk.deleteAppResolvingOnce)(e,n,l=>{l!==void 0&&o.push(...Fb(l))}),i.push({type:"app",id:n});let s=[...new Set(o)].map(l=>({type:"genPage",id:l}));return{success:a.length===0,deleted:i,failures:a,retained:s}}Bi.deleteAppCascade=Kk});var xb={};Rr(xb,{Guid:()=>P});var P,Ue=I(()=>{"use strict";P=class e{guidString;guid;static get EmptyGuid(){return new e("00000000-0000-0000-0000-000000000000")}static NewGuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var r=Math.random()*16|0,n=t=="x"?r:r&3|8;return n.toString(16)})}constructor(t,r=!1){this.guidString=t;let n=new RegExp("[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$");(r||n.test(t))&&(this.guid=t)}ToString(){return this.guid}}});var T,ot=I(()=>{"use strict";Le();T=class e{static get EmptyString(){return""}static IsTrue(t){let r=!1;return r=t&&(this.IsStrictTrue(t)||this.IsYes(t)),r}static IsStrictTrue(t){let r=!1;return t&&(r=t.toLowerCase()==="true"),r}static IsYes(t){return t.toLowerCase()==="yes"||t.toLowerCase()==="y"}static get WhiteSpace(){return/ /g}static get EnglishAndNumericCharacters(){return/([a-z0-9A-Z]+)/g}static get ValidIdExpression(){return/([a-z0-9A-Z_]+)/g}static IsNullOrEmpty(t){return t==null||t==null||t==""}static Format(t,r){return e.IsNullOrEmpty(t)?t:t.replace(/\{\{|\}\}|\{(\d+)\}/g,function(n,i){return n=="{{"?"{":n=="}}"?"}":r[i]})}static EndsWithString(t,r){return t.indexOf(r,t.length-r.length)!==-1}static IsBlankString(t){return t.replace(/\s/g,"").length==0}static EscapeXml(t,r){let n=t;return this.IsNullOrEmpty(n)||(n=n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),r&&(n=n.replace(/"/g,"&quot;").replace(/'/g,"&apos;"))),n}static EscapeDomId(t){return t.replace(".","\\.")}static ToSnakeCase(t){let r=e.EmptyString;for(let n=0;n<t.length;n++)n!==0&&t[n]==t[n].toUpperCase()&&(r+="-"),r+=t[n].toLowerCase();return r}static GetSnakeCaseMarkup(t,r){let n="<"+this.ToSnakeCase(t);if(!E.IsNullOrUndefined(r))for(let i of r.getKeys())n+=" "+this.ToSnakeCase(i)+'="'+r.getValue(i)+'"';return n+">"}static StripBraces(t){return t&&t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?t.substr(1,t.length-2):t}static AddBraces(t){return E.IsNullOrUndefined(t)||t.charAt(0)==="{"||t.charAt(t.length-1)==="}"?t:`{${t}}`}static GuidStringEquals(t,r){return t===r?!0:!t||!r?!1:e.StripBraces(t).toUpperCase()===e.StripBraces(r).toUpperCase()}static AddBracesToArrayValues(t){return t.length>0?t.map(n=>(n.charAt(0)!=="{"&&(n="{"+n),n.charAt(n.length-1)!=="}"&&(n=n+"}"),n)):t}static StripBracesOnArrayValues(t){return t.length>0?t.map(n=>{let i;return n.charAt(0)==="{"&&(i=n.substr(1,n.length-1)),n.charAt(n.length-1)==="}"&&(i=i.substr(0,n.length-2)),i}):t}}});var Lb={};Rr(Lb,{ScriptUtilities:()=>E});var E,Le=I(()=>{"use strict";Ue();ot();E=class e{static IsNullOrUndefined(t){return t==null||t===void 0}static IsMacMachine(){return navigator.platform.indexOf("Mac")!==-1}static IsNullOrEmptyGuid(t){return T.IsNullOrEmpty(t.ToString())?!0:P.EmptyGuid.ToString()===t.ToString()}static IsNullOrUndefinedNested(t,r){return r.split(".").every(i=>typeof t!="object"||t==null||!(i in t)||t[i]==null?!1:(t=t[i],!0))}static ParseXml(t){return new DOMParser().parseFromString(t,"text/xml")}static IsWellFormedXml(t){return!e.ParseXml(t).querySelector("parsererror")}static getNamedItemValue(t,r){let n=t.getNamedItem(r);return e.IsNullOrUndefined(n)?null:n.value}static getBooleanValue(t,r){let n=e.getNamedItemValue(t,r);return e.IsNullOrUndefined(n)?null:T.IsTrue(n)}static getNumericValue(t){return e.IsNullOrUndefined(t)?null:parseInt(t)}static getAllUniqueTagNames(t){let r=new Set;return e.getAllUniqueTagNamesHelper(t,r),r}static getAllUniqueTagNamesHelper(t,r){if(t.nodeType===Node.ELEMENT_NODE&&(r.add(t.tagName),t.hasChildNodes()))for(let n=0;n<t.children.length;n++)this.getAllUniqueTagNamesHelper(t.children.item(n),r)}}});var Al,Cl,jn,Sl,mp,El,hp=I(()=>{"use strict";(function(e){e[e.FormElementNodeChange=0]="FormElementNodeChange",e[e.FormElementAttributeChange=1]="FormElementAttributeChange"})(Al||(Al={}));Cl=class{type;targetNode;constructor(t,r){this.type=t,this.targetNode=r}},jn=class extends Cl{key;oldValue;newValue;constructor(t,r,n,i){super(Al.FormElementNodeChange,t),this.key=r,this.oldValue=n,this.newValue=i}apply(){this.targetNode.replaceObjectPropertyValue(this.key,this.newValue)}revert(){this.targetNode.replaceObjectPropertyValue(this.key,this.oldValue)}},Sl=class extends Cl{property;oldValue;newValue;constructor(t,r,n,i){super(Al.FormElementAttributeChange,t),this.property=r,this.oldValue=n,this.newValue=i}apply(){this.targetNode.replaceAttributeValue(this.property,this.newValue)}revert(){this.targetNode.replaceAttributeValue(this.property,this.oldValue)}},mp=class{changeSet;reversedChangeSet;constructor(t){this.changeSet=t,this.changeSet&&(this.reversedChangeSet=this.changeSet.slice().reverse())}length(){return this.changeSet?this.changeSet.length:0}apply(){this.changeSet&&this.changeSet.length>0&&this.changeSet.forEach(t=>{t.apply()})}revert(){this.reversedChangeSet&&this.reversedChangeSet.length>0&&this.reversedChangeSet.forEach(t=>{t.revert()})}},El=class{isTracking;_trackedChanges;_trackedChangeSets;constructor(t=!1){this.isTracking=t,this._trackedChanges=[],this._trackedChangeSets=[]}addChange(t){this.isTracking&&this._trackedChanges.push(t)}collectChanges(){let t=new mp(this._trackedChanges.slice());return this._trackedChanges=[],t}pushChangeSet(t){this._trackedChangeSets.push(t)}popChangeSet(){if(this._trackedChangeSets?.length>0)return this._trackedChangeSets.pop()}getChangeSets(){return this._trackedChangeSets}}});var kb={};Rr(kb,{ChartGridMode:()=>Bt,ColumnLayoutWidths:()=>rM,ComponentCategory:()=>Dl,ComponentType:()=>gp,ControlLayoutTypes:()=>Sp,DisplayConditionsInfo:()=>eM,ElementNames:()=>v,ElementProperties:()=>m,ElementType:()=>yp,EntityAttributeProperty:()=>bp,EventType:()=>yo,FormActivationState:()=>Cp,FormCanvasServiceScope:()=>mM,FormDesignerSideBarTab:()=>vp,FormPresentation:()=>wp,FormState:()=>Nl,FormType:()=>Be,HeaderDensityType:()=>yn,LookUpTable:()=>yr,MORE_TAB_PREFIX:()=>iM,NavBarChildElementType:()=>Ap,PREVIEW_ID_HEADER_FLYOUT:()=>lM,PREVIEW_ID_HEADER_OVERFLOW_BUTTON:()=>cM,PREVIEW_ID_NAVIGATION_AREA:()=>oM,PREVIEW_ID_QUICKCREATE_ROOT:()=>pM,PREVIEW_ID_TAB:()=>dM,PREVIEW_ID_TAB_LIST:()=>uM,PREVIEW_ID_TAB_PANEL:()=>sM,PropertyModelKeys:()=>Dp,PropertyModelSectionKeys:()=>nM,RELATED_TAB_ID:()=>Ip,RELATED_TAB_PREFIX:()=>aM,SectionDefaultProperties:()=>tM,SectionLayoutTypes:()=>Se,TabContentType:()=>Ep,TabDefaultProperties:()=>bn,TabLayoutTypes:()=>Ce,TelemetryPropertyNames:()=>fM,UnboundControlPropertyKeys:()=>Np,compositeAddressFields:()=>Zk,compositeFieldNames:()=>Ot,compositeFields:()=>Yk});var Be,gp,vp,v,m,yp,Ot,Yk,Zk,bp,yr,Nl,yn,wp,eM,Ap,Cp,Ce,tM,bn,Se,Sp,Ep,rM,Np,Dp,nM,yo,Bt,Ip,iM,aM,oM,sM,lM,uM,cM,dM,pM,fM,Dl,mM,K=I(()=>{"use strict";(function(e){e[e.Dashboard=0]="Dashboard",e[e.AppointmentBook=1]="AppointmentBook",e[e.Main=2]="Main",e[e.MiniCampaignBO=3]="MiniCampaignBO",e[e.Preview=4]="Preview",e[e.MobileExpress=5]="MobileExpress",e[e.QuickViewForm=6]="QuickViewForm",e[e.QuickCreate=7]="QuickCreate",e[e.Dialog=8]="Dialog",e[e.TaskFlowForm=9]="TaskFlowForm",e[e.InteractionCentricDashboard=10]="InteractionCentricDashboard",e[e.Card=11]="Card",e[e.MainInteractiveExperience=12]="MainInteractiveExperience",e[e.Other=100]="Other",e[e.MainBackup=101]="MainBackup",e[e.AppointmentBookBackup=102]="AppointmentBookBackup",e[e.PowerBIDashboard=103]="PowerBIDashboard"})(Be||(Be={}));(function(e){e[e.Form=0]="Form",e[e.Dialog=1]="Dialog"})(gp||(gp={}));(function(e){e[e.Components=0]="Components",e[e.Properties=1]="Properties",e[e.Relationship=2]="Relationship",e[e.BusinessRules=3]="BusinessRules"})(vp||(vp={}));(function(e){e.form="form",e.formTab="tab",e.formColumn="column",e.formSection="section",e.formRow="row",e.formCell="cell",e.formLabel="label",e.formControl="control",e.formEvent="event",e.dependency="dependency",e.queryStringParameter="querystringparameter",e.controlDescriptions="controlDescriptions",e.controlDescription="controlDescription",e.customControl="customControl",e.dataset="data-set",e.formFooter="footer",e.formHeader="header",e.formNavigation="Navigation",e.formTabs="tabs",e.formColumns="columns",e.formSections="sections",e.formRows="rows",e.formEvents="events",e.quickFormDependencies="externaldependencies",e.controlParameters="parameters",e.formDependencies="dependencies",e.formNavBarAreas="NavBarAreas",e.formNavBarArea="NavBarArea",e.formNavBar="NavBar",e.spacerControl="SpacerControl",e.formField="Field",e.formNavBarByRelationshipItem="NavBarByRelationshipItem",e.formNavBarItem="NavBarItem",e.Title="Title",e.Titles="Titles",e.NavigationLink="Navigation Link",e.Relationship="Relationship",e.NavigationLinkIconClass="mscrm-glyph-NavLinkIcon",e.formDisplayConditions="DisplayConditions",e.formLibraries="formLibraries",e.internalLibraries="internaljscriptfile",e.eventHandlers="Handlers",e.handler="Handler",e.library="Library",e.formRoles="Role",e.formEveryOne="Everyone",e.Handler="Handler",e.EventHandlers="Handlers",e.InternalEventHandlers="InternalHandlers",e.HiddenControl="hiddencontrols",e.EventDependencies="dependencies",e.EventDependency="dependency",e.isvisibleinmocaonly="msinternal.isvisibleinmocaonly"})(v||(v={}));m={ShowImage:"showImage",ShowNavigationbar:"shownavigationbar",MaxWidth:"maxWidth",HeaderDensityType:"headerdensity",OnLoadEvent:"onload",EventActive:"active",EventAttribute:"attribute",Relationship:"relationship",Control:"control",HandlerUniqueId:"handlerUniqueId",functionName:"functionName",libraryNameEventHandler:"libraryName",enabledForField:"enabled",passExecutionContext:"passExecutionContext",parameters:"parameters",eventFunctionName:"eventFunctionName",eventEnabled:"eventEnabled",indicationOfSubgrid:"indicationOfSubgrid",Name:"name",Type:"type",TitleResourceId:"TitleResourceId",Show:"Show",RelationshipName:"RelationshipName",Sequence:"Sequence",Area:"Area",headerPrefix:"header_",application:"application",labelId:"labelid",showbar:"showbar",layout:"layout",classid:"classid",uniqueid:"uniqueid",isUnbound:"isunbound",isRequired:"isrequired",rowspan:"rowspan",rowheight:"rowheight",colspan:"colspan",width:"width",IsUserDefined:"IsUserDefined",expanded:"expanded",related:"related",showlabel:"showlabel",locklevel:"locklevel",datafieldname:"datafieldname",formFactor:"formFactor",static:"static",disabled:"disabled",description:"description",languagecode:"languagecode",LCID:"LCID",groupName:"group",contentType:"contenttype",showCommandBar:"showcommandbar",showBody:"showbody",showTabNavigator:"showtabnavigator",userspacer:"userspacer",columnName:"columns",LabelWidth:"labelwidth",Fieldlabelalignment:"celllabelalignment",Fieldlabelposition:"celllabelposition",availableforphone:"availableforphone",Locked:"bLocked",ReadOnly:"bDisabled",visible:"visible",ForControl:"forControl",text:"Text",url:"Url",passParameters:"PassParameters",autoExpand:"AutoExpand",auto:"auto",Auto:"Auto",Fixed:"Fixed",icon:"Icon",id:"id",Id:"Id",showOnMobileClient:"ShowOnMobileClient",webResourceId:"WebResourceId",viewName:"ViewName",failureTimeField:"FailureTimeField",successCondition:"SuccessConditionName",successConditionValue:"SuccessConditionValue",failureCondition:"FailureConditionName",failureConditionValue:"FailureConditionValue",warningCondition:"WarningConditionName",warningConditionValue:"WarningConditionValue",cancelCondition:"CancelConditionName",cancelConditionValue:"CancelConditionValue",pauseCondition:"PauseConditionName",pauseConditionValue:"PauseConditionValue",filterResults:"FilterResults",autoSuggestionSource:"AutoSuggestionSource",numberOfResults:"NumberOfResults",addressField:"AddressField",displayAsCustomer360Tile:"DisplayAsCustomer360Tile",hideQuickFormBorder:"HideQuickFormBorder",quickForms:"QuickForms",entityName:"EntityName",controlMode:"ControlMode",headerColorCode:"HeaderColorCode",targetEntityType:"TargetEntityType",enableQuickFind:"EnableQuickFind",enableViewPicker:"EnableViewPicker",enableChartPicker:"EnableChartPicker",recordsPerPage:"RecordsPerPage",chartGridMode:"ChartGridMode",referencePanelSubgridIconUrl:"ReferencePanelSubgridIconUrl",referencePanelQuickFormCollectionIconUrl:"ReferencePanelQuickFormCollectionIconUrl",referencePanelSearchWidgetIconUrl:"ReferencePanelSearchWidgetIconUrl",viewId:"ViewId",isUserView:"IsUserView",enableJumpBar:"EnableJumpBar",isUserChart:"IsUserChart",viewIds:"ViewIds",filteredViewIds:"FilteredViewIds",visualizationId:"VisualizationId",teamTemplateId:"TeamTemplateId",selectDefaultLanguage:"SelectDefaultLanguage",allowChangingFiltersOnUI:"AllowChangingFiltersOnUI",enableAutoSuggestions:"EnableAutoSuggestions",enableRating:"EnableRating",searchForAutoSuggestionsUsing:"SearchForAutoSuggestionsUsing",showContextualActions:"ShowContextualActions",showDepartmentFilter:"ShowDepartmentFilter",showLanguageFilter:"ShowLanguageFilter",showRatingUsing:"ShowRatingUsing",actionList:"ActionList",Order:"Order",FallbackForm:"FallbackForm",allowSearchFilter:"allowSearchFilter",socialInstanceParameters:"<Parameters>k__BackingField",signalUrl:"SignalUrl",border:"Border",scrolling:"Scrolling",security:"Security",BingMapsAddress1Composite:"address1_composite",BingMapsAddress2Composite:"address2_composite",UrlHttpsProtocolPrefix:"https://",UrlHttpProtocolPrefix:"http://",showAll:"ShowAll",ShowFilterPane:"UClientShowFilterPane",ExpandFilterPane:"UClientExpandFilterPane",SortOption:"UClientOrderBy",DefaultModuleCreateExperience:"UClientDefaultModuleForCreateExperience",RecordPerPages:"UClientRecordPerPage",moduleList:"UClientModules",showAllModule:"Show All",showSelectedModule:"Show Selected",Ascending:"Ascending",Descending:"Descending",Activities:"Activities",Posts:"Posts",Notes:"Notes",CardForm:"CardForm",SelectActivity:"SelectActivity",DisplayActivity:"UClientDisplayActivityUsing",CreateActivity:"UClientCreateActivityUsing",DisplayActivityHeader:"UClientDisplayActivityHeaderUsing",SortTimeLine:"UClientSortActivitiesByValue",activityList:"UClientActivities",CardActivityMap:"UClientActivityCardMap",DefaultTabId:"DefaultTabId",EmailConversationView:"EmailConversationView",OrderByActivityWall:"OrderByActivityWall",ShowArticleTab:"ShowArticleTab",SortActivityWall:"SortActivityWall",TimelineUniqueName:"UClientUniqueName",SortTimeLineBy:"modifiedon",SelectActivityListDefault:"appointment",SelectCardDefault:"Select Card Form",AscendingValue:"ascending",DescendingValue:"descending",DefaultTabIdValue:"ActivitiesTab",EmailConversationViewDefault:"true",ShowArticleTabDefault:"false",SelectDefaultLanguage:"SelectDefaultLanguage",SelectDefaultLanguageValue:"00000000-0000-0000-0000-000000000000",SortActivityWallDefault:"modifiedon",RecordPerPagesDefault:"10",TimelineNameLabel:"Timeline",showSelectedActions:"Show Selected",defaultFormat:"defaultformat",fieldLabels:"fieldlabels",QuickCreateForm:"quickcreateform",QuickFormNameToIdXMLTempate:"<QuickFormId e,yname={0}>{1}</QuickFormId>",QuickFormIdListXMLTempate:"<QuickFormId,}</QuickFormIds>",AllowFilterOff:"AllowFilterOff",AutoResolve:"AutoResolve",DefaultViewId:"DefaultViewId",DependentAttributeName:"DependentAttributeName",DependentAttributeType:"DependentAttributeType",DisableMru:"DisableMru",UseMFDForCreate:"useMainFormDialogForCreate",UseMFDForEdit:"useMainFormDialogForEdit",DisableQuickFind:"DisableQuickFind",DisableViewPicker:"DisableViewPicker",FilterRelationshipName:"FilterRelationshipName",AvailableViewIds:"AvailableViewIds",MainForm:"mainform",DefaultsFields:"defaultfields",TimeLineCardForm:"cardform",libraryUniqueId:"libraryUniqueId",libraryName:"name",displayName:"displayName",OnChangeEvent:"onchange",ViewIdRAControlDefault:"{92AFD454-0F2E-4397-A1C8-05E37C6AD699}",TargetEntityTypeRAControlDefault:"actioncard",ChartGridModeRAControlDefault:"All",RecordsPerPageRAControlDefault:"4",RAControlDefaultValue:"false",RAcontrolDefaultHeaderColorCode:"#000000",DropdownSelectedDefaultValue:"1",selectPrimaryCustomer:"SelectPrimaryCustomer",bindAttribute:"BindAttribute"};(function(e){e[e.TAB=0]="TAB",e[e.SECTION=1]="SECTION",e[e.BASIC_CONTROL=2]="BASIC_CONTROL",e[e.HEADER=3]="HEADER",e[e.FOOTER=4]="FOOTER",e[e.UB_CONTROL=5]="UB_CONTROL",e[e.RELATIONSHIPITEM=6]="RELATIONSHIPITEM",e[e.RELATIONSHIPGROUP=7]="RELATIONSHIPGROUP",e[e.NAVIGATIONLINK=8]="NAVIGATIONLINK",e[e.FORMMODEL=9]="FORMMODEL",e[e.UNDEFINED=10]="UNDEFINED"})(yp||(yp={}));Ot={fullname:"fullname",yomifullname:"yomifullname",address1_composite:"address1_composite",address2_composite:"address2_composite",address3_composite:"address3_composite",billto:"billto_composite",shipto:"shipto_composite"},Yk=[Ot.fullname,Ot.yomifullname,Ot.address1_composite,Ot.address2_composite,Ot.address3_composite,Ot.billto,Ot.shipto],Zk=[Ot.address1_composite,Ot.address2_composite,Ot.address3_composite,Ot.billto,Ot.shipto];(function(e){e[e.IsValidForForm=0]="IsValidForForm",e[e.IsValidForCreate=1]="IsValidForCreate"})(bp||(bp={}));(function(e){e[e.DependencyFieldTable=0]="DependencyFieldTable",e[e.LockedFieldTable=1]="LockedFieldTable"})(yr||(yr={}));(function(e){e[e.Published=0]="Published",e[e.Draft=1]="Draft",e[e.New=2]="New",e[e.SaveAs=3]="SaveAs"})(Nl||(Nl={}));(function(e){e.Low="Low",e.HighReadOnlyValues="HighReadOnlyValues",e.HighWithControls="HighWithControls"})(yn||(yn={}));(function(e){e[e.ClassicForm=0]="ClassicForm",e[e.AirForm=1]="AirForm",e[e.ConvertedICForm=2]="ConvertedICForm"})(wp||(wp={}));eM={TopOrderFormId:"topOrderFormId",NextDisplayOrder:"nextDisplayOrder"};(function(e){e[e.NavBarRelationShipItem=0]="NavBarRelationShipItem",e[e.NavBarItem=1]="NavBarItem"})(Ap||(Ap={}));(function(e){e[e.InActive=0]="InActive",e[e.Active=1]="Active"})(Cp||(Cp={}));(function(e){e[e.ONE_COLUMN=0]="ONE_COLUMN",e[e.TWO_COLUMN_EQUAL=1]="TWO_COLUMN_EQUAL",e[e.TWO_COLUMN_WIDER_LEFT=2]="TWO_COLUMN_WIDER_LEFT",e[e.TWO_COLUMN_WIDER_RIGHT=3]="TWO_COLUMN_WIDER_RIGHT",e[e.TWO_COLUMN_CUSTOM_LAYOUT=4]="TWO_COLUMN_CUSTOM_LAYOUT",e[e.THREE_COLUMN_EQUAL=5]="THREE_COLUMN_EQUAL",e[e.THREE_COLUMN_WIDER_MID=6]="THREE_COLUMN_WIDER_MID",e[e.THREE_COLUMN_CUSTOM_LAYOUT=7]="THREE_COLUMN_CUSTOM_LAYOUT"})(Ce||(Ce={}));tM={ShowLabel:"false",LockLevel:"0",IsUserDefined:"0",LabelWidth:"115",columns:"1",ShowBar:"false",Layout:"varwidth",namePrefix:"_section_"},bn={namePrefix:"tab_",ShowLabel:"true",LockLevel:"0",IsUserDefined:"0"};(function(e){e[e.ONE_COLUMN=0]="ONE_COLUMN",e[e.TWO_COLUMN=1]="TWO_COLUMN",e[e.THREE_COLUMN=2]="THREE_COLUMN",e[e.FOUR_COLUMN=3]="FOUR_COLUMN",e[e.REFERENCE_PANEL=4]="REFERENCE_PANEL"})(Se||(Se={}));(function(e){e[e.SUBGRID=0]="SUBGRID",e[e.SPACER=1]="SPACER",e[e.QUICK_VIEW=2]="QUICK_VIEW",e[e.WEB_RESOURCE=3]="WEB_RESOURCE",e[e.IFRAME=4]="IFRAME",e[e.BING_MAPS=5]="BING_MAPS",e[e.TIMER=6]="TIMER",e[e.TIMELINE=7]="TIMELINE",e[e.NOTES=8]="NOTES",e[e.SOCIAL_INSIGHTS=9]="SOCIAL_INSIGHTS",e[e.KB_SEARCH=10]="KB_SEARCH",e[e.INTERACTION_WALL=11]="INTERACTION_WALL",e[e.ACI_CONTROL=12]="ACI_CONTROL",e[e.RELATIONSHIP_ASSISTANT=13]="RELATIONSHIP_ASSISTANT",e[e.REFERENCE_PANEL=14]="REFERENCE_PANEL",e[e.REF_PANEL_QUICKVIEW=15]="REF_PANEL_QUICKVIEW",e[e.REF_PANEL_SUBGRID=16]="REF_PANEL_SUBGRID",e[e.REF_PANEL_KBSEARCH=17]="REF_PANEL_KBSEARCH",e[e.WEB_RESOURCE_HTML=18]="WEB_RESOURCE_HTML",e[e.PRED_LEAD_SCORING=19]="PRED_LEAD_SCORING"})(Sp||(Sp={}));(function(e){e.cardSections="cardSections",e.singleComponent="singleComponent",e.default="default",e.expandAvailableSpace="expandAvailableSpace"})(Ep||(Ep={}));rM={ONE_COLUMN:"100",TWO_COLUMN:"50",THREE_COLUMN:"33.33",FOUR_COLUMN:"25"};(function(e){e.minValue="MinValue",e.maxValue="MaxValue",e.precision="Precision",e.maxLength="MaxLength",e.entityLogicalName="EntityLogicalName",e.defaultViewId="DefaultViewId",e.optionSetDefaultValue="DefaultValue",e.optionSetId="OptionSetId"})(Np||(Np={}));(function(e){e.entityName="entityName",e.formName="formName",e.formDisplayName="formDisplayName",e.description="description",e.maxWidth="maxWidth",e.showNavigation="showNavigation",e.showImageCheck="showImageCheck",e.downloadFormXml="downloadFormXml",e.downloadRawFormXml="downloadRawFormXml",e.expandTab="expandTab",e.singleComponent="singleComponent",e.label="label",e.name="name",e.hiddenByDefault="hiddenByDefault",e.hideForPhone="hideForPhone",e.tabLayout="tabLayout",e.column1Width="column1Width",e.column2Width="column2Width",e.column3Width="column3Width",e.hideLabel="hideLabel",e.lockElement="lockElement",e.sectionLayout="sectionLayout",e.labelWidth="labelWidth",e.fieldLabelAlignment="fieldLabelAlignment",e.fieldLabelPosition="fieldLabelPosition",e.cellWidth="cellWidth",e.fieldHeight="fieldHeight",e.cellHeight="cellHeight",e.showLine="showLine",e.readonly="readonly",e.required="required",e.maxLength="maxLength",e.isTitle="isTitle",e.minValue="minValue",e.maxValue="maxValue",e.precision="precision",e.autoExpand="autoExpand",e.highDensityEnabled="highDensityEnabled",e.hideExtendedHeader="hideExtendedHeader",e.defaultViewProperty="defaultViewProperty",e.defaultChartProperty="defaultChartProperty",e.teamTemplateProperty="teamTemplateProperty",e.datasourceProperty="datasourceProperty",e.eventType="eventType",e.addEvent="addEvent",e.cellOnChange="cellOnChange",e.cellOnChangeEventDependencies="cellOnChangeEventDependencies",e.cellOnChangeHandlers="cellOnChangeHandlers",e.gridOnChange="gridOnChange",e.gridOnChangeEventDependencies="gridOnChangeEventDependencies",e.gridOnChangeHandlers="gridOnChangeHandlers",e.gridOnChangeTargetField="gridOnChangeTargetField",e.gridOnRecordSelect="gridOnRecordSelect",e.gridOnRecordSelectEventDependencies="gridOnRecordSelectEventDependencies",e.gridOnRecordSelectHandlers="gridOnRecordSelectHandlers",e.cellOnReadyStateEventDependencies="cellOnReadyStateEventDependencies",e.cellOnReadyStateHandlers="cellOnReadyStateEventHandlers",e.tabOnChange="tabOnChange",e.tabOnChangeEventDependencies="tabOnChangeEventDependencies",e.tabOnChangeHandlers="tabOnChangeHandlers",e.formOnLoad="formOnLoad",e.formOnLoadEventDependencies="formOnLoadEventDependencies",e.formOnLoadHandlers="formOnLoadHandlers",e.formOnSave="formOnSave",e.formOnSaveDependencies="formOnSaveDependencies",e.formOnSaveHandlers="formOnSaveHandlers",e.gridOnSave="gridOnSave",e.gridOnSaveDependencies="gridOnSaveDependencies",e.gridOnSaveHandlers="gridOnSaveHandlers",e.formHasNoLibraries="formHasNoLibraries",e.hideHeaderCommandBar="hideHeaderCommandBar",e.hideHeaderBody="hideHeaderBody",e.hideHeaderTabNavigator="hideHeaderTabNavigator",e.hideFooter="hideFooter",e.scrollingDropdown="scrollingDropdown",e.displayBorder="displayBorder",e.crossScripting="crossScripting",e.passParams="passParams",e.webResourceCustomParamData="webResourceCustomParameterData",e.webResourceAltText="webResourceAltText",e.verticalAlignment="verticalAlignment",e.horizontalAlignment="horizontalAlignment",e.specificSize="specificSize",e.urlProperty="urlProperty",e.enableViewPicker="enableViewPicker",e.enableChartPicker="enableChartPicker",e.chartGridMode="chartGridMode",e.relatedRecords="relatedRecords",e.hideSearchBox="hideSearchBox",e.showAllViews="showAllViews",e.availableViewsProperty="availableViewsProperty",e.recordsPerPage="recordsPerPage",e.businessRulePill="business-rule-pill-",e.addBusinessRule="addBusinessRule",e.rowHeight="rowHeight",e.refPanelSectionTabs="refPanelSectionTabs",e.editCanvasAppProperty="editCanvasAppProperty"})(Dp||(Dp={}));nM={display:"DisplayOptions",format:"Formatting",control:"Controls",data:"DataOptions",form:"FormProperties",events:"EventProperties",activeBusinessRules:"activeBusinessRules",addBusinessRule:"addBusinessRule",inactiveBusinessRules:"inactiveBusinessRules"};(function(e){e.onChange="onchange",e.onTabStateChange="tabstatechange",e.onLoad="onload",e.onSave="onsave",e.onReadyStateComplete="onreadystatecomplete",e.onRecordSelect="onrecordselect"})(yo||(yo={}));(function(e){e.All="All",e.Chart="Chart",e.Grid="Grid"})(Bt||(Bt={}));Ip="tab_related3b554255-7717-4d17-bb7f-9936fb1e75ca",iM="more_tab_",aM="related_tab_",oM="preview_id_navigation_area",sM="tab-section",lM="headerFieldsFlyout",uM="tablist",cM="header_overflowButton",dM="tab",pM="quickCreateRoot",fM={defaultVisibility:"Default visibility"};(function(e){e.input="input",e.layout="layout",e.grid="grid",e.relatedData="relatedData",e.display="display",e.powerbi="powerbi",e.artificialIntelligence="artificialIntelligence",e.media="media",e.collaboration="collaboration",e.more="more",e.test="test",e.popular="popular"})(Dl||(Dl={}));mM="CellCanvasServiceScope"});var Mb={};Rr(Mb,{Attribute:()=>Il,FormElementNode:()=>j});var Il,j,Qe=I(()=>{"use strict";Le();ot();hp();K();Ue();Il=class{key;value;constructor(t,r){this.key=t,this.value=r}},j=class e{nodeName;properties;childrenNodes;parentNode;nodeId;isTransient;constructor(t,r){this.nodeName=t,this.properties=[],this.childrenNodes=[],this.parentNode=r,this.isTransient=!1,this.nodeId=`nodeId-${P.NewGuid()}`}getProperty(t){for(let r of this.properties)if(r.key===t)return r.value;return null}getNodeId(){return this.nodeId}getNodeName(){return this.nodeName}setNodeName(t){this.trackObjectPropertyChange("nodeName",t)}get NodeName(){return this.getNodeName()}getAllProperties(){return this.properties}replaceAttributeValue(t,r){this.properties.find(n=>n===t)&&(t.value=r)}replaceObjectPropertyValue(t,r){this[t]=r}getAllChildren(){return this.childrenNodes}getParentNode(){return this.parentNode}visit(t){let r=!1;if(t){r=!!t(this);let n=this.childrenNodes;if(!r&&n)for(let i=0;!r&&i<n.length;i++)r=n[i].visit(t)}return r}findAll(t){let r=[];return t&&this.visit(n=>{t(n)&&r.push(n)}),r}findFirst(t){let r=null;return t&&this.visit(n=>{if(t(n))return r=n,!0}),r}raiseMetadataChange(t){let r=this.getAncestor(v.form);r&&r.raiseMetadataChange(t)}trackPropertyAddition(t,r){this.trackPropertyCollectionChange(()=>{this.properties.push(new Il(t,r))})}trackPropertyDeletion(t){this.trackPropertyCollectionChange(()=>{let r=this.properties.findIndex(n=>n.key===t);r>-1&&this.properties.splice(r,1)})}trackPropertyCollectionChange(t){let r=this.changeTracker();if(r&&r.isTracking){let n=this.properties.slice();t(),r.addChange(new jn(this,"properties",n,this.properties.slice()))}else t()}trackChildrenCollectionChange(t){let r=this.changeTracker();if(r&&r.isTracking){let n=this.childrenNodes.slice();t(),r.addChange(new jn(this,"childrenNodes",n,this.childrenNodes.slice()))}else t()}trackParentNodeChange(t){let r=this.changeTracker();if(r&&r.isTracking){let n=this.parentNode;if(t(),n===this.parentNode)return;r.addChange(new jn(this,"parentNode",n,this.parentNode))}else t()}trackAttributeValueChange(t,r){let n=this.changeTracker();if(n&&n.isTracking){let i=t.value;if(i===r)return;t.value=r,n.addChange(new Sl(this,t,i,r))}else t.value=r}trackObjectPropertyChange(t,r){let n=this.changeTracker();if(n&&n.isTracking){let i=this[t];if(i===r)return;this[t]=r,n.addChange(new jn(this,t,i,r))}else this[t]=r}setProperty(t,r){if(!t)throw new Error("Invalid property key");let n=this.properties.find(i=>i.key===t);n?this.trackAttributeValueChange(n,r):this.addProperty(t,r)}addProperty(t,r){if(!t)throw new Error("Invalid property key");this.trackPropertyAddition(t,r)}removeProperty(t){this.trackPropertyDeletion(t)}addChild(t){t.trackParentNodeChange(()=>{t.parentNode=this}),this.trackChildrenCollectionChange(()=>{this.childrenNodes.push(t)})}insertChildAtIndex(t,r){E.IsNullOrUndefined(t)||(t.trackParentNodeChange(()=>{t.parentNode=this}),this.trackChildrenCollectionChange(()=>{this.childrenNodes.splice(r,0,t)}))}moveChild(t,r){let n=this.childrenNodes.indexOf(t);if(n<0)return!1;let i=Math.min(Math.max(0,n+r),this.childrenNodes.length-1);return n!==i&&this.trackChildrenCollectionChange(()=>{this.childrenNodes.splice(i,0,this.childrenNodes.splice(n,1)[0])}),!0}getChildren(t){let r=[];for(let n of this.childrenNodes)n.nodeName===t&&r.push(n);return r}getFirstChild(t){for(let r of this.childrenNodes)if(r.nodeName===t)return r;return null}getAllGrandChildren(t){let r=this.getChildren(t),n=null;return r.length===0?new Array:(n=r[0],n.childrenNodes)}deleteChild(t){if(E.IsNullOrUndefined(t))return-1;for(let r=0;r<this.childrenNodes.length;r++)if(this.childrenNodes[r]===t)return this.trackChildrenCollectionChange(()=>{this.childrenNodes.splice(r,1)}),r;return-1}deleteAllChildren(){this.trackChildrenCollectionChange(()=>{this.childrenNodes=[]})}getParent(){return this.parentNode}getParentType(){return this.parentNode?this.parentNode.nodeName:T.EmptyString}updateChild(t,r){let n=this.childrenNodes.indexOf(t);return n>-1?(r.trackParentNodeChange(()=>{r.parentNode=this}),this.trackChildrenCollectionChange(()=>{this.childrenNodes.splice(n,1,r)}),!0):!1}getAncestor(t){let r=this.getParent(),n=this.getParentType();for(;r;){if(n===t)return r;n=r.getParentType(),r=r.getParent()}return null}deleteFirstGrandChildOfName(t,r){return this.getChildren(t)[0].deleteChild(r)}deleteChildren(t,r){r=E.IsNullOrUndefined(r)?this.childrenNodes.length:r,this.trackChildrenCollectionChange(()=>{this.childrenNodes.splice(t,r)})}deleteGrandChildren(t,r,n){this.getChildren(t)[0].deleteChildren(r,n)}addGrandChild(t,r){let n=this.getChildren(t),i=null;n.length===0?(i=new e(t,this),this.addChild(i)):i=n[0],i.addChild(r)}addGrandChildAtIndex(t,r,n){let i=this.getChildren(t),a=null;i.length===0?(a=new e(t,this),this.addChild(a)):a=i[0],a.insertChildAtIndex(r,n)}GetPropertyByParameter(t){return this.getProperty(t)}getSemanticParent(){switch(this.getNodeName()){case v.formCell:let t=this.getAncestor(v.formSection);return t||(t=this.getAncestor(v.formHeader),t)||(t=this.getAncestor(v.formFooter),t)?t:null;case v.formSection:return this.getAncestor(v.formTab);case v.formTab:return this.getAncestor(v.form);default:return null}}isDirty(){return this.visit(t=>t.isInChangeSet())}isInChangeSet(){return this.changeTracker().getChangeSets().some(r=>r.changeSet.some(n=>n.targetNode.getNodeId()===this.getNodeId()))}changeTracker(){let t=this.getAncestor(v.form);return t?t.changeTracker():null}}});var Ub={};Rr(Ub,{ControlClassId:()=>S,ControlNamePrefixes:()=>_l,getControlDisplayNames:()=>hM});function hM(e){return{[S.AccessPrivilegeControl]:e("controls.controlNames.accessPrivilege"),[S.AccessTeamTablePickerControl]:e("controls.controlNames.accessTeamTablePicker"),[S.ACIControl]:e("controls.controlNames.aci"),[S.ActivitiesContainerControl]:e("controls.controlNames.activitiesContainer"),[S.ActivitiesWallControl]:e("controls.controlNames.activitiesWall"),[S.AppliedFiltersControl]:e("controls.controlNames.appliedFilters"),[S.ArticleContentControl]:e("controls.controlNames.articleContent"),[S.BooleanControl]:e("controls.controlNames.twoOption"),[S.ButtonControl]:e("controls.controlNames.button"),[S.CheckboxControl]:e("controls.controlNames.checkbox"),[S.CompositionLinkControl]:e("controls.controlNames.compositionLink"),[S.ConnectionControl]:e("controls.controlNames.connection"),[S.ConnectionRoleObjectTypeListControl]:e("controls.controlNames.connectionRoleObjectTypeList"),[S.CoverageChoiceControl]:e("controls.controlNames.coverageChoice"),[S.DashboardControl]:e("controls.controlNames.dashboard"),[S.DynamicPropertyListControl]:e("controls.controlNames.dynamicPropertyList"),[S.EditFilterControl]:e("controls.controlNames.editFilter"),[S.ErrorStatusControl]:e("controls.controlNames.errorStatus"),[S.GlobalFilterControl]:e("controls.controlNames.globalFilter"),[S.HiddenInputControl]:e("controls.controlNames.hiddenInput"),[S.KBViewerControl]:e("controls.controlNames.kbViewer"),[S.LabelControl]:e("controls.controlNames.label"),[S.MailMergeLanguagePickerControl]:e("controls.controlNames.mailMergeLanguagePicker"),[S.MapLinkControl]:e("controls.controlNames.mapLink"),[S.OrgInsightsControl]:e("controls.controlNames.orgInsights"),[S.ChoiceLookupControl]:e("controls.controlNames.choiceLookup"),[S.PowerBIControl]:e("controls.controlNames.powerBI"),[S.ProcessControl]:e("controls.controlNames.process"),[S.RelatedInformationControl]:e("controls.controlNames.relatedInformation"),[S.RelationshipRoleChoiceControl]:e("controls.controlNames.relationshipRoleChoice"),[S.ReportControl]:e("controls.controlNames.report"),[S.StreamsControl]:e("controls.controlNames.streams"),[S.WebResourceSilverlightControl]:e("controls.controlNames.webResourceSilverlight"),[S.CurrencyControl]:e("controls.controlNames.currency"),[S.DateTimeControl]:e("controls.controlNames.dateAndTime"),[S.DecimalControl]:e("controls.controlNames.decimal"),[S.DurationControl]:e("controls.controlNames.duration"),[S.EmailAddressControl]:e("controls.controlNames.email"),[S.FileControl]:e("controls.controlNames.file"),[S.FloatingNumberControl]:e("controls.controlNames.floatingNumber"),[S.IframeControl]:e("controls.controlNames.iframe"),[S.ImageControl]:e("controls.controlNames.image"),[S.LookupControl]:e("controls.controlNames.lookup"),[S.MapsControl]:e("controls.controlNames.maps"),[S.PhoneNumberControl]:e("controls.controlNames.phoneNumber"),[S.ChoiceControl]:e("controls.controlNames.choice"),[S.QuickViewControl]:e("controls.controlNames.quickView"),[S.QuickFormControl]:e("controls.controlNames.quickForm"),[S.CustomControl]:e("controls.controlNames.customControl"),[S.SearchWidgetControl]:e("controls.controlNames.searchWidget"),[S.SocialInsightsControl]:e("controls.controlNames.socialInsights"),[S.SubgridControl]:e("controls.controlNames.subgrid"),[S.TextAreaControl]:e("controls.controlNames.textArea"),[S.TextboxControl]:e("controls.controlNames.textBox"),[S.TickerControl]:e("controls.controlNames.ticker"),[S.UrlControl]:e("controls.controlNames.url"),[S.WebResourceHTMLControl]:e("controls.controlNames.webResourceHTML"),[S.WebResourceImageControl]:e("controls.controlNames.webResourceImage"),[S.IntegerControl]:e("controls.controlNames.integer"),[S.TimerControl]:e("controls.controlNames.timer"),[S.TimelineControl]:e("controls.controlNames.timeline"),[S.EmailBodyControl]:e("controls.controlNames.emailBody"),[S.PartyListControl]:e("controls.controlNames.partyList"),[S.TimezoneControl]:e("controls.controlNames.timezone"),[S.LanguageControl]:e("controls.controlNames.language"),[S.ChoiceStatusControl]:e("controls.controlNames.choiceStatus"),[S.ChoicesControl]:e("controls.controlNames.choices"),[S.RegardingControl]:e("controls.controlNames.regarding"),[S.EmailEngagementActionsControl]:e("controls.controlNames.emailEngagementActions"),[S.EmailRecipientActivityControl]:e("controls.controlNames.emailRecipientActivity"),[S.ReferencePanelSearchWidgetControl]:e("controls.controlNames.referencePanelSearchWidget"),[S.ReferencePanelQuickViewControl]:e("controls.controlNames.referencePanelQuickView"),[S.ReferencePanelSubgridControl]:e("controls.controlNames.referencePanelSubgrid"),[S.KBEditorControl]:e("controls.controlNames.KBEditor"),[S.LinkControl]:e("controls.controlNames.link")}}var S,_l,Hn=I(()=>{"use strict";(function(e){e.AccessPrivilegeControl="F93A31B2-99AC-4084-8EC2-D4027C31369A",e.AccessTeamTablePickerControl="3f4e2a56-f102-4b4d-ab9c-f1574ca5bfda",e.ACIControl="C8BFBBEF-6851-4401-A0CC-7450062FE085",e.ActivitiesContainerControl="C72511AB-84E5-4FB7-A543-25B4FC01E83E",e.ActivitiesWallControl="6636847D-B74D-4994-B55A-A6FAF97ECEA2",e.AppliedFiltersControl="9C310A73-A360-42C5-8943-47A06F1B51EA",e.ArticleContentControl="F02EF977-2564-4B9A-B2F0-DF083D8A019B",e.BooleanControl="67FAC785-CD58-4F9F-ABB3-4B7DDC6ED5ED",e.ButtonControl="00AD73DA-BD4D-49C6-88A8-2F4F4CAD4A20",e.CheckboxControl="B0C6723A-8503-4FD7-BB28-C8A06AC933C2",e.CompositionLinkControl="DB1284EF-9FFC-4E99-B382-0CC082FE2364",e.ConnectionControl="3246F906-1F71-45F7-B11F-D7BE0F9D04C9",e.ConnectionRoleObjectTypeListControl="821ACF1A-7E46-4A0C-965D-FE14A57D78C7",e.CoverageChoiceControl="4168A05C-D857-46AF-8457-5BB47EB04EA1",e.DashboardControl="D2561F53-B292-42D9-B222-478E40FFE29F",e.DynamicPropertyListControl="6896F004-B17A-4202-861E-8B7EA2080E0B",e.EditFilterControl="1479835F-F852-4679-B864-C6892A2844C9",e.ErrorStatusControl="F4C16ECA-CA81-4E39-9448-834B8378721E",e.GlobalFilterControl="FFF0E632-9D7B-4F21-BBC1-05D1567AD144",e.HiddenInputControl="5546E6CD-394C-4BEE-94A8-4425E17EF6C6",e.KBViewerControl="A62B6FA9-169E-406C-B1AA-EAB828CB6026",e.LabelControl="39354E4A-5015-4D74-8031-EA9EB73A1322",e.MailMergeLanguagePickerControl="B634828E-C390-444A-AFE6-E07315D9D970",e.MapLinkControl="91DC0675-C8B9-4421-B1E0-261CEBF02BAC",e.OrgInsightsControl="76b9e25e-695e-4fef-ac69-f05cfa96739c",e.ChoiceLookupControl="2305e33a-bad3-4022-9e15-1856cf218333",e.PowerBIControl="8C54228C-1B25-4909-A12A-F2B968BB0D62",e.ProcessControl="06E9F7AF-1F54-4681-8EEC-1E21A1CEB465",e.RelatedInformationControl="163B90A6-EB64-49D2-9DF8-3C84A4F0A0F8",e.RelationshipRoleChoiceControl="5F986642-5961-4D9F-AB5E-643D71E231E9",e.ReportControl="A28F441B-916C-4865-87FD-0C5D53BD59C9",e.StreamsControl="EE9078C8-6946-4E2C-B8F8-35E65F4BE6A8",e.WebResourceSilverlightControl="080677DB-86EC-4544-AC42-F927E74B491F",e.CurrencyControl="533B9E00-756B-4312-95A0-DC888637AC78",e.CustomControl="F9A8A302-114E-466A-B582-6771B2AE0D92",e.DateTimeControl="5B773807-9FB2-42DB-97C3-7A91EFF8ADFF",e.DecimalControl="C3EFE0C3-0EC6-42BE-8349-CBD9079DFD8E",e.DurationControl="AA987274-CE4E-4271-A803-66164311A958",e.EmailAddressControl="ADA2203E-B4CD-49BE-9DDF-234642B43B52",e.EmailBodyControl="6F3FB987-393B-4D2D-859F-9D0F0349B6AD",e.EmailEngagementActionsControl="F454228D-1D25-4319-E12F-D27968BC0234",e.EmailRecipientActivityControl="26E9760F-7454-40DE-BB07-F6DCCCB82040",e.FileControl="0A7FF475-B016-4687-9CE5-042BFDBD6519",e.FloatingNumberControl="0D2C745A-E5A8-4C8F-BA63-C6D3BB604660",e.IframeControl="FD2A7985-3187-444E-908D-6624B21F69C0",e.ImageControl="7E548B0D-209C-477B-9DCD-F0F44472381D",e.LanguageControl="671A9387-CA5A-4D1E-8AB7-06E39DDCF6B5",e.LookupControl="270BD3DB-D9AF-4782-9025-509E298DEC0A",e.MapsControl="62B0DF79-0464-470F-8AF7-4483CFEA0C7D",e.ChoicesControl="4AA28AB7-9C13-4F57-A73D-AD894D048B5F",e.IntegerControl="C6D124CA-7EDA-4A60-AEA9-7FB8D318B68F",e.PartyListControl="CBFB742C-14E7-4A17-96BB-1A13F7F64AA2",e.PhoneNumberControl="8C10015A-B339-4982-9474-A95FE05631A5",e.ChoiceControl="3EF39988-22BB-4F0B-BBBE-64B5A3748AEE",e.ChoiceStatusControl="5D68B988-0661-4DB2-BC3E-17598AD3BE6C",e.QuickViewControl="5C5600E0-1D6E-4205-A272-BE80DA87FD42",e.QuickFormControl="69AF7DCA-2E3B-4EE7-9201-0DA731DD2413",e.RegardingControl="F3015350-44A2-4AA0-97B5-00166532B5E9",e.SearchWidgetControl="E616A57F-20E0-4534-8662-A101B5DDF4E0",e.SocialInsightsControl="86B9E25E-695E-4FEF-AC69-F05CFA96739C",e.SubgridControl="E7A81278-8635-4D9E-8D4D-59480B391C5B",e.TextAreaControl="E0DECE4B-6FC8-4A8F-A065-082708572369",e.TextboxControl="4273EDBD-AC1D-40D3-9FB2-095C621B552D",e.TickerControl="1E1FC551-F7A8-43AF-AC34-A8DC35C7B6D4",e.TimerControl="9C5CA0A1-AB4D-4781-BE7E-8DFBE867B87E",e.TimelineControl="06375649-C143-495E-A496-C962E5B4488E",e.TimezoneControl="7C624A0B-F59E-493D-9583-638D34759266",e.UrlControl="71716B6C-711E-476C-8AB8-5D11542BFB47",e.WebResourceHTMLControl="9FDF5F91-88B1-47F4-AD53-C11EFC01A01D",e.WebResourceImageControl="587CDF98-C1D5-4BDE-8473-14A0BC7644A7",e.ReferencePanelSearchWidgetControl="7CCD1494-1F7A-4E3A-8BDE-F32069DAEB9F",e.ReferencePanelSubgridControl="02D4264B-47E2-4B4C-AA95-F439F3F4D458",e.ReferencePanelQuickViewControl="B68B05F0-A46D-43F8-843B-917920AF806A",e.KBEditorControl="F94DB24F-263D-44A7-B38E-A35E9854812B",e.LinkControl="DFDF1CDE-837B-4AC9-98CF-AC74361FD89D"})(S||(S={}));_l={[S.WebResourceHTMLControl]:"WebResource",[S.WebResourceImageControl]:"WebResource",[S.IframeControl]:"IFRAME",[S.SearchWidgetControl]:"Search widget",[S.SubgridControl]:"Subgrid",[S.TimelineControl]:"Timeline",[S.QuickViewControl]:"QuickviewControl"}});var Qn=g((zj,$b)=>{var bo=new Proxy(function(){return bo},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:bo},apply:function(){return bo},construct:function(){return{}}}),Bb=function(){return bo};Object.setPrototypeOf(Bb,bo);$b.exports=Bb});var pt,zr,qb,Vb,$i=I(()=>{"use strict";pt="cds-designer-models",zr="FormCustomControl",qb="FormCell",Vb="Form"});var qi,ft,wo=I(()=>{"use strict";qi=class{keys;values;constructor(){this.keys=[],this.values=[]}add(t,r){return this.containsKey(t)?!1:(this.keys.push(t),this.values.push(r),!0)}upsert(t,r){this.update(t,r)||this.add(t,r)}sortedUpsert(t,r){if(!this.update(t,r)){let n=0;for(;n<this.keys.length&&this.keys[n]<t;)n++;this.keys.splice(n,0,t),this.values.splice(n,0,r)}}clear(){this.keys=[],this.values=[]}containsKey(t){return this.keys.indexOf(t)!==-1}containsValue(t){return this.values.indexOf(t)!==-1}count(){return this.keys.length}getValue(t){let r=this.keys.indexOf(t);return r!==-1?this.values[r]:!1}getKeys(){return this.keys.slice()}getValues(){return this.values.slice()}remove(t){let r=this.keys.indexOf(t);return r!==-1?(this.keys.splice(r,1),this.values.splice(r,1),!0):!1}update(t,r){let n=this.keys.indexOf(t);return n!==-1?(this.values[n]=r,!0):!1}},ft=class{data={};add(t,r){return this.containsKey(t)?!1:(this.data[t]=r,!0)}upsert(t,r){this.data[t]=r}clear(){this.data={}}containsKey(t){return this.data.hasOwnProperty(t)}containsValue(t){for(let r in this.data)if(this.data[r]===t)return!0;return!1}count(){return Object.keys(this.data).length}getValue(t){return this.containsKey(t)?this.data[t]:!1}getKeys(){return Object.keys(this.data)}getValues(){let t=[];for(let r in this.data)t.push(this.data[r]);return t}remove(t){return this.containsKey(t)?delete this.data[t]:!1}update(t,r){return this.containsKey(t)?(this.data[t]=r,!0):!1}getInternalObject(){return this.data}}});var Jn,_p=I(()=>{"use strict";wo();K();Jn=class e{static lockedFieldCount=new ft;static dependencyFieldCount=new ft;static getNecessaryLookUpTable(t){switch(t){case yr.DependencyFieldTable:return e.dependencyFieldCount;case yr.LockedFieldTable:return e.lockedFieldCount}}static initCanvasLockedFieldLookUp(t){switch(t){case yr.DependencyFieldTable:e.dependencyFieldCount=new ft;case yr.LockedFieldTable:e.lockedFieldCount=new ft}}}});var Pl,Gb=I(()=>{"use strict";Ue();Le();K();Qe();Pl=class extends j{constructor(t){super(v.controlDescription,t)}get forControl(){let t=this.getProperty(m.ForControl);return E.IsNullOrUndefined(t)?null:(t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"&&(t=t.substr(1,t.length-2)),new P(t))}set forControl(t){this.setProperty(m.ForControl,`{${t.ToString()}}`)}get customControls(){return this.getChildren(v.customControl)}set customControls(t){this.deleteAllChildren();for(let r of t)this.addChild(r)}get DefaultControlClassId(){for(let t of this.customControls)if(!E.IsNullOrUndefined(t.id))return t.id;return null}get DefaultCustomControl(){for(let t of this.customControls)if(!E.IsNullOrUndefined(t.id))return t;return null}get DefaultCustomControls(){let t=[];for(let r of this.customControls)E.IsNullOrUndefined(r.id)||t.push(r);return t}async toJSON(t){let r=await this.getCustomControlsJSON(t);return r?{UniqueId:this.forControl.guidString,CustomControls:r,VersionNumber:0,OverallVersionNumber:0}:null}async getCustomControlsJSON(t){if(this.customControls){let r=[];for(let n of this.customControls){let i=await n.toJSON(t);i&&r.push(i)}return r}return null}}});var Wb,jb,mt,_,zb,wn,Xn,Vi,Pp,Tp,Gi=I(()=>{"use strict";Wb={Name:"Name",Value:"Value",Type:"Type",TypeGroup:"TypeGroup",Usage:"Usage",Static:"Static",Primary:"Primary",Columns:"Columns",EnableViewPicker:"EnableViewPicker",EntityName:"EntityName",FilteredViewIds:"FilteredViewIds",ReferencingName:"ReferencingName",RelationshipName:"RelationshipName",RelationshipType:"RelationshipType",TargetEntityType:"TargetEntityType",ViewId:"ViewId",DependentAttributeName:"DependentAttributeName",DependentAttributeType:"DependentAttributeType",DefaultViewId:"DefaultViewId",BindAttribute:"BindAttribute",FilterRelationshipName:"FilterRelationshipName",AvailableViewIds:"AvailableViewIds",QuickForms:"QuickForms",EntityNameKey:"EntityNameKey",CardFormType:"Form.Card",CardFormId:"CardFormId",Hidden:"Hidden",Required:"Required",DefaultValue:"DefaultValue"},jb={GroupDefinition:"GroupDefinition"},mt={Control:"control",Resources:"resources",DisplayNameKey:"display-name-key",descriptionKey:"description-key",value:"value",name:"name",defaultKey:"default",groups:"groups",group:"group",property:"property",hidden:"hidden",required:"required",typeGroup:"type-group",type:"type",usage:"usage",ofType:"of-type",ofTypeGroup:"of-type-group",ImageURL:"preview-image",DefaultValue:"default-value",static:"static",dataset:"data-set",propertySet:"property-set",initialDatasetFetch:"initial-data-set-fetch",editable:"editable",cdsDatasetOptions:"cds-data-set-options",allowDefaultSelectedItems:"allow-default-selected-items",resettable:"resettable",isGroup:"isGroup",entityName:"entityname"};(function(e){e.Boolean="Boolean",e.Currency="Currency",e.DateAndTimeDateAndTime="DateAndTime.DateAndTime",e.DateAndTimeDateOnly="DateAndTime.DateOnly",e.Decimal="Decimal",e.Enum="Enum",e.FP="FP",e.File="File",e.Guid="Guid",e.Image="Image",e.LookupCustomer="Lookup.Customer",e.LookupOwner="Lookup.Owner",e.LookupPartyList="Lookup.PartyList",e.LookupRegarding="Lookup.Regarding",e.LookupSimple="Lookup.Simple",e.Multiple="Multiple",e.MultiSelectOptionSet="MultiSelectOptionSet",e.OptionSet="OptionSet",e.SingleLineEmail="SingleLine.Email",e.SingleLinePhone="SingleLine.Phone",e.SingleLineText="SingleLine.Text",e.SingleLineTextArea="SingleLine.TextArea",e.SingleLineTickerSymbol="SingleLine.Ticker",e.SingleLineURL="SingleLine.URL",e.TwoOptions="TwoOptions",e.WholeDuration="Whole.Duration",e.WholeLanguage="Whole.Language",e.WholeNone="Whole.None",e.WholeTimeZone="Whole.TimeZone",e.BusinessProcessFlow="BusinessProcessFlow",e.CardForm="Form.Card",e.Dashboard="Dashboard",e.FormMain="Form.Main",e.Grid="Grid",e.PowerBIReport="PowerBI.Report",e.QuickForm="Form.QuickForm",e.Search="Search",e.SearchWidget="SearchWidget",e.TimelineWall="TimelineWall",e.UnboundCustomControl="Unbound",e.WebResourceHtmlControl="WebResource.HTML"})(_||(_={}));(function(e){e.BooleanType="CC_FlipLabel_Name",e.DateTimeType="CC_TextBox_Name",e.DecimalType="CC_TextBox_Name",e.DoubleType="CC_TextBox_Name",e.IntegerType="CC_TextBox_Name",e.LookupType="CC_TextBox_Name",e.MemoType="CC_TextArea_Name",e.MoneyType="CC_TextBox_Name",e.OptionSetType="CC_OptionSet_Name",e.StringType="CC_TextBox_Name",e.GridType="CC_ReadOnlyGrid_Name",e.UnboundCustomControlType="CC_UnboundCustomControl_Name"})(zb||(zb={}));(function(e){e.ArcKnobControl="MscrmControls.Knob.ArcKnobControl",e.CardFeedNameControl="MscrmControls.CardFeedContainer.CardFeedContainer",e.CheckboxControl="MscrmControls.FieldControls.CheckboxControl",e.DateTimeControl="MscrmControls.FieldControls.DateTimeControl",e.DurationControl="MscrmControls.FieldControls.DurationControl",e.EditableGridControl="MscrmControls.Grid.GridControl",e.EmailEngagementActionsControl="MscrmControls.EmailEngagement.EmailEngagementActionsControl",e.FormComponent="MscrmControls.ModelForm.ModelFormControl",e.LanguageCodeControl="MscrmControls.FieldControls.LanguagePickerControl",e.LinearSliderControl="MscrmControls.Slider.LinearSliderControl",e.MultiSelectOptionSetControl="MscrmControls.MultiSelectPicklist.UpdMSPicklistControl",e.OptionSetControl="MscrmControls.OptionSet.OptionSetControl",e.PowerBIPCFControl="MscrmControls.PowerBIPCFControl",e.PredictiveScoringWidget="MscrmControls.Sales.PredictiveScoringWidget.PredictiveScoringWidget",e.ReadonlyGrid="MscrmControls.Grid.ReadOnlyGrid",e.SimilarCasesGrid="MscrmControls.Containers.SimilarCasesGridControl",e.StarRatingControl="MscrmControls.Rating.StarRatingControl",e.TimeZoneControl="MscrmControls.FieldControls.TimeZonePickListControl",e.ModelFormControl="MscrmControls.ModelForm.ModelFormControl",e.AutoCompleteControl="MscrmControls.AutoComplete.AutoCompleteControl",e.CanvasAppControl="MscrmControls.Canvas.CanvasControl",e.PowerAppsOneGrid="Microsoft.PowerApps.PowerAppsOneGrid"})(wn||(wn={}));(function(e){e[e.Read=0]="Read",e[e.Edit=1]="Edit",e[e.Both=2]="Both",e[e.Container=3]="Container",e[e.Unknown=4]="Unknown"})(Xn||(Xn={}));(function(e){e[e.Bound=0]="Bound",e[e.Input=1]="Input",e[e.Output=2]="Output"})(Vi||(Vi={}));Pp=[_.LookupCustomer,_.LookupOwner,_.LookupPartyList,_.LookupRegarding,_.LookupSimple],Tp=[_.WholeNone,_.WholeDuration,_.WholeLanguage,_.WholeTimeZone,_.FP,_.Decimal]});function Wr(){return br||(br=window._makerConfig,br&&window?.location?.search?.indexOf("useProductionConfig")>-1&&(br={...br,region:"prod",graphQLEndpoint:"https://graph.make.powerapps.com/"}),br?.region==="prod"&&(br={endpoints:{eu:{ch:{graphql:"https://graph-make.ch-cm001.gateway.prod.cm.powerapps.com/"},de:{graphql:"https://graph-make.de-cm001.gateway.prod.cm.powerapps.com/"},fr:{graphql:"https://graph-make.fr-cm001.gateway.prod.cm.powerapps.com/"},no:{graphql:"https://graph-make.no-cm001.gateway.prod.cm.powerapps.com/"},default:{graphql:"https://graph-make.eu-cm001.gateway.prod.cm.powerapps.com/"}}},...br}),br||{aadClientId:"a8f7a65c-f5ba-4859-b2d6-df772c264e9d",location:"cus",region:"test",publicPath:"/",graphQLEndpoint:"https://graph.make.test.powerapps.com/"})}var br,Tl=I(()=>{"use strict";});function Hb(e,t,r){if(!e)return Ol.has(e)||(window._ppux?.log?.("PPUX/Geo/NonExistent",{eventType:"Trace",team:"Shell",severity:"Error",errorCode:"GeoIsEmpty"}),Ol.add("")),!1;if(e){if(e=e.toLowerCase(),Ol.has(e))return!1;if(!(e in t))return window._ppux?.log?.("PPUX/Geo/NonExistent",{eventType:"Trace",team:"Shell",severity:"Error",errorCode:"GeoNonExistent",eventInfo:{missinggeo:e,parent:r}}),Ol.add(e),!1}return!0}function gM(e){return Hb(e,Op,"Location dictionary")?Op[e.toLowerCase()]:"us"}function vM(){let e=Wr().location.toLowerCase();return Hb(e,Op,"Current location dictionary")?e:"us"}var Ol,Op,aH,Qb=I(()=>{"use strict";Tl();Ol=new Set,Op={cae:"ae",nae:"ae",eas:"as",seas:"as",eau:"au",seau:"au",sbr:"br",cca:"ca",eca:"ca",nch:"ch",wch:"ch",nde:"de",wcde:"de",neu:"eu",weu:"eu",cfr:"fr",sfr:"fr",cin:"in",sin:"in",ejp:"jp",wjp:"jp",suk:"uk",wuk:"uk",eus:"us",wus:"us",cus:"us",ude:"us",udc:"us",ugtx:"us",ugva:"us",eus2:"us",wus2:"us",nza:"za",wza:"za",cne2:"cn",cnn2:"cn",skr:"kr",ckr:"kr",eno:"no",wno:"no",wrx:"us",erx:"us",wex:"us",eex:"us",unitedstates:"us",europe:"eu",asia:"as",australia:"au",japan:"jp",canada:"ca",india:"in",italy:"it",unitedstatesfirstrelease:"us",unitedkingdom:"uk",southamerica:"br",france:"fr",unitedarabemirates:"ae",germany:"de",sweden:"se",switzerland:"ch",korea:"kr",norway:"no",usgov:"us",usgovhigh:"us",usdod:"us",china:"cn",usnat:"us",ussec:"us",southafrica:"za",singapore:"sg",newzealand:"nz",poland:"pl",qatar:"qa",as:"as",au:"au",ca:"ca",in:"in",jp:"jp",kr:"kr",nz:"nz",ae:"ae",qa:"qa",us:"us",uk:"uk",eu:"eu",de:"de",ch:"ch",no:"no",fr:"fr",se:"se",it:"it",pl:"pl",be:"eu",bel:"eu",gr:"eu",grc:"eu",lt:"eu",ltu:"eu",pt:"eu",prt:"eu",bg:"eu",bgr:"eu",es:"eu",esp:"eu",lu:"eu",lux:"eu",ro:"eu",rou:"eu",cz:"eu",cze:"eu",hu:"eu",hun:"eu",si:"eu",svn:"eu",dk:"eu",dnk:"eu",hr:"eu",hrv:"eu",mt:"eu",mlt:"eu",sk:"eu",svk:"eu",nit:"it",nl:"eu",nld:"eu",fi:"eu",fin:"eu",ee:"eu",est:"eu",cy:"eu",cyp:"eu",at:"eu",aut:"eu",swe:"se",cse:"se",ie:"eu",irl:"eu",lv:"eu",lva:"eu",cpl:"pl",nnz:"nz",cqa:"qa",sg:"sg",br:"br",za:"za",sa:"za"};aH=gM(vM())});var L,sH,Jb=I(()=>{"use strict";L={USWest:"westus",USWest2:"westus2",USCentral:"centralus",USEast:"eastus",USEast2:"eastus2",USNorthCentral:"northcentralus",USSouthCentral:"southcentralus",USWestCentral:"westcentralus",CanadaCentral:"canadacentral",CanadaEast:"canadaeast",BrazilSouth:"brazilsouth",EuropeNorth:"northeurope",EuropeWest:"westeurope",UKSouth:"uksouth",UKWest:"ukwest",FranceCentral:"francecentral",FranceSouth:"francesouth",SwitzerlandNorth:"switzerlandnorth",SwitzerlandWest:"switzerlandwest",GermanyNorth:"germanynorth",GermanyWestCentral:"germanywestcentral",NorwayWest:"norwaywest",NorwayEast:"norwayeast",SwedenCentral:"swedencentral",ItalyNorth:"italynorth",PolandCentral:"polandcentral",AsiaEast:"eastasia",AsiaSouthEast:"southeastasia",JapanEast:"japaneast",JapanWest:"japanwest",AustraliaEast:"australiaeast",AustraliaSouthEast:"australiasoutheast",AustraliaCentral:"australiacentral",AustraliaCentral2:"australiacentral2",IndiaCentral:"centralindia",IndiaSouth:"southindia",IndiaWest:"westindia",KoreaSouth:"koreasouth",KoreaCentral:"koreacentral",NewZealandNorth:"newzealandnorth",UAECentral:"uaecentral",UAENorth:"uaenorth",SouthAfricaNorth:"southafricanorth",SouthAfricaWest:"southafricawest",QatarCentral:"qatarcentral",GermanyCentral:"germanycentral",GermanyNorthEast:"germanynortheast",SingaporeSouthEast:"southeastasia",GovernmentUSVirginia:"usgovvirginia",GovernmentUSIowa:"usgoviowa",GovernmentUSArizona:"usgovarizona",GovernmentUSTexas:"usgovtexas",GovernmentUSDodEast:"usdodeast",GovernmentUSDodCentral:"usdodcentral",ChinaNorth:"chinanorth",ChinaNorth2:"chinanorth2",ChinaNorth3:"chinanorth3",ChinaEast:"chinaeast",ChinaEast2:"chinaeast2",ChinaEast3:"chinaeast3",UssecEast:"usseceast",UssecWest:"ussecwest",UsnatEast:"usnateast",UsnatWest:"usnatwest"},sH={[L.USWest]:{geoName:"us",regionShortName:"wus"},[L.USCentral]:{geoName:"us",regionShortName:"cus"},[L.USEast]:{geoName:"us",regionShortName:"eus"},[L.USEast2]:{geoName:"us",regionShortName:"eus2"},[L.USWestCentral]:{geoName:"us",regionShortName:"wcus"},[L.USWest2]:{geoName:"us",regionShortName:"wus2"},[L.USSouthCentral]:{geoName:"br",regionShortName:"scus"},[L.BrazilSouth]:{geoName:"br",regionShortName:"sbr"},[L.UKSouth]:{geoName:"uk",regionShortName:"suk"},[L.UKWest]:{geoName:"uk",regionShortName:"wuk"},[L.JapanEast]:{geoName:"jp",regionShortName:"ejp"},[L.JapanWest]:{geoName:"jp",regionShortName:"wjp"},[L.IndiaCentral]:{geoName:"in",regionShortName:"cin"},[L.IndiaSouth]:{geoName:"in",regionShortName:"sin"},[L.ItalyNorth]:{geoName:"it",regionShortName:"nit"},[L.GermanyWestCentral]:{geoName:"de",regionShortName:"wcde"},[L.GermanyNorth]:{geoName:"de",regionShortName:"nde"},[L.EuropeNorth]:{geoName:"eu",regionShortName:"neu"},[L.EuropeWest]:{geoName:"eu",regionShortName:"weu"},[L.AustraliaEast]:{geoName:"au",regionShortName:"eau"},[L.AustraliaSouthEast]:{geoName:"au",regionShortName:"seau"},[L.AsiaSouthEast]:{geoName:"as",regionShortName:"seas"},[L.AsiaEast]:{geoName:"as",regionShortName:"eas"},[L.CanadaCentral]:{geoName:"ca",regionShortName:"cca"},[L.CanadaEast]:{geoName:"ca",regionShortName:"eca"},[L.SouthAfricaNorth]:{geoName:"za",regionShortName:"nza"},[L.SouthAfricaWest]:{geoName:"za",regionShortName:"wza"},[L.FranceCentral]:{geoName:"fr",regionShortName:"cfr"},[L.FranceSouth]:{geoName:"fr",regionShortName:"sfr"},[L.UAENorth]:{geoName:"ae",regionShortName:"nae"},[L.UAECentral]:{geoName:"ae",regionShortName:"cae"},[L.SwedenCentral]:{geoName:"se",regionShortName:"cse"},[L.SwitzerlandNorth]:{geoName:"ch",regionShortName:"nch"},[L.SwitzerlandWest]:{geoName:"ch",regionShortName:"wch"},[L.NorwayEast]:{geoName:"no",regionShortName:"eno"},[L.NorwayWest]:{geoName:"no",regionShortName:"wno"},[L.KoreaCentral]:{geoName:"kr",regionShortName:"ckr"},[L.KoreaSouth]:{geoName:"kr",regionShortName:"skr"},[L.SingaporeSouthEast]:{geoName:"sg",regionShortName:"seas"},[L.PolandCentral]:{geoName:"pl",regionShortName:"cpl"},[L.QatarCentral]:{geoName:"qa",regionShortName:"cqa"},[L.NewZealandNorth]:{geoName:"nz",regionShortName:"nnz"},[L.GovernmentUSTexas]:{geoName:"us",regionShortName:"ugtx"},[L.GovernmentUSVirginia]:{geoName:"us",regionShortName:"ugva"},[L.GovernmentUSDodCentral]:{regionShortName:"udc"},[L.GovernmentUSDodEast]:{regionShortName:"ude"},[L.ChinaEast]:{regionShortName:"cne"},[L.ChinaEast2]:{regionShortName:"cne2"},[L.ChinaEast3]:{regionShortName:"cne3"},[L.ChinaNorth]:{regionShortName:"cnn"},[L.ChinaNorth2]:{regionShortName:"cnn2"},[L.ChinaNorth3]:{regionShortName:"cnn3"},[L.UssecEast]:{geoName:"us",regionShortName:"erx"},[L.UssecWest]:{geoName:"us",regionShortName:"wrx"},[L.UsnatEast]:{geoName:"us",regionShortName:"eex"},[L.UsnatWest]:{geoName:"us",regionShortName:"wex"}}});var Xb=I(()=>{"use strict";Tl();});var Ao=I(()=>{"use strict";Tl();Qb();Jb();Xb();});function Co(e,t){return Kb?Kb.isOverridden(e,t):{overridden:!1}}var Kb,So=I(()=>{"use strict";});var Rp=I(()=>{"use strict";Ao();So();});function yM(e,t){let{region:r}=Wr();return()=>{let n=e.settings[t];if(n.allowOverrides){let s=Co(e.packageName,t);if(s.overridden)return typeof s.value=="string"?bM(s.value):s.value}let a=n.values,o=process.env.SETTINGS_FALLBACK_REGION?.[r];return a[r]!==void 0?a[r]:o&&a[o]!==void 0?a[o]:a.default}}function bM(e){return isNaN(Number(e))?e==="true"?!0:e==="false"?!1:e:Number(e)}function wM(e){let t=e.packageName;if(Rl.has(t)){let r=`settings has already been created for this package ${t}`;throw console.error(r),new Error(r)}if(Object.keys(e.settings).some(r=>xp(t,r))){let r=`error parsing settings config for package ${t}, a feature gate with the same name exists`;throw console.error(r),new Error(r)}Object.keys(e.settings).forEach(r=>{if(Object.keys(e.settings[r].values).filter(i=>i!=="default").some(i=>!xl(i))){let i=`error parsing settings config for package ${t}, setting ${r} has invalid region`;throw console.error(i),new Error(i)}})}function Eo(e){wM(e);let t={};return Object.keys(e.settings).forEach(r=>{t[r]={enumerable:!0,get:yM(e,r)}}),Rl.set(e.packageName,e),Object.defineProperties({},t)}function Fp(e,t){return Rl.has(e)?!!Rl.get(e).settings[t]:!1}var Rl,Fl=I(()=>{"use strict";Ao();So();Lp();No();Rl=new Map});function Yb(e,t){let{region:r}=Wr();return()=>{let n=Co(e.packageName,t);if(n.overridden)return n.value.toString()==="true";let i=e.features[t].enabledFor,a=process.env.SETTINGS_FALLBACK_REGION?.[r];return i[r]!==void 0?!!i[r]:a&&i[a]!==void 0?!!i[a]:!1}}function AM(e){let t=e.packageName;if(Ll.has(t)){let r="feature gates has already been created for this package";throw console.error(r),new Error(r)}if(Object.keys(e.features).some(r=>Fp(t,r))){let r=`error parsing feature gates config for package ${t}, a setting with the same name exists`;throw console.error(r),new Error(r)}Object.keys(e.features).forEach(r=>{if(Object.keys(e.features[r].enabledFor).some(i=>!xl(i))){let i=`error parsing feature gates config for package ${t}, feature ${r} has invalid region`;throw console.error(i),new Error(i)}})}function kp(e){AM(e);let t={};Object.keys(e.features).forEach(i=>{t[i]={enumerable:!0,configurable:!0,get:Yb(e,i)}});let r={},n=new Set;return t.dangerouslySet={enumerable:!1,value:(i,a)=>{n.add(i),Object.defineProperty(r,i,{enumerable:!0,configurable:!0,value:a})}},t.dangerouslyReset={enumerable:!1,value:()=>{let i={};n.forEach(a=>{i[a.toString()]={enumerable:!0,configurable:!0,get:Yb(e,a.toString())}}),Object.defineProperties(r,i),n.clear()}},Ll.set(e.packageName,e),Object.defineProperties(r,t)}function xp(e,t){return Ll.has(e)?!!Ll.get(e).features[t]:!1}var Ll,Lp=I(()=>{"use strict";Ao();No();So();Fl();Ll=new Map});var ew=g((RH,Zb)=>{"use strict";Zb.exports=function(t,r){if(r=r.split(":")[0],t=+t,!t)return!1;switch(r){case"http":case"ws":return t!==80;case"https":case"wss":return t!==443;case"ftp":return t!==21;case"gopher":return t!==70;case"file":return!1}return t!==0}});var nw=g(Mp=>{"use strict";var CM=Object.prototype.hasOwnProperty,SM;function tw(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return null}}function rw(e){try{return encodeURIComponent(e)}catch{return null}}function EM(e){for(var t=/([^=?#&]+)=?([^&]*)/g,r={},n;n=t.exec(e);){var i=tw(n[1]),a=tw(n[2]);i===null||a===null||i in r||(r[i]=a)}return r}function NM(e,t){t=t||"";var r=[],n,i;typeof t!="string"&&(t="?");for(i in e)if(CM.call(e,i)){if(n=e[i],!n&&(n===null||n===SM||isNaN(n))&&(n=""),i=rw(i),n=rw(n),i===null||n===null)continue;r.push(i+"="+n)}return r.length?t+r.join("&"):""}Mp.stringify=NM;Mp.parse=EM});var $p=g((xH,uw)=>{"use strict";var aw=ew(),kl=nw(),ow=/[\n\r\t]/g,DM=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,IM=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,_M=/^[a-zA-Z]:/,PM=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/;function Bp(e){return(e||"").toString().replace(PM,"")}var Up=[["#","hash"],["?","query"],function(t,r){return wr(r.protocol)?t.replace(/\\/g,"/"):t},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],iw={hash:1,query:1};function sw(e){var t;typeof window<"u"?t=window:typeof global<"u"?t=global:typeof self<"u"?t=self:t={};var r=t.location||{};e=e||r;var n={},i=typeof e,a;if(e.protocol==="blob:")n=new Ar(unescape(e.pathname),{});else if(i==="string"){n=new Ar(e,{});for(a in iw)delete n[a]}else if(i==="object"){for(a in e)a in iw||(n[a]=e[a]);n.slashes===void 0&&(n.slashes=DM.test(e.href))}return n}function wr(e){return e==="file:"||e==="ftp:"||e==="http:"||e==="https:"||e==="ws:"||e==="wss:"}function lw(e,t){e=Bp(e),e=e.replace(ow,""),t=t||{};var r=IM.exec(e),n=r[1]?r[1].toLowerCase():"",i=!!r[2],a=!!r[3],o=0,s;return i?a?(s=r[2]+r[3]+r[4],o=r[2].length+r[3].length):(s=r[2]+r[4],o=r[2].length):a?(s=r[3]+r[4],o=r[3].length):s=r[4],n==="file:"?o>=2&&(s=s.slice(2)):wr(n)?s=r[4]:n?i&&(s=s.slice(2)):o>=2&&wr(t.protocol)&&(s=r[4]),{protocol:n,slashes:i||wr(n),slashesCount:o,rest:s}}function TM(e,t){if(e==="")return t;for(var r=(t||"/").split("/").slice(0,-1).concat(e.split("/")),n=r.length,i=r[n-1],a=!1,o=0;n--;)r[n]==="."?r.splice(n,1):r[n]===".."?(r.splice(n,1),o++):o&&(n===0&&(a=!0),r.splice(n,1),o--);return a&&r.unshift(""),(i==="."||i==="..")&&r.push(""),r.join("/")}function Ar(e,t,r){if(e=Bp(e),e=e.replace(ow,""),!(this instanceof Ar))return new Ar(e,t,r);var n,i,a,o,s,l,u=Up.slice(),c=typeof t,d=this,p=0;for(c!=="object"&&c!=="string"&&(r=t,t=null),r&&typeof r!="function"&&(r=kl.parse),t=sw(t),i=lw(e||"",t),n=!i.protocol&&!i.slashes,d.slashes=i.slashes||n&&t.slashes,d.protocol=i.protocol||t.protocol||"",e=i.rest,(i.protocol==="file:"&&(i.slashesCount!==2||_M.test(e))||!i.slashes&&(i.protocol||i.slashesCount<2||!wr(d.protocol)))&&(u[3]=[/(.*)/,"pathname"]);p<u.length;p++){if(o=u[p],typeof o=="function"){e=o(e,d);continue}a=o[0],l=o[1],a!==a?d[l]=e:typeof a=="string"?(s=a==="@"?e.lastIndexOf(a):e.indexOf(a),~s&&(typeof o[2]=="number"?(d[l]=e.slice(0,s),e=e.slice(s+o[2])):(d[l]=e.slice(s),e=e.slice(0,s)))):(s=a.exec(e))&&(d[l]=s[1],e=e.slice(0,s.index)),d[l]=d[l]||n&&o[3]&&t[l]||"",o[4]&&(d[l]=d[l].toLowerCase())}r&&(d.query=r(d.query)),n&&t.slashes&&d.pathname.charAt(0)!=="/"&&(d.pathname!==""||t.pathname!=="")&&(d.pathname=TM(d.pathname,t.pathname)),d.pathname.charAt(0)!=="/"&&wr(d.protocol)&&(d.pathname="/"+d.pathname),aw(d.port,d.protocol)||(d.host=d.hostname,d.port=""),d.username=d.password="",d.auth&&(s=d.auth.indexOf(":"),~s?(d.username=d.auth.slice(0,s),d.username=encodeURIComponent(decodeURIComponent(d.username)),d.password=d.auth.slice(s+1),d.password=encodeURIComponent(decodeURIComponent(d.password))):d.username=encodeURIComponent(decodeURIComponent(d.auth)),d.auth=d.password?d.username+":"+d.password:d.username),d.origin=d.protocol!=="file:"&&wr(d.protocol)&&d.host?d.protocol+"//"+d.host:"null",d.href=d.toString()}function OM(e,t,r){var n=this;switch(e){case"query":typeof t=="string"&&t.length&&(t=(r||kl.parse)(t)),n[e]=t;break;case"port":n[e]=t,aw(t,n.protocol)?t&&(n.host=n.hostname+":"+t):(n.host=n.hostname,n[e]="");break;case"hostname":n[e]=t,n.port&&(t+=":"+n.port),n.host=t;break;case"host":n[e]=t,/:\d+$/.test(t)?(t=t.split(":"),n.port=t.pop(),n.hostname=t.join(":")):(n.hostname=t,n.port="");break;case"protocol":n.protocol=t.toLowerCase(),n.slashes=!r;break;case"pathname":case"hash":if(t){var i=e==="pathname"?"/":"#";n[e]=t.charAt(0)!==i?i+t:t}else n[e]=t;break;case"username":case"password":n[e]=encodeURIComponent(t);break;case"auth":var a=t.indexOf(":");~a?(n.username=t.slice(0,a),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=t.slice(a+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(t))}for(var o=0;o<Up.length;o++){var s=Up[o];s[4]&&(n[s[1]]=n[s[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin=n.protocol!=="file:"&&wr(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function RM(e){(!e||typeof e!="function")&&(e=kl.stringify);var t,r=this,n=r.host,i=r.protocol;i&&i.charAt(i.length-1)!==":"&&(i+=":");var a=i+(r.protocol&&r.slashes||wr(r.protocol)?"//":"");return r.username?(a+=r.username,r.password&&(a+=":"+r.password),a+="@"):r.password?(a+=":"+r.password,a+="@"):r.protocol!=="file:"&&wr(r.protocol)&&!n&&r.pathname!=="/"&&(a+="@"),n[n.length-1]===":"&&(n+=":"),a+=n+r.pathname,t=typeof r.query=="object"?e(r.query):r.query,t&&(a+=t.charAt(0)!=="?"?"?"+t:t),r.hash&&(a+=r.hash),a}Ar.prototype={set:OM,toString:RM};Ar.extractProtocol=lw;Ar.location=sw;Ar.trimLeft=Bp;Ar.qs=kl;uw.exports=Ar});var FM,cw=I(()=>{"use strict";FM=se($p());});function qp(e,t,r){let n=Object.keys(r).sort();if(n.length===0)throw new Error(`ECS feature has no properties: ${e}.${t}`);let i=`ecs.${e}.${t}`;return n.length===1?`${i}.${n[0]}`:`${i}.{${n.join(";")}}`}var Ml=I(()=>{"use strict";});var Vp,Gp,zp=I(()=>{"use strict";Ml();Vp=class{features=new Map;register(t,r){let n=qp(r,t.teamName,t.fallback),i={clientName:r,teamName:t.teamName,fullName:n,description:t.description,owners:t.owners,ecsURL:t.ecsURL,createdOn:t.createdOn,fallbackConfig:t.fallback,feature:t,displayTeam:t.displayTeam,tags:t.tags,category:t.category};this.features.set(n,i)}getAll(){return Array.from(this.features.values())}get(t){return this.features.get(t)}has(t){return this.features.has(t)}getByClient(t){return this.getAll().filter(r=>r.clientName===t)}getByTeam(t){return this.getAll().filter(r=>r.teamName===t)}search(t){let r=t.toLowerCase();return this.getAll().filter(n=>n.fullName.toLowerCase().includes(r)||n.description?.toLowerCase().includes(r)||n.teamName.toLowerCase().includes(r)||n.clientName.toLowerCase().includes(r))}getClientNames(){let t=new Set;return this.features.forEach(r=>t.add(r.clientName)),Array.from(t)}getTeamNames(){let t=new Set;return this.features.forEach(r=>t.add(r.teamName)),Array.from(t)}clear(){this.features.clear()}},Gp=new Vp});var Wp=I(()=>{"use strict";});function xl(e){return xM.has(e)}var xM,No=I(()=>{"use strict";Rp();Lp();Fl();So();Rp();cw();zp();Ml();Wp();xM=new Set(["tie","test","prod","preview","preprod","gov","high","dod","mooncake","ex","rx"])});var LM,dw=I(()=>{"use strict";No();LM=Eo({packageName:"cds-designer-models",settings:{testCustomControls:{description:"Test Custom Controls to show up in the component picker.",allowOverrides:!0,values:{default:"",test:"",preprod:"",preview:"",gov:""}}}})});var Ul,O,k,Kn,zi,Bl,pw,fw,jp,Do=I(()=>{"use strict";wo();Ul=class{name;constructor(t){this.name=t}toString(){return this.name}getName(){return this.name}getDisplayNameResourceKey(){return jp.getDisplayNameResourceKey(this.name)}};(function(e){e.BigInt="BigIntType",e.CalendarRulesType="CalendarRulesType",e.Currency="MoneyType",e.Customer="Customer",e.CustomerType="CustomerType",e.DateTime="DateTimeType",e.DecimalNumber="DecimalType",e.EntityNameType="EntityNameType",e.FloatingPointNumber="DoubleType",e.Image="ImageType",e.File="FileType",e.Lookup="Lookup",e.LookupType="LookupType",e.ManagedPropertyType="ManagedPropertyType",e.MultipleLineofText="MemoType",e.MultiSelectOptionSet="MultiSelectPicklistType",e.OptionSet="PicklistType",e.Owner="Owner",e.OwnerType="OwnerType",e.PartyList="PartyList",e.PartyListType="PartyListType",e.PrimaryNameAttributeType="String",e.SingleLineofText="StringType",e.State="StateType",e.Status="StatusType",e.Subject="Subject",e.TimeStamp="TimeStampType",e.TwoOptions="BooleanType",e.UniqueIdentifier="Uniqueidentifier",e.UniqueIdentifierType="UniqueidentifierType",e.VirtualType="VirtualType",e.WholeNumber="IntegerType"})(O||(O={}));(function(e){e.Email="Email",e.Text="Text",e.TextArea="TextArea",e.Url="Url",e.TickerSymbol="TickerSymbol",e.PhoneticGuide="PhoneticGuide",e.VersionNumber="VersionNumber",e.Phone="Phone",e.None="None",e.Duration="Duration",e.TimeZone="TimeZone",e.Language="Language",e.Locale="Locale",e.DateOnly="DateOnly",e.DateAndTime="DateAndTime",e.Picklist="Picklist",e.State="State",e.Status="Status",e.Boolean="Boolean",e.Regarding="Regarding"})(k||(k={}));Kn=class extends Ul{constructor(t){super(t)}static get None(){return"None"}static get SystemRequired(){return"SystemRequired"}static get ApplicationRequired(){return"ApplicationRequired"}static get Recommended(){return"Recommended"}},zi=class e extends Ul{constructor(t){super(t),t||(this.name=e.None)}static get None(){return"None"}static get Persistent(){return"Persistent"}static get Calculated(){return"Calculated"}static get Rollup(){return"Rollup"}GetValue(){return this.name===e.None?Bl.Persistent:parseInt(Bl[this.name])}};(function(e){e[e.Persistent=0]="Persistent",e[e.Calculated=1]="Calculated",e[e.Rollup=2]="Rollup"})(Bl||(Bl={}));(function(e){e[e.Undefined=0]="Undefined",e[e.Simple=1]="Simple",e[e.Related=2]="Related",e[e.Logical=4]="Logical",e[e.Calculated=8]="Calculated",e[e.Rollup=16]="Rollup",e[e.Invalid=32]="Invalid"})(pw||(pw={}));(function(e){e[e.Attribute=0]="Attribute",e[e.Organization=1]="Organization",e[e.Currency=2]="Currency"})(fw||(fw={}));jp=class e{static resourceKeyMap=e.initResourceKeyMap();static initResourceKeyMap(){let t=new qi;return t.add(O.TwoOptions,"SystemCustomization.type.bit.label"),t.add(O.Customer,"SystemCustomization.type.customer.label"),t.add(O.CustomerType,"SystemCustomization.type.customer.label"),t.add(O.DateTime,"SystemCustomization.type.datetime.label"),t.add(O.DecimalNumber,"SystemCustomization.type.decimal.label"),t.add(O.FloatingPointNumber,"SystemCustomization.type.float.label"),t.add(O.WholeNumber,"SystemCustomization.type.int.label"),t.add(O.LookupType,"SystemCustomization.type.lookup.label"),t.add(O.Lookup,"SystemCustomization.type.lookup.label"),t.add(O.MultipleLineofText,"SystemCustomization.type.ntext.label"),t.add(O.Currency,"SystemCustomization.type.money.label"),t.add(O.Owner,"SystemCustomization.type.owner.label"),t.add(O.OwnerType,"SystemCustomization.type.owner.label"),t.add(O.PartyList,"SystemCustomization.type.partylist.label"),t.add(O.PartyListType,"SystemCustomization.type.partylist.label"),t.add(O.OptionSet,"SystemCustomization.type.picklist.label"),t.add(O.State,"SystemCustomization.type.state.label"),t.add(O.Status,"SystemCustomization.type.status.label"),t.add(O.SingleLineofText,"SystemCustomization.type.nvarchar.label"),t.add(O.UniqueIdentifier,"SystemCustomization.type.uniqueidentifier.label"),t.add(O.UniqueIdentifierType,"SystemCustomization.type.uniqueidentifiertype.label"),t.add(O.CalendarRulesType,"SystemCustomization.type.calendarrules.label"),t.add(O.VirtualType,"SystemCustomization.type.virtual.label"),t.add(O.BigInt,"SystemCustomization.type.bigint.label"),t.add(O.ManagedPropertyType,"SystemCustomization.type.managedproperty.label"),t.add(O.EntityNameType,"SystemCustomization.type.entityname.label"),t.add(O.Image,"SystemCustomization.type.image.label"),t.add(O.MultiSelectOptionSet,"SystemCustomization.type.multiselectpicklist.label"),t.add(O.PrimaryNameAttributeType,"SystemCustomization.type.primaryname.label"),t.add(O.LookupType,"SystemCustomization.type.lookuptype.label"),t.add(O.Subject,"SystemCustomization.type.subject.label"),t.add(k.Email,"SystemCustomization.String.Format.email"),t.add(k.Text,"SystemCustomization.String.Format.text"),t.add(k.TextArea,"SystemCustomization.String.Format.textarea"),t.add(k.Url,"SystemCustomization.String.Format.url"),t.add(k.TickerSymbol,"SystemCustomization.String.Format.tickersymbol"),t.add(k.PhoneticGuide,"SystemCustomization.String.Format.phoneticguide"),t.add(k.VersionNumber,"SystemCustomization.String.Format.versionnumber"),t.add(k.Phone,"SystemCustomization.String.Format.phone"),t.add(k.None,"SystemCustomization.Integer.Format."),t.add(k.Duration,"SystemCustomization.Integer.Format.duration"),t.add(k.TimeZone,"SystemCustomization.Integer.Format.timezone"),t.add(k.Language,"SystemCustomization.Integer.Format.language"),t.add(k.Locale,"SystemCustomization.Integer.Format.language"),t.add(k.DateOnly,"SystemCustomization.DateTime.Format.date"),t.add(k.DateAndTime,"SystemCustomization.DateTime.Format.datetime"),t.add(k.Regarding,"SystemCustomization.Lookup.Format.regarding"),t.add(zi.Persistent,"SystemCustomization.String.Source.persistent"),t.add(zi.Calculated,"SystemCustomization.String.Source.calculated"),t.add(zi.Rollup,"SystemCustomization.String.Source.rollup"),t.add(zi.None,"SystemCustomization.String.Source.none"),t}static getDisplayNameResourceKey(t){return e.resourceKeyMap.getValue(t)}}});var vw,Qp,Wi,Yn,Hp,$l,ji,jr,we,mw,hw,gw,rr=I(()=>{"use strict";vw={ThreeEqColumn_FirstColumn:34,ThreeEqColumn_SecondColumn:33,ThreeEqColumn_ThirdColumn:33,FiveEqColumn:20},Qp={ONE_COLUMN:"1",TWO_COLUMN:"2",THREE_COLUMN:"3",FOUR_COLUMN:"4"};(function(e){e[e.SUBGRID=0]="SUBGRID",e[e.SPACER=1]="SPACER",e[e.QUICK_VIEW=2]="QUICK_VIEW",e[e.WEB_RESOURCE=3]="WEB_RESOURCE",e[e.IFRAME=4]="IFRAME",e[e.BING_MAPS=5]="BING_MAPS",e[e.TIMER=6]="TIMER",e[e.TIMELINE=7]="TIMELINE",e[e.SOCIAL_INSIGHTS=8]="SOCIAL_INSIGHTS",e[e.KB_SEARCH=9]="KB_SEARCH",e[e.ACI_CONTROL=10]="ACI_CONTROL",e[e.RELATIONSHIP_ASSISTANT=11]="RELATIONSHIP_ASSISTANT",e[e.REFERENCE_PANEL=12]="REFERENCE_PANEL",e[e.REF_PANEL_QUICKVIEW=13]="REF_PANEL_QUICKVIEW",e[e.REF_PANEL_SUBGRID=14]="REF_PANEL_SUBGRID",e[e.REF_PANEL_KBSEARCH=15]="REF_PANEL_KBSEARCH",e[e.WEB_RESOURCE_HTML=16]="WEB_RESOURCE_HTML",e[e.PRED_LEAD_SCORING=17]="PRED_LEAD_SCORING"})(Wi||(Wi={}));(function(e){e.Left="Left",e.Right="Right",e.Center="Center"})(Yn||(Yn={}));(function(e){e[e.Mobile=0]="Mobile",e[e.Tablet=1]="Tablet",e[e.Web=2]="Web"})(Hp||(Hp={}));$l=class{static ONE_COLUMN=1;static TWO_COLUMN=2;static THREE_COLUMN=3;static FIVE_COLUMN=5};(function(e){e.Left="Left",e.Top="Top"})(ji||(ji={}));jr=class{static StartTag="<"},we={ShowLabel:"true",LockLevel:"0",IsUserDefined:"0",LabelWidth:"115",columns:"1",ShowBar:"false",Layout:"varwidth",namePrefix:"_section_",labelAlignment:Yn.Left,labelPosition:ji.Left,MarginalControlColumns:"111",referencePanelNamePrefix:"ref_pan_"};(function(e){e.AddFormBodyFieldToReadOnlyHeader="AddFormBodyFieldToReadOnlyHeader",e.AddFieldPaneFieldToReadOnlyHeader="AddFieldPaneFieldToReadOnlyHeader",e.AddFieldExceedsReadOnlyHeaderLimit="AddFieldExceedsReadOnlyHeaderLimit",e.AddCustomComponentToReadOnlyHeader="AddCustomComponentToReadOnlyHeader",e.AddNonDisplayableComponentToReadOnlyHeader="AddNonDisplayableComponentToReadOnlyHeader",e.AddFieldToFlyoutOnly="AddFieldToFlyoutOnly",e.DisplayedFieldToFlyout="DisplayedFieldToFlyout",e.FlyoutFieldToDisplayed="FlyoutFieldToDisplayed",e.AddControlBeforeDefaultLabel="AddControlBeforeDefaultLabel"})(mw||(mw={}));(function(e){e.TabWithLockedFieldRemoval="TabWithLockedFieldRemoval",e.SectionWithLockedFieldRemoval="SectionWithLockedFieldRemoval",e.LockedSectionRemoval="LockedSectionRemoval",e.LockedFieldRemoval="LockedFieldRemoval",e.RequiredFieldRemoval="RequiredFieldRemoval",e.LastRemainingTab="LastRemainingTab",e.UnknownRemoval="UnknownRemoval"})(hw||(hw={}));(function(e){e.IsHeader="IsHeader",e.IsFooter="IsFooter",e.ContainedInHeader="ContainedInHeader",e.ContainedInFooter="ContainedInFooter",e.NoElementFound="NoElementFound",e.NoTarget="NoTarget",e.CannotAddControlToHeader="CannotAddControlToHeader",e.CannotAddControlToFooter="CannotAddControlToFooter"})(gw||(gw={}))});var Jp,yw=I(()=>{"use strict";(function(e){e.DefaultValue="defaultValue",e.Loaded="loaded"})(Jp||(Jp={}))});var Aw,kM,bw,RQ,FQ,Io,ww,xQ,LQ,Cw=I(()=>{"use strict";Aw=se(Qn());Le();$i();dw();Do();rr();Gi();K();kM=se(Mn());yw();(function(e){e.Model="Model",e.Canvas="Canvas",e.CustomPages="CustomPages"})(bw||(bw={}));RQ={Read:Xn.Read,Edit:Xn.Edit,Both:Xn.Both,Container:Xn.Container},FQ={input:Vi.Input,bound:Vi.Bound,output:Vi.Output};(function(e){e[e.dataset=0]="dataset",e[e.property=1]="property",e[e.groups=2]="groups",e[e.group=3]="group"})(Io||(Io={}));(function(e){e[e.None=0]="None",e[e.HiddenControl=1]="HiddenControl",e[e.CompatibleDataTypesIsMissing=2]="CompatibleDataTypesIsMissing",e[e.TagNameIsUnsupported=3]="TagNameIsUnsupported",e[e.PropertyTypeIsUnsupported=4]="PropertyTypeIsUnsupported",e[e.PropertyTypeGroupIsUnsupported=5]="PropertyTypeGroupIsUnsupported"})(ww||(ww={}));xQ=new Set([_.Currency,_.Decimal,_.FP,_.Multiple,_.SingleLineEmail,_.SingleLinePhone,_.SingleLineText,_.SingleLineTextArea,_.SingleLineURL,_.SingleLineTickerSymbol,_.WholeNone,_.WholeDuration,_.WholeLanguage,_.WholeTimeZone,_.Enum,_.LookupSimple,_.LookupCustomer,_.LookupOwner,_.LookupPartyList,_.LookupRegarding,_.TwoOptions,_.Boolean,_.PowerBIReport,_.DateAndTimeDateAndTime,_.DateAndTimeDateOnly,_.OptionSet,_.MultiSelectOptionSet,_.CardForm]),LQ={numbers:[_.WholeNone,_.FP,_.Decimal,_.Currency],text:[_.SingleLineText,_.SingleLineTextArea,_.Multiple],lookup:[_.LookupSimple,_.LookupCustomer,_.LookupOwner,_.LookupPartyList,_.LookupRegarding],dates:[_.DateAndTimeDateOnly,_.DateAndTimeDateAndTime],allFields:[_.TwoOptions,_.DateAndTimeDateOnly,_.DateAndTimeDateAndTime,_.FP,_.Decimal,_.WholeNone,_.WholeDuration,_.WholeTimeZone,_.WholeLanguage,_.LookupSimple,_.LookupCustomer,_.LookupOwner,_.LookupPartyList,_.LookupRegarding,_.Multiple,_.OptionSet,_.SingleLineText,_.SingleLineTextArea,_.SingleLineEmail,_.SingleLineURL,_.SingleLineTickerSymbol,_.SingleLinePhone]}});var nr,ql,Sw=I(()=>{"use strict";nr=se(Qn());Ue();Le();ot();$i();Gi();Cw();Do();K();Qe();rr();ql=class extends j{constructor(t){super(v.customControl,t)}customControlId;get id(){let t=this.getProperty(m.id);return E.IsNullOrUndefined(t)?null:t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?new P(t.substr(1,t.length-2)):new P(t)}getParameters(){let t=new Map,r=this.getAllChildren();if(r&&r.length!==0&&r[0]){let n=r[0].getAllChildren();if(n!=null){for(let i of n)if(i&&i.getAllChildren().length>0){let a=i.getNodeName();t.get(a)?t.get(a).push(i):t.set(a,[i])}}}return t}getFormComponentValueByParameterName(t){let r=this.getParameters()?.get(mt.value);if(r?.length>0){let n=r[0],i=n?.getAllChildren()?.length>0?n.getAllChildren().find(o=>o.getNodeName()===t):null,a=i?.getAllChildren()?.length>0?i.getAllChildren()[0].getNodeName():"";return this.normalizePropertyValue(a)}}getParameterValue(t){let r=this.getParameterNodeChild(t);return r&&this.normalizePropertyValue(r.getNodeName())}getParameterNodeChild(t){let r=this.getParameters().get(t);return r?.length>0&&r[0].getAllChildren()?.length>0?r[0].getAllChildren()[0]:null}getDatasetName(t){return t.getAllProperties().find(r=>r.key===mt.name)?.value}getParameterChildrenValues(t,r,n){if(this.isDataSet(t)){let i=r.find(u=>u.key===mt.name)?.value,a={Name:i,Type:_.Grid,Columns:[]},l=this.getParameters().get(mt.dataset).find(u=>this.getDatasetName(u)===i).getAllChildren();for(let u of l){let c=u.getNodeName();if(u&&u.getAllChildren().length>0){let d=this.normalizePropertyValue(u.getAllChildren()[0].getNodeName());a[c]=d}}return a}}getParameterIsStatic(t){let r=!1,n=this.getParameters().get(t)[0],i=n&&n.getAllProperties();if(i){for(let a of i)if(a.key===m.static&&a.value==="true"){r=!0;break}}return r}get name(){return this.getProperty(m.Name)}get formFactor(){return this.getProperty(m.formFactor)}set formFactor(t){this.setProperty(m.formFactor,t)}async toJSON(t){if(this.id)return null;let r=await this.parametersToJSON(t),n=parseInt(this.formFactor,10);return{CustomControlId:this.customControlId,FormFactor:isNaN(n)?-1:n,Name:this.name,Version:null,Parameters:r,ShouldOverrideControlVisible:!1}}normalizePropertyValue(t){return t.startsWith(jr.StartTag)&&(t=t.substring(1)),t}async parametersToJSON(t){let r=[];if(!this.name)return r;try{let n=await t.formModelService.customControlDiscoveryService.getCustomControlMetadata(this.name);if(n)if(n.configurations){let i=n.configurations,a=this.getParameters();for(let[o,s]of a)if(this.isDataSet(o))for(let l of a.get(o)){let u=l.getAllProperties(),c=this.getDatasetName(l),d=i.get(c),p=await this.parameterJSON(o,u,d,t);r.push({Name:c,Value:p})}else if(this.isGroups(s))r.push({Name:o,Value:{Type:jb.GroupDefinition,Value:this.normalizePropertyValue(this.getParameterNodeChild(s[0].NodeName).NodeName)}}),i.get(o).groupSet?.forEach(u=>{u.groupConfigurableProperties.forEach(async c=>{let d=c.name;c.propertyType===Io.dataset?a.get(mt.dataset)?.some(f=>this.getDatasetName(f)===d)||r.push({Name:d,Value:{Name:d,Columns:[],Type:_.Grid}}):c.propertyType===Io.property&&(a.has(d)||r.push({Name:d,Value:{Usage:c.usage}}))})});else{let l=s[0].getAllProperties(),u=i.get(o),c=await this.parameterJSON(o,l,u,t);if(c)r.push({Name:o,Value:c});else{(0,nr.trackInfoTrace)(pt,{eventName:`${zr}/parametersToJSON`,eventData:{message:`Configuration metadata for custom control parameter ${o} is not available for custom control : ${this.name}.`}}),r=[];break}}}else(0,nr.trackErrorTrace)(pt,{eventName:`${zr}/parametersToJSON`,eventData:{message:"Custom Control Manifest Property Info not available"}},new Error(`Custom Control Manifest Property Info not available for custom control : ${this.name}.`));else(0,nr.trackErrorTrace)(pt,{eventName:`${zr}/parametersToJSON`,eventData:{message:"Custom Control Manifest not found"}},new Error(`No custom control manifest found for ${this.name}`))}catch(n){(0,nr.trackErrorTrace)(pt,{eventName:`${zr}/parametersToJSON`,eventData:{message:"parameters to json failed"}},n)}return r}async parameterJSON(t,r,n,i){if(this.isDataSet(t)){let a=n,o=r.find(s=>s.key===mt.name)?.value;if(a)return this.getParameterChildrenValues(t,r);{let s=new Error(`No dataset manifest info for ${o}`);(0,nr.trackErrorTrace)(pt,{eventName:`${zr}/parameterJSON`,eventData:{message:"Missing custom control manifest dataset info"}},s)}}else{let a=n,o=r&&r.find(l=>l.key===m.Type),s=a&&!a.ofTypeGroup.every(l=>!Pp.includes(l));if(this.isLookupType(o?.value)||this.isLookupType(a?.ofType)||s)if(a){let l=a.usage,u=this.getParameterIsStatic(t),c=a.isPrimary;if(this.name===wn.FormComponent){let d=this.getFormComponentValueByParameterName(m.bindAttribute),p=await i.formModelService.loadLookupModel(d),f=p.lookupColumn,h=this.getLookupDataTypeFromAttributeMetadata(f);return{Name:t,Type:h,Usage:l,Static:u,Primary:c,EntityName:p.primaryTableName,Value:d,ViewId:this.getFormComponentValueByParameterName(Wb.DefaultViewId),TargetEntityType:f.targets[0],FilterRelationshipName:this.getFormComponentValueByParameterName(m.FilterRelationshipName),AvailableViewIds:this.getFormComponentValueByParameterName(m.AvailableViewIds),DependentAttributeName:this.getFormComponentValueByParameterName(m.DependentAttributeName),DependentAttributeType:this.getFormComponentValueByParameterName(m.DependentAttributeType),AllowFilterOff:T.IsStrictTrue(this.getFormComponentValueByParameterName(m.AllowFilterOff)),DisableQuickFind:T.IsStrictTrue(this.getFormComponentValueByParameterName(m.DisableQuickFind)),EnableViewPicker:!T.IsStrictTrue(this.getFormComponentValueByParameterName(m.DisableViewPicker))}}return{Name:t,Usage:l,Static:u,Primary:c,Value:this.getParameterValue(t)}}else{let l=new Error(`No lookup manifest info for ${t}`);(0,nr.trackErrorTrace)(pt,{eventName:`${zr}/parameterJSON`,eventData:{message:"Missing custom control manifest lookup property info"}},l)}if(a){let l=a.usage,u=this.getParameterIsStatic(t),c=this.getParameterValue(t),d=a.isPrimary;if(o){let f=o.value;return{Type:f,Static:u,Usage:l,Value:this.isNumberTypeProperty(a,f)&&Number(c)?Number(c):c,Primary:d}}if(a.ofType)return{Type:a.ofType,Static:u,Usage:l,Value:c,Primary:!0};if(a.ofTypeGroup)return{Static:u,Usage:l,Value:c,Primary:!0};let p=new Error(`No property type info for ${t}`);(0,nr.trackErrorTrace)(pt,{eventName:`${zr}/parameterJSON`,eventData:{message:"Missing property type info"}},p)}else{let l=new Error(`No property manifest info for ${t}`);(0,nr.trackWarningTrace)(pt,{eventName:`${zr}/parameterJSON`,eventData:{message:"Missing custom control manifest property info"}},l)}}return null}getLookupDataTypeFromAttributeMetadata(t){let{attributeType:r,format:n}=t;switch(r){case O.Customer:return _.LookupCustomer;case O.Owner:return _.LookupOwner;case O.PartyList:return _.LookupPartyList;default:return n===k.Regarding?_.LookupRegarding:_.LookupSimple}}isLookupType(t){return Pp.includes(t)}isNumberTypeProperty(t,r){return Tp.includes(r)||t.ofTypeGroup.some(n=>Tp.includes(n))}isDataSet(t){return mt.dataset===t}isGroups(t){return!!t[0].getAllProperties().find(n=>n.key==="isGroup"&&n.value==="true")}}});var q,Xp=I(()=>{"use strict";q=class{static get CustomControl(){return"CustomControl"}static get ACIControl(){return"ACIControl"}static get ReferencePanelSearchWidget(){return"ReferencePanelSearchWidget"}static get SearchWidgetControl(){return"SearchWidgetControl"}static get SocialInsightControl(){return"SocialInsightControl"}static get NotesControl(){return"notescontrol"}static get TimerControl(){return"TimerControl"}static get MapsControl(){return"MapsControl"}static get IframeControl(){return"IframeControl"}static get WebResourceHtmlControl(){return"WebResourceHtmlControl"}static get QuickFormCollectionControl(){return"QuickFormCollectionControl"}static get QuickFormControl(){return"QuickFormControl"}static get GridControl(){return"GridControl"}static get SubGridControl(){return"SubGridControl"}static get WebResourceImageControl(){return"WebResourceImageControl"}static get TimeLineControl(){return"TimeLineControl"}static get LeadScoringControl(){return"LeadScoringControl"}}});var R,Hi,$e,Vl=I(()=>{"use strict";Ue();wo();Le();ot();Do();Hn();Xp();rr();R=class{static get TextBoxControl(){return"4273EDBD-AC1D-40d3-9FB2-095C621B552D"}static get TickerControl(){return"1E1FC551-F7A8-43af-AC34-A8DC35C7B6D4"}static get UrlControl(){return"71716B6C-711E-476c-8AB8-5D11542BFB47"}static get PhoneNumberControl(){return"8C10015A-B339-4982-9474-A95FE05631A5"}static get EmailAddressControl(){return"ADA2203E-B4CD-49be-9DDF-234642B43B52"}static get RadioControl(){return"67FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED"}static get LookupControl(){return"270BD3DB-D9AF-4782-9025-509E298DEC0A"}static get DateTimeControl(){return"5B773807-9FB2-42db-97C3-7A91EFF8ADFF"}static get IntegerControl(){return"C6D124CA-7EDA-4a60-AEA9-7FB8D318B68F"}static get MoneyControl(){return"533B9E00-756B-4312-95A0-DC888637AC78"}static get FloatControl(){return"0D2C745A-E5A8-4c8f-BA63-C6D3BB604660"}static get DecimalControl(){return"C3EFE0C3-0EC6-42be-8349-CBD9079DFD8E"}static get TextAreaControl(){return"E0DECE4B-6FC8-4a8f-A065-082708572369"}static get PicklistControl(){return"3EF39988-22BB-4f0b-BBBE-64B5A3748AEE"}static get HiddenInputControl(){return"5546E6CD-394C-4BEE-94A8-4425E17EF6C6"}static get GridControl(){return"E7A81278-8635-4D9E-8D4D-59480B391C5B"}static get CheckBoxControl(){return"B0C6723A-8503-4fd7-BB28-C8A06AC933C2"}static get IframeControl(){return"FD2A7985-3187-444e-908D-6624B21F69C0"}static get SocialInsightControl(){return"86B9E25E-695E-4FEF-AC69-F05CFA96739C"}static get OrgInsightsControl(){return"76B9E25E-695E-4FEF-AC69-F05CFA96739C"}static get DurationControl(){return"AA987274-CE4E-4271-A803-66164311A958"}static get RegardingControl(){return"F3015350-44A2-4aa0-97B5-00166532B5E9"}static get PartyListControl(){return"CBFB742C-14E7-4a17-96BB-1A13F7F64AA2"}static get TimeLineControl(){return"06375649-c143-495e-a496-c962e5b4488e"}static get TimeLineControlUC(){return"06375649-C143-495E-A496-C962E5B4488E"}static get TimeZonePicklistControl(){return"7C624A0B-F59E-493d-9583-638D34759266"}static get LanguagePickerControl(){return"671A9387-CA5A-4d1e-8AB7-06E39DDCF6B5"}static get AccessTeamTablePickerControl(){return"3F4E2A56-F102-4B4D-AB9C-F1574CA5BFDA"}static get KBViewerControl(){return"A62B6FA9-169E-406C-B1AA-EAB828CB6026"}static get PicklistStatusControl(){return"5D68B988-0661-4db2-BC3E-17598AD3BE6C"}static get EmailBodyControl(){return"6F3FB987-393B-4d2d-859F-9D0F0349B6AD"}static get PicklistLookupControl(){return"2305E33A-BAD3-4022-9E15-1856CF218333"}static get RelationshipRolePicklistControl(){return"5F986642-5961-4D9F-AB5E-643D71E231E9"}static get RelatedInformationControl(){return"163B90A6-EB64-49D2-9DF8-3C84A4F0A0F8"}static get CoverPagePicklistControl(){return"4168A05C-D857-46AF-8457-5BB47EB04EA1"}static get MailMergeLanguagePickerControl(){return"B634828E-C390-444A-AFE6-E07315D9D970"}static get ConnectionControl(){return"3246F906-1F71-45F7-B11F-D7BE0F9D04C9"}static get ConnectionRoleObjectTypeListControl(){return"821ACF1A-7E46-4A0C-965D-FE14A57D78C7"}static get MapsControl(){return"62B0DF79-0464-470F-8AF7-4483CFEA0C7D"}static get MapLinkControl(){return"91DC0675-C8B9-4421-B1E0-261CEBF02BAC"}static get WebResourceHtmlControl(){return"9FDF5F91-88B1-47F4-AD53-C11EFC01A01D"}static get WebResourceImageControl(){return"587CDF98-C1D5-4BDE-8473-14A0BC7644A7"}static get WebResourceSilverlightControl(){return"080677DB-86EC-4544-AC42-F927E74B491F"}static get ReportControl(){return"A28F441B-916C-4865-87FD-0C5D53BD59C9"}static get ArticleContentControl(){return"F02EF977-2564-4B9A-B2F0-DF083D8A019B"}static get ProcessControl(){return"06E9F7AF-1F54-4681-8EEC-1E21A1CEB465"}static get ActivitiesWallControl(){return"6636847D-B74D-4994-B55A-A6FAF97ECEA2"}static get QuickFormControl(){return"69AF7DCA-2E3B-4EE7-9201-0DA731DD2413"}static get QuickFormCollectionControl(){return"5C5600E0-1D6E-4205-A272-BE80DA87FD42"}static get LinkControl(){return"DFDF1CDE-837B-4AC9-98CF-AC74361FD89D"}static get CompositionLinkControl(){return"DB1284EF-9FFC-4E99-B382-0CC082FE2364"}static get ErrorStatusControl(){return"F4C16ECA-CA81-4E39-9448-834B8378721E"}static get ActivitiesContainerControl(){return"C72511AB-84E5-4FB7-A543-25B4FC01E83E"}static get AccessPrivilegeControl(){return"F93A31B2-99AC-4084-8EC2-D4027C31369A"}static get TimerControl(){return"9C5CA0A1-AB4D-4781-BE7E-8DFBE867B87E"}static get DynamicPropertyListControl(){return"6896F004-B17A-4202-861E-8B7EA2080E0B"}static get ButtonControl(){return"00AD73DA-BD4D-49C6-88A8-2F4F4CAD4A20"}static get SearchWidgetControl(){return"E616A57F-20E0-4534-8662-A101B5DDF4E0"}static get EmailRecipientActivityControl(){return"26E9760F-7454-40DE-BB07-F6DCCCB82040"}static get LabelControl(){return"39354E4A-5015-4D74-8031-EA9EB73A1322"}static get CustomControl(){return"F9A8A302-114E-466A-B582-6771B2AE0D92"}static get EditFilterControl(){return"1479835F-F852-4679-B864-C6892A2844C9"}static get RichEditorControl(){return"F94DB24F-263D-44A7-B38E-A35E9854812B"}static get PowerBIControl(){return"8C54228C-1B25-4909-A12A-F2B968BB0D62"}static get EmailEngagementActionsControl(){return"F454228D-1D25-4319-E12F-D27968BC0234"}static get ACIControl(){return"C8BFBBEF-6851-4401-A0CC-7450062FE085"}static get ChoicesControl(){return"4AA28AB7-9C13-4F57-A73D-AD894D048B5F"}static get ReferencePanelSubgridControl(){return"02D4264B-47E2-4B4C-AA95-F439F3F4D458"}static get ReferencePanelSearchWidget(){return"7CCD1494-1F7A-4E3A-8BDE-F32069DAEB9F"}static get ReferencePanelQuickFormCollectionControl(){return"B68B05F0-A46D-43F8-843B-917920AF806A"}static get SpacerControl(){return"E4BAB03A-A9A5-4C23-CC3B-54AA680150E2"}},Hi=class{static get RelationshipAssistant(){return"3ff9a528-dd50-4aca-8f10-2e5ed73513ad"}static get PredictiveLeadScoring(){return"6f503f2a-d033-4106-b62c-f8f2e5f01a57"}},$e=class e{static FieldControlIds=e.initializeFieldControls();static UnboundControlIds=e.initializeUnboundControls();static ControlsAllowedForReferencePanel=e.initializeReferencePanelControls();static ControlsAllowedForFooter=e.initializeFooterControls();static CustomControlIdMap=new ft;static initializeFieldControls(){let t=new ft,r=e.getControlName(O.SingleLineofText,k.Phone);t.add(r,new P(R.PhoneNumberControl));let n=e.getControlName(O.SingleLineofText,k.TextArea);t.add(n,new P(R.TextAreaControl));let i=e.getControlName(O.SingleLineofText,k.Text);t.add(i,new P(R.TextBoxControl));let a=e.getControlName(O.SingleLineofText,k.Email);t.add(a,new P(R.EmailAddressControl));let o=e.getControlName(O.SingleLineofText,k.Url);t.add(o,new P(R.UrlControl));let s=e.getControlName(O.SingleLineofText,k.TickerSymbol);t.add(s,new P(R.TickerControl));let l=e.getControlName(O.SingleLineofText,k.PhoneticGuide);t.add(l,new P(R.TextBoxControl));let u=e.getControlName(O.WholeNumber,k.Duration);t.add(u,new P(R.DurationControl));let c=e.getControlName(O.WholeNumber,k.Language);t.add(c,new P(R.LanguagePickerControl));let d=e.getControlName(O.WholeNumber,k.TimeZone);t.add(d,new P(R.TimeZonePicklistControl));let p=e.getControlName(O.WholeNumber,k.None);t.add(p,new P(R.IntegerControl));let f=e.getControlName(O.DateTime,k.DateOnly);t.add(f,new P(R.DateTimeControl));let h=e.getControlName(O.DateTime,k.DateAndTime);t.add(h,new P(R.DateTimeControl));let y=e.getControlName(O.LookupType,k.None);t.add(y,new P(R.LookupControl));let w=e.getControlName(O.CustomerType,k.None);t.add(w,new P(R.LookupControl));let N=e.getControlName(O.FloatingPointNumber,k.None);t.add(N,new P(R.FloatControl));let D=e.getControlName(O.DecimalNumber,k.None);t.add(D,new P(R.DecimalControl));let x=e.getControlName(O.Currency,k.None);t.add(x,new P(R.MoneyControl));let F=e.getControlName(O.MultipleLineofText,k.None);t.add(F,new P(R.TextAreaControl));let X=e.getControlName(O.MultipleLineofText,k.Text);t.add(X,new P(R.TextAreaControl));let V=e.getControlName(O.MultipleLineofText,k.TextArea);t.add(V,new P(R.TextAreaControl));let M=e.getControlName(O.MultipleLineofText,k.Email);t.add(M,new P(R.EmailBodyControl));let U=e.getControlName(O.OptionSet,k.None);t.add(U,new P(R.PicklistControl));let B=e.getControlName(O.TwoOptions,k.None);t.add(B,new P(R.RadioControl));let z=e.getControlName(O.Image,k.None);t.add(z,new P(R.WebResourceImageControl));let $=e.getControlName(O.Image,k.None);t.add($,new P(R.WebResourceHtmlControl));let Ee=e.getControlName(O.TwoOptions,"Radio");t.add(Ee,new P(R.RadioControl));let ye=e.getControlName(O.TwoOptions,"CheckBox");t.add(ye,new P(R.CheckBoxControl));let Ge=e.getControlName(O.TwoOptions,"List");t.add(Ge,new P(R.PicklistControl));let Ze=e.getControlName(O.State,k.None);t.add(Ze,new P(R.PicklistControl));let pe=e.getControlName(O.Status,k.None);t.add(pe,new P(R.PicklistStatusControl));let vt=e.getControlName(O.OwnerType,k.None);t.add(vt,new P(R.LookupControl));let lc=e.getControlName(O.PartyListType,k.None);t.add(lc,new P(R.PartyListControl));let fP=e.getControlName(O.LookupType,k.Regarding);t.add(fP,new P(R.RegardingControl));let mP=e.getControlName(O.MultiSelectOptionSet,k.None);return t.add(mP,new P(R.ChoicesControl)),t}static getControlName(t,r){return t+"_"+r}static getControlIdByTypeAndFormat(t,r){let n=e.getControlName(t.toString(),r.toString());return e.FieldControlIds.containsKey(n)?e.FieldControlIds.getValue(n):null}static getTypeAndFormatByControlOrUniqueId(t){for(let r in e.FieldControlIds.getKeys())if(e.FieldControlIds.getValue(e.FieldControlIds.getKeys()[r]).guidString.toLowerCase()===t)return e.FieldControlIds.getKeys()[r]}static getControlDataTypeByControlOrUniqueId(t){if(!E.IsNullOrEmptyGuid(t)){let r=e.getTypeAndFormatByControlOrUniqueId(t.guidString.toLowerCase());return r=E.IsNullOrUndefined(r)?e.getUnboundControlNameFromIdentifier(t):r.substring(0,r.indexOf("_")),r}return null}static isCustomControl(t){return E.IsNullOrUndefined(t.control)||E.IsNullOrUndefined(t.control.ClassId)||t.control.ClassId.guidString===R.CustomControl}static initializeUnboundControls(){let t=new ft;return t.add(R.ACIControl,q.ACIControl),t.add(R.IframeControl,q.IframeControl),t.add(R.SearchWidgetControl,q.SearchWidgetControl),t.add(R.MapsControl,q.MapsControl),t.add(R.QuickFormCollectionControl,q.QuickFormCollectionControl),t.add(R.GridControl,q.SubGridControl),t.add(R.WebResourceImageControl,q.WebResourceImageControl),t.add(R.WebResourceHtmlControl,q.WebResourceHtmlControl),t.add(R.ReferencePanelSearchWidget,q.SearchWidgetControl),t.add(R.ReferencePanelQuickFormCollectionControl,q.QuickFormCollectionControl),t.add(R.ReferencePanelSubgridControl,q.SubGridControl),t.add(R.TimerControl,q.TimerControl),t.add(R.TimeLineControl,q.NotesControl),t.add(R.TimeLineControlUC,q.NotesControl),t.add(R.SocialInsightControl,q.SocialInsightControl),t.add(Hi.RelationshipAssistant,q.CustomControl),t}static initializeReferencePanelControls(){let t=new ft;return t.add(R.IframeControl,q.IframeControl),t.add(R.ReferencePanelSearchWidget,q.SearchWidgetControl),t.add(R.ReferencePanelQuickFormCollectionControl,q.QuickFormCollectionControl),t.add(R.ReferencePanelSubgridControl,q.SubGridControl),t.add(R.WebResourceHtmlControl,q.WebResourceHtmlControl),t.add(R.WebResourceImageControl,q.WebResourceHtmlControl),t}static initializeFooterControls(){let t=new qi;return t.add(Wi.IFRAME,!0),t.add(Wi.SPACER,!0),t.add(Wi.WEB_RESOURCE_HTML,!0),t}static isUnboundFormControl(t){if(E.IsNullOrUndefined(t)||E.IsNullOrUndefined(t.control)||E.IsNullOrUndefined(t.control.ClassId))return!1;let r=e.getUniqueIdentifierForControl(t.control);return e.UnboundControlIds.containsKey(r.guidString)}static isReferencePanelSection(t){return!E.IsNullOrUndefined(t)&&!E.IsNullOrUndefined(t.Name)&&t.Name.indexOf(we.referencePanelNamePrefix)===0}static isUnboundFormControlByIdentifier(t){return E.IsNullOrUndefined(t)||E.IsNullOrUndefined(t.guidString)?!1:e.UnboundControlIds.containsKey(t.guidString)}static getUnboundFormControlName(t){let r=T.EmptyString;if(E.IsNullOrUndefined(t)||E.IsNullOrUndefined(t.control)||E.IsNullOrUndefined(t.control.ClassId))return r;let n=e.getUniqueIdentifierForControl(t.control);return e.UnboundControlIds.getValue(n.guidString).toString()}static getUnboundControlNameFromIdentifier(t){return E.IsNullOrUndefined(t)||E.IsNullOrUndefined(t.guidString)?T.EmptyString:e.UnboundControlIds.getValue(t.guidString).toString()}static isSpacerControl(t){return t===R.SpacerControl}static GetRowSpan(t){let r=t.ClassId;if(e.isRelationshipAssistantControl(t))r=t.UniqueId;else if(r.guidString===R.CustomControl&&!E.IsNullOrUndefined(t.UniqueId)){let n=t.UniqueId.ToString();e.CustomControlIdMap.containsKey(n)&&(r=e.CustomControlIdMap.getValue(n))}switch(e.UnboundControlIds.getValue(r.guidString)){case q.IframeControl:case q.ACIControl:case q.SocialInsightControl:return 6;case q.SubGridControl:case q.CustomControl:return 4;case q.WebResourceImageControl:return 15;case q.WebResourceHtmlControl:return 15;case q.MapsControl:return 8;case q.SearchWidgetControl:return 10;case q.NotesControl:case q.TimeLineControl:return 15;case q.TimerControl:return 2;default:}}static isLookUpControl(t){return!E.IsNullOrUndefined(t)&&t.ClassId.guidString===R.LookupControl}static isRelationshipAssistantOrLeadScoringControl(t){return!E.IsNullOrUndefined(t)&&e.isRelationshipAssistantOrLeadScoring(t.UniqueId)}static isRelationshipAssistantOrLeadScoring(t){return!E.IsNullOrUndefined(t)&&(t.guidString===Hi.RelationshipAssistant||t.guidString===Hi.PredictiveLeadScoring)}static isRelationshipAssistantControl(t){return!E.IsNullOrUndefined(t)&&e.isRelationshipAssistant(t.UniqueId)}static isRelationshipAssistant(t){return!E.IsNullOrUndefined(t)&&t.guidString===Hi.RelationshipAssistant}static getUniqueIdentifierForControl(t){if(E.IsNullOrUndefined(t))return null;let r=t.ClassId;if(e.isRelationshipAssistantControl(t))r=t.UniqueId;else if(r.guidString===R.CustomControl&&!E.IsNullOrUndefined(t.UniqueId)){let n=t.UniqueId.ToString();e.CustomControlIdMap.containsKey(n)&&(r=e.CustomControlIdMap.getValue(n))}return r}}});var Gl,Ew=I(()=>{"use strict";Gl=class{listeners=[];listenersOncer=[];on(t){return this.listeners.push(t),{dispose:()=>this.off(t)}}once(t){this.listenersOncer.push(t)}off(t){let r=this.listeners.indexOf(t);r>-1&&this.listeners.splice(r,1)}emit(t){this.listeners.forEach(r=>r(t)),this.listenersOncer.forEach(r=>r(t)),this.listenersOncer=[]}pipe(t){return this.on(r=>t.emit(r))}}});var Zn,Qi,Nw,Dw,An,Iw,_w,Kp=I(()=>{"use strict";(function(e){e[e.Center=0]="Center",e[e.Left=1]="Left",e[e.Right=2]="Right"})(Zn||(Zn={}));(function(e){e[e.Left=0]="Left",e[e.Top=1]="Top"})(Qi||(Qi={}));(function(e){e[e.Top=0]="Top",e[e.Middle=1]="Middle"})(Nw||(Nw={}));(function(e){e[e.None=0]="None",e[e.Create=1]="Create",e[e.Existing=2]="Existing",e[e.ReadOnly=3]="ReadOnly",e[e.Disabled=4]="Disabled",e[e.BulkEdit=6]="BulkEdit",e[e.Merge=7]="Merge",e[e.Print=8]="Print",e[e.FollowUp=9]="FollowUp"})(Dw||(Dw={}));(function(e){e[e.None=-1]="None",e[e.AppointmentBook=0]="AppointmentBook",e[e.Hardcoded=1]="Hardcoded",e[e.Main=2]="Main",e[e.MiniCampaignBO=3]="MiniCampaignBO",e[e.Preview=4]="Preview",e[e.Dashboard=5]="Dashboard",e[e.Quick=6]="Quick",e[e.Mobile=7]="Mobile",e[e.Read=8]="Read",e[e.QuickCreate=9]="QuickCreate",e[e.Dialog=10]="Dialog",e[e.Card=11]="Card",e[e.TaskBasedForm=12]="TaskBasedForm",e[e.InteractionCentricDashboard=13]="InteractionCentricDashboard"})(An||(An={}));(function(e){e[e.None=0]="None",e[e.SystemRequired=1]="SystemRequired",e[e.ApplicationRequired=2]="ApplicationRequired",e[e.Recommended=3]="Recommended"})(Iw||(Iw={}));(function(e){e[e.Boolean=0]="Boolean",e[e.Customer=1]="Customer",e[e.DateTime=2]="DateTime",e[e.Decimal=3]="Decimal",e[e.Double=4]="Double",e[e.Integer=5]="Integer",e[e.Lookup=6]="Lookup",e[e.Memo=7]="Memo",e[e.Money=8]="Money",e[e.Owner=9]="Owner",e[e.PartyList=10]="PartyList",e[e.Picklist=11]="Picklist",e[e.State=12]="State",e[e.Status=13]="Status",e[e.String=14]="String",e[e.Uniqueidentifier=15]="Uniqueidentifier",e[e.CalendarRules=16]="CalendarRules",e[e.Virtual=17]="Virtual",e[e.BigInt=18]="BigInt",e[e.ManagedProperty=19]="ManagedProperty",e[e.EntityName=20]="EntityName"})(_w||(_w={}))});var Ji,Pw=I(()=>{"use strict";No();Ji=kp({packageName:"cds-designer-models",features:{showAllPCFControls:{owner:"anchoudh",description:"Do not only show the controls that exist on the whitelist",enabledFor:{test:!1,preprod:!1,preview:!1,prod:!1,gov:!1,high:!1,dod:!1,mooncake:!1}},showTestControls:{owner:"lucorre",description:"Show advanced custom controls for testing (designated in Authoring Manifest with isTestOnly=true)",enabledFor:{test:!0,preprod:!1,preview:!1,prod:!1,gov:!1,high:!1,dod:!1,mooncake:!1}},enablePrefetchGetMoreComponentsLocalization:{owner:"vajagarl",description:"Enables prefetching the localization files for controls displayed in custom control picker",enabledFor:{test:!0,preprod:!0,preview:!0,prod:!0,gov:!0,high:!0,dod:!0,mooncake:!0}},showMapControl:{owner:"vayilavarapu",createdDate:"07/19/2022",description:"Show map control",enabledFor:{test:!0,preprod:!0,preview:!0,prod:!0,gov:!0,high:!0,dod:!0,mooncake:!0,ex:!0,rx:!0}},enableFallbackFormTemplate:{owner:"vajagarl",createdDate:"01/03/2023",description:"Enable default form template as fallback if unable to retrieve a form template from Dataverse",enabledFor:{test:!0,preprod:!0,preview:!0,prod:!0,gov:!0,high:!0,dod:!0,mooncake:!0,ex:!0,rx:!0}},enableAutoInsertionOfCellInRow:{owner:"debeshd",createdDate:"09/01/2023",description:"Enable the auto insertion of cell in a row when a section is initialized",enabledFor:{test:!1,preprod:!1,preview:!1,prod:!1,gov:!1,high:!1,dod:!1,mooncake:!1,ex:!1,rx:!1}},enableOneGridEvents:{owner:"aansu",createdDate:"08/21/2024",description:"Enable OneGrid events in form designer",enabledFor:{test:!0,preprod:!0,prod:!0,preview:!0,gov:!0,high:!0,dod:!0,mooncake:!0,ex:!0,rx:!0}},disablePBIComponents:{owner:"adekulkarni",createdDate:"02/13/2025",description:"Disables PBI components and cleans them up from the form",enabledFor:{test:!0,preprod:!1,preview:!1,prod:!1,gov:!1,high:!1,dod:!1,mooncake:!1,ex:!1,rx:!1}},enableAgentResponse:{owner:"jennietu",createdDate:"04/24/2025",description:"Enables agent response in form designer",enabledFor:{test:!0,preprod:!0,preview:!1,prod:!1,gov:!1,high:!1,dod:!1,mooncake:!1,ex:!1,rx:!1}},enableDelayedLocalizationForCustomControls:{owner:"aansu",createdDate:"06/08/2025",description:"Enables delayed localization of custom control",enabledFor:{test:!0,preprod:!0,preview:!0,prod:!0,gov:!0,high:!0,dod:!0,mooncake:!0,ex:!0,rx:!0}}}})});function Tw(e){return{...e,extractConfig:t=>MM(t,Object.keys(e.fallback))}}function MM(e,t){let r={};for(let n of t)typeof e[n]<"u"&&(r[n]=e[n]);return r}var Yp=I(()=>{"use strict";});var Zp=g((uJ,Rw)=>{var _o=new Proxy(function(){return _o},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:_o},apply:function(){return _o},construct:function(){return{}}}),Ow=function(){return _o};Object.setPrototypeOf(Ow,_o);Rw.exports=Ow});var Lw=g((cJ,xw)=>{var Po=new Proxy(function(){return Po},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:Po},apply:function(){return Po},construct:function(){return{}}}),Fw=function(){return Po};Object.setPrototypeOf(Fw,Po);xw.exports=Fw});var ef=g((dJ,Mw)=>{var To=new Proxy(function(){return To},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:To},apply:function(){return To},construct:function(){return{}}}),kw=function(){return To};Object.setPrototypeOf(kw,To);Mw.exports=kw});var Bw=g((pJ,Uw)=>{function UM(){this.__data__=[],this.size=0}Uw.exports=UM});var Xi=g((fJ,$w)=>{function BM(e,t){return e===t||e!==e&&t!==t}$w.exports=BM});var Oo=g((mJ,qw)=>{var $M=Xi();function qM(e,t){for(var r=e.length;r--;)if($M(e[r][0],t))return r;return-1}qw.exports=qM});var Gw=g((hJ,Vw)=>{var VM=Oo(),GM=Array.prototype,zM=GM.splice;function WM(e){var t=this.__data__,r=VM(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():zM.call(t,r,1),--this.size,!0}Vw.exports=WM});var Ww=g((gJ,zw)=>{var jM=Oo();function HM(e){var t=this.__data__,r=jM(t,e);return r<0?void 0:t[r][1]}zw.exports=HM});var Hw=g((vJ,jw)=>{var QM=Oo();function JM(e){return QM(this.__data__,e)>-1}jw.exports=JM});var Jw=g((yJ,Qw)=>{var XM=Oo();function KM(e,t){var r=this.__data__,n=XM(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}Qw.exports=KM});var Ro=g((bJ,Xw)=>{var YM=Bw(),ZM=Gw(),eU=Ww(),tU=Hw(),rU=Jw();function Ki(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Ki.prototype.clear=YM;Ki.prototype.delete=ZM;Ki.prototype.get=eU;Ki.prototype.has=tU;Ki.prototype.set=rU;Xw.exports=Ki});var Yw=g((wJ,Kw)=>{var nU=Ro();function iU(){this.__data__=new nU,this.size=0}Kw.exports=iU});var eA=g((AJ,Zw)=>{function aU(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}Zw.exports=aU});var rA=g((CJ,tA)=>{function oU(e){return this.__data__.get(e)}tA.exports=oU});var iA=g((SJ,nA)=>{function sU(e){return this.__data__.has(e)}nA.exports=sU});var tf=g((EJ,aA)=>{var lU=typeof global=="object"&&global&&global.Object===Object&&global;aA.exports=lU});var ir=g((NJ,oA)=>{var uU=tf(),cU=typeof self=="object"&&self&&self.Object===Object&&self,dU=uU||cU||Function("return this")();oA.exports=dU});var Fo=g((DJ,sA)=>{var pU=ir(),fU=pU.Symbol;sA.exports=fU});var dA=g((IJ,cA)=>{var lA=Fo(),uA=Object.prototype,mU=uA.hasOwnProperty,hU=uA.toString,xo=lA?lA.toStringTag:void 0;function gU(e){var t=mU.call(e,xo),r=e[xo];try{e[xo]=void 0;var n=!0}catch{}var i=hU.call(e);return n&&(t?e[xo]=r:delete e[xo]),i}cA.exports=gU});var fA=g((_J,pA)=>{var vU=Object.prototype,yU=vU.toString;function bU(e){return yU.call(e)}pA.exports=bU});var ei=g((PJ,gA)=>{var mA=Fo(),wU=dA(),AU=fA(),CU="[object Null]",SU="[object Undefined]",hA=mA?mA.toStringTag:void 0;function EU(e){return e==null?e===void 0?SU:CU:hA&&hA in Object(e)?wU(e):AU(e)}gA.exports=EU});var Hr=g((TJ,vA)=>{function NU(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}vA.exports=NU});var zl=g((OJ,yA)=>{var DU=ei(),IU=Hr(),_U="[object AsyncFunction]",PU="[object Function]",TU="[object GeneratorFunction]",OU="[object Proxy]";function RU(e){if(!IU(e))return!1;var t=DU(e);return t==PU||t==TU||t==_U||t==OU}yA.exports=RU});var wA=g((RJ,bA)=>{var FU=ir(),xU=FU["__core-js_shared__"];bA.exports=xU});var SA=g((FJ,CA)=>{var rf=wA(),AA=(function(){var e=/[^.]+$/.exec(rf&&rf.keys&&rf.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function LU(e){return!!AA&&AA in e}CA.exports=LU});var nf=g((xJ,EA)=>{var kU=Function.prototype,MU=kU.toString;function UU(e){if(e!=null){try{return MU.call(e)}catch{}try{return e+""}catch{}}return""}EA.exports=UU});var DA=g((LJ,NA)=>{var BU=zl(),$U=SA(),qU=Hr(),VU=nf(),GU=/[\\^$.*+?()[\]{}|]/g,zU=/^\[object .+?Constructor\]$/,WU=Function.prototype,jU=Object.prototype,HU=WU.toString,QU=jU.hasOwnProperty,JU=RegExp("^"+HU.call(QU).replace(GU,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function XU(e){if(!qU(e)||$U(e))return!1;var t=BU(e)?JU:zU;return t.test(VU(e))}NA.exports=XU});var _A=g((kJ,IA)=>{function KU(e,t){return e?.[t]}IA.exports=KU});var Cn=g((MJ,PA)=>{var YU=DA(),ZU=_A();function eB(e,t){var r=ZU(e,t);return YU(r)?r:void 0}PA.exports=eB});var Wl=g((UJ,TA)=>{var tB=Cn(),rB=ir(),nB=tB(rB,"Map");TA.exports=nB});var Lo=g((BJ,OA)=>{var iB=Cn(),aB=iB(Object,"create");OA.exports=aB});var xA=g(($J,FA)=>{var RA=Lo();function oB(){this.__data__=RA?RA(null):{},this.size=0}FA.exports=oB});var kA=g((qJ,LA)=>{function sB(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}LA.exports=sB});var UA=g((VJ,MA)=>{var lB=Lo(),uB="__lodash_hash_undefined__",cB=Object.prototype,dB=cB.hasOwnProperty;function pB(e){var t=this.__data__;if(lB){var r=t[e];return r===uB?void 0:r}return dB.call(t,e)?t[e]:void 0}MA.exports=pB});var $A=g((GJ,BA)=>{var fB=Lo(),mB=Object.prototype,hB=mB.hasOwnProperty;function gB(e){var t=this.__data__;return fB?t[e]!==void 0:hB.call(t,e)}BA.exports=gB});var VA=g((zJ,qA)=>{var vB=Lo(),yB="__lodash_hash_undefined__";function bB(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=vB&&t===void 0?yB:t,this}qA.exports=bB});var zA=g((WJ,GA)=>{var wB=xA(),AB=kA(),CB=UA(),SB=$A(),EB=VA();function Yi(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Yi.prototype.clear=wB;Yi.prototype.delete=AB;Yi.prototype.get=CB;Yi.prototype.has=SB;Yi.prototype.set=EB;GA.exports=Yi});var HA=g((jJ,jA)=>{var WA=zA(),NB=Ro(),DB=Wl();function IB(){this.size=0,this.__data__={hash:new WA,map:new(DB||NB),string:new WA}}jA.exports=IB});var JA=g((HJ,QA)=>{function _B(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}QA.exports=_B});var ko=g((QJ,XA)=>{var PB=JA();function TB(e,t){var r=e.__data__;return PB(t)?r[typeof t=="string"?"string":"hash"]:r.map}XA.exports=TB});var YA=g((JJ,KA)=>{var OB=ko();function RB(e){var t=OB(this,e).delete(e);return this.size-=t?1:0,t}KA.exports=RB});var eC=g((XJ,ZA)=>{var FB=ko();function xB(e){return FB(this,e).get(e)}ZA.exports=xB});var rC=g((KJ,tC)=>{var LB=ko();function kB(e){return LB(this,e).has(e)}tC.exports=kB});var iC=g((YJ,nC)=>{var MB=ko();function UB(e,t){var r=MB(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}nC.exports=UB});var jl=g((ZJ,aC)=>{var BB=HA(),$B=YA(),qB=eC(),VB=rC(),GB=iC();function Zi(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Zi.prototype.clear=BB;Zi.prototype.delete=$B;Zi.prototype.get=qB;Zi.prototype.has=VB;Zi.prototype.set=GB;aC.exports=Zi});var sC=g((eX,oC)=>{var zB=Ro(),WB=Wl(),jB=jl(),HB=200;function QB(e,t){var r=this.__data__;if(r instanceof zB){var n=r.__data__;if(!WB||n.length<HB-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new jB(n)}return r.set(e,t),this.size=r.size,this}oC.exports=QB});var af=g((tX,lC)=>{var JB=Ro(),XB=Yw(),KB=eA(),YB=rA(),ZB=iA(),e$=sC();function ea(e){var t=this.__data__=new JB(e);this.size=t.size}ea.prototype.clear=XB;ea.prototype.delete=KB;ea.prototype.get=YB;ea.prototype.has=ZB;ea.prototype.set=e$;lC.exports=ea});var cC=g((rX,uC)=>{var t$="__lodash_hash_undefined__";function r$(e){return this.__data__.set(e,t$),this}uC.exports=r$});var pC=g((nX,dC)=>{function n$(e){return this.__data__.has(e)}dC.exports=n$});var mC=g((iX,fC)=>{var i$=jl(),a$=cC(),o$=pC();function Hl(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new i$;++t<r;)this.add(e[t])}Hl.prototype.add=Hl.prototype.push=a$;Hl.prototype.has=o$;fC.exports=Hl});var gC=g((aX,hC)=>{function s$(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}hC.exports=s$});var yC=g((oX,vC)=>{function l$(e,t){return e.has(t)}vC.exports=l$});var of=g((sX,bC)=>{var u$=mC(),c$=gC(),d$=yC(),p$=1,f$=2;function m$(e,t,r,n,i,a){var o=r&p$,s=e.length,l=t.length;if(s!=l&&!(o&&l>s))return!1;var u=a.get(e),c=a.get(t);if(u&&c)return u==t&&c==e;var d=-1,p=!0,f=r&f$?new u$:void 0;for(a.set(e,t),a.set(t,e);++d<s;){var h=e[d],y=t[d];if(n)var w=o?n(y,h,d,t,e,a):n(h,y,d,e,t,a);if(w!==void 0){if(w)continue;p=!1;break}if(f){if(!c$(t,function(N,D){if(!d$(f,D)&&(h===N||i(h,N,r,n,a)))return f.push(D)})){p=!1;break}}else if(!(h===y||i(h,y,r,n,a))){p=!1;break}}return a.delete(e),a.delete(t),p}bC.exports=m$});var sf=g((lX,wC)=>{var h$=ir(),g$=h$.Uint8Array;wC.exports=g$});var CC=g((uX,AC)=>{function v$(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}AC.exports=v$});var EC=g((cX,SC)=>{function y$(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}SC.exports=y$});var PC=g((dX,_C)=>{var NC=Fo(),DC=sf(),b$=Xi(),w$=of(),A$=CC(),C$=EC(),S$=1,E$=2,N$="[object Boolean]",D$="[object Date]",I$="[object Error]",_$="[object Map]",P$="[object Number]",T$="[object RegExp]",O$="[object Set]",R$="[object String]",F$="[object Symbol]",x$="[object ArrayBuffer]",L$="[object DataView]",IC=NC?NC.prototype:void 0,lf=IC?IC.valueOf:void 0;function k$(e,t,r,n,i,a,o){switch(r){case L$:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case x$:return!(e.byteLength!=t.byteLength||!a(new DC(e),new DC(t)));case N$:case D$:case P$:return b$(+e,+t);case I$:return e.name==t.name&&e.message==t.message;case T$:case R$:return e==t+"";case _$:var s=A$;case O$:var l=n&S$;if(s||(s=C$),e.size!=t.size&&!l)return!1;var u=o.get(e);if(u)return u==t;n|=E$,o.set(e,t);var c=w$(s(e),s(t),n,i,a,o);return o.delete(e),c;case F$:if(lf)return lf.call(e)==lf.call(t)}return!1}_C.exports=k$});var OC=g((pX,TC)=>{function M$(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}TC.exports=M$});var Sn=g((fX,RC)=>{var U$=Array.isArray;RC.exports=U$});var xC=g((mX,FC)=>{var B$=OC(),$$=Sn();function q$(e,t,r){var n=t(e);return $$(e)?n:B$(n,r(e))}FC.exports=q$});var kC=g((hX,LC)=>{function V$(e,t){for(var r=-1,n=e==null?0:e.length,i=0,a=[];++r<n;){var o=e[r];t(o,r,e)&&(a[i++]=o)}return a}LC.exports=V$});var UC=g((gX,MC)=>{function G$(){return[]}MC.exports=G$});var qC=g((vX,$C)=>{var z$=kC(),W$=UC(),j$=Object.prototype,H$=j$.propertyIsEnumerable,BC=Object.getOwnPropertySymbols,Q$=BC?function(e){return e==null?[]:(e=Object(e),z$(BC(e),function(t){return H$.call(e,t)}))}:W$;$C.exports=Q$});var GC=g((yX,VC)=>{function J$(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}VC.exports=J$});var En=g((bX,zC)=>{function X$(e){return e!=null&&typeof e=="object"}zC.exports=X$});var jC=g((wX,WC)=>{var K$=ei(),Y$=En(),Z$="[object Arguments]";function eq(e){return Y$(e)&&K$(e)==Z$}WC.exports=eq});var uf=g((AX,JC)=>{var HC=jC(),tq=En(),QC=Object.prototype,rq=QC.hasOwnProperty,nq=QC.propertyIsEnumerable,iq=HC((function(){return arguments})())?HC:function(e){return tq(e)&&rq.call(e,"callee")&&!nq.call(e,"callee")};JC.exports=iq});var KC=g((CX,XC)=>{function aq(){return!1}XC.exports=aq});var Ql=g((Mo,ta)=>{var oq=ir(),sq=KC(),eS=typeof Mo=="object"&&Mo&&!Mo.nodeType&&Mo,YC=eS&&typeof ta=="object"&&ta&&!ta.nodeType&&ta,lq=YC&&YC.exports===eS,ZC=lq?oq.Buffer:void 0,uq=ZC?ZC.isBuffer:void 0,cq=uq||sq;ta.exports=cq});var Jl=g((SX,tS)=>{var dq=9007199254740991,pq=/^(?:0|[1-9]\d*)$/;function fq(e,t){var r=typeof e;return t=t??dq,!!t&&(r=="number"||r!="symbol"&&pq.test(e))&&e>-1&&e%1==0&&e<t}tS.exports=fq});var cf=g((EX,rS)=>{var mq=9007199254740991;function hq(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=mq}rS.exports=hq});var iS=g((NX,nS)=>{var gq=ei(),vq=cf(),yq=En(),bq="[object Arguments]",wq="[object Array]",Aq="[object Boolean]",Cq="[object Date]",Sq="[object Error]",Eq="[object Function]",Nq="[object Map]",Dq="[object Number]",Iq="[object Object]",_q="[object RegExp]",Pq="[object Set]",Tq="[object String]",Oq="[object WeakMap]",Rq="[object ArrayBuffer]",Fq="[object DataView]",xq="[object Float32Array]",Lq="[object Float64Array]",kq="[object Int8Array]",Mq="[object Int16Array]",Uq="[object Int32Array]",Bq="[object Uint8Array]",$q="[object Uint8ClampedArray]",qq="[object Uint16Array]",Vq="[object Uint32Array]",ge={};ge[xq]=ge[Lq]=ge[kq]=ge[Mq]=ge[Uq]=ge[Bq]=ge[$q]=ge[qq]=ge[Vq]=!0;ge[bq]=ge[wq]=ge[Rq]=ge[Aq]=ge[Fq]=ge[Cq]=ge[Sq]=ge[Eq]=ge[Nq]=ge[Dq]=ge[Iq]=ge[_q]=ge[Pq]=ge[Tq]=ge[Oq]=!1;function Gq(e){return yq(e)&&vq(e.length)&&!!ge[gq(e)]}nS.exports=Gq});var oS=g((DX,aS)=>{function zq(e){return function(t){return e(t)}}aS.exports=zq});var lS=g((Uo,ra)=>{var Wq=tf(),sS=typeof Uo=="object"&&Uo&&!Uo.nodeType&&Uo,Bo=sS&&typeof ra=="object"&&ra&&!ra.nodeType&&ra,jq=Bo&&Bo.exports===sS,df=jq&&Wq.process,Hq=(function(){try{var e=Bo&&Bo.require&&Bo.require("util").types;return e||df&&df.binding&&df.binding("util")}catch{}})();ra.exports=Hq});var Xl=g((IX,dS)=>{var Qq=iS(),Jq=oS(),uS=lS(),cS=uS&&uS.isTypedArray,Xq=cS?Jq(cS):Qq;dS.exports=Xq});var pf=g((_X,pS)=>{var Kq=GC(),Yq=uf(),Zq=Sn(),e3=Ql(),t3=Jl(),r3=Xl(),n3=Object.prototype,i3=n3.hasOwnProperty;function a3(e,t){var r=Zq(e),n=!r&&Yq(e),i=!r&&!n&&e3(e),a=!r&&!n&&!i&&r3(e),o=r||n||i||a,s=o?Kq(e.length,String):[],l=s.length;for(var u in e)(t||i3.call(e,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||t3(u,l)))&&s.push(u);return s}pS.exports=a3});var Kl=g((PX,fS)=>{var o3=Object.prototype;function s3(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||o3;return e===r}fS.exports=s3});var ff=g((TX,mS)=>{function l3(e,t){return function(r){return e(t(r))}}mS.exports=l3});var gS=g((OX,hS)=>{var u3=ff(),c3=u3(Object.keys,Object);hS.exports=c3});var yS=g((RX,vS)=>{var d3=Kl(),p3=gS(),f3=Object.prototype,m3=f3.hasOwnProperty;function h3(e){if(!d3(e))return p3(e);var t=[];for(var r in Object(e))m3.call(e,r)&&r!="constructor"&&t.push(r);return t}vS.exports=h3});var $o=g((FX,bS)=>{var g3=zl(),v3=cf();function y3(e){return e!=null&&v3(e.length)&&!g3(e)}bS.exports=y3});var AS=g((xX,wS)=>{var b3=pf(),w3=yS(),A3=$o();function C3(e){return A3(e)?b3(e):w3(e)}wS.exports=C3});var SS=g((LX,CS)=>{var S3=xC(),E3=qC(),N3=AS();function D3(e){return S3(e,N3,E3)}CS.exports=D3});var DS=g((kX,NS)=>{var ES=SS(),I3=1,_3=Object.prototype,P3=_3.hasOwnProperty;function T3(e,t,r,n,i,a){var o=r&I3,s=ES(e),l=s.length,u=ES(t),c=u.length;if(l!=c&&!o)return!1;for(var d=l;d--;){var p=s[d];if(!(o?p in t:P3.call(t,p)))return!1}var f=a.get(e),h=a.get(t);if(f&&h)return f==t&&h==e;var y=!0;a.set(e,t),a.set(t,e);for(var w=o;++d<l;){p=s[d];var N=e[p],D=t[p];if(n)var x=o?n(D,N,p,t,e,a):n(N,D,p,e,t,a);if(!(x===void 0?N===D||i(N,D,r,n,a):x)){y=!1;break}w||(w=p=="constructor")}if(y&&!w){var F=e.constructor,X=t.constructor;F!=X&&"constructor"in e&&"constructor"in t&&!(typeof F=="function"&&F instanceof F&&typeof X=="function"&&X instanceof X)&&(y=!1)}return a.delete(e),a.delete(t),y}NS.exports=T3});var _S=g((MX,IS)=>{var O3=Cn(),R3=ir(),F3=O3(R3,"DataView");IS.exports=F3});var TS=g((UX,PS)=>{var x3=Cn(),L3=ir(),k3=x3(L3,"Promise");PS.exports=k3});var RS=g((BX,OS)=>{var M3=Cn(),U3=ir(),B3=M3(U3,"Set");OS.exports=B3});var xS=g(($X,FS)=>{var $3=Cn(),q3=ir(),V3=$3(q3,"WeakMap");FS.exports=V3});var VS=g((qX,qS)=>{var mf=_S(),hf=Wl(),gf=TS(),vf=RS(),yf=xS(),$S=ei(),na=nf(),LS="[object Map]",G3="[object Object]",kS="[object Promise]",MS="[object Set]",US="[object WeakMap]",BS="[object DataView]",z3=na(mf),W3=na(hf),j3=na(gf),H3=na(vf),Q3=na(yf),ti=$S;(mf&&ti(new mf(new ArrayBuffer(1)))!=BS||hf&&ti(new hf)!=LS||gf&&ti(gf.resolve())!=kS||vf&&ti(new vf)!=MS||yf&&ti(new yf)!=US)&&(ti=function(e){var t=$S(e),r=t==G3?e.constructor:void 0,n=r?na(r):"";if(n)switch(n){case z3:return BS;case W3:return LS;case j3:return kS;case H3:return MS;case Q3:return US}return t});qS.exports=ti});var XS=g((VX,JS)=>{var bf=af(),J3=of(),X3=PC(),K3=DS(),GS=VS(),zS=Sn(),WS=Ql(),Y3=Xl(),Z3=1,jS="[object Arguments]",HS="[object Array]",Yl="[object Object]",e4=Object.prototype,QS=e4.hasOwnProperty;function t4(e,t,r,n,i,a){var o=zS(e),s=zS(t),l=o?HS:GS(e),u=s?HS:GS(t);l=l==jS?Yl:l,u=u==jS?Yl:u;var c=l==Yl,d=u==Yl,p=l==u;if(p&&WS(e)){if(!WS(t))return!1;o=!0,c=!1}if(p&&!c)return a||(a=new bf),o||Y3(e)?J3(e,t,r,n,i,a):X3(e,t,l,r,n,i,a);if(!(r&Z3)){var f=c&&QS.call(e,"__wrapped__"),h=d&&QS.call(t,"__wrapped__");if(f||h){var y=f?e.value():e,w=h?t.value():t;return a||(a=new bf),i(y,w,r,n,a)}}return p?(a||(a=new bf),K3(e,t,r,n,i,a)):!1}JS.exports=t4});var eE=g((GX,ZS)=>{var r4=XS(),KS=En();function YS(e,t,r,n,i){return e===t?!0:e==null||t==null||!KS(e)&&!KS(t)?e!==e&&t!==t:r4(e,t,r,n,YS,i)}ZS.exports=YS});var rE=g((zX,tE)=>{var n4=eE();function i4(e,t){return n4(e,t)}tE.exports=i4});var wf=g((WX,nE)=>{var a4=Cn(),o4=(function(){try{var e=a4(Object,"defineProperty");return e({},"",{}),e}catch{}})();nE.exports=o4});var Zl=g((jX,aE)=>{var iE=wf();function s4(e,t,r){t=="__proto__"&&iE?iE(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}aE.exports=s4});var Af=g((HX,oE)=>{var l4=Zl(),u4=Xi();function c4(e,t,r){(r!==void 0&&!u4(e[t],r)||r===void 0&&!(t in e))&&l4(e,t,r)}oE.exports=c4});var lE=g((QX,sE)=>{function d4(e){return function(t,r,n){for(var i=-1,a=Object(t),o=n(t),s=o.length;s--;){var l=o[e?s:++i];if(r(a[l],l,a)===!1)break}return t}}sE.exports=d4});var cE=g((JX,uE)=>{var p4=lE(),f4=p4();uE.exports=f4});var hE=g((qo,ia)=>{var m4=ir(),mE=typeof qo=="object"&&qo&&!qo.nodeType&&qo,dE=mE&&typeof ia=="object"&&ia&&!ia.nodeType&&ia,h4=dE&&dE.exports===mE,pE=h4?m4.Buffer:void 0,fE=pE?pE.allocUnsafe:void 0;function g4(e,t){if(t)return e.slice();var r=e.length,n=fE?fE(r):new e.constructor(r);return e.copy(n),n}ia.exports=g4});var yE=g((XX,vE)=>{var gE=sf();function v4(e){var t=new e.constructor(e.byteLength);return new gE(t).set(new gE(e)),t}vE.exports=v4});var wE=g((KX,bE)=>{var y4=yE();function b4(e,t){var r=t?y4(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}bE.exports=b4});var CE=g((YX,AE)=>{function w4(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}AE.exports=w4});var NE=g((ZX,EE)=>{var A4=Hr(),SE=Object.create,C4=(function(){function e(){}return function(t){if(!A4(t))return{};if(SE)return SE(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}})();EE.exports=C4});var Cf=g((eK,DE)=>{var S4=ff(),E4=S4(Object.getPrototypeOf,Object);DE.exports=E4});var _E=g((tK,IE)=>{var N4=NE(),D4=Cf(),I4=Kl();function _4(e){return typeof e.constructor=="function"&&!I4(e)?N4(D4(e)):{}}IE.exports=_4});var TE=g((rK,PE)=>{var P4=$o(),T4=En();function O4(e){return T4(e)&&P4(e)}PE.exports=O4});var FE=g((nK,RE)=>{var R4=ei(),F4=Cf(),x4=En(),L4="[object Object]",k4=Function.prototype,M4=Object.prototype,OE=k4.toString,U4=M4.hasOwnProperty,B4=OE.call(Object);function $4(e){if(!x4(e)||R4(e)!=L4)return!1;var t=F4(e);if(t===null)return!0;var r=U4.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&OE.call(r)==B4}RE.exports=$4});var Sf=g((iK,xE)=>{function q4(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}xE.exports=q4});var Ef=g((aK,LE)=>{var V4=Zl(),G4=Xi(),z4=Object.prototype,W4=z4.hasOwnProperty;function j4(e,t,r){var n=e[t];(!(W4.call(e,t)&&G4(n,r))||r===void 0&&!(t in e))&&V4(e,t,r)}LE.exports=j4});var ME=g((oK,kE)=>{var H4=Ef(),Q4=Zl();function J4(e,t,r,n){var i=!r;r||(r={});for(var a=-1,o=t.length;++a<o;){var s=t[a],l=n?n(r[s],e[s],s,r,e):void 0;l===void 0&&(l=e[s]),i?Q4(r,s,l):H4(r,s,l)}return r}kE.exports=J4});var BE=g((sK,UE)=>{function X4(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}UE.exports=X4});var qE=g((lK,$E)=>{var K4=Hr(),Y4=Kl(),Z4=BE(),e5=Object.prototype,t5=e5.hasOwnProperty;function r5(e){if(!K4(e))return Z4(e);var t=Y4(e),r=[];for(var n in e)n=="constructor"&&(t||!t5.call(e,n))||r.push(n);return r}$E.exports=r5});var Nf=g((uK,VE)=>{var n5=pf(),i5=qE(),a5=$o();function o5(e){return a5(e)?n5(e,!0):i5(e)}VE.exports=o5});var zE=g((cK,GE)=>{var s5=ME(),l5=Nf();function u5(e){return s5(e,l5(e))}GE.exports=u5});var XE=g((dK,JE)=>{var WE=Af(),c5=hE(),d5=wE(),p5=CE(),f5=_E(),jE=uf(),HE=Sn(),m5=TE(),h5=Ql(),g5=zl(),v5=Hr(),y5=FE(),b5=Xl(),QE=Sf(),w5=zE();function A5(e,t,r,n,i,a,o){var s=QE(e,r),l=QE(t,r),u=o.get(l);if(u){WE(e,r,u);return}var c=a?a(s,l,r+"",e,t,o):void 0,d=c===void 0;if(d){var p=HE(l),f=!p&&h5(l),h=!p&&!f&&b5(l);c=l,p||f||h?HE(s)?c=s:m5(s)?c=p5(s):f?(d=!1,c=c5(l,!0)):h?(d=!1,c=d5(l,!0)):c=[]:y5(l)||jE(l)?(c=s,jE(s)?c=w5(s):(!v5(s)||g5(s))&&(c=f5(l))):d=!1}d&&(o.set(l,c),i(c,l,n,a,o),o.delete(l)),WE(e,r,c)}JE.exports=A5});var Df=g((pK,YE)=>{var C5=af(),S5=Af(),E5=cE(),N5=XE(),D5=Hr(),I5=Nf(),_5=Sf();function KE(e,t,r,n,i){e!==t&&E5(t,function(a,o){if(i||(i=new C5),D5(a))N5(e,t,o,r,KE,n,i);else{var s=n?n(_5(e,o),a,o+"",e,t,i):void 0;s===void 0&&(s=a),S5(e,o,s)}},I5)}YE.exports=KE});var If=g((fK,ZE)=>{function P5(e){return e}ZE.exports=P5});var tN=g((mK,eN)=>{function T5(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}eN.exports=T5});var iN=g((hK,nN)=>{var O5=tN(),rN=Math.max;function R5(e,t,r){return t=rN(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,a=rN(n.length-t,0),o=Array(a);++i<a;)o[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=r(o),O5(e,this,s)}}nN.exports=R5});var oN=g((gK,aN)=>{function F5(e){return function(){return e}}aN.exports=F5});var uN=g((vK,lN)=>{var x5=oN(),sN=wf(),L5=If(),k5=sN?function(e,t){return sN(e,"toString",{configurable:!0,enumerable:!1,value:x5(t),writable:!0})}:L5;lN.exports=k5});var dN=g((yK,cN)=>{var M5=800,U5=16,B5=Date.now;function $5(e){var t=0,r=0;return function(){var n=B5(),i=U5-(n-r);if(r=n,i>0){if(++t>=M5)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}cN.exports=$5});var fN=g((bK,pN)=>{var q5=uN(),V5=dN(),G5=V5(q5);pN.exports=G5});var hN=g((wK,mN)=>{var z5=If(),W5=iN(),j5=fN();function H5(e,t){return j5(W5(e,t,z5),e+"")}mN.exports=H5});var vN=g((AK,gN)=>{var Q5=Xi(),J5=$o(),X5=Jl(),K5=Hr();function Y5(e,t,r){if(!K5(r))return!1;var n=typeof t;return(n=="number"?J5(r)&&X5(t,r.length):n=="string"&&t in r)?Q5(r[t],e):!1}gN.exports=Y5});var _f=g((CK,yN)=>{var Z5=hN(),eV=vN();function tV(e){return Z5(function(t,r){var n=-1,i=r.length,a=i>1?r[i-1]:void 0,o=i>2?r[2]:void 0;for(a=e.length>3&&typeof a=="function"?(i--,a):void 0,o&&eV(r[0],r[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++n<i;){var s=r[n];s&&e(t,s,n,a)}return t})}yN.exports=tV});var wN=g((SK,bN)=>{var rV=Df(),nV=_f(),iV=nV(function(e,t,r,n){rV(e,t,r,n)});bN.exports=iV});var $t,Vo=I(()=>{"use strict";(function(e){e[e.NotLoaded=0]="NotLoaded",e[e.Initialized=1]="Initialized",e[e.ConfigsLoaded=2]="ConfigsLoaded",e[e.Error=3]="Error"})($t||($t={}))});function CN(e,t,r="PROD"){let n=i=>`ShellSettings_ECS_ClientCache_${e}_${AN.EcsConfigType[i]}_${r}`;return{getData:i=>{let a=t.getItem(n(i));return Promise.resolve(a?JSON.parse(a):void 0)},putData:(i,a)=>(t.setItem(n(i),JSON.stringify(a)),Promise.resolve())}}var AN,aV,SN=I(()=>{"use strict";AN=se(ef()),aV=se(Zp());});var Pf,EN=I(()=>{"use strict";Fl();Pf=Eo({packageName:"shell-settings",settings:{prodEcsEndpoint:{description:"The url for the PROD ECS endpoint",values:{default:"https://ecs.office.com",dod:"https://config.ecs.dod.teams.microsoft.us",high:"https://config.ecs.gov.teams.microsoft.us",ex:"https://config.ecs.teams.eaglex.ic.gov",rx:"https://config.ecs.teams.microsoft.scloud"}},integrationEcsEndpoint:{description:"The url for the INT ECS endpoint",values:{default:"https://config.edge.skype.net"}}}})});var DN,IN,_N,PN,Tf,oV,eu,NN,Of=I(()=>{"use strict";DN=se(Zp()),IN=se(Lw()),_N=se(ef()),PN=se(rE()),Tf=se(wN());Vo();SN();EN();oV=60*1e3,eu=class{clientName;logger;ecsEndpoint;resolveLoadingPromise;loadingPromise=new Promise(t=>this.resolveLoadingPromise=t);_status=$t.NotLoaded;endpointType;clientConfigOverride;get status(){return this._status}constructor(t,r,n="PROD"){this.clientName=t,this.logger=r,this.endpointType=n,this.ecsEndpoint=n==="PROD"?Pf.prodEcsEndpoint:Pf.integrationEcsEndpoint}client=new IN.default;init=async({clientVersion:t,getFilters:r,cacheStorage:n=DN.StorageHelper.transientWithGlobalFallback,updateIntervalInMinutes:i,overrideEcsInitParams:a})=>{this.client.telemetryEventAdded.subscribe(this.logger.logEvent),this.client.configUpdated.subscribe(this.handleConfigUpdated);let o=(async()=>{let s=await r();return this.logEvent("FeaturesClient/configRequested",{ecsClientName:this.clientName,filters:s}),s});try{await this.client.initialize({clientName:this.clientName,clientVersion:t??"1.0.0.0",configsToFetch:[_N.EcsConfigType.Default],hosts:[this.ecsEndpoint],initialAppActiveState:!0,getEcsParameters:o,databaseInterface:CN(this.clientName,n,this.endpointType),...a}),this.client.requestUpdate(),this._status===$t.NotLoaded&&(this._status=$t.Initialized)}catch(s){this._status=$t.Error,this.resolveLoadingPromise(),this.logEvent("FeaturesClient/initializationFailed",{ecsClientName:this.clientName,error:s},"Error")}i&&window.setInterval(()=>this.client.requestUpdate(),i*oV)};getConfig=t=>{let r=this.getMergedClientConfigByTeamName(t.teamName),n=r?t.extractConfig(r):{};return(0,Tf.default)({},t.fallback,n,t.override,NN)};getAllConfigs=()=>this.getMergedClientConfig();getAllConfigsByTeamName=t=>this.getMergedClientConfigByTeamName(t);requestConfigUpdate=()=>{this.client.requestUpdate()};subscribe=(t,r)=>{let n=this.getConfig(t),i=this.client.configUpdated.subscribe(()=>{let a=this.getConfig(t);(0,PN.default)(a,n)||(n={...a},r(a))});return{unsubscribe:()=>i.unsubscribe()}};waitUntilLoaded=async t=>{if(t!==void 0){let r,n=new Promise((i,a)=>{r=window.setTimeout(()=>{a(new Error("Timed out waiting for configuration to load"))},t)});await Promise.race([this.loadingPromise,n]),clearTimeout(r)}else await this.loadingPromise};overrideClientConfig(t){this.logger.logEvent("FeaturesClient/overrideClientConfig",{clientConfigOverride:t}),this.clientConfigOverride=t}undoClientConfigOverride(){this.clientConfigOverride=void 0,this.logger.logEvent("FeaturesClient/undoClientConfigOverride")}getMergedClientConfig=()=>(0,Tf.default)({},this.client.getConfig()?.config,this.clientConfigOverride,NN);getMergedClientConfigByTeamName=t=>this.getMergedClientConfig()?.[t];handleConfigUpdated=()=>{let t=this.client.getConfig();if(t===void 0)return;this.resolveLoadingPromise(),this._status=$t.ConfigsLoaded;let{ConfigIDs:r,Headers:n}=t.config;this.logEvent("FeaturesClient/configUpdated",{ecsClientName:this.clientName,configIDs:r,ETag:n?.ETag})};logEvent=(t,r)=>{this.logger.logEvent(t,{ecsClientName:this.clientName,ecsEndpointType:this.endpointType,...r})}},NN=(e,t)=>{if(Array.isArray(t))return t}});var ON=g((RK,TN)=>{"use strict";var sV=()=>{let e={};return e.promise=new Promise((t,r)=>{e.resolve=t,e.reject=r}),e};TN.exports=sV});var Rf=g((FK,FN)=>{var Go=new Proxy(function(){return Go},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:Go},apply:function(){return Go},construct:function(){return{}}}),RN=function(){return Go};Object.setPrototypeOf(RN,Go);FN.exports=RN});var kN=g((xK,LN)=>{var zo=new Proxy(function(){return zo},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:zo},apply:function(){return zo},construct:function(){return{}}}),xN=function(){return zo};Object.setPrototypeOf(xN,zo);LN.exports=xN});var GN=g((LK,VN)=>{"use strict";var Ff=kN(),lV={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},uV={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},cV={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},$N={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},xf={};xf[Ff.ForwardRef]=cV;xf[Ff.Memo]=$N;function MN(e){return Ff.isMemo(e)?$N:xf[e.$$typeof]||lV}var dV=Object.defineProperty,pV=Object.getOwnPropertyNames,UN=Object.getOwnPropertySymbols,fV=Object.getOwnPropertyDescriptor,mV=Object.getPrototypeOf,BN=Object.prototype;function qN(e,t,r){if(typeof t!="string"){if(BN){var n=mV(t);n&&n!==BN&&qN(e,n,r)}var i=pV(t);UN&&(i=i.concat(UN(t)));for(var a=MN(e),o=MN(t),s=0;s<i.length;++s){var l=i[s];if(!uV[l]&&!(r&&r[l])&&!(o&&o[l])&&!(a&&a[l])){var u=fV(t,l);try{dV(e,l,u)}catch{}}}}return e}VN.exports=qN});function WN(e,t,r){let[n,i]=(0,aa.useState)(e.getConfig(t));return(0,aa.useEffect)(()=>{if(!r?.subscribe&&e.status===$t.ConfigsLoaded)return;let a=e.subscribe(t,o=>{i(o),r?.subscribe||a.unsubscribe()});return a?.unsubscribe},[]),n}function jN(e){return function(t,r){return WN(e,t,r)}}function HN(e,t,r,n){let i=a=>{let o=WN(e,t,n),s={...a,...o};return aa.default.createElement(r,{...s})};return(0,zN.default)(i,r),i.displayName=`WithFeature(${r.name})`,i}function QN(e,t,r,n){return t.reduce((i,a)=>HN(e,a,i,n),r)}function JN(e){return function(t,r,n){return HN(e,t,r,n)}}var zN,aa,Lf=I(()=>{"use strict";zN=se(GN()),aa=se(Rf());Vo();});var KN=g((UK,XN)=>{var hV=Df(),gV=_f(),vV=gV(function(e,t,r){hV(e,t,r)});XN.exports=vV});var tu=g((BK,YN)=>{var yV=ei(),bV=En(),wV="[object Symbol]";function AV(e){return typeof e=="symbol"||bV(e)&&yV(e)==wV}YN.exports=AV});var eD=g(($K,ZN)=>{var CV=Sn(),SV=tu(),EV=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,NV=/^\w*$/;function DV(e,t){if(CV(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||SV(e)?!0:NV.test(e)||!EV.test(e)||t!=null&&e in Object(t)}ZN.exports=DV});var nD=g((qK,rD)=>{var tD=jl(),IV="Expected a function";function kf(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(IV);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var o=e.apply(this,n);return r.cache=a.set(i,o)||a,o};return r.cache=new(kf.Cache||tD),r}kf.Cache=tD;rD.exports=kf});var aD=g((VK,iD)=>{var _V=nD(),PV=500;function TV(e){var t=_V(e,function(n){return r.size===PV&&r.clear(),n}),r=t.cache;return t}iD.exports=TV});var sD=g((GK,oD)=>{var OV=aD(),RV=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,FV=/\\(\\)?/g,xV=OV(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(RV,function(r,n,i,a){t.push(i?a.replace(FV,"$1"):n||r)}),t});oD.exports=xV});var uD=g((zK,lD)=>{function LV(e,t){for(var r=-1,n=e==null?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}lD.exports=LV});var hD=g((WK,mD)=>{var cD=Fo(),kV=uD(),MV=Sn(),UV=tu(),BV=1/0,dD=cD?cD.prototype:void 0,pD=dD?dD.toString:void 0;function fD(e){if(typeof e=="string")return e;if(MV(e))return kV(e,fD)+"";if(UV(e))return pD?pD.call(e):"";var t=e+"";return t=="0"&&1/e==-BV?"-0":t}mD.exports=fD});var vD=g((jK,gD)=>{var $V=hD();function qV(e){return e==null?"":$V(e)}gD.exports=qV});var bD=g((HK,yD)=>{var VV=Sn(),GV=eD(),zV=sD(),WV=vD();function jV(e,t){return VV(e)?e:GV(e,t)?[e]:zV(WV(e))}yD.exports=jV});var AD=g((QK,wD)=>{var HV=tu(),QV=1/0;function JV(e){if(typeof e=="string"||HV(e))return e;var t=e+"";return t=="0"&&1/e==-QV?"-0":t}wD.exports=JV});var ED=g((JK,SD)=>{var XV=Ef(),KV=bD(),YV=Jl(),CD=Hr(),ZV=AD();function e9(e,t,r,n){if(!CD(e))return e;t=KV(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var l=ZV(t[i]),u=r;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(i!=o){var c=s[l];u=n?n(c,l,s):void 0,u===void 0&&(u=CD(c)?c:YV(t[i+1])?[]:{})}XV(s,l,u),s=s[l]}return e}SD.exports=e9});var DD=g((XK,ND)=>{var t9=ED();function r9(e,t,r){return e==null?e:t9(e,t,r)}ND.exports=r9});function TD(e){let{query:t}=(0,PD.default)(window.location.href,!0);return i9(e,t),e}function i9(e,t){let r=n9+e.clientName,n=Object.keys(t).filter(a=>a.startsWith(r));if(!n)return;let i={};n.forEach(a=>{let o=t[a];if(o)try{let s=JSON.parse(o),l=r+OD,u={};if(a===r)u=s;else if(a.startsWith(l)){let c=a.substring(l.length);(0,_D.default)(u,c,s)}(0,ID.default)(i,u)}catch{}}),Object.keys(i).length>0&&e.overrideClientConfig(i)}var ID,_D,PD,OD,n9,RD=I(()=>{"use strict";ID=se(KN()),_D=se(DD()),PD=se($p());OD=".",n9="ecs"+OD});function nu(e,t,r){let n=TD(new eu(e,t,r));function i(a){(0,ru.useEffect)(()=>{n.init(a)},[])}return{featuresClient:n,createFeature:o9(n),useFeaturesClientInitParams:i,withFeatures:(a,o,s)=>QN(n,a,o,s)}}function o9(e){let t=jN(e),r=JN(e);return function(i){let a=Tw(i);return a.getConfig=()=>e.getConfig(a),a.isLoaded=()=>e.status===$t.ConfigsLoaded,Gp.register(a,e.clientName),{useFeature:o=>t(a,o),withFeature:(o,s)=>r(a,o,s),feature:a}}}var a9,ru,Mf=I(()=>{"use strict";a9=se(ON()),ru=se(Rf());Yp();Of();Vo();Lf();RD();zp();});var FD=I(()=>{"use strict";Yp();Of();Mf();Vo();Lf();Ml();Wp();});function iu(e){return{logEvent:(t,r,n)=>{switch(n){case"Error":(0,oa.trackErrorTrace)(e,{eventName:t,eventData:r});break;case"Warning":(0,oa.trackWarningTrace)(e,{eventName:t,eventData:r});break;default:(0,oa.trackInfoTrace)(e,{eventName:t,eventData:r});break}}}}var oa,Uf=I(()=>{"use strict";oa=se(Qn());});var gY,vY,yY,xD=I(()=>{"use strict";FD();Uf();({featuresClient:gY,createFeature:vY,useFeaturesClientInitParams:yY}=nu("PowerApps-Shell-Test",iu("shell-features")))});var MD=g((wY,kD)=>{var Wo=new Proxy(function(){return Wo},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:Wo},apply:function(){return Wo},construct:function(){return{}}}),LD=function(){return Wo};Object.setPrototypeOf(LD,Wo);kD.exports=LD});var s9,l9,UD=I(()=>{"use strict";Ao();s9=se(MD()),l9=se(Qn());});var BD=I(()=>{"use strict";xD();Uf();UD();});var PY,sa,TY,$D=I(()=>{"use strict";BD();Mf();({featuresClient:PY,createFeature:sa,useFeaturesClientInitParams:TY}=nu("PowerApps-MakerPortal",iu("powerapps-features")))});var qD,VD,xY,LY,kY,MY,Bf=I(()=>{"use strict";Pw();$D();({feature:qD}=sa({teamName:"MakerPortal",owners:["debeshd"],description:"Enable the auto insertion of cell in a row when a section is initialized",createdOn:"09/01/2023",fallback:{enableAutoInsertionOfCellInRow:Ji.enableAutoInsertionOfCellInRow}})),{feature:VD}=sa({teamName:"MakerPortal",owners:["aansu"],description:"Enable the one grid events for form designer",createdOn:"08/21/2024",fallback:{enableOneGridEventsForFormDesigner:Ji.enableOneGridEvents}}),{feature:xY}=sa({teamName:"MakerPortal",owners:["adekulkarni"],description:"Disables PBI components and cleans them up from the form",createdOn:"01/03/2023",fallback:{enableFallbackFormTemplate:Ji.disablePBIComponents}}),{feature:LY}=sa({teamName:"MakerPortal",owners:["jennietu"],description:"Enables agent response in form designer. This feature is used to enable the agent response in form designer",createdOn:"04/24/2025",fallback:{enableAgentResponse:Ji.enableAgentResponse}}),{feature:kY,useFeature:MY}=sa({teamName:"MakerPortal",owners:["aansu"],description:"Enables delayed localization of custom control",createdOn:"06/08/2025",fallback:{enableDelayedLocalizationForCustomControls:Ji.enableDelayedLocalizationForCustomControls}})});var WD=g((BY,zD)=>{var jo=new Proxy(function(){return jo},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:jo},apply:function(){return jo},construct:function(){return{}}}),GD=function(){return jo};Object.setPrototypeOf(GD,jo);zD.exports=GD});var st,Nn=I(()=>{"use strict";Ue();Le();ot();Vl();K();Qe();st=class extends j{static HighestUsedIndexByClass=new Map;get colspan(){let t=this.getProperty(m.colspan);return E.IsNullOrUndefined(t)?null:parseInt(t,10)}set colspan(t){E.IsNullOrUndefined(t)||this.setProperty(m.colspan,String(t))}constructor(t,r){super(t,r)}get id(){let t=this.getProperty(m.id);return t==null?null:t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?new P(t.substr(1,t.length-2)):new P(t)}set id(t){this.setProperty(m.id,`{${t.ToString()}}`)}set labelId(t){this.setProperty(m.labelId,`{${t.ToString()}}`)}get labelId(){let t=this.getProperty(m.labelId);return t&&t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?new P(t.substr(1,t.length-2)):new P(t)}get Name(){return this.getProperty(m.Name)}set Name(t){this.setProperty(m.Name,t)}setDisplayName(t,r){for(let i of this.getAllLabels())if(+i.getProperty(m.languagecode)===r){i.setProperty(m.description,t);return}let n=new j(v.formLabel,null);n.setProperty(m.description,t),n.setProperty(m.languagecode,String(r)),this.addGrandChild("labels",n)}getDisplayName(t){for(let r of this.getAllLabels())if(+r.getProperty(m.languagecode)===t)return r.getProperty(m.description)}getAllLabels(){let t=this.getChildren("labels");return t.length!==1?[]:t[0].getChildren("label")}get isLocked(){return+this.getProperty(m.locklevel)==1}set isLocked(t){!this.IsUnboundControl&&this.setProperty(m.locklevel,t?"1":"0")}get availableforphone(){return this.getProcessedValue(m.availableforphone)}set availableforphone(t){E.IsNullOrUndefined(t)||!this.IsAllowedUBCForAvailableOnPhone()||this.setProperty(m.availableforphone,String(t))}get visible(){return this.getProcessedValue(m.visible)}set visible(t){E.IsNullOrUndefined(t)||!this.IsAllowedUBCForVisibleByDefault()||this.setProperty(m.visible,String(t))}isLockLevelSettable(){return!this.IsUnboundControl}get showlabel(){return this.getProcessedValue(m.showlabel)}set showlabel(t){E.IsNullOrUndefined(t)||this.setProperty(m.showlabel,String(t))}isAvailableForPhoneSettable(){return this.IsAllowedUBCForAvailableOnPhone()}isVisibleSettable(){return this.IsAllowedUBCForVisibleByDefault()}getProcessedValue(t){let r=this.getProperty(t);return E.IsNullOrUndefined(r)||this.getProperty(t)==="true"}get readonly(){let t=this.getFirstChild(v.formControl);return t?t.disabled:!1}set readonly(t){let r=this.getFirstChild(v.formControl);r&&(r.disabled=t)}get allowfilteroff(){let t=this.getFirstChild(v.formControl);if(t)return t.getParam(m.AllowFilterOff)==="true"}set allowfilteroff(t){let r=this.getFirstChild(v.formControl);r&&!this.IsUnboundControl&&r.setParameter(m.AllowFilterOff,t)}get autoresolve(){let t=this.getFirstChild(v.formControl);if(t)return t.getParam(m.AutoResolve)==="true"}set autoresolve(t){let r=this.getFirstChild(v.formControl);r&&!this.IsUnboundControl&&r.setParameter(m.AutoResolve,t)}get defaultviewid(){let t=this.getFirstChild(v.formControl);return t?t.getParam(m.DefaultViewId):T.EmptyString}set defaultviewid(t){let r=this.getFirstChild(v.formControl);r&&!this.IsUnboundControl&&r.setParameter(m.DefaultViewId,t)}get dependentattributename(){let t=this.getFirstChild(v.formControl);return t?t.getParam(m.DependentAttributeName):T.EmptyString}set dependentattributename(t){let r=this.getFirstChild(v.formControl);r&&!this.IsUnboundControl&&r.setParameter(m.DependentAttributeName,t)}get dependentattributetype(){let t=this.getFirstChild(v.formControl);return t?t.getParam(m.DependentAttributeType):T.EmptyString}set dependentattributetype(t){let r=this.getFirstChild(v.formControl);r&&!this.IsUnboundControl&&r.setParameter(m.DependentAttributeType,t)}get disablequickfind(){let t=this.getFirstChild(v.formControl);if(t)return t.getParam(m.DisableQuickFind)==="true"}set disablequickfind(t){let r=this.getFirstChild(v.formControl);r&&!this.IsUnboundControl&&r.setParameter(m.DisableQuickFind,t)}get disableviewpicker(){let t=this.getFirstChild(v.formControl);if(t)return t.getParam(m.DisableViewPicker)==="true"}set disableviewpicker(t){let r=this.getFirstChild(v.formControl);r&&!this.IsUnboundControl&&r.setParameter(m.DisableViewPicker,t)}get filterrelationshipname(){let t=this.getFirstChild(v.formControl);return t?t.getParam(m.FilterRelationshipName):T.EmptyString}set filterrelationshipname(t){let r=this.getFirstChild(v.formControl);r&&!this.IsUnboundControl&&r.setParameter(m.FilterRelationshipName,t)}get availableviewids(){let t=this.getFirstChild(v.formControl);return t?t.getParam(m.AvailableViewIds):T.EmptyString}set availableviewids(t){let r=this.getFirstChild(v.formControl);r&&!this.IsUnboundControl&&r.setParameter(m.AvailableViewIds,t)}get IsUnboundControl(){let t=this.getFirstChild(v.formControl);if(t&&t.ClassId){let r=$e.getUniqueIdentifierForControl(t);return!E.IsNullOrUndefined(r)&&$e.isUnboundFormControlByIdentifier(r)}else return!1}IsAllowedUBCForAvailableOnPhone(){let t=this.getFirstChild(v.formControl);if(t){let n=$e.getUniqueIdentifierForControl(t).guidString,i=n===R.GridControl||n===R.TimeLineControl||n===R.TimeLineControlUC;return this.IsUnboundControl?i:!0}return this.NodeName===v.formSection||this.NodeName===v.formTab}IsAllowedUBCForVisibleByDefault(){let t=this.getFirstChild(v.formControl);if(t){let n=$e.getUniqueIdentifierForControl(t).guidString,i=n===R.MapsControl||n===R.WebResourceHtmlControl||n===R.WebResourceImageControl||n===R.IframeControl||n===R.SocialInsightControl;return this.IsUnboundControl?i:!0}else return!0}get events(){let t=this.getChildren(v.formEvents);return t.length===1?t[0].getAllChildren():[]}addEvent(t){this.addGrandChild(v.formEvents,t)}getUsedNodeNameSet(t){return null}getHighestIndexById(t,r){return null}}});var la,$f=I(()=>{"use strict";ot();K();Qe();la=class extends j{constructor(t,r){super(v.dependency,t),T.IsNullOrEmpty(r)||this.setDefaultProperties(r)}set id(t){this.setProperty(m.id,t)}get id(){return this.getProperty(m.id)}setDefaultProperties(t){this.id=t}}});var jD,ua,qf=I(()=>{"use strict";Le();$f();K();Qe();Nn();(function(e){e[e.Form=0]="Form",e[e.Cell=1]="Cell",e[e.Tab=2]="Tab",e[e.Control=3]="Control"})(jD||(jD={}));ua=class extends st{constructor(t,r){super(v.formEvent,t),r&&(this.eventName=r,this.application="false",this.active="false")}set eventName(t){this.setProperty(m.Name,t)}get eventName(){return this.getProperty(m.Name)}set application(t){this.setProperty(m.application,t)}get application(){return this.getProperty(m.application)}set attribute(t){this.setProperty(m.EventAttribute,t)}get attribute(){return this.getProperty(m.EventAttribute)}set relationship(t){this.setProperty(m.Relationship,t)}get relationship(){return this.getProperty(m.Relationship)}set control(t){this.setProperty(m.Control,t)}get control(){return this.getProperty(m.Control)}set active(t){this.setProperty(m.EventActive,t)}get active(){return this.getProperty(m.EventActive)}getAllHandlers(){let t=this.getChildren(v.EventHandlers);return t&&t.length?t[0].getChildren(v.handler):[]}getAllDependencies(){let t=this.getChildren(v.formDependencies);return t.length===0?[]:t[0].getAllChildren()}setDependencies(t){let r=this.getFirstChild(v.formDependencies);if(E.IsNullOrUndefined(r)){if(t.length===0)return;this.addChild(new j(v.formDependencies,this)),r=this.getFirstChild(v.formDependencies)}if(t.length===0)r.getParentNode().deleteChild(r);else{r.deleteAllChildren();for(let n of t)r.addChild(new la(r,n.toString()))}}}});var ar,Ho=I(()=>{"use strict";Ue();wo();Le();Hn();K();Qe();rr();ar=class extends j{previewVersion;constructor(t){super(v.formControl,t)}updatePreview(){this.previewVersion=Date.now()}get ClassId(){let t=this.getProperty(m.classid);return t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"&&(t=t.substr(1,t.length-2)),new P(t)}set ClassId(t){this.setProperty(m.classid,`{${t.ToString()}}`)}get dataFieldName(){return this.getProperty(m.datafieldname)}set dataFieldName(t){this.setProperty(m.datafieldname,t)}set id(t){this.setProperty(m.id,t)}get id(){return this.getProperty(m.id)}get UniqueId(){let t=this.getProperty(m.uniqueid);return E.IsNullOrUndefined(t)?null:(t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"&&(t=t.substr(1,t.length-2)),new P(t))}set UniqueId(t){this.setProperty(m.uniqueid,`{${t.ToString()}}`)}get isRequired(){return this.getProperty(m.isRequired)==="true"}set isRequired(t){E.IsNullOrUndefined(t)||this.setProperty(m.isRequired,String(t))}get disableMru(){return this.getParam(m.DisableMru)==="true"}set disableMru(t){E.IsNullOrUndefined(t)||this.setParameter(m.DisableMru,t)}get useMFDForCreate(){return this.getParam(m.UseMFDForCreate)==="true"}set useMFDForCreate(t){E.IsNullOrUndefined(t)||this.setParameter(m.UseMFDForCreate,t)}get useMFDForEdit(){return this.getParam(m.UseMFDForEdit)==="true"}set useMFDForEdit(t){E.IsNullOrUndefined(t)||this.setParameter(m.UseMFDForEdit,t)}get disabled(){return this.getProperty(m.disabled)==="true"}set disabled(t){E.IsNullOrUndefined(t)||this.setProperty(m.disabled,String(t))}get indicationOfSubgrid(){return this.getProperty(m.indicationOfSubgrid)==="true"}set indicationOfSubgrid(t){this.setProperty(m.indicationOfSubgrid,String(t))}getAllParameters(){let t=new ft,r=this.getFirstChild(m.parameters);return r&&r.getAllChildren().forEach(n=>{if(n){let i=n.getAllChildren(),a=i&&i.length>0&&i[0];a&&t.add(n.getNodeName(),a.getNodeName())}}),t}setParameter(t,r){let n=!1;r===null&&(n=!0);let i=(jr.StartTag+r).toString(),a=this.parametersNode;if(a){let o=a.findFirst(s=>s&&s.getNodeName()===t);if(o)if(n){this.deleteFirstGrandChildOfName(v.controlParameters,o);return}else{let s=o.getAllChildren();s&&s.length>0&&s[0]?s[0].setNodeName(i):o.addChild(new j(i,o))}else n||(o=new j(t,a),o.addChild(new j(i,o)),a.addChild(o))}else if(!n){a=new j("parameters",this);let o=new j(t,a);o.addChild(new j(i,o)),a.addChild(o),this.addChild(a)}}getParam(t){if(this.parametersNode){let r=this.parametersNode.findFirst(n=>n&&n.getNodeName()===t);if(r){let n=r.getAllChildren(),i=n&&n.length>0&&n[0];if(i){let a=i.getNodeName();return a.charAt(0)===jr.StartTag?a.substring(1):a}}}return null}get parametersNode(){let t=this.getChildren(m.parameters);return t.length===0?null:t[0]}async serializeParameters(t,r){let n=new ft;switch(this.ClassId.guidString.toUpperCase()){case S.LookupControl:if(t&&t.getKeys())if(t.getKeys().forEach(o=>{n.add(o,this.getParam(o))}),t&&t.containsKey("DefaultViewId")){let o=this.getParam("DefaultViewId").replace("{","").replace("}","");n.upsert("DefaultViewId",o)}else{let o=this.getParent(),s=await r.formModelService.lookupControlService.populateDefaultView(this,o.getParentForm().entityName);s&&s.id&&n.upsert("DefaultViewId",s.id.replace("{","").replace("}",""))}break;default:t&&t.getKeys()&&t.getKeys().forEach(o=>{n.add(o,this.getParam(o))});break}let i=n.getInternalObject(),a=[];for(let o in i)i.hasOwnProperty(o)&&a.push({Name:o,Value:i[o]});return a}getIsUnbound(){return this.getProperty(m.isUnbound)==="true"}getAttributeTypeFromClassId(t){if(t)switch(t.toUpperCase()){case S.BooleanControl:case S.CheckboxControl:return 0;case S.DateTimeControl:return 2;case S.DecimalControl:return 3;case S.FloatingNumberControl:return 4;case S.IntegerControl:case S.DurationControl:case S.LanguageControl:case S.TimezoneControl:return 5;case S.LookupControl:return 6;case S.CurrencyControl:return 8;case S.PartyListControl:return 10;case S.ChoiceControl:case S.RelationshipRoleChoiceControl:return 11;case S.ChoiceStatusControl:return 13;case S.TextAreaControl:case S.TextboxControl:case S.LabelControl:case S.EmailAddressControl:case S.UrlControl:case S.TickerControl:case S.ButtonControl:case S.PhoneNumberControl:return 14;case S.ChoicesControl:return 24;default:return}return 14}async toJSON(t){let r=this.getParent(),n=t&&t.formModelService&&t.formModelService.getFormType()===Be.QuickViewForm?!0:this.disabled,i=await this.serializeParameters(this.getAllParameters(),t);return{ClassId:this.ClassId&&this.ClassId.guidString,Parameters:i,Disabled:n,ControlLayout:0,RequiredLevel:0,Type:this.getAttributeTypeFromClassId(this.ClassId.guidString),IsUnbound:this.getIsUnbound(),IsRequired:this.isRequired,DataFieldName:this.dataFieldName,UniqueId:this.UniqueId&&this.UniqueId.guidString,Id:this.previewVersion?this.id+this.previewVersion:this.id,Label:r.getDisplayName(t.langCode),LabelId:r.labelId&&r.labelId.guidString,Name:null,ShowLabel:r.showlabel,PreviewId:r&&r.id.guidString,Visible:r.visible||t.formModelService.showHiddenElements}}}});var ca,Vf=I(()=>{"use strict";ot();Gi();Ho();K();Qe();ca=class extends ar{constructor(t){super(t)}get targetEntityType(){return this.getParam(m.targetEntityType)||T.EmptyString}set targetEntityType(t){this.setParameter(m.targetEntityType,t)}get viewId(){return T.StripBraces(this.getParam(m.viewId))||T.EmptyString}set viewId(t){this.setParameter(m.viewId,T.AddBraces(t))}get viewIds(){return this.getParam(m.viewIds)||T.EmptyString}set viewIds(t){this.setParameter(m.viewIds,t)}get relationshipName(){return this.getParam(m.RelationshipName)||T.EmptyString}set relationshipName(t){this.setParameter(m.RelationshipName,t)}get isUserView(){return T.IsStrictTrue(this.getParam(m.isUserView))}set isUserView(t){this.setParameter(m.isUserView,t.toString())}get enableViewPicker(){return T.IsStrictTrue(this.getParam(m.enableViewPicker))}set enableViewPicker(t){this.setParameter(m.enableViewPicker,t)}get autoExpand(){return this.getParent().autoexpand&&this.getParam(m.autoExpand)===m.Auto}set autoExpand(t){let r=this.getParent();this.setParameter(m.autoExpand,t?m.Auto:m.Fixed),r.autoexpand=t}get recordsPerPage(){return this.getParam(m.recordsPerPage)?Number(this.getParam(m.recordsPerPage)):Number(m.RecordsPerPageRAControlDefault)}set recordsPerPage(t){this.setParameter(m.recordsPerPage,String(t))}get enableQuickFind(){return T.IsStrictTrue(this.getParam(m.enableQuickFind))}set enableQuickFind(t){this.setParameter(m.enableQuickFind,t)}get teamTemplateId(){return T.StripBraces(this.getParam(m.teamTemplateId))||T.EmptyString}set teamTemplateId(t){this.setParameter(m.teamTemplateId,T.AddBraces(t))}get chartId(){return this.getParam(m.visualizationId)||T.EmptyString}set chartId(t){this.setParameter(m.visualizationId,t)}get enableChartPicker(){return T.IsStrictTrue(this.getParam(m.enableChartPicker))}set enableChartPicker(t){this.setParameter(m.enableChartPicker,t)}get chartGridMode(){switch(this.getParam(m.chartGridMode)){case Bt.Chart:return Bt.Chart;case Bt.Grid:return Bt.Grid;default:return Bt.All}}set chartGridMode(t){this.setParameter(m.chartGridMode,t)}updateChartGridMode(t){t?this.chartGridMode=Bt.Chart:this.chartGridMode=this.enableChartPicker?Bt.All:Bt.Grid}updateDefaultProperties(t,r){for(let n of t)switch(n.getNodeName()){case m.targetEntityType:n.getAllChildren()[0].setNodeName("<"+r.targetEntityType);break;case m.viewId:n.getAllChildren()[0].setNodeName("<"+T.AddBraces(r.viewId));break;case m.isUserView:n.getAllChildren()[0].setNodeName("<"+r.isUserView);break;case m.enableViewPicker:n.getAllChildren()[0].setNodeName("<"+r.enableViewPicker);break;case m.RelationshipName:let i=n.getAllChildren(),a="<"+r.relationshipName;i.length?n.getAllChildren()[0].setNodeName(a):n.addChild(new j(a,n));break;default:break}}updateControlDescription(t){let r=t.getControlDescriptionByForControl(this.UniqueId);if(r){let n=r.customControls;for(let i=0;i<n.length;i++){let a=n[i].getParameters().get(mt.dataset)?n[i].getParameters().get(mt.dataset)[0]:null;if(a){let o=a.getAllChildren();this.updateDefaultProperties(o,this)}else{let o=n[i].getAllChildren()[0].getAllChildren();this.updateDefaultProperties(o,this)}}}}}});var da,Gf=I(()=>{"use strict";ot();Gi();Ho();K();da=class extends ar{constructor(t){super(t)}get defaultViewId(){return T.StripBraces(this.getParam(m.DefaultViewId))||T.EmptyString}set defaultViewId(t){this.setParameter(m.DefaultViewId,T.AddBraces(t))}get autoResolve(){return T.IsStrictTrue(this.getParam(m.AutoResolve))}set autoResolve(t){this.setParameter(m.AutoResolve,t)}get disableQuickFind(){return T.IsStrictTrue(this.getParam(m.DisableQuickFind))}set disableQuickFind(t){this.setParameter(m.DisableQuickFind,t)}get disableViewPicker(){return T.IsStrictTrue(this.getParam(m.DisableViewPicker))}set disableViewPicker(t){this.setParameter(m.DisableViewPicker,t)}get allowFilterOff(){return T.IsStrictTrue(this.getParam(m.AllowFilterOff))}set allowFilterOff(t){this.setParameter(m.AllowFilterOff,t)}get disableMru(){return T.IsStrictTrue(this.getParam(m.DisableMru))}set disableMru(t){this.setParameter(m.DisableMru,t)}get dependentAttributeName(){return this.getParam(m.DependentAttributeName)||T.EmptyString}set dependentAttributeName(t){this.setParameter(m.DependentAttributeName,t)}get dependentAttributeType(){return this.getParam(m.DependentAttributeType)||T.EmptyString}set dependentAttributeType(t){this.setParameter(m.DependentAttributeType,t)}get filterRelationshipName(){return this.getParam(m.FilterRelationshipName)||T.EmptyString}set filterRelationshipName(t){this.setParameter(m.FilterRelationshipName,t)}get availableViewIds(){return this.getParam(m.AvailableViewIds)||T.EmptyString}set availableViewIds(t){this.setParameter(m.AvailableViewIds,t)}updateDefaultProperties(t,r){for(let n of t)switch(n.getNodeName()){case m.datafieldname:case m.bindAttribute:n.getAllChildren()[0].setNodeName("<"+r.dataFieldName);break;case m.DefaultViewId:n.getAllChildren()[0].setNodeName("<"+T.AddBraces(r.defaultViewId));break;case m.AllowFilterOff:n.getAllChildren()[0].setNodeName("<"+r.allowFilterOff);break;case m.DisableQuickFind:n.getAllChildren()[0].setNodeName("<"+r.disableQuickFind);break;case m.DisableViewPicker:n.getAllChildren()[0].setNodeName("<"+r.disableViewPicker);break;case m.FilterRelationshipName:n.getAllChildren()[0].setNodeName("<"+r.filterRelationshipName);break;case m.DependentAttributeName:n.getAllChildren()[0].setNodeName("<"+r.dependentAttributeName);break;case m.DependentAttributeType:n.getAllChildren()[0].setNodeName("<"+r.dependentAttributeType);break;case m.AvailableViewIds:n.getAllChildren()[0].setNodeName("<"+r.availableViewIds);break;case m.DisableMru:n.getAllChildren()[0].setNodeName("<"+r.disableMru);break;case m.AutoResolve:n.getAllChildren()[0].setNodeName("<"+r.autoResolve);break;default:break}}updateControlDescription(t){let r=t.getControlDescriptionByForControl(this.UniqueId);if(r){let n=r.customControls;for(let i=0;i<n.length;i++){let a=n[i].getParameters().get(mt.value)?n[i].getParameters().get(mt.value)[0]:null;if(a){let o=a.getAllChildren();this.updateDefaultProperties(o,this)}else{let o=n[i].getAllChildren()[0].getAllChildren();this.updateDefaultProperties(o,this)}}}}}});var HD,zf,Nt,Qo=I(()=>{"use strict";HD=se(WD());Nn();K();Le();Ue();qf();Ho();Vl();Xp();_p();rr();Hn();$i();Vf();Gf();Wf();Do();zf="_",Nt=class e extends st{fieldPlaceholder;fieldRequiredLevel;isNewField;cellColType;dependentFields=[];constructor(t){super(v.formCell,t),this.isNewField=!1}get cellType(){return this.cellColType}set cellType(t){this.cellColType=t}setDefaultProperties(t){this.showlabel=t,this.isLocked=!1,E.IsNullOrUndefined(this.getProperty(m.id))&&(this.id=new P(P.NewGuid()))}addControl(t,r,n,i,a,o,s){n instanceof ar?this.addChild(n):n instanceof P&&this.addChild(this.getControlWithControlSpecificProperties(t,r,n,i,a,o,s))}removeControl(){return this.deleteChild(this.control)>=0}get isIndependent(){if(!E.IsNullOrUndefined(this.control))return E.IsNullOrUndefined(this.control.dataFieldName)?E.IsNullOrUndefined(this.control.id)?!0:!Jn.dependencyFieldCount.containsKey(this.control.id):!Jn.dependencyFieldCount.containsKey(this.control.dataFieldName)}createOnLoadEvent(){this.addEvent(new ua(this,yo.onLoad))}get dependencies(){let t=this.getChildren(v.formEvents);for(let r of t){let n=r.getChildren(v.formEvent);for(let i of n)this.buildDependencyList(i,this.dependentFields)}return this.dependentFields}getNextAvailableControlName(t,r,n,i){let a;if(i&&_l[i])a=_l[i].replace(/ /g,zf)+zf;else{a="Control_";let u=new Error("Control class id does not exist or is undefined");(0,HD.trackErrorTrace)(pt,{eventName:`${qb}/getNextAvailableControlName`},u)}let o="new_",s=this.getHighestIndexById(t,i)+1,l=`${a}${o}${s}`;for(;n.has(l);)s++,l=`${a}${o}${s}`;return l}getUnboundControlProperties(t){e.prototype.setProperty.call(t,m.isUnbound,"true"),e.prototype.setProperty.call(t,m.isRequired,"false")}getControlWithControlSpecificProperties(t,r,n,i,a,o,s){let l;a===qt.Grid?(l=new ca(this),l.indicationOfSubgrid=!0):a===qt.Lookup?l=new da(this):l=new ar(this);let u=n.guidString,c=o||this.getNextAvailableControlName(t,i,this.getUsedNodeNameSet(t),u);if(e.prototype.setProperty.call(l,m.id,c),l.ClassId=n,!E.IsNullOrUndefined(s)&&(l.UniqueId=s),!o&&r)this.getUnboundControlProperties(l);else{let d=$e.getUniqueIdentifierForControl(l);E.IsNullOrUndefined(d)||($e.getControlDataTypeByControlOrUniqueId(d)===q.QuickFormCollectionControl||!$e.isUnboundFormControlByIdentifier(d)?a!==qt.Grid&&o&&u!==S.IframeControl&&u!==S.SubgridControl&&u!==S.ReferencePanelSubgridControl&&(l.dataFieldName=o,e.prototype.setProperty.call(l,m.disabled,"false")):(this.rowspan=$e.GetRowSpan(l),($e.getControlDataTypeByControlOrUniqueId(d)===q.NotesControl||$e.getControlDataTypeByControlOrUniqueId(d)===q.TimeLineControl)&&(e.prototype.setProperty.call(l,m.disabled,"false"),l.id=q.NotesControl)),($e.getUnboundControlNameFromIdentifier(n)===q.SubGridControl||$e.getUnboundControlNameFromIdentifier(n)===q.NotesControl||$e.getUnboundControlNameFromIdentifier(n)===q.TimeLineControl)&&(this.availableforphone=!0))}return l}buildDependencyList(t,r){if(E.IsNullOrUndefined(t))return;let n=t.getAllChildren();for(let i of n){let a=i.getAllChildren();for(let o of a){let s=o.GetPropertyByParameter(m.id);o.getNodeName()===v.dependency&&s?r.push(s):this.buildDependencyList(o,r)}}}get control(){return this.getFirstChild(v.formControl)}set rowspan(t){this.setProperty(m.rowspan,String(t))}get rowspan(){let t=this.getProperty(m.rowspan);return E.IsNullOrUndefined(t)?1:parseInt(t,10)}set autoexpand(t){this.setProperty(m.auto,String(t))}get autoexpand(){return this.getProperty(m.auto)==="true"}set colspan(t){let r=Number(Qp.ONE_COLUMN),n=Number(Qp.FOUR_COLUMN);E.IsNullOrUndefined(t)||t>n||t<r||this.setProperty(m.colspan,String(t))}get colspan(){let t=this.getProperty(m.colspan);return E.IsNullOrUndefined(t)?1:parseInt(t,10)}getParentRow(){return this.getAncestor(v.formRow)}getParentSection(){return this.getAncestor(v.formSection)}getParentTab(){return this.getAncestor(v.formTab)}getParentForm(){return this.getAncestor(v.form)}isInHeader(){let t=this.getAncestor(v.formHeader);return!E.IsNullOrUndefined(t)}isInFooter(){let t=this.getAncestor(v.formFooter);return!E.IsNullOrUndefined(t)}isEmpty(){return E.IsNullOrUndefined(this.control)&&!this.IsUserSpacer}getHeaderFooter(){return this.isInHeader()?this.getAncestor(v.formHeader):this.isInFooter()?this.getAncestor(v.formFooter):null}get FieldRequiredLevel(){return this.fieldRequiredLevel}set FieldRequiredLevel(t){this.fieldRequiredLevel=t}get FieldPlaceholder(){return this.fieldPlaceholder}set FieldPlaceholder(t){this.fieldPlaceholder=t}get IsNewField(){return this.isNewField}set IsNewField(t){this.isNewField=t}get IsUserSpacer(){let t=this.getProperty(m.userspacer);return E.IsNullOrUndefined(t)?!1:t==="true"}SetUserSpacer(){this.setProperty(m.userspacer,"true")}ClearUserSpacer(){this.setProperty(m.userspacer,"false")}get columns(){let t=this.getProperty(m.columnName);return E.IsNullOrUndefined(t)?null:parseInt(t,10)}getColumnLayoutValue(t){let r;switch(t){case Se.TWO_COLUMN:r="11";break;case Se.THREE_COLUMN:r="111";break;case Se.FOUR_COLUMN:r="1111";break;default:r="1"}return r}findRowIndexByCellId(t){let r=this.getParentRow().cells.indexOf(this);for(let n=0;n<t.rows.length;n++)if(!E.IsNullOrUndefined(t.rows[n].cells[r])&&this.id.ToString()===t.rows[n].cells[r].id.ToString())return n;return-1}setAutoExpandDetailsForTab(){let t=this.getParentTab();E.IsNullOrUndefined(t)||(t.autoExpandCell=this,t.tabContainsAutoExpandControl=!0)}isCellRequiredOrLocked(t,r,n){let i=this.getParentForm();if(this?.control){if(this.IsUserSpacer)return!1;{if(this.isLocked||r().has(this.control.dataFieldName))return!0;let a=i.isDuplicateCell(this,n),o=this.getRequiredLevel(t);if((o===Kn.ApplicationRequired||o===Kn.SystemRequired)&&!a||this.isCellLockedByExternal(t)&&!a)return!0}}return!1}getRequiredLevel(t){return!this.control?.dataFieldName||!this.control?.id||this.IsNewField||!this.control?.ClassId?Kn.None:t.getEntityAttributeByName(this.control.dataFieldName)?.requiredLevel?.toString()??Kn.None}isCellLockedByExternal(t){return this.control||this.IsUnboundControl?!1:t.getEntityAttributeByName(this.control.dataFieldName).isRequiredForForm||!this.isIndependent}async toJSON(t){return{Id:this.id&&this.id.guidString,Name:this.Name,Label:this.getDisplayName(t.langCode),ShowLabel:this.showlabel,Visible:this.visible||t.formModelService.showHiddenElements,LabelId:this.labelId.guidString,PreviewId:this.id&&this.id.guidString,ColSpan:this.colspan,RowSpan:this.rowspan,AutoExpand:this.autoexpand,IsInFirstColumnOfSection:!1,IsInLastColumnOfSection:!1,AvailableForPhone:this.availableforphone,UserSpacer:this.IsUserSpacer,IsPreviewCell:!1,IsStreamCell:!1,IsChartCell:!1,IsTileCell:!1,Control:this.control&&await this.control.toJSON(t)}}getUsedNodeNameSet(t){let r=new Set;return t&&t.visit(n=>{if(n.getNodeName()===v.formCell){let i=n;i.control&&i!==this&&r.add(n.control.id)}return!1}),r}getHighestIndexById(t,r){let n=t.findAll(a=>a.getNodeName()===v.formCell&&a.control&&a.control.ClassId.guidString===r),i=0;return n.forEach(a=>{i=Math.max(this.parseControlNameIndex(a.control.id),i)}),i}parseControlNameIndex(t){let r=t.length-1,n=0;for(;r>0&&parseInt(t.charAt(r),10);)r--;return r>0&&r!==t.length-1&&t.charAt(r)===zf&&(r++,n=parseInt(t.substr(r,t.length-r),10)),n}}});var pa,jf=I(()=>{"use strict";ot();K();Qe();pa=class extends j{isInternal;constructor(t,r,n,i){super(v.library,t),this.isInternal=!!i,T.IsNullOrEmpty(n)||(this.name=r,this.libraryUniqueId=n)}get libraryUniqueId(){let t=this.getProperty(m.libraryUniqueId);return t&&t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"&&(t=t.substr(1,t.length-2)),t?.toUpperCase()}set libraryUniqueId(t){this.setProperty(m.libraryUniqueId,t)}get name(){return this.getProperty(m.libraryName)}set name(t){this.setProperty(m.libraryName,t)}get displayName(){return this.getProperty(m.displayName)}set displayName(t){this.setProperty(m.displayName,t)}get description(){return this.getProperty(m.description)}set description(t){this.setProperty(m.description,t)}}});var ri,Hf=I(()=>{"use strict";Le();Qo();K();Qe();ri=class extends j{isRowAddedOnDragOver;constructor(t){super(v.formRow,t)}addCell(t){this.addChild(t)}appendCells(t){for(let r of t)this.addChild(r)}updateCell(t,r){return this.updateChild(t,r)}removeCell(t){return E.IsNullOrUndefined(t)?!1:this.deleteChild(t)>=0}insertCellAtIndex(t,r){return E.IsNullOrUndefined(t)?!1:(this.insertChildAtIndex(t,r),!0)}isEmpty(){return!this.cells||this.cells.every(t=>t.isEmpty())}getParentSection(){return this.getAncestor(v.formSection)}insertPaddingCellAtIndex(t){let r=new Nt(this);r.setDefaultProperties(),this.insertCellAtIndex(r,t)}get firstCell(){let t=this.cells;return t.length>0?t[0]:null}get cells(){return this.getChildren(v.formCell)}get rowColspan(){return this.cells.reduce((t,r)=>t+r.colspan,0)}set IsRowAddedOnDragOver(t){this.isRowAddedOnDragOver=t}get IsRowAddedOnDragOver(){return this.isRowAddedOnDragOver}async getCellsJSON(t){let r=[],n=[];if(this.cells){for(let i of this.cells)n.push(i.toJSON(t));for(let i of n)r.push(await i)}return r}async toJSON(t){return{Cells:await this.getCellsJSON(t),Visible:!0,Height:"0"}}}});function u9(e){switch(e){case Yn.Left:return Zn.Left;case Yn.Right:return Zn.Right;case Yn.Center:return Zn.Center;default:return Zn.Left}}function c9(e){switch(e){case ji.Left:return Qi.Left;case ji.Top:return Qi.Top;default:return Qi.Left}}function QD(e){switch(e){case 1:return 1;case 2:return 11;case 3:return 111;case 4:return 1111;default:return 1}}var d9,Cr,Jo=I(()=>{"use strict";Kp();Ue();Le();ot();Bf();Qo();K();rr();Nn();Hf();d9=115,Cr=class e extends st{colSpan=1;constructor(t,r){super(t,r)}getSectionType(){let t;switch(this.columns){case 1:t=Se.ONE_COLUMN;break;case 11:t=Se.TWO_COLUMN;break;case 111:t=Se.THREE_COLUMN;break;case 1111:t=Se.FOUR_COLUMN;break;default:t=this.colSpan-1}return t}setUniqueName(){let t=this.getParentTab(),r=we.namePrefix;if(t){let n=t.Name,i=t.TotalSectionsCount+1;r=n+we.namePrefix+i.toString()}else r+=Math.floor(Math.random()*1e3);this.setProperty(m.Name,r)}initializeDefaultProperties(t,r,n){if(n===Se.REFERENCE_PANEL){this.addProperty(m.rowheight,"25");let i=`${we.referencePanelNamePrefix}${P.NewGuid()}${we.namePrefix}`;this.addProperty(m.Name,i)}else this.setUniqueName();if(this.addProperty(m.id,new P(P.NewGuid()).guidString),this.addProperty(m.IsUserDefined,we.IsUserDefined),this.addProperty(m.locklevel,we.LockLevel),this.addProperty(m.showlabel,we.ShowLabel),this.addProperty(m.showbar,we.ShowBar),this.addProperty(m.layout,we.Layout),this.addProperty(m.Fieldlabelalignment,we.labelAlignment),this.addProperty(m.Fieldlabelposition,we.labelPosition),E.IsNullOrUndefined(n))this.addProperty(m.columnName,we.columns);else{let i=this.getColumnLayoutValue(n);this.addProperty(m.columnName,i)}this.addProperty(m.LabelWidth,we.LabelWidth),this.setDisplayName(r,t)}getColumnLayoutValue(t){let r;switch(t){case Se.TWO_COLUMN:r="11";break;case Se.THREE_COLUMN:r="111";break;case Se.FOUR_COLUMN:r="1111";break;default:r="1"}return r}getNumberOfColumns(){return e.getNumericColumnLayoutValue(this.columns)}static getNumericColumnLayoutValue(t){switch(t){case 1:return 1;case 11:return 2;case 111:return 3;case 1111:return 4;default:throw new Error("Unexpected Section Layout Value.")}}getColumnCountValue(){let t=0;return E.IsNullOrUndefined(this.columns)?t=this.ColSpan:this.columns.toString().split(T.EmptyString).forEach(r=>{t+=parseInt(r,10)}),t}get ColSpan(){return this.colSpan}initializeRow(t){if(t>0&&t<5){let r=new ri(null);if(this.addGrandChild(v.formRows,r),qD.getConfig().enableAutoInsertionOfCellInRow)for(let n=0;n<t;n++){let i=new Nt(r);i.setDefaultProperties(!1),r.addCell(i)}}}initialize(t,r,n){this.initializeDefaultProperties(t,r,n),n===Se.REFERENCE_PANEL&&(n=Se.ONE_COLUMN),this.initializeRow(n+1)}setColSpan(t){this.colSpan=t}appendRow(t){this.addGrandChild(v.formRows,t)}insertRowAtIndex(t,r){this.addGrandChildAtIndex(v.formRows,t,r)}insertRowsAtIndex(t,r){if(t&&t.length>0)for(let n=0;n<t.length;n++)this.addGrandChildAtIndex(v.formRows,t[n],r+n)}indexOfRow(t){return this.rows.indexOf(t)}deleteRow(t){return this.deleteFirstGrandChildOfName(v.formRows,t)}deleteRows(t,r){this.deleteGrandChildren(v.formRows,t,r)}get rows(){return this.getRows()}getRows(){let t=this.getChildren(v.formRows);return t.length===0?[]:t[0].getChildren(v.formRow)}get columns(){let t=this.getProperty(m.columnName),r=E.IsNullOrUndefined(t)?NaN:parseInt(t,10);if(isNaN(r)){let n=1;for(let i of this.rows)n=Math.max(n,i.cells.length);return QD(n)}return r}set columns(t){E.IsNullOrUndefined(t)||this.setProperty(m.columnName,String(t))}get rowHeight(){let t=this.getProperty(m.rowheight);return E.IsNullOrUndefined(t)?null:parseInt(t,10)}set rowHeight(t){this.setProperty(m.rowheight,String(t))}set autoexpand(t){this.setProperty(m.autoExpand.toLowerCase(),String(t))}get autoexpand(){return this.getProperty(m.autoExpand.toLowerCase())==="true"}get isUserDefined(){return+this.getProperty(m.IsUserDefined)!=0}set isUserDefined(t){t?this.setProperty(m.IsUserDefined,"1"):this.setProperty(m.IsUserDefined,"0")}getParentColumn(){return this.getAncestor(v.formColumn)}getParentTab(){return this.getAncestor(v.formTab)}get hasMultiColumnRow(){return this.getColumnCountValue()>1}get showlabel(){return this.getProperty(m.showlabel)==="true"}set showlabel(t){E.IsNullOrUndefined(t)||this.setProperty(m.showlabel,String(t))}get fieldLabelAlignment(){let t=we.labelAlignment,r=this.getProperty(m.Fieldlabelalignment);return E.IsNullOrUndefined(r)?t:r}set fieldLabelAlignment(t){E.IsNullOrUndefined(t)||this.setProperty(m.Fieldlabelalignment,t)}get fieldLabelPosition(){let t=this.getProperty(m.Fieldlabelposition);return E.IsNullOrUndefined(t)?we.labelPosition:t}set fieldLabelPosition(t){E.IsNullOrUndefined(t)||this.setProperty(m.Fieldlabelposition,String(t))}get showbar(){return this.getProperty(m.showbar)==="true"}set showbar(t){E.IsNullOrUndefined(t)||this.setProperty(m.showbar,String(t))}get labelwidth(){let t=+this.getProperty(m.LabelWidth);return t===0?d9:t}set labelwidth(t){E.IsNullOrUndefined(t)||t>283&&t<57||this.setProperty(m.LabelWidth,t.toString())}async getRowsJSON(t){let r=[],n=[];if(this.rows){for(let i of this.rows)n.push(i.toJSON(t));for(let i of n)r.push(await i)}return r}async toJSON(t){return{Name:this.Name,Id:this.id&&this.id.guidString,Label:this.getDisplayName(t.langCode),ShowLabel:this.showlabel,Visible:this.visible||t.formModelService.showHiddenElements,LabelId:this.labelId&&this.labelId.guidString,PreviewId:this.id&&this.id.guidString,Rows:await this.getRowsJSON(t),CellLabel:{Width:this.labelwidth,Alignment:u9(this.fieldLabelAlignment),Position:c9(this.fieldLabelPosition)},Columns:QD(this.getColumnCountValue()),AvailableForPhone:this.availableforphone,Height:this.rowHeight&&this.rowHeight.toString()}}getUsedNodeNameSet(t){let r=new Set;return t&&t.visit(n=>{if(n.getNodeName()===v.formSection){let i=n;i.Name&&!T.GuidStringEquals(i.id.guidString,this.id.guidString)&&r.add(n.Name)}return!1}),r}isReferencePanelSection(){return!E.IsNullOrUndefined(this)&&!E.IsNullOrUndefined(this.Name)&&this.Name.indexOf(we.referencePanelNamePrefix)===0}getAllMultiRowCells(){return this.findAll(t=>{if(t.getNodeName()===v.formCell){let r=t;return!r.isEmpty()&&r.rowspan>1}return!1})}isHeaderOrFooterSection(){return this.NodeName===v.formFooter||this.NodeName===v.formHeader}}});var Dn,au=I(()=>{"use strict";K();Qe();Jo();Dn=class e extends j{constructor(t){super(v.formColumn,t)}initializeDefaultProperties(t){this.addProperty(m.width,t.toString()+"%")}insertSectionAtIndex(t,r){this.addGrandChildAtIndex(v.formSections,t,r)}static createAndInitNewSection(t,r,n){let i=new Cr(v.formSection,null);return i.initialize(t,r,n),i}addSectionAtIndex(t,r){this.addGrandChildAtIndex(v.formSections,t,r)}initialize(t,r,n,i=Se.ONE_COLUMN){this.initializeDefaultProperties(t);let a=e.createAndInitNewSection(r,n,i);this.addSectionAtIndex(a,this.sections.length),a.setUniqueName()}get parentTab(){return this.getAncestor(v.formTab)}get sections(){let t=this.getChildren("sections");return t.length!==1?[]:t[0].getChildren(v.formSection)}get width(){return this.getProperty(m.width)}set width(t){this.setProperty(m.width,t)}deleteSection(t){return this.deleteFirstGrandChildOfName(v.formSections,t)}async getSectionsJSON(t){let r=[];if(this.sections)for(let n of this.sections)r.push(await n.toJSON(t));return r}async toJSON(t){return{Name:this.getProperty(m.Name),Id:this.getProperty(m.id),Label:null,ShowLabel:!1,Visible:!0,LabelId:null,PreviewId:this.getProperty(m.id),Sections:await this.getSectionsJSON(t),Width:this.width}}}});var ou,JD=I(()=>{"use strict";Ue();K();rr();Jo();ou=class extends Cr{initializeNavArea(t,r,n){this.initializeNavAreaProps(t,r,n)}get AreaName(){return this.Name}initializeNavAreaProps(t,r,n){this.addProperty(m.Name,n),this.addProperty(m.id,new P(P.NewGuid()).guidString),this.addProperty(m.columnName,we.columns),this.setDisplayName(r,t)}}});var su,XD=I(()=>{"use strict";au();K();JD();su=class extends Dn{addAndIntializeNavBarSection(t,r,n,i){let a=new ou(v.formSection,null);return a.initializeNavArea(t,r,i),this.addGrandChildAtIndex(v.formSections,a,n),a}}});var Qr,lu=I(()=>{"use strict";Ue();Le();ot();au();K();Qe();Nn();Qr=class extends st{tabContainsAutoExpandControl;autoExpandCell;constructor(t,r){super(v.formTab,t),this.tabContainsAutoExpandControl=!1}getParentForm(){return this.getAncestor(v.form)}getTabLayoutType(){let t;switch(this.columns.length){case 1:t=Ce.ONE_COLUMN;break;case 2:if(parseInt(this.columns[0].width,10)===50&&parseInt(this.columns[1].width,10)===50){t=Ce.TWO_COLUMN_EQUAL;break}if(parseInt(this.columns[0].width,10)===67&&parseInt(this.columns[1].width,10)===33){t=Ce.TWO_COLUMN_WIDER_LEFT;break}if(parseInt(this.columns[0].width,10)===34&&parseInt(this.columns[1].width,10)===66){t=Ce.TWO_COLUMN_WIDER_RIGHT;break}t=Ce.TWO_COLUMN_CUSTOM_LAYOUT;break;case 3:if(parseInt(this.columns[0].width,10)===34&&parseInt(this.columns[1].width,10)===33&&parseInt(this.columns[2].width,10)===33){t=Ce.THREE_COLUMN_EQUAL;break}if(parseInt(this.columns[0].width,10)===28&&parseInt(this.columns[1].width,10)===44&&parseInt(this.columns[2].width,10)===28){t=Ce.THREE_COLUMN_WIDER_MID;break}t=Ce.THREE_COLUMN_CUSTOM_LAYOUT;break;default:}return t}initializeProperties(t,r,n){this.addProperty(m.Name,bn.namePrefix+t.toString()),this.addProperty(m.id,new P(P.NewGuid()).guidString),this.addProperty(m.IsUserDefined,bn.IsUserDefined),this.addProperty(m.locklevel,bn.LockLevel),this.addProperty(m.showlabel,bn.ShowLabel),this.setDisplayName(n,r)}get TotalSectionsCount(){let t=0;for(let r of this.columns)t+=r.sections.length;return t}initializeColumns(t,r,n,i=Se.ONE_COLUMN,a=!0,o){let s=this.getChildren(v.formColumns)[0],l=[];switch(t){case Ce.ONE_COLUMN:l.push(100);break;case Ce.TWO_COLUMN_EQUAL:l.push(50),l.push(50);break;case Ce.TWO_COLUMN_WIDER_LEFT:l.push(67),l.push(33);break;case Ce.TWO_COLUMN_WIDER_RIGHT:l.push(34),l.push(66);break;case Ce.THREE_COLUMN_EQUAL:l.push(34),l.push(33),l.push(33);break;case Ce.THREE_COLUMN_WIDER_MID:l.push(28),l.push(44),l.push(28);break;default:}for(let u of l){let c=new Dn(s);c.initialize(u,r,n,i),this.addGrandChild(v.formColumns,c)}}initialize(t,r,n,i,a,o=Se.ONE_COLUMN,s=!0,l){this.addChild(new j(v.formColumns,this)),this.initializeProperties(r,n,i),this.initializeColumns(t,n,a,o,s,l)}get columns(){let t=this.getChildren(v.formColumns);return t.length!==1?[]:t[0].getChildren(v.formColumn)}get expanded(){return this.getProcessedValue(m.expanded)}set expanded(t){E.IsNullOrUndefined(t)||this.setProperty(m.expanded,String(t))}get groupName(){return this.getProperty(m.groupName)}get contentType(){return this.getProperty(m.contentType)}set contentType(t){this.setProperty(m.contentType,t)}insertNewColumnAtIndex(t,r,n,i,a){t.initialize(n,i,a),this.addGrandChildAtIndex(v.formColumns,t,r)}insertColumnAtIndex(t,r){this.addGrandChildAtIndex(v.formColumns,t,r)}deleteColumn(t){return this.deleteFirstGrandChildOfName(v.formColumns,t)}async getColumnsJSON(t){let r=[],n=[];if(this.columns){for(let i of this.columns)n.push(i.toJSON(t));for(let i of n)r.push(await i)}return r}async toJSON(t){return{Name:this.Name,Id:this.id&&this.id.guidString,Label:this.getDisplayName(t.langCode)+(!this.visible&&t.formModelService.showHiddenElements?"\u3000\u3000":""),ShowLabel:this.showlabel,Visible:this.visible||t.formModelService.showHiddenElements,LabelId:this.labelId&&this.labelId.guidString,UniqueId:this.id&&this.id.guidString,PreviewId:this.id&&this.id.guidString,Columns:await this.getColumnsJSON(t),EventHandlers:[],Expanded:this.expanded,ContentType:this.contentType,AvailableForPhone:this.availableforphone,Header:void 0,Footer:void 0}}getUsedNodeNameSet(t){let r=new Set;return t&&t.visit(n=>{if(n.getNodeName()===v.formTab){let i=n;i.Name&&!T.GuidStringEquals(i.id.guidString,this.id.guidString)&&r.add(n.Name)}return!1}),r}}});var ni,Qf=I(()=>{"use strict";Ue();K();Qe();rr();XD();lu();ni=class extends Qr{constructor(t,r,n){super(t,Ce.THREE_COLUMN_EQUAL),this.setDisplayName(r,n),this.id=new P(P.NewGuid())}initializeDefaultProps(){this.addChild(new j(v.formColumns,this)),this.initializeFiveColumns()}get columns(){let t=this.getChildren("columns");return t.length!==1?[]:t[0].getChildren(v.formColumn)}getNavSectionForArea(t){for(let r of this.columns)for(let n of r.sections)if(n.AreaName===t)return n;return null}getNavCellFromNavId(t){for(let r of this.columns)for(let n of r.sections)for(let i of n.rows)for(let a of i.cells)if(a.NavId===t)return a;return null}initializeFiveColumns(){for(let t=0;t<$l.FIVE_COLUMN;t++){let r=new su(this.getChildren(v.formColumns)[0]);r.initializeDefaultProperties(vw.FiveEqColumn),this.addGrandChild(v.formColumns,r)}}}});function f9(e){switch(e){case Be.Main:return An.Main;case Be.QuickCreate:return An.QuickCreate;case Be.QuickViewForm:return An.Quick;case Be.Dialog:return An.Dialog;default:return An.None}}function m9(e,t){if(t===Be.Main){if(e)switch(e.toLowerCase()){case"low":return yn.Low;case"highreadonlyvalues":return yn.HighReadOnlyValues;default:return yn.HighWithControls}return yn.Low}}var cu,p9,uu,KD=I(()=>{"use strict";Ew();cu=se(Qn());Kp();Le();ot();$i();Bf();K();Gi();hp();Hn();Qo();K();Nn();jf();Qf();lu();p9="1920";uu=class e extends st{_formUniqueName;isHeaderDefaulted;consistencyStrong=!1;_formId;_rawFormXml;_entityName;_entityDisplayName;_status;_formName;_langCode;_description;_formType;_formPresentation;parameters=[];_formactivationstate;_changeTracker;_metadataChangeEvent;_etag;constructor(t,r,n,i,a,o,s,l,u){super(v.form,null),this._formUniqueName=a,this._formId=t,this._entityName=r,this._status=n,this._formName=i,this._description=l,this._formType=o,this._formPresentation=s,this._formactivationstate=u,this._changeTracker=new El,this._metadataChangeEvent=new Gl}get FormLibraries(){let t=this.getFirstChild(v.formLibraries),r=t?t.getAllChildren():[],n=this._getInternalLibraries();return r.concat(n)}getAllEvents(){let t=[],r=this.events;r&&(t=t.concat(r));for(let n of this.tabs){let i=n.events;i&&(t=t.concat(i)),n.findAll(a=>a instanceof Nt).forEach(a=>{let o=a.events;o&&(t=t.concat(o))})}return t}getEventsForNode(t){if(t instanceof e){let r=t.events;return r?r.filter(n=>!n.control&&!n.attribute):null}else if(t instanceof Nt){if(t.control?.dataFieldName){let r=this.events;return r?r.filter(n=>n.attribute&&t.control.dataFieldName===n.attribute):null}else if(this.isCellEditableGridControl(t)){let r=this.events;return r?r.filter(n=>n.control&&t.control.id===n.control):null}}return t?.events}_getInternalLibraries(){let t=this.findAll(i=>i.getNodeName()===v.internalLibraries),r=[],n="src";return t.length>0&&(r=t.map(i=>{let a=i.GetPropertyByParameter(n).replace("$webresource:",""),o=new pa(void 0,void 0,"",!0);return o.name=a,o.displayName=a,o})),r}getDependentFields(){let t=this.getAllEvents(),r=new Set;return t.forEach(n=>{try{n.getAllDependencies().forEach(a=>{r.add(a.id)})}catch(i){throw(0,cu.trackErrorTrace)(Vb,{eventName:"GetDependentFields_MissingDependencies",eventData:{Message:`Failed get dependencies for form event in form ${this.formId.guidString}.`,Attribute:n.attribute,EventName:n.eventName}}),i}}),r}get Parameters(){return this.parameters}set Parameters(t){this.parameters=t}get ShowImagecheck(){return T.IsNullOrEmpty(this.getProperty(m.ShowImage))?!0:this.getProperty(m.ShowImage)!=="false"}set ShowImagecheck(t){t?this.setProperty(m.ShowImage,String(t)):this.setProperty(m.ShowImage,"false")}get ShowNavigation(){return T.IsNullOrEmpty(this.getProperty(m.ShowNavigationbar))?!0:this.getProperty(m.ShowNavigationbar)!=="false"}set ShowNavigation(t){t?this.setProperty(m.ShowNavigationbar,String(t)):this.setProperty(m.ShowNavigationbar,"false")}get MaxWidth(){return T.IsNullOrEmpty(this.getProperty(m.MaxWidth))?p9:this.getProperty(m.MaxWidth)}set MaxWidth(t){this.setProperty(m.MaxWidth,t)}get headerDensityType(){return this.getProperty(m.HeaderDensityType)}set headerDensityType(t){t&&this.formType===Be.Main?this.setProperty(m.HeaderDensityType,t):this.formType!==Be.Main&&this.headerDensityType&&this.removeProperty(m.HeaderDensityType)}IsMainOrQuickCreateForm(){return this.formType===Be.Main||this.formType===Be.QuickCreate}get FormPresentation(){return this._formPresentation}get LanguageCode(){return this._langCode}set LanguageCode(t){this._langCode=t}get header(){let t=this.getChildren(v.formHeader);return t.length!==1?null:t[0]}set header(t){E.IsNullOrUndefined(t)||(this.deleteChild(this.header),this.addChild(t))}getAllDependencies(){return this.getChildren(v.quickFormDependencies).length===0?[]:this.ConvertModelToArray(this.getChildren(v.quickFormDependencies)[0].getAllChildren())}ConvertModelToArray(t){let r=[];return E.IsNullOrUndefined(t)||t.forEach(n=>{r.push(n.id)}),r}get footer(){let t=this.getChildren(v.formFooter);return t.length!==1?null:t[0]}set footer(t){E.IsNullOrUndefined(t)||(this.deleteChild(this.footer),this.addChild(t))}createAndInitNewTab(t,r,n){let i=new Qr(null,t),a=this.getNextTabCounter(this.tabs.length+1);return i.initialize(t,a,this.LanguageCode,r,n),i}addTabAtIndex(t,r){this.addGrandChildAtIndex(v.formTabs,t,r)}createAndInitNewTabWithMarginalControl(t,r,n,i,a){let o=new Qr(null,Ce.ONE_COLUMN),s=this.getNextTabCounter(this.tabs.length+1);o.initialize(Ce.ONE_COLUMN,s,this.LanguageCode,r,n,a,!1),this.addGrandChildAtIndex(v.formTabs,o,i);let l=o.columns[0].sections[0];for(let u=0;u<t.rows.length;u++)l.appendRow(t.rows[u])}getNextTabCounter(t){for(let r=0;r<this.tabs.length;r++)if(this.tabs[r].Name===bn.namePrefix+t.toString())return this.getNextTabCounter(t+1);return t}get allTabs(){let t=this.getChildren(v.formTabs);return t.length!==1?[]:t[0].getChildren(v.formTab)}get CanvasNavigationTab(){if(this.tabs.length>0){let t=this.tabs[this.tabs.length-1];if(t instanceof ni)return t}return null}get NavigationNode(){let t=this.getChildren(v.formNavigation);return t.length!==1?null:t[0]}set NavigationNode(t){let n=this.getAllChildren().indexOf(this.NavigationNode);n>=0&&(this.deleteChild(this.NavigationNode),this.insertChildAtIndex(t,n))}addNavigatioNode(t){this.addChild(t)}get tabs(){return this.allTabs}deleteTab(t){return this.deleteFirstGrandChildOfName(v.formTabs,t)}insertTabAtIndex(t,r){this.addGrandChildAtIndex(v.formTabs,t,r)}insertRelatedTab(t){let r=this.getAllGrandChildren(v.formTabs);if(!E.IsNullOrUndefined(r)){let n=r.length;this.insertTabAtIndex(t,n)}}get isfooterPresent(){return this.getChildren(v.formFooter).length>0}get displayCondition(){let t=this.getChildren(v.formDisplayConditions);return t.length>0?t[0]:null}set displayCondition(t){this.deleteChild(this.displayCondition),this.addChild(t)}get entityName(){return this._entityName}get formId(){return this._formId}set formId(t){this._formId=t}get rawFormXml(){return this._rawFormXml}set rawFormXml(t){this._rawFormXml=t}get status(){return this._status}set status(t){this._status=t}get formName(){return this._formName}set formName(t){this.trackObjectPropertyChange("_formName",t)}get formUniqueName(){return this._formUniqueName}set formUniqueName(t){this.trackObjectPropertyChange("_formUniqueName",t)}get formType(){return this._formType}get tabCount(){return this.allTabs.length}get description(){return this._description}set description(t){this.trackObjectPropertyChange("_description",t)}get formactivationstate(){return this._formactivationstate}set formactivationstate(t){this.trackObjectPropertyChange("_formactivationstate",t)}get entityDisplayName(){return this._entityDisplayName}set entityDisplayName(t){this._entityDisplayName=t}get etag(){return this._etag}set etag(t){this._etag=t}indexOfTab(t){return this.getAllGrandChildren(v.formTabs).indexOf(t)}get ControlDescriptions(){return this.getAllGrandChildren(v.controlDescriptions)}addControlDescriptionNode(t){this.addGrandChild(v.controlDescriptions,t)}deleteControlDescByForControlId(t){let r=this.getControlDescriptionByForControl(t);E.IsNullOrUndefined(r)||this.deleteFirstGrandChildOfName(v.controlDescriptions,r)}getControlDescriptionByForControl(t){if(!t)return null;for(let r of this.ControlDescriptions)if(r.forControl.guidString===t.guidString)return r;return null}cellHasCustomControlWithName(t,r){if(!t?.control||!r)return!1;let n=this.getControlDescriptionByForControl(t.control.UniqueId);return n?!!n.customControls.find(i=>i.name===r):!1}isDuplicateCell(t,r){return!!this.findFirst(i=>{if(!(i instanceof Nt))return!1;let a=!0;return r==="Tab"?a=i.getParentTab()!==t.getParentTab():r==="Section"?a=i.getParentSection()!==t.getParentSection():a=i!==t,i instanceof Nt&&i.control&&t.control&&a&&i.control.dataFieldName===t.control.dataFieldName})}isCellEditableGridControl(t){return!t?.control?.indicationOfSubgrid||t.control.ClassId.guidString.toUpperCase()!==S.CustomControl?!1:this.cellHasCustomControlWithName(t,wn.EditableGridControl)||VD.getConfig()?.enableOneGridEventsForFormDesigner&&this.cellHasCustomControlWithName(t,wn.PowerAppsOneGrid)}isCellCanvasAppControl(t){return t?.control?.ClassId.guidString.toUpperCase()===S.CustomControl&&this.cellHasCustomControlWithName(t,wn.CanvasAppControl)}findFormNodeById(t,r=this){return r===null?null:r.findFirst(n=>{if(n===this&&t===this.formId.ToString()||n.id?.ToString?.()===t)return!0})}findFormCellByClassId(t,r=this){return r?r.findFirst(n=>{if(n.getNodeName()===v.formCell){let i=n;return i&&i.control&&i.control.ClassId.guidString===t}return!1}):null}async getTabsJSON(t){let r=this.tabs,n=[],i=[];if(r){for(let a of r)if(!(a instanceof ni)){let o=a.toJSON(t);n.push(o)}for(let a of n)i.push(await a)}return i}async getControlDescriptionsToJSON(t){let r=[];for(let n of this.ControlDescriptions){let i=await n.toJSON(t);i&&r.push(i)}return r}async toJSON(t){let r=[];r=await this.getControlDescriptionsToJSON(t);let n=this.NavigationNode&&await this.NavigationNode.toJSON(t);return{Id:this._formId.guidString,Name:this.formName,Label:this.getDisplayName(t.langCode),ShowLabel:this.showlabel,Visible:this.visible,LabelId:this.labelId&&this.labelId.guidString,PreviewId:this._formId.guidString,PreviewSessionId:(0,cu.getSessionId)(),EntityLogicalName:this._entityName,FormId:this._formId.guidString,TabAttributes:{},Tabs:await this.getTabsJSON(t),HiddenFields:[],Header:this.header&&await this.header.toJSON(t),Footer:this.footer&&await this.footer.toJSON(t),...this.formType===Be.Main?{HeaderDensity:m9(this.headerDensityType,this.formType)}:{},InlineEditGridRow:[],InlineQuickForms:[],QuickFormEntities:[],EventHandlers:[],LinkControlSections:[],FormType:f9(this.formType),SubGrids:[],Views:void 0,Charts:void 0,CustomControlConfigurations:r,BusinessLogic:void 0,FormLibraries:[],Navigation:n,ShowNavigationBar:this.ShowNavigation||t.formModelService.showHiddenElements,ClientResources:[]}}changeTracker(){return this._changeTracker}onMetadataChange=t=>this._metadataChangeEvent.on(t);raiseMetadataChange(t){this._metadataChangeEvent.emit(t)}}});var du,Jf,YD=I(()=>{"use strict";Ue();Le();K();Qe();Nn();du=class extends st{constructor(t){super(v.formDisplayConditions,t)}get Order(){let t=this.getProperty(m.Order);return E.IsNullOrUndefined(t)?null:parseInt(t,10)}set Order(t){this.setProperty(m.Order,t.toString())}get FallbackForm(){return this.getProperty(m.FallbackForm)==="true"}set FallbackForm(t){this.setProperty(m.FallbackForm,t.toString())}addRoles(t){this.deleteAllChildren();for(let r=0;r<t.length;r++)this.addChild(t[r])}isRoleEveryone(){return!!(this.getChildren(v.formEveryOne)&&this.getChildren(v.formEveryOne)[0])}setRoleEveryone(){this.deleteAllChildren(),this.addChild(new Jf(this))}},Jf=class extends j{constructor(t){super(v.formEveryOne,t)}}});var pu,ZD=I(()=>{"use strict";K();Qe();pu=class extends j{constructor(t,r){super(v.Handler,r),t.length>0&&this.setDefaultProperties(t)}setDefaultProperties(t){this.FunctionName=t[0],this.LibraryName=t[1],this.HandlerUniqueID=t[2],this.Enabled=t[3],this.Parameters=t[4],this.PassExecutionContext=t[5]}get HandlerUniqueID(){return this.getProperty(m.HandlerUniqueId)}set HandlerUniqueID(t){this.setProperty(m.HandlerUniqueId,t)}get FunctionName(){return this.getProperty(m.functionName)}set FunctionName(t){this.setProperty(m.functionName,t)}get LibraryName(){return this.getProperty(m.libraryNameEventHandler)}set LibraryName(t){this.setProperty(m.libraryNameEventHandler,t)}get Enabled(){return this.getProperty(m.enabledForField)}set Enabled(t){this.setProperty(m.enabledForField,t)}get PassExecutionContext(){return this.getProperty(m.passExecutionContext)}set PassExecutionContext(t){this.setProperty(m.passExecutionContext,t)}get Parameters(){return this.getProperty(m.parameters)}set Parameters(t){this.setProperty(m.parameters,t)}}});var fa,Xf=I(()=>{"use strict";K();Jo();fa=class extends Cr{constructor(t,r){super(t,r)}get cells(){let t=this.getRows(),r=[];if(this.rows&&t.length){for(let n of this.rows)if(n.cells){let i=n.getChildren(v.formCell);for(let a of i)r.push(a)}}return r}get occupiedCells(){return this.cells.filter(t=>!t.isEmpty())}get maxColumns(){return super.getColumnCountValue()}}});var Xo,e2=I(()=>{"use strict";K();Xf();Xo=class extends fa{_customFooter;constructor(t,r){super(v.formFooter,t),this._customFooter=r}get customFooter(){return this._customFooter}set customFooter(t){this._customFooter=t}async getControls(t){let r=[];if(this.rows){for(let n of this.rows)if(n.cells)for(let i of n.cells)i.control&&r.push(await i.control.toJSON(t))}return r}async toJSON(t){return{AvailableForPhone:this.availableforphone,Controls:await this.getControls(t),UniqueId:this.id&&this.id.guidString,PreviewId:this.id&&this.id.guidString}}isEmpty(){return!this.cells.find(t=>!!t.control)}}});var Ko,t2=I(()=>{"use strict";K();Xf();Ko=class extends fa{_customHeader;constructor(t,r){super(v.formHeader,t),this._customHeader=r}get customHeader(){return this._customHeader}set customHeader(t){this._customHeader=t}get showCommandBar(){return this.getProcessedValue(m.showCommandBar)}set showCommandBar(t){t!=null&&this.setProperty(m.showCommandBar,String(t))}get showBody(){return this.getProcessedValue(m.showBody)}set showBody(t){t!=null&&this.setProperty(m.showBody,String(t))}get showTabNavigator(){return this.getProcessedValue(m.showTabNavigator)}set showTabNavigator(t){t!=null&&this.setProperty(m.showTabNavigator,String(t))}async getControls(t){let r=[];if(this.rows){for(let n of this.rows)if(n.cells)for(let i of n.cells)i.control&&r.push(await i.control.toJSON(t))}return r}async toJSON(t){return{AvailableForPhone:this.availableforphone,Controls:await this.getControls(t),UniqueId:this.id&&this.id.guidString,PreviewId:this.id&&this.id.guidString}}}});var Dt,ii=I(()=>{"use strict";Ue();ot();K();Nn();Dt=class e extends st{constructor(t,r){super(t,r)}getTitle(t){for(let r of this.getAllTitles())if(+r.getProperty(m.LCID)===t)return r.getProperty(m.text);return null}getAllTitles(){let t=this.getChildren(v.Titles);return t.length===0?[]:t[0].getChildren(v.Title)}setTitle(t,r){for(let i of this.getAllTitles())if(+i.getProperty(m.LCID)===r){i.setProperty(m.text,t);return}let n=new e(v.Title,null);n.setProperty(m.text,t),n.setProperty(m.LCID,String(r)),this.addGrandChild(v.Titles,n)}get Sequence(){return+this.getProperty(m.Sequence)}set Sequence(t){this.setProperty(m.Sequence,t.toString())}get Area(){return this.getProperty(m.Area)}set Area(t){this.setProperty(m.Area,t)}set Id(t){this.setProperty(m.Id,t)}get Id(){return this.getProperty(m.Id)}get id(){return new P(this.Id??"",!0)}set id(t){this.Id=t.guidString}get Show(){return!0}get Icon(){return this.getProperty(m.icon)}set Icon(t){t=t||T.EmptyString,this.setProperty(m.icon,t)}updateCommonProperties(t,r){this.Area=t.Area,this.Sequence=t.Sequence,this.setTitle(t.getDisplayName(r),r)}}});var Yo,r2=I(()=>{"use strict";(function(e){e[e.NavLinkNotAvailable=-1]="NavLinkNotAvailable",e[e.NavLinkIdConflict=-2]="NavLinkIdConflict",e[e.NavBarNotAvailable=-3]="NavBarNotAvailable"})(Yo||(Yo={}))});var fu,n2=I(()=>{"use strict";Le();K();ii();r2();fu=class extends Dt{constructor(t){super(v.formNavBar,t)}addChildElement(t){this.addChild(t)}getAllActiveNavBarChildren(){return this.getAllChildren().filter(n=>n.Show)}getAllInActiveActiveNavBarChildren(){return this.getAllChildren().filter(n=>!n.Show)}get AllRelationShipItems(){return this.getChildren("NavBarByRelationshipItem")}get AllNavLinkItems(){return this.getChildren("NavBarItem")}removeNavLink(t){let r=this.getNavBarLinkItemById(t);return E.IsNullOrUndefined(r)?Yo.NavLinkNotAvailable:r.length===1?this.deleteChild(r[0]):Yo.NavLinkIdConflict}getRelationShipItemsByArea(t){let r=this.AllRelationShipItems,n=[];for(let i of r)i.Area===t&&i.Show===!0&&n.push(i);return n}getNavBarRelationShipItemsByNavId(t){return this.AllRelationShipItems.filter(n=>n.Id===t)}getNavBarLinkItemById(t){let r=this.AllNavLinkItems.filter(n=>n.Id===t);return r.length>0?r:null}getAllActiveChildrenForGivenArea(t){let r=this.getAllChildren(),n=[];for(let i of r)i.Area===t&&i.Show&&n.push(i);return n}}});var ve,h9,i2,_te,ma,Kf=I(()=>{"use strict";Ue();K();ii();(function(e){e.Info="_NA_Info",e.Sales="_NA_SFA",e.Service="_NA_CS",e.Marketing="_NA_MA",e.InternetMarketing="_NA_IMA",e.ProcessCenter="_NA_PROC",e.Async="_NA_AO"})(ve||(ve={}));h9=new Map([[ve.Info,"Info"],[ve.Sales,"Sales"],[ve.Service,"Service"],[ve.Marketing,"Marketing"],[ve.ProcessCenter,"ProcessCenter"]]),i2=new Map([["Info",ve.Info],["Sales",ve.Sales],["Service",ve.Service],["Marketing",ve.Marketing],["ProcessCenter",ve.ProcessCenter]]),_te=new Map([[ve.Info,9e3],[ve.Sales,9200],[ve.Service,9400],[ve.Marketing,9600],[ve.ProcessCenter,9800],[ve.InternetMarketing,1e4],[ve.Async,10200]]),ma=class extends Dt{constructor(t,r){super(v.formNavBarArea,r)}setDefaultPropertiesByType(t,r,n){this.AreaId=h9.get(t);let i=n?.(`navBarArea.title.${this.AreaId}`)??this.AreaId;this.setTitle(i,r)}get ParentNavigation(){return this.getAncestor(v.formNavigation)}get AreaId(){return this.getProperty(m.Id)}set AreaId(t){this.setProperty(m.Id,t)}get id(){return new P(this.AreaId??"",!0)}set id(t){this.AreaId=t.guidString}async toJSON(t){return{Id:this.AreaId,Titles:[{LCID:t.langCode,Text:this.getTitle(t.langCode)}],PreviewId:this.AreaId}}}});var ha,Yf=I(()=>{"use strict";K();ii();ha=class extends Dt{constructor(t,r){super(v.formNavBarAreas,r)}get AllNavBarAreaItems(){return this.getChildren(v.formNavBarArea)}get ParentNavigation(){return this.getAncestor(v.formNavigation)}addNavBarArea(t){this.addChild(t)}}});var mu,a2=I(()=>{"use strict";Le();K();ii();mu=class extends Dt{RelationshipNameUCIRuntime;constructor(t){super(v.formNavBarByRelationshipItem,t)}get RelationshipName(){return this.getProperty(m.RelationshipName)}set RelationshipName(t){this.setProperty(m.RelationshipName,t)}set Show(t){this.setProperty(m.Show,String(t))}get Show(){let t=this.getProperty(m.Show);return E.IsNullOrUndefined(t)||t==="true"}get TitleResourceId(){return this.getProperty(m.TitleResourceId)}async toJSON(t){return{Area:this.Area,Show:this.Show||t.formModelService.showHiddenElements,Id:this.Id,Titles:[{Name:t.langCode.toString(),Value:this.getTitle(t.langCode)}],Sequence:this.Sequence.toString(),Privileges:[],TooltipTitles:[],AvailableOffline:!0,PreviewId:this.Id,RelationshipName:this.RelationshipNameUCIRuntime??this.RelationshipName,Icon:null,ViewId:null,Client:null,TitleResourceId:null}}}});var hu,o2=I(()=>{"use strict";K();ii();hu=class extends Dt{constructor(t){super(v.formNavBarItem,t)}get Url(){return this.getProperty(m.url)}set Url(t){this.setProperty(m.url,t)}}});var gu,s2=I(()=>{"use strict";Ue();K();Kf();Yf();ii();gu=class extends Dt{constructor(t,r){super(t,r)}getNavBarAreaByAreaName(t){let r=this.navBarAreas.AllNavBarAreaItems.filter(n=>n.AreaId===t);return r.length===0?null:r[0]}get navBarAreas(){return this.getFirstChild(v.formNavBarAreas)}setDefaultNavBarAreas(t,r){let n=[ve.Info,ve.Sales,ve.Service,ve.Marketing,ve.ProcessCenter];if(this.navBarAreas){let i=this.navBarAreas?.AllNavBarAreaItems;if(i&&i.length>0){let a=new Set(i.map(o=>i2.get(o.AreaId)));n=n.filter(o=>!a.has(o))}}else{let i=new ha(v.formNavBarAreas,this);i.isTransient=!0,this.addChild(i)}return n.length>0?(n.forEach(i=>{let a=new ma(v.formNavBarArea,this.navBarAreas);a.setDefaultPropertiesByType(i,t,r),this.navBarAreas.addNavBarArea(a)}),!0):!1}get navBar(){return this.getFirstChild(v.formNavBar)}get id(){return new P(Ip,!0)}replaceNavAreaToGivenIndex(t,r){this.navBarAreas?.AllNavBarAreaItems.indexOf(r)!==-1&&(this.deleteFirstGrandChildOfName(v.formNavBarAreas,r),this.addGrandChildAtIndex(v.formNavBarAreas,r,t))}async getNavBarAreasJSON(t){let r=[],n=[];if(this.navBarAreas?.AllNavBarAreaItems){for(let a of this.navBarAreas.AllNavBarAreaItems)n.push(a.toJSON(t));r=await Promise.all(n)}return r}async getNavBarRelationshipItemsJSON(t){let r=[],n=[];if(this.navBar?.AllRelationShipItems){for(let i of this.navBar.AllRelationShipItems)n.push(i.toJSON(t));r=await Promise.all(n)}return r}async toJSON(t){let r=await this.getNavBarAreasJSON(t),n=await this.getNavBarRelationshipItemsJSON(t);return{NavBarAreas:{NavBarAreas:r},NavBarByRelationshipItems:n,NavBarItems:[],NavPaneIsvItems:{NavBarIsvItems:[]},ShowEmptyNavBarAreas:t.formModelService.showHiddenElements}}}});var l2={};Rr(l2,{ControlType:()=>qt,DeserializationService:()=>tm,DeserializationServiceScope:()=>em,DeserializedFormElementNode:()=>It});var Zf,It,em,qt,tm,Wf=I(()=>{"use strict";Zf=se(Qn());Ue();Le();ot();$i();_p();Hn();Gb();Sw();Vl();KD();Qo();au();Ho();$f();K();K();YD();Qe();rr();qf();ZD();e2();Vf();Gf();t2();jf();Hf();Jo();lu();n2();Kf();Yf();a2();o2();s2();It=class extends j{constructor(t,r){super(t,r)}insertProperty(t,r){this.addProperty(t,r)}insertChild(t){this.addChild(t)}},em="DeserializationService";(function(e){e.Grid="Grid",e.Lookup="Lookup",e.Base="Base"})(qt||(qt={}));tm=class{lcid;constructor(t){this.lcid=t}deSerializeFormXml(t,r,n,i,a,o,s,l,u,c){if(!t)throw new Error("Formxml could not be parsed.");let d=t.getElementsByTagName("form");if(d.length!==1){let f="";throw d.length===0?f="FormXml has no form node.":f="FormXml has multiple form nodes.",(0,Zf.trackErrorTrace)(pt,{eventName:em,eventData:{error:f}}),new Error(f)}let p=this.createFormModel(d.item(0),r,n,i,a,o,s,l,u,c);return E.IsNullOrUndefined(p.displayCondition)&&s!==Be.Dialog&&this.appendDefaultDisplayCondition(p),p}upsertFieldCount(t,r){let n=Jn.getNecessaryLookUpTable(r),i=1;n.containsKey(t)&&(i+=n.getValue(t)),n.upsert(t,i)}appendDefaultDisplayCondition(t){let r='<DisplayConditions Order="0" FallbackForm="true"><Everyone/></DisplayConditions>';if(!E.IsNullOrUndefined(t)){let n=E.ParseXml(r);n!==null&&this.populateElementChildren(t,n.childNodes)}}createFormModel(t,r,n,i,a,o,s,l,u,c){let d=new uu(r,n,i,a,o,s,l,u,c);return this.populateElementProperties(d,t.attributes),this.populateElementChildren(d,t.childNodes),s===Be.Main&&(this.insertHeaderFooterElementProperties(v.formHeader,d,d.header),this.insertHeaderFooterElementProperties(v.formFooter,d,d.footer)),d}insertHeaderFooterElementProperties(t,r,n){if(E.IsNullOrUndefined(n)){let i=t===v.formHeader?new Ko(r,!0):new Xo(r,!0);It.prototype.insertProperty.call(i,m.id,"{"+P.NewGuid()+"}"),It.prototype.insertProperty.call(i,m.Fieldlabelposition,"Top"),It.prototype.insertProperty.call(i,m.columnName,we.MarginalControlColumns),It.prototype.insertProperty.call(i,m.LabelWidth,we.LabelWidth),It.prototype.insertProperty.call(i,m.Fieldlabelalignment,"Left");let a=null,o=new ri(a);for(let s=0;s<i.maxColumns;s++){let l=new Nt(o);It.prototype.insertProperty.call(l,m.id,"{"+P.NewGuid()+"}"),l.setDisplayName(T.EmptyString,this.lcid),It.prototype.insertProperty.call(l,m.showlabel,"false"),o.addCell(l)}i.appendRow(o),t===v.formHeader?r.header=i:r.footer=i}}deSerializeFormXmlNode(t,r){if(t&&t.nodeValue&&(t.nodeType===Node.TEXT_NODE||t.nodeType===Node.CDATA_SECTION_NODE))return new It(`<${t.nodeValue}`,r);if(t.nodeType===Node.COMMENT_NODE)return;let n=this.createModelNode(t,r);return this.populateElementProperties(n,t.attributes),this.populateElementChildren(n,t.childNodes),n}populateElementProperties(t,r){if(!r){let n="attributes is undefined for element: "+t.getNodeName();throw(0,Zf.trackErrorTrace)(pt,{eventName:em,eventData:{error:n}}),new Error(n)}for(let n=0;n<r.length;n++){let i=r.item(n);i&&(It.prototype.insertProperty.call(t,i.name,i.value),t.getNodeName()===v.formCell&&i.name===m.auto&&i.value==="true"&&t.setAutoExpandDetailsForTab())}}populateElementChildren(t,r){for(let n=0;n<r.length;n++){let i=r.item(n),a=this.deSerializeFormXmlNode(i,t);a&&It.prototype.insertChild.call(t,a)}}createModelNode(t,r){switch(t.nodeName){case v.form:throw new Error("Form node shouldn't be created using this method");case v.formTab:return new Qr(r);case v.formColumn:return new Dn(r);case v.formHeader:return new Ko(r,!1);case v.formFooter:return new Xo(r,!1);case v.formSection:return new Cr(v.formSection,r);case v.formRow:return new ri(r);case v.formCell:return new Nt(r);case v.formControl:let n=t.attributes,i=t.childNodes.length>0?t.childNodes[0].childNodes:null,a;for(let s=0;s<n.length;s++){let l=n.item(s);if(l.name===m.indicationOfSubgrid&&l.value==="true"||l.name===m.classid&&(l.value?.toLocaleUpperCase()===`{${S.SubgridControl}}`||l.value?.toLocaleUpperCase()===`{${S.ReferencePanelSubgridControl}}`))a=qt.Grid;else if(l.name===m.classid&&l.value?.toLocaleUpperCase()===`{${S.LookupControl}}`)a=qt.Lookup;else if(l.name===m.classid&&l.value?.toLocaleUpperCase()===`{${S.CustomControl}}`)for(let u=0;u<i?.length;u++)i[u].nodeName===m.DefaultViewId&&(a=qt.Lookup)}return a===qt.Grid?new ca(r):a===qt.Lookup?new da(r):new ar(r);case v.formEvent:return new ua(r,T.EmptyString);case v.dependency:return this.populateDependencyTable(t),new la(r,T.EmptyString);case v.Handler:let o=[];return new pu(o,r);case v.formNavigation:return new gu(t.nodeName,r);case v.formNavBarArea:return new ma(t.nodeName,r);case v.formNavBarAreas:return new ha(t.nodeName,r);case v.formNavBar:return new fu(r);case v.formNavBarByRelationshipItem:return new mu(r);case v.formNavBarItem:return new hu(r);case v.formDisplayConditions:return new du(r);case v.library:return new pa(r,T.EmptyString,T.EmptyString);case v.controlDescription:return new Pl(r);case v.customControl:return this.populateCustomControlConfigurationId(t),new ql(r);default:return new It(t.nodeName,r)}}populateDependencyTable(t){let r=t.attributes;for(let n=0;n<r.length;n++){let i=r.item(n);i.name===m.id&&this.upsertFieldCount(i.value,yr.DependencyFieldTable)}}populateCustomControlConfigurationId(t){let r=t.attributes;for(let n=0;n<r.length;n++){let i=r.item(n);if(i.name===m.id){let a=new P(i.value.substr(1,i.value.length-2));for(let o=0;o<t.parentNode.attributes.length;o++){let s=t.parentNode.attributes.item(o);if(s.name===m.ForControl){let l=s.value.substr(1,i.value.length-2);$e.CustomControlIdMap.upsert(l,a);break}}break}}}}});var u2={};Rr(u2,{SerializationService:()=>rm,SerializationServiceScope:()=>g9,SerializedFormElementNode:()=>ga});var g9,ga,rm,c2=I(()=>{"use strict";ot();Qe();rr();Qf();g9="SerializationService",ga=class extends j{fetchNodeName(){return this.getNodeName()}enumerateProperties(){return this.getAllProperties()}enumerateChildren(){return this.getAllChildren()}},rm=class{langCode;constructor(t){this.langCode=t}serializeFormXmlNode(t){let r=ga.prototype.fetchNodeName.call(t);if(r.charAt(0)===jr.StartTag)return T.EscapeXml(r.substr(1),!1);if(t.isTransient&&!t.isDirty())return T.EmptyString;let n=ga.prototype.enumerateProperties.call(t),i=ga.prototype.enumerateChildren.call(t);if(!(t instanceof ni)){let a=`<${r}`;if(n.length!==0&&(a+=` ${this.getPropertiesString(n)}`),i.length===0)a+=" />";else{let o=T.EmptyString;for(let s of i)o+=this.serializeFormXmlNode(s);a+=`>${o}</${r}>`}return a}return T.EmptyString}getPropertiesString(t){let r=T.EmptyString;return t.forEach((n,i)=>{i!==0&&(r+=" "),r+=`${n.key}="${T.EscapeXml(n.value,!0)}"`}),r}}});var In=g(vu=>{"use strict";Object.defineProperty(vu,"__esModule",{value:!0});vu.installDomShim=void 0;var d2=wl(),p2=!1,v9={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12};function y9(){if(p2)return;let e=globalThis;typeof e.DOMParser>"u"&&(e.DOMParser=d2.DOMParser),typeof e.XMLSerializer>"u"&&(e.XMLSerializer=d2.XMLSerializer),typeof e.Node>"u"&&(e.Node=v9),p2=!0}vu.installDomShim=y9});var P2=g(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.classIdForAttributeType=_t.QUICK_VIEW_CLASS_ID=_t.NOTES_CLASS_ID=_t.SUBGRID_CLASS_ID=_t.formRegistration=_t.FormAdapter=void 0;var Vt=(Ue(),Fr(xb)),b9=(Le(),Fr(Lb)),w9=(Qe(),Fr(Mb)),lt=(K(),Fr(kb)),ke=(Hn(),Fr(Ub)),A9=(Wf(),Fr(l2)),C9=(c2(),Fr(u2)),qe=mn(),f2=Yt(),ai=cr(),S9=qd(),y2=bt(),om=ee(),b2=In(),w2=Ni(),E9={[lt.FormType.Main]:"Main",[lt.FormType.QuickCreate]:"QuickCreate",[lt.FormType.QuickViewForm]:"QuickView",[lt.FormType.Card]:"Card"},nm={Main:lt.FormType.Main,QuickCreate:lt.FormType.QuickCreate,QuickView:lt.FormType.QuickViewForm,Card:lt.FormType.Card},N9=new Map(Object.entries(ke.ControlClassId).map(([e,t])=>[String(t).toUpperCase(),e]));function A2(e){var t;return e&&(t=N9.get(e.toUpperCase()))!==null&&t!==void 0?t:"Unknown"}function Zo(e){return e.getAllProperties().map(t=>[t.key,t.value])}function oi(e){let t=new Map;for(let r of e.getAllProperties())t.has(r.key)||t.set(r.key,r.value);return t}function C2(e,t){return e.getAllChildren().find(r=>r.getNodeName()===t)}function sm(e,t){var r,n;let i=C2(e,"labels");if(!i)return"";let a=i.getAllChildren().filter(s=>s.getNodeName()==="label"),o=(r=a.find(s=>oi(s).get("languagecode")===String(t)))!==null&&r!==void 0?r:a[0];return o&&(n=oi(o).get("description"))!==null&&n!==void 0?n:""}function D9(e){let t=C2(e,"parameters"),r={};if(!t)return r;for(let n of t.getAllChildren()){let i=n.getNodeName();if(i.charAt(0)==="<"||i.charAt(0)==="#")continue;let a=n.getAllChildren()[0],o=a?a.getNodeName():"";o.charAt(0)==="<"&&(o=o.substring(1)),r[i]=o}return r}function S2(e){return/^1+$/.test(e)&&e.length>=1&&e.length<=4?e.length:1}function im(e){let t=Math.min(Math.max(Math.trunc(e),1),4);return"1".repeat(t)}function es(e){return String(e??"").replace(/[{}]/g,"")}function am(e){return`{${es(e)}}`}function m2(e,t){if(e===void 0||e==="")return t;let r=Number(e);return Number.isNaN(r)?t:r}function bu(e,t,r){let n=e.getAllChildren(),i=n.findIndex(u=>u.getNodeName()===t),a=[];if(n.forEach((u,c)=>{c!==i&&a.push({i:c,node:(0,qe.rawFromNode)(u)})}),i<0)return{modeled:[],bag:{a:Zo(e),c:a}};let o=n[i],s=[],l=[];return o.getAllChildren().forEach((u,c)=>{u.getNodeName()===r?s.push(u):l.push({i:c,node:(0,qe.rawFromNode)(u)})}),{modeled:s,bag:{a:Zo(e),c:a,w:{n:o.getNodeName(),a:Zo(o),c:l}}}}function E2(e,t,r){let n=[],i=[];return e.getAllChildren().forEach((a,o)=>{a.getNodeName()===t&&(!r||n.length===0)?n.push(a):i.push({i:o,node:(0,qe.rawFromNode)(a)})}),{modeled:n,bag:{a:Zo(e),c:i}}}function I9(e,t){let{modeled:r,bag:n}=bu(e,"tabs","tab");return{tabs:r.map(i=>_9(i,t)),bag:n}}function _9(e,t){var r,n;let i=oi(e),{modeled:a,bag:o}=bu(e,"columns","column");return{id:(r=i.get("id"))!==null&&r!==void 0?r:"",name:(n=i.get("name"))!==null&&n!==void 0?n:"",label:sm(e,t),expanded:i.get("expanded")==="true",visible:i.has("visible")?i.get("visible")==="true":!0,columns:a.map(s=>P9(s,t)),bag:o}}function P9(e,t){let r=oi(e),{modeled:n,bag:i}=bu(e,"sections","section");return{width:r.get("width"),sections:n.map(a=>T9(a,t)),bag:i}}function T9(e,t){var r,n,i;let a=oi(e),{modeled:o,bag:s}=bu(e,"rows","row");return{id:(r=a.get("id"))!==null&&r!==void 0?r:"",name:(n=a.get("name"))!==null&&n!==void 0?n:"",label:sm(e,t),visible:a.has("visible")?a.get("visible")==="true":!0,showLabel:a.get("showlabel")==="true",columns:S2((i=a.get("columns"))!==null&&i!==void 0?i:"1"),rows:o.map(l=>O9(l,t)),bag:s}}function O9(e,t){let{modeled:r,bag:n}=E2(e,"cell",!1);return{cells:r.map(i=>R9(i,t)),bag:n}}function R9(e,t){var r;let n=oi(e),{modeled:i,bag:a}=E2(e,"control",!0),o=sm(e,t),s=n.get("showlabel")==="true",l=i[0]?F9(i[0],o,s):null;return{id:(r=n.get("id"))!==null&&r!==void 0?r:"",visible:n.has("visible")?n.get("visible")==="true":!0,colspan:m2(n.get("colspan"),1),rowspan:m2(n.get("rowspan"),1),control:l,bag:a}}function F9(e,t,r){var n,i;let a=oi(e),o=es((n=a.get("classid"))!==null&&n!==void 0?n:""),s=a.get("datafieldname");return{id:(i=a.get("id"))!==null&&i!==void 0?i:"",classId:o,fieldName:s||null,type:A2(o),isRequired:a.get("isrequired")==="true",isReadOnly:a.get("disabled")==="true",label:t,showLabel:r,parameters:D9(e),bag:{a:Zo(e),c:e.getAllChildren().map((l,u)=>({i:u,node:(0,qe.rawFromNode)(l)}))}}}function va(e){return e.a.length===0&&e.c.length===0&&!e.w}function N2(e,t){let r=e.a.find(n=>n[0]===t);return r?r[1]:void 0}function si(e,t){var r;let n=new Set(e.a.map(o=>o[0])),i=va(e),a=[];for(let o of t)if(n.has(o.key)){let s=(r=N2(e,o.key))!==null&&r!==void 0?r:"";o.matches(s)||a.push([o.key,o.render()])}else i?a.push([o.key,o.render()]):o.matches(o.absentDefault)||a.push([o.key,o.render()]);return(0,qe.mergeAttrs)(e.a,a)}var _n=(e,t)=>({key:e,matches:r=>r===t,render:()=>t,absentDefault:""}),Pn=(e,t,r=!1)=>({key:e,matches:n=>n==="true"===t,render:()=>String(t),absentDefault:String(r)}),h2=(e,t,r=1)=>({key:e,matches:n=>Number(n)===t,render:()=>String(t),absentDefault:String(r)});function lm(e,t){return{n:"labels",a:[],c:[{n:"label",a:[["description",e],["languagecode",String(t)]],c:[]}]}}function D2(e){return{n:"parameters",a:[],c:Object.keys(e).map(t=>({n:(0,om.assertXmlName)(t,"Form control parameter name"),a:[],c:[{n:`<${e[t]}`,a:[],c:[]}]}))}}function x9(e,t){var r,n;let i=e.c.find(o=>o.n==="label"&&o.a.some(s=>s[0]==="languagecode"&&s[1]===String(t))),a=i??e.c.find(o=>o.n==="label");return(n=(r=a?.a.find(o=>o[0]==="description"))===null||r===void 0?void 0:r[1])!==null&&n!==void 0?n:""}function L9(e,t,r){let n=!1,i=e.c.map(a=>a.n!=="label"||!a.a.some(s=>s[0]==="languagecode"&&s[1]===String(r))?a:(n=!0,{...a,a:a.a.map(s=>s[0]==="description"?["description",t]:s)}));return n||i.push({n:"label",a:[["description",t],["languagecode",String(r)]],c:[]}),{...e,c:i}}function um(e,t,r){let n=e.c.findIndex(a=>a.node.n==="labels");if(n<0||x9(e.c[n].node,r)===t)return e;let i=L9(e.c[n].node,t,r);return{...e,c:e.c.map((a,o)=>o===n?{...a,node:i}:a)}}function k9(e){let t={};for(let r of e.c){let n=r.n;if(n.charAt(0)==="<"||n.charAt(0)==="#")continue;let i=r.c[0],a=i?i.n:"";a.charAt(0)==="<"&&(a=a.substring(1)),t[n]=a}return t}function M9(e,t){let r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every(i=>e[i]===t[i])}function U9(e,t){return e.a.some(r=>r[0]===t)?{...e,a:e.a.filter(r=>r[0]!==t)}:e}function B9(e,t){let r=e.c.findIndex(i=>i.node.n==="parameters");if(r<0||M9(k9(e.c[r].node),t))return e;let n=D2(t);return{...e,c:e.c.map((i,a)=>a===r?{...i,node:n}:i)}}function wu(e,t,r,n){if(e.w){let o={n:e.w.n,a:e.w.a.map(s=>[s[0],s[1]]),c:(0,qe.spliceChildren)(e.w.c,r)};return(0,qe.spliceChildren)(e.c,[o])}let i=n(),a={n:t,a:[],c:r};return e.c.length===0?[...i,a]:(0,qe.spliceChildren)(e.c,[...i,a])}function $9(e,t){let r=e.tabs.map(n=>q9(n,t));return{n:"form",a:si(e.bag,[]),c:e.tabs.length===0&&va(e.bag)?[]:wu(e.bag,"tabs",r,()=>[])}}function q9(e,t){let r=[_n("id",e.id),_n("name",e.name),Pn("expanded",e.expanded),Pn("visible",e.visible,!0)],n=e.columns.map(a=>V9(a,t)),i=um(e.bag,e.label,t);return{n:"tab",a:si(i,r),c:wu(i,"columns",n,()=>e.label?[lm(e.label,t)]:[])}}function V9(e,t){let r=e.width!==void 0?[_n("width",e.width)]:[],n=e.sections.map(i=>G9(i,t));return{n:"column",a:si(e.bag,r),c:wu(e.bag,"sections",n,()=>[])}}function G9(e,t){let r=[_n("id",e.id),_n("name",e.name),Pn("showlabel",e.showLabel),Pn("visible",e.visible,!0),{key:"columns",matches:a=>S2(a)===e.columns,render:()=>im(e.columns),absentDefault:im(1)}],n=e.rows.map(a=>z9(a,t)),i=um(e.bag,e.label,t);return{n:"section",a:si(i,r),c:wu(i,"rows",n,()=>e.label?[lm(e.label,t)]:[])}}function z9(e,t){let r=e.cells.map(n=>W9(n,t));return{n:"row",a:si(e.bag,[]),c:va(e.bag)?r:(0,qe.assembleChildren)(e.bag,r)}}function W9(e,t){let r=e.control?e.control.showLabel:N2(e.bag,"showlabel")==="true",n=[_n("id",e.id),Pn("showlabel",r),Pn("visible",e.visible,!0),h2("colspan",e.colspan),h2("rowspan",e.rowspan)],i=e.control?[j9(e.control)]:[],a;if(va(e.bag))a=[...e.control&&e.control.label?[lm(e.control.label,t)]:[],...i];else{let o=e.control?um(e.bag,e.control.label,t):e.bag;a=(0,qe.assembleChildren)(o,i)}return{n:"cell",a:si(e.bag,n),c:a}}function j9(e){let t=[_n("id",e.id),{key:"classid",matches:i=>es(i)===e.classId,render:()=>am(e.classId),absentDefault:""}];e.fieldName!==null&&t.push(_n("datafieldname",e.fieldName)),t.push(Pn("disabled",e.isReadOnly)),t.push(Pn("isrequired",e.isRequired));let r=e.fieldName===null?U9(e.bag,"datafieldname"):e.bag,n;return va(r)?n=Object.keys(e.parameters).length>0?[D2(e.parameters)]:[]:n=(0,qe.assembleChildren)(B9(r,e.parameters),[]),{n:"control",a:si(r,t),c:n}}var H9={make:(e,t)=>new w9.FormElementNode(e,t),setProp:(e,t,r)=>e.setProperty(t,r),addChild:(e,t)=>e.addChild(t)};function g2(e,t,r){(0,b2.installDomShim)();let n=J9(e,r),i=(0,qe.rebuildRaw)($9(n,t),H9,null);return new C9.SerializationService(t).serializeFormXmlNode(i)}function Q9(e){return JSON.parse(JSON.stringify(e))}function J9(e,t){var r;let n=Q9(e);n.bag||(n.bag=(0,qe.emptyBag)()),n8(n.bag),t&&X9(n,t);for(let i of(r=n.tabs)!==null&&r!==void 0?r:[])K9(i);return n}function X9(e,t){var r;let n=(r=e.entityLogicalName)!==null&&r!==void 0?r:"";I2(e,i=>{let a=i.fieldName,o=i;if(!a||o.label!==void 0&&o.classId!==void 0)return;let s=t.resolveField(n,a);s&&(o.label===void 0&&s.displayName&&(o.label=s.displayName),o.classId===void 0&&s.attributeType&&(o.classId=_2(s.attributeType)))})}function I2(e,t){var r,n,i,a,o;for(let s of(r=e.tabs)!==null&&r!==void 0?r:[])for(let l of(n=s.columns)!==null&&n!==void 0?n:[])for(let u of(i=l.sections)!==null&&i!==void 0?i:[])for(let c of(a=u.rows)!==null&&a!==void 0?a:[])for(let d of(o=c.cells)!==null&&o!==void 0?o:[])d.control&&t(d.control)}function K9(e){e.id||(e.id=Vt.Guid.NewGuid()),e.name===void 0&&(e.name=""),e.label===void 0&&(e.label=""),e.expanded===void 0&&(e.expanded=!0),e.visible===void 0&&(e.visible=!0),e.columns||(e.columns=[]);for(let t of e.columns)Y9(t);e.bag||(e.bag=(0,qe.emptyBag)())}function Y9(e){e.sections||(e.sections=[]);for(let t of e.sections)Z9(t);e.bag||(e.bag=(0,qe.emptyBag)()),e.width===void 0&&va(e.bag)&&(e.width="100%")}function Z9(e){e.id||(e.id=Vt.Guid.NewGuid()),e.name===void 0&&(e.name=""),e.label===void 0&&(e.label=""),e.showLabel===void 0&&(e.showLabel=!1),e.visible===void 0&&(e.visible=!0),e.columns===void 0&&(e.columns=1),e.rows||(e.rows=[]);for(let t of e.rows)e8(t);e.bag||(e.bag=(0,qe.emptyBag)())}function e8(e){e.cells||(e.cells=[]);for(let t of e.cells)t8(t);e.bag||(e.bag=(0,qe.emptyBag)())}function t8(e){e.id||(e.id=Vt.Guid.NewGuid()),e.visible===void 0&&(e.visible=!0),e.colspan===void 0&&(e.colspan=1),e.rowspan===void 0&&(e.rowspan=1),e.control===void 0&&(e.control=null),e.control&&r8(e.control),e.bag||(e.bag=(0,qe.emptyBag)())}function r8(e){var t;e.id||(e.id=Vt.Guid.NewGuid()),e.classId===void 0&&(e.classId=String(ke.ControlClassId.TextboxControl)),e.fieldName===void 0&&(e.fieldName=null),e.type===void 0&&(e.type=e.fieldName?"Field":A2(String(e.classId))),e.isRequired===void 0&&(e.isRequired=!1),e.isReadOnly===void 0&&(e.isReadOnly=!1),e.label===void 0&&(e.label=(t=e.fieldName)!==null&&t!==void 0?t:""),e.showLabel===void 0&&(e.showLabel=!0),(e.parameters===void 0||e.parameters===null)&&(e.parameters={});for(let r of Object.keys(e.parameters))(0,om.assertXmlName)(r,"Form control parameter name");e.bag||(e.bag=(0,qe.emptyBag)())}function n8(e){for(let t of e.c){let r=t.node;if(r.n==="events"){for(let n of r.c)if(n.n==="event"){for(let i of n.c)if(i.n==="Handlers")for(let a of i.c)a.n==="Handler"&&!v2(a,"handlerUniqueId")&&a.a.push(["handlerUniqueId",am(Vt.Guid.NewGuid())])}}else if(r.n==="formLibraries")for(let n of r.c)n.n==="Library"&&!v2(n,"libraryUniqueId")&&n.a.push(["libraryUniqueId",am(Vt.Guid.NewGuid())])}}var yu=class{constructor(t=w2.DEFAULT_LCID){this.lcid=t}toArtifact(t,r){var n,i,a;let{tabs:o,bag:s}=I9(t,this.lcid);return{id:t.formId?t.formId.guidString:"",name:(n=t.formName)!==null&&n!==void 0?n:"",entityLogicalName:(i=t.entityName)!==null&&i!==void 0?i:"",formType:(a=E9[t.formType])!==null&&a!==void 0?a:"Main",status:this.readActivationStatus(t),...r!==void 0&&r!==""?{description:r}:{},tabs:o,bag:s}}fromArtifact(t){var r;return this.deserialize({formxml:g2(t,this.lcid),formid:t.id||Vt.Guid.NewGuid(),objecttypecode:t.entityLogicalName,type:nm[t.formType],name:t.name,uniquename:t.name,description:(r=t.description)!==null&&r!==void 0?r:"",formpresentation:lt.FormPresentation.AirForm,formactivationstate:t.status==="Active"?lt.FormActivationState.Active:lt.FormActivationState.InActive})}fromApiResponse(t){var r,n,i,a,o,s,l;let u=t,c=this.deserialize({formxml:(r=u.formxml)!==null&&r!==void 0?r:"",formid:(n=u.formid)!==null&&n!==void 0?n:Vt.Guid.NewGuid(),objecttypecode:(i=u.objecttypecode)!==null&&i!==void 0?i:"",type:u.type,name:(a=u.name)!==null&&a!==void 0?a:"",uniquename:(o=u.uniquename)!==null&&o!==void 0?o:"",description:(s=u.description)!==null&&s!==void 0?s:"",formpresentation:u.formpresentation,formactivationstate:u.formactivationstate});return this.toArtifact(c,(l=u.description)!==null&&l!==void 0?l:void 0)}toApiPayload(t,r,n){return{formxml:g2(t,this.lcid,n),name:t.name,type:nm[t.formType],objecttypecode:t.entityLogicalName,...t.description!==void 0?{description:t.description}:{}}}metadataNeeds(t){let r=t.entityLogicalName;if(!r)return[];let n=new Set,i=[];return I2(t,a=>{let o=a.fieldName,s=a;!o||s.label!==void 0&&s.classId!==void 0||n.has(o)||(n.add(o),i.push({entityLogicalName:r,fieldName:o}))}),i}createDefault(t){var r,n,i,a,o,s,l,u,c,d,p;let f=t.tabs&&t.tabs.length>0?void 0:p8(this.lcid),h=f!==void 0?f:t.tabs.map(N=>i8(N,this.lcid)).join(""),y=this.deserialize({formxml:`<form><tabs>${h}</tabs></form>`,formid:t.id||Vt.Guid.NewGuid(),objecttypecode:(r=t.entityLogicalName)!==null&&r!==void 0?r:"",type:nm[(n=t.formType)!==null&&n!==void 0?n:"Main"],name:(i=t.name)!==null&&i!==void 0?i:"New Form",uniquename:(a=t.name)!==null&&a!==void 0?a:"New Form",description:(o=t.description)!==null&&o!==void 0?o:"",formpresentation:lt.FormPresentation.AirForm,formactivationstate:((s=t.status)!==null&&s!==void 0?s:"Active")==="Active"?lt.FormActivationState.Active:lt.FormActivationState.InActive}),w=this.toArtifact(y,t.description);return{id:(l=t.id)!==null&&l!==void 0?l:w.id,name:(u=t.name)!==null&&u!==void 0?u:"New Form",entityLogicalName:(c=t.entityLogicalName)!==null&&c!==void 0?c:"",formType:(d=t.formType)!==null&&d!==void 0?d:"Main",status:(p=t.status)!==null&&p!==void 0?p:"Active",...t.description!==void 0?{description:t.description}:{},tabs:w.tabs,bag:w.bag}}assignMissingIds(t){return(0,y2.assignMissingIds)(t)}validate(t){return m8(t)}deserialize(t){(0,b2.installDomShim)();let r=b9.ScriptUtilities.ParseXml(t.formxml),n=new A9.DeserializationService(this.lcid).deSerializeFormXml(r,new Vt.Guid(t.formid),t.objecttypecode,lt.FormState.Draft,t.name,t.uniquename,t.type,t.formpresentation,t.description,t.formactivationstate);if(!n)throw new Error("FormXml could not be deserialized into a Form model.");return n}readActivationStatus(t){return t.formactivationstate===lt.FormActivationState.InActive?"Inactive":"Active"}};_t.FormAdapter=yu;function or(e){return String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function cm(e,t){return e?`<labels><label description="${or(e)}" languagecode="${t}" /></labels>`:""}function dm(e){return e&&e.length>0?es(e):(0,y2.newId)()}function i8(e,t){var r,n,i,a;let o=(r=e.columns)!==null&&r!==void 0?r:[],s=(o.length>0?o:[d8()]).map(l=>a8(l,t)).join("");return`<tab id="{${or(dm(e.id))}}" name="${or((n=e.name)!==null&&n!==void 0?n:"")}" expanded="${(i=e.expanded)!==null&&i!==void 0?i:!0}" visible="${(a=e.visible)!==null&&a!==void 0?a:!0}">${cm(e.label,t)}<columns>${s}</columns></tab>`}function a8(e,t){var r,n;let i=((r=e.sections)!==null&&r!==void 0?r:[]).map(a=>o8(a,t)).join("");return`<column width="${or((n=e.width)!==null&&n!==void 0?n:"100%")}"><sections>${i}</sections></column>`}function o8(e,t){var r,n,i,a,o;let s=((r=e.rows)!==null&&r!==void 0?r:[]).map(l=>s8(l,t)).join("");return`<section id="{${or(dm(e.id))}}" name="${or((n=e.name)!==null&&n!==void 0?n:"")}" showlabel="${(i=e.showLabel)!==null&&i!==void 0?i:!1}" visible="${(a=e.visible)!==null&&a!==void 0?a:!0}" columns="${im((o=e.columns)!==null&&o!==void 0?o:1)}">${cm(e.label,t)}<rows>${s}</rows></section>`}function s8(e,t){var r;return`<row>${((r=e.cells)!==null&&r!==void 0?r:[]).map(n=>l8(n,t)).join("")}</row>`}function l8(e,t){var r,n,i,a,o,s;let l=e.control,u=l?cm((n=(r=l.label)!==null&&r!==void 0?r:l.fieldName)!==null&&n!==void 0?n:"",t):"",c=l?u8(l):"";return`<cell id="{${or(dm(e.id))}}" showlabel="${l?(i=l.showLabel)!==null&&i!==void 0?i:!0:!1}" visible="${(a=e.visible)!==null&&a!==void 0?a:!0}" colspan="${(o=e.colspan)!==null&&o!==void 0?o:1}" rowspan="${(s=e.rowspan)!==null&&s!==void 0?s:1}">${u}${c}</cell>`}function u8(e){var t,r,n;let i=e.fieldName?` datafieldname="${or(e.fieldName)}"`:"",a=c8(e.parameters),o=e.classId?es(e.classId):String(ke.ControlClassId.TextboxControl);return`<control id="${or((t=e.id)!==null&&t!==void 0?t:"")}" classid="{${or(o)}}"${i} disabled="${(r=e.isReadOnly)!==null&&r!==void 0?r:!1}" isrequired="${(n=e.isRequired)!==null&&n!==void 0?n:!1}">${a}</control>`}function c8(e){let t=Object.keys(e??{});return t.length===0?"":(t.forEach(n=>(0,om.assertXmlName)(n,"Form control parameter name")),`<parameters>${t.map(n=>`<${n}>${or(e[n])}</${n}>`).join("")}</parameters>`)}function d8(){return{width:"100%",sections:[],bag:{a:[],c:[]}}}function p8(e){return`<tab id="{${Vt.Guid.NewGuid()}}" name="tab_general" expanded="true" visible="true"><labels><label description="General" languagecode="${e}" /></labels><columns><column width="100%"><sections><section id="{${Vt.Guid.NewGuid()}}" name="section_general" showlabel="false" visible="true" columns="1"><labels><label description="General" languagecode="${e}" /></labels><rows></rows></section></sections></column></columns></tab>`}function f8(e=w2.DEFAULT_LCID){return{adapter:new yu(e),api:S9.formApi,languageSensitive:!0,publish:(t,r,n)=>(0,f2.publishBoundEntity)(t,n),publishScope:(t,r)=>(0,f2.boundEntityPublishScope)(r)}}_t.formRegistration=f8;function m8(e){let t=[];return(0,ai.childObjects)(e,"tabs","","tab",t).forEach(({node:n,index:i})=>{(0,ai.childObjects)(n,"columns",`/tabs/${i}`,"column",t).forEach(({node:o,index:s})=>{let l=`/tabs/${i}/columns/${s}`;(0,ai.childObjects)(o,"sections",l,"section",t).forEach(({node:c,index:d})=>{let p=`${l}/sections/${d}`;(0,ai.childObjects)(c,"rows",p,"row",t).forEach(({node:h,index:y})=>{let w=`${p}/rows/${y}`;(0,ai.childObjects)(h,"cells",w,"cell",t).forEach(({node:D,index:x})=>{let F=D.control;F!=null&&!(0,ai.isJsonObject)(F)&&t.push((0,ai.issue)(`${w}/cells/${x}/control`,"control-must-be-object-or-null",`a cell control must be a JSON object or null, got ${typeof F}`))})})})})}),t}_t.SUBGRID_CLASS_ID=ke.ControlClassId.SubgridControl;_t.NOTES_CLASS_ID=ke.ControlClassId.TimelineControl;_t.QUICK_VIEW_CLASS_ID=ke.ControlClassId.QuickViewControl;var h8={Lookup:String(ke.ControlClassId.LookupControl),Customer:String(ke.ControlClassId.LookupControl),Owner:String(ke.ControlClassId.LookupControl),PartyList:String(ke.ControlClassId.PartyListControl),Boolean:String(ke.ControlClassId.BooleanControl),DateTime:String(ke.ControlClassId.DateTimeControl),Decimal:String(ke.ControlClassId.DecimalControl),Double:String(ke.ControlClassId.FloatingNumberControl),Money:String(ke.ControlClassId.CurrencyControl),Integer:String(ke.ControlClassId.IntegerControl),BigInt:String(ke.ControlClassId.IntegerControl),Memo:String(ke.ControlClassId.TextAreaControl),String:String(ke.ControlClassId.TextboxControl)},g8="3EF39988-22BB-4F0B-BBBE-64B5A3748AEE";function _2(e){return e==="Picklist"||e==="State"||e==="Status"?g8:e&&h8[e]||String(ke.ControlClassId.TextboxControl)}_t.classIdForAttributeType=_2;function v2(e,t){let r=e.a.find(n=>n[0]===t);return r?r[1]:void 0}});var pm=g(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});ya.viewApi=ya.findDefaultViews=void 0;var O2=Kt(),Gt=be(),Jr=ee(),v8="savedqueryid,name,description,fetchxml,layoutxml,querytype,returnedtypecode,isdefault",y8="savedqueryid,name,returnedtypecode,querytype,isdefault";async function b8(e,t,r={}){var n;let i=new Set(((n=r.excludeViewIds)!==null&&n!==void 0?n:[]).filter(Boolean)),a=`returnedtypecode eq '${(0,Jr.odataLiteral)(t)}' and querytype eq 0`,o=`/savedqueries${(0,Jr.odataQuery)([["$select","savedqueryid,name,isdefault"],["$filter",a]])}`;return(await(0,O2.collectPages)(e,o,`findDefaultViews('${t}')`)).filter(l=>{var u;return l.savedqueryid&&!i.has(l.savedqueryid)&&(l.isdefault||/^(Active|Inactive)\b/i.test((u=l.name)!==null&&u!==void 0?u:""))}).map(l=>{var u;return{id:String(l.savedqueryid),name:String((u=l.name)!==null&&u!==void 0?u:"")}})}ya.findDefaultViews=b8;async function w8(e,t){var r;let n=`/EntityDefinitions(LogicalName='${(0,Jr.odataLiteral)(t)}')${(0,Jr.odataQuery)([["$select","ObjectTypeCode"]])}`,i=await e.get(n);if(i.status>=200&&i.status<300){let a=(r=i.body)===null||r===void 0?void 0:r.ObjectTypeCode;return typeof a=="number"?a:void 0}}async function T2(e,t,r){if(!r||!/<grid\b/.test(t)||/<grid[^>]*\bobject=/.test(t))return t;let n=await w8(e,r);return n===void 0?t:t.replace(/<grid\b/,`<grid object="${n}"`)}ya.viewApi={async get(e,t){let n=`/savedqueries(${(0,Jr.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Jr.odataQuery)([["$select",v8]]),i=(0,Gt.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,Gt.readEtag)(i)}},async list(e,t){let r=`/savedqueries${(0,Jr.odataQuery)([["$select",y8],["$filter",t?.entityLogicalName?`returnedtypecode eq '${(0,Jr.odataLiteral)(t.entityLogicalName)}'`:void 0]])}`;return(await(0,O2.collectPages)(e,r,"listArtifacts('view')")).map(i=>{var a,o;return{type:"view",id:(a=i.savedqueryid)!==null&&a!==void 0?a:"",name:(o=i.name)!==null&&o!==void 0?o:"",entityLogicalName:i.returnedtypecode,isDirty:!1}})},async create(e,t,r){let n=t,i=(0,Gt.echoWrite)("savedqueryid"),a=`/savedqueries${i.query}`,o=await T2(e,n.layoutxml,n.returnedtypecode),s=(0,Gt.ensureSuccess)(await e.post(a,(0,Gt.withClientMintedId)({name:n.name,description:n.description,fetchxml:n.fetchxml,layoutxml:o,returnedtypecode:n.returnedtypecode,querytype:n.querytype,isdefault:n.isdefault},"savedqueryid",r),i.options),e.apiUrl(a));return{id:(0,Gt.resolveCreatedId)(s,"savedqueryid","view",r),etag:(0,Gt.readEtag)(s)}},async update(e,t,r,n){let i=r,a=(0,Jr.normalizeGuid)(t,"id"),o=(0,Gt.echoWrite)("savedqueryid",{"If-Match":(0,Gt.requireEtag)(n,"view",a)}),s=`/savedqueries(${a})${o.query}`,l=await T2(e,i.layoutxml,i.returnedtypecode),u=(0,Gt.ensureSuccess)(await e.patch(s,{name:i.name,description:i.description,fetchxml:i.fetchxml,layoutxml:l},o.options),e.apiUrl(s));return{id:a,etag:(0,Gt.readEtag)(u)}},delete(e,t){return(0,Gt.deleteRecord)(e,"savedqueries",t)}}});var z2=g(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});wa.viewRegistration=wa.ViewAdapter=void 0;var ba=cr(),fm=mn(),li=Gn(),R2=Yt(),A8=pm(),mm=In(),C8=bt(),k2=100,Au=class{toArtifact(t){var r,n,i,a,o,s,l,u;(0,mm.installDomShim)();let c=(r=t.fetchxml)!==null&&r!==void 0?r:"",d=(n=t.layoutxml)!==null&&n!==void 0?n:"",p=(0,li.parseXmlRoot)(c,"<fetch/>"),f=(0,li.parseXmlRoot)(d,"<grid/>");return{id:(i=t.savedqueryid)!==null&&i!==void 0?i:"",name:(a=t.name)!==null&&a!==void 0?a:"",description:(o=t.description)!==null&&o!==void 0?o:"",entityLogicalName:(s=t.returnedtypecode)!==null&&s!==void 0?s:S8(p),queryType:(l=t.querytype)!==null&&l!==void 0?l:0,isDefault:(u=t.isdefault)!==null&&u!==void 0?u:!1,columns:U2(f,p),filters:q2(p),sort:$2(p),fetchBag:c?(0,li.projectElementBag)(p):void 0,layoutBag:d?(0,li.projectElementBag)(f):void 0}}fromArtifact(t){(0,mm.installDomShim)();let{fetchxml:r,layoutxml:n}=F2(t);return{savedqueryid:t.id,name:t.name,description:t.description,returnedtypecode:t.entityLogicalName,querytype:t.queryType,isdefault:t.isDefault,fetchxml:r,layoutxml:n}}fromApiResponse(t){return this.toArtifact(t??{})}toApiPayload(t){var r,n,i,a,o;(0,mm.installDomShim)();let{fetchxml:s,layoutxml:l}=F2(t);return{name:(r=t.name)!==null&&r!==void 0?r:"",description:(n=t.description)!==null&&n!==void 0?n:"",fetchxml:s,layoutxml:l,returnedtypecode:(i=t.entityLogicalName)!==null&&i!==void 0?i:"",querytype:(a=t.queryType)!==null&&a!==void 0?a:0,isdefault:(o=t.isDefault)!==null&&o!==void 0?o:!1}}createDefault(t){var r,n,i,a,o,s,l,u;let c=(r=t.entityLogicalName)!==null&&r!==void 0?r:"";return{id:(n=t.id)!==null&&n!==void 0?n:(0,C8.newId)(),name:(i=t.name)!==null&&i!==void 0?i:"New View",description:(a=t.description)!==null&&a!==void 0?a:"",entityLogicalName:c,queryType:(o=t.queryType)!==null&&o!==void 0?o:0,isDefault:(s=t.isDefault)!==null&&s!==void 0?s:!1,columns:t.columns&&t.columns.length>0?t.columns:[{name:`${c}id`,width:300,order:0}],filters:(l=t.filters)!==null&&l!==void 0?l:{type:"and",conditions:[],groups:[]},sort:(u=t.sort)!==null&&u!==void 0?u:[]}}assignMissingIds(t){return t}validate(t){let r=[],n=t;(0,ba.childObjects)(n,"columns","","column",r),(0,ba.childObjects)(n,"sort","","sort",r);let i=n.filters;return i!=null&&((0,ba.isJsonObject)(i)?M2(i,"/filters",r):r.push((0,ba.issue)("/filters","filters-must-be-object",`filters must be a JSON object, got ${typeof i}`))),r}};wa.ViewAdapter=Au;function M2(e,t,r){(0,ba.childObjects)(e,"conditions",t,"condition",r),(0,ba.childObjects)(e,"groups",t,"filterGroup",r).forEach(({node:i,index:a})=>M2(i,`${t}/groups/${a}`,r))}function S8(e){var t;let r=e.getElementsByTagName("entity")[0];return(t=r?.getAttribute("name"))!==null&&t!==void 0?t:""}function U2(e,t){var r;let n=B2(t),i=e.getElementsByTagName("cell"),a=[],o=0;for(let s=0;s<i.length;s+=1){let l=i[s];if(l.getAttribute("ishidden")==="1")continue;let u=l.getAttribute("name");if(!u)continue;let c=parseInt((r=l.getAttribute("width"))!==null&&r!==void 0?r:"",10),d={name:u,width:Number.isNaN(c)?k2:c,order:o},p=n.get(u);p&&(d.relatedEntity=p),o+=1,a.push(d)}return a}function B2(e){var t;let r=new Map,n=e.getElementsByTagName("link-entity");for(let i=0;i<n.length;i+=1){let a=n[i],o=a.getAttribute("name");if(!o)continue;let s=a.getElementsByTagName("attribute");for(let l=0;l<s.length;l+=1){let u=s[l],c=(t=u.getAttribute("alias"))!==null&&t!==void 0?t:u.getAttribute("name");c&&r.set(c,o)}}return r}function $2(e){var t;let r=e.getElementsByTagName("entity")[0];if(!r)return[];let n=[],i=r.childNodes;for(let a=0;a<i.length;a+=1){let o=i[a];if(o.nodeType===1&&o.tagName==="order"){let s=o.getAttribute("attribute");s&&n.push({attribute:s,descending:((t=o.getAttribute("descending"))!==null&&t!==void 0?t:"").toLowerCase()==="true"})}}return n}function q2(e){let t=e.getElementsByTagName("entity")[0],r={type:"and",conditions:[],groups:[]};if(!t)return r;let n=zt(t,"filter").filter(i=>!V2(i)).map(G2);return n.length===0?r:n.length===1?n[0]:{type:"and",conditions:[],groups:n}}function V2(e){if(zt(e,"filter").length>0)return!1;let t=zt(e,"condition");return t.length===0?!1:t.some(r=>r.getAttribute("isquickfindfields")==="1"||zt(r,"value").length>0)}function G2(e){var t,r;let n=((t=e.getAttribute("type"))!==null&&t!==void 0?t:"and").toLowerCase()==="or"?"or":"and",i=[],a=[],o=e.childNodes;for(let s=0;s<o.length;s+=1){let l=o[s];if(l.nodeType===1)if(l.tagName==="condition"){if(l.getAttribute("isquickfindfields")==="1")continue;let u=l.getAttribute("attribute");if(!u)continue;let c={attribute:u,operator:(r=l.getAttribute("operator"))!==null&&r!==void 0?r:""},d=l.getAttribute("value");d!==null&&(c.value=d),i.push(c)}else l.tagName==="filter"&&a.push(G2(l))}return{type:n,conditions:i,groups:a}}function zt(e,t){let r=[],n=e.childNodes;for(let i=0;i<n.length;i+=1){let a=n[i];a.nodeType===1&&a.tagName===t&&r.push(a)}return r}function F2(e){let t=E8(e.columns);if(!x2(e.fetchBag)||!x2(e.layoutBag))return{fetchxml:x8({...e,columns:t}),layoutxml:L8({...e,columns:t},`${e.entityLogicalName}id`)};let r=new DOMParser().parseFromString("<root/>","text/xml"),n=L2(e.fetchBag,"fetch",r),i=L2(e.layoutBag,"grid",r),a=U2(i,n),o=!hm(t,a),s=!hm(e.sort,$2(n)),l=!hm(e.filters,q2(n));return o&&(N8(r,n,t,a),P8(r,i,t)),s&&R8(r,n,e.sort),l&&F8(r,n,e.filters),{fetchxml:(0,li.serializeNode)(n),layoutxml:(0,li.serializeNode)(i)}}function E8(e){return(e??[]).map((t,r)=>{var n,i;return{name:String(t.name).toLowerCase(),width:(n=t.width)!==null&&n!==void 0?n:k2,order:(i=t.order)!==null&&i!==void 0?i:r,...t.relatedEntity?{relatedEntity:t.relatedEntity}:{}}})}function x2(e){return!!e&&(e.c.length>0||e.a.length>0)}function L2(e,t,r){let n={n:t,a:(0,fm.mergeAttrs)(e.a,[]),c:(0,fm.spliceChildren)(e.c,[])};return(0,fm.rebuildRaw)(n,(0,li.domEngine)(r),null)}function N8(e,t,r,n){var i;let a=t.getElementsByTagName("entity")[0];if(!a)return;let o=new Set(r.map(u=>{var c;return`${(c=u.relatedEntity)!==null&&c!==void 0?c:""}:${u.name}`}));for(let u of n)o.has(`${(i=u.relatedEntity)!==null&&i!==void 0?i:""}:${u.name}`)||D8(a,u);let s=B2(t),l=new Set(zt(a,"attribute").map(u=>u.getAttribute("name")).filter(u=>!!u));for(let u of[...r].sort((c,d)=>c.order-d.order))if(u.relatedEntity){if(s.get(u.name)===u.relatedEntity)continue;let c=I8(e,a,u.relatedEntity),d=e.createElement("attribute");d.setAttribute("name",u.name),c.appendChild(d),s.set(u.name,u.relatedEntity)}else{if(l.has(u.name))continue;let c=e.createElement("attribute");c.setAttribute("name",u.name),_8(a,c),l.add(u.name)}}function D8(e,t){var r;if(t.relatedEntity){for(let n of zt(e,"link-entity"))if(n.getAttribute("name")===t.relatedEntity){for(let i of zt(n,"attribute"))if(((r=i.getAttribute("alias"))!==null&&r!==void 0?r:i.getAttribute("name"))===t.name){n.removeChild(i);return}}return}for(let n of zt(e,"attribute"))if(n.getAttribute("name")===t.name){e.removeChild(n);return}}function I8(e,t,r){for(let i of zt(t,"link-entity"))if(i.getAttribute("name")===r)return i;let n=e.createElement("link-entity");return n.setAttribute("name",r),t.appendChild(n),n}function _8(e,t){let r=e.childNodes;for(let n=0;n<r.length;n+=1){let i=r[n];if(i.nodeType===1&&i.tagName!=="attribute"){e.insertBefore(t,i);return}}e.appendChild(t)}function P8(e,t,r){let n=t.getElementsByTagName("row")[0];if(!n)return;let i=[...r].sort((s,l)=>s.order-l.order),a=T8(n);if(O8(a,i)){for(let s=0;s<i.length;s+=1){let l=String(i[s].width);a[s].getAttribute("width")!==l&&a[s].setAttribute("width",l)}return}let o=new Map;for(let s of a){let l=s.getAttribute("name");l&&o.set(l,s),n.removeChild(s)}for(let s of i){let l=o.get(s.name);l||(l=e.createElement("cell"),l.setAttribute("name",s.name)),l.setAttribute("width",String(s.width)),n.appendChild(l)}}function T8(e){return zt(e,"cell").filter(t=>!!t.getAttribute("name")&&t.getAttribute("ishidden")!=="1")}function O8(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r+=1)if(e[r].getAttribute("name")!==t[r].name)return!1;return!0}function R8(e,t,r){let n=t.getElementsByTagName("entity")[0];if(n){for(let i of zt(n,"order"))n.removeChild(i);for(let i of r){let a=e.createElement("order");a.setAttribute("attribute",i.attribute),a.setAttribute("descending",String(i.descending)),n.appendChild(a)}}}function F8(e,t,r){let n=t.getElementsByTagName("entity")[0];if(n){for(let i of zt(n,"filter"))V2(i)||n.removeChild(i);(r.conditions.length>0||r.groups.length>0)&&n.appendChild(gm(e,r))}}function hm(e,t){return JSON.stringify(e)===JSON.stringify(t)}function x8(e){let t=new DOMParser().parseFromString("<fetch/>","text/xml"),r=t.documentElement;r.setAttribute("version","1.0"),r.setAttribute("mapping","logical");let n=t.createElement("entity");n.setAttribute("name",e.entityLogicalName),r.appendChild(n);let i=new Map;for(let a of[...e.columns].sort((o,s)=>o.order-s.order)){let o=t.createElement("attribute");if(o.setAttribute("name",a.name),a.relatedEntity){let s=i.get(a.relatedEntity);s||(s=t.createElement("link-entity"),s.setAttribute("name",a.relatedEntity),n.appendChild(s),i.set(a.relatedEntity,s)),s.appendChild(o)}else n.appendChild(o)}for(let a of e.sort){let o=t.createElement("order");o.setAttribute("attribute",a.attribute),o.setAttribute("descending",String(a.descending)),n.appendChild(o)}return(e.filters.conditions.length>0||e.filters.groups.length>0)&&n.appendChild(gm(t,e.filters)),new XMLSerializer().serializeToString(t)}function gm(e,t){let r=e.createElement("filter");r.setAttribute("type",t.type);for(let n of t.conditions){let i=e.createElement("condition");i.setAttribute("attribute",n.attribute),i.setAttribute("operator",n.operator),n.value!==void 0&&i.setAttribute("value",n.value),r.appendChild(i)}for(let n of t.groups)r.appendChild(gm(e,n));return r}function L8(e,t){var r;let n=new DOMParser().parseFromString("<grid/>","text/xml"),i=n.documentElement,a=[...e.columns].sort((s,l)=>s.order-l.order);i.setAttribute("name","resultset"),i.setAttribute("jump",((r=a[0])===null||r===void 0?void 0:r.name)||t||`${e.entityLogicalName}id`),i.setAttribute("select","1"),i.setAttribute("icon","1"),i.setAttribute("preview","1");let o=n.createElement("row");o.setAttribute("name","result"),o.setAttribute("id",t||`${e.entityLogicalName}id`),i.appendChild(o);for(let s of a){let l=n.createElement("cell");l.setAttribute("name",s.name),l.setAttribute("width",String(s.width)),o.appendChild(l)}return new XMLSerializer().serializeToString(n)}function k8(){return{adapter:new Au,api:A8.viewApi,publish:(e,t,r)=>(0,R2.publishBoundEntity)(e,r),publishScope:(e,t)=>(0,R2.boundEntityPublishScope)(t)}}wa.viewRegistration=k8});var nI=g(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.appRegistration=Tn.AppAdapter=Tn.HEADER_NAV_BOOLEAN_RULE=void 0;var Xr=cr(),Je=mn(),rs=Gn(),M8=Yt(),U8=sl(),vm=rl(),ym=In(),B8=bt(),$8=ee(),Y2=Ni(),q8=ie(),Z2=il();Object.defineProperty(Tn,"HEADER_NAV_BOOLEAN_RULE",{enumerable:!0,get:function(){return Z2.HEADER_NAV_BOOLEAN_RULE}});var Nu="7.0.0.0",W2=`<SiteMap IntroducedVersion="${Nu}"></SiteMap>`,j2="/_imgs/imagestrips/transparent_spacer.gif",H2="/_imgs/TableIconsFluentV9/document_one_page_sparkle.svg",V8=["Entity","Url","DefaultDashboard","Page","GenPageId"],ts="sitemapId",Q2="sitemapName",G8="sitemapNameUnique";function J2(e,t,r){if(e===void 0)return r;if(typeof e!="boolean")throw new q8.ValidationError("app",t,[eI(e)]);return e}function eI(e){return(0,Xr.issue)("/headerAndNavigationRefresh",Z2.HEADER_NAV_BOOLEAN_RULE,`headerAndNavigationRefresh must be a boolean, got ${typeof e}`)}function z8(e){let t=n=>{let i=e[n];return typeof i=="string"&&i.trim()!==""?i.trim():void 0},r=n=>{let i=t(n);if(i!==void 0)try{return(0,$8.normalizeGuid)(i,n)}catch{return}};switch(e.type){case"Entity":return t("entity")&&`Entity:${t("entity").toLowerCase()}`;case"URL":return t("url")&&`URL:${t("url").toLowerCase()}`;case"DashBoard":return r("dashboardId")&&`DashBoard:${r("dashboardId")}`;case"CustomPage":return t("page")&&`CustomPage:${t("page").toLowerCase()}`;case"GenPage":return r("genPageId")&&`GenPage:${r("genPageId")}`;default:return}}var Du=class{constructor(t=Y2.DEFAULT_LCID){this.lcid=t}toArtifact(t){let{bag:r,modeledEls:n}=Cu(t,"Area");return{id:"",name:"",uniqueName:"",description:"",siteMap:{areas:n.map(i=>this.areaToJson(i)),bag:r},bag:(0,Je.emptyBag)()}}fromArtifact(t){(0,ym.installDomShim)();let r=this.assignMissingIds(JSON.parse(JSON.stringify(t))),n=new DOMParser().parseFromString("<root/>","text/xml"),i=this.rootToRaw(r);return(0,Je.rebuildRaw)(i,(0,rs.domEngine)(n),null)}fromApiResponse(t){var r,n,i,a,o,s,l,u,c,d;(0,ym.installDomShim)();let p=t??{},f=(r=p.$sitemap)!==null&&r!==void 0?r:p,h=(0,rs.parseXmlRoot)((n=f.sitemapxml)!==null&&n!==void 0?n:W2,W2),y=this.toArtifact(h);return y.id=(i=p.appmoduleid)!==null&&i!==void 0?i:"",y.name=(a=p.name)!==null&&a!==void 0?a:"",y.uniqueName=(o=p.uniquename)!==null&&o!==void 0?o:"",y.description=(s=p.description)!==null&&s!==void 0?s:"",y.bag={a:[[ts,(u=(l=f.sitemapid)!==null&&l!==void 0?l:p._sitemapid_value)!==null&&u!==void 0?u:""],[Q2,(c=f.sitemapname)!==null&&c!==void 0?c:""],[G8,(d=f.sitemapnameunique)!==null&&d!==void 0?d:""]],c:[]},y}toApiPayload(t){var r,n,i,a,o,s,l,u,c,d,p,f,h,y,w;(0,ym.installDomShim)();let N=(0,rs.serializeNode)(this.fromArtifact(t)),D=[],x=[];for(let X of(n=(r=t.siteMap)===null||r===void 0?void 0:r.areas)!==null&&n!==void 0?n:[])for(let V of(i=X.groups)!==null&&i!==void 0?i:[])for(let M of(a=V.subAreas)!==null&&a!==void 0?a:[])M.type==="Entity"&&M.entity?D.push(M.entity):M.type==="DashBoard"&&M.dashboardId&&x.push(M.dashboardId);let F=(o=t.bag)!==null&&o!==void 0?o:(0,Je.emptyBag)();return{sitemapId:(s=K2(F,ts))!==null&&s!==void 0?s:"",sitemapxml:N,sitemapname:K2(F,Q2)||t.name,appModuleId:t.id,appModuleName:t.name,appModuleDescription:t.description,appModuleUniqueName:t.uniqueName,...t.iconWebResourceId?{iconWebResourceId:t.iconWebResourceId}:{},...t.headerAndNavigationRefresh===void 0?{}:{appSettings:{[vm.HEADER_AND_NAVIGATION_REFRESH]:J2(t.headerAndNavigationRefresh,(l=t.id)!==null&&l!==void 0?l:"(unknown)",!0)?vm.APP_SETTING_ON:vm.APP_SETTING_OFF}},...typeof t.published=="boolean"?{published:t.published}:{},entities:D,components:{forms:(c=(u=t.components)===null||u===void 0?void 0:u.forms)!==null&&c!==void 0?c:[],views:(p=(d=t.components)===null||d===void 0?void 0:d.views)!==null&&p!==void 0?p:[],charts:(h=(f=t.components)===null||f===void 0?void 0:f.charts)!==null&&h!==void 0?h:[],dashboards:[...(w=(y=t.components)===null||y===void 0?void 0:y.dashboards)!==null&&w!==void 0?w:[],...x]}}}createDefault(t){var r,n,i,a,o,s;let l=!((r=t.siteMap)===null||r===void 0)&&r.areas&&t.siteMap.areas.length>0?t.siteMap.areas:[{id:"",title:"Area",groups:[{id:"",title:"Group",subAreas:[]}]}];return{id:(n=t.id)!==null&&n!==void 0?n:(0,B8.newId)(),name:(i=t.name)!==null&&i!==void 0?i:"New App",uniqueName:(a=t.uniqueName)!==null&&a!==void 0?a:"",description:(o=t.description)!==null&&o!==void 0?o:"",siteMap:{areas:l},...t.iconWebResourceId?{iconWebResourceId:t.iconWebResourceId}:{},headerAndNavigationRefresh:J2(t.headerAndNavigationRefresh,(s=t.id)!==null&&s!==void 0?s:"(new)",!0),...typeof t.published=="boolean"?{published:t.published}:{},...t.components?{components:t.components}:{}}}assignMissingIds(t){let r=t;if(!r||typeof r!="object")return t;let n=r.siteMap;return n&&Array.isArray(n.areas)?n.areas.forEach(Am):Array.isArray(r.areas)?r.areas.forEach(Am):Array.isArray(r.groups)?Am(r):Array.isArray(r.subAreas)?rI(r):"type"in r&&Iu(r,"subarea"),t}validate(t){let r=[],n=t.published;n!==void 0&&typeof n!="boolean"&&r.push((0,Xr.issue)("/published","published-must-be-boolean",`published must be a boolean, got ${typeof n}`));let i=t.siteMap,a=t.headerAndNavigationRefresh;if(a!==void 0&&typeof a!="boolean"&&r.push(eI(a)),i==null)return r;if(!(0,Xr.isJsonObject)(i))return r.push((0,Xr.issue)("/siteMap","sitemap-must-be-object",`siteMap must be a JSON object, got ${typeof i}`)),r;let o=(0,Xr.childObjects)(i,"areas","/siteMap","area",r),s=new Map;return o.forEach(({node:l,index:u})=>{let c=`/siteMap/areas/${u}`;(0,Xr.childObjects)(l,"groups",c,"group",r).forEach(({node:p,index:f})=>{let h=`${c}/groups/${f}`;(0,Xr.childObjects)(p,"subAreas",h,"subArea",r).forEach(({node:w,index:N})=>{let D=`${h}/subAreas/${N}`;(0,Xr.optionalEnum)(w,"type",["Entity","URL","DashBoard","CustomPage","GenPage"],D,"subarea-type-invalid",r);let x=z8(w);if(!x)return;let F=s.get(x);if(F===void 0){s.set(x,D);return}r.push((0,Xr.issue)(D,"subarea-duplicate-target",`the sitemap already navigates to this target at ${F}; a duplicate SubArea would pin it twice and a single removeElement would leave one behind`))})})}),r}applyServerIdentity(t,r){let n=r[ts];if(!n)return;t.bag||(t.bag=(0,Je.emptyBag)());let i=t.bag.a.find(a=>a[0]===ts);i?i[1]=n:t.bag.a.push([ts,n])}areaToJson(t){var r;let{bag:n,modeledEls:i}=Cu(t,"Group"),a={id:(r=t.getAttribute("Id"))!==null&&r!==void 0?r:"",title:bm(t,this.lcid),groups:i.map(l=>this.groupToJson(l)),bag:n},o=t.getAttribute("Icon");o&&(a.icon=o);let s=t.getAttribute("VectorIcon");return s&&(a.vectorIcon=s),a}groupToJson(t){var r;let{bag:n,modeledEls:i}=Cu(t,"SubArea");return{id:(r=t.getAttribute("Id"))!==null&&r!==void 0?r:"",title:bm(t,this.lcid),subAreas:i.map(a=>this.subAreaToJson(a)),bag:n}}subAreaToJson(t){var r;let{bag:n}=Cu(t,null),i=W8(t),a={id:(r=t.getAttribute("Id"))!==null&&r!==void 0?r:"",type:i,title:bm(t,this.lcid),bag:n};if(i==="Entity"){let l=t.getAttribute("Entity");l&&(a.entity=l)}else if(i==="DashBoard"){let l=t.getAttribute("DefaultDashboard");l&&(a.dashboardId=l);let u=t.getAttribute("Url");u&&(a.dashboardUrl=u)}else if(i==="CustomPage"){let l=t.getAttribute("Page");l&&(a.page=l)}else if(i==="GenPage"){let l=t.getAttribute("GenPageId");l&&(a.genPageId=l)}else{let l=t.getAttribute("Url");l&&(a.url=l)}let o=t.getAttribute("Icon");o&&o!==j2&&(a.icon=o);let s=t.getAttribute("VectorIcon");return s&&(a.vectorIcon=s),a}rootToRaw(t){var r,n,i,a;let o=(n=(r=t.siteMap)===null||r===void 0?void 0:r.bag)!==null&&n!==void 0?n:(0,Je.emptyBag)(),l=Su(o)?[["IntroducedVersion",Nu]]:[],u=((a=(i=t.siteMap)===null||i===void 0?void 0:i.areas)!==null&&a!==void 0?a:[]).map(c=>this.areaToRaw(c));return{n:"SiteMap",a:(0,Je.mergeAttrs)(o.a,l),c:(0,Je.spliceChildren)(o.c,u)}}areaToRaw(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:(0,Je.emptyBag)(),i=Su(n),a=[],o=[];t.id&&a.push(["Id",t.id]),i&&a.push(["ShowGroups","true"],["ResourceId","SitemapDesigner.NewTitle"],["DescriptionResourceId","SitemapDesigner.NewTitle"],["IntroducedVersion",Nu]),t.icon!==void 0?a.push(["Icon",t.icon]):Eu(n.a,"Icon")&&o.push("Icon"),t.vectorIcon!==void 0?a.push(["VectorIcon",t.vectorIcon]):Eu(n.a,"VectorIcon")&&o.push("VectorIcon");let s=t.groups.map(u=>this.groupToRaw(u)),l=wm((0,Je.spliceChildren)(n.c,s),t.title,i,this.lcid);return{n:"Area",a:(0,Je.mergeAttrs)(n.a,a,o),c:l}}groupToRaw(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:(0,Je.emptyBag)(),i=Su(n),a=[];t.id&&a.push(["Id",t.id]),i&&a.push(["ResourceId","SitemapDesigner.NewGroup"],["DescriptionResourceId","SitemapDesigner.NewGroup"],["ToolTipResourseId","SitemapDesigner.Unknown"],["IntroducedVersion",Nu],["IsProfile","false"]);let o=t.subAreas.map(l=>this.subAreaToRaw(l)),s=wm((0,Je.spliceChildren)(n.c,o),t.title,i,this.lcid);return{n:"Group",a:(0,Je.mergeAttrs)(n.a,a),c:s}}subAreaToRaw(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:(0,Je.emptyBag)(),i=Su(n),a=H8(n.a,t.type),o=[],s=[];t.id&&o.push(["Id",t.id]),J8(o,t),i?(o.push(["ResourceId","SitemapDesigner.NewSubArea"],["Client","All,Outlook,OutlookLaptopClient,OutlookWorkstationClient,Web"],["Sku","All,OnPremise,Live,SPLA"],["AvailableOffline","true"],["PassParams","false"]),t.icon&&o.push(["Icon",t.icon])):t.icon!==void 0?o.push(["Icon",t.icon]):Eu(a,"Icon",j2)&&s.push("Icon"),t.vectorIcon!==void 0?o.push(["VectorIcon",t.vectorIcon]):Eu(a,"VectorIcon")?t.type==="GenPage"?o.push(["VectorIcon",H2]):s.push("VectorIcon"):t.type==="GenPage"&&!j8(a,"VectorIcon")&&o.push(["VectorIcon",H2]);let l=wm((0,Je.spliceChildren)(n.c,[]),t.title,i,this.lcid);return{n:"SubArea",a:(0,Je.mergeAttrs)(a,o,s),c:l}}};Tn.AppAdapter=Du;function Cu(e,t){let r=(0,rs.nodeLikeFromDom)(e).getAllProperties().map(s=>[s.key,s.value]),n=[],i=[],a=e.childNodes,o=0;for(let s=0;s<a.length;s+=1){let l=a[s];l.nodeType!==1&&l.nodeType!==3||(l.nodeType===1&&t!==null&&l.tagName===t?i.push(l):n.push({i:o,node:(0,Je.rawFromNode)((0,rs.nodeLikeFromDom)(l))}),o+=1)}return{bag:{a:r,c:n},modeledEls:i}}function X2(e,t){let r=[],n=e.childNodes;for(let i=0;i<n.length;i+=1){let a=n[i];a.nodeType===1&&a.tagName===t&&r.push(a)}return r}function bm(e,t){var r;let n=X2(e,"Titles")[0];if(!n)return"";let a=X2(n,"Title").find(o=>o.getAttribute("LCID")===String(t));return a&&(r=a.getAttribute("Title"))!==null&&r!==void 0?r:""}function W8(e){return e.getAttribute("GenPageId")?"GenPage":e.getAttribute("Entity")?"Entity":e.getAttribute("Page")?"CustomPage":e.getAttribute("DefaultDashboard")?"DashBoard":"URL"}function Su(e){return e.a.length===0&&e.c.length===0}function j8(e,t){return e.some(([r])=>r===t)}function Eu(e,t,r){let n=e.find(([a])=>a===t),i=n?.[1];return!!i&&i!==r}function K2(e,t){let r=e.a.find(([n])=>n===t);return r?r[1]:void 0}function H8(e,t){let r=Q8(t);return e.filter(([n])=>!V8.includes(n)||r.has(n)).map(n=>[n[0],n[1]])}function Q8(e){switch(e){case"Entity":return new Set(["Entity"]);case"URL":return new Set(["Url"]);case"DashBoard":return new Set(["DefaultDashboard","Url"]);case"CustomPage":return new Set(["Page"]);case"GenPage":return new Set(["GenPageId"]);default:return new Set}}function J8(e,t){var r,n,i,a,o;switch(t.type){case"Entity":e.push(["Entity",(r=t.entity)!==null&&r!==void 0?r:""]);break;case"URL":e.push(["Url",(n=t.url)!==null&&n!==void 0?n:""]);break;case"DashBoard":e.push(["DefaultDashboard",(i=t.dashboardId)!==null&&i!==void 0?i:""]),t.dashboardUrl!==void 0&&e.push(["Url",t.dashboardUrl]);break;case"CustomPage":e.push(["Page",(a=t.page)!==null&&a!==void 0?a:""]);break;case"GenPage":e.push(["GenPageId",(o=t.genPageId)!==null&&o!==void 0?o:""]);break;default:break}}function wm(e,t,r,n){if(!t)return e;let i=e.findIndex(a=>a.n==="Titles");if(i>=0){let a=e.slice();return a[i]=X8(e[i],t,n),a}return r?[K8(t,n),...e]:e}function X8(e,t,r){let n=!1,i=e.c.map(a=>!n&&a.n==="Title"&&Y8(a,"LCID")===String(r)?(n=!0,{n:a.n,a:(0,Je.mergeAttrs)(a.a,[["Title",t]]),c:a.c}):a);return n||i.unshift(tI(t,r)),{n:e.n,a:e.a.map(a=>[a[0],a[1]]),c:i}}function K8(e,t){return{n:"Titles",a:[],c:[tI(e,t)]}}function tI(e,t){return{n:"Title",a:[["LCID",String(t)],["Title",e]],c:[]}}function Y8(e,t){let r=e.a.find(([n])=>n===t);return r?r[1]:void 0}function Z8(e){let t="0123456789abcdef",r="";for(let n=0;n<e;n+=1)r+=t[Math.floor(Math.random()*t.length)];return r}function Iu(e,t){e&&(typeof e.id!="string"||e.id.length===0)&&(e.id=`${t}_${Z8(8)}`)}function Am(e){var t;Iu(e,"area");for(let r of(t=e.groups)!==null&&t!==void 0?t:[])rI(r)}function rI(e){var t;Iu(e,"group");for(let r of(t=e.subAreas)!==null&&t!==void 0?t:[])Iu(r,"subarea")}function e6(e=Y2.DEFAULT_LCID){return{adapter:new Du(e),api:U8.appApi,languageSensitive:!0,publish:(t,r)=>(0,M8.publishAppModule)(t,r),publishScope:t=>({envelope:"appmodule",targetIds:[t]})}}Tn.appRegistration=e6});var iI={};Rr(iI,{ActionType:()=>Sm,AppActionOrigin:()=>Om,AppActionVisibilityType:()=>Tm,ButtonType:()=>Nm,CannotUpdateAppActionColumns:()=>t6,Context:()=>Im,IconType:()=>Em,Location:()=>Dm,OnClickEventType:()=>Pm,Scope:()=>_m,VisibilityType:()=>Cm});var Cm,Sm,Em,Nm,Dm,Im,_m,Pm,Tm,Om,t6,aI=I(()=>{"use strict";(function(e){e[e.NotSupported=0]="NotSupported",e[e.Show=1]="Show",e[e.ClassicRules=2]="ClassicRules",e[e.Expression=3]="Expression"})(Cm||(Cm={}));(function(e){e[e.NotSupported=0]="NotSupported",e[e.None=1]="None",e[e.JavaScript=2]="JavaScript",e[e.Expression=3]="Expression"})(Sm||(Sm={}));(function(e){e[e.NoIcon=0]="NoIcon",e[e.UseIcon=1]="UseIcon",e[e.UseWebResource=2]="UseWebResource"})(Em||(Em={}));(function(e){e[e.Standard=0]="Standard",e[e.Dropdown=1]="Dropdown",e[e.Split=2]="Split",e[e.Group=3]="Group"})(Nm||(Nm={}));(function(e){e[e.Form=0]="Form",e[e.HomePageGrid=1]="HomePageGrid",e[e.SubGridStandard=2]="SubGridStandard",e[e.SubGridAssociated=3]="SubGridAssociated",e[e.QuickForm=4]="QuickForm",e[e.Global=5]="Global",e[e.Dashboard=6]="Dashboard"})(Dm||(Dm={}));(function(e){e[e.All=0]="All",e[e.Entity=1]="Entity"})(Im||(Im={}));(function(e){e[e.App=0]="App",e[e.Entity=1]="Entity",e[e.Global=2]="Global"})(_m||(_m={}));(function(e){e[e.None=0]="None",e[e.Formula=1]="Formula",e[e.JavaScript=2]="JavaScript"})(Pm||(Pm={}));(function(e){e[e.None=0]="None",e[e.Formula=1]="Formula",e[e.ClassicRules=2]="ClassicRules"})(Tm||(Tm={}));(function(e){e[e.Default=0]="Default",e[e.Migrated=1]="Migrated",e[e.MigratedClone=2]="MigratedClone"})(Om||(Om={}));t6=["appactionid","appmoduleid","context","contextvalue","location","name","type","uniquename","isdisabled","origin"]});var sI=g(_u=>{"use strict";Object.defineProperty(_u,"__esModule",{value:!0});_u.commandApi=void 0;var Rt=be(),r6=ie(),Wt=ee(),n6="OnClickEventJavaScriptWebResourceId($select=name,webresourceid),IconWebResourceId($select=name,webresourceid)";async function Rm(e,t){let r=`/EntityDefinitions(LogicalName='${(0,Wt.odataLiteral)(t)}')${(0,Wt.odataQuery)([["$select","MetadataId"]])}`,i=(0,Rt.ensureSuccess)(await e.get(r),e.apiUrl(r)).body,a=i?.MetadataId;return a?(0,Wt.normalizeGuid)(a,"entityMetadataId"):""}_u.commandApi={async get(e,t){var r;let n=t,i=await Rm(e,n),a=i?`_contextentity_value eq ${i}`:`contextvalue eq '${(0,Wt.odataLiteral)(n)}'`,o=`/appactions${(0,Wt.odataQuery)([["$expand",n6],["$filter",a]])}`,s=(0,Rt.ensureSuccess)(await e.get(o),e.apiUrl(o)),l=s.body,u=(r=l?.value)!==null&&r!==void 0?r:[],c={entityLogicalName:n,entityMetadataId:i,appActions:u},d={};for(let p of u){let f=typeof p.appactionid=="string"?p.appactionid:void 0;if(f){let h=p["@odata.etag"];d[(0,Wt.normalizeGuid)(f,"appactionid")]=typeof h=="string"?h:null}}return{raw:c,etag:(0,Rt.readEtag)(s),memberEtags:d}},async list(e,t){let r=t?.entityLogicalName;return r?[{type:"command",id:r,name:`${r} commands`,entityLogicalName:r,isDirty:!1}]:[]},async create(e,t){let r=t,n=r.entityMetadataId||await Rm(e,r.entityLogicalName);return oI(e,{...r,entityMetadataId:n},!1)},async update(e,t,r,n,i){return oI(e,r,!0,i)},async delete(e,t){var r,n;let i=await Rm(e,t),a=i?`_contextentity_value eq ${i}`:`contextvalue eq '${(0,Wt.odataLiteral)(t)}'`,o=`/appactions${(0,Wt.odataQuery)([["$select","appactionid"],["$filter",a]])}`,l=(n=(r=(0,Rt.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[];for(let u of l)u.appactionid&&await(0,Rt.deleteRecord)(e,"appactions",u.appactionid)}};async function oI(e,t,r,n){let i=t.entityMetadataId?(0,Wt.normalizeGuid)(t.entityMetadataId,"entityMetadataId"):"",a=a6(t.rows),o={};try{await i6(e,t,a,i,r,n,o)}catch(s){throw(0,r6.withPartialTokens)(s,{memberEtags:o})}return{id:t.entityLogicalName,etag:null,memberEtags:o}}async function i6(e,t,r,n,i,a,o){var s,l,u;for(let c of r)if(i&&c.exists){let d=(0,Wt.normalizeGuid)(c.appactionid,"id"),p=(s=a?.[d])!==null&&s!==void 0?s:c.etag,f=(0,Rt.echoWrite)("appactionid",p?{"If-Match":p}:void 0),h=`/appactions(${d})${f.query}`,y=(0,Rt.ensureSuccess)(await e.patch(h,c.body,f.options),e.apiUrl(h));o[d]=(0,Rt.readEtag)(y)}else{let d=(0,Rt.echoWrite)("appactionid"),p=`/appactions${d.query}`,f={...c.body};n&&f["[email protected]"]===void 0&&(f["[email protected]"]=`/entities(${n})`);let h=(0,Rt.ensureSuccess)(await e.post(p,f,d.options),e.apiUrl(p)),y=(0,Rt.readCreatedId)(h,"appactionid");y&&(o[(0,Wt.normalizeGuid)(y,"appactionid")]=(0,Rt.readEtag)(h))}for(let c of[...(l=t.deletedRowIds)!==null&&l!==void 0?l:[]].reverse()){let d=(0,Wt.normalizeGuid)(c,"id");await(0,Rt.deleteRecord)(e,"appactions",d,(u=a?.[d])!==null&&u!==void 0?u:void 0),delete o[d]}}function a6(e){let t=new Map(e.map(a=>[a.appactionid,a])),r=new Set,n=[],i=a=>{if(r.has(a.appactionid))return;let o=a.body["[email protected]"];if(typeof o=="string"){let s=/\(([^)]+)\)/.exec(o),l=s?t.get(s[1]):void 0;l&&i(l)}r.add(a.appactionid),n.push(a)};return e.forEach(i),n}});var CI=g(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});Aa.commandRegistration=Aa.CommandAdapter=void 0;var Ve=(aI(),Fr(iI)),lI=Yt(),jt=cr(),o6=sI(),cI=bt(),Ca=ee(),xm="$ClientSvg:",Lm=".svg",s6=2,l6=1,u6=1,dI="entityMetadataId",c6=new Set(["@odata.etag","IconWebResourceId","OnClickEventJavaScriptWebResourceId","VisibilityFormulaComponentLibraryId","OnClickEventFormulaComponentLibraryId","ContextEntity","_appmoduleid_value","_contextentity_value","_createdby_value","_createdonbehalfby_value","_iconwebresourceid_value","_modifiedby_value","_modifiedonbehalfby_value","_onclickeventformulacomponentlibraryid_value","_onclickeventjavascriptwebresourceid_value","_organizationid_value","_parentappactionid_value","_visibilityformulacomponentlibraryid_value","createdon","modifiedon","overriddencreatedon","overwritetime","componentstate","componentidunique","solutionid","ismanaged","iscustomizable","versionnumber","importsequencenumber","timezoneruleversionnumber","utcconversiontimezonecode","statecode","statuscode","scope"]),Pu=class{toArtifact(t){var r,n,i,a,o,s;let l=(r=t.appActions)!==null&&r!==void 0?r:[],u=(n=t.entityLogicalName)!==null&&n!==void 0?n:"",c=new Map;for(let f of l){let h=typeof f._parentappactionid_value=="string"&&f._parentappactionid_value?f._parentappactionid_value:"",y=(i=c.get(h))!==null&&i!==void 0?i:[];y.push(f),c.set(h,y)}let d=new Map;for(let f of(a=c.get(""))!==null&&a!==void 0?a:[]){let h=h6(f.location),y=(o=d.get(h))!==null&&o!==void 0?o:[];y.push(f),d.set(h,y)}let p=[];for(let[f,h]of d)p.push({location:f,groups:p6(h,c,gI(f),u)});return{id:u,entityLogicalName:u,commandBars:m6(p),bag:{a:[[dI,(s=t.entityMetadataId)!==null&&s!==void 0?s:""]]}}}fromArtifact(t){return{entityLogicalName:t.entityLogicalName,entityMetadataId:Mm(t),appActions:Fm(t).map(r=>r.row)}}fromApiResponse(t){return this.toArtifact(t??{})}toApiPayload(t,r){let n=new Set(r?Fm(r).map(l=>l.appactionid):[]),i=Fm(t,new Set([...n].map(l=>l.toLowerCase()))),a=new Set(i.map(l=>l.appactionid)),o=i.map(l=>{let u=l.exists||n.has(l.appactionid);return{appactionid:l.appactionid,exists:u,etag:l.etag,body:u?I6(l.row):AI(l.row)}}),s=[...n].filter(l=>!a.has(l));return{entityLogicalName:t.entityLogicalName,entityMetadataId:Mm(t),rows:o,...s.length>0?{deletedRowIds:s}:{}}}createDefault(t){var r,n,i,a;let o=(n=(r=t.entityLogicalName)!==null&&r!==void 0?r:t.id)!==null&&n!==void 0?n:"";return{id:(i=t.id)!==null&&i!==void 0?i:o,entityLogicalName:o,commandBars:(a=t.commandBars)!==null&&a!==void 0?a:[]}}assignMissingIds(t){return(0,cI.assignMissingIds)(t)}validate(t){let r=[];return(0,jt.childObjects)(t,"commandBars","","commandBar",r).forEach(({node:i,index:a})=>{let o=`/commandBars/${a}`;(0,jt.optionalEnum)(i,"location",["MainTab","ContextualTab","HomeTab"],o,"bar-location-invalid",r),(0,jt.childObjects)(i,"groups",o,"group",r).forEach(({node:l,index:u})=>{let c=`${o}/groups/${u}`;(0,jt.optionalGuidId)(l,"id",c,"group-id-invalid",r),pI((0,jt.childObjects)(l,"controls",c,"control",r),`${c}/controls`,r)})}),r}};Aa.CommandAdapter=Pu;function pI(e,t,r){e.forEach(({node:n,index:i})=>{let a=`${t}/${i}`;(0,jt.optionalGuidId)(n,"id",a,"control-id-invalid",r),(0,jt.optionalEnum)(n,"type",["Button","FlyoutAnchor","SplitButton"],a,"control-type-invalid",r);let o=n.location;o!==void 0&&(typeof o!="number"||!Number.isInteger(o)||o<0||o>6)&&r.push((0,jt.issue)(`${a}/location`,"control-location-invalid",`location must be an integer 0-6 when present, got ${JSON.stringify(o)}`)),n.action!==void 0&&n.action!==null&&((0,jt.isJsonObject)(n.action)?(0,jt.optionalEnum)(n.action,"type",["javascript"],`${a}/action`,"action-type-invalid",r):r.push((0,jt.issue)(`${a}/action`,"control-action-must-be-object",`a control action must be a JSON object when present, got ${typeof n.action}`)));let s=(0,jt.childObjects)(n,"children",a,"control",r);s.length>0&&pI(s,`${a}/children`,r)})}function fI(e){return{a:Object.entries(e)}}function d6(e){return Object.fromEntries(e.a)}function km(e,t){if(e){for(let[r,n]of e.a)if(r===t)return n}}function Mm(e){let t=km(e.bag,dI);return typeof t=="string"?t:""}function p6(e,t,r,n){var i,a;let o=[],s=[];for(let l of Ou(e))l.type===Ve.ButtonType.Group?o.push({id:hI(l.name,n),title:typeof l.grouptitle=="string"?l.grouptitle:"",controls:Ou((a=t.get((i=l.appactionid)!==null&&i!==void 0?i:""))!==null&&a!==void 0?a:[]).map(u=>Tu(u,t,r,n)),bag:fI(l)}):s.push(Tu(l,t,r,n));return s.length>0&&o.unshift({id:(0,cI.newId)(),title:"",controls:s}),o}function Tu(e,t,r,n){var i,a,o,s;let l=hI(e.name,n),u={id:l,type:g6(e.type),label:typeof e.buttonlabeltext=="string"?e.buttonlabeltext:"",command:typeof e.appactionid=="string"?e.appactionid:l,bag:fI(e)},c=mI(e);c&&(u.icon=c);let d=f6(e);d&&(u.action=d),typeof e.hidden=="boolean"&&(u.hidden=e.hidden),typeof e.isdisabled=="boolean"&&(u.disabled=e.isdisabled),typeof e.location=="number"&&e.location!==r&&(u.location=e.location);let p=t.get((i=e.appactionid)!==null&&i!==void 0?i:"");if(p&&p.length>0){let f=[];for(let h of Ou(p))if(h.type===Ve.ButtonType.Group){u.flyoutGroupId=(a=h.appactionid)!==null&&a!==void 0?a:void 0;for(let y of Ou((s=t.get((o=h.appactionid)!==null&&o!==void 0?o:""))!==null&&s!==void 0?s:[]))f.push(Tu(y,t,r,n))}else f.push(Tu(h,t,r,n));u.children=f}return u}function mI(e){var t;if(!((t=e.IconWebResourceId)===null||t===void 0)&&t.name)return e.IconWebResourceId.name;if(e.fonticon)return e.fonticon.startsWith(xm)?e.fonticon.slice(xm.length)+Lm:e.fonticon}function f6(e){var t;let r=e.onclickeventjavascriptfunctionname;if(typeof r!="string"||!r)return;let n=e.OnClickEventJavaScriptWebResourceId,i=e._onclickeventjavascriptwebresourceid_value,a={type:"javascript",webResourceId:(t=typeof i=="string"?i:n?.webresourceid)!==null&&t!==void 0?t:"",functionName:r};n?.name&&(a.libraryName=n.name);let o=e.onclickeventjavascriptparameters;return typeof o=="string"&&o&&(a.parameters=o),a}function uI(e){return typeof e.sequence=="number"?e.sequence:typeof e.buttonsequencepriority=="number"?e.buttonsequencepriority:0}function Ou(e){return[...e].sort((t,r)=>uI(t)-uI(r))}function m6(e){let t={MainTab:0,ContextualTab:1,HomeTab:2};return[...e].sort((r,n)=>{var i,a;return((i=t[r.location])!==null&&i!==void 0?i:9)-((a=t[n.location])!==null&&a!==void 0?a:9)})}function hI(e,t){if(!e)return"";if(e.indexOf("{!EntityLogicalName}")>=0)return e.replace("{!EntityLogicalName}",t);let r=e.split("!");return r.length===2?r[1]:e}function h6(e){switch(e){case Ve.Location.Form:case Ve.Location.QuickForm:return"MainTab";case Ve.Location.HomePageGrid:case Ve.Location.Dashboard:return"HomeTab";default:return"ContextualTab"}}function gI(e){switch(e){case"MainTab":return Ve.Location.Form;case"HomeTab":return Ve.Location.HomePageGrid;default:return Ve.Location.SubGridStandard}}function g6(e){switch(e){case Ve.ButtonType.Dropdown:return"FlyoutAnchor";case Ve.ButtonType.Split:return"SplitButton";default:return"Button"}}function v6(e){switch(e){case"FlyoutAnchor":return Ve.ButtonType.Dropdown;case"SplitButton":return Ve.ButtonType.Split;default:return Ve.ButtonType.Standard}}function y6(e){var t;return e.bag&&e.bag.a.length>0?!0:((t=e.title)!==null&&t!==void 0?t:"").length>0}function vI(e,t){var r,n,i;return((n=(r=e.bag)===null||r===void 0?void 0:r.a.length)!==null&&n!==void 0?n:0)>0?!0:t.has(((i=e.id)!==null&&i!==void 0?i:"").toLowerCase())}function Fm(e,t=new Set){var r,n,i,a;let o=[],s=Mm(e);for(let l of(r=e.commandBars)!==null&&r!==void 0?r:[]){let u=gI(l.location),c=((n=l.groups)!==null&&n!==void 0?n:[]).flatMap(f=>{var h;return(h=f.controls)!==null&&h!==void 0?h:[]}),d=c.length>0&&c.every(f=>!vI(f,t)),p=0;for(let f of(i=l.groups)!==null&&i!==void 0?i:[]){let h;if(y6(f)){let y=w6(f,u,void 0,e,s);o.push(y),h=y.appactionid}for(let y of(a=f.controls)!==null&&a!==void 0?a:[])yI(y,u,h,e,s,o,d?p:void 0,t),p+=1}}return o}function yI(e,t,r,n,i,a,o,s=new Set){var l;let u=b6(e,t,r,n,i,o);a.push(u);let c=(l=e.children)!==null&&l!==void 0?l:[];if(c.length===0)return;let d=e.flyoutGroupId||D6(u.appactionid);a.push(A6(d,t,u.appactionid,n,i));let p=c.every(f=>!vI(f,s));for(let[f,h]of c.entries())yI(h,t,d,n,i,a,p?f:void 0,s)}function b6(e,t,r,n,i,a){let o=bI(e,t,r,n,i),s=o.row;a!==void 0&&typeof s.sequence!="number"&&(s.sequence=a);let l=mI(s);return e.location!==void 0&&(s.location=e.location),s.type=v6(e.type),s.buttonlabeltext=e.label,C6(s,e.icon,l),E6(s,e.action),S6(s),e.hidden!==void 0&&(s.hidden=e.hidden),e.disabled!==void 0&&(s.isdisabled=e.disabled),{...o,row:s}}function w6(e,t,r,n,i){let a=bI(e,t,r,n,i);return a.row.type=Ve.ButtonType.Group,a.row.grouptitle=e.title,a}function A6(e,t,r,n,i){let a=wI(e,t,n,i);return a["[email protected]"]=`/appactions(${(0,Ca.normalizeGuid)(r,"Command flyout group id")})`,a.type=Ve.ButtonType.Group,a.grouptitle===void 0&&(a.grouptitle=""),a.isgrouptitlehidden=!0,{appactionid:e,exists:!1,etag:null,row:a}}function bI(e,t,r,n,i){let a,o,s,l;if(e.bag&&e.bag.a.length>0){a=d6(e.bag),o=!0;let u=km(e.bag,"@odata.etag");s=typeof u=="string"?u:null;let c=km(e.bag,"appactionid");l=typeof c=="string"&&c?c:e.id}else l=e.id,a=wI(l,t,n,i),o=!1,s=null;return r&&(a["[email protected]"]=`/appactions(${(0,Ca.normalizeGuid)(r,"Command parent appaction id")})`),{appactionid:l,exists:o,etag:s,row:a}}function wI(e,t,r,n){let i={appactionid:e,name:`${e}!${e.replace(/-/g,"").slice(0,32)}`,uniquename:"",location:t,context:Ve.Context.Entity,contextvalue:r.entityLogicalName,scope:Ve.Scope.Entity};return n&&(i["[email protected]"]=`/entities(${(0,Ca.normalizeGuid)(n,"Command context entity metadata id")})`),i}function C6(e,t,r){if(t===r){let n=e._iconwebresourceid_value;typeof n=="string"&&n&&!e.fonticon&&(e["[email protected]"]=`/webresourceset(${(0,Ca.normalizeGuid)(n,"Command icon web resource id")})`);return}if(t===void 0){e.fonticon="",e.IconWebResourceId=null;return}e.fonticon=t.toLowerCase().endsWith(Lm)?xm+t.slice(0,t.length-Lm.length):t,e.IconWebResourceId=null}function S6(e){let t=(n,i)=>{let a=e[n];if(typeof a!="string"||a.length===0||e[`${i}@odata.bind`]!==void 0)return;let o=(0,Ca.normalizeGuid)(a,`Command ${i}`);e[`${i}@odata.bind`]=`/canvasapps(${o})`};e.onclickeventtype===l6&&t("_onclickeventformulacomponentlibraryid_value","OnClickEventFormulaComponentLibraryId");let r=e.visibilitytype;(!r||r===u6)&&t("_visibilityformulacomponentlibraryid_value","VisibilityFormulaComponentLibraryId")}function E6(e,t){if(!(!t||t.type!=="javascript")){if(e.onclickeventtype=s6,t.webResourceId){let r=(0,Ca.normalizeGuid)(t.webResourceId,"Command action web resource id");e["[email protected]"]=`/webresourceset(${r})`}e.onclickeventjavascriptfunctionname=t.functionName,t.parameters!==void 0&&(e.onclickeventjavascriptparameters=t.parameters)}}function N6(e){let t=2166136261;for(let r=0;r<e.length;r+=1)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return t>>>0}function D6(e){let t="";for(let r=0;r<4;r+=1)t+=N6(`${r}:flyout-group:${e}`).toString(16).padStart(8,"0");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20,32)}`}function AI(e){let t={...e};for(let r of c6)delete t[r];return t}function I6(e){let t=AI(e);for(let r of Ve.CannotUpdateAppActionColumns)delete t[r];return t}function _6(){return{adapter:new Pu,api:o6.commandApi,publish:(e,t,r)=>(0,lI.publishBoundEntity)(e,r),publishScope:(e,t)=>(0,lI.boundEntityPublishScope)(t)}}Aa.commandRegistration=_6});var SI=g(Ru=>{"use strict";Object.defineProperty(Ru,"__esModule",{value:!0});Ru.chartApi=void 0;var P6=Kt(),Ht=be(),ns=ee(),T6="savedqueryvisualizationid,name,description,primaryentitytypecode,datadescription,presentationdescription,charttype,type,isdefault",O6="savedqueryvisualizationid,name,primaryentitytypecode,charttype,isdefault";Ru.chartApi={async get(e,t){let n=`/savedqueryvisualizations(${(0,ns.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,ns.odataQuery)([["$select",T6]]),i=(0,Ht.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,Ht.readEtag)(i)}},async list(e,t){let r=`/savedqueryvisualizations${(0,ns.odataQuery)([["$select",O6],["$filter",t?.entityLogicalName?`primaryentitytypecode eq '${(0,ns.odataLiteral)(t.entityLogicalName)}'`:void 0]])}`;return(await(0,P6.collectPages)(e,r,"listArtifacts('chart')")).map(i=>{var a,o;return{type:"chart",id:(a=i.savedqueryvisualizationid)!==null&&a!==void 0?a:"",name:(o=i.name)!==null&&o!==void 0?o:"",entityLogicalName:i.primaryentitytypecode,isDirty:!1}})},async create(e,t,r){let n=t,i=(0,Ht.echoWrite)("savedqueryvisualizationid"),a=`/savedqueryvisualizations${i.query}`,o=(0,Ht.ensureSuccess)(await e.post(a,(0,Ht.withClientMintedId)({name:n.name,description:n.description,datadescription:n.datadescription,presentationdescription:n.presentationdescription,primaryentitytypecode:n.primaryentitytypecode,charttype:n.charttype,isdefault:n.isdefault},"savedqueryvisualizationid",r),i.options),e.apiUrl(a));return{id:(0,Ht.resolveCreatedId)(o,"savedqueryvisualizationid","chart",r),etag:(0,Ht.readEtag)(o)}},async update(e,t,r,n){let i=r,a=(0,ns.normalizeGuid)(t,"id"),o=(0,Ht.echoWrite)("savedqueryvisualizationid",{"If-Match":(0,Ht.requireEtag)(n,"chart",a)}),s=`/savedqueryvisualizations(${a})${o.query}`,l=(0,Ht.ensureSuccess)(await e.patch(s,{name:i.name,description:i.description,datadescription:i.datadescription,presentationdescription:i.presentationdescription},o.options),e.apiUrl(s));return{id:a,etag:(0,Ht.readEtag)(l)}},delete(e,t){return(0,Ht.deleteRecord)(e,"savedqueryvisualizations",t)}}});var BI=g(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});Sa.chartRegistration=Sa.ChartAdapter=void 0;var Um=mn(),EI=cr(),Kr=Gn(),NI=Yt(),R6=SI(),Bm=In(),F6=bt(),x6=["Column","StackedColumn","StackedColumn100","Bar","StackedBar","StackedBar100","Area","StackedArea","StackedArea100","Line","Pie","Doughnut","Funnel","Tag"],L6=new Map(x6.map(e=>[e.toLowerCase(),e]));function PI(e){var t;return e&&(t=L6.get(e.toLowerCase()))!==null&&t!==void 0?t:"Column"}function k6(){return'<Chart Palette="BrightPastel"><Series><Series ChartType="Column" ChartArea="Default" /></Series><ChartAreas><ChartArea Name="Default" /></ChartAreas><Legends><Legend Name="Default" /></Legends></Chart>'}function M6(e){var t,r;let n=e.entityLogicalName,i=e.series.map((u,c)=>({alias:`agg_${c}`,series:u})),a=e.categories.map((u,c)=>({alias:`grp_${c}`,category:u})),o=i.map(u=>`<attribute alias="${u.alias}" name="${is(u.series.attribute)}" aggregate="${is(u.series.aggregate)}" />`).join("")+a.map(u=>`<attribute alias="${u.alias}" name="${is(u.category.attribute)}" groupby="true"${u.category.dateGrouping?` dategrouping="${is(u.category.dateGrouping)}"`:""} />`).join(""),s=i.map(u=>`<measure alias="${u.alias}" />`).join(""),l=(r=(t=a[0])===null||t===void 0?void 0:t.alias)!==null&&r!==void 0?r:"";return`<datadefinition><fetchcollection><fetch mapping="logical" aggregate="true"><entity name="${is(n)}">${o}</entity></fetch></fetchcollection><categorycollection><category alias="${l}"><measurecollection>${s}</measurecollection></category></categorycollection></datadefinition>`}var Fu=class{toArtifact(t){var r,n,i,a,o,s,l;(0,Bm.installDomShim)();let u=(r=t.datadescription)!==null&&r!==void 0?r:"",c=(n=t.presentationdescription)!==null&&n!==void 0?n:"",d=(0,Kr.parseXmlRoot)(u,"<datadefinition/>"),p=(0,Kr.parseXmlRoot)(c,"<Chart/>");return{id:(i=t.savedqueryvisualizationid)!==null&&i!==void 0?i:"",name:(a=t.name)!==null&&a!==void 0?a:"",description:(o=t.description)!==null&&o!==void 0?o:"",entityLogicalName:(s=t.primaryentitytypecode)!==null&&s!==void 0?s:"",chartType:TI(p),isDefault:(l=t.isdefault)!==null&&l!==void 0?l:!1,series:FI(d),categories:xI(d),presentation:OI(p),dataBag:u?(0,Kr.projectElementBag)(d):void 0,presentationBag:c?(0,Kr.projectElementBag)(p):void 0,rowBag:U6(t.charttype,t.type)}}fromArtifact(t){(0,Bm.installDomShim)();let{datadescription:r,presentationdescription:n}=B6(t);return{savedqueryvisualizationid:t.id,name:t.name,description:t.description,primaryentitytypecode:t.entityLogicalName,datadescription:r,presentationdescription:n,charttype:DI(t.rowBag,"charttype"),type:DI(t.rowBag,"type"),isdefault:t.isDefault}}fromApiResponse(t){return this.toArtifact(t??{})}toApiPayload(t){var r,n,i,a,o,s,l;let u=this.fromArtifact(t);return{name:(r=u.name)!==null&&r!==void 0?r:"",description:(n=u.description)!==null&&n!==void 0?n:"",datadescription:(i=u.datadescription)!==null&&i!==void 0?i:"",presentationdescription:(a=u.presentationdescription)!==null&&a!==void 0?a:"",primaryentitytypecode:(o=u.primaryentitytypecode)!==null&&o!==void 0?o:"",charttype:(s=u.charttype)!==null&&s!==void 0?s:0,isdefault:(l=u.isdefault)!==null&&l!==void 0?l:!1}}createDefault(t){var r,n,i,a,o,s,l;(0,Bm.installDomShim)();let u=(r=t.entityLogicalName)!==null&&r!==void 0?r:"";return{id:(n=t.id)!==null&&n!==void 0?n:(0,F6.newId)(),name:(i=t.name)!==null&&i!==void 0?i:"New Chart",description:(a=t.description)!==null&&a!==void 0?a:"",entityLogicalName:u,chartType:(o=t.chartType)!==null&&o!==void 0?o:"Column",isDefault:(s=t.isDefault)!==null&&s!==void 0?s:!1,series:t.series&&t.series.length>0?t.series:[{attribute:"createdon",aggregate:"count"}],categories:t.categories&&t.categories.length>0?t.categories:[{attribute:"createdon",dateGrouping:"month"}],presentation:(l=t.presentation)!==null&&l!==void 0?l:{palette:"BrightPastel",showLegend:!0}}}assignMissingIds(t){return t}validate(t){let r=[],n=t;return(0,EI.childObjects)(n,"series","","series",r),(0,EI.childObjects)(n,"categories","","category",r),r}};Sa.ChartAdapter=Fu;function U6(e,t){let r=[];return e!==void 0&&r.push(["charttype",String(e)]),t!==void 0&&r.push(["type",String(t)]),r.length>0?{a:r,c:[]}:void 0}function DI(e,t){if(!e)return;let r=e.a.find(([i])=>i===t);if(!r)return;let n=parseInt(r[1],10);return Number.isNaN(n)?void 0:n}function TI(e){let t=e.getElementsByTagName("Series");for(let r=0;r<t.length;r+=1)if(t[r].getAttribute("ChartType"))return PI(t[r].getAttribute("ChartType"));return"Column"}function OI(e){var t;let r={showLegend:e.getElementsByTagName("Legend").length>0},n=e.getAttribute("Palette");n&&(r.palette=n);let i=e.getElementsByTagName("Title")[0],a=((t=i?.textContent)!==null&&t!==void 0?t:"").trim();return a&&(r.title=a),r}function xu(e){return e.getElementsByTagName("fetch")[0]}function RI(e){var t;let r=new Map;if(!e)return r;let n=e.getElementsByTagName("link-entity");for(let i=0;i<n.length;i+=1){let a=n[i],o=a.getAttribute("name");if(!o)continue;let s=a.getElementsByTagName("attribute");for(let l=0;l<s.length;l+=1){let u=s[l],c=(t=u.getAttribute("alias"))!==null&&t!==void 0?t:u.getAttribute("name");c&&r.set(c,o)}}return r}function FI(e){let t=xu(e);if(!t)return[];let r=RI(t),n=t.getElementsByTagName("attribute"),i=[];for(let a=0;a<n.length;a+=1){let o=n[a],s=o.getAttribute("aggregate");if(!s)continue;let l=o.getAttribute("name");if(!l)continue;let u={attribute:l,aggregate:s},c=o.getAttribute("charttype");c&&(u.seriesType=PI(c));let d=o.getAttribute("alias");d&&(u.alias=d);let p=d??l,f=r.get(p);f&&(u.relatedEntity=f),i.push(u)}return i}function xI(e){var t;let r=xu(e);if(!r)return[];let n=RI(r),i=r.getElementsByTagName("attribute"),a=[];for(let o=0;o<i.length;o+=1){let s=i[o];if(((t=s.getAttribute("groupby"))!==null&&t!==void 0?t:"").toLowerCase()!=="true")continue;let l=s.getAttribute("name");if(!l)continue;let u={attribute:l},c=s.getAttribute("dategrouping");c&&(u.dateGrouping=c);let d=s.getAttribute("alias");d&&(u.alias=d);let p=d??l,f=n.get(p);f&&(u.relatedEntity=f),a.push(u)}return a}function B6(e){if(!II(e.dataBag)||!II(e.presentationBag))return{datadescription:M6(e),presentationdescription:aG(e)};let t=new DOMParser().parseFromString("<root/>","text/xml"),r=_I(e.dataBag,"datadefinition",t),n=_I(e.presentationBag,"Chart",t);return $m(e.series,FI(r))||(q6(t,r,e.series),$6(t,n,e.series.length,e.chartType)),$m(e.categories,xI(r))||V6(t,r,e.categories),e.chartType!==TI(n)&&MI(n,e.chartType),$m(e.presentation,OI(n))||UI(n,e.presentation),{datadescription:(0,Kr.serializeNode)(r),presentationdescription:(0,Kr.serializeNode)(n)}}function II(e){return!!e&&(e.c.length>0||e.a.length>0)}function $6(e,t,r,n){let i,a=t.childNodes;for(let l=0;l<a.length;l+=1)if(a[l].nodeType===1&&a[l].tagName==="Series"){i=a[l];break}i||(i=e.createElement("Series"),t.insertBefore(i,t.firstChild));let o=[],s=i.childNodes;for(let l=0;l<s.length;l+=1)s[l].nodeType===1&&s[l].tagName==="Series"&&o.push(s[l]);for(let l=o.length;l<r;l+=1){let u=e.createElement("Series");u.setAttribute("ChartType",n),i.appendChild(u)}for(let l=r;l<o.length;l+=1)i.removeChild(o[l])}function _I(e,t,r){let n={n:t,a:(0,Um.mergeAttrs)(e.a,[]),c:(0,Um.spliceChildren)(e.c,[])};return(0,Um.rebuildRaw)(n,(0,Kr.domEngine)(r),null)}function q6(e,t,r){let n=xu(t),i=n?.getElementsByTagName("entity")[0];!n||!i||LI(e,t,i,J6(n),r,K6,{aliasPrefix:"aggregate_column",addRef:W6,removeRef:Q6})}function V6(e,t,r){let n=xu(t),i=n?.getElementsByTagName("entity")[0];!n||!i||LI(e,t,i,X6(n),r,Y6,{aliasPrefix:"groupby_column",addRef:j6,removeRef:H6})}function LI(e,t,r,n,i,a,o){let s=new Map;for(let p of n){let f=p.getAttribute("alias");f&&s.set(f,p)}let l=new Set,u=[];for(let p of i){let f=p.alias?s.get(p.alias):void 0;f&&!l.has(f)?(a(f,p),l.add(f)):u.push(p)}let c=n.filter(p=>!l.has(p)),d=0;for(let p of u)if(d<c.length){let f=c[d];a(f,p),l.add(f),d+=1}else{let f=e.createElement("attribute"),h=p.alias||z6(t,o.aliasPrefix);f.setAttribute("alias",h),a(f,p),Z6(e,r,f,p.relatedEntity),o.addRef(e,t,h)}for(let p of n)if(!l.has(p)){let f=p.getAttribute("alias");f&&o.removeRef(t,f),tG(p)}}function G6(e){let t=new Set;for(let r of["attribute","measure","category"]){let n=e.getElementsByTagName(r);for(let i=0;i<n.length;i+=1){let a=n[i].getAttribute("alias");a&&t.add(a)}}return t}function z6(e,t){let r=G6(e);if(!r.has(t))return t;for(let n=2;;n+=1){let i=`${t}_${n}`;if(!r.has(i))return i}}function kI(e,t){let r=t.getElementsByTagName("categorycollection")[0];if(r)return r;let n=e.createElement("categorycollection");return t.appendChild(n),n}function W6(e,t,r){let n=kI(e,t),i=n.getElementsByTagName("category")[0];i||(i=e.createElement("category"),n.appendChild(i));let a=e.createElement("measurecollection"),o=e.createElement("measure");o.setAttribute("alias",r),a.appendChild(o),i.appendChild(a)}function j6(e,t,r){let n=kI(e,t),i=e.createElement("category");i.setAttribute("alias",r),n.appendChild(i)}function H6(e,t){let r=e.getElementsByTagName("category");for(let n=0;n<r.length;n+=1)r[n].getAttribute("alias")===t&&r[n].removeAttribute("alias")}function Q6(e,t){var r;let n=e.getElementsByTagName("measure"),i=[];for(let a=0;a<n.length;a+=1)n[a].getAttribute("alias")===t&&i.push(n[a]);for(let a of i){let o=a.parentNode;o?.removeChild(a),o&&o.tagName==="measurecollection"&&!nG(o)&&((r=o.parentNode)===null||r===void 0||r.removeChild(o))}}function J6(e){let t=[],r=e.getElementsByTagName("attribute");for(let n=0;n<r.length;n+=1)r[n].getAttribute("aggregate")&&t.push(r[n]);return t}function X6(e){var t;let r=[],n=e.getElementsByTagName("attribute");for(let i=0;i<n.length;i+=1)((t=n[i].getAttribute("groupby"))!==null&&t!==void 0?t:"").toLowerCase()==="true"&&r.push(n[i]);return r}function K6(e,t){e.setAttribute("name",t.attribute),e.setAttribute("aggregate",t.aggregate),t.seriesType&&e.setAttribute("charttype",t.seriesType)}function Y6(e,t){e.setAttribute("name",t.attribute),e.setAttribute("groupby","true"),t.dateGrouping?e.setAttribute("dategrouping",t.dateGrouping):e.getAttribute("dategrouping")!==null&&e.removeAttribute("dategrouping")}function Z6(e,t,r,n){n?eG(e,t,n).appendChild(r):t.appendChild(r)}function eG(e,t,r){let n=t.getElementsByTagName("link-entity");for(let a=0;a<n.length;a+=1)if(n[a].getAttribute("name")===r)return n[a];let i=e.createElement("link-entity");return i.setAttribute("name",r),t.appendChild(i),i}function tG(e){let t=e.parentNode;if(t&&(t.removeChild(e),t.tagName==="link-entity"&&!rG(t))){let r=t.parentNode;r&&r.removeChild(t)}}function rG(e){let t=e.childNodes;for(let r=0;r<t.length;r+=1){let n=t[r];if(n.nodeType===1){let i=n.tagName;if(i==="attribute"||i==="link-entity")return!0}}return!1}function nG(e){let t=e.childNodes;for(let r=0;r<t.length;r+=1)if(t[r].nodeType===1)return!0;return!1}function MI(e,t){let r=e.getElementsByTagName("Series"),n=!1;for(let i=0;i<r.length;i+=1)r[i].getAttribute("ChartType")&&(r[i].setAttribute("ChartType",t),n=!0);if(!n){for(let i=0;i<r.length;i+=1)if(!iG(r[i])){r[i].setAttribute("ChartType",t);return}}}function iG(e){let t=e.childNodes;for(let r=0;r<t.length;r+=1){let n=t[r];if(n.nodeType===1&&n.tagName==="Series")return!0}return!1}function UI(e,t){var r;let n=e.ownerDocument;if(t.palette!==void 0&&e.setAttribute("Palette",t.palette),t.showLegend!==void 0){let i=[],a=e.getElementsByTagName("Legends");for(let o=0;o<a.length;o+=1)i.push(a[o]);if(t.showLegend&&i.length===0){let o=n.createElement("Legends"),s=n.createElement("Legend");s.setAttribute("Name","Default"),o.appendChild(s),e.appendChild(o)}else if(!t.showLegend)for(let o of i)(r=o.parentNode)===null||r===void 0||r.removeChild(o)}if(t.title!==void 0){let i=e.getElementsByTagName("Title")[0];i&&(i.textContent=t.title)}}function aG(e){let t=(0,Kr.parseXmlRoot)(k6(),"<Chart/>");return MI(t,e.chartType),UI(t,e.presentation),(0,Kr.serializeNode)(t)}function $m(e,t){return JSON.stringify(e)===JSON.stringify(t)}function is(e){return String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function oG(){return{adapter:new Fu,api:R6.chartApi,publish:(e,t,r)=>(0,NI.publishBoundEntity)(e,r),publishScope:(e,t)=>(0,NI.boundEntityPublishScope)(t)}}Sa.chartRegistration=oG});var $I=g(Lu=>{"use strict";Object.defineProperty(Lu,"__esModule",{value:!0});Lu.dashboardApi=void 0;var sG=Kt(),Qt=be(),as=ee(),lG="formid,name,description,formxml,type,objecttypecode,istabletenabled,iscustomizable,componentstate,versionnumber",uG="formid,name,type,objecttypecode",cG=0,dG=10;Lu.dashboardApi={async get(e,t){let n=`/systemforms(${(0,as.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,as.odataQuery)([["$select",lG]]),i=(0,Qt.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,Qt.readEtag)(i)}},async list(e,t){let r=[`(type eq ${cG} or type eq ${dG})`];t?.entityLogicalName&&r.push(`objecttypecode eq '${(0,as.odataLiteral)(t.entityLogicalName)}'`);let n=`/systemforms${(0,as.odataQuery)([["$select",uG],["$filter",r.join(" and ")]])}`;return(await(0,sG.collectPages)(e,n,"listArtifacts('dashboard')")).map(a=>{var o,s;return{type:"dashboard",id:(o=a.formid)!==null&&o!==void 0?o:"",name:(s=a.name)!==null&&s!==void 0?s:"",entityLogicalName:a.objecttypecode,isDirty:!1}})},async create(e,t,r){let n=t,i=(0,Qt.echoWrite)("formid"),a=`/systemforms${i.query}`,o={name:n.name,description:n.description,formxml:n.formxml,istabletenabled:n.istabletenabled,type:n.type};n.objecttypecode&&(o.objecttypecode=n.objecttypecode);let s=(0,Qt.ensureSuccess)(await e.post(a,(0,Qt.withClientMintedId)(o,"formid",r),i.options),e.apiUrl(a));return{id:(0,Qt.resolveCreatedId)(s,"formid","dashboard",r),etag:(0,Qt.readEtag)(s)}},async update(e,t,r,n){let i=r,a=(0,as.normalizeGuid)(t,"id"),o=(0,Qt.echoWrite)("formid",{"If-Match":(0,Qt.requireEtag)(n,"dashboard",a)}),s=`/systemforms(${a})${o.query}`,l=(0,Qt.ensureSuccess)(await e.patch(s,{name:i.name,description:i.description,formxml:i.formxml,istabletenabled:i.istabletenabled},o.options),e.apiUrl(s));return{id:a,etag:(0,Qt.readEtag)(l)}},delete(e,t){return(0,Qt.deleteRecord)(e,"systemforms",t)}}});var YI=g(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.dashboardRegistration=Sr.TILE_CLASS_ID=Sr.DashboardAdapter=void 0;var ss=mn(),Jt=Gn(),qm=Yt(),os=cr(),pG=$I(),Vm=In(),ui=bt(),jI=ee(),HI=Ni(),qI="0",Gm="10",fG=new Map([["{E7A81278-8635-4D9E-8D4D-59480B391C5B}","chart"],["{FD2A7985-3187-444E-908D-6624B21F69C0}","iframe"],["{9FDF5F91-88B1-47F4-AD53-C11EFC01A01D}","webresource"],["{EE9078C8-6946-4E2C-B8F8-35E65F4BE6A8}","stream"],["{06375649-C143-495E-A496-C962E5B4488E}","timeline"],["{8C54228C-1B25-4909-A12A-F2B968BB0D62}","powerbi"],["{F9A8A302-114E-466A-B582-6771B2AE0D92}","assistant"]]),mG="{3FF9A528-DD50-4ACA-8F10-2E5ED73513AD}",Mu=class{constructor(t=HI.DEFAULT_LCID){this.lcid=t}toArtifact(t){var r,n,i,a;(0,Vm.installDomShim)();let o=(r=t.formxml)!==null&&r!==void 0?r:"",s=(0,Jt.parseXmlRoot)(o,"<form/>");return{id:(n=t.formid)!==null&&n!==void 0?n:"",name:(i=t.name)!==null&&i!==void 0?i:"",description:(a=t.description)!==null&&a!==void 0?a:"",dashboardType:hG(t.type),entityLogicalName:t.objecttypecode?t.objecttypecode:null,enabledForMobile:!!t.istabletenabled,layoutType:gG(s),components:VI(s,this.lcid),bag:(0,Jt.projectElementBag)(s)}}fromArtifact(t){var r;return(0,Vm.installDomShim)(),{formid:t.id,name:t.name,description:t.description,type:t.dashboardType==="Interactive"?Gm:qI,objecttypecode:(r=t.entityLogicalName)!==null&&r!==void 0?r:"",istabletenabled:t.enabledForMobile,formxml:GI(t,this.lcid)}}fromApiResponse(t){return this.toArtifact(t??{})}toApiPayload(t){return{name:t.name,description:t.description,formxml:GI(t,this.lcid),istabletenabled:t.enabledForMobile,type:t.dashboardType==="Interactive"?Gm:qI,objecttypecode:t.entityLogicalName}}createDefault(t){var r,n,i,a,o,s,l,u;(0,Vm.installDomShim)();let c=(0,Jt.parseXmlRoot)(PG(),"<form/>");return{id:(r=t.id)!==null&&r!==void 0?r:(0,ui.newId)(),name:(n=t.name)!==null&&n!==void 0?n:"New Dashboard",description:(i=t.description)!==null&&i!==void 0?i:"",dashboardType:(a=t.dashboardType)!==null&&a!==void 0?a:"Standard",entityLogicalName:(o=t.entityLogicalName)!==null&&o!==void 0?o:null,enabledForMobile:(s=t.enabledForMobile)!==null&&s!==void 0?s:!1,layoutType:(l=t.layoutType)!==null&&l!==void 0?l:0,components:(u=t.components)!==null&&u!==void 0?u:VI(c,this.lcid),bag:(0,Jt.projectElementBag)(c)}}assignMissingIds(t){if(t&&typeof t=="object"&&!Array.isArray(t)&&"position"in t&&!("components"in t)){let r=t;(typeof r.id!="string"||r.id.length===0)&&(r.id=(0,ui.newId)())}return t}validate(t){let r=[],n=(0,os.childObjects)(t,"components","","component",r),i=new Set;return n.forEach(({node:a,index:o})=>{let s=`/components/${o}`;for(let l of["position","parameters"]){let u=a[l];u!==void 0&&!(0,os.isJsonObject)(u)&&r.push((0,os.issue)(`${s}/${l}`,`component-${l}-must-be-object`,`a component ${l} must be a JSON object when present, got ${u===null?"null":typeof u}`))}if((0,os.isJsonObject)(a.position)){let l=ls(a.position);i.has(l)?r.push((0,os.issue)(`${s}/position`,"component-position-collision",`two components occupy the same dashboard position (${l}); move one to a free cell`)):i.add(l)}}),r}};Sr.DashboardAdapter=Mu;function hG(e){return String(e??"")===Gm?"Interactive":"Standard"}function gG(e){var t;let r=(t=e?.getAttribute("formLayout"))!==null&&t!==void 0?t:e?.getAttribute("layoutType"),n=parseInt(r??"",10);return Number.isNaN(n)?0:n}function J(e,t){let r=[],n=e.childNodes;for(let i=0;i<n.length;i+=1){let a=n[i];a.nodeType===1&&a.tagName.toLowerCase()===t&&r.push(a)}return r}function VI(e,t){let r=[];return J(e,"tabs").flatMap(i=>J(i,"tab")).forEach((i,a)=>{J(i,"columns").flatMap(s=>J(s,"column")).forEach((s,l)=>{J(s,"sections").flatMap(c=>J(c,"section")).forEach((c,d)=>{vG(c,{tabIndex:a,columnIndex:l,sectionIndex:d},r,t)})})}),r}function vG(e,t,r,n){J(e,"rows").flatMap(a=>J(a,"row")).forEach((a,o)=>{J(a,"cell").forEach((s,l)=>{let u=yG(s,{...t,rowIndex:o,cellIndex:l},n);u&&r.push(u)})})}function yG(e,t,r){var n,i,a;let o=XI((n=e.getAttribute("id"))!==null&&n!==void 0?n:"");if(o.toLowerCase().startsWith("spacer"))return null;let s=J(e,"control")[0];if(!s)return null;let l=(i=s.getAttribute("classid"))!==null&&i!==void 0?i:"",u=AG(s),c=CG(l,u,s),d=bG(s);return{id:(a=s.getAttribute("id"))!==null&&a!==void 0?a:o,type:c,name:JI(e,r),classId:l,position:t,colspan:zm(e,"colspan",1),rowspan:zm(e,"rowspan",1),parameters:u,bag:(0,Jt.projectElementBag)(e),...d?{icProperties:d}:{}}}function QI(e){let t=e.childNodes;for(let r=0;r<t.length;r+=1){let n=t[r];if(n.nodeType===1&&n.tagName.toLowerCase()==="icproperties")return n}}function bG(e){let t=QI(e);return t?(0,Jt.serializeNode)(t):void 0}function wG(e,t,r){let n=QI(t);if(!r){n&&t.removeChild(n);return}let i=new DOMParser().parseFromString(r,"text/xml").documentElement,a=(0,ss.rebuildRaw)((0,ss.rawFromNode)((0,Jt.nodeLikeFromDom)(i)),(0,Jt.domEngine)(e),null);n&&(0,Jt.serializeNode)(n)===(0,Jt.serializeNode)(a)||(n?t.replaceChild(a,n):t.appendChild(a))}function JI(e,t){var r,n;let i=J(e,"labels")[0];if(!i)return"";let a=J(i,"label"),o=(r=a.find(s=>s.getAttribute("languagecode")===String(t)))!==null&&r!==void 0?r:a[0];return(n=o?.getAttribute("description"))!==null&&n!==void 0?n:""}function AG(e){var t;let r={},n=J(e,"parameters")[0];if(!n)return r;let i=n.childNodes;for(let a=0;a<i.length;a+=1){let o=i[a];o.nodeType===1&&(r[o.tagName]=((t=o.textContent)!==null&&t!==void 0?t:"").trim())}return r}function CG(e,t,r){var n;let i=fG.get(e.toUpperCase());return i?i==="chart"?t.ChartGridMode==="Chart"?"chart":"list":i==="assistant"&&((n=r.getAttribute("uniqueid"))!==null&&n!==void 0?n:"").toUpperCase()===mG?"assistant":i:"unknown"}function zm(e,t,r){var n;let i=parseInt((n=e.getAttribute(t))!==null&&n!==void 0?n:"",10);return Number.isNaN(i)?r:i}function XI(e){return e.replace(/^\{/,"").replace(/\}$/,"")}function SG(e,t){let r={n:"form",a:(0,ss.mergeAttrs)(e.bag.a,[]),c:(0,ss.spliceChildren)(e.bag.c,[])};return(0,ss.rebuildRaw)(r,(0,Jt.domEngine)(t),null)}function GI(e,t){let r=new DOMParser().parseFromString("<root/>","text/xml"),n=SG(e,r);return DG(r,n,e.components,t),EG(r,n,e.components,t),(0,Jt.serializeNode)(n)}function EG(e,t,r,n){let i=KI(t);for(let a of r)i.has(ls(a.position))||NG(e,t,a,n)}function NG(e,t,r,n){var i,a,o,s;let l=(a=(i=r.position)===null||i===void 0?void 0:i.sectionIndex)!==null&&a!==void 0?a:0,u=TG(t,e,l);for(let z of J(u,"row"))J(z,"cell").some($=>J($,"control").length>0)||u.removeChild(z);let c=r.classId||Sr.TILE_CLASS_ID[r.type]||Sr.TILE_CLASS_ID.iframe,d=r.rowspan&&r.rowspan>0?r.rowspan:4,p=r.bag&&zI(r.bag,"id")?String(zI(r.bag,"id")):ku((0,ui.newId)()),f=r.id?ku(r.id):ku((0,ui.newId)()),h=u.parentNode,y=Math.max(1,parseInt(h&&h.getAttribute&&h.getAttribute("columns")||"1",10)||1),w=Math.min(Math.max(1,r.colspan&&r.colspan>0?r.colspan:1),y),N=J(u,"row"),D=N[N.length-1],x=D?J(D,"cell").reduce((z,$)=>z+zm($,"colspan",1),0):0;(!D||x+w>y)&&(D=e.createElement("row"),u.appendChild(D));let F=e.createElement("cell");F.setAttribute("id",p),F.setAttribute("colspan",String(w)),F.setAttribute("rowspan",String(d)),F.setAttribute("showlabel","true");let X=e.createElement("labels"),V=e.createElement("label");V.setAttribute("description",(o=r.name)!==null&&o!==void 0?o:""),V.setAttribute("languagecode",String(n)),X.appendChild(V),F.appendChild(X);let M=e.createElement("control");M.setAttribute("id",f),M.setAttribute("classid",ku(c));let U=e.createElement("parameters"),B=(s=r.parameters)!==null&&s!==void 0?s:{};for(let z of Object.keys(B)){let $=(0,jI.createSafeXmlElement)(e,z,"dashboard tile parameter");$.textContent=B[z],U.appendChild($)}M.appendChild(U),F.appendChild(M),D.appendChild(F)}function zI(e,t){if(!e)return;let r=e.a.find(n=>n[0]===t);return r?r[1]:void 0}function DG(e,t,r,n){var i;let a=KI(t),o=new Set(r.map(s=>ls(s.position)));for(let s of r){let l=a.get(ls(s.position));if(!l)continue;let u=J(l,"control")[0];u&&(IG(e,l,s.name,n),_G(e,u,s.parameters),WI(l,"colspan",s.colspan),WI(l,"rowspan",s.rowspan),s.icProperties!==void 0&&wG(e,u,s.icProperties))}for(let[s,l]of a)o.has(s)||(i=l.parentNode)===null||i===void 0||i.removeChild(l)}function KI(e){let t=new Map;return J(e,"tabs").flatMap(n=>J(n,"tab")).forEach((n,i)=>{J(n,"columns").flatMap(o=>J(o,"column")).forEach((o,s)=>{J(o,"sections").flatMap(u=>J(u,"section")).forEach((u,c)=>{J(u,"rows").flatMap(p=>J(p,"row")).forEach((p,f)=>{J(p,"cell").forEach((h,y)=>{var w;XI((w=h.getAttribute("id"))!==null&&w!==void 0?w:"").toLowerCase().startsWith("spacer")||J(h,"control")[0]&&t.set(ls({tabIndex:i,columnIndex:s,sectionIndex:c,rowIndex:f,cellIndex:y}),h)})})})})}),t}function ls(e){let t=e??{};return`${t.tabIndex}.${t.columnIndex}.${t.sectionIndex}.${t.rowIndex}.${t.cellIndex}`}function IG(e,t,r,n){if(r===JI(t,n))return;let i=J(t,"labels")[0];i||(i=e.createElement("labels"),t.appendChild(i));let a=J(i,"label").find(o=>o.getAttribute("languagecode")===String(n));a||(a=e.createElement("label"),a.setAttribute("languagecode",String(n)),i.appendChild(a)),a.setAttribute("description",r)}function _G(e,t,r){var n;if(!r)return;let i=Object.keys(r);if(i.length===0)return;let a=J(t,"parameters")[0];a||(a=e.createElement("parameters"),t.appendChild(a));let o=new Map,s=a.childNodes;for(let l=0;l<s.length;l+=1){let u=s[l];u.nodeType===1&&o.set(u.tagName,u)}for(let l of i){let u=r[l],c=o.get(l);if(c)((n=c.textContent)!==null&&n!==void 0?n:"")!==u&&(c.textContent=u);else{let d=(0,jI.createSafeXmlElement)(e,l,"dashboard component parameter");d.textContent=u,a.appendChild(d)}}}function WI(e,t,r){var n;((n=e.getAttribute(t))!==null&&n!==void 0?n:"")!==String(r)&&e.setAttribute(t,String(r))}function PG(e=2){let t=`{${(0,ui.newId)()}}`,r=`{${(0,ui.newId)()}}`,n=`{${(0,ui.newId)()}}`,i=Math.max(1,Math.floor(e));return`<form><tabs><tab id="${t}" name="General" showlabel="true" expanded="true" verticallayout="true"><columns><column width="100%"><sections><section id="${r}" name="Section 1" showlabel="false" columns="${i}"><rows><row><cell id="${n}" rowspan="12" colspan="${i}" showlabel="true" /></row></rows></section></sections></column></columns></tab></tabs></form>`}Sr.TILE_CLASS_ID={chart:"E7A81278-8635-4D9E-8D4D-59480B391C5B",list:"E7A81278-8635-4D9E-8D4D-59480B391C5B",iframe:"FD2A7985-3187-444E-908D-6624B21F69C0",webresource:"9FDF5F91-88B1-47F4-AD53-C11EFC01A01D"};function ku(e){return`{${e.replace(/[{}]/g,"")}}`}function TG(e,t,r){var n;let i=J(e,"tabs").flatMap(u=>J(u,"tab"))[0];if(!i)throw new Error("addDashboardTile: dashboard formxml has no <tab>");let a=J(i,"columns").flatMap(u=>J(u,"column"))[0];if(!a)throw new Error("addDashboardTile: dashboard formxml has no <column>");let o=J(a,"sections").flatMap(u=>J(u,"section")),s=(n=o[r])!==null&&n!==void 0?n:o[0];if(!s)throw new Error("addDashboardTile: dashboard formxml has no <section>");let l=J(s,"rows")[0];return l||(l=t.createElement("rows"),s.appendChild(l)),l}function OG(e=HI.DEFAULT_LCID){return{adapter:new Mu(e),api:pG.dashboardApi,languageSensitive:!0,publish:(t,r,n)=>n?.entityLogicalName?(0,qm.publishBoundEntity)(t,n):(0,qm.publishDashboardById)(t,r),publishScope:(t,r)=>r?.entityLogicalName?(0,qm.boundEntityPublishScope)(r):{envelope:"dashboard",targetIds:[t]}}}Sr.dashboardRegistration=OG});var i_=g(Bu=>{"use strict";Object.defineProperty(Bu,"__esModule",{value:!0});Bu.genPageApi=void 0;var n_=Kt(),Ie=be(),Pt=ee(),Er=ie(),On="uxagentprojects",Na="uxagentprojectfiles",Ea="uxagentprojectid",Nr="uxagentprojectfileid",Uu=`${Ea},name`,RG=`${Nr},filename,filetype`;async function Wm(e,t,r,n){var i;let a=`/${t}(${r})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Pt.odataQuery)([["$select",n]]),o=(0,Ie.ensureSuccess)(await e.get(a),e.apiUrl(a));return{row:(i=o.body)!==null&&i!==void 0?i:{},etag:(0,Ie.readEtag)(o)}}async function FG(e,t){let r=`/${Na}(${t})/filecontent/$value`,n=await e.get(r);if(n.status===404)return{status:"unavailable",reason:"unpublished"};(0,Ie.ensureSuccess)(n,e.apiUrl(r));let i=n.body;if(i instanceof Uint8Array||Buffer.isBuffer(i))return{status:"available",data:Buffer.from(i).toString("base64")};if(i instanceof ArrayBuffer)return{status:"available",data:Buffer.from(new Uint8Array(i)).toString("base64")};if(typeof i=="string")return{status:"available",data:Buffer.from(i,"utf8").toString("base64")};throw new Er.SdkError("GENPAGE_CONTENT_UNREADABLE",`Read the content of file '${t}' but the injected HttpClient returned a body this SDK cannot encode (${typeof i}). Return the response as a string, Uint8Array, Buffer, or ArrayBuffer; a byte-returning transport is required to round-trip non-UTF8 assets.`)}async function xG(e,t,r,n){if(!e.supportsBinaryPatch)throw new Er.SdkError("GENPAGE_CONTENT_WRITE_UNSUPPORTED",`Refusing to push generative-page file '${t}': its content cannot be written because the injected HttpClient does not implement patchRaw(). A Dataverse File column is not writable through a JSON body, so saving the row without its bytes would report success for a page whose source never uploaded.`);let i=`/${Na}(${t})/filecontent`,a=new Uint8Array(Buffer.from(n,"base64"));(0,Pt.assertNoControlChars)(r,"generative-page file name"),(0,Ie.ensureSuccess)(await e.patchRaw(i,a,{headers:{"Content-Type":"application/octet-stream","Content-Length":String(a.byteLength),"x-ms-file-name":r}}),e.apiUrl(i))}async function jm(e,t){let r=`/${Na}/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()`+(0,Pt.odataQuery)([["$select",RG],["$filter",`_${Ea}_value eq ${t}`]]);return(await(0,n_.collectPages)(e,r,"fetchArtifact('genPage')")).map(i=>({row:i,etag:typeof i["@odata.etag"]=="string"?i["@odata.etag"]:null}))}async function ZI(e,t,r){var n;let{etag:i}=await Wm(e,On,t,Uu),a={};for(let{row:l,etag:u}of await jm(e,t))a[(0,Pt.normalizeGuid)(String((n=l[Nr])!==null&&n!==void 0?n:""),Nr)]=u;let o=Object.keys(a),s=!i||o.length!==r.size||o.some(l=>!r.has(l))||Object.values(a).some(l=>!l);return{etag:i,memberEtags:a,mismatch:s}}function e_(e,t){return t.mismatch?{etag:null,memberEtags:{},warnings:[`Generative page '${e}' was written, but its files changed on the server while the write was in progress, so the new concurrency tokens cannot be trusted. The local baseline is now unusable: re-fetch the page before editing it again \u2014 the next push will refuse rather than overwrite blind.`]}:{etag:t.etag,memberEtags:t.memberEtags}}Bu.genPageApi={async get(e,t){var r;let n=(0,Pt.normalizeGuid)(t,"id"),{row:i,etag:a}=await Wm(e,On,n,Uu),o=await jm(e,n),s={},l=[];for(let{row:u,etag:c}of o){let d=(0,Pt.normalizeGuid)(String((r=u[Nr])!==null&&r!==void 0?r:""),Nr);s[d]=c;let p=await FG(e,d);l.push({...u,content:p})}return{raw:{project:i,files:l},etag:a,memberEtags:s}},async list(e,t){let r=`/${On}/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()`+(0,Pt.odataQuery)([["$select",Uu]]);return(await(0,n_.collectPages)(e,r,"listArtifacts('genPage')")).map(i=>{var a,o;return{type:"genPage",id:String((a=i[Ea])!==null&&a!==void 0?a:""),name:String((o=i.name)!==null&&o!==void 0?o:""),isDirty:!1}})},async create(e,t,r){let n=t;t_(e,n);let i=`/${On}`,a=(0,Ie.ensureSuccess)(await e.post(i,(0,Ie.withClientMintedId)({name:n.name},Ea,r)),e.apiUrl(i)),o=(0,Ie.resolveCreatedId)(a,Ea,"generative page",r),s=new Set;for(let l of n.files){let u=await r_(e,o,l,!0);s.add((0,Pt.normalizeGuid)(u.id,"file id"))}try{return{id:o,...e_(o,await ZI(e,o,s))}}catch(l){return{id:o,etag:null,memberEtags:{},warnings:[`The generative page was created, but re-reading its concurrency tokens failed (${l instanceof Error?l.message:String(l)}). The local baseline is unusable: re-fetch the page before editing it \u2014 the next push will refuse rather than overwrite blind.`]}}},async update(e,t,r,n,i){let a=r,o=(0,Pt.normalizeGuid)(t,"id");t_(e,a);let s=await jm(e,o),{etag:l}=await Wm(e,On,o,Uu);if(n&&l&&n!==l)throw new Er.SdkError(Ie.VERSION_CONFLICT_CODE,`Generative page '${o}' changed on the server after it was fetched (baseline ${n}, server ${l}) \u2014 another writer edited it. A page row accepts no If-Match validator, so this push would silently overwrite them. Re-fetch the page and re-apply the edit.`);if(!n||!l)throw new Er.SdkError(Ie.VERSION_CONFLICT_CODE,`Cannot verify generative page '${o}' before writing: ${n?"the server did not return the page's current token":"no baseline token was recorded"}. This entity accepts no If-Match validator, so an unverified write would silently overwrite any concurrent edit. Re-fetch the page and retry.`);let u=new Set(s.map(({row:f})=>{var h;return(0,Pt.normalizeGuid)(String((h=f[Nr])!==null&&h!==void 0?h:""),Nr)})),c=new Set(a.files.map(f=>(0,Pt.normalizeGuid)(f.id,"file id")));if(!i)throw new Er.SdkError(Ie.VERSION_CONFLICT_CODE,`Cannot verify the files of generative page '${o}' before writing: no child baseline was recorded. These rows accept no If-Match validator, so an unverified write would silently overwrite any concurrent edit. Re-fetch the page and retry.`);let d=new Set(Object.keys(i).map(f=>f.toLowerCase()));{for(let h of c)if(!u.has(h)&&d.has(h))throw new Er.SdkError(Ie.VERSION_CONFLICT_CODE,`Generative-page file '${h}' existed when this page was fetched but is gone from the server now \u2014 another writer deleted it. Refusing to recreate it, because a blind re-create would undo that delete and, for an unpublished page, restore the row WITHOUT its content. Re-fetch the page and re-apply the edit.`);for(let h of u)if(!d.has(h))throw new Er.SdkError(Ie.VERSION_CONFLICT_CODE,`Generative-page file '${h}' is on the server but absent from this page's baseline \u2014 another writer added it after the page was fetched, so its contents cannot be verified. Refusing to write over or delete it. Re-fetch the page so the addition is part of your baseline.`);let f=new Map(s.map(({row:h,etag:y})=>{var w;return[(0,Pt.normalizeGuid)(String((w=h[Nr])!==null&&w!==void 0?w:""),Nr),y]}));for(let[h,y]of Object.entries(i??{})){let w=h.toLowerCase();if(!u.has(w))continue;let N=f.get(w);if(!y||!N)throw new Er.SdkError(Ie.VERSION_CONFLICT_CODE,`Cannot verify generative-page file '${w}' before writing: ${y?"the server did not return its current token":"no baseline token was recorded"}. A file row accepts no If-Match validator, so an unverified write would silently overwrite any concurrent edit. Re-fetch the page and retry.`);if(y!==N)throw new Er.SdkError(Ie.VERSION_CONFLICT_CODE,`Generative-page file '${w}' changed on the server after this page was fetched (baseline ${y}, server ${N}) \u2014 another writer edited it. A file row accepts no If-Match validator, so this push would silently overwrite that change. Re-fetch the page and re-apply the edit.`)}}let p=`/${On}(${o})`;(0,Ie.ensureSuccess)(await e.patch(p,{name:a.name},{headers:{"If-Match":"*"}}),e.apiUrl(p));for(let f of a.files){let h=(0,Pt.normalizeGuid)(f.id,"file id");await r_(e,o,f,!u.has(h))}for(let f of u)c.has(f)||await(0,Ie.deleteRecord)(e,Na,f);try{return{id:o,...e_(o,await ZI(e,o,c))}}catch(f){return{id:o,etag:null,memberEtags:{},warnings:[`The generative page was written, but re-reading its concurrency tokens failed (${f instanceof Error?f.message:String(f)}). The local baseline is now unusable: re-fetch the page before editing it again \u2014 the next push will refuse rather than overwrite blind.`]}}},delete(e,t){return(0,Ie.deleteRecord)(e,On,t)}};function t_(e,t){var r;if(((r=t.files)!==null&&r!==void 0?r:[]).some(i=>i.content.status==="available")&&!e.supportsBinaryPatch)throw new Er.SdkError("GENPAGE_CONTENT_WRITE_UNSUPPORTED","Refusing to write this generative page: it has file content to upload, but the injected HttpClient does not implement patchRaw(). A Dataverse File column is not writable through a JSON body, so proceeding would create the page and its rows and then fail, leaving a page whose source never uploaded.")}async function r_(e,t,r,n){let i=(0,Pt.normalizeGuid)(r.id,"file id"),a;if(n){let o=`/${Na}`,s=(0,Ie.ensureSuccess)(await e.post(o,(0,Ie.withClientMintedId)({filename:r.name,filetype:r.fileType,[`${Ea}@odata.bind`]:`/${On}(${t})`},Nr,i)),e.apiUrl(o));a=(0,Ie.readEtag)(s)}else{let o=`/${Na}(${i})`,s=(0,Ie.ensureSuccess)(await e.patch(o,{filename:r.name,filetype:r.fileType},{headers:{"If-Match":"*"}}),e.apiUrl(o));a=(0,Ie.readEtag)(s)}return r.content.status==="available"&&await xG(e,i,r.name,r.content.data),{id:i,etag:a}}});var l_=g(Ia=>{"use strict";Object.defineProperty(Ia,"__esModule",{value:!0});Ia.genPageRegistration=Ia.GenPageAdapter=void 0;var LG=i_(),kG=Yt(),Rn=cr(),s_=bt(),a_=2e8;function o_(e){return typeof e=="string"&&e.trim()!==""?e:(0,s_.newId)()}function Da(e){return(0,Rn.isJsonObject)(e)?e:{}}function MG(e){let t=Da(e);return t.status==="available"&&typeof t.data=="string"?{status:"available",data:t.data}:{status:"unavailable",reason:"unpublished"}}var $u=class{toArtifact(t){return t}fromArtifact(t){return t}fromApiResponse(t){var r,n;let i=t,a=Da(i?.project),o=Array.isArray(i?.files)?i.files:[];return{id:String((r=a.uxagentprojectid)!==null&&r!==void 0?r:""),name:String((n=a.name)!==null&&n!==void 0?n:""),files:o.map(s=>{var l,u,c;let d=Da(s);return{id:String((l=d.uxagentprojectfileid)!==null&&l!==void 0?l:""),name:String((u=d.filename)!==null&&u!==void 0?u:""),fileType:Number((c=d.filetype)!==null&&c!==void 0?c:a_),content:MG(d.content)}})}}toApiPayload(t){var r;return{name:t.name,files:((r=t.files)!==null&&r!==void 0?r:[]).map(n=>({id:n.id,name:n.name,fileType:n.fileType,content:n.content}))}}createDefault(t){var r,n;return{id:o_(t.id),name:(r=t.name)!==null&&r!==void 0?r:"New page",files:((n=t.files)!==null&&n!==void 0?n:[]).map(i=>{var a,o,s;return{id:o_(i.id),name:(a=i.name)!==null&&a!==void 0?a:"index.tsx",fileType:(o=i.fileType)!==null&&o!==void 0?o:a_,content:(s=i.content)!==null&&s!==void 0?s:{status:"available",data:""}}})}}assignMissingIds(t){let r=Da(t);return(typeof r.id!="string"||r.id.trim()==="")&&(r.id=(0,s_.newId)()),r}validate(t){let r=[],n=t.files;if(n!==void 0&&!Array.isArray(n))return r.push((0,Rn.issue)("/files","files-must-be-array",`files must be an array, got ${typeof n}`)),r;let i=new Map;return(Array.isArray(n)?n:[]).forEach((a,o)=>{let s=`/files/${o}`,l=Da(a),u=typeof l.id=="string"?l.id.trim().toLowerCase():"";if(u==="")r.push((0,Rn.issue)(s,"file-id-required","a generative-page file needs an id"));else{let f=i.get(u);f!==void 0?r.push((0,Rn.issue)(s,"file-id-duplicate",`two files share the id '${l.id}' (also at /files/${f}); a file's id is its identity, so a duplicate makes an edit ambiguous`)):i.set(u,o)}let c=typeof l.name=="string"?l.name:"";(c===""||/[\u0000-\u001F\u007F]/.test(c)||/[\\/]/.test(c))&&r.push((0,Rn.issue)(s+"/name","file-name-invalid",`a file name must be a non-empty single path segment with no control characters or path separators (it is sent as an HTTP header on upload); got '${c}'`));let d=l.content;if(d===void 0){r.push((0,Rn.issue)(s+"/content","file-content-required","content is required: omitting it is indistinguishable from an empty file, and the two have opposite effects on the next push"));return}let p=Da(d);p.status==="available"?typeof p.data!="string"&&r.push((0,Rn.issue)(s+"/content/data","file-content-data-invalid","available content needs base64 `data`")):p.status!=="unavailable"&&r.push((0,Rn.issue)(s+"/content/status","file-content-status-invalid",`content.status must be 'available' or 'unavailable', got ${String(p.status)}`))}),r}};Ia.GenPageAdapter=$u;function UG(){return{adapter:new $u,api:LG.genPageApi,publish:(e,t)=>(0,kG.publishGenPageById)(e,t),publishScope:e=>({envelope:"uxagentproject",targetIds:[e]})}}Ia.genPageRegistration=UG});var c_=g(Vu=>{"use strict";Object.defineProperty(Vu,"__esModule",{value:!0});Vu.reconcileBpfSecurityRoles=void 0;var qu=be(),Hm=ee(),BG="Global",u_={create:"Create",read:"Read",write:"Write",delete:"Delete"};async function $G(e,t){var r,n;let i=`/EntityDefinitions(LogicalName='${t}')?$select=LogicalName,Privileges`,o=(n=(r=(0,qu.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)===null||r===void 0?void 0:r.Privileges)!==null&&n!==void 0?n:[],s={},l=new Set;return Object.keys(u_).forEach(u=>{let c=o.find(d=>d.PrivilegeType===u_[u]);if(c){let d=(0,Hm.normalizeGuid)(c.PrivilegeId,"PrivilegeId");s[u]=d,l.add(d)}}),{byAccess:s,all:l}}async function qG(e,t){var r,n;let i=`/RetrieveRolePrivilegesRole(RoleId=${t})`,o=(n=(r=(0,qu.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)===null||r===void 0?void 0:r.RolePrivileges)!==null&&n!==void 0?n:[];return new Set(o.map(s=>(0,Hm.normalizeGuid)(s.PrivilegeId,"PrivilegeId")))}async function VG(e,t,r){if(r.length===0)return;let n={Privileges:r.map(a=>({Depth:BG,PrivilegeId:a}))},i=`/roles(${t})/Microsoft.Dynamics.CRM.AddPrivilegesRole`;(0,qu.ensureSuccess)(await e.post(i,n),e.apiUrl(i))}async function GG(e,t,r){let n={Privilege:{"@odata.type":"Microsoft.Dynamics.CRM.privilege",privilegeid:r}},i=`/roles(${t})/Microsoft.Dynamics.CRM.RemovePrivilegeRole`;(0,qu.ensureSuccess)(await e.post(i,n),e.apiUrl(i))}async function zG(e,t,r){var n;if(!r||r.length===0)return;let i=await $G(e,t.toLowerCase());for(let a of r){let o=(0,Hm.normalizeGuid)(a.roleId,"roleId"),s=new Set(((n=a.access)!==null&&n!==void 0?n:[]).map(p=>i.byAccess[p]).filter(p=>!!p)),l=await qG(e,o),u=new Set([...l].filter(p=>i.all.has(p))),c=[...s].filter(p=>!u.has(p)),d=[...u].filter(p=>!s.has(p));await VG(e,o,c);for(let p of d)await GG(e,o,p)}}Vu.reconcileBpfSecurityRoles=zG});var h_=g(zu=>{"use strict";Object.defineProperty(zu,"__esModule",{value:!0});zu.bpfApi=void 0;var Fn=Mn(),WG=Kt(),Xt=be(),Dr=ee(),jG=c_(),Gu={"Content-Type":"application/json",Accept:"application/json"},HG=`category eq ${Fn.WorkflowCategory.BusinessProcessFlow} and type eq ${Fn.WorkflowTypeCode.Definition} and businessprocesstype eq ${Fn.BusinessProcessType.BusinessFlow}`,QG="workflowid,name,description,primaryentity,statecode,category,type,businessprocesstype,processorder",JG="workflowid,name,uniquename,description,primaryentity,statecode,statuscode,category,type,businessprocesstype,processorder,xaml,clientdata",XG=["xaml","name","description","processorder"];async function d_(e,t){var r;if(t.status!=="Active"||!t.securityRoles||t.securityRoles.length===0)return;let n=String((r=t.record.uniquename)!==null&&r!==void 0?r:"");n!==""&&await(0,jG.reconcileBpfSecurityRoles)(e,n,t.securityRoles)}async function Qm(e,t,r){var n;if(r==="Draft")return null;let i=(0,Dr.normalizeGuid)(t,"workflowid"),a={statecode:Fn.StateCode.Activated,statuscode:Fn.StatusCode.Activated},o=`/workflows(${i})`,s=(0,Xt.ensureSuccess)(await e.patch(o,a,{headers:Gu}),e.apiUrl(o));return(n=(0,Xt.readEtag)(s))!==null&&n!==void 0?n:await m_(e,i)}async function m_(e,t){let r=`/workflows(${t})${(0,Dr.odataQuery)([["$select","workflowid"]])}`,n=await e.get(r);return n.status>=200&&n.status<300?(0,Xt.readEtag)(n):null}async function KG(e,t){var r;let n=`/workflows(${t})${(0,Dr.odataQuery)([["$select","statecode"]])}`,i=await e.get(n);if(i.status<200||i.status>=300)return null;let a=(r=i.body)===null||r===void 0?void 0:r.statecode;return a==null?null:Number(a)}async function p_(e,t,r){if(await KG(e,t)!==Fn.StateCode.Activated)return!1;let n={statecode:Fn.StateCode.Draft,statuscode:Fn.StatusCode.Draft},i=`/workflows(${t})`,a={...Gu};return r&&(a["If-Match"]=r),(0,Xt.ensureSuccess)(await e.patch(i,n,{headers:a}),e.apiUrl(i)),!0}async function f_(e,t){try{await Qm(e,t,"Active")}catch{}}function YG(e){let t={};for(let r of XG)e[r]!==void 0&&(t[r]=e[r]);return t}zu.bpfApi={async get(e,t){let n=`/workflows(${(0,Dr.normalizeGuid)(t,"id")})${(0,Dr.odataQuery)([["$select",JG]])}`,i=(0,Xt.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,Xt.readEtag)(i)}},async list(e,t){let r=[HG];t?.entityLogicalName&&r.push(`primaryentity eq '${(0,Dr.odataLiteral)(t.entityLogicalName)}'`);let n=`/workflows${(0,Dr.odataQuery)([["$select",QG],["$filter",r.join(" and ")]])}`;return(await(0,WG.collectPages)(e,n,"listArtifacts('bpf')")).map(a=>{var o,s;return{type:"bpf",id:(o=a.workflowid)!==null&&o!==void 0?o:"",name:(s=a.name)!==null&&s!==void 0?s:"",entityLogicalName:a.primaryentity,isDirty:!1}})},async create(e,t){let r=t,n=(0,Dr.normalizeGuid)(r.record.workflowid,"workflowid"),i="/workflows",a=(0,Xt.ensureSuccess)(await e.post(i,r.record,{headers:Gu}),e.apiUrl(i)),o=null;try{o=await Qm(e,n,r.status),await d_(e,r)}catch(s){try{await(0,Xt.deleteRecord)(e,"workflows",n)}catch{}throw s}return{id:n,etag:o??(0,Xt.readEtag)(a)}},async update(e,t,r,n){var i;let a=r,o=(0,Dr.normalizeGuid)(t,"id"),s=await p_(e,o,n);try{let l=`/workflows(${o})`,u={...Gu};n&&!s&&(u["If-Match"]=n);let c=(0,Xt.ensureSuccess)(await e.patch(l,YG(a.record),{headers:u}),e.apiUrl(l)),d=await Qm(e,o,a.status);return await d_(e,a),{id:o,etag:(i=d??(0,Xt.readEtag)(c))!==null&&i!==void 0?i:await m_(e,o)}}catch(l){throw s&&await f_(e,o),l}},async delete(e,t){let r=(0,Dr.normalizeGuid)(t,"id"),n=await p_(e,r,null);try{await(0,Xt.deleteRecord)(e,"workflows",r)}catch(i){throw n&&await f_(e,r),i}}}});var Y_=g(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});Ta.bpfRegistration=Ta.BpfAdapter=void 0;var _a=ws(),ZG=wl(),Wu=Mn(),e7=h_(),Jm=mn(),ci=Gn(),__=In(),Ft=cr(),xn=bt(),Ir=ie(),t7=100,Km='<?xml version="1.0" encoding="utf-16"?>',g_=1033,P_="mxswa:Workflow",r7="mxswa:ActivityReference.Properties",n7="mcwo:StepLabel",i7="mcwb:Control",v_="mcwb:Control.ControlDisplayName",T_="mcwb:Control.DataFieldName",O_="DataFieldName",y_="ControlDisplayName",R_="Literal",ju="x:Null",b_="x:String",Ym="x:Key",Zm="DisplayName",Qu="Activities",a7="StepLabels",F_="StageId",x_="StageCategory",L_="NextStageId",k_="ProcessStepId",eh="IsProcessRequired",M_="EntityComposite",U_="StageComposite",B_="StepComposite";function Xm(e){return(0,Ft.isJsonObject)(e)?e:{}}function _r(e){if(!e)return[];let t=[],r=e.childNodes;for(let n=0;n<r.length;n+=1){let i=r[n];i.nodeType===1&&t.push(i)}return t}function di(e,t){var r;return(r=_r(e).find(n=>n.tagName===t))!==null&&r!==void 0?r:null}function Pr(e){return di(e,r7)}function ht(e,t){var r;return(r=_r(e).find(n=>n.getAttribute(Ym)===t))!==null&&r!==void 0?r:null}function Pa(e,t){var r;return((r=e.getAttribute("AssemblyQualifiedName"))!==null&&r!==void 0?r:"").includes(t)}function Zr(e){var t;return!e||!e.firstChild?"":(t=e.firstChild.nodeValue)!==null&&t!==void 0?t:""}function $_(e,t,r){e.firstChild?e.firstChild.nodeValue=r:e.appendChild(t.createTextNode(r))}function us(e){var t;let r=(t=e.getAttribute(Zm))!==null&&t!==void 0?t:"",n=r.indexOf(": ");return n>=0?r.slice(n+2):r}function q_(e,t){var r;let n=(r=e.getAttribute(Zm))!==null&&r!==void 0?r:"",i=n.indexOf(": ");e.setAttribute(Zm,i>=0?n.slice(0,i+2)+t:t)}function V_(e,t){let r=ht(e,a7),n=di(r,n7);n&&n.setAttribute("Description",t)}function o7(e){let t=ht(e,x_);if(!t||t.tagName===ju)return;let r=Zr(t).trim();return r===""?void 0:Number(r)}function s7(e){let t=ht(e,L_);if(!t||t.tagName===ju)return;let r=Zr(t).trim();return r===""?void 0:r}function G_(e){let t=z_(e);if(!t)return;let r=j_(t,O_,T_);return r===""?void 0:r}function th(e,t){let r=_r(e);for(;r.length>0;){let n=r.pop();if(n.tagName===t)return n;for(let i of _r(n))r.push(i)}return null}function z_(e){let t=ht(Pr(e),Qu);return t?th(t,i7):null}function W_(e,t){let r=e.attributes;for(let n=0;n<r.length;n+=1)if(r[n].name===t)return!0;return!1}function j_(e,t,r){var n;return W_(e,t)?(n=e.getAttribute(t))!==null&&n!==void 0?n:"":p7(e,r)}function w_(e,t,r,n){if(W_(e,t)){e.setAttribute(t,n);return}if(di(e,r)){l7(e,r,n);return}throw new Ir.InvalidArgumentError(`BPF step control exposes neither a '${t}' attribute nor a <${r}> wrapper to bind a column`)}function l7(e,t,r){let n=di(e,t),i=n?th(n,R_):null;i&&i.setAttribute("Value",r)}function H_(e){return us(e)}function Ju(e){let t=di(e,P_),r=[];for(let n of _r(t).filter(i=>Pa(i,M_))){let i=ht(Pr(n),Qu);for(let a of _r(i).filter(o=>Pa(o,U_)))r.push({el:a,entity:H_(n)})}return r}function rh(e){let t=ht(Pr(e),Qu);return _r(t).filter(r=>Pa(r,B_))}function u7(e){let t=Pr(e),r=Zr(ht(t,eh)).trim().toLowerCase(),n=G_(e),i={id:Zr(ht(t,k_)),name:us(e)};return n!==void 0&&(i.fieldName=n),r==="true"&&(i.required=!0),i}function c7(e,t){let r=Pr(e),n=o7(r),i=s7(r),a={id:Zr(ht(r,F_)),name:us(e),entityLogicalName:t,steps:rh(e).map(u7)};return n!==void 0&&(a.category=n),i!==void 0&&(a.nextStageId=i),a}function d7(e){return Ju(e).map(({el:t,entity:r})=>c7(t,r))}function Yr(e){return new Ir.NotImplementedError("bpf-structural-authoring",`${e} is not supported yet (this phase authors identity, stage/step names, step required, step field binding, stage categories, and adding/removing/reordering stages & steps on a single-table process; branching, actions, security-role wiring and multi-table processes land in later phases). The rest of the process round-trips losslessly.`)}function p7(e,t){var r;let n=di(e,t),i=n?th(n,R_):null;return(r=i?.getAttribute("Value"))!==null&&r!==void 0?r:""}function nh(e,t){var r;let n=e.createElement(t.tagName),i=t.attributes;for(let o=0;o<i.length;o+=1)n.setAttribute(i[o].name,i[o].value);let a=t.childNodes;for(let o=0;o<a.length;o+=1){let s=a[o];s.nodeType===1?n.appendChild(nh(e,s)):s.nodeType===3&&n.appendChild(e.createTextNode((r=s.nodeValue)!==null&&r!==void 0?r:""))}return n}function Q_(e){return ht(Pr(e),Qu)}function f7(e,t,r){var n;let i=t.entityLogicalName&&t.entityLogicalName.trim()!==""?t.entityLogicalName:r,a=!((n=t.steps[0])===null||n===void 0)&&n.id&&t.steps[0].id.trim()!==""?t.steps[0].id:(0,xn.newId)(),{body:o}=Xu(ih(i,(0,_a.v4)(),t.id,a));return nh(e,Ju((0,ci.parseXmlRoot)(o,"<Activity/>"))[0].el)}function m7(e,t){let{body:r}=Xu(ih("account",(0,_a.v4)(),(0,_a.v4)(),t.id));return nh(e,rh(Ju((0,ci.parseXmlRoot)(r,"<Activity/>"))[0].el)[0])}function J_(e,t){for(;e.firstChild;)e.removeChild(e.firstChild);for(let r of t)e.appendChild(r)}function X_(e,t,r,n){let i=ht(e,r);if(!i||!i.parentNode){if(n!==void 0&&n!=="")throw Yr(`setting '${r}' on a stage whose xaml does not expose that slot`);return}let a=i.parentNode;if(n===void 0||n===""){if(i.tagName!==ju){let s=t.createElement(ju);s.setAttribute(Ym,r),a.replaceChild(s,i)}return}if(i.tagName===b_){Zr(i)!==n&&$_(i,t,n);return}let o=t.createElement(b_);o.setAttribute(Ym,r),o.appendChild(t.createTextNode(n)),a.replaceChild(o,i)}function h7(e,t,r){X_(e,t,x_,r===void 0?void 0:String(r))}function g7(e,t,r){X_(e,t,L_,r)}function K_(e,t,r){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(r(e[n])!==t[n])return!1;return!0}function A_(e){return Zr(ht(Pr(e),F_))}function C_(e){return Zr(ht(Pr(e),k_))}function S_(e,t,r){var n,i,a,o;let s=Pr(e);r.name!==us(e)&&(q_(e,r.name),V_(s,r.name));let l=Zr(ht(s,eh)).trim().toLowerCase()==="true";if(((n=r.required)!==null&&n!==void 0?n:!1)!==l){let u=ht(s,eh);u&&$_(u,t,r.required?"True":"False")}if(((i=r.fieldName)!==null&&i!==void 0?i:"")!==((a=G_(e))!==null&&a!==void 0?a:"")){let u=z_(e);if(!u)throw new Ir.InvalidArgumentError("BPF step has no <mcwb:Control> element to bind a column to");let c=(o=r.fieldName)!==null&&o!==void 0?o:"";w_(u,O_,T_,c),c!==""&&j_(u,y_,v_)===""&&w_(u,y_,v_,c)}}function E_(e,t,r,n){var i;let a=Pr(e);if(!a)throw new Ir.InvalidArgumentError("BPF stage composite has no <\u2026ActivityReference.Properties>");if(r.name!==us(e)&&(q_(e,r.name),V_(a,r.name)),h7(a,t,r.category),g7(a,t,n),r.relationshipName&&r.relationshipName.trim()!=="")throw Yr("a stage relationship / table change (multi-table authoring)");if(r.actions&&r.actions.length>0||r.branch)throw Yr("stage actions or conditional branching");let o=Q_(e);if(!o)throw new Ir.InvalidArgumentError("BPF stage has no [Activities] collection");let s=(i=r.steps)!==null&&i!==void 0?i:[];if(s.length===0)throw new Ir.InvalidArgumentError(`BPF stage '${r.name}' must have at least one step`);let l=rh(e);if(K_(l,s.map(d=>d.id),C_)){l.forEach((d,p)=>S_(d,t,s[p]));return}let u=new Map(l.map(d=>[C_(d),d]));if(_r(o).some(d=>!Pa(d,B_)))throw Yr("adding, removing or reordering steps on a stage that also contains branching or actions");let c=s.map(d=>{var p;return(p=u.get(d.id))!==null&&p!==void 0?p:m7(t,d)});J_(o,c),c.forEach((d,p)=>S_(d,t,s[p]))}function v7(e,t,r){let n=di(e,P_);if(!n)throw new Ir.InvalidArgumentError("BPF xaml has no <mxswa:Workflow> root activity");if(r.globalActions&&r.globalActions.length>0)throw Yr("global (process-completed/abandoned) actions");if(!r.stages||r.stages.length===0)throw new Ir.InvalidArgumentError("a BPF must have at least one stage");let i=Ju(e),a=i.map(p=>p.el);if(K_(a,r.stages.map(p=>p.id),A_)){i.forEach(({el:p,entity:f},h)=>{let y=r.stages[h];if(y.entityLogicalName&&y.entityLogicalName.trim()!==""&&y.entityLogicalName!==f)throw Yr(`changing a stage's table ('${y.entityLogicalName}' vs the process's '${f}')`);E_(p,t,y,y.nextStageId)});return}let o=_r(n).filter(p=>Pa(p,M_));if(o.length!==1)throw Yr("adding, removing or reordering stages on a multi-table process");let s=o[0],l=H_(s),u=Q_(s);if(!u)throw new Ir.InvalidArgumentError("BPF primary entity composite has no [Activities] collection");if(_r(u).some(p=>!Pa(p,U_)))throw Yr("adding, removing or reordering stages on a process whose primary composite holds non-stage activities (multi-table nesting or advanced constructs)");for(let p of r.stages)if(p.entityLogicalName&&p.entityLogicalName.trim()!==""&&p.entityLogicalName!==l)throw Yr(`a stage on a different table ('${p.entityLogicalName}') than the process primary ('${l}')`);let c=new Map(a.map(p=>[A_(p),p])),d=r.stages.map(p=>{var f;return(f=c.get(p.id))!==null&&f!==void 0?f:f7(t,p,l)});J_(u,d),d.forEach((p,f)=>{let h=f<d.length-1?r.stages[f+1].id:void 0;E_(p,t,r.stages[f],h)})}function Xu(e){let t=e.match(/^<\?xml[^>]*\?>\s*/),r=t?t[0]:"";return{prolog:r,body:e.slice(r.length)}}function y7(e){var t,r,n,i,a,o;(0,__.installDomShim)();let s=(t=e.bag)===null||t===void 0?void 0:t.xaml;if(s){let p=new ZG.DOMParser().parseFromString("<root/>","text/xml"),f={n:"Activity",a:(0,Jm.mergeAttrs)(s.a,[]),c:(0,Jm.spliceChildren)(s.c,[])};return{root:(0,Jm.rebuildRaw)(f,(0,ci.domEngine)(p),null),prolog:(n=(r=e.bag)===null||r===void 0?void 0:r.xamlProlog)!==null&&n!==void 0?n:Km,eol:(a=(i=e.bag)===null||i===void 0?void 0:i.xamlEol)!==null&&a!==void 0?a:"lf"}}let l=e.stages[0],u=(o=l?.steps)===null||o===void 0?void 0:o[0],c=ih(e.entityLogicalName,(0,_a.v4)(),l?.id&&l.id.trim()!==""?l.id:(0,_a.v4)(),u?.id&&u.id.trim()!==""?u.id:(0,_a.v4)()),{body:d}=Xu(c);return{root:(0,ci.parseXmlRoot)(d,"<Activity/>"),prolog:Km,eol:"lf"}}function b7(e){let{root:t,prolog:r,eol:n}=y7(e);v7(t,t.ownerDocument,e);let i=(0,ci.serializeNode)(t);return n==="crlf"&&(i=i.replace(/\n/g,`\r
-`)),r+i}function w7(e){return e.uniqueName&&e.uniqueName.trim()!==""?e.uniqueName:`new_${(e.name||"businessprocessflow").toLowerCase().replace(/[^a-z0-9]/g,"")||"businessprocessflow"}`}var Hu=class{toArtifact(t){return t}fromArtifact(t){return t}fromApiResponse(t){var r,n;(0,__.installDomShim)();let i=t,a=typeof i.xaml=="string"?i.xaml:"",o={id:i.workflowid?String(i.workflowid):null,name:String((r=i.name)!==null&&r!==void 0?r:""),entityLogicalName:String((n=i.primaryentity)!==null&&n!==void 0?n:""),status:Number(i.statecode)===1?"Active":"Draft",stages:[]};if(i.uniquename&&(o.uniqueName=String(i.uniquename)),i.description!=null&&i.description!==""&&(o.description=String(i.description)),i.processorder!=null&&i.processorder!==""&&(o.order=Number(i.processorder)),a.trim()!==""){let{prolog:s,body:l}=Xu(a),u=(0,ci.parseXmlRoot)(l,"<Activity/>");o.stages=d7(u),o.bag={xaml:(0,ci.projectElementBag)(u),xamlProlog:s,xamlEol:/\r\n/.test(a)?"crlf":"lf"}}return o}toApiPayload(t){var r;let n={workflowid:t.id&&t.id.trim()!==""?t.id:(0,xn.newId)(),name:t.name,uniquename:w7(t),primaryentity:t.entityLogicalName,xaml:b7(t),category:Wu.WorkflowCategory.BusinessProcessFlow,type:Wu.WorkflowTypeCode.Definition,businessprocesstype:Wu.BusinessProcessType.BusinessFlow,scope:Wu.WorkflowScope.Organization,processorder:(r=t.order)!==null&&r!==void 0?r:t7};t.description!==void 0&&(n.description=t.description);let i={record:n,status:t.status};if(t.securityRoles&&t.securityRoles.length>0){if(t.status!=="Active")throw new Ir.InvalidArgumentError('securityRoles require the BPF to be Active \u2014 the backing table they grant access to is created on activation; set status to "Active" to wire security roles');i.securityRoles=t.securityRoles}return i}createDefault(t){var r,n,i;let a=t.stages&&t.stages.length>0?t.stages.map(D_):[D_({id:(0,xn.newId)(),name:"New Stage",steps:[]})],o={id:t.id&&t.id.trim()!==""?t.id:(0,xn.newId)(),name:(r=t.name)!==null&&r!==void 0?r:"New business process flow",entityLogicalName:(n=t.entityLogicalName)!==null&&n!==void 0?n:"",status:(i=t.status)!==null&&i!==void 0?i:"Draft",stages:a};return t.uniqueName&&(o.uniqueName=t.uniqueName),t.description!==void 0&&(o.description=t.description),t.order!==void 0&&(o.order=t.order),t.globalActions!==void 0&&(o.globalActions=t.globalActions),t.securityRoles!==void 0&&(o.securityRoles=t.securityRoles),o}assignMissingIds(t){let r=Xm(t);(typeof r.id!="string"||r.id.trim()==="")&&(r.id=(0,xn.newId)());for(let n of["stages","steps","actions","globalActions"]){let i=r[n];Array.isArray(i)&&i.forEach(a=>this.assignMissingIds(a))}return r}validate(t){let r=[],n=t.stages;if(n!==void 0&&!Array.isArray(n))return r.push((0,Ft.issue)("/stages","stages-must-be-array",`stages must be an array, got ${typeof n}`)),r;let i=Array.isArray(n)?n:[];i.length>30&&r.push((0,Ft.issue)("/stages","too-many-stages",`a BPF allows at most 30 stages, got ${i.length}`));let a=new Set,o=new Map;i.forEach((l,u)=>{let c=`/stages/${u}`,d=Xm(l),p=typeof d.id=="string"?d.id.trim():"";p===""?r.push((0,Ft.issue)(`${c}/id`,"stage-id-required","a stage needs an id")):o.has(p.toLowerCase())?r.push((0,Ft.issue)(`${c}/id`,"stage-id-duplicate",`two stages share the id '${l.id}' (also at /stages/${o.get(p.toLowerCase())})`)):o.set(p.toLowerCase(),u),typeof l.entityLogicalName=="string"&&l.entityLogicalName!==""&&a.add(l.entityLogicalName);let f=Array.isArray(l.steps)?l.steps:[];f.length===0&&r.push((0,Ft.issue)(`${c}/steps`,"stage-needs-step","a BPF stage must have at least one step")),f.length>30&&r.push((0,Ft.issue)(`${c}/steps`,"too-many-steps",`a stage allows at most 30 steps, got ${f.length}`));let h=new Map;f.forEach((y,w)=>{let N=`${c}/steps/${w}`,D=typeof Xm(y).id=="string"?y.id.trim():"";D===""?r.push((0,Ft.issue)(`${N}/id`,"step-id-required","a step needs an id")):h.has(D.toLowerCase())?r.push((0,Ft.issue)(`${N}/id`,"step-id-duplicate",`two steps in this stage share the id '${y.id}'`)):h.set(D.toLowerCase(),w)}),l.branch&&!N_(i,l.branch.nextStageId)&&r.push((0,Ft.issue)(`${c}/branch/nextStageId`,"branch-target-unknown",`branch nextStageId '${l.branch.nextStageId}' does not match any stage id`)),typeof l.nextStageId=="string"&&l.nextStageId!==""&&!N_(i,l.nextStageId)&&r.push((0,Ft.issue)(`${c}/nextStageId`,"next-stage-unknown",`nextStageId '${l.nextStageId}' does not match any stage id`))}),a.size>5&&r.push((0,Ft.issue)("/stages","too-many-tables",`a BPF spans at most 5 tables, got ${a.size}`));let s=A7(i);return s>=0&&r.push((0,Ft.issue)(`/stages/${s}/nextStageId`,"next-stage-cycle","the stage nextStageId links form a cycle; the flow must be acyclic")),r}};Ta.BpfAdapter=Hu;function A7(e){let t=new Map(e.map(r=>[r.id,r]));for(let r=0;r<e.length;r+=1){let n=new Set,i=e[r];for(;i&&typeof i.nextStageId=="string"&&i.nextStageId!=="";){if(n.has(i.id))return r;n.add(i.id),i=t.get(i.nextStageId)}}return-1}function N_(e,t){return e.some(r=>r.id===t)}function D_(e){var t,r;let n=e.steps&&e.steps.length>0?e.steps.map(I_):[I_({id:(0,xn.newId)(),name:"New Step"})],i={id:e.id&&e.id.trim()!==""?e.id:(0,xn.newId)(),name:(t=e.name)!==null&&t!==void 0?t:"New Stage",entityLogicalName:(r=e.entityLogicalName)!==null&&r!==void 0?r:"",steps:n};return e.category!==void 0&&(i.category=e.category),e.nextStageId!==void 0&&(i.nextStageId=e.nextStageId),e.relationshipName!==void 0&&(i.relationshipName=e.relationshipName),e.actions!==void 0&&(i.actions=e.actions),e.branch!==void 0&&(i.branch=e.branch),i}function I_(e){var t;let r={id:e.id&&e.id.trim()!==""?e.id:(0,xn.newId)(),name:(t=e.name)!==null&&t!==void 0?t:"New Step"};return e.fieldName!==void 0&&(r.fieldName=e.fieldName),e.required!==void 0&&(r.required=e.required),r}function ih(e,t,r,n){return`${Km}<Activity x:Class="XrmWorkflow00000000000000000000000000000000" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:mcwb="clr-namespace:Microsoft.Crm.Workflow.BusinessProcessFlowActivities;assembly=Microsoft.Crm.Workflow, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" xmlns:mcwo="clr-namespace:Microsoft.Crm.Workflow.ObjectModel;assembly=Microsoft.Crm, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" xmlns:mxs="clr-namespace:Microsoft.Xrm.Sdk;assembly=Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" xmlns:mxswa="clr-namespace:Microsoft.Xrm.Sdk.Workflow.Activities;assembly=Microsoft.Xrm.Sdk.Workflow, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" xmlns:sco="clr-namespace:System.Collections.ObjectModel;assembly=mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" xmlns:srs="clr-namespace:System.Runtime.Serialization;assembly=System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" xmlns:this="clr-namespace:" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"><x:Members><x:Property Name="InputEntities" Type="InArgument(scg:IDictionary(x:String, mxs:Entity))" /><x:Property Name="CreatedEntities" Type="InArgument(scg:IDictionary(x:String, mxs:Entity))" /></x:Members><this:XrmWorkflow00000000000000000000000000000000.InputEntities><InArgument x:TypeArguments="scg:IDictionary(x:String, mxs:Entity)" /></this:XrmWorkflow00000000000000000000000000000000.InputEntities><this:XrmWorkflow00000000000000000000000000000000.CreatedEntities><InArgument x:TypeArguments="scg:IDictionary(x:String, mxs:Entity)" /></this:XrmWorkflow00000000000000000000000000000000.CreatedEntities><mva:VisualBasic.Settings>Assembly references and imported namespaces for internal implementation</mva:VisualBasic.Settings><mxswa:Workflow><mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.EntityComposite, Microsoft.Crm.Workflow, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="EntityStep1: ${e}"><mxswa:ActivityReference.Properties><sco:Collection x:TypeArguments="Variable" x:Key="Variables" /><sco:Collection x:TypeArguments="Activity" x:Key="Activities"><mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.StageComposite, Microsoft.Crm.Workflow, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="StageStep2: New Stage"><mxswa:ActivityReference.Properties><sco:Collection x:TypeArguments="Variable" x:Key="Variables" /><sco:Collection x:TypeArguments="Activity" x:Key="Activities"><mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.StepComposite, Microsoft.Crm.Workflow, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="StepStep3: New Step"><mxswa:ActivityReference.Properties><sco:Collection x:TypeArguments="Variable" x:Key="Variables" /><sco:Collection x:TypeArguments="Activity" x:Key="Activities"><Sequence DisplayName="ControlStep4"><mcwb:Control ControlId="${t}" IsSystemControl="False" IsUnbound="False" SystemStepType="0"><mcwb:Control.ClassId><InArgument x:TypeArguments="x:String"><Literal x:TypeArguments="x:String" Value="" /></InArgument></mcwb:Control.ClassId><mcwb:Control.ControlDisplayName><InArgument x:TypeArguments="x:String"><Literal x:TypeArguments="x:String" Value="" /></InArgument></mcwb:Control.ControlDisplayName><mcwb:Control.DataFieldName><InArgument x:TypeArguments="x:String"><Literal x:TypeArguments="x:String" Value="" /></InArgument></mcwb:Control.DataFieldName><mcwb:Control.Parameters><InArgument x:TypeArguments="x:String"><Literal x:TypeArguments="x:String" Value="" /></InArgument></mcwb:Control.Parameters></mcwb:Control></Sequence></sco:Collection><sco:Collection x:TypeArguments="mcwo:StepLabel" x:Key="StepLabels"><mcwo:StepLabel Description="New Step" LabelId="${n}" LanguageCode="${g_}" /></sco:Collection><x:String x:Key="ProcessStepId">${n}</x:String><x:Boolean x:Key="IsProcessRequired">False</x:Boolean></mxswa:ActivityReference.Properties></mxswa:ActivityReference></sco:Collection><sco:Collection x:TypeArguments="mcwo:StepLabel" x:Key="StepLabels"><mcwo:StepLabel Description="New Stage" LabelId="${r}" LanguageCode="${g_}" /></sco:Collection><x:String x:Key="StageId">${r}</x:String><x:Null x:Key="StageCategory" /><x:Null x:Key="NextStageId" /></mxswa:ActivityReference.Properties></mxswa:ActivityReference></sco:Collection><x:Null x:Key="RelationshipName" /><x:Null x:Key="AttributeName" /><x:Boolean x:Key="IsClosedLoop">False</x:Boolean></mxswa:ActivityReference.Properties></mxswa:ActivityReference></mxswa:Workflow></Activity>`}function C7(){return{adapter:new Hu,api:e7.bpfApi,languageSensitive:!0}}Ta.bpfRegistration=C7});var Z_=g(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});Ku.buildRegistrations=void 0;var S7=P2(),E7=z2(),N7=wd(),D7=nI(),I7=CI(),_7=BI(),P7=YI(),T7=l_(),O7=Y_();function R7(e){let t=new Map;return t.set("form",(0,S7.formRegistration)(e)),t.set("view",(0,E7.viewRegistration)()),t.set("businessRule",(0,N7.businessRuleRegistration)()),t.set("app",(0,D7.appRegistration)(e)),t.set("command",(0,I7.commandRegistration)()),t.set("chart",(0,_7.chartRegistration)()),t.set("dashboard",(0,P7.dashboardRegistration)(e)),t.set("genPage",(0,T7.genPageRegistration)()),t.set("bpf",(0,O7.bpfRegistration)()),t}Ku.buildRegistrations=R7});var l1=g(Re=>{"use strict";Object.defineProperty(Re,"__esModule",{value:!0});Re.removeRowSummary=Re.configureRowSummary=Re.buildGptDynamicPrompt=Re.setAppAiFeatures=Re.getAiReadiness=Re.saveSettingValue=Re.retrieveSetting=Re.AI_GATE=void 0;var sr=be(),Xe=ee(),e1=bt(),en=ie();Re.AI_GATE={formFill:"FormFillBarUXEnabled",formFillSuggestions:"FormPredictEnabled",formFillSmartPaste:"FormPredictSmartPasteEnabled",formFillFiles:"FormFillFileUploadEnabled",nlSearch:"EnableNLGridSearch",nlChart:"NLChartVisualizationSetting",summaries:"EnableFormInsights",m365:"m365copilotmodelappenabled"};var i1={formFill:"FormFillBarUXEnabled",formFillSuggestions:"FormPredictEnabled",formFillSmartPaste:"FormPredictSmartPasteEnabledOnByDefault",formFillFiles:"FormFillFileUploadEnabled",nlSearch:"NLGridSearchSetting",nlChart:"NLChartDataVisualizationSetting",m365:"m365copilotmodelappenabled"},F7=new Set(Object.entries(Re.AI_GATE).filter(([e,t])=>i1[e]===t).map(([e])=>e)),x7={formFill:{enabled:"2",disabled:"1"},formFillSuggestions:{enabled:"2",disabled:"1"},formFillSmartPaste:{enabled:"2",disabled:"1"},formFillFiles:{enabled:"2",disabled:"1"}};function ah(e){return x7[e]}var Yu=1e6;function L7(e,t){let r=ah(t),n=()=>{throw new en.InvalidArgumentError(`setAppAiFeatures: '${t}' must be a boolean or an integer between 0 and ${Yu} (e.g. 0, 1, 2); got '${String(e)}'.`)},i=a=>r?a?r.enabled:r.disabled:a?"1":"0";if(typeof e=="boolean")return i(e);if(typeof e=="number")return!Number.isSafeInteger(e)||e<0||e>Yu?n():String(e);if(typeof e=="string"){let a=e.trim(),o=a.toLowerCase();if(o==="true")return i(!0);if(o==="false")return i(!1);if(/^[0-9]+$/.test(a)){let s=a.replace(/^0+(?=[0-9])/,"");return s.length>String(Yu).length||Number(s)>Yu?n():s}}return n()}function k7(e,t){let r=ah(t);return r?e===r.enabled:e!=="0"}async function M7(e,t){var r,n,i;let a=`/appmodules${(0,Xe.odataQuery)([["$select","appmoduleid"],["$filter",`uniquename eq '${(0,Xe.odataLiteral)(t)}'`]])}`,o=await e.get(a);return o.status>=200&&o.status<300?(i=((n=(r=o.body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[])[0])===null||i===void 0?void 0:i.appmoduleid:void 0}async function U7(e,t){var r,n;let i=`/appmodules${(0,Xe.odataQuery)([["$select","appmoduleid"],["$filter",`uniquename eq '${(0,Xe.odataLiteral)(t)}'`]])}`,a;try{a=await e.get(i)}catch(l){throw new en.InvalidArgumentError(`setAppAiFeatures: cannot confirm that the supplied appModuleId belongs to app '${t}' \u2014 the lookup failed (${l.message}). Retry, or omit appModuleId to verify by name.`)}if(a.status<200||a.status>=300)throw new en.InvalidArgumentError(`setAppAiFeatures: cannot confirm that the supplied appModuleId belongs to app '${t}' \u2014 the lookup returned HTTP ${a.status}. Retry, or omit appModuleId to verify by name.`);let o=(r=a.body)===null||r===void 0?void 0:r.value;if(!Array.isArray(o))throw new en.InvalidArgumentError(`setAppAiFeatures: cannot confirm that the supplied appModuleId belongs to app '${t}' \u2014 the lookup returned a malformed body.`);if(o.length===0)return;let s=(n=o[0])===null||n===void 0?void 0:n.appmoduleid;if(!s)throw new en.InvalidArgumentError(`setAppAiFeatures: cannot confirm that the supplied appModuleId belongs to app '${t}' \u2014 the lookup returned a row with no appmoduleid.`);return s}var t1=new WeakMap;async function B7(e,t){var r,n,i;let a=t1.get(e);if(a||(a=new Map,t1.set(e,a)),a.has(t))return a.get(t);let o=`/settingdefinitions${(0,Xe.odataQuery)([["$select","settingdefinitionid"],["$filter",`uniquename eq '${(0,Xe.odataLiteral)(t)}'`]])}`,s=await e.get(o),l=s.status>=200&&s.status<300?(i=((n=(r=s.body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[])[0])===null||i===void 0?void 0:i.settingdefinitionid:void 0;return l&&a.set(t,l),l}async function $7(e,t,r){var n,i;let a=await B7(e,r);if(!t||!a)return;let o=`/appsettings${(0,Xe.odataQuery)([["$select","value"],["$filter",`_parentappmoduleid_value eq ${t} and _settingdefinitionid_value eq ${a}`]])}`,s=await e.get(o);if(s.status<200||s.status>=300)return;let l=(i=(n=s.body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[];return l.length>0?{exists:!0,value:l[0].value}:{exists:!1}}var q7=4,V7=500,r1=20,n1=3e4;function G7(e){if(e===void 0)return q7;if(!Number.isFinite(e))throw new en.InvalidArgumentError(`setAppAiFeatures: verifyAttempts must be a finite integer between 1 and ${r1}; got ${e}.`);return Math.min(r1,Math.max(1,Math.floor(e)))}function z7(e){if(e===void 0)return V7;if(!Number.isFinite(e))throw new en.InvalidArgumentError(`setAppAiFeatures: verifyDelayMs must be a finite number between 0 and ${n1}; got ${e}.`);return Math.min(n1,Math.max(0,Math.floor(e)))}function W7(e){return e>0?new Promise(t=>setTimeout(t,e)):Promise.resolve()}async function j7(e,t,r,n,i,a,o){let s,l,u,c=!1;for(let d=0;d<a;d+=1){d>0&&await W7(o*d);let p;try{let f=await t();f?(p=await $7(e,f,n),p===void 0&&(u="the app-scope override row could not be read (insufficient access or unresolvable ids)")):u=`the app '${r}' could not be resolved to an appmoduleid \u2014 a newly created app is not readable until it is published, so either publish it first or pass \`appModuleId\` in the options to verify without the lookup`}catch(f){p=void 0,u=f.message}c=p!==void 0,l=p?.exists;try{s=(await Zu(e,n,{appUniqueName:r})).value}catch{}if(p?.exists&&p.value===i)return{result:"proven",effectiveValue:p.value,appOverrideExists:!0}}return c?{result:"absent",effectiveValue:s,appOverrideExists:l}:{result:"unverifiable",effectiveValue:s,appOverrideExists:void 0,reason:u}}function a1(e,t,r){if(t===2)return String(e).toLowerCase()==="true";let n=r?ah(r):void 0;return n?e===n.enabled:e!=null&&e!=="0"&&e!==""}async function Zu(e,t,r={}){var n,i;let a=[`SettingName='${(0,Xe.odataPathLiteral)(t)}'`];r.appUniqueName&&a.push(`AppUniqueName='${(0,Xe.odataPathLiteral)(r.appUniqueName)}'`);let o=`/RetrieveSetting(${a.join(",")})`,l=(i=(n=(0,sr.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||n===void 0?void 0:n.SettingDetail)!==null&&i!==void 0?i:{};return{value:l.Value,dataType:l.DataType}}Re.retrieveSetting=Zu;async function o1(e,t,r,n={}){let i={SettingName:t,Value:r};n.appUniqueName&&(i.AppUniqueName=n.appUniqueName),n.solutionUniqueName&&(i.SolutionUniqueName=n.solutionUniqueName),(0,sr.ensureSuccess)(await e.post("/SaveSettingValue",i),e.apiUrl("/SaveSettingValue"))}Re.saveSettingValue=o1;async function H7(e,t={}){let r={};for(let[n,i]of Object.entries(Re.AI_GATE)){let{value:a,dataType:o}=await Zu(e,i,t);r[n]={enabled:a1(a,o,n),setting:i,value:a}}return r}Re.getAiReadiness=H7;async function Q7(e,t,r,n={}){var i,a;if(!t||!t.trim())throw new en.InvalidArgumentError("setAppAiFeatures: a non-empty appUniqueName is required (an empty value would write the setting at organization scope, affecting every app).");let o=G7(n.verifyAttempts),s=z7(n.verifyDelayMs),l=[];for(let[y,w]of Object.entries(r)){if(w===void 0)continue;let N=i1[y];N&&l.push({feature:y,setting:N,requestedValue:L7(w,y)})}let u=[],c=n.appModuleId?(0,Xe.normalizeGuid)(n.appModuleId,"appModuleId"):void 0;if(c){let y=await U7(e,t);if(y&&(0,Xe.normalizeGuid)(y,"appModuleId")!==c)throw new en.InvalidArgumentError(`setAppAiFeatures: appModuleId '${c}' does not belong to app '${t}' (which resolves to '${y}'). Settings are written by unique name, so verifying against a different app would report success for a write that never landed.`)}let d,p=async()=>c||(d||(d=await M7(e,t)),d),f=new Map,h=async y=>{if(F7.has(y))return;let w=Re.AI_GATE[y];if(w){if(!f.has(w))try{let{value:N,dataType:D}=await Zu(e,w);f.set(w,{enabled:a1(N,D,y),setting:w,value:N})}catch{f.set(w,void 0)}return f.get(w)}};for(let{feature:y,setting:w,requestedValue:N}of l)try{await o1(e,w,N,{appUniqueName:t,solutionUniqueName:n.solutionUniqueName});let D=await j7(e,p,t,w,N,o,s),x={feature:y,setting:w,requestedValue:N,effectiveValue:D.effectiveValue,appOverrideExists:D.appOverrideExists};if(D.result==="proven")u.push({...x,status:"applied"});else if(D.result==="absent"){let F=k7(N,y)?await h(y):void 0;F&&!F.enabled?u.push({...x,status:"skipped",reason:`the write was issued and no app-scope override holding '${N}' was observed for '${w}' after ${o} attempt(s); the org readiness gate '${F.setting}' reads '${F.value}', so an environment admin must enable it before this app can turn the feature on`}):u.push({...x,status:"notPersisted",reason:`the write reported success but no app-scope override holding '${N}' was observed for '${w}' after ${o} attempt(s) \u2014 it reads '${(i=D.effectiveValue)!==null&&i!==void 0?i:""}' for this app (Dataverse can accept an app-scope write without storing it)`})}else u.push({...x,status:"unverified",reason:`the write was issued but could not be confirmed: ${(a=D.reason)!==null&&a!==void 0?a:"the app-scope override row could not be read"}. The value may or may not be in force \u2014 verify manually before relying on it.`})}catch(D){u.push({feature:y,setting:w,requestedValue:N,status:"failed",reason:D.message})}return{applied:u.filter(y=>y.status==="applied").map(y=>y.feature),skipped:u.filter(y=>y.status==="skipped").map(y=>y.feature),notPersisted:u.filter(y=>y.status==="notPersisted").map(y=>y.feature),unverified:u.filter(y=>y.status==="unverified").map(y=>y.feature),failed:u.filter(y=>y.status==="failed").map(y=>y.feature),outcomes:u}}Re.setAppAiFeatures=Q7;var J7="GptPowerPrompt",X7='{ "consumptionSource": "Api", "partnerSource": "AIBuilder", "consumptionSourceVersion": "GptApiClient"}';function s1(e){var t,r,n,i;let a=e.entityLogicalName,o=[{type:"literal",text:e.instruction.replace(/\s*$/,"")+" "}];return e.columns.forEach((s,l)=>{o.push({type:"data",id:`${a}.${s.logical}`,text:s.display}),l<e.columns.length-1&&o.push({type:"literal",text:", "})}),{version:"GptDynamicPrompt-2",prompt:o,definitions:{inputs:[{id:"RecordId",text:"RecordId",type:"text"},{id:"LanguageCode",text:"LanguageCode",type:"text"}],formulas:[],data:[{id:a,displayName:a,type:"dataverseTable",filters:[{filterType:"equal",attribute:e.primaryKey,valueType:"inputVariable",value:"RecordId"}]}],output:{formats:[(t=e.outputFormat)!==null&&t!==void 0?t:"text"]}},modelParameters:{modelType:"default",gptParameters:{temperature:(r=e.temperature)!==null&&r!==void 0?r:0}},settings:{recordRetrievalLimit:(n=e.recordRetrievalLimit)!==null&&n!==void 0?n:30,shouldPreserveRecordLinks:null,runtime:null,enableReasoning:(i=e.enableReasoning)!==null&&i!==void 0?i:!0},code:"",signature:""}}Re.buildGptDynamicPrompt=s1;async function K7(e,t){var r,n;let i=`/EntityDefinitions(LogicalName='${(0,Xe.odataPathLiteral)(t)}')${(0,Xe.odataQuery)([["$select","MetadataId"]])}`;return(n=(r=(0,sr.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)===null||r===void 0?void 0:r.MetadataId)!==null&&n!==void 0?n:""}async function Y7(e,t,r={}){var n,i,a,o,s;let l=`ais_RowSummary_${t.entityLogicalName}`,u=`/aiskillconfigs${(0,Xe.odataQuery)([["$select","aiskillconfigid,_aimodel_value"],["$filter",`uniquename eq '${(0,Xe.odataLiteral)(l)}'`],["$top",1]])}`,c=((i=(n=(0,sr.ensureSuccess)(await e.get(u),e.apiUrl(u)).body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[])[0];if(c)return{modelId:c._aimodel_value,aiSkillConfigId:c.aiskillconfigid};let d=`/msdyn_aitemplates${(0,Xe.odataQuery)([["$select","msdyn_aitemplateid"],["$filter",`msdyn_uniquename eq '${J7}'`],["$top",1]])}`,p=((s=(o=(a=(0,sr.ensureSuccess)(await e.get(d),e.apiUrl(d)).body)===null||a===void 0?void 0:a.value)===null||o===void 0?void 0:o[0])!==null&&s!==void 0?s:{}).msdyn_aitemplateid,f=(0,e1.newId)(),h=(0,e1.newId)(),y=JSON.stringify(s1(t)),w={ModelId:f,RunConfigurationId:h,ModelName:`${t.entityLogicalName} row summary`,TemplateId:p,CustomConfiguration:y,Source:X7,RunConfiguration:""};(0,sr.ensureSuccess)(await e.post("/AIModelPublish",w),e.apiUrl("/AIModelPublish"));try{let N=await K7(e,t.entityLogicalName),D={uniquename:l,description:`${t.entityLogicalName} row summary`,"[email protected]":`/entities(${N})`,"[email protected]":`/msdyn_aimodels(${f})`,aiskill:"RowSummary"},x=(0,sr.ensureSuccess)(await e.post("/aiskillconfigs",D),e.apiUrl("/aiskillconfigs")),F=(0,sr.requireCreatedId)(x,"aiskillconfigid","row-summary skill");return{modelId:f,aiSkillConfigId:F}}catch(N){try{await e.delete(`/msdyn_aimodels(${f})`)}catch{}throw N}}Re.configureRowSummary=Y7;async function Z7(e,t){var r,n;let i=`ais_RowSummary_${t.entityLogicalName}`,a=`/aiskillconfigs${(0,Xe.odataQuery)([["$select","aiskillconfigid,_aimodel_value"],["$filter",`uniquename eq '${(0,Xe.odataLiteral)(i)}'`],["$top",1]])}`,o=((n=(r=(0,sr.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[])[0];if(!o)return;let s=`/aiskillconfigs(${o.aiskillconfigid})`;if((0,sr.ensureSuccess)(await e.delete(s),e.apiUrl(s)),o._aimodel_value){let l=`/msdyn_aimodels(${o._aimodel_value})`;(0,sr.ensureSuccess)(await e.delete(l),e.apiUrl(l))}}Re.removeRowSummary=Z7});var u1=g(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});Oa.findArtifact=Oa.resolveArtifact=void 0;var gt=ee(),tn=el(),ez=sl(),tz=be(),rz=ie();async function nz(e,t,r){var n,i,a,o,s,l,u,c,d,p,f,h;switch(t){case"app":{let y=(0,ez.unpublishedAppModulesQuery)("appmoduleid,name,appmoduleidunique",`uniquename eq '${(0,gt.odataLiteral)((n=r.uniqueName)!==null&&n!==void 0?n:"")}'`,1),N=(i=(0,tz.ensureSuccess)(await e.get(y),e.apiUrl(y)).body)===null||i===void 0?void 0:i.value,D=N&&N[0];return D?[{id:String(D.appmoduleid),name:String(D.name),appModuleIdUnique:String(D.appmoduleidunique)}]:[]}case"dashboard":return(await(0,tn.queryRecords)(e,"systemform",{select:["formid","name"],filter:`name eq '${(0,gt.odataLiteral)((a=r.name)!==null&&a!==void 0?a:"")}' and type eq 0`,top:10})||[]).map(w=>({id:String(w.formid),name:String(w.name)}));case"command":{let y=await(0,tn.queryRecords)(e,"appaction",{select:["appactionid","buttonlabeltext"],filter:`contextvalue eq '${(0,gt.odataLiteral)((o=r.entity)!==null&&o!==void 0?o:"")}'`,top:1});return y&&y.length?[{id:String(r.entity),entity:String(r.entity)}]:[]}case"form":return(await(0,tn.queryRecords)(e,"systemform",{select:["formid","name"],filter:`name eq '${(0,gt.odataLiteral)((s=r.name)!==null&&s!==void 0?s:"")}' and objecttypecode eq '${(0,gt.odataLiteral)((l=r.entity)!==null&&l!==void 0?l:"")}'`,top:10})||[]).map(w=>({id:String(w.formid),name:String(w.name)}));case"chart":return(await(0,tn.queryRecords)(e,"savedqueryvisualization",{select:["savedqueryvisualizationid","name"],filter:`name eq '${(0,gt.odataLiteral)((u=r.name)!==null&&u!==void 0?u:"")}' and primaryentitytypecode eq '${(0,gt.odataLiteral)((c=r.entity)!==null&&c!==void 0?c:"")}'`,top:10})||[]).map(w=>({id:String(w.savedqueryvisualizationid),name:String(w.name)}));case"view":return(await(0,tn.queryRecords)(e,"savedquery",{select:["savedqueryid","name"],filter:`name eq '${(0,gt.odataLiteral)((d=r.name)!==null&&d!==void 0?d:"")}' and returnedtypecode eq '${(0,gt.odataLiteral)((p=r.entity)!==null&&p!==void 0?p:"")}'`,top:10})||[]).map(w=>({id:String(w.savedqueryid),name:String(w.name)}));case"webResource":return(await(0,tn.queryRecords)(e,"webresource",{select:["webresourceid","name"],filter:`name eq '${(0,gt.odataLiteral)((f=r.name)!==null&&f!==void 0?f:"")}'`,top:1})||[]).map(w=>({id:String(w.webresourceid),name:String(w.name)}));case"solution":return(await(0,tn.queryRecords)(e,"solution",{select:["solutionid","uniquename"],filter:`uniquename eq '${(0,gt.odataLiteral)((h=r.uniqueName)!==null&&h!==void 0?h:"")}'`,top:1})||[]).map(w=>({id:String(w.solutionid),name:String(w.uniquename)}));default:return[]}}Oa.resolveArtifact=nz;async function iz(e,t,r){var n,i,a,o,s;let l=(0,gt.odataLiteral)((n=r.name)!==null&&n!==void 0?n:""),u=(0,gt.odataLiteral)((i=r.entity)!==null&&i!==void 0?i:"");if(t==="command"){let h=await(0,tn.queryRecords)(e,"appaction",{select:["appactionid"],filter:`contextvalue eq '${(0,gt.odataLiteral)((a=r.entity)!==null&&a!==void 0?a:"")}'`,top:1});return h&&h.length?String(r.entity):null}let c=az(t,l,u,r),d=t!=="app",p=await(0,tn.queryRecords)(e,c.set,{select:[c.idField],filter:c.filter,top:d?2:1});if(d&&p&&p.length>1)throw new rz.AmbiguousArtifactError(t,(s=(o=r.name)!==null&&o!==void 0?o:r.uniqueName)!==null&&s!==void 0?s:"",p.length);let f=p&&p[0]&&p[0][c.idField];return f!=null?String(f):null}Oa.findArtifact=iz;function az(e,t,r,n){var i;switch(e){case"view":return{set:"savedquery",idField:"savedqueryid",filter:`returnedtypecode eq '${r}' and name eq '${t}'`};case"chart":return{set:"savedqueryvisualization",idField:"savedqueryvisualizationid",filter:`primaryentitytypecode eq '${r}' and name eq '${t}'`};case"form":return{set:"systemform",idField:"formid",filter:`objecttypecode eq '${r}' and name eq '${t}'`};case"app":return{set:"appmodule",idField:"appmoduleid",filter:`uniquename eq '${(0,gt.odataLiteral)((i=n.uniqueName)!==null&&i!==void 0?i:"")}'`};case"dashboard":return{set:"systemform",idField:"formid",filter:`name eq '${t}' and type eq 0`};default:throw new Error(`Unsupported findable kind: ${e}`)}}});var d1=g(tc=>{"use strict";Object.defineProperty(tc,"__esModule",{value:!0});tc.seedRecordGraph=void 0;var c1=el(),oz=Hs(),ec=ee(),sz=ie();async function lz(e,t,r={}){var n,i,a,o,s;let l=(n=r.createdIds)!==null&&n!==void 0?n:{},u=(i=r.entitySetFor)!==null&&i!==void 0?i:(p=>(0,oz.resolveEntitySetName)(e,p)),c={},d=p=>{var f;return(f=c[p])!==null&&f!==void 0?f:l[p]};for(let p of t){let f=p.entityLogical.toLowerCase(),h=(a=p.matchOn)===null||a===void 0?void 0:a.toLowerCase(),y=[];for(let V of p.records){let M={...V.body};for(let U of(o=V.binds)!==null&&o!==void 0?o:[]){let B=U.parentEntity.toLowerCase(),z=(s=d(B))===null||s===void 0?void 0:s[U.parentIndex];if(!z)throw new sz.InvalidArgumentError(`Cannot resolve bind '${U.navProperty}' on a '${f}' record: parent '${U.parentEntity}'[${U.parentIndex}] has no created id. Seed the parent group before the child, or supply it via options.createdIds.`);let $=(0,ec.assertODataName)(await u(B),`entity set for parent '${U.parentEntity}'`),Ee=(0,ec.normalizeGuid)(z,`parent id for bind '${U.navProperty}'`);M[`${U.navProperty}@odata.bind`]=`/${$}(${Ee})`}y.push(M)}let w=h?y.map(V=>{let M=V[h];return M!=null&&M!==""?String(M):null}):y.map(()=>null),N=new Map;if(h){let V=(0,ec.assertODataName)(h,"RecordGraph matchOn key"),M=[...new Set(w.filter(U=>U!==null))];if(M.length){let U=M.map(z=>`${V} eq '${(0,ec.odataLiteral)(z)}'`).join(" or "),B=await(0,c1.queryRecords)(e,f,{select:[V,`${f}id`],filter:U,top:5e3});for(let z of B??[]){let $=z[V];$!=null&&N.set(String($).toLowerCase(),String(z[`${f}id`]))}}}let D=[],x=new Map,F=y.map((V,M)=>{let U=w[M];if(U&&N.has(U.toLowerCase()))return null;if(U){let B=U.toLowerCase(),z=x.get(B);if(z!==void 0)return z;let $=D.push(V)-1;return x.set(B,$),$}return D.push(V)-1}),X=D.length?await(0,c1.createRecordsBulk)(e,f,D):[];c[f]=y.map((V,M)=>{let U=w[M];return U&&N.has(U.toLowerCase())?N.get(U.toLowerCase()):X[F[M]]})}return{createdIds:c}}tc.seedRecordGraph=lz});var A1=g(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.getEntityPrivileges=ut.addEntityPrivilegesToRole=ut.deleteSecurityRole=ut.createPersonaRole=ut.createSecurityRole=ut.SDK_ROLE_MARKER=void 0;var lr=be(),Ke=ee(),xt=ie(),rc={read:"Read",create:"Create",write:"Write",delete:"Delete",append:"Append",appendTo:"AppendTo",assign:"Assign",share:"Share"},sh={user:"Basic",businessUnit:"Local",parentChild:"Deep",organization:"Global"},p1={user:1,businessUnit:2,parentChild:3,organization:4},oh={user:"CanBeBasic",businessUnit:"CanBeLocal",parentChild:"CanBeDeep",organization:"CanBeGlobal"};ut.SDK_ROLE_MARKER="Authored by @maker-studio/cds-maker-sdk (persona/security role).";function uz(e){return Object.prototype.hasOwnProperty.call(rc,e)?rc[e]:void 0}function cz(e){return Object.prototype.hasOwnProperty.call(sh,e)}var f1=new WeakMap,m1=new WeakMap;async function v1(e,t){var r,n;(0,Ke.assertODataName)(t,"entity logical name");let i=f1.get(e);i||(i=new Map,f1.set(e,i));let a=i.get(t);if(a)return a;let o=`/EntityDefinitions(LogicalName='${(0,Ke.odataPathLiteral)(t)}')${(0,Ke.odataQuery)([["$select","LogicalName,Privileges"]])}`,l=(n=(r=(0,lr.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||r===void 0?void 0:r.Privileges)!==null&&n!==void 0?n:[];if(l.length===0)throw new xt.InvalidArgumentError(`Entity '${t}' exposes no privileges (unknown or non-securable entity).`);return i.set(t,l),l}async function dz(e){var t,r,n;let i=m1.get(e);if(i)return i;let a=`/businessunits${(0,Ke.odataQuery)([["$select","businessunitid"],["$filter","_parentbusinessunitid_value eq null"],["$top",1]])}`,l=(n=((r=(t=(0,lr.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||t===void 0?void 0:t.value)!==null&&r!==void 0?r:[])[0])===null||n===void 0?void 0:n.businessunitid;if(!l)throw new xt.InvalidArgumentError("Could not resolve the root business unit.");let u=(0,Ke.normalizeGuid)(l,"businessUnitId");return m1.set(e,u),u}async function y1(e,t){var r;let n=new Map;for(let i of t){if(!i.access||i.access.length===0)throw new xt.InvalidArgumentError(`Entity '${i.entity}' privilege request has no access levels.`);let a=(r=i.scope)!==null&&r!==void 0?r:"user";if(!cz(a))throw new xt.InvalidArgumentError(`Unknown privilege scope '${a}' for entity '${i.entity}'.`);let o=await v1(e,i.entity);for(let s of i.access){let l=uz(s);if(!l)throw new xt.InvalidArgumentError(`Unknown access level '${s}' for entity '${i.entity}'.`);let u=o.find(h=>h.PrivilegeType===l);if(!u)throw new xt.InvalidArgumentError(`Entity '${i.entity}' does not support '${s}' access.`);let c=oh[a];if(u[c]===!1)throw new xt.InvalidArgumentError(`Privilege '${u.Name}' on '${i.entity}' does not support the '${a}' scope.`);let d=(0,Ke.normalizeGuid)(u.PrivilegeId,"PrivilegeId"),p=n.get(d);if(!p){n.set(d,{privilegeName:u.Name,privilegeType:l,scope:a,entities:new Set([i.entity])});continue}if(p.scope===a){p.entities.add(i.entity);continue}if(!(p.entities.size===1&&p.entities.has(i.entity))){let h=[...p.entities].sort().join(", ");throw new xt.InvalidArgumentError(`Entities '${h}' and '${i.entity}' share the Dataverse privilege '${u.Name}' but request different scopes; a role holds one depth per privilege. Use the same scope for all entities that share this privilege, or split them.`)}p.scope=p1[a]>p1[p.scope]?a:p.scope}}return[...n.entries()].map(([i,a])=>({entity:[...a.entities].sort().join(", "),privilegeId:i,privilegeName:a.privilegeName,privilegeType:a.privilegeType,scope:a.scope}))}async function pz(e,t,r,n){if(r.length===0&&!n)return;let i={Privileges:r.map(o=>({Depth:sh[o.scope],PrivilegeId:o.privilegeId}))},a=`/roles(${t})/Microsoft.Dynamics.CRM.ReplacePrivilegesRole`;(0,lr.ensureSuccess)(await e.post(a,i),e.apiUrl(a))}async function h1(e,t,r,n,i){var a,o;let s=`/${t}(${r})/${n}${(0,Ke.odataQuery)([["$select","roleid"],["$filter",`roleid eq ${i}`]])}`;return((o=(a=(0,lr.ensureSuccess)(await e.get(s),e.apiUrl(s)).body)===null||a===void 0?void 0:a.value)!==null&&o!==void 0?o:[]).length>0}async function fz(e,t,r){var n,i;let a=[],o=[],s={"@odata.id":e.apiUrl(`/roles(${t})`)};for(let l of(n=r?.teams)!==null&&n!==void 0?n:[]){let u=(0,Ke.normalizeGuid)(l,"teamId");if(!await h1(e,"teams",u,"teamroles_association",t)){let c=`/teams(${u})/teamroles_association/$ref`;(0,lr.ensureSuccess)(await e.post(c,s),e.apiUrl(c))}a.push(u)}for(let l of(i=r?.users)!==null&&i!==void 0?i:[]){let u=(0,Ke.normalizeGuid)(l,"userId");if(!await h1(e,"systemusers",u,"systemuserroles_association",t)){let c=`/systemusers(${u})/systemuserroles_association/$ref`;(0,lr.ensureSuccess)(await e.post(c,s),e.apiUrl(c))}o.push(u)}return{teams:a,users:o}}async function g1(e,t,r){var n,i;let a=`/roles${(0,Ke.odataQuery)([["$select","roleid,description,ismanaged"],["$filter",`name eq '${(0,Ke.odataLiteral)(t)}' and _businessunitid_value eq ${r}`]])}`,l=((i=(n=(0,lr.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[]).filter(d=>!!d.roleid);if(l.length===0)return;let u=d=>{var p;return d.ismanaged!==!0&&((p=d.description)!==null&&p!==void 0?p:"")===ut.SDK_ROLE_MARKER};if(l.some(d=>!u(d)))throw new xt.InvalidArgumentError(`A role named '${t}' already exists in this business unit and was not created by the SDK; refusing to modify or assign it. Choose a different persona/role name.`);if(l.length>1)throw new xt.InvalidArgumentError(`Multiple (${l.length}) SDK-owned roles named '${t}' exist in this business unit; refusing to reuse one arbitrarily. Remove the duplicate role(s) and retry.`);let c=l[0].roleid;return c?(0,Ke.normalizeGuid)(c,"roleId"):void 0}function mz(e){var t,r;return{teams:((t=e?.teams)!==null&&t!==void 0?t:[]).map(n=>(0,Ke.normalizeGuid)(n,"teamId")),users:((r=e?.users)!==null&&r!==void 0?r:[]).map(n=>(0,Ke.normalizeGuid)(n,"userId"))}}function b1(e){return e.map(t=>({entity:t.entity,privilegeName:t.privilegeName,privilegeType:t.privilegeType,scope:t.scope}))}async function w1(e,t){var r,n;let i=(r=t.name)===null||r===void 0?void 0:r.trim();if(!i)throw new xt.InvalidArgumentError("createSecurityRole: a non-empty role name is required.");let a=t.businessUnitId?(0,Ke.normalizeGuid)(t.businessUnitId,"businessUnitId"):await dz(e),o=await y1(e,(n=t.privileges)!==null&&n!==void 0?n:[]),s=mz(t.assignTo),l=await g1(e,i,a),u=l!==void 0;if(!l){let d="/roles",p={name:i,description:ut.SDK_ROLE_MARKER,"[email protected]":`/businessunits(${a})`};try{let f=(0,lr.ensureSuccess)(await e.post(d,p),e.apiUrl(d));l=(0,Ke.normalizeGuid)((0,lr.requireCreatedId)(f,"roleid","role"),"roleId")}catch(f){let h;try{h=await g1(e,i,a)}catch{h=void 0}if(!h)throw f;l=h}}await pz(e,l,o,u);let c=await fz(e,l,s);return{roleId:l,name:i,reused:u,appliedPrivileges:b1(o),assignedTeams:c.teams,assignedUsers:c.users}}ut.createSecurityRole=w1;async function hz(e,t){var r,n;let i=(r=t.persona)===null||r===void 0?void 0:r.trim();if(!i)throw new xt.InvalidArgumentError("createPersonaRole: a non-empty persona name is required.");let a=[...t.jobs.flatMap(o=>{var s;return(s=o.privileges)!==null&&s!==void 0?s:[]}),...(n=t.additionalPrivileges)!==null&&n!==void 0?n:[]];return w1(e,{name:i,businessUnitId:t.businessUnitId,privileges:a,assignTo:t.assignTo})}ut.createPersonaRole=hz;async function gz(e,t){let n=`/roles(${(0,Ke.normalizeGuid)(t,"roleId")})`;(0,lr.ensureSuccess)(await e.delete(n),e.apiUrl(n))}ut.deleteSecurityRole=gz;async function vz(e,t,r){let n=(0,Ke.normalizeGuid)(t,"roleId");if(r.length===0)throw new xt.InvalidArgumentError("addEntityPrivilegesToRole requires at least one entity privilege (an empty grant would be a silent no-op).");let i=await y1(e,r),a={Privileges:i.map(s=>({Depth:sh[s.scope],PrivilegeId:s.privilegeId}))},o=`/roles(${n})/Microsoft.Dynamics.CRM.AddPrivilegesRole`;return(0,lr.ensureSuccess)(await e.post(o,a),e.apiUrl(o)),b1(i)}ut.addEntityPrivilegesToRole=vz;var yz=new Map(Object.keys(rc).map(e=>[rc[e],e]));async function bz(e,t){return(await v1(e,t)).map(n=>{let i=Object.keys(oh).filter(o=>n[oh[o]]!==!1),a=yz.get(n.PrivilegeType);return{name:n.Name,privilegeId:n.PrivilegeId,privilegeType:n.PrivilegeType,...a?{access:a}:{},scopes:i}})}ut.getEntityPrivileges=bz});var I1=g(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.createMakerSdk=Or.MakerSdk=Or.ALREADY_EXISTS_CODE=void 0;var C1=Dc(),wz=wd(),ce=ie(),rn=ks(),Az=vv(),S1=wv(),Cz=Dv(),Sz=Wv(),lh=jv(),Ye=Hs(),E1=qd(),nn=el(),nc=Cy(),Ra=rl(),Ez=il(),ct=Py(),Nz=Xd(),Dz=Z_(),Iz=In(),_z=bt(),Pz=Ni(),Ln=vd(),N1=Nd(),Tz=3e5,Tr=be(),kn=ee(),Fa=l1(),D1=u1(),Oz=d1(),Rz=pm(),cs=A1();Or.ALREADY_EXISTS_CODE="ARTIFACT_ALREADY_EXISTS";var ac=class{constructor(t){var r,n;this.artifactLocks=new Map,(0,Iz.installDomShim)(),this.languageCode=(r=t.languageCode)!==null&&r!==void 0?r:Pz.DEFAULT_LCID,this.cacheStalenessMs=(n=t.cacheStalenessMs)!==null&&n!==void 0?n:Tz,this.workspace=new S1.WorkspaceManager(t.workspacePath,t.instanceUrl),this.versions=new Cz.VersionManager(this.workspace),this.dataverse=new Sz.DataverseClient(t.instanceUrl,t.httpClient,t.solutionUniqueName),this.registrations=(0,Dz.buildRegistrations)(this.languageCode)}initWorkspace(){this.workspace.init()}getManifest(){return this.workspace.getManifest()}cleanWorkspace(){this.workspace.clean()}withArtifactLock(t,r,n){var i;let a=`${t}\0${(0,S1.canonicalArtifactId)(r)}`,s=((i=this.artifactLocks.get(a))!==null&&i!==void 0?i:Promise.resolve()).then(n,n),l=s.then(()=>{},()=>{});return this.artifactLocks.set(a,l),l.then(()=>{this.artifactLocks.get(a)===l&&this.artifactLocks.delete(a)}),s}async fetchArtifact(t,r,n){return this.withArtifactLock(t,r,()=>this.fetchArtifactUnlocked(t,r,n))}async fetchArtifactUnlocked(t,r,n){var i,a;let o=this.requireRegistration(t,"fetchArtifact"),{raw:s,etag:l,memberEtags:u,siblingEtags:c}=await o.api.get(this.dataverse,r),d=o.adapter.fromApiResponse(s);if(!n?.overwrite&&this.versions.isDirty(t,r)){let p=(a=(i=this.versions.getMeta(t,r))===null||i===void 0?void 0:i.etag)!==null&&a!==void 0?a:null;if(p&&l&&p!==l)throw new ce.LocalEditsWouldBeLostError(t,r,p,l);let f=this.workspace.readArtifact(t,r);if(f){let h=this.versions.getMeta(t,r);if(h&&!h.etag&&l){if(!(0,N1.deepEqual)(h.snapshot,d))throw new ce.LocalEditsWouldBeLostError(t,r,p,l);this.versions.storeMeta(t,r,{...h,etag:l,fetchedAt:(0,Tr.nowIso)()})}return(0,Ln.cloneJson)(f)}}return this.workspace.writeArtifact(t,r,d),this.versions.storeMeta(t,r,{etag:l,languageCode:this.languageCode,fetchedAt:(0,Tr.nowIso)(),snapshot:(0,Ln.cloneJson)(d),...u?{memberEtags:u}:{},...c?{siblingEtags:c}:{}}),(0,Ln.cloneJson)(d)}async fetchArtifactList(t,r){return this.requireRegistration(t,"fetchArtifactList").api.list(this.dataverse,r)}async fetchSolution(t){var r;let n=await(0,ct.fetchSolutionComponents)(this.dataverse,t),i=[],a=[];for(let o of n)try{let s=await this.resolveComponentType(o);if(!s){a.push({componentId:o.objectId,componentType:o.componentType,workflowCategory:o.workflowCategory,reason:"unsupported"});continue}let l=await this.fetchArtifact(s,o.objectId);i.push({type:s,id:o.objectId,name:typeof l.name=="string"?l.name:(r=o.displayName)!==null&&r!==void 0?r:o.objectId,entityLogicalName:typeof l.entityLogicalName=="string"?l.entityLogicalName:void 0,lastFetched:(0,Tr.nowIso)(),isDirty:!1})}catch(s){a.push({componentId:o.objectId,componentType:o.componentType,workflowCategory:o.workflowCategory,reason:"failed",error:ic(s)})}return this.workspace.updateManifest({lastSyncAt:(0,Tr.nowIso)()}),{summaries:i,skipped:a}}async fetchEntityMetadata(t){let r=await(0,lh.fetchEntityMetadataFromApi)(this.dataverse,t);return this.workspace.writeEntityMetadata(t,r),r}findTables(t,r){return(0,lh.findTables)(this.dataverse,t,r)}findColumns(t,r,n){return(0,lh.findColumns)(this.dataverse,t,r,n)}createTable(t){return(0,Ye.createTable)(this.dataverse,t)}createColumn(t,r){return(0,Ye.createColumn)(this.dataverse,t,r)}createColumns(t,r){return(0,Ye.createColumns)(this.dataverse,t,r)}updateColumn(t,r,n){return(0,Ye.updateColumn)(this.dataverse,t,r,n)}deleteColumn(t,r){return(0,Ye.deleteColumn)(this.dataverse,t,r)}setFormSecurityRoles(t,r){return(0,E1.setFormSecurityRoles)(this.dataverse,t,r)}getFormSecurityRoles(t){return(0,E1.getFormSecurityRoles)(this.dataverse,t)}validateBusinessRule(t,r){return new wz.BusinessRuleAdapter().semanticIssues(t,r)}setColumnVisualization(t,r,n){return(0,Ye.setColumnVisualization)(this.dataverse,t,r,n)}getColumnVisualization(t,r){return(0,Ye.getColumnVisualization)(this.dataverse,t,r)}createCustomerColumn(t,r){return(0,Ye.createCustomerColumn)(this.dataverse,t,r)}insertStatusValue(t,r){return(0,Ye.insertStatusValue)(this.dataverse,t,r)}updateTable(t,r){return(0,Ye.updateTable)(this.dataverse,t,r)}async setEntityIcon(t,r){if(await(0,Ye.updateTable)(this.dataverse,t,{iconVectorName:r.vector,iconSmallName:r.small,iconMediumName:r.medium,iconLargeName:r.large}),r.publish!==!1){let n=`<importexportxml><entities><entity>${(0,kn.xmlText)(t)}</entity></entities></importexportxml>`;(0,Tr.ensureSuccess)(await this.dataverse.post("/PublishXml",{ParameterXml:n}),this.dataverse.apiUrl("/PublishXml"))}}createAlternateKey(t,r){return(0,Ye.createAlternateKey)(this.dataverse,t,r)}deleteAlternateKey(t,r){return(0,Ye.deleteAlternateKey)(this.dataverse,t,r)}createRelationship(t){return(0,Ye.createRelationship)(this.dataverse,t)}deleteRelationship(t){return(0,Ye.deleteRelationship)(this.dataverse,t)}createGlobalOptionSet(t){return(0,Ye.createGlobalOptionSet)(this.dataverse,t)}deleteGlobalOptionSet(t){return(0,Ye.deleteGlobalOptionSet)(this.dataverse,t)}deleteTable(t){return(0,Ye.deleteTable)(this.dataverse,t)}createSecurityRole(t){return(0,cs.createSecurityRole)(this.dataverse,t)}createPersonaRole(t){return(0,cs.createPersonaRole)(this.dataverse,t)}deleteSecurityRole(t){return(0,cs.deleteSecurityRole)(this.dataverse,t)}addEntityPrivilegesToRole(t,r){return(0,cs.addEntityPrivilegesToRole)(this.dataverse,t,r)}getEntityPrivileges(t){return(0,cs.getEntityPrivileges)(this.dataverse,t)}createRecord(t,r){return(0,nn.createRecord)(this.dataverse,t,r)}createRecordsBulk(t,r){return(0,nn.createRecordsBulk)(this.dataverse,t,r)}updateRecord(t,r,n){return(0,nn.updateRecord)(this.dataverse,t,r,n)}upsertRecord(t,r,n){return(0,nn.upsertRecord)(this.dataverse,t,r,n)}deleteRecord(t,r){return(0,nn.deleteRecord)(this.dataverse,t,r)}getRecord(t,r,n){return(0,nn.getRecord)(this.dataverse,t,r,n)}queryRecords(t,r){return(0,nn.queryRecords)(this.dataverse,t,r)}seedRecordGraph(t,r){return(0,Oz.seedRecordGraph)(this.dataverse,t,r)}resolveArtifact(t,r){return(0,D1.resolveArtifact)(this.dataverse,t,r)}findArtifact(t,r){return(0,D1.findArtifact)(this.dataverse,t,r)}async deleteAppCascade(t,r){let n=await(0,Nz.deleteAppCascade)(this.dataverse,t,r),i=(0,kn.normalizeGuid)(t,"appModuleId");return this.workspace.readArtifact("app",i)&&this.workspace.deleteArtifact("app",i),n}associateRecords(t,r,n){return(0,nn.associateRecords)(this.dataverse,t,r,n)}disassociateRecords(t,r,n,i){return(0,nn.disassociateRecords)(this.dataverse,t,r,n,i)}createWebResource(t){return(0,nc.createWebResource)(this.dataverse,t)}updateWebResource(t,r){return(0,nc.updateWebResource)(this.dataverse,t,r)}getWebResource(t){return(0,nc.getWebResource)(this.dataverse,t)}deleteWebResource(t){return(0,nc.deleteWebResource)(this.dataverse,t)}getAppSettings(t){return(0,Ra.readAppSettings)(this.dataverse,t)}setAppSetting(t,r,n){return(0,Ra.setAppSetting)(this.dataverse,t,r,n)}setHeaderAndNavigationRefresh(t,r){if(typeof r!="boolean")throw new ce.ValidationError("app",t,[{pointer:"/headerAndNavigationRefresh",rule:Ez.HEADER_NAV_BOOLEAN_RULE,message:`enabled must be a boolean, got ${typeof r}`}]);return(0,Ra.setAppSetting)(this.dataverse,t,Ra.HEADER_AND_NAVIGATION_REFRESH,r?Ra.APP_SETTING_ON:Ra.APP_SETTING_OFF)}getSolution(t){return(0,ct.getSolution)(this.dataverse,t)}createPublisher(t){return(0,ct.createPublisher)(this.dataverse,t)}createSolution(t){return(0,ct.createSolution)(this.dataverse,t)}setSolutionVersion(t,r){return(0,ct.setSolutionVersion)(this.dataverse,t,r)}addSolutionComponent(t){return(0,ct.addSolutionComponent)(this.dataverse,t)}removeSolutionComponent(t,r,n){return(0,ct.removeSolutionComponent)(this.dataverse,t,r,n)}exportSolution(t){return(0,ct.exportSolution)(this.dataverse,t)}importSolution(t){return(0,ct.importSolution)(this.dataverse,t)}deleteSolution(t){return(0,ct.deleteSolution)(this.dataverse,t)}async getArtifact(t,r){return this.withArtifactLock(t,r,()=>this.getArtifactUnlocked(t,r))}async getArtifactUnlocked(t,r){return(0,Ln.cloneJson)(await this.readRaw(t,r))}async readRaw(t,r){return await this.revalidateIfStale(t,r),this.readLocal(t,r)}async readForMutation(t,r,n){if(await this.revalidateIfStale(t,r)==="refreshed-changed")throw new ce.StaleArtifactError(t,r,n);return this.readLocal(t,r)}readLocal(t,r){let n=this.workspace.readArtifact(t,r);if(!n)throw new ce.ArtifactNotFoundError(t,r);return n}async revalidateIfStale(t,r){let n=this.versions.getMeta(t,r);if(!n)return"skipped";let i=n.fetchedAt?Date.parse(n.fetchedAt):NaN,a=Date.now()-i;if(!Number.isNaN(i)&&this.cacheStalenessMs>0&&a<=this.cacheStalenessMs)return"fresh";if(this.versions.isDirty(t,r))return"skipped";let o=this.workspace.readArtifact(t,r);await this.fetchArtifactUnlocked(t,r);let s=this.workspace.readArtifact(t,r);return(0,N1.deepEqual)(o,s)?"refreshed-unchanged":"refreshed-changed"}async queryTree(t,r,n){return this.withArtifactLock(t,r,async()=>{let i=await this.getArtifactUnlocked(t,r),a=rn.JsonPointer.resolve(i,n);if(a===void 0)throw new ce.PathNotFoundError(t,r,n);return a})}async findElements(t,r,n){return this.withArtifactLock(t,r,async()=>(0,Az.findElements)(await this.getArtifactUnlocked(t,r),n))}listArtifacts(t,r){return this.workspace.listArtifacts(t,r).map(n=>({...n,isDirty:this.versions.isDirty(n.type,n.id)}))}getEntityMetadata(t){let r=this.workspace.readEntityMetadata(t);if(!r)throw new ce.ArtifactNotFoundError("entityMetadata",t);return r}getFieldMetadata(t,r){let i=this.getEntityMetadata(t).attributes.find(a=>a.logicalName===r);if(!i)throw new ce.PathNotFoundError("entityMetadata",t,r);return i}async updateElement(t,r,n,i){return this.withArtifactLock(t,r,async()=>{let a=await this.readForMutation(t,r,n),o=rn.JsonPointer.resolve(a,n);if(o===void 0)throw new ce.PathNotFoundError(t,r,n);let s=oc(o)&&oc(i)?{...o,...i}:i;return rn.JsonPointer.set(a,n,(0,Ln.cloneJson)(s)),this.assertStructurallyValid(t,r,a,n),this.workspace.writeArtifact(t,r,a),this.getArtifactUnlocked(t,r)})}async addElement(t,r,n,i,a){return this.withArtifactLock(t,r,async()=>{let o=await this.readForMutation(t,r,n),s=rn.JsonPointer.resolve(o,n);if(s===void 0)throw new ce.PathNotFoundError(t,r,n);if(!Array.isArray(s))throw new ce.ValidationError(t,r,n,"parent must be an array");let l=this.assignMissingIds(t,(0,Ln.cloneJson)(i)),u=Lz(s,a?.position);return s.splice(u,0,l),this.assertStructurallyValid(t,r,o,n),this.workspace.writeArtifact(t,r,o),this.getArtifactUnlocked(t,r)})}async moveElement(t,r,n,i,a){return this.withArtifactLock(t,r,async()=>{var o;let s=await this.readForMutation(t,r,n),l=rn.JsonPointer.resolve(s,n);if(l===void 0)throw new ce.PathNotFoundError(t,r,n);let u=rn.JsonPointer.resolve(s,i);if(u===void 0)throw new ce.PathNotFoundError(t,r,i);if(!Array.isArray(u))throw new ce.ValidationError(t,r,i,"move target must be an array");if(i===n||i.startsWith(`${n}/`))throw new ce.ValidationError(t,r,i,"cannot move an element into its own subtree");rn.JsonPointer.remove(s,n);let c=(o=a?.index)!==null&&o!==void 0?o:u.length;return u.splice(Math.max(0,Math.min(c,u.length)),0,l),this.assertStructurallyValid(t,r,s,i),this.workspace.writeArtifact(t,r,s),this.getArtifactUnlocked(t,r)})}async removeElement(t,r,n){return this.withArtifactLock(t,r,async()=>{let i=await this.readForMutation(t,r,n);if(rn.JsonPointer.resolve(i,n)===void 0)throw new ce.PathNotFoundError(t,r,n);return rn.JsonPointer.remove(i,n),this.assertStructurallyValid(t,r,i,xz(n)),this.workspace.writeArtifact(t,r,i),this.getArtifactUnlocked(t,r)})}assertStructurallyValid(t,r,n,i){var a,o,s;let l=this.registrations.get(t),u=(s=(o=l==null?void 0:(a=l.adapter).validate)===null||o===void 0?void 0:o.call(a,n,i))!==null&&s!==void 0?s:[];if(u.length>0)throw new ce.ValidationError(t,r,u)}retrieveSetting(t,r){return(0,Fa.retrieveSetting)(this.dataverse,t,r)}saveSettingValue(t,r,n){return(0,Fa.saveSettingValue)(this.dataverse,t,r,n)}getAiReadiness(t){return(0,Fa.getAiReadiness)(this.dataverse,t)}setAppAiFeatures(t,r,n){return(0,Fa.setAppAiFeatures)(this.dataverse,t,r,n)}configureRowSummary(t,r){return(0,Fa.configureRowSummary)(this.dataverse,t,r)}removeRowSummary(t){return(0,Fa.removeRowSummary)(this.dataverse,t)}async enrichDefaultViews(t,r,n={}){let i=await(0,Rz.findDefaultViews)(this.dataverse,t,n);for(let a of i)await this.fetchArtifact("view",a.id),await this.updateElement("view",a.id,"/columns",r),await this.pushArtifact("view",a.id);return i.length&&await this.publishArtifact("view",i[0].id),{updated:i.map(a=>a.id)}}createArtifact(t,r){let n=this.requireRegistration(t,"createArtifact"),i=n.adapter.assignMissingIds(n.adapter.createDefault(r)),a=i.id;if(!a)throw new ce.ValidationError(t,"(new)","/id","created artifact must have an id");return this.workspace.writeArtifact(t,a,i),(0,Ln.cloneJson)(i)}deleteArtifact(t,r){this.workspace.deleteArtifact(t,r)}async deleteRemoteArtifact(t,r){return this.withArtifactLock(t,r,async()=>{await this.requireRegistration(t,"deleteRemoteArtifact").api.delete(this.dataverse,r),this.workspace.readArtifact(t,r)&&this.workspace.deleteArtifact(t,r)})}async publishArtifact(t,r,n){return this.withArtifactLock(t,r,()=>this.publishArtifactUnlocked(t,r,n))}async publishArtifactUnlocked(t,r,n){var i;let a=await this.readRaw(t,r),o=this.registrations.get(t);if(!o?.publish)return{type:t,id:r,shipped:!1,publish:{kind:"notApplicable"}};let s=(i=o.publishScope)===null||i===void 0?void 0:i.call(o,r,a);try{await o.publish(this.dataverse,r,a)}catch(u){return{type:t,id:r,shipped:!1,publish:{kind:"failed",error:ic(u)},...s?{publishScope:s}:{}}}if(!n?.verify)return{type:t,id:r,shipped:!1,publish:{kind:"submitted"},...s?{publishScope:s}:{}};let l=await this.verifyPublished(t,r);return{type:t,id:r,shipped:l.kind==="verified",publish:l,...s?{publishScope:s}:{}}}async verifyPublished(t,r){if(t!=="app")return{kind:"unverifiable",reason:`published-projection verification is not characterised for '${t}'; the publish was submitted`};try{let n=`/appmodules(${(0,kn.normalizeGuid)(r,"id")})${(0,kn.odataQuery)([["$select","appmoduleid"]])}`,i=await this.dataverse.get(n);return i.status>=200&&i.status<300?{kind:"verified"}:{kind:"unverifiable",reason:`the published projection answered HTTP ${i.status}`}}catch(n){return{kind:"unverifiable",reason:ic(n).message}}}async pushArtifact(t,r){return this.withArtifactLock(t,r,()=>this.pushArtifactUnlocked(t,r))}async pushArtifactUnlocked(t,r){var n,i,a,o,s,l;let u=this.requireRegistration(t,"pushArtifact"),c=this.readLocal(t,r),d=this.versions.getMeta(t,r);this.assertLanguageMatches(t,r,d,u);let p=await this.buildMetadataContext(u.adapter,c),f=u.adapter.toApiPayload(c,d?.snapshot,p);try{let h=d?await u.api.update(this.dataverse,r,f,d.etag,d.memberEtags,d.siblingEtags):await this.createWithMintedId(u,t,r,f),y=r;return d||(h.serverIdentity&&u.adapter.applyServerIdentity&&u.adapter.applyServerIdentity(c,h.serverIdentity),h.id&&h.id!==r&&(c.id=h.id,this.workspace.deleteArtifact(t,r),y=h.id),this.workspace.writeArtifact(t,y,c)),this.versions.storeMeta(t,y,{etag:h.etag,languageCode:this.languageCode,fetchedAt:(0,Tr.nowIso)(),snapshot:(0,Ln.cloneJson)(c),...h.memberEtags?{memberEtags:h.memberEtags}:{},...h.siblingEtags?{siblingEtags:h.siblingEtags}:{}}),{type:t,id:y,saved:!0,shipped:!1,publish:(n=h.publish)!==null&&n!==void 0?n:{kind:"notRequested"},...h.publish&&h.publish.kind!=="notRequested"?(()=>{var w;let N=(w=u.publishScope)===null||w===void 0?void 0:w.call(u,y,c);return N?{publishScope:N}:{}})():{},...h.warnings&&h.warnings.length>0?{warnings:h.warnings}:{}}}catch(h){let y=(0,ce.readPartialTokens)(h);if(y&&d){let w={...(i=d.memberEtags)!==null&&i!==void 0?i:{},...(a=y.memberEtags)!==null&&a!==void 0?a:{}},N={...(o=d.siblingEtags)!==null&&o!==void 0?o:{},...(s=y.siblingEtags)!==null&&s!==void 0?s:{}};this.versions.storeMeta(t,r,{...d,...Object.keys(w).length>0?{memberEtags:w}:{},...Object.keys(N).length>0?{siblingEtags:N}:{}})}if(h instanceof ce.SdkError&&h.code===Or.ALREADY_EXISTS_CODE)return{type:t,id:r,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:h};if(h instanceof ce.SdkError&&h.code===C1.WFOM_API_UNAVAILABLE_CODE)return{type:t,id:r,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:h};if(h instanceof ce.SdkError&&h.code===C1.BUSINESS_RULE_LEFT_DEACTIVATED_CODE)return{type:t,id:r,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:h};if(h instanceof ce.SdkError&&h.code===Tr.VERSION_CONFLICT_CODE)return{type:t,id:r,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:new ce.VersionConflictError(t,r,(l=d?.etag)!==null&&l!==void 0?l:null,null,h.message)};throw h}}assertLanguageMatches(t,r,n,i){if(i?.languageSensitive&&!(n?.languageCode===void 0||n.languageCode===this.languageCode))throw new ce.SdkError("ARTIFACT_LANGUAGE_MISMATCH",`Refusing to push ${t} '${r}': it was fetched with languageCode ${n.languageCode} but this SDK is configured with ${this.languageCode}. Pushing would rewrite labels read in one language as labels in another. Re-fetch with languageCode ${this.languageCode}, or create the SDK with languageCode ${n.languageCode}.`)}async createWithMintedId(t,r,n,i){try{return await t.api.create(this.dataverse,i,n)}catch(a){throw!(a instanceof ce.SdkError)||a.code!==Tr.VERSION_CONFLICT_CODE?a:new ce.SdkError(Or.ALREADY_EXISTS_CODE,`Cannot create ${r} '${n}': a record already exists at that id, so an earlier push of this artifact committed before its local version metadata was saved. No duplicate was created. Run fetchArtifact('${r}', '${n}') to adopt the existing record's identity, etag and snapshot, then push again \u2014 that push will be a conditional update. This is not done automatically because the only recovery available here would be an UNCONDITIONAL overwrite, which would destroy any edit made to the record in the meantime.`)}}async buildMetadataContext(t,r){var n,i;let a=(i=(n=t.metadataNeeds)===null||n===void 0?void 0:n.call(t,r))!==null&&i!==void 0?i:[];if(a.length===0)return;let o=new Set(a.map(s=>s.entityLogicalName).filter(s=>!!s));for(let s of o)if(!this.workspace.readEntityMetadata(s))try{await this.fetchEntityMetadata(s)}catch{}return{resolveField:(s,l)=>{let u=this.workspace.readEntityMetadata(s),c=u?.attributes.find(d=>d.logicalName===l);return c?{displayName:c.displayName,attributeType:c.attributeType}:void 0}}}async pushAll(){let t=this.getDirtyArtifacts(),r=[];for(let n of t)try{r.push(await this.pushArtifact(n.type,n.id))}catch(i){r.push({type:n.type,id:n.id,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:ic(i)})}return r}getDirtyArtifacts(){return this.workspace.listArtifacts().filter(t=>this.versions.isDirty(t.type,t.id)).map(t=>({...t,isDirty:!0}))}diffArtifact(t,r){return this.versions.diff(t,r)}assignMissingIds(t,r){let n=this.registrations.get(t);return n?n.adapter.assignMissingIds(r):(0,_z.assignMissingIds)(r)}async resolveComponentType(t){switch(t.componentType){case ct.SolutionComponentType.SavedQuery:return"view";case ct.SolutionComponentType.SavedQueryVisualization:return"chart";case ct.SolutionComponentType.AppModule:return"app";case ct.SolutionComponentType.UxAgentProject:return"genPage";case ct.SolutionComponentType.Workflow:return t.workflowCategory===2?"businessRule":t.workflowCategory===4&&await this.isBusinessFlowWorkflow(t.objectId)?"bpf":void 0;case ct.SolutionComponentType.SystemForm:return await this.isDashboardForm(t.objectId)?"dashboard":"form";default:return}}async isDashboardForm(t){let n=`/systemforms(${(0,kn.normalizeGuid)(t,"formId")})${(0,kn.odataQuery)([["$select","type"]])}`,i=(0,Tr.ensureSuccess)(await this.dataverse.get(n),this.dataverse.apiUrl(n)),a=Number(i.body.type);return a===0||a===10}async isBusinessFlowWorkflow(t){let n=`/workflows(${(0,kn.normalizeGuid)(t,"workflowId")})${(0,kn.odataQuery)([["$select","businessprocesstype"]])}`,i=(0,Tr.ensureSuccess)(await this.dataverse.get(n),this.dataverse.apiUrl(n));return Number(i.body.businessprocesstype)===0}requireRegistration(t,r){let n=this.registrations.get(t);if(!n)throw new ce.NotImplementedError(r,`no adapter registered for artifact type '${t}'`);return n}};Or.MakerSdk=ac;function Fz(e){return new ac(e)}Or.createMakerSdk=Fz;function ic(e){return e instanceof Error?e:new Error(String(e))}function oc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function xz(e){let t=e.lastIndexOf("/");return t<=0?"":e.slice(0,t)}function Lz(e,t){if(t===void 0||t==="end")return e.length;if(t==="start")return 0;if("index"in t)return Math.max(0,Math.min(t.index,e.length));if("before"in t){let n=e.findIndex(i=>oc(i)&&i.id===t.before);return n<0?e.length:n}let r=e.findIndex(n=>oc(n)&&n.id===t.after);return r<0?e.length:r+1}});var _1=g(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});sc.ARTIFACT_TYPES=void 0;sc.ARTIFACT_TYPES=["form","view","businessRule","app","command","chart","dashboard","genPage","bpf"]});var T1=g(P1=>{"use strict";Object.defineProperty(P1,"__esModule",{value:!0})});var R1=g(O1=>{"use strict";Object.defineProperty(O1,"__esModule",{value:!0})});var x1=g(F1=>{"use strict";Object.defineProperty(F1,"__esModule",{value:!0})});var k1=g(L1=>{"use strict";Object.defineProperty(L1,"__esModule",{value:!0})});var U1=g(M1=>{"use strict";Object.defineProperty(M1,"__esModule",{value:!0})});var $1=g(B1=>{"use strict";Object.defineProperty(B1,"__esModule",{value:!0})});var V1=g(q1=>{"use strict";Object.defineProperty(q1,"__esModule",{value:!0})});var z1=g(G1=>{"use strict";Object.defineProperty(G1,"__esModule",{value:!0})});var j1=g(W1=>{"use strict";Object.defineProperty(W1,"__esModule",{value:!0})});var Q1=g(H1=>{"use strict";Object.defineProperty(H1,"__esModule",{value:!0})});var X1=g(J1=>{"use strict";Object.defineProperty(J1,"__esModule",{value:!0})});var Y1=g(K1=>{"use strict";Object.defineProperty(K1,"__esModule",{value:!0})});var eP=g(Z1=>{"use strict";Object.defineProperty(Z1,"__esModule",{value:!0})});var rP=g(tP=>{"use strict";Object.defineProperty(tP,"__esModule",{value:!0})});var iP=g(nP=>{"use strict";Object.defineProperty(nP,"__esModule",{value:!0})});var oP=g(aP=>{"use strict";Object.defineProperty(aP,"__esModule",{value:!0})});var lP=g(sP=>{"use strict";Object.defineProperty(sP,"__esModule",{value:!0})});var cP=g(uP=>{"use strict";Object.defineProperty(uP,"__esModule",{value:!0})});var pP=g(dP=>{"use strict";Object.defineProperty(dP,"__esModule",{value:!0})});var kz=exports&&exports.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),_e=exports&&exports.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&kz(t,e,r)};Object.defineProperty(exports,"__esModule",{value:!0});exports.createMakerSdk=void 0;var Mz=I1();Object.defineProperty(exports,"createMakerSdk",{enumerable:!0,get:function(){return Mz.createMakerSdk}});_e(_1(),exports);_e(T1(),exports);_e(R1(),exports);_e(x1(),exports);_e(k1(),exports);_e(U1(),exports);_e($1(),exports);_e(V1(),exports);_e(z1(),exports);_e(j1(),exports);_e(Q1(),exports);_e(X1(),exports);_e(Y1(),exports);_e(il(),exports);_e(eP(),exports);_e(rP(),exports);_e(iP(),exports);_e(oP(),exports);_e(lP(),exports);_e(cP(),exports);_e(pP(),exports);_e(ie(),exports);
+`)}function Lv(e){this.options=e||{locator:{}}}Lv.prototype.parseFromString=function(e,t){var r=this.options,n=new qx,i=r.domBuilder||new mo,a=r.errorHandler,o=r.locator,s=r.xmlns||{},l=/\/x?html?$/.test(t),u=l?Pv.HTML_ENTITIES:Pv.XML_ENTITIES;o&&i.setDocumentLocator(o),n.errorHandler=Vx(a,i,o),n.domBuilder=r.domBuilder||i,l&&(s[""]=Ov.HTML),s.xml=s.xml||Ov.XML;var c=r.normalizeLineEndings||xv;return e&&typeof e=="string"?n.parse(c(e),s,u):n.errorHandler.error("invalid doc source"),i.doc};function Vx(e,t,r){if(!e){if(t instanceof mo)return t;e=t}var n={},i=e instanceof Function;r=r||{};function a(o){var s=e[o];!s&&i&&(s=e.length==2?function(l){e(o,l)}:e),n[o]=s&&function(l){s("[xmldom "+o+"] "+l+wd(r))}||function(){}}return a("warning"),a("error"),a("fatalError"),n}function mo(){this.cdata=!1}function Mi(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}mo.prototype={startDocument:function(){this.doc=new Ux().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,r,n){var i=this.doc,a=i.createElementNS(e,r||t),o=n.length;il(this,a),this.currentElement=a,this.locator&&Mi(this.locator,a);for(var s=0;s<o;s++){var e=n.getURI(s),l=n.getValue(s),r=n.getQName(s),u=i.createAttributeNS(e,r);this.locator&&Mi(n.getLocator(s),u),u.value=u.nodeValue=l,a.setAttributeNode(u)}},endElement:function(e,t,r){var n=this.currentElement,i=n.tagName;this.currentElement=n.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var r=this.doc.createProcessingInstruction(e,t);this.locator&&Mi(this.locator,r),il(this,r)},ignorableWhitespace:function(e,t,r){},characters:function(e,t,r){if(e=Rv.apply(this,arguments),e){if(this.cdata)var n=this.doc.createCDATASection(e);else var n=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(e)&&this.doc.appendChild(n),this.locator&&Mi(this.locator,n)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,r){e=Rv.apply(this,arguments);var n=this.doc.createComment(e);this.locator&&Mi(this.locator,n),il(this,n)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,r){var n=this.doc.implementation;if(n&&n.createDocumentType){var i=n.createDocumentType(e,t,r);this.locator&&Mi(this.locator,i),il(this,i),this.doc.doctype=i}},warning:function(e){console.warn("[xmldom warning] "+e,wd(this.locator))},error:function(e){console.error("[xmldom error] "+e,wd(this.locator))},fatalError:function(e){throw new $x(e,this.locator)}};function wd(e){if(e)return`
+@`+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function Rv(e,t,r){return typeof e=="string"?e.substr(t,r):e.length>=t+r||t?new java.lang.String(e,t,r)+"":e}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){mo.prototype[e]=function(){return null}});function il(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}al.__DOMHandler=mo;al.normalizeLineEndings=xv;al.DOMParser=Lv});var sl=g(ol=>{var Mv=vd();ol.DOMImplementation=Mv.DOMImplementation;ol.XMLSerializer=Mv.XMLSerializer;ol.DOMParser=kv().DOMParser});var id=g(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});Bi.deleteAppCascade=Bi.collectGenPageIds=void 0;var Gx=Qs(),zx=ne(),Ad=ie(),Wx=sl();function Bv(e){let t=[],r=s=>l=>t.push(`${s}: ${l}`),i=new Wx.DOMParser({errorHandler:{warning:r("warning"),error:r("error"),fatalError:r("fatalError")}}).parseFromString(e,"text/xml").documentElement;if(!i||t.length>0)throw new zx.InvalidArgumentError(`The app sitemap xml could not be parsed cleanly, so its generative-page children cannot be determined${t.length>0?` (${t[0]})`:""}`);let a=[],o=s=>{if(s.nodeName==="SubArea"){let u=s.getAttribute("GenPageId");u&&a.push((0,Ad.normalizeGuid)(u,"GenPageId"))}let l=s.childNodes;for(let u=0;u<l.length;u+=1){let c=l[u];c.nodeType===1&&o(c)}};return o(i),a}Bi.collectGenPageIds=Bv;async function Hx(e,t,r){let n=(0,Ad.normalizeGuid)(t,"appModuleId");(0,Ad.normalizeGuid)(r,"appModuleIdUnique");let i=[],a=[],o=[];await(0,Gx.deleteAppResolvingOnce)(e,n,l=>{l!==void 0&&o.push(...Bv(l))}),i.push({type:"app",id:n});let s=[...new Set(o)].map(l=>({type:"genPage",id:l}));return{success:a.length===0,deleted:i,failures:a,retained:s}}Bi.deleteAppCascade=Hx});var Uv={};Br(Uv,{Guid:()=>T});var T,Le=I(()=>{"use strict";T=class e{guidString;guid;static get EmptyGuid(){return new e("00000000-0000-0000-0000-000000000000")}static NewGuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var r=Math.random()*16|0,n=t=="x"?r:r&3|8;return n.toString(16)})}constructor(t,r=!1){this.guidString=t;let n=new RegExp("[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$");(r||n.test(t))&&(this.guid=t)}ToString(){return this.guid}}});var P,rt=I(()=>{"use strict";Fe();P=class e{static get EmptyString(){return""}static IsTrue(t){let r=!1;return r=t&&(this.IsStrictTrue(t)||this.IsYes(t)),r}static IsStrictTrue(t){let r=!1;return t&&(r=t.toLowerCase()==="true"),r}static IsYes(t){return t.toLowerCase()==="yes"||t.toLowerCase()==="y"}static get WhiteSpace(){return/ /g}static get EnglishAndNumericCharacters(){return/([a-z0-9A-Z]+)/g}static get ValidIdExpression(){return/([a-z0-9A-Z_]+)/g}static IsNullOrEmpty(t){return t==null||t==null||t==""}static Format(t,r){return e.IsNullOrEmpty(t)?t:t.replace(/\{\{|\}\}|\{(\d+)\}/g,function(n,i){return n=="{{"?"{":n=="}}"?"}":r[i]})}static EndsWithString(t,r){return t.indexOf(r,t.length-r.length)!==-1}static IsBlankString(t){return t.replace(/\s/g,"").length==0}static EscapeXml(t,r){let n=t;return this.IsNullOrEmpty(n)||(n=n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),r&&(n=n.replace(/"/g,"&quot;").replace(/'/g,"&apos;"))),n}static EscapeDomId(t){return t.replace(".","\\.")}static ToSnakeCase(t){let r=e.EmptyString;for(let n=0;n<t.length;n++)n!==0&&t[n]==t[n].toUpperCase()&&(r+="-"),r+=t[n].toLowerCase();return r}static GetSnakeCaseMarkup(t,r){let n="<"+this.ToSnakeCase(t);if(!N.IsNullOrUndefined(r))for(let i of r.getKeys())n+=" "+this.ToSnakeCase(i)+'="'+r.getValue(i)+'"';return n+">"}static StripBraces(t){return t&&t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?t.substr(1,t.length-2):t}static AddBraces(t){return N.IsNullOrUndefined(t)||t.charAt(0)==="{"||t.charAt(t.length-1)==="}"?t:`{${t}}`}static GuidStringEquals(t,r){return t===r?!0:!t||!r?!1:e.StripBraces(t).toUpperCase()===e.StripBraces(r).toUpperCase()}static AddBracesToArrayValues(t){return t.length>0?t.map(n=>(n.charAt(0)!=="{"&&(n="{"+n),n.charAt(n.length-1)!=="}"&&(n=n+"}"),n)):t}static StripBracesOnArrayValues(t){return t.length>0?t.map(n=>{let i;return n.charAt(0)==="{"&&(i=n.substr(1,n.length-1)),n.charAt(n.length-1)==="}"&&(i=i.substr(0,n.length-2)),i}):t}}});var $v={};Br($v,{ScriptUtilities:()=>N});var N,Fe=I(()=>{"use strict";Le();rt();N=class e{static IsNullOrUndefined(t){return t==null||t===void 0}static IsMacMachine(){return navigator.platform.indexOf("Mac")!==-1}static IsNullOrEmptyGuid(t){return P.IsNullOrEmpty(t.ToString())?!0:T.EmptyGuid.ToString()===t.ToString()}static IsNullOrUndefinedNested(t,r){return r.split(".").every(i=>typeof t!="object"||t==null||!(i in t)||t[i]==null?!1:(t=t[i],!0))}static ParseXml(t){return new DOMParser().parseFromString(t,"text/xml")}static IsWellFormedXml(t){return!e.ParseXml(t).querySelector("parsererror")}static getNamedItemValue(t,r){let n=t.getNamedItem(r);return e.IsNullOrUndefined(n)?null:n.value}static getBooleanValue(t,r){let n=e.getNamedItemValue(t,r);return e.IsNullOrUndefined(n)?null:P.IsTrue(n)}static getNumericValue(t){return e.IsNullOrUndefined(t)?null:parseInt(t)}static getAllUniqueTagNames(t){let r=new Set;return e.getAllUniqueTagNamesHelper(t,r),r}static getAllUniqueTagNamesHelper(t,r){if(t.nodeType===Node.ELEMENT_NODE&&(r.add(t.tagName),t.hasChildNodes()))for(let n=0;n<t.children.length;n++)this.getAllUniqueTagNamesHelper(t.children.item(n),r)}}});var ll,ul,Jn,cl,Cd,dl,Sd=I(()=>{"use strict";(function(e){e[e.FormElementNodeChange=0]="FormElementNodeChange",e[e.FormElementAttributeChange=1]="FormElementAttributeChange"})(ll||(ll={}));ul=class{type;targetNode;constructor(t,r){this.type=t,this.targetNode=r}},Jn=class extends ul{key;oldValue;newValue;constructor(t,r,n,i){super(ll.FormElementNodeChange,t),this.key=r,this.oldValue=n,this.newValue=i}apply(){this.targetNode.replaceObjectPropertyValue(this.key,this.newValue)}revert(){this.targetNode.replaceObjectPropertyValue(this.key,this.oldValue)}},cl=class extends ul{property;oldValue;newValue;constructor(t,r,n,i){super(ll.FormElementAttributeChange,t),this.property=r,this.oldValue=n,this.newValue=i}apply(){this.targetNode.replaceAttributeValue(this.property,this.newValue)}revert(){this.targetNode.replaceAttributeValue(this.property,this.oldValue)}},Cd=class{changeSet;reversedChangeSet;constructor(t){this.changeSet=t,this.changeSet&&(this.reversedChangeSet=this.changeSet.slice().reverse())}length(){return this.changeSet?this.changeSet.length:0}apply(){this.changeSet&&this.changeSet.length>0&&this.changeSet.forEach(t=>{t.apply()})}revert(){this.reversedChangeSet&&this.reversedChangeSet.length>0&&this.reversedChangeSet.forEach(t=>{t.revert()})}},dl=class{isTracking;_trackedChanges;_trackedChangeSets;constructor(t=!1){this.isTracking=t,this._trackedChanges=[],this._trackedChangeSets=[]}addChange(t){this.isTracking&&this._trackedChanges.push(t)}collectChanges(){let t=new Cd(this._trackedChanges.slice());return this._trackedChanges=[],t}pushChangeSet(t){this._trackedChangeSets.push(t)}popChangeSet(){if(this._trackedChangeSets?.length>0)return this._trackedChangeSets.pop()}getChangeSets(){return this._trackedChangeSets}}});var qv={};Br(qv,{ChartGridMode:()=>Vt,ColumnLayoutWidths:()=>Xx,ComponentCategory:()=>fl,ComponentType:()=>Ed,ControlLayoutTypes:()=>Od,DisplayConditionsInfo:()=>Jx,ElementNames:()=>y,ElementProperties:()=>m,ElementType:()=>Dd,EntityAttributeProperty:()=>Id,EventType:()=>ho,FormActivationState:()=>Pd,FormCanvasServiceScope:()=>uL,FormDesignerSideBarTab:()=>Nd,FormPresentation:()=>_d,FormState:()=>pl,FormType:()=>ke,HeaderDensityType:()=>Sn,LookUpTable:()=>Cr,MORE_TAB_PREFIX:()=>Zx,NavBarChildElementType:()=>Td,PREVIEW_ID_HEADER_FLYOUT:()=>nL,PREVIEW_ID_HEADER_OVERFLOW_BUTTON:()=>aL,PREVIEW_ID_NAVIGATION_AREA:()=>tL,PREVIEW_ID_QUICKCREATE_ROOT:()=>sL,PREVIEW_ID_TAB:()=>oL,PREVIEW_ID_TAB_LIST:()=>iL,PREVIEW_ID_TAB_PANEL:()=>rL,PropertyModelKeys:()=>xd,PropertyModelSectionKeys:()=>Yx,RELATED_TAB_ID:()=>Ld,RELATED_TAB_PREFIX:()=>eL,SectionDefaultProperties:()=>Kx,SectionLayoutTypes:()=>Se,TabContentType:()=>Rd,TabDefaultProperties:()=>En,TabLayoutTypes:()=>Ce,TelemetryPropertyNames:()=>lL,UnboundControlPropertyKeys:()=>Fd,compositeAddressFields:()=>Qx,compositeFieldNames:()=>Lt,compositeFields:()=>jx});var ke,Ed,Nd,y,m,Dd,Lt,jx,Qx,Id,Cr,pl,Sn,_d,Jx,Td,Pd,Ce,Kx,En,Se,Od,Rd,Xx,Fd,xd,Yx,ho,Vt,Ld,Zx,eL,tL,rL,nL,iL,aL,oL,sL,lL,fl,uL,X=I(()=>{"use strict";(function(e){e[e.Dashboard=0]="Dashboard",e[e.AppointmentBook=1]="AppointmentBook",e[e.Main=2]="Main",e[e.MiniCampaignBO=3]="MiniCampaignBO",e[e.Preview=4]="Preview",e[e.MobileExpress=5]="MobileExpress",e[e.QuickViewForm=6]="QuickViewForm",e[e.QuickCreate=7]="QuickCreate",e[e.Dialog=8]="Dialog",e[e.TaskFlowForm=9]="TaskFlowForm",e[e.InteractionCentricDashboard=10]="InteractionCentricDashboard",e[e.Card=11]="Card",e[e.MainInteractiveExperience=12]="MainInteractiveExperience",e[e.Other=100]="Other",e[e.MainBackup=101]="MainBackup",e[e.AppointmentBookBackup=102]="AppointmentBookBackup",e[e.PowerBIDashboard=103]="PowerBIDashboard"})(ke||(ke={}));(function(e){e[e.Form=0]="Form",e[e.Dialog=1]="Dialog"})(Ed||(Ed={}));(function(e){e[e.Components=0]="Components",e[e.Properties=1]="Properties",e[e.Relationship=2]="Relationship",e[e.BusinessRules=3]="BusinessRules"})(Nd||(Nd={}));(function(e){e.form="form",e.formTab="tab",e.formColumn="column",e.formSection="section",e.formRow="row",e.formCell="cell",e.formLabel="label",e.formControl="control",e.formEvent="event",e.dependency="dependency",e.queryStringParameter="querystringparameter",e.controlDescriptions="controlDescriptions",e.controlDescription="controlDescription",e.customControl="customControl",e.dataset="data-set",e.formFooter="footer",e.formHeader="header",e.formNavigation="Navigation",e.formTabs="tabs",e.formColumns="columns",e.formSections="sections",e.formRows="rows",e.formEvents="events",e.quickFormDependencies="externaldependencies",e.controlParameters="parameters",e.formDependencies="dependencies",e.formNavBarAreas="NavBarAreas",e.formNavBarArea="NavBarArea",e.formNavBar="NavBar",e.spacerControl="SpacerControl",e.formField="Field",e.formNavBarByRelationshipItem="NavBarByRelationshipItem",e.formNavBarItem="NavBarItem",e.Title="Title",e.Titles="Titles",e.NavigationLink="Navigation Link",e.Relationship="Relationship",e.NavigationLinkIconClass="mscrm-glyph-NavLinkIcon",e.formDisplayConditions="DisplayConditions",e.formLibraries="formLibraries",e.internalLibraries="internaljscriptfile",e.eventHandlers="Handlers",e.handler="Handler",e.library="Library",e.formRoles="Role",e.formEveryOne="Everyone",e.Handler="Handler",e.EventHandlers="Handlers",e.InternalEventHandlers="InternalHandlers",e.HiddenControl="hiddencontrols",e.EventDependencies="dependencies",e.EventDependency="dependency",e.isvisibleinmocaonly="msinternal.isvisibleinmocaonly"})(y||(y={}));m={ShowImage:"showImage",ShowNavigationbar:"shownavigationbar",MaxWidth:"maxWidth",HeaderDensityType:"headerdensity",OnLoadEvent:"onload",EventActive:"active",EventAttribute:"attribute",Relationship:"relationship",Control:"control",HandlerUniqueId:"handlerUniqueId",functionName:"functionName",libraryNameEventHandler:"libraryName",enabledForField:"enabled",passExecutionContext:"passExecutionContext",parameters:"parameters",eventFunctionName:"eventFunctionName",eventEnabled:"eventEnabled",indicationOfSubgrid:"indicationOfSubgrid",Name:"name",Type:"type",TitleResourceId:"TitleResourceId",Show:"Show",RelationshipName:"RelationshipName",Sequence:"Sequence",Area:"Area",headerPrefix:"header_",application:"application",labelId:"labelid",showbar:"showbar",layout:"layout",classid:"classid",uniqueid:"uniqueid",isUnbound:"isunbound",isRequired:"isrequired",rowspan:"rowspan",rowheight:"rowheight",colspan:"colspan",width:"width",IsUserDefined:"IsUserDefined",expanded:"expanded",related:"related",showlabel:"showlabel",locklevel:"locklevel",datafieldname:"datafieldname",formFactor:"formFactor",static:"static",disabled:"disabled",description:"description",languagecode:"languagecode",LCID:"LCID",groupName:"group",contentType:"contenttype",showCommandBar:"showcommandbar",showBody:"showbody",showTabNavigator:"showtabnavigator",userspacer:"userspacer",columnName:"columns",LabelWidth:"labelwidth",Fieldlabelalignment:"celllabelalignment",Fieldlabelposition:"celllabelposition",availableforphone:"availableforphone",Locked:"bLocked",ReadOnly:"bDisabled",visible:"visible",ForControl:"forControl",text:"Text",url:"Url",passParameters:"PassParameters",autoExpand:"AutoExpand",auto:"auto",Auto:"Auto",Fixed:"Fixed",icon:"Icon",id:"id",Id:"Id",showOnMobileClient:"ShowOnMobileClient",webResourceId:"WebResourceId",viewName:"ViewName",failureTimeField:"FailureTimeField",successCondition:"SuccessConditionName",successConditionValue:"SuccessConditionValue",failureCondition:"FailureConditionName",failureConditionValue:"FailureConditionValue",warningCondition:"WarningConditionName",warningConditionValue:"WarningConditionValue",cancelCondition:"CancelConditionName",cancelConditionValue:"CancelConditionValue",pauseCondition:"PauseConditionName",pauseConditionValue:"PauseConditionValue",filterResults:"FilterResults",autoSuggestionSource:"AutoSuggestionSource",numberOfResults:"NumberOfResults",addressField:"AddressField",displayAsCustomer360Tile:"DisplayAsCustomer360Tile",hideQuickFormBorder:"HideQuickFormBorder",quickForms:"QuickForms",entityName:"EntityName",controlMode:"ControlMode",headerColorCode:"HeaderColorCode",targetEntityType:"TargetEntityType",enableQuickFind:"EnableQuickFind",enableViewPicker:"EnableViewPicker",enableChartPicker:"EnableChartPicker",recordsPerPage:"RecordsPerPage",chartGridMode:"ChartGridMode",referencePanelSubgridIconUrl:"ReferencePanelSubgridIconUrl",referencePanelQuickFormCollectionIconUrl:"ReferencePanelQuickFormCollectionIconUrl",referencePanelSearchWidgetIconUrl:"ReferencePanelSearchWidgetIconUrl",viewId:"ViewId",isUserView:"IsUserView",enableJumpBar:"EnableJumpBar",isUserChart:"IsUserChart",viewIds:"ViewIds",filteredViewIds:"FilteredViewIds",visualizationId:"VisualizationId",teamTemplateId:"TeamTemplateId",selectDefaultLanguage:"SelectDefaultLanguage",allowChangingFiltersOnUI:"AllowChangingFiltersOnUI",enableAutoSuggestions:"EnableAutoSuggestions",enableRating:"EnableRating",searchForAutoSuggestionsUsing:"SearchForAutoSuggestionsUsing",showContextualActions:"ShowContextualActions",showDepartmentFilter:"ShowDepartmentFilter",showLanguageFilter:"ShowLanguageFilter",showRatingUsing:"ShowRatingUsing",actionList:"ActionList",Order:"Order",FallbackForm:"FallbackForm",allowSearchFilter:"allowSearchFilter",socialInstanceParameters:"<Parameters>k__BackingField",signalUrl:"SignalUrl",border:"Border",scrolling:"Scrolling",security:"Security",BingMapsAddress1Composite:"address1_composite",BingMapsAddress2Composite:"address2_composite",UrlHttpsProtocolPrefix:"https://",UrlHttpProtocolPrefix:"http://",showAll:"ShowAll",ShowFilterPane:"UClientShowFilterPane",ExpandFilterPane:"UClientExpandFilterPane",SortOption:"UClientOrderBy",DefaultModuleCreateExperience:"UClientDefaultModuleForCreateExperience",RecordPerPages:"UClientRecordPerPage",moduleList:"UClientModules",showAllModule:"Show All",showSelectedModule:"Show Selected",Ascending:"Ascending",Descending:"Descending",Activities:"Activities",Posts:"Posts",Notes:"Notes",CardForm:"CardForm",SelectActivity:"SelectActivity",DisplayActivity:"UClientDisplayActivityUsing",CreateActivity:"UClientCreateActivityUsing",DisplayActivityHeader:"UClientDisplayActivityHeaderUsing",SortTimeLine:"UClientSortActivitiesByValue",activityList:"UClientActivities",CardActivityMap:"UClientActivityCardMap",DefaultTabId:"DefaultTabId",EmailConversationView:"EmailConversationView",OrderByActivityWall:"OrderByActivityWall",ShowArticleTab:"ShowArticleTab",SortActivityWall:"SortActivityWall",TimelineUniqueName:"UClientUniqueName",SortTimeLineBy:"modifiedon",SelectActivityListDefault:"appointment",SelectCardDefault:"Select Card Form",AscendingValue:"ascending",DescendingValue:"descending",DefaultTabIdValue:"ActivitiesTab",EmailConversationViewDefault:"true",ShowArticleTabDefault:"false",SelectDefaultLanguage:"SelectDefaultLanguage",SelectDefaultLanguageValue:"00000000-0000-0000-0000-000000000000",SortActivityWallDefault:"modifiedon",RecordPerPagesDefault:"10",TimelineNameLabel:"Timeline",showSelectedActions:"Show Selected",defaultFormat:"defaultformat",fieldLabels:"fieldlabels",QuickCreateForm:"quickcreateform",QuickFormNameToIdXMLTempate:"<QuickFormId e,yname={0}>{1}</QuickFormId>",QuickFormIdListXMLTempate:"<QuickFormId,}</QuickFormIds>",AllowFilterOff:"AllowFilterOff",AutoResolve:"AutoResolve",DefaultViewId:"DefaultViewId",DependentAttributeName:"DependentAttributeName",DependentAttributeType:"DependentAttributeType",DisableMru:"DisableMru",UseMFDForCreate:"useMainFormDialogForCreate",UseMFDForEdit:"useMainFormDialogForEdit",DisableQuickFind:"DisableQuickFind",DisableViewPicker:"DisableViewPicker",FilterRelationshipName:"FilterRelationshipName",AvailableViewIds:"AvailableViewIds",MainForm:"mainform",DefaultsFields:"defaultfields",TimeLineCardForm:"cardform",libraryUniqueId:"libraryUniqueId",libraryName:"name",displayName:"displayName",OnChangeEvent:"onchange",ViewIdRAControlDefault:"{92AFD454-0F2E-4397-A1C8-05E37C6AD699}",TargetEntityTypeRAControlDefault:"actioncard",ChartGridModeRAControlDefault:"All",RecordsPerPageRAControlDefault:"4",RAControlDefaultValue:"false",RAcontrolDefaultHeaderColorCode:"#000000",DropdownSelectedDefaultValue:"1",selectPrimaryCustomer:"SelectPrimaryCustomer",bindAttribute:"BindAttribute"};(function(e){e[e.TAB=0]="TAB",e[e.SECTION=1]="SECTION",e[e.BASIC_CONTROL=2]="BASIC_CONTROL",e[e.HEADER=3]="HEADER",e[e.FOOTER=4]="FOOTER",e[e.UB_CONTROL=5]="UB_CONTROL",e[e.RELATIONSHIPITEM=6]="RELATIONSHIPITEM",e[e.RELATIONSHIPGROUP=7]="RELATIONSHIPGROUP",e[e.NAVIGATIONLINK=8]="NAVIGATIONLINK",e[e.FORMMODEL=9]="FORMMODEL",e[e.UNDEFINED=10]="UNDEFINED"})(Dd||(Dd={}));Lt={fullname:"fullname",yomifullname:"yomifullname",address1_composite:"address1_composite",address2_composite:"address2_composite",address3_composite:"address3_composite",billto:"billto_composite",shipto:"shipto_composite"},jx=[Lt.fullname,Lt.yomifullname,Lt.address1_composite,Lt.address2_composite,Lt.address3_composite,Lt.billto,Lt.shipto],Qx=[Lt.address1_composite,Lt.address2_composite,Lt.address3_composite,Lt.billto,Lt.shipto];(function(e){e[e.IsValidForForm=0]="IsValidForForm",e[e.IsValidForCreate=1]="IsValidForCreate"})(Id||(Id={}));(function(e){e[e.DependencyFieldTable=0]="DependencyFieldTable",e[e.LockedFieldTable=1]="LockedFieldTable"})(Cr||(Cr={}));(function(e){e[e.Published=0]="Published",e[e.Draft=1]="Draft",e[e.New=2]="New",e[e.SaveAs=3]="SaveAs"})(pl||(pl={}));(function(e){e.Low="Low",e.HighReadOnlyValues="HighReadOnlyValues",e.HighWithControls="HighWithControls"})(Sn||(Sn={}));(function(e){e[e.ClassicForm=0]="ClassicForm",e[e.AirForm=1]="AirForm",e[e.ConvertedICForm=2]="ConvertedICForm"})(_d||(_d={}));Jx={TopOrderFormId:"topOrderFormId",NextDisplayOrder:"nextDisplayOrder"};(function(e){e[e.NavBarRelationShipItem=0]="NavBarRelationShipItem",e[e.NavBarItem=1]="NavBarItem"})(Td||(Td={}));(function(e){e[e.InActive=0]="InActive",e[e.Active=1]="Active"})(Pd||(Pd={}));(function(e){e[e.ONE_COLUMN=0]="ONE_COLUMN",e[e.TWO_COLUMN_EQUAL=1]="TWO_COLUMN_EQUAL",e[e.TWO_COLUMN_WIDER_LEFT=2]="TWO_COLUMN_WIDER_LEFT",e[e.TWO_COLUMN_WIDER_RIGHT=3]="TWO_COLUMN_WIDER_RIGHT",e[e.TWO_COLUMN_CUSTOM_LAYOUT=4]="TWO_COLUMN_CUSTOM_LAYOUT",e[e.THREE_COLUMN_EQUAL=5]="THREE_COLUMN_EQUAL",e[e.THREE_COLUMN_WIDER_MID=6]="THREE_COLUMN_WIDER_MID",e[e.THREE_COLUMN_CUSTOM_LAYOUT=7]="THREE_COLUMN_CUSTOM_LAYOUT"})(Ce||(Ce={}));Kx={ShowLabel:"false",LockLevel:"0",IsUserDefined:"0",LabelWidth:"115",columns:"1",ShowBar:"false",Layout:"varwidth",namePrefix:"_section_"},En={namePrefix:"tab_",ShowLabel:"true",LockLevel:"0",IsUserDefined:"0"};(function(e){e[e.ONE_COLUMN=0]="ONE_COLUMN",e[e.TWO_COLUMN=1]="TWO_COLUMN",e[e.THREE_COLUMN=2]="THREE_COLUMN",e[e.FOUR_COLUMN=3]="FOUR_COLUMN",e[e.REFERENCE_PANEL=4]="REFERENCE_PANEL"})(Se||(Se={}));(function(e){e[e.SUBGRID=0]="SUBGRID",e[e.SPACER=1]="SPACER",e[e.QUICK_VIEW=2]="QUICK_VIEW",e[e.WEB_RESOURCE=3]="WEB_RESOURCE",e[e.IFRAME=4]="IFRAME",e[e.BING_MAPS=5]="BING_MAPS",e[e.TIMER=6]="TIMER",e[e.TIMELINE=7]="TIMELINE",e[e.NOTES=8]="NOTES",e[e.SOCIAL_INSIGHTS=9]="SOCIAL_INSIGHTS",e[e.KB_SEARCH=10]="KB_SEARCH",e[e.INTERACTION_WALL=11]="INTERACTION_WALL",e[e.ACI_CONTROL=12]="ACI_CONTROL",e[e.RELATIONSHIP_ASSISTANT=13]="RELATIONSHIP_ASSISTANT",e[e.REFERENCE_PANEL=14]="REFERENCE_PANEL",e[e.REF_PANEL_QUICKVIEW=15]="REF_PANEL_QUICKVIEW",e[e.REF_PANEL_SUBGRID=16]="REF_PANEL_SUBGRID",e[e.REF_PANEL_KBSEARCH=17]="REF_PANEL_KBSEARCH",e[e.WEB_RESOURCE_HTML=18]="WEB_RESOURCE_HTML",e[e.PRED_LEAD_SCORING=19]="PRED_LEAD_SCORING"})(Od||(Od={}));(function(e){e.cardSections="cardSections",e.singleComponent="singleComponent",e.default="default",e.expandAvailableSpace="expandAvailableSpace"})(Rd||(Rd={}));Xx={ONE_COLUMN:"100",TWO_COLUMN:"50",THREE_COLUMN:"33.33",FOUR_COLUMN:"25"};(function(e){e.minValue="MinValue",e.maxValue="MaxValue",e.precision="Precision",e.maxLength="MaxLength",e.entityLogicalName="EntityLogicalName",e.defaultViewId="DefaultViewId",e.optionSetDefaultValue="DefaultValue",e.optionSetId="OptionSetId"})(Fd||(Fd={}));(function(e){e.entityName="entityName",e.formName="formName",e.formDisplayName="formDisplayName",e.description="description",e.maxWidth="maxWidth",e.showNavigation="showNavigation",e.showImageCheck="showImageCheck",e.downloadFormXml="downloadFormXml",e.downloadRawFormXml="downloadRawFormXml",e.expandTab="expandTab",e.singleComponent="singleComponent",e.label="label",e.name="name",e.hiddenByDefault="hiddenByDefault",e.hideForPhone="hideForPhone",e.tabLayout="tabLayout",e.column1Width="column1Width",e.column2Width="column2Width",e.column3Width="column3Width",e.hideLabel="hideLabel",e.lockElement="lockElement",e.sectionLayout="sectionLayout",e.labelWidth="labelWidth",e.fieldLabelAlignment="fieldLabelAlignment",e.fieldLabelPosition="fieldLabelPosition",e.cellWidth="cellWidth",e.fieldHeight="fieldHeight",e.cellHeight="cellHeight",e.showLine="showLine",e.readonly="readonly",e.required="required",e.maxLength="maxLength",e.isTitle="isTitle",e.minValue="minValue",e.maxValue="maxValue",e.precision="precision",e.autoExpand="autoExpand",e.highDensityEnabled="highDensityEnabled",e.hideExtendedHeader="hideExtendedHeader",e.defaultViewProperty="defaultViewProperty",e.defaultChartProperty="defaultChartProperty",e.teamTemplateProperty="teamTemplateProperty",e.datasourceProperty="datasourceProperty",e.eventType="eventType",e.addEvent="addEvent",e.cellOnChange="cellOnChange",e.cellOnChangeEventDependencies="cellOnChangeEventDependencies",e.cellOnChangeHandlers="cellOnChangeHandlers",e.gridOnChange="gridOnChange",e.gridOnChangeEventDependencies="gridOnChangeEventDependencies",e.gridOnChangeHandlers="gridOnChangeHandlers",e.gridOnChangeTargetField="gridOnChangeTargetField",e.gridOnRecordSelect="gridOnRecordSelect",e.gridOnRecordSelectEventDependencies="gridOnRecordSelectEventDependencies",e.gridOnRecordSelectHandlers="gridOnRecordSelectHandlers",e.cellOnReadyStateEventDependencies="cellOnReadyStateEventDependencies",e.cellOnReadyStateHandlers="cellOnReadyStateEventHandlers",e.tabOnChange="tabOnChange",e.tabOnChangeEventDependencies="tabOnChangeEventDependencies",e.tabOnChangeHandlers="tabOnChangeHandlers",e.formOnLoad="formOnLoad",e.formOnLoadEventDependencies="formOnLoadEventDependencies",e.formOnLoadHandlers="formOnLoadHandlers",e.formOnSave="formOnSave",e.formOnSaveDependencies="formOnSaveDependencies",e.formOnSaveHandlers="formOnSaveHandlers",e.gridOnSave="gridOnSave",e.gridOnSaveDependencies="gridOnSaveDependencies",e.gridOnSaveHandlers="gridOnSaveHandlers",e.formHasNoLibraries="formHasNoLibraries",e.hideHeaderCommandBar="hideHeaderCommandBar",e.hideHeaderBody="hideHeaderBody",e.hideHeaderTabNavigator="hideHeaderTabNavigator",e.hideFooter="hideFooter",e.scrollingDropdown="scrollingDropdown",e.displayBorder="displayBorder",e.crossScripting="crossScripting",e.passParams="passParams",e.webResourceCustomParamData="webResourceCustomParameterData",e.webResourceAltText="webResourceAltText",e.verticalAlignment="verticalAlignment",e.horizontalAlignment="horizontalAlignment",e.specificSize="specificSize",e.urlProperty="urlProperty",e.enableViewPicker="enableViewPicker",e.enableChartPicker="enableChartPicker",e.chartGridMode="chartGridMode",e.relatedRecords="relatedRecords",e.hideSearchBox="hideSearchBox",e.showAllViews="showAllViews",e.availableViewsProperty="availableViewsProperty",e.recordsPerPage="recordsPerPage",e.businessRulePill="business-rule-pill-",e.addBusinessRule="addBusinessRule",e.rowHeight="rowHeight",e.refPanelSectionTabs="refPanelSectionTabs",e.editCanvasAppProperty="editCanvasAppProperty"})(xd||(xd={}));Yx={display:"DisplayOptions",format:"Formatting",control:"Controls",data:"DataOptions",form:"FormProperties",events:"EventProperties",activeBusinessRules:"activeBusinessRules",addBusinessRule:"addBusinessRule",inactiveBusinessRules:"inactiveBusinessRules"};(function(e){e.onChange="onchange",e.onTabStateChange="tabstatechange",e.onLoad="onload",e.onSave="onsave",e.onReadyStateComplete="onreadystatecomplete",e.onRecordSelect="onrecordselect"})(ho||(ho={}));(function(e){e.All="All",e.Chart="Chart",e.Grid="Grid"})(Vt||(Vt={}));Ld="tab_related3b554255-7717-4d17-bb7f-9936fb1e75ca",Zx="more_tab_",eL="related_tab_",tL="preview_id_navigation_area",rL="tab-section",nL="headerFieldsFlyout",iL="tablist",aL="header_overflowButton",oL="tab",sL="quickCreateRoot",lL={defaultVisibility:"Default visibility"};(function(e){e.input="input",e.layout="layout",e.grid="grid",e.relatedData="relatedData",e.display="display",e.powerbi="powerbi",e.artificialIntelligence="artificialIntelligence",e.media="media",e.collaboration="collaboration",e.more="more",e.test="test",e.popular="popular"})(fl||(fl={}));uL="CellCanvasServiceScope"});var Vv={};Br(Vv,{Attribute:()=>ml,FormElementNode:()=>W});var ml,W,We=I(()=>{"use strict";Fe();rt();Sd();X();Le();ml=class{key;value;constructor(t,r){this.key=t,this.value=r}},W=class e{nodeName;properties;childrenNodes;parentNode;nodeId;isTransient;constructor(t,r){this.nodeName=t,this.properties=[],this.childrenNodes=[],this.parentNode=r,this.isTransient=!1,this.nodeId=`nodeId-${T.NewGuid()}`}getProperty(t){for(let r of this.properties)if(r.key===t)return r.value;return null}getNodeId(){return this.nodeId}getNodeName(){return this.nodeName}setNodeName(t){this.trackObjectPropertyChange("nodeName",t)}get NodeName(){return this.getNodeName()}getAllProperties(){return this.properties}replaceAttributeValue(t,r){this.properties.find(n=>n===t)&&(t.value=r)}replaceObjectPropertyValue(t,r){this[t]=r}getAllChildren(){return this.childrenNodes}getParentNode(){return this.parentNode}visit(t){let r=!1;if(t){r=!!t(this);let n=this.childrenNodes;if(!r&&n)for(let i=0;!r&&i<n.length;i++)r=n[i].visit(t)}return r}findAll(t){let r=[];return t&&this.visit(n=>{t(n)&&r.push(n)}),r}findFirst(t){let r=null;return t&&this.visit(n=>{if(t(n))return r=n,!0}),r}raiseMetadataChange(t){let r=this.getAncestor(y.form);r&&r.raiseMetadataChange(t)}trackPropertyAddition(t,r){this.trackPropertyCollectionChange(()=>{this.properties.push(new ml(t,r))})}trackPropertyDeletion(t){this.trackPropertyCollectionChange(()=>{let r=this.properties.findIndex(n=>n.key===t);r>-1&&this.properties.splice(r,1)})}trackPropertyCollectionChange(t){let r=this.changeTracker();if(r&&r.isTracking){let n=this.properties.slice();t(),r.addChange(new Jn(this,"properties",n,this.properties.slice()))}else t()}trackChildrenCollectionChange(t){let r=this.changeTracker();if(r&&r.isTracking){let n=this.childrenNodes.slice();t(),r.addChange(new Jn(this,"childrenNodes",n,this.childrenNodes.slice()))}else t()}trackParentNodeChange(t){let r=this.changeTracker();if(r&&r.isTracking){let n=this.parentNode;if(t(),n===this.parentNode)return;r.addChange(new Jn(this,"parentNode",n,this.parentNode))}else t()}trackAttributeValueChange(t,r){let n=this.changeTracker();if(n&&n.isTracking){let i=t.value;if(i===r)return;t.value=r,n.addChange(new cl(this,t,i,r))}else t.value=r}trackObjectPropertyChange(t,r){let n=this.changeTracker();if(n&&n.isTracking){let i=this[t];if(i===r)return;this[t]=r,n.addChange(new Jn(this,t,i,r))}else this[t]=r}setProperty(t,r){if(!t)throw new Error("Invalid property key");let n=this.properties.find(i=>i.key===t);n?this.trackAttributeValueChange(n,r):this.addProperty(t,r)}addProperty(t,r){if(!t)throw new Error("Invalid property key");this.trackPropertyAddition(t,r)}removeProperty(t){this.trackPropertyDeletion(t)}addChild(t){t.trackParentNodeChange(()=>{t.parentNode=this}),this.trackChildrenCollectionChange(()=>{this.childrenNodes.push(t)})}insertChildAtIndex(t,r){N.IsNullOrUndefined(t)||(t.trackParentNodeChange(()=>{t.parentNode=this}),this.trackChildrenCollectionChange(()=>{this.childrenNodes.splice(r,0,t)}))}moveChild(t,r){let n=this.childrenNodes.indexOf(t);if(n<0)return!1;let i=Math.min(Math.max(0,n+r),this.childrenNodes.length-1);return n!==i&&this.trackChildrenCollectionChange(()=>{this.childrenNodes.splice(i,0,this.childrenNodes.splice(n,1)[0])}),!0}getChildren(t){let r=[];for(let n of this.childrenNodes)n.nodeName===t&&r.push(n);return r}getFirstChild(t){for(let r of this.childrenNodes)if(r.nodeName===t)return r;return null}getAllGrandChildren(t){let r=this.getChildren(t),n=null;return r.length===0?new Array:(n=r[0],n.childrenNodes)}deleteChild(t){if(N.IsNullOrUndefined(t))return-1;for(let r=0;r<this.childrenNodes.length;r++)if(this.childrenNodes[r]===t)return this.trackChildrenCollectionChange(()=>{this.childrenNodes.splice(r,1)}),r;return-1}deleteAllChildren(){this.trackChildrenCollectionChange(()=>{this.childrenNodes=[]})}getParent(){return this.parentNode}getParentType(){return this.parentNode?this.parentNode.nodeName:P.EmptyString}updateChild(t,r){let n=this.childrenNodes.indexOf(t);return n>-1?(r.trackParentNodeChange(()=>{r.parentNode=this}),this.trackChildrenCollectionChange(()=>{this.childrenNodes.splice(n,1,r)}),!0):!1}getAncestor(t){let r=this.getParent(),n=this.getParentType();for(;r;){if(n===t)return r;n=r.getParentType(),r=r.getParent()}return null}deleteFirstGrandChildOfName(t,r){return this.getChildren(t)[0].deleteChild(r)}deleteChildren(t,r){r=N.IsNullOrUndefined(r)?this.childrenNodes.length:r,this.trackChildrenCollectionChange(()=>{this.childrenNodes.splice(t,r)})}deleteGrandChildren(t,r,n){this.getChildren(t)[0].deleteChildren(r,n)}addGrandChild(t,r){let n=this.getChildren(t),i=null;n.length===0?(i=new e(t,this),this.addChild(i)):i=n[0],i.addChild(r)}addGrandChildAtIndex(t,r,n){let i=this.getChildren(t),a=null;i.length===0?(a=new e(t,this),this.addChild(a)):a=i[0],a.insertChildAtIndex(r,n)}GetPropertyByParameter(t){return this.getProperty(t)}getSemanticParent(){switch(this.getNodeName()){case y.formCell:let t=this.getAncestor(y.formSection);return t||(t=this.getAncestor(y.formHeader),t)||(t=this.getAncestor(y.formFooter),t)?t:null;case y.formSection:return this.getAncestor(y.formTab);case y.formTab:return this.getAncestor(y.form);default:return null}}isDirty(){return this.visit(t=>t.isInChangeSet())}isInChangeSet(){return this.changeTracker().getChangeSets().some(r=>r.changeSet.some(n=>n.targetNode.getNodeId()===this.getNodeId()))}changeTracker(){let t=this.getAncestor(y.form);return t?t.changeTracker():null}}});var Gv={};Br(Gv,{ControlClassId:()=>S,ControlNamePrefixes:()=>hl,getControlDisplayNames:()=>cL});function cL(e){return{[S.AccessPrivilegeControl]:e("controls.controlNames.accessPrivilege"),[S.AccessTeamTablePickerControl]:e("controls.controlNames.accessTeamTablePicker"),[S.ACIControl]:e("controls.controlNames.aci"),[S.ActivitiesContainerControl]:e("controls.controlNames.activitiesContainer"),[S.ActivitiesWallControl]:e("controls.controlNames.activitiesWall"),[S.AppliedFiltersControl]:e("controls.controlNames.appliedFilters"),[S.ArticleContentControl]:e("controls.controlNames.articleContent"),[S.BooleanControl]:e("controls.controlNames.twoOption"),[S.ButtonControl]:e("controls.controlNames.button"),[S.CheckboxControl]:e("controls.controlNames.checkbox"),[S.CompositionLinkControl]:e("controls.controlNames.compositionLink"),[S.ConnectionControl]:e("controls.controlNames.connection"),[S.ConnectionRoleObjectTypeListControl]:e("controls.controlNames.connectionRoleObjectTypeList"),[S.CoverageChoiceControl]:e("controls.controlNames.coverageChoice"),[S.DashboardControl]:e("controls.controlNames.dashboard"),[S.DynamicPropertyListControl]:e("controls.controlNames.dynamicPropertyList"),[S.EditFilterControl]:e("controls.controlNames.editFilter"),[S.ErrorStatusControl]:e("controls.controlNames.errorStatus"),[S.GlobalFilterControl]:e("controls.controlNames.globalFilter"),[S.HiddenInputControl]:e("controls.controlNames.hiddenInput"),[S.KBViewerControl]:e("controls.controlNames.kbViewer"),[S.LabelControl]:e("controls.controlNames.label"),[S.MailMergeLanguagePickerControl]:e("controls.controlNames.mailMergeLanguagePicker"),[S.MapLinkControl]:e("controls.controlNames.mapLink"),[S.OrgInsightsControl]:e("controls.controlNames.orgInsights"),[S.ChoiceLookupControl]:e("controls.controlNames.choiceLookup"),[S.PowerBIControl]:e("controls.controlNames.powerBI"),[S.ProcessControl]:e("controls.controlNames.process"),[S.RelatedInformationControl]:e("controls.controlNames.relatedInformation"),[S.RelationshipRoleChoiceControl]:e("controls.controlNames.relationshipRoleChoice"),[S.ReportControl]:e("controls.controlNames.report"),[S.StreamsControl]:e("controls.controlNames.streams"),[S.WebResourceSilverlightControl]:e("controls.controlNames.webResourceSilverlight"),[S.CurrencyControl]:e("controls.controlNames.currency"),[S.DateTimeControl]:e("controls.controlNames.dateAndTime"),[S.DecimalControl]:e("controls.controlNames.decimal"),[S.DurationControl]:e("controls.controlNames.duration"),[S.EmailAddressControl]:e("controls.controlNames.email"),[S.FileControl]:e("controls.controlNames.file"),[S.FloatingNumberControl]:e("controls.controlNames.floatingNumber"),[S.IframeControl]:e("controls.controlNames.iframe"),[S.ImageControl]:e("controls.controlNames.image"),[S.LookupControl]:e("controls.controlNames.lookup"),[S.MapsControl]:e("controls.controlNames.maps"),[S.PhoneNumberControl]:e("controls.controlNames.phoneNumber"),[S.ChoiceControl]:e("controls.controlNames.choice"),[S.QuickViewControl]:e("controls.controlNames.quickView"),[S.QuickFormControl]:e("controls.controlNames.quickForm"),[S.CustomControl]:e("controls.controlNames.customControl"),[S.SearchWidgetControl]:e("controls.controlNames.searchWidget"),[S.SocialInsightsControl]:e("controls.controlNames.socialInsights"),[S.SubgridControl]:e("controls.controlNames.subgrid"),[S.TextAreaControl]:e("controls.controlNames.textArea"),[S.TextboxControl]:e("controls.controlNames.textBox"),[S.TickerControl]:e("controls.controlNames.ticker"),[S.UrlControl]:e("controls.controlNames.url"),[S.WebResourceHTMLControl]:e("controls.controlNames.webResourceHTML"),[S.WebResourceImageControl]:e("controls.controlNames.webResourceImage"),[S.IntegerControl]:e("controls.controlNames.integer"),[S.TimerControl]:e("controls.controlNames.timer"),[S.TimelineControl]:e("controls.controlNames.timeline"),[S.EmailBodyControl]:e("controls.controlNames.emailBody"),[S.PartyListControl]:e("controls.controlNames.partyList"),[S.TimezoneControl]:e("controls.controlNames.timezone"),[S.LanguageControl]:e("controls.controlNames.language"),[S.ChoiceStatusControl]:e("controls.controlNames.choiceStatus"),[S.ChoicesControl]:e("controls.controlNames.choices"),[S.RegardingControl]:e("controls.controlNames.regarding"),[S.EmailEngagementActionsControl]:e("controls.controlNames.emailEngagementActions"),[S.EmailRecipientActivityControl]:e("controls.controlNames.emailRecipientActivity"),[S.ReferencePanelSearchWidgetControl]:e("controls.controlNames.referencePanelSearchWidget"),[S.ReferencePanelQuickViewControl]:e("controls.controlNames.referencePanelQuickView"),[S.ReferencePanelSubgridControl]:e("controls.controlNames.referencePanelSubgrid"),[S.KBEditorControl]:e("controls.controlNames.KBEditor"),[S.LinkControl]:e("controls.controlNames.link")}}var S,hl,Kn=I(()=>{"use strict";(function(e){e.AccessPrivilegeControl="F93A31B2-99AC-4084-8EC2-D4027C31369A",e.AccessTeamTablePickerControl="3f4e2a56-f102-4b4d-ab9c-f1574ca5bfda",e.ACIControl="C8BFBBEF-6851-4401-A0CC-7450062FE085",e.ActivitiesContainerControl="C72511AB-84E5-4FB7-A543-25B4FC01E83E",e.ActivitiesWallControl="6636847D-B74D-4994-B55A-A6FAF97ECEA2",e.AppliedFiltersControl="9C310A73-A360-42C5-8943-47A06F1B51EA",e.ArticleContentControl="F02EF977-2564-4B9A-B2F0-DF083D8A019B",e.BooleanControl="67FAC785-CD58-4F9F-ABB3-4B7DDC6ED5ED",e.ButtonControl="00AD73DA-BD4D-49C6-88A8-2F4F4CAD4A20",e.CheckboxControl="B0C6723A-8503-4FD7-BB28-C8A06AC933C2",e.CompositionLinkControl="DB1284EF-9FFC-4E99-B382-0CC082FE2364",e.ConnectionControl="3246F906-1F71-45F7-B11F-D7BE0F9D04C9",e.ConnectionRoleObjectTypeListControl="821ACF1A-7E46-4A0C-965D-FE14A57D78C7",e.CoverageChoiceControl="4168A05C-D857-46AF-8457-5BB47EB04EA1",e.DashboardControl="D2561F53-B292-42D9-B222-478E40FFE29F",e.DynamicPropertyListControl="6896F004-B17A-4202-861E-8B7EA2080E0B",e.EditFilterControl="1479835F-F852-4679-B864-C6892A2844C9",e.ErrorStatusControl="F4C16ECA-CA81-4E39-9448-834B8378721E",e.GlobalFilterControl="FFF0E632-9D7B-4F21-BBC1-05D1567AD144",e.HiddenInputControl="5546E6CD-394C-4BEE-94A8-4425E17EF6C6",e.KBViewerControl="A62B6FA9-169E-406C-B1AA-EAB828CB6026",e.LabelControl="39354E4A-5015-4D74-8031-EA9EB73A1322",e.MailMergeLanguagePickerControl="B634828E-C390-444A-AFE6-E07315D9D970",e.MapLinkControl="91DC0675-C8B9-4421-B1E0-261CEBF02BAC",e.OrgInsightsControl="76b9e25e-695e-4fef-ac69-f05cfa96739c",e.ChoiceLookupControl="2305e33a-bad3-4022-9e15-1856cf218333",e.PowerBIControl="8C54228C-1B25-4909-A12A-F2B968BB0D62",e.ProcessControl="06E9F7AF-1F54-4681-8EEC-1E21A1CEB465",e.RelatedInformationControl="163B90A6-EB64-49D2-9DF8-3C84A4F0A0F8",e.RelationshipRoleChoiceControl="5F986642-5961-4D9F-AB5E-643D71E231E9",e.ReportControl="A28F441B-916C-4865-87FD-0C5D53BD59C9",e.StreamsControl="EE9078C8-6946-4E2C-B8F8-35E65F4BE6A8",e.WebResourceSilverlightControl="080677DB-86EC-4544-AC42-F927E74B491F",e.CurrencyControl="533B9E00-756B-4312-95A0-DC888637AC78",e.CustomControl="F9A8A302-114E-466A-B582-6771B2AE0D92",e.DateTimeControl="5B773807-9FB2-42DB-97C3-7A91EFF8ADFF",e.DecimalControl="C3EFE0C3-0EC6-42BE-8349-CBD9079DFD8E",e.DurationControl="AA987274-CE4E-4271-A803-66164311A958",e.EmailAddressControl="ADA2203E-B4CD-49BE-9DDF-234642B43B52",e.EmailBodyControl="6F3FB987-393B-4D2D-859F-9D0F0349B6AD",e.EmailEngagementActionsControl="F454228D-1D25-4319-E12F-D27968BC0234",e.EmailRecipientActivityControl="26E9760F-7454-40DE-BB07-F6DCCCB82040",e.FileControl="0A7FF475-B016-4687-9CE5-042BFDBD6519",e.FloatingNumberControl="0D2C745A-E5A8-4C8F-BA63-C6D3BB604660",e.IframeControl="FD2A7985-3187-444E-908D-6624B21F69C0",e.ImageControl="7E548B0D-209C-477B-9DCD-F0F44472381D",e.LanguageControl="671A9387-CA5A-4D1E-8AB7-06E39DDCF6B5",e.LookupControl="270BD3DB-D9AF-4782-9025-509E298DEC0A",e.MapsControl="62B0DF79-0464-470F-8AF7-4483CFEA0C7D",e.ChoicesControl="4AA28AB7-9C13-4F57-A73D-AD894D048B5F",e.IntegerControl="C6D124CA-7EDA-4A60-AEA9-7FB8D318B68F",e.PartyListControl="CBFB742C-14E7-4A17-96BB-1A13F7F64AA2",e.PhoneNumberControl="8C10015A-B339-4982-9474-A95FE05631A5",e.ChoiceControl="3EF39988-22BB-4F0B-BBBE-64B5A3748AEE",e.ChoiceStatusControl="5D68B988-0661-4DB2-BC3E-17598AD3BE6C",e.QuickViewControl="5C5600E0-1D6E-4205-A272-BE80DA87FD42",e.QuickFormControl="69AF7DCA-2E3B-4EE7-9201-0DA731DD2413",e.RegardingControl="F3015350-44A2-4AA0-97B5-00166532B5E9",e.SearchWidgetControl="E616A57F-20E0-4534-8662-A101B5DDF4E0",e.SocialInsightsControl="86B9E25E-695E-4FEF-AC69-F05CFA96739C",e.SubgridControl="E7A81278-8635-4D9E-8D4D-59480B391C5B",e.TextAreaControl="E0DECE4B-6FC8-4A8F-A065-082708572369",e.TextboxControl="4273EDBD-AC1D-40D3-9FB2-095C621B552D",e.TickerControl="1E1FC551-F7A8-43AF-AC34-A8DC35C7B6D4",e.TimerControl="9C5CA0A1-AB4D-4781-BE7E-8DFBE867B87E",e.TimelineControl="06375649-C143-495E-A496-C962E5B4488E",e.TimezoneControl="7C624A0B-F59E-493D-9583-638D34759266",e.UrlControl="71716B6C-711E-476C-8AB8-5D11542BFB47",e.WebResourceHTMLControl="9FDF5F91-88B1-47F4-AD53-C11EFC01A01D",e.WebResourceImageControl="587CDF98-C1D5-4BDE-8473-14A0BC7644A7",e.ReferencePanelSearchWidgetControl="7CCD1494-1F7A-4E3A-8BDE-F32069DAEB9F",e.ReferencePanelSubgridControl="02D4264B-47E2-4B4C-AA95-F439F3F4D458",e.ReferencePanelQuickViewControl="B68B05F0-A46D-43F8-843B-917920AF806A",e.KBEditorControl="F94DB24F-263D-44A7-B38E-A35E9854812B",e.LinkControl="DFDF1CDE-837B-4AC9-98CF-AC74361FD89D"})(S||(S={}));hl={[S.WebResourceHTMLControl]:"WebResource",[S.WebResourceImageControl]:"WebResource",[S.IframeControl]:"IFRAME",[S.SearchWidgetControl]:"Search widget",[S.SubgridControl]:"Subgrid",[S.TimelineControl]:"Timeline",[S.QuickViewControl]:"QuickviewControl"}});var Xn=g((Zz,Wv)=>{var go=new Proxy(function(){return go},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:go},apply:function(){return go},construct:function(){return{}}}),zv=function(){return go};Object.setPrototypeOf(zv,go);Wv.exports=zv});var dt,jr,Hv,jv,Ui=I(()=>{"use strict";dt="cds-designer-models",jr="FormCustomControl",Hv="FormCell",jv="Form"});var $i,pt,vo=I(()=>{"use strict";$i=class{keys;values;constructor(){this.keys=[],this.values=[]}add(t,r){return this.containsKey(t)?!1:(this.keys.push(t),this.values.push(r),!0)}upsert(t,r){this.update(t,r)||this.add(t,r)}sortedUpsert(t,r){if(!this.update(t,r)){let n=0;for(;n<this.keys.length&&this.keys[n]<t;)n++;this.keys.splice(n,0,t),this.values.splice(n,0,r)}}clear(){this.keys=[],this.values=[]}containsKey(t){return this.keys.indexOf(t)!==-1}containsValue(t){return this.values.indexOf(t)!==-1}count(){return this.keys.length}getValue(t){let r=this.keys.indexOf(t);return r!==-1?this.values[r]:!1}getKeys(){return this.keys.slice()}getValues(){return this.values.slice()}remove(t){let r=this.keys.indexOf(t);return r!==-1?(this.keys.splice(r,1),this.values.splice(r,1),!0):!1}update(t,r){let n=this.keys.indexOf(t);return n!==-1?(this.values[n]=r,!0):!1}},pt=class{data={};add(t,r){return this.containsKey(t)?!1:(this.data[t]=r,!0)}upsert(t,r){this.data[t]=r}clear(){this.data={}}containsKey(t){return this.data.hasOwnProperty(t)}containsValue(t){for(let r in this.data)if(this.data[r]===t)return!0;return!1}count(){return Object.keys(this.data).length}getValue(t){return this.containsKey(t)?this.data[t]:!1}getKeys(){return Object.keys(this.data)}getValues(){let t=[];for(let r in this.data)t.push(this.data[r]);return t}remove(t){return this.containsKey(t)?delete this.data[t]:!1}update(t,r){return this.containsKey(t)?(this.data[t]=r,!0):!1}getInternalObject(){return this.data}}});var Yn,kd=I(()=>{"use strict";vo();X();Yn=class e{static lockedFieldCount=new pt;static dependencyFieldCount=new pt;static getNecessaryLookUpTable(t){switch(t){case Cr.DependencyFieldTable:return e.dependencyFieldCount;case Cr.LockedFieldTable:return e.lockedFieldCount}}static initCanvasLockedFieldLookUp(t){switch(t){case Cr.DependencyFieldTable:e.dependencyFieldCount=new pt;case Cr.LockedFieldTable:e.lockedFieldCount=new pt}}}});var gl,Qv=I(()=>{"use strict";Le();Fe();X();We();gl=class extends W{constructor(t){super(y.controlDescription,t)}get forControl(){let t=this.getProperty(m.ForControl);return N.IsNullOrUndefined(t)?null:(t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"&&(t=t.substr(1,t.length-2)),new T(t))}set forControl(t){this.setProperty(m.ForControl,`{${t.ToString()}}`)}get customControls(){return this.getChildren(y.customControl)}set customControls(t){this.deleteAllChildren();for(let r of t)this.addChild(r)}get DefaultControlClassId(){for(let t of this.customControls)if(!N.IsNullOrUndefined(t.id))return t.id;return null}get DefaultCustomControl(){for(let t of this.customControls)if(!N.IsNullOrUndefined(t.id))return t;return null}get DefaultCustomControls(){let t=[];for(let r of this.customControls)N.IsNullOrUndefined(r.id)||t.push(r);return t}async toJSON(t){let r=await this.getCustomControlsJSON(t);return r?{UniqueId:this.forControl.guidString,CustomControls:r,VersionNumber:0,OverallVersionNumber:0}:null}async getCustomControlsJSON(t){if(this.customControls){let r=[];for(let n of this.customControls){let i=await n.toJSON(t);i&&r.push(i)}return r}return null}}});var Kv,Xv,ft,_,Jv,Nn,Zn,qi,Md,Bd,Vi=I(()=>{"use strict";Kv={Name:"Name",Value:"Value",Type:"Type",TypeGroup:"TypeGroup",Usage:"Usage",Static:"Static",Primary:"Primary",Columns:"Columns",EnableViewPicker:"EnableViewPicker",EntityName:"EntityName",FilteredViewIds:"FilteredViewIds",ReferencingName:"ReferencingName",RelationshipName:"RelationshipName",RelationshipType:"RelationshipType",TargetEntityType:"TargetEntityType",ViewId:"ViewId",DependentAttributeName:"DependentAttributeName",DependentAttributeType:"DependentAttributeType",DefaultViewId:"DefaultViewId",BindAttribute:"BindAttribute",FilterRelationshipName:"FilterRelationshipName",AvailableViewIds:"AvailableViewIds",QuickForms:"QuickForms",EntityNameKey:"EntityNameKey",CardFormType:"Form.Card",CardFormId:"CardFormId",Hidden:"Hidden",Required:"Required",DefaultValue:"DefaultValue"},Xv={GroupDefinition:"GroupDefinition"},ft={Control:"control",Resources:"resources",DisplayNameKey:"display-name-key",descriptionKey:"description-key",value:"value",name:"name",defaultKey:"default",groups:"groups",group:"group",property:"property",hidden:"hidden",required:"required",typeGroup:"type-group",type:"type",usage:"usage",ofType:"of-type",ofTypeGroup:"of-type-group",ImageURL:"preview-image",DefaultValue:"default-value",static:"static",dataset:"data-set",propertySet:"property-set",initialDatasetFetch:"initial-data-set-fetch",editable:"editable",cdsDatasetOptions:"cds-data-set-options",allowDefaultSelectedItems:"allow-default-selected-items",resettable:"resettable",isGroup:"isGroup",entityName:"entityname"};(function(e){e.Boolean="Boolean",e.Currency="Currency",e.DateAndTimeDateAndTime="DateAndTime.DateAndTime",e.DateAndTimeDateOnly="DateAndTime.DateOnly",e.Decimal="Decimal",e.Enum="Enum",e.FP="FP",e.File="File",e.Guid="Guid",e.Image="Image",e.LookupCustomer="Lookup.Customer",e.LookupOwner="Lookup.Owner",e.LookupPartyList="Lookup.PartyList",e.LookupRegarding="Lookup.Regarding",e.LookupSimple="Lookup.Simple",e.Multiple="Multiple",e.MultiSelectOptionSet="MultiSelectOptionSet",e.OptionSet="OptionSet",e.SingleLineEmail="SingleLine.Email",e.SingleLinePhone="SingleLine.Phone",e.SingleLineText="SingleLine.Text",e.SingleLineTextArea="SingleLine.TextArea",e.SingleLineTickerSymbol="SingleLine.Ticker",e.SingleLineURL="SingleLine.URL",e.TwoOptions="TwoOptions",e.WholeDuration="Whole.Duration",e.WholeLanguage="Whole.Language",e.WholeNone="Whole.None",e.WholeTimeZone="Whole.TimeZone",e.BusinessProcessFlow="BusinessProcessFlow",e.CardForm="Form.Card",e.Dashboard="Dashboard",e.FormMain="Form.Main",e.Grid="Grid",e.PowerBIReport="PowerBI.Report",e.QuickForm="Form.QuickForm",e.Search="Search",e.SearchWidget="SearchWidget",e.TimelineWall="TimelineWall",e.UnboundCustomControl="Unbound",e.WebResourceHtmlControl="WebResource.HTML"})(_||(_={}));(function(e){e.BooleanType="CC_FlipLabel_Name",e.DateTimeType="CC_TextBox_Name",e.DecimalType="CC_TextBox_Name",e.DoubleType="CC_TextBox_Name",e.IntegerType="CC_TextBox_Name",e.LookupType="CC_TextBox_Name",e.MemoType="CC_TextArea_Name",e.MoneyType="CC_TextBox_Name",e.OptionSetType="CC_OptionSet_Name",e.StringType="CC_TextBox_Name",e.GridType="CC_ReadOnlyGrid_Name",e.UnboundCustomControlType="CC_UnboundCustomControl_Name"})(Jv||(Jv={}));(function(e){e.ArcKnobControl="MscrmControls.Knob.ArcKnobControl",e.CardFeedNameControl="MscrmControls.CardFeedContainer.CardFeedContainer",e.CheckboxControl="MscrmControls.FieldControls.CheckboxControl",e.DateTimeControl="MscrmControls.FieldControls.DateTimeControl",e.DurationControl="MscrmControls.FieldControls.DurationControl",e.EditableGridControl="MscrmControls.Grid.GridControl",e.EmailEngagementActionsControl="MscrmControls.EmailEngagement.EmailEngagementActionsControl",e.FormComponent="MscrmControls.ModelForm.ModelFormControl",e.LanguageCodeControl="MscrmControls.FieldControls.LanguagePickerControl",e.LinearSliderControl="MscrmControls.Slider.LinearSliderControl",e.MultiSelectOptionSetControl="MscrmControls.MultiSelectPicklist.UpdMSPicklistControl",e.OptionSetControl="MscrmControls.OptionSet.OptionSetControl",e.PowerBIPCFControl="MscrmControls.PowerBIPCFControl",e.PredictiveScoringWidget="MscrmControls.Sales.PredictiveScoringWidget.PredictiveScoringWidget",e.ReadonlyGrid="MscrmControls.Grid.ReadOnlyGrid",e.SimilarCasesGrid="MscrmControls.Containers.SimilarCasesGridControl",e.StarRatingControl="MscrmControls.Rating.StarRatingControl",e.TimeZoneControl="MscrmControls.FieldControls.TimeZonePickListControl",e.ModelFormControl="MscrmControls.ModelForm.ModelFormControl",e.AutoCompleteControl="MscrmControls.AutoComplete.AutoCompleteControl",e.CanvasAppControl="MscrmControls.Canvas.CanvasControl",e.PowerAppsOneGrid="Microsoft.PowerApps.PowerAppsOneGrid"})(Nn||(Nn={}));(function(e){e[e.Read=0]="Read",e[e.Edit=1]="Edit",e[e.Both=2]="Both",e[e.Container=3]="Container",e[e.Unknown=4]="Unknown"})(Zn||(Zn={}));(function(e){e[e.Bound=0]="Bound",e[e.Input=1]="Input",e[e.Output=2]="Output"})(qi||(qi={}));Md=[_.LookupCustomer,_.LookupOwner,_.LookupPartyList,_.LookupRegarding,_.LookupSimple],Bd=[_.WholeNone,_.WholeDuration,_.WholeLanguage,_.WholeTimeZone,_.FP,_.Decimal]});function Qr(){return Sr||(Sr=window._makerConfig,Sr&&window?.location?.search?.indexOf("useProductionConfig")>-1&&(Sr={...Sr,region:"prod",graphQLEndpoint:"https://graph.make.powerapps.com/"}),Sr?.region==="prod"&&(Sr={endpoints:{eu:{ch:{graphql:"https://graph-make.ch-cm001.gateway.prod.cm.powerapps.com/"},de:{graphql:"https://graph-make.de-cm001.gateway.prod.cm.powerapps.com/"},fr:{graphql:"https://graph-make.fr-cm001.gateway.prod.cm.powerapps.com/"},no:{graphql:"https://graph-make.no-cm001.gateway.prod.cm.powerapps.com/"},default:{graphql:"https://graph-make.eu-cm001.gateway.prod.cm.powerapps.com/"}}},...Sr}),Sr||{aadClientId:"a8f7a65c-f5ba-4859-b2d6-df772c264e9d",location:"cus",region:"test",publicPath:"/",graphQLEndpoint:"https://graph.make.test.powerapps.com/"})}var Sr,vl=I(()=>{"use strict";});function Yv(e,t,r){if(!e)return yl.has(e)||(window._ppux?.log?.("PPUX/Geo/NonExistent",{eventType:"Trace",team:"Shell",severity:"Error",errorCode:"GeoIsEmpty"}),yl.add("")),!1;if(e){if(e=e.toLowerCase(),yl.has(e))return!1;if(!(e in t))return window._ppux?.log?.("PPUX/Geo/NonExistent",{eventType:"Trace",team:"Shell",severity:"Error",errorCode:"GeoNonExistent",eventInfo:{missinggeo:e,parent:r}}),yl.add(e),!1}return!0}function dL(e){return Yv(e,Ud,"Location dictionary")?Ud[e.toLowerCase()]:"us"}function pL(){let e=Qr().location.toLowerCase();return Yv(e,Ud,"Current location dictionary")?e:"us"}var yl,Ud,mW,Zv=I(()=>{"use strict";vl();yl=new Set,Ud={cae:"ae",nae:"ae",eas:"as",seas:"as",eau:"au",seau:"au",sbr:"br",cca:"ca",eca:"ca",nch:"ch",wch:"ch",nde:"de",wcde:"de",neu:"eu",weu:"eu",cfr:"fr",sfr:"fr",cin:"in",sin:"in",ejp:"jp",wjp:"jp",suk:"uk",wuk:"uk",eus:"us",wus:"us",cus:"us",ude:"us",udc:"us",ugtx:"us",ugva:"us",eus2:"us",wus2:"us",nza:"za",wza:"za",cne2:"cn",cnn2:"cn",skr:"kr",ckr:"kr",eno:"no",wno:"no",wrx:"us",erx:"us",wex:"us",eex:"us",unitedstates:"us",europe:"eu",asia:"as",australia:"au",japan:"jp",canada:"ca",india:"in",italy:"it",unitedstatesfirstrelease:"us",unitedkingdom:"uk",southamerica:"br",france:"fr",unitedarabemirates:"ae",germany:"de",sweden:"se",switzerland:"ch",korea:"kr",norway:"no",usgov:"us",usgovhigh:"us",usdod:"us",china:"cn",usnat:"us",ussec:"us",southafrica:"za",singapore:"sg",newzealand:"nz",poland:"pl",qatar:"qa",as:"as",au:"au",ca:"ca",in:"in",jp:"jp",kr:"kr",nz:"nz",ae:"ae",qa:"qa",us:"us",uk:"uk",eu:"eu",de:"de",ch:"ch",no:"no",fr:"fr",se:"se",it:"it",pl:"pl",be:"eu",bel:"eu",gr:"eu",grc:"eu",lt:"eu",ltu:"eu",pt:"eu",prt:"eu",bg:"eu",bgr:"eu",es:"eu",esp:"eu",lu:"eu",lux:"eu",ro:"eu",rou:"eu",cz:"eu",cze:"eu",hu:"eu",hun:"eu",si:"eu",svn:"eu",dk:"eu",dnk:"eu",hr:"eu",hrv:"eu",mt:"eu",mlt:"eu",sk:"eu",svk:"eu",nit:"it",nl:"eu",nld:"eu",fi:"eu",fin:"eu",ee:"eu",est:"eu",cy:"eu",cyp:"eu",at:"eu",aut:"eu",swe:"se",cse:"se",ie:"eu",irl:"eu",lv:"eu",lva:"eu",cpl:"pl",nnz:"nz",cqa:"qa",sg:"sg",br:"br",za:"za",sa:"za"};mW=dL(pL())});var k,gW,ey=I(()=>{"use strict";k={USWest:"westus",USWest2:"westus2",USCentral:"centralus",USEast:"eastus",USEast2:"eastus2",USNorthCentral:"northcentralus",USSouthCentral:"southcentralus",USWestCentral:"westcentralus",CanadaCentral:"canadacentral",CanadaEast:"canadaeast",BrazilSouth:"brazilsouth",EuropeNorth:"northeurope",EuropeWest:"westeurope",UKSouth:"uksouth",UKWest:"ukwest",FranceCentral:"francecentral",FranceSouth:"francesouth",SwitzerlandNorth:"switzerlandnorth",SwitzerlandWest:"switzerlandwest",GermanyNorth:"germanynorth",GermanyWestCentral:"germanywestcentral",NorwayWest:"norwaywest",NorwayEast:"norwayeast",SwedenCentral:"swedencentral",ItalyNorth:"italynorth",PolandCentral:"polandcentral",AsiaEast:"eastasia",AsiaSouthEast:"southeastasia",JapanEast:"japaneast",JapanWest:"japanwest",AustraliaEast:"australiaeast",AustraliaSouthEast:"australiasoutheast",AustraliaCentral:"australiacentral",AustraliaCentral2:"australiacentral2",IndiaCentral:"centralindia",IndiaSouth:"southindia",IndiaWest:"westindia",KoreaSouth:"koreasouth",KoreaCentral:"koreacentral",NewZealandNorth:"newzealandnorth",UAECentral:"uaecentral",UAENorth:"uaenorth",SouthAfricaNorth:"southafricanorth",SouthAfricaWest:"southafricawest",QatarCentral:"qatarcentral",GermanyCentral:"germanycentral",GermanyNorthEast:"germanynortheast",SingaporeSouthEast:"southeastasia",GovernmentUSVirginia:"usgovvirginia",GovernmentUSIowa:"usgoviowa",GovernmentUSArizona:"usgovarizona",GovernmentUSTexas:"usgovtexas",GovernmentUSDodEast:"usdodeast",GovernmentUSDodCentral:"usdodcentral",ChinaNorth:"chinanorth",ChinaNorth2:"chinanorth2",ChinaNorth3:"chinanorth3",ChinaEast:"chinaeast",ChinaEast2:"chinaeast2",ChinaEast3:"chinaeast3",UssecEast:"usseceast",UssecWest:"ussecwest",UsnatEast:"usnateast",UsnatWest:"usnatwest"},gW={[k.USWest]:{geoName:"us",regionShortName:"wus"},[k.USCentral]:{geoName:"us",regionShortName:"cus"},[k.USEast]:{geoName:"us",regionShortName:"eus"},[k.USEast2]:{geoName:"us",regionShortName:"eus2"},[k.USWestCentral]:{geoName:"us",regionShortName:"wcus"},[k.USWest2]:{geoName:"us",regionShortName:"wus2"},[k.USSouthCentral]:{geoName:"br",regionShortName:"scus"},[k.BrazilSouth]:{geoName:"br",regionShortName:"sbr"},[k.UKSouth]:{geoName:"uk",regionShortName:"suk"},[k.UKWest]:{geoName:"uk",regionShortName:"wuk"},[k.JapanEast]:{geoName:"jp",regionShortName:"ejp"},[k.JapanWest]:{geoName:"jp",regionShortName:"wjp"},[k.IndiaCentral]:{geoName:"in",regionShortName:"cin"},[k.IndiaSouth]:{geoName:"in",regionShortName:"sin"},[k.ItalyNorth]:{geoName:"it",regionShortName:"nit"},[k.GermanyWestCentral]:{geoName:"de",regionShortName:"wcde"},[k.GermanyNorth]:{geoName:"de",regionShortName:"nde"},[k.EuropeNorth]:{geoName:"eu",regionShortName:"neu"},[k.EuropeWest]:{geoName:"eu",regionShortName:"weu"},[k.AustraliaEast]:{geoName:"au",regionShortName:"eau"},[k.AustraliaSouthEast]:{geoName:"au",regionShortName:"seau"},[k.AsiaSouthEast]:{geoName:"as",regionShortName:"seas"},[k.AsiaEast]:{geoName:"as",regionShortName:"eas"},[k.CanadaCentral]:{geoName:"ca",regionShortName:"cca"},[k.CanadaEast]:{geoName:"ca",regionShortName:"eca"},[k.SouthAfricaNorth]:{geoName:"za",regionShortName:"nza"},[k.SouthAfricaWest]:{geoName:"za",regionShortName:"wza"},[k.FranceCentral]:{geoName:"fr",regionShortName:"cfr"},[k.FranceSouth]:{geoName:"fr",regionShortName:"sfr"},[k.UAENorth]:{geoName:"ae",regionShortName:"nae"},[k.UAECentral]:{geoName:"ae",regionShortName:"cae"},[k.SwedenCentral]:{geoName:"se",regionShortName:"cse"},[k.SwitzerlandNorth]:{geoName:"ch",regionShortName:"nch"},[k.SwitzerlandWest]:{geoName:"ch",regionShortName:"wch"},[k.NorwayEast]:{geoName:"no",regionShortName:"eno"},[k.NorwayWest]:{geoName:"no",regionShortName:"wno"},[k.KoreaCentral]:{geoName:"kr",regionShortName:"ckr"},[k.KoreaSouth]:{geoName:"kr",regionShortName:"skr"},[k.SingaporeSouthEast]:{geoName:"sg",regionShortName:"seas"},[k.PolandCentral]:{geoName:"pl",regionShortName:"cpl"},[k.QatarCentral]:{geoName:"qa",regionShortName:"cqa"},[k.NewZealandNorth]:{geoName:"nz",regionShortName:"nnz"},[k.GovernmentUSTexas]:{geoName:"us",regionShortName:"ugtx"},[k.GovernmentUSVirginia]:{geoName:"us",regionShortName:"ugva"},[k.GovernmentUSDodCentral]:{regionShortName:"udc"},[k.GovernmentUSDodEast]:{regionShortName:"ude"},[k.ChinaEast]:{regionShortName:"cne"},[k.ChinaEast2]:{regionShortName:"cne2"},[k.ChinaEast3]:{regionShortName:"cne3"},[k.ChinaNorth]:{regionShortName:"cnn"},[k.ChinaNorth2]:{regionShortName:"cnn2"},[k.ChinaNorth3]:{regionShortName:"cnn3"},[k.UssecEast]:{geoName:"us",regionShortName:"erx"},[k.UssecWest]:{geoName:"us",regionShortName:"wrx"},[k.UsnatEast]:{geoName:"us",regionShortName:"eex"},[k.UsnatWest]:{geoName:"us",regionShortName:"wex"}}});var ty=I(()=>{"use strict";vl();});var yo=I(()=>{"use strict";vl();Zv();ey();ty();});function bo(e,t){return ry?ry.isOverridden(e,t):{overridden:!1}}var ry,wo=I(()=>{"use strict";});var $d=I(()=>{"use strict";yo();wo();});function fL(e,t){let{region:r}=Qr();return()=>{let n=e.settings[t];if(n.allowOverrides){let s=bo(e.packageName,t);if(s.overridden)return typeof s.value=="string"?mL(s.value):s.value}let a=n.values,o=process.env.SETTINGS_FALLBACK_REGION?.[r];return a[r]!==void 0?a[r]:o&&a[o]!==void 0?a[o]:a.default}}function mL(e){return isNaN(Number(e))?e==="true"?!0:e==="false"?!1:e:Number(e)}function hL(e){let t=e.packageName;if(bl.has(t)){let r=`settings has already been created for this package ${t}`;throw console.error(r),new Error(r)}if(Object.keys(e.settings).some(r=>Vd(t,r))){let r=`error parsing settings config for package ${t}, a feature gate with the same name exists`;throw console.error(r),new Error(r)}Object.keys(e.settings).forEach(r=>{if(Object.keys(e.settings[r].values).filter(i=>i!=="default").some(i=>!Al(i))){let i=`error parsing settings config for package ${t}, setting ${r} has invalid region`;throw console.error(i),new Error(i)}})}function Ao(e){hL(e);let t={};return Object.keys(e.settings).forEach(r=>{t[r]={enumerable:!0,get:fL(e,r)}}),bl.set(e.packageName,e),Object.defineProperties({},t)}function qd(e,t){return bl.has(e)?!!bl.get(e).settings[t]:!1}var bl,wl=I(()=>{"use strict";yo();wo();Gd();Co();bl=new Map});function ny(e,t){let{region:r}=Qr();return()=>{let n=bo(e.packageName,t);if(n.overridden)return n.value.toString()==="true";let i=e.features[t].enabledFor,a=process.env.SETTINGS_FALLBACK_REGION?.[r];return i[r]!==void 0?!!i[r]:a&&i[a]!==void 0?!!i[a]:!1}}function gL(e){let t=e.packageName;if(Cl.has(t)){let r="feature gates has already been created for this package";throw console.error(r),new Error(r)}if(Object.keys(e.features).some(r=>qd(t,r))){let r=`error parsing feature gates config for package ${t}, a setting with the same name exists`;throw console.error(r),new Error(r)}Object.keys(e.features).forEach(r=>{if(Object.keys(e.features[r].enabledFor).some(i=>!Al(i))){let i=`error parsing feature gates config for package ${t}, feature ${r} has invalid region`;throw console.error(i),new Error(i)}})}function zd(e){gL(e);let t={};Object.keys(e.features).forEach(i=>{t[i]={enumerable:!0,configurable:!0,get:ny(e,i)}});let r={},n=new Set;return t.dangerouslySet={enumerable:!1,value:(i,a)=>{n.add(i),Object.defineProperty(r,i,{enumerable:!0,configurable:!0,value:a})}},t.dangerouslyReset={enumerable:!1,value:()=>{let i={};n.forEach(a=>{i[a.toString()]={enumerable:!0,configurable:!0,get:ny(e,a.toString())}}),Object.defineProperties(r,i),n.clear()}},Cl.set(e.packageName,e),Object.defineProperties(r,t)}function Vd(e,t){return Cl.has(e)?!!Cl.get(e).features[t]:!1}var Cl,Gd=I(()=>{"use strict";yo();Co();wo();wl();Cl=new Map});var ay=g((qW,iy)=>{"use strict";iy.exports=function(t,r){if(r=r.split(":")[0],t=+t,!t)return!1;switch(r){case"http":case"ws":return t!==80;case"https":case"wss":return t!==443;case"ftp":return t!==21;case"gopher":return t!==70;case"file":return!1}return t!==0}});var ly=g(Wd=>{"use strict";var vL=Object.prototype.hasOwnProperty,yL;function oy(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return null}}function sy(e){try{return encodeURIComponent(e)}catch{return null}}function bL(e){for(var t=/([^=?#&]+)=?([^&]*)/g,r={},n;n=t.exec(e);){var i=oy(n[1]),a=oy(n[2]);i===null||a===null||i in r||(r[i]=a)}return r}function wL(e,t){t=t||"";var r=[],n,i;typeof t!="string"&&(t="?");for(i in e)if(vL.call(e,i)){if(n=e[i],!n&&(n===null||n===yL||isNaN(n))&&(n=""),i=sy(i),n=sy(n),i===null||n===null)continue;r.push(i+"="+n)}return r.length?t+r.join("&"):""}Wd.stringify=wL;Wd.parse=bL});var Qd=g((GW,my)=>{"use strict";var cy=ay(),Sl=ly(),dy=/[\n\r\t]/g,AL=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,CL=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,SL=/^[a-zA-Z]:/,EL=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/;function jd(e){return(e||"").toString().replace(EL,"")}var Hd=[["#","hash"],["?","query"],function(t,r){return Er(r.protocol)?t.replace(/\\/g,"/"):t},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],uy={hash:1,query:1};function py(e){var t;typeof window<"u"?t=window:typeof global<"u"?t=global:typeof self<"u"?t=self:t={};var r=t.location||{};e=e||r;var n={},i=typeof e,a;if(e.protocol==="blob:")n=new Nr(unescape(e.pathname),{});else if(i==="string"){n=new Nr(e,{});for(a in uy)delete n[a]}else if(i==="object"){for(a in e)a in uy||(n[a]=e[a]);n.slashes===void 0&&(n.slashes=AL.test(e.href))}return n}function Er(e){return e==="file:"||e==="ftp:"||e==="http:"||e==="https:"||e==="ws:"||e==="wss:"}function fy(e,t){e=jd(e),e=e.replace(dy,""),t=t||{};var r=CL.exec(e),n=r[1]?r[1].toLowerCase():"",i=!!r[2],a=!!r[3],o=0,s;return i?a?(s=r[2]+r[3]+r[4],o=r[2].length+r[3].length):(s=r[2]+r[4],o=r[2].length):a?(s=r[3]+r[4],o=r[3].length):s=r[4],n==="file:"?o>=2&&(s=s.slice(2)):Er(n)?s=r[4]:n?i&&(s=s.slice(2)):o>=2&&Er(t.protocol)&&(s=r[4]),{protocol:n,slashes:i||Er(n),slashesCount:o,rest:s}}function NL(e,t){if(e==="")return t;for(var r=(t||"/").split("/").slice(0,-1).concat(e.split("/")),n=r.length,i=r[n-1],a=!1,o=0;n--;)r[n]==="."?r.splice(n,1):r[n]===".."?(r.splice(n,1),o++):o&&(n===0&&(a=!0),r.splice(n,1),o--);return a&&r.unshift(""),(i==="."||i==="..")&&r.push(""),r.join("/")}function Nr(e,t,r){if(e=jd(e),e=e.replace(dy,""),!(this instanceof Nr))return new Nr(e,t,r);var n,i,a,o,s,l,u=Hd.slice(),c=typeof t,d=this,p=0;for(c!=="object"&&c!=="string"&&(r=t,t=null),r&&typeof r!="function"&&(r=Sl.parse),t=py(t),i=fy(e||"",t),n=!i.protocol&&!i.slashes,d.slashes=i.slashes||n&&t.slashes,d.protocol=i.protocol||t.protocol||"",e=i.rest,(i.protocol==="file:"&&(i.slashesCount!==2||SL.test(e))||!i.slashes&&(i.protocol||i.slashesCount<2||!Er(d.protocol)))&&(u[3]=[/(.*)/,"pathname"]);p<u.length;p++){if(o=u[p],typeof o=="function"){e=o(e,d);continue}a=o[0],l=o[1],a!==a?d[l]=e:typeof a=="string"?(s=a==="@"?e.lastIndexOf(a):e.indexOf(a),~s&&(typeof o[2]=="number"?(d[l]=e.slice(0,s),e=e.slice(s+o[2])):(d[l]=e.slice(s),e=e.slice(0,s)))):(s=a.exec(e))&&(d[l]=s[1],e=e.slice(0,s.index)),d[l]=d[l]||n&&o[3]&&t[l]||"",o[4]&&(d[l]=d[l].toLowerCase())}r&&(d.query=r(d.query)),n&&t.slashes&&d.pathname.charAt(0)!=="/"&&(d.pathname!==""||t.pathname!=="")&&(d.pathname=NL(d.pathname,t.pathname)),d.pathname.charAt(0)!=="/"&&Er(d.protocol)&&(d.pathname="/"+d.pathname),cy(d.port,d.protocol)||(d.host=d.hostname,d.port=""),d.username=d.password="",d.auth&&(s=d.auth.indexOf(":"),~s?(d.username=d.auth.slice(0,s),d.username=encodeURIComponent(decodeURIComponent(d.username)),d.password=d.auth.slice(s+1),d.password=encodeURIComponent(decodeURIComponent(d.password))):d.username=encodeURIComponent(decodeURIComponent(d.auth)),d.auth=d.password?d.username+":"+d.password:d.username),d.origin=d.protocol!=="file:"&&Er(d.protocol)&&d.host?d.protocol+"//"+d.host:"null",d.href=d.toString()}function DL(e,t,r){var n=this;switch(e){case"query":typeof t=="string"&&t.length&&(t=(r||Sl.parse)(t)),n[e]=t;break;case"port":n[e]=t,cy(t,n.protocol)?t&&(n.host=n.hostname+":"+t):(n.host=n.hostname,n[e]="");break;case"hostname":n[e]=t,n.port&&(t+=":"+n.port),n.host=t;break;case"host":n[e]=t,/:\d+$/.test(t)?(t=t.split(":"),n.port=t.pop(),n.hostname=t.join(":")):(n.hostname=t,n.port="");break;case"protocol":n.protocol=t.toLowerCase(),n.slashes=!r;break;case"pathname":case"hash":if(t){var i=e==="pathname"?"/":"#";n[e]=t.charAt(0)!==i?i+t:t}else n[e]=t;break;case"username":case"password":n[e]=encodeURIComponent(t);break;case"auth":var a=t.indexOf(":");~a?(n.username=t.slice(0,a),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=t.slice(a+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(t))}for(var o=0;o<Hd.length;o++){var s=Hd[o];s[4]&&(n[s[1]]=n[s[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin=n.protocol!=="file:"&&Er(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function IL(e){(!e||typeof e!="function")&&(e=Sl.stringify);var t,r=this,n=r.host,i=r.protocol;i&&i.charAt(i.length-1)!==":"&&(i+=":");var a=i+(r.protocol&&r.slashes||Er(r.protocol)?"//":"");return r.username?(a+=r.username,r.password&&(a+=":"+r.password),a+="@"):r.password?(a+=":"+r.password,a+="@"):r.protocol!=="file:"&&Er(r.protocol)&&!n&&r.pathname!=="/"&&(a+="@"),n[n.length-1]===":"&&(n+=":"),a+=n+r.pathname,t=typeof r.query=="object"?e(r.query):r.query,t&&(a+=t.charAt(0)!=="?"?"?"+t:t),r.hash&&(a+=r.hash),a}Nr.prototype={set:DL,toString:IL};Nr.extractProtocol=fy;Nr.location=py;Nr.trimLeft=jd;Nr.qs=Sl;my.exports=Nr});var _L,hy=I(()=>{"use strict";_L=re(Qd());});function Jd(e,t,r){let n=Object.keys(r).sort();if(n.length===0)throw new Error(`ECS feature has no properties: ${e}.${t}`);let i=`ecs.${e}.${t}`;return n.length===1?`${i}.${n[0]}`:`${i}.{${n.join(";")}}`}var El=I(()=>{"use strict";});var Kd,Xd,Yd=I(()=>{"use strict";El();Kd=class{features=new Map;register(t,r){let n=Jd(r,t.teamName,t.fallback),i={clientName:r,teamName:t.teamName,fullName:n,description:t.description,owners:t.owners,ecsURL:t.ecsURL,createdOn:t.createdOn,fallbackConfig:t.fallback,feature:t,displayTeam:t.displayTeam,tags:t.tags,category:t.category};this.features.set(n,i)}getAll(){return Array.from(this.features.values())}get(t){return this.features.get(t)}has(t){return this.features.has(t)}getByClient(t){return this.getAll().filter(r=>r.clientName===t)}getByTeam(t){return this.getAll().filter(r=>r.teamName===t)}search(t){let r=t.toLowerCase();return this.getAll().filter(n=>n.fullName.toLowerCase().includes(r)||n.description?.toLowerCase().includes(r)||n.teamName.toLowerCase().includes(r)||n.clientName.toLowerCase().includes(r))}getClientNames(){let t=new Set;return this.features.forEach(r=>t.add(r.clientName)),Array.from(t)}getTeamNames(){let t=new Set;return this.features.forEach(r=>t.add(r.teamName)),Array.from(t)}clear(){this.features.clear()}},Xd=new Kd});var Zd=I(()=>{"use strict";});function Al(e){return TL.has(e)}var TL,Co=I(()=>{"use strict";$d();Gd();wl();wo();$d();hy();Yd();El();Zd();TL=new Set(["tie","test","prod","preview","preprod","gov","high","dod","mooncake","ex","rx"])});var PL,gy=I(()=>{"use strict";Co();PL=Ao({packageName:"cds-designer-models",settings:{testCustomControls:{description:"Test Custom Controls to show up in the component picker.",allowOverrides:!0,values:{default:"",test:"",preprod:"",preview:"",gov:""}}}})});var Nl,O,M,ei,Gi,Dl,vy,yy,ep,So=I(()=>{"use strict";vo();Nl=class{name;constructor(t){this.name=t}toString(){return this.name}getName(){return this.name}getDisplayNameResourceKey(){return ep.getDisplayNameResourceKey(this.name)}};(function(e){e.BigInt="BigIntType",e.CalendarRulesType="CalendarRulesType",e.Currency="MoneyType",e.Customer="Customer",e.CustomerType="CustomerType",e.DateTime="DateTimeType",e.DecimalNumber="DecimalType",e.EntityNameType="EntityNameType",e.FloatingPointNumber="DoubleType",e.Image="ImageType",e.File="FileType",e.Lookup="Lookup",e.LookupType="LookupType",e.ManagedPropertyType="ManagedPropertyType",e.MultipleLineofText="MemoType",e.MultiSelectOptionSet="MultiSelectPicklistType",e.OptionSet="PicklistType",e.Owner="Owner",e.OwnerType="OwnerType",e.PartyList="PartyList",e.PartyListType="PartyListType",e.PrimaryNameAttributeType="String",e.SingleLineofText="StringType",e.State="StateType",e.Status="StatusType",e.Subject="Subject",e.TimeStamp="TimeStampType",e.TwoOptions="BooleanType",e.UniqueIdentifier="Uniqueidentifier",e.UniqueIdentifierType="UniqueidentifierType",e.VirtualType="VirtualType",e.WholeNumber="IntegerType"})(O||(O={}));(function(e){e.Email="Email",e.Text="Text",e.TextArea="TextArea",e.Url="Url",e.TickerSymbol="TickerSymbol",e.PhoneticGuide="PhoneticGuide",e.VersionNumber="VersionNumber",e.Phone="Phone",e.None="None",e.Duration="Duration",e.TimeZone="TimeZone",e.Language="Language",e.Locale="Locale",e.DateOnly="DateOnly",e.DateAndTime="DateAndTime",e.Picklist="Picklist",e.State="State",e.Status="Status",e.Boolean="Boolean",e.Regarding="Regarding"})(M||(M={}));ei=class extends Nl{constructor(t){super(t)}static get None(){return"None"}static get SystemRequired(){return"SystemRequired"}static get ApplicationRequired(){return"ApplicationRequired"}static get Recommended(){return"Recommended"}},Gi=class e extends Nl{constructor(t){super(t),t||(this.name=e.None)}static get None(){return"None"}static get Persistent(){return"Persistent"}static get Calculated(){return"Calculated"}static get Rollup(){return"Rollup"}GetValue(){return this.name===e.None?Dl.Persistent:parseInt(Dl[this.name])}};(function(e){e[e.Persistent=0]="Persistent",e[e.Calculated=1]="Calculated",e[e.Rollup=2]="Rollup"})(Dl||(Dl={}));(function(e){e[e.Undefined=0]="Undefined",e[e.Simple=1]="Simple",e[e.Related=2]="Related",e[e.Logical=4]="Logical",e[e.Calculated=8]="Calculated",e[e.Rollup=16]="Rollup",e[e.Invalid=32]="Invalid"})(vy||(vy={}));(function(e){e[e.Attribute=0]="Attribute",e[e.Organization=1]="Organization",e[e.Currency=2]="Currency"})(yy||(yy={}));ep=class e{static resourceKeyMap=e.initResourceKeyMap();static initResourceKeyMap(){let t=new $i;return t.add(O.TwoOptions,"SystemCustomization.type.bit.label"),t.add(O.Customer,"SystemCustomization.type.customer.label"),t.add(O.CustomerType,"SystemCustomization.type.customer.label"),t.add(O.DateTime,"SystemCustomization.type.datetime.label"),t.add(O.DecimalNumber,"SystemCustomization.type.decimal.label"),t.add(O.FloatingPointNumber,"SystemCustomization.type.float.label"),t.add(O.WholeNumber,"SystemCustomization.type.int.label"),t.add(O.LookupType,"SystemCustomization.type.lookup.label"),t.add(O.Lookup,"SystemCustomization.type.lookup.label"),t.add(O.MultipleLineofText,"SystemCustomization.type.ntext.label"),t.add(O.Currency,"SystemCustomization.type.money.label"),t.add(O.Owner,"SystemCustomization.type.owner.label"),t.add(O.OwnerType,"SystemCustomization.type.owner.label"),t.add(O.PartyList,"SystemCustomization.type.partylist.label"),t.add(O.PartyListType,"SystemCustomization.type.partylist.label"),t.add(O.OptionSet,"SystemCustomization.type.picklist.label"),t.add(O.State,"SystemCustomization.type.state.label"),t.add(O.Status,"SystemCustomization.type.status.label"),t.add(O.SingleLineofText,"SystemCustomization.type.nvarchar.label"),t.add(O.UniqueIdentifier,"SystemCustomization.type.uniqueidentifier.label"),t.add(O.UniqueIdentifierType,"SystemCustomization.type.uniqueidentifiertype.label"),t.add(O.CalendarRulesType,"SystemCustomization.type.calendarrules.label"),t.add(O.VirtualType,"SystemCustomization.type.virtual.label"),t.add(O.BigInt,"SystemCustomization.type.bigint.label"),t.add(O.ManagedPropertyType,"SystemCustomization.type.managedproperty.label"),t.add(O.EntityNameType,"SystemCustomization.type.entityname.label"),t.add(O.Image,"SystemCustomization.type.image.label"),t.add(O.MultiSelectOptionSet,"SystemCustomization.type.multiselectpicklist.label"),t.add(O.PrimaryNameAttributeType,"SystemCustomization.type.primaryname.label"),t.add(O.LookupType,"SystemCustomization.type.lookuptype.label"),t.add(O.Subject,"SystemCustomization.type.subject.label"),t.add(M.Email,"SystemCustomization.String.Format.email"),t.add(M.Text,"SystemCustomization.String.Format.text"),t.add(M.TextArea,"SystemCustomization.String.Format.textarea"),t.add(M.Url,"SystemCustomization.String.Format.url"),t.add(M.TickerSymbol,"SystemCustomization.String.Format.tickersymbol"),t.add(M.PhoneticGuide,"SystemCustomization.String.Format.phoneticguide"),t.add(M.VersionNumber,"SystemCustomization.String.Format.versionnumber"),t.add(M.Phone,"SystemCustomization.String.Format.phone"),t.add(M.None,"SystemCustomization.Integer.Format."),t.add(M.Duration,"SystemCustomization.Integer.Format.duration"),t.add(M.TimeZone,"SystemCustomization.Integer.Format.timezone"),t.add(M.Language,"SystemCustomization.Integer.Format.language"),t.add(M.Locale,"SystemCustomization.Integer.Format.language"),t.add(M.DateOnly,"SystemCustomization.DateTime.Format.date"),t.add(M.DateAndTime,"SystemCustomization.DateTime.Format.datetime"),t.add(M.Regarding,"SystemCustomization.Lookup.Format.regarding"),t.add(Gi.Persistent,"SystemCustomization.String.Source.persistent"),t.add(Gi.Calculated,"SystemCustomization.String.Source.calculated"),t.add(Gi.Rollup,"SystemCustomization.String.Source.rollup"),t.add(Gi.None,"SystemCustomization.String.Source.none"),t}static getDisplayNameResourceKey(t){return e.resourceKeyMap.getValue(t)}}});var Cy,rp,zi,ti,tp,Il,Wi,Jr,Ae,by,wy,Ay,ir=I(()=>{"use strict";Cy={ThreeEqColumn_FirstColumn:34,ThreeEqColumn_SecondColumn:33,ThreeEqColumn_ThirdColumn:33,FiveEqColumn:20},rp={ONE_COLUMN:"1",TWO_COLUMN:"2",THREE_COLUMN:"3",FOUR_COLUMN:"4"};(function(e){e[e.SUBGRID=0]="SUBGRID",e[e.SPACER=1]="SPACER",e[e.QUICK_VIEW=2]="QUICK_VIEW",e[e.WEB_RESOURCE=3]="WEB_RESOURCE",e[e.IFRAME=4]="IFRAME",e[e.BING_MAPS=5]="BING_MAPS",e[e.TIMER=6]="TIMER",e[e.TIMELINE=7]="TIMELINE",e[e.SOCIAL_INSIGHTS=8]="SOCIAL_INSIGHTS",e[e.KB_SEARCH=9]="KB_SEARCH",e[e.ACI_CONTROL=10]="ACI_CONTROL",e[e.RELATIONSHIP_ASSISTANT=11]="RELATIONSHIP_ASSISTANT",e[e.REFERENCE_PANEL=12]="REFERENCE_PANEL",e[e.REF_PANEL_QUICKVIEW=13]="REF_PANEL_QUICKVIEW",e[e.REF_PANEL_SUBGRID=14]="REF_PANEL_SUBGRID",e[e.REF_PANEL_KBSEARCH=15]="REF_PANEL_KBSEARCH",e[e.WEB_RESOURCE_HTML=16]="WEB_RESOURCE_HTML",e[e.PRED_LEAD_SCORING=17]="PRED_LEAD_SCORING"})(zi||(zi={}));(function(e){e.Left="Left",e.Right="Right",e.Center="Center"})(ti||(ti={}));(function(e){e[e.Mobile=0]="Mobile",e[e.Tablet=1]="Tablet",e[e.Web=2]="Web"})(tp||(tp={}));Il=class{static ONE_COLUMN=1;static TWO_COLUMN=2;static THREE_COLUMN=3;static FIVE_COLUMN=5};(function(e){e.Left="Left",e.Top="Top"})(Wi||(Wi={}));Jr=class{static StartTag="<"},Ae={ShowLabel:"true",LockLevel:"0",IsUserDefined:"0",LabelWidth:"115",columns:"1",ShowBar:"false",Layout:"varwidth",namePrefix:"_section_",labelAlignment:ti.Left,labelPosition:Wi.Left,MarginalControlColumns:"111",referencePanelNamePrefix:"ref_pan_"};(function(e){e.AddFormBodyFieldToReadOnlyHeader="AddFormBodyFieldToReadOnlyHeader",e.AddFieldPaneFieldToReadOnlyHeader="AddFieldPaneFieldToReadOnlyHeader",e.AddFieldExceedsReadOnlyHeaderLimit="AddFieldExceedsReadOnlyHeaderLimit",e.AddCustomComponentToReadOnlyHeader="AddCustomComponentToReadOnlyHeader",e.AddNonDisplayableComponentToReadOnlyHeader="AddNonDisplayableComponentToReadOnlyHeader",e.AddFieldToFlyoutOnly="AddFieldToFlyoutOnly",e.DisplayedFieldToFlyout="DisplayedFieldToFlyout",e.FlyoutFieldToDisplayed="FlyoutFieldToDisplayed",e.AddControlBeforeDefaultLabel="AddControlBeforeDefaultLabel"})(by||(by={}));(function(e){e.TabWithLockedFieldRemoval="TabWithLockedFieldRemoval",e.SectionWithLockedFieldRemoval="SectionWithLockedFieldRemoval",e.LockedSectionRemoval="LockedSectionRemoval",e.LockedFieldRemoval="LockedFieldRemoval",e.RequiredFieldRemoval="RequiredFieldRemoval",e.LastRemainingTab="LastRemainingTab",e.UnknownRemoval="UnknownRemoval"})(wy||(wy={}));(function(e){e.IsHeader="IsHeader",e.IsFooter="IsFooter",e.ContainedInHeader="ContainedInHeader",e.ContainedInFooter="ContainedInFooter",e.NoElementFound="NoElementFound",e.NoTarget="NoTarget",e.CannotAddControlToHeader="CannotAddControlToHeader",e.CannotAddControlToFooter="CannotAddControlToFooter"})(Ay||(Ay={}))});var np,Sy=I(()=>{"use strict";(function(e){e.DefaultValue="defaultValue",e.Loaded="loaded"})(np||(np={}))});var Dy,OL,Ey,qH,VH,Eo,Ny,GH,zH,Iy=I(()=>{"use strict";Dy=re(Xn());Fe();Ui();gy();So();ir();Vi();X();OL=re(Gn());Sy();(function(e){e.Model="Model",e.Canvas="Canvas",e.CustomPages="CustomPages"})(Ey||(Ey={}));qH={Read:Zn.Read,Edit:Zn.Edit,Both:Zn.Both,Container:Zn.Container},VH={input:qi.Input,bound:qi.Bound,output:qi.Output};(function(e){e[e.dataset=0]="dataset",e[e.property=1]="property",e[e.groups=2]="groups",e[e.group=3]="group"})(Eo||(Eo={}));(function(e){e[e.None=0]="None",e[e.HiddenControl=1]="HiddenControl",e[e.CompatibleDataTypesIsMissing=2]="CompatibleDataTypesIsMissing",e[e.TagNameIsUnsupported=3]="TagNameIsUnsupported",e[e.PropertyTypeIsUnsupported=4]="PropertyTypeIsUnsupported",e[e.PropertyTypeGroupIsUnsupported=5]="PropertyTypeGroupIsUnsupported"})(Ny||(Ny={}));GH=new Set([_.Currency,_.Decimal,_.FP,_.Multiple,_.SingleLineEmail,_.SingleLinePhone,_.SingleLineText,_.SingleLineTextArea,_.SingleLineURL,_.SingleLineTickerSymbol,_.WholeNone,_.WholeDuration,_.WholeLanguage,_.WholeTimeZone,_.Enum,_.LookupSimple,_.LookupCustomer,_.LookupOwner,_.LookupPartyList,_.LookupRegarding,_.TwoOptions,_.Boolean,_.PowerBIReport,_.DateAndTimeDateAndTime,_.DateAndTimeDateOnly,_.OptionSet,_.MultiSelectOptionSet,_.CardForm]),zH={numbers:[_.WholeNone,_.FP,_.Decimal,_.Currency],text:[_.SingleLineText,_.SingleLineTextArea,_.Multiple],lookup:[_.LookupSimple,_.LookupCustomer,_.LookupOwner,_.LookupPartyList,_.LookupRegarding],dates:[_.DateAndTimeDateOnly,_.DateAndTimeDateAndTime],allFields:[_.TwoOptions,_.DateAndTimeDateOnly,_.DateAndTimeDateAndTime,_.FP,_.Decimal,_.WholeNone,_.WholeDuration,_.WholeTimeZone,_.WholeLanguage,_.LookupSimple,_.LookupCustomer,_.LookupOwner,_.LookupPartyList,_.LookupRegarding,_.Multiple,_.OptionSet,_.SingleLineText,_.SingleLineTextArea,_.SingleLineEmail,_.SingleLineURL,_.SingleLineTickerSymbol,_.SingleLinePhone]}});var ar,_l,_y=I(()=>{"use strict";ar=re(Xn());Le();Fe();rt();Ui();Vi();Iy();So();X();We();ir();_l=class extends W{constructor(t){super(y.customControl,t)}customControlId;get id(){let t=this.getProperty(m.id);return N.IsNullOrUndefined(t)?null:t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?new T(t.substr(1,t.length-2)):new T(t)}getParameters(){let t=new Map,r=this.getAllChildren();if(r&&r.length!==0&&r[0]){let n=r[0].getAllChildren();if(n!=null){for(let i of n)if(i&&i.getAllChildren().length>0){let a=i.getNodeName();t.get(a)?t.get(a).push(i):t.set(a,[i])}}}return t}getFormComponentValueByParameterName(t){let r=this.getParameters()?.get(ft.value);if(r?.length>0){let n=r[0],i=n?.getAllChildren()?.length>0?n.getAllChildren().find(o=>o.getNodeName()===t):null,a=i?.getAllChildren()?.length>0?i.getAllChildren()[0].getNodeName():"";return this.normalizePropertyValue(a)}}getParameterValue(t){let r=this.getParameterNodeChild(t);return r&&this.normalizePropertyValue(r.getNodeName())}getParameterNodeChild(t){let r=this.getParameters().get(t);return r?.length>0&&r[0].getAllChildren()?.length>0?r[0].getAllChildren()[0]:null}getDatasetName(t){return t.getAllProperties().find(r=>r.key===ft.name)?.value}getParameterChildrenValues(t,r,n){if(this.isDataSet(t)){let i=r.find(u=>u.key===ft.name)?.value,a={Name:i,Type:_.Grid,Columns:[]},l=this.getParameters().get(ft.dataset).find(u=>this.getDatasetName(u)===i).getAllChildren();for(let u of l){let c=u.getNodeName();if(u&&u.getAllChildren().length>0){let d=this.normalizePropertyValue(u.getAllChildren()[0].getNodeName());a[c]=d}}return a}}getParameterIsStatic(t){let r=!1,n=this.getParameters().get(t)[0],i=n&&n.getAllProperties();if(i){for(let a of i)if(a.key===m.static&&a.value==="true"){r=!0;break}}return r}get name(){return this.getProperty(m.Name)}get formFactor(){return this.getProperty(m.formFactor)}set formFactor(t){this.setProperty(m.formFactor,t)}async toJSON(t){if(this.id)return null;let r=await this.parametersToJSON(t),n=parseInt(this.formFactor,10);return{CustomControlId:this.customControlId,FormFactor:isNaN(n)?-1:n,Name:this.name,Version:null,Parameters:r,ShouldOverrideControlVisible:!1}}normalizePropertyValue(t){return t.startsWith(Jr.StartTag)&&(t=t.substring(1)),t}async parametersToJSON(t){let r=[];if(!this.name)return r;try{let n=await t.formModelService.customControlDiscoveryService.getCustomControlMetadata(this.name);if(n)if(n.configurations){let i=n.configurations,a=this.getParameters();for(let[o,s]of a)if(this.isDataSet(o))for(let l of a.get(o)){let u=l.getAllProperties(),c=this.getDatasetName(l),d=i.get(c),p=await this.parameterJSON(o,u,d,t);r.push({Name:c,Value:p})}else if(this.isGroups(s))r.push({Name:o,Value:{Type:Xv.GroupDefinition,Value:this.normalizePropertyValue(this.getParameterNodeChild(s[0].NodeName).NodeName)}}),i.get(o).groupSet?.forEach(u=>{u.groupConfigurableProperties.forEach(async c=>{let d=c.name;c.propertyType===Eo.dataset?a.get(ft.dataset)?.some(f=>this.getDatasetName(f)===d)||r.push({Name:d,Value:{Name:d,Columns:[],Type:_.Grid}}):c.propertyType===Eo.property&&(a.has(d)||r.push({Name:d,Value:{Usage:c.usage}}))})});else{let l=s[0].getAllProperties(),u=i.get(o),c=await this.parameterJSON(o,l,u,t);if(c)r.push({Name:o,Value:c});else{(0,ar.trackInfoTrace)(dt,{eventName:`${jr}/parametersToJSON`,eventData:{message:`Configuration metadata for custom control parameter ${o} is not available for custom control : ${this.name}.`}}),r=[];break}}}else(0,ar.trackErrorTrace)(dt,{eventName:`${jr}/parametersToJSON`,eventData:{message:"Custom Control Manifest Property Info not available"}},new Error(`Custom Control Manifest Property Info not available for custom control : ${this.name}.`));else(0,ar.trackErrorTrace)(dt,{eventName:`${jr}/parametersToJSON`,eventData:{message:"Custom Control Manifest not found"}},new Error(`No custom control manifest found for ${this.name}`))}catch(n){(0,ar.trackErrorTrace)(dt,{eventName:`${jr}/parametersToJSON`,eventData:{message:"parameters to json failed"}},n)}return r}async parameterJSON(t,r,n,i){if(this.isDataSet(t)){let a=n,o=r.find(s=>s.key===ft.name)?.value;if(a)return this.getParameterChildrenValues(t,r);{let s=new Error(`No dataset manifest info for ${o}`);(0,ar.trackErrorTrace)(dt,{eventName:`${jr}/parameterJSON`,eventData:{message:"Missing custom control manifest dataset info"}},s)}}else{let a=n,o=r&&r.find(l=>l.key===m.Type),s=a&&!a.ofTypeGroup.every(l=>!Md.includes(l));if(this.isLookupType(o?.value)||this.isLookupType(a?.ofType)||s)if(a){let l=a.usage,u=this.getParameterIsStatic(t),c=a.isPrimary;if(this.name===Nn.FormComponent){let d=this.getFormComponentValueByParameterName(m.bindAttribute),p=await i.formModelService.loadLookupModel(d),f=p.lookupColumn,h=this.getLookupDataTypeFromAttributeMetadata(f);return{Name:t,Type:h,Usage:l,Static:u,Primary:c,EntityName:p.primaryTableName,Value:d,ViewId:this.getFormComponentValueByParameterName(Kv.DefaultViewId),TargetEntityType:f.targets[0],FilterRelationshipName:this.getFormComponentValueByParameterName(m.FilterRelationshipName),AvailableViewIds:this.getFormComponentValueByParameterName(m.AvailableViewIds),DependentAttributeName:this.getFormComponentValueByParameterName(m.DependentAttributeName),DependentAttributeType:this.getFormComponentValueByParameterName(m.DependentAttributeType),AllowFilterOff:P.IsStrictTrue(this.getFormComponentValueByParameterName(m.AllowFilterOff)),DisableQuickFind:P.IsStrictTrue(this.getFormComponentValueByParameterName(m.DisableQuickFind)),EnableViewPicker:!P.IsStrictTrue(this.getFormComponentValueByParameterName(m.DisableViewPicker))}}return{Name:t,Usage:l,Static:u,Primary:c,Value:this.getParameterValue(t)}}else{let l=new Error(`No lookup manifest info for ${t}`);(0,ar.trackErrorTrace)(dt,{eventName:`${jr}/parameterJSON`,eventData:{message:"Missing custom control manifest lookup property info"}},l)}if(a){let l=a.usage,u=this.getParameterIsStatic(t),c=this.getParameterValue(t),d=a.isPrimary;if(o){let f=o.value;return{Type:f,Static:u,Usage:l,Value:this.isNumberTypeProperty(a,f)&&Number(c)?Number(c):c,Primary:d}}if(a.ofType)return{Type:a.ofType,Static:u,Usage:l,Value:c,Primary:!0};if(a.ofTypeGroup)return{Static:u,Usage:l,Value:c,Primary:!0};let p=new Error(`No property type info for ${t}`);(0,ar.trackErrorTrace)(dt,{eventName:`${jr}/parameterJSON`,eventData:{message:"Missing property type info"}},p)}else{let l=new Error(`No property manifest info for ${t}`);(0,ar.trackWarningTrace)(dt,{eventName:`${jr}/parameterJSON`,eventData:{message:"Missing custom control manifest property info"}},l)}}return null}getLookupDataTypeFromAttributeMetadata(t){let{attributeType:r,format:n}=t;switch(r){case O.Customer:return _.LookupCustomer;case O.Owner:return _.LookupOwner;case O.PartyList:return _.LookupPartyList;default:return n===M.Regarding?_.LookupRegarding:_.LookupSimple}}isLookupType(t){return Md.includes(t)}isNumberTypeProperty(t,r){return Bd.includes(r)||t.ofTypeGroup.some(n=>Bd.includes(n))}isDataSet(t){return ft.dataset===t}isGroups(t){return!!t[0].getAllProperties().find(n=>n.key==="isGroup"&&n.value==="true")}}});var q,ip=I(()=>{"use strict";q=class{static get CustomControl(){return"CustomControl"}static get ACIControl(){return"ACIControl"}static get ReferencePanelSearchWidget(){return"ReferencePanelSearchWidget"}static get SearchWidgetControl(){return"SearchWidgetControl"}static get SocialInsightControl(){return"SocialInsightControl"}static get NotesControl(){return"notescontrol"}static get TimerControl(){return"TimerControl"}static get MapsControl(){return"MapsControl"}static get IframeControl(){return"IframeControl"}static get WebResourceHtmlControl(){return"WebResourceHtmlControl"}static get QuickFormCollectionControl(){return"QuickFormCollectionControl"}static get QuickFormControl(){return"QuickFormControl"}static get GridControl(){return"GridControl"}static get SubGridControl(){return"SubGridControl"}static get WebResourceImageControl(){return"WebResourceImageControl"}static get TimeLineControl(){return"TimeLineControl"}static get LeadScoringControl(){return"LeadScoringControl"}}});var R,Hi,Me,Tl=I(()=>{"use strict";Le();vo();Fe();rt();So();Kn();ip();ir();R=class{static get TextBoxControl(){return"4273EDBD-AC1D-40d3-9FB2-095C621B552D"}static get TickerControl(){return"1E1FC551-F7A8-43af-AC34-A8DC35C7B6D4"}static get UrlControl(){return"71716B6C-711E-476c-8AB8-5D11542BFB47"}static get PhoneNumberControl(){return"8C10015A-B339-4982-9474-A95FE05631A5"}static get EmailAddressControl(){return"ADA2203E-B4CD-49be-9DDF-234642B43B52"}static get RadioControl(){return"67FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED"}static get LookupControl(){return"270BD3DB-D9AF-4782-9025-509E298DEC0A"}static get DateTimeControl(){return"5B773807-9FB2-42db-97C3-7A91EFF8ADFF"}static get IntegerControl(){return"C6D124CA-7EDA-4a60-AEA9-7FB8D318B68F"}static get MoneyControl(){return"533B9E00-756B-4312-95A0-DC888637AC78"}static get FloatControl(){return"0D2C745A-E5A8-4c8f-BA63-C6D3BB604660"}static get DecimalControl(){return"C3EFE0C3-0EC6-42be-8349-CBD9079DFD8E"}static get TextAreaControl(){return"E0DECE4B-6FC8-4a8f-A065-082708572369"}static get PicklistControl(){return"3EF39988-22BB-4f0b-BBBE-64B5A3748AEE"}static get HiddenInputControl(){return"5546E6CD-394C-4BEE-94A8-4425E17EF6C6"}static get GridControl(){return"E7A81278-8635-4D9E-8D4D-59480B391C5B"}static get CheckBoxControl(){return"B0C6723A-8503-4fd7-BB28-C8A06AC933C2"}static get IframeControl(){return"FD2A7985-3187-444e-908D-6624B21F69C0"}static get SocialInsightControl(){return"86B9E25E-695E-4FEF-AC69-F05CFA96739C"}static get OrgInsightsControl(){return"76B9E25E-695E-4FEF-AC69-F05CFA96739C"}static get DurationControl(){return"AA987274-CE4E-4271-A803-66164311A958"}static get RegardingControl(){return"F3015350-44A2-4aa0-97B5-00166532B5E9"}static get PartyListControl(){return"CBFB742C-14E7-4a17-96BB-1A13F7F64AA2"}static get TimeLineControl(){return"06375649-c143-495e-a496-c962e5b4488e"}static get TimeLineControlUC(){return"06375649-C143-495E-A496-C962E5B4488E"}static get TimeZonePicklistControl(){return"7C624A0B-F59E-493d-9583-638D34759266"}static get LanguagePickerControl(){return"671A9387-CA5A-4d1e-8AB7-06E39DDCF6B5"}static get AccessTeamTablePickerControl(){return"3F4E2A56-F102-4B4D-AB9C-F1574CA5BFDA"}static get KBViewerControl(){return"A62B6FA9-169E-406C-B1AA-EAB828CB6026"}static get PicklistStatusControl(){return"5D68B988-0661-4db2-BC3E-17598AD3BE6C"}static get EmailBodyControl(){return"6F3FB987-393B-4d2d-859F-9D0F0349B6AD"}static get PicklistLookupControl(){return"2305E33A-BAD3-4022-9E15-1856CF218333"}static get RelationshipRolePicklistControl(){return"5F986642-5961-4D9F-AB5E-643D71E231E9"}static get RelatedInformationControl(){return"163B90A6-EB64-49D2-9DF8-3C84A4F0A0F8"}static get CoverPagePicklistControl(){return"4168A05C-D857-46AF-8457-5BB47EB04EA1"}static get MailMergeLanguagePickerControl(){return"B634828E-C390-444A-AFE6-E07315D9D970"}static get ConnectionControl(){return"3246F906-1F71-45F7-B11F-D7BE0F9D04C9"}static get ConnectionRoleObjectTypeListControl(){return"821ACF1A-7E46-4A0C-965D-FE14A57D78C7"}static get MapsControl(){return"62B0DF79-0464-470F-8AF7-4483CFEA0C7D"}static get MapLinkControl(){return"91DC0675-C8B9-4421-B1E0-261CEBF02BAC"}static get WebResourceHtmlControl(){return"9FDF5F91-88B1-47F4-AD53-C11EFC01A01D"}static get WebResourceImageControl(){return"587CDF98-C1D5-4BDE-8473-14A0BC7644A7"}static get WebResourceSilverlightControl(){return"080677DB-86EC-4544-AC42-F927E74B491F"}static get ReportControl(){return"A28F441B-916C-4865-87FD-0C5D53BD59C9"}static get ArticleContentControl(){return"F02EF977-2564-4B9A-B2F0-DF083D8A019B"}static get ProcessControl(){return"06E9F7AF-1F54-4681-8EEC-1E21A1CEB465"}static get ActivitiesWallControl(){return"6636847D-B74D-4994-B55A-A6FAF97ECEA2"}static get QuickFormControl(){return"69AF7DCA-2E3B-4EE7-9201-0DA731DD2413"}static get QuickFormCollectionControl(){return"5C5600E0-1D6E-4205-A272-BE80DA87FD42"}static get LinkControl(){return"DFDF1CDE-837B-4AC9-98CF-AC74361FD89D"}static get CompositionLinkControl(){return"DB1284EF-9FFC-4E99-B382-0CC082FE2364"}static get ErrorStatusControl(){return"F4C16ECA-CA81-4E39-9448-834B8378721E"}static get ActivitiesContainerControl(){return"C72511AB-84E5-4FB7-A543-25B4FC01E83E"}static get AccessPrivilegeControl(){return"F93A31B2-99AC-4084-8EC2-D4027C31369A"}static get TimerControl(){return"9C5CA0A1-AB4D-4781-BE7E-8DFBE867B87E"}static get DynamicPropertyListControl(){return"6896F004-B17A-4202-861E-8B7EA2080E0B"}static get ButtonControl(){return"00AD73DA-BD4D-49C6-88A8-2F4F4CAD4A20"}static get SearchWidgetControl(){return"E616A57F-20E0-4534-8662-A101B5DDF4E0"}static get EmailRecipientActivityControl(){return"26E9760F-7454-40DE-BB07-F6DCCCB82040"}static get LabelControl(){return"39354E4A-5015-4D74-8031-EA9EB73A1322"}static get CustomControl(){return"F9A8A302-114E-466A-B582-6771B2AE0D92"}static get EditFilterControl(){return"1479835F-F852-4679-B864-C6892A2844C9"}static get RichEditorControl(){return"F94DB24F-263D-44A7-B38E-A35E9854812B"}static get PowerBIControl(){return"8C54228C-1B25-4909-A12A-F2B968BB0D62"}static get EmailEngagementActionsControl(){return"F454228D-1D25-4319-E12F-D27968BC0234"}static get ACIControl(){return"C8BFBBEF-6851-4401-A0CC-7450062FE085"}static get ChoicesControl(){return"4AA28AB7-9C13-4F57-A73D-AD894D048B5F"}static get ReferencePanelSubgridControl(){return"02D4264B-47E2-4B4C-AA95-F439F3F4D458"}static get ReferencePanelSearchWidget(){return"7CCD1494-1F7A-4E3A-8BDE-F32069DAEB9F"}static get ReferencePanelQuickFormCollectionControl(){return"B68B05F0-A46D-43F8-843B-917920AF806A"}static get SpacerControl(){return"E4BAB03A-A9A5-4C23-CC3B-54AA680150E2"}},Hi=class{static get RelationshipAssistant(){return"3ff9a528-dd50-4aca-8f10-2e5ed73513ad"}static get PredictiveLeadScoring(){return"6f503f2a-d033-4106-b62c-f8f2e5f01a57"}},Me=class e{static FieldControlIds=e.initializeFieldControls();static UnboundControlIds=e.initializeUnboundControls();static ControlsAllowedForReferencePanel=e.initializeReferencePanelControls();static ControlsAllowedForFooter=e.initializeFooterControls();static CustomControlIdMap=new pt;static initializeFieldControls(){let t=new pt,r=e.getControlName(O.SingleLineofText,M.Phone);t.add(r,new T(R.PhoneNumberControl));let n=e.getControlName(O.SingleLineofText,M.TextArea);t.add(n,new T(R.TextAreaControl));let i=e.getControlName(O.SingleLineofText,M.Text);t.add(i,new T(R.TextBoxControl));let a=e.getControlName(O.SingleLineofText,M.Email);t.add(a,new T(R.EmailAddressControl));let o=e.getControlName(O.SingleLineofText,M.Url);t.add(o,new T(R.UrlControl));let s=e.getControlName(O.SingleLineofText,M.TickerSymbol);t.add(s,new T(R.TickerControl));let l=e.getControlName(O.SingleLineofText,M.PhoneticGuide);t.add(l,new T(R.TextBoxControl));let u=e.getControlName(O.WholeNumber,M.Duration);t.add(u,new T(R.DurationControl));let c=e.getControlName(O.WholeNumber,M.Language);t.add(c,new T(R.LanguagePickerControl));let d=e.getControlName(O.WholeNumber,M.TimeZone);t.add(d,new T(R.TimeZonePicklistControl));let p=e.getControlName(O.WholeNumber,M.None);t.add(p,new T(R.IntegerControl));let f=e.getControlName(O.DateTime,M.DateOnly);t.add(f,new T(R.DateTimeControl));let h=e.getControlName(O.DateTime,M.DateAndTime);t.add(h,new T(R.DateTimeControl));let v=e.getControlName(O.LookupType,M.None);t.add(v,new T(R.LookupControl));let w=e.getControlName(O.CustomerType,M.None);t.add(w,new T(R.LookupControl));let E=e.getControlName(O.FloatingPointNumber,M.None);t.add(E,new T(R.FloatControl));let D=e.getControlName(O.DecimalNumber,M.None);t.add(D,new T(R.DecimalControl));let x=e.getControlName(O.Currency,M.None);t.add(x,new T(R.MoneyControl));let F=e.getControlName(O.MultipleLineofText,M.None);t.add(F,new T(R.TextAreaControl));let j=e.getControlName(O.MultipleLineofText,M.Text);t.add(j,new T(R.TextAreaControl));let L=e.getControlName(O.MultipleLineofText,M.TextArea);t.add(L,new T(R.TextAreaControl));let V=e.getControlName(O.MultipleLineofText,M.Email);t.add(V,new T(R.EmailBodyControl));let B=e.getControlName(O.OptionSet,M.None);t.add(B,new T(R.PicklistControl));let U=e.getControlName(O.TwoOptions,M.None);t.add(U,new T(R.RadioControl));let z=e.getControlName(O.Image,M.None);t.add(z,new T(R.WebResourceImageControl));let $=e.getControlName(O.Image,M.None);t.add($,new T(R.WebResourceHtmlControl));let Oe=e.getControlName(O.TwoOptions,"Radio");t.add(Oe,new T(R.RadioControl));let vt=e.getControlName(O.TwoOptions,"CheckBox");t.add(vt,new T(R.CheckBoxControl));let pe=e.getControlName(O.TwoOptions,"List");t.add(pe,new T(R.PicklistControl));let Ke=e.getControlName(O.State,M.None);t.add(Ke,new T(R.PicklistControl));let Z=e.getControlName(O.Status,M.None);t.add(Z,new T(R.PicklistStatusControl));let yt=e.getControlName(O.OwnerType,M.None);t.add(yt,new T(R.LookupControl));let lc=e.getControlName(O.PartyListType,M.None);t.add(lc,new T(R.PartyListControl));let GT=e.getControlName(O.LookupType,M.Regarding);t.add(GT,new T(R.RegardingControl));let zT=e.getControlName(O.MultiSelectOptionSet,M.None);return t.add(zT,new T(R.ChoicesControl)),t}static getControlName(t,r){return t+"_"+r}static getControlIdByTypeAndFormat(t,r){let n=e.getControlName(t.toString(),r.toString());return e.FieldControlIds.containsKey(n)?e.FieldControlIds.getValue(n):null}static getTypeAndFormatByControlOrUniqueId(t){for(let r in e.FieldControlIds.getKeys())if(e.FieldControlIds.getValue(e.FieldControlIds.getKeys()[r]).guidString.toLowerCase()===t)return e.FieldControlIds.getKeys()[r]}static getControlDataTypeByControlOrUniqueId(t){if(!N.IsNullOrEmptyGuid(t)){let r=e.getTypeAndFormatByControlOrUniqueId(t.guidString.toLowerCase());return r=N.IsNullOrUndefined(r)?e.getUnboundControlNameFromIdentifier(t):r.substring(0,r.indexOf("_")),r}return null}static isCustomControl(t){return N.IsNullOrUndefined(t.control)||N.IsNullOrUndefined(t.control.ClassId)||t.control.ClassId.guidString===R.CustomControl}static initializeUnboundControls(){let t=new pt;return t.add(R.ACIControl,q.ACIControl),t.add(R.IframeControl,q.IframeControl),t.add(R.SearchWidgetControl,q.SearchWidgetControl),t.add(R.MapsControl,q.MapsControl),t.add(R.QuickFormCollectionControl,q.QuickFormCollectionControl),t.add(R.GridControl,q.SubGridControl),t.add(R.WebResourceImageControl,q.WebResourceImageControl),t.add(R.WebResourceHtmlControl,q.WebResourceHtmlControl),t.add(R.ReferencePanelSearchWidget,q.SearchWidgetControl),t.add(R.ReferencePanelQuickFormCollectionControl,q.QuickFormCollectionControl),t.add(R.ReferencePanelSubgridControl,q.SubGridControl),t.add(R.TimerControl,q.TimerControl),t.add(R.TimeLineControl,q.NotesControl),t.add(R.TimeLineControlUC,q.NotesControl),t.add(R.SocialInsightControl,q.SocialInsightControl),t.add(Hi.RelationshipAssistant,q.CustomControl),t}static initializeReferencePanelControls(){let t=new pt;return t.add(R.IframeControl,q.IframeControl),t.add(R.ReferencePanelSearchWidget,q.SearchWidgetControl),t.add(R.ReferencePanelQuickFormCollectionControl,q.QuickFormCollectionControl),t.add(R.ReferencePanelSubgridControl,q.SubGridControl),t.add(R.WebResourceHtmlControl,q.WebResourceHtmlControl),t.add(R.WebResourceImageControl,q.WebResourceHtmlControl),t}static initializeFooterControls(){let t=new $i;return t.add(zi.IFRAME,!0),t.add(zi.SPACER,!0),t.add(zi.WEB_RESOURCE_HTML,!0),t}static isUnboundFormControl(t){if(N.IsNullOrUndefined(t)||N.IsNullOrUndefined(t.control)||N.IsNullOrUndefined(t.control.ClassId))return!1;let r=e.getUniqueIdentifierForControl(t.control);return e.UnboundControlIds.containsKey(r.guidString)}static isReferencePanelSection(t){return!N.IsNullOrUndefined(t)&&!N.IsNullOrUndefined(t.Name)&&t.Name.indexOf(Ae.referencePanelNamePrefix)===0}static isUnboundFormControlByIdentifier(t){return N.IsNullOrUndefined(t)||N.IsNullOrUndefined(t.guidString)?!1:e.UnboundControlIds.containsKey(t.guidString)}static getUnboundFormControlName(t){let r=P.EmptyString;if(N.IsNullOrUndefined(t)||N.IsNullOrUndefined(t.control)||N.IsNullOrUndefined(t.control.ClassId))return r;let n=e.getUniqueIdentifierForControl(t.control);return e.UnboundControlIds.getValue(n.guidString).toString()}static getUnboundControlNameFromIdentifier(t){return N.IsNullOrUndefined(t)||N.IsNullOrUndefined(t.guidString)?P.EmptyString:e.UnboundControlIds.getValue(t.guidString).toString()}static isSpacerControl(t){return t===R.SpacerControl}static GetRowSpan(t){let r=t.ClassId;if(e.isRelationshipAssistantControl(t))r=t.UniqueId;else if(r.guidString===R.CustomControl&&!N.IsNullOrUndefined(t.UniqueId)){let n=t.UniqueId.ToString();e.CustomControlIdMap.containsKey(n)&&(r=e.CustomControlIdMap.getValue(n))}switch(e.UnboundControlIds.getValue(r.guidString)){case q.IframeControl:case q.ACIControl:case q.SocialInsightControl:return 6;case q.SubGridControl:case q.CustomControl:return 4;case q.WebResourceImageControl:return 15;case q.WebResourceHtmlControl:return 15;case q.MapsControl:return 8;case q.SearchWidgetControl:return 10;case q.NotesControl:case q.TimeLineControl:return 15;case q.TimerControl:return 2;default:}}static isLookUpControl(t){return!N.IsNullOrUndefined(t)&&t.ClassId.guidString===R.LookupControl}static isRelationshipAssistantOrLeadScoringControl(t){return!N.IsNullOrUndefined(t)&&e.isRelationshipAssistantOrLeadScoring(t.UniqueId)}static isRelationshipAssistantOrLeadScoring(t){return!N.IsNullOrUndefined(t)&&(t.guidString===Hi.RelationshipAssistant||t.guidString===Hi.PredictiveLeadScoring)}static isRelationshipAssistantControl(t){return!N.IsNullOrUndefined(t)&&e.isRelationshipAssistant(t.UniqueId)}static isRelationshipAssistant(t){return!N.IsNullOrUndefined(t)&&t.guidString===Hi.RelationshipAssistant}static getUniqueIdentifierForControl(t){if(N.IsNullOrUndefined(t))return null;let r=t.ClassId;if(e.isRelationshipAssistantControl(t))r=t.UniqueId;else if(r.guidString===R.CustomControl&&!N.IsNullOrUndefined(t.UniqueId)){let n=t.UniqueId.ToString();e.CustomControlIdMap.containsKey(n)&&(r=e.CustomControlIdMap.getValue(n))}return r}}});var Pl,Ty=I(()=>{"use strict";Pl=class{listeners=[];listenersOncer=[];on(t){return this.listeners.push(t),{dispose:()=>this.off(t)}}once(t){this.listenersOncer.push(t)}off(t){let r=this.listeners.indexOf(t);r>-1&&this.listeners.splice(r,1)}emit(t){this.listeners.forEach(r=>r(t)),this.listenersOncer.forEach(r=>r(t)),this.listenersOncer=[]}pipe(t){return this.on(r=>t.emit(r))}}});var ri,ji,Py,Oy,Dn,Ry,Fy,ap=I(()=>{"use strict";(function(e){e[e.Center=0]="Center",e[e.Left=1]="Left",e[e.Right=2]="Right"})(ri||(ri={}));(function(e){e[e.Left=0]="Left",e[e.Top=1]="Top"})(ji||(ji={}));(function(e){e[e.Top=0]="Top",e[e.Middle=1]="Middle"})(Py||(Py={}));(function(e){e[e.None=0]="None",e[e.Create=1]="Create",e[e.Existing=2]="Existing",e[e.ReadOnly=3]="ReadOnly",e[e.Disabled=4]="Disabled",e[e.BulkEdit=6]="BulkEdit",e[e.Merge=7]="Merge",e[e.Print=8]="Print",e[e.FollowUp=9]="FollowUp"})(Oy||(Oy={}));(function(e){e[e.None=-1]="None",e[e.AppointmentBook=0]="AppointmentBook",e[e.Hardcoded=1]="Hardcoded",e[e.Main=2]="Main",e[e.MiniCampaignBO=3]="MiniCampaignBO",e[e.Preview=4]="Preview",e[e.Dashboard=5]="Dashboard",e[e.Quick=6]="Quick",e[e.Mobile=7]="Mobile",e[e.Read=8]="Read",e[e.QuickCreate=9]="QuickCreate",e[e.Dialog=10]="Dialog",e[e.Card=11]="Card",e[e.TaskBasedForm=12]="TaskBasedForm",e[e.InteractionCentricDashboard=13]="InteractionCentricDashboard"})(Dn||(Dn={}));(function(e){e[e.None=0]="None",e[e.SystemRequired=1]="SystemRequired",e[e.ApplicationRequired=2]="ApplicationRequired",e[e.Recommended=3]="Recommended"})(Ry||(Ry={}));(function(e){e[e.Boolean=0]="Boolean",e[e.Customer=1]="Customer",e[e.DateTime=2]="DateTime",e[e.Decimal=3]="Decimal",e[e.Double=4]="Double",e[e.Integer=5]="Integer",e[e.Lookup=6]="Lookup",e[e.Memo=7]="Memo",e[e.Money=8]="Money",e[e.Owner=9]="Owner",e[e.PartyList=10]="PartyList",e[e.Picklist=11]="Picklist",e[e.State=12]="State",e[e.Status=13]="Status",e[e.String=14]="String",e[e.Uniqueidentifier=15]="Uniqueidentifier",e[e.CalendarRules=16]="CalendarRules",e[e.Virtual=17]="Virtual",e[e.BigInt=18]="BigInt",e[e.ManagedProperty=19]="ManagedProperty",e[e.EntityName=20]="EntityName"})(Fy||(Fy={}))});var Qi,xy=I(()=>{"use strict";Co();Qi=zd({packageName:"cds-designer-models",features:{showAllPCFControls:{owner:"anchoudh",description:"Do not only show the controls that exist on the whitelist",enabledFor:{test:!1,preprod:!1,preview:!1,prod:!1,gov:!1,high:!1,dod:!1,mooncake:!1}},showTestControls:{owner:"lucorre",description:"Show advanced custom controls for testing (designated in Authoring Manifest with isTestOnly=true)",enabledFor:{test:!0,preprod:!1,preview:!1,prod:!1,gov:!1,high:!1,dod:!1,mooncake:!1}},enablePrefetchGetMoreComponentsLocalization:{owner:"vajagarl",description:"Enables prefetching the localization files for controls displayed in custom control picker",enabledFor:{test:!0,preprod:!0,preview:!0,prod:!0,gov:!0,high:!0,dod:!0,mooncake:!0}},showMapControl:{owner:"vayilavarapu",createdDate:"07/19/2022",description:"Show map control",enabledFor:{test:!0,preprod:!0,preview:!0,prod:!0,gov:!0,high:!0,dod:!0,mooncake:!0,ex:!0,rx:!0}},enableFallbackFormTemplate:{owner:"vajagarl",createdDate:"01/03/2023",description:"Enable default form template as fallback if unable to retrieve a form template from Dataverse",enabledFor:{test:!0,preprod:!0,preview:!0,prod:!0,gov:!0,high:!0,dod:!0,mooncake:!0,ex:!0,rx:!0}},enableAutoInsertionOfCellInRow:{owner:"debeshd",createdDate:"09/01/2023",description:"Enable the auto insertion of cell in a row when a section is initialized",enabledFor:{test:!1,preprod:!1,preview:!1,prod:!1,gov:!1,high:!1,dod:!1,mooncake:!1,ex:!1,rx:!1}},enableOneGridEvents:{owner:"aansu",createdDate:"08/21/2024",description:"Enable OneGrid events in form designer",enabledFor:{test:!0,preprod:!0,prod:!0,preview:!0,gov:!0,high:!0,dod:!0,mooncake:!0,ex:!0,rx:!0}},disablePBIComponents:{owner:"adekulkarni",createdDate:"02/13/2025",description:"Disables PBI components and cleans them up from the form",enabledFor:{test:!0,preprod:!1,preview:!1,prod:!1,gov:!1,high:!1,dod:!1,mooncake:!1,ex:!1,rx:!1}},enableAgentResponse:{owner:"jennietu",createdDate:"04/24/2025",description:"Enables agent response in form designer",enabledFor:{test:!0,preprod:!0,preview:!1,prod:!1,gov:!1,high:!1,dod:!1,mooncake:!1,ex:!1,rx:!1}},enableDelayedLocalizationForCustomControls:{owner:"aansu",createdDate:"06/08/2025",description:"Enables delayed localization of custom control",enabledFor:{test:!0,preprod:!0,preview:!0,prod:!0,gov:!0,high:!0,dod:!0,mooncake:!0,ex:!0,rx:!0}}}})});function Ly(e){return{...e,extractConfig:t=>RL(t,Object.keys(e.fallback))}}function RL(e,t){let r={};for(let n of t)typeof e[n]<"u"&&(r[n]=e[n]);return r}var op=I(()=>{"use strict";});var sp=g((yj,My)=>{var No=new Proxy(function(){return No},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:No},apply:function(){return No},construct:function(){return{}}}),ky=function(){return No};Object.setPrototypeOf(ky,No);My.exports=ky});var $y=g((bj,Uy)=>{var Do=new Proxy(function(){return Do},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:Do},apply:function(){return Do},construct:function(){return{}}}),By=function(){return Do};Object.setPrototypeOf(By,Do);Uy.exports=By});var lp=g((wj,Vy)=>{var Io=new Proxy(function(){return Io},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:Io},apply:function(){return Io},construct:function(){return{}}}),qy=function(){return Io};Object.setPrototypeOf(qy,Io);Vy.exports=qy});var zy=g((Aj,Gy)=>{function FL(){this.__data__=[],this.size=0}Gy.exports=FL});var Ji=g((Cj,Wy)=>{function xL(e,t){return e===t||e!==e&&t!==t}Wy.exports=xL});var _o=g((Sj,Hy)=>{var LL=Ji();function kL(e,t){for(var r=e.length;r--;)if(LL(e[r][0],t))return r;return-1}Hy.exports=kL});var Qy=g((Ej,jy)=>{var ML=_o(),BL=Array.prototype,UL=BL.splice;function $L(e){var t=this.__data__,r=ML(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():UL.call(t,r,1),--this.size,!0}jy.exports=$L});var Ky=g((Nj,Jy)=>{var qL=_o();function VL(e){var t=this.__data__,r=qL(t,e);return r<0?void 0:t[r][1]}Jy.exports=VL});var Yy=g((Dj,Xy)=>{var GL=_o();function zL(e){return GL(this.__data__,e)>-1}Xy.exports=zL});var eb=g((Ij,Zy)=>{var WL=_o();function HL(e,t){var r=this.__data__,n=WL(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}Zy.exports=HL});var To=g((_j,tb)=>{var jL=zy(),QL=Qy(),JL=Ky(),KL=Yy(),XL=eb();function Ki(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Ki.prototype.clear=jL;Ki.prototype.delete=QL;Ki.prototype.get=JL;Ki.prototype.has=KL;Ki.prototype.set=XL;tb.exports=Ki});var nb=g((Tj,rb)=>{var YL=To();function ZL(){this.__data__=new YL,this.size=0}rb.exports=ZL});var ab=g((Pj,ib)=>{function ek(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}ib.exports=ek});var sb=g((Oj,ob)=>{function tk(e){return this.__data__.get(e)}ob.exports=tk});var ub=g((Rj,lb)=>{function rk(e){return this.__data__.has(e)}lb.exports=rk});var up=g((Fj,cb)=>{var nk=typeof global=="object"&&global&&global.Object===Object&&global;cb.exports=nk});var or=g((xj,db)=>{var ik=up(),ak=typeof self=="object"&&self&&self.Object===Object&&self,ok=ik||ak||Function("return this")();db.exports=ok});var Po=g((Lj,pb)=>{var sk=or(),lk=sk.Symbol;pb.exports=lk});var gb=g((kj,hb)=>{var fb=Po(),mb=Object.prototype,uk=mb.hasOwnProperty,ck=mb.toString,Oo=fb?fb.toStringTag:void 0;function dk(e){var t=uk.call(e,Oo),r=e[Oo];try{e[Oo]=void 0;var n=!0}catch{}var i=ck.call(e);return n&&(t?e[Oo]=r:delete e[Oo]),i}hb.exports=dk});var yb=g((Mj,vb)=>{var pk=Object.prototype,fk=pk.toString;function mk(e){return fk.call(e)}vb.exports=mk});var ni=g((Bj,Ab)=>{var bb=Po(),hk=gb(),gk=yb(),vk="[object Null]",yk="[object Undefined]",wb=bb?bb.toStringTag:void 0;function bk(e){return e==null?e===void 0?yk:vk:wb&&wb in Object(e)?hk(e):gk(e)}Ab.exports=bk});var Kr=g((Uj,Cb)=>{function wk(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}Cb.exports=wk});var Ol=g(($j,Sb)=>{var Ak=ni(),Ck=Kr(),Sk="[object AsyncFunction]",Ek="[object Function]",Nk="[object GeneratorFunction]",Dk="[object Proxy]";function Ik(e){if(!Ck(e))return!1;var t=Ak(e);return t==Ek||t==Nk||t==Sk||t==Dk}Sb.exports=Ik});var Nb=g((qj,Eb)=>{var _k=or(),Tk=_k["__core-js_shared__"];Eb.exports=Tk});var _b=g((Vj,Ib)=>{var cp=Nb(),Db=(function(){var e=/[^.]+$/.exec(cp&&cp.keys&&cp.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function Pk(e){return!!Db&&Db in e}Ib.exports=Pk});var dp=g((Gj,Tb)=>{var Ok=Function.prototype,Rk=Ok.toString;function Fk(e){if(e!=null){try{return Rk.call(e)}catch{}try{return e+""}catch{}}return""}Tb.exports=Fk});var Ob=g((zj,Pb)=>{var xk=Ol(),Lk=_b(),kk=Kr(),Mk=dp(),Bk=/[\\^$.*+?()[\]{}|]/g,Uk=/^\[object .+?Constructor\]$/,$k=Function.prototype,qk=Object.prototype,Vk=$k.toString,Gk=qk.hasOwnProperty,zk=RegExp("^"+Vk.call(Gk).replace(Bk,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Wk(e){if(!kk(e)||Lk(e))return!1;var t=xk(e)?zk:Uk;return t.test(Mk(e))}Pb.exports=Wk});var Fb=g((Wj,Rb)=>{function Hk(e,t){return e?.[t]}Rb.exports=Hk});var In=g((Hj,xb)=>{var jk=Ob(),Qk=Fb();function Jk(e,t){var r=Qk(e,t);return jk(r)?r:void 0}xb.exports=Jk});var Rl=g((jj,Lb)=>{var Kk=In(),Xk=or(),Yk=Kk(Xk,"Map");Lb.exports=Yk});var Ro=g((Qj,kb)=>{var Zk=In(),eM=Zk(Object,"create");kb.exports=eM});var Ub=g((Jj,Bb)=>{var Mb=Ro();function tM(){this.__data__=Mb?Mb(null):{},this.size=0}Bb.exports=tM});var qb=g((Kj,$b)=>{function rM(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}$b.exports=rM});var Gb=g((Xj,Vb)=>{var nM=Ro(),iM="__lodash_hash_undefined__",aM=Object.prototype,oM=aM.hasOwnProperty;function sM(e){var t=this.__data__;if(nM){var r=t[e];return r===iM?void 0:r}return oM.call(t,e)?t[e]:void 0}Vb.exports=sM});var Wb=g((Yj,zb)=>{var lM=Ro(),uM=Object.prototype,cM=uM.hasOwnProperty;function dM(e){var t=this.__data__;return lM?t[e]!==void 0:cM.call(t,e)}zb.exports=dM});var jb=g((Zj,Hb)=>{var pM=Ro(),fM="__lodash_hash_undefined__";function mM(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=pM&&t===void 0?fM:t,this}Hb.exports=mM});var Jb=g((eQ,Qb)=>{var hM=Ub(),gM=qb(),vM=Gb(),yM=Wb(),bM=jb();function Xi(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Xi.prototype.clear=hM;Xi.prototype.delete=gM;Xi.prototype.get=vM;Xi.prototype.has=yM;Xi.prototype.set=bM;Qb.exports=Xi});var Yb=g((tQ,Xb)=>{var Kb=Jb(),wM=To(),AM=Rl();function CM(){this.size=0,this.__data__={hash:new Kb,map:new(AM||wM),string:new Kb}}Xb.exports=CM});var ew=g((rQ,Zb)=>{function SM(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}Zb.exports=SM});var Fo=g((nQ,tw)=>{var EM=ew();function NM(e,t){var r=e.__data__;return EM(t)?r[typeof t=="string"?"string":"hash"]:r.map}tw.exports=NM});var nw=g((iQ,rw)=>{var DM=Fo();function IM(e){var t=DM(this,e).delete(e);return this.size-=t?1:0,t}rw.exports=IM});var aw=g((aQ,iw)=>{var _M=Fo();function TM(e){return _M(this,e).get(e)}iw.exports=TM});var sw=g((oQ,ow)=>{var PM=Fo();function OM(e){return PM(this,e).has(e)}ow.exports=OM});var uw=g((sQ,lw)=>{var RM=Fo();function FM(e,t){var r=RM(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}lw.exports=FM});var Fl=g((lQ,cw)=>{var xM=Yb(),LM=nw(),kM=aw(),MM=sw(),BM=uw();function Yi(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Yi.prototype.clear=xM;Yi.prototype.delete=LM;Yi.prototype.get=kM;Yi.prototype.has=MM;Yi.prototype.set=BM;cw.exports=Yi});var pw=g((uQ,dw)=>{var UM=To(),$M=Rl(),qM=Fl(),VM=200;function GM(e,t){var r=this.__data__;if(r instanceof UM){var n=r.__data__;if(!$M||n.length<VM-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new qM(n)}return r.set(e,t),this.size=r.size,this}dw.exports=GM});var pp=g((cQ,fw)=>{var zM=To(),WM=nb(),HM=ab(),jM=sb(),QM=ub(),JM=pw();function Zi(e){var t=this.__data__=new zM(e);this.size=t.size}Zi.prototype.clear=WM;Zi.prototype.delete=HM;Zi.prototype.get=jM;Zi.prototype.has=QM;Zi.prototype.set=JM;fw.exports=Zi});var hw=g((dQ,mw)=>{var KM="__lodash_hash_undefined__";function XM(e){return this.__data__.set(e,KM),this}mw.exports=XM});var vw=g((pQ,gw)=>{function YM(e){return this.__data__.has(e)}gw.exports=YM});var bw=g((fQ,yw)=>{var ZM=Fl(),eB=hw(),tB=vw();function xl(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new ZM;++t<r;)this.add(e[t])}xl.prototype.add=xl.prototype.push=eB;xl.prototype.has=tB;yw.exports=xl});var Aw=g((mQ,ww)=>{function rB(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}ww.exports=rB});var Sw=g((hQ,Cw)=>{function nB(e,t){return e.has(t)}Cw.exports=nB});var fp=g((gQ,Ew)=>{var iB=bw(),aB=Aw(),oB=Sw(),sB=1,lB=2;function uB(e,t,r,n,i,a){var o=r&sB,s=e.length,l=t.length;if(s!=l&&!(o&&l>s))return!1;var u=a.get(e),c=a.get(t);if(u&&c)return u==t&&c==e;var d=-1,p=!0,f=r&lB?new iB:void 0;for(a.set(e,t),a.set(t,e);++d<s;){var h=e[d],v=t[d];if(n)var w=o?n(v,h,d,t,e,a):n(h,v,d,e,t,a);if(w!==void 0){if(w)continue;p=!1;break}if(f){if(!aB(t,function(E,D){if(!oB(f,D)&&(h===E||i(h,E,r,n,a)))return f.push(D)})){p=!1;break}}else if(!(h===v||i(h,v,r,n,a))){p=!1;break}}return a.delete(e),a.delete(t),p}Ew.exports=uB});var mp=g((vQ,Nw)=>{var cB=or(),dB=cB.Uint8Array;Nw.exports=dB});var Iw=g((yQ,Dw)=>{function pB(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}Dw.exports=pB});var Tw=g((bQ,_w)=>{function fB(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}_w.exports=fB});var xw=g((wQ,Fw)=>{var Pw=Po(),Ow=mp(),mB=Ji(),hB=fp(),gB=Iw(),vB=Tw(),yB=1,bB=2,wB="[object Boolean]",AB="[object Date]",CB="[object Error]",SB="[object Map]",EB="[object Number]",NB="[object RegExp]",DB="[object Set]",IB="[object String]",_B="[object Symbol]",TB="[object ArrayBuffer]",PB="[object DataView]",Rw=Pw?Pw.prototype:void 0,hp=Rw?Rw.valueOf:void 0;function OB(e,t,r,n,i,a,o){switch(r){case PB:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case TB:return!(e.byteLength!=t.byteLength||!a(new Ow(e),new Ow(t)));case wB:case AB:case EB:return mB(+e,+t);case CB:return e.name==t.name&&e.message==t.message;case NB:case IB:return e==t+"";case SB:var s=gB;case DB:var l=n&yB;if(s||(s=vB),e.size!=t.size&&!l)return!1;var u=o.get(e);if(u)return u==t;n|=bB,o.set(e,t);var c=hB(s(e),s(t),n,i,a,o);return o.delete(e),c;case _B:if(hp)return hp.call(e)==hp.call(t)}return!1}Fw.exports=OB});var kw=g((AQ,Lw)=>{function RB(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}Lw.exports=RB});var _n=g((CQ,Mw)=>{var FB=Array.isArray;Mw.exports=FB});var Uw=g((SQ,Bw)=>{var xB=kw(),LB=_n();function kB(e,t,r){var n=t(e);return LB(e)?n:xB(n,r(e))}Bw.exports=kB});var qw=g((EQ,$w)=>{function MB(e,t){for(var r=-1,n=e==null?0:e.length,i=0,a=[];++r<n;){var o=e[r];t(o,r,e)&&(a[i++]=o)}return a}$w.exports=MB});var Gw=g((NQ,Vw)=>{function BB(){return[]}Vw.exports=BB});var Hw=g((DQ,Ww)=>{var UB=qw(),$B=Gw(),qB=Object.prototype,VB=qB.propertyIsEnumerable,zw=Object.getOwnPropertySymbols,GB=zw?function(e){return e==null?[]:(e=Object(e),UB(zw(e),function(t){return VB.call(e,t)}))}:$B;Ww.exports=GB});var Qw=g((IQ,jw)=>{function zB(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}jw.exports=zB});var Tn=g((_Q,Jw)=>{function WB(e){return e!=null&&typeof e=="object"}Jw.exports=WB});var Xw=g((TQ,Kw)=>{var HB=ni(),jB=Tn(),QB="[object Arguments]";function JB(e){return jB(e)&&HB(e)==QB}Kw.exports=JB});var gp=g((PQ,eA)=>{var Yw=Xw(),KB=Tn(),Zw=Object.prototype,XB=Zw.hasOwnProperty,YB=Zw.propertyIsEnumerable,ZB=Yw((function(){return arguments})())?Yw:function(e){return KB(e)&&XB.call(e,"callee")&&!YB.call(e,"callee")};eA.exports=ZB});var rA=g((OQ,tA)=>{function eU(){return!1}tA.exports=eU});var Ll=g((xo,ea)=>{var tU=or(),rU=rA(),aA=typeof xo=="object"&&xo&&!xo.nodeType&&xo,nA=aA&&typeof ea=="object"&&ea&&!ea.nodeType&&ea,nU=nA&&nA.exports===aA,iA=nU?tU.Buffer:void 0,iU=iA?iA.isBuffer:void 0,aU=iU||rU;ea.exports=aU});var kl=g((RQ,oA)=>{var oU=9007199254740991,sU=/^(?:0|[1-9]\d*)$/;function lU(e,t){var r=typeof e;return t=t??oU,!!t&&(r=="number"||r!="symbol"&&sU.test(e))&&e>-1&&e%1==0&&e<t}oA.exports=lU});var vp=g((FQ,sA)=>{var uU=9007199254740991;function cU(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=uU}sA.exports=cU});var uA=g((xQ,lA)=>{var dU=ni(),pU=vp(),fU=Tn(),mU="[object Arguments]",hU="[object Array]",gU="[object Boolean]",vU="[object Date]",yU="[object Error]",bU="[object Function]",wU="[object Map]",AU="[object Number]",CU="[object Object]",SU="[object RegExp]",EU="[object Set]",NU="[object String]",DU="[object WeakMap]",IU="[object ArrayBuffer]",_U="[object DataView]",TU="[object Float32Array]",PU="[object Float64Array]",OU="[object Int8Array]",RU="[object Int16Array]",FU="[object Int32Array]",xU="[object Uint8Array]",LU="[object Uint8ClampedArray]",kU="[object Uint16Array]",MU="[object Uint32Array]",ge={};ge[TU]=ge[PU]=ge[OU]=ge[RU]=ge[FU]=ge[xU]=ge[LU]=ge[kU]=ge[MU]=!0;ge[mU]=ge[hU]=ge[IU]=ge[gU]=ge[_U]=ge[vU]=ge[yU]=ge[bU]=ge[wU]=ge[AU]=ge[CU]=ge[SU]=ge[EU]=ge[NU]=ge[DU]=!1;function BU(e){return fU(e)&&pU(e.length)&&!!ge[dU(e)]}lA.exports=BU});var dA=g((LQ,cA)=>{function UU(e){return function(t){return e(t)}}cA.exports=UU});var fA=g((Lo,ta)=>{var $U=up(),pA=typeof Lo=="object"&&Lo&&!Lo.nodeType&&Lo,ko=pA&&typeof ta=="object"&&ta&&!ta.nodeType&&ta,qU=ko&&ko.exports===pA,yp=qU&&$U.process,VU=(function(){try{var e=ko&&ko.require&&ko.require("util").types;return e||yp&&yp.binding&&yp.binding("util")}catch{}})();ta.exports=VU});var Ml=g((kQ,gA)=>{var GU=uA(),zU=dA(),mA=fA(),hA=mA&&mA.isTypedArray,WU=hA?zU(hA):GU;gA.exports=WU});var bp=g((MQ,vA)=>{var HU=Qw(),jU=gp(),QU=_n(),JU=Ll(),KU=kl(),XU=Ml(),YU=Object.prototype,ZU=YU.hasOwnProperty;function e$(e,t){var r=QU(e),n=!r&&jU(e),i=!r&&!n&&JU(e),a=!r&&!n&&!i&&XU(e),o=r||n||i||a,s=o?HU(e.length,String):[],l=s.length;for(var u in e)(t||ZU.call(e,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||KU(u,l)))&&s.push(u);return s}vA.exports=e$});var Bl=g((BQ,yA)=>{var t$=Object.prototype;function r$(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||t$;return e===r}yA.exports=r$});var wp=g((UQ,bA)=>{function n$(e,t){return function(r){return e(t(r))}}bA.exports=n$});var AA=g(($Q,wA)=>{var i$=wp(),a$=i$(Object.keys,Object);wA.exports=a$});var SA=g((qQ,CA)=>{var o$=Bl(),s$=AA(),l$=Object.prototype,u$=l$.hasOwnProperty;function c$(e){if(!o$(e))return s$(e);var t=[];for(var r in Object(e))u$.call(e,r)&&r!="constructor"&&t.push(r);return t}CA.exports=c$});var Mo=g((VQ,EA)=>{var d$=Ol(),p$=vp();function f$(e){return e!=null&&p$(e.length)&&!d$(e)}EA.exports=f$});var DA=g((GQ,NA)=>{var m$=bp(),h$=SA(),g$=Mo();function v$(e){return g$(e)?m$(e):h$(e)}NA.exports=v$});var _A=g((zQ,IA)=>{var y$=Uw(),b$=Hw(),w$=DA();function A$(e){return y$(e,w$,b$)}IA.exports=A$});var OA=g((WQ,PA)=>{var TA=_A(),C$=1,S$=Object.prototype,E$=S$.hasOwnProperty;function N$(e,t,r,n,i,a){var o=r&C$,s=TA(e),l=s.length,u=TA(t),c=u.length;if(l!=c&&!o)return!1;for(var d=l;d--;){var p=s[d];if(!(o?p in t:E$.call(t,p)))return!1}var f=a.get(e),h=a.get(t);if(f&&h)return f==t&&h==e;var v=!0;a.set(e,t),a.set(t,e);for(var w=o;++d<l;){p=s[d];var E=e[p],D=t[p];if(n)var x=o?n(D,E,p,t,e,a):n(E,D,p,e,t,a);if(!(x===void 0?E===D||i(E,D,r,n,a):x)){v=!1;break}w||(w=p=="constructor")}if(v&&!w){var F=e.constructor,j=t.constructor;F!=j&&"constructor"in e&&"constructor"in t&&!(typeof F=="function"&&F instanceof F&&typeof j=="function"&&j instanceof j)&&(v=!1)}return a.delete(e),a.delete(t),v}PA.exports=N$});var FA=g((HQ,RA)=>{var D$=In(),I$=or(),_$=D$(I$,"DataView");RA.exports=_$});var LA=g((jQ,xA)=>{var T$=In(),P$=or(),O$=T$(P$,"Promise");xA.exports=O$});var MA=g((QQ,kA)=>{var R$=In(),F$=or(),x$=R$(F$,"Set");kA.exports=x$});var UA=g((JQ,BA)=>{var L$=In(),k$=or(),M$=L$(k$,"WeakMap");BA.exports=M$});var jA=g((KQ,HA)=>{var Ap=FA(),Cp=Rl(),Sp=LA(),Ep=MA(),Np=UA(),WA=ni(),ra=dp(),$A="[object Map]",B$="[object Object]",qA="[object Promise]",VA="[object Set]",GA="[object WeakMap]",zA="[object DataView]",U$=ra(Ap),$$=ra(Cp),q$=ra(Sp),V$=ra(Ep),G$=ra(Np),ii=WA;(Ap&&ii(new Ap(new ArrayBuffer(1)))!=zA||Cp&&ii(new Cp)!=$A||Sp&&ii(Sp.resolve())!=qA||Ep&&ii(new Ep)!=VA||Np&&ii(new Np)!=GA)&&(ii=function(e){var t=WA(e),r=t==B$?e.constructor:void 0,n=r?ra(r):"";if(n)switch(n){case U$:return zA;case $$:return $A;case q$:return qA;case V$:return VA;case G$:return GA}return t});HA.exports=ii});var tC=g((XQ,eC)=>{var Dp=pp(),z$=fp(),W$=xw(),H$=OA(),QA=jA(),JA=_n(),KA=Ll(),j$=Ml(),Q$=1,XA="[object Arguments]",YA="[object Array]",Ul="[object Object]",J$=Object.prototype,ZA=J$.hasOwnProperty;function K$(e,t,r,n,i,a){var o=JA(e),s=JA(t),l=o?YA:QA(e),u=s?YA:QA(t);l=l==XA?Ul:l,u=u==XA?Ul:u;var c=l==Ul,d=u==Ul,p=l==u;if(p&&KA(e)){if(!KA(t))return!1;o=!0,c=!1}if(p&&!c)return a||(a=new Dp),o||j$(e)?z$(e,t,r,n,i,a):W$(e,t,l,r,n,i,a);if(!(r&Q$)){var f=c&&ZA.call(e,"__wrapped__"),h=d&&ZA.call(t,"__wrapped__");if(f||h){var v=f?e.value():e,w=h?t.value():t;return a||(a=new Dp),i(v,w,r,n,a)}}return p?(a||(a=new Dp),H$(e,t,r,n,i,a)):!1}eC.exports=K$});var aC=g((YQ,iC)=>{var X$=tC(),rC=Tn();function nC(e,t,r,n,i){return e===t?!0:e==null||t==null||!rC(e)&&!rC(t)?e!==e&&t!==t:X$(e,t,r,n,nC,i)}iC.exports=nC});var sC=g((ZQ,oC)=>{var Y$=aC();function Z$(e,t){return Y$(e,t)}oC.exports=Z$});var Ip=g((eJ,lC)=>{var eq=In(),tq=(function(){try{var e=eq(Object,"defineProperty");return e({},"",{}),e}catch{}})();lC.exports=tq});var $l=g((tJ,cC)=>{var uC=Ip();function rq(e,t,r){t=="__proto__"&&uC?uC(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}cC.exports=rq});var _p=g((rJ,dC)=>{var nq=$l(),iq=Ji();function aq(e,t,r){(r!==void 0&&!iq(e[t],r)||r===void 0&&!(t in e))&&nq(e,t,r)}dC.exports=aq});var fC=g((nJ,pC)=>{function oq(e){return function(t,r,n){for(var i=-1,a=Object(t),o=n(t),s=o.length;s--;){var l=o[e?s:++i];if(r(a[l],l,a)===!1)break}return t}}pC.exports=oq});var hC=g((iJ,mC)=>{var sq=fC(),lq=sq();mC.exports=lq});var wC=g((Bo,na)=>{var uq=or(),bC=typeof Bo=="object"&&Bo&&!Bo.nodeType&&Bo,gC=bC&&typeof na=="object"&&na&&!na.nodeType&&na,cq=gC&&gC.exports===bC,vC=cq?uq.Buffer:void 0,yC=vC?vC.allocUnsafe:void 0;function dq(e,t){if(t)return e.slice();var r=e.length,n=yC?yC(r):new e.constructor(r);return e.copy(n),n}na.exports=dq});var SC=g((aJ,CC)=>{var AC=mp();function pq(e){var t=new e.constructor(e.byteLength);return new AC(t).set(new AC(e)),t}CC.exports=pq});var NC=g((oJ,EC)=>{var fq=SC();function mq(e,t){var r=t?fq(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}EC.exports=mq});var IC=g((sJ,DC)=>{function hq(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}DC.exports=hq});var PC=g((lJ,TC)=>{var gq=Kr(),_C=Object.create,vq=(function(){function e(){}return function(t){if(!gq(t))return{};if(_C)return _C(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}})();TC.exports=vq});var Tp=g((uJ,OC)=>{var yq=wp(),bq=yq(Object.getPrototypeOf,Object);OC.exports=bq});var FC=g((cJ,RC)=>{var wq=PC(),Aq=Tp(),Cq=Bl();function Sq(e){return typeof e.constructor=="function"&&!Cq(e)?wq(Aq(e)):{}}RC.exports=Sq});var LC=g((dJ,xC)=>{var Eq=Mo(),Nq=Tn();function Dq(e){return Nq(e)&&Eq(e)}xC.exports=Dq});var BC=g((pJ,MC)=>{var Iq=ni(),_q=Tp(),Tq=Tn(),Pq="[object Object]",Oq=Function.prototype,Rq=Object.prototype,kC=Oq.toString,Fq=Rq.hasOwnProperty,xq=kC.call(Object);function Lq(e){if(!Tq(e)||Iq(e)!=Pq)return!1;var t=_q(e);if(t===null)return!0;var r=Fq.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&kC.call(r)==xq}MC.exports=Lq});var Pp=g((fJ,UC)=>{function kq(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}UC.exports=kq});var Op=g((mJ,$C)=>{var Mq=$l(),Bq=Ji(),Uq=Object.prototype,$q=Uq.hasOwnProperty;function qq(e,t,r){var n=e[t];(!($q.call(e,t)&&Bq(n,r))||r===void 0&&!(t in e))&&Mq(e,t,r)}$C.exports=qq});var VC=g((hJ,qC)=>{var Vq=Op(),Gq=$l();function zq(e,t,r,n){var i=!r;r||(r={});for(var a=-1,o=t.length;++a<o;){var s=t[a],l=n?n(r[s],e[s],s,r,e):void 0;l===void 0&&(l=e[s]),i?Gq(r,s,l):Vq(r,s,l)}return r}qC.exports=zq});var zC=g((gJ,GC)=>{function Wq(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}GC.exports=Wq});var HC=g((vJ,WC)=>{var Hq=Kr(),jq=Bl(),Qq=zC(),Jq=Object.prototype,Kq=Jq.hasOwnProperty;function Xq(e){if(!Hq(e))return Qq(e);var t=jq(e),r=[];for(var n in e)n=="constructor"&&(t||!Kq.call(e,n))||r.push(n);return r}WC.exports=Xq});var Rp=g((yJ,jC)=>{var Yq=bp(),Zq=HC(),e3=Mo();function t3(e){return e3(e)?Yq(e,!0):Zq(e)}jC.exports=t3});var JC=g((bJ,QC)=>{var r3=VC(),n3=Rp();function i3(e){return r3(e,n3(e))}QC.exports=i3});var tS=g((wJ,eS)=>{var KC=_p(),a3=wC(),o3=NC(),s3=IC(),l3=FC(),XC=gp(),YC=_n(),u3=LC(),c3=Ll(),d3=Ol(),p3=Kr(),f3=BC(),m3=Ml(),ZC=Pp(),h3=JC();function g3(e,t,r,n,i,a,o){var s=ZC(e,r),l=ZC(t,r),u=o.get(l);if(u){KC(e,r,u);return}var c=a?a(s,l,r+"",e,t,o):void 0,d=c===void 0;if(d){var p=YC(l),f=!p&&c3(l),h=!p&&!f&&m3(l);c=l,p||f||h?YC(s)?c=s:u3(s)?c=s3(s):f?(d=!1,c=a3(l,!0)):h?(d=!1,c=o3(l,!0)):c=[]:f3(l)||XC(l)?(c=s,XC(s)?c=h3(s):(!p3(s)||d3(s))&&(c=l3(l))):d=!1}d&&(o.set(l,c),i(c,l,n,a,o),o.delete(l)),KC(e,r,c)}eS.exports=g3});var Fp=g((AJ,nS)=>{var v3=pp(),y3=_p(),b3=hC(),w3=tS(),A3=Kr(),C3=Rp(),S3=Pp();function rS(e,t,r,n,i){e!==t&&b3(t,function(a,o){if(i||(i=new v3),A3(a))w3(e,t,o,r,rS,n,i);else{var s=n?n(S3(e,o),a,o+"",e,t,i):void 0;s===void 0&&(s=a),y3(e,o,s)}},C3)}nS.exports=rS});var xp=g((CJ,iS)=>{function E3(e){return e}iS.exports=E3});var oS=g((SJ,aS)=>{function N3(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}aS.exports=N3});var uS=g((EJ,lS)=>{var D3=oS(),sS=Math.max;function I3(e,t,r){return t=sS(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,a=sS(n.length-t,0),o=Array(a);++i<a;)o[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=r(o),D3(e,this,s)}}lS.exports=I3});var dS=g((NJ,cS)=>{function _3(e){return function(){return e}}cS.exports=_3});var mS=g((DJ,fS)=>{var T3=dS(),pS=Ip(),P3=xp(),O3=pS?function(e,t){return pS(e,"toString",{configurable:!0,enumerable:!1,value:T3(t),writable:!0})}:P3;fS.exports=O3});var gS=g((IJ,hS)=>{var R3=800,F3=16,x3=Date.now;function L3(e){var t=0,r=0;return function(){var n=x3(),i=F3-(n-r);if(r=n,i>0){if(++t>=R3)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}hS.exports=L3});var yS=g((_J,vS)=>{var k3=mS(),M3=gS(),B3=M3(k3);vS.exports=B3});var wS=g((TJ,bS)=>{var U3=xp(),$3=uS(),q3=yS();function V3(e,t){return q3($3(e,t,U3),e+"")}bS.exports=V3});var CS=g((PJ,AS)=>{var G3=Ji(),z3=Mo(),W3=kl(),H3=Kr();function j3(e,t,r){if(!H3(r))return!1;var n=typeof t;return(n=="number"?z3(r)&&W3(t,r.length):n=="string"&&t in r)?G3(r[t],e):!1}AS.exports=j3});var Lp=g((OJ,SS)=>{var Q3=wS(),J3=CS();function K3(e){return Q3(function(t,r){var n=-1,i=r.length,a=i>1?r[i-1]:void 0,o=i>2?r[2]:void 0;for(a=e.length>3&&typeof a=="function"?(i--,a):void 0,o&&J3(r[0],r[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++n<i;){var s=r[n];s&&e(t,s,n,a)}return t})}SS.exports=K3});var NS=g((RJ,ES)=>{var X3=Fp(),Y3=Lp(),Z3=Y3(function(e,t,r,n){X3(e,t,r,n)});ES.exports=Z3});var Gt,Uo=I(()=>{"use strict";(function(e){e[e.NotLoaded=0]="NotLoaded",e[e.Initialized=1]="Initialized",e[e.ConfigsLoaded=2]="ConfigsLoaded",e[e.Error=3]="Error"})(Gt||(Gt={}))});function IS(e,t,r="PROD"){let n=i=>`ShellSettings_ECS_ClientCache_${e}_${DS.EcsConfigType[i]}_${r}`;return{getData:i=>{let a=t.getItem(n(i));return Promise.resolve(a?JSON.parse(a):void 0)},putData:(i,a)=>(t.setItem(n(i),JSON.stringify(a)),Promise.resolve())}}var DS,e4,_S=I(()=>{"use strict";DS=re(lp()),e4=re(sp());});var kp,TS=I(()=>{"use strict";wl();kp=Ao({packageName:"shell-settings",settings:{prodEcsEndpoint:{description:"The url for the PROD ECS endpoint",values:{default:"https://ecs.office.com",dod:"https://config.ecs.dod.teams.microsoft.us",high:"https://config.ecs.gov.teams.microsoft.us",ex:"https://config.ecs.teams.eaglex.ic.gov",rx:"https://config.ecs.teams.microsoft.scloud"}},integrationEcsEndpoint:{description:"The url for the INT ECS endpoint",values:{default:"https://config.edge.skype.net"}}}})});var OS,RS,FS,xS,Mp,t4,ql,PS,Bp=I(()=>{"use strict";OS=re(sp()),RS=re($y()),FS=re(lp()),xS=re(sC()),Mp=re(NS());Uo();_S();TS();t4=60*1e3,ql=class{clientName;logger;ecsEndpoint;resolveLoadingPromise;loadingPromise=new Promise(t=>this.resolveLoadingPromise=t);_status=Gt.NotLoaded;endpointType;clientConfigOverride;get status(){return this._status}constructor(t,r,n="PROD"){this.clientName=t,this.logger=r,this.endpointType=n,this.ecsEndpoint=n==="PROD"?kp.prodEcsEndpoint:kp.integrationEcsEndpoint}client=new RS.default;init=async({clientVersion:t,getFilters:r,cacheStorage:n=OS.StorageHelper.transientWithGlobalFallback,updateIntervalInMinutes:i,overrideEcsInitParams:a})=>{this.client.telemetryEventAdded.subscribe(this.logger.logEvent),this.client.configUpdated.subscribe(this.handleConfigUpdated);let o=(async()=>{let s=await r();return this.logEvent("FeaturesClient/configRequested",{ecsClientName:this.clientName,filters:s}),s});try{await this.client.initialize({clientName:this.clientName,clientVersion:t??"1.0.0.0",configsToFetch:[FS.EcsConfigType.Default],hosts:[this.ecsEndpoint],initialAppActiveState:!0,getEcsParameters:o,databaseInterface:IS(this.clientName,n,this.endpointType),...a}),this.client.requestUpdate(),this._status===Gt.NotLoaded&&(this._status=Gt.Initialized)}catch(s){this._status=Gt.Error,this.resolveLoadingPromise(),this.logEvent("FeaturesClient/initializationFailed",{ecsClientName:this.clientName,error:s},"Error")}i&&window.setInterval(()=>this.client.requestUpdate(),i*t4)};getConfig=t=>{let r=this.getMergedClientConfigByTeamName(t.teamName),n=r?t.extractConfig(r):{};return(0,Mp.default)({},t.fallback,n,t.override,PS)};getAllConfigs=()=>this.getMergedClientConfig();getAllConfigsByTeamName=t=>this.getMergedClientConfigByTeamName(t);requestConfigUpdate=()=>{this.client.requestUpdate()};subscribe=(t,r)=>{let n=this.getConfig(t),i=this.client.configUpdated.subscribe(()=>{let a=this.getConfig(t);(0,xS.default)(a,n)||(n={...a},r(a))});return{unsubscribe:()=>i.unsubscribe()}};waitUntilLoaded=async t=>{if(t!==void 0){let r,n=new Promise((i,a)=>{r=window.setTimeout(()=>{a(new Error("Timed out waiting for configuration to load"))},t)});await Promise.race([this.loadingPromise,n]),clearTimeout(r)}else await this.loadingPromise};overrideClientConfig(t){this.logger.logEvent("FeaturesClient/overrideClientConfig",{clientConfigOverride:t}),this.clientConfigOverride=t}undoClientConfigOverride(){this.clientConfigOverride=void 0,this.logger.logEvent("FeaturesClient/undoClientConfigOverride")}getMergedClientConfig=()=>(0,Mp.default)({},this.client.getConfig()?.config,this.clientConfigOverride,PS);getMergedClientConfigByTeamName=t=>this.getMergedClientConfig()?.[t];handleConfigUpdated=()=>{let t=this.client.getConfig();if(t===void 0)return;this.resolveLoadingPromise(),this._status=Gt.ConfigsLoaded;let{ConfigIDs:r,Headers:n}=t.config;this.logEvent("FeaturesClient/configUpdated",{ecsClientName:this.clientName,configIDs:r,ETag:n?.ETag})};logEvent=(t,r)=>{this.logger.logEvent(t,{ecsClientName:this.clientName,ecsEndpointType:this.endpointType,...r})}},PS=(e,t)=>{if(Array.isArray(t))return t}});var kS=g((qJ,LS)=>{"use strict";var r4=()=>{let e={};return e.promise=new Promise((t,r)=>{e.resolve=t,e.reject=r}),e};LS.exports=r4});var Up=g((VJ,BS)=>{var $o=new Proxy(function(){return $o},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:$o},apply:function(){return $o},construct:function(){return{}}}),MS=function(){return $o};Object.setPrototypeOf(MS,$o);BS.exports=MS});var qS=g((GJ,$S)=>{var qo=new Proxy(function(){return qo},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:qo},apply:function(){return qo},construct:function(){return{}}}),US=function(){return qo};Object.setPrototypeOf(US,qo);$S.exports=US});var QS=g((zJ,jS)=>{"use strict";var $p=qS(),n4={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},i4={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},a4={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},WS={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},qp={};qp[$p.ForwardRef]=a4;qp[$p.Memo]=WS;function VS(e){return $p.isMemo(e)?WS:qp[e.$$typeof]||n4}var o4=Object.defineProperty,s4=Object.getOwnPropertyNames,GS=Object.getOwnPropertySymbols,l4=Object.getOwnPropertyDescriptor,u4=Object.getPrototypeOf,zS=Object.prototype;function HS(e,t,r){if(typeof t!="string"){if(zS){var n=u4(t);n&&n!==zS&&HS(e,n,r)}var i=s4(t);GS&&(i=i.concat(GS(t)));for(var a=VS(e),o=VS(t),s=0;s<i.length;++s){var l=i[s];if(!i4[l]&&!(r&&r[l])&&!(o&&o[l])&&!(a&&a[l])){var u=l4(t,l);try{o4(e,l,u)}catch{}}}}return e}jS.exports=HS});function KS(e,t,r){let[n,i]=(0,ia.useState)(e.getConfig(t));return(0,ia.useEffect)(()=>{if(!r?.subscribe&&e.status===Gt.ConfigsLoaded)return;let a=e.subscribe(t,o=>{i(o),r?.subscribe||a.unsubscribe()});return a?.unsubscribe},[]),n}function XS(e){return function(t,r){return KS(e,t,r)}}function YS(e,t,r,n){let i=a=>{let o=KS(e,t,n),s={...a,...o};return ia.default.createElement(r,{...s})};return(0,JS.default)(i,r),i.displayName=`WithFeature(${r.name})`,i}function ZS(e,t,r,n){return t.reduce((i,a)=>YS(e,a,i,n),r)}function eE(e){return function(t,r,n){return YS(e,t,r,n)}}var JS,ia,Vp=I(()=>{"use strict";JS=re(QS()),ia=re(Up());Uo();});var rE=g((jJ,tE)=>{var c4=Fp(),d4=Lp(),p4=d4(function(e,t,r){c4(e,t,r)});tE.exports=p4});var Vl=g((QJ,nE)=>{var f4=ni(),m4=Tn(),h4="[object Symbol]";function g4(e){return typeof e=="symbol"||m4(e)&&f4(e)==h4}nE.exports=g4});var aE=g((JJ,iE)=>{var v4=_n(),y4=Vl(),b4=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,w4=/^\w*$/;function A4(e,t){if(v4(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||y4(e)?!0:w4.test(e)||!b4.test(e)||t!=null&&e in Object(t)}iE.exports=A4});var lE=g((KJ,sE)=>{var oE=Fl(),C4="Expected a function";function Gp(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(C4);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var o=e.apply(this,n);return r.cache=a.set(i,o)||a,o};return r.cache=new(Gp.Cache||oE),r}Gp.Cache=oE;sE.exports=Gp});var cE=g((XJ,uE)=>{var S4=lE(),E4=500;function N4(e){var t=S4(e,function(n){return r.size===E4&&r.clear(),n}),r=t.cache;return t}uE.exports=N4});var pE=g((YJ,dE)=>{var D4=cE(),I4=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,_4=/\\(\\)?/g,T4=D4(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(I4,function(r,n,i,a){t.push(i?a.replace(_4,"$1"):n||r)}),t});dE.exports=T4});var mE=g((ZJ,fE)=>{function P4(e,t){for(var r=-1,n=e==null?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}fE.exports=P4});var wE=g((eK,bE)=>{var hE=Po(),O4=mE(),R4=_n(),F4=Vl(),x4=1/0,gE=hE?hE.prototype:void 0,vE=gE?gE.toString:void 0;function yE(e){if(typeof e=="string")return e;if(R4(e))return O4(e,yE)+"";if(F4(e))return vE?vE.call(e):"";var t=e+"";return t=="0"&&1/e==-x4?"-0":t}bE.exports=yE});var CE=g((tK,AE)=>{var L4=wE();function k4(e){return e==null?"":L4(e)}AE.exports=k4});var EE=g((rK,SE)=>{var M4=_n(),B4=aE(),U4=pE(),$4=CE();function q4(e,t){return M4(e)?e:B4(e,t)?[e]:U4($4(e))}SE.exports=q4});var DE=g((nK,NE)=>{var V4=Vl(),G4=1/0;function z4(e){if(typeof e=="string"||V4(e))return e;var t=e+"";return t=="0"&&1/e==-G4?"-0":t}NE.exports=z4});var TE=g((iK,_E)=>{var W4=Op(),H4=EE(),j4=kl(),IE=Kr(),Q4=DE();function J4(e,t,r,n){if(!IE(e))return e;t=H4(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var l=Q4(t[i]),u=r;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(i!=o){var c=s[l];u=n?n(c,l,s):void 0,u===void 0&&(u=IE(c)?c:j4(t[i+1])?[]:{})}W4(s,l,u),s=s[l]}return e}_E.exports=J4});var OE=g((aK,PE)=>{var K4=TE();function X4(e,t,r){return e==null?e:K4(e,t,r)}PE.exports=X4});function LE(e){let{query:t}=(0,xE.default)(window.location.href,!0);return Z4(e,t),e}function Z4(e,t){let r=Y4+e.clientName,n=Object.keys(t).filter(a=>a.startsWith(r));if(!n)return;let i={};n.forEach(a=>{let o=t[a];if(o)try{let s=JSON.parse(o),l=r+kE,u={};if(a===r)u=s;else if(a.startsWith(l)){let c=a.substring(l.length);(0,FE.default)(u,c,s)}(0,RE.default)(i,u)}catch{}}),Object.keys(i).length>0&&e.overrideClientConfig(i)}var RE,FE,xE,kE,Y4,ME=I(()=>{"use strict";RE=re(rE()),FE=re(OE()),xE=re(Qd());kE=".",Y4="ecs"+kE});function zl(e,t,r){let n=LE(new ql(e,t,r));function i(a){(0,Gl.useEffect)(()=>{n.init(a)},[])}return{featuresClient:n,createFeature:tV(n),useFeaturesClientInitParams:i,withFeatures:(a,o,s)=>ZS(n,a,o,s)}}function tV(e){let t=XS(e),r=eE(e);return function(i){let a=Ly(i);return a.getConfig=()=>e.getConfig(a),a.isLoaded=()=>e.status===Gt.ConfigsLoaded,Xd.register(a,e.clientName),{useFeature:o=>t(a,o),withFeature:(o,s)=>r(a,o,s),feature:a}}}var eV,Gl,zp=I(()=>{"use strict";eV=re(kS()),Gl=re(Up());op();Bp();Uo();Vp();ME();Yd();});var BE=I(()=>{"use strict";op();Bp();zp();Uo();Vp();El();Zd();});function Wl(e){return{logEvent:(t,r,n)=>{switch(n){case"Error":(0,aa.trackErrorTrace)(e,{eventName:t,eventData:r});break;case"Warning":(0,aa.trackWarningTrace)(e,{eventName:t,eventData:r});break;default:(0,aa.trackInfoTrace)(e,{eventName:t,eventData:r});break}}}}var aa,Wp=I(()=>{"use strict";aa=re(Xn());});var NK,DK,IK,UE=I(()=>{"use strict";BE();Wp();({featuresClient:NK,createFeature:DK,useFeaturesClientInitParams:IK}=zl("PowerApps-Shell-Test",Wl("shell-features")))});var VE=g((TK,qE)=>{var Vo=new Proxy(function(){return Vo},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:Vo},apply:function(){return Vo},construct:function(){return{}}}),$E=function(){return Vo};Object.setPrototypeOf($E,Vo);qE.exports=$E});var rV,nV,GE=I(()=>{"use strict";yo();rV=re(VE()),nV=re(Xn());});var zE=I(()=>{"use strict";UE();Wp();GE();});var BK,oa,UK,WE=I(()=>{"use strict";zE();zp();({featuresClient:BK,createFeature:oa,useFeaturesClientInitParams:UK}=zl("PowerApps-MakerPortal",Wl("powerapps-features")))});var HE,jE,GK,zK,WK,HK,Hp=I(()=>{"use strict";xy();WE();({feature:HE}=oa({teamName:"MakerPortal",owners:["debeshd"],description:"Enable the auto insertion of cell in a row when a section is initialized",createdOn:"09/01/2023",fallback:{enableAutoInsertionOfCellInRow:Qi.enableAutoInsertionOfCellInRow}})),{feature:jE}=oa({teamName:"MakerPortal",owners:["aansu"],description:"Enable the one grid events for form designer",createdOn:"08/21/2024",fallback:{enableOneGridEventsForFormDesigner:Qi.enableOneGridEvents}}),{feature:GK}=oa({teamName:"MakerPortal",owners:["adekulkarni"],description:"Disables PBI components and cleans them up from the form",createdOn:"01/03/2023",fallback:{enableFallbackFormTemplate:Qi.disablePBIComponents}}),{feature:zK}=oa({teamName:"MakerPortal",owners:["jennietu"],description:"Enables agent response in form designer. This feature is used to enable the agent response in form designer",createdOn:"04/24/2025",fallback:{enableAgentResponse:Qi.enableAgentResponse}}),{feature:WK,useFeature:HK}=oa({teamName:"MakerPortal",owners:["aansu"],description:"Enables delayed localization of custom control",createdOn:"06/08/2025",fallback:{enableDelayedLocalizationForCustomControls:Qi.enableDelayedLocalizationForCustomControls}})});var KE=g((QK,JE)=>{var Go=new Proxy(function(){return Go},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:Go},apply:function(){return Go},construct:function(){return{}}}),QE=function(){return Go};Object.setPrototypeOf(QE,Go);JE.exports=QE});var nt,Pn=I(()=>{"use strict";Le();Fe();rt();Tl();X();We();nt=class extends W{static HighestUsedIndexByClass=new Map;get colspan(){let t=this.getProperty(m.colspan);return N.IsNullOrUndefined(t)?null:parseInt(t,10)}set colspan(t){N.IsNullOrUndefined(t)||this.setProperty(m.colspan,String(t))}constructor(t,r){super(t,r)}get id(){let t=this.getProperty(m.id);return t==null?null:t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?new T(t.substr(1,t.length-2)):new T(t)}set id(t){this.setProperty(m.id,`{${t.ToString()}}`)}set labelId(t){this.setProperty(m.labelId,`{${t.ToString()}}`)}get labelId(){let t=this.getProperty(m.labelId);return t&&t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?new T(t.substr(1,t.length-2)):new T(t)}get Name(){return this.getProperty(m.Name)}set Name(t){this.setProperty(m.Name,t)}setDisplayName(t,r){for(let i of this.getAllLabels())if(+i.getProperty(m.languagecode)===r){i.setProperty(m.description,t);return}let n=new W(y.formLabel,null);n.setProperty(m.description,t),n.setProperty(m.languagecode,String(r)),this.addGrandChild("labels",n)}getDisplayName(t){for(let r of this.getAllLabels())if(+r.getProperty(m.languagecode)===t)return r.getProperty(m.description)}getAllLabels(){let t=this.getChildren("labels");return t.length!==1?[]:t[0].getChildren("label")}get isLocked(){return+this.getProperty(m.locklevel)==1}set isLocked(t){!this.IsUnboundControl&&this.setProperty(m.locklevel,t?"1":"0")}get availableforphone(){return this.getProcessedValue(m.availableforphone)}set availableforphone(t){N.IsNullOrUndefined(t)||!this.IsAllowedUBCForAvailableOnPhone()||this.setProperty(m.availableforphone,String(t))}get visible(){return this.getProcessedValue(m.visible)}set visible(t){N.IsNullOrUndefined(t)||!this.IsAllowedUBCForVisibleByDefault()||this.setProperty(m.visible,String(t))}isLockLevelSettable(){return!this.IsUnboundControl}get showlabel(){return this.getProcessedValue(m.showlabel)}set showlabel(t){N.IsNullOrUndefined(t)||this.setProperty(m.showlabel,String(t))}isAvailableForPhoneSettable(){return this.IsAllowedUBCForAvailableOnPhone()}isVisibleSettable(){return this.IsAllowedUBCForVisibleByDefault()}getProcessedValue(t){let r=this.getProperty(t);return N.IsNullOrUndefined(r)||this.getProperty(t)==="true"}get readonly(){let t=this.getFirstChild(y.formControl);return t?t.disabled:!1}set readonly(t){let r=this.getFirstChild(y.formControl);r&&(r.disabled=t)}get allowfilteroff(){let t=this.getFirstChild(y.formControl);if(t)return t.getParam(m.AllowFilterOff)==="true"}set allowfilteroff(t){let r=this.getFirstChild(y.formControl);r&&!this.IsUnboundControl&&r.setParameter(m.AllowFilterOff,t)}get autoresolve(){let t=this.getFirstChild(y.formControl);if(t)return t.getParam(m.AutoResolve)==="true"}set autoresolve(t){let r=this.getFirstChild(y.formControl);r&&!this.IsUnboundControl&&r.setParameter(m.AutoResolve,t)}get defaultviewid(){let t=this.getFirstChild(y.formControl);return t?t.getParam(m.DefaultViewId):P.EmptyString}set defaultviewid(t){let r=this.getFirstChild(y.formControl);r&&!this.IsUnboundControl&&r.setParameter(m.DefaultViewId,t)}get dependentattributename(){let t=this.getFirstChild(y.formControl);return t?t.getParam(m.DependentAttributeName):P.EmptyString}set dependentattributename(t){let r=this.getFirstChild(y.formControl);r&&!this.IsUnboundControl&&r.setParameter(m.DependentAttributeName,t)}get dependentattributetype(){let t=this.getFirstChild(y.formControl);return t?t.getParam(m.DependentAttributeType):P.EmptyString}set dependentattributetype(t){let r=this.getFirstChild(y.formControl);r&&!this.IsUnboundControl&&r.setParameter(m.DependentAttributeType,t)}get disablequickfind(){let t=this.getFirstChild(y.formControl);if(t)return t.getParam(m.DisableQuickFind)==="true"}set disablequickfind(t){let r=this.getFirstChild(y.formControl);r&&!this.IsUnboundControl&&r.setParameter(m.DisableQuickFind,t)}get disableviewpicker(){let t=this.getFirstChild(y.formControl);if(t)return t.getParam(m.DisableViewPicker)==="true"}set disableviewpicker(t){let r=this.getFirstChild(y.formControl);r&&!this.IsUnboundControl&&r.setParameter(m.DisableViewPicker,t)}get filterrelationshipname(){let t=this.getFirstChild(y.formControl);return t?t.getParam(m.FilterRelationshipName):P.EmptyString}set filterrelationshipname(t){let r=this.getFirstChild(y.formControl);r&&!this.IsUnboundControl&&r.setParameter(m.FilterRelationshipName,t)}get availableviewids(){let t=this.getFirstChild(y.formControl);return t?t.getParam(m.AvailableViewIds):P.EmptyString}set availableviewids(t){let r=this.getFirstChild(y.formControl);r&&!this.IsUnboundControl&&r.setParameter(m.AvailableViewIds,t)}get IsUnboundControl(){let t=this.getFirstChild(y.formControl);if(t&&t.ClassId){let r=Me.getUniqueIdentifierForControl(t);return!N.IsNullOrUndefined(r)&&Me.isUnboundFormControlByIdentifier(r)}else return!1}IsAllowedUBCForAvailableOnPhone(){let t=this.getFirstChild(y.formControl);if(t){let n=Me.getUniqueIdentifierForControl(t).guidString,i=n===R.GridControl||n===R.TimeLineControl||n===R.TimeLineControlUC;return this.IsUnboundControl?i:!0}return this.NodeName===y.formSection||this.NodeName===y.formTab}IsAllowedUBCForVisibleByDefault(){let t=this.getFirstChild(y.formControl);if(t){let n=Me.getUniqueIdentifierForControl(t).guidString,i=n===R.MapsControl||n===R.WebResourceHtmlControl||n===R.WebResourceImageControl||n===R.IframeControl||n===R.SocialInsightControl;return this.IsUnboundControl?i:!0}else return!0}get events(){let t=this.getChildren(y.formEvents);return t.length===1?t[0].getAllChildren():[]}addEvent(t){this.addGrandChild(y.formEvents,t)}getUsedNodeNameSet(t){return null}getHighestIndexById(t,r){return null}}});var sa,jp=I(()=>{"use strict";rt();X();We();sa=class extends W{constructor(t,r){super(y.dependency,t),P.IsNullOrEmpty(r)||this.setDefaultProperties(r)}set id(t){this.setProperty(m.id,t)}get id(){return this.getProperty(m.id)}setDefaultProperties(t){this.id=t}}});var XE,la,Qp=I(()=>{"use strict";Fe();jp();X();We();Pn();(function(e){e[e.Form=0]="Form",e[e.Cell=1]="Cell",e[e.Tab=2]="Tab",e[e.Control=3]="Control"})(XE||(XE={}));la=class extends nt{constructor(t,r){super(y.formEvent,t),r&&(this.eventName=r,this.application="false",this.active="false")}set eventName(t){this.setProperty(m.Name,t)}get eventName(){return this.getProperty(m.Name)}set application(t){this.setProperty(m.application,t)}get application(){return this.getProperty(m.application)}set attribute(t){this.setProperty(m.EventAttribute,t)}get attribute(){return this.getProperty(m.EventAttribute)}set relationship(t){this.setProperty(m.Relationship,t)}get relationship(){return this.getProperty(m.Relationship)}set control(t){this.setProperty(m.Control,t)}get control(){return this.getProperty(m.Control)}set active(t){this.setProperty(m.EventActive,t)}get active(){return this.getProperty(m.EventActive)}getAllHandlers(){let t=this.getChildren(y.EventHandlers);return t&&t.length?t[0].getChildren(y.handler):[]}getAllDependencies(){let t=this.getChildren(y.formDependencies);return t.length===0?[]:t[0].getAllChildren()}setDependencies(t){let r=this.getFirstChild(y.formDependencies);if(N.IsNullOrUndefined(r)){if(t.length===0)return;this.addChild(new W(y.formDependencies,this)),r=this.getFirstChild(y.formDependencies)}if(t.length===0)r.getParentNode().deleteChild(r);else{r.deleteAllChildren();for(let n of t)r.addChild(new sa(r,n.toString()))}}}});var sr,zo=I(()=>{"use strict";Le();vo();Fe();Kn();X();We();ir();sr=class extends W{previewVersion;constructor(t){super(y.formControl,t)}updatePreview(){this.previewVersion=Date.now()}get ClassId(){let t=this.getProperty(m.classid);return t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"&&(t=t.substr(1,t.length-2)),new T(t)}set ClassId(t){this.setProperty(m.classid,`{${t.ToString()}}`)}get dataFieldName(){return this.getProperty(m.datafieldname)}set dataFieldName(t){this.setProperty(m.datafieldname,t)}set id(t){this.setProperty(m.id,t)}get id(){return this.getProperty(m.id)}get UniqueId(){let t=this.getProperty(m.uniqueid);return N.IsNullOrUndefined(t)?null:(t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"&&(t=t.substr(1,t.length-2)),new T(t))}set UniqueId(t){this.setProperty(m.uniqueid,`{${t.ToString()}}`)}get isRequired(){return this.getProperty(m.isRequired)==="true"}set isRequired(t){N.IsNullOrUndefined(t)||this.setProperty(m.isRequired,String(t))}get disableMru(){return this.getParam(m.DisableMru)==="true"}set disableMru(t){N.IsNullOrUndefined(t)||this.setParameter(m.DisableMru,t)}get useMFDForCreate(){return this.getParam(m.UseMFDForCreate)==="true"}set useMFDForCreate(t){N.IsNullOrUndefined(t)||this.setParameter(m.UseMFDForCreate,t)}get useMFDForEdit(){return this.getParam(m.UseMFDForEdit)==="true"}set useMFDForEdit(t){N.IsNullOrUndefined(t)||this.setParameter(m.UseMFDForEdit,t)}get disabled(){return this.getProperty(m.disabled)==="true"}set disabled(t){N.IsNullOrUndefined(t)||this.setProperty(m.disabled,String(t))}get indicationOfSubgrid(){return this.getProperty(m.indicationOfSubgrid)==="true"}set indicationOfSubgrid(t){this.setProperty(m.indicationOfSubgrid,String(t))}getAllParameters(){let t=new pt,r=this.getFirstChild(m.parameters);return r&&r.getAllChildren().forEach(n=>{if(n){let i=n.getAllChildren(),a=i&&i.length>0&&i[0];a&&t.add(n.getNodeName(),a.getNodeName())}}),t}setParameter(t,r){let n=!1;r===null&&(n=!0);let i=(Jr.StartTag+r).toString(),a=this.parametersNode;if(a){let o=a.findFirst(s=>s&&s.getNodeName()===t);if(o)if(n){this.deleteFirstGrandChildOfName(y.controlParameters,o);return}else{let s=o.getAllChildren();s&&s.length>0&&s[0]?s[0].setNodeName(i):o.addChild(new W(i,o))}else n||(o=new W(t,a),o.addChild(new W(i,o)),a.addChild(o))}else if(!n){a=new W("parameters",this);let o=new W(t,a);o.addChild(new W(i,o)),a.addChild(o),this.addChild(a)}}getParam(t){if(this.parametersNode){let r=this.parametersNode.findFirst(n=>n&&n.getNodeName()===t);if(r){let n=r.getAllChildren(),i=n&&n.length>0&&n[0];if(i){let a=i.getNodeName();return a.charAt(0)===Jr.StartTag?a.substring(1):a}}}return null}get parametersNode(){let t=this.getChildren(m.parameters);return t.length===0?null:t[0]}async serializeParameters(t,r){let n=new pt;switch(this.ClassId.guidString.toUpperCase()){case S.LookupControl:if(t&&t.getKeys())if(t.getKeys().forEach(o=>{n.add(o,this.getParam(o))}),t&&t.containsKey("DefaultViewId")){let o=this.getParam("DefaultViewId").replace("{","").replace("}","");n.upsert("DefaultViewId",o)}else{let o=this.getParent(),s=await r.formModelService.lookupControlService.populateDefaultView(this,o.getParentForm().entityName);s&&s.id&&n.upsert("DefaultViewId",s.id.replace("{","").replace("}",""))}break;default:t&&t.getKeys()&&t.getKeys().forEach(o=>{n.add(o,this.getParam(o))});break}let i=n.getInternalObject(),a=[];for(let o in i)i.hasOwnProperty(o)&&a.push({Name:o,Value:i[o]});return a}getIsUnbound(){return this.getProperty(m.isUnbound)==="true"}getAttributeTypeFromClassId(t){if(t)switch(t.toUpperCase()){case S.BooleanControl:case S.CheckboxControl:return 0;case S.DateTimeControl:return 2;case S.DecimalControl:return 3;case S.FloatingNumberControl:return 4;case S.IntegerControl:case S.DurationControl:case S.LanguageControl:case S.TimezoneControl:return 5;case S.LookupControl:return 6;case S.CurrencyControl:return 8;case S.PartyListControl:return 10;case S.ChoiceControl:case S.RelationshipRoleChoiceControl:return 11;case S.ChoiceStatusControl:return 13;case S.TextAreaControl:case S.TextboxControl:case S.LabelControl:case S.EmailAddressControl:case S.UrlControl:case S.TickerControl:case S.ButtonControl:case S.PhoneNumberControl:return 14;case S.ChoicesControl:return 24;default:return}return 14}async toJSON(t){let r=this.getParent(),n=t&&t.formModelService&&t.formModelService.getFormType()===ke.QuickViewForm?!0:this.disabled,i=await this.serializeParameters(this.getAllParameters(),t);return{ClassId:this.ClassId&&this.ClassId.guidString,Parameters:i,Disabled:n,ControlLayout:0,RequiredLevel:0,Type:this.getAttributeTypeFromClassId(this.ClassId.guidString),IsUnbound:this.getIsUnbound(),IsRequired:this.isRequired,DataFieldName:this.dataFieldName,UniqueId:this.UniqueId&&this.UniqueId.guidString,Id:this.previewVersion?this.id+this.previewVersion:this.id,Label:r.getDisplayName(t.langCode),LabelId:r.labelId&&r.labelId.guidString,Name:null,ShowLabel:r.showlabel,PreviewId:r&&r.id.guidString,Visible:r.visible||t.formModelService.showHiddenElements}}}});var ua,Jp=I(()=>{"use strict";rt();Vi();zo();X();We();ua=class extends sr{constructor(t){super(t)}get targetEntityType(){return this.getParam(m.targetEntityType)||P.EmptyString}set targetEntityType(t){this.setParameter(m.targetEntityType,t)}get viewId(){return P.StripBraces(this.getParam(m.viewId))||P.EmptyString}set viewId(t){this.setParameter(m.viewId,P.AddBraces(t))}get viewIds(){return this.getParam(m.viewIds)||P.EmptyString}set viewIds(t){this.setParameter(m.viewIds,t)}get relationshipName(){return this.getParam(m.RelationshipName)||P.EmptyString}set relationshipName(t){this.setParameter(m.RelationshipName,t)}get isUserView(){return P.IsStrictTrue(this.getParam(m.isUserView))}set isUserView(t){this.setParameter(m.isUserView,t.toString())}get enableViewPicker(){return P.IsStrictTrue(this.getParam(m.enableViewPicker))}set enableViewPicker(t){this.setParameter(m.enableViewPicker,t)}get autoExpand(){return this.getParent().autoexpand&&this.getParam(m.autoExpand)===m.Auto}set autoExpand(t){let r=this.getParent();this.setParameter(m.autoExpand,t?m.Auto:m.Fixed),r.autoexpand=t}get recordsPerPage(){return this.getParam(m.recordsPerPage)?Number(this.getParam(m.recordsPerPage)):Number(m.RecordsPerPageRAControlDefault)}set recordsPerPage(t){this.setParameter(m.recordsPerPage,String(t))}get enableQuickFind(){return P.IsStrictTrue(this.getParam(m.enableQuickFind))}set enableQuickFind(t){this.setParameter(m.enableQuickFind,t)}get teamTemplateId(){return P.StripBraces(this.getParam(m.teamTemplateId))||P.EmptyString}set teamTemplateId(t){this.setParameter(m.teamTemplateId,P.AddBraces(t))}get chartId(){return this.getParam(m.visualizationId)||P.EmptyString}set chartId(t){this.setParameter(m.visualizationId,t)}get enableChartPicker(){return P.IsStrictTrue(this.getParam(m.enableChartPicker))}set enableChartPicker(t){this.setParameter(m.enableChartPicker,t)}get chartGridMode(){switch(this.getParam(m.chartGridMode)){case Vt.Chart:return Vt.Chart;case Vt.Grid:return Vt.Grid;default:return Vt.All}}set chartGridMode(t){this.setParameter(m.chartGridMode,t)}updateChartGridMode(t){t?this.chartGridMode=Vt.Chart:this.chartGridMode=this.enableChartPicker?Vt.All:Vt.Grid}updateDefaultProperties(t,r){for(let n of t)switch(n.getNodeName()){case m.targetEntityType:n.getAllChildren()[0].setNodeName("<"+r.targetEntityType);break;case m.viewId:n.getAllChildren()[0].setNodeName("<"+P.AddBraces(r.viewId));break;case m.isUserView:n.getAllChildren()[0].setNodeName("<"+r.isUserView);break;case m.enableViewPicker:n.getAllChildren()[0].setNodeName("<"+r.enableViewPicker);break;case m.RelationshipName:let i=n.getAllChildren(),a="<"+r.relationshipName;i.length?n.getAllChildren()[0].setNodeName(a):n.addChild(new W(a,n));break;default:break}}updateControlDescription(t){let r=t.getControlDescriptionByForControl(this.UniqueId);if(r){let n=r.customControls;for(let i=0;i<n.length;i++){let a=n[i].getParameters().get(ft.dataset)?n[i].getParameters().get(ft.dataset)[0]:null;if(a){let o=a.getAllChildren();this.updateDefaultProperties(o,this)}else{let o=n[i].getAllChildren()[0].getAllChildren();this.updateDefaultProperties(o,this)}}}}}});var ca,Kp=I(()=>{"use strict";rt();Vi();zo();X();ca=class extends sr{constructor(t){super(t)}get defaultViewId(){return P.StripBraces(this.getParam(m.DefaultViewId))||P.EmptyString}set defaultViewId(t){this.setParameter(m.DefaultViewId,P.AddBraces(t))}get autoResolve(){return P.IsStrictTrue(this.getParam(m.AutoResolve))}set autoResolve(t){this.setParameter(m.AutoResolve,t)}get disableQuickFind(){return P.IsStrictTrue(this.getParam(m.DisableQuickFind))}set disableQuickFind(t){this.setParameter(m.DisableQuickFind,t)}get disableViewPicker(){return P.IsStrictTrue(this.getParam(m.DisableViewPicker))}set disableViewPicker(t){this.setParameter(m.DisableViewPicker,t)}get allowFilterOff(){return P.IsStrictTrue(this.getParam(m.AllowFilterOff))}set allowFilterOff(t){this.setParameter(m.AllowFilterOff,t)}get disableMru(){return P.IsStrictTrue(this.getParam(m.DisableMru))}set disableMru(t){this.setParameter(m.DisableMru,t)}get dependentAttributeName(){return this.getParam(m.DependentAttributeName)||P.EmptyString}set dependentAttributeName(t){this.setParameter(m.DependentAttributeName,t)}get dependentAttributeType(){return this.getParam(m.DependentAttributeType)||P.EmptyString}set dependentAttributeType(t){this.setParameter(m.DependentAttributeType,t)}get filterRelationshipName(){return this.getParam(m.FilterRelationshipName)||P.EmptyString}set filterRelationshipName(t){this.setParameter(m.FilterRelationshipName,t)}get availableViewIds(){return this.getParam(m.AvailableViewIds)||P.EmptyString}set availableViewIds(t){this.setParameter(m.AvailableViewIds,t)}updateDefaultProperties(t,r){for(let n of t)switch(n.getNodeName()){case m.datafieldname:case m.bindAttribute:n.getAllChildren()[0].setNodeName("<"+r.dataFieldName);break;case m.DefaultViewId:n.getAllChildren()[0].setNodeName("<"+P.AddBraces(r.defaultViewId));break;case m.AllowFilterOff:n.getAllChildren()[0].setNodeName("<"+r.allowFilterOff);break;case m.DisableQuickFind:n.getAllChildren()[0].setNodeName("<"+r.disableQuickFind);break;case m.DisableViewPicker:n.getAllChildren()[0].setNodeName("<"+r.disableViewPicker);break;case m.FilterRelationshipName:n.getAllChildren()[0].setNodeName("<"+r.filterRelationshipName);break;case m.DependentAttributeName:n.getAllChildren()[0].setNodeName("<"+r.dependentAttributeName);break;case m.DependentAttributeType:n.getAllChildren()[0].setNodeName("<"+r.dependentAttributeType);break;case m.AvailableViewIds:n.getAllChildren()[0].setNodeName("<"+r.availableViewIds);break;case m.DisableMru:n.getAllChildren()[0].setNodeName("<"+r.disableMru);break;case m.AutoResolve:n.getAllChildren()[0].setNodeName("<"+r.autoResolve);break;default:break}}updateControlDescription(t){let r=t.getControlDescriptionByForControl(this.UniqueId);if(r){let n=r.customControls;for(let i=0;i<n.length;i++){let a=n[i].getParameters().get(ft.value)?n[i].getParameters().get(ft.value)[0]:null;if(a){let o=a.getAllChildren();this.updateDefaultProperties(o,this)}else{let o=n[i].getAllChildren()[0].getAllChildren();this.updateDefaultProperties(o,this)}}}}}});var YE,Xp,Dt,Wo=I(()=>{"use strict";YE=re(KE());Pn();X();Fe();Le();Qp();zo();Tl();ip();kd();ir();Kn();Ui();Jp();Kp();Yp();So();Xp="_",Dt=class e extends nt{fieldPlaceholder;fieldRequiredLevel;isNewField;cellColType;dependentFields=[];constructor(t){super(y.formCell,t),this.isNewField=!1}get cellType(){return this.cellColType}set cellType(t){this.cellColType=t}setDefaultProperties(t){this.showlabel=t,this.isLocked=!1,N.IsNullOrUndefined(this.getProperty(m.id))&&(this.id=new T(T.NewGuid()))}addControl(t,r,n,i,a,o,s){n instanceof sr?this.addChild(n):n instanceof T&&this.addChild(this.getControlWithControlSpecificProperties(t,r,n,i,a,o,s))}removeControl(){return this.deleteChild(this.control)>=0}get isIndependent(){if(!N.IsNullOrUndefined(this.control))return N.IsNullOrUndefined(this.control.dataFieldName)?N.IsNullOrUndefined(this.control.id)?!0:!Yn.dependencyFieldCount.containsKey(this.control.id):!Yn.dependencyFieldCount.containsKey(this.control.dataFieldName)}createOnLoadEvent(){this.addEvent(new la(this,ho.onLoad))}get dependencies(){let t=this.getChildren(y.formEvents);for(let r of t){let n=r.getChildren(y.formEvent);for(let i of n)this.buildDependencyList(i,this.dependentFields)}return this.dependentFields}getNextAvailableControlName(t,r,n,i){let a;if(i&&hl[i])a=hl[i].replace(/ /g,Xp)+Xp;else{a="Control_";let u=new Error("Control class id does not exist or is undefined");(0,YE.trackErrorTrace)(dt,{eventName:`${Hv}/getNextAvailableControlName`},u)}let o="new_",s=this.getHighestIndexById(t,i)+1,l=`${a}${o}${s}`;for(;n.has(l);)s++,l=`${a}${o}${s}`;return l}getUnboundControlProperties(t){e.prototype.setProperty.call(t,m.isUnbound,"true"),e.prototype.setProperty.call(t,m.isRequired,"false")}getControlWithControlSpecificProperties(t,r,n,i,a,o,s){let l;a===zt.Grid?(l=new ua(this),l.indicationOfSubgrid=!0):a===zt.Lookup?l=new ca(this):l=new sr(this);let u=n.guidString,c=o||this.getNextAvailableControlName(t,i,this.getUsedNodeNameSet(t),u);if(e.prototype.setProperty.call(l,m.id,c),l.ClassId=n,!N.IsNullOrUndefined(s)&&(l.UniqueId=s),!o&&r)this.getUnboundControlProperties(l);else{let d=Me.getUniqueIdentifierForControl(l);N.IsNullOrUndefined(d)||(Me.getControlDataTypeByControlOrUniqueId(d)===q.QuickFormCollectionControl||!Me.isUnboundFormControlByIdentifier(d)?a!==zt.Grid&&o&&u!==S.IframeControl&&u!==S.SubgridControl&&u!==S.ReferencePanelSubgridControl&&(l.dataFieldName=o,e.prototype.setProperty.call(l,m.disabled,"false")):(this.rowspan=Me.GetRowSpan(l),(Me.getControlDataTypeByControlOrUniqueId(d)===q.NotesControl||Me.getControlDataTypeByControlOrUniqueId(d)===q.TimeLineControl)&&(e.prototype.setProperty.call(l,m.disabled,"false"),l.id=q.NotesControl)),(Me.getUnboundControlNameFromIdentifier(n)===q.SubGridControl||Me.getUnboundControlNameFromIdentifier(n)===q.NotesControl||Me.getUnboundControlNameFromIdentifier(n)===q.TimeLineControl)&&(this.availableforphone=!0))}return l}buildDependencyList(t,r){if(N.IsNullOrUndefined(t))return;let n=t.getAllChildren();for(let i of n){let a=i.getAllChildren();for(let o of a){let s=o.GetPropertyByParameter(m.id);o.getNodeName()===y.dependency&&s?r.push(s):this.buildDependencyList(o,r)}}}get control(){return this.getFirstChild(y.formControl)}set rowspan(t){this.setProperty(m.rowspan,String(t))}get rowspan(){let t=this.getProperty(m.rowspan);return N.IsNullOrUndefined(t)?1:parseInt(t,10)}set autoexpand(t){this.setProperty(m.auto,String(t))}get autoexpand(){return this.getProperty(m.auto)==="true"}set colspan(t){let r=Number(rp.ONE_COLUMN),n=Number(rp.FOUR_COLUMN);N.IsNullOrUndefined(t)||t>n||t<r||this.setProperty(m.colspan,String(t))}get colspan(){let t=this.getProperty(m.colspan);return N.IsNullOrUndefined(t)?1:parseInt(t,10)}getParentRow(){return this.getAncestor(y.formRow)}getParentSection(){return this.getAncestor(y.formSection)}getParentTab(){return this.getAncestor(y.formTab)}getParentForm(){return this.getAncestor(y.form)}isInHeader(){let t=this.getAncestor(y.formHeader);return!N.IsNullOrUndefined(t)}isInFooter(){let t=this.getAncestor(y.formFooter);return!N.IsNullOrUndefined(t)}isEmpty(){return N.IsNullOrUndefined(this.control)&&!this.IsUserSpacer}getHeaderFooter(){return this.isInHeader()?this.getAncestor(y.formHeader):this.isInFooter()?this.getAncestor(y.formFooter):null}get FieldRequiredLevel(){return this.fieldRequiredLevel}set FieldRequiredLevel(t){this.fieldRequiredLevel=t}get FieldPlaceholder(){return this.fieldPlaceholder}set FieldPlaceholder(t){this.fieldPlaceholder=t}get IsNewField(){return this.isNewField}set IsNewField(t){this.isNewField=t}get IsUserSpacer(){let t=this.getProperty(m.userspacer);return N.IsNullOrUndefined(t)?!1:t==="true"}SetUserSpacer(){this.setProperty(m.userspacer,"true")}ClearUserSpacer(){this.setProperty(m.userspacer,"false")}get columns(){let t=this.getProperty(m.columnName);return N.IsNullOrUndefined(t)?null:parseInt(t,10)}getColumnLayoutValue(t){let r;switch(t){case Se.TWO_COLUMN:r="11";break;case Se.THREE_COLUMN:r="111";break;case Se.FOUR_COLUMN:r="1111";break;default:r="1"}return r}findRowIndexByCellId(t){let r=this.getParentRow().cells.indexOf(this);for(let n=0;n<t.rows.length;n++)if(!N.IsNullOrUndefined(t.rows[n].cells[r])&&this.id.ToString()===t.rows[n].cells[r].id.ToString())return n;return-1}setAutoExpandDetailsForTab(){let t=this.getParentTab();N.IsNullOrUndefined(t)||(t.autoExpandCell=this,t.tabContainsAutoExpandControl=!0)}isCellRequiredOrLocked(t,r,n){let i=this.getParentForm();if(this?.control){if(this.IsUserSpacer)return!1;{if(this.isLocked||r().has(this.control.dataFieldName))return!0;let a=i.isDuplicateCell(this,n),o=this.getRequiredLevel(t);if((o===ei.ApplicationRequired||o===ei.SystemRequired)&&!a||this.isCellLockedByExternal(t)&&!a)return!0}}return!1}getRequiredLevel(t){return!this.control?.dataFieldName||!this.control?.id||this.IsNewField||!this.control?.ClassId?ei.None:t.getEntityAttributeByName(this.control.dataFieldName)?.requiredLevel?.toString()??ei.None}isCellLockedByExternal(t){return this.control||this.IsUnboundControl?!1:t.getEntityAttributeByName(this.control.dataFieldName).isRequiredForForm||!this.isIndependent}async toJSON(t){return{Id:this.id&&this.id.guidString,Name:this.Name,Label:this.getDisplayName(t.langCode),ShowLabel:this.showlabel,Visible:this.visible||t.formModelService.showHiddenElements,LabelId:this.labelId.guidString,PreviewId:this.id&&this.id.guidString,ColSpan:this.colspan,RowSpan:this.rowspan,AutoExpand:this.autoexpand,IsInFirstColumnOfSection:!1,IsInLastColumnOfSection:!1,AvailableForPhone:this.availableforphone,UserSpacer:this.IsUserSpacer,IsPreviewCell:!1,IsStreamCell:!1,IsChartCell:!1,IsTileCell:!1,Control:this.control&&await this.control.toJSON(t)}}getUsedNodeNameSet(t){let r=new Set;return t&&t.visit(n=>{if(n.getNodeName()===y.formCell){let i=n;i.control&&i!==this&&r.add(n.control.id)}return!1}),r}getHighestIndexById(t,r){let n=t.findAll(a=>a.getNodeName()===y.formCell&&a.control&&a.control.ClassId.guidString===r),i=0;return n.forEach(a=>{i=Math.max(this.parseControlNameIndex(a.control.id),i)}),i}parseControlNameIndex(t){let r=t.length-1,n=0;for(;r>0&&parseInt(t.charAt(r),10);)r--;return r>0&&r!==t.length-1&&t.charAt(r)===Xp&&(r++,n=parseInt(t.substr(r,t.length-r),10)),n}}});var da,Zp=I(()=>{"use strict";rt();X();We();da=class extends W{isInternal;constructor(t,r,n,i){super(y.library,t),this.isInternal=!!i,P.IsNullOrEmpty(n)||(this.name=r,this.libraryUniqueId=n)}get libraryUniqueId(){let t=this.getProperty(m.libraryUniqueId);return t&&t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"&&(t=t.substr(1,t.length-2)),t?.toUpperCase()}set libraryUniqueId(t){this.setProperty(m.libraryUniqueId,t)}get name(){return this.getProperty(m.libraryName)}set name(t){this.setProperty(m.libraryName,t)}get displayName(){return this.getProperty(m.displayName)}set displayName(t){this.setProperty(m.displayName,t)}get description(){return this.getProperty(m.description)}set description(t){this.setProperty(m.description,t)}}});var ai,ef=I(()=>{"use strict";Fe();Wo();X();We();ai=class extends W{isRowAddedOnDragOver;constructor(t){super(y.formRow,t)}addCell(t){this.addChild(t)}appendCells(t){for(let r of t)this.addChild(r)}updateCell(t,r){return this.updateChild(t,r)}removeCell(t){return N.IsNullOrUndefined(t)?!1:this.deleteChild(t)>=0}insertCellAtIndex(t,r){return N.IsNullOrUndefined(t)?!1:(this.insertChildAtIndex(t,r),!0)}isEmpty(){return!this.cells||this.cells.every(t=>t.isEmpty())}getParentSection(){return this.getAncestor(y.formSection)}insertPaddingCellAtIndex(t){let r=new Dt(this);r.setDefaultProperties(),this.insertCellAtIndex(r,t)}get firstCell(){let t=this.cells;return t.length>0?t[0]:null}get cells(){return this.getChildren(y.formCell)}get rowColspan(){return this.cells.reduce((t,r)=>t+r.colspan,0)}set IsRowAddedOnDragOver(t){this.isRowAddedOnDragOver=t}get IsRowAddedOnDragOver(){return this.isRowAddedOnDragOver}async getCellsJSON(t){let r=[],n=[];if(this.cells){for(let i of this.cells)n.push(i.toJSON(t));for(let i of n)r.push(await i)}return r}async toJSON(t){return{Cells:await this.getCellsJSON(t),Visible:!0,Height:"0"}}}});function iV(e){switch(e){case ti.Left:return ri.Left;case ti.Right:return ri.Right;case ti.Center:return ri.Center;default:return ri.Left}}function aV(e){switch(e){case Wi.Left:return ji.Left;case Wi.Top:return ji.Top;default:return ji.Left}}function ZE(e){switch(e){case 1:return 1;case 2:return 11;case 3:return 111;case 4:return 1111;default:return 1}}var oV,Dr,Ho=I(()=>{"use strict";ap();Le();Fe();rt();Hp();Wo();X();ir();Pn();ef();oV=115,Dr=class e extends nt{colSpan=1;constructor(t,r){super(t,r)}getSectionType(){let t;switch(this.columns){case 1:t=Se.ONE_COLUMN;break;case 11:t=Se.TWO_COLUMN;break;case 111:t=Se.THREE_COLUMN;break;case 1111:t=Se.FOUR_COLUMN;break;default:t=this.colSpan-1}return t}setUniqueName(){let t=this.getParentTab(),r=Ae.namePrefix;if(t){let n=t.Name,i=t.TotalSectionsCount+1;r=n+Ae.namePrefix+i.toString()}else r+=Math.floor(Math.random()*1e3);this.setProperty(m.Name,r)}initializeDefaultProperties(t,r,n){if(n===Se.REFERENCE_PANEL){this.addProperty(m.rowheight,"25");let i=`${Ae.referencePanelNamePrefix}${T.NewGuid()}${Ae.namePrefix}`;this.addProperty(m.Name,i)}else this.setUniqueName();if(this.addProperty(m.id,new T(T.NewGuid()).guidString),this.addProperty(m.IsUserDefined,Ae.IsUserDefined),this.addProperty(m.locklevel,Ae.LockLevel),this.addProperty(m.showlabel,Ae.ShowLabel),this.addProperty(m.showbar,Ae.ShowBar),this.addProperty(m.layout,Ae.Layout),this.addProperty(m.Fieldlabelalignment,Ae.labelAlignment),this.addProperty(m.Fieldlabelposition,Ae.labelPosition),N.IsNullOrUndefined(n))this.addProperty(m.columnName,Ae.columns);else{let i=this.getColumnLayoutValue(n);this.addProperty(m.columnName,i)}this.addProperty(m.LabelWidth,Ae.LabelWidth),this.setDisplayName(r,t)}getColumnLayoutValue(t){let r;switch(t){case Se.TWO_COLUMN:r="11";break;case Se.THREE_COLUMN:r="111";break;case Se.FOUR_COLUMN:r="1111";break;default:r="1"}return r}getNumberOfColumns(){return e.getNumericColumnLayoutValue(this.columns)}static getNumericColumnLayoutValue(t){switch(t){case 1:return 1;case 11:return 2;case 111:return 3;case 1111:return 4;default:throw new Error("Unexpected Section Layout Value.")}}getColumnCountValue(){let t=0;return N.IsNullOrUndefined(this.columns)?t=this.ColSpan:this.columns.toString().split(P.EmptyString).forEach(r=>{t+=parseInt(r,10)}),t}get ColSpan(){return this.colSpan}initializeRow(t){if(t>0&&t<5){let r=new ai(null);if(this.addGrandChild(y.formRows,r),HE.getConfig().enableAutoInsertionOfCellInRow)for(let n=0;n<t;n++){let i=new Dt(r);i.setDefaultProperties(!1),r.addCell(i)}}}initialize(t,r,n){this.initializeDefaultProperties(t,r,n),n===Se.REFERENCE_PANEL&&(n=Se.ONE_COLUMN),this.initializeRow(n+1)}setColSpan(t){this.colSpan=t}appendRow(t){this.addGrandChild(y.formRows,t)}insertRowAtIndex(t,r){this.addGrandChildAtIndex(y.formRows,t,r)}insertRowsAtIndex(t,r){if(t&&t.length>0)for(let n=0;n<t.length;n++)this.addGrandChildAtIndex(y.formRows,t[n],r+n)}indexOfRow(t){return this.rows.indexOf(t)}deleteRow(t){return this.deleteFirstGrandChildOfName(y.formRows,t)}deleteRows(t,r){this.deleteGrandChildren(y.formRows,t,r)}get rows(){return this.getRows()}getRows(){let t=this.getChildren(y.formRows);return t.length===0?[]:t[0].getChildren(y.formRow)}get columns(){let t=this.getProperty(m.columnName),r=N.IsNullOrUndefined(t)?NaN:parseInt(t,10);if(isNaN(r)){let n=1;for(let i of this.rows)n=Math.max(n,i.cells.length);return ZE(n)}return r}set columns(t){N.IsNullOrUndefined(t)||this.setProperty(m.columnName,String(t))}get rowHeight(){let t=this.getProperty(m.rowheight);return N.IsNullOrUndefined(t)?null:parseInt(t,10)}set rowHeight(t){this.setProperty(m.rowheight,String(t))}set autoexpand(t){this.setProperty(m.autoExpand.toLowerCase(),String(t))}get autoexpand(){return this.getProperty(m.autoExpand.toLowerCase())==="true"}get isUserDefined(){return+this.getProperty(m.IsUserDefined)!=0}set isUserDefined(t){t?this.setProperty(m.IsUserDefined,"1"):this.setProperty(m.IsUserDefined,"0")}getParentColumn(){return this.getAncestor(y.formColumn)}getParentTab(){return this.getAncestor(y.formTab)}get hasMultiColumnRow(){return this.getColumnCountValue()>1}get showlabel(){return this.getProperty(m.showlabel)==="true"}set showlabel(t){N.IsNullOrUndefined(t)||this.setProperty(m.showlabel,String(t))}get fieldLabelAlignment(){let t=Ae.labelAlignment,r=this.getProperty(m.Fieldlabelalignment);return N.IsNullOrUndefined(r)?t:r}set fieldLabelAlignment(t){N.IsNullOrUndefined(t)||this.setProperty(m.Fieldlabelalignment,t)}get fieldLabelPosition(){let t=this.getProperty(m.Fieldlabelposition);return N.IsNullOrUndefined(t)?Ae.labelPosition:t}set fieldLabelPosition(t){N.IsNullOrUndefined(t)||this.setProperty(m.Fieldlabelposition,String(t))}get showbar(){return this.getProperty(m.showbar)==="true"}set showbar(t){N.IsNullOrUndefined(t)||this.setProperty(m.showbar,String(t))}get labelwidth(){let t=+this.getProperty(m.LabelWidth);return t===0?oV:t}set labelwidth(t){N.IsNullOrUndefined(t)||t>283&&t<57||this.setProperty(m.LabelWidth,t.toString())}async getRowsJSON(t){let r=[],n=[];if(this.rows){for(let i of this.rows)n.push(i.toJSON(t));for(let i of n)r.push(await i)}return r}async toJSON(t){return{Name:this.Name,Id:this.id&&this.id.guidString,Label:this.getDisplayName(t.langCode),ShowLabel:this.showlabel,Visible:this.visible||t.formModelService.showHiddenElements,LabelId:this.labelId&&this.labelId.guidString,PreviewId:this.id&&this.id.guidString,Rows:await this.getRowsJSON(t),CellLabel:{Width:this.labelwidth,Alignment:iV(this.fieldLabelAlignment),Position:aV(this.fieldLabelPosition)},Columns:ZE(this.getColumnCountValue()),AvailableForPhone:this.availableforphone,Height:this.rowHeight&&this.rowHeight.toString()}}getUsedNodeNameSet(t){let r=new Set;return t&&t.visit(n=>{if(n.getNodeName()===y.formSection){let i=n;i.Name&&!P.GuidStringEquals(i.id.guidString,this.id.guidString)&&r.add(n.Name)}return!1}),r}isReferencePanelSection(){return!N.IsNullOrUndefined(this)&&!N.IsNullOrUndefined(this.Name)&&this.Name.indexOf(Ae.referencePanelNamePrefix)===0}getAllMultiRowCells(){return this.findAll(t=>{if(t.getNodeName()===y.formCell){let r=t;return!r.isEmpty()&&r.rowspan>1}return!1})}isHeaderOrFooterSection(){return this.NodeName===y.formFooter||this.NodeName===y.formHeader}}});var On,Hl=I(()=>{"use strict";X();We();Ho();On=class e extends W{constructor(t){super(y.formColumn,t)}initializeDefaultProperties(t){this.addProperty(m.width,t.toString()+"%")}insertSectionAtIndex(t,r){this.addGrandChildAtIndex(y.formSections,t,r)}static createAndInitNewSection(t,r,n){let i=new Dr(y.formSection,null);return i.initialize(t,r,n),i}addSectionAtIndex(t,r){this.addGrandChildAtIndex(y.formSections,t,r)}initialize(t,r,n,i=Se.ONE_COLUMN){this.initializeDefaultProperties(t);let a=e.createAndInitNewSection(r,n,i);this.addSectionAtIndex(a,this.sections.length),a.setUniqueName()}get parentTab(){return this.getAncestor(y.formTab)}get sections(){let t=this.getChildren("sections");return t.length!==1?[]:t[0].getChildren(y.formSection)}get width(){return this.getProperty(m.width)}set width(t){this.setProperty(m.width,t)}deleteSection(t){return this.deleteFirstGrandChildOfName(y.formSections,t)}async getSectionsJSON(t){let r=[];if(this.sections)for(let n of this.sections)r.push(await n.toJSON(t));return r}async toJSON(t){return{Name:this.getProperty(m.Name),Id:this.getProperty(m.id),Label:null,ShowLabel:!1,Visible:!0,LabelId:null,PreviewId:this.getProperty(m.id),Sections:await this.getSectionsJSON(t),Width:this.width}}}});var jl,eN=I(()=>{"use strict";Le();X();ir();Ho();jl=class extends Dr{initializeNavArea(t,r,n){this.initializeNavAreaProps(t,r,n)}get AreaName(){return this.Name}initializeNavAreaProps(t,r,n){this.addProperty(m.Name,n),this.addProperty(m.id,new T(T.NewGuid()).guidString),this.addProperty(m.columnName,Ae.columns),this.setDisplayName(r,t)}}});var Ql,tN=I(()=>{"use strict";Hl();X();eN();Ql=class extends On{addAndIntializeNavBarSection(t,r,n,i){let a=new jl(y.formSection,null);return a.initializeNavArea(t,r,i),this.addGrandChildAtIndex(y.formSections,a,n),a}}});var Xr,Jl=I(()=>{"use strict";Le();Fe();rt();Hl();X();We();Pn();Xr=class extends nt{tabContainsAutoExpandControl;autoExpandCell;constructor(t,r){super(y.formTab,t),this.tabContainsAutoExpandControl=!1}getParentForm(){return this.getAncestor(y.form)}getTabLayoutType(){let t;switch(this.columns.length){case 1:t=Ce.ONE_COLUMN;break;case 2:if(parseInt(this.columns[0].width,10)===50&&parseInt(this.columns[1].width,10)===50){t=Ce.TWO_COLUMN_EQUAL;break}if(parseInt(this.columns[0].width,10)===67&&parseInt(this.columns[1].width,10)===33){t=Ce.TWO_COLUMN_WIDER_LEFT;break}if(parseInt(this.columns[0].width,10)===34&&parseInt(this.columns[1].width,10)===66){t=Ce.TWO_COLUMN_WIDER_RIGHT;break}t=Ce.TWO_COLUMN_CUSTOM_LAYOUT;break;case 3:if(parseInt(this.columns[0].width,10)===34&&parseInt(this.columns[1].width,10)===33&&parseInt(this.columns[2].width,10)===33){t=Ce.THREE_COLUMN_EQUAL;break}if(parseInt(this.columns[0].width,10)===28&&parseInt(this.columns[1].width,10)===44&&parseInt(this.columns[2].width,10)===28){t=Ce.THREE_COLUMN_WIDER_MID;break}t=Ce.THREE_COLUMN_CUSTOM_LAYOUT;break;default:}return t}initializeProperties(t,r,n){this.addProperty(m.Name,En.namePrefix+t.toString()),this.addProperty(m.id,new T(T.NewGuid()).guidString),this.addProperty(m.IsUserDefined,En.IsUserDefined),this.addProperty(m.locklevel,En.LockLevel),this.addProperty(m.showlabel,En.ShowLabel),this.setDisplayName(n,r)}get TotalSectionsCount(){let t=0;for(let r of this.columns)t+=r.sections.length;return t}initializeColumns(t,r,n,i=Se.ONE_COLUMN,a=!0,o){let s=this.getChildren(y.formColumns)[0],l=[];switch(t){case Ce.ONE_COLUMN:l.push(100);break;case Ce.TWO_COLUMN_EQUAL:l.push(50),l.push(50);break;case Ce.TWO_COLUMN_WIDER_LEFT:l.push(67),l.push(33);break;case Ce.TWO_COLUMN_WIDER_RIGHT:l.push(34),l.push(66);break;case Ce.THREE_COLUMN_EQUAL:l.push(34),l.push(33),l.push(33);break;case Ce.THREE_COLUMN_WIDER_MID:l.push(28),l.push(44),l.push(28);break;default:}for(let u of l){let c=new On(s);c.initialize(u,r,n,i),this.addGrandChild(y.formColumns,c)}}initialize(t,r,n,i,a,o=Se.ONE_COLUMN,s=!0,l){this.addChild(new W(y.formColumns,this)),this.initializeProperties(r,n,i),this.initializeColumns(t,n,a,o,s,l)}get columns(){let t=this.getChildren(y.formColumns);return t.length!==1?[]:t[0].getChildren(y.formColumn)}get expanded(){return this.getProcessedValue(m.expanded)}set expanded(t){N.IsNullOrUndefined(t)||this.setProperty(m.expanded,String(t))}get groupName(){return this.getProperty(m.groupName)}get contentType(){return this.getProperty(m.contentType)}set contentType(t){this.setProperty(m.contentType,t)}insertNewColumnAtIndex(t,r,n,i,a){t.initialize(n,i,a),this.addGrandChildAtIndex(y.formColumns,t,r)}insertColumnAtIndex(t,r){this.addGrandChildAtIndex(y.formColumns,t,r)}deleteColumn(t){return this.deleteFirstGrandChildOfName(y.formColumns,t)}async getColumnsJSON(t){let r=[],n=[];if(this.columns){for(let i of this.columns)n.push(i.toJSON(t));for(let i of n)r.push(await i)}return r}async toJSON(t){return{Name:this.Name,Id:this.id&&this.id.guidString,Label:this.getDisplayName(t.langCode)+(!this.visible&&t.formModelService.showHiddenElements?"\u3000\u3000":""),ShowLabel:this.showlabel,Visible:this.visible||t.formModelService.showHiddenElements,LabelId:this.labelId&&this.labelId.guidString,UniqueId:this.id&&this.id.guidString,PreviewId:this.id&&this.id.guidString,Columns:await this.getColumnsJSON(t),EventHandlers:[],Expanded:this.expanded,ContentType:this.contentType,AvailableForPhone:this.availableforphone,Header:void 0,Footer:void 0}}getUsedNodeNameSet(t){let r=new Set;return t&&t.visit(n=>{if(n.getNodeName()===y.formTab){let i=n;i.Name&&!P.GuidStringEquals(i.id.guidString,this.id.guidString)&&r.add(n.Name)}return!1}),r}}});var oi,tf=I(()=>{"use strict";Le();X();We();ir();tN();Jl();oi=class extends Xr{constructor(t,r,n){super(t,Ce.THREE_COLUMN_EQUAL),this.setDisplayName(r,n),this.id=new T(T.NewGuid())}initializeDefaultProps(){this.addChild(new W(y.formColumns,this)),this.initializeFiveColumns()}get columns(){let t=this.getChildren("columns");return t.length!==1?[]:t[0].getChildren(y.formColumn)}getNavSectionForArea(t){for(let r of this.columns)for(let n of r.sections)if(n.AreaName===t)return n;return null}getNavCellFromNavId(t){for(let r of this.columns)for(let n of r.sections)for(let i of n.rows)for(let a of i.cells)if(a.NavId===t)return a;return null}initializeFiveColumns(){for(let t=0;t<Il.FIVE_COLUMN;t++){let r=new Ql(this.getChildren(y.formColumns)[0]);r.initializeDefaultProperties(Cy.FiveEqColumn),this.addGrandChild(y.formColumns,r)}}}});function lV(e){switch(e){case ke.Main:return Dn.Main;case ke.QuickCreate:return Dn.QuickCreate;case ke.QuickViewForm:return Dn.Quick;case ke.Dialog:return Dn.Dialog;default:return Dn.None}}function uV(e,t){if(t===ke.Main){if(e)switch(e.toLowerCase()){case"low":return Sn.Low;case"highreadonlyvalues":return Sn.HighReadOnlyValues;default:return Sn.HighWithControls}return Sn.Low}}var Xl,sV,Kl,rN=I(()=>{"use strict";Ty();Xl=re(Xn());ap();Fe();rt();Ui();Hp();X();Vi();Sd();Kn();Wo();X();Pn();Zp();tf();Jl();sV="1920";Kl=class e extends nt{_formUniqueName;isHeaderDefaulted;consistencyStrong=!1;_formId;_rawFormXml;_entityName;_entityDisplayName;_status;_formName;_langCode;_description;_formType;_formPresentation;parameters=[];_formactivationstate;_changeTracker;_metadataChangeEvent;_etag;constructor(t,r,n,i,a,o,s,l,u){super(y.form,null),this._formUniqueName=a,this._formId=t,this._entityName=r,this._status=n,this._formName=i,this._description=l,this._formType=o,this._formPresentation=s,this._formactivationstate=u,this._changeTracker=new dl,this._metadataChangeEvent=new Pl}get FormLibraries(){let t=this.getFirstChild(y.formLibraries),r=t?t.getAllChildren():[],n=this._getInternalLibraries();return r.concat(n)}getAllEvents(){let t=[],r=this.events;r&&(t=t.concat(r));for(let n of this.tabs){let i=n.events;i&&(t=t.concat(i)),n.findAll(a=>a instanceof Dt).forEach(a=>{let o=a.events;o&&(t=t.concat(o))})}return t}getEventsForNode(t){if(t instanceof e){let r=t.events;return r?r.filter(n=>!n.control&&!n.attribute):null}else if(t instanceof Dt){if(t.control?.dataFieldName){let r=this.events;return r?r.filter(n=>n.attribute&&t.control.dataFieldName===n.attribute):null}else if(this.isCellEditableGridControl(t)){let r=this.events;return r?r.filter(n=>n.control&&t.control.id===n.control):null}}return t?.events}_getInternalLibraries(){let t=this.findAll(i=>i.getNodeName()===y.internalLibraries),r=[],n="src";return t.length>0&&(r=t.map(i=>{let a=i.GetPropertyByParameter(n).replace("$webresource:",""),o=new da(void 0,void 0,"",!0);return o.name=a,o.displayName=a,o})),r}getDependentFields(){let t=this.getAllEvents(),r=new Set;return t.forEach(n=>{try{n.getAllDependencies().forEach(a=>{r.add(a.id)})}catch(i){throw(0,Xl.trackErrorTrace)(jv,{eventName:"GetDependentFields_MissingDependencies",eventData:{Message:`Failed get dependencies for form event in form ${this.formId.guidString}.`,Attribute:n.attribute,EventName:n.eventName}}),i}}),r}get Parameters(){return this.parameters}set Parameters(t){this.parameters=t}get ShowImagecheck(){return P.IsNullOrEmpty(this.getProperty(m.ShowImage))?!0:this.getProperty(m.ShowImage)!=="false"}set ShowImagecheck(t){t?this.setProperty(m.ShowImage,String(t)):this.setProperty(m.ShowImage,"false")}get ShowNavigation(){return P.IsNullOrEmpty(this.getProperty(m.ShowNavigationbar))?!0:this.getProperty(m.ShowNavigationbar)!=="false"}set ShowNavigation(t){t?this.setProperty(m.ShowNavigationbar,String(t)):this.setProperty(m.ShowNavigationbar,"false")}get MaxWidth(){return P.IsNullOrEmpty(this.getProperty(m.MaxWidth))?sV:this.getProperty(m.MaxWidth)}set MaxWidth(t){this.setProperty(m.MaxWidth,t)}get headerDensityType(){return this.getProperty(m.HeaderDensityType)}set headerDensityType(t){t&&this.formType===ke.Main?this.setProperty(m.HeaderDensityType,t):this.formType!==ke.Main&&this.headerDensityType&&this.removeProperty(m.HeaderDensityType)}IsMainOrQuickCreateForm(){return this.formType===ke.Main||this.formType===ke.QuickCreate}get FormPresentation(){return this._formPresentation}get LanguageCode(){return this._langCode}set LanguageCode(t){this._langCode=t}get header(){let t=this.getChildren(y.formHeader);return t.length!==1?null:t[0]}set header(t){N.IsNullOrUndefined(t)||(this.deleteChild(this.header),this.addChild(t))}getAllDependencies(){return this.getChildren(y.quickFormDependencies).length===0?[]:this.ConvertModelToArray(this.getChildren(y.quickFormDependencies)[0].getAllChildren())}ConvertModelToArray(t){let r=[];return N.IsNullOrUndefined(t)||t.forEach(n=>{r.push(n.id)}),r}get footer(){let t=this.getChildren(y.formFooter);return t.length!==1?null:t[0]}set footer(t){N.IsNullOrUndefined(t)||(this.deleteChild(this.footer),this.addChild(t))}createAndInitNewTab(t,r,n){let i=new Xr(null,t),a=this.getNextTabCounter(this.tabs.length+1);return i.initialize(t,a,this.LanguageCode,r,n),i}addTabAtIndex(t,r){this.addGrandChildAtIndex(y.formTabs,t,r)}createAndInitNewTabWithMarginalControl(t,r,n,i,a){let o=new Xr(null,Ce.ONE_COLUMN),s=this.getNextTabCounter(this.tabs.length+1);o.initialize(Ce.ONE_COLUMN,s,this.LanguageCode,r,n,a,!1),this.addGrandChildAtIndex(y.formTabs,o,i);let l=o.columns[0].sections[0];for(let u=0;u<t.rows.length;u++)l.appendRow(t.rows[u])}getNextTabCounter(t){for(let r=0;r<this.tabs.length;r++)if(this.tabs[r].Name===En.namePrefix+t.toString())return this.getNextTabCounter(t+1);return t}get allTabs(){let t=this.getChildren(y.formTabs);return t.length!==1?[]:t[0].getChildren(y.formTab)}get CanvasNavigationTab(){if(this.tabs.length>0){let t=this.tabs[this.tabs.length-1];if(t instanceof oi)return t}return null}get NavigationNode(){let t=this.getChildren(y.formNavigation);return t.length!==1?null:t[0]}set NavigationNode(t){let n=this.getAllChildren().indexOf(this.NavigationNode);n>=0&&(this.deleteChild(this.NavigationNode),this.insertChildAtIndex(t,n))}addNavigatioNode(t){this.addChild(t)}get tabs(){return this.allTabs}deleteTab(t){return this.deleteFirstGrandChildOfName(y.formTabs,t)}insertTabAtIndex(t,r){this.addGrandChildAtIndex(y.formTabs,t,r)}insertRelatedTab(t){let r=this.getAllGrandChildren(y.formTabs);if(!N.IsNullOrUndefined(r)){let n=r.length;this.insertTabAtIndex(t,n)}}get isfooterPresent(){return this.getChildren(y.formFooter).length>0}get displayCondition(){let t=this.getChildren(y.formDisplayConditions);return t.length>0?t[0]:null}set displayCondition(t){this.deleteChild(this.displayCondition),this.addChild(t)}get entityName(){return this._entityName}get formId(){return this._formId}set formId(t){this._formId=t}get rawFormXml(){return this._rawFormXml}set rawFormXml(t){this._rawFormXml=t}get status(){return this._status}set status(t){this._status=t}get formName(){return this._formName}set formName(t){this.trackObjectPropertyChange("_formName",t)}get formUniqueName(){return this._formUniqueName}set formUniqueName(t){this.trackObjectPropertyChange("_formUniqueName",t)}get formType(){return this._formType}get tabCount(){return this.allTabs.length}get description(){return this._description}set description(t){this.trackObjectPropertyChange("_description",t)}get formactivationstate(){return this._formactivationstate}set formactivationstate(t){this.trackObjectPropertyChange("_formactivationstate",t)}get entityDisplayName(){return this._entityDisplayName}set entityDisplayName(t){this._entityDisplayName=t}get etag(){return this._etag}set etag(t){this._etag=t}indexOfTab(t){return this.getAllGrandChildren(y.formTabs).indexOf(t)}get ControlDescriptions(){return this.getAllGrandChildren(y.controlDescriptions)}addControlDescriptionNode(t){this.addGrandChild(y.controlDescriptions,t)}deleteControlDescByForControlId(t){let r=this.getControlDescriptionByForControl(t);N.IsNullOrUndefined(r)||this.deleteFirstGrandChildOfName(y.controlDescriptions,r)}getControlDescriptionByForControl(t){if(!t)return null;for(let r of this.ControlDescriptions)if(r.forControl.guidString===t.guidString)return r;return null}cellHasCustomControlWithName(t,r){if(!t?.control||!r)return!1;let n=this.getControlDescriptionByForControl(t.control.UniqueId);return n?!!n.customControls.find(i=>i.name===r):!1}isDuplicateCell(t,r){return!!this.findFirst(i=>{if(!(i instanceof Dt))return!1;let a=!0;return r==="Tab"?a=i.getParentTab()!==t.getParentTab():r==="Section"?a=i.getParentSection()!==t.getParentSection():a=i!==t,i instanceof Dt&&i.control&&t.control&&a&&i.control.dataFieldName===t.control.dataFieldName})}isCellEditableGridControl(t){return!t?.control?.indicationOfSubgrid||t.control.ClassId.guidString.toUpperCase()!==S.CustomControl?!1:this.cellHasCustomControlWithName(t,Nn.EditableGridControl)||jE.getConfig()?.enableOneGridEventsForFormDesigner&&this.cellHasCustomControlWithName(t,Nn.PowerAppsOneGrid)}isCellCanvasAppControl(t){return t?.control?.ClassId.guidString.toUpperCase()===S.CustomControl&&this.cellHasCustomControlWithName(t,Nn.CanvasAppControl)}findFormNodeById(t,r=this){return r===null?null:r.findFirst(n=>{if(n===this&&t===this.formId.ToString()||n.id?.ToString?.()===t)return!0})}findFormCellByClassId(t,r=this){return r?r.findFirst(n=>{if(n.getNodeName()===y.formCell){let i=n;return i&&i.control&&i.control.ClassId.guidString===t}return!1}):null}async getTabsJSON(t){let r=this.tabs,n=[],i=[];if(r){for(let a of r)if(!(a instanceof oi)){let o=a.toJSON(t);n.push(o)}for(let a of n)i.push(await a)}return i}async getControlDescriptionsToJSON(t){let r=[];for(let n of this.ControlDescriptions){let i=await n.toJSON(t);i&&r.push(i)}return r}async toJSON(t){let r=[];r=await this.getControlDescriptionsToJSON(t);let n=this.NavigationNode&&await this.NavigationNode.toJSON(t);return{Id:this._formId.guidString,Name:this.formName,Label:this.getDisplayName(t.langCode),ShowLabel:this.showlabel,Visible:this.visible,LabelId:this.labelId&&this.labelId.guidString,PreviewId:this._formId.guidString,PreviewSessionId:(0,Xl.getSessionId)(),EntityLogicalName:this._entityName,FormId:this._formId.guidString,TabAttributes:{},Tabs:await this.getTabsJSON(t),HiddenFields:[],Header:this.header&&await this.header.toJSON(t),Footer:this.footer&&await this.footer.toJSON(t),...this.formType===ke.Main?{HeaderDensity:uV(this.headerDensityType,this.formType)}:{},InlineEditGridRow:[],InlineQuickForms:[],QuickFormEntities:[],EventHandlers:[],LinkControlSections:[],FormType:lV(this.formType),SubGrids:[],Views:void 0,Charts:void 0,CustomControlConfigurations:r,BusinessLogic:void 0,FormLibraries:[],Navigation:n,ShowNavigationBar:this.ShowNavigation||t.formModelService.showHiddenElements,ClientResources:[]}}changeTracker(){return this._changeTracker}onMetadataChange=t=>this._metadataChangeEvent.on(t);raiseMetadataChange(t){this._metadataChangeEvent.emit(t)}}});var Yl,rf,nN=I(()=>{"use strict";Le();Fe();X();We();Pn();Yl=class extends nt{constructor(t){super(y.formDisplayConditions,t)}get Order(){let t=this.getProperty(m.Order);return N.IsNullOrUndefined(t)?null:parseInt(t,10)}set Order(t){this.setProperty(m.Order,t.toString())}get FallbackForm(){return this.getProperty(m.FallbackForm)==="true"}set FallbackForm(t){this.setProperty(m.FallbackForm,t.toString())}addRoles(t){this.deleteAllChildren();for(let r=0;r<t.length;r++)this.addChild(t[r])}isRoleEveryone(){return!!(this.getChildren(y.formEveryOne)&&this.getChildren(y.formEveryOne)[0])}setRoleEveryone(){this.deleteAllChildren(),this.addChild(new rf(this))}},rf=class extends W{constructor(t){super(y.formEveryOne,t)}}});var Zl,iN=I(()=>{"use strict";X();We();Zl=class extends W{constructor(t,r){super(y.Handler,r),t.length>0&&this.setDefaultProperties(t)}setDefaultProperties(t){this.FunctionName=t[0],this.LibraryName=t[1],this.HandlerUniqueID=t[2],this.Enabled=t[3],this.Parameters=t[4],this.PassExecutionContext=t[5]}get HandlerUniqueID(){return this.getProperty(m.HandlerUniqueId)}set HandlerUniqueID(t){this.setProperty(m.HandlerUniqueId,t)}get FunctionName(){return this.getProperty(m.functionName)}set FunctionName(t){this.setProperty(m.functionName,t)}get LibraryName(){return this.getProperty(m.libraryNameEventHandler)}set LibraryName(t){this.setProperty(m.libraryNameEventHandler,t)}get Enabled(){return this.getProperty(m.enabledForField)}set Enabled(t){this.setProperty(m.enabledForField,t)}get PassExecutionContext(){return this.getProperty(m.passExecutionContext)}set PassExecutionContext(t){this.setProperty(m.passExecutionContext,t)}get Parameters(){return this.getProperty(m.parameters)}set Parameters(t){this.setProperty(m.parameters,t)}}});var pa,nf=I(()=>{"use strict";X();Ho();pa=class extends Dr{constructor(t,r){super(t,r)}get cells(){let t=this.getRows(),r=[];if(this.rows&&t.length){for(let n of this.rows)if(n.cells){let i=n.getChildren(y.formCell);for(let a of i)r.push(a)}}return r}get occupiedCells(){return this.cells.filter(t=>!t.isEmpty())}get maxColumns(){return super.getColumnCountValue()}}});var jo,aN=I(()=>{"use strict";X();nf();jo=class extends pa{_customFooter;constructor(t,r){super(y.formFooter,t),this._customFooter=r}get customFooter(){return this._customFooter}set customFooter(t){this._customFooter=t}async getControls(t){let r=[];if(this.rows){for(let n of this.rows)if(n.cells)for(let i of n.cells)i.control&&r.push(await i.control.toJSON(t))}return r}async toJSON(t){return{AvailableForPhone:this.availableforphone,Controls:await this.getControls(t),UniqueId:this.id&&this.id.guidString,PreviewId:this.id&&this.id.guidString}}isEmpty(){return!this.cells.find(t=>!!t.control)}}});var Qo,oN=I(()=>{"use strict";X();nf();Qo=class extends pa{_customHeader;constructor(t,r){super(y.formHeader,t),this._customHeader=r}get customHeader(){return this._customHeader}set customHeader(t){this._customHeader=t}get showCommandBar(){return this.getProcessedValue(m.showCommandBar)}set showCommandBar(t){t!=null&&this.setProperty(m.showCommandBar,String(t))}get showBody(){return this.getProcessedValue(m.showBody)}set showBody(t){t!=null&&this.setProperty(m.showBody,String(t))}get showTabNavigator(){return this.getProcessedValue(m.showTabNavigator)}set showTabNavigator(t){t!=null&&this.setProperty(m.showTabNavigator,String(t))}async getControls(t){let r=[];if(this.rows){for(let n of this.rows)if(n.cells)for(let i of n.cells)i.control&&r.push(await i.control.toJSON(t))}return r}async toJSON(t){return{AvailableForPhone:this.availableforphone,Controls:await this.getControls(t),UniqueId:this.id&&this.id.guidString,PreviewId:this.id&&this.id.guidString}}}});var It,si=I(()=>{"use strict";Le();rt();X();Pn();It=class e extends nt{constructor(t,r){super(t,r)}getTitle(t){for(let r of this.getAllTitles())if(+r.getProperty(m.LCID)===t)return r.getProperty(m.text);return null}getAllTitles(){let t=this.getChildren(y.Titles);return t.length===0?[]:t[0].getChildren(y.Title)}setTitle(t,r){for(let i of this.getAllTitles())if(+i.getProperty(m.LCID)===r){i.setProperty(m.text,t);return}let n=new e(y.Title,null);n.setProperty(m.text,t),n.setProperty(m.LCID,String(r)),this.addGrandChild(y.Titles,n)}get Sequence(){return+this.getProperty(m.Sequence)}set Sequence(t){this.setProperty(m.Sequence,t.toString())}get Area(){return this.getProperty(m.Area)}set Area(t){this.setProperty(m.Area,t)}set Id(t){this.setProperty(m.Id,t)}get Id(){return this.getProperty(m.Id)}get id(){return new T(this.Id??"",!0)}set id(t){this.Id=t.guidString}get Show(){return!0}get Icon(){return this.getProperty(m.icon)}set Icon(t){t=t||P.EmptyString,this.setProperty(m.icon,t)}updateCommonProperties(t,r){this.Area=t.Area,this.Sequence=t.Sequence,this.setTitle(t.getDisplayName(r),r)}}});var Jo,sN=I(()=>{"use strict";(function(e){e[e.NavLinkNotAvailable=-1]="NavLinkNotAvailable",e[e.NavLinkIdConflict=-2]="NavLinkIdConflict",e[e.NavBarNotAvailable=-3]="NavBarNotAvailable"})(Jo||(Jo={}))});var eu,lN=I(()=>{"use strict";Fe();X();si();sN();eu=class extends It{constructor(t){super(y.formNavBar,t)}addChildElement(t){this.addChild(t)}getAllActiveNavBarChildren(){return this.getAllChildren().filter(n=>n.Show)}getAllInActiveActiveNavBarChildren(){return this.getAllChildren().filter(n=>!n.Show)}get AllRelationShipItems(){return this.getChildren("NavBarByRelationshipItem")}get AllNavLinkItems(){return this.getChildren("NavBarItem")}removeNavLink(t){let r=this.getNavBarLinkItemById(t);return N.IsNullOrUndefined(r)?Jo.NavLinkNotAvailable:r.length===1?this.deleteChild(r[0]):Jo.NavLinkIdConflict}getRelationShipItemsByArea(t){let r=this.AllRelationShipItems,n=[];for(let i of r)i.Area===t&&i.Show===!0&&n.push(i);return n}getNavBarRelationShipItemsByNavId(t){return this.AllRelationShipItems.filter(n=>n.Id===t)}getNavBarLinkItemById(t){let r=this.AllNavLinkItems.filter(n=>n.Id===t);return r.length>0?r:null}getAllActiveChildrenForGivenArea(t){let r=this.getAllChildren(),n=[];for(let i of r)i.Area===t&&i.Show&&n.push(i);return n}}});var ve,cV,uN,MZ,fa,af=I(()=>{"use strict";Le();X();si();(function(e){e.Info="_NA_Info",e.Sales="_NA_SFA",e.Service="_NA_CS",e.Marketing="_NA_MA",e.InternetMarketing="_NA_IMA",e.ProcessCenter="_NA_PROC",e.Async="_NA_AO"})(ve||(ve={}));cV=new Map([[ve.Info,"Info"],[ve.Sales,"Sales"],[ve.Service,"Service"],[ve.Marketing,"Marketing"],[ve.ProcessCenter,"ProcessCenter"]]),uN=new Map([["Info",ve.Info],["Sales",ve.Sales],["Service",ve.Service],["Marketing",ve.Marketing],["ProcessCenter",ve.ProcessCenter]]),MZ=new Map([[ve.Info,9e3],[ve.Sales,9200],[ve.Service,9400],[ve.Marketing,9600],[ve.ProcessCenter,9800],[ve.InternetMarketing,1e4],[ve.Async,10200]]),fa=class extends It{constructor(t,r){super(y.formNavBarArea,r)}setDefaultPropertiesByType(t,r,n){this.AreaId=cV.get(t);let i=n?.(`navBarArea.title.${this.AreaId}`)??this.AreaId;this.setTitle(i,r)}get ParentNavigation(){return this.getAncestor(y.formNavigation)}get AreaId(){return this.getProperty(m.Id)}set AreaId(t){this.setProperty(m.Id,t)}get id(){return new T(this.AreaId??"",!0)}set id(t){this.AreaId=t.guidString}async toJSON(t){return{Id:this.AreaId,Titles:[{LCID:t.langCode,Text:this.getTitle(t.langCode)}],PreviewId:this.AreaId}}}});var ma,of=I(()=>{"use strict";X();si();ma=class extends It{constructor(t,r){super(y.formNavBarAreas,r)}get AllNavBarAreaItems(){return this.getChildren(y.formNavBarArea)}get ParentNavigation(){return this.getAncestor(y.formNavigation)}addNavBarArea(t){this.addChild(t)}}});var tu,cN=I(()=>{"use strict";Fe();X();si();tu=class extends It{RelationshipNameUCIRuntime;constructor(t){super(y.formNavBarByRelationshipItem,t)}get RelationshipName(){return this.getProperty(m.RelationshipName)}set RelationshipName(t){this.setProperty(m.RelationshipName,t)}set Show(t){this.setProperty(m.Show,String(t))}get Show(){let t=this.getProperty(m.Show);return N.IsNullOrUndefined(t)||t==="true"}get TitleResourceId(){return this.getProperty(m.TitleResourceId)}async toJSON(t){return{Area:this.Area,Show:this.Show||t.formModelService.showHiddenElements,Id:this.Id,Titles:[{Name:t.langCode.toString(),Value:this.getTitle(t.langCode)}],Sequence:this.Sequence.toString(),Privileges:[],TooltipTitles:[],AvailableOffline:!0,PreviewId:this.Id,RelationshipName:this.RelationshipNameUCIRuntime??this.RelationshipName,Icon:null,ViewId:null,Client:null,TitleResourceId:null}}}});var ru,dN=I(()=>{"use strict";X();si();ru=class extends It{constructor(t){super(y.formNavBarItem,t)}get Url(){return this.getProperty(m.url)}set Url(t){this.setProperty(m.url,t)}}});var nu,pN=I(()=>{"use strict";Le();X();af();of();si();nu=class extends It{constructor(t,r){super(t,r)}getNavBarAreaByAreaName(t){let r=this.navBarAreas.AllNavBarAreaItems.filter(n=>n.AreaId===t);return r.length===0?null:r[0]}get navBarAreas(){return this.getFirstChild(y.formNavBarAreas)}setDefaultNavBarAreas(t,r){let n=[ve.Info,ve.Sales,ve.Service,ve.Marketing,ve.ProcessCenter];if(this.navBarAreas){let i=this.navBarAreas?.AllNavBarAreaItems;if(i&&i.length>0){let a=new Set(i.map(o=>uN.get(o.AreaId)));n=n.filter(o=>!a.has(o))}}else{let i=new ma(y.formNavBarAreas,this);i.isTransient=!0,this.addChild(i)}return n.length>0?(n.forEach(i=>{let a=new fa(y.formNavBarArea,this.navBarAreas);a.setDefaultPropertiesByType(i,t,r),this.navBarAreas.addNavBarArea(a)}),!0):!1}get navBar(){return this.getFirstChild(y.formNavBar)}get id(){return new T(Ld,!0)}replaceNavAreaToGivenIndex(t,r){this.navBarAreas?.AllNavBarAreaItems.indexOf(r)!==-1&&(this.deleteFirstGrandChildOfName(y.formNavBarAreas,r),this.addGrandChildAtIndex(y.formNavBarAreas,r,t))}async getNavBarAreasJSON(t){let r=[],n=[];if(this.navBarAreas?.AllNavBarAreaItems){for(let a of this.navBarAreas.AllNavBarAreaItems)n.push(a.toJSON(t));r=await Promise.all(n)}return r}async getNavBarRelationshipItemsJSON(t){let r=[],n=[];if(this.navBar?.AllRelationShipItems){for(let i of this.navBar.AllRelationShipItems)n.push(i.toJSON(t));r=await Promise.all(n)}return r}async toJSON(t){let r=await this.getNavBarAreasJSON(t),n=await this.getNavBarRelationshipItemsJSON(t);return{NavBarAreas:{NavBarAreas:r},NavBarByRelationshipItems:n,NavBarItems:[],NavPaneIsvItems:{NavBarIsvItems:[]},ShowEmptyNavBarAreas:t.formModelService.showHiddenElements}}}});var fN={};Br(fN,{ControlType:()=>zt,DeserializationService:()=>uf,DeserializationServiceScope:()=>lf,DeserializedFormElementNode:()=>_t});var sf,_t,lf,zt,uf,Yp=I(()=>{"use strict";sf=re(Xn());Le();Fe();rt();Ui();kd();Kn();Qv();_y();Tl();rN();Wo();Hl();zo();jp();X();X();nN();We();ir();Qp();iN();aN();Jp();Kp();oN();Zp();ef();Ho();Jl();lN();af();of();cN();dN();pN();_t=class extends W{constructor(t,r){super(t,r)}insertProperty(t,r){this.addProperty(t,r)}insertChild(t){this.addChild(t)}},lf="DeserializationService";(function(e){e.Grid="Grid",e.Lookup="Lookup",e.Base="Base"})(zt||(zt={}));uf=class{lcid;constructor(t){this.lcid=t}deSerializeFormXml(t,r,n,i,a,o,s,l,u,c){if(!t)throw new Error("Formxml could not be parsed.");let d=t.getElementsByTagName("form");if(d.length!==1){let f="";throw d.length===0?f="FormXml has no form node.":f="FormXml has multiple form nodes.",(0,sf.trackErrorTrace)(dt,{eventName:lf,eventData:{error:f}}),new Error(f)}let p=this.createFormModel(d.item(0),r,n,i,a,o,s,l,u,c);return N.IsNullOrUndefined(p.displayCondition)&&s!==ke.Dialog&&this.appendDefaultDisplayCondition(p),p}upsertFieldCount(t,r){let n=Yn.getNecessaryLookUpTable(r),i=1;n.containsKey(t)&&(i+=n.getValue(t)),n.upsert(t,i)}appendDefaultDisplayCondition(t){let r='<DisplayConditions Order="0" FallbackForm="true"><Everyone/></DisplayConditions>';if(!N.IsNullOrUndefined(t)){let n=N.ParseXml(r);n!==null&&this.populateElementChildren(t,n.childNodes)}}createFormModel(t,r,n,i,a,o,s,l,u,c){let d=new Kl(r,n,i,a,o,s,l,u,c);return this.populateElementProperties(d,t.attributes),this.populateElementChildren(d,t.childNodes),s===ke.Main&&(this.insertHeaderFooterElementProperties(y.formHeader,d,d.header),this.insertHeaderFooterElementProperties(y.formFooter,d,d.footer)),d}insertHeaderFooterElementProperties(t,r,n){if(N.IsNullOrUndefined(n)){let i=t===y.formHeader?new Qo(r,!0):new jo(r,!0);_t.prototype.insertProperty.call(i,m.id,"{"+T.NewGuid()+"}"),_t.prototype.insertProperty.call(i,m.Fieldlabelposition,"Top"),_t.prototype.insertProperty.call(i,m.columnName,Ae.MarginalControlColumns),_t.prototype.insertProperty.call(i,m.LabelWidth,Ae.LabelWidth),_t.prototype.insertProperty.call(i,m.Fieldlabelalignment,"Left");let a=null,o=new ai(a);for(let s=0;s<i.maxColumns;s++){let l=new Dt(o);_t.prototype.insertProperty.call(l,m.id,"{"+T.NewGuid()+"}"),l.setDisplayName(P.EmptyString,this.lcid),_t.prototype.insertProperty.call(l,m.showlabel,"false"),o.addCell(l)}i.appendRow(o),t===y.formHeader?r.header=i:r.footer=i}}deSerializeFormXmlNode(t,r){if(t&&t.nodeValue&&(t.nodeType===Node.TEXT_NODE||t.nodeType===Node.CDATA_SECTION_NODE))return new _t(`<${t.nodeValue}`,r);if(t.nodeType===Node.COMMENT_NODE)return;let n=this.createModelNode(t,r);return this.populateElementProperties(n,t.attributes),this.populateElementChildren(n,t.childNodes),n}populateElementProperties(t,r){if(!r){let n="attributes is undefined for element: "+t.getNodeName();throw(0,sf.trackErrorTrace)(dt,{eventName:lf,eventData:{error:n}}),new Error(n)}for(let n=0;n<r.length;n++){let i=r.item(n);i&&(_t.prototype.insertProperty.call(t,i.name,i.value),t.getNodeName()===y.formCell&&i.name===m.auto&&i.value==="true"&&t.setAutoExpandDetailsForTab())}}populateElementChildren(t,r){for(let n=0;n<r.length;n++){let i=r.item(n),a=this.deSerializeFormXmlNode(i,t);a&&_t.prototype.insertChild.call(t,a)}}createModelNode(t,r){switch(t.nodeName){case y.form:throw new Error("Form node shouldn't be created using this method");case y.formTab:return new Xr(r);case y.formColumn:return new On(r);case y.formHeader:return new Qo(r,!1);case y.formFooter:return new jo(r,!1);case y.formSection:return new Dr(y.formSection,r);case y.formRow:return new ai(r);case y.formCell:return new Dt(r);case y.formControl:let n=t.attributes,i=t.childNodes.length>0?t.childNodes[0].childNodes:null,a;for(let s=0;s<n.length;s++){let l=n.item(s);if(l.name===m.indicationOfSubgrid&&l.value==="true"||l.name===m.classid&&(l.value?.toLocaleUpperCase()===`{${S.SubgridControl}}`||l.value?.toLocaleUpperCase()===`{${S.ReferencePanelSubgridControl}}`))a=zt.Grid;else if(l.name===m.classid&&l.value?.toLocaleUpperCase()===`{${S.LookupControl}}`)a=zt.Lookup;else if(l.name===m.classid&&l.value?.toLocaleUpperCase()===`{${S.CustomControl}}`)for(let u=0;u<i?.length;u++)i[u].nodeName===m.DefaultViewId&&(a=zt.Lookup)}return a===zt.Grid?new ua(r):a===zt.Lookup?new ca(r):new sr(r);case y.formEvent:return new la(r,P.EmptyString);case y.dependency:return this.populateDependencyTable(t),new sa(r,P.EmptyString);case y.Handler:let o=[];return new Zl(o,r);case y.formNavigation:return new nu(t.nodeName,r);case y.formNavBarArea:return new fa(t.nodeName,r);case y.formNavBarAreas:return new ma(t.nodeName,r);case y.formNavBar:return new eu(r);case y.formNavBarByRelationshipItem:return new tu(r);case y.formNavBarItem:return new ru(r);case y.formDisplayConditions:return new Yl(r);case y.library:return new da(r,P.EmptyString,P.EmptyString);case y.controlDescription:return new gl(r);case y.customControl:return this.populateCustomControlConfigurationId(t),new _l(r);default:return new _t(t.nodeName,r)}}populateDependencyTable(t){let r=t.attributes;for(let n=0;n<r.length;n++){let i=r.item(n);i.name===m.id&&this.upsertFieldCount(i.value,Cr.DependencyFieldTable)}}populateCustomControlConfigurationId(t){let r=t.attributes;for(let n=0;n<r.length;n++){let i=r.item(n);if(i.name===m.id){let a=new T(i.value.substr(1,i.value.length-2));for(let o=0;o<t.parentNode.attributes.length;o++){let s=t.parentNode.attributes.item(o);if(s.name===m.ForControl){let l=s.value.substr(1,i.value.length-2);Me.CustomControlIdMap.upsert(l,a);break}}break}}}}});var mN={};Br(mN,{SerializationService:()=>cf,SerializationServiceScope:()=>dV,SerializedFormElementNode:()=>ha});var dV,ha,cf,hN=I(()=>{"use strict";rt();We();ir();tf();dV="SerializationService",ha=class extends W{fetchNodeName(){return this.getNodeName()}enumerateProperties(){return this.getAllProperties()}enumerateChildren(){return this.getAllChildren()}},cf=class{langCode;constructor(t){this.langCode=t}serializeFormXmlNode(t){let r=ha.prototype.fetchNodeName.call(t);if(r.charAt(0)===Jr.StartTag)return P.EscapeXml(r.substr(1),!1);if(t.isTransient&&!t.isDirty())return P.EmptyString;let n=ha.prototype.enumerateProperties.call(t),i=ha.prototype.enumerateChildren.call(t);if(!(t instanceof oi)){let a=`<${r}`;if(n.length!==0&&(a+=` ${this.getPropertiesString(n)}`),i.length===0)a+=" />";else{let o=P.EmptyString;for(let s of i)o+=this.serializeFormXmlNode(s);a+=`>${o}</${r}>`}return a}return P.EmptyString}getPropertiesString(t){let r=P.EmptyString;return t.forEach((n,i)=>{i!==0&&(r+=" "),r+=`${n.key}="${P.EscapeXml(n.value,!0)}"`}),r}}});var Ir=g(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.rejectUnknownKeys=it.childObjects=it.optionalGuidId=it.optionalEnum=it.eachObject=it.issue=it.isJsonObject=void 0;function gN(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}it.isJsonObject=gN;function ga(e,t,r,n){return n?{pointer:e,rule:t,message:r,fatal:n}:{pointer:e,rule:t,message:r}}it.issue=ga;function vN(e,t,r,n){if(!Array.isArray(e))return[];let i=[];return e.forEach((a,o)=>{gN(a)?i.push({node:a,index:o}):n.push(ga(`${t}/${o}`,`${r}-must-be-object`,`a ${r} must be a JSON object, got ${a===null?"null":typeof a}`))}),i}it.eachObject=vN;function pV(e,t,r,n,i,a){let o=e[t];o!==void 0&&(typeof o!="string"||!r.includes(o))&&a.push(ga(`${n}/${t}`,i,`${t} must be one of ${r.map(s=>`'${s}'`).join(", ")}, got ${JSON.stringify(o)}`))}it.optionalEnum=pV;var fV=/^(?:\{[0-9a-fA-F]{8}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{12}\}|[0-9a-fA-F]{8}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{12})$/;function mV(e,t,r,n,i){let a=e[t];typeof a=="string"&&a!==""&&!fV.test(a)&&i.push(ga(`${r}/${t}`,n,`${t} must be a GUID or empty, got '${a}'`))}it.optionalGuidId=mV;function hV(e,t,r,n,i){let a=e[t],o=`${r}/${t}`;return a===void 0?[]:Array.isArray(a)?vN(a,o,n,i):(i.push(ga(o,`${n}-list-must-be-array`,`${t} must be an array when present, got ${typeof a}`)),[])}it.childObjects=hV;function gV(e,t,r,n,i,a={}){var o,s;for(let l of Object.keys(e)){if(t.has(l))continue;let u=(o=a.elsewhere)===null||o===void 0?void 0:o[l],c=(s=a.unsupported)===null||s===void 0?void 0:s[l],d=u?` '${l}' is a ${u} key \u2014 set it on the ${u} instead.`:c?` ${c}`:` Put values the typed layer does not model in '${n}.bag', which round-trips them verbatim.`;i.push(ga(`${r}/${l}`,`${n}-unknown-key`,`'${l}' is not a ${n} property, and would be SILENTLY DROPPED at serialization.${d}`))}}it.rejectUnknownKeys=gV});var Rn=g(iu=>{"use strict";Object.defineProperty(iu,"__esModule",{value:!0});iu.installDomShim=void 0;var yN=sl(),bN=!1,vV={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12};function yV(){if(bN)return;let e=globalThis;typeof e.DOMParser>"u"&&(e.DOMParser=yN.DOMParser),typeof e.XMLSerializer>"u"&&(e.XMLSerializer=yN.XMLSerializer),typeof e.Node>"u"&&(e.Node=vV),bN=!0}iu.installDomShim=yV});var LN=g(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.classIdForAttributeType=Pt.QUICK_VIEW_CLASS_ID=Pt.NOTES_CLASS_ID=Pt.SUBGRID_CLASS_ID=Pt.formRegistration=Pt.FormAdapter=void 0;var Yr=(Le(),fr(Uv)),bV=(Fe(),fr($v)),wV=(We(),fr(Vv)),at=(X(),fr(qv)),xe=(Kn(),fr(Gv)),AV=(Yp(),fr(fN)),CV=(hN(),fr(mN)),Be=yn(),wN=rr(),Tt=Ir(),SV=Qc(),Ko=ct(),mf=ie(),NN=Rn(),DN=Ci(),EV={[at.FormType.Main]:"Main",[at.FormType.QuickCreate]:"QuickCreate",[at.FormType.QuickViewForm]:"QuickView",[at.FormType.Card]:"Card"},df={Main:at.FormType.Main,QuickCreate:at.FormType.QuickCreate,QuickView:at.FormType.QuickViewForm,Card:at.FormType.Card},NV=new Map(Object.entries(xe.ControlClassId).map(([e,t])=>[String(t).toUpperCase(),e]));function IN(e){var t;return e&&(t=NV.get(e.toUpperCase()))!==null&&t!==void 0?t:"Unknown"}function Xo(e){return e.getAllProperties().map(t=>[t.key,t.value])}function li(e){let t=new Map;for(let r of e.getAllProperties())t.has(r.key)||t.set(r.key,r.value);return t}function _N(e,t){return e.getAllChildren().find(r=>r.getNodeName()===t)}function hf(e,t){var r,n;let i=_N(e,"labels");if(!i)return"";let a=i.getAllChildren().filter(s=>s.getNodeName()==="label"),o=(r=a.find(s=>li(s).get("languagecode")===String(t)))!==null&&r!==void 0?r:a[0];return o&&(n=li(o).get("description"))!==null&&n!==void 0?n:""}function DV(e){let t=_N(e,"parameters"),r={};if(!t)return r;for(let n of t.getAllChildren()){let i=n.getNodeName();if(i.charAt(0)==="<"||i.charAt(0)==="#")continue;let a=n.getAllChildren()[0],o=a?a.getNodeName():"";o.charAt(0)==="<"&&(o=o.substring(1)),r[i]=o}return r}function TN(e){return/^1+$/.test(e)&&e.length>=1&&e.length<=4?e.length:1}function pf(e){let t=Math.min(Math.max(Math.trunc(e),1),4);return"1".repeat(t)}function Yo(e){return String(e??"").replace(/[{}]/g,"")}function ff(e){return`{${Yo(e)}}`}function AN(e,t){if(e===void 0||e==="")return t;let r=Number(e);return Number.isNaN(r)?t:r}function ou(e,t,r){let n=e.getAllChildren(),i=n.findIndex(u=>u.getNodeName()===t),a=[];if(n.forEach((u,c)=>{c!==i&&a.push({i:c,node:(0,Be.rawFromNode)(u)})}),i<0)return{modeled:[],bag:{a:Xo(e),c:a}};let o=n[i],s=[],l=[];return o.getAllChildren().forEach((u,c)=>{u.getNodeName()===r?s.push(u):l.push({i:c,node:(0,Be.rawFromNode)(u)})}),{modeled:s,bag:{a:Xo(e),c:a,w:{n:o.getNodeName(),a:Xo(o),c:l}}}}function PN(e,t,r){let n=[],i=[];return e.getAllChildren().forEach((a,o)=>{a.getNodeName()===t&&(!r||n.length===0)?n.push(a):i.push({i:o,node:(0,Be.rawFromNode)(a)})}),{modeled:n,bag:{a:Xo(e),c:i}}}function IV(e,t){let{modeled:r,bag:n}=ou(e,"tabs","tab");return{tabs:r.map(i=>_V(i,t)),bag:n}}function _V(e,t){var r,n;let i=li(e),{modeled:a,bag:o}=ou(e,"columns","column");return{id:(r=i.get("id"))!==null&&r!==void 0?r:"",name:(n=i.get("name"))!==null&&n!==void 0?n:"",label:hf(e,t),expanded:i.get("expanded")==="true",visible:i.has("visible")?i.get("visible")==="true":!0,columns:a.map(s=>TV(s,t)),bag:o}}function TV(e,t){let r=li(e),{modeled:n,bag:i}=ou(e,"sections","section");return{width:r.get("width"),sections:n.map(a=>PV(a,t)),bag:i}}function PV(e,t){var r,n,i;let a=li(e),{modeled:o,bag:s}=ou(e,"rows","row");return{id:(r=a.get("id"))!==null&&r!==void 0?r:"",name:(n=a.get("name"))!==null&&n!==void 0?n:"",label:hf(e,t),visible:a.has("visible")?a.get("visible")==="true":!0,showLabel:a.get("showlabel")==="true",columns:TN((i=a.get("columns"))!==null&&i!==void 0?i:"1"),rows:o.map(l=>OV(l,t)),bag:s}}function OV(e,t){let{modeled:r,bag:n}=PN(e,"cell",!1);return{cells:r.map(i=>RV(i,t)),bag:n}}function RV(e,t){var r;let n=li(e),{modeled:i,bag:a}=PN(e,"control",!0),o=hf(e,t),s=n.get("showlabel")==="true",l=i[0]?FV(i[0],o,s):null;return{id:(r=n.get("id"))!==null&&r!==void 0?r:"",visible:n.has("visible")?n.get("visible")==="true":!0,colspan:AN(n.get("colspan"),1),rowspan:AN(n.get("rowspan"),1),control:l,bag:a}}function FV(e,t,r){var n,i;let a=li(e),o=Yo((n=a.get("classid"))!==null&&n!==void 0?n:""),s=a.get("datafieldname");return{id:(i=a.get("id"))!==null&&i!==void 0?i:"",classId:o,fieldName:s||null,type:IN(o),isRequired:a.get("isrequired")==="true",isReadOnly:a.get("disabled")==="true",label:t,showLabel:r,parameters:DV(e),bag:{a:Xo(e),c:e.getAllChildren().map((l,u)=>({i:u,node:(0,Be.rawFromNode)(l)}))}}}function va(e){return e.a.length===0&&e.c.length===0&&!e.w}function ON(e,t){let r=e.a.find(n=>n[0]===t);return r?r[1]:void 0}function ui(e,t){var r;let n=new Set(e.a.map(o=>o[0])),i=va(e),a=[];for(let o of t)if(n.has(o.key)){let s=(r=ON(e,o.key))!==null&&r!==void 0?r:"";o.matches(s)||a.push([o.key,o.render()])}else i?a.push([o.key,o.render()]):o.matches(o.absentDefault)||a.push([o.key,o.render()]);return(0,Be.mergeAttrs)(e.a,a)}var Fn=(e,t)=>({key:e,matches:r=>r===t,render:()=>t,absentDefault:""}),xn=(e,t,r=!1)=>({key:e,matches:n=>n==="true"===t,render:()=>String(t),absentDefault:String(r)}),CN=(e,t,r=1)=>({key:e,matches:n=>Number(n)===t,render:()=>String(t),absentDefault:String(r)});function gf(e,t){return{n:"labels",a:[],c:[{n:"label",a:[["description",e],["languagecode",String(t)]],c:[]}]}}function RN(e){return{n:"parameters",a:[],c:Object.keys(e).map(t=>({n:(0,mf.assertXmlName)(t,"Form control parameter name"),a:[],c:[{n:`<${e[t]}`,a:[],c:[]}]}))}}function xV(e,t){var r,n;let i=e.c.find(o=>o.n==="label"&&o.a.some(s=>s[0]==="languagecode"&&s[1]===String(t))),a=i??e.c.find(o=>o.n==="label");return(n=(r=a?.a.find(o=>o[0]==="description"))===null||r===void 0?void 0:r[1])!==null&&n!==void 0?n:""}function LV(e,t,r){let n=!1,i=e.c.map(a=>a.n!=="label"||!a.a.some(s=>s[0]==="languagecode"&&s[1]===String(r))?a:(n=!0,{...a,a:a.a.map(s=>s[0]==="description"?["description",t]:s)}));return n||i.push({n:"label",a:[["description",t],["languagecode",String(r)]],c:[]}),{...e,c:i}}function vf(e,t,r){let n=e.c.findIndex(a=>a.node.n==="labels");if(n<0||xV(e.c[n].node,r)===t)return e;let i=LV(e.c[n].node,t,r);return{...e,c:e.c.map((a,o)=>o===n?{...a,node:i}:a)}}function kV(e){let t={};for(let r of e.c){let n=r.n;if(n.charAt(0)==="<"||n.charAt(0)==="#")continue;let i=r.c[0],a=i?i.n:"";a.charAt(0)==="<"&&(a=a.substring(1)),t[n]=a}return t}function MV(e,t){let r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every(i=>e[i]===t[i])}function BV(e,t){return e.a.some(r=>r[0]===t)?{...e,a:e.a.filter(r=>r[0]!==t)}:e}function UV(e,t){let r=e.c.findIndex(i=>i.node.n==="parameters");if(r<0||MV(kV(e.c[r].node),t))return e;let n=RN(t);return{...e,c:e.c.map((i,a)=>a===r?{...i,node:n}:i)}}function su(e,t,r,n){if(e.w){let o={n:e.w.n,a:e.w.a.map(s=>[s[0],s[1]]),c:(0,Be.spliceChildren)(e.w.c,r)};return(0,Be.spliceChildren)(e.c,[o])}let i=n(),a={n:t,a:[],c:r};return e.c.length===0?[...i,a]:(0,Be.spliceChildren)(e.c,[...i,a])}function $V(e,t){let r=e.tabs.map(n=>qV(n,t));return{n:"form",a:ui(e.bag,[]),c:e.tabs.length===0&&va(e.bag)?[]:su(e.bag,"tabs",r,()=>[])}}function qV(e,t){let r=[Fn("id",e.id),Fn("name",e.name),xn("expanded",e.expanded),xn("visible",e.visible,!0)],n=e.columns.map(a=>VV(a,t)),i=vf(e.bag,e.label,t);return{n:"tab",a:ui(i,r),c:su(i,"columns",n,()=>e.label?[gf(e.label,t)]:[])}}function VV(e,t){let r=e.width!==void 0?[Fn("width",e.width)]:[],n=e.sections.map(i=>GV(i,t));return{n:"column",a:ui(e.bag,r),c:su(e.bag,"sections",n,()=>[])}}function GV(e,t){let r=[Fn("id",e.id),Fn("name",e.name),xn("showlabel",e.showLabel),xn("visible",e.visible,!0),{key:"columns",matches:a=>TN(a)===e.columns,render:()=>pf(e.columns),absentDefault:pf(1)}],n=e.rows.map(a=>zV(a,t)),i=vf(e.bag,e.label,t);return{n:"section",a:ui(i,r),c:su(i,"rows",n,()=>e.label?[gf(e.label,t)]:[])}}function zV(e,t){let r=e.cells.map(n=>WV(n,t));return{n:"row",a:ui(e.bag,[]),c:va(e.bag)?r:(0,Be.assembleChildren)(e.bag,r)}}function WV(e,t){let r=e.control?e.control.showLabel:ON(e.bag,"showlabel")==="true",n=[Fn("id",e.id),xn("showlabel",r),xn("visible",e.visible,!0),CN("colspan",e.colspan),CN("rowspan",e.rowspan)],i=e.control?[HV(e.control)]:[],a;if(va(e.bag))a=[...e.control&&e.control.label?[gf(e.control.label,t)]:[],...i];else{let o=e.control?vf(e.bag,e.control.label,t):e.bag;a=(0,Be.assembleChildren)(o,i)}return{n:"cell",a:ui(e.bag,n),c:a}}function HV(e){let t=[Fn("id",e.id),{key:"classid",matches:i=>Yo(i)===e.classId,render:()=>ff(e.classId),absentDefault:""}];e.fieldName!==null&&t.push(Fn("datafieldname",e.fieldName)),t.push(xn("disabled",e.isReadOnly)),t.push(xn("isrequired",e.isRequired));let r=e.fieldName===null?BV(e.bag,"datafieldname"):e.bag,n;return va(r)?n=Object.keys(e.parameters).length>0?[RN(e.parameters)]:[]:n=(0,Be.assembleChildren)(UV(r,e.parameters),[]),{n:"control",a:ui(r,t),c:n}}var jV={make:(e,t)=>new wV.FormElementNode(e,t),setProp:(e,t,r)=>e.setProperty(t,r),addChild:(e,t)=>e.addChild(t)};function SN(e,t,r){(0,NN.installDomShim)();let n=JV(e,r),i=(0,Be.rebuildRaw)($V(n,t),jV,null);return new CV.SerializationService(t).serializeFormXmlNode(i)}function QV(e){return JSON.parse(JSON.stringify(e))}function JV(e,t){var r;let n=QV(e);n.bag||(n.bag=(0,Be.emptyBag)()),n5(n.bag),t&&KV(n,t);for(let i of(r=n.tabs)!==null&&r!==void 0?r:[])XV(i);return n}function KV(e,t){var r;let n=(r=e.entityLogicalName)!==null&&r!==void 0?r:"";FN(e,i=>{let a=i.fieldName,o=i;if(!a||o.label!==void 0&&o.classId!==void 0)return;let s=t.resolveField(n,a);s&&(o.label===void 0&&s.displayName&&(o.label=s.displayName),o.classId===void 0&&s.attributeType&&(o.classId=xN(s.attributeType)))})}function FN(e,t){var r,n,i,a,o;for(let s of(r=e.tabs)!==null&&r!==void 0?r:[])for(let l of(n=s.columns)!==null&&n!==void 0?n:[])for(let u of(i=l.sections)!==null&&i!==void 0?i:[])for(let c of(a=u.rows)!==null&&a!==void 0?a:[])for(let d of(o=c.cells)!==null&&o!==void 0?o:[])d.control&&t(d.control)}function XV(e){e.id||(e.id=Yr.Guid.NewGuid()),e.name===void 0&&(e.name=""),e.label===void 0&&(e.label=""),e.expanded===void 0&&(e.expanded=!0),e.visible===void 0&&(e.visible=!0),e.columns||(e.columns=[]);for(let t of e.columns)YV(t);e.bag||(e.bag=(0,Be.emptyBag)())}function YV(e){e.sections||(e.sections=[]);for(let t of e.sections)ZV(t);e.bag||(e.bag=(0,Be.emptyBag)()),e.width===void 0&&va(e.bag)&&(e.width="100%")}function ZV(e){e.id||(e.id=Yr.Guid.NewGuid()),e.name===void 0&&(e.name=""),e.label===void 0&&(e.label=""),e.showLabel===void 0&&(e.showLabel=!1),e.visible===void 0&&(e.visible=!0),e.columns===void 0&&(e.columns=1),e.rows||(e.rows=[]);for(let t of e.rows)e5(t);e.bag||(e.bag=(0,Be.emptyBag)())}function e5(e){e.cells||(e.cells=[]);for(let t of e.cells)t5(t);e.bag||(e.bag=(0,Be.emptyBag)())}function t5(e){e.id||(e.id=Yr.Guid.NewGuid()),e.visible===void 0&&(e.visible=!0),e.colspan===void 0&&(e.colspan=1),e.rowspan===void 0&&(e.rowspan=1),e.control===void 0&&(e.control=null),e.control&&r5(e.control),e.bag||(e.bag=(0,Be.emptyBag)())}function r5(e){var t;e.id||(e.id=Yr.Guid.NewGuid()),e.classId===void 0&&(e.classId=String(xe.ControlClassId.TextboxControl)),e.fieldName===void 0&&(e.fieldName=null),e.type===void 0&&(e.type=e.fieldName?"Field":IN(String(e.classId))),e.isRequired===void 0&&(e.isRequired=!1),e.isReadOnly===void 0&&(e.isReadOnly=!1),e.label===void 0&&(e.label=(t=e.fieldName)!==null&&t!==void 0?t:""),e.showLabel===void 0&&(e.showLabel=!0),(e.parameters===void 0||e.parameters===null)&&(e.parameters={});for(let r of Object.keys(e.parameters))(0,mf.assertXmlName)(r,"Form control parameter name");e.bag||(e.bag=(0,Be.emptyBag)())}function n5(e){for(let t of e.c){let r=t.node;if(r.n==="events"){for(let n of r.c)if(n.n==="event"){for(let i of n.c)if(i.n==="Handlers")for(let a of i.c)a.n==="Handler"&&!EN(a,"handlerUniqueId")&&a.a.push(["handlerUniqueId",ff(Yr.Guid.NewGuid())])}}else if(r.n==="formLibraries")for(let n of r.c)n.n==="Library"&&!EN(n,"libraryUniqueId")&&n.a.push(["libraryUniqueId",ff(Yr.Guid.NewGuid())])}}var au=class{constructor(t=DN.DEFAULT_LCID){this.lcid=t}toArtifact(t,r){var n,i,a;let{tabs:o,bag:s}=IV(t,this.lcid);return{id:t.formId?t.formId.guidString:"",name:(n=t.formName)!==null&&n!==void 0?n:"",entityLogicalName:(i=t.entityName)!==null&&i!==void 0?i:"",formType:(a=EV[t.formType])!==null&&a!==void 0?a:"Main",status:this.readActivationStatus(t),...r!==void 0&&r!==""?{description:r}:{},tabs:o,bag:s}}fromArtifact(t){var r;return this.deserialize({formxml:SN(t,this.lcid),formid:t.id||(0,Ko.newId)(),objecttypecode:t.entityLogicalName,type:df[t.formType],name:t.name,uniquename:t.name,description:(r=t.description)!==null&&r!==void 0?r:"",formpresentation:at.FormPresentation.AirForm,formactivationstate:t.status==="Active"?at.FormActivationState.Active:at.FormActivationState.InActive})}fromApiResponse(t){var r,n,i,a,o,s,l;let u=t,c=this.deserialize({formxml:(r=u.formxml)!==null&&r!==void 0?r:"",formid:(n=u.formid)!==null&&n!==void 0?n:(0,Ko.newId)(),objecttypecode:(i=u.objecttypecode)!==null&&i!==void 0?i:"",type:u.type,name:(a=u.name)!==null&&a!==void 0?a:"",uniquename:(o=u.uniquename)!==null&&o!==void 0?o:"",description:(s=u.description)!==null&&s!==void 0?s:"",formpresentation:u.formpresentation,formactivationstate:u.formactivationstate});return this.toArtifact(c,(l=u.description)!==null&&l!==void 0?l:void 0)}toApiPayload(t,r,n){return{formxml:SN(t,this.lcid,n),name:t.name,type:df[t.formType],objecttypecode:t.entityLogicalName,...t.description!==void 0?{description:t.description}:{}}}metadataNeeds(t){let r=t.entityLogicalName;if(!r)return[];let n=new Set,i=[];return FN(t,a=>{let o=a.fieldName,s=a;!o||s.label!==void 0&&s.classId!==void 0||n.has(o)||(n.add(o),i.push({entityLogicalName:r,fieldName:o}))}),i}createDefault(t){var r,n,i,a,o,s,l,u,c,d,p;let f=t.tabs&&t.tabs.length>0?void 0:p5(this.lcid),h=f!==void 0?f:t.tabs.map(E=>i5(E,this.lcid)).join(""),v=this.deserialize({formxml:`<form><tabs>${h}</tabs></form>`,formid:t.id||(0,Ko.newId)(),objecttypecode:(r=t.entityLogicalName)!==null&&r!==void 0?r:"",type:df[(n=t.formType)!==null&&n!==void 0?n:"Main"],name:(i=t.name)!==null&&i!==void 0?i:"New Form",uniquename:(a=t.name)!==null&&a!==void 0?a:"New Form",description:(o=t.description)!==null&&o!==void 0?o:"",formpresentation:at.FormPresentation.AirForm,formactivationstate:((s=t.status)!==null&&s!==void 0?s:"Active")==="Active"?at.FormActivationState.Active:at.FormActivationState.InActive}),w=this.toArtifact(v,t.description);return{id:(l=t.id)!==null&&l!==void 0?l:w.id,name:(u=t.name)!==null&&u!==void 0?u:"New Form",entityLogicalName:(c=t.entityLogicalName)!==null&&c!==void 0?c:"",formType:(d=t.formType)!==null&&d!==void 0?d:"Main",status:(p=t.status)!==null&&p!==void 0?p:"Active",...t.description!==void 0?{description:t.description}:{},tabs:w.tabs,bag:w.bag}}assignMissingIds(t){return(0,Ko.assignMissingIds)(t)}validate(t){return A5(t)}deserialize(t){(0,NN.installDomShim)();let r=bV.ScriptUtilities.ParseXml(t.formxml),n=new AV.DeserializationService(this.lcid).deSerializeFormXml(r,new Yr.Guid(t.formid),t.objecttypecode,at.FormState.Draft,t.name,t.uniquename,t.type,t.formpresentation,t.description,t.formactivationstate);if(!n)throw new Error("FormXml could not be deserialized into a Form model.");return n}readActivationStatus(t){return t.formactivationstate===at.FormActivationState.InActive?"Inactive":"Active"}};Pt.FormAdapter=au;function lr(e){return String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function yf(e,t){return e?`<labels><label description="${lr(e)}" languagecode="${t}" /></labels>`:""}function bf(e){return e&&e.length>0?Yo(e):(0,Ko.newId)()}function i5(e,t){var r,n,i,a;let o=(r=e.columns)!==null&&r!==void 0?r:[],s=(o.length>0?o:[d5()]).map(l=>a5(l,t)).join("");return`<tab id="{${lr(bf(e.id))}}" name="${lr((n=e.name)!==null&&n!==void 0?n:"")}" expanded="${(i=e.expanded)!==null&&i!==void 0?i:!0}" visible="${(a=e.visible)!==null&&a!==void 0?a:!0}">${yf(e.label,t)}<columns>${s}</columns></tab>`}function a5(e,t){var r,n;let i=((r=e.sections)!==null&&r!==void 0?r:[]).map(a=>o5(a,t)).join("");return`<column width="${lr((n=e.width)!==null&&n!==void 0?n:"100%")}"><sections>${i}</sections></column>`}function o5(e,t){var r,n,i,a,o;let s=((r=e.rows)!==null&&r!==void 0?r:[]).map(l=>s5(l,t)).join("");return`<section id="{${lr(bf(e.id))}}" name="${lr((n=e.name)!==null&&n!==void 0?n:"")}" showlabel="${(i=e.showLabel)!==null&&i!==void 0?i:!1}" visible="${(a=e.visible)!==null&&a!==void 0?a:!0}" columns="${pf((o=e.columns)!==null&&o!==void 0?o:1)}">${yf(e.label,t)}<rows>${s}</rows></section>`}function s5(e,t){var r;return`<row>${((r=e.cells)!==null&&r!==void 0?r:[]).map(n=>l5(n,t)).join("")}</row>`}function l5(e,t){var r,n,i,a,o,s;let l=e.control,u=l?yf((n=(r=l.label)!==null&&r!==void 0?r:l.fieldName)!==null&&n!==void 0?n:"",t):"",c=l?u5(l):"";return`<cell id="{${lr(bf(e.id))}}" showlabel="${l?(i=l.showLabel)!==null&&i!==void 0?i:!0:!1}" visible="${(a=e.visible)!==null&&a!==void 0?a:!0}" colspan="${(o=e.colspan)!==null&&o!==void 0?o:1}" rowspan="${(s=e.rowspan)!==null&&s!==void 0?s:1}">${u}${c}</cell>`}function u5(e){var t,r,n;let i=e.fieldName?` datafieldname="${lr(e.fieldName)}"`:"",a=c5(e.parameters),o=e.classId?Yo(e.classId):String(xe.ControlClassId.TextboxControl);return`<control id="${lr((t=e.id)!==null&&t!==void 0?t:"")}" classid="{${lr(o)}}"${i} disabled="${(r=e.isReadOnly)!==null&&r!==void 0?r:!1}" isrequired="${(n=e.isRequired)!==null&&n!==void 0?n:!1}">${a}</control>`}function c5(e){let t=Object.keys(e??{});return t.length===0?"":(t.forEach(n=>(0,mf.assertXmlName)(n,"Form control parameter name")),`<parameters>${t.map(n=>`<${n}>${lr(e[n])}</${n}>`).join("")}</parameters>`)}function d5(){return{width:"100%",sections:[],bag:{a:[],c:[]}}}function p5(e){return`<tab id="{${Yr.Guid.NewGuid()}}" name="tab_general" expanded="true" visible="true"><labels><label description="General" languagecode="${e}" /></labels><columns><column width="100%"><sections><section id="{${Yr.Guid.NewGuid()}}" name="section_general" showlabel="false" visible="true" columns="1"><labels><label description="General" languagecode="${e}" /></labels><rows></rows></section></sections></column></columns></tab>`}function f5(e=DN.DEFAULT_LCID){return{adapter:new au(e),api:SV.formApi,languageSensitive:!0,publish:(t,r,n)=>(0,wN.publishBoundEntity)(t,n),publishScope:(t,r)=>(0,wN.boundEntityPublishScope)(r)}}Pt.formRegistration=f5;var m5=new Set(["id","name","label","expanded","visible","columns","bag"]),h5=new Set(["id","width","sections","bag"]),g5=new Set(["id","name","label","visible","showLabel","columns","rows","bag"]),v5=new Set(["id","cells","bag"]),y5=new Set(["id","visible","colspan","rowspan","control","bag"]),b5=new Set(["id","classId","fieldName","type","isRequired","isReadOnly","label","showLabel","parameters","bag"]),w5={elsewhere:{isReadOnly:"control",isRequired:"control",fieldName:"control",classId:"control",label:"control",showLabel:"control",parameters:"control"},unsupported:{createOnly:"FormXml has no create-only concept; gate the field with a business rule instead. Raise it with the SDK owners if you need it modeled.",updateOnly:"FormXml has no update-only concept; gate the field with a business rule instead. Raise it with the SDK owners if you need it modeled."}};function A5(e){let t=[];return(0,Tt.childObjects)(e,"tabs","","tab",t).forEach(({node:n,index:i})=>{let a=`/tabs/${i}`;(0,Tt.rejectUnknownKeys)(n,m5,a,"tab",t),(0,Tt.childObjects)(n,"columns",a,"column",t).forEach(({node:s,index:l})=>{let u=`${a}/columns/${l}`;(0,Tt.rejectUnknownKeys)(s,h5,u,"column",t),(0,Tt.childObjects)(s,"sections",u,"section",t).forEach(({node:d,index:p})=>{let f=`${u}/sections/${p}`;(0,Tt.rejectUnknownKeys)(d,g5,f,"section",t),(0,Tt.childObjects)(d,"rows",f,"row",t).forEach(({node:v,index:w})=>{let E=`${f}/rows/${w}`;(0,Tt.rejectUnknownKeys)(v,v5,E,"row",t),(0,Tt.childObjects)(v,"cells",E,"cell",t).forEach(({node:x,index:F})=>{let j=`${E}/cells/${F}`;(0,Tt.rejectUnknownKeys)(x,y5,j,"cell",t,w5);let L=x.control;L!=null&&!(0,Tt.isJsonObject)(L)?t.push((0,Tt.issue)(`${j}/control`,"control-must-be-object-or-null",`a cell control must be a JSON object or null, got ${typeof L}`)):(0,Tt.isJsonObject)(L)&&(0,Tt.rejectUnknownKeys)(L,b5,`${j}/control`,"control",t)})})})})}),t}Pt.SUBGRID_CLASS_ID=xe.ControlClassId.SubgridControl;Pt.NOTES_CLASS_ID=xe.ControlClassId.TimelineControl;Pt.QUICK_VIEW_CLASS_ID=xe.ControlClassId.QuickViewControl;var C5={Lookup:String(xe.ControlClassId.LookupControl),Customer:String(xe.ControlClassId.LookupControl),Owner:String(xe.ControlClassId.LookupControl),PartyList:String(xe.ControlClassId.PartyListControl),Boolean:String(xe.ControlClassId.BooleanControl),DateTime:String(xe.ControlClassId.DateTimeControl),Decimal:String(xe.ControlClassId.DecimalControl),Double:String(xe.ControlClassId.FloatingNumberControl),Money:String(xe.ControlClassId.CurrencyControl),Integer:String(xe.ControlClassId.IntegerControl),BigInt:String(xe.ControlClassId.IntegerControl),Memo:String(xe.ControlClassId.TextAreaControl),String:String(xe.ControlClassId.TextboxControl)},S5="3EF39988-22BB-4F0B-BBBE-64B5A3748AEE";function xN(e){return e==="Picklist"||e==="State"||e==="Status"?S5:e&&C5[e]||String(xe.ControlClassId.TextboxControl)}Pt.classIdForAttributeType=xN;function EN(e,t){let r=e.a.find(n=>n[0]===t);return r?r[1]:void 0}});var wf=g(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});ya.viewApi=ya.findDefaultViews=void 0;var MN=er(),Wt=be(),Zr=ie(),E5="savedqueryid,name,description,fetchxml,layoutxml,querytype,returnedtypecode,isdefault",N5="savedqueryid,name,returnedtypecode,querytype,isdefault";async function D5(e,t,r={}){var n;let i=new Set(((n=r.excludeViewIds)!==null&&n!==void 0?n:[]).filter(Boolean)),a=`returnedtypecode eq '${(0,Zr.odataLiteral)(t)}' and querytype eq 0`,o=`/savedqueries${(0,Zr.odataQuery)([["$select","savedqueryid,name,isdefault"],["$filter",a]])}`;return(await(0,MN.collectPages)(e,o,`findDefaultViews('${t}')`)).filter(l=>{var u;return l.savedqueryid&&!i.has(l.savedqueryid)&&(l.isdefault||/^(Active|Inactive)\b/i.test((u=l.name)!==null&&u!==void 0?u:""))}).map(l=>{var u;return{id:String(l.savedqueryid),name:String((u=l.name)!==null&&u!==void 0?u:"")}})}ya.findDefaultViews=D5;async function I5(e,t){var r;let n=`/EntityDefinitions(LogicalName='${(0,Zr.odataLiteral)(t)}')${(0,Zr.odataQuery)([["$select","ObjectTypeCode"]])}`,i=await e.get(n);if(i.status>=200&&i.status<300){let a=(r=i.body)===null||r===void 0?void 0:r.ObjectTypeCode;return typeof a=="number"?a:void 0}}async function kN(e,t,r){if(!r||!/<grid\b/.test(t)||/<grid[^>]*\bobject=/.test(t))return t;let n=await I5(e,r);return n===void 0?t:t.replace(/<grid\b/,`<grid object="${n}"`)}ya.viewApi={async get(e,t){let n=`/savedqueries(${(0,Zr.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Zr.odataQuery)([["$select",E5]]),i=(0,Wt.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,Wt.readEtag)(i)}},async list(e,t){let r=`/savedqueries${(0,Zr.odataQuery)([["$select",N5],["$filter",t?.entityLogicalName?`returnedtypecode eq '${(0,Zr.odataLiteral)(t.entityLogicalName)}'`:void 0]])}`;return(await(0,MN.collectPages)(e,r,"listArtifacts('view')")).map(i=>{var a,o;return{type:"view",id:(a=i.savedqueryid)!==null&&a!==void 0?a:"",name:(o=i.name)!==null&&o!==void 0?o:"",entityLogicalName:i.returnedtypecode,isDirty:!1}})},async create(e,t,r){let n=t,i=(0,Wt.echoWrite)("savedqueryid"),a=`/savedqueries${i.query}`,o=await kN(e,n.layoutxml,n.returnedtypecode),s=(0,Wt.ensureSuccess)(await e.post(a,(0,Wt.withClientMintedId)({name:n.name,description:n.description,fetchxml:n.fetchxml,layoutxml:o,returnedtypecode:n.returnedtypecode,querytype:n.querytype,isdefault:n.isdefault},"savedqueryid",r),i.options),e.apiUrl(a));return{id:(0,Wt.resolveCreatedId)(s,"savedqueryid","view",r),etag:(0,Wt.readEtag)(s)}},async update(e,t,r,n){let i=r,a=(0,Zr.normalizeGuid)(t,"id"),o=(0,Wt.echoWrite)("savedqueryid",{"If-Match":(0,Wt.requireEtag)(n,"view",a)}),s=`/savedqueries(${a})${o.query}`,l=await kN(e,i.layoutxml,i.returnedtypecode),u=(0,Wt.ensureSuccess)(await e.patch(s,{name:i.name,description:i.description,fetchxml:i.fetchxml,layoutxml:l},o.options),e.apiUrl(s));return{id:a,etag:(0,Wt.readEtag)(u)}},delete(e,t){return(0,Wt.deleteRecord)(e,"savedqueries",t)}}});var XN=g(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});wa.viewRegistration=wa.ViewAdapter=void 0;var ba=Ir(),Af=yn(),ci=Hn(),BN=rr(),_5=wf(),Cf=Rn(),T5=ct(),zN=100,uu=class{toArtifact(t){var r,n,i,a,o,s,l,u;(0,Cf.installDomShim)();let c=(r=t.fetchxml)!==null&&r!==void 0?r:"",d=(n=t.layoutxml)!==null&&n!==void 0?n:"",p=(0,ci.parseXmlRoot)(c,"<fetch/>"),f=(0,ci.parseXmlRoot)(d,"<grid/>"),h=QN(p);return{id:(i=t.savedqueryid)!==null&&i!==void 0?i:"",name:(a=t.name)!==null&&a!==void 0?a:"",description:(o=t.description)!==null&&o!==void 0?o:"",entityLogicalName:(s=t.returnedtypecode)!==null&&s!==void 0?s:P5(p),queryType:(l=t.querytype)!==null&&l!==void 0?l:0,isDefault:(u=t.isdefault)!==null&&u!==void 0?u:!1,columns:HN(f,p),filters:KN(p),sort:JN(p),...h.length>0?{linkEntities:h}:{},fetchBag:c?(0,ci.projectElementBag)(p):void 0,layoutBag:d?(0,ci.projectElementBag)(f):void 0}}fromArtifact(t){(0,Cf.installDomShim)();let{fetchxml:r,layoutxml:n}=UN(t);return{savedqueryid:t.id,name:t.name,description:t.description,returnedtypecode:t.entityLogicalName,querytype:t.queryType,isdefault:t.isDefault,fetchxml:r,layoutxml:n}}fromApiResponse(t){return this.toArtifact(t??{})}toApiPayload(t){var r,n,i,a,o;(0,Cf.installDomShim)();let{fetchxml:s,layoutxml:l}=UN(t);return{name:(r=t.name)!==null&&r!==void 0?r:"",description:(n=t.description)!==null&&n!==void 0?n:"",fetchxml:s,layoutxml:l,returnedtypecode:(i=t.entityLogicalName)!==null&&i!==void 0?i:"",querytype:(a=t.queryType)!==null&&a!==void 0?a:0,isdefault:(o=t.isDefault)!==null&&o!==void 0?o:!1}}createDefault(t){var r,n,i,a,o,s,l,u;let c=(r=t.entityLogicalName)!==null&&r!==void 0?r:"";return{id:(n=t.id)!==null&&n!==void 0?n:(0,T5.newId)(),name:(i=t.name)!==null&&i!==void 0?i:"New View",description:(a=t.description)!==null&&a!==void 0?a:"",entityLogicalName:c,queryType:(o=t.queryType)!==null&&o!==void 0?o:0,isDefault:(s=t.isDefault)!==null&&s!==void 0?s:!1,columns:t.columns&&t.columns.length>0?t.columns:[{name:`${c}id`,width:300,order:0}],filters:(l=t.filters)!==null&&l!==void 0?l:{type:"and",conditions:[],groups:[]},sort:(u=t.sort)!==null&&u!==void 0?u:[],...t.linkEntities&&t.linkEntities.length>0?{linkEntities:t.linkEntities}:{}}}assignMissingIds(t){return t}validate(t){let r=[],n=t;(0,ba.childObjects)(n,"columns","","column",r),(0,ba.childObjects)(n,"sort","","sort",r);let i=n.filters;return i!=null&&((0,ba.isJsonObject)(i)?WN(i,"/filters",r):r.push((0,ba.issue)("/filters","filters-must-be-object",`filters must be a JSON object, got ${typeof i}`))),r}};wa.ViewAdapter=uu;function WN(e,t,r){(0,ba.childObjects)(e,"conditions",t,"condition",r),(0,ba.childObjects)(e,"groups",t,"filterGroup",r).forEach(({node:i,index:a})=>WN(i,`${t}/groups/${a}`,r))}function P5(e){var t;let r=e.getElementsByTagName("entity")[0];return(t=r?.getAttribute("name"))!==null&&t!==void 0?t:""}function HN(e,t){var r;let n=jN(t),i=e.getElementsByTagName("cell"),a=[],o=0;for(let s=0;s<i.length;s+=1){let l=i[s];if(l.getAttribute("ishidden")==="1")continue;let u=l.getAttribute("name");if(!u)continue;let c=parseInt((r=l.getAttribute("width"))!==null&&r!==void 0?r:"",10),d={name:u,width:Number.isNaN(c)?zN:c,order:o},p=n.get(u);p&&(d.relatedEntity=p),o+=1,a.push(d)}return a}function jN(e){let t=new Map,r=e.getElementsByTagName("link-entity");for(let n=0;n<r.length;n+=1){let i=r[n],a=i.getAttribute("name");if(!a)continue;let o=i.getElementsByTagName("attribute");for(let s=0;s<o.length;s+=1){let l=o[s],u=l.getAttribute("alias")||l.getAttribute("name");u&&t.set(u,a)}}return t}function QN(e){let t=e.getElementsByTagName("entity")[0];if(!t)return[];let r=[];for(let n of ot(t,"link-entity")){let i=n.getAttribute("name"),a=n.getAttribute("from"),o=n.getAttribute("to");if(!i||!a||!o)continue;let s=n.getAttribute("alias"),l=n.getAttribute("link-type"),u=ot(n,"filter")[0];r.push({name:i,from:a,to:o,...s?{alias:s}:{},...l==="inner"||l==="outer"?{linkType:l}:{},...u?{filters:Ef(u)}:{}})}return r}function JN(e){var t;let r=e.getElementsByTagName("entity")[0];if(!r)return[];let n=[],i=r.childNodes;for(let a=0;a<i.length;a+=1){let o=i[a];if(o.nodeType===1&&o.tagName==="order"){let s=o.getAttribute("attribute");s&&n.push({attribute:s,descending:((t=o.getAttribute("descending"))!==null&&t!==void 0?t:"").toLowerCase()==="true"})}}return n}function KN(e){let t=e.getElementsByTagName("entity")[0],r={type:"and",conditions:[],groups:[]};if(!t)return r;let n=ot(t,"filter").filter(i=>!Sf(i)).map(Ef);return n.length===0?r:n.length===1?n[0]:{type:"and",conditions:[],groups:n}}function Sf(e){if(ot(e,"filter").length>0)return!1;let t=ot(e,"condition");return t.length===0?!1:t.some(r=>r.getAttribute("isquickfindfields")==="1"||ot(r,"value").length>0)}function Ef(e){var t,r;let n=((t=e.getAttribute("type"))!==null&&t!==void 0?t:"and").toLowerCase()==="or"?"or":"and",i=[],a=[],o=e.childNodes;for(let s=0;s<o.length;s+=1){let l=o[s];if(l.nodeType===1)if(l.tagName==="condition"){if(l.getAttribute("isquickfindfields")==="1")continue;let u=l.getAttribute("attribute");if(!u)continue;let c={attribute:u,operator:(r=l.getAttribute("operator"))!==null&&r!==void 0?r:""},d=l.getAttribute("value");d!==null&&(c.value=d),i.push(c)}else l.tagName==="filter"&&a.push(Ef(l))}return{type:n,conditions:i,groups:a}}function ot(e,t){let r=[],n=e.childNodes;for(let i=0;i<n.length;i+=1){let a=n[i];a.nodeType===1&&a.tagName===t&&r.push(a)}return r}function UN(e){var t;let r=O5(e.columns);if(!$N(e.fetchBag)||!$N(e.layoutBag))return{fetchxml:q5({...e,columns:r}),layoutxml:V5({...e,columns:r},`${e.entityLogicalName}id`)};let n=new DOMParser().parseFromString("<root/>","text/xml"),i=qN(e.fetchBag,"fetch",n),a=qN(e.layoutBag,"grid",n),o=HN(a,i),s=!lu(r,o),l=!lu(e.sort,JN(i)),u=!lu(e.filters,KN(i)),c=(t=e.linkEntities)!==null&&t!==void 0?t:[],d=!lu(c,QN(i));return d&&$5(n,i,c),s?(VN(n,i,r,o),L5(n,a,r)):d&&VN(n,i,r,o),l&&B5(n,i,e.sort),u&&U5(n,i,e.filters),{fetchxml:(0,ci.serializeNode)(i),layoutxml:(0,ci.serializeNode)(a)}}function O5(e){return(e??[]).map((t,r)=>{var n,i;return{name:String(t.name).toLowerCase(),width:(n=t.width)!==null&&n!==void 0?n:zN,order:(i=t.order)!==null&&i!==void 0?i:r,...t.relatedEntity?{relatedEntity:t.relatedEntity}:{}}})}function $N(e){return!!e&&(e.c.length>0||e.a.length>0)}function qN(e,t,r){let n={n:t,a:(0,Af.mergeAttrs)(e.a,[]),c:(0,Af.spliceChildren)(e.c,[])};return(0,Af.rebuildRaw)(n,(0,ci.domEngine)(r),null)}function VN(e,t,r,n){var i;let a=t.getElementsByTagName("entity")[0];if(!a)return;let o=new Set(r.map(u=>{var c;return`${(c=u.relatedEntity)!==null&&c!==void 0?c:""}:${u.name}`}));for(let u of n)o.has(`${(i=u.relatedEntity)!==null&&i!==void 0?i:""}:${u.name}`)||R5(a,u);let s=jN(t),l=new Set(ot(a,"attribute").map(u=>u.getAttribute("name")).filter(u=>!!u));for(let u of[...r].sort((c,d)=>c.order-d.order))if(u.relatedEntity){if(s.get(u.name)===u.relatedEntity)continue;let c=F5(e,a,u.relatedEntity),d=e.createElement("attribute");d.setAttribute("name",u.name),c.appendChild(d),s.set(u.name,u.relatedEntity)}else{if(l.has(u.name))continue;let c=e.createElement("attribute");c.setAttribute("name",u.name),x5(a,c),l.add(u.name)}}function R5(e,t){if(t.relatedEntity){for(let r of ot(e,"link-entity"))if(!(r.getAttribute("alias")!==t.relatedEntity&&r.getAttribute("name")!==t.relatedEntity)){for(let n of ot(r,"attribute"))if((n.getAttribute("alias")||n.getAttribute("name"))===t.name){r.removeChild(n);return}}return}for(let r of ot(e,"attribute"))if(r.getAttribute("name")===t.name){e.removeChild(r);return}}function F5(e,t,r){for(let i of ot(t,"link-entity"))if(i.getAttribute("alias")===r||i.getAttribute("name")===r)return i;let n=e.createElement("link-entity");return n.setAttribute("name",r),t.appendChild(n),n}function x5(e,t){let r=e.childNodes;for(let n=0;n<r.length;n+=1){let i=r[n];if(i.nodeType===1&&i.tagName!=="attribute"){e.insertBefore(t,i);return}}e.appendChild(t)}function L5(e,t,r){let n=t.getElementsByTagName("row")[0];if(!n)return;let i=[...r].sort((s,l)=>s.order-l.order),a=k5(n);if(M5(a,i)){for(let s=0;s<i.length;s+=1){let l=String(i[s].width);a[s].getAttribute("width")!==l&&a[s].setAttribute("width",l)}return}let o=new Map;for(let s of a){let l=s.getAttribute("name");l&&o.set(l,s),n.removeChild(s)}for(let s of i){let l=o.get(s.name);l||(l=e.createElement("cell"),l.setAttribute("name",s.name)),l.setAttribute("width",String(s.width)),n.appendChild(l)}}function k5(e){return ot(e,"cell").filter(t=>!!t.getAttribute("name")&&t.getAttribute("ishidden")!=="1")}function M5(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r+=1)if(e[r].getAttribute("name")!==t[r].name)return!1;return!0}function B5(e,t,r){let n=t.getElementsByTagName("entity")[0];if(n){for(let i of ot(n,"order"))n.removeChild(i);for(let i of r){let a=e.createElement("order");a.setAttribute("attribute",i.attribute),a.setAttribute("descending",String(i.descending)),n.appendChild(a)}}}function U5(e,t,r){let n=t.getElementsByTagName("entity")[0];if(n){for(let i of ot(n,"filter"))Sf(i)||n.removeChild(i);(r.conditions.length>0||r.groups.length>0)&&n.appendChild(Zo(e,r))}}function lu(e,t){return JSON.stringify(e)===JSON.stringify(t)}function $5(e,t,r){let n=t.getElementsByTagName("entity")[0];if(!n)return;let i=new Map(r.map(o=>[o.alias||o.name,o])),a=new Set;for(let o of ot(n,"link-entity")){if(!o.getAttribute("name")||!o.getAttribute("from")||!o.getAttribute("to"))continue;let s=o.getAttribute("alias")||o.getAttribute("name")||"",l=i.get(s);if(!l){n.removeChild(o);continue}a.add(s),GN(e,o,l)}for(let[o,s]of i){if(a.has(o))continue;let l=e.createElement("link-entity");GN(e,l,s),n.appendChild(l)}}function GN(e,t,r){t.setAttribute("name",r.name),t.setAttribute("from",r.from),t.setAttribute("to",r.to),r.alias?t.setAttribute("alias",r.alias):t.removeAttribute("alias"),r.linkType?t.setAttribute("link-type",r.linkType):t.removeAttribute("link-type");for(let n of ot(t,"filter"))Sf(n)||t.removeChild(n);r.filters&&(r.filters.conditions.length>0||r.filters.groups.length>0)&&t.appendChild(Zo(e,r.filters))}function q5(e){var t;let r=new DOMParser().parseFromString("<fetch/>","text/xml"),n=r.documentElement;n.setAttribute("version","1.0"),n.setAttribute("mapping","logical");let i=r.createElement("entity");i.setAttribute("name",e.entityLogicalName),n.appendChild(i);let a=new Map;for(let o of(t=e.linkEntities)!==null&&t!==void 0?t:[]){let s=r.createElement("link-entity");s.setAttribute("name",o.name),s.setAttribute("from",o.from),s.setAttribute("to",o.to),o.alias&&s.setAttribute("alias",o.alias),o.linkType&&s.setAttribute("link-type",o.linkType),o.filters&&(o.filters.conditions.length>0||o.filters.groups.length>0)&&s.appendChild(Zo(r,o.filters)),i.appendChild(s),a.set(o.alias||o.name,s),a.set(o.name,s)}for(let o of[...e.columns].sort((s,l)=>s.order-l.order)){let s=r.createElement("attribute");if(s.setAttribute("name",o.name),o.relatedEntity){let l=a.get(o.relatedEntity);l||(l=r.createElement("link-entity"),l.setAttribute("name",o.relatedEntity),i.appendChild(l),a.set(o.relatedEntity,l)),l.appendChild(s)}else i.appendChild(s)}for(let o of e.sort){let s=r.createElement("order");s.setAttribute("attribute",o.attribute),s.setAttribute("descending",String(o.descending)),i.appendChild(s)}return(e.filters.conditions.length>0||e.filters.groups.length>0)&&i.appendChild(Zo(r,e.filters)),new XMLSerializer().serializeToString(r)}function Zo(e,t){let r=e.createElement("filter");r.setAttribute("type",t.type);for(let n of t.conditions){let i=e.createElement("condition");i.setAttribute("attribute",n.attribute),i.setAttribute("operator",n.operator),n.value!==void 0&&i.setAttribute("value",n.value),r.appendChild(i)}for(let n of t.groups)r.appendChild(Zo(e,n));return r}function V5(e,t){var r;let n=new DOMParser().parseFromString("<grid/>","text/xml"),i=n.documentElement,a=[...e.columns].sort((s,l)=>s.order-l.order);i.setAttribute("name","resultset"),i.setAttribute("jump",((r=a[0])===null||r===void 0?void 0:r.name)||t||`${e.entityLogicalName}id`),i.setAttribute("select","1"),i.setAttribute("icon","1"),i.setAttribute("preview","1");let o=n.createElement("row");o.setAttribute("name","result"),o.setAttribute("id",t||`${e.entityLogicalName}id`),i.appendChild(o);for(let s of a){let l=n.createElement("cell");l.setAttribute("name",s.name),l.setAttribute("width",String(s.width)),o.appendChild(l)}return new XMLSerializer().serializeToString(n)}function G5(){return{adapter:new uu,api:_5.viewApi,publish:(e,t,r)=>(0,BN.publishBoundEntity)(e,r),publishScope:(e,t)=>(0,BN.boundEntityPublishScope)(t)}}wa.viewRegistration=G5});function cu(e,t){return e==="SetFieldValue"&&t!==void 0&&z5.has(t.attributeType)&&(t.requiredLevel==="None"||t.requiredLevel==="Recommended")}var z5,Nf=I(()=>{"use strict";z5=new Set(["Integer","Double","Decimal","Money","String","Memo","DateTime","Picklist","Lookup"])});function YN(e){return e!=="Entity"&&e!=="AllForms"&&typeof e=="string"&&e.trim()!==""}function Df(e){return YN(e)?1:2}function If(e){return YN(e)?e:void 0}function ZN(e,t){let r=If(e.scope);return{"@odata.type":"#Microsoft.Dynamics.CRM.workflow",name:e.name,description:e.description,workflowid:t,ondemand:!1,subprocess:!1,triggeroncreate:!1,triggerondelete:!1,category:Aa.WorkflowCategory.BusinessRule,type:Aa.WorkflowTypeCode.Definition,mode:1,scope:Aa.WorkflowScope.Organization,primaryentity:e.entityLogicalName,iscrmuiworkflow:!0,processtriggerscope:Df(e.scope),...r!==void 0?{processtriggerformid:r}:{}}}var Aa,eD=I(()=>{"use strict";Aa=re(Gn());});function tD(e,t=0){return(Ze[e[t+0]]+Ze[e[t+1]]+Ze[e[t+2]]+Ze[e[t+3]]+"-"+Ze[e[t+4]]+Ze[e[t+5]]+"-"+Ze[e[t+6]]+Ze[e[t+7]]+"-"+Ze[e[t+8]]+Ze[e[t+9]]+"-"+Ze[e[t+10]]+Ze[e[t+11]]+Ze[e[t+12]]+Ze[e[t+13]]+Ze[e[t+14]]+Ze[e[t+15]]).toLowerCase()}var Ze,rD=I(()=>{Ze=[];for(let e=0;e<256;++e)Ze.push((e+256).toString(16).slice(1))});function _f(){return du>pu.length-16&&((0,nD.randomFillSync)(pu),du=0),pu.slice(du,du+=16)}var nD,pu,du,iD=I(()=>{nD=require("crypto"),pu=new Uint8Array(256),du=pu.length});var aD,Tf,oD=I(()=>{aD=require("crypto"),Tf={randomUUID:aD.randomUUID}});function W5(e,t,r){if(Tf.randomUUID&&!t&&!e)return Tf.randomUUID();e=e||{};let n=e.random??e.rng?.()??_f();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return tD(n)}var mt,sD=I(()=>{oD();iD();rD();mt=W5});var Pf=I(()=>{sD()});var lD=I(()=>{"use strict";});var Of=g(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.WorkflowConditionOperator=Ht.WorkflowAttributeType=Ht.SystemStep=Ht.FieldRequiredLevelTypes=Ht.AttributeDateTimeBehavior=void 0;Ht.AttributeDateTimeBehavior={None:0,Dynamic:1,DateOnly:2,StaticTimeZoneInvariant:3,UserLocal:4};Ht.FieldRequiredLevelTypes={None:"0",Required:"1",Recommended:"2"};Ht.SystemStep={IdentifyContact:"IdentifyContact",IdentifyAccount:"IdentifyAccount",IdentifyCustomer:"IdentifyCustomer",IdentifyCase:"IdentifyCase",Solution:"Solution",Resolve:"Resolve"};Ht.WorkflowAttributeType={Boolean:"0",Customer:"1",DateTime:"2",Decimal:"3",Float:"4",Integer:"5",Lookup:"6",Money:"7",Owner:"8",PartyList:"9",Picklist:"10",Key:"11",State:"12",Status:"13",String:"14",UniqueIdentifier:"15",EntityNameReference:"16",Entity:"17",EntityCollection:"18",BpfProcess:"19",BpfStageCategory:"20",BpfStage:"21",EntityReferenceCollection:"22",MultiSelectPicklist:"23",BigType:"24"};Ht.WorkflowConditionOperator={IsNull:"0",NotNull:"1",LogicalAnd:"2",LogicalOr:"3",IN:"4",NotIn:"5",NotInNull:"51",Equal:"6",NotEqual:"7",Contains:"8",DoesNotContain:"9",BeginsWith:"10",DoesNotBeginWith:"11",EndsWith:"12",DoesNotEndWith:"13",GreaterThan:"14",GreaterThanOrEqual:"15",LessThan:"16",LessThanOrEqual:"17",EqualUserId:"18",NotEqualUserId:"19",On:"20",NotOn:"21",OnOrAfter:"22",OnOrBefore:"23",Yesterday:"24",Today:"25",Tomorrow:"26",NextSevenDays:"27",LastSevenDays:"28",NextWeek:"29",LastWeek:"30",ThisWeek:"31",NextMonth:"32",LastMonth:"33",ThisMonth:"34",NextYear:"35",LastYear:"36",ThisYear:"37",Anytime:"38",LastXHours:"39",NextXHours:"40",LastXDays:"41",NextXDays:"42",LastXWeeks:"43",NextXWeeks:"44",LastXMonths:"45",NextXMonths:"46",LastXYears:"47",NextXYears:"48",Under:"49",NotUnder:"50"}});function pD(e){switch(e){case"Boolean":return ye.WorkflowAttributeType.Boolean;case"Customer":return ye.WorkflowAttributeType.Customer;case"DateTime":return ye.WorkflowAttributeType.DateTime;case"Decimal":return ye.WorkflowAttributeType.Decimal;case"Double":return ye.WorkflowAttributeType.Float;case"Integer":return ye.WorkflowAttributeType.Integer;case"Lookup":return ye.WorkflowAttributeType.Lookup;case"Money":return ye.WorkflowAttributeType.Money;case"Owner":return ye.WorkflowAttributeType.Owner;case"Picklist":return ye.WorkflowAttributeType.Picklist;case"State":return ye.WorkflowAttributeType.State;case"Status":return ye.WorkflowAttributeType.Status;case"Uniqueidentifier":case"UniqueIdentifier":return ye.WorkflowAttributeType.UniqueIdentifier;case"BigInt":return ye.WorkflowAttributeType.BigType;default:return ye.WorkflowAttributeType.String}}function bD(e){return e&&e!==ye.WorkflowAttributeType.String?e:void 0}function Q5(e){return{__class:yD,parameterName:"primaryEntity",entityName:e}}function uD(e){return{__class:Ff,type:Rf,typeSet:!1,behavior:ye.AttributeDateTimeBehavior.None,method:fD,parameters:[e]}}function cD(e,t,r=ye.WorkflowAttributeType.String){return{__class:hD,type:r,behavior:ye.AttributeDateTimeBehavior.None,typeSet:!1,entity:Q5(t),attributeName:e}}function J5(e,t=ye.WorkflowAttributeType.String){return{__class:gD,type:t,behavior:ye.AttributeDateTimeBehavior.None,typeSet:!1,primitiveValue:e}}function K5(e){return{__class:vD,type:Rf,typeSet:!1,behavior:ye.AttributeDateTimeBehavior.None,days:e,hours:"0",minutes:"0",months:"0",years:"0"}}function wD(e,t){let r=H5[e.operator],n=uD(cD(e.leftField,t,e.leftWorkflowType)),i;e.dateArithmetic?i=K5(e.right.value??"0"):e.right.kind==="field"?i=cD(e.right.field??"",t,e.right.workflowType):i=J5(e.right.value??"",e.right.workflowType??e.leftWorkflowType);let a=uD(i);return{__class:Ff,type:Rf,typeSet:!1,behavior:ye.AttributeDateTimeBehavior.None,method:mD,parameters:[r,n,a]}}function AD(e){return typeof e=="object"&&e.__class===Ff}function X5(e){return typeof e=="object"&&e.__class===vD}function fu(e){return AD(e)&&e.method===fD&&e.parameters.length>0?fu(e.parameters[0]):e}function dD(e){if(typeof e!="object"||e.__class!==hD)return null;let t=e.entity;if(t&&t.__class&&t.__class!==yD)return null;let r=e.attributeName;return r?{field:r,workflowType:bD(e.type)}:null}function CD(e){if(!e)return null;let t=fu(e);if(!AD(t)||t.method!==mD||t.parameters.length!==3)return null;let r=t.parameters[0],n=j5[String(r)];if(!n)return null;let i=dD(fu(t.parameters[1]));if(!i)return null;let a=fu(t.parameters[2]);if(X5(a))return n!=="+"&&n!=="-"?null:{leftField:i.field,leftWorkflowType:i.workflowType,operator:n,right:{kind:"value",value:String(a.days??"")},dateArithmetic:!0};let o=dD(a);if(o)return{leftField:i.field,leftWorkflowType:i.workflowType,operator:n,right:{kind:"field",field:o.field,workflowType:o.workflowType}};if(typeof a=="object"&&a.__class===gD){let s=a.primitiveValue;return{leftField:i.field,leftWorkflowType:i.workflowType,operator:n,right:{kind:"value",value:s!=null?String(s):"",workflowType:bD(a.type)}}}return null}function Lf(e){let t=(e??"").trim();if(!/^\d+$/.test(t))return!1;let r=Number(t);return Number.isSafeInteger(r)&&r>=xf&&r<=Ca}function di(e){if(!e||!e.leftField)return"incomplete";if(e.right.kind==="field")return e.right.field&&e.right.field.trim()?null:"incomplete";let t=e.right.value;return!t||!t.trim()?"incomplete":e.dateArithmetic&&!Lf(t)?"invalidDayCount":null}function Sa(e){return di(e)===null}var ye,fD,mD,Rf,hD,gD,Ff,vD,yD,H5,j5,xf,Ca,es=I(()=>{"use strict";ye=re(Of());fD="0",mD="3",Rf="0",hD="EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions",gD="PrimitiveExpression:#Microsoft.Crm.Workflow.Expressions",Ff="MethodCallExpression:#Microsoft.Crm.Workflow.Expressions",vD="TimeSpanExpression:#Microsoft.Crm.Workflow.Expressions",yD="PrimaryEntity:#Microsoft.Crm.Workflow.Expressions";H5={"+":0,"-":1,"*":2,"/":3},j5={0:"+",1:"-",2:"*",3:"/"};xf=0,Ca=2147483647});function SD(e){return e.__class==="BinaryExpression:#Microsoft.Crm.Workflow.Expressions"}function Y5(e){return e.__class==="ConditionBranchStep:#Microsoft.Crm.Workflow.ObjectModel"}function ts(){return{list:[]}}function ED(e,t,r){return e&&e.list.length>0?{list:[{...e.list[0],description:t},...e.list.slice(1)]}:{list:[{labelId:mt(),languageCode:r,description:t}]}}function Uf(e){return{__class:"PrimaryEntity:#Microsoft.Crm.Workflow.Expressions",parameterName:"primaryEntity",entityName:e}}function $f(e,t,r){return{__class:"EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions",type:r,behavior:G.AttributeDateTimeBehavior.None,typeSet:!1,entity:Uf(t),attributeName:e}}function rs(e,t){return{__class:"PrimitiveExpression:#Microsoft.Crm.Workflow.Expressions",type:t,behavior:G.AttributeDateTimeBehavior.None,typeSet:!1,primitiveValue:e}}function OD(e){return{__class:"LookupExpression:#Microsoft.Crm.Workflow.Expressions",type:e.workflowType??G.WorkflowAttributeType.Lookup,behavior:G.AttributeDateTimeBehavior.None,typeSet:!1,entityType:e.entityType,label:e.label??"",staticValue:rs(e.id.replace(/[{}]/g,""),G.WorkflowAttributeType.UniqueIdentifier)}}function ND(e,t){let r=e.valueType==="Lookup"?e.lookupValue?.workflowType??G.WorkflowAttributeType.Lookup:e.valueWorkflowType??G.WorkflowAttributeType.String,n=Bf[e.operator]??G.WorkflowConditionOperator.Equal,i=$f(e.field,t,r),a;if(e.operator==="ContainsData"||e.operator==="DoesNotContainData")a=[];else if(e.valueType==="Field"&&e.valueField)a=[$f(e.valueField,t,r)];else if(e.valueType==="Lookup"){if(!e.lookupValue)throw new Error("Lookup condition is missing its record value.");a=[OD(e.lookupValue)]}else e.valueType==="Clear"?a=[rs(null,r)]:e.valueType==="Expression"?a=[hu(e.valueType,e.value,e.valueField,t,e.expression,e.rawExpression)]:a=[rs(e.value??"",r)];return{__class:"BinaryExpression:#Microsoft.Crm.Workflow.Expressions",type:G.WorkflowAttributeType.Boolean,behavior:G.AttributeDateTimeBehavior.None,typeSet:!1,conditionOperatoroperator:n,left:i,right:a}}function Z5(e,t,r){if(e.length===0)return null;if(e.length===1)return ND(e[0],r);let n=t==="AND"?G.WorkflowConditionOperator.LogicalAnd:G.WorkflowConditionOperator.LogicalOr,[i,...a]=e.map(o=>ND(o,r));return{__class:"BinaryExpression:#Microsoft.Crm.Workflow.Expressions",type:G.WorkflowAttributeType.Boolean,behavior:G.AttributeDateTimeBehavior.None,typeSet:!1,conditionOperatoroperator:n,left:i,right:a}}function mu(e){if(!e)return{valueType:"Value",value:""};if(e.__class==="EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions")return{valueType:"Field",valueField:e.attributeName};if(e.__class==="PrimitiveExpression:#Microsoft.Crm.Workflow.Expressions")return e.primitiveValue==null?{valueType:"Clear",valueWorkflowType:e.type}:{valueType:"Value",value:e.primitiveValue!=null?String(e.primitiveValue):""};if(e.__class==="LookupExpression:#Microsoft.Crm.Workflow.Expressions"){let t=e.staticValue,r=typeof t=="object"&&t?.__class==="PrimitiveExpression:#Microsoft.Crm.Workflow.Expressions"?t.primitiveValue:t;return{valueType:"Lookup",lookupValue:{entityType:e.entityType,id:String(r??""),label:e.label,...e.type!==G.WorkflowAttributeType.Lookup?{workflowType:e.type}:{}}}}if(e.__class==="MethodCallExpression:#Microsoft.Crm.Workflow.Expressions"){let t=CD(e);return t?{valueType:"Expression",expression:t}:{valueType:"Expression",rawExpression:e}}return{valueType:"Value",value:""}}function kf(e){let t=PD[e.conditionOperatoroperator]??"Equals",r=e.left,n=r.__class==="EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions",i=n?r.attributeName:"",a=n?r.type:void 0,s=t==="ContainsData"||t==="DoesNotContainData"?{valueType:"Value"}:mu(e.right[0]),l=s.valueWorkflowType??a;return{id:mt(),field:i,fieldDisplayName:i,operator:t,...s,...l?{valueWorkflowType:l}:{}}}function DD(e){if(!e||e.__class!=="BinaryExpression:#Microsoft.Crm.Workflow.Expressions")return{clauses:[],logic:"AND"};let t=e.conditionOperatoroperator;if(t===G.WorkflowConditionOperator.LogicalAnd||t===G.WorkflowConditionOperator.LogicalOr){let r=t===G.WorkflowConditionOperator.LogicalAnd?"AND":"OR";return{clauses:[...SD(e.left)?[kf(e.left)]:[],...e.right.filter(SD).map(kf)],logic:r}}return{clauses:[kf(e)],logic:"AND"}}function hu(e,t,r,n,i,a,o,s){if(e==="Field"&&r)return $f(r,n,G.WorkflowAttributeType.String);if(e==="Expression"){if(i)return wD(i,n);if(a!=null)return a}return e==="Lookup"&&o?OD(o):e==="Clear"?rs(null,s??G.WorkflowAttributeType.String):rs(t??"",G.WorkflowAttributeType.String)}function Mf(e,t){return{propertyName:e,propertyValueExpr:t}}function Ea(e){return`Step_${e.value++}`}function jt(e,t){let r=(t.counts[e]??0)+1,n=`${e}${r}`;for(;t.used.has(n);)r+=1,n=`${e}${r}`;return t.counts[e]=r,t.used.add(n),n}function ID(e,t,r){return e&&!r.used.has(e)?(r.used.add(e),e):jt(t,r)}function e9(e){return e===TD.StateCode.Activated?"Active":"Draft"}function t9(e,t){let r=e.processtriggerscope,n=e.processtriggerformid;return r===1&&n?n:r===2?"Entity":t??"Entity"}function RD(e,t=1033){return new Na({languageCode:t}).serialize(e)}function FD(e){return new Na().deserialize(e)}var TD,G,Bf,PD,qf,Na,Vf=I(()=>{"use strict";Pf();TD=re(Gn());lD();es();G=re(Of());Bf={Equals:G.WorkflowConditionOperator.Equal,DoesNotEqual:G.WorkflowConditionOperator.NotEqual,IsGreaterThan:G.WorkflowConditionOperator.GreaterThan,IsLessThan:G.WorkflowConditionOperator.LessThan,IsGreaterThanEqualTo:G.WorkflowConditionOperator.GreaterThanOrEqual,IsLessThanEqualTo:G.WorkflowConditionOperator.LessThanOrEqual,Contains:G.WorkflowConditionOperator.Contains,DoesNotContain:G.WorkflowConditionOperator.DoesNotContain,BeginsWith:G.WorkflowConditionOperator.BeginsWith,DoesNotBeginWith:G.WorkflowConditionOperator.DoesNotBeginWith,EndsWith:G.WorkflowConditionOperator.EndsWith,DoesNotEndWith:G.WorkflowConditionOperator.DoesNotEndWith,On:G.WorkflowConditionOperator.On,NotOn:G.WorkflowConditionOperator.NotOn,ContainsData:G.WorkflowConditionOperator.NotNull,DoesNotContainData:G.WorkflowConditionOperator.IsNull},PD={};for(let e of Object.keys(Bf))PD[Bf[e]]=e;qf={setFieldValue:"Set Field Value",setDefaultValue:"Set Default Value",lockUnlock:"Lock/Unlock",setBusinessRequired:"Set Business Required",setVisibility:"Set Visibility",recommendation:"Recommendation",showErrorMessage:"Show Error Message",condition:"Condition"};Na=class{resolveLabel;languageCode;entityName="";stepCounter={value:0};idCounter={counts:{},used:new Set};constructor(t={}){this.resolveLabel=t.resolveLabel??(r=>qf[r]),this.languageCode=t.languageCode??1033}label(t){return this.resolveLabel(t)}serialize(t){let r=t.wfomRoot;this.entityName=t.entityLogicalName,this.stepCounter={value:r?Number(r.nextStepIndex):1},this.idCounter={counts:{},used:new Set};let n=t.scope!=="Entity"&&t.scope!=="AllForms"?t.scope:null,i=t.rootCondition?[this.serializeConditionNode(t.rootCondition)]:[],a={__class:"WorkflowStep:#Microsoft.Crm.Workflow.ObjectModel",id:r?.id??t.ruleId??mt(),name:r?.name??"Step_0",description:r!==void 0?r.description:t.description||null,stepLabels:ts(),argumentsArray:[],primaryEntityName:r?.primaryEntityName??this.entityName,nextStepIndex:String(this.stepCounter.value),isCrmUIWorkflow:!0,category:r?.category??"2",businessProcessType:r?.businessProcessType??"0",mode:r?.mode??"0",title:r?.title??t.name,formId:n,workflowEntityId:r?.workflowEntityId??t.ruleId??"",variables:r?.variables??[],inputs:r?.inputs??[],steps:{list:i}};return JSON.stringify(a)}makeApplyActionStep(t){return{__class:"SetAttributeValueStep:#Microsoft.Crm.Workflow.ObjectModel",id:jt("SetAttributeValueStep",this.idCounter),description:t.displayName||"New Action",name:t.stepName??Ea(this.stepCounter),stepLabels:{list:[]},specification:Mf(t.field,hu(t.valueType,t.value,t.valueField,this.entityName,t.expression,t.rawExpression,t.lookupValue,t.valueWorkflowType)),entity:Uf(this.entityName)}}makeRecommendationActionStep(t,r,n){let i=r.map(l=>this.makeApplyActionStep(l)),a=t??"",o=n?.stepLabels,s=ED(o,a,this.languageCode);return{__class:"ActionStep:#Microsoft.Crm.Workflow.ObjectModel",id:ID(n?.id,"ActionStep",this.idCounter),name:n?.name??Ea(this.stepCounter),description:n?.description??"Action step",stepLabels:s,steps:{list:i},actionId:null,actionType:n?.actionType??"4",processId:n?.processId??mt(),uniqueName:n?.uniqueName??`id_${mt().replace(/-/g,"")}ActionStep`}}serializeAction(t){let r=Uf(this.entityName),n=t.stepName??Ea(this.stepCounter),i=t.stepLabels??ts(),a={name:n,stepLabels:i,description:t.displayName},o=t.type;switch(o){case"SetFieldValue":return{...a,id:jt("SetAttributeValueStep",this.idCounter),__class:"SetAttributeValueStep:#Microsoft.Crm.Workflow.ObjectModel",entity:r,specification:Mf(t.field,hu(t.valueType,t.value,t.valueField,this.entityName,t.expression,t.rawExpression,t.lookupValue,t.valueWorkflowType))};case"SetDefaultValue":return{...a,id:jt("SetDefaultValueStep",this.idCounter),__class:"SetDefaultValueStep:#Microsoft.Crm.Workflow.ObjectModel",entity:r,specification:Mf(t.field,hu(t.valueType,t.value,t.valueField,this.entityName,t.expression,t.rawExpression,t.lookupValue,t.valueWorkflowType))};case"LockUnlock":return{...a,id:jt("SetDisplayModeStep",this.idCounter),__class:"SetDisplayModeStep:#Microsoft.Crm.Workflow.ObjectModel",controlId:t.field,controlType:"standard",isReadOnly:t.lock,entity:r};case"SetBusinessRequired":return{...a,id:jt("SetFieldRequiredLevelStep",this.idCounter),__class:"SetFieldRequiredLevelStep:#Microsoft.Crm.Workflow.ObjectModel",controlId:t.field,controlType:"standard",requiredLevel:t.required?G.FieldRequiredLevelTypes.Required:G.FieldRequiredLevelTypes.None,entity:r};case"SetVisibility":return{...a,id:jt("SetVisibilityStep",this.idCounter),__class:"SetVisibilityStep:#Microsoft.Crm.Workflow.ObjectModel",controlId:t.field,controlType:"standard",isVisible:t.visible,entity:r};case"ShowErrorMessage":{let s=t.errorMessage||t.displayName,l=t.stepLabels&&t.stepLabels.list.length>0?t.stepLabels:{list:[{labelId:mt(),languageCode:this.languageCode,description:s}]};return{...a,id:jt("SetMessageStep",this.idCounter),__class:"SetMessageStep:#Microsoft.Crm.Workflow.ObjectModel",stepLabels:l,name:s,controlId:t.field,entity:r,level:t.messageLevel??"error",actionSteps:t.messageActionSteps??{list:[]}}}case"Recommendation":{let s=t.messageText??t.recommendationTitle??t.displayName,l=ED(t.stepLabels,s,this.languageCode),u={list:[this.makeRecommendationActionStep(t.acceptanceText,t.applyActions??[],t.recommendationActionStepMeta)]};return{...a,id:jt("SetMessageStep",this.idCounter),__class:"SetMessageStep:#Microsoft.Crm.Workflow.ObjectModel",stepLabels:l,description:t.recommendationTitle||t.displayName,controlId:t.field,entity:r,level:"RECOMMENDATION",actionSteps:u}}default:throw new Error(`Unsupported action type: ${o}`)}}serializeConditionNode(t){let r=t.stepName??Ea(this.stepCounter),n=jt("ConditionStep",this.idCounter),i=[],a=t,o=!0;for(;a;){let s=Z5(a.clauses,a.logic,this.entityName),l=o?a.branchName??Ea(this.stepCounter):Ea(this.stepCounter),c={__class:"ConditionBranchStep:#Microsoft.Crm.Workflow.ObjectModel",id:o?ID(a.branchId,"ConditionBranchStep",this.idCounter):jt("ConditionBranchStep",this.idCounter),name:l,description:a.displayName,stepLabels:ts(),conditionExpression:s??void 0,steps:{list:a.trueBranch.map(p=>this.serializeBranchItem(p))}};i.push(c);let d=a.falseBranch;if(d.length===1&&d[0].kind==="condition"){a=d[0],o=!1;continue}d.length>0&&i.push(this.makeTerminalElseBranch(d)),a=void 0}return{__class:"ConditionStep:#Microsoft.Crm.Workflow.ObjectModel",id:n,name:r,description:"",stepLabels:ts(),containsElsebranch:i.length>1,steps:{list:i}}}makeTerminalElseBranch(t){return{__class:"ConditionBranchStep:#Microsoft.Crm.Workflow.ObjectModel",id:jt("ConditionBranchStep",this.idCounter),name:"Else",description:null,stepLabels:ts(),conditionExpression:void 0,steps:{list:t.map(r=>this.serializeBranchItem(r))}}}serializeBranchItem(t){return t.kind==="condition"?this.serializeConditionNode(t):this.serializeAction(t)}deserialize(t){let r=t,n=null,i;if(t.wfomJson)try{let a=JSON.parse(t.wfomJson);i={id:a.id==="WorkflowStep0"||!a.id?t.workflowid??mt():a.id,name:a.name,description:a.description,nextStepIndex:a.nextStepIndex,category:a.category==="0"||a.category===0?"2":a.category,businessProcessType:a.businessProcessType,mode:a.mode,title:a.title||t.name||"",primaryEntityName:a.primaryEntityName==="1"||!a.primaryEntityName?t.primaryentity??"":a.primaryEntityName,workflowEntityId:a.workflowEntityId==="00000000-0000-0000-0000-000000000000"||!a.workflowEntityId?t.workflowid??"":a.workflowEntityId,formId:a.formId,variables:a.variables,inputs:a.inputs};let s=(a.steps?.list??[]).find(l=>l.__class==="ConditionStep:#Microsoft.Crm.Workflow.ObjectModel");s&&(n=this.deserializeConditionStep(s))}catch{}return{ruleId:t.workflowid??null,name:t.name??"",description:t.description??"",entityLogicalName:t.primaryentity??"",scope:t9(r,i?.formId),status:e9(t.statecode),rootCondition:n,wfomRoot:i}}deserializeConditionStep(t){let r=(t.steps?.list??[]).filter(Y5);return this.buildConditionNodeFromBranches(r,t,!0)}buildConditionNodeFromBranches(t,r,n){let[i,...a]=t,{clauses:o,logic:s}=DD(i?.conditionExpression),l=this.deserializeBranch(i?.steps?.list??[]),u=this.deserializeElseChain(a,r),c=i?.description||i?.name||r.description||r.name||this.label("condition");return{kind:"condition",id:(n?r.id:i?.id)??mt(),displayName:c,clauses:o,logic:s,trueBranch:l,falseBranch:u,isCollapsed:!1,stepName:n?r.name:void 0,branchId:n?i?.id:void 0,branchName:n?i?.name:void 0}}deserializeElseChain(t,r){if(t.length===0)return[];let[n]=t,{clauses:i}=DD(n.conditionExpression);return i.length===0?this.deserializeBranch(n.steps?.list??[]):[this.buildConditionNodeFromBranches(t,r,!1)]}deserializeBranch(t){return t.map(r=>r.__class==="ConditionStep:#Microsoft.Crm.Workflow.ObjectModel"?this.deserializeConditionStep(r):this.deserializeAction(r)).filter(r=>r!==null)}parseRecommendationApplyActions(t){let n=(t?.list??[])[0];if(!n)return{applyActions:[]};let i={id:n.id,name:n.name,description:n.description??void 0,stepLabels:n.stepLabels,processId:n.processId,uniqueName:n.uniqueName,actionType:n.actionType},a=n.stepLabels?.list,o=a&&a.length>0?a[0].description??"":"";return{applyActions:(n.steps?.list??[]).filter(l=>l.__class==="SetAttributeValueStep:#Microsoft.Crm.Workflow.ObjectModel").map(l=>{let u=l.specification;return{id:l.id||mt(),field:u?.propertyName??"",stepName:l.name??void 0,displayName:l.description??void 0,...mu(u?.propertyValueExpr)}}),meta:i,acceptanceText:o}}deserializeAction(t){switch(t.__class){case"SetAttributeValueStep:#Microsoft.Crm.Workflow.ObjectModel":{let r=mu(t.specification.propertyValueExpr);return{kind:"action",id:t.id,type:"SetFieldValue",displayName:t.description||t.name||this.label("setFieldValue"),stepName:t.name,stepLabels:t.stepLabels,field:t.specification.propertyName,...r}}case"SetDefaultValueStep:#Microsoft.Crm.Workflow.ObjectModel":{let r=mu(t.specification.propertyValueExpr);return{kind:"action",id:t.id,type:"SetDefaultValue",displayName:t.description||t.name||this.label("setDefaultValue"),stepName:t.name,stepLabels:t.stepLabels,field:t.specification.propertyName,...r}}case"SetDisplayModeStep:#Microsoft.Crm.Workflow.ObjectModel":return{kind:"action",id:t.id,type:"LockUnlock",displayName:t.description||t.name||this.label("lockUnlock"),stepName:t.name,stepLabels:t.stepLabels,field:t.controlId,lock:t.isReadOnly};case"SetFieldRequiredLevelStep:#Microsoft.Crm.Workflow.ObjectModel":return{kind:"action",id:t.id,type:"SetBusinessRequired",displayName:t.description||t.name||this.label("setBusinessRequired"),stepName:t.name,stepLabels:t.stepLabels,field:t.controlId,required:t.requiredLevel!==G.FieldRequiredLevelTypes.None};case"SetVisibilityStep:#Microsoft.Crm.Workflow.ObjectModel":return{kind:"action",id:t.id,type:"SetVisibility",displayName:t.description||t.name||this.label("setVisibility"),stepName:t.name,stepLabels:t.stepLabels,field:t.controlId,visible:t.isVisible};case"SetMessageStep:#Microsoft.Crm.Workflow.ObjectModel":{let r=t.stepLabels?.list,n=r&&r.length>0?r[0].description??"":"";if((t.level??"").toUpperCase()==="RECOMMENDATION"){let{applyActions:i,meta:a,acceptanceText:o}=this.parseRecommendationApplyActions(t.actionSteps);return{kind:"action",id:t.id,type:"Recommendation",displayName:t.description||this.label("recommendation"),stepName:t.name,stepLabels:t.stepLabels,field:t.controlId,recommendationTitle:t.description||"",messageText:n,acceptanceText:o,applyActions:i,recommendationActionStepMeta:a}}return{kind:"action",id:t.id,type:"ShowErrorMessage",displayName:t.description||this.label("showErrorMessage"),stepName:t.name,stepLabels:t.stepLabels,field:t.controlId,errorMessage:n||t.name||"",messageLevel:t.level??void 0,messageActionSteps:t.actionSteps}}case"ActionStep:#Microsoft.Crm.Workflow.ObjectModel":{let{applyActions:r,meta:n,acceptanceText:i}=this.parseRecommendationApplyActions({list:[t]});return{kind:"action",id:t.id,type:"Recommendation",displayName:t.name||this.label("recommendation"),stepName:t.name,stepLabels:t.stepLabels,field:t.actionControl?.controlId??"",recommendationTitle:t.name||"",messageText:t.description||"",acceptanceText:i,applyActions:r,recommendationActionStepMeta:n}}default:return null}}}});function Ln(e){return!r9.has(e)}function MD(e){return u9.has(e)}function gu(e){return LD.has(e)?n9:s9.has(e)?i9:kD.has(e)?a9:o9}function BD(e){return gu(e)[0]}function UD(e,t){return gu(t).includes(e)}function xD(e){return LD.has(e)?"string":e==="Money"?"money":e==="Integer"||e==="BigInt"?"integer":e==="Decimal"||e==="Double"?"decimal":kD.has(e)?"date":l9.has(e)?"boolean":"other"}function vu(e,t){let r=xD(e),n=xD(t);return r==="other"||n==="other"?e===t:r===n}var r9,n9,i9,a9,o9,LD,s9,kD,l9,u9,Gf=I(()=>{"use strict";r9=new Set(["ContainsData","DoesNotContainData"]);n9=["Equals","DoesNotEqual","Contains","DoesNotContain","BeginsWith","DoesNotBeginWith","EndsWith","DoesNotEndWith","ContainsData","DoesNotContainData"],i9=["Equals","DoesNotEqual","IsGreaterThan","IsGreaterThanEqualTo","IsLessThan","IsLessThanEqualTo","ContainsData","DoesNotContainData"],a9=["On","NotOn","IsGreaterThan","IsGreaterThanEqualTo","IsLessThan","IsLessThanEqualTo","ContainsData","DoesNotContainData"],o9=["Equals","DoesNotEqual","ContainsData","DoesNotContainData"],LD=new Set(["String","Memo","EntityName"]),s9=new Set(["Integer","BigInt","Money","Decimal","Double"]),kD=new Set(["DateTime"]),l9=new Set(["Boolean"]),u9=new Set(["Equals","DoesNotEqual"])});function jf(e){return c9.has(e.type)}function zf(e,t,r,n,i,a,o){let s=i.get(r);!s||!d9.has(s.attributeType)||n!=="Value"||o?.operator&&!MD(o.operator)||a.push({nodeId:e,kind:"INVALID_VALUE_TYPE_FOR_FIELD",message:`${t}: please select a record for this lookup field; a typed text value cannot be saved.`,target:o?.target,itemId:o?.itemId,messageKey:"Validation.InvalidValueTypeForField",messageParams:{label:t}})}function Wf(e){return!!(e?.entityType?.trim()&&e.id?.trim())}function Hf(e,t,r){return{nodeId:e,kind:"INVALID_DAY_COUNT",message:`Please enter a whole number of days between 0 and ${Ca}.`,target:t,itemId:r,messageKey:"Validation.InvalidDayCount",messageParams:{max:Ca}}}function $D(e,t,r,n,i,a,o,s){if(i!=="Clear")return;let l=a.get(n);cu(r,l)||o.push({nodeId:e,kind:"INVALID_CLEAR_FOR_FIELD",message:`${t}: Clear is only supported for optional fields with a legacy-compatible type.`,target:s?.target,itemId:s?.itemId,messageKey:"Validation.InvalidClearForField",messageParams:{label:t}})}function bu(e){if(!e)return!1;for(let t of[...e.trueBranch,...e.falseBranch])if(t.kind==="action"){if(jf(t))return!0}else if(bu(t))return!0;return!1}function Qf(e,t){if(e.id===t)return e;for(let r of[...e.trueBranch,...e.falseBranch]){if(r.id===t)return r;if(r.kind==="condition"){let n=Qf(r,t);if(n)return n}}return null}function Da(e,t){for(let r=0;r<e.trueBranch.length;r++){let n=e.trueBranch[r];if(n.id===t)return{node:e,branch:"true",index:r};if(n.kind==="condition"){let i=Da(n,t);if(i)return i}}for(let r=0;r<e.falseBranch.length;r++){let n=e.falseBranch[r];if(n.id===t)return{node:e,branch:"false",index:r};if(n.kind==="condition"){let i=Da(n,t);if(i)return i}}return null}function Jf(e,t){return{...e,trueBranch:qD(e.trueBranch,t),falseBranch:qD(e.falseBranch,t)}}function qD(e,t){return e.filter(r=>r.id!==t).map(r=>r.kind==="condition"?Jf(r,t):r)}function kn(e,t,r){return e.id===t?r(e):{...e,trueBranch:e.trueBranch.map(n=>n.kind==="condition"?kn(n,t,r):n),falseBranch:e.falseBranch.map(n=>n.kind==="condition"?kn(n,t,r):n)}}function yu(e,t,r){return{...e,trueBranch:e.trueBranch.map(n=>n.kind==="action"&&n.id===t?r(n):n.kind==="condition"?yu(n,t,r):n),falseBranch:e.falseBranch.map(n=>n.kind==="action"&&n.id===t?r(n):n.kind==="condition"?yu(n,t,r):n)}}function VD(e,t,r,n){return kn(e,t,i=>({...i,trueBranch:r==="true"?[...i.trueBranch,n]:i.trueBranch,falseBranch:r==="false"?[...i.falseBranch,n]:i.falseBranch}))}function Kf(e){return e.length===1&&e[0].kind==="condition"}function f9(e){let t=0,r=e??void 0;for(;r;){t+=1;let{falseBranch:n}=r;if(Kf(n)){r=n[0];continue}n.length>0&&(t+=1),r=void 0}return t}function m9(e){return!!e&&f9(e)<p9}function h9(e,t){if(!e)return;let r=(n,i)=>{if(n.id===t)return i;let a=[];if(Kf(n.falseBranch)){let o=r(n.falseBranch[0],i);if(o)return o}else a.push(...n.falseBranch.filter(o=>o.kind==="condition"));a.push(...n.trueBranch.filter(o=>o.kind==="condition"));for(let o of a){let s=r(o,o);if(s)return s}};return r(e,e)}function GD(e,t,r){let n=h9(e,t);return!n||!m9(n)?e:kn(e,t,i=>zD(i,r))}function zD(e,t){if(Kf(e.falseBranch))return{...e,falseBranch:[zD(e.falseBranch[0],t)]};let r=Xf(t);return r.falseBranch=e.falseBranch,{...e,falseBranch:[r]}}function WD(e,t){let r=Da(e,t);if(!r||r.branch!=="false")return e;let n=r.node.falseBranch[r.index];if(!n||n.kind!=="condition")return e;let i=n.falseBranch;return kn(e,r.node.id,a=>({...a,falseBranch:i}))}function HD(e,t,r){let n=Da(e,t);if(!n)return e;let i=a=>{let o=[...a],s=o[n.index+r];return s?(o[n.index+r]=o[n.index],o[n.index]=s,o):a};return kn(e,n.node.id,a=>({...a,trueBranch:n.branch==="true"?i(a.trueBranch):a.trueBranch,falseBranch:n.branch==="false"?i(a.falseBranch):a.falseBranch}))}function Xf(e){return{kind:"condition",id:mt(),displayName:e??"New Condition",clauses:[],logic:"AND",trueBranch:[],falseBranch:[],isCollapsed:!1}}function jD(e,t){let r={kind:"action",id:mt(),type:e,displayName:t??`New ${e}`};switch(e){case"Recommendation":return{...r,type:"Recommendation",field:"",recommendationTitle:"",messageText:"",applyActions:[{id:mt(),field:"",valueType:"Value",value:""}]};case"LockUnlock":return{...r,type:"LockUnlock",field:"",lock:!0};case"ShowErrorMessage":return{...r,type:"ShowErrorMessage",field:"",errorMessage:""};case"SetFieldValue":return{...r,type:"SetFieldValue",field:"",valueType:"Value",value:""};case"SetDefaultValue":return{...r,type:"SetDefaultValue",field:"",valueType:"Value",value:""};case"SetBusinessRequired":return{...r,type:"SetBusinessRequired",field:"",required:!0};case"SetVisibility":return{...r,type:"SetVisibility",field:"",visible:!0};default:return{...r,type:"SetFieldValue",field:"",valueType:"Value",value:""}}}function QD(e){if(!e)return[];let t=[];return JD(e,t),[...new Set(t)]}function JD(e,t){e.clauses.forEach(r=>{r.field&&t.push(r.field)}),[...e.trueBranch,...e.falseBranch].forEach(r=>{r.kind==="condition"?JD(r,t):"field"in r&&r.field&&t.push(r.field)})}function KD(e,t=[]){if(!e)return[{nodeId:"root",kind:"NO_CONDITION",message:"A business rule must include at least one condition.",target:"node"}];let r=[],n=new Map(t.map(i=>[i.logicalName,i]));return XD(e,r,n),bu(e)||r.push({nodeId:"root",kind:"NO_ACTION",message:"A business rule must include at least one action step.",target:"node"}),r}function XD(e,t,r){e.clauses.length===0&&t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_FIELD",message:"Add at least one clause to this condition.",target:"node",messageKey:"Validation.AddClause"}),e.clauses.forEach(n=>{let i=n.valueType==="Expression"&&!n.rawExpression?di(n.expression):null;if(!n.field)t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_FIELD",message:"Please select a field for this clause.",target:"clauseField",itemId:n.id});else if(Ln(n.operator)&&n.valueType==="Value"&&!n.value)t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_VALUE",message:"Please enter a value for this clause.",target:"clauseValue",itemId:n.id});else if(Ln(n.operator)&&n.valueType==="Value"&&n.value){let a=r.get(n.field);a?.maxLength&&n.value.length>a.maxLength&&t.push({nodeId:e.id,kind:"CLAUSE_VALUE_TOO_LONG",message:`Value exceeds the field's maximum length of ${a.maxLength} characters.`,target:"clauseValue",itemId:n.id,messageParams:{maxLength:a.maxLength}})}else Ln(n.operator)&&n.valueType==="Expression"&&!n.rawExpression&&!Sa(n.expression)&&t.push(i==="invalidDayCount"?Hf(e.id,"clauseValue",n.id):{nodeId:e.id,kind:"EMPTY_CLAUSE_VALUE",message:"Please complete the formula for this clause.",target:"clauseValue",itemId:n.id,messageKey:"Validation.CompleteClauseFormula"});Ln(n.operator)&&n.valueType==="Lookup"&&(Wf(n.lookupValue)||t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_VALUE",message:"Please select a lookup record for this clause.",target:"clauseValue",itemId:n.id,messageKey:"Validation.EmptyClauseLookupValue"})),Ln(n.operator)&&zf(e.id,"Condition",n.field,n.valueType,r,t,{operator:n.operator,target:"clauseValue",itemId:n.id})}),[...e.trueBranch,...e.falseBranch].forEach(n=>{if(n.kind==="condition")XD(n,t,r);else{if(!("field"in n)||!n.field)t.push({nodeId:n.id,kind:"EMPTY_ACTION_FIELD",message:`${n.type}: a target field is required.`,target:"actionField",messageParams:{actionType:n.type}});else if((n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&(n.valueType??"Value")==="Value"&&!n.value?.trim())t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:`${n.type}: please provide a value.`,target:"actionValue",messageParams:{actionType:n.type}});else if((n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&n.valueType==="Value"&&n.value){let i=r.get(n.field);i?.maxLength&&n.value.length>i.maxLength&&t.push({nodeId:n.id,kind:"ACTION_VALUE_TOO_LONG",message:`${n.type}: value exceeds the field's maximum length of ${i.maxLength} characters.`,target:"actionValue",messageParams:{actionType:n.type,maxLength:i.maxLength}})}else if((n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&n.valueType==="Field"){if(!n.valueField)t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:`${n.type}: please select a field to copy from.`,target:"actionValue",messageKey:"Validation.SelectActionSourceField",messageParams:{actionType:n.type}});else if(r.size>0){let i=r.get(n.field),a=r.get(n.valueField);i&&a&&!vu(i.attributeType,a.attributeType)&&t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:`${n.type}: the source field's type is not compatible with the target field.`,target:"actionValue",messageKey:"Validation.IncompatibleActionSourceField",messageParams:{actionType:n.type}})}}else if((n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&n.valueType==="Expression"){let i=n.rawExpression?null:di(n.expression);!n.rawExpression&&!Sa(n.expression)&&t.push(i==="invalidDayCount"?Hf(n.id,"actionValue"):{nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:`${n.type}: please complete the formula.`,target:"actionValue",messageKey:"Validation.CompleteActionFormula",messageParams:{actionType:n.type}})}else(n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&n.valueType==="Lookup"&&!Wf(n.lookupValue)&&t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:`${n.type}: please complete the lookup record.`,target:"actionValue",messageKey:"Validation.EmptyActionLookupValue",messageParams:{actionType:n.type}});if((n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&n.field&&(zf(n.id,n.type,n.field,n.valueType,r,t,{target:"actionValue"}),$D(n.id,n.type,n.type,n.field,n.valueType,r,t,{target:"actionValue"})),n.type==="ShowErrorMessage"&&!n.errorMessage?.trim()&&t.push({nodeId:n.id,kind:"EMPTY_ACTION_MESSAGE",message:"Show error message: please enter an error message.",target:"actionMessage"}),n.type==="Recommendation"){let i=n.applyActions??[];n.recommendationTitle?.trim()||t.push({nodeId:n.id,kind:"EMPTY_RECOMMENDATION_TITLE",message:"Recommendation: please enter a recommendation title.",target:"recommendationTitle"}),n.messageText?.trim()||t.push({nodeId:n.id,kind:"EMPTY_RECOMMENDATION_MESSAGE",message:"Recommendation: please enter a recommendation message.",target:"recommendationMessage"}),i.length===0&&t.push({nodeId:n.id,kind:"RECOMMENDATION_NO_APPLY_ACTION",message:"Recommendation: add at least one action to apply.",target:"node"}),i.forEach(a=>{if(!a.field)t.push({nodeId:n.id,kind:"EMPTY_ACTION_FIELD",message:"Recommendation: a target field is required for each action to apply.",target:"applyActionField",itemId:a.id,messageKey:"Validation.RecommendationApplyField"});else if(a.valueType==="Field")a.valueField||t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:"Recommendation: please select a field to copy from.",target:"applyActionValue",itemId:a.id,messageKey:"Validation.RecommendationApplySourceField"});else if(a.valueType==="Expression"){let o=a.rawExpression?null:di(a.expression);!a.rawExpression&&!Sa(a.expression)&&t.push(o==="invalidDayCount"?Hf(n.id,"applyActionValue",a.id):{nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:"Recommendation: please complete the formula.",target:"applyActionValue",itemId:a.id,messageKey:"Validation.RecommendationApplyFormula"})}else a.valueType==="Lookup"?Wf(a.lookupValue)||t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:"Recommendation: please complete the lookup record.",target:"applyActionValue",itemId:a.id,messageKey:"Validation.RecommendationApplyLookupValue"}):a.valueType==="Clear"||a.value?.trim()||t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:"Recommendation: please enter a value for each action to apply.",target:"applyActionValue",itemId:a.id,messageKey:"Validation.RecommendationApplyValue"});a.field&&(zf(n.id,"Recommendation",a.field,a.valueType,r,t,{target:"applyActionValue",itemId:a.id}),$D(n.id,"Recommendation","SetFieldValue",a.field,a.valueType,r,t,{target:"applyActionValue",itemId:a.id}))})}}})}var c9,d9,p9,Yf=I(()=>{"use strict";Pf();Nf();Gf();es();c9=new Set(["LockUnlock","ShowErrorMessage","SetFieldValue","SetDefaultValue","SetBusinessRequired","SetVisibility"]);d9=new Set(["Lookup","Customer","Owner"]);p9=10});var YD={};Br(YD,{DAY_COUNT_MAX:()=>Ca,DAY_COUNT_MIN:()=>xf,DEFAULT_DESERIALIZE_LABELS:()=>qf,WorkflowJsonMapper:()=>Na,addElseIfInTree:()=>GD,appendToBranch:()=>VD,areFieldKindsCompatible:()=>vu,attributeTypeToWorkflowType:()=>pD,buildWorkflowEntity:()=>ZN,collectUsedFields:()=>QD,createEmptyAction:()=>jD,createEmptyCondition:()=>Xf,deserializeWorkflowJson:()=>FD,findNode:()=>Qf,findParent:()=>Da,getDefaultOperatorForFieldType:()=>BD,getExpressionModelIssue:()=>di,getOperatorsForFieldType:()=>gu,hasAnyTriggerGeneratingAction:()=>bu,isDayCountValid:()=>Lf,isExpressionModelComplete:()=>Sa,isOperatorCompatible:()=>UD,isTriggerGeneratingAction:()=>jf,moveBranchItemInTree:()=>HD,operatorNeedsValue:()=>Ln,processTriggerFormIdFromScope:()=>If,processTriggerScopeFromScope:()=>Df,removeElseIfInTree:()=>WD,removeNodeFromTree:()=>Jf,serializeToWorkflowJson:()=>RD,supportsClearForActionType:()=>cu,updateActionInTree:()=>yu,updateConditionInTree:()=>kn,validateBusinessRule:()=>KD});var ZD=I(()=>{"use strict";Nf();eD();Vf();Vf();Yf();Yf();Gf();es();es();});var Zf=g(wu=>{"use strict";Object.defineProperty(wu,"__esModule",{value:!0});wu.cloneJson=void 0;function g9(e){return JSON.parse(JSON.stringify(e))}wu.cloneJson=g9});var c2=g(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.BUSINESS_RULE_NULL_GUID=Mn.businessRuleRegistration=Mn.BusinessRuleAdapter=void 0;var e2=ct(),ns=(ZD(),fr(YD)),t2=rr(),r2=ne(),v9=Zf(),_r=Ir(),y9=Dc(),b9=ct();function w9(e){return o2((0,v9.cloneJson)(e))}function o2(e){var t,r;let n=i=>(i??[]).map(a=>A9(a)?o2(a):a);return{...e,logic:(t=e.logic)!==null&&t!==void 0?t:"AND",clauses:(r=e.clauses)!==null&&r!==void 0?r:[],trueBranch:n(e.trueBranch),falseBranch:n(e.falseBranch)}}function A9(e){return Object.prototype.hasOwnProperty.call(e,"type")?!1:Object.prototype.hasOwnProperty.call(e,"clauses")||Object.prototype.hasOwnProperty.call(e,"trueBranch")||Object.prototype.hasOwnProperty.call(e,"falseBranch")||Object.prototype.hasOwnProperty.call(e,"logic")}function C9(e){var t;if(e===null||typeof e!="object"||Array.isArray(e))throw new r2.ValidationError("businessRule","(new)","/rootCondition",`rootCondition must be a condition object or null, got ${Array.isArray(e)?"array":typeof e}`);if(Object.prototype.hasOwnProperty.call(e,"type"))throw new r2.ValidationError("businessRule",(t=e.id)!==null&&t!==void 0?t:"(new)","/rootCondition","rootCondition looks like an ACTION (it carries 'type'), but it must be a condition. Wrap the action in a condition's trueBranch instead \u2014 a bare action would compile to an empty rule that saves successfully and does nothing.");return e}var S9="00000000-0000-0000-0000-000000000000";Mn.BUSINESS_RULE_NULL_GUID=S9;var E9=new Set(["Recommendation","LockUnlock","ShowErrorMessage","SetFieldValue","SetDefaultValue","SetBusinessRequired","SetVisibility"]),N9=["ruleId","name","description","entityLogicalName","scope","status","rootCondition"],D9=["kind","id","displayName","logic","clauses","trueBranch","falseBranch"],I9=["id","field","fieldDisplayName","operator","valueType","value","valueField","lookupValue","expression","rawExpression","valueWorkflowType"];function ur(e,t){return e===void 0?t:{...e,...t}}var pi=["kind","id","type","displayName","field","stepName","stepLabels"],n2=["valueType","valueWorkflowType","value","valueField","lookupValue","expression","rawExpression"],_9={Recommendation:[...pi,"recommendationTitle","messageText","acceptanceText","applyActions","recommendationActionStepMeta"],LockUnlock:[...pi,"lock"],ShowErrorMessage:[...pi,"errorMessage","messageLevel","messageActionSteps"],SetFieldValue:[...pi,...n2],SetDefaultValue:[...pi,...n2],SetBusinessRequired:[...pi,"required"],SetVisibility:[...pi,"visible"]};function H(e,t){return t===void 0?{}:{[e]:t}}function s2(e){var t;return e===void 0?void 0:{...e,label:(t=e.label)!==null&&t!==void 0?t:""}}function em(e){return{valueType:e.valueType,...H("valueWorkflowType",e.valueWorkflowType),...H("value",e.value),...H("valueField",e.valueField),...H("lookupValue",s2(e.lookupValue)),...H("expression",e.expression),...H("rawExpression",e.rawExpression)}}function l2(e,t){let r=new Set(t),n={};for(let[i,a]of Object.entries(e))r.has(i)||a!==void 0&&(n[i]=a);return Object.keys(n).length>0?n:void 0}var T9=["id","field","valueType","valueWorkflowType","value","valueField","lookupValue","expression","rawExpression","stepName","displayName"];function P9(e){return ur(e.bag,{id:e.id,field:e.field,...em(e),...H("stepName",e.stepName),...H("displayName",e.displayName)})}function O9(e){let t=l2(e,T9);return{id:e.id,field:e.field,valueType:e.valueType,...H("valueWorkflowType",e.valueWorkflowType),...H("value",e.value),...H("valueField",e.valueField),...H("lookupValue",e.lookupValue),...H("expression",e.expression),...H("rawExpression",e.rawExpression),...H("stepName",e.stepName),...H("displayName",e.displayName),...H("bag",t)}}function i2(e){return{valueType:e.valueType,...H("valueWorkflowType",e.valueWorkflowType),...H("value",e.value),...H("valueField",e.valueField),...H("lookupValue",e.lookupValue),...H("expression",e.expression),...H("rawExpression",e.rawExpression)}}function a2(e){throw new Error(`Unsupported business-rule action type: ${e.type}`)}var R9=new Set(["INVALID_CLEAR_FOR_FIELD","INVALID_VALUE_TYPE_FOR_FIELD","CLAUSE_VALUE_TOO_LONG","ACTION_VALUE_TOO_LONG"]),F9=new Set,x9="INVALID_CLEAR_FOR_FIELD";function L9(e){let t=n=>{var i;return(0,_r.isJsonObject)(n)&&(n.label===""||n.label===void 0)?{...n,label:String((i=n.id)!==null&&i!==void 0?i:"")}:n},r=n=>{if(!(0,_r.isJsonObject)(n))return n;let i={...n};"lookupValue"in i&&(i.lookupValue=t(i.lookupValue)),Array.isArray(i.applyActions)&&(i.applyActions=i.applyActions.map(r));for(let a of["clauses","trueBranch","falseBranch"])Array.isArray(i[a])&&(i[a]=i[a].map(r));return i};return r(e)}var Au=class{toArtifact(t){let r=this.residualBag(t,N9),n={id:t.ruleId,name:t.name,description:t.description,entityLogicalName:t.entityLogicalName,scope:t.scope,status:t.status,rootCondition:t.rootCondition?this.conditionToJson(t.rootCondition):null};return r&&(n.bag=r),n}fromArtifact(t){let r=t.rootCondition?this.conditionFromJson(t.rootCondition):null;return ur(t.bag,{ruleId:t.id,name:t.name,description:t.description,entityLogicalName:t.entityLogicalName,scope:t.scope,status:t.status,rootCondition:r})}fromApiResponse(t){var r;let n=t??{},i={...(r=n.Entity)!==null&&r!==void 0?r:{},wfomJson:n.WfomJson},a=(0,ns.deserializeWorkflowJson)(i);return this.toArtifact(a)}toApiPayload(t){var r;let n=this.fromArtifact(t);n.wfomRoot&&(n.wfomRoot={...n.wfomRoot,name:t.name,title:t.name,primaryEntityName:t.entityLogicalName||n.wfomRoot.primaryEntityName});let i=(0,ns.serializeToWorkflowJson)(n),a=(r=n.ruleId)!==null&&r!==void 0?r:(0,e2.newId)();return{Entity:this.buildWorkflowEntity(n,a),WfomJson:i,status:t.status}}createDefault(t){var r,n,i,a,o,s;let l={ruleId:(r=t.id)!==null&&r!==void 0?r:null,name:(n=t.name)!==null&&n!==void 0?n:"New business rule",description:(i=t.description)!==null&&i!==void 0?i:"",entityLogicalName:(a=t.entityLogicalName)!==null&&a!==void 0?a:"",scope:(o=t.scope)!==null&&o!==void 0?o:"Entity",status:(s=t.status)!==null&&s!==void 0?s:"Draft",rootCondition:t.rootCondition===void 0?(0,ns.createEmptyCondition)():t.rootCondition===null?null:this.conditionFromJson(w9(C9(t.rootCondition)))},u=this.toArtifact(l);return u.id||(u.id=(0,e2.newId)()),u}assignMissingIds(t){return(0,b9.assignMissingIds)(t)}validate(t){let r=[],n=t.rootCondition;return n==null?r:(0,_r.isJsonObject)(n)?(u2(n,"/rootCondition",r),r):(r.push((0,_r.issue)("/rootCondition","condition-must-be-object",`rootCondition must be a JSON object or null, got ${typeof n}`)),r)}semanticIssues(t,r=[]){let n;try{n=this.fromArtifact(t)}catch(o){return[(0,_r.issue)("/rootCondition","rule-not-representable",o instanceof Error?o.message:String(o))]}let i=n.rootCondition===null?null:L9(n.rootCondition),a;return r.length===0?a=R9:r.some(o=>o.requiredLevel!==void 0)?a=F9:a=new Set([x9]),(0,ns.validateBusinessRule)(i,r).filter(o=>!a.has(o.kind)).map(o=>(0,_r.issue)(`/rootCondition (${o.nodeId})`,`business-rule-${o.kind}`,o.message))}issuesBlockingPush(t,r=[],n){return this.semanticIssues(t,r)}residualBag(t,r){return l2(t,r)}buildWorkflowEntity(t,r){return(0,ns.buildWorkflowEntity)(t,r)}conditionToJson(t){let r=this.residualBag(t,D9),n={id:t.id,displayName:t.displayName,logic:t.logic,clauses:t.clauses.map(i=>this.clauseToJson(i)),trueBranch:t.trueBranch.map(i=>this.branchItemToJson(i)),falseBranch:t.falseBranch.map(i=>this.branchItemToJson(i))};return r&&(n.bag=r),n}clauseToJson(t){let r=this.residualBag(t,I9),n={id:t.id,field:t.field,fieldDisplayName:t.fieldDisplayName,operator:t.operator,valueType:t.valueType,...t.value!==void 0?{value:t.value}:{},...t.valueField!==void 0?{valueField:t.valueField}:{},...t.lookupValue!==void 0?{lookupValue:t.lookupValue}:{},...t.expression!==void 0?{expression:t.expression}:{},...t.rawExpression!==void 0?{rawExpression:t.rawExpression}:{},...t.valueWorkflowType!==void 0?{valueWorkflowType:t.valueWorkflowType}:{}};return r&&(n.bag=r),n}branchItemToJson(t){return t.kind==="condition"?this.conditionToJson(t):this.actionToJson(t)}actionToJson(t){let r=this.residualBag(t,_9[t.type]),n={kind:"action",id:t.id,displayName:t.displayName,field:t.field,...H("stepName",t.stepName),...H("stepLabels",t.stepLabels),...H("bag",r)};switch(t.type){case"Recommendation":return{...n,type:"Recommendation",recommendationTitle:t.recommendationTitle,messageText:t.messageText,...H("acceptanceText",t.acceptanceText),applyActions:t.applyActions.map(O9),...H("recommendationActionStepMeta",t.recommendationActionStepMeta)};case"LockUnlock":return{...n,type:"LockUnlock",lock:t.lock};case"ShowErrorMessage":return{...n,type:"ShowErrorMessage",errorMessage:t.errorMessage,...H("messageLevel",t.messageLevel),...H("messageActionSteps",t.messageActionSteps)};case"SetFieldValue":return{...n,type:"SetFieldValue",...i2(t)};case"SetDefaultValue":return{...n,type:"SetDefaultValue",...i2(t)};case"SetBusinessRequired":return{...n,type:"SetBusinessRequired",required:t.required};case"SetVisibility":return{...n,type:"SetVisibility",visible:t.visible};default:return a2(t)}}conditionFromJson(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:{};return ur(n,{kind:"condition",isCollapsed:typeof n.isCollapsed=="boolean"?n.isCollapsed:!1,id:t.id,displayName:t.displayName,logic:t.logic,clauses:t.clauses.map(i=>this.clauseFromJson(i)),trueBranch:t.trueBranch.map(i=>this.branchItemFromJson(i)),falseBranch:t.falseBranch.map(i=>this.branchItemFromJson(i))})}clauseFromJson(t){var r;return ur(t.bag,{id:t.id,field:t.field,fieldDisplayName:(r=t.fieldDisplayName)!==null&&r!==void 0?r:t.field,operator:t.operator,valueType:t.valueType,...H("value",t.value),...H("valueField",t.valueField),...H("lookupValue",s2(t.lookupValue)),...H("expression",t.expression),...H("rawExpression",t.rawExpression),...H("valueWorkflowType",t.valueWorkflowType)})}branchItemFromJson(t){return this.isConditionJson(t)?this.conditionFromJson(t):this.actionFromJson(t)}actionFromJson(t){if(!E9.has(t.type))throw new Error(`Unsupported business-rule action type: ${t.type}`);M9(t);let r={kind:"action",id:t.id,displayName:t.displayName,field:t.field,...H("stepName",t.stepName),...H("stepLabels",t.stepLabels)};switch(t.type){case"Recommendation":return ur(t.bag,{...r,type:"Recommendation",recommendationTitle:t.recommendationTitle,messageText:t.messageText,...H("acceptanceText",t.acceptanceText),applyActions:t.applyActions.map(P9),...H("recommendationActionStepMeta",t.recommendationActionStepMeta)});case"LockUnlock":return ur(t.bag,{...r,type:"LockUnlock",lock:t.lock});case"ShowErrorMessage":return ur(t.bag,{...r,type:"ShowErrorMessage",errorMessage:t.errorMessage,...H("messageLevel",t.messageLevel),...H("messageActionSteps",t.messageActionSteps)});case"SetFieldValue":return ur(t.bag,{...r,type:"SetFieldValue",...em(t)});case"SetDefaultValue":return ur(t.bag,{...r,type:"SetDefaultValue",...em(t)});case"SetBusinessRequired":return ur(t.bag,{...r,type:"SetBusinessRequired",required:t.required});case"SetVisibility":return ur(t.bag,{...r,type:"SetVisibility",visible:t.visible});default:return a2(t)}}isConditionJson(t){return Object.prototype.hasOwnProperty.call(t,"clauses")&&Object.prototype.hasOwnProperty.call(t,"logic")&&!Object.prototype.hasOwnProperty.call(t,"type")}};Mn.BusinessRuleAdapter=Au;function u2(e,t,r){(0,_r.optionalEnum)(e,"logic",["AND","OR"],t,"condition-logic-invalid",r),(0,_r.childObjects)(e,"clauses",t,"clause",r);for(let n of["trueBranch","falseBranch"])(0,_r.childObjects)(e,n,t,"branchItem",r).forEach(({node:a,index:o})=>{"clauses"in a||"trueBranch"in a||"falseBranch"in a?u2(a,`${t}/${n}/${o}`,r):k9(a,`${t}/${n}/${o}`,r)})}function k9(e,t,r){e.type==="SetDefaultValue"&&e.valueType==="Clear"&&r.push((0,_r.issue)(`${t}/valueType`,"clear-only-set-field-value","Clear is only supported for SetFieldValue actions."))}function M9(e){if(e.type==="SetDefaultValue"&&e.valueType==="Clear")throw new Error("Clear is only supported for SetFieldValue actions.")}function B9(){return{adapter:new Au,api:y9.businessRuleApi,publish:(e,t,r)=>(0,t2.publishBoundEntity)(e,r),publishScope:(e,t)=>(0,t2.boundEntityPublishScope)(t)}}Mn.businessRuleRegistration=B9});var D2=g(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.appRegistration=Bn.AppAdapter=Bn.HEADER_NAV_BOOLEAN_RULE=void 0;var en=Ir(),He=yn(),as=Hn(),U9=rr(),$9=Qs(),tm=Gs(),rm=Rn(),q9=ct(),V9=ie(),w2=Ci(),A2=ne(),C2=Ws();Object.defineProperty(Bn,"HEADER_NAV_BOOLEAN_RULE",{enumerable:!0,get:function(){return C2.HEADER_NAV_BOOLEAN_RULE}});var Nu="7.0.0.0",d2=`<SiteMap IntroducedVersion="${Nu}"></SiteMap>`,p2="/_imgs/imagestrips/transparent_spacer.gif",f2="/_imgs/TableIconsFluentV9/document_one_page_sparkle.svg",G9=["Entity","Url","DefaultDashboard","Page","GenPageId"],is="sitemapId",m2="sitemapName",z9="sitemapNameUnique",h2="aiDescription",g2="[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}",W9=new RegExp(`^(?:\\{${g2}\\}|${g2})$`);function v2(e,t){if(!W9.test(e.trim()))throw new A2.ValidationError("app",t,[{pointer:"/sitemapId",rule:"app-sitemapid-guid",message:`sitemapId must be a GUID; received '${e}'.`}]);return e.trim()}function y2(e,t,r){if(e===void 0)return r;if(typeof e!="boolean")throw new A2.ValidationError("app",t,[S2(e)]);return e}function S2(e){return(0,en.issue)("/headerAndNavigationRefresh",C2.HEADER_NAV_BOOLEAN_RULE,`headerAndNavigationRefresh must be a boolean, got ${typeof e}`)}function H9(e){let t=n=>{let i=e[n];return typeof i=="string"&&i.trim()!==""?i.trim():void 0},r=n=>{let i=t(n);if(i!==void 0)try{return(0,V9.normalizeGuid)(i,n)}catch{return}};switch(e.type){case"Entity":return t("entity")&&`Entity:${t("entity").toLowerCase()}`;case"URL":return t("url")&&`URL:${t("url").toLowerCase()}`;case"DashBoard":return r("dashboardId")&&`DashBoard:${r("dashboardId")}`;case"CustomPage":return t("page")&&`CustomPage:${t("page").toLowerCase()}`;case"GenPage":return r("genPageId")&&`GenPage:${r("genPageId")}`;default:return}}var Du=class{constructor(t=w2.DEFAULT_LCID){this.lcid=t}toArtifact(t){let{bag:r,modeledEls:n}=Cu(t,"Area");return{id:"",name:"",uniqueName:"",description:"",siteMap:{areas:n.map(i=>this.areaToJson(i)),bag:r},bag:(0,He.emptyBag)()}}fromArtifact(t){(0,rm.installDomShim)();let r=this.assignMissingIds(JSON.parse(JSON.stringify(t))),n=new DOMParser().parseFromString("<root/>","text/xml"),i=this.rootToRaw(r);return(0,He.rebuildRaw)(i,(0,as.domEngine)(n),null)}fromApiResponse(t){var r,n,i,a,o,s,l,u,c,d,p;(0,rm.installDomShim)();let f=t??{},h=(r=f.$sitemap)!==null&&r!==void 0?r:f,v=(0,as.parseXmlRoot)((n=h.sitemapxml)!==null&&n!==void 0?n:d2,d2),w=this.toArtifact(v);return w.id=(i=f.appmoduleid)!==null&&i!==void 0?i:"",w.name=(a=f.name)!==null&&a!==void 0?a:"",w.uniqueName=(o=f.uniquename)!==null&&o!==void 0?o:"",w.description=(s=f.description)!==null&&s!==void 0?s:"",f.aiappdescription&&(w.aiDescription=f.aiappdescription),w.bag={a:[[is,(u=(l=h.sitemapid)!==null&&l!==void 0?l:f._sitemapid_value)!==null&&u!==void 0?u:""],[m2,(c=h.sitemapname)!==null&&c!==void 0?c:""],[z9,(d=h.sitemapnameunique)!==null&&d!==void 0?d:""],[h2,(p=f.aiappdescription)!==null&&p!==void 0?p:""]],c:[]},w}toApiPayload(t){var r,n,i,a,o,s,l,u,c,d,p,f,h,v;(0,rm.installDomShim)();let w=(0,as.serializeNode)(this.fromArtifact(t)),E=[],D=[];for(let F of(n=(r=t.siteMap)===null||r===void 0?void 0:r.areas)!==null&&n!==void 0?n:[])for(let j of(i=F.groups)!==null&&i!==void 0?i:[])for(let L of(a=j.subAreas)!==null&&a!==void 0?a:[])L.type==="Entity"&&L.entity?E.push(L.entity):L.type==="DashBoard"&&L.dashboardId&&D.push(L.dashboardId);let x=(o=t.bag)!==null&&o!==void 0?o:(0,He.emptyBag)();return{sitemapId:im(x,is)||(t.sitemapId?v2(t.sitemapId,t.id):""),sitemapxml:w,sitemapname:im(x,m2)||t.name,appModuleId:t.id,appModuleName:t.name,appModuleDescription:t.description,...t.aiDescription!==void 0&&t.aiDescription!==im(x,h2)?{appModuleAiDescription:t.aiDescription}:{},appModuleUniqueName:t.uniqueName,...t.iconWebResourceId?{iconWebResourceId:t.iconWebResourceId}:{},...t.headerAndNavigationRefresh===void 0?{}:{appSettings:{[tm.HEADER_AND_NAVIGATION_REFRESH]:y2(t.headerAndNavigationRefresh,(s=t.id)!==null&&s!==void 0?s:"(unknown)",!0)?tm.APP_SETTING_ON:tm.APP_SETTING_OFF}},...typeof t.published=="boolean"?{published:t.published}:{},entities:E,components:{forms:(u=(l=t.components)===null||l===void 0?void 0:l.forms)!==null&&u!==void 0?u:[],views:(d=(c=t.components)===null||c===void 0?void 0:c.views)!==null&&d!==void 0?d:[],charts:(f=(p=t.components)===null||p===void 0?void 0:p.charts)!==null&&f!==void 0?f:[],dashboards:[...(v=(h=t.components)===null||h===void 0?void 0:h.dashboards)!==null&&v!==void 0?v:[],...D]}}}createDefault(t){var r,n,i,a,o,s;let l=!((r=t.siteMap)===null||r===void 0)&&r.areas&&t.siteMap.areas.length>0?t.siteMap.areas:[{id:"",title:"Area",groups:[{id:"",title:"Group",subAreas:[]}]}],u=(n=t.id)!==null&&n!==void 0?n:(0,q9.newId)();return{id:u,name:(i=t.name)!==null&&i!==void 0?i:"New App",uniqueName:(a=t.uniqueName)!==null&&a!==void 0?a:"",description:(o=t.description)!==null&&o!==void 0?o:"",...t.aiDescription?{aiDescription:t.aiDescription}:{},siteMap:{areas:l},...t.sitemapId?{sitemapId:v2(t.sitemapId,u)}:{},...t.iconWebResourceId?{iconWebResourceId:t.iconWebResourceId}:{},headerAndNavigationRefresh:y2(t.headerAndNavigationRefresh,(s=t.id)!==null&&s!==void 0?s:"(new)",!0),...typeof t.published=="boolean"?{published:t.published}:{},...t.components?{components:t.components}:{}}}assignMissingIds(t){let r=t;if(!r||typeof r!="object")return t;let n=r.siteMap;return n&&Array.isArray(n.areas)?n.areas.forEach(om):Array.isArray(r.areas)?r.areas.forEach(om):Array.isArray(r.groups)?om(r):Array.isArray(r.subAreas)?N2(r):"type"in r&&Iu(r,"subarea"),t}validate(t){let r=[],n=t.published;n!==void 0&&typeof n!="boolean"&&r.push((0,en.issue)("/published","published-must-be-boolean",`published must be a boolean, got ${typeof n}`));let i=t.siteMap,a=t.headerAndNavigationRefresh;if(a!==void 0&&typeof a!="boolean"&&r.push(S2(a)),i==null)return r;if(!(0,en.isJsonObject)(i))return r.push((0,en.issue)("/siteMap","sitemap-must-be-object",`siteMap must be a JSON object, got ${typeof i}`)),r;let o=(0,en.childObjects)(i,"areas","/siteMap","area",r),s=new Map;return o.forEach(({node:l,index:u})=>{let c=`/siteMap/areas/${u}`;(0,en.childObjects)(l,"groups",c,"group",r).forEach(({node:p,index:f})=>{let h=`${c}/groups/${f}`;(0,en.childObjects)(p,"subAreas",h,"subArea",r).forEach(({node:w,index:E})=>{let D=`${h}/subAreas/${E}`;(0,en.optionalEnum)(w,"type",["Entity","URL","DashBoard","CustomPage","GenPage"],D,"subarea-type-invalid",r);let x=H9(w);if(!x)return;let F=s.get(x);if(F===void 0){s.set(x,D);return}r.push((0,en.issue)(D,"subarea-duplicate-target",`the sitemap already navigates to this target at ${F}; a duplicate SubArea would pin it twice and a single removeElement would leave one behind`))})})}),r}applyServerIdentity(t,r){let n=r[is];if(!n)return;t.bag||(t.bag=(0,He.emptyBag)());let i=t.bag.a.find(a=>a[0]===is);i?i[1]=n:t.bag.a.push([is,n])}areaToJson(t){var r;let{bag:n,modeledEls:i}=Cu(t,"Group"),a={id:(r=t.getAttribute("Id"))!==null&&r!==void 0?r:"",title:nm(t,this.lcid),groups:i.map(l=>this.groupToJson(l)),bag:n},o=t.getAttribute("Icon");o&&(a.icon=o);let s=t.getAttribute("VectorIcon");return s&&(a.vectorIcon=s),a}groupToJson(t){var r;let{bag:n,modeledEls:i}=Cu(t,"SubArea");return{id:(r=t.getAttribute("Id"))!==null&&r!==void 0?r:"",title:nm(t,this.lcid),subAreas:i.map(a=>this.subAreaToJson(a)),bag:n}}subAreaToJson(t){var r;let{bag:n}=Cu(t,null),i=j9(t),a={id:(r=t.getAttribute("Id"))!==null&&r!==void 0?r:"",type:i,title:nm(t,this.lcid),bag:n};if(i==="Entity"){let l=t.getAttribute("Entity");l&&(a.entity=l)}else if(i==="DashBoard"){let l=t.getAttribute("DefaultDashboard");l&&(a.dashboardId=l);let u=t.getAttribute("Url");u&&(a.dashboardUrl=u)}else if(i==="CustomPage"){let l=t.getAttribute("Page");l&&(a.page=l)}else if(i==="GenPage"){let l=t.getAttribute("GenPageId");l&&(a.genPageId=l)}else{let l=t.getAttribute("Url");l&&(a.url=l)}let o=t.getAttribute("Icon");o&&o!==p2&&(a.icon=o);let s=t.getAttribute("VectorIcon");return s&&(a.vectorIcon=s),a}rootToRaw(t){var r,n,i,a;let o=(n=(r=t.siteMap)===null||r===void 0?void 0:r.bag)!==null&&n!==void 0?n:(0,He.emptyBag)(),l=Su(o)?[["IntroducedVersion",Nu]]:[],u=((a=(i=t.siteMap)===null||i===void 0?void 0:i.areas)!==null&&a!==void 0?a:[]).map(c=>this.areaToRaw(c));return{n:"SiteMap",a:(0,He.mergeAttrs)(o.a,l),c:(0,He.spliceChildren)(o.c,u)}}areaToRaw(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:(0,He.emptyBag)(),i=Su(n),a=[],o=[];t.id&&a.push(["Id",t.id]),i&&a.push(["ShowGroups","true"],["ResourceId","SitemapDesigner.NewTitle"],["DescriptionResourceId","SitemapDesigner.NewTitle"],["IntroducedVersion",Nu]),t.icon!==void 0?a.push(["Icon",t.icon]):Eu(n.a,"Icon")&&o.push("Icon"),t.vectorIcon!==void 0?a.push(["VectorIcon",t.vectorIcon]):Eu(n.a,"VectorIcon")&&o.push("VectorIcon");let s=t.groups.map(u=>this.groupToRaw(u)),l=am((0,He.spliceChildren)(n.c,s),t.title,i,this.lcid);return{n:"Area",a:(0,He.mergeAttrs)(n.a,a,o),c:l}}groupToRaw(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:(0,He.emptyBag)(),i=Su(n),a=[];t.id&&a.push(["Id",t.id]),i&&a.push(["ResourceId","SitemapDesigner.NewGroup"],["DescriptionResourceId","SitemapDesigner.NewGroup"],["ToolTipResourseId","SitemapDesigner.Unknown"],["IntroducedVersion",Nu],["IsProfile","false"]);let o=t.subAreas.map(l=>this.subAreaToRaw(l)),s=am((0,He.spliceChildren)(n.c,o),t.title,i,this.lcid);return{n:"Group",a:(0,He.mergeAttrs)(n.a,a),c:s}}subAreaToRaw(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:(0,He.emptyBag)(),i=Su(n),a=J9(n.a,t.type),o=[],s=[];t.id&&o.push(["Id",t.id]),X9(o,t),i?(o.push(["ResourceId","SitemapDesigner.NewSubArea"],["Client","All,Outlook,OutlookLaptopClient,OutlookWorkstationClient,Web"],["Sku","All,OnPremise,Live,SPLA"],["AvailableOffline","true"],["PassParams","false"]),t.icon&&o.push(["Icon",t.icon])):t.icon!==void 0?o.push(["Icon",t.icon]):Eu(a,"Icon",p2)&&s.push("Icon"),t.vectorIcon!==void 0?o.push(["VectorIcon",t.vectorIcon]):Eu(a,"VectorIcon")?t.type==="GenPage"?o.push(["VectorIcon",f2]):s.push("VectorIcon"):t.type==="GenPage"&&!Q9(a,"VectorIcon")&&o.push(["VectorIcon",f2]);let l=am((0,He.spliceChildren)(n.c,[]),t.title,i,this.lcid);return{n:"SubArea",a:(0,He.mergeAttrs)(a,o,s),c:l}}};Bn.AppAdapter=Du;function Cu(e,t){let r=(0,as.nodeLikeFromDom)(e).getAllProperties().map(s=>[s.key,s.value]),n=[],i=[],a=e.childNodes,o=0;for(let s=0;s<a.length;s+=1){let l=a[s];l.nodeType!==1&&l.nodeType!==3||(l.nodeType===1&&t!==null&&l.tagName===t?i.push(l):n.push({i:o,node:(0,He.rawFromNode)((0,as.nodeLikeFromDom)(l))}),o+=1)}return{bag:{a:r,c:n},modeledEls:i}}function b2(e,t){let r=[],n=e.childNodes;for(let i=0;i<n.length;i+=1){let a=n[i];a.nodeType===1&&a.tagName===t&&r.push(a)}return r}function nm(e,t){var r;let n=b2(e,"Titles")[0];if(!n)return"";let a=b2(n,"Title").find(o=>o.getAttribute("LCID")===String(t));return a&&(r=a.getAttribute("Title"))!==null&&r!==void 0?r:""}function j9(e){return e.getAttribute("GenPageId")?"GenPage":e.getAttribute("Entity")?"Entity":e.getAttribute("Page")?"CustomPage":e.getAttribute("DefaultDashboard")?"DashBoard":"URL"}function Su(e){return e.a.length===0&&e.c.length===0}function Q9(e,t){return e.some(([r])=>r===t)}function Eu(e,t,r){let n=e.find(([a])=>a===t),i=n?.[1];return!!i&&i!==r}function im(e,t){let r=e.a.find(([n])=>n===t);return r?r[1]:void 0}function J9(e,t){let r=K9(t);return e.filter(([n])=>!G9.includes(n)||r.has(n)).map(n=>[n[0],n[1]])}function K9(e){switch(e){case"Entity":return new Set(["Entity"]);case"URL":return new Set(["Url"]);case"DashBoard":return new Set(["DefaultDashboard","Url"]);case"CustomPage":return new Set(["Page"]);case"GenPage":return new Set(["GenPageId"]);default:return new Set}}function X9(e,t){var r,n,i,a,o;switch(t.type){case"Entity":e.push(["Entity",(r=t.entity)!==null&&r!==void 0?r:""]);break;case"URL":e.push(["Url",(n=t.url)!==null&&n!==void 0?n:""]);break;case"DashBoard":e.push(["DefaultDashboard",(i=t.dashboardId)!==null&&i!==void 0?i:""]),t.dashboardUrl!==void 0&&e.push(["Url",t.dashboardUrl]);break;case"CustomPage":e.push(["Page",(a=t.page)!==null&&a!==void 0?a:""]);break;case"GenPage":e.push(["GenPageId",(o=t.genPageId)!==null&&o!==void 0?o:""]);break;default:break}}function am(e,t,r,n){if(!t)return e;let i=e.findIndex(a=>a.n==="Titles");if(i>=0){let a=e.slice();return a[i]=Y9(e[i],t,n),a}return r?[Z9(t,n),...e]:e}function Y9(e,t,r){let n=!1,i=e.c.map(a=>!n&&a.n==="Title"&&e8(a,"LCID")===String(r)?(n=!0,{n:a.n,a:(0,He.mergeAttrs)(a.a,[["Title",t]]),c:a.c}):a);return n||i.unshift(E2(t,r)),{n:e.n,a:e.a.map(a=>[a[0],a[1]]),c:i}}function Z9(e,t){return{n:"Titles",a:[],c:[E2(e,t)]}}function E2(e,t){return{n:"Title",a:[["LCID",String(t)],["Title",e]],c:[]}}function e8(e,t){let r=e.a.find(([n])=>n===t);return r?r[1]:void 0}function t8(e){let t="0123456789abcdef",r="";for(let n=0;n<e;n+=1)r+=t[Math.floor(Math.random()*t.length)];return r}function Iu(e,t){e&&(typeof e.id!="string"||e.id.length===0)&&(e.id=`${t}_${t8(8)}`)}function om(e){var t;Iu(e,"area");for(let r of(t=e.groups)!==null&&t!==void 0?t:[])N2(r)}function N2(e){var t;Iu(e,"group");for(let r of(t=e.subAreas)!==null&&t!==void 0?t:[])Iu(r,"subarea")}function r8(e=w2.DEFAULT_LCID){return{adapter:new Du(e),api:$9.appApi,languageSensitive:!0,publish:(t,r)=>(0,U9.publishAppModule)(t,r),publishScope:t=>({envelope:"appmodule",targetIds:[t]})}}Bn.appRegistration=r8});var I2={};Br(I2,{ActionType:()=>lm,AppActionOrigin:()=>gm,AppActionVisibilityType:()=>hm,ButtonType:()=>cm,CannotUpdateAppActionColumns:()=>n8,Context:()=>pm,IconType:()=>um,Location:()=>dm,OnClickEventType:()=>mm,Scope:()=>fm,VisibilityType:()=>sm});var sm,lm,um,cm,dm,pm,fm,mm,hm,gm,n8,_2=I(()=>{"use strict";(function(e){e[e.NotSupported=0]="NotSupported",e[e.Show=1]="Show",e[e.ClassicRules=2]="ClassicRules",e[e.Expression=3]="Expression"})(sm||(sm={}));(function(e){e[e.NotSupported=0]="NotSupported",e[e.None=1]="None",e[e.JavaScript=2]="JavaScript",e[e.Expression=3]="Expression"})(lm||(lm={}));(function(e){e[e.NoIcon=0]="NoIcon",e[e.UseIcon=1]="UseIcon",e[e.UseWebResource=2]="UseWebResource"})(um||(um={}));(function(e){e[e.Standard=0]="Standard",e[e.Dropdown=1]="Dropdown",e[e.Split=2]="Split",e[e.Group=3]="Group"})(cm||(cm={}));(function(e){e[e.Form=0]="Form",e[e.HomePageGrid=1]="HomePageGrid",e[e.SubGridStandard=2]="SubGridStandard",e[e.SubGridAssociated=3]="SubGridAssociated",e[e.QuickForm=4]="QuickForm",e[e.Global=5]="Global",e[e.Dashboard=6]="Dashboard"})(dm||(dm={}));(function(e){e[e.All=0]="All",e[e.Entity=1]="Entity"})(pm||(pm={}));(function(e){e[e.App=0]="App",e[e.Entity=1]="Entity",e[e.Global=2]="Global"})(fm||(fm={}));(function(e){e[e.None=0]="None",e[e.Formula=1]="Formula",e[e.JavaScript=2]="JavaScript"})(mm||(mm={}));(function(e){e[e.None=0]="None",e[e.Formula=1]="Formula",e[e.ClassicRules=2]="ClassicRules"})(hm||(hm={}));(function(e){e[e.Default=0]="Default",e[e.Migrated=1]="Migrated",e[e.MigratedClone=2]="MigratedClone"})(gm||(gm={}));n8=["appactionid","appmoduleid","context","contextvalue","location","name","type","uniquename","isdisabled","origin"]});var O2=g(Tu=>{"use strict";Object.defineProperty(Tu,"__esModule",{value:!0});Tu.commandApi=void 0;var kt=be(),P2=ne(),Qt=ie(),i8="OnClickEventJavaScriptWebResourceId($select=name,webresourceid),IconWebResourceId($select=name,webresourceid)";async function _u(e,t){let r=`/EntityDefinitions(LogicalName='${(0,Qt.odataLiteral)(t)}')${(0,Qt.odataQuery)([["$select","MetadataId"]])}`,i=(0,kt.ensureSuccess)(await e.get(r),e.apiUrl(r)).body,a=i?.MetadataId;return a?(0,Qt.normalizeGuid)(a,"entityMetadataId"):""}Tu.commandApi={async get(e,t){var r;let n=t,i=await _u(e,n),a=i?`_contextentity_value eq ${i}`:`contextvalue eq '${(0,Qt.odataLiteral)(n)}'`,o=`/appactions${(0,Qt.odataQuery)([["$expand",i8],["$filter",a]])}`,s=(0,kt.ensureSuccess)(await e.get(o),e.apiUrl(o)),l=s.body,u=(r=l?.value)!==null&&r!==void 0?r:[],c={entityLogicalName:n,entityMetadataId:i,appActions:u},d={};for(let p of u){let f=typeof p.appactionid=="string"?p.appactionid:void 0;if(f){let h=p["@odata.etag"];d[(0,Qt.normalizeGuid)(f,"appactionid")]=typeof h=="string"?h:null}}return{raw:c,etag:(0,kt.readEtag)(s),memberEtags:d}},async list(e,t){let r=t?.entityLogicalName;return r?[{type:"command",id:r,name:`${r} commands`,entityLogicalName:r,isDirty:!1}]:[]},async create(e,t){let r=t,n=r.entityMetadataId||await _u(e,r.entityLogicalName);return T2(e,{...r,entityMetadataId:n},!1)},async update(e,t,r,n,i){let a=r,o=a.entityMetadataId||await _u(e,a.entityLogicalName);return T2(e,{...a,entityMetadataId:o},!0,i)},async delete(e,t){var r,n;let i=await _u(e,t),a=i?`_contextentity_value eq ${i}`:`contextvalue eq '${(0,Qt.odataLiteral)(t)}'`,o=`/appactions${(0,Qt.odataQuery)([["$select","appactionid"],["$filter",a]])}`,l=(n=(r=(0,kt.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[];for(let u of l)u.appactionid&&await(0,kt.deleteRecord)(e,"appactions",u.appactionid)}};async function T2(e,t,r,n){let i=t.entityMetadataId?(0,Qt.normalizeGuid)(t.entityMetadataId,"entityMetadataId"):"",a=o8(t.rows),o={};try{await a8(e,t,a,i,r,n,o)}catch(s){throw(0,P2.withPartialTokens)(s,{memberEtags:o})}return{id:t.entityLogicalName,etag:null,memberEtags:o}}async function a8(e,t,r,n,i,a,o){var s,l,u;for(let c of r)if(i&&c.exists){let d=(0,Qt.normalizeGuid)(c.appactionid,"id"),p=(s=a?.[d])!==null&&s!==void 0?s:c.etag,f=(0,kt.echoWrite)("appactionid",p?{"If-Match":p}:void 0),h=`/appactions(${d})${f.query}`,v=(0,kt.ensureSuccess)(await e.patch(h,c.body,f.options),e.apiUrl(h));o[d]=(0,kt.readEtag)(v)}else{let d=(0,kt.echoWrite)("appactionid"),p=`/appactions${d.query}`,f={...c.body};if(f["[email protected]"]===void 0){if(!n)throw new P2.SdkError("COMMAND_CONTEXT_ENTITY_UNRESOLVED",`Cannot create app action '${c.appactionid}' for entity '${t.entityLogicalName}': the entity MetadataId could not be resolved, so the required ContextEntity bind cannot be set. A row written without it is created but is permanently unreadable \u2014 commandApi.get filters on _contextentity_value. Verify the entity logical name exists and is readable, then retry.`);f["[email protected]"]=`/entities(${n})`}let h=(0,kt.ensureSuccess)(await e.post(p,f,d.options),e.apiUrl(p)),v=(0,kt.readCreatedId)(h,"appactionid");v&&(o[(0,Qt.normalizeGuid)(v,"appactionid")]=(0,kt.readEtag)(h))}for(let c of[...(l=t.deletedRowIds)!==null&&l!==void 0?l:[]].reverse()){let d=(0,Qt.normalizeGuid)(c,"id");await(0,kt.deleteRecord)(e,"appactions",d,(u=a?.[d])!==null&&u!==void 0?u:void 0),delete o[d]}}function o8(e){let t=new Map(e.map(a=>[a.appactionid,a])),r=new Set,n=[],i=a=>{if(r.has(a.appactionid))return;let o=a.body["[email protected]"];if(typeof o=="string"){let s=/\(([^)]+)\)/.exec(o),l=s?t.get(s[1]):void 0;l&&i(l)}r.add(a.appactionid),n.push(a)};return e.forEach(i),n}});var H2=g(Ia=>{"use strict";Object.defineProperty(Ia,"__esModule",{value:!0});Ia.commandRegistration=Ia.CommandAdapter=void 0;var Ue=(_2(),fr(I2)),R2=rr(),Jt=Ir(),s8=O2(),x2=ct(),_a=ie(),ym="$ClientSvg:",bm=".svg",l8=2,u8=1,c8=1,L2="entityMetadataId",d8=new Set(["@odata.etag","IconWebResourceId","OnClickEventJavaScriptWebResourceId","VisibilityFormulaComponentLibraryId","OnClickEventFormulaComponentLibraryId","ContextEntity","_appmoduleid_value","_contextentity_value","_createdby_value","_createdonbehalfby_value","_iconwebresourceid_value","_modifiedby_value","_modifiedonbehalfby_value","_onclickeventformulacomponentlibraryid_value","_onclickeventjavascriptwebresourceid_value","_organizationid_value","_parentappactionid_value","_visibilityformulacomponentlibraryid_value","createdon","modifiedon","overriddencreatedon","overwritetime","componentstate","componentidunique","solutionid","ismanaged","iscustomizable","versionnumber","importsequencenumber","timezoneruleversionnumber","utcconversiontimezonecode","statecode","statuscode","scope"]),Pu=class{toArtifact(t){var r,n,i,a,o,s;let l=(r=t.appActions)!==null&&r!==void 0?r:[],u=(n=t.entityLogicalName)!==null&&n!==void 0?n:"",c=new Map;for(let f of l){let h=typeof f._parentappactionid_value=="string"&&f._parentappactionid_value?f._parentappactionid_value:"",v=(i=c.get(h))!==null&&i!==void 0?i:[];v.push(f),c.set(h,v)}let d=new Map;for(let f of(a=c.get(""))!==null&&a!==void 0?a:[]){let h=g8(f.location),v=(o=d.get(h))!==null&&o!==void 0?o:[];v.push(f),d.set(h,v)}let p=[];for(let[f,h]of d)p.push({location:f,groups:f8(h,c,$2(f),u)});return{id:u,entityLogicalName:u,commandBars:h8(p),bag:{a:[[L2,(s=t.entityMetadataId)!==null&&s!==void 0?s:""]]}}}fromArtifact(t){return{entityLogicalName:t.entityLogicalName,entityMetadataId:Am(t),appActions:vm(t).map(r=>r.row)}}fromApiResponse(t){return this.toArtifact(t??{})}toApiPayload(t,r){let n=new Set(r?vm(r).map(l=>l.appactionid):[]),i=vm(t,new Set([...n].map(l=>l.toLowerCase()))),a=new Set(i.map(l=>l.appactionid)),o=i.map(l=>{let u=l.exists||n.has(l.appactionid);return{appactionid:l.appactionid,exists:u,etag:l.etag,body:u?_8(l.row):W2(l.row)}}),s=[...n].filter(l=>!a.has(l));return{entityLogicalName:t.entityLogicalName,entityMetadataId:Am(t),rows:o,...s.length>0?{deletedRowIds:s}:{}}}createDefault(t){var r,n,i,a;let o=(n=(r=t.entityLogicalName)!==null&&r!==void 0?r:t.id)!==null&&n!==void 0?n:"";return{id:(i=t.id)!==null&&i!==void 0?i:o,entityLogicalName:o,commandBars:(a=t.commandBars)!==null&&a!==void 0?a:[]}}assignMissingIds(t){return(0,x2.assignMissingIds)(t)}validate(t){let r=[];return(0,Jt.childObjects)(t,"commandBars","","commandBar",r).forEach(({node:i,index:a})=>{let o=`/commandBars/${a}`;(0,Jt.optionalEnum)(i,"location",["MainTab","ContextualTab","HomeTab"],o,"bar-location-invalid",r),(0,Jt.childObjects)(i,"groups",o,"group",r).forEach(({node:l,index:u})=>{let c=`${o}/groups/${u}`;(0,Jt.optionalGuidId)(l,"id",c,"group-id-invalid",r),k2((0,Jt.childObjects)(l,"controls",c,"control",r),`${c}/controls`,r)})}),r}};Ia.CommandAdapter=Pu;function k2(e,t,r){e.forEach(({node:n,index:i})=>{let a=`${t}/${i}`;(0,Jt.optionalGuidId)(n,"id",a,"control-id-invalid",r),(0,Jt.optionalEnum)(n,"type",["Button","FlyoutAnchor","SplitButton"],a,"control-type-invalid",r);let o=n.location;o!==void 0&&(typeof o!="number"||!Number.isInteger(o)||o<0||o>6)&&r.push((0,Jt.issue)(`${a}/location`,"control-location-invalid",`location must be an integer 0-6 when present, got ${JSON.stringify(o)}`)),n.action!==void 0&&n.action!==null&&((0,Jt.isJsonObject)(n.action)?(0,Jt.optionalEnum)(n.action,"type",["javascript"],`${a}/action`,"action-type-invalid",r):r.push((0,Jt.issue)(`${a}/action`,"control-action-must-be-object",`a control action must be a JSON object when present, got ${typeof n.action}`)));let s=(0,Jt.childObjects)(n,"children",a,"control",r);s.length>0&&k2(s,`${a}/children`,r)})}function M2(e){return{a:Object.entries(e)}}function p8(e){return Object.fromEntries(e.a)}function wm(e,t){if(e){for(let[r,n]of e.a)if(r===t)return n}}function Am(e){let t=wm(e.bag,L2);return typeof t=="string"?t:""}function f8(e,t,r,n){var i,a;let o=[],s=[];for(let l of Ru(e))l.type===Ue.ButtonType.Group?o.push({id:U2(l.name,n),title:typeof l.grouptitle=="string"?l.grouptitle:"",controls:Ru((a=t.get((i=l.appactionid)!==null&&i!==void 0?i:""))!==null&&a!==void 0?a:[]).map(u=>Ou(u,t,r,n)),bag:M2(l)}):s.push(Ou(l,t,r,n));return s.length>0&&o.unshift({id:(0,x2.newId)(),title:"",controls:s}),o}function Ou(e,t,r,n){var i,a,o,s;let l=U2(e.name,n),u={id:l,type:v8(e.type),label:typeof e.buttonlabeltext=="string"?e.buttonlabeltext:"",command:typeof e.appactionid=="string"?e.appactionid:l,bag:M2(e)},c=B2(e);c&&(u.icon=c);let d=m8(e);d&&(u.action=d),typeof e.hidden=="boolean"&&(u.hidden=e.hidden),typeof e.isdisabled=="boolean"&&(u.disabled=e.isdisabled),typeof e.location=="number"&&e.location!==r&&(u.location=e.location);let p=t.get((i=e.appactionid)!==null&&i!==void 0?i:"");if(p&&p.length>0){let f=[];for(let h of Ru(p))if(h.type===Ue.ButtonType.Group){u.flyoutGroupId=(a=h.appactionid)!==null&&a!==void 0?a:void 0;for(let v of Ru((s=t.get((o=h.appactionid)!==null&&o!==void 0?o:""))!==null&&s!==void 0?s:[]))f.push(Ou(v,t,r,n))}else f.push(Ou(h,t,r,n));u.children=f}return u}function B2(e){var t;if(!((t=e.IconWebResourceId)===null||t===void 0)&&t.name)return e.IconWebResourceId.name;if(e.fonticon)return e.fonticon.startsWith(ym)?e.fonticon.slice(ym.length)+bm:e.fonticon}function m8(e){var t;let r=e.onclickeventjavascriptfunctionname;if(typeof r!="string"||!r)return;let n=e.OnClickEventJavaScriptWebResourceId,i=e._onclickeventjavascriptwebresourceid_value,a={type:"javascript",webResourceId:(t=typeof i=="string"?i:n?.webresourceid)!==null&&t!==void 0?t:"",functionName:r};n?.name&&(a.libraryName=n.name);let o=e.onclickeventjavascriptparameters;return typeof o=="string"&&o&&(a.parameters=o),a}function F2(e){return typeof e.sequence=="number"?e.sequence:typeof e.buttonsequencepriority=="number"?e.buttonsequencepriority:0}function Ru(e){return[...e].sort((t,r)=>F2(t)-F2(r))}function h8(e){let t={MainTab:0,ContextualTab:1,HomeTab:2};return[...e].sort((r,n)=>{var i,a;return((i=t[r.location])!==null&&i!==void 0?i:9)-((a=t[n.location])!==null&&a!==void 0?a:9)})}function U2(e,t){if(!e)return"";if(e.indexOf("{!EntityLogicalName}")>=0)return e.replace("{!EntityLogicalName}",t);let r=e.split("!");return r.length===2?r[1]:e}function g8(e){switch(e){case Ue.Location.Form:case Ue.Location.QuickForm:return"MainTab";case Ue.Location.HomePageGrid:case Ue.Location.Dashboard:return"HomeTab";default:return"ContextualTab"}}function $2(e){switch(e){case"MainTab":return Ue.Location.Form;case"HomeTab":return Ue.Location.HomePageGrid;default:return Ue.Location.SubGridStandard}}function v8(e){switch(e){case Ue.ButtonType.Dropdown:return"FlyoutAnchor";case Ue.ButtonType.Split:return"SplitButton";default:return"Button"}}function y8(e){switch(e){case"FlyoutAnchor":return Ue.ButtonType.Dropdown;case"SplitButton":return Ue.ButtonType.Split;default:return Ue.ButtonType.Standard}}function b8(e){var t;return e.bag&&e.bag.a.length>0?!0:((t=e.title)!==null&&t!==void 0?t:"").length>0}function q2(e,t){var r,n,i;return((n=(r=e.bag)===null||r===void 0?void 0:r.a.length)!==null&&n!==void 0?n:0)>0?!0:t.has(((i=e.id)!==null&&i!==void 0?i:"").toLowerCase())}function vm(e,t=new Set){var r,n,i,a;let o=[],s=Am(e);for(let l of(r=e.commandBars)!==null&&r!==void 0?r:[]){let u=$2(l.location),c=((n=l.groups)!==null&&n!==void 0?n:[]).flatMap(f=>{var h;return(h=f.controls)!==null&&h!==void 0?h:[]}),d=c.length>0&&c.every(f=>!q2(f,t)),p=0;for(let f of(i=l.groups)!==null&&i!==void 0?i:[]){let h;if(b8(f)){let v=A8(f,u,void 0,e,s);o.push(v),h=v.appactionid}for(let v of(a=f.controls)!==null&&a!==void 0?a:[])V2(v,u,h,e,s,o,d?p:void 0,t),p+=1}}return o}function V2(e,t,r,n,i,a,o,s=new Set){var l;let u=w8(e,t,r,n,i,o);a.push(u);let c=(l=e.children)!==null&&l!==void 0?l:[];if(c.length===0)return;let d=e.flyoutGroupId||I8(u.appactionid);a.push(C8(d,t,u.appactionid,n,i));let p=c.every(f=>!q2(f,s));for(let[f,h]of c.entries())V2(h,t,d,n,i,a,p?f:void 0,s)}function w8(e,t,r,n,i,a){let o=G2(e,t,r,n,i),s=o.row;a!==void 0&&typeof s.sequence!="number"&&(s.sequence=a);let l=B2(s);return e.location!==void 0&&(s.location=e.location),s.type=y8(e.type),s.buttonlabeltext=e.label,S8(s,e.icon,l),N8(s,e.action),E8(s),e.hidden!==void 0&&(s.hidden=e.hidden),e.disabled!==void 0&&(s.isdisabled=e.disabled),{...o,row:s}}function A8(e,t,r,n,i){let a=G2(e,t,r,n,i);return a.row.type=Ue.ButtonType.Group,a.row.grouptitle=e.title,a}function C8(e,t,r,n,i){let a=z2(e,t,n,i);return a["[email protected]"]=`/appactions(${(0,_a.normalizeGuid)(r,"Command flyout group id")})`,a.type=Ue.ButtonType.Group,a.grouptitle===void 0&&(a.grouptitle=""),a.isgrouptitlehidden=!0,{appactionid:e,exists:!1,etag:null,row:a}}function G2(e,t,r,n,i){let a,o,s,l;if(e.bag&&e.bag.a.length>0){a=p8(e.bag),o=!0;let u=wm(e.bag,"@odata.etag");s=typeof u=="string"?u:null;let c=wm(e.bag,"appactionid");l=typeof c=="string"&&c?c:e.id}else l=e.id,a=z2(l,t,n,i),o=!1,s=null;return r&&(a["[email protected]"]=`/appactions(${(0,_a.normalizeGuid)(r,"Command parent appaction id")})`),{appactionid:l,exists:o,etag:s,row:a}}function z2(e,t,r,n){let i={appactionid:e,name:`${e}!${e.replace(/-/g,"").slice(0,32)}`,uniquename:"",location:t,context:Ue.Context.Entity,contextvalue:r.entityLogicalName,scope:Ue.Scope.Entity};return n&&(i["[email protected]"]=`/entities(${(0,_a.normalizeGuid)(n,"Command context entity metadata id")})`),i}function S8(e,t,r){if(t===r){let n=e._iconwebresourceid_value;typeof n=="string"&&n&&!e.fonticon&&(e["[email protected]"]=`/webresourceset(${(0,_a.normalizeGuid)(n,"Command icon web resource id")})`);return}if(t===void 0){e.fonticon="",e.IconWebResourceId=null;return}e.fonticon=t.toLowerCase().endsWith(bm)?ym+t.slice(0,t.length-bm.length):t,e.IconWebResourceId=null}function E8(e){let t=(n,i)=>{let a=e[n];if(typeof a!="string"||a.length===0||e[`${i}@odata.bind`]!==void 0)return;let o=(0,_a.normalizeGuid)(a,`Command ${i}`);e[`${i}@odata.bind`]=`/canvasapps(${o})`};e.onclickeventtype===u8&&t("_onclickeventformulacomponentlibraryid_value","OnClickEventFormulaComponentLibraryId");let r=e.visibilitytype;(!r||r===c8)&&t("_visibilityformulacomponentlibraryid_value","VisibilityFormulaComponentLibraryId")}function N8(e,t){if(!(!t||t.type!=="javascript")){if(e.onclickeventtype=l8,t.webResourceId){let r=(0,_a.normalizeGuid)(t.webResourceId,"Command action web resource id");e["[email protected]"]=`/webresourceset(${r})`}e.onclickeventjavascriptfunctionname=t.functionName,t.parameters!==void 0&&(e.onclickeventjavascriptparameters=t.parameters)}}function D8(e){let t=2166136261;for(let r=0;r<e.length;r+=1)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return t>>>0}function I8(e){let t="";for(let r=0;r<4;r+=1)t+=D8(`${r}:flyout-group:${e}`).toString(16).padStart(8,"0");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20,32)}`}function W2(e){let t={...e};for(let r of d8)delete t[r];return t}function _8(e){let t=W2(e);for(let r of Ue.CannotUpdateAppActionColumns)delete t[r];return t}function T8(){return{adapter:new Pu,api:s8.commandApi,publish:(e,t,r)=>(0,R2.publishBoundEntity)(e,r),publishScope:(e,t)=>(0,R2.boundEntityPublishScope)(t)}}Ia.commandRegistration=T8});var j2=g(Fu=>{"use strict";Object.defineProperty(Fu,"__esModule",{value:!0});Fu.chartApi=void 0;var P8=er(),Kt=be(),os=ie(),O8="savedqueryvisualizationid,name,description,primaryentitytypecode,datadescription,presentationdescription,charttype,type,isdefault",R8="savedqueryvisualizationid,name,primaryentitytypecode,charttype,isdefault";Fu.chartApi={async get(e,t){let n=`/savedqueryvisualizations(${(0,os.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,os.odataQuery)([["$select",O8]]),i=(0,Kt.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,Kt.readEtag)(i)}},async list(e,t){let r=`/savedqueryvisualizations${(0,os.odataQuery)([["$select",R8],["$filter",t?.entityLogicalName?`primaryentitytypecode eq '${(0,os.odataLiteral)(t.entityLogicalName)}'`:void 0]])}`;return(await(0,P8.collectPages)(e,r,"listArtifacts('chart')")).map(i=>{var a,o;return{type:"chart",id:(a=i.savedqueryvisualizationid)!==null&&a!==void 0?a:"",name:(o=i.name)!==null&&o!==void 0?o:"",entityLogicalName:i.primaryentitytypecode,isDirty:!1}})},async create(e,t,r){let n=t,i=(0,Kt.echoWrite)("savedqueryvisualizationid"),a=`/savedqueryvisualizations${i.query}`,o=(0,Kt.ensureSuccess)(await e.post(a,(0,Kt.withClientMintedId)({name:n.name,description:n.description,datadescription:n.datadescription,presentationdescription:n.presentationdescription,primaryentitytypecode:n.primaryentitytypecode,charttype:n.charttype,isdefault:n.isdefault},"savedqueryvisualizationid",r),i.options),e.apiUrl(a));return{id:(0,Kt.resolveCreatedId)(o,"savedqueryvisualizationid","chart",r),etag:(0,Kt.readEtag)(o)}},async update(e,t,r,n){let i=r,a=(0,os.normalizeGuid)(t,"id"),o=(0,Kt.echoWrite)("savedqueryvisualizationid",{"If-Match":(0,Kt.requireEtag)(n,"chart",a)}),s=`/savedqueryvisualizations(${a})${o.query}`,l=(0,Kt.ensureSuccess)(await e.patch(s,{name:i.name,description:i.description,datadescription:i.datadescription,presentationdescription:i.presentationdescription},o.options),e.apiUrl(s));return{id:a,etag:(0,Kt.readEtag)(l)}},delete(e,t){return(0,Kt.deleteRecord)(e,"savedqueryvisualizations",t)}}});var uI=g(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});Ta.chartRegistration=Ta.ChartAdapter=void 0;var Cm=yn(),Q2=Ir(),tn=Hn(),J2=rr(),F8=j2(),Sm=Rn(),x8=ct(),L8=["Column","StackedColumn","StackedColumn100","Bar","StackedBar","StackedBar100","Area","StackedArea","StackedArea100","Line","Pie","Doughnut","Funnel","Tag"],k8=new Map(L8.map(e=>[e.toLowerCase(),e]));function Z2(e){var t;return e&&(t=k8.get(e.toLowerCase()))!==null&&t!==void 0?t:"Column"}function M8(){return'<Chart Palette="BrightPastel"><Series><Series ChartType="Column" ChartArea="Default" /></Series><ChartAreas><ChartArea Name="Default" /></ChartAreas><Legends><Legend Name="Default" /></Legends></Chart>'}function B8(e){var t,r;let n=e.entityLogicalName,i=e.series.map((u,c)=>({alias:`agg_${c}`,series:u})),a=e.categories.map((u,c)=>({alias:`grp_${c}`,category:u})),o=i.map(u=>`<attribute alias="${u.alias}" name="${ss(u.series.attribute)}" aggregate="${ss(u.series.aggregate)}" />`).join("")+a.map(u=>`<attribute alias="${u.alias}" name="${ss(u.category.attribute)}" groupby="true"${u.category.dateGrouping?` dategrouping="${ss(u.category.dateGrouping)}"`:""} />`).join(""),s=i.map(u=>`<measure alias="${u.alias}" />`).join(""),l=(r=(t=a[0])===null||t===void 0?void 0:t.alias)!==null&&r!==void 0?r:"";return`<datadefinition><fetchcollection><fetch mapping="logical" aggregate="true"><entity name="${ss(n)}">${o}</entity></fetch></fetchcollection><categorycollection><category alias="${l}"><measurecollection>${s}</measurecollection></category></categorycollection></datadefinition>`}var xu=class{toArtifact(t){var r,n,i,a,o,s,l;(0,Sm.installDomShim)();let u=(r=t.datadescription)!==null&&r!==void 0?r:"",c=(n=t.presentationdescription)!==null&&n!==void 0?n:"",d=(0,tn.parseXmlRoot)(u,"<datadefinition/>"),p=(0,tn.parseXmlRoot)(c,"<Chart/>");return{id:(i=t.savedqueryvisualizationid)!==null&&i!==void 0?i:"",name:(a=t.name)!==null&&a!==void 0?a:"",description:(o=t.description)!==null&&o!==void 0?o:"",entityLogicalName:(s=t.primaryentitytypecode)!==null&&s!==void 0?s:"",chartType:eI(p),isDefault:(l=t.isdefault)!==null&&l!==void 0?l:!1,series:nI(d),categories:iI(d),presentation:tI(p),dataBag:u?(0,tn.projectElementBag)(d):void 0,presentationBag:c?(0,tn.projectElementBag)(p):void 0,rowBag:U8(t.charttype,t.type)}}fromArtifact(t){(0,Sm.installDomShim)();let{datadescription:r,presentationdescription:n}=$8(t);return{savedqueryvisualizationid:t.id,name:t.name,description:t.description,primaryentitytypecode:t.entityLogicalName,datadescription:r,presentationdescription:n,charttype:K2(t.rowBag,"charttype"),type:K2(t.rowBag,"type"),isdefault:t.isDefault}}fromApiResponse(t){return this.toArtifact(t??{})}toApiPayload(t){var r,n,i,a,o,s,l;let u=this.fromArtifact(t);return{name:(r=u.name)!==null&&r!==void 0?r:"",description:(n=u.description)!==null&&n!==void 0?n:"",datadescription:(i=u.datadescription)!==null&&i!==void 0?i:"",presentationdescription:(a=u.presentationdescription)!==null&&a!==void 0?a:"",primaryentitytypecode:(o=u.primaryentitytypecode)!==null&&o!==void 0?o:"",charttype:(s=u.charttype)!==null&&s!==void 0?s:0,isdefault:(l=u.isdefault)!==null&&l!==void 0?l:!1}}createDefault(t){var r,n,i,a,o,s,l;(0,Sm.installDomShim)();let u=(r=t.entityLogicalName)!==null&&r!==void 0?r:"";return{id:(n=t.id)!==null&&n!==void 0?n:(0,x8.newId)(),name:(i=t.name)!==null&&i!==void 0?i:"New Chart",description:(a=t.description)!==null&&a!==void 0?a:"",entityLogicalName:u,chartType:(o=t.chartType)!==null&&o!==void 0?o:"Column",isDefault:(s=t.isDefault)!==null&&s!==void 0?s:!1,series:t.series&&t.series.length>0?t.series:[{attribute:"createdon",aggregate:"count"}],categories:t.categories&&t.categories.length>0?t.categories:[{attribute:"createdon",dateGrouping:"month"}],presentation:(l=t.presentation)!==null&&l!==void 0?l:{palette:"BrightPastel",showLegend:!0}}}assignMissingIds(t){return t}validate(t){let r=[],n=t;return(0,Q2.childObjects)(n,"series","","series",r),(0,Q2.childObjects)(n,"categories","","category",r),r}};Ta.ChartAdapter=xu;function U8(e,t){let r=[];return e!==void 0&&r.push(["charttype",String(e)]),t!==void 0&&r.push(["type",String(t)]),r.length>0?{a:r,c:[]}:void 0}function K2(e,t){if(!e)return;let r=e.a.find(([i])=>i===t);if(!r)return;let n=parseInt(r[1],10);return Number.isNaN(n)?void 0:n}function eI(e){let t=e.getElementsByTagName("Series");for(let r=0;r<t.length;r+=1)if(t[r].getAttribute("ChartType"))return Z2(t[r].getAttribute("ChartType"));return"Column"}function tI(e){var t;let r={showLegend:e.getElementsByTagName("Legend").length>0},n=e.getAttribute("Palette");n&&(r.palette=n);let i=e.getElementsByTagName("Title")[0],a=((t=i?.textContent)!==null&&t!==void 0?t:"").trim();return a&&(r.title=a),r}function Lu(e){return e.getElementsByTagName("fetch")[0]}function rI(e){let t=new Map;if(!e)return t;let r=e.getElementsByTagName("link-entity");for(let n=0;n<r.length;n+=1){let i=r[n],a=i.getAttribute("name");if(!a)continue;let o=i.getElementsByTagName("attribute");for(let s=0;s<o.length;s+=1){let l=o[s],u=l.getAttribute("alias")||l.getAttribute("name");u&&t.set(u,a)}}return t}function nI(e){let t=Lu(e);if(!t)return[];let r=rI(t),n=t.getElementsByTagName("attribute"),i=[];for(let a=0;a<n.length;a+=1){let o=n[a],s=o.getAttribute("aggregate");if(!s)continue;let l=o.getAttribute("name");if(!l)continue;let u={attribute:l,aggregate:s},c=o.getAttribute("charttype");c&&(u.seriesType=Z2(c));let d=o.getAttribute("alias");d&&(u.alias=d);let p=d??l,f=r.get(p);f&&(u.relatedEntity=f),i.push(u)}return i}function iI(e){var t;let r=Lu(e);if(!r)return[];let n=rI(r),i=r.getElementsByTagName("attribute"),a=[];for(let o=0;o<i.length;o+=1){let s=i[o];if(((t=s.getAttribute("groupby"))!==null&&t!==void 0?t:"").toLowerCase()!=="true")continue;let l=s.getAttribute("name");if(!l)continue;let u={attribute:l},c=s.getAttribute("dategrouping");c&&(u.dateGrouping=c);let d=s.getAttribute("alias");d&&(u.alias=d);let p=d??l,f=n.get(p);f&&(u.relatedEntity=f),a.push(u)}return a}function $8(e){if(!X2(e.dataBag)||!X2(e.presentationBag))return{datadescription:B8(e),presentationdescription:oG(e)};let t=new DOMParser().parseFromString("<root/>","text/xml"),r=Y2(e.dataBag,"datadefinition",t),n=Y2(e.presentationBag,"Chart",t);return Em(e.series,nI(r))||(V8(t,r,e.series),q8(t,n,e.series.length,e.chartType)),Em(e.categories,iI(r))||G8(t,r,e.categories),e.chartType!==eI(n)&&sI(n,e.chartType),Em(e.presentation,tI(n))||lI(n,e.presentation),{datadescription:(0,tn.serializeNode)(r),presentationdescription:(0,tn.serializeNode)(n)}}function X2(e){return!!e&&(e.c.length>0||e.a.length>0)}function q8(e,t,r,n){let i,a=t.childNodes;for(let l=0;l<a.length;l+=1)if(a[l].nodeType===1&&a[l].tagName==="Series"){i=a[l];break}i||(i=e.createElement("Series"),t.insertBefore(i,t.firstChild));let o=[],s=i.childNodes;for(let l=0;l<s.length;l+=1)s[l].nodeType===1&&s[l].tagName==="Series"&&o.push(s[l]);for(let l=o.length;l<r;l+=1){let u=e.createElement("Series");u.setAttribute("ChartType",n),i.appendChild(u)}for(let l=r;l<o.length;l+=1)i.removeChild(o[l])}function Y2(e,t,r){let n={n:t,a:(0,Cm.mergeAttrs)(e.a,[]),c:(0,Cm.spliceChildren)(e.c,[])};return(0,Cm.rebuildRaw)(n,(0,tn.domEngine)(r),null)}function V8(e,t,r){let n=Lu(t),i=n?.getElementsByTagName("entity")[0];!n||!i||aI(e,t,i,K8(n),r,Y8,{aliasPrefix:"aggregate_column",addRef:H8,removeRef:J8})}function G8(e,t,r){let n=Lu(t),i=n?.getElementsByTagName("entity")[0];!n||!i||aI(e,t,i,X8(n),r,Z8,{aliasPrefix:"groupby_column",addRef:j8,removeRef:Q8})}function aI(e,t,r,n,i,a,o){let s=new Map;for(let p of n){let f=p.getAttribute("alias");f&&s.set(f,p)}let l=new Set,u=[];for(let p of i){let f=p.alias?s.get(p.alias):void 0;f&&!l.has(f)?(a(f,p),l.add(f)):u.push(p)}let c=n.filter(p=>!l.has(p)),d=0;for(let p of u)if(d<c.length){let f=c[d];a(f,p),l.add(f),d+=1}else{let f=e.createElement("attribute"),h=p.alias||W8(t,o.aliasPrefix);f.setAttribute("alias",h),a(f,p),eG(e,r,f,p.relatedEntity),o.addRef(e,t,h)}for(let p of n)if(!l.has(p)){let f=p.getAttribute("alias");f&&o.removeRef(t,f),rG(p)}}function z8(e){let t=new Set;for(let r of["attribute","measure","category"]){let n=e.getElementsByTagName(r);for(let i=0;i<n.length;i+=1){let a=n[i].getAttribute("alias");a&&t.add(a)}}return t}function W8(e,t){let r=z8(e);if(!r.has(t))return t;for(let n=2;;n+=1){let i=`${t}_${n}`;if(!r.has(i))return i}}function oI(e,t){let r=t.getElementsByTagName("categorycollection")[0];if(r)return r;let n=e.createElement("categorycollection");return t.appendChild(n),n}function H8(e,t,r){let n=oI(e,t),i=n.getElementsByTagName("category")[0];i||(i=e.createElement("category"),n.appendChild(i));let a=e.createElement("measurecollection"),o=e.createElement("measure");o.setAttribute("alias",r),a.appendChild(o),i.appendChild(a)}function j8(e,t,r){let n=oI(e,t),i=e.createElement("category");i.setAttribute("alias",r),n.appendChild(i)}function Q8(e,t){let r=e.getElementsByTagName("category");for(let n=0;n<r.length;n+=1)r[n].getAttribute("alias")===t&&r[n].removeAttribute("alias")}function J8(e,t){var r;let n=e.getElementsByTagName("measure"),i=[];for(let a=0;a<n.length;a+=1)n[a].getAttribute("alias")===t&&i.push(n[a]);for(let a of i){let o=a.parentNode;o?.removeChild(a),o&&o.tagName==="measurecollection"&&!iG(o)&&((r=o.parentNode)===null||r===void 0||r.removeChild(o))}}function K8(e){let t=[],r=e.getElementsByTagName("attribute");for(let n=0;n<r.length;n+=1)r[n].getAttribute("aggregate")&&t.push(r[n]);return t}function X8(e){var t;let r=[],n=e.getElementsByTagName("attribute");for(let i=0;i<n.length;i+=1)((t=n[i].getAttribute("groupby"))!==null&&t!==void 0?t:"").toLowerCase()==="true"&&r.push(n[i]);return r}function Y8(e,t){e.setAttribute("name",t.attribute),e.setAttribute("aggregate",t.aggregate),t.seriesType&&e.setAttribute("charttype",t.seriesType)}function Z8(e,t){e.setAttribute("name",t.attribute),e.setAttribute("groupby","true"),t.dateGrouping?e.setAttribute("dategrouping",t.dateGrouping):e.getAttribute("dategrouping")!==null&&e.removeAttribute("dategrouping")}function eG(e,t,r,n){n?tG(e,t,n).appendChild(r):t.appendChild(r)}function tG(e,t,r){let n=t.getElementsByTagName("link-entity");for(let a=0;a<n.length;a+=1)if(n[a].getAttribute("name")===r)return n[a];let i=e.createElement("link-entity");return i.setAttribute("name",r),t.appendChild(i),i}function rG(e){let t=e.parentNode;if(t&&(t.removeChild(e),t.tagName==="link-entity"&&!nG(t))){let r=t.parentNode;r&&r.removeChild(t)}}function nG(e){let t=e.childNodes;for(let r=0;r<t.length;r+=1){let n=t[r];if(n.nodeType===1){let i=n.tagName;if(i==="attribute"||i==="link-entity")return!0}}return!1}function iG(e){let t=e.childNodes;for(let r=0;r<t.length;r+=1)if(t[r].nodeType===1)return!0;return!1}function sI(e,t){let r=e.getElementsByTagName("Series"),n=!1;for(let i=0;i<r.length;i+=1)r[i].getAttribute("ChartType")&&(r[i].setAttribute("ChartType",t),n=!0);if(!n){for(let i=0;i<r.length;i+=1)if(!aG(r[i])){r[i].setAttribute("ChartType",t);return}}}function aG(e){let t=e.childNodes;for(let r=0;r<t.length;r+=1){let n=t[r];if(n.nodeType===1&&n.tagName==="Series")return!0}return!1}function lI(e,t){var r;let n=e.ownerDocument;if(t.palette!==void 0&&e.setAttribute("Palette",t.palette),t.showLegend!==void 0){let i=[],a=e.getElementsByTagName("Legends");for(let o=0;o<a.length;o+=1)i.push(a[o]);if(t.showLegend&&i.length===0){let o=n.createElement("Legends"),s=n.createElement("Legend");s.setAttribute("Name","Default"),o.appendChild(s),e.appendChild(o)}else if(!t.showLegend)for(let o of i)(r=o.parentNode)===null||r===void 0||r.removeChild(o)}if(t.title!==void 0){let i=e.getElementsByTagName("Title")[0];i&&(i.textContent=t.title)}}function oG(e){let t=(0,tn.parseXmlRoot)(M8(),"<Chart/>");return sI(t,e.chartType),lI(t,e.presentation),(0,tn.serializeNode)(t)}function Em(e,t){return JSON.stringify(e)===JSON.stringify(t)}function ss(e){return String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function sG(){return{adapter:new xu,api:F8.chartApi,publish:(e,t,r)=>(0,J2.publishBoundEntity)(e,r),publishScope:(e,t)=>(0,J2.boundEntityPublishScope)(t)}}Ta.chartRegistration=sG});var cI=g(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.dashboardApi=void 0;var lG=er(),Xt=be(),ls=ie(),uG="formid,name,description,formxml,type,objecttypecode,istabletenabled,iscustomizable,componentstate,versionnumber",cG="formid,name,type,objecttypecode",dG=0,pG=10;ku.dashboardApi={async get(e,t){let n=`/systemforms(${(0,ls.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,ls.odataQuery)([["$select",uG]]),i=(0,Xt.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,Xt.readEtag)(i)}},async list(e,t){let r=[`(type eq ${dG} or type eq ${pG})`];t?.entityLogicalName&&r.push(`objecttypecode eq '${(0,ls.odataLiteral)(t.entityLogicalName)}'`);let n=`/systemforms${(0,ls.odataQuery)([["$select",cG],["$filter",r.join(" and ")]])}`;return(await(0,lG.collectPages)(e,n,"listArtifacts('dashboard')")).map(a=>{var o,s;return{type:"dashboard",id:(o=a.formid)!==null&&o!==void 0?o:"",name:(s=a.name)!==null&&s!==void 0?s:"",entityLogicalName:a.objecttypecode,isDirty:!1}})},async create(e,t,r){let n=t,i=(0,Xt.echoWrite)("formid"),a=`/systemforms${i.query}`,o={name:n.name,description:n.description,formxml:n.formxml,istabletenabled:n.istabletenabled,type:n.type};n.objecttypecode&&(o.objecttypecode=n.objecttypecode);let s=(0,Xt.ensureSuccess)(await e.post(a,(0,Xt.withClientMintedId)(o,"formid",r),i.options),e.apiUrl(a));return{id:(0,Xt.resolveCreatedId)(s,"formid","dashboard",r),etag:(0,Xt.readEtag)(s)}},async update(e,t,r,n){let i=r,a=(0,ls.normalizeGuid)(t,"id"),o=(0,Xt.echoWrite)("formid",{"If-Match":(0,Xt.requireEtag)(n,"dashboard",a)}),s=`/systemforms(${a})${o.query}`,l=(0,Xt.ensureSuccess)(await e.patch(s,{name:i.name,description:i.description,formxml:i.formxml,istabletenabled:i.istabletenabled},o.options),e.apiUrl(s));return{id:a,etag:(0,Xt.readEtag)(l)}},delete(e,t){return(0,Xt.deleteRecord)(e,"systemforms",t)}}});var CI=g(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.dashboardRegistration=Tr.TILE_CLASS_ID=Tr.DashboardAdapter=void 0;var cs=yn(),Yt=Hn(),Nm=rr(),us=Ir(),fG=cI(),Dm=Rn(),fi=ct(),gI=ie(),vI=Ci(),dI="0",Im="10",mG=new Map([["{E7A81278-8635-4D9E-8D4D-59480B391C5B}","chart"],["{FD2A7985-3187-444E-908D-6624B21F69C0}","iframe"],["{9FDF5F91-88B1-47F4-AD53-C11EFC01A01D}","webresource"],["{EE9078C8-6946-4E2C-B8F8-35E65F4BE6A8}","stream"],["{06375649-C143-495E-A496-C962E5B4488E}","timeline"],["{8C54228C-1B25-4909-A12A-F2B968BB0D62}","powerbi"],["{F9A8A302-114E-466A-B582-6771B2AE0D92}","assistant"]]),hG="{3FF9A528-DD50-4ACA-8F10-2E5ED73513AD}",Bu=class{constructor(t=vI.DEFAULT_LCID){this.lcid=t}toArtifact(t){var r,n,i,a;(0,Dm.installDomShim)();let o=(r=t.formxml)!==null&&r!==void 0?r:"",s=(0,Yt.parseXmlRoot)(o,"<form/>");return{id:(n=t.formid)!==null&&n!==void 0?n:"",name:(i=t.name)!==null&&i!==void 0?i:"",description:(a=t.description)!==null&&a!==void 0?a:"",dashboardType:gG(t.type),entityLogicalName:t.objecttypecode?t.objecttypecode:null,enabledForMobile:!!t.istabletenabled,layoutType:vG(s),components:pI(s,this.lcid),bag:(0,Yt.projectElementBag)(s)}}fromArtifact(t){var r;return(0,Dm.installDomShim)(),{formid:t.id,name:t.name,description:t.description,type:t.dashboardType==="Interactive"?Im:dI,objecttypecode:(r=t.entityLogicalName)!==null&&r!==void 0?r:"",istabletenabled:t.enabledForMobile,formxml:fI(t,this.lcid)}}fromApiResponse(t){return this.toArtifact(t??{})}toApiPayload(t){return{name:t.name,description:t.description,formxml:fI(t,this.lcid),istabletenabled:t.enabledForMobile,type:t.dashboardType==="Interactive"?Im:dI,objecttypecode:t.entityLogicalName}}createDefault(t){var r,n,i,a,o,s,l,u;(0,Dm.installDomShim)();let c=(0,Yt.parseXmlRoot)(PG(),"<form/>");return{id:(r=t.id)!==null&&r!==void 0?r:(0,fi.newId)(),name:(n=t.name)!==null&&n!==void 0?n:"New Dashboard",description:(i=t.description)!==null&&i!==void 0?i:"",dashboardType:(a=t.dashboardType)!==null&&a!==void 0?a:"Standard",entityLogicalName:(o=t.entityLogicalName)!==null&&o!==void 0?o:null,enabledForMobile:(s=t.enabledForMobile)!==null&&s!==void 0?s:!1,layoutType:(l=t.layoutType)!==null&&l!==void 0?l:0,components:(u=t.components)!==null&&u!==void 0?u:pI(c,this.lcid),bag:(0,Yt.projectElementBag)(c)}}assignMissingIds(t){if(t&&typeof t=="object"&&!Array.isArray(t)&&"position"in t&&!("components"in t)){let r=t;(typeof r.id!="string"||r.id.length===0)&&(r.id=(0,fi.newId)())}return t}validate(t){let r=[],n=(0,us.childObjects)(t,"components","","component",r),i=new Set;return n.forEach(({node:a,index:o})=>{let s=`/components/${o}`;for(let l of["position","parameters"]){let u=a[l];u!==void 0&&!(0,us.isJsonObject)(u)&&r.push((0,us.issue)(`${s}/${l}`,`component-${l}-must-be-object`,`a component ${l} must be a JSON object when present, got ${u===null?"null":typeof u}`))}if((0,us.isJsonObject)(a.position)){let l=ds(a.position);i.has(l)?r.push((0,us.issue)(`${s}/position`,"component-position-collision",`two components occupy the same dashboard position (${l}); move one to a free cell`)):i.add(l)}}),r}};Tr.DashboardAdapter=Bu;function gG(e){return String(e??"")===Im?"Interactive":"Standard"}function vG(e){var t;let r=(t=e?.getAttribute("formLayout"))!==null&&t!==void 0?t:e?.getAttribute("layoutType"),n=parseInt(r??"",10);return Number.isNaN(n)?0:n}function K(e,t){let r=[],n=e.childNodes;for(let i=0;i<n.length;i+=1){let a=n[i];a.nodeType===1&&a.tagName.toLowerCase()===t&&r.push(a)}return r}function pI(e,t){let r=[];return K(e,"tabs").flatMap(i=>K(i,"tab")).forEach((i,a)=>{K(i,"columns").flatMap(s=>K(s,"column")).forEach((s,l)=>{K(s,"sections").flatMap(c=>K(c,"section")).forEach((c,d)=>{yG(c,{tabIndex:a,columnIndex:l,sectionIndex:d},r,t)})})}),r}function yG(e,t,r,n){K(e,"rows").flatMap(a=>K(a,"row")).forEach((a,o)=>{K(a,"cell").forEach((s,l)=>{let u=bG(s,{...t,rowIndex:o,cellIndex:l},n);u&&r.push(u)})})}function bG(e,t,r){var n,i,a;let o=wI((n=e.getAttribute("id"))!==null&&n!==void 0?n:"");if(o.toLowerCase().startsWith("spacer"))return null;let s=K(e,"control")[0];if(!s)return null;let l=(i=s.getAttribute("classid"))!==null&&i!==void 0?i:"",u=CG(s),c=SG(l,u,s),d=wG(s);return{id:(a=s.getAttribute("id"))!==null&&a!==void 0?a:o,type:c,name:bI(e,r),classId:l,position:t,colspan:_m(e,"colspan",1),rowspan:_m(e,"rowspan",1),parameters:u,bag:(0,Yt.projectElementBag)(e),...d?{icProperties:d}:{}}}function yI(e){let t=e.childNodes;for(let r=0;r<t.length;r+=1){let n=t[r];if(n.nodeType===1&&n.tagName.toLowerCase()==="icproperties")return n}}function wG(e){let t=yI(e);return t?(0,Yt.serializeNode)(t):void 0}function AG(e,t,r){let n=yI(t);if(!r){n&&t.removeChild(n);return}let i=new DOMParser().parseFromString(r,"text/xml").documentElement,a=(0,cs.rebuildRaw)((0,cs.rawFromNode)((0,Yt.nodeLikeFromDom)(i)),(0,Yt.domEngine)(e),null);n&&(0,Yt.serializeNode)(n)===(0,Yt.serializeNode)(a)||(n?t.replaceChild(a,n):t.appendChild(a))}function bI(e,t){var r,n;let i=K(e,"labels")[0];if(!i)return"";let a=K(i,"label"),o=(r=a.find(s=>s.getAttribute("languagecode")===String(t)))!==null&&r!==void 0?r:a[0];return(n=o?.getAttribute("description"))!==null&&n!==void 0?n:""}function CG(e){var t;let r={},n=K(e,"parameters")[0];if(!n)return r;let i=n.childNodes;for(let a=0;a<i.length;a+=1){let o=i[a];o.nodeType===1&&(r[o.tagName]=((t=o.textContent)!==null&&t!==void 0?t:"").trim())}return r}function SG(e,t,r){var n;let i=mG.get(e.toUpperCase());return i?i==="chart"?t.ChartGridMode==="Chart"?"chart":"list":i==="assistant"&&((n=r.getAttribute("uniqueid"))!==null&&n!==void 0?n:"").toUpperCase()===hG?"assistant":i:"unknown"}function _m(e,t,r){var n;let i=parseInt((n=e.getAttribute(t))!==null&&n!==void 0?n:"",10);return Number.isNaN(i)?r:i}function wI(e){return e.replace(/^\{/,"").replace(/\}$/,"")}function EG(e,t){let r={n:"form",a:(0,cs.mergeAttrs)(e.bag.a,[]),c:(0,cs.spliceChildren)(e.bag.c,[])};return(0,cs.rebuildRaw)(r,(0,Yt.domEngine)(t),null)}function fI(e,t){let r=new DOMParser().parseFromString("<root/>","text/xml"),n=EG(e,r);return IG(r,n,e.components,t),NG(r,n,e.components,t),(0,Yt.serializeNode)(n)}function NG(e,t,r,n){let i=AI(t);for(let a of r)i.has(ds(a.position))||DG(e,t,a,n)}function DG(e,t,r,n){var i,a,o,s;let l=(a=(i=r.position)===null||i===void 0?void 0:i.sectionIndex)!==null&&a!==void 0?a:0,u=OG(t,e,l);for(let z of K(u,"row"))K(z,"cell").some($=>K($,"control").length>0)||u.removeChild(z);let c=r.classId||Tr.TILE_CLASS_ID[r.type]||Tr.TILE_CLASS_ID.iframe,d=r.rowspan&&r.rowspan>0?r.rowspan:4,p=r.bag&&mI(r.bag,"id")?String(mI(r.bag,"id")):Mu((0,fi.newId)()),f=r.id?Mu(r.id):Mu((0,fi.newId)()),h=u.parentNode,v=Math.max(1,parseInt(h&&h.getAttribute&&h.getAttribute("columns")||"1",10)||1),w=Math.min(Math.max(1,r.colspan&&r.colspan>0?r.colspan:1),v),E=K(u,"row"),D=E[E.length-1],x=D?K(D,"cell").reduce((z,$)=>z+_m($,"colspan",1),0):0;(!D||x+w>v)&&(D=e.createElement("row"),u.appendChild(D));let F=e.createElement("cell");F.setAttribute("id",p),F.setAttribute("colspan",String(w)),F.setAttribute("rowspan",String(d)),F.setAttribute("showlabel","true");let j=e.createElement("labels"),L=e.createElement("label");L.setAttribute("description",(o=r.name)!==null&&o!==void 0?o:""),L.setAttribute("languagecode",String(n)),j.appendChild(L),F.appendChild(j);let V=e.createElement("control");V.setAttribute("id",f),V.setAttribute("classid",Mu(c));let B=e.createElement("parameters"),U=(s=r.parameters)!==null&&s!==void 0?s:{};for(let z of Object.keys(U)){let $=(0,gI.createSafeXmlElement)(e,z,"dashboard tile parameter");$.textContent=U[z],B.appendChild($)}V.appendChild(B),F.appendChild(V),D.appendChild(F)}function mI(e,t){if(!e)return;let r=e.a.find(n=>n[0]===t);return r?r[1]:void 0}function IG(e,t,r,n){var i;let a=AI(t),o=new Set(r.map(s=>ds(s.position)));for(let s of r){let l=a.get(ds(s.position));if(!l)continue;let u=K(l,"control")[0];u&&(_G(e,l,s.name,n),TG(e,u,s.parameters),hI(l,"colspan",s.colspan),hI(l,"rowspan",s.rowspan),s.icProperties!==void 0&&AG(e,u,s.icProperties))}for(let[s,l]of a)o.has(s)||(i=l.parentNode)===null||i===void 0||i.removeChild(l)}function AI(e){let t=new Map;return K(e,"tabs").flatMap(n=>K(n,"tab")).forEach((n,i)=>{K(n,"columns").flatMap(o=>K(o,"column")).forEach((o,s)=>{K(o,"sections").flatMap(u=>K(u,"section")).forEach((u,c)=>{K(u,"rows").flatMap(p=>K(p,"row")).forEach((p,f)=>{K(p,"cell").forEach((h,v)=>{var w;wI((w=h.getAttribute("id"))!==null&&w!==void 0?w:"").toLowerCase().startsWith("spacer")||K(h,"control")[0]&&t.set(ds({tabIndex:i,columnIndex:s,sectionIndex:c,rowIndex:f,cellIndex:v}),h)})})})})}),t}function ds(e){let t=e??{};return`${t.tabIndex}.${t.columnIndex}.${t.sectionIndex}.${t.rowIndex}.${t.cellIndex}`}function _G(e,t,r,n){if(r===bI(t,n))return;let i=K(t,"labels")[0];i||(i=e.createElement("labels"),t.appendChild(i));let a=K(i,"label").find(o=>o.getAttribute("languagecode")===String(n));a||(a=e.createElement("label"),a.setAttribute("languagecode",String(n)),i.appendChild(a)),a.setAttribute("description",r)}function TG(e,t,r){var n;if(!r)return;let i=Object.keys(r);if(i.length===0)return;let a=K(t,"parameters")[0];a||(a=e.createElement("parameters"),t.appendChild(a));let o=new Map,s=a.childNodes;for(let l=0;l<s.length;l+=1){let u=s[l];u.nodeType===1&&o.set(u.tagName,u)}for(let l of i){let u=r[l],c=o.get(l);if(c)((n=c.textContent)!==null&&n!==void 0?n:"")!==u&&(c.textContent=u);else{let d=(0,gI.createSafeXmlElement)(e,l,"dashboard component parameter");d.textContent=u,a.appendChild(d)}}}function hI(e,t,r){var n;((n=e.getAttribute(t))!==null&&n!==void 0?n:"")!==String(r)&&e.setAttribute(t,String(r))}function PG(e=2){let t=`{${(0,fi.newId)()}}`,r=`{${(0,fi.newId)()}}`,n=`{${(0,fi.newId)()}}`,i=Math.max(1,Math.floor(e));return`<form><tabs><tab id="${t}" name="General" showlabel="true" expanded="true" verticallayout="true"><columns><column width="100%"><sections><section id="${r}" name="Section 1" showlabel="false" columns="${i}"><rows><row><cell id="${n}" rowspan="12" colspan="${i}" showlabel="true" /></row></rows></section></sections></column></columns></tab></tabs></form>`}Tr.TILE_CLASS_ID={chart:"E7A81278-8635-4D9E-8D4D-59480B391C5B",list:"E7A81278-8635-4D9E-8D4D-59480B391C5B",iframe:"FD2A7985-3187-444E-908D-6624B21F69C0",webresource:"9FDF5F91-88B1-47F4-AD53-C11EFC01A01D"};function Mu(e){return`{${e.replace(/[{}]/g,"")}}`}function OG(e,t,r){var n;let i=K(e,"tabs").flatMap(u=>K(u,"tab"))[0];if(!i)throw new Error("addDashboardTile: dashboard formxml has no <tab>");let a=K(i,"columns").flatMap(u=>K(u,"column"))[0];if(!a)throw new Error("addDashboardTile: dashboard formxml has no <column>");let o=K(a,"sections").flatMap(u=>K(u,"section")),s=(n=o[r])!==null&&n!==void 0?n:o[0];if(!s)throw new Error("addDashboardTile: dashboard formxml has no <section>");let l=K(s,"rows")[0];return l||(l=t.createElement("rows"),s.appendChild(l)),l}function RG(e=vI.DEFAULT_LCID){return{adapter:new Bu(e),api:fG.dashboardApi,languageSensitive:!0,publish:(t,r,n)=>n?.entityLogicalName?(0,Nm.publishBoundEntity)(t,n):(0,Nm.publishDashboardById)(t,r),publishScope:(t,r)=>r?.entityLogicalName?(0,Nm.boundEntityPublishScope)(r):{envelope:"dashboard",targetIds:[t]}}}Tr.dashboardRegistration=RG});var _I=g(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});qu.genPageApi=void 0;var II=er(),De=be(),Ot=ie(),Uu=Kc(),Pr=ne();function FG(e){let t=globalThis;return t.Buffer?t.Buffer.isBuffer(e):!1}var Un="uxagentprojects",Oa="uxagentprojectfiles",Pa="uxagentprojectid",Or="uxagentprojectfileid",$u=`${Pa},name`,xG=`${Or},filename,filetype`;async function Tm(e,t,r,n){var i;let a=`/${t}(${r})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Ot.odataQuery)([["$select",n]]),o=(0,De.ensureSuccess)(await e.get(a),e.apiUrl(a));return{row:(i=o.body)!==null&&i!==void 0?i:{},etag:(0,De.readEtag)(o)}}async function LG(e,t){let r=`/${Oa}(${t})/filecontent/$value`,n=await e.get(r);if(n.status===404)return{status:"unavailable",reason:"unpublished"};(0,De.ensureSuccess)(n,e.apiUrl(r));let i=n.body;if(i instanceof Uint8Array||FG(i))return{status:"available",data:(0,Uu.bytesToBase64)(i)};if(i instanceof ArrayBuffer)return{status:"available",data:(0,Uu.bytesToBase64)(new Uint8Array(i))};if(typeof i=="string")return{status:"available",data:(0,Uu.utf8ToBase64)(i)};throw new Pr.SdkError("GENPAGE_CONTENT_UNREADABLE",`Read the content of file '${t}' but the injected HttpClient returned a body this SDK cannot encode (${typeof i}). Return the response as a string, Uint8Array, Buffer, or ArrayBuffer; a byte-returning transport is required to round-trip non-UTF8 assets.`)}async function kG(e,t,r,n){if(!e.supportsBinaryPatch)throw new Pr.SdkError("GENPAGE_CONTENT_WRITE_UNSUPPORTED",`Refusing to push generative-page file '${t}': its content cannot be written because the injected HttpClient does not implement patchRaw(). A Dataverse File column is not writable through a JSON body, so saving the row without its bytes would report success for a page whose source never uploaded.`);let i=`/${Oa}(${t})/filecontent`,a=(0,Uu.base64ToBytes)(n);(0,Ot.assertNoControlChars)(r,"generative-page file name"),(0,De.ensureSuccess)(await e.patchRaw(i,a,{headers:{"Content-Type":"application/octet-stream","Content-Length":String(a.byteLength),"x-ms-file-name":r}}),e.apiUrl(i))}async function Pm(e,t){let r=`/${Oa}/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()`+(0,Ot.odataQuery)([["$select",xG],["$filter",`_${Pa}_value eq ${t}`]]);return(await(0,II.collectPages)(e,r,"fetchArtifact('genPage')")).map(i=>({row:i,etag:typeof i["@odata.etag"]=="string"?i["@odata.etag"]:null}))}async function SI(e,t,r){var n;let{etag:i}=await Tm(e,Un,t,$u),a={};for(let{row:l,etag:u}of await Pm(e,t))a[(0,Ot.normalizeGuid)(String((n=l[Or])!==null&&n!==void 0?n:""),Or)]=u;let o=Object.keys(a),s=!i||o.length!==r.size||o.some(l=>!r.has(l))||Object.values(a).some(l=>!l);return{etag:i,memberEtags:a,mismatch:s}}function EI(e,t){return t.mismatch?{etag:null,memberEtags:{},warnings:[`Generative page '${e}' was written, but its files changed on the server while the write was in progress, so the new concurrency tokens cannot be trusted. The local baseline is now unusable: re-fetch the page before editing it again \u2014 the next push will refuse rather than overwrite blind.`]}:{etag:t.etag,memberEtags:t.memberEtags}}qu.genPageApi={async get(e,t){var r;let n=(0,Ot.normalizeGuid)(t,"id"),{row:i,etag:a}=await Tm(e,Un,n,$u),o=await Pm(e,n),s={},l=[];for(let{row:u,etag:c}of o){let d=(0,Ot.normalizeGuid)(String((r=u[Or])!==null&&r!==void 0?r:""),Or);s[d]=c;let p=await LG(e,d);l.push({...u,content:p})}return{raw:{project:i,files:l},etag:a,memberEtags:s}},async list(e,t){let r=`/${Un}/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()`+(0,Ot.odataQuery)([["$select",$u]]);return(await(0,II.collectPages)(e,r,"listArtifacts('genPage')")).map(i=>{var a,o;return{type:"genPage",id:String((a=i[Pa])!==null&&a!==void 0?a:""),name:String((o=i.name)!==null&&o!==void 0?o:""),isDirty:!1}})},async create(e,t,r){let n=t;NI(e,n);let i=`/${Un}`,a=(0,De.ensureSuccess)(await e.post(i,(0,De.withClientMintedId)({name:n.name},Pa,r)),e.apiUrl(i)),o=(0,De.resolveCreatedId)(a,Pa,"generative page",r),s=new Set;for(let l of n.files){let u=await DI(e,o,l,!0);s.add((0,Ot.normalizeGuid)(u.id,"file id"))}try{return{id:o,...EI(o,await SI(e,o,s))}}catch(l){return{id:o,etag:null,memberEtags:{},warnings:[`The generative page was created, but re-reading its concurrency tokens failed (${l instanceof Error?l.message:String(l)}). The local baseline is unusable: re-fetch the page before editing it \u2014 the next push will refuse rather than overwrite blind.`]}}},async update(e,t,r,n,i){let a=r,o=(0,Ot.normalizeGuid)(t,"id");NI(e,a);let s=await Pm(e,o),{etag:l}=await Tm(e,Un,o,$u);if(n&&l&&n!==l)throw new Pr.SdkError(De.VERSION_CONFLICT_CODE,`Generative page '${o}' changed on the server after it was fetched (baseline ${n}, server ${l}) \u2014 another writer edited it. A page row accepts no If-Match validator, so this push would silently overwrite them. Re-fetch the page and re-apply the edit.`);if(!n||!l)throw new Pr.SdkError(De.VERSION_CONFLICT_CODE,`Cannot verify generative page '${o}' before writing: ${n?"the server did not return the page's current token":"no baseline token was recorded"}. This entity accepts no If-Match validator, so an unverified write would silently overwrite any concurrent edit. Re-fetch the page and retry.`);let u=new Set(s.map(({row:f})=>{var h;return(0,Ot.normalizeGuid)(String((h=f[Or])!==null&&h!==void 0?h:""),Or)})),c=new Set(a.files.map(f=>(0,Ot.normalizeGuid)(f.id,"file id")));if(!i)throw new Pr.SdkError(De.VERSION_CONFLICT_CODE,`Cannot verify the files of generative page '${o}' before writing: no child baseline was recorded. These rows accept no If-Match validator, so an unverified write would silently overwrite any concurrent edit. Re-fetch the page and retry.`);let d=new Set(Object.keys(i).map(f=>f.toLowerCase()));{for(let h of c)if(!u.has(h)&&d.has(h))throw new Pr.SdkError(De.VERSION_CONFLICT_CODE,`Generative-page file '${h}' existed when this page was fetched but is gone from the server now \u2014 another writer deleted it. Refusing to recreate it, because a blind re-create would undo that delete and, for an unpublished page, restore the row WITHOUT its content. Re-fetch the page and re-apply the edit.`);for(let h of u)if(!d.has(h))throw new Pr.SdkError(De.VERSION_CONFLICT_CODE,`Generative-page file '${h}' is on the server but absent from this page's baseline \u2014 another writer added it after the page was fetched, so its contents cannot be verified. Refusing to write over or delete it. Re-fetch the page so the addition is part of your baseline.`);let f=new Map(s.map(({row:h,etag:v})=>{var w;return[(0,Ot.normalizeGuid)(String((w=h[Or])!==null&&w!==void 0?w:""),Or),v]}));for(let[h,v]of Object.entries(i??{})){let w=h.toLowerCase();if(!u.has(w))continue;let E=f.get(w);if(!v||!E)throw new Pr.SdkError(De.VERSION_CONFLICT_CODE,`Cannot verify generative-page file '${w}' before writing: ${v?"the server did not return its current token":"no baseline token was recorded"}. A file row accepts no If-Match validator, so an unverified write would silently overwrite any concurrent edit. Re-fetch the page and retry.`);if(v!==E)throw new Pr.SdkError(De.VERSION_CONFLICT_CODE,`Generative-page file '${w}' changed on the server after this page was fetched (baseline ${v}, server ${E}) \u2014 another writer edited it. A file row accepts no If-Match validator, so this push would silently overwrite that change. Re-fetch the page and re-apply the edit.`)}}let p=`/${Un}(${o})`;(0,De.ensureSuccess)(await e.patch(p,{name:a.name},{headers:{"If-Match":"*"}}),e.apiUrl(p));for(let f of a.files){let h=(0,Ot.normalizeGuid)(f.id,"file id");await DI(e,o,f,!u.has(h))}for(let f of u)c.has(f)||await(0,De.deleteRecord)(e,Oa,f);try{return{id:o,...EI(o,await SI(e,o,c))}}catch(f){return{id:o,etag:null,memberEtags:{},warnings:[`The generative page was written, but re-reading its concurrency tokens failed (${f instanceof Error?f.message:String(f)}). The local baseline is now unusable: re-fetch the page before editing it again \u2014 the next push will refuse rather than overwrite blind.`]}}},delete(e,t){return(0,De.deleteRecord)(e,Un,t)}};function NI(e,t){var r;if(((r=t.files)!==null&&r!==void 0?r:[]).some(i=>i.content.status==="available")&&!e.supportsBinaryPatch)throw new Pr.SdkError("GENPAGE_CONTENT_WRITE_UNSUPPORTED","Refusing to write this generative page: it has file content to upload, but the injected HttpClient does not implement patchRaw(). A Dataverse File column is not writable through a JSON body, so proceeding would create the page and its rows and then fail, leaving a page whose source never uploaded.")}async function DI(e,t,r,n){let i=(0,Ot.normalizeGuid)(r.id,"file id"),a;if(n){let o=`/${Oa}`,s=(0,De.ensureSuccess)(await e.post(o,(0,De.withClientMintedId)({filename:r.name,filetype:r.fileType,[`${Pa}@odata.bind`]:`/${Un}(${t})`},Or,i)),e.apiUrl(o));a=(0,De.readEtag)(s)}else{let o=`/${Oa}(${i})`,s=(0,De.ensureSuccess)(await e.patch(o,{filename:r.name,filetype:r.fileType},{headers:{"If-Match":"*"}}),e.apiUrl(o));a=(0,De.readEtag)(s)}return r.content.status==="available"&&await kG(e,i,r.name,r.content.data),{id:i,etag:a}}});var RI=g(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});Fa.genPageRegistration=Fa.GenPageAdapter=void 0;var MG=_I(),BG=rr(),$n=Ir(),OI=ct(),TI=2e8;function PI(e){return typeof e=="string"&&e.trim()!==""?e:(0,OI.newId)()}function Ra(e){return(0,$n.isJsonObject)(e)?e:{}}function UG(e){let t=Ra(e);return t.status==="available"&&typeof t.data=="string"?{status:"available",data:t.data}:{status:"unavailable",reason:"unpublished"}}var Vu=class{toArtifact(t){return t}fromArtifact(t){return t}fromApiResponse(t){var r,n;let i=t,a=Ra(i?.project),o=Array.isArray(i?.files)?i.files:[];return{id:String((r=a.uxagentprojectid)!==null&&r!==void 0?r:""),name:String((n=a.name)!==null&&n!==void 0?n:""),files:o.map(s=>{var l,u,c;let d=Ra(s);return{id:String((l=d.uxagentprojectfileid)!==null&&l!==void 0?l:""),name:String((u=d.filename)!==null&&u!==void 0?u:""),fileType:Number((c=d.filetype)!==null&&c!==void 0?c:TI),content:UG(d.content)}})}}toApiPayload(t){var r;return{name:t.name,files:((r=t.files)!==null&&r!==void 0?r:[]).map(n=>({id:n.id,name:n.name,fileType:n.fileType,content:n.content}))}}createDefault(t){var r,n;return{id:PI(t.id),name:(r=t.name)!==null&&r!==void 0?r:"New page",files:((n=t.files)!==null&&n!==void 0?n:[]).map(i=>{var a,o,s;return{id:PI(i.id),name:(a=i.name)!==null&&a!==void 0?a:"index.tsx",fileType:(o=i.fileType)!==null&&o!==void 0?o:TI,content:(s=i.content)!==null&&s!==void 0?s:{status:"available",data:""}}})}}assignMissingIds(t){let r=Ra(t);return(typeof r.id!="string"||r.id.trim()==="")&&(r.id=(0,OI.newId)()),r}validate(t){let r=[],n=t.files;if(n!==void 0&&!Array.isArray(n))return r.push((0,$n.issue)("/files","files-must-be-array",`files must be an array, got ${typeof n}`)),r;let i=new Map;return(Array.isArray(n)?n:[]).forEach((a,o)=>{let s=`/files/${o}`,l=Ra(a),u=typeof l.id=="string"?l.id.trim().toLowerCase():"";if(u==="")r.push((0,$n.issue)(s,"file-id-required","a generative-page file needs an id"));else{let f=i.get(u);f!==void 0?r.push((0,$n.issue)(s,"file-id-duplicate",`two files share the id '${l.id}' (also at /files/${f}); a file's id is its identity, so a duplicate makes an edit ambiguous`)):i.set(u,o)}let c=typeof l.name=="string"?l.name:"";(c===""||/[\u0000-\u001F\u007F]/.test(c)||/[\\/]/.test(c))&&r.push((0,$n.issue)(s+"/name","file-name-invalid",`a file name must be a non-empty single path segment with no control characters or path separators (it is sent as an HTTP header on upload); got '${c}'`));let d=l.content;if(d===void 0){r.push((0,$n.issue)(s+"/content","file-content-required","content is required: omitting it is indistinguishable from an empty file, and the two have opposite effects on the next push"));return}let p=Ra(d);p.status==="available"?typeof p.data!="string"&&r.push((0,$n.issue)(s+"/content/data","file-content-data-invalid","available content needs base64 `data`")):p.status!=="unavailable"&&r.push((0,$n.issue)(s+"/content/status","file-content-status-invalid",`content.status must be 'available' or 'unavailable', got ${String(p.status)}`))}),r}};Fa.GenPageAdapter=Vu;function $G(){return{adapter:new Vu,api:MG.genPageApi,publish:(e,t)=>(0,BG.publishGenPageById)(e,t),publishScope:e=>({envelope:"uxagentproject",targetIds:[e]})}}Fa.genPageRegistration=$G});var xI=g(zu=>{"use strict";Object.defineProperty(zu,"__esModule",{value:!0});zu.reconcileBpfSecurityRoles=void 0;var Gu=be(),Om=ie(),qG="Global",FI={create:"Create",read:"Read",write:"Write",delete:"Delete"};async function VG(e,t){var r,n;let i=`/EntityDefinitions(LogicalName='${t}')?$select=LogicalName,Privileges`,o=(n=(r=(0,Gu.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)===null||r===void 0?void 0:r.Privileges)!==null&&n!==void 0?n:[],s={},l=new Set;return Object.keys(FI).forEach(u=>{let c=o.find(d=>d.PrivilegeType===FI[u]);if(c){let d=(0,Om.normalizeGuid)(c.PrivilegeId,"PrivilegeId");s[u]=d,l.add(d)}}),{byAccess:s,all:l}}async function GG(e,t){var r,n;let i=`/RetrieveRolePrivilegesRole(RoleId=${t})`,o=(n=(r=(0,Gu.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)===null||r===void 0?void 0:r.RolePrivileges)!==null&&n!==void 0?n:[];return new Set(o.map(s=>(0,Om.normalizeGuid)(s.PrivilegeId,"PrivilegeId")))}async function zG(e,t,r){if(r.length===0)return;let n={Privileges:r.map(a=>({Depth:qG,PrivilegeId:a}))},i=`/roles(${t})/Microsoft.Dynamics.CRM.AddPrivilegesRole`;(0,Gu.ensureSuccess)(await e.post(i,n),e.apiUrl(i))}async function WG(e,t,r){let n={Privilege:{"@odata.type":"Microsoft.Dynamics.CRM.privilege",privilegeid:r}},i=`/roles(${t})/Microsoft.Dynamics.CRM.RemovePrivilegeRole`;(0,Gu.ensureSuccess)(await e.post(i,n),e.apiUrl(i))}async function HG(e,t,r){var n;if(!r||r.length===0)return;let i=await VG(e,t.toLowerCase());for(let a of r){let o=(0,Om.normalizeGuid)(a.roleId,"roleId"),s=new Set(((n=a.access)!==null&&n!==void 0?n:[]).map(p=>i.byAccess[p]).filter(p=>!!p)),l=await GG(e,o),u=new Set([...l].filter(p=>i.all.has(p))),c=[...s].filter(p=>!u.has(p)),d=[...u].filter(p=>!s.has(p));await zG(e,o,c);for(let p of d)await WG(e,o,p)}}zu.reconcileBpfSecurityRoles=HG});var UI=g(Hu=>{"use strict";Object.defineProperty(Hu,"__esModule",{value:!0});Hu.bpfApi=void 0;var qn=Gn(),jG=er(),Zt=be(),Rr=ie(),QG=xI(),Wu={"Content-Type":"application/json",Accept:"application/json"},JG=`category eq ${qn.WorkflowCategory.BusinessProcessFlow} and type eq ${qn.WorkflowTypeCode.Definition} and businessprocesstype eq ${qn.BusinessProcessType.BusinessFlow}`,KG="workflowid,name,description,primaryentity,statecode,category,type,businessprocesstype,processorder",XG="workflowid,name,uniquename,description,primaryentity,statecode,statuscode,category,type,businessprocesstype,processorder,xaml,clientdata",YG=["xaml","name","description","processorder"];async function LI(e,t){var r;if(t.status!=="Active"||!t.securityRoles||t.securityRoles.length===0)return;let n=String((r=t.record.uniquename)!==null&&r!==void 0?r:"");n!==""&&await(0,QG.reconcileBpfSecurityRoles)(e,n,t.securityRoles)}async function Rm(e,t,r){var n;if(r==="Draft")return null;let i=(0,Rr.normalizeGuid)(t,"workflowid"),a={statecode:qn.StateCode.Activated,statuscode:qn.StatusCode.Activated},o=`/workflows(${i})`,s=(0,Zt.ensureSuccess)(await e.patch(o,a,{headers:Wu}),e.apiUrl(o));return(n=(0,Zt.readEtag)(s))!==null&&n!==void 0?n:await BI(e,i)}async function BI(e,t){let r=`/workflows(${t})${(0,Rr.odataQuery)([["$select","workflowid"]])}`,n=await e.get(r);return n.status>=200&&n.status<300?(0,Zt.readEtag)(n):null}async function ZG(e,t){var r;let n=`/workflows(${t})${(0,Rr.odataQuery)([["$select","statecode"]])}`,i=await e.get(n);if(i.status<200||i.status>=300)return null;let a=(r=i.body)===null||r===void 0?void 0:r.statecode;return a==null?null:Number(a)}async function kI(e,t,r){if(await ZG(e,t)!==qn.StateCode.Activated)return!1;let n={statecode:qn.StateCode.Draft,statuscode:qn.StatusCode.Draft},i=`/workflows(${t})`,a={...Wu};return r&&(a["If-Match"]=r),(0,Zt.ensureSuccess)(await e.patch(i,n,{headers:a}),e.apiUrl(i)),!0}async function MI(e,t){try{await Rm(e,t,"Active")}catch{}}function e6(e){let t={};for(let r of YG)e[r]!==void 0&&(t[r]=e[r]);return t}Hu.bpfApi={async get(e,t){let n=`/workflows(${(0,Rr.normalizeGuid)(t,"id")})${(0,Rr.odataQuery)([["$select",XG]])}`,i=(0,Zt.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,Zt.readEtag)(i)}},async list(e,t){let r=[JG];t?.entityLogicalName&&r.push(`primaryentity eq '${(0,Rr.odataLiteral)(t.entityLogicalName)}'`);let n=`/workflows${(0,Rr.odataQuery)([["$select",KG],["$filter",r.join(" and ")]])}`;return(await(0,jG.collectPages)(e,n,"listArtifacts('bpf')")).map(a=>{var o,s;return{type:"bpf",id:(o=a.workflowid)!==null&&o!==void 0?o:"",name:(s=a.name)!==null&&s!==void 0?s:"",entityLogicalName:a.primaryentity,isDirty:!1}})},async create(e,t){let r=t,n=(0,Rr.normalizeGuid)(r.record.workflowid,"workflowid"),i="/workflows",a=(0,Zt.ensureSuccess)(await e.post(i,r.record,{headers:Wu}),e.apiUrl(i)),o=null;try{o=await Rm(e,n,r.status),await LI(e,r)}catch(s){try{await(0,Zt.deleteRecord)(e,"workflows",n)}catch{}throw s}return{id:n,etag:o??(0,Zt.readEtag)(a)}},async update(e,t,r,n){var i;let a=r,o=(0,Rr.normalizeGuid)(t,"id"),s=await kI(e,o,n);try{let l=`/workflows(${o})`,u={...Wu};n&&!s&&(u["If-Match"]=n);let c=(0,Zt.ensureSuccess)(await e.patch(l,e6(a.record),{headers:u}),e.apiUrl(l)),d=await Rm(e,o,a.status);return await LI(e,a),{id:o,etag:(i=d??(0,Zt.readEtag)(c))!==null&&i!==void 0?i:await BI(e,o)}}catch(l){throw s&&await MI(e,o),l}},async delete(e,t){let r=(0,Rr.normalizeGuid)(t,"id"),n=await kI(e,r,null);try{await(0,Zt.deleteRecord)(e,"workflows",r)}catch(i){throw n&&await MI(e,r),i}}}});var C_=g(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0});La.bpfRegistration=La.BpfAdapter=void 0;var t6=sl(),ju=Gn(),r6=UI(),Fm=yn(),mi=Hn(),YI=Rn(),Mt=Ir(),Rt=ct(),Fr=ne(),n6=100,Lm='<?xml version="1.0" encoding="utf-16"?>',$I=1033,ZI="mxswa:Workflow",i6="mxswa:ActivityReference.Properties",a6="mcwo:StepLabel",o6="mcwb:Control",qI="mcwb:Control.ControlDisplayName",e_="mcwb:Control.DataFieldName",t_="DataFieldName",VI="ControlDisplayName",r_="Literal",Qu="x:Null",GI="x:String",km="x:Key",Mm="DisplayName",Ku="Activities",s6="StepLabels",n_="StageId",i_="StageCategory",a_="NextStageId",o_="ProcessStepId",Bm="IsProcessRequired",s_="EntityComposite",l_="StageComposite",u_="StepComposite";function xm(e){return(0,Mt.isJsonObject)(e)?e:{}}function xr(e){if(!e)return[];let t=[],r=e.childNodes;for(let n=0;n<r.length;n+=1){let i=r[n];i.nodeType===1&&t.push(i)}return t}function hi(e,t){var r;return(r=xr(e).find(n=>n.tagName===t))!==null&&r!==void 0?r:null}function Lr(e){return hi(e,i6)}function ht(e,t){var r;return(r=xr(e).find(n=>n.getAttribute(km)===t))!==null&&r!==void 0?r:null}function xa(e,t){var r;return((r=e.getAttribute("AssemblyQualifiedName"))!==null&&r!==void 0?r:"").includes(t)}function nn(e){var t;return!e||!e.firstChild?"":(t=e.firstChild.nodeValue)!==null&&t!==void 0?t:""}function c_(e,t,r){e.firstChild?e.firstChild.nodeValue=r:e.appendChild(t.createTextNode(r))}function ps(e){var t;let r=(t=e.getAttribute(Mm))!==null&&t!==void 0?t:"",n=r.indexOf(": ");return n>=0?r.slice(n+2):r}function d_(e,t){var r;let n=(r=e.getAttribute(Mm))!==null&&r!==void 0?r:"",i=n.indexOf(": ");e.setAttribute(Mm,i>=0?n.slice(0,i+2)+t:t)}function p_(e,t){let r=ht(e,s6),n=hi(r,a6);n&&n.setAttribute("Description",t)}function l6(e){let t=ht(e,i_);if(!t||t.tagName===Qu)return;let r=nn(t).trim();return r===""?void 0:Number(r)}function u6(e){let t=ht(e,a_);if(!t||t.tagName===Qu)return;let r=nn(t).trim();return r===""?void 0:r}function f_(e){let t=m_(e);if(!t)return;let r=g_(t,t_,e_);return r===""?void 0:r}function Um(e,t){let r=xr(e);for(;r.length>0;){let n=r.pop();if(n.tagName===t)return n;for(let i of xr(n))r.push(i)}return null}function m_(e){let t=ht(Lr(e),Ku);return t?Um(t,o6):null}function h_(e,t){let r=e.attributes;for(let n=0;n<r.length;n+=1)if(r[n].name===t)return!0;return!1}function g_(e,t,r){var n;return h_(e,t)?(n=e.getAttribute(t))!==null&&n!==void 0?n:"":m6(e,r)}function zI(e,t,r,n){if(h_(e,t)){e.setAttribute(t,n);return}if(hi(e,r)){c6(e,r,n);return}throw new Fr.InvalidArgumentError(`BPF step control exposes neither a '${t}' attribute nor a <${r}> wrapper to bind a column`)}function c6(e,t,r){let n=hi(e,t),i=n?Um(n,r_):null;i&&i.setAttribute("Value",r)}function v_(e){return ps(e)}function Xu(e){let t=hi(e,ZI),r=[];for(let n of xr(t).filter(i=>xa(i,s_))){let i=ht(Lr(n),Ku);for(let a of xr(i).filter(o=>xa(o,l_)))r.push({el:a,entity:v_(n)})}return r}function $m(e){let t=ht(Lr(e),Ku);return xr(t).filter(r=>xa(r,u_))}function d6(e){let t=Lr(e),r=nn(ht(t,Bm)).trim().toLowerCase(),n=f_(e),i={id:nn(ht(t,o_)),name:ps(e)};return n!==void 0&&(i.fieldName=n),r==="true"&&(i.required=!0),i}function p6(e,t){let r=Lr(e),n=l6(r),i=u6(r),a={id:nn(ht(r,n_)),name:ps(e),entityLogicalName:t,steps:$m(e).map(d6)};return n!==void 0&&(a.category=n),i!==void 0&&(a.nextStageId=i),a}function f6(e){return Xu(e).map(({el:t,entity:r})=>p6(t,r))}function rn(e){return new Fr.NotImplementedError("bpf-structural-authoring",`${e} is not supported yet (this phase authors identity, stage/step names, step required, step field binding, stage categories, and adding/removing/reordering stages & steps on a single-table process; branching, actions, security-role wiring and multi-table processes land in later phases). The rest of the process round-trips losslessly.`)}function m6(e,t){var r;let n=hi(e,t),i=n?Um(n,r_):null;return(r=i?.getAttribute("Value"))!==null&&r!==void 0?r:""}function qm(e,t){var r;let n=e.createElement(t.tagName),i=t.attributes;for(let o=0;o<i.length;o+=1)n.setAttribute(i[o].name,i[o].value);let a=t.childNodes;for(let o=0;o<a.length;o+=1){let s=a[o];s.nodeType===1?n.appendChild(qm(e,s)):s.nodeType===3&&n.appendChild(e.createTextNode((r=s.nodeValue)!==null&&r!==void 0?r:""))}return n}function y_(e){return ht(Lr(e),Ku)}function h6(e,t,r){var n;let i=t.entityLogicalName&&t.entityLogicalName.trim()!==""?t.entityLogicalName:r,a=!((n=t.steps[0])===null||n===void 0)&&n.id&&t.steps[0].id.trim()!==""?t.steps[0].id:(0,Rt.newId)(),{body:o}=Yu(Vm(i,(0,Rt.newId)(),t.id,a));return qm(e,Xu((0,mi.parseXmlRoot)(o,"<Activity/>"))[0].el)}function g6(e,t){let{body:r}=Yu(Vm("account",(0,Rt.newId)(),(0,Rt.newId)(),t.id));return qm(e,$m(Xu((0,mi.parseXmlRoot)(r,"<Activity/>"))[0].el)[0])}function b_(e,t){for(;e.firstChild;)e.removeChild(e.firstChild);for(let r of t)e.appendChild(r)}function w_(e,t,r,n){let i=ht(e,r);if(!i||!i.parentNode){if(n!==void 0&&n!=="")throw rn(`setting '${r}' on a stage whose xaml does not expose that slot`);return}let a=i.parentNode;if(n===void 0||n===""){if(i.tagName!==Qu){let s=t.createElement(Qu);s.setAttribute(km,r),a.replaceChild(s,i)}return}if(i.tagName===GI){nn(i)!==n&&c_(i,t,n);return}let o=t.createElement(GI);o.setAttribute(km,r),o.appendChild(t.createTextNode(n)),a.replaceChild(o,i)}function v6(e,t,r){w_(e,t,i_,r===void 0?void 0:String(r))}function y6(e,t,r){w_(e,t,a_,r)}function A_(e,t,r){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(r(e[n])!==t[n])return!1;return!0}function WI(e){return nn(ht(Lr(e),n_))}function HI(e){return nn(ht(Lr(e),o_))}function jI(e,t,r){var n,i,a,o;let s=Lr(e);r.name!==ps(e)&&(d_(e,r.name),p_(s,r.name));let l=nn(ht(s,Bm)).trim().toLowerCase()==="true";if(((n=r.required)!==null&&n!==void 0?n:!1)!==l){let u=ht(s,Bm);u&&c_(u,t,r.required?"True":"False")}if(((i=r.fieldName)!==null&&i!==void 0?i:"")!==((a=f_(e))!==null&&a!==void 0?a:"")){let u=m_(e);if(!u)throw new Fr.InvalidArgumentError("BPF step has no <mcwb:Control> element to bind a column to");let c=(o=r.fieldName)!==null&&o!==void 0?o:"";zI(u,t_,e_,c),c!==""&&g_(u,VI,qI)===""&&zI(u,VI,qI,c)}}function QI(e,t,r,n){var i;let a=Lr(e);if(!a)throw new Fr.InvalidArgumentError("BPF stage composite has no <\u2026ActivityReference.Properties>");if(r.name!==ps(e)&&(d_(e,r.name),p_(a,r.name)),v6(a,t,r.category),y6(a,t,n),r.relationshipName&&r.relationshipName.trim()!=="")throw rn("a stage relationship / table change (multi-table authoring)");if(r.actions&&r.actions.length>0||r.branch)throw rn("stage actions or conditional branching");let o=y_(e);if(!o)throw new Fr.InvalidArgumentError("BPF stage has no [Activities] collection");let s=(i=r.steps)!==null&&i!==void 0?i:[];if(s.length===0)throw new Fr.InvalidArgumentError(`BPF stage '${r.name}' must have at least one step`);let l=$m(e);if(A_(l,s.map(d=>d.id),HI)){l.forEach((d,p)=>jI(d,t,s[p]));return}let u=new Map(l.map(d=>[HI(d),d]));if(xr(o).some(d=>!xa(d,u_)))throw rn("adding, removing or reordering steps on a stage that also contains branching or actions");let c=s.map(d=>{var p;return(p=u.get(d.id))!==null&&p!==void 0?p:g6(t,d)});b_(o,c),c.forEach((d,p)=>jI(d,t,s[p]))}function b6(e,t,r){let n=hi(e,ZI);if(!n)throw new Fr.InvalidArgumentError("BPF xaml has no <mxswa:Workflow> root activity");if(r.globalActions&&r.globalActions.length>0)throw rn("global (process-completed/abandoned) actions");if(!r.stages||r.stages.length===0)throw new Fr.InvalidArgumentError("a BPF must have at least one stage");let i=Xu(e),a=i.map(p=>p.el);if(A_(a,r.stages.map(p=>p.id),WI)){i.forEach(({el:p,entity:f},h)=>{let v=r.stages[h];if(v.entityLogicalName&&v.entityLogicalName.trim()!==""&&v.entityLogicalName!==f)throw rn(`changing a stage's table ('${v.entityLogicalName}' vs the process's '${f}')`);QI(p,t,v,v.nextStageId)});return}let o=xr(n).filter(p=>xa(p,s_));if(o.length!==1)throw rn("adding, removing or reordering stages on a multi-table process");let s=o[0],l=v_(s),u=y_(s);if(!u)throw new Fr.InvalidArgumentError("BPF primary entity composite has no [Activities] collection");if(xr(u).some(p=>!xa(p,l_)))throw rn("adding, removing or reordering stages on a process whose primary composite holds non-stage activities (multi-table nesting or advanced constructs)");for(let p of r.stages)if(p.entityLogicalName&&p.entityLogicalName.trim()!==""&&p.entityLogicalName!==l)throw rn(`a stage on a different table ('${p.entityLogicalName}') than the process primary ('${l}')`);let c=new Map(a.map(p=>[WI(p),p])),d=r.stages.map(p=>{var f;return(f=c.get(p.id))!==null&&f!==void 0?f:h6(t,p,l)});b_(u,d),d.forEach((p,f)=>{let h=f<d.length-1?r.stages[f+1].id:void 0;QI(p,t,r.stages[f],h)})}function Yu(e){let t=e.match(/^<\?xml[^>]*\?>\s*/),r=t?t[0]:"";return{prolog:r,body:e.slice(r.length)}}function w6(e){var t,r,n,i,a,o;(0,YI.installDomShim)();let s=(t=e.bag)===null||t===void 0?void 0:t.xaml;if(s){let p=new t6.DOMParser().parseFromString("<root/>","text/xml"),f={n:"Activity",a:(0,Fm.mergeAttrs)(s.a,[]),c:(0,Fm.spliceChildren)(s.c,[])};return{root:(0,Fm.rebuildRaw)(f,(0,mi.domEngine)(p),null),prolog:(n=(r=e.bag)===null||r===void 0?void 0:r.xamlProlog)!==null&&n!==void 0?n:Lm,eol:(a=(i=e.bag)===null||i===void 0?void 0:i.xamlEol)!==null&&a!==void 0?a:"lf"}}let l=e.stages[0],u=(o=l?.steps)===null||o===void 0?void 0:o[0],c=Vm(e.entityLogicalName,(0,Rt.newId)(),l?.id&&l.id.trim()!==""?l.id:(0,Rt.newId)(),u?.id&&u.id.trim()!==""?u.id:(0,Rt.newId)()),{body:d}=Yu(c);return{root:(0,mi.parseXmlRoot)(d,"<Activity/>"),prolog:Lm,eol:"lf"}}function A6(e){let{root:t,prolog:r,eol:n}=w6(e);b6(t,t.ownerDocument,e);let i=(0,mi.serializeNode)(t);return n==="crlf"&&(i=i.replace(/\n/g,`\r
+`)),r+i}function C6(e){return e.uniqueName&&e.uniqueName.trim()!==""?e.uniqueName:`new_${(e.name||"businessprocessflow").toLowerCase().replace(/[^a-z0-9]/g,"")||"businessprocessflow"}`}var Ju=class{toArtifact(t){return t}fromArtifact(t){return t}fromApiResponse(t){var r,n;(0,YI.installDomShim)();let i=t,a=typeof i.xaml=="string"?i.xaml:"",o={id:i.workflowid?String(i.workflowid):null,name:String((r=i.name)!==null&&r!==void 0?r:""),entityLogicalName:String((n=i.primaryentity)!==null&&n!==void 0?n:""),status:Number(i.statecode)===1?"Active":"Draft",stages:[]};if(i.uniquename&&(o.uniqueName=String(i.uniquename)),i.description!=null&&i.description!==""&&(o.description=String(i.description)),i.processorder!=null&&i.processorder!==""&&(o.order=Number(i.processorder)),a.trim()!==""){let{prolog:s,body:l}=Yu(a),u=(0,mi.parseXmlRoot)(l,"<Activity/>");o.stages=f6(u),o.bag={xaml:(0,mi.projectElementBag)(u),xamlProlog:s,xamlEol:/\r\n/.test(a)?"crlf":"lf"}}return o}toApiPayload(t){var r;let n={workflowid:t.id&&t.id.trim()!==""?t.id:(0,Rt.newId)(),name:t.name,uniquename:C6(t),primaryentity:t.entityLogicalName,xaml:A6(t),category:ju.WorkflowCategory.BusinessProcessFlow,type:ju.WorkflowTypeCode.Definition,businessprocesstype:ju.BusinessProcessType.BusinessFlow,scope:ju.WorkflowScope.Organization,processorder:(r=t.order)!==null&&r!==void 0?r:n6};t.description!==void 0&&(n.description=t.description);let i={record:n,status:t.status};if(t.securityRoles&&t.securityRoles.length>0){if(t.status!=="Active")throw new Fr.InvalidArgumentError('securityRoles require the BPF to be Active \u2014 the backing table they grant access to is created on activation; set status to "Active" to wire security roles');i.securityRoles=t.securityRoles}return i}createDefault(t){var r,n,i;let a=t.stages&&t.stages.length>0?t.stages.map(KI):[KI({id:(0,Rt.newId)(),name:"New Stage",steps:[]})],o={id:t.id&&t.id.trim()!==""?t.id:(0,Rt.newId)(),name:(r=t.name)!==null&&r!==void 0?r:"New business process flow",entityLogicalName:(n=t.entityLogicalName)!==null&&n!==void 0?n:"",status:(i=t.status)!==null&&i!==void 0?i:"Draft",stages:a};return t.uniqueName&&(o.uniqueName=t.uniqueName),t.description!==void 0&&(o.description=t.description),t.order!==void 0&&(o.order=t.order),t.globalActions!==void 0&&(o.globalActions=t.globalActions),t.securityRoles!==void 0&&(o.securityRoles=t.securityRoles),o}assignMissingIds(t){let r=xm(t);(typeof r.id!="string"||r.id.trim()==="")&&(r.id=(0,Rt.newId)());for(let n of["stages","steps","actions","globalActions"]){let i=r[n];Array.isArray(i)&&i.forEach(a=>this.assignMissingIds(a))}return r}validate(t){let r=[],n=t.stages;if(n!==void 0&&!Array.isArray(n))return r.push((0,Mt.issue)("/stages","stages-must-be-array",`stages must be an array, got ${typeof n}`)),r;let i=Array.isArray(n)?n:[];i.length>30&&r.push((0,Mt.issue)("/stages","too-many-stages",`a BPF allows at most 30 stages, got ${i.length}`));let a=new Set,o=new Map;i.forEach((l,u)=>{let c=`/stages/${u}`,d=xm(l),p=typeof d.id=="string"?d.id.trim():"";p===""?r.push((0,Mt.issue)(`${c}/id`,"stage-id-required","a stage needs an id")):o.has(p.toLowerCase())?r.push((0,Mt.issue)(`${c}/id`,"stage-id-duplicate",`two stages share the id '${l.id}' (also at /stages/${o.get(p.toLowerCase())})`)):o.set(p.toLowerCase(),u),typeof l.entityLogicalName=="string"&&l.entityLogicalName!==""&&a.add(l.entityLogicalName);let f=Array.isArray(l.steps)?l.steps:[];f.length===0&&r.push((0,Mt.issue)(`${c}/steps`,"stage-needs-step","a BPF stage must have at least one step")),f.length>30&&r.push((0,Mt.issue)(`${c}/steps`,"too-many-steps",`a stage allows at most 30 steps, got ${f.length}`));let h=new Map;f.forEach((v,w)=>{let E=`${c}/steps/${w}`,D=typeof xm(v).id=="string"?v.id.trim():"";D===""?r.push((0,Mt.issue)(`${E}/id`,"step-id-required","a step needs an id")):h.has(D.toLowerCase())?r.push((0,Mt.issue)(`${E}/id`,"step-id-duplicate",`two steps in this stage share the id '${v.id}'`)):h.set(D.toLowerCase(),w)}),l.branch&&!JI(i,l.branch.nextStageId)&&r.push((0,Mt.issue)(`${c}/branch/nextStageId`,"branch-target-unknown",`branch nextStageId '${l.branch.nextStageId}' does not match any stage id`)),typeof l.nextStageId=="string"&&l.nextStageId!==""&&!JI(i,l.nextStageId)&&r.push((0,Mt.issue)(`${c}/nextStageId`,"next-stage-unknown",`nextStageId '${l.nextStageId}' does not match any stage id`))}),a.size>5&&r.push((0,Mt.issue)("/stages","too-many-tables",`a BPF spans at most 5 tables, got ${a.size}`));let s=S6(i);return s>=0&&r.push((0,Mt.issue)(`/stages/${s}/nextStageId`,"next-stage-cycle","the stage nextStageId links form a cycle; the flow must be acyclic")),r}};La.BpfAdapter=Ju;function S6(e){let t=new Map(e.map(r=>[r.id,r]));for(let r=0;r<e.length;r+=1){let n=new Set,i=e[r];for(;i&&typeof i.nextStageId=="string"&&i.nextStageId!=="";){if(n.has(i.id))return r;n.add(i.id),i=t.get(i.nextStageId)}}return-1}function JI(e,t){return e.some(r=>r.id===t)}function KI(e){var t,r;let n=e.steps&&e.steps.length>0?e.steps.map(XI):[XI({id:(0,Rt.newId)(),name:"New Step"})],i={id:e.id&&e.id.trim()!==""?e.id:(0,Rt.newId)(),name:(t=e.name)!==null&&t!==void 0?t:"New Stage",entityLogicalName:(r=e.entityLogicalName)!==null&&r!==void 0?r:"",steps:n};return e.category!==void 0&&(i.category=e.category),e.nextStageId!==void 0&&(i.nextStageId=e.nextStageId),e.relationshipName!==void 0&&(i.relationshipName=e.relationshipName),e.actions!==void 0&&(i.actions=e.actions),e.branch!==void 0&&(i.branch=e.branch),i}function XI(e){var t;let r={id:e.id&&e.id.trim()!==""?e.id:(0,Rt.newId)(),name:(t=e.name)!==null&&t!==void 0?t:"New Step"};return e.fieldName!==void 0&&(r.fieldName=e.fieldName),e.required!==void 0&&(r.required=e.required),r}function Vm(e,t,r,n){return`${Lm}<Activity x:Class="XrmWorkflow00000000000000000000000000000000" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:mcwb="clr-namespace:Microsoft.Crm.Workflow.BusinessProcessFlowActivities;assembly=Microsoft.Crm.Workflow, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" xmlns:mcwo="clr-namespace:Microsoft.Crm.Workflow.ObjectModel;assembly=Microsoft.Crm, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" xmlns:mxs="clr-namespace:Microsoft.Xrm.Sdk;assembly=Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" xmlns:mxswa="clr-namespace:Microsoft.Xrm.Sdk.Workflow.Activities;assembly=Microsoft.Xrm.Sdk.Workflow, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" xmlns:sco="clr-namespace:System.Collections.ObjectModel;assembly=mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" xmlns:srs="clr-namespace:System.Runtime.Serialization;assembly=System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" xmlns:this="clr-namespace:" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"><x:Members><x:Property Name="InputEntities" Type="InArgument(scg:IDictionary(x:String, mxs:Entity))" /><x:Property Name="CreatedEntities" Type="InArgument(scg:IDictionary(x:String, mxs:Entity))" /></x:Members><this:XrmWorkflow00000000000000000000000000000000.InputEntities><InArgument x:TypeArguments="scg:IDictionary(x:String, mxs:Entity)" /></this:XrmWorkflow00000000000000000000000000000000.InputEntities><this:XrmWorkflow00000000000000000000000000000000.CreatedEntities><InArgument x:TypeArguments="scg:IDictionary(x:String, mxs:Entity)" /></this:XrmWorkflow00000000000000000000000000000000.CreatedEntities><mva:VisualBasic.Settings>Assembly references and imported namespaces for internal implementation</mva:VisualBasic.Settings><mxswa:Workflow><mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.EntityComposite, Microsoft.Crm.Workflow, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="EntityStep1: ${e}"><mxswa:ActivityReference.Properties><sco:Collection x:TypeArguments="Variable" x:Key="Variables" /><sco:Collection x:TypeArguments="Activity" x:Key="Activities"><mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.StageComposite, Microsoft.Crm.Workflow, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="StageStep2: New Stage"><mxswa:ActivityReference.Properties><sco:Collection x:TypeArguments="Variable" x:Key="Variables" /><sco:Collection x:TypeArguments="Activity" x:Key="Activities"><mxswa:ActivityReference AssemblyQualifiedName="Microsoft.Crm.Workflow.Activities.StepComposite, Microsoft.Crm.Workflow, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" DisplayName="StepStep3: New Step"><mxswa:ActivityReference.Properties><sco:Collection x:TypeArguments="Variable" x:Key="Variables" /><sco:Collection x:TypeArguments="Activity" x:Key="Activities"><Sequence DisplayName="ControlStep4"><mcwb:Control ControlId="${t}" IsSystemControl="False" IsUnbound="False" SystemStepType="0"><mcwb:Control.ClassId><InArgument x:TypeArguments="x:String"><Literal x:TypeArguments="x:String" Value="" /></InArgument></mcwb:Control.ClassId><mcwb:Control.ControlDisplayName><InArgument x:TypeArguments="x:String"><Literal x:TypeArguments="x:String" Value="" /></InArgument></mcwb:Control.ControlDisplayName><mcwb:Control.DataFieldName><InArgument x:TypeArguments="x:String"><Literal x:TypeArguments="x:String" Value="" /></InArgument></mcwb:Control.DataFieldName><mcwb:Control.Parameters><InArgument x:TypeArguments="x:String"><Literal x:TypeArguments="x:String" Value="" /></InArgument></mcwb:Control.Parameters></mcwb:Control></Sequence></sco:Collection><sco:Collection x:TypeArguments="mcwo:StepLabel" x:Key="StepLabels"><mcwo:StepLabel Description="New Step" LabelId="${n}" LanguageCode="${$I}" /></sco:Collection><x:String x:Key="ProcessStepId">${n}</x:String><x:Boolean x:Key="IsProcessRequired">False</x:Boolean></mxswa:ActivityReference.Properties></mxswa:ActivityReference></sco:Collection><sco:Collection x:TypeArguments="mcwo:StepLabel" x:Key="StepLabels"><mcwo:StepLabel Description="New Stage" LabelId="${r}" LanguageCode="${$I}" /></sco:Collection><x:String x:Key="StageId">${r}</x:String><x:Null x:Key="StageCategory" /><x:Null x:Key="NextStageId" /></mxswa:ActivityReference.Properties></mxswa:ActivityReference></sco:Collection><x:Null x:Key="RelationshipName" /><x:Null x:Key="AttributeName" /><x:Boolean x:Key="IsClosedLoop">False</x:Boolean></mxswa:ActivityReference.Properties></mxswa:ActivityReference></mxswa:Workflow></Activity>`}function E6(){return{adapter:new Ju,api:r6.bpfApi,languageSensitive:!0}}La.bpfRegistration=E6});var S_=g(Zu=>{"use strict";Object.defineProperty(Zu,"__esModule",{value:!0});Zu.buildRegistrations=void 0;var N6=LN(),D6=XN(),I6=c2(),_6=D2(),T6=H2(),P6=uI(),O6=CI(),R6=RI(),F6=C_();function x6(e){let t=new Map;return t.set("form",(0,N6.formRegistration)(e)),t.set("view",(0,D6.viewRegistration)()),t.set("businessRule",(0,I6.businessRuleRegistration)()),t.set("app",(0,_6.appRegistration)(e)),t.set("command",(0,T6.commandRegistration)()),t.set("chart",(0,P6.chartRegistration)()),t.set("dashboard",(0,O6.dashboardRegistration)(e)),t.set("genPage",(0,R6.genPageRegistration)()),t.set("bpf",(0,F6.bpfRegistration)()),t}Zu.buildRegistrations=x6});var R_=g(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.removeRowSummary=Pe.configureRowSummary=Pe.buildGptDynamicPrompt=Pe.setAppAiFeatures=Pe.getAiReadiness=Pe.saveSettingValue=Pe.retrieveSetting=Pe.AI_GATE=void 0;var cr=be(),je=ie(),E_=ct(),an=ne();Pe.AI_GATE={formFill:"FormFillBarUXEnabled",formFillSuggestions:"FormPredictEnabled",formFillSmartPaste:"FormPredictSmartPasteEnabled",formFillFiles:"FormFillFileUploadEnabled",nlSearch:"EnableNLGridSearch",nlChart:"NLChartVisualizationSetting",summaries:"EnableFormInsights",m365:"m365copilotmodelappenabled"};var __={formFill:"FormFillBarUXEnabled",formFillSuggestions:"FormPredictEnabled",formFillSmartPaste:"FormPredictSmartPasteEnabledOnByDefault",formFillFiles:"FormFillFileUploadEnabled",nlSearch:"NLGridSearchSetting",nlChart:"NLChartDataVisualizationSetting",m365:"m365copilotmodelappenabled"},L6=new Set(Object.entries(Pe.AI_GATE).filter(([e,t])=>__[e]===t).map(([e])=>e)),k6={formFill:{enabled:"2",disabled:"1"},formFillSuggestions:{enabled:"2",disabled:"1"},formFillSmartPaste:{enabled:"2",disabled:"1"},formFillFiles:{enabled:"2",disabled:"1"}};function Gm(e){return k6[e]}var ec=1e6;function M6(e,t){let r=Gm(t),n=()=>{throw new an.InvalidArgumentError(`setAppAiFeatures: '${t}' must be a boolean or an integer between 0 and ${ec} (e.g. 0, 1, 2); got '${String(e)}'.`)},i=a=>r?a?r.enabled:r.disabled:a?"1":"0";if(typeof e=="boolean")return i(e);if(typeof e=="number")return!Number.isSafeInteger(e)||e<0||e>ec?n():String(e);if(typeof e=="string"){let a=e.trim(),o=a.toLowerCase();if(o==="true")return i(!0);if(o==="false")return i(!1);if(/^[0-9]+$/.test(a)){let s=a.replace(/^0+(?=[0-9])/,"");return s.length>String(ec).length||Number(s)>ec?n():s}}return n()}function B6(e,t){let r=Gm(t);return r?e===r.enabled:e!=="0"}async function U6(e,t){var r,n,i;let a=`/appmodules${(0,je.odataQuery)([["$select","appmoduleid"],["$filter",`uniquename eq '${(0,je.odataLiteral)(t)}'`]])}`,o=await e.get(a);return o.status>=200&&o.status<300?(i=((n=(r=o.body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[])[0])===null||i===void 0?void 0:i.appmoduleid:void 0}async function $6(e,t){var r,n;let i=`/appmodules${(0,je.odataQuery)([["$select","appmoduleid"],["$filter",`uniquename eq '${(0,je.odataLiteral)(t)}'`]])}`,a;try{a=await e.get(i)}catch(l){throw new an.InvalidArgumentError(`setAppAiFeatures: cannot confirm that the supplied appModuleId belongs to app '${t}' \u2014 the lookup failed (${l.message}). Retry, or omit appModuleId to verify by name.`)}if(a.status<200||a.status>=300)throw new an.InvalidArgumentError(`setAppAiFeatures: cannot confirm that the supplied appModuleId belongs to app '${t}' \u2014 the lookup returned HTTP ${a.status}. Retry, or omit appModuleId to verify by name.`);let o=(r=a.body)===null||r===void 0?void 0:r.value;if(!Array.isArray(o))throw new an.InvalidArgumentError(`setAppAiFeatures: cannot confirm that the supplied appModuleId belongs to app '${t}' \u2014 the lookup returned a malformed body.`);if(o.length===0)return;let s=(n=o[0])===null||n===void 0?void 0:n.appmoduleid;if(!s)throw new an.InvalidArgumentError(`setAppAiFeatures: cannot confirm that the supplied appModuleId belongs to app '${t}' \u2014 the lookup returned a row with no appmoduleid.`);return s}var N_=new WeakMap;async function q6(e,t){var r,n,i;let a=N_.get(e);if(a||(a=new Map,N_.set(e,a)),a.has(t))return a.get(t);let o=`/settingdefinitions${(0,je.odataQuery)([["$select","settingdefinitionid"],["$filter",`uniquename eq '${(0,je.odataLiteral)(t)}'`]])}`,s=await e.get(o),l=s.status>=200&&s.status<300?(i=((n=(r=s.body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[])[0])===null||i===void 0?void 0:i.settingdefinitionid:void 0;return l&&a.set(t,l),l}async function V6(e,t,r){var n,i;let a=await q6(e,r);if(!t||!a)return;let o=`/appsettings${(0,je.odataQuery)([["$select","value"],["$filter",`_parentappmoduleid_value eq ${t} and _settingdefinitionid_value eq ${a}`]])}`,s=await e.get(o);if(s.status<200||s.status>=300)return;let l=(i=(n=s.body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[];return l.length>0?{exists:!0,value:l[0].value}:{exists:!1}}var G6=4,z6=500,D_=20,I_=3e4;function W6(e){if(e===void 0)return G6;if(!Number.isFinite(e))throw new an.InvalidArgumentError(`setAppAiFeatures: verifyAttempts must be a finite integer between 1 and ${D_}; got ${e}.`);return Math.min(D_,Math.max(1,Math.floor(e)))}function H6(e){if(e===void 0)return z6;if(!Number.isFinite(e))throw new an.InvalidArgumentError(`setAppAiFeatures: verifyDelayMs must be a finite number between 0 and ${I_}; got ${e}.`);return Math.min(I_,Math.max(0,Math.floor(e)))}async function j6(e,t,r,n,i,a,o){let s,l,u,c=!1;for(let d=0;d<a;d+=1){d>0&&await new Promise(f=>setTimeout(f,o*d));let p;try{let f=await t();f?(p=await V6(e,f,n),p===void 0&&(u="the app-scope override row could not be read (insufficient access or unresolvable ids)")):u=`the app '${r}' could not be resolved to an appmoduleid \u2014 a newly created app is not readable until it is published, so either publish it first or pass \`appModuleId\` in the options to verify without the lookup`}catch(f){p=void 0,u=f.message}c=p!==void 0,l=p?.exists;try{s=(await tc(e,n,{appUniqueName:r})).value}catch{}if(p?.exists&&p.value===i)return{result:"proven",effectiveValue:p.value,appOverrideExists:!0}}return c?{result:"absent",effectiveValue:s,appOverrideExists:l}:{result:"unverifiable",effectiveValue:s,appOverrideExists:void 0,reason:u}}function T_(e,t,r){if(t===2)return String(e).toLowerCase()==="true";let n=r?Gm(r):void 0;return n?e===n.enabled:e!=null&&e!=="0"&&e!==""}async function tc(e,t,r={}){var n,i;let a=[`SettingName='${(0,je.odataPathLiteral)(t)}'`];r.appUniqueName&&a.push(`AppUniqueName='${(0,je.odataPathLiteral)(r.appUniqueName)}'`);let o=`/RetrieveSetting(${a.join(",")})`,l=(i=(n=(0,cr.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||n===void 0?void 0:n.SettingDetail)!==null&&i!==void 0?i:{};return{value:l.Value,dataType:l.DataType}}Pe.retrieveSetting=tc;async function P_(e,t,r,n={}){let i={SettingName:t,Value:r};n.appUniqueName&&(i.AppUniqueName=n.appUniqueName),n.solutionUniqueName&&(i.SolutionUniqueName=n.solutionUniqueName),(0,cr.ensureSuccess)(await e.post("/SaveSettingValue",i),e.apiUrl("/SaveSettingValue"))}Pe.saveSettingValue=P_;async function Q6(e,t={}){let r={};for(let[n,i]of Object.entries(Pe.AI_GATE)){let{value:a,dataType:o}=await tc(e,i,t);r[n]={enabled:T_(a,o,n),setting:i,value:a}}return r}Pe.getAiReadiness=Q6;async function J6(e,t,r,n={}){var i,a;if(!t||!t.trim())throw new an.InvalidArgumentError("setAppAiFeatures: a non-empty appUniqueName is required (an empty value would write the setting at organization scope, affecting every app).");let o=W6(n.verifyAttempts),s=H6(n.verifyDelayMs),l=[];for(let[v,w]of Object.entries(r)){if(w===void 0)continue;let E=__[v];E&&l.push({feature:v,setting:E,requestedValue:M6(w,v)})}let u=[],c=n.appModuleId?(0,je.normalizeGuid)(n.appModuleId,"appModuleId"):void 0;if(c){let v=await $6(e,t);if(v&&(0,je.normalizeGuid)(v,"appModuleId")!==c)throw new an.InvalidArgumentError(`setAppAiFeatures: appModuleId '${c}' does not belong to app '${t}' (which resolves to '${v}'). Settings are written by unique name, so verifying against a different app would report success for a write that never landed.`)}let d,p=async()=>c||(d||(d=await U6(e,t)),d),f=new Map,h=async v=>{if(L6.has(v))return;let w=Pe.AI_GATE[v];if(w){if(!f.has(w))try{let{value:E,dataType:D}=await tc(e,w);f.set(w,{enabled:T_(E,D,v),setting:w,value:E})}catch{f.set(w,void 0)}return f.get(w)}};for(let{feature:v,setting:w,requestedValue:E}of l)try{await P_(e,w,E,{appUniqueName:t,solutionUniqueName:n.solutionUniqueName});let D=await j6(e,p,t,w,E,o,s),x={feature:v,setting:w,requestedValue:E,effectiveValue:D.effectiveValue,appOverrideExists:D.appOverrideExists};if(D.result==="proven")u.push({...x,status:"applied"});else if(D.result==="absent"){let F=B6(E,v)?await h(v):void 0;F&&!F.enabled?u.push({...x,status:"skipped",reason:`the write was issued and no app-scope override holding '${E}' was observed for '${w}' after ${o} attempt(s); the org readiness gate '${F.setting}' reads '${F.value}', so an environment admin must enable it before this app can turn the feature on`}):u.push({...x,status:"notPersisted",reason:`the write reported success but no app-scope override holding '${E}' was observed for '${w}' after ${o} attempt(s) \u2014 it reads '${(i=D.effectiveValue)!==null&&i!==void 0?i:""}' for this app (Dataverse can accept an app-scope write without storing it)`})}else u.push({...x,status:"unverified",reason:`the write was issued but could not be confirmed: ${(a=D.reason)!==null&&a!==void 0?a:"the app-scope override row could not be read"}. The value may or may not be in force \u2014 verify manually before relying on it.`})}catch(D){u.push({feature:v,setting:w,requestedValue:E,status:"failed",reason:D.message})}return{applied:u.filter(v=>v.status==="applied").map(v=>v.feature),skipped:u.filter(v=>v.status==="skipped").map(v=>v.feature),notPersisted:u.filter(v=>v.status==="notPersisted").map(v=>v.feature),unverified:u.filter(v=>v.status==="unverified").map(v=>v.feature),failed:u.filter(v=>v.status==="failed").map(v=>v.feature),outcomes:u}}Pe.setAppAiFeatures=J6;var K6="GptPowerPrompt",X6='{ "consumptionSource": "Api", "partnerSource": "AIBuilder", "consumptionSourceVersion": "GptApiClient"}';function O_(e){var t,r,n,i;let a=e.entityLogicalName,o=[{type:"literal",text:e.instruction.replace(/\s*$/,"")+" "}];return e.columns.forEach((s,l)=>{o.push({type:"data",id:`${a}.${s.logical}`,text:s.display}),l<e.columns.length-1&&o.push({type:"literal",text:", "})}),{version:"GptDynamicPrompt-2",prompt:o,definitions:{inputs:[{id:"RecordId",text:"RecordId",type:"text"},{id:"LanguageCode",text:"LanguageCode",type:"text"}],formulas:[],data:[{id:a,displayName:a,type:"dataverseTable",filters:[{filterType:"equal",attribute:e.primaryKey,valueType:"inputVariable",value:"RecordId"}]}],output:{formats:[(t=e.outputFormat)!==null&&t!==void 0?t:"text"]}},modelParameters:{modelType:"default",gptParameters:{temperature:(r=e.temperature)!==null&&r!==void 0?r:0}},settings:{recordRetrievalLimit:(n=e.recordRetrievalLimit)!==null&&n!==void 0?n:30,shouldPreserveRecordLinks:null,runtime:null,enableReasoning:(i=e.enableReasoning)!==null&&i!==void 0?i:!0},code:"",signature:""}}Pe.buildGptDynamicPrompt=O_;async function Y6(e,t){var r,n;let i=`/EntityDefinitions(LogicalName='${(0,je.odataPathLiteral)(t)}')${(0,je.odataQuery)([["$select","MetadataId"]])}`;return(n=(r=(0,cr.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)===null||r===void 0?void 0:r.MetadataId)!==null&&n!==void 0?n:""}async function Z6(e,t,r={}){var n,i,a,o,s;let l=`ais_RowSummary_${t.entityLogicalName}`,u=`/aiskillconfigs${(0,je.odataQuery)([["$select","aiskillconfigid,_aimodel_value"],["$filter",`uniquename eq '${(0,je.odataLiteral)(l)}'`],["$top",1]])}`,c=((i=(n=(0,cr.ensureSuccess)(await e.get(u),e.apiUrl(u)).body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[])[0];if(c)return{modelId:c._aimodel_value,aiSkillConfigId:c.aiskillconfigid};let d=`/msdyn_aitemplates${(0,je.odataQuery)([["$select","msdyn_aitemplateid"],["$filter",`msdyn_uniquename eq '${K6}'`],["$top",1]])}`,p=((s=(o=(a=(0,cr.ensureSuccess)(await e.get(d),e.apiUrl(d)).body)===null||a===void 0?void 0:a.value)===null||o===void 0?void 0:o[0])!==null&&s!==void 0?s:{}).msdyn_aitemplateid,f=(0,E_.newId)(),h=(0,E_.newId)(),v=JSON.stringify(O_(t)),w={ModelId:f,RunConfigurationId:h,ModelName:`${t.entityLogicalName} row summary`,TemplateId:p,CustomConfiguration:v,Source:X6,RunConfiguration:""};(0,cr.ensureSuccess)(await e.post("/AIModelPublish",w),e.apiUrl("/AIModelPublish"));try{let E=await Y6(e,t.entityLogicalName),D={uniquename:l,description:`${t.entityLogicalName} row summary`,"[email protected]":`/entities(${E})`,"[email protected]":`/msdyn_aimodels(${f})`,aiskill:"RowSummary"},x=(0,cr.ensureSuccess)(await e.post("/aiskillconfigs",D),e.apiUrl("/aiskillconfigs")),F=(0,cr.requireCreatedId)(x,"aiskillconfigid","row-summary skill");return{modelId:f,aiSkillConfigId:F}}catch(E){try{await e.delete(`/msdyn_aimodels(${f})`)}catch{}throw E}}Pe.configureRowSummary=Z6;async function e7(e,t){var r,n;let i=`ais_RowSummary_${t.entityLogicalName}`,a=`/aiskillconfigs${(0,je.odataQuery)([["$select","aiskillconfigid,_aimodel_value"],["$filter",`uniquename eq '${(0,je.odataLiteral)(i)}'`],["$top",1]])}`,o=((n=(r=(0,cr.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[])[0];if(!o)return;let s=`/aiskillconfigs(${o.aiskillconfigid})`;if((0,cr.ensureSuccess)(await e.delete(s),e.apiUrl(s)),o._aimodel_value){let l=`/msdyn_aimodels(${o._aimodel_value})`;(0,cr.ensureSuccess)(await e.delete(l),e.apiUrl(l))}}Pe.removeRowSummary=e7});var F_=g(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});ka.findArtifact=ka.resolveArtifact=void 0;var gt=ie(),on=qs(),t7=Qs(),r7=be(),n7=ne();async function i7(e,t,r){var n,i,a,o,s,l,u,c,d,p,f,h;switch(t){case"app":{let v=(0,t7.unpublishedAppModulesQuery)("appmoduleid,name,appmoduleidunique",`uniquename eq '${(0,gt.odataLiteral)((n=r.uniqueName)!==null&&n!==void 0?n:"")}'`,1),E=(i=(0,r7.ensureSuccess)(await e.get(v),e.apiUrl(v)).body)===null||i===void 0?void 0:i.value,D=E&&E[0];return D?[{id:String(D.appmoduleid),name:String(D.name),appModuleIdUnique:String(D.appmoduleidunique)}]:[]}case"dashboard":return(await(0,on.queryRecords)(e,"systemform",{select:["formid","name"],filter:`name eq '${(0,gt.odataLiteral)((a=r.name)!==null&&a!==void 0?a:"")}' and type eq 0`,top:10})||[]).map(w=>({id:String(w.formid),name:String(w.name)}));case"command":{let v=await(0,on.queryRecords)(e,"appaction",{select:["appactionid","buttonlabeltext"],filter:`contextvalue eq '${(0,gt.odataLiteral)((o=r.entity)!==null&&o!==void 0?o:"")}'`,top:1});return v&&v.length?[{id:String(r.entity),entity:String(r.entity)}]:[]}case"form":return(await(0,on.queryRecords)(e,"systemform",{select:["formid","name"],filter:`name eq '${(0,gt.odataLiteral)((s=r.name)!==null&&s!==void 0?s:"")}' and objecttypecode eq '${(0,gt.odataLiteral)((l=r.entity)!==null&&l!==void 0?l:"")}'`,top:10})||[]).map(w=>({id:String(w.formid),name:String(w.name)}));case"chart":return(await(0,on.queryRecords)(e,"savedqueryvisualization",{select:["savedqueryvisualizationid","name"],filter:`name eq '${(0,gt.odataLiteral)((u=r.name)!==null&&u!==void 0?u:"")}' and primaryentitytypecode eq '${(0,gt.odataLiteral)((c=r.entity)!==null&&c!==void 0?c:"")}'`,top:10})||[]).map(w=>({id:String(w.savedqueryvisualizationid),name:String(w.name)}));case"view":return(await(0,on.queryRecords)(e,"savedquery",{select:["savedqueryid","name"],filter:`name eq '${(0,gt.odataLiteral)((d=r.name)!==null&&d!==void 0?d:"")}' and returnedtypecode eq '${(0,gt.odataLiteral)((p=r.entity)!==null&&p!==void 0?p:"")}'`,top:10})||[]).map(w=>({id:String(w.savedqueryid),name:String(w.name)}));case"webResource":return(await(0,on.queryRecords)(e,"webresource",{select:["webresourceid","name"],filter:`name eq '${(0,gt.odataLiteral)((f=r.name)!==null&&f!==void 0?f:"")}'`,top:1})||[]).map(w=>({id:String(w.webresourceid),name:String(w.name)}));case"solution":return(await(0,on.queryRecords)(e,"solution",{select:["solutionid","uniquename"],filter:`uniquename eq '${(0,gt.odataLiteral)((h=r.uniqueName)!==null&&h!==void 0?h:"")}'`,top:1})||[]).map(w=>({id:String(w.solutionid),name:String(w.uniquename)}));default:return[]}}ka.resolveArtifact=i7;async function a7(e,t,r){var n,i,a,o,s;let l=(0,gt.odataLiteral)((n=r.name)!==null&&n!==void 0?n:""),u=(0,gt.odataLiteral)((i=r.entity)!==null&&i!==void 0?i:"");if(t==="command"){let h=await(0,on.queryRecords)(e,"appaction",{select:["appactionid"],filter:`contextvalue eq '${(0,gt.odataLiteral)((a=r.entity)!==null&&a!==void 0?a:"")}'`,top:1});return h&&h.length?String(r.entity):null}let c=o7(t,l,u,r),d=t!=="app",p=await(0,on.queryRecords)(e,c.set,{select:[c.idField],filter:c.filter,top:d?2:1});if(d&&p&&p.length>1)throw new n7.AmbiguousArtifactError(t,(s=(o=r.name)!==null&&o!==void 0?o:r.uniqueName)!==null&&s!==void 0?s:"",p.length);let f=p&&p[0]&&p[0][c.idField];return f!=null?String(f):null}ka.findArtifact=a7;function o7(e,t,r,n){var i;switch(e){case"view":return{set:"savedquery",idField:"savedqueryid",filter:`returnedtypecode eq '${r}' and name eq '${t}'`};case"chart":return{set:"savedqueryvisualization",idField:"savedqueryvisualizationid",filter:`primaryentitytypecode eq '${r}' and name eq '${t}'`};case"form":return{set:"systemform",idField:"formid",filter:`objecttypecode eq '${r}' and name eq '${t}'`};case"app":return{set:"appmodule",idField:"appmoduleid",filter:`uniquename eq '${(0,gt.odataLiteral)((i=n.uniqueName)!==null&&i!==void 0?i:"")}'`};case"dashboard":return{set:"systemform",idField:"formid",filter:`name eq '${t}' and type eq 0`};default:throw new Error(`Unsupported findable kind: ${e}`)}}});var L_=g(nc=>{"use strict";Object.defineProperty(nc,"__esModule",{value:!0});nc.seedRecordGraph=void 0;var x_=qs(),s7=xs(),rc=ie(),l7=ne();async function u7(e,t,r={}){var n,i,a,o,s;let l=(n=r.createdIds)!==null&&n!==void 0?n:{},u=(i=r.entitySetFor)!==null&&i!==void 0?i:(p=>(0,s7.resolveEntitySetName)(e,p)),c={},d=p=>{var f;return(f=c[p])!==null&&f!==void 0?f:l[p]};for(let p of t){let f=p.entityLogical.toLowerCase(),h=(a=p.matchOn)===null||a===void 0?void 0:a.toLowerCase(),v=[];for(let L of p.records){let V={...L.body};for(let B of(o=L.binds)!==null&&o!==void 0?o:[]){let U=B.parentEntity.toLowerCase(),z=(s=d(U))===null||s===void 0?void 0:s[B.parentIndex];if(!z)throw new l7.InvalidArgumentError(`Cannot resolve bind '${B.navProperty}' on a '${f}' record: parent '${B.parentEntity}'[${B.parentIndex}] has no created id. Seed the parent group before the child, or supply it via options.createdIds.`);let $=(0,rc.assertODataName)(await u(U),`entity set for parent '${B.parentEntity}'`),Oe=(0,rc.normalizeGuid)(z,`parent id for bind '${B.navProperty}'`);V[`${B.navProperty}@odata.bind`]=`/${$}(${Oe})`}v.push(V)}let w=h?v.map(L=>{let V=L[h];return V!=null&&V!==""?String(V):null}):v.map(()=>null),E=new Map;if(h){let L=(0,rc.assertODataName)(h,"RecordGraph matchOn key"),V=[...new Set(w.filter(B=>B!==null))];if(V.length){let B=V.map(z=>`${L} eq '${(0,rc.odataLiteral)(z)}'`).join(" or "),U=await(0,x_.queryRecords)(e,f,{select:[L,`${f}id`],filter:B,top:5e3});for(let z of U??[]){let $=z[L];$!=null&&E.set(String($).toLowerCase(),String(z[`${f}id`]))}}}let D=[],x=new Map,F=v.map((L,V)=>{let B=w[V];if(B&&E.has(B.toLowerCase()))return null;if(B){let U=B.toLowerCase(),z=x.get(U);if(z!==void 0)return z;let $=D.push(L)-1;return x.set(U,$),$}return D.push(L)-1}),j=D.length?await(0,x_.createRecordsBulk)(e,f,D):[];c[f]=v.map((L,V)=>{let B=w[V];return B&&E.has(B.toLowerCase())?E.get(B.toLowerCase()):j[F[V]]})}return{createdIds:c}}nc.seedRecordGraph=u7});var W_=g(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.getEntityPrivileges=st.addEntityPrivilegesToRole=st.deleteSecurityRole=st.createPersonaRole=st.createSecurityRole=st.SDK_ROLE_MARKER=void 0;var dr=be(),Qe=ie(),Bt=ne(),ic={read:"Read",create:"Create",write:"Write",delete:"Delete",append:"Append",appendTo:"AppendTo",assign:"Assign",share:"Share"},Wm={user:"Basic",businessUnit:"Local",parentChild:"Deep",organization:"Global"},k_={user:1,businessUnit:2,parentChild:3,organization:4},zm={user:"CanBeBasic",businessUnit:"CanBeLocal",parentChild:"CanBeDeep",organization:"CanBeGlobal"};st.SDK_ROLE_MARKER="Authored by @maker-studio/cds-maker-sdk (persona/security role).";function c7(e){return Object.prototype.hasOwnProperty.call(ic,e)?ic[e]:void 0}function d7(e){return Object.prototype.hasOwnProperty.call(Wm,e)}var M_=new WeakMap,B_=new WeakMap;async function q_(e,t){var r,n;(0,Qe.assertODataName)(t,"entity logical name");let i=M_.get(e);i||(i=new Map,M_.set(e,i));let a=i.get(t);if(a)return a;let o=`/EntityDefinitions(LogicalName='${(0,Qe.odataPathLiteral)(t)}')${(0,Qe.odataQuery)([["$select","LogicalName,Privileges"]])}`,l=(n=(r=(0,dr.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||r===void 0?void 0:r.Privileges)!==null&&n!==void 0?n:[];if(l.length===0)throw new Bt.InvalidArgumentError(`Entity '${t}' exposes no privileges (unknown or non-securable entity).`);return i.set(t,l),l}async function p7(e){var t,r,n;let i=B_.get(e);if(i)return i;let a=`/businessunits${(0,Qe.odataQuery)([["$select","businessunitid"],["$filter","_parentbusinessunitid_value eq null"],["$top",1]])}`,l=(n=((r=(t=(0,dr.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||t===void 0?void 0:t.value)!==null&&r!==void 0?r:[])[0])===null||n===void 0?void 0:n.businessunitid;if(!l)throw new Bt.InvalidArgumentError("Could not resolve the root business unit.");let u=(0,Qe.normalizeGuid)(l,"businessUnitId");return B_.set(e,u),u}async function V_(e,t){var r;let n=new Map;for(let i of t){if(!i.access||i.access.length===0)throw new Bt.InvalidArgumentError(`Entity '${i.entity}' privilege request has no access levels.`);let a=(r=i.scope)!==null&&r!==void 0?r:"user";if(!d7(a))throw new Bt.InvalidArgumentError(`Unknown privilege scope '${a}' for entity '${i.entity}'.`);let o=await q_(e,i.entity);for(let s of i.access){let l=c7(s);if(!l)throw new Bt.InvalidArgumentError(`Unknown access level '${s}' for entity '${i.entity}'.`);let u=o.find(h=>h.PrivilegeType===l);if(!u)throw new Bt.InvalidArgumentError(`Entity '${i.entity}' does not support '${s}' access.`);let c=zm[a];if(u[c]===!1)throw new Bt.InvalidArgumentError(`Privilege '${u.Name}' on '${i.entity}' does not support the '${a}' scope.`);let d=(0,Qe.normalizeGuid)(u.PrivilegeId,"PrivilegeId"),p=n.get(d);if(!p){n.set(d,{privilegeName:u.Name,privilegeType:l,scope:a,entities:new Set([i.entity])});continue}if(p.scope===a){p.entities.add(i.entity);continue}if(!(p.entities.size===1&&p.entities.has(i.entity))){let h=[...p.entities].sort().join(", ");throw new Bt.InvalidArgumentError(`Entities '${h}' and '${i.entity}' share the Dataverse privilege '${u.Name}' but request different scopes; a role holds one depth per privilege. Use the same scope for all entities that share this privilege, or split them.`)}p.scope=k_[a]>k_[p.scope]?a:p.scope}}return[...n.entries()].map(([i,a])=>({entity:[...a.entities].sort().join(", "),privilegeId:i,privilegeName:a.privilegeName,privilegeType:a.privilegeType,scope:a.scope}))}async function f7(e,t,r,n){if(r.length===0&&!n)return;let i={Privileges:r.map(o=>({Depth:Wm[o.scope],PrivilegeId:o.privilegeId}))},a=`/roles(${t})/Microsoft.Dynamics.CRM.ReplacePrivilegesRole`;(0,dr.ensureSuccess)(await e.post(a,i),e.apiUrl(a))}async function U_(e,t,r,n,i){var a,o;let s=`/${t}(${r})/${n}${(0,Qe.odataQuery)([["$select","roleid"],["$filter",`roleid eq ${i}`]])}`;return((o=(a=(0,dr.ensureSuccess)(await e.get(s),e.apiUrl(s)).body)===null||a===void 0?void 0:a.value)!==null&&o!==void 0?o:[]).length>0}async function m7(e,t,r){var n,i;let a=[],o=[],s={"@odata.id":e.apiUrl(`/roles(${t})`)};for(let l of(n=r?.teams)!==null&&n!==void 0?n:[]){let u=(0,Qe.normalizeGuid)(l,"teamId");if(!await U_(e,"teams",u,"teamroles_association",t)){let c=`/teams(${u})/teamroles_association/$ref`;(0,dr.ensureSuccess)(await e.post(c,s),e.apiUrl(c))}a.push(u)}for(let l of(i=r?.users)!==null&&i!==void 0?i:[]){let u=(0,Qe.normalizeGuid)(l,"userId");if(!await U_(e,"systemusers",u,"systemuserroles_association",t)){let c=`/systemusers(${u})/systemuserroles_association/$ref`;(0,dr.ensureSuccess)(await e.post(c,s),e.apiUrl(c))}o.push(u)}return{teams:a,users:o}}async function $_(e,t,r){var n,i;let a=`/roles${(0,Qe.odataQuery)([["$select","roleid,description,ismanaged"],["$filter",`name eq '${(0,Qe.odataLiteral)(t)}' and _businessunitid_value eq ${r}`]])}`,l=((i=(n=(0,dr.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[]).filter(d=>!!d.roleid);if(l.length===0)return;let u=d=>{var p;return d.ismanaged!==!0&&((p=d.description)!==null&&p!==void 0?p:"")===st.SDK_ROLE_MARKER};if(l.some(d=>!u(d)))throw new Bt.InvalidArgumentError(`A role named '${t}' already exists in this business unit and was not created by the SDK; refusing to modify or assign it. Choose a different persona/role name.`);if(l.length>1)throw new Bt.InvalidArgumentError(`Multiple (${l.length}) SDK-owned roles named '${t}' exist in this business unit; refusing to reuse one arbitrarily. Remove the duplicate role(s) and retry.`);let c=l[0].roleid;return c?(0,Qe.normalizeGuid)(c,"roleId"):void 0}function h7(e){var t,r;return{teams:((t=e?.teams)!==null&&t!==void 0?t:[]).map(n=>(0,Qe.normalizeGuid)(n,"teamId")),users:((r=e?.users)!==null&&r!==void 0?r:[]).map(n=>(0,Qe.normalizeGuid)(n,"userId"))}}function G_(e){return e.map(t=>({entity:t.entity,privilegeName:t.privilegeName,privilegeType:t.privilegeType,scope:t.scope}))}async function z_(e,t){var r,n;let i=(r=t.name)===null||r===void 0?void 0:r.trim();if(!i)throw new Bt.InvalidArgumentError("createSecurityRole: a non-empty role name is required.");let a=t.businessUnitId?(0,Qe.normalizeGuid)(t.businessUnitId,"businessUnitId"):await p7(e),o=await V_(e,(n=t.privileges)!==null&&n!==void 0?n:[]),s=h7(t.assignTo),l=await $_(e,i,a),u=l!==void 0;if(!l){let d="/roles",p={name:i,description:st.SDK_ROLE_MARKER,"[email protected]":`/businessunits(${a})`};try{let f=(0,dr.ensureSuccess)(await e.post(d,p),e.apiUrl(d));l=(0,Qe.normalizeGuid)((0,dr.requireCreatedId)(f,"roleid","role"),"roleId")}catch(f){let h;try{h=await $_(e,i,a)}catch{h=void 0}if(!h)throw f;l=h}}await f7(e,l,o,u);let c=await m7(e,l,s);return{roleId:l,name:i,reused:u,appliedPrivileges:G_(o),assignedTeams:c.teams,assignedUsers:c.users}}st.createSecurityRole=z_;async function g7(e,t){var r,n;let i=(r=t.persona)===null||r===void 0?void 0:r.trim();if(!i)throw new Bt.InvalidArgumentError("createPersonaRole: a non-empty persona name is required.");let a=[...t.jobs.flatMap(o=>{var s;return(s=o.privileges)!==null&&s!==void 0?s:[]}),...(n=t.additionalPrivileges)!==null&&n!==void 0?n:[]];return z_(e,{name:i,businessUnitId:t.businessUnitId,privileges:a,assignTo:t.assignTo})}st.createPersonaRole=g7;async function v7(e,t){let n=`/roles(${(0,Qe.normalizeGuid)(t,"roleId")})`;(0,dr.ensureSuccess)(await e.delete(n),e.apiUrl(n))}st.deleteSecurityRole=v7;async function y7(e,t,r){let n=(0,Qe.normalizeGuid)(t,"roleId");if(r.length===0)throw new Bt.InvalidArgumentError("addEntityPrivilegesToRole requires at least one entity privilege (an empty grant would be a silent no-op).");let i=await V_(e,r),a={Privileges:i.map(s=>({Depth:Wm[s.scope],PrivilegeId:s.privilegeId}))},o=`/roles(${n})/Microsoft.Dynamics.CRM.AddPrivilegesRole`;return(0,dr.ensureSuccess)(await e.post(o,a),e.apiUrl(o)),G_(i)}st.addEntityPrivilegesToRole=y7;var b7=new Map(Object.keys(ic).map(e=>[ic[e],e]));async function w7(e,t){return(await q_(e,t)).map(n=>{let i=Object.keys(zm).filter(o=>n[zm[o]]!==!1),a=b7.get(n.PrivilegeType);return{name:n.Name,privilegeId:n.PrivilegeId,privilegeType:n.PrivilegeType,...a?{access:a}:{},scopes:i}})}st.getEntityPrivileges=w7});var X_=g(Ut=>{"use strict";Object.defineProperty(Ut,"__esModule",{value:!0});Ut.createMakerSdk=Ut.MakerSdk=Ut.PUSH_NOT_ATTEMPTED_CODE=Ut.ALREADY_EXISTS_CODE=void 0;var H_=Dc(),te=ne(),pr=Es(),A7=mg(),K_=bg(),C7=Ng(),S7=_c(),E7=zg(),Hm=Wg(),Je=xs(),j_=Qc(),sn=qs(),ac=I0(),Ma=Gs(),N7=Ws(),lt=x0(),D7=id(),I7=S_(),_7=Rn(),T7=ct(),P7=Ci(),ln=Zf(),Q_=Oc(),O7=3e5,kr=be(),Vn=ie(),Ba=R_(),J_=F_(),R7=L_(),F7=wf(),fs=W_();function x7(e){let t=e.workspaceStorage;if(t==null)throw new Error("createMakerSdk requires a workspaceStorage. Node callers can build one with `createNodeWorkspaceStorage(path)` from '@maker-studio/cds-maker-sdk/node'; a host with no filesystem implements WorkspaceStorage directly.");return new K_.WorkspaceManager(L7,e.instanceUrl,(0,S7.assertStorageContract)(t))}Ut.ALREADY_EXISTS_CODE="ARTIFACT_ALREADY_EXISTS";Ut.PUSH_NOT_ATTEMPTED_CODE="PUSH_NOT_ATTEMPTED";var L7="<injected workspaceStorage>",oc=class{constructor(t){var r,n;this.artifactLocks=new Map,(0,_7.installDomShim)(),this.languageCode=(r=t.languageCode)!==null&&r!==void 0?r:P7.DEFAULT_LCID,this.cacheStalenessMs=(n=t.cacheStalenessMs)!==null&&n!==void 0?n:O7,this.workspace=x7(t),this.versions=new C7.VersionManager(this.workspace),this.dataverse=new E7.DataverseClient(t.instanceUrl,t.httpClient,t.solutionUniqueName),this.registrations=(0,I7.buildRegistrations)(this.languageCode)}async initWorkspace(){await this.workspace.init()}async getManifest(){return this.workspace.getManifest()}async cleanWorkspace(){await this.workspace.clean()}withArtifactLock(t,r,n){var i;let a=`${t}\0${(0,K_.canonicalArtifactId)(r)}`,s=((i=this.artifactLocks.get(a))!==null&&i!==void 0?i:Promise.resolve()).then(n,n),l=s.then(()=>{},()=>{});return this.artifactLocks.set(a,l),l.then(()=>{this.artifactLocks.get(a)===l&&this.artifactLocks.delete(a)}),s}async fetchArtifact(t,r,n){return this.withArtifactLock(t,r,()=>this.fetchArtifactUnlocked(t,r,n))}async fetchArtifactUnlocked(t,r,n){var i,a;let o=this.requireRegistration(t,"fetchArtifact"),{raw:s,etag:l,memberEtags:u,siblingEtags:c}=await o.api.get(this.dataverse,r),d=o.adapter.fromApiResponse(s);if(!n?.overwrite&&await this.versions.isDirty(t,r)){let p=(a=(i=await this.versions.getMeta(t,r))===null||i===void 0?void 0:i.etag)!==null&&a!==void 0?a:null;if(p&&l&&p!==l)throw new te.LocalEditsWouldBeLostError(t,r,p,l);let f=await this.workspace.readArtifact(t,r);if(f){let h=await this.versions.getMeta(t,r);if(h&&!h.etag&&l){if(!(0,Q_.deepEqual)(h.snapshot,d))throw new te.LocalEditsWouldBeLostError(t,r,p,l);await this.versions.storeMeta(t,r,{...h,etag:l,fetchedAt:(0,kr.nowIso)()})}return(0,ln.cloneJson)(f)}}return await this.workspace.writeArtifact(t,r,d),await this.versions.storeMeta(t,r,{etag:l,languageCode:this.languageCode,fetchedAt:(0,kr.nowIso)(),snapshot:(0,ln.cloneJson)(d),...u?{memberEtags:u}:{},...c?{siblingEtags:c}:{}}),(0,ln.cloneJson)(d)}async fetchArtifactList(t,r){return this.requireRegistration(t,"fetchArtifactList").api.list(this.dataverse,r)}async fetchSolution(t){var r;let n=await(0,lt.fetchSolutionComponents)(this.dataverse,t),i=[],a=[];for(let o of n)try{let s=await this.resolveComponentType(o);if(!s){a.push({componentId:o.objectId,componentType:o.componentType,workflowCategory:o.workflowCategory,reason:"unsupported"});continue}let l=await this.fetchArtifact(s,o.objectId);i.push({type:s,id:o.objectId,name:typeof l.name=="string"?l.name:(r=o.displayName)!==null&&r!==void 0?r:o.objectId,entityLogicalName:typeof l.entityLogicalName=="string"?l.entityLogicalName:void 0,lastFetched:(0,kr.nowIso)(),isDirty:!1})}catch(s){a.push({componentId:o.objectId,componentType:o.componentType,workflowCategory:o.workflowCategory,reason:"failed",error:ms(s)})}return await this.workspace.updateManifest({lastSyncAt:(0,kr.nowIso)()}),{summaries:i,skipped:a}}async fetchEntityMetadata(t){let r=await(0,Hm.fetchEntityMetadataFromApi)(this.dataverse,t);return await this.workspace.writeEntityMetadata(t,r),r}findTables(t,r){return(0,Hm.findTables)(this.dataverse,t,r)}findColumns(t,r,n){return(0,Hm.findColumns)(this.dataverse,t,r,n)}createTable(t){return(0,Je.createTable)(this.dataverse,t)}createColumn(t,r){return(0,Je.createColumn)(this.dataverse,t,r)}createColumns(t,r){return(0,Je.createColumns)(this.dataverse,t,r)}updateColumn(t,r,n){return(0,Je.updateColumn)(this.dataverse,t,r,n)}deleteColumn(t,r){return(0,Je.deleteColumn)(this.dataverse,t,r)}setFormSecurityRoles(t,r){return(0,j_.setFormSecurityRoles)(this.dataverse,t,r)}getFormSecurityRoles(t){return(0,j_.getFormSecurityRoles)(this.dataverse,t)}setColumnVisualization(t,r,n){return(0,Je.setColumnVisualization)(this.dataverse,t,r,n)}getColumnVisualization(t,r){return(0,Je.getColumnVisualization)(this.dataverse,t,r)}createCustomerColumn(t,r){return(0,Je.createCustomerColumn)(this.dataverse,t,r)}insertStatusValue(t,r){return(0,Je.insertStatusValue)(this.dataverse,t,r)}updateTable(t,r){return(0,Je.updateTable)(this.dataverse,t,r)}async setEntityIcon(t,r){if(await(0,Je.updateTable)(this.dataverse,t,{iconVectorName:r.vector,iconSmallName:r.small,iconMediumName:r.medium,iconLargeName:r.large}),r.publish!==!1){let n=`<importexportxml><entities><entity>${(0,Vn.xmlText)(t)}</entity></entities></importexportxml>`;(0,kr.ensureSuccess)(await this.dataverse.post("/PublishXml",{ParameterXml:n}),this.dataverse.apiUrl("/PublishXml"))}}createAlternateKey(t,r){return(0,Je.createAlternateKey)(this.dataverse,t,r)}deleteAlternateKey(t,r){return(0,Je.deleteAlternateKey)(this.dataverse,t,r)}createRelationship(t){return(0,Je.createRelationship)(this.dataverse,t)}deleteRelationship(t){return(0,Je.deleteRelationship)(this.dataverse,t)}createGlobalOptionSet(t){return(0,Je.createGlobalOptionSet)(this.dataverse,t)}deleteGlobalOptionSet(t){return(0,Je.deleteGlobalOptionSet)(this.dataverse,t)}deleteTable(t){return(0,Je.deleteTable)(this.dataverse,t)}createSecurityRole(t){return(0,fs.createSecurityRole)(this.dataverse,t)}createPersonaRole(t){return(0,fs.createPersonaRole)(this.dataverse,t)}deleteSecurityRole(t){return(0,fs.deleteSecurityRole)(this.dataverse,t)}addEntityPrivilegesToRole(t,r){return(0,fs.addEntityPrivilegesToRole)(this.dataverse,t,r)}getEntityPrivileges(t){return(0,fs.getEntityPrivileges)(this.dataverse,t)}createRecord(t,r){return(0,sn.createRecord)(this.dataverse,t,r)}createRecordsBulk(t,r){return(0,sn.createRecordsBulk)(this.dataverse,t,r)}updateRecord(t,r,n){return(0,sn.updateRecord)(this.dataverse,t,r,n)}upsertRecord(t,r,n){return(0,sn.upsertRecord)(this.dataverse,t,r,n)}deleteRecord(t,r){return(0,sn.deleteRecord)(this.dataverse,t,r)}getRecord(t,r,n){return(0,sn.getRecord)(this.dataverse,t,r,n)}queryRecords(t,r){return(0,sn.queryRecords)(this.dataverse,t,r)}seedRecordGraph(t,r){return(0,R7.seedRecordGraph)(this.dataverse,t,r)}resolveArtifact(t,r){return(0,J_.resolveArtifact)(this.dataverse,t,r)}findArtifact(t,r){return(0,J_.findArtifact)(this.dataverse,t,r)}async deleteAppCascade(t,r){let n=await(0,D7.deleteAppCascade)(this.dataverse,t,r),i=(0,Vn.normalizeGuid)(t,"appModuleId");return await this.workspace.readArtifact("app",i)&&await this.workspace.deleteArtifact("app",i),n}associateRecords(t,r,n){return(0,sn.associateRecords)(this.dataverse,t,r,n)}disassociateRecords(t,r,n,i){return(0,sn.disassociateRecords)(this.dataverse,t,r,n,i)}createWebResource(t){return(0,ac.createWebResource)(this.dataverse,t)}updateWebResource(t,r){return(0,ac.updateWebResource)(this.dataverse,t,r)}getWebResource(t){return(0,ac.getWebResource)(this.dataverse,t)}deleteWebResource(t){return(0,ac.deleteWebResource)(this.dataverse,t)}getAppSettings(t){return(0,Ma.readAppSettings)(this.dataverse,t)}setAppSetting(t,r,n){return(0,Ma.setAppSetting)(this.dataverse,t,r,n)}setHeaderAndNavigationRefresh(t,r){if(typeof r!="boolean")throw new te.ValidationError("app",t,[{pointer:"/headerAndNavigationRefresh",rule:N7.HEADER_NAV_BOOLEAN_RULE,message:`enabled must be a boolean, got ${typeof r}`}]);return(0,Ma.setAppSetting)(this.dataverse,t,Ma.HEADER_AND_NAVIGATION_REFRESH,r?Ma.APP_SETTING_ON:Ma.APP_SETTING_OFF)}getSolution(t){return(0,lt.getSolution)(this.dataverse,t)}createPublisher(t){return(0,lt.createPublisher)(this.dataverse,t)}createSolution(t){return(0,lt.createSolution)(this.dataverse,t)}setSolutionVersion(t,r){return(0,lt.setSolutionVersion)(this.dataverse,t,r)}addSolutionComponent(t){return(0,lt.addSolutionComponent)(this.dataverse,t)}removeSolutionComponent(t,r,n){return(0,lt.removeSolutionComponent)(this.dataverse,t,r,n)}exportSolution(t){return(0,lt.exportSolution)(this.dataverse,t)}importSolution(t){return(0,lt.importSolution)(this.dataverse,t)}deleteSolution(t){return(0,lt.deleteSolution)(this.dataverse,t)}async getArtifact(t,r){return this.withArtifactLock(t,r,()=>this.getArtifactUnlocked(t,r))}async getArtifactUnlocked(t,r){return(0,ln.cloneJson)(await this.readRaw(t,r))}async readRaw(t,r){return await this.revalidateIfStale(t,r),this.readLocal(t,r)}async readForMutation(t,r,n){if(await this.revalidateIfStale(t,r)==="refreshed-changed")throw new te.StaleArtifactError(t,r,n);return this.readLocal(t,r)}async readLocal(t,r){let n=await this.workspace.readArtifact(t,r);if(!n)throw new te.ArtifactNotFoundError(t,r);return n}async revalidateIfStale(t,r){let n=await this.versions.getMeta(t,r);if(!n)return"skipped";let i=n.fetchedAt?Date.parse(n.fetchedAt):NaN,a=Date.now()-i;if(!Number.isNaN(i)&&this.cacheStalenessMs>0&&a<=this.cacheStalenessMs)return"fresh";if(await this.versions.isDirty(t,r))return"skipped";let o=await this.workspace.readArtifact(t,r);await this.fetchArtifactUnlocked(t,r);let s=await this.workspace.readArtifact(t,r);return(0,Q_.deepEqual)(o,s)?"refreshed-unchanged":"refreshed-changed"}async queryTree(t,r,n){return this.withArtifactLock(t,r,async()=>{let i=await this.getArtifactUnlocked(t,r),a=pr.JsonPointer.resolve(i,n);if(a===void 0)throw new te.PathNotFoundError(t,r,n);return a})}async findElements(t,r,n){return this.withArtifactLock(t,r,async()=>(0,A7.findElements)(await this.getArtifactUnlocked(t,r),n))}async withDirtyFlags(t){let r=[];for(let n of t)r.push({...n,isDirty:await this.versions.isDirty(n.type,n.id)});return r}async listArtifacts(t,r){return this.withDirtyFlags(await this.workspace.listArtifacts(t,r))}async getEntityMetadata(t){let r=await this.workspace.readEntityMetadata(t);if(!r)throw new te.ArtifactNotFoundError("entityMetadata",t);return r}async getFieldMetadata(t,r){let i=(await this.getEntityMetadata(t)).attributes.find(a=>a.logicalName===r);if(!i)throw new te.PathNotFoundError("entityMetadata",t,r);return i}async updateElement(t,r,n,i){return this.withArtifactLock(t,r,async()=>{let a=await this.readForMutation(t,r,n),o=pr.JsonPointer.resolve(a,n);if(o===void 0)throw new te.PathNotFoundError(t,r,n);let s=Ua(o)&&Ua(i)?{...o,...i}:i;return pr.JsonPointer.set(a,n,(0,ln.cloneJson)(s)),this.assertStructurallyValid(t,r,a,n),await this.workspace.writeArtifact(t,r,a),this.getArtifactUnlocked(t,r)})}async addElement(t,r,n,i,a){return this.withArtifactLock(t,r,async()=>{let o=await this.readForMutation(t,r,n),s=pr.JsonPointer.resolve(o,n);if(s===void 0)throw new te.PathNotFoundError(t,r,n);if(!Array.isArray(s)){if(!Ua(s)||!Ua(i))throw new te.ValidationError(t,r,n,"parent must be an array, or an object with an object of properties to add");if(a?.position!==void 0)throw new te.ValidationError(t,r,n,"position is not supported for an object parent");let c=this.assignMissingIds(t,(0,ln.cloneJson)(i));for(let d of Object.keys(c))pr.JsonPointer.set(o,pr.JsonPointer.append(n,d),c[d]);return this.assertStructurallyValid(t,r,o,n),await this.workspace.writeArtifact(t,r,o),this.getArtifactUnlocked(t,r)}let l=this.assignMissingIds(t,(0,ln.cloneJson)(i)),u=B7(s,a?.position);return s.splice(u,0,l),this.assertStructurallyValid(t,r,o,n),await this.workspace.writeArtifact(t,r,o),this.getArtifactUnlocked(t,r)})}async moveElement(t,r,n,i,a){return this.withArtifactLock(t,r,async()=>{var o;let s=await this.readForMutation(t,r,n),l=pr.JsonPointer.resolve(s,n);if(l===void 0)throw new te.PathNotFoundError(t,r,n);let u=pr.JsonPointer.resolve(s,i);if(u===void 0)throw new te.PathNotFoundError(t,r,i);if(!Array.isArray(u))throw new te.ValidationError(t,r,i,"move target must be an array");if(i===n||i.startsWith(`${n}/`))throw new te.ValidationError(t,r,i,"cannot move an element into its own subtree");pr.JsonPointer.remove(s,n);let c=(o=a?.index)!==null&&o!==void 0?o:u.length;return u.splice(Math.max(0,Math.min(c,u.length)),0,l),this.assertStructurallyValid(t,r,s,i),await this.workspace.writeArtifact(t,r,s),this.getArtifactUnlocked(t,r)})}async removeElement(t,r,n){return this.withArtifactLock(t,r,async()=>{let i=await this.readForMutation(t,r,n);if(pr.JsonPointer.resolve(i,n)===void 0)throw new te.PathNotFoundError(t,r,n);return pr.JsonPointer.remove(i,n),this.assertStructurallyValid(t,r,i,M7(n)),await this.workspace.writeArtifact(t,r,i),this.getArtifactUnlocked(t,r)})}assertStructurallyValid(t,r,n,i){var a,o,s;let l=this.registrations.get(t),u=(s=(o=l==null?void 0:(a=l.adapter).validate)===null||o===void 0?void 0:o.call(a,n,i))!==null&&s!==void 0?s:[];if(u.length>0)throw new te.ValidationError(t,r,u)}retrieveSetting(t,r){return(0,Ba.retrieveSetting)(this.dataverse,t,r)}saveSettingValue(t,r,n){return(0,Ba.saveSettingValue)(this.dataverse,t,r,n)}getAiReadiness(t){return(0,Ba.getAiReadiness)(this.dataverse,t)}setAppAiFeatures(t,r,n){return(0,Ba.setAppAiFeatures)(this.dataverse,t,r,n)}configureRowSummary(t,r){return(0,Ba.configureRowSummary)(this.dataverse,t,r)}removeRowSummary(t){return(0,Ba.removeRowSummary)(this.dataverse,t)}async enrichDefaultViews(t,r,n={}){let i=await(0,F7.findDefaultViews)(this.dataverse,t,n);for(let a of i)await this.fetchArtifact("view",a.id),await this.updateElement("view",a.id,"/columns",r),await this.pushArtifact("view",a.id);return i.length&&await this.publishArtifact("view",i[0].id),{updated:i.map(a=>a.id)}}async createArtifact(t,r){let n=this.requireRegistration(t,"createArtifact"),i=n.adapter.assignMissingIds(n.adapter.createDefault(r)),a=i.id;if(!a)throw new te.ValidationError(t,"(new)","/id","created artifact must have an id");return this.withArtifactLock(t,a,async()=>(await this.workspace.writeArtifact(t,a,i),(0,ln.cloneJson)(i)))}async deleteArtifact(t,r){return this.withArtifactLock(t,r,async()=>{await this.workspace.deleteArtifact(t,r)})}async deleteRemoteArtifact(t,r){return this.withArtifactLock(t,r,async()=>{await this.requireRegistration(t,"deleteRemoteArtifact").api.delete(this.dataverse,r),await this.workspace.readArtifact(t,r)&&await this.workspace.deleteArtifact(t,r)})}async publishArtifact(t,r,n){return this.withArtifactLock(t,r,()=>this.publishArtifactUnlocked(t,r,n))}async publishArtifactUnlocked(t,r,n){var i;let a=await this.readRaw(t,r),o=this.registrations.get(t);if(!o?.publish)return{type:t,id:r,shipped:!1,publish:{kind:"notApplicable"}};let s=(i=o.publishScope)===null||i===void 0?void 0:i.call(o,r,a);try{await o.publish(this.dataverse,r,a)}catch(u){return{type:t,id:r,shipped:!1,publish:{kind:"failed",error:ms(u)},...s?{publishScope:s}:{}}}if(!n?.verify)return{type:t,id:r,shipped:!1,publish:{kind:"submitted"},...s?{publishScope:s}:{}};let l=await this.verifyPublished(t,r);return{type:t,id:r,shipped:l.kind==="verified",publish:l,...s?{publishScope:s}:{}}}async verifyPublished(t,r){if(t!=="app")return{kind:"unverifiable",reason:`published-projection verification is not characterised for '${t}'; the publish was submitted`};try{let n=`/appmodules(${(0,Vn.normalizeGuid)(r,"id")})${(0,Vn.odataQuery)([["$select","appmoduleid"]])}`,i=await this.dataverse.get(n);return i.status>=200&&i.status<300?{kind:"verified"}:{kind:"unverifiable",reason:`the published projection answered HTTP ${i.status}`}}catch(n){return{kind:"unverifiable",reason:ms(n).message}}}async pushArtifact(t,r){return this.withArtifactLock(t,r,()=>this.pushArtifactUnlocked(t,r))}async prepareArtifactUnlocked(t,r){let n=this.requireRegistration(t,"pushArtifact"),i=await this.readLocal(t,r),a=await this.versions.getMeta(t,r);this.assertLanguageMatches(t,r,a,n);let o=await this.buildMetadataContext(n.adapter,i),s=await n.adapter.toApiPayload(i,a?.snapshot,o);return await this.assertSemanticallyComplete(n,t,r,i,a===null,a?.everActivated),{type:t,id:r,reg:n,json:i,meta:a,payload:s}}async assertSemanticallyComplete(t,r,n,i,a,o){var s;let l=t.adapter.issuesBlockingPush;if(!l)return;let u=i.entityLogicalName,c=u?await this.workspace.readEntityMetadata(u):null,d=((s=c?.attributes)!==null&&s!==void 0?s:[]).map(f=>({logicalName:f.logicalName,displayName:f.displayName,attributeType:f.attributeType,isCustomAttribute:f.isCustomAttribute,...f.maxLength!==void 0?{maxLength:f.maxLength}:{},...f.options?{options:f.options.map(h=>({value:h.value,label:h.label}))}:{},...f.targets?{targets:f.targets}:{}})),p=l.call(t.adapter,i,d,{isCreate:a,everActivated:o});if(p.length>0)throw new te.ValidationError(r,n,p)}async pushArtifactUnlocked(t,r){return this.executePrepared(await this.prepareArtifactUnlocked(t,r))}async executePrepared(t){var r,n,i,a,o,s;let{type:l,id:u,reg:c,json:d,meta:p,payload:f}=t;try{let h=p?await c.api.update(this.dataverse,u,f,p.etag,p.memberEtags,p.siblingEtags):await this.createWithMintedId(c,l,u,f),v=u;return p||(h.serverIdentity&&c.adapter.applyServerIdentity&&c.adapter.applyServerIdentity(d,h.serverIdentity),h.id&&h.id!==u&&(d.id=h.id,await this.workspace.deleteArtifact(l,u),v=h.id),await this.workspace.writeArtifact(l,v,d)),await this.versions.storeMeta(l,v,{etag:h.etag,languageCode:this.languageCode,fetchedAt:(0,kr.nowIso)(),snapshot:(0,ln.cloneJson)(d),...h.memberEtags?{memberEtags:h.memberEtags}:{},...h.siblingEtags?{siblingEtags:h.siblingEtags}:{}}),{type:l,id:v,saved:!0,shipped:!1,publish:(r=h.publish)!==null&&r!==void 0?r:{kind:"notRequested"},...h.publish&&h.publish.kind!=="notRequested"?(()=>{var w;let E=(w=c.publishScope)===null||w===void 0?void 0:w.call(c,v,d);return E?{publishScope:E}:{}})():{},...h.warnings&&h.warnings.length>0?{warnings:h.warnings}:{}}}catch(h){let v=(0,te.readPartialTokens)(h);if(v&&p){let w={...(n=p.memberEtags)!==null&&n!==void 0?n:{},...(i=v.memberEtags)!==null&&i!==void 0?i:{}},E={...(a=p.siblingEtags)!==null&&a!==void 0?a:{},...(o=v.siblingEtags)!==null&&o!==void 0?o:{}};await this.versions.storeMeta(l,u,{...p,...Object.keys(w).length>0?{memberEtags:w}:{},...Object.keys(E).length>0?{siblingEtags:E}:{}})}if(h instanceof te.SdkError&&h.code===Ut.ALREADY_EXISTS_CODE)return{type:l,id:u,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:h};if(h instanceof te.SdkError&&h.code===H_.WFOM_API_UNAVAILABLE_CODE)return{type:l,id:u,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:h};if(h instanceof te.SdkError&&h.code===H_.BUSINESS_RULE_LEFT_DEACTIVATED_CODE)return{type:l,id:u,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:h};if(h instanceof te.SdkError&&h.code===kr.VERSION_CONFLICT_CODE)return{type:l,id:u,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:new te.VersionConflictError(l,u,(s=p?.etag)!==null&&s!==void 0?s:null,null,h.message)};throw h}}assertLanguageMatches(t,r,n,i){if(i?.languageSensitive&&!(n?.languageCode===void 0||n.languageCode===this.languageCode))throw new te.SdkError("ARTIFACT_LANGUAGE_MISMATCH",`Refusing to push ${t} '${r}': it was fetched with languageCode ${n.languageCode} but this SDK is configured with ${this.languageCode}. Pushing would rewrite labels read in one language as labels in another. Re-fetch with languageCode ${this.languageCode}, or create the SDK with languageCode ${n.languageCode}.`)}async createWithMintedId(t,r,n,i){try{return await t.api.create(this.dataverse,i,n)}catch(a){throw!(a instanceof te.SdkError)||a.code!==kr.VERSION_CONFLICT_CODE?a:new te.SdkError(Ut.ALREADY_EXISTS_CODE,`Cannot create ${r} '${n}': a record already exists at that id, so an earlier push of this artifact committed before its local version metadata was saved. No duplicate was created. Run fetchArtifact('${r}', '${n}') to adopt the existing record's identity, etag and snapshot, then push again \u2014 that push will be a conditional update. This is not done automatically because the only recovery available here would be an UNCONDITIONAL overwrite, which would destroy any edit made to the record in the meantime.`)}}async buildMetadataContext(t,r){var n,i;let a=(i=(n=t.metadataNeeds)===null||n===void 0?void 0:n.call(t,r))!==null&&i!==void 0?i:[];if(a.length===0)return;let o=new Set(a.map(l=>l.entityLogicalName).filter(l=>!!l)),s=new Map;for(let l of o){let u=await this.workspace.readEntityMetadata(l);if(!u)try{await this.fetchEntityMetadata(l),u=await this.workspace.readEntityMetadata(l)}catch{}u&&s.set(l,u)}return{resolveField:(l,u)=>{let c=s.get(l),d=c?.attributes.find(p=>p.logicalName===u);return d?{displayName:d.displayName,attributeType:d.attributeType}:void 0}}}async pushAll(){let t=await this.getDirtyArtifacts();await this.warmBatchMetadata(t);let r=new Map;for(let i=0;i<t.length;i+=1){let a=t[i];try{await this.withArtifactLock(a.type,a.id,()=>this.prepareArtifactUnlocked(a.type,a.id))}catch(o){r.set(i,{type:a.type,id:a.id,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:ms(o)})}}if(r.size>0)return t.map((i,a)=>{var o;return(o=r.get(a))!==null&&o!==void 0?o:{type:i.type,id:i.id,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:new te.SdkError(Ut.PUSH_NOT_ATTEMPTED_CODE,`Not attempted: ${r.size} artifact(s) in this batch could not be prepared, so no writes were issued. Fix the reported failures and push again.`)}});let n=[];for(let i of t)try{n.push(await this.pushArtifact(i.type,i.id))}catch(a){n.push({type:i.type,id:i.id,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:ms(a)})}return n}async warmBatchMetadata(t){var r,n,i;let a=new Set;for(let o of t){let s=this.registrations.get(o.type);if(!s)continue;let l;try{l=await this.readLocal(o.type,o.id)}catch{continue}let u=l.entityLogicalName;u&&a.add(u);for(let c of(i=(n=(r=s.adapter).metadataNeeds)===null||n===void 0?void 0:n.call(r,l))!==null&&i!==void 0?i:[])c.entityLogicalName&&a.add(c.entityLogicalName)}for(let o of a)if(!await this.workspace.readEntityMetadata(o))try{await this.fetchEntityMetadata(o)}catch{}}async getDirtyArtifacts(){return(await this.withDirtyFlags(await this.workspace.listArtifacts())).filter(r=>r.isDirty)}async diffArtifact(t,r){return this.versions.diff(t,r)}assignMissingIds(t,r){let n=this.registrations.get(t);return n?n.adapter.assignMissingIds(r):(0,T7.assignMissingIds)(r)}async resolveComponentType(t){switch(t.componentType){case lt.SolutionComponentType.SavedQuery:return"view";case lt.SolutionComponentType.SavedQueryVisualization:return"chart";case lt.SolutionComponentType.AppModule:return"app";case lt.SolutionComponentType.UxAgentProject:return"genPage";case lt.SolutionComponentType.Workflow:return t.workflowCategory===2?"businessRule":t.workflowCategory===4&&await this.isBusinessFlowWorkflow(t.objectId)?"bpf":void 0;case lt.SolutionComponentType.SystemForm:return await this.isDashboardForm(t.objectId)?"dashboard":"form";default:return}}async isDashboardForm(t){let n=`/systemforms(${(0,Vn.normalizeGuid)(t,"formId")})${(0,Vn.odataQuery)([["$select","type"]])}`,i=(0,kr.ensureSuccess)(await this.dataverse.get(n),this.dataverse.apiUrl(n)),a=Number(i.body.type);return a===0||a===10}async isBusinessFlowWorkflow(t){let n=`/workflows(${(0,Vn.normalizeGuid)(t,"workflowId")})${(0,Vn.odataQuery)([["$select","businessprocesstype"]])}`,i=(0,kr.ensureSuccess)(await this.dataverse.get(n),this.dataverse.apiUrl(n));return Number(i.body.businessprocesstype)===0}requireRegistration(t,r){let n=this.registrations.get(t);if(!n)throw new te.NotImplementedError(r,`no adapter registered for artifact type '${t}'`);return n}};Ut.MakerSdk=oc;function k7(e){return new oc(e)}Ut.createMakerSdk=k7;function ms(e){return e instanceof Error?e:new Error(String(e))}function Ua(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function M7(e){let t=e.lastIndexOf("/");return t<=0?"":e.slice(0,t)}function B7(e,t){if(t===void 0||t==="end")return e.length;if(t==="start")return 0;if("index"in t)return Math.max(0,Math.min(t.index,e.length));if("before"in t){let n=e.findIndex(i=>Ua(i)&&i.id===t.before);return n<0?e.length:n}let r=e.findIndex(n=>Ua(n)&&n.id===t.after);return r<0?e.length:r+1}});var Y_=g(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});sc.ARTIFACT_TYPES=void 0;sc.ARTIFACT_TYPES=["form","view","businessRule","app","command","chart","dashboard","genPage","bpf"]});var eT=g(Z_=>{"use strict";Object.defineProperty(Z_,"__esModule",{value:!0})});var rT=g(tT=>{"use strict";Object.defineProperty(tT,"__esModule",{value:!0})});var iT=g(nT=>{"use strict";Object.defineProperty(nT,"__esModule",{value:!0})});var oT=g(aT=>{"use strict";Object.defineProperty(aT,"__esModule",{value:!0})});var lT=g(sT=>{"use strict";Object.defineProperty(sT,"__esModule",{value:!0})});var cT=g(uT=>{"use strict";Object.defineProperty(uT,"__esModule",{value:!0})});var pT=g(dT=>{"use strict";Object.defineProperty(dT,"__esModule",{value:!0})});var mT=g(fT=>{"use strict";Object.defineProperty(fT,"__esModule",{value:!0})});var gT=g(hT=>{"use strict";Object.defineProperty(hT,"__esModule",{value:!0})});var yT=g(vT=>{"use strict";Object.defineProperty(vT,"__esModule",{value:!0})});var wT=g(bT=>{"use strict";Object.defineProperty(bT,"__esModule",{value:!0})});var CT=g(AT=>{"use strict";Object.defineProperty(AT,"__esModule",{value:!0})});var ET=g(ST=>{"use strict";Object.defineProperty(ST,"__esModule",{value:!0})});var DT=g(NT=>{"use strict";Object.defineProperty(NT,"__esModule",{value:!0})});var _T=g(IT=>{"use strict";Object.defineProperty(IT,"__esModule",{value:!0})});var PT=g(TT=>{"use strict";Object.defineProperty(TT,"__esModule",{value:!0})});var RT=g(OT=>{"use strict";Object.defineProperty(OT,"__esModule",{value:!0})});var xT=g(FT=>{"use strict";Object.defineProperty(FT,"__esModule",{value:!0})});var kT=g(LT=>{"use strict";Object.defineProperty(LT,"__esModule",{value:!0})});var MT=g(le=>{"use strict";var U7=le&&le.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),Ie=le&&le.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&U7(t,e,r)};Object.defineProperty(le,"__esModule",{value:!0});le.createMakerSdk=void 0;var $7=X_();Object.defineProperty(le,"createMakerSdk",{enumerable:!0,get:function(){return $7.createMakerSdk}});Ie(Y_(),le);Ie(eT(),le);Ie(rT(),le);Ie(iT(),le);Ie(oT(),le);Ie(lT(),le);Ie(cT(),le);Ie(pT(),le);Ie(mT(),le);Ie(gT(),le);Ie(yT(),le);Ie(wT(),le);Ie(CT(),le);Ie(Ws(),le);Ie(ET(),le);Ie(DT(),le);Ie(_T(),le);Ie(PT(),le);Ie(RT(),le);Ie(xT(),le);Ie(kT(),le);Ie(ne(),le)});var Qm=g(Mr=>{"use strict";var q7=Mr&&Mr.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),V7=Mr&&Mr.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),$T=Mr&&Mr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&q7(t,e,r);return V7(t,e),t};Object.defineProperty(Mr,"__esModule",{value:!0});Mr.NodeFileSystemStorage=void 0;var $e=$T(require("fs")),ut=$T(require("path")),BT=ne(),UT=Tc();async function qT(e){let t;try{t=await $e.promises.lstat(e)}catch{return}if(t.isSymbolicLink()){try{await $e.promises.unlink(e)}catch{await $e.promises.rmdir(e)}return}if(!t.isDirectory()){await $e.promises.unlink(e);return}for(let r of await $e.promises.readdir(e))await qT(ut.join(e,r));await $e.promises.rmdir(e)}var jm=class{constructor(t){this.root=t}getRoot(){return this.root}pathFor(t,r=!0){return this.assertWithinRoot(ut.join(this.root,...t),r)}realPathThroughNearestAncestor(t){let r=t,n=[];for(;!$e.existsSync(r);){n.unshift(ut.basename(r));let i=ut.dirname(r);if(i===r)return ut.resolve(t);r=i}return ut.resolve($e.realpathSync(r),...n)}assertWithinRoot(t,r){let n=ut.resolve(this.root),i=ut.resolve(t);if(i!==n&&!i.startsWith(n+ut.sep))throw new BT.PathTraversalError(t,this.root);let a=this.realPathThroughNearestAncestor(n),o=r?this.realPathThroughNearestAncestor(i):ut.resolve(this.realPathThroughNearestAncestor(ut.dirname(i)),ut.basename(i));if(o!==a&&!o.startsWith(a+ut.sep))throw new BT.PathTraversalError(t,this.root);return i}async readText(t){let r=this.pathFor(t);if(!$e.existsSync(r))return null;try{return await(0,UT.retryTransientIoAsync)(()=>$e.promises.readFile(r,"utf8"))}catch(n){if(n.code==="ENOENT")return null;throw n}}async writeTextAtomic(t,r){let n=this.pathFor(t),i=ut.dirname(n);await $e.promises.mkdir(i,{recursive:!0});let a=ut.join(i,`.${ut.basename(n)}.${Date.now()}.${Math.random().toString(36).slice(2)}.tmp`);try{await $e.promises.writeFile(a,r,"utf8"),await(0,UT.retryTransientIoAsync)(()=>$e.promises.rename(a,n))}catch(o){try{$e.existsSync(a)&&await $e.promises.unlink(a)}catch{}throw o}}async deleteFile(t){let r=this.pathFor(t);$e.existsSync(r)&&await $e.promises.unlink(r)}async deleteByPrefix(t){await qT(this.pathFor(t,!1))}async ensureContainer(t){await $e.promises.mkdir(this.pathFor(t),{recursive:!0})}async exists(t){return $e.existsSync(this.pathFor(t))}};Mr.NodeFileSystemStorage=jm});var VT=g($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});$a.createNodeWorkspaceStorage=$a.NodeFileSystemStorage=void 0;var G7=Qm(),z7=Qm();Object.defineProperty($a,"NodeFileSystemStorage",{enumerable:!0,get:function(){return z7.NodeFileSystemStorage}});function W7(e){return new G7.NodeFileSystemStorage(e)}$a.createNodeWorkspaceStorage=W7});var un={};module.exports=fr(un);cn(un,re(MT()),module.exports);cn(un,re(VT()),module.exports);
diff --git a/plugins/model-apps/scripts/verify-model-app.js b/plugins/model-apps/scripts/verify-model-app.js
index 0ff97c2df..a1ef5427d 100644
--- a/plugins/model-apps/scripts/verify-model-app.js
+++ b/plugins/model-apps/scripts/verify-model-app.js
@@ -19,12 +19,12 @@ const { odataLit } = require('./lib/odata.js');
const { makeGenpageCli } = require('./lib/genpage-cli.js');
const { depthFromMask } = require('./lib/role-privileges.js');
-function makeProvision(env, workspaceDir) {
- const { createMakerSdk } = require('./vendor/cds-maker-sdk.cjs');
+async function makeProvision(env, workspaceDir) {
+ const { createMakerSdk, createNodeWorkspaceStorage } = require('./vendor/cds-maker-sdk.cjs');
const httpClient = createAzHttpClient(env);
fs.mkdirSync(workspaceDir, { recursive: true });
- const sdk = createMakerSdk({ workspacePath: workspaceDir, instanceUrl: env, httpClient });
- sdk.initWorkspace();
+ const sdk = createMakerSdk({ workspaceStorage: createNodeWorkspaceStorage(workspaceDir), instanceUrl: env, httpClient });
+ await sdk.initWorkspace();
// Only the SDK is returned. The raw `httpClient` used to come back with it because the role
// privilege check had no SDK surface to read `EntityDefinitions(...)?$select=Privileges`; the
// vendored bundle now exposes `getEntityPrivileges`, so that escape hatch is gone. Handing the
@@ -366,7 +366,7 @@ async function main() {
const v = validateAppSpec(spec, { profile: 'deploy' });
if (!v.ok) { emitResult(false, { ok: false, errors: v.errors }); return; }
const workspaceDir = workspaceArg || path.join(path.dirname(specPath), '.maker-workspace');
- const sdk = makeProvision(env, workspaceDir);
+ const sdk = await makeProvision(env, workspaceDir);
const genpageCli = makeGenpageCli(env);
const r = await verifySpec(spec, readerFor(sdk, appUniqueName(spec), { genpageCli, workspaceDir }));
// Show `detail` on a failing check. Without it a READ that failed (throttling, auth expiry, a 5xx)