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.

model-apps: pack reconciled fields, verify form topology, and carry a divergent N:N name (#592)

Akshay Malooaa98f0cfd713
diff --git a/evals/model-apps/app-builder/lib/facts.js b/evals/model-apps/app-builder/lib/facts.js
index 1d10a003d..dbf55f9cf 100644
--- a/evals/model-apps/app-builder/lib/facts.js
+++ b/evals/model-apps/app-builder/lib/facts.js
@@ -365,6 +365,47 @@ function appFacts(spec) {
// queryRecords always returns a single-element array (rows[0] truthy) so view/chart/form lookups
// all pass. Entity/column lookups are derived from the spec. Sitemap XML is built from appShell
// so entity-subarea checks pass. No pages()/pageCode() needed for intent-only specs.
+// Render a spec form's AUTHORED explicit layout as FormXML, so the all-present reader can answer
+// the layout oracle too. Without it the reader claims every artifact is present while exposing no
+// `formTopology`, and verify now (correctly) reports an explicit layout as UNVERIFIED — a gap in
+// the fixture, not a finding about the spec.
+//
+// Cells are packed by WIDTH exactly as the compiler packs them, because the oracle checks that no
+// row carries more columns of content than its section declares. `columns` is emitted as the width
+// RATIO string FormXML actually uses ("11" = two equal columns), not as a count.
+function formXmlForAuthoredLayout(form) {
+ const esc = (v) => String(v == null ? '' : v).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/"/g, '&quot;');
+ const labels = (text) => `<labels><label description="${esc(text)}" languagecode="1033"/></labels>`;
+ const tabsXml = (form.tabs || []).map((t, ti) => {
+ const cols = Array.isArray(t.columns) ? t.columns : [{ width: '100%', sections: t.sections || [] }];
+ const colsXml = cols.map((col, ci) => {
+ const secsXml = ((col && col.sections) || []).map((sec, si) => {
+ const width = Math.max(1, Math.min(4, Number(sec.columns) || 1));
+ const entries = (sec.fields || []).map((f) => (typeof f === 'string' ? { name: f } : (f || {})));
+ const rows = [];
+ let cur = [];
+ let used = 0;
+ for (const e of entries) {
+ const span = Math.min(width, Math.max(1, Number(e.colspan) || 1));
+ if (used + span > width && cur.length) { rows.push(cur); cur = []; used = 0; }
+ cur.push({ name: String(e.name || '').toLowerCase(), colspan: span, rowspan: Math.max(1, Number(e.rowspan) || 1) });
+ used += span;
+ }
+ if (cur.length) rows.push(cur);
+ const rowsXml = rows.map((r) => `<row>${r.map((c) => `<cell colspan="${c.colspan}" rowspan="${c.rowspan}">`
+ + `<control datafieldname="${esc(c.name)}" /></cell>`).join('')}</row>`).join('');
+ const name = sec.name || `section_${ti}_${ci}_${si}`;
+ return `<section name="${esc(name)}" columns="${'1'.repeat(width)}">${labels(sec.label || 'Details')}`
+ + `<rows>${rowsXml}</rows></section>`;
+ }).join('');
+ return `<column width="${esc((col && col.width) || '100%')}"><sections>${secsXml}</sections></column>`;
+ }).join('');
+ const tabName = t.name || `tab_${ti}`;
+ return `<tab name="${esc(tabName)}">${labels(t.label || 'General')}<columns>${colsXml}</columns></tab>`;
+ }).join('');
+ return `<form><tabs>${tabsXml}</tabs></form>`;
+}
+
function makeAllPresentReader(spec) {
const entities = new Set((spec.entities || []).map((e) => lc(e.schemaName)));
const columnsByEntity = {};
@@ -430,6 +471,15 @@ function makeAllPresentReader(spec) {
? workflowRow(opts && opts.filter)
: [{ savedqueryid: 'x', savedqueryvisualizationid: 'x', formid: 'x' }]),
sitemapXml: async () => xml,
+ // The layout oracle. An "all present" reader that cannot read layouts would make verify report
+ // every explicit form as UNVERIFIED — correct behaviour, but a fixture gap rather than a finding
+ // about the spec. Rendering the AUTHORED layout is the honest synthesis here: the reader's whole
+ // premise is "the environment already matches the spec".
+ formTopology: async (entityLogical, _formId) => {
+ const form = (spec.forms || []).find((f) => lc(f.entity) === lc(entityLogical)
+ && Array.isArray(f.tabs) && f.tabs.length);
+ return form ? formXmlForAuthoredLayout(form) : null;
+ },
};
}
diff --git a/evals/model-apps/genpage/lib/assertions-layer-1.js b/evals/model-apps/genpage/lib/assertions-layer-1.js
index d8582890b..21e31fcf8 100644
--- a/evals/model-apps/genpage/lib/assertions-layer-1.js
+++ b/evals/model-apps/genpage/lib/assertions-layer-1.js
@@ -15,6 +15,29 @@
function fail(reason) { return { status: 'fail', reason }; }
function pass() { return { status: 'pass', reason: '' }; }
+
+// The two upload transports, recognised in ONE place.
+//
+// New runs deploy through `scripts/genpage-upload.js`, which hands the prompt to pac BY FILE so a
+// shell cannot reinterpret quotes/newlines (#589). The fixtures checked in here are captured
+// transcripts from before that change and show the raw `pac model genpage upload` form; rewriting a
+// captured transcript to match today's skill would be falsifying the evidence it exists to be.
+//
+// Defined once because the two DID drift: the common assertion was updated and the per-eval Phase
+// expectations were not, so a correct new-transport run failed the evals while a raw
+// `pac … --prompt "…"` run passed — the evals were grading the quoting-unsafe transport as correct.
+const UPLOAD_CMD = /pac\s+model\s+genpage\s+upload|genpage-upload\.js/;
+const uploadLinesOf = (log) => String(log || '').split('\n').filter((l) => UPLOAD_CMD.test(l));
+
+// What the log records about an upload's PROMPT, whichever transport carried it: the inline quoted
+// value, or — for the file transport, where there is no inline value to read — the `Prompt scope:`
+// line the skill requires alongside the command.
+function promptEvidence(log, uploadLine) {
+ const inline = /--prompt\s+"([^"]*)"/.exec(uploadLine || '');
+ if (inline) return inline[1];
+ const scope = /^\s*[-*]?\s*Prompt scope:\s*(.+)$/im.exec(String(log || ''));
+ return scope ? scope[1].trim() : null;
+}
function skip(reason) { return { status: 'skip', reason }; }
// An EDIT-flow fixture produces `genpage-edit-plan.md` and never `genpage-plan.md`: the create
@@ -602,8 +625,10 @@ WORKFLOW_ASSERTIONS.set(
({ fixture }) => {
const log = fixture.workflowLog;
if (!log) return fail('no workflow-log.md');
- if (!/pac\s+model\s+genpage\s+upload/.test(log)) return fail('no upload invocation recorded');
- if (!/--prompt/.test(log)) return fail('upload lacks --prompt flag');
+ if (!UPLOAD_CMD.test(log)) return fail('no upload invocation recorded');
+ // `--prompt` also matches `--prompt-file`, which is the intent: what is asserted is that a
+ // prompt was recorded and scoped, not which flag carried it.
+ if (!/--prompt/.test(log)) return fail('upload lacks a --prompt/--prompt-file flag');
return pass();
}
);
@@ -806,8 +831,8 @@ PHASE_EXPECTATIONS.set(
({ fixture }) => {
const log = fixture.workflowLog;
if (!log) return fail('no workflow-log.md');
- if (!/pac\s+model\s+genpage\s+upload/.test(log)) return fail('upload command not recorded');
- const uploadLines = log.split('\n').filter((l) => /pac\s+model\s+genpage\s+upload/.test(l));
+ if (!UPLOAD_CMD.test(log)) return fail('upload command not recorded');
+ const uploadLines = uploadLinesOf(log);
if (uploadLines.some((l) => /--data-sources/.test(l))) {
return fail('upload includes --data-sources on mock-data page');
}
@@ -820,8 +845,8 @@ PHASE_EXPECTATIONS.set(
({ fixture }) => {
const log = fixture.workflowLog;
if (!log) return fail('no workflow-log.md');
- if (!/pac\s+model\s+genpage\s+upload/.test(log)) return fail('upload command not recorded');
- const uploadLines = log.split('\n').filter((l) => /pac\s+model\s+genpage\s+upload/.test(l));
+ if (!UPLOAD_CMD.test(log)) return fail('upload command not recorded');
+ const uploadLines = uploadLinesOf(log);
if (uploadLines.some((l) => /--data-sources/.test(l))) {
return fail('upload includes --data-sources on mock-data page');
}
@@ -933,7 +958,7 @@ PHASE_EXPECTATIONS.set(
({ fixture }) => {
const log = fixture.workflowLog;
if (!log) return fail('no workflow-log.md');
- const uploadLines = log.split('\n').filter((l) => /pac\s+model\s+genpage\s+upload/.test(l));
+ const uploadLines = uploadLinesOf(log);
if (uploadLines.length === 0) return fail('upload not recorded');
const editUpload = uploadLines.find((l) => /--page-id/.test(l));
if (!editUpload) return fail('edit upload missing --page-id');
@@ -1233,21 +1258,25 @@ PHASE_EXPECTATIONS.set(
({ fixture }) => {
const log = fixture.workflowLog;
if (!log) return fail('no workflow-log.md');
- const upload = (log.split('\n').find((l) => /genpage upload/.test(l)) || '');
- if (!upload) return fail('no `pac model genpage upload` command in the workflow log');
+ const upload = uploadLinesOf(log)[0] || '';
+ if (!upload) return fail('no genpage upload command in the workflow log');
if (!/--page-id\b/.test(upload)) return fail('edit upload must pass --page-id');
if (!/--connectors\b/.test(upload)) return fail('edit upload must pass --connectors');
// An existing page is already in the sitemap; re-adding it creates a duplicate subarea.
if (/--add-to-sitemap\b/.test(upload)) return fail('edit upload must omit --add-to-sitemap');
- // --prompt must be the DELTA. The page's original description ("dashboard showing the current
+ // The prompt must be the DELTA. The page's original description ("dashboard showing the current
// weather ... temperature, conditions, and humidity") must not be restated, or each edit
// re-sends the whole history and the stored prompt drifts from what the page now is.
- const m = upload.match(/--prompt\s+"([^"]*)"/);
- if (!m) return fail('edit upload has no quoted --prompt value');
- if (/temperature, conditions, and humidity/i.test(m[1])) {
- return fail('--prompt restates the original page description instead of this edit\'s delta');
+ //
+ // Read through `promptEvidence` rather than demanding an inline quoted value: the file
+ // transport has no inline value to read, and requiring one made a correct run fail while a raw
+ // `--prompt "…"` run passed — grading the quoting-unsafe transport as the correct one.
+ const value = promptEvidence(log, upload);
+ if (value === null) return fail('edit upload records no prompt value or `Prompt scope:` line');
+ if (/temperature, conditions, and humidity/i.test(value)) {
+ return fail('the prompt restates the original page description instead of this edit\'s delta');
}
return pass();
}
diff --git a/plugins/model-apps/AGENTS.md b/plugins/model-apps/AGENTS.md
index 6290b0356..26cae262d 100644
--- a/plugins/model-apps/AGENTS.md
+++ b/plugins/model-apps/AGENTS.md
@@ -510,8 +510,11 @@ the pipeline and delegates each script's **behavioral spec** to the entries belo
prompts. The `ai` block in the App Spec configures the full set; see
[`references/app-spec-schema.md`](references/app-spec-schema.md) → `## ai`.
- **`scripts/preview-form.js` → `scripts/lib/form-preview.js`** — renders an ASCII **form
- wireframe** (tabs, sections, fields with widget hints, the Notes/timeline block, sub-grids, form
- JS) from the App Spec, so the user can review a form visually during authoring before approving.
+ wireframe** (tabs, sections, fields with widget hints and authored `hidden`/`readOnly` state, the
+ Notes/timeline block, sub-grids, form JS) from the App Spec, so the user can review a form
+ visually during authoring before approving. A hidden field is annotated rather than omitted, and
+ state is never truncated — the widget hint and then the label give way first, because a
+ half-printed `(read-on…` is the silent-state failure the annotation exists to prevent.
**`scripts/preview-app.js` → `scripts/lib/app-preview.js`** — renders the WHOLE app design
(data model + sitemap tree + views/charts + per-form wireframes + page-intents + design contract)
as a single ASCII preview — the design gate #2 / plan-mode approval artifact.
@@ -614,6 +617,7 @@ scripts/
run-tests.js ← one-command plugin + SDK regression runner
smoke-eval.js ← scripted live smoke eval (build → assert → teardown)
generate-page-manifest.js ← Phase 0.5: writes working-dir package.json + genpage.d.ts
+ genpage-upload.js ← /genpage: deploy one page via the shared wrapper (prompt passed BY FILE, never on a command line)
capture-fixture.js ← Copies /genpage working dir into an eval fixture and runs both runners
lib/
entity-provision.js ← Shared entity-provisioning core (solution + data-model + sample-data)
@@ -657,6 +661,7 @@ scripts/
apply-snapshot.js ← changed-only: pure eligibility state machine (identity bind, debt, tombstone, generation CAS)
apply-snapshot-store.js ← changed-only: atomic snapshot write + workspace lease + invalidate/tombstone/delete
apply-snapshot-index.js ← changed-only: build result.created → snapshot artifact map
+ workspace-paths.js ← the `.maker-workspace` name + the guard that gates destructive --clear-workspace cleanup
changed-only-flow.js ← changed-only: --changed-only orchestration (decide fast/full, live identity, snapshot lifecycle)
projection.js ← changed-only: pure post-apply verifiers (form placement / sitemap / page dual-hash)
detect-browser.js ← System Chromium/Edge/Chrome detection (used by the launcher)
diff --git a/plugins/model-apps/CHANGELOG.md b/plugins/model-apps/CHANGELOG.md
index 15c2a68a2..be89aa539 100644
--- a/plugins/model-apps/CHANGELOG.md
+++ b/plugins/model-apps/CHANGELOG.md
@@ -12,179 +12,134 @@ 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
- allow-listed, so a typo — or a key the SDK's serializer would discard — fails instead of silently
- vanishing. The form wireframe renders the new structure, since that preview is the approval gate.
-
-- **The dry run resolves create-vs-reuse against the live environment** ([#559]). Without `--apply`
- the plan was a static echo of the spec, identical whether every artifact already existed or none
- did — the one question a dry run exists to answer. Each item is now `+ create` or `= reuse`, with
- a summary (`2 to create, 6 already present`); an unreadable item is `? unknown`, never guessed.
- The probe reuses the build's own discovery, so the plan cannot drift from the apply.
- `--no-live-plan` restores the offline listing.
-- **Sample data can express a hierarchy on one table** ([#544]). A `$parent` may target the row's
- own entity (an org tree, a "reports to" chain). Rows are seeded in dependency waves, so
- declaration order does not matter, and a cycle is rejected by the lint rather than failing the
- build partway through. Add `$parent.lookup` to say which relationship a bind uses — required only
- when two or more relationships connect the same pair, and now **rejected** rather than silently
- taking the first declared one.
+- **`personas[].excludes[]` records what the app deliberately leaves out** ([#583]), rendered as
+ **Deliberately out of scope** beside the traceability table. Documentary only.
+- **Richer form layouts**: multi-column tabs (`tabs[].columns[]` with a `width`), cell
+ `colspan`/`rowspan`, and author-controlled `expanded`/`visible`/`showLabel`. Layout keys are
+ allow-listed, so a typo fails instead of silently vanishing.
+- **The dry run resolves create-vs-reuse against the live environment** ([#559]) — each item is
+ `+ create`, `= reuse` or `? unknown`, never guessed. `--no-live-plan` restores the offline listing.
+- **Sample data can express a hierarchy on one table** ([#544]). `$parent` may target the row's own
+ entity; rows seed in dependency waves and a cycle fails the lint. `$parent.lookup` picks the
+ relationship when two connect the same pair — now required there instead of guessed.
+- **`minimumPluginVersion`** lets a spec declare the oldest plugin that can build it, so a newer spec
+ is refused rather than mis-compiled.
+- **The vendored SDK moves to injected storage.** `createNodeWorkspaceStorage(...)` replaces
+ `workspacePath` — no change for authors, breaking for anything calling these scripts as a library.
### 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
- form to a two-column layout got the old layout, minus any field they had not re-declared, and a
- green build. Tabs, form-columns and sections are now created when missing, patched in place when
- they differ, and a field in the wrong section is **moved** rather than duplicated. Containers match
- by `name`, then `label`, then position, so a form built by an earlier `auto` layout converges
- instead of gaining a duplicate tab on every rebuild; sections the engine owns (a sub-grid host, the
- notes/timeline section) are matched by name only.
-- **`--verify` no longer demands a default form the build never promotes.** The build refuses to
- re-point the default form of a reused or stock table, but the verifier asserted it anyway — so any
- spec with a Main form on `account`, `contact`, or an `existing: true` table failed verify
- permanently. Verify now applies the build's own guard.
-- **A tab's `columns` must be a list of form-columns.** `columns` is an integer grid width on a
- *section* and an array of form-columns on a *tab* — the schema's most confusable key. `"columns": 2`
- on a tab validated clean and was then discarded by the compiler, silently shipping a one-column
- form. It is now an error that names the fix.
-- **Duplicate sample-data names fail at author time, not halfway through the build.** The loader
- refuses to use a duplicated value as its `matchOn` key — a refusal that landed after tables, forms
- and views were already deployed. Two tickets both called "Printer issue" is ordinary sample data;
- it is now caught by `validateAppSpec`, with the same escape hatches the loader honours, and the
- rule now also covers a single-column alternate key when that is what `matchOn` selects.
-- **Cell spans converge on an existing form, and are clamped where they are written.** `colspan`/
- `rowspan` were create-only, so widening a field on a deployed form produced a green build and an
- unchanged cell. A declared span is now written to the deployed cell, while an undeclared one is
- still never sent, so a cell a maker widened by hand survives. A `colspan` wider than its section is
- now clamped in the emitted cell, not only in the row arithmetic. A `rowspan` is rejected unless it
- is the last field in its section — a compiler limitation, tracked in [#581].
-- **A build no longer reports a default form it failed to set.** `result.created.defaultForms`
- recorded the entity even when the `isdefault` write threw.
-- **`--verify` proves sort PRECEDENCE, not just membership.** Each authored order was checked for
- existence anywhere in the deployed query, so a deployed `[name asc, createdon desc]` satisfied an
- authored `[createdon desc, name asc]` — two views that return rows in different orders. Authored
- orders must now appear in their declared relative order; extra platform orders are still tolerated.
-- **Dashboard id-passthrough tiles are validated per tile type.** One shared test covered both
- shapes, so a list tile carrying a stray `visualizationId` skipped the `viewId` requirement and a
- chart tile with only a `viewId` passed with no visualization to render. The download was made
- consistent in the same change.
-- **A downloaded relationship that is renamed is no longer reported as lost.** A relationship carried
- into the spec under a generated name was also recorded as skipped, so the summary claimed it was
- absent. It is now reported as a rename, and a parent table whose metadata could not be read is
- reported as undetermined rather than diagnosed wrongly.
-- **Two silent no-ops now report themselves.** A failed default-form promotion was swallowed
- entirely; it now warns with the reason, and `--verify` proves the deployed `systemform.isdefault`
- independently. An **existing** view's authored filters/sort are still not reapplied — only columns
- and description converge — and that is now said out loud instead of reported as success.
-- **`_seedKey` in `sampleData` is rejected instead of being sent to Dataverse.** It was never a
- loader sentinel, so it reached the API as an attribute no table has. The error names the real
- mechanism: a single-column alternate key. Ambiguous parent binds are rejected for the same reason
- rather than binding to an arbitrary row.
-- **`--verify` gained three oracles**: the deployed default Main form, a view's authored
- filters/sort parsed from `fetchxml`, and app-role associations. Each fails closed when its proof
- cannot be read.
-- **A download no longer invents text columns from a polymorphic lookup** ([#574]). A polymorphic
- lookup's shadow attributes are stored physically, so unlike a single-target lookup's they slipped
- past the filter that catches the rest: `<lookup>name` and `<lookup>yominame` were emitted as real
- `Text` columns, and a rebuild into a fresh environment gained two invented text fields where a
- lookup used to be. The filter now keys on `AttributeOf`, which names the attribute a shadow belongs
- to; an unreadable value keeps the column rather than deleting it.
-- **A download no longer invents a Money column's base-currency twin either.** Found by live
- round-trip after the fix above. Dataverse generates a `<money>_base` column beside every `Money`
- column, and it carries no `AttributeOf`, so the rule above is blind to it — the downloaded spec
- declared it as an authored column, and a rebuild would try to create a column the platform owns.
- Recognised by `IsBaseCurrency`, which is the only unambiguous signal; an unreadable value keeps the
- column.
-- **A download reconstructs `relationships[]`** ([#567]). The block was absent entirely and nothing
- said so, so a downloaded spec looked complete while a rebuild produced tables with no lookups and
- no hierarchy, reporting success. 1:N and N:N relationships are now read from live metadata, and any
- the App Spec cannot express — a polymorphic lookup, a parent outside the app — are named with a
- reason instead of vanishing.
-- **A downloaded spec no longer fails its own lint** ([#572]). A downloaded dashboard carries
- id-passthrough tiles, which `validateAppSpec` and the build accept but the lint did not — so
- `lint-app-spec.js` rejected a freshly downloaded spec with six errors reporting a chart literally
- named `'undefined'`. The lint now understands them and reports a missing reference as missing.
-- **A download round-trips Choice and MultiChoice columns** ([#564]). They were emitted with no
- `type`, so rebuilding into a **fresh** environment created single-line Text while Memo, Money and
- DateTime survived — an asymmetry harder to notice than an outright failure. Option sets are now
- read per table: a local set becomes inline `options[]` (localizations preserved), a shared one a
- `globalChoice` reference plus a `globalChoices[]` declaration. Four related defects went with it:
- a **MultiChoice column was dropped from the spec entirely** (Dataverse types it `Virtual`); a
- lookup's synthetic `<lookup>name` column was emitted as a real Text column, which a fresh rebuild
- then created; a legal multi-language option set could abort the **whole** download; and
- `globalChoices[]` could declare sets nothing referenced. A column whose option set cannot be read
- is still left untyped — but now named, with the reason. Note the App Spec cannot express option
- *values*: labels and order round-trip, and a fresh rebuild re-bases them to `100000000 + index`.
-- **`--verify` checks that a sitemap-visible table really belongs to the app.** The sitemap and the
- app module's table list are separate facts and can disagree, so an app could show a table in
- navigation while omitting it from its Tables list — and verify still said PASS, because the table
- existed and the sitemap named it. It now fails by table name, fails **closed** when the component
- list cannot be read, and reports leftover `entity` placeholder components.
-- **A multi-line page prompt is no longer flattened on upload** ([#565]). Prompts went to `pac`
- inline, where a newline guard collapsed every line break — so a downloaded conversation transcript
- degraded a little more on each edit-rebuild. They now go through `--prompt-file` /
- `--agent-message-file`. `upload()` also accepts an optional `compiledCodeFile`.
-- **`/genpage` Phase 1 is reachable again** ([#541]). Its interactive flow was specified to run
- inside a headless `Task` subagent, so create flows could not complete. Interaction now runs in the
- main loop; the agents are headless workers that return a `needs_input` request when they need a
- decision (`references/agent-interaction-contract.md`).
-- **Teardown no longer reports a false failure for a self-referencing relationship** ([#544]). The
- table delete already removes it, so deleting it first returned `referenced by 2 other components`
- and a completely clean run still exited non-zero.
-- **A mistyped flag now fails instead of quietly changing what the command does.** An unrecognised
- flag was dropped *and* swallowed the token after it: `--stagee ui` planned all 9 phases instead of
- 3 and exited 0 — with `--apply`, a scoped apply became a full one. Every CLI now declares the
- flags it accepts, rejects anything else with a "did you mean", and rejects a value-bearing flag
- passed bare. This also covers `--allow-destructiv` and friends on the destructive tools.
-- **A test file in a `scripts/tests/` subdirectory is no longer silently skipped.** Discovery was a
- flat `readdir`, so a nested suite would be committed, reviewed, reported green and never run.
+- **An explicit form layout reshapes a form instead of flattening it** ([#575]). Every field was
+ appended to the first section, containers were never created or resized, and declaring `tabs`
+ silently switched pruning on. Containers now match by `name`, then `label`, then position, and a
+ misplaced field is moved rather than duplicated.
+- **A section emptied by a layout move is reclaimed** instead of surviving as a blank twin.
+- **A field added or moved on an existing form packs to the section's grid**, so the same spec no
+ longer produces a different form depending on whether the form already existed.
+- **Cell spans converge on an existing form, and are clamped where they are written.** A declared
+ span reaches the deployed cell; an undeclared one is still never sent, so a cell widened by hand
+ survives. `rowspan` is rejected unless it is the last field in its section ([#581]).
+- **A form field can be narrowed again.** An explicit `colspan`/`rowspan` of `1` was
+ indistinguishable from omitting it, so changing `2` back to `1` never reached the form.
+- **Widening a field on a deployed form re-packs its row.** The span was patched in place but the
+ row was not re-packed, leaving three columns of content in a two-column section. Displaced fields
+ move down rather than to the bottom of the section; a span that still fits writes nothing.
+- **`--verify` no longer fails a reshape the build performed correctly.** The build reuses deployed
+ containers and deliberately does not rename them (form scripts and business rules reference
+ section names), but verify looked them up by the authored name — so a section it had just reused
+ read as "absent". Both sides now share one matcher.
+- **The form wireframe shows authored `hidden` and `readOnly` state** ([#591]), so the approval gate
+ no longer draws every field as visible and editable.
+- **`/genpage` deploys through the same quoting-safe upload path as `/app-builder`** ([#589]). A
+ prompt containing quotes, newlines, `%VAR%` or non-ASCII could fail to deploy — and editing the
+ approved prompt until it parses builds the page from text nobody approved. `--add-to-sitemap` is
+ now refused alongside `--page-id`.
+- **A multi-line page prompt is no longer flattened on upload** ([#565]). Prompt files are now
+ delivered byte-for-byte, including a trailing newline; only a leading byte-order mark is stripped,
+ because that is an encoding marker rather than content.
+- **`/genpage` refuses to "update" a page that does not exist.** `pac` treats an unknown `--page-id`
+ as a create and returns the new id, so a stale one silently produced a second, unplaced page and
+ reported it as an update.
+- **An explicitly empty prompt or agent message is refused, not replaced** with generated text.
+ Omitting the value still gets the default, on both `/genpage` and `/app-builder`.
+- **A `/genpage` update no longer silently unbinds the page.** `pac` rewrites the binding list from
+ the flags it is given, so omitting `--data-sources` persisted `[]` while the source went on
+ querying the table. An update now preserves the page's existing bindings; `--clear-data-sources`
+ unbinds deliberately.
+- **`/genpage` Phase 1 is reachable again** ([#541]) — its interactive flow no longer runs inside a
+ headless subagent.
+- **A downloaded page keeps its table bindings.** `pac` writes `config.json` with a BOM, which
+ `JSON.parse` rejects, and the failure was read as "no data sources". A config that is present but
+ unreadable now stops the download unless you pass `--allow-lossy-download`.
+- **Choice and MultiChoice columns round-trip on download** ([#564]). They were emitted untyped, so
+ a fresh rebuild created Text, and a MultiChoice column was dropped entirely. Option *values* still
+ do not round-trip: labels and order do, and a fresh rebuild re-bases them to `100000000 + index`.
+- **`relationships[]` is reconstructed on download** ([#567]). The block was absent and nothing said
+ so, so a rebuild produced tables with no lookups and reported success.
+- **A download no longer invents columns** — a polymorphic lookup's shadow attributes ([#574]) and a
+ Money column's `_base` twin were emitted as real columns a fresh rebuild would then create.
+- **A downloaded spec no longer fails its own lint** ([#572]).
+- **A renamed N:N relationship carries its deployed name**, so a rebuild does not create a second
+ intersect beside it, and it is reported as renamed rather than lost.
+- **Every dropped dashboard tile is reported**, naming the parameter it lacks, and id-passthrough
+ tiles are validated per tile type.
+- **`--clear-workspace` no longer recursively deletes whatever `--workspace` named** ([#587]). It ran
+ `rm -rf` on the caller's path with no check that it was a workspace, immediately after a
+ *successful* teardown. It now requires the directory to carry the SDK's own workspace manifest —
+ the conventional name alone is not proof — and rejects roots and symlink escapes.
+- **Teardown stops instead of stripping a live app when the app delete fails** ([#587]). This
+ **reverses earlier best-effort behaviour**; continue-on-error still applies to every later step.
+- **A security role whose sharing check cannot be read is retained, not deleted** ([#587]).
+- **A plain `--apply` halts when the changed-only snapshot cannot be invalidated** ([#587]) —
+ otherwise a later `--changed-only` run trusts a stale snapshot and skips work.
+- **Teardown no longer reports a false failure for a self-referencing relationship** ([#544]).
+- **A mistyped flag fails instead of quietly changing what the command does.** An unrecognised flag
+ was dropped *and* swallowed the token after it, so `--stagee ui` planned all 9 phases and exited 0.
+- **`--verify` proves the deployed form LAYOUT**, not just that a form exists — every wrong-layout
+ failure previously finished with an unqualified PASS. It checks the authored tabs, sections and
+ field placement, that no row carries more content than its section's grid allows, and that a span
+ you declared is the span that deployed. A span you did *not* declare is left alone, so a cell
+ widened by hand in the designer still verifies.
+- **`--verify` proves sort PRECEDENCE, not just membership**, so two views that return rows in
+ different orders are no longer both accepted.
+- **`--verify` checks that a sitemap-visible table really belongs to the app**, and fails closed when
+ the component list cannot be read.
+- **`--verify` gained three oracles**: the deployed default Main form, a view's filters/sort parsed
+ from `fetchxml`, and app-role associations. Each fails closed.
+- **`--verify` no longer demands a default form the build never promotes** on a reused or stock table.
+- **A tab's `columns` must be a list of form-columns.** `"columns": 2` on a tab validated clean and
+ was then discarded, silently shipping a one-column form.
+- **Duplicate sample-data names fail at author time**, not after tables and forms are deployed.
+- **`_seedKey` in `sampleData` is rejected** instead of reaching Dataverse as an attribute no table
+ has; the error names the real mechanism, a single-column alternate key.
+- **An explicit layout with no tabs, or a tab with no sections, is rejected** — it previously passed
+ the build gate and silently dropped every field the form declared.
+- **A form layout may not place the same field twice, or reuse a tab/section `name`.** A duplicated
+ field deployed two cells on a fresh build and one on the next.
+- **A business rule's `dataType` reaches Dataverse as a real type.** The platform *accepts* the wrong
+ value rather than rejecting it, so affected rules deployed and activated with a wrongly-typed
+ condition — rebuild any app with `businessRules[]` built against the previous release.
+- **A build no longer reports a default form it failed to set**, and a failed promotion warns with
+ the reason instead of being swallowed. An **existing** view's authored filters/sort are still not
+ reapplied, and that is now said out loud.
+- **A test file in a `scripts/tests/` subdirectory is no longer silently skipped.**
+- **The vendored SDK is refreshed** for upstream wire-correctness fixes (view joins, `addElement`
+ re-keying, dashboard parsing, duplicate sort attributes, BPF `If-Match`). Measured against the
+ previous bundle, none of it changes this plugin's output today — it removes latent hazards.
### Changed
-- **`/app-builder` is GA.** The preview notice is gone: the App Spec shape, the CLI flags and the
- build phases are now treated as a stable contract rather than one that may change between
- versions. The guidance that outlived the notice stays — review the dry-run plan before approving,
- and use `teardown-model-app.js --apply` to clean up probes. `--changed-only` (partial apply) is
- the one piece still experimental, and remains off by default.
-- **Connector authoring is GA and on by default.** SharePoint / weather / Office 365 / SQL /
- custom-REST binding and ALM packaging of connection references work without opting in. The
- `connectors` flag is **flipped to `true` and kept for one release as a rollback switch** —
- `GENPAGE_ENABLE_CONNECTORS=0` restores the old behaviour — and is scheduled for removal next
- release. `custom-api` and `custom-telemetry` are unaffected and still default-OFF.
-- **The Phase 4.5 dispatch value is the binding count, not the flag state.** The page-builder gets
- `Connectors: none` or `<n> binding(s)`; a disabled gate and an empty binding table both yield
- `none`, so the dispatch stays stable when the flag is removed.
-- **The App Spec schema is split so the always-read half is smaller.** `globalChoices`,
- `webResources`, `commands`, `businessRules`, `businessProcessFlows`, `dashboards` and `roleGrants`
- moved to `app-spec-schema-advanced.md`, leaving a pointer table: 105 KB → 82 KB eagerly read.
-- **The CLI flag contract is shared rather than per-script**, so the flag rules and the "did you
- mean" suggestion cannot drift between commands.
-- **Deeper tests on the paths connectors GA just made live**, including a connector *edit* eval and
- a contract test pinning the dispatch fields the skills hand to the page-builder.
-- **A form layout may no longer place the same field twice, or reuse a tab/section `name`.** Both
- are now rejected at author time: a duplicated field deployed two cells on a fresh build and one on
- the next, so the spec did not survive its own rebuild. Remove the duplicate placement. Identity is
- per form — a second form on the same table may still place the same column.
-- **A download now reports every dashboard tile it drops** instead of discarding it in silence,
- naming the parameter the tile lacks.
-- **An explicit form layout with no tabs, or a tab with no sections, is rejected at author time.** It
- previously passed the build gate — only the standalone lint caught it — and silently dropped every
- field the form declared.
+- **`/app-builder` is GA.** The App Spec shape, the CLI flags and the build phases are now a stable
+ contract. `--changed-only` remains experimental and off by default.
+- **Connector authoring is GA and on by default.** The `connectors` flag is flipped to `true` and
+ kept for one release as a rollback switch (`GENPAGE_ENABLE_CONNECTORS=0`), then removed.
+ `custom-api` and `custom-telemetry` are unaffected and still default-OFF.
+- **The Phase 4.5 dispatch value is the binding count, not the flag state**, so the dispatch stays
+ stable when the flag is removed.
+- **The App Spec schema is split** so the always-read half is smaller: 105 KB → 82 KB.
+- **The CLI flag contract is shared** rather than per-script, so the rules and the "did you mean"
+ suggestion cannot drift between commands.
+- **Deeper tests on the paths connectors GA made live**, including a connector *edit* eval.
[#541]: https://github.com/microsoft/power-platform-skills/issues/541
[#544]: https://github.com/microsoft/power-platform-skills/issues/544
@@ -196,6 +151,10 @@ downloads that round-trip Choice columns.
[#574]: https://github.com/microsoft/power-platform-skills/issues/574
[#575]: https://github.com/microsoft/power-platform-skills/issues/575
[#581]: https://github.com/microsoft/power-platform-skills/issues/581
+[#583]: https://github.com/microsoft/power-platform-skills/issues/583
+[#587]: https://github.com/microsoft/power-platform-skills/issues/587
+[#589]: https://github.com/microsoft/power-platform-skills/issues/589
+[#591]: https://github.com/microsoft/power-platform-skills/issues/591
## [2.7.1]
diff --git a/plugins/model-apps/references/app-spec-schema.md b/plugins/model-apps/references/app-spec-schema.md
index 7e5f053ff..b1ebb4ee5 100644
--- a/plugins/model-apps/references/app-spec-schema.md
+++ b/plugins/model-apps/references/app-spec-schema.md
@@ -680,6 +680,18 @@ would promise a layout Dataverse never renders. The SDK refuses these too, but t
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.
+**`minimumPluginVersion`** (top level, optional) declares the oldest plugin that can build this spec —
+`"minimumPluginVersion": "2.9.0"`. A plugin older than that refuses the spec instead of mis-compiling
+it, naming both versions. The value must be a plain dotted version (`2`, `2.9`, `2.9.0`) with an
+optional `-pre` or `+build` suffix, which compares on the release core. Anything else — `2..9`, a
+trailing typo, stray whitespace — is rejected as malformed rather than quietly reinterpreted as a
+different floor.
+
+⚠ It protects **forward only**. Measured against the shipped 2.8.0 validator, an unknown top-level
+key, `schemaVersion: 3` and even `schemaVersion: 99` are all accepted — it validates none of them —
+so no marker can make an already-released consumer reject a spec. What stops an older plugin
+damaging a richer form today is the destructive preflight: reducing a multi-column form to an empty
+field set surfaces as a plan to remove every non-primary field, which needs authorization.
**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
or twice in the same one (matching is case-insensitive, and applies to both the string and the
@@ -1171,6 +1183,13 @@ privilege removes it — the role converges to the spec).
- `appAccess` (optional boolean, default `true`) — inject app-module read + associate the app to the role.
- `businessUnitId` (optional GUID) — business unit to create the role in (defaults to the org root BU).
- `assignTo` (optional) — `{ teams?: GUID[], users?: GUID[] }`, grant-only.
+- `excludes[]` (optional) — what this persona deliberately **does not** do in this app, e.g.
+ `"Approving budgets — handled in the Finance app"`. Never applied to Dataverse; like
+ `jobs[].surfaces[]` it is documentary, and it renders as a **Deliberately out of scope** list beside
+ the jobs→surfaces traceability table in `model-app-plan.md`. An app's scope is defined as much by
+ what it leaves out as by what it includes, and the exclusions are what let a reviewer tell two apps
+ built over the same tables apart — an omission nobody was shown cannot be approved. Entries must be
+ non-empty strings; a bare string instead of an array is rejected rather than read as a one-item list.
**Idempotency & safety.** A role is identified by its **(trimmed name, business unit)** — the same
identity the platform uses. A rebuild **reuses** only a role the builder itself authored (marked as
diff --git a/plugins/model-apps/references/authoring-flow.md b/plugins/model-apps/references/authoring-flow.md
index 57cb6c0ed..74133e3a1 100644
--- a/plugins/model-apps/references/authoring-flow.md
+++ b/plugins/model-apps/references/authoring-flow.md
@@ -283,12 +283,20 @@ so you ask once and use the answer twice:
"jobs": [
{ "name": "Assign incoming work", "description": "Triage new work orders and route them to a technician" },
{ "name": "Watch today's queue", "description": "See at a glance what is overdue, unassigned, or at risk" }
- ] }
+ ],
+ "excludes": ["Approving budgets — handled in the Finance app"] }
]
```
`privileges[]` is **not** filled in yet — entities don't exist until Level (a). Level (c) adds it.
+**Capture what the app deliberately leaves out**, too, in `excludes[]`. When the user rules
+something out — "dispatchers don't approve anything", "we won't touch invoicing here" — that is a
+scope decision, and it renders into the design document as **Deliberately out of scope** beside the
+traceability table. Two apps built over the same tables are told apart by what each declines to do,
+and an omission the reviewer was never shown cannot be approved. It is documentary only; nothing is
+applied to Dataverse.
+
**Carry the jobs forward.** At Level (b), every job must be answerable with "this surface lets them
do it". Record that link in `jobs[].surfaces[]` (view/form/page names, or a page `key`):
@@ -451,7 +459,8 @@ the layout that lands.
**Show the form wireframe.** After writing the proposed forms to `app-spec.json`, render an
ASCII wireframe so the user can *see* each form's tabs, sections, fields, the Notes block, and
-sub-grids before approving — then ask for changes:
+sub-grids before approving — then ask for changes. Fields carry their authored state, so a
+`(hidden)` or `(read-only)` annotation in the wireframe is part of what is being approved:
```bash
node "${PLUGIN_ROOT}/scripts/preview-form.js" --spec @<working-dir>/app-spec.json [--entity <schemaName>]
diff --git a/plugins/model-apps/scripts/build-model-app.js b/plugins/model-apps/scripts/build-model-app.js
index 4bac532e2..08a2e1725 100644
--- a/plugins/model-apps/scripts/build-model-app.js
+++ b/plugins/model-apps/scripts/build-model-app.js
@@ -482,6 +482,35 @@ function parseLanguageCode(value) {
return lc;
}
+// Refuse to mutate unless the changed-only snapshot was demonstrably invalidated (#587 item 3).
+//
+// Extracted from main() so it can be tested by BEHAVIOUR. The first version of this guard was
+// covered only by a source-level test, and an adversarial review proved that test worthless: both
+// `if (false && …)` and a catch that manufactures `{ ok: true }` passed the whole file. A guard
+// whose test survives its own removal is not a guard.
+//
+// Throws on anything that is not a definite success — `{ ok: false }`, a thrown error, and a
+// missing/malformed return alike. A MISSING snapshot is not one of those: invalidateSnapshot
+// reports `{ ok: true, reason: 'no snapshot to invalidate' }`, so an ordinary first build is
+// unaffected. Halting costs a retry; continuing costs a silently incomplete deployment.
+function assertSnapshotInvalidated(store, workspaceDir) {
+ let inv;
+ try {
+ inv = store.invalidateSnapshot(workspaceDir);
+ } catch (e) {
+ inv = { ok: false, reason: e && e.message ? e.message : String(e) };
+ }
+ if (!inv || inv.ok !== true) {
+ throw new Error(
+ `refusing to apply: the changed-only snapshot in ${workspaceDir} could not be invalidated `
+ + `(${(inv && inv.reason) || 'unknown reason'}). A later --changed-only run would trust it and `
+ + 'skip work this apply is about to make necessary. Retry once any concurrent run has finished, '
+ + 'or delete the snapshot to re-baseline.'
+ );
+ }
+ return inv;
+}
+
async function main() {
const argv = process.argv.slice(2);
const { positional, flags } = parseArgs(argv);
@@ -689,12 +718,15 @@ async function main() {
} else {
// Invariant: EVERY state-changing apply must invalidate the changed-only snapshot BEFORE it writes
// (design core invariant). A plain `--apply` (or `--stage data --apply`) mutates the app outside the
- // changed-only flow, so a stale eligible snapshot would otherwise describe pre-apply state. Best-effort
- // + fail-safe: if a snapshot exists it is marked ineligible (the next `--changed-only` re-baselines via
- // a full build); no snapshot ⇒ a harmless no-op. Never blocks the build.
- if (opts.apply) {
- try { applySnapshotStore.invalidateSnapshot(workspaceDir); } catch { /* best-effort — never block a build */ }
- }
+ // changed-only flow, so a stale eligible snapshot would otherwise describe pre-apply state.
+ //
+ // FAIL CLOSED (#587 item 3). This used to be best-effort: the `{ ok, reason }` result was discarded
+ // and a throw was swallowed with "never block a build". But "the snapshot could not be invalidated"
+ // is not cosmetic — the snapshot is exactly what a later `--changed-only` run trusts to decide what
+ // it may SKIP. If a full apply mutates the environment while an ELIGIBLE snapshot survives (lease
+ // contention from a concurrent run, an unwritable workspace), that later run certifies pre-apply
+ // state and can skip work this apply just made necessary.
+ if (opts.apply) assertSnapshotInvalidated(applySnapshotStore, workspaceDir);
r = await buildModelApp(spec, opts, deps);
}
} finally {
@@ -725,4 +757,4 @@ async function main() {
if (require.main === module) {
main().catch((err) => emitResult(false, err));
}
-module.exports = { buildModelApp, planFor, isTransientHalt, checkCollisions, discoverOpDiffState, envTruthy, parseLanguageCode };
+module.exports = { buildModelApp, planFor, isTransientHalt, checkCollisions, discoverOpDiffState, envTruthy, parseLanguageCode, assertSnapshotInvalidated };
diff --git a/plugins/model-apps/scripts/download-model-app.js b/plugins/model-apps/scripts/download-model-app.js
index caee8ad2a..53d1f8b23 100644
--- a/plugins/model-apps/scripts/download-model-app.js
+++ b/plugins/model-apps/scripts/download-model-app.js
@@ -17,7 +17,7 @@ const { parseManifestBase64, manifestResourceName, reconcilePageIds } = require(
const { reverseResolveNavIds } = require('./lib/pageref-resolver.js');
const { fetchSitemap, sitemapGenPages } = require('./lib/sitemap-pages.js');
const { isRestrictedSolution } = require('./lib/system-solutions.js');
-const { isPlatformIconRef, webResourceNameFromRef, validateAppSpec, normalizeLanguageCode, isLocalizedLabelMap, ambiguousChoiceAliases, relationshipSchemaName } = require('./lib/app-spec.js');
+const { isPlatformIconRef, webResourceNameFromRef, validateAppSpec, normalizeLanguageCode, isLocalizedLabelMap, ambiguousChoiceAliases, relationshipSchemaName, manyToManySchemaName } = require('./lib/app-spec.js');
const { odataGuid } = require('./lib/ai-app-settings.js');
// webresourcetype (int) -> app-spec web-resource type.
@@ -274,7 +274,27 @@ async function readRelationships(sdk, logicals, publisherPrefix, warn) {
note(r.SchemaName, lc(logical), `it links '${e1}' to '${e2}' and this app does not include both tables`);
continue;
}
- relationships.push({ type: 'ManyToMany', entity1: e1, entity2: e2 });
+ // The deployed schema name is emitted ONLY when it differs from the one the build would
+ // generate anyway AND it satisfies the publisher-prefix rule the lint enforces — the same
+ // rule the 1:N branch above applies, for the same two reasons: a foreign-prefix name would
+ // hand back a spec that fails its own lint, while omitting a DIVERGENT name makes a rebuild
+ // into this same environment create a SECOND intersect relationship beside the existing one
+ // instead of matching it.
+ //
+ // `manyToManySchemaName` SORTS the two entity names before composing, so `auto` is computed
+ // from the same pair that is emitted rather than from the order Dataverse happened to report.
+ const rel = { type: 'ManyToMany', entity1: e1, entity2: e2 };
+ const auto = manyToManySchemaName({ entity1: e1, entity2: e2 }, publisherPrefix);
+ const deployed = r.SchemaName;
+ if (deployed && lc(deployed) !== lc(auto)) {
+ if (!publisherPrefix || lc(deployed).startsWith(`${lc(publisherPrefix)}_`)) rel.schemaName = deployed;
+ else if (typeof warn === 'function') {
+ // RENAMED, not skipped — this relationship IS carried into the spec, so recording it as
+ // skipped would claim it was absent from the rebuildable spec, the opposite of the truth.
+ warn(`relationship '${deployed}' between '${e1}' and '${e2}' does not start with this solution's publisher prefix '${publisherPrefix}_', so the spec rebuilds it under the generated name '${auto}' instead`);
+ }
+ }
+ relationships.push(rel);
}
} catch (e) {
note('(many-to-many)', lc(logical), `their metadata could not be read (${e && e.message})`);
@@ -705,7 +725,13 @@ async function readDescriptionInventory(sdk, appId, solutionUniqueName) {
// Read pac's downloaded page tree (<pagesRoot>/<pageId>/{page.tsx,config.json,prompt.txt}) into
// pages[] entries with codeFile paths relative to `outDir`.
-function parseDownloadedPages(pagesRoot, outDir, nameById) {
+//
+// `unreadable` collects pages whose config.json EXISTS but could not be parsed. That distinction is
+// load-bearing: a MISSING config is genuinely optional, but a present-and-unparseable one means the
+// page's `dataSources` are unknown — and defaulting them to `[]` writes a spec that rebuilds the
+// page with NO table bindings while its source still queries the table. Silent, and only visible
+// once the rebuilt page returns nothing.
+function parseDownloadedPages(pagesRoot, outDir, nameById, unreadable) {
const pages = [];
if (!fs.existsSync(pagesRoot)) return pages;
for (const entry of fs.readdirSync(pagesRoot)) {
@@ -714,9 +740,37 @@ function parseDownloadedPages(pagesRoot, outDir, nameById) {
const tsx = path.join(dir, 'page.tsx');
if (!fs.existsSync(tsx)) continue;
let config = {};
- try { config = JSON.parse(fs.readFileSync(path.join(dir, 'config.json'), 'utf8')); } catch { /* optional */ }
- let prompt = '';
- try { prompt = fs.readFileSync(path.join(dir, 'prompt.txt'), 'utf8').trim(); } catch { /* optional */ }
+ const configPath = path.join(dir, 'config.json');
+ // Read DIRECTLY and let ENOENT — and ONLY ENOENT — mean "absent, therefore optional".
+ // `existsSync` returns false for a file that exists but cannot be OPENED (permissions/ACL), which
+ // made an unreadable config indistinguishable from a missing one: the page was emitted with no
+ // bindings and never recorded as unreadable, so it slipped past the --allow-lossy-download gate
+ // this very function exists to feed.
+ try {
+ // MEASURED: `pac model genpage download` writes config.json starting `ef bb bf`. Node's
+ // 'utf8' decode keeps that BOM as U+FEFF, and JSON.parse REJECTS a leading U+FEFF — so a
+ // perfectly valid downloaded config threw, the old catch substituted `{}`, and the page's
+ // table bindings vanished from the emitted spec. A BOM is an encoding marker, not content.
+ config = JSON.parse(fs.readFileSync(configPath, 'utf8').replace(/^\uFEFF/, ''));
+ if (!config || typeof config !== 'object' || Array.isArray(config)) throw new Error('config.json is not a JSON object');
+ } catch (e) {
+ config = {};
+ // Present but unreadable — report it rather than inventing empty metadata. A genuinely absent
+ // config is optional by contract and is NOT reported.
+ if (!(e && e.code === 'ENOENT') && unreadable) {
+ unreadable.push({ pageId: entry, reason: e && e.message ? e.message : String(e) });
+ }
+ }
+ // A MISSING prompt.txt is an OMISSION, not an empty prompt. Emitting '' made every downloaded
+ // page lacking that optional file look like an explicitly blank prompt, which the build's
+ // blank-provenance guard then refuses — aborting the rebuild of a perfectly good downloaded app.
+ // A file that EXISTS but is blank or unreadable stays explicit, so it still fails closed.
+ let prompt;
+ try {
+ prompt = fs.readFileSync(path.join(dir, 'prompt.txt'), 'utf8').replace(/^\uFEFF/, '').trim();
+ } catch (e) {
+ prompt = (e && e.code === 'ENOENT') ? undefined : '';
+ }
pages.push({
pageId: entry,
name: (nameById && nameById.get(String(entry).toLowerCase())) || entry,
@@ -1789,7 +1843,18 @@ async function runDownload({ sdk, genpageCli, outDir, appId, appUnique, allowLos
const id = String(p.pageId).toLowerCase();
return [id, envNameById.get(id) || p.title || p.pageId];
}));
- pages = parseDownloadedPages(pagesRoot, outDir, nameById);
+ const unreadableConfigs = [];
+ pages = parseDownloadedPages(pagesRoot, outDir, nameById, unreadableConfigs);
+ // A page whose config.json could not be read has UNKNOWN data sources, and the spec would claim
+ // it has none — rebuilding it with no table bindings while its source still queries the table.
+ // That is exactly the class of silent loss `--allow-lossy-download` exists to gate.
+ if (unreadableConfigs.length) {
+ const detail = unreadableConfigs.map((u) => `${u.pageId} (${u.reason})`).join(', ');
+ if (!allowLossy) {
+ return { ok: false, error: `could not read config.json for page(s): ${detail} — their data-source bindings are unknown, so refusing to write a spec that would silently rebuild them unbound. Re-run with --allow-lossy-download to accept the loss.` };
+ }
+ process.stderr.write(`WARNING: ${unreadableConfigs.length} page config(s) unreadable; their data-source bindings are DROPPED: ${detail}\n`);
+ }
// Bidirectional exact equality: sitemap ids ↔ downloaded ids (I3). A gap either way means pac
// fetched a different set than the sitemap declares — rebuilding from this spec would silently
diff --git a/plugins/model-apps/scripts/genpage-upload.js b/plugins/model-apps/scripts/genpage-upload.js
new file mode 100644
index 000000000..16ef121aa
--- /dev/null
+++ b/plugins/model-apps/scripts/genpage-upload.js
@@ -0,0 +1,299 @@
+#!/usr/bin/env node
+'use strict';
+// genpage-upload: deploy ONE generative page through the shared, quoting-safe upload wrapper.
+//
+// WHY THIS SCRIPT EXISTS (#589). `makeGenpageCli().upload()` already writes the prompt and
+// agent-message to temp files and passes `--prompt-file` / `--agent-message-file`, because a
+// prompt is arbitrary user text: it carries quotes, newlines, `%VAR%`, `&`, `|` and non-ASCII.
+// `/app-builder` went through that wrapper, but the standalone `/genpage` skill still told the
+// orchestrator to compose a raw `pac model genpage upload --prompt "<text>"` command line in
+// Markdown — so the same page content deployed one way and failed the other. Observed live:
+//
+// Error: Not a valid command.
+// Parse failed on: Inspection
+// Was it quote wrapped? No, be sure to wrap values that contain spaces.
+//
+// …for a prompt containing an ASCII-quoted multiword page name. The workaround people reach for is
+// to EDIT the approved prompt (swap in typographic quotes), which silently breaks prompt
+// provenance — the page is then built from text the user never approved.
+//
+// So this script is the one entry point both skills use. The prompt never becomes part of a
+// command line: it is read from a FILE and handed to the wrapper as a value.
+//
+// Usage:
+// node scripts/genpage-upload.js --env <orgUrl> --app-id <guid> --code-file <path>
+// --prompt-file <path> --agent-message-file <path>
+// [--page-id <guid>] [--name <text>] [--data-sources <csv>] [--compiled-code-file <path>]
+//
+// `--prompt` / `--agent-message` are accepted for short, shell-safe text, but `--prompt-file` is
+// the documented path precisely because it cannot be mangled by a shell.
+const fs = require('node:fs');
+const path = require('node:path');
+const os = require('node:os');
+const { parseArgs, validateFlags, emitResult } = require('./lib/dataverse-auth.js');
+const { makeGenpageCli, suppliedButBlank } = require('./lib/genpage-cli.js');
+
+const KNOWN = ['env', 'app-id', 'code-file', 'compiled-code-file', 'page-id', 'name',
+ 'data-sources', 'clear-data-sources', 'prompt', 'prompt-file', 'agent-message', 'agent-message-file',
+ 'model', 'connectors', 'actions', 'add-to-sitemap'];
+// Bare switches; every other flag carries a value.
+const SWITCHES = ['add-to-sitemap', 'clear-data-sources'];
+const NEED_VALUE = KNOWN.filter((f) => !SWITCHES.includes(f));
+
+const USAGE = 'Usage: node scripts/genpage-upload.js --env <orgUrl> --app-id <guid> --code-file <path> '
+ + '--prompt-file <path> --agent-message-file <path> [--page-id <guid>] [--name <text>] '
+ + '[--data-sources <csv>] [--clear-data-sources] [--compiled-code-file <path>] [--model <id>] '
+ + '[--connectors <path>] [--actions <path>] [--add-to-sitemap]';
+
+// Resolve one text input that may arrive inline or by file. Returns { ok, value } or { ok:false,
+// error }. Supplying BOTH is rejected rather than silently preferring one: the two would be
+// different text, and quietly picking either means deploying a prompt the caller did not intend.
+function resolveText(flags, inlineFlag, fileFlag, readFile) {
+ const inline = flags[inlineFlag];
+ const file = flags[fileFlag];
+ const hasInline = typeof inline === 'string' && inline !== '';
+ const hasFile = typeof file === 'string' && file !== '';
+ if (hasInline && hasFile) {
+ return { ok: false, error: `pass only one of --${inlineFlag} or --${fileFlag}, not both` };
+ }
+ if (hasFile) {
+ // utf8, and NOT trimmed: a downloaded prompt is a multi-line conversation transcript whose
+ // blank lines — and whose final newline — are part of the text.
+ //
+ // A LEADING UTF-8 BOM is stripped. MEASURED against a live deployment: `pac model genpage
+ // download` writes the recovered `prompt.txt` starting `ef bb bf`, and the documented edit flow
+ // re-feeds exactly that file through `--prompt-file`. Node's 'utf8' decode keeps the BOM as
+ // U+FEFF, so the prompt handed back to pac would begin with an invisible character — silently
+ // altering the first character of a prompt the user approved. Only the LEADING one is removed:
+ // a U+FEFF anywhere else is content, not an encoding marker.
+ // The bytes are otherwise passed through UNCHANGED — no trailing-newline normalization. This
+ // transport exists precisely so an arbitrary prompt survives verbatim, and the direct
+ // /app-builder wrapper path preserves a final newline, so stripping one here made the same text
+ // deploy differently depending on which path carried it. A prompt that legitimately ends with a
+ // newline (a downloaded transcript, a heredoc) keeps it.
+ try {
+ return {
+ ok: true,
+ value: String(readFile(path.resolve(file), 'utf8')).replace(/^\uFEFF/, ''),
+ };
+ } catch (e) {
+ return { ok: false, error: `--${fileFlag} could not be read: ${e.message}` };
+ }
+ }
+ return { ok: true, value: hasInline ? inline : undefined };
+}
+
+async function main(argv = process.argv.slice(2), deps = {}) {
+ const emit = deps.emit || emitResult;
+ const readFile = deps.readFile || fs.readFileSync;
+ const cliFactory = deps.makeGenpageCli || makeGenpageCli;
+
+ const flagError = validateFlags(argv, { known: KNOWN, needValue: NEED_VALUE });
+ if (flagError) return emit(false, { error: `${flagError}\n${USAGE}` });
+ const { flags } = parseArgs(argv);
+
+ for (const required of ['env', 'app-id', 'code-file']) {
+ if (typeof flags[required] !== 'string' || !flags[required]) {
+ return emit(false, { error: `--${required} is required\n${USAGE}` });
+ }
+ }
+
+ const prompt = resolveText(flags, 'prompt', 'prompt-file', readFile);
+ if (!prompt.ok) return emit(false, { error: prompt.error });
+ const agentMessage = resolveText(flags, 'agent-message', 'agent-message-file', readFile);
+ if (!agentMessage.ok) return emit(false, { error: agentMessage.error });
+
+ // An EMPTY prompt or agent-message is refused rather than defaulted. `upload()` substitutes
+ // `Generative page <name>` for a blank prompt and `Authored by app-builder` for a blank agent
+ // message, which is reasonable when nothing was supplied at all — but a caller who passed
+ // `--prompt-file` / `--agent-message-file` asked for THAT text, and silently deploying generated
+ // provenance instead is the failure this path exists to prevent. A file holding only whitespace,
+ // only a newline, or only a BOM is the realistic way this happens.
+ for (const [label, inlineFlag, fileFlag, resolved] of [
+ ['prompt', 'prompt', 'prompt-file', prompt],
+ ['agent message', 'agent-message', 'agent-message-file', agentMessage],
+ ]) {
+ const given = typeof flags[inlineFlag] === 'string' || typeof flags[fileFlag] === 'string';
+ if (given && suppliedButBlank(resolved.value === undefined ? '' : resolved.value)) {
+ return emit(false, {
+ error: `the ${label} resolved to empty — refusing to deploy generated text in place of the `
+ + `${label} you supplied. Check the file is not blank, newline-only, or BOM-only.`,
+ });
+ }
+ }
+
+ const addToSitemap = flags['add-to-sitemap'] === true || flags['add-to-sitemap'] === 'true';
+ // Same normalization as the switch above, and for the same reason: `parseArgs` yields the STRING
+ // "false" for `--clear-data-sources=false`, which is truthy. Testing the raw flag would have read
+ // an explicit refusal to clear as permission to clear — unbinding the page the guard protects.
+ const clearDataSources = flags['clear-data-sources'] === true || flags['clear-data-sources'] === 'true';
+ // A contradiction, not a precedence question: one says "remove every binding", the other names the
+ // bindings to keep. Silently preferring either is a guess about intent on a destructive operation.
+ if (clearDataSources && flags['data-sources']) {
+ return emit(false, {
+ error: '--clear-data-sources cannot be combined with --data-sources: one unbinds the page and '
+ + 'the other sets its bindings. Drop whichever you did not mean.',
+ });
+ }
+ // REFUSED, not silently dropped. pac rejects the combination, and an update that quietly discards
+ // the flag leaves the caller believing a placement happened. The wrapper also omits it on an
+ // update as a backstop, but a backstop is not an answer to an explicit contradictory request.
+ if (addToSitemap && flags['page-id']) {
+ return emit(false, {
+ error: '--add-to-sitemap cannot be combined with --page-id: an update cannot add a sitemap '
+ + 'entry, and the page it names is already placed. Drop one of the two.',
+ });
+ }
+
+ const cli = cliFactory(flags.env);
+
+ // An UPDATE must have a target that EXISTS. pac treats an unknown `--page-id` as a CREATE and
+ // returns the NEW page's id, and the wrapper's identity guard compares the returned id to the one
+ // it just used — which matches, so a typo'd or stale id silently produced a brand-new, UNPLACED
+ // page reported as `updated: true`. Live-reproduced: a UUID proven absent beforehand became a page.
+ //
+ // Checked here rather than inside `upload()` because this is where an ARBITRARY id enters: the
+ // standalone CLI takes it straight from the caller. /app-builder's page updates carry ids from its
+ // own manifest and reconcile, so they do not need an extra env-wide listing per page.
+ //
+ // Env-wide and including unpublished pages, because an app-scoped list is derived from the sitemap
+ // and would miss exactly the unplaced page this defect creates. Fail CLOSED on an unreadable
+ // listing: "cannot prove the target exists" must not license a write that might create a duplicate.
+ if (flags['page-id']) {
+ // Resolve the enumerator by EITHER of the wrapper's two exported names. A wrapper exposing
+ // neither cannot prove the target exists, and skipping the check in that case would be
+ // fail-OPEN exactly when the wrapper is unknown — the opposite of the policy this guard
+ // implements. Gating on `typeof ... === 'function'` alone silently restored the original defect
+ // for any older or custom wrapper.
+ const enumerate = typeof cli.enumerateEnvironment === 'function' ? () => cli.enumerateEnvironment()
+ : typeof cli.enumerateEnv === 'function' ? () => cli.enumerateEnv()
+ : null;
+ if (!enumerate) {
+ return emit(false, {
+ error: `cannot verify that page ${flags['page-id']} exists before updating it — this pac `
+ + 'wrapper exposes no environment listing. Refusing to upload, because pac treats an '
+ + 'unknown --page-id as a create and would make a new page and report it as an update.',
+ });
+ }
+ const known = await enumerate();
+ if (!known || known.ok !== true) {
+ return emit(false, {
+ error: `cannot verify that page ${flags['page-id']} exists before updating it `
+ + `(${(known && known.error) || 'unknown reason'}) — refusing to upload, because pac treats an `
+ + 'unknown --page-id as a create and would make a new page.',
+ });
+ }
+ if (!(known.ids || []).includes(String(flags['page-id']).toLowerCase())) {
+ return emit(false, {
+ error: `page ${flags['page-id']} does not exist in this environment — refusing to "update" it. `
+ + 'pac would create a NEW unplaced page and report it as an update. Check the id, or drop '
+ + '--page-id to create a page deliberately.',
+ });
+ }
+ }
+
+ // An UPDATE that says NOTHING about data sources must not DESTROY them. pac rewrites the page's
+ // binding list from the flags it is given, so omitting `--data-sources` persists `[]` — the page
+ // goes on querying the table while its stored binding disappears. Live-reproduced by following
+ // the Phase 7.5 fix-redeploy command, which omits the flag.
+ //
+ // Same rule as an omitted cell span: absence is "no opinion", never "clear it". The current
+ // bindings are read back and re-sent, so a fix-redeploy is non-destructive by default; pass
+ // `--clear-data-sources` to actually unbind. A create has nothing to preserve.
+ let preservedDataSources;
+ if (flags['page-id'] && !flags['data-sources'] && !clearDataSources) {
+ const probe = fs.mkdtempSync(path.join(os.tmpdir(), 'genpage-ds-'));
+ // The failure is RECORDED and emitted after cleanup, never emitted from inside the try. The real
+ // `emitResult` calls `process.exit(1)`, so a `return emit(...)` in the catch never reaches the
+ // `finally` — leaving the probe directory, and the downloaded page source and prompt inside it,
+ // on disk. The injected emitters used in tests return normally and hid that entirely.
+ let probeError = null;
+ try {
+ await cli.download({ appId: flags['app-id'], outputDir: probe, pageIds: [flags['page-id']] });
+ // pac names the downloaded directory with ITS OWN casing of the page id, which need not match
+ // the casing the caller typed. Joining the caller's spelling works on a case-INSENSITIVE
+ // filesystem and fails on Linux, where a differently-cased --page-id would "lose" the config
+ // and refuse a perfectly good update. Resolve the directory case-insensitively instead.
+ const wantDir = String(flags['page-id']).toLowerCase();
+ const entry = fs.readdirSync(probe).find((d) => d.toLowerCase() === wantDir);
+ if (!entry) throw new Error('pac wrote no directory for this page');
+ // pac writes config.json UTF-8 WITH a BOM, which JSON.parse rejects outright — strip it first
+ // or a perfectly good config reads as unparseable and the bindings are "lost" here too.
+ const raw = fs.readFileSync(path.join(probe, entry, 'config.json'), 'utf8').replace(/^\uFEFF/, '');
+ const cfg = JSON.parse(raw);
+ if (!cfg || typeof cfg !== 'object' || Array.isArray(cfg)) {
+ throw new Error('config.json is not a JSON object');
+ }
+ // An ABSENT `dataSources` key means the page HAS no bindings — the same reading the download
+ // path uses (`config.dataSources || []`), and how an unbound page legitimately looks. A key
+ // that is PRESENT but not an array is neither absent nor readable: it is malformed, and
+ // treating it as "no bindings" would unbind the page on the strength of a value we could not
+ // interpret. Only a MISSING or UNREADABLE config is unknown, and that is refused below.
+ if (cfg.dataSources !== undefined && !Array.isArray(cfg.dataSources)) {
+ throw new Error(`config.json dataSources is ${typeof cfg.dataSources}, not an array`);
+ }
+ preservedDataSources = Array.isArray(cfg.dataSources) ? cfg.dataSources : [];
+ } catch (e) {
+ // Fail CLOSED: guessing "probably none" is exactly the silent unbinding this exists to stop.
+ probeError = `cannot read the current data-source bindings for page ${flags['page-id']} (${e.message})`
+ + ' — refusing to update, because pac would persist an EMPTY binding list and the page would'
+ + ' keep querying a table it is no longer bound to. Pass --data-sources explicitly, or'
+ + ' --clear-data-sources to unbind deliberately.';
+ } finally {
+ // Best-effort: a cleanup failure must not replace the outcome of the operation, nor abort an
+ // update whose bindings were read successfully.
+ try { fs.rmSync(probe, { recursive: true, force: true }); } catch { /* leave the temp dir */ }
+ }
+ if (probeError) return emit(false, { error: probeError });
+ }
+
+ try {
+ const res = await cli.upload({
+ appId: flags['app-id'],
+ pageId: flags['page-id'] || undefined,
+ codeFile: flags['code-file'],
+ compiledCodeFile: flags['compiled-code-file'] || undefined,
+ name: flags.name || undefined,
+ prompt: prompt.value,
+ agentMessage: agentMessage.value,
+ // Passed through as the CSV the caller typed; upload() normalizes array-or-string. When the
+ // caller said nothing on an update, this carries the page's EXISTING bindings so they survive.
+ dataSources: flags['data-sources'] || preservedDataSources || undefined,
+ model: flags.model || undefined,
+ connectors: flags.connectors || undefined,
+ actions: flags.actions || undefined,
+ addToSitemap,
+ });
+ const pageId = (res && (res.pageId || res.id)) || null;
+ // A create that asked for placement, crashed mid-flight, and was recovered as an UPDATE leaves
+ // the page deployed but NOT in the sitemap — invisible in the app's navigation. That is an
+ // incomplete deployment, so it is reported as a failure WITH the page id, rather than as
+ // success, so the operator can place it instead of discovering the gap later.
+ if (res && res.sitemapPending) {
+ return emit(false, {
+ pageId,
+ appId: flags['app-id'],
+ error: `page ${pageId} was deployed but NOT added to the sitemap: the create was recovered as `
+ + 'an update, which cannot carry --add-to-sitemap. Add the page to the app navigation manually.',
+ });
+ }
+ // `pageId` is the one value a caller needs in order to continue (sitemap wiring, a follow-up
+ // edit). Echo the identity back rather than making the caller re-parse pac output.
+ return emit(true, {
+ ok: true,
+ pageId,
+ appId: flags['app-id'],
+ updated: !!flags['page-id'],
+ });
+ } catch (e) {
+ return emit(false, { error: e && e.message ? e.message : String(e) });
+ }
+}
+
+if (require.main === module) {
+ main().catch((e) => {
+ process.stderr.write(`${e && e.message ? e.message : e}\n`);
+ process.exit(1);
+ });
+}
+module.exports = { main, resolveText };
diff --git a/plugins/model-apps/scripts/lib/app-spec-doc.js b/plugins/model-apps/scripts/lib/app-spec-doc.js
index 520a9bbf1..559274f0e 100644
--- a/plugins/model-apps/scripts/lib/app-spec-doc.js
+++ b/plugins/model-apps/scripts/lib/app-spec-doc.js
@@ -90,6 +90,19 @@ function jobsSection(spec) {
}
}
out.push('');
+ // Deliberate exclusions, rendered beside the traceability table so scope is REVIEWED rather than
+ // assumed (#583). What an app leaves out is what distinguishes two apps built over the same tables,
+ // and a reviewer cannot approve an omission they were never shown.
+ const excluded = personas
+ .map((p) => ({ persona: p.persona, items: arr(p.excludes).filter((x) => typeof x === 'string' && x.trim()) }))
+ .filter((e) => e.items.length);
+ if (excluded.length) {
+ out.push('**Deliberately out of scope**', '');
+ for (const e of excluded) {
+ for (const x of e.items) out.push(`- ${cell(e.persona)} — ${cell(x)}`);
+ }
+ out.push('');
+ }
const unmapped = personas.flatMap((p) => objs(p.jobs).filter((j) => !arr(j.surfaces).length).map((j) => `${p.persona} → ${j.name}`));
if (unmapped.length) {
out.push(
diff --git a/plugins/model-apps/scripts/lib/app-spec.js b/plugins/model-apps/scripts/lib/app-spec.js
index c2fb49765..f4576e6a2 100644
--- a/plugins/model-apps/scripts/lib/app-spec.js
+++ b/plugins/model-apps/scripts/lib/app-spec.js
@@ -1175,6 +1175,47 @@ function formColumnsOf(tab) {
return [{ width: '100%', sections: Array.isArray(tab.sections) ? tab.sections : [] }];
}
+// The plugin's own version, read from its manifest, for the `minimumPluginVersion` capability gate.
+//
+// Cached, and NULL when the manifest cannot be read. The caller decides what that means, and it is
+// not "satisfied": `validateAppSpec` REJECTS a spec that declares a minimum when the version is
+// unknown, because "we could not read our own version" must not wave an incompatible install
+// through to the write path. A spec that declares NO minimum never consults this at all, so an
+// unreadable manifest cannot break an existing spec.
+let cachedPluginVersion;
+function pluginVersion() {
+ if (cachedPluginVersion !== undefined) return cachedPluginVersion;
+ cachedPluginVersion = null;
+ for (const rel of [['..', '..', '.plugin', 'plugin.json'], ['..', '..', '.claude-plugin', 'plugin.json']]) {
+ try {
+ const manifest = JSON.parse(require('node:fs').readFileSync(path.join(__dirname, ...rel), 'utf8'));
+ if (manifest && typeof manifest.version === 'string') { cachedPluginVersion = manifest.version; break; }
+ } catch { /* try the next location */ }
+ }
+ return cachedPluginVersion;
+}
+
+// Compare two dotted versions numerically. Returns <0, 0 or >0.
+//
+// Deliberately NOT a semver library: this repo vendors nothing for it, and the only versions being
+// compared are this plugin's own `major.minor.patch` manifest values.
+//
+// The `-`/`+` suffix is stripped BEFORE splitting on dots, not after. Splitting first turned
+// `2.8.0-beta.1` into `[2, 8, 0, 1]`, so a running `2.8.0` compared as OLDER than a `2.8.0-beta.1`
+// requirement and refused to build — the opposite of the intended behaviour, and my earlier comment
+// claiming the suffix "sorts by its numeric prefix" was only true for a suffix with no dot in it.
+// Comparing the release CORE means a pre-release or build-metadata requirement is satisfied by the
+// corresponding release, which is the safe direction: it cannot spuriously block a build.
+function compareVersions(a, b) {
+ const core = (v) => String(v || '').split(/[-+]/)[0].split('.').map((n) => parseInt(n, 10) || 0);
+ const [pa, pb] = [core(a), core(b)];
+ for (let i = 0; i < Math.max(pa.length, pb.length); i++) {
+ const d = (pa[i] || 0) - (pb[i] || 0);
+ if (d) return d;
+ }
+ return 0;
+}
+
// 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.
@@ -1569,6 +1610,42 @@ function validateAppSpec(spec, opts = {}) {
const shape = normalizeSpecShape(spec);
errors.push(...shape.errors);
spec = shape.spec;
+ // CAPABILITY GATE (#584 item 5). A spec may declare the minimum plugin version that can build it;
+ // an older plugin refuses rather than mis-compiling it.
+ //
+ // ⚠ MEASURED LIMITATION, stated here because it is easy to over-promise: this gate protects
+ // FORWARD only. Consumers already shipped cannot be made to reject anything — the 2.8.0 validator
+ // accepts an unknown top-level key, `schemaVersion: 3` and even `schemaVersion: 99`, all with
+ // `ok: true`, because it validates none of them. So this does NOT retroactively protect a maker
+ // running an older plugin; it makes the requirement explicit and machine-checkable from here on,
+ // and every future consumer inherits it.
+ //
+ // What DOES protect the reported harm today is the destructive preflight: the failure mode in
+ // #584 (an old compiler reducing a columns-only form to an empty field set) surfaces as a plan to
+ // remove every non-primary field, which requires authorization before it can be written.
+ if (spec.minimumPluginVersion !== undefined) {
+ const want = spec.minimumPluginVersion;
+ // ANCHORED at BOTH ends on purpose. A prefix-only pattern accepted `2..9` on its leading `2`,
+ // and compareVersions' `parseInt(n, 10) || 0` then read the empty component as 0 and enforced
+ // 2.0.9 — a different floor than the author wrote, with no error. The optional `-pre`/`+build`
+ // suffix is permitted because compareVersions deliberately compares the release CORE.
+ if (typeof want !== 'string' || !/^\d+(?:\.\d+)*(?:[-+][0-9A-Za-z.-]+)?$/.test(want)) {
+ errors.push(`minimumPluginVersion must be a dotted version string like '2.9.0', got ${JSON.stringify(want)}`);
+ } else {
+ const have = pluginVersion();
+ if (!have) {
+ // FAIL CLOSED. The spec has explicitly declared a floor, so "we could not read our own
+ // version" must not become "requirement satisfied" — that would let an incompatible install
+ // reach the write path with no check and no override. A spec that declares NO minimum is
+ // unaffected, so this cannot break any existing spec.
+ errors.push(`this spec requires model-apps ${want} or newer, but this plugin's own manifest version could not be read, `
+ + 'so the requirement cannot be checked. Reinstall or repair the plugin rather than removing this line.');
+ } else if (compareVersions(have, want) < 0) {
+ errors.push(`this spec requires model-apps ${want} or newer, but the running plugin is ${have}. `
+ + 'It declares capabilities this version would not build correctly — upgrade the plugin rather than removing this line.');
+ }
+ }
+ }
if (!spec.solution || !spec.solution.uniqueName) {
errors.push('solution.uniqueName is required');
}
@@ -2941,7 +3018,7 @@ function validateAppSpec(spec, opts = {}) {
// defaulting to true → the persona wrongly gets app-module read + the app association. Same pattern
// the `design` block uses. Allowlists mirror the vendored SDK's PersonaRoleSpec/JobToBeDone/
// EntityPrivilege shapes exactly.
- const PERSONA_KEYS = new Set(['persona', 'jobs', 'additionalPrivileges', 'appAccess', 'businessUnitId', 'assignTo']);
+ const PERSONA_KEYS = new Set(['persona', 'jobs', 'additionalPrivileges', 'appAccess', 'businessUnitId', 'assignTo', 'excludes']);
const JOB_KEYS = new Set(['name', 'description', 'privileges', 'surfaces']);
const PRIVILEGE_KEYS = new Set(['entity', 'access', 'scope']);
const rejectUnknown = (obj, allowed, ctx) => {
@@ -2986,6 +3063,15 @@ function validateAppSpec(spec, opts = {}) {
}
const label = pname || '?';
if (p.appAccess !== undefined && typeof p.appAccess !== 'boolean') errors.push(`persona "${label}": appAccess must be a boolean`);
+ // excludes[]: what this persona deliberately does NOT do in this app (#583). An app's scope is
+ // defined as much by what it leaves out as by what it includes, and the exclusions are what let a
+ // reviewer tell two apps over the same tables apart. Purely DOCUMENTARY — like jobs[].surfaces it
+ // is rendered into the design doc and never applied to Dataverse. `personaRoleSpecFor` projects
+ // explicit fields only, so this can never reach the SDK and be silently discarded there.
+ if (p.excludes !== undefined) {
+ if (!Array.isArray(p.excludes)) errors.push(`persona "${label}": excludes must be an array of strings`);
+ else for (const x of p.excludes) if (typeof x !== 'string' || !x.trim()) errors.push(`persona "${label}": each excludes[] entry must be a non-empty string`);
+ }
if (p.businessUnitId !== undefined && (typeof p.businessUnitId !== 'string' || !FORM_GUID_RE.test(p.businessUnitId))) errors.push(`persona "${label}": businessUnitId must be a GUID`);
if (!Array.isArray(p.jobs) || !p.jobs.length) {
errors.push(`persona "${label}": at least one job (jobs[]) is required`);
diff --git a/plugins/model-apps/scripts/lib/artifact-intent.js b/plugins/model-apps/scripts/lib/artifact-intent.js
index 133d3e087..e65cdbe80 100644
--- a/plugins/model-apps/scripts/lib/artifact-intent.js
+++ b/plugins/model-apps/scripts/lib/artifact-intent.js
@@ -17,6 +17,28 @@ const { SDK_COLUMN_TYPE } = require('./entity-provision.js');
// Arrange field cells into `columns` cells-per-row.
// Mirrors rowsFromCells in sdk-build.js but lives here so this module is
// self-contained — the build engine should call compileFormIntent, not rowsFromCells.
+
+// The width a cell occupies in a section of `columns` columns, clamped exactly as rowsFromCells
+// clamps it. Shared so the RECONCILE path (which appends a cell to an already-deployed section) packs
+// by the same rule the CREATE path uses. They used to disagree: `placeFieldInSection` appended every
+// added field as its own single-cell row and moved every relocated field onto the last row
+// regardless of width, so the same spec produced a different shape depending only on whether the
+// form already existed.
+function clampedCellSpan(cell, columns) {
+ const cols = Math.max(1, Math.min(4, columns || 1));
+ return Math.min(cols, Math.max(1, Number(cell && cell.colspan) || 1));
+}
+
+// True when `cell` still fits on the END of `row`. This is the exact complement of the
+// "start a new row" test in rowsFromCells (`used + span > cols && current.length`): an EMPTY row
+// always accepts the cell, because a span wider than the section is clamped to it rather than
+// overflowing into a row of its own.
+function cellFitsInRow(row, cell, columns) {
+ const cols = Math.max(1, Math.min(4, columns || 1));
+ const used = ((row && row.cells) || []).reduce((n, c) => n + clampedCellSpan(c, cols), 0);
+ return used === 0 || used + clampedCellSpan(cell, cols) <= cols;
+}
+
function rowsFromCells(cells, columns) {
const cols = Math.max(1, Math.min(4, columns || 1));
const rows = [];
@@ -101,12 +123,19 @@ function fieldCellIntent(logical, opts) {
// Same asymmetry, same reason: only `visible: false` is written. An explicit `true` would
// un-hide a control someone deliberately hid outside the spec.
if (opts.hidden) cell.visible = false;
- // Spans are written only when they are NOT the adapter's default of 1, for the same reason
- // `isReadOnly: false` is never written: emitting the default on every ordinary cell would
- // overwrite a span a maker widened by hand on a form the spec never claimed to own that of.
+ // Spans are written when the author EXPRESSED one — including an explicit 1.
+ //
+ // The asymmetry that matters here is OMISSION vs VALUE, not 1 vs >1. Omitting a span means the
+ // spec has no opinion, and emitting the adapter default for every ordinary cell would overwrite a
+ // span a maker widened by hand on a form the spec never claimed to own that of — the same reason
+ // `isReadOnly: false` is never written. But an author who WRITES `colspan: 1` is claiming it.
+ //
+ // Collapsing those two cases made a reset unrepresentable: changing an authored span from 2 to 1
+ // compiled to "no colspan", reconcile read that as "no desired span", and the deployed cell stayed
+ // at 2 — live-reproduced across two applies. `undefined` is still omission; a number is intent.
// Both serialize to real `colspan`/`rowspan` attributes (verified against the vendored bundle).
- if (opts.colspan > 1) cell.colspan = opts.colspan;
- if (opts.rowspan > 1) cell.rowspan = opts.rowspan;
+ if (typeof opts.colspan === 'number' && opts.colspan >= 1) cell.colspan = opts.colspan;
+ if (typeof opts.rowspan === 'number' && opts.rowspan >= 1) cell.rowspan = opts.rowspan;
return cell;
}
@@ -131,10 +160,19 @@ const NON_FORM_RENDERABLE_TYPES = new Set(['BigInt']);
// { "name": "co_description", "colspan": 2 }
// Returns a canonical { name, readOnly, hidden, after, colspan, rowspan } with `name`/`after`
// lower-cased, because every downstream comparison (form field logicals, cell pointers, Dataverse
-// attribute logical names) is lower-case. Spans normalize to `undefined` rather than 1 so the cell
-// builder can distinguish "author asked for the default" from "author said nothing".
+// attribute logical names) is lower-case.
+//
+// A span is `undefined` only when the author SAID NOTHING. An explicit 1 is preserved as 1: the
+// previous rule mapped every value <= 1 to undefined, which made "author asked for the default"
+// and "author said nothing" IDENTICAL — the opposite of what its comment claimed. The consequence
+// was live-reproduced: changing an authored colspan from 2 to 1 compiled to "no colspan",
+// reconcile read that as "no desired span", and the deployed cell stayed at 2 across two applies.
function normalizeFieldEntry(entry) {
- const span = (v) => (Number.isFinite(Number(v)) && Number(v) > 1 ? Math.floor(Number(v)) : undefined);
+ const span = (v) => {
+ if (v === undefined || v === null || v === '') return undefined; // said nothing
+ const n = Number(v);
+ return Number.isFinite(n) && n >= 1 ? Math.floor(n) : undefined; // an explicit 1 IS intent
+ };
if (entry && typeof entry === 'object' && !Array.isArray(entry)) {
return {
name: String(entry.name || '').toLowerCase(),
@@ -154,6 +192,12 @@ function normalizeFieldEntry(entry) {
// This is the ONLY way to reach these attributes under an AUTO layout, which has no field list to
// hang an inline object off. Under an EXPLICIT layout both work and the inline entry wins, because
// the more specific declaration should not be silently overridden by a form-wide default.
+function optSpan(v) {
+ if (v === undefined || v === null || v === '') return undefined;
+ const n = Number(v);
+ return Number.isFinite(n) && n >= 1 ? Math.floor(n) : undefined;
+}
+
function fieldOptionsMap(formSpec) {
const map = {};
const fo = formSpec && formSpec.fieldOptions;
@@ -166,8 +210,9 @@ function fieldOptionsMap(formSpec) {
readOnly: v.readOnly === true,
hidden: v.hidden === true,
after: v.after ? String(v.after).toLowerCase() : undefined,
- colspan: Number(v.colspan) > 1 ? Math.floor(Number(v.colspan)) : undefined,
- rowspan: Number(v.rowspan) > 1 ? Math.floor(Number(v.rowspan)) : undefined,
+ // Same omission-vs-value rule as normalizeFieldEntry: an explicit 1 is a claim, absence is not.
+ colspan: optSpan(v.colspan),
+ rowspan: optSpan(v.rowspan),
};
}
return map;
@@ -801,6 +846,12 @@ function findFieldCellPointer(formJson, logical) {
module.exports = {
compileFormIntent,
+ clampedCellSpan,
+ cellFitsInRow,
+ // Exported for the build's in-place repack: a span widened on a DEPLOYED form can overflow its
+ // row, and the reconcile must re-pack it with the SAME rule the create path uses, not a second
+ // implementation that can drift.
+ rowsFromCells,
fieldCellIntent,
notesCellIntent,
notesSectionIntent,
diff --git a/plugins/model-apps/scripts/lib/form-container-match.js b/plugins/model-apps/scripts/lib/form-container-match.js
new file mode 100644
index 000000000..7c11c792a
--- /dev/null
+++ b/plugins/model-apps/scripts/lib/form-container-match.js
@@ -0,0 +1,47 @@
+'use strict';
+
+// How an AUTHORED form container (a tab or a section) is matched to a DEPLOYED one.
+//
+// This is shared deliberately. The build reconciles an existing form by matching containers
+// name -> label -> position, and a position- or label-matched container KEEPS ITS DEPLOYED NAME: it
+// is not renamed, because form scripts and business rules can reference a section by name. A
+// verifier that looks containers up by the AUTHORED name therefore reports a perfectly good
+// auto-to-explicit migration as "section absent" and fails a build that did exactly what was asked.
+// Live-reproduced. Both sides now use this one function, so they cannot drift apart again.
+
+// Find the deployed container matching `want`, preferring an exact name, then a label, then the
+// positional slot. `claimed` (a Set of already-taken indices) keeps two authored containers from
+// resolving to the same deployed one; `skip` hides containers the LABEL and POSITION passes must
+// not claim. Returns `{ index, item }` or null.
+function matchContainer(list, want, wantIndex, opts) {
+ const items = list || [];
+ const claimed = (opts && opts.claimed) || null;
+ const skip = (opts && opts.skip) || (() => false);
+ const eq = (a, b) => a !== undefined && a !== null && String(a).toLowerCase() === String(b || '').toLowerCase();
+ const free = (i) => !claimed || !claimed.has(i);
+ let idx = items.findIndex((x, i) => free(i) && want.name && eq(x.name, want.name));
+ if (idx < 0) idx = items.findIndex((x, i) => free(i) && !skip(x) && want.label && eq(x.label, want.label));
+ if (idx < 0 && wantIndex < items.length && free(wantIndex) && !skip(items[wantIndex])) idx = wantIndex;
+ return idx < 0 ? null : { index: idx, item: items[idx] };
+}
+
+// A section the ENGINE owns rather than one the author laid out: a sub-grid host, or the
+// notes/timeline section. `addSubgrids` appends one such section per authored sub-grid on EVERY
+// layout (auto included), and `compileFormIntent` appends the notes section — so they sit in the
+// same `sections[]` array as the author's own, just after them.
+//
+// They must be invisible to the LABEL and POSITION passes. Otherwise, as soon as an explicit layout
+// declares as many sections as the index of the first appended one, the positional fallback claims
+// the sub-grid: it gets relabelled to the author's section title, bound field controls are injected
+// into the row holding the grid control, and the author's section is never created. The build is
+// green and a rebuild converges on the same wrong shape, so nothing downstream reports it.
+//
+// Detected structurally (every cell carries a control with no `fieldName`) rather than by name, so
+// it holds for a sub-grid whose section the author renamed in Maker. An EMPTY section has no cells
+// and is deliberately NOT engine-owned — it stays matchable so a vacated section can be reused.
+function isEngineOwnedSection(s) {
+ const cells = ((s && s.rows) || []).flatMap((r) => (r && r.cells) || []);
+ return cells.length > 0 && cells.every((c) => c && c.control && !c.control.fieldName);
+}
+
+module.exports = { matchContainer, isEngineOwnedSection };
diff --git a/plugins/model-apps/scripts/lib/form-preview.js b/plugins/model-apps/scripts/lib/form-preview.js
index b74e14a8b..f5db651c7 100644
--- a/plugins/model-apps/scripts/lib/form-preview.js
+++ b/plugins/model-apps/scripts/lib/form-preview.js
@@ -71,12 +71,44 @@ function labelFor(entity, fn, lang) {
return (c && (labelText(c.displayName, lang) || c.schemaName)) || fn;
}
-// "Label * [widget]" for one field cell.
-function fieldLabel(entity, cell, lang) {
+// The authored, non-default state of one cell, as the suffix that is appended to its label.
+// `compileFormIntent` writes only the NON-default state (see artifact-intent.js): a hidden cell gets
+// `cell.visible = false` and a read-only one `control.isReadOnly = true`; the visible/editable
+// defaults are never emitted. So presence of the flag is the signal, and `isReadOnly: false` never
+// appears to be mistaken for an authored read-write intent.
+//
+// Shared with the row renderer, which needs the tag's WIDTH to decide whether a row must be stacked
+// — deriving it twice is how the two would drift apart.
+function stateTag(cell) {
+ const state = [];
+ if (cell.visible === false) state.push('hidden');
+ if (cell.control && cell.control.isReadOnly) state.push('read-only');
+ return state.length ? ` (${state.join(', ')})` : '';
+}
+
+// "Label * (state) [widget]" for one field cell.
+//
+// State is placed BEFORE the widget deliberately, and `avail` (the cell's rendered width) lets this
+// protect the state further. Cells are clipped to the column width and `clip()` truncates the END,
+// so an annotation appended after the widget is exactly what gets cut. Ordering alone is still not
+// enough: with a long display name the annotation itself is what gets cut, producing "(read-o…" — a
+// half-printed state flag, which is the silent-state failure this annotation exists to prevent. A
+// truncated LABEL stays recognisable; a truncated state does not. So the decorative widget hint is
+// surrendered first, the name is truncated after that, and the state is never truncated.
+//
+// When even that is not enough — the tag alone is wider than the column — the ROW renderer stacks
+// the cells at full width instead of calling this with an impossible `avail`.
+function fieldLabel(entity, cell, lang, avail) {
const fn = cell.control.fieldName;
const req = cell.control.isRequired ? ' *' : '';
const widget = WIDGET[fieldType(entity, fn)] || WIDGET.Text;
- return `${cell.control.label || labelFor(entity, fn, lang)}${req} ${widget}`;
+ const tag = stateTag(cell);
+ const name = cell.control.label || labelFor(entity, fn, lang);
+ const full = `${name}${req}${tag} ${widget}`;
+ if (!tag || !avail || vwidth(full) <= avail) return full;
+ const noWidget = `${name}${req}${tag}`;
+ if (vwidth(noWidget) <= avail) return noWidget;
+ return `${clip(name, Math.max(1, avail - vwidth(`${req}${tag}`)))}${req}${tag}`;
}
// Render one form to an ASCII wireframe string.
@@ -126,7 +158,26 @@ function renderFormWireframe(spec, f) {
const cells = (r.cells || []).filter((c) => c.control && c.control.fieldName);
if (!cells.length) continue;
const colW = Math.floor((INNER - 3) / Math.max(1, cells.length));
- const parts = cells.map((c) => vpad(clip(` ${fieldLabel(entity, c, spec && spec.languageCode)}`, colW), colW));
+ // STACK rather than truncate a state tag. Adversarial review caught the width-priority
+ // ordering in fieldLabel() being necessary but not sufficient: once the tag ALONE is wider
+ // than the column, reserving "at least one name character" still leaves the tag itself to
+ // be eaten by clip(). ` (hidden, read-only)` needs 20 columns; a three-column row gives 18
+ // and a four-column row 13, so the approval gate went back to showing `(hidden, read-o…`.
+ //
+ // When that happens the row is rendered one cell per line at full width, which keeps the
+ // state intact at the cost of the side-by-side depiction. The wireframe exists to report
+ // what will deploy, so a less pretty row beats a row that misreports state.
+ const needed = (c) => vwidth(` ${stateTag(c)}`) + 1; // + 1 char of name
+ const mustStack = cells.length > 1 && cells.some((c) => stateTag(c) && needed(c) > colW);
+ if (mustStack) {
+ for (const c of cells) {
+ lines.push(row(clip(` ${fieldLabel(entity, c, spec && spec.languageCode, INNER - 2)}`, INNER)));
+ }
+ continue;
+ }
+ // `colW - 2` is the room left after the two-space cell indent below, and is what
+ // fieldLabel needs in order to protect the state annotation from being clipped.
+ const parts = cells.map((c) => vpad(clip(` ${fieldLabel(entity, c, spec && spec.languageCode, colW - 2)}`, colW), colW));
lines.push(row(parts.join('')));
}
}
diff --git a/plugins/model-apps/scripts/lib/genpage-cli.js b/plugins/model-apps/scripts/lib/genpage-cli.js
index dab5c3a6d..28b91d55e 100644
--- a/plugins/model-apps/scripts/lib/genpage-cli.js
+++ b/plugins/model-apps/scripts/lib/genpage-cli.js
@@ -215,7 +215,8 @@ function makeGenpageCli(env, deps = {}) {
// newIds.length > 1 → THROW (ambiguous; concurrent creates or noise — never guess)
// NO name matching anywhere in recovery (names are unreliable — app-scoped list misses
// pre-sitemap pages; env-wide names drift with sitemap titles). Any enumerateEnv failure → THROW.
- async upload({ appId, pageId, codeFile, compiledCodeFile, name, prompt, agentMessage, dataSources }) {
+ async upload({ appId, pageId, codeFile, compiledCodeFile, name, prompt, agentMessage, dataSources,
+ addToSitemap, model, connectors, actions }) {
// pac REQUIRES both a prompt and an agent-message for a new page. Resolve the effective text
// (preserving the historical defaults) ONCE, then hand both to pac BY FILE via --prompt-file /
// --agent-message-file rather than inline --prompt / --agent-message. A downloaded page prompt is
@@ -224,7 +225,14 @@ function makeGenpageCli(env, deps = {}) {
// stray newline can't truncate the Windows command line) and silently loses every line break on
// an edit-rebuild. A file round-trips the text verbatim. See `pac model genpage upload --help`.
const promptText = prompt && String(prompt).trim() ? String(prompt) : `Generative page ${name || ''}`.trim();
- const agentMessageText = agentMessage && String(agentMessage).trim() ? String(agentMessage) : 'Authored by app-builder';
+ // The default applies only when NO agent message was supplied. An explicitly EMPTY one (a
+ // zero-byte --agent-message-file) used to be replaced by this fallback, so the deployed page
+ // carried provenance the caller never wrote — the same fabrication the empty-prompt check
+ // already refuses. `undefined` means "not supplied"; a supplied empty string is the caller's
+ // problem to fix, and is rejected by genpage-upload.js before reaching here.
+ const agentMessageText = agentMessage === undefined || agentMessage === null
+ ? 'Authored by app-builder'
+ : String(agentMessage);
// Write both files ONCE, before the retry loop, into a unique temp dir. mkdtempSync's random
// suffix keeps concurrent uploads from colliding on a fixed filename. UTF-8 because prompts carry
// non-ASCII (pac reads these back as UTF-8). The try/finally guarantees the dir is removed on
@@ -246,21 +254,41 @@ function makeGenpageCli(env, deps = {}) {
// prompt/agent-message round-trips intact instead of being newline-collapsed.
args.push('--prompt-file', promptFile);
args.push('--agent-message-file', agentMessageFile);
- if (dataSources && dataSources.length) args.push('--data-sources', dataSources.join(','));
+ // Accept an ARRAY (how the build passes it) or a CSV STRING (how a CLI caller does).
+ // `dataSources.join` on a string would throw, and a bare `.length` check passes for both,
+ // so the shape has to be normalized rather than assumed.
+ const ds = Array.isArray(dataSources) ? dataSources.join(',') : String(dataSources || '');
+ if (ds) args.push('--data-sources', ds);
+ // OPT-IN extras, for the standalone /genpage skill (#589). They default to absent because
+ // /app-builder must NOT send them: `--add-to-sitemap` in particular is deliberately omitted
+ // there, since the SDK owns the sitemap and writes the GenPage subareas itself — letting pac
+ // add one too would produce a duplicate subarea. Unlike the prompt these are short,
+ // caller-controlled values (a model id, file paths, a bare switch), so they are safe inline.
+ if (model) args.push('--model', model);
+ if (connectors) args.push('--connectors', connectors);
+ if (actions) args.push('--actions', actions);
+ // Only ever on a CREATE. pac rejects the combination, and the skills' own rule is
+ // "use --page-id, omit --add-to-sitemap" — enforcing it here keeps every caller honest
+ // instead of repeating the rule in prose at each call site.
+ if (addToSitemap && !pid) args.push('--add-to-sitemap');
return run(args);
};
let pid = pageId;
let lastErr = '';
+ // Set when a CREATE asked for sitemap placement but recovery adopted an existing page id,
+ // turning the retry into an UPDATE — which cannot carry --add-to-sitemap. The page then
+ // exists but is UNPLACED, and reporting plain success would hide that.
+ let sitemapPending = false;
// Snapshot taken once (lazily on the first CREATE attempt) so the before/after diff is anchored
// to the exact env state before this operation. Fail-closed: if we can't snapshot, we can't
// safely attribute a later uncertain result — halt to prevent a blind duplicate.
let beforeIds = null;
for (let i = 0; i < attempts; i += 1) {
- if (!pid && name && beforeIds === null) {
+ if (!pid && beforeIds === null) {
const before = await enumerateEnv();
if (!before.ok) {
throw new Error(
- `pac genpage upload for '${name}': cannot snapshot the environment before create (${before.error}) — refusing to create (would risk a duplicate)`
+ `pac genpage upload for '${name || '(unnamed)'}': cannot snapshot the environment before create (${before.error}) — refusing to create (would risk a duplicate)`
);
}
beforeIds = new Set(before.ids);
@@ -275,10 +303,10 @@ function makeGenpageCli(env, deps = {}) {
// Case-insensitive: PAC can normalize GUID casing across writes.
if (pid && id.toLowerCase() !== pid.toLowerCase()) {
throw new Error(
- `pac genpage upload for '${name}': UPDATE returned an unexpected Page ID (got ${id}, expected ${pid}) — refusing to persist a mismatched update`
+ `pac genpage upload for '${name || '(unnamed)'}': UPDATE returned an unexpected Page ID (got ${id}, expected ${pid}) — refusing to persist a mismatched update`
);
}
- return { pageId: id };
+ return sitemapPending ? { pageId: id, sitemapPending: true } : { pageId: id };
}
lastErr = `returned no Page ID: ${lastLine(r)}`;
} else {
@@ -287,27 +315,31 @@ function makeGenpageCli(env, deps = {}) {
// Uncertain CREATE: no caller pid and result was non-zero or zero-without-Page-ID.
// Strict env-wide before/after id diff — never use name matching (names drift; app-scoped
// lists miss pre-sitemap pages; a page's list "Name" is its sitemap title, not its identity).
- if (!pid && name) {
+ if (!pid) {
const after = await enumerateEnv();
if (!after.ok) {
throw new Error(
- `pac genpage upload for '${name}' had an uncertain result and env enumeration failed — refusing to retry (would risk a duplicate): ${after.error}`
+ `pac genpage upload for '${name || '(unnamed)'}' had an uncertain result and env enumeration failed — refusing to retry (would risk a duplicate): ${after.error}`
);
}
const newIds = after.ids.filter((id) => !beforeIds.has(id));
if (newIds.length === 1) {
pid = newIds[0]; // CREATE landed → adopt; I7 guard verifies returned id on the UPDATE
+ // The adopted retry runs as an UPDATE, so `--add-to-sitemap` is no longer emitted.
+ // Record that the placement the caller asked for did not happen rather than letting
+ // a successful-looking result imply a page that is actually unreachable from the nav.
+ if (addToSitemap) sitemapPending = true;
} else if (newIds.length === 0) {
// CREATE did NOT land → safe to retry (pid stays undefined; beforeIds unchanged)
} else {
throw new Error(
- `pac genpage upload for '${name}': ${newIds.length} new pages appeared after an uncertain create — cannot attribute (ambiguous)`
+ `pac genpage upload for '${name || '(unnamed)'}': ${newIds.length} new pages appeared after an uncertain create — cannot attribute (ambiguous)`
);
}
}
if (i < attempts - 1) await sleep(500 * (i + 1));
}
- throw new Error(`pac genpage upload failed for '${name}' after ${attempts} attempt(s): ${lastErr}`);
+ throw new Error(`pac genpage upload failed for '${name || '(unnamed)'}' after ${attempts} attempt(s): ${lastErr}`);
} finally {
// Best-effort cleanup on EVERY exit path (success return, retry-exhaustion throw, mid-loop
// throws). A cleanup failure (e.g. a transient Windows file lock) must NEVER mask the upload's
@@ -318,6 +350,13 @@ function makeGenpageCli(env, deps = {}) {
list({ appId }) {
return listPages(appId);
},
+ // Env-wide, INCLUDING unpublished pages — the only listing that can answer "does this page id
+ // exist at all", since an app-scoped list is derived from the sitemap and so misses a page that
+ // was created but never placed. Exposed so the standalone CLI can verify an update target
+ // without reimplementing pac listing, retry and output classification.
+ enumerateEnvironment() {
+ return enumerateEnv();
+ },
enumerate({ appId }) {
return enumeratePages(appId);
},
@@ -338,4 +377,11 @@ function makeGenpageCli(env, deps = {}) {
};
}
-module.exports = { makeGenpageCli, parsePageId, parseList, parseListCount, classifyListOutput, quoteArg, buildPacInvocation, runPac };
+// A provenance value the caller SUPPLIED but left blank. `undefined`/`null` mean "not supplied", and
+// the wrapper's defaults then apply legitimately. A present-but-blank value is different: the caller
+// asked for THAT text, so substituting generated provenance deploys words nobody wrote. Whitespace-,
+// newline- and BOM-only files are the realistic ways an empty value arrives.
+function suppliedButBlank(value) {
+ return value !== undefined && value !== null && !String(value).trim();
+}
+module.exports = { makeGenpageCli, suppliedButBlank, parsePageId, parseList, parseListCount, classifyListOutput, quoteArg, buildPacInvocation, runPac };
diff --git a/plugins/model-apps/scripts/lib/sdk-build.js b/plugins/model-apps/scripts/lib/sdk-build.js
index 1927b1e0b..b8a8edaac 100644
--- a/plugins/model-apps/scripts/lib/sdk-build.js
+++ b/plugins/model-apps/scripts/lib/sdk-build.js
@@ -72,8 +72,11 @@ const {
formEventsRegionIntent,
viewColumnsIntent,
firstColumnSectionsPointer,
+ cellFitsInRow,
+ rowsFromCells,
} = require('./artifact-intent.js');
-const { makeGenpageCli } = require('./genpage-cli.js');
+const { makeGenpageCli, suppliedButBlank } = require('./genpage-cli.js');
+const { matchContainer, isEngineOwnedSection } = require('./form-container-match.js');
const { manifestResourceName, buildManifest, serializeManifest, parseManifestBase64, reconcilePageIds } = require('./page-manifest.js');
// MEMBERSHIP authority (the app's live sitemap) + the cross-app shared-page scan. fetchSitemap is
// fail-closed & discriminated (C4); fetchAppsForPages is the only way to prove a generative page is not
@@ -1752,7 +1755,7 @@ async function runSdkBuild(spec, opts = {}) {
// imposes no row/cell cardinality rule, only "a cell control must be an object or null"), and
// Dataverse accepts the push; how UCI lays the overflow out is NOT verified here. A row
// emptied by the move is removed so blank rows cannot accumulate.
- const applyFieldPositions = async (formId, def) => {
+ const applyFieldPositions = async (formId, def, vacated) => {
const positions = def.__fieldPositions || {};
for (const logical of Object.keys(positions)) {
const anchor = positions[logical];
@@ -1772,6 +1775,16 @@ async function runSdkBuild(spec, opts = {}) {
// to 2 columns above 6 fields, so this was the common case, not an edge case.
if (from.sectionPointer === to.sectionPointer && from.flatIndex === to.flatIndex + 1) continue;
+ // A positioning move can CROSS sections (`fieldOptions[x].after` may anchor to a field in
+ // another one), which empties the source just as a layout move does. Recording it here is what
+ // keeps the vacated-section sweep honest: without it, a source section emptied by this pass —
+ // and then stripped of its last field by the prune pass — survived as an orphan, because no
+ // one ever added its name to the set.
+ if (vacated && from.sectionPointer !== to.sectionPointer) {
+ const src = sectionAt(form, from.sectionPointer);
+ if (src && src.name) vacated.add(String(src.name).toLowerCase());
+ }
+
// Which mechanic can actually SATISFY that check?
//
// A ROW move inserts the field's row after the anchor's row, so it lands after the LAST cell
@@ -1840,37 +1853,6 @@ async function runSdkBuild(spec, opts = {}) {
//
// `skip` hides containers the weaker passes must not claim. Only NAME may match them, because a
// name is positive evidence and a label/position is not.
- const matchContainer = (list, want, wantIndex, opts) => {
- const items = list || [];
- const claimed = (opts && opts.claimed) || null;
- const skip = (opts && opts.skip) || (() => false);
- const eq = (a, b) => a !== undefined && a !== null && String(a).toLowerCase() === String(b || '').toLowerCase();
- const free = (i) => !claimed || !claimed.has(i);
- let idx = items.findIndex((x, i) => free(i) && want.name && eq(x.name, want.name));
- if (idx < 0) idx = items.findIndex((x, i) => free(i) && !skip(x) && want.label && eq(x.label, want.label));
- if (idx < 0 && wantIndex < items.length && free(wantIndex) && !skip(items[wantIndex])) idx = wantIndex;
- return idx < 0 ? null : { index: idx, item: items[idx] };
- };
-
- // A section the ENGINE owns rather than one the author laid out: a sub-grid host, or the
- // notes/timeline section. `addSubgrids` appends one such section per authored sub-grid on EVERY
- // layout (auto included), and `compileFormIntent` appends the notes section — so they sit in the
- // same `sections[]` array as the author's own, just after them.
- //
- // They must be invisible to the LABEL and POSITION passes. Otherwise, as soon as an explicit
- // layout declares as many sections as the index of the first appended one, the positional fallback
- // claims the sub-grid: it gets relabelled to the author's section title, bound field controls are
- // injected into the row holding the grid control, and the author's section is never created. The
- // build is green and a rebuild converges on the same wrong shape, so nothing downstream reports it.
- //
- // Detected structurally (every cell carries a control with no `fieldName`) rather than by name, so
- // it holds for a sub-grid whose section the author renamed in Maker. An EMPTY section has no cells
- // and is deliberately NOT engine-owned — it stays matchable so a vacated section can be reused.
- const isEngineOwnedSection = (s) => {
- const cells = ((s && s.rows) || []).flatMap((r) => (r && r.cells) || []);
- return cells.length > 0 && cells.every((c) => c && c.control && !c.control.fieldName);
- };
-
// Send only the keys that actually differ, so a rebuild that changes nothing issues no writes.
const diffPatch = (live, want, keys) => {
const patch = {};
@@ -1903,7 +1885,11 @@ async function runSdkBuild(spec, opts = {}) {
// fields, so a notes/timeline section created empty would deploy a visible section header
// promising a control that nothing ever adds.
const stripRows = (section) => (isEngineOwnedSection(section) ? Object.assign({}, section) : Object.assign({}, section, { rows: [] }));
- const sectionTargets = {};
+ // Null-prototype, because this map is keyed by AUTHOR-CONTROLLED section names. On a plain
+ // object a section legitimately named `__proto__` would mutate the prototype instead of becoming
+ // an own enumerable property, so it would be invisible to `Object.values` — and the
+ // vacated-section sweep would then treat a section the layout explicitly claimed as unclaimed.
+ const sectionTargets = Object.create(null);
const wantTabs = def.tabs || [];
// Indices already taken by an earlier want, so two wants can never converge on one container.
const claimedTabs = new Set();
@@ -2022,7 +2008,43 @@ async function runSdkBuild(spec, opts = {}) {
const current = live[key] === undefined ? 1 : live[key];
if (current !== want) patch[key] = want;
}
- if (Object.keys(patch).length) await provision.updateElement('form', formId, location.cellPointer, patch);
+ if (Object.keys(patch).length) {
+ await provision.updateElement('form', formId, location.cellPointer, patch);
+ // A WIDENED span can overflow the row it sits in: a 2-column section holding two colspan-1
+ // cells becomes 2+1 = 3 columns of content the moment one is widened to 2. The create path
+ // packs rows by WIDTH (`rowsFromCells`), but an in-place span change never re-ran that
+ // packing, so the row was left overflowing — a shape `rowsFromCells` would never emit, and one
+ // Dataverse renders unpredictably. Live-reproduced: widening a field left three columns of
+ // content in a two-column row across two applies.
+ await repackRowAt(formId, location);
+ }
+ };
+
+ // Re-pack the row a span change just overflowed, using the create path's own packer so both routes
+ // produce the same shape. The displaced cells move DOWN into rows inserted immediately below,
+ // rather than to the bottom of the section, so the author's field order survives.
+ //
+ // The cells are moved by `updateElement` (the same mechanism `appendCellPacked` uses to write a
+ // cells array), and the new rows are created EMPTY first — an existing cell carries an `id`, and
+ // handing one to `addElement` risks re-keying the node rather than moving it.
+ const repackRowAt = async (formId, location) => {
+ const form = await provision.getArtifact('form', formId) || {};
+ const section = sectionAt(form, location.sectionPointer);
+ const row = section && (section.rows || [])[location.rowIndex];
+ if (!row) return;
+ const packed = rowsFromCells(row.cells || [], section.columns);
+ if (packed.length <= 1) return; // still fits — nothing to do
+ for (let k = 1; k < packed.length; k += 1) {
+ await provision.addElement('form', formId, location.sectionPointer + '/rows', { cells: [] },
+ // The SDK's position resolver accepts `undefined | 'end' | 'start' | {index} | {before} |
+ // {after}` and tests `'index' in position`, so a BARE NUMBER throws
+ // "Cannot use 'in' operator to search for 'index' in 1".
+ { position: { index: location.rowIndex + k } });
+ await provision.updateElement('form', formId,
+ `${location.sectionPointer}/rows/${location.rowIndex + k}`, { cells: packed[k].cells });
+ }
+ await provision.updateElement('form', formId,
+ `${location.sectionPointer}/rows/${location.rowIndex}`, { cells: packed[0].cells });
};
// The live cell a findFieldCellLocation result points at.
@@ -2037,7 +2059,32 @@ async function runSdkBuild(spec, opts = {}) {
// A field whose declared section could not be resolved falls back to the form's first section —
// exactly the pre-existing behavior. A layout the topology pass could not materialize must still
// never lose a field.
- const placeFieldInSection = async (formId, logical, wantCell, target) => {
+ // Append a cell to a section, PACKING it the way the create path does.
+ //
+ // `rowsFromCells` fills a row until the section's grid width is used, so a 2-column section holds
+ // two single-width fields per row. The reconcile path used to ignore that entirely — every ADDED
+ // field became its own single-cell row and every MOVED field was appended to the last row whatever
+ // its width — so the same spec deployed a different shape depending only on whether the form
+ // already existed. `cellFitsInRow` is the create path's own rule, shared rather than restated.
+ //
+ // MEASURED against the vendored bundle: `addElement` REFUSES a `.../rows/<i>/cells` pointer
+ // ("Path not found in form/<id>"), so a cell cannot be appended to an existing row that way. The
+ // row is rewritten instead — `updateElement` replaces the `cells` array, and re-sending the
+ // existing cell objects carries their `id` and `control.id` through verbatim (measured), so this
+ // neither mints new ids nor drops adapter-derived control state.
+ const appendCellPacked = async (formId, form, sectionPointer, wantCell) => {
+ const section = sectionAt(form, sectionPointer) || {};
+ const rows = section.rows || [];
+ const lastIndex = rows.length - 1;
+ if (lastIndex >= 0 && cellFitsInRow(rows[lastIndex], wantCell, section.columns)) {
+ await provision.updateElement('form', formId, sectionPointer + '/rows/' + lastIndex,
+ { cells: [...(rows[lastIndex].cells || []), wantCell] });
+ return;
+ }
+ await provision.addElement('form', formId, sectionPointer + '/rows', { cells: [wantCell] });
+ };
+
+ const placeFieldInSection = async (formId, logical, wantCell, target, vacated) => {
let form = await provision.getArtifact('form', formId) || {};
const targetPointer = resolveSectionPointer(form, target);
const existing = findFieldCellLocation(form, logical);
@@ -2045,7 +2092,7 @@ async function runSdkBuild(spec, opts = {}) {
if (!existing) {
const rowsPtr = targetPointer ? targetPointer + '/rows' : firstSectionRowsPointer(form);
if (!rowsPtr) return;
- await provision.addElement('form', formId, rowsPtr, { cells: [wantCell] });
+ await appendCellPacked(formId, form, rowsPtr.slice(0, -'/rows'.length), wantCell);
return;
}
// Converge the cell SHAPE even when the cell is already where it belongs. `colspan`/`rowspan`
@@ -2055,20 +2102,45 @@ async function runSdkBuild(spec, opts = {}) {
// Only spans the author EXPLICITLY set are written. `fieldCellIntent` omits a span of 1, so an
// absent span means "no opinion" and leaves a cell a maker widened by hand alone — the same rule
// that keeps `isReadOnly: false` from ever being written.
- await convergeCellSpans(formId, form, existing, wantCell);
-
- // Already on the form and already in the right section (or we have no opinion) — leave it be,
- // so a rebuild converges instead of reshuffling the form on every run.
- if (!targetPointer || existing.sectionPointer === targetPointer) return;
+ //
+ // Converging BEFORE a relocation would clamp the span against the section the cell is LEAVING:
+ // a `colspan: 4` bound for a 4-column destination was cut to the 2-column source's width and
+ // then moved, arriving narrower than authored (and only widening on a second apply). So when the
+ // cell is staying, converge here; when it is moving, converge in the DESTINATION after the move.
+ const staying = !targetPointer || existing.sectionPointer === targetPointer;
+ if (staying) {
+ await convergeCellSpans(formId, form, existing, wantCell);
+ // Already on the form and already in the right section (or we have no opinion) — leave it be,
+ // so a rebuild converges instead of reshuffling the form on every run.
+ return;
+ }
// Misplaced: relocate the CELL rather than delete-and-recreate it, so its id and any
// adapter-derived or maker-edited control state survive the move.
- let rowIndex = ((sectionAt(form, targetPointer) || {}).rows || []).length - 1;
- if (rowIndex < 0) {
- // A section this run just created has no row to move into. The SDK accepts a row with an
- // empty cells array and serializes it correctly, so seed one and target that.
+ //
+ // Record the section this cell is LEAVING. That is what makes the vacated-section sweep precise:
+ // "empty" alone cannot distinguish a section this run emptied from one a maker created empty and
+ // may reference from a form script.
+ const sourceSection = sectionAt(form, existing.sectionPointer);
+ if (vacated && sourceSection && sourceSection.name) vacated.add(String(sourceSection.name).toLowerCase());
+ //
+ // The destination ROW is chosen by the same packing rule the create path uses, not simply the
+ // last one: appending every relocated field to `rows.length - 1` piled four fields into a single
+ // row of a 2-column section, a shape `rowsFromCells` would never emit.
+ const targetSection = sectionAt(form, targetPointer) || {};
+ const targetRows = targetSection.rows || [];
+ // Captured BEFORE the add below. `getArtifact` can hand back a live reference to the artifact
+ // tree rather than a copy, so `targetRows` may be the very array `addElement` pushes into —
+ // reading `.length` afterwards would yield the POST-add count and target a row one past the end,
+ // which silently skips the move (the `if (!row) return` guard below).
+ const priorRowCount = targetRows.length;
+ let rowIndex = priorRowCount - 1;
+ if (rowIndex < 0 || !cellFitsInRow(targetRows[rowIndex], wantCell, targetSection.columns)) {
+ // Either the section this run just created has no row yet, or the last row is full. The SDK
+ // accepts a row with an empty cells array and serializes it correctly, so seed one and target
+ // it. `addElement` appends, so the new row's index is the PRE-add length.
await provision.addElement('form', formId, targetPointer + '/rows', { cells: [] });
- rowIndex = 0;
+ rowIndex = priorRowCount;
}
form = await provision.getArtifact('form', formId) || {};
const from = findFieldCellLocation(form, logical);
@@ -2087,6 +2159,13 @@ async function runSdkBuild(spec, opts = {}) {
await provision.removeElement('form', formId, from.rowPointer);
}
}
+
+ // Converge the span NOW, in the destination, so it is clamped and packed against the section the
+ // cell actually landed in rather than the one it left. Re-resolve the location: the move (and a
+ // possible stranded-row removal) invalidated every pointer computed above.
+ const settledForm = await provision.getArtifact('form', formId) || {};
+ const settled = findFieldCellLocation(settledForm, logical);
+ if (settled) await convergeCellSpans(formId, settledForm, settled, wantCell);
};
const reconcileForm = async (formId, def) => {
@@ -2104,13 +2183,21 @@ async function runSdkBuild(spec, opts = {}) {
// and no authored structure to honor, so it keeps the additive first-section behavior —
// reshaping a form a maker built by hand is not something an auto layout ever asked for.
let declaredSection = {};
- let sectionTargets = {};
+ // Null-prototype: keyed by AUTHOR-CONTROLLED section names, so a section legitimately named
+ // `__proto__` must land as an own enumerable property. On a plain object that assignment mutates
+ // the prototype instead, leaving the claimed-set lookup below blind to it — and the sweep then
+ // deleted a section the layout had explicitly asked for.
+ let sectionTargets = Object.create(null);
+ // Sections this run EMPTIED, by deployed name. The vacated-section sweep considers only these:
+ // "holds no cells" cannot tell a section we just emptied from one a maker created empty and may
+ // show/hide from a form script, and deleting the latter is invisible to the destructive preflight.
+ const vacatedSections = new Set();
if (def.__explicitLayout) {
declaredSection = declaredSectionByField(def.tabs);
sectionTargets = await reconcileFormTopology(formId, def);
}
for (const logical of want) {
- await placeFieldInSection(formId, logical, wantCellByLogical[logical], sectionTargets[declaredSection[logical]]);
+ await placeFieldInSection(formId, logical, wantCellByLogical[logical], sectionTargets[declaredSection[logical]], vacatedSections);
}
await addSubgrids(formId, def.__subgrids);
// Re-assert per-control attributes (read-only / hidden) on fields that were ALREADY on the form.
@@ -2124,7 +2211,7 @@ async function runSdkBuild(spec, opts = {}) {
await applyFieldControlOptions(formId, def, want, wantCellByLogical);
// Reposition any field the spec anchors after another (`fieldOptions[x].after`). Runs AFTER the
// add/attribute passes so a field created in this same run can be positioned in the same run.
- await applyFieldPositions(formId, def);
+ await applyFieldPositions(formId, def, vacatedSections);
// Prune fields the deployed form carries that the spec's EXPLICIT layout dropped, so editing a
// form to REMOVE a field lands. Gated to an author-controlled layout (explicit `tabs`); an AUTO
// layout stays additive (never strip a column a user added in Maker). Never remove the primary.
@@ -2137,10 +2224,73 @@ async function runSdkBuild(spec, opts = {}) {
const primary = def.__primaryField ? String(def.__primaryField).toLowerCase() : null;
for (const logical of formFieldLogicals(await provision.getArtifact('form', formId) || {})) {
if (wantSet.has(logical) || logical === primary) continue;
- const ptr = findFieldCellPointer(await provision.getArtifact('form', formId) || {}, logical);
+ const pruneForm = await provision.getArtifact('form', formId) || {};
+ const loc = findFieldCellLocation(pruneForm, logical);
+ // Pruning can empty a section too, so it feeds the vacated set on the same terms as a move.
+ if (loc) {
+ const sec = sectionAt(pruneForm, loc.sectionPointer);
+ if (sec && sec.name) vacatedSections.add(String(sec.name).toLowerCase());
+ }
+ const ptr = loc ? loc.cellPointer : findFieldCellPointer(pruneForm, logical);
if (ptr) await provision.removeElement('form', formId, ptr);
}
}
+ // Reclaim a section the layout VACATED (#581). A generated section name encodes position
+ // (`section_<tab>[_<column>]_<index>`), so moving a section between form-columns or tabs under a
+ // generated name changes its identity: the topology pass creates a new one and the old one is
+ // never matched again. The field pass then empties it, leaving a deployed form with two sections
+ // headed the same thing, one of them blank — stable across rebuilds and permanently wrong.
+ //
+ // Runs LAST, after the field placement and prune passes, because only then is a vacated section
+ // actually empty. Four conditions, each load-bearing:
+ // · explicit layout + prune ON — the same gate the field prune uses. An `auto` layout has no
+ // authored shape to vacate, and `prune: false` means "leave what I did not re-declare".
+ // · THIS RUN emptied it. `vacatedSections` records every section a cell was moved or pruned
+ // out of. Without this the sweep deleted a section a maker had created empty and may
+ // show/hide from a form script — an unchanged layout would silently destroy it, and the
+ // destructive preflight cannot see it because that compares fields, not containers.
+ // · the section is NOT one the authored layout claimed (by pointer or by deployed name).
+ // · it holds NO cells at all — not merely no bound fields. A section can carry a spacer or a
+ // control this reader does not model, and an empty-LOOKING section is not an empty one.
+ //
+ // That last test is also what protects the ENGINE's own sections. An explicit
+ // `isEngineOwnedSection` check was written here first and then removed as dead: that predicate is
+ // `cells.length > 0 && every cell unbound`, so anything it calls engine-owned already has cells
+ // and is spared above. Mutation testing proved it unkillable, and a guard that cannot fail
+ // implies coverage that does not exist.
+ if (def.__explicitLayout && def.__prune !== false) {
+ const claimedPointers = new Set();
+ const claimedNames = new Set();
+ for (const t of Object.values(sectionTargets || {})) {
+ if (!t) continue;
+ if (t.pointer) claimedPointers.add(t.pointer);
+ if (t.name) claimedNames.add(String(t.name).toLowerCase());
+ }
+ // Collected from a single read and removed from the BACK, because removeElement shifts the
+ // indices of later siblings — deleting front-first would silently target the wrong section.
+ const orphans = [];
+ const live = await provision.getArtifact('form', formId) || {};
+ (live.tabs || []).forEach((tab, ti) => {
+ (tab.columns || []).forEach((col, ci) => {
+ (col.sections || []).forEach((sec, si) => {
+ const pointer = `/tabs/${ti}/columns/${ci}/sections/${si}`;
+ if (claimedPointers.has(pointer)) return;
+ const secName = sec && sec.name ? String(sec.name).toLowerCase() : null;
+ if (secName && claimedNames.has(secName)) return;
+ if (!secName || !vacatedSections.has(secName)) return;
+ const cells = ((sec && sec.rows) || []).flatMap((r) => (r && r.cells) || []);
+ if (cells.length) return;
+ orphans.push({ pointer, name: (sec && sec.name) || '(unnamed)', label: (sec && sec.label) || '' });
+ });
+ });
+ });
+ for (const o of orphans.slice().reverse()) {
+ await provision.removeElement('form', formId, o.pointer);
+ if (typeof opts.warn === 'function') {
+ opts.warn(`form ${def.name}: removed the now-empty section '${o.name}'${o.label ? ` ("${o.label}")` : ''} — the layout no longer places anything in it. Give a section an explicit \`name\` if you intend to move it between tabs or form-columns.`);
+ }
+ }
+ }
requireSuccessfulPush(await provision.pushArtifact('form', formId), `form ${def.name}`, opts.warn);
reportPartialPush(await provision.publishArtifact('form', formId), `form ${def.name}`, opts.warn);
await provision.addSolutionComponent({ componentId: formId, componentType: COMPONENT_TYPE.form, solutionUniqueName: sol.uniqueName });
@@ -3224,6 +3374,17 @@ async function runSdkBuild(spec, opts = {}) {
else runner.skip('pages', `page "${p.name}" (no tsx source)`);
}
+ // A page that SUPPLIES an empty prompt or agent message would otherwise have generated text
+ // deployed in its place. Checked here, before ANY upload, so a bad spec fails whole rather than
+ // leaving half the pages deployed. Absent keys are untouched — only a present-but-blank value is
+ // an authoring mistake. Same rule as the standalone CLI, via the same predicate.
+ for (const p of implemented) {
+ for (const [field, value] of [['prompt', p.prompt], ['agentMessage', p.agentMessage]]) {
+ if (suppliedButBlank(value)) {
+ throw new BuildHalt(`page "${p.name || keyOf(p)}": ${field} is present but blank — refusing to deploy generated text in its place. Give it real content or remove the key.`, { phase: 'pages', code: 'pages-blank-provenance', recoverable: false });
+ }
+ }
+ }
// (1) STRUCTURAL SCAN of every implemented canonical source BEFORE any write (C1/C4), via the single
// nav oracle (extractNavTargets). Reject a malformed (non-canonical) nav PAGEREF and enforce EXACT
// parity between declared navigatesTo targetKeys and the keys the source references at REAL nav
diff --git a/plugins/model-apps/scripts/lib/sdk-teardown.js b/plugins/model-apps/scripts/lib/sdk-teardown.js
index f70812d21..e0ee76ecc 100644
--- a/plugins/model-apps/scripts/lib/sdk-teardown.js
+++ b/plugins/model-apps/scripts/lib/sdk-teardown.js
@@ -196,7 +196,22 @@ const KIND_HANDLERS = {
app: {
async resolve(sdk, target) {
const items = await sdk.resolveArtifact('app', { uniqueName: target.uniqueName });
- return (items || []).map((x) => ({ id: x.id, name: x.name, appModuleIdUnique: x.appModuleIdUnique }));
+ // `uniqueName` is carried so `confirmAbsent` below can re-query this exact app.
+ return (items || []).map((x) => ({ id: x.id, name: x.name, appModuleIdUnique: x.appModuleIdUnique, uniqueName: target.uniqueName }));
+ },
+ // Is the app REALLY gone? A 404 from the delete is not proof: the SDK also surfaces 404 when
+ // the ATOMIC app+sitemap changeset is ROLLED BACK by the platform, and the app is still there.
+ // deleteStep used to record that as a successful delete, so the abort never fired and dependent
+ // teardown stripped a LIVE app while reporting ok:true. Asking the platform is authoritative;
+ // inferring absence from an error code is not. A read failure returns false (fail closed) —
+ // "cannot prove it is gone" must not license deleting everything it renders.
+ async confirmAbsent(sdk, item) {
+ try {
+ const rows = await sdk.resolveArtifact('app', { uniqueName: item.uniqueName });
+ return !(rows || []).length;
+ } catch {
+ return false;
+ }
},
// deleteAppCascade fail-fast-deletes the app module together with its sitemap (atomically), and
// returns a structured { success, deleted, failures, retained } result (older vendored bundles
@@ -219,9 +234,14 @@ const KIND_HANDLERS = {
const detail = failures
.map((f) => `${f.operation} ${f.type}${f.id ? ` ${f.id}` : ''}: ${errMsg(f.error)}`)
.join('; ');
- throw new Error(
+ const err = new Error(
`app "${item.name}" deleted, but ${failures.length} cascade cleanup step(s) failed (orphaned rows remain): ${detail}`
);
+ // The app ROW is gone by this point — only a cleanup step failed. runTeardown keys its
+ // abort on this flag: here the dependents MUST still be torn down, because stopping would
+ // strand more orphans, not fewer. See #587 item 5.
+ err.appDeleted = true;
+ throw err;
}
},
},
@@ -345,22 +365,40 @@ const KIND_HANDLERS = {
// loss: teardown deletes the app FIRST, so if the role is STILL associated with any app module, that
// association belongs to ANOTHER app that shares this (same name+BU) persona — deleting the role
// would break that app. Skip those; delete only roles no app still uses (this app's link is already
- // gone, or a data-only role). Best-effort: if the association check can't run, fall back to the
- // BU+marker decision (delete) — the extra guard only ever REMOVES candidates, never adds them.
+ // gone, or a data-only role).
+ //
+ // The guard FAILS CLOSED (#587 item 7). It used to be best-effort — an unreadable association fell
+ // back to "not shared", i.e. delete — which is the wrong direction for a destructive decision and
+ // was inconsistent with this same function, where a failure to resolve the business unit already
+ // returns [] and deletes nothing. Costs are asymmetric: retaining a role an operator can delete by
+ // hand, versus silently stripping permissions from a DIFFERENT app that shares the persona.
const owned = (rows || []).filter((r) => r.ismanaged !== true && (r.description || '') === SDK_ROLE_MARKER && r.roleid);
const kept = [];
for (const r of owned) {
const id = String(r.roleid);
- let sharedWithAnotherApp = false;
+ // Starts FALSE: a role is deletable only once the check has actually PROVED no app still
+ // references it. Every path that cannot produce that proof leaves it false.
+ let provedUnused = false;
if (FORM_GUID_RE.test(id)) {
try {
// OData `any()` over the appmodule<->role N:N (live-verified). id is a Dataverse GUID (Edm.Guid,
// unquoted) validated above, so interpolation is injection-safe.
const apps = await sdk.queryRecords('appmodule', { select: ['appmoduleid'], filter: `appmoduleroles_association/any(x:x/roleid eq ${id})`, top: 1 });
- sharedWithAnotherApp = Array.isArray(apps) && apps.length > 0;
- } catch { sharedWithAnotherApp = false; }
+ provedUnused = Array.isArray(apps) && apps.length === 0;
+ } catch {
+ // Unreadable association (403, transient 5xx, an old bundle): treat exactly like "still in
+ // use". We did not learn that it is unused, so we have not earned the right to delete it.
+ provedUnused = false;
+ }
+ } else {
+ // FORM_GUID_RE is an INJECTION guard on the OData filter, not an existence check. Every
+ // Dataverse `roleid` is an Edm.Guid, so an id that fails it did not come from the platform;
+ // it has no app association to protect, and `deleteSecurityRole` would reject it anyway.
+ // Treating it as a FAILED check was considered and rejected: it adds no safety on any real
+ // row while making ownership resolution depend on id formatting.
+ provedUnused = true;
}
- if (!sharedWithAnotherApp) kept.push({ id, name: target.name });
+ if (provedUnused) kept.push({ id, name: target.name });
}
return kept;
},
@@ -1060,7 +1098,15 @@ async function deleteStep(sdk, handler, items) {
continue;
}
if (isNotFound(err)) {
- // Already gone (e.g. cascade) — tolerate
+ // Already gone (e.g. cascade) — tolerate.
+ //
+ // EXCEPT where the handler can check. For a dependency ROOT a 404 is ambiguous: it means
+ // "already gone" OR "the atomic changeset rolled back and the record is still live", and
+ // treating the second as a delete let teardown strip an app that still existed. A handler
+ // exposing `confirmAbsent` gets to ask the platform instead of inferring.
+ if (typeof handler.confirmAbsent === 'function' && !(await handler.confirmAbsent(sdk, item))) {
+ throw err;
+ }
deletedIds.push(item.id);
continue;
}
@@ -1151,7 +1197,24 @@ async function runTeardown(spec, opts = {}, deps = {}) {
const message = errMsg(err);
result.errors.push({ step: step.label, message });
emit({ phase: step.phase, status: 'error', label: step.label, n: myN, total, detail: message });
- // best-effort: continue to the next step so a single failure doesn't strand the rest.
+ // Best-effort continue-on-error is right for the steps AFTER the dependency root is gone — one
+ // undeletable view should not strand the rest. It is WRONG for the root itself (#587 item 5):
+ // tables, forms, views and charts are COMPONENTS of the app module, so continuing past a failed
+ // app delete strips a LIVE app of everything it renders and leaves it broken in the environment.
+ // Stopping leaves a consistent app the operator can retry against.
+ //
+ // `err.appDeleted` marks the other case: the app row WAS removed and only a cascade cleanup step
+ // failed. There the dependents are already orphaned, so continuing removes them rather than
+ // leaving more behind.
+ if (step.kind === 'app' && !err.appDeleted) {
+ for (let i = myN; i < plan.length; i += 1) {
+ const rest = plan[i];
+ const why = `${rest.label} (not attempted — the app was not deleted)`;
+ result.skipped.push(why);
+ emit({ phase: rest.phase, status: 'skip', label: why, n: i + 1, total });
+ }
+ break;
+ }
}
}
return result;
diff --git a/plugins/model-apps/scripts/lib/verify-spec.js b/plugins/model-apps/scripts/lib/verify-spec.js
index 9fd1b1ef1..5f1344025 100644
--- a/plugins/model-apps/scripts/lib/verify-spec.js
+++ b/plugins/model-apps/scripts/lib/verify-spec.js
@@ -5,7 +5,9 @@
// { ok, checks:[{kind,name,present,detail}], missing:[…] }.
const { odataLit } = require('./odata.js');
-const { normalizePageSource, relationshipSchemaName, manyToManySchemaName, SDK_ROLE_MARKER, canonicalPersonaName, bpfUniqueName, BPF_ROLE_ACCESS } = require('./app-spec.js');
+const { matchContainer, isEngineOwnedSection } = require('./form-container-match.js');
+const { decodeXmlEntities } = require('./sitemap-pages.js');
+const { normalizePageSource, relationshipSchemaName, manyToManySchemaName, SDK_ROLE_MARKER, canonicalPersonaName, bpfUniqueName, BPF_ROLE_ACCESS, generatedTabName, generatedSectionName, formColumnsOf } = require('./app-spec.js');
const { resolveExistingFormId, resolveRoleBusinessUnit, roleBuClause, appUniqueName, businessRuleFilter, bpfFilter, viewDef } = require('./sdk-build.js');
const { extractNavTargets } = require('./pageref-resolver.js');
const { AI_APP_SETTING, resolveAiFlags, specOptsIntoAi, featureWantValue, sameSettingValue, resolveAppModuleId, proveAppOverride } = require('./ai-app-settings.js');
@@ -226,6 +228,156 @@ async function verifySpec(spec, read, opts = {}) {
}
}
+ // Form TOPOLOGY. Existence is not proof of shape: every wrong-layout defect this plugin has hit —
+ // fields flattened into the first section, a duplicate tab appended on each rebuild, a relocated
+ // field piled into an already-full row — deployed a form that EXISTS with the right name and type,
+ // so verify reported an unqualified PASS while the layout was wrong.
+ //
+ // Scope is deliberately the AUTHORED subset, not an exact match: the engine appends sub-grid and
+ // notes sections the spec never declares, and a maker may add their own. So this asserts that every
+ // tab and section the author declared is present, and that every field lands in the section the
+ // author put it in — and says nothing about containers it did not declare.
+ //
+ // Only EXPLICIT layouts are checked. An `auto` layout declares no shape to honour, so there is
+ // nothing to verify beyond the field list the existing checks already cover.
+ //
+ // Fail-closed: when the formxml cannot be read the check is reported NOT present with the read
+ // error, never skipped — "we could not look" must not read as "the layout is correct". That
+ // applies to a MISSING READER CAPABILITY too: gating the whole oracle on
+ // `typeof read.formTopology === 'function'` let a reader without it skip every layout check, so an
+ // explicit form passed verify on identity and default checks alone with no layout proof at all.
+ const canReadTopology = typeof read.formTopology === 'function';
+ {
+ for (const f of spec.forms || []) {
+ if (!Array.isArray(f.tabs) || !f.tabs.length) continue;
+ const entity = String(f.entity || '').toLowerCase();
+ const name = f.name || `${f.entity} form`;
+ if (!canReadTopology) {
+ add('form-topology', `${entity}.${name}`, false,
+ 'this reader exposes no deployed-layout source, so the layout is UNVERIFIED — not proven correct');
+ continue;
+ }
+ let id = null;
+ let idError = null;
+ try {
+ id = await resolveExistingFormId(read, { entityLogicalName: entity, name, formType: f.formType, formId: f.formId });
+ } catch (e) { idError = (e && e.message) || String(e); }
+ if (!id) {
+ // A form that genuinely does not exist was already reported by the existence check above, so
+ // saying it twice adds nothing. A FAILED resolution is different: the form may well be there
+ // and correct, and silently skipping the layout check let a transient read failure pass as a
+ // verified layout.
+ if (idError) {
+ add('form-topology', `${entity}.${name}`, false,
+ `could not resolve the deployed form id (${idError}) — the layout is unverified, not proven correct`);
+ }
+ continue;
+ }
+
+ let xml = null;
+ let readError = null;
+ try { xml = await read.formTopology(entity, id); } catch (e) { readError = (e && e.message) || String(e); }
+ if (!xml) {
+ add('form-topology', `${entity}.${name}`, false,
+ `could not read the deployed form layout${readError ? `: ${readError}` : ''} — the layout is unverified, not proven correct`);
+ continue;
+ }
+
+ const deployed = parseFormTopology(xml);
+ // Where the DEPLOYED form actually placed each bound field, keyed by section name.
+ const placedIn = new Map();
+ for (const t of deployed) for (const c of t.columns || []) for (const sec of c.sections || []) {
+ for (const fl of sec.fields || []) if (!placedIn.has(fl)) placedIn.set(fl, String(sec.name || '').toLowerCase());
+ }
+
+ const problems = [];
+ // Match containers the way the BUILD does — name, then label, then position — using the same
+ // function it uses. A label- or position-matched container deliberately KEEPS its deployed
+ // name (form scripts and business rules reference section names), so looking one up by the
+ // AUTHORED name reported a perfectly good auto-to-explicit migration as "section absent" and
+ // failed a build that had done exactly what was asked. Live-reproduced.
+ const claimedTabs = new Set();
+ f.tabs.forEach((t, ti) => {
+ if (!t || typeof t !== 'object') return;
+ const tabName = String(t.name || generatedTabName(ti)).toLowerCase();
+ // Match the label the COMPILER emits, not the raw authored one. `compileFormIntent` defaults
+ // a tab to 'General' and a section to 'Details', so the deployed container carries the
+ // default — comparing against `undefined` would skip the label pass and fall through to
+ // position, picking a different container than the build did.
+ const tabHit = matchContainer(deployed, { name: tabName, label: t.label || 'General' }, ti, { claimed: claimedTabs });
+ if (!tabHit) { problems.push(`tab '${tabName}' is absent`); return; }
+ claimedTabs.add(tabHit.index);
+ const got = tabHit.item;
+ const authoredColumns = formColumnsOf(t);
+ if ((got.columns || []).length < authoredColumns.length) {
+ problems.push(`tab '${tabName}' has ${(got.columns || []).length} form-column(s), the spec declares ${authoredColumns.length}`);
+ }
+ authoredColumns.forEach((col, ci) => {
+ const sections = (col && Array.isArray(col.sections)) ? col.sections : [];
+ const deployedSections = ((got.columns || [])[ci] || {}).sections || [];
+ const claimedSections = new Set();
+ sections.forEach((sec, si) => {
+ if (!sec || typeof sec !== 'object') return;
+ const secName = String(sec.name || generatedSectionName(ti, ci, si)).toLowerCase();
+ const secHit = matchContainer(deployedSections, { name: secName, label: sec.label || 'Details' }, si,
+ { claimed: claimedSections, skip: isEngineOwnedSection });
+ if (!secHit) {
+ problems.push(`section '${secName}' is absent from tab '${tabName}' form-column ${ci + 1}`);
+ return;
+ }
+ claimedSections.add(secHit.index);
+ // OCCUPANCY: no deployed row may carry more columns of content than its section has.
+ // This is the shape defect the reconcile fixes (a field packed into a full row, or a
+ // widened span overflowing one), and a field-to-section check alone cannot see it.
+ // Skipped when the deployed section declares no width — unknown is not "one".
+ const secCols = Number(secHit.item.columns);
+ if (Number.isFinite(secCols) && secCols >= 1) {
+ for (const [ri, drow] of (secHit.item.rows || []).entries()) {
+ const used = (drow.cells || []).reduce((n, c) => n + (Number(c.colspan) || 1), 0);
+ if (used > secCols) {
+ problems.push(`section '${secName}' row ${ri + 1} carries ${used} columns of content in a ${secCols}-column section`);
+ }
+ }
+ }
+ // A span the author DECLARED must be the deployed span. An UNDECLARED one is not
+ // checked — the build never writes it, so a maker's hand-widened cell must survive
+ // both the rebuild and the verification.
+ const deployedCellOf = (logical) => (secHit.item.rows || [])
+ .flatMap((r2) => r2.cells || [])
+ .find((c) => c.control && c.control.fieldName === logical);
+ for (const entry of (sec.fields || [])) {
+ if (!entry || typeof entry !== 'object') continue;
+ const fl = String(entry.name || '').toLowerCase();
+ if (!fl) continue;
+ const dc = deployedCellOf(fl);
+ if (!dc) continue; // placement is reported separately below
+ for (const key of ['colspan', 'rowspan']) {
+ const want = Number(entry[key]);
+ if (!Number.isFinite(want) || want < 1) continue; // not declared
+ const got = Number(dc[key]) || 1;
+ if (got !== want) problems.push(`field '${fl}' has ${key} ${got}, the spec declares ${want}`);
+ }
+ }
+ // Fields are compared against the section that was MATCHED, not the authored name — the
+ // deployed section legitimately keeps its own name.
+ const deployedSecName = String(secHit.item.name || '').toLowerCase();
+ for (const entry of (sec.fields || [])) {
+ const fieldName = typeof entry === 'string' ? entry : (entry && entry.name);
+ if (!fieldName) continue;
+ const fl = String(fieldName).toLowerCase();
+ const where = placedIn.get(fl);
+ if (where === undefined) problems.push(`field '${fl}' is not placed on the deployed form`);
+ else if (where !== deployedSecName) problems.push(`field '${fl}' is deployed in section '${where}', the spec places it in '${secName}'`);
+ }
+ });
+ });
+ });
+
+ add('form-topology', `${entity}.${name}`, problems.length === 0,
+ problems.length ? `deployed layout does not match the authored one — ${problems.slice(0, 6).join('; ')}${problems.length > 6 ? `; +${problems.length - 6} more` : ''}` : '');
+ }
+ }
+
// Commands (existence) — a spec can declare a command bar that didn't build and still pass verify
// (commands weren't checked). The SDK models one command bar per entity, so verify per entity. Best-
// effort: only when the reader can resolve a command bar (`commandBar(entity)` -> truthy when present).
@@ -1066,6 +1218,94 @@ function parseFetchXml(xml) {
return { conditions, orders };
}
+// Parse a deployed form's FormXml into the container tree `--verify` needs to prove a layout.
+//
+// Why this exists: form verification used to prove only that a form row EXISTS with the right
+// (entity, name, type), plus whether it is the table default. Every wrong-layout failure this plugin
+// has hit — fields flattened into the first section, a tab appended on every rebuild, a relocated
+// field piled into a full row — therefore finished with an unqualified PASS. Existence is not proof
+// of shape.
+//
+// Shape being parsed (attribute order varies; quotes may be single or double):
+// <form><tabs>
+// <tab name="tab_overview" ...><columns>
+// <column width="60%"><sections>
+// <section name="sec_summary" ...><rows>
+// <row><cell ...><control datafieldname="new_name" .../></cell></row>
+// … and a cell may carry no control at all (a spacer), or a control with no datafieldname
+// (a sub-grid, the notes timeline, a web resource) — those are NOT bound fields and are skipped.
+//
+// Written as a depth scanner rather than nested non-greedy regexes: tabs contain columns contain
+// sections contain rows contain cells, and a non-greedy `<section>[\s\S]*?</section>` stops at the
+// first close tag, which for nested containers attributes children to the wrong parent.
+function parseFormTopology(xml) {
+ const s = String(xml || '');
+ const tabs = [];
+ let tab = null, column = null, section = null, row = null, cell = null;
+ // A <cell> carries its own <labels>, so a cell's label must not be attributed to its section.
+ let inCell = false;
+ const re = /<(\/?)(tab|column|section|row|cell|control|label)\b([^>]*?)(\/?)>/gi;
+ const attr = (raw, name) => {
+ const m = new RegExp(`\\b${name}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`, 'i').exec(raw || '');
+ return m ? (m[1] != null ? m[1] : m[2]) : undefined;
+ };
+ let m;
+ while ((m = re.exec(s)) !== null) {
+ const closing = m[1] === '/';
+ const tag = m[2].toLowerCase();
+ const raw = m[3];
+ const selfClosing = m[4] === '/';
+ if (closing) {
+ if (tag === 'tab') { tab = null; column = null; section = null; }
+ else if (tag === 'column') { column = null; section = null; }
+ else if (tag === 'section') { section = null; row = null; cell = null; }
+ else if (tag === 'row') { row = null; cell = null; }
+ else if (tag === 'cell') { inCell = false; cell = null; }
+ continue;
+ }
+ if (tag === 'tab') { tab = { name: attr(raw, 'name'), label: undefined, columns: [] }; tabs.push(tab); if (selfClosing) tab = null; }
+ else if (tag === 'column' && tab) { column = { width: attr(raw, 'width'), sections: [] }; tab.columns.push(column); if (selfClosing) column = null; }
+ else if (tag === 'section' && column) {
+ const ratio = attr(raw, 'columns');
+ // `columns` is a width RATIO string, not a count: "11" is two equal columns, "1111" is four.
+ // ABSENT means the width is UNKNOWN — left undefined so the occupancy check skips rather than
+ // assuming a 1-column grid and inventing an overflow that is not there.
+ section = { name: attr(raw, 'name'), label: undefined, columns: ratio ? String(ratio).length : undefined, rows: [], fields: [] };
+ column.sections.push(section);
+ if (selfClosing) section = null;
+ }
+ else if (tag === 'row' && section) { row = { cells: [] }; section.rows.push(row); if (selfClosing) row = null; }
+ else if (tag === 'cell') {
+ inCell = !selfClosing;
+ // A cell with no <control> child stays control-less, which is what keeps a SPACER from
+ // reading as engine-owned.
+ cell = { colspan: Number(attr(raw, 'colspan')) || 1, rowspan: Number(attr(raw, 'rowspan')) || 1 };
+ if (row) row.cells.push(cell);
+ if (selfClosing) cell = null;
+ }
+ // FormXML carries the display label in a nested <labels><label description="..."/></labels>,
+ // not an attribute. The BUILD matches containers name -> label -> position, so without this the
+ // verifier can never make the label pass and would disagree with a label-matched reshape.
+ else if (tag === 'label' && !inCell) {
+ const d = attr(raw, 'description') === undefined ? undefined : decodeXmlEntities(attr(raw, 'description'));
+ if (d !== undefined) {
+ if (section && section.label === undefined) section.label = d;
+ else if (!section && tab && tab.label === undefined) tab.label = d;
+ }
+ }
+ else if (tag === 'control' && section) {
+ // Only BOUND fields reach `fields[]`. A control with no `datafieldname` is a sub-grid, the
+ // notes timeline or a web resource — engine-owned, never something the spec's field list
+ // claims to place. The CELL still records that a control was present, because that is what
+ // distinguishes an engine-owned section from a merely empty one.
+ const f = attr(raw, 'datafieldname');
+ if (f) section.fields.push(String(f).toLowerCase());
+ if (cell) cell.control = f ? { fieldName: String(f).toLowerCase() } : {};
+ }
+ }
+ return tabs;
+}
+
function conditionMatches(want, got) {
if (want.attribute !== got.attribute || want.operator !== got.operator) return false;
return want.value === undefined || String(want.value) === String(got.value);
diff --git a/plugins/model-apps/scripts/lib/workspace-paths.js b/plugins/model-apps/scripts/lib/workspace-paths.js
new file mode 100644
index 000000000..5a6ad6037
--- /dev/null
+++ b/plugins/model-apps/scripts/lib/workspace-paths.js
@@ -0,0 +1,130 @@
+'use strict';
+// Workspace path identity + the safety guard for destructive workspace cleanup.
+//
+// The SDK workspace is a LOCAL cache directory holding artifact metadata. It is safe to delete, and
+// teardown's `--clear-workspace` deletes it after a clean apply because stale metadata would make a
+// later rebuild skip tables that no longer exist.
+//
+// The hazard (#587 item 8): `--workspace <dir>` lets the caller name that directory, and cleanup
+// then ran `fs.rmSync(dir, { recursive: true, force: true })` on whatever was passed — no check that
+// it was a workspace at all. A mistyped or shell-expanded path (a repo root, a home directory,
+// `.`) was therefore recursively deleted on a SUCCESSFUL teardown, which is the moment an operator
+// is least expecting data loss.
+const path = require('node:path');
+const fs = require('node:fs');
+
+// The DEFAULT name, used when `--workspace` is not given. It is NOT an identity test: every CLI here
+// accepts `--workspace <any-dir>`, and a live run with `--workspace lvws` proved a name-only guard
+// refuses a perfectly real workspace. Identity is established by CONTENT below.
+const WORKSPACE_DIR_NAME = '.maker-workspace';
+
+// The SDK writes this at the workspace root. Its shape is the durable marker: `instanceUrl` plus an
+// `artifacts` array. Checking the CONTENT rather than just the filename matters — plenty of
+// directories contain some `manifest.json`, and deleting one of those would be the original bug
+// wearing a different hat.
+const WORKSPACE_MANIFEST = 'manifest.json';
+
+function looksLikeSdkWorkspace(dir, readFileSync) {
+ let raw;
+ try {
+ raw = readFileSync(path.join(dir, WORKSPACE_MANIFEST), 'utf8');
+ } catch {
+ return false; // no manifest => not an SDK workspace
+ }
+ try {
+ const m = JSON.parse(String(raw).replace(/^\uFEFF/, ''));
+ return !!m && typeof m === 'object' && !Array.isArray(m)
+ && typeof m.instanceUrl === 'string' && Array.isArray(m.artifacts);
+ } catch {
+ return false; // a manifest.json belonging to something else (npm, a bundler, …)
+ }
+}
+
+// May `--clear-workspace` recursively delete `dir`?
+//
+// Returns { ok: true, target } with the REAL path to delete, or { ok: false, reason }. Refusing is
+// always safe here: the cost is a stale cache directory the operator can remove by hand, against
+// the cost of deleting a directory that was never a workspace.
+//
+// `deps` exists so the rules can be tested without creating symlinks/junctions, which need
+// elevation on Windows.
+function checkWorkspaceClearable(dir, deps = {}) {
+ const lstatSync = deps.lstatSync || fs.lstatSync;
+ const realpathSync = deps.realpathSync || fs.realpathSync;
+ const readFileSync = deps.readFileSync || fs.readFileSync;
+
+ if (typeof dir !== 'string' || !dir.trim()) return { ok: false, reason: 'no workspace path was given' };
+ const resolved = path.resolve(dir);
+
+ // 1. Never a filesystem/drive root, and never directly inside one. `C:\\.maker-workspace` or
+ // `/.maker-workspace` is not a project layout; it is what an empty or truncated base path
+ // produces, so treat it as a mistake rather than an instruction.
+ const parent = path.dirname(resolved);
+ if (resolved === path.parse(resolved).root || parent === resolved) {
+ return { ok: false, reason: `refusing to delete '${resolved}': that is a filesystem root` };
+ }
+ if (parent === path.parse(parent).root) {
+ return { ok: false, reason: `refusing to delete '${resolved}': a workspace directly inside a filesystem root is not a project workspace` };
+ }
+
+ // 2. The final component must not be a symlink/junction. Deleting through one is how a directory
+ // that merely POINTS at something else (a source tree, a home directory) turns a cache cleanup
+ // into arbitrary data loss. Only the last component is checked, because a symlinked ANCESTOR is
+ // ordinary and legitimate (/tmp is a symlink on macOS) and refusing those would reject real
+ // workspaces.
+ let st;
+ try {
+ st = lstatSync(resolved);
+ } catch (e) {
+ // Nothing there is not an error for a cleanup step — there is simply nothing to remove.
+ return { ok: false, reason: `nothing to clear at '${resolved}' (${e.code || e.message})` };
+ }
+ if (st.isSymbolicLink()) {
+ return { ok: false, reason: `refusing to delete '${resolved}': it is a symlink/junction, not a real workspace directory` };
+ }
+ if (!st.isDirectory()) {
+ return { ok: false, reason: `refusing to delete '${resolved}': not a directory` };
+ }
+
+ // 3. Resolve the real path BEFORE the identity test, so a junction in the chain cannot land the
+ // delete somewhere that was never inspected.
+ let real;
+ try {
+ real = realpathSync(resolved);
+ } catch (e) {
+ return { ok: false, reason: `cannot resolve '${resolved}' (${e.code || e.message})` };
+ }
+
+ // 3b. Re-apply the root rules to the CANONICAL target. Adversarial review found the lexical-only
+ // check bypassable: `D:\review-link\project\.maker-workspace` reached through an ancestor
+ // junction resolves to `D:\.maker-workspace`, which passing directly would be refused. The
+ // rules have to hold for the path actually deleted, not merely the one typed.
+ const realParent = path.dirname(real);
+ if (real === path.parse(real).root || realParent === real || realParent === path.parse(realParent).root) {
+ return { ok: false, reason: `refusing to delete '${resolved}': it resolves to '${real}', at or directly inside a filesystem root` };
+ }
+
+ // 4. IDENTITY, proven by CONTENT. The directory must carry the SDK's own workspace manifest.
+ //
+ // The default NAME is deliberately NOT accepted as an alternative. `--workspace` is
+ // caller-supplied, so `--workspace /some/important/.maker-workspace` would otherwise reach
+ // recursive deletion on nothing more than a matching basename — and a name is not identity.
+ // Refusing costs a stale cache directory the operator can delete by hand; accepting costs
+ // whatever was really in that directory.
+ //
+ // This does not reject real workspaces: a live `--workspace <custom-name>` run cleared
+ // successfully through this very check, because a genuine workspace always carries the
+ // manifest. A directory named `.maker-workspace` WITHOUT one is either not a workspace or is
+ // empty enough that leaving it costs nothing.
+ if (!looksLikeSdkWorkspace(real, readFileSync)) {
+ return {
+ ok: false,
+ reason: `refusing to delete '${resolved}': it is not an SDK workspace `
+ + `(no readable '${WORKSPACE_MANIFEST}' with instanceUrl + artifacts at its root)`,
+ };
+ }
+
+ return { ok: true, target: real };
+}
+
+module.exports = { WORKSPACE_DIR_NAME, WORKSPACE_MANIFEST, looksLikeSdkWorkspace, checkWorkspaceClearable };
diff --git a/plugins/model-apps/scripts/teardown-model-app.js b/plugins/model-apps/scripts/teardown-model-app.js
index 34a438fcd..c2bb34730 100644
--- a/plugins/model-apps/scripts/teardown-model-app.js
+++ b/plugins/model-apps/scripts/teardown-model-app.js
@@ -23,6 +23,7 @@ const os = require('node:os');
const { validateAppSpec, migrateAppSpec } = require('./lib/app-spec.js');
const { runTeardown } = require('./lib/sdk-teardown.js');
const { classifyOps } = require('./lib/op-diff.js');
+const { checkWorkspaceClearable } = require('./lib/workspace-paths.js');
const { createAzHttpClient } = require('./lib/sdk-http-client.js');
const { parseArgs, validateFlags, readJsonArg, emitResult } = require('./lib/dataverse-auth.js');
const snapStore = require('./lib/apply-snapshot-store.js');
@@ -156,9 +157,18 @@ async function main() {
// Clear the local workspace only after a clean apply — stale metadata there would make a
// subsequent rebuild skip tables that no longer exist. Filesystem-local, opt-in.
if (apply && flags['clear-workspace'] && r && r.ok && !r.dryRun) {
- if (fs.existsSync(workspaceDir)) {
- fs.rmSync(workspaceDir, { recursive: true, force: true });
- process.stderr.write(`\ncleared workspace ${workspaceDir}\n`);
+ // VALIDATE BEFORE DELETING. `--workspace` is caller-supplied and this runs immediately
+ // after a SUCCESSFUL teardown — the moment an operator is least expecting data loss — so an
+ // unguarded `rmSync(dir, { recursive: true, force: true })` on a mistyped path, or on a
+ // shell variable that expanded to a repo root, destroyed real work. Refusal is a WARNING,
+ // not a failure: the teardown itself already succeeded, and the cost of refusing is only a
+ // stale cache directory the operator can remove by hand.
+ const clearable = checkWorkspaceClearable(workspaceDir);
+ if (clearable.ok) {
+ fs.rmSync(clearable.target, { recursive: true, force: true });
+ process.stderr.write(`\ncleared workspace ${clearable.target}\n`);
+ } else {
+ process.stderr.write(`\nskipped --clear-workspace: ${clearable.reason}\n`);
}
}
} catch (err) {
diff --git a/plugins/model-apps/scripts/tests/app-spec-doc.test.js b/plugins/model-apps/scripts/tests/app-spec-doc.test.js
index 2c1014dcd..2dcf7f0eb 100644
--- a/plugins/model-apps/scripts/tests/app-spec-doc.test.js
+++ b/plugins/model-apps/scripts/tests/app-spec-doc.test.js
@@ -573,3 +573,26 @@ test('sitemap area/group/subarea depictions render, and entity subareas defer to
// reviewer a depiction that is not the one actually rendered.
assert.match(md, /Projects .*— icon: the table's own/);
});
+
+// #583 Gap 1 — the exclusions are rendered BESIDE the traceability table so scope is reviewed
+// rather than assumed. A reviewer cannot approve an omission they were never shown, and two apps
+// built over the same tables are told apart by what each one declines to do.
+test('#583 deliberate persona exclusions are rendered into the design document', () => {
+ const spec = realisticSpec();
+ const first = spec.personas[0];
+ first.excludes = ['Approving budgets — handled in the Finance app', 'Editing customer master data'];
+ const md = renderAppSpecDoc(spec);
+
+ assert.match(md, /Deliberately out of scope/, 'the section must exist');
+ for (const x of first.excludes) {
+ assert.ok(md.includes(x), `the exclusion ${JSON.stringify(x)} must be shown verbatim`);
+ }
+ assert.ok(md.indexOf('Deliberately out of scope') > md.indexOf('| Persona |'),
+ 'exclusions belong beside the traceability table, not before it');
+
+ // A spec that records none must not grow an empty heading — an empty section reads as
+ // "nothing is out of scope", which is a different claim from "this was not captured".
+ const none = realisticSpec();
+ for (const p of none.personas) delete p.excludes;
+ assert.doesNotMatch(renderAppSpecDoc(none), /Deliberately out of scope/);
+});
diff --git a/plugins/model-apps/scripts/tests/app-spec-keys.test.js b/plugins/model-apps/scripts/tests/app-spec-keys.test.js
index 243e10444..8e33c778d 100644
--- a/plugins/model-apps/scripts/tests/app-spec-keys.test.js
+++ b/plugins/model-apps/scripts/tests/app-spec-keys.test.js
@@ -743,3 +743,86 @@ test('form layout: a non-array fields inside columns[] is caught, not thrown on'
const errs = validateAppSpec(s, { profile: 'plan' }).errors;
assert.ok(errs.some((e) => /fields must be an array/.test(e)), `got ${JSON.stringify(errs)}`);
});
+
+// --- #584 item 5: the minimumPluginVersion capability gate --------------------------------------
+//
+// ⚠ This gate protects FORWARD only, and the test records that honestly because it is easy to
+// over-claim. MEASURED against the shipped 2.8.0 validator: an unknown top-level key,
+// `schemaVersion: 3` and `schemaVersion: 99` are ALL accepted with ok:true, because it validates
+// none of them. No marker can make an already-released consumer reject a spec. What this buys is a
+// machine-checkable requirement from here on, inherited by every future consumer.
+test('minimumPluginVersion refuses a spec that needs a newer plugin than the one running', () => {
+ const { version } = require('../../.plugin/plugin.json');
+ const bump = (v, by) => { const p = String(v).split('.').map((n) => parseInt(n, 10) || 0); p[0] += by; return p.join('.'); };
+ const spec = (v) => Object.assign(base(), v === undefined ? {} : { minimumPluginVersion: v });
+ const gateErrors = (s) => validateAppSpec(s, { profile: 'plan' }).errors.filter((e) => /requires model-apps|minimumPluginVersion/.test(e));
+
+ assert.deepStrictEqual(gateErrors(spec(undefined)), [], 'a spec that declares no requirement is unaffected');
+ assert.deepStrictEqual(gateErrors(spec(version)), [], 'the exact running version satisfies the requirement');
+ assert.deepStrictEqual(gateErrors(spec(bump(version, -1))), [], 'an older requirement is satisfied');
+
+ const tooNew = gateErrors(spec(bump(version, 1)));
+ assert.strictEqual(tooNew.length, 1, `a newer requirement must be refused; got ${JSON.stringify(tooNew)}`);
+ assert.match(tooNew[0], new RegExp(`requires model-apps ${bump(version, 1).replace(/\./g, '\\.')}`), 'the message names the required version');
+ assert.match(tooNew[0], new RegExp(`running plugin is ${String(version).replace(/\./g, '\\.')}`), 'and the version actually running');
+ assert.match(tooNew[0], /upgrade the plugin/, 'and tells the author to upgrade rather than delete the line');
+
+ // Pre-release and build-metadata suffixes compare on the release CORE. Astra review caught the
+ // first attempt splitting on dots BEFORE stripping the suffix, which turned `2.8.0-beta.1` into
+ // [2,8,0,1] — so the running release compared as OLDER than its own pre-release and refused to
+ // build. A dotted suffix is the case a single-token `-beta` test cannot catch.
+ for (const suffix of ['-beta', '-beta.1', '+build.1', '-rc.2']) {
+ assert.deepStrictEqual(gateErrors(spec(`${version}${suffix}`)), [],
+ `a '${suffix}' requirement is satisfied by the corresponding release — comparing the core is the safe direction`);
+ }
+
+ // A malformed value is rejected on its own terms rather than silently treated as 0.0.0, which
+ // would make every requirement vacuously satisfied.
+ const bad = gateErrors(spec('next'));
+ assert.strictEqual(bad.length, 1);
+ assert.match(bad[0], /dotted version string/);
+ // The grammar is ANCHORED, and the anchoring is the point. The reviewer caught a prefix-only
+ // pattern: `2..9` matched on its leading `2` alone, and compareVersions' `parseInt(n, 10) || 0`
+ // then turned the empty component into 0 and enforced **2.0.9** — a DIFFERENT floor than the
+ // author wrote, with no error at all. The evident intent `2.9` IS refused by this plugin, so the
+ // typo silently inverted the outcome. Trailing junk is the same class (`2.9.0garbage` -> 2.9.0).
+ for (const malformed of ['2..9', '2.9.0garbage', '2.9.0 ', ' 2.9.0', '2.', '.9', '2.9.0-', '1.2.3++x']) {
+ const e = gateErrors(spec(malformed));
+ assert.strictEqual(e.length, 1, `${JSON.stringify(malformed)} must be refused, got ${JSON.stringify(e)}`);
+ assert.match(e[0], /dotted version string/,
+ `${JSON.stringify(malformed)} must be reported as malformed rather than compared as a version`);
+ }
+
+ // …while every shape an author legitimately writes still passes the grammar. A version that is
+ // merely NEWER than this plugin is a different outcome from one that is malformed, so accept
+ // either "no error" or the too-new refusal here — this asserts well-formedness, not the floor.
+ for (const good of ['2', '2.9', '2.9.0', '2.9.0.1', '2.9.0-beta.1', '2.9.0+build.1']) {
+ const e = gateErrors(spec(good));
+ assert.ok(e.length === 0 || /requires model-apps/.test(e[0]),
+ `${JSON.stringify(good)} must be accepted as well-formed, got ${JSON.stringify(e)}`);
+ }
+
+ // FAIL CLOSED when this plugin cannot read its own version. Astra review caught the first attempt
+ // downgrading that to a warning, which let an incompatible install reach the write path with the
+ // requirement neither satisfied nor overridden. Driven by making BOTH manifest reads throw.
+ const fs = require('node:fs');
+ const realRead = fs.readFileSync;
+ delete require.cache[require.resolve('../lib/app-spec.js')];
+ fs.readFileSync = function (p, ...rest) {
+ if (String(p).includes('plugin.json')) { const e = new Error('EACCES'); e.code = 'EACCES'; throw e; }
+ return realRead.call(this, p, ...rest);
+ };
+ try {
+ const isolated = require('../lib/app-spec.js');
+ const r = isolated.validateAppSpec(Object.assign(base(), { minimumPluginVersion: '99.0.0' }), { profile: 'plan' });
+ assert.strictEqual(r.ok, false, 'an unreadable manifest must not satisfy a declared minimum');
+ assert.ok(r.errors.some((e) => /could not be read/.test(e)),
+ `the refusal must say the version was unreadable; got ${JSON.stringify(r.errors)}`);
+ // …and a spec that declares NO minimum is unaffected, so this cannot break an existing spec.
+ assert.strictEqual(isolated.validateAppSpec(base(), { profile: 'plan' }).ok, true,
+ 'a spec with no minimumPluginVersion must still validate when the manifest is unreadable');
+ } finally {
+ fs.readFileSync = realRead;
+ delete require.cache[require.resolve('../lib/app-spec.js')];
+ }
+});
\ No newline at end of file
diff --git a/plugins/model-apps/scripts/tests/app-spec.test.js b/plugins/model-apps/scripts/tests/app-spec.test.js
index 5a2010bdd..63c62ddb9 100644
--- a/plugins/model-apps/scripts/tests/app-spec.test.js
+++ b/plugins/model-apps/scripts/tests/app-spec.test.js
@@ -1273,3 +1273,42 @@ test('AB#6686426: one isDefault among several Main forms is valid', () => {
const r = validateAppSpec(deskWithForms([mainForm('A'), mainForm('B', { isDefault: true }), mainForm('C')]), { profile: 'plan' });
assert.strictEqual(r.ok, true, JSON.stringify(r.errors));
});
+
+// #583 Gap 1 — an app's scope is defined as much by what it deliberately leaves out as by what it
+// includes, and the exclusions are what let a reviewer tell two apps over the same tables apart.
+// Nothing recorded them, so they lived only in the authoring conversation.
+//
+// `excludes[]` is DOCUMENTARY, like `jobs[].surfaces`: personaRoleSpecFor() projects explicit fields
+// only, so it can never reach the SDK and be silently discarded there — the failure class #583 Gap 3
+// describes for `aiDescription`.
+function personaSpec(persona) {
+ return {
+ schemaVersion: 2,
+ solution: { uniqueName: 'contoso', publisherPrefix: 'contoso' },
+ app: { name: 'Contoso' },
+ entities: [{ schemaName: 'contoso_order', primaryAttribute: { schemaName: 'contoso_name' }, columns: [] }],
+ appShell: { areas: [{ label: 'Main', groups: [{ label: 'Main', subAreas: [] }] }] },
+ personas: [Object.assign({
+ persona: 'Dispatcher',
+ jobs: [{ name: 'Assign work', surfaces: ['Active Work'], privileges: [{ entity: 'contoso_order', access: ['read'] }] }],
+ }, persona)],
+ };
+}
+
+test('#583 a persona may record deliberate exclusions, and a malformed one is rejected', () => {
+ const ok = validateAppSpec(personaSpec({ excludes: ['Approving budgets — handled in the Finance app'] }), { profile: 'plan' });
+ assert.strictEqual(ok.ok, true, JSON.stringify(ok.errors));
+
+ // A persona with no excludes is unaffected — this cannot break an existing spec.
+ assert.strictEqual(validateAppSpec(personaSpec({}), { profile: 'plan' }).ok, true);
+
+ const notArray = validateAppSpec(personaSpec({ excludes: 'Approving budgets' }), { profile: 'plan' });
+ assert.ok(notArray.errors.some((e) => /excludes must be an array of strings/.test(e)),
+ `a bare string must be rejected, not treated as a one-item list; got ${JSON.stringify(notArray.errors)}`);
+
+ for (const bad of [[''], [' '], [42], [null]]) {
+ const r = validateAppSpec(personaSpec({ excludes: bad }), { profile: 'plan' });
+ assert.ok(r.errors.some((e) => /each excludes\[\] entry must be a non-empty string/.test(e)),
+ `${JSON.stringify(bad)} must be rejected — a blank exclusion documents nothing`);
+ }
+});
diff --git a/plugins/model-apps/scripts/tests/artifact-intent.test.js b/plugins/model-apps/scripts/tests/artifact-intent.test.js
index 5c2bf4075..f4eb550b7 100644
--- a/plugins/model-apps/scripts/tests/artifact-intent.test.js
+++ b/plugins/model-apps/scripts/tests/artifact-intent.test.js
@@ -744,10 +744,16 @@ test('explicit layout: multi-column tabs split width evenly unless authored', ()
assert.deepStrictEqual(cols.map((c) => c.sections[0].name), ['section_0_0', 'section_0_1_0', 'section_0_2_0']);
});
-test('fieldCellIntent writes a span only ABOVE the adapter default, even when handed the default', () => {
- // normalizeFieldEntry already folds <=1 to undefined, so this guards the OTHER callers: emitting
- // colspan="1" on every ordinary cell would overwrite a span widened by hand in the designer.
- assert.ok(!('colspan' in fieldCellIntent('new_name', { colspan: 1 })), 'colspan 1 is the default and must not be written');
- assert.ok(!('rowspan' in fieldCellIntent('new_name', { rowspan: 1 })), 'rowspan 1 is the default and must not be written');
+test('fieldCellIntent writes a span the author EXPRESSED, including an explicit 1', () => {
+ // The real asymmetry is OMISSION vs VALUE, not 1 vs >1. An ordinary cell never passes a span at
+ // all, so the "don't overwrite a hand-widened designer span" concern is served by omission — and
+ // it is asserted below. Folding an explicit 1 to undefined additionally made a RESET
+ // unrepresentable: 2 -> 1 compiled to "no colspan" and the deployed cell stayed at 2.
+ assert.strictEqual(fieldCellIntent('new_name', { colspan: 1 }).colspan, 1, 'an explicit 1 is a claim and must be written');
+ assert.strictEqual(fieldCellIntent('new_name', { rowspan: 1 }).rowspan, 1);
assert.strictEqual(fieldCellIntent('new_name', { colspan: 3 }).colspan, 3);
+ // The concern the old rule was protecting, stated directly: saying NOTHING must write nothing.
+ assert.ok(!('colspan' in fieldCellIntent('new_name', {})), 'omission must not emit a span');
+ assert.ok(!('rowspan' in fieldCellIntent('new_name', {})), 'omission must not emit a span');
+ assert.ok(!('colspan' in fieldCellIntent('new_name', { colspan: undefined })), 'an undefined span is omission');
});
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 b2de53a56..dc365d395 100644
--- a/plugins/model-apps/scripts/tests/build-model-app.test.js
+++ b/plugins/model-apps/scripts/tests/build-model-app.test.js
@@ -6,7 +6,7 @@ const { test } = require('node:test');
const assert = require('node:assert');
const path = require('node:path');
const fs = require('node:fs');
-const { buildModelApp, isTransientHalt, discoverOpDiffState, parseLanguageCode } = require(path.join(__dirname, '..', 'build-model-app.js'));
+const { buildModelApp, isTransientHalt, discoverOpDiffState, parseLanguageCode, assertSnapshotInvalidated } = require(path.join(__dirname, '..', 'build-model-app.js'));
const { resolveLanguageCode } = require(path.join(__dirname, '..', 'lib', 'entity-provision.js'));
const { validateAppSpec, normalizeLanguageCode } = require(path.join(__dirname, '..', 'lib', 'app-spec.js'));
const { readProvisionedLanguages } = require(path.join(__dirname, '..', 'lib', 'dataverse-auth.js'));
@@ -1252,3 +1252,61 @@ test('a phase-skipped check is narrated DIFFERENTLY from an environment-gated on
'and must NOT blame the environment, which is working fine');
assert.deepStrictEqual(r.verify.phaseSkipped, ['business-rule:new_ticket.Lock notes']);
});
+
+// #587 item 3 — a plain `--apply` called invalidateSnapshot but DISCARDED its `{ ok, reason }`
+// result and swallowed any throw, under a "never block a build" rationale. That is not cosmetic:
+// the snapshot is what a later `--changed-only` run trusts to decide what it may SKIP, so an
+// eligible snapshot surviving a full apply lets that run certify pre-apply state and skip work this
+// apply just made necessary. Halting costs a retry; continuing costs a silently incomplete deploy.
+//
+// The first version of this test was SOURCE-LEVEL, and an adversarial review proved it worthless:
+// both `if (false && …)` and a catch manufacturing `{ ok: true }` left all 74 tests green. The
+// guard is now an exported function, so it is tested by BEHAVIOUR instead.
+test('#587 the snapshot guard refuses every outcome that is not a definite success', () => {
+ const calls = [];
+ const storeReturning = (value) => ({
+ invalidateSnapshot: (dir) => { calls.push(dir); if (typeof value === 'function') return value(); return value; },
+ });
+
+ // The only accepted outcome, including the "nothing to invalidate" case an ordinary first build
+ // produces — so this is not a blanket refusal.
+ assert.deepStrictEqual(
+ assertSnapshotInvalidated(storeReturning({ ok: true, generation: 'g1' }), 'WS'),
+ { ok: true, generation: 'g1' });
+ assert.deepStrictEqual(
+ assertSnapshotInvalidated(storeReturning({ ok: true, reason: 'no snapshot to invalidate', generation: null }), 'WS').ok,
+ true);
+ assert.deepStrictEqual(calls, ['WS', 'WS'], 'the workspace dir must be passed through');
+
+ // Everything else must halt BEFORE the mutation engine runs.
+ for (const [label, value] of [
+ ['lease contention', { ok: false, reason: 'workspace lease held by pid 123' }],
+ ['a thrown error', () => { throw new Error('EACCES: permission denied'); }],
+ ['undefined', undefined],
+ ['null', null],
+ ['a malformed return', { status: 'fine' }],
+ ['ok as a truthy non-true', { ok: 'yes' }],
+ ]) {
+ assert.throws(
+ () => assertSnapshotInvalidated(storeReturning(value), 'WS'),
+ /refusing to apply/,
+ `${label} must halt the apply`);
+ }
+
+ // The reason reaches the operator — "it failed" without saying why is not actionable when the
+ // realistic cause is another run holding the lease.
+ assert.throws(
+ () => assertSnapshotInvalidated(storeReturning({ ok: false, reason: 'workspace lease held by pid 123' }), 'WS'),
+ /workspace lease held by pid 123/);
+});
+
+// …and the WIRING, which a behavioural test of the function alone cannot cover: main() must
+// actually call it, and only when applying.
+test('#587 a plain --apply calls the snapshot guard before building', () => {
+ const src = fs.readFileSync(path.join(__dirname, '..', 'build-model-app.js'), 'utf8');
+ const i = src.indexOf('r = await buildModelApp(spec, opts, deps);');
+ assert.ok(i > -1, 'the build call must still be findable for this check to mean anything');
+ const before = src.slice(Math.max(0, i - 1500), i);
+ assert.match(before, /if \(opts\.apply\) assertSnapshotInvalidated\(applySnapshotStore, workspaceDir\);/,
+ 'the guard must run, gated on apply, immediately before the mutation engine');
+});
diff --git a/plugins/model-apps/scripts/tests/download-model-app.test.js b/plugins/model-apps/scripts/tests/download-model-app.test.js
index 76f6fcaee..0e32fe3f1 100644
--- a/plugins/model-apps/scripts/tests/download-model-app.test.js
+++ b/plugins/model-apps/scripts/tests/download-model-app.test.js
@@ -6,7 +6,7 @@ const assert = require('node:assert');
const fs = require('node:fs');
const os = require('node:os');
const path = require('node:path');
-const { untypedColumnNames, collectGlobalChoices, finalizeGlobalChoices, resolveAppId, collectSitemap, parseDownloadedPages, entityFromMetadata, readEntityWithDescriptions, readDescriptionInventory, iconWebResources, readDashboards, droppedSubareaCount, preserveAuthoredLanguageCode } = require('../download-model-app.js');
+const { untypedColumnNames, collectGlobalChoices, finalizeGlobalChoices, resolveAppId, collectSitemap, parseDownloadedPages, entityFromMetadata, readEntityWithDescriptions, readDescriptionInventory, iconWebResources, readDashboards, readRelationships, droppedSubareaCount, preserveAuthoredLanguageCode } = require('../download-model-app.js');
test('resolveAppId returns a guid as-is, else resolves by uniquename', async () => {
const guid = '11111111-2222-3333-4444-555555555555';
@@ -2494,3 +2494,237 @@ test('#574 follow-up: IsBaseCurrency is read through the Money CAST and drops th
assert.deepStrictEqual(e.columns.map((c) => c.schemaName), ['cfo_budget'],
`the base-currency twin must not survive the real read path; got ${JSON.stringify(e.columns.map((c) => c.schemaName))}`);
});
+
+// --- #584 item 1: an N:N whose deployed SchemaName diverges from the generated default -----------
+//
+// The N:N read already retrieved `SchemaName` and then threw it away, emitting only
+// { type, entity1, entity2 }. A relationship deployed as `new_CustomTicketTagLink` therefore came
+// back as the generated `new_tag_new_ticket`, so a rebuild into the SAME environment creates a
+// SECOND intersect relationship beside the existing one instead of matching it — while the download
+// presents itself as rebuildable. The 1:N branch had carried the deployed name for exactly this
+// reason; this applies the identical rule.
+test('readRelationships carries a divergent N:N SchemaName, and omits it when it matches the default', async () => {
+ const mk = (schemaName) => ({
+ dataverse: {
+ get: async (url) => {
+ if (/ManyToManyRelationships/.test(url)) {
+ return { status: 200, body: { value: [{ SchemaName: schemaName, Entity1LogicalName: 'new_ticket', Entity2LogicalName: 'new_tag', IsCustomRelationship: true }] } };
+ }
+ // No 1:N and no lookup metadata for this probe.
+ return { status: 200, body: { value: [] } };
+ },
+ },
+ });
+
+ // 1. DIVERGENT and correctly prefixed -> carried verbatim.
+ const divergent = await readRelationships(mk('new_CustomTicketTagLink'), ['new_ticket', 'new_tag'], 'new');
+ const nn = (divergent.relationships || []).filter((r) => r.type === 'ManyToMany');
+ assert.strictEqual(nn.length, 1, `expected one N:N; got ${JSON.stringify(divergent.relationships)}`);
+ assert.strictEqual(nn[0].schemaName, 'new_CustomTicketTagLink', 'a deployed name a rebuild could not guess must be carried');
+
+ // 2. The GENERATED default -> omitted, so the spec stays minimal and the build composes it.
+ const { manyToManySchemaName } = require('../lib/app-spec.js');
+ const auto = manyToManySchemaName({ entity1: 'new_ticket', entity2: 'new_tag' }, 'new');
+ const matching = await readRelationships(mk(auto), ['new_ticket', 'new_tag'], 'new');
+ const nn2 = (matching.relationships || []).filter((r) => r.type === 'ManyToMany');
+ assert.strictEqual(nn2.length, 1);
+ assert.ok(!('schemaName' in nn2[0]), `a name equal to the generated default adds nothing; got ${JSON.stringify(nn2[0])}`);
+
+ // 3. FOREIGN publisher prefix -> reported as a rename, NOT carried (it would fail the spec's own
+ // lint) and NOT counted as skipped (the relationship is still in the spec).
+ const warnings = [];
+ const foreign = await readRelationships(mk('zzz_ForeignPrefixLink'), ['new_ticket', 'new_tag'], 'new', (m) => warnings.push(m));
+ const nn3 = (foreign.relationships || []).filter((r) => r.type === 'ManyToMany');
+ assert.strictEqual(nn3.length, 1, 'the relationship is still carried');
+ assert.ok(!('schemaName' in nn3[0]), 'but not under a name that fails the publisher-prefix lint');
+ assert.ok(warnings.some((w) => /zzz_ForeignPrefixLink/.test(w) && /publisher prefix/.test(w)),
+ `the rename must be reported; got ${JSON.stringify(warnings)}`);
+ assert.deepStrictEqual((foreign.skipped || []).filter((s) => /zzz_ForeignPrefixLink/.test(s.name)), [],
+ 'and never counted as skipped — it IS in the rebuildable spec');
+});
+// LIVE-REPRODUCED: `pac model genpage download` writes config.json starting `ef bb bf`. Node's
+// 'utf8' decode keeps that BOM as U+FEFF and JSON.parse REJECTS a leading U+FEFF, so a perfectly
+// valid downloaded config threw and the old catch substituted `{}` — the page's table bindings
+// vanished from the emitted spec, and the rebuilt page queried a table it was no longer bound to.
+//
+// Also separates the two cases the old code conflated: a MISSING config is genuinely optional,
+// while a PRESENT-but-unparseable one means the bindings are UNKNOWN and must not be reported as
+// none.
+test('a BOM-prefixed downloaded config.json keeps its data-source bindings', () => {
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'dlbom-'));
+ const mk = (id, bytes) => {
+ const d = path.join(root, id);
+ fs.mkdirSync(d, { recursive: true });
+ fs.writeFileSync(path.join(d, 'page.tsx'), 'export default () => null;', 'utf8');
+ if (bytes !== undefined) fs.writeFileSync(path.join(d, 'config.json'), bytes);
+ return d;
+ };
+
+ const CONFIG = JSON.stringify({ dataSources: ['contoso_ticket'] });
+ mk('11111111-1111-1111-1111-111111111111', Buffer.from('\uFEFF' + CONFIG, 'utf8')); // BOM, as pac writes it
+ mk('22222222-2222-2222-2222-222222222222', Buffer.from(CONFIG, 'utf8')); // plain
+ mk('33333333-3333-3333-3333-333333333333'); // no config at all
+ mk('44444444-4444-4444-4444-444444444444', Buffer.from('{ not json', 'utf8')); // present, broken
+
+ // The fixture really is BOM-prefixed on disk, so this cannot pass by writing a plain file.
+ const first = fs.readFileSync(path.join(root, '11111111-1111-1111-1111-111111111111', 'config.json'));
+ assert.deepStrictEqual([...first.slice(0, 3)], [0xef, 0xbb, 0xbf]);
+
+ const unreadable = [];
+ const pages = parseDownloadedPages(root, root, null, unreadable);
+ const byId = new Map(pages.map((x) => [x.pageId, x]));
+
+ assert.deepStrictEqual(byId.get('11111111-1111-1111-1111-111111111111').dataSources, ['contoso_ticket'],
+ 'a BOM must not cost the page its bindings');
+ assert.deepStrictEqual(byId.get('22222222-2222-2222-2222-222222222222').dataSources, ['contoso_ticket'],
+ 'and a plain config must still work');
+ assert.deepStrictEqual(byId.get('33333333-3333-3333-3333-333333333333').dataSources, [],
+ 'a MISSING config is optional — no bindings, no complaint');
+
+ assert.deepStrictEqual(unreadable.map((u) => u.pageId), ['44444444-4444-4444-4444-444444444444'],
+ 'only the present-but-broken config counts as unreadable — not the absent one, not the BOM one');
+
+ fs.rmSync(root, { recursive: true, force: true });
+});
+
+// A prompt.txt carries the same BOM, and it becomes the rebuilt page's prompt.
+test('a BOM-prefixed downloaded prompt.txt does not keep the BOM in the prompt', () => {
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'dlbom2-'));
+ const d = path.join(root, '55555555-5555-5555-5555-555555555555');
+ fs.mkdirSync(d, { recursive: true });
+ fs.writeFileSync(path.join(d, 'page.tsx'), 'x', 'utf8');
+ fs.writeFileSync(path.join(d, 'prompt.txt'), Buffer.from('\uFEFFConversation with 1 prompts:', 'utf8'));
+ const pages = parseDownloadedPages(root, root, null, []);
+ assert.strictEqual(pages[0].prompt.charCodeAt(0) !== 0xFEFF, true, 'the prompt must not start with a BOM');
+ assert.strictEqual(pages[0].prompt, 'Conversation with 1 prompts:');
+ fs.rmSync(root, { recursive: true, force: true });
+});
+
+// The parse-level test above proves an unreadable config is RECORDED. It does not prove the
+// download REFUSES to emit a spec because of it — the policy is what protects the user, and making
+// the gate unconditionally false left the parse test passing while `runDownload` happily returned
+// ok:true with the bindings silently dropped. This asserts the GATE, not just the parse.
+test('runDownload REFUSES to emit a spec when a page config is unreadable, unless the loss is accepted', async () => {
+ const GP = '13ecbc57-a3a4-4132-b0a2-a6c6b12691e8';
+ const APP_ID = 'a1b2c3d4-0000-4000-8000-00000000beef';
+ const APP_UNIQ_VALUE = 'c0ffee00-0000-4000-8000-00000000cafe';
+ const SM_ID = '5111e0f2-0000-4000-8000-0000000000ab';
+ const APP_UNIQUE = 'test_gate';
+ const SM_XML = `<SiteMap><Area><Group><SubArea GenPageId="${GP}" Title="Sitemap Page"/><SubArea Entity="contoso_item"/></Group></Area></SiteMap>`;
+
+ const out = fs.mkdtempSync(path.join(os.tmpdir(), 'dl-gate-'));
+ const mkSdk = () => ({
+ fetchArtifact: async () => ({
+ name: 'Gate App', description: '',
+ siteMap: { areas: [{ title: 'M', groups: [{ title: 'G', subAreas: [
+ { type: 'GenPage', genPageId: GP, title: 'Sitemap Page' },
+ { type: 'Entity', entity: 'contoso_item' },
+ ] }] }] },
+ }),
+ queryRecords: async (logical, opts) => {
+ const filter = (opts && opts.filter) || '';
+ if (logical === 'appmodule') {
+ const m = filter.match(/uniquename eq '([^']+)'/);
+ if (m) return m[1] === APP_UNIQUE ? [{ appmoduleid: APP_ID, appmoduleidunique: APP_UNIQ_VALUE }] : [];
+ return [{ appmoduleid: APP_ID, appmoduleidunique: APP_UNIQ_VALUE, uniquename: APP_UNIQUE }];
+ }
+ if (logical === 'appmodulecomponent') return [{ objectid: SM_ID, componenttype: 62 }];
+ if (logical === 'sitemap') return [{ sitemapxml: SM_XML }];
+ return [];
+ },
+ fetchEntityMetadata: async (logical) => ({
+ schemaName: logical, displayName: 'Item', primaryNameAttribute: `${String(logical).split('_')[0]}_name`,
+ }),
+ });
+ // pac downloads the page, but its config.json is unreadable — the live BOM case before the fix,
+ // and any future pac format change after it.
+ const genpageCli = {
+ enumerateEnv: async () => ({ ok: true, ids: [GP.toLowerCase()], pages: [{ pageId: GP, name: 'Env Page' }] }),
+ download: async ({ outputDir, pageIds }) => {
+ for (const pid of (pageIds || [])) {
+ fs.mkdirSync(path.join(outputDir, pid), { recursive: true });
+ fs.writeFileSync(path.join(outputDir, pid, 'page.tsx'), 'export default () => null;');
+ fs.writeFileSync(path.join(outputDir, pid, 'config.json'), Buffer.from('{ truncated', 'utf8'));
+ }
+ return true;
+ },
+ };
+
+ try {
+ const refused = await runDownload({ sdk: mkSdk(), genpageCli, outDir: out, appId: APP_ID, appUnique: APP_UNIQUE });
+ assert.strictEqual(refused.ok, false, `an unreadable config must abort the download; got ${JSON.stringify(refused).slice(0, 300)}`);
+ assert.match(refused.error, /config\.json/, 'the failure names what could not be read');
+ assert.match(refused.error, /--allow-lossy-download/, 'and advertises the override');
+ assert.strictEqual(refused.spec, undefined, 'no spec may be produced — emitting one IS the silent loss');
+
+ // With the loss explicitly accepted it completes, warns, and the bindings are simply absent.
+ const warned = [];
+ const realWrite = process.stderr.write.bind(process.stderr);
+ process.stderr.write = (chunk, ...rest) => { warned.push(String(chunk)); return realWrite(chunk, ...rest); };
+ let lossy;
+ try {
+ lossy = await runDownload({ sdk: mkSdk(), genpageCli, outDir: out, appId: APP_ID, appUnique: APP_UNIQUE, allowLossy: true });
+ } finally { process.stderr.write = realWrite; }
+ assert.strictEqual(lossy.ok, true, `--allow-lossy-download must let it through: ${JSON.stringify(lossy).slice(0, 300)}`);
+ assert.ok(warned.some((w) => /unreadable/i.test(w) && /DROPPED/.test(w)),
+ `the accepted loss must still be announced; saw ${JSON.stringify(warned)}`);
+ } finally {
+ fs.rmSync(out, { recursive: true, force: true });
+ }
+});
+
+// --- PR review: a MISSING optional file is not an explicitly blank one --------------------------
+// `prompt` used to default to '' for a page with no prompt.txt. The build's blank-provenance guard
+// then read that as "the author supplied an empty prompt" and ABORTED the rebuild — so downloading
+// an app and rebuilding it broke for every page lacking the optional file. Omission must stay
+// omission; a file that EXISTS but is blank stays explicit so it still fails closed.
+test('a page with NO prompt.txt omits prompt entirely, rather than claiming an empty one', () => {
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'dlprompt-'));
+ const mk = (id, promptBytes) => {
+ const d = path.join(root, id);
+ fs.mkdirSync(d, { recursive: true });
+ fs.writeFileSync(path.join(d, 'page.tsx'), 'export default () => null;', 'utf8');
+ fs.writeFileSync(path.join(d, 'config.json'), Buffer.from(JSON.stringify({ dataSources: [] }), 'utf8'));
+ if (promptBytes !== undefined) fs.writeFileSync(path.join(d, 'prompt.txt'), promptBytes);
+ };
+ mk('11111111-1111-1111-1111-111111111111'); // no prompt.txt
+ mk('22222222-2222-2222-2222-222222222222', Buffer.from(' \n', 'utf8')); // present, blank
+ mk('33333333-3333-3333-3333-333333333333', Buffer.from('real prompt', 'utf8'));
+
+ const pages = parseDownloadedPages(root, root, null, []);
+ const byId = new Map(pages.map((p) => [p.pageId, p]));
+
+ assert.strictEqual(byId.get('11111111-1111-1111-1111-111111111111').prompt, undefined,
+ 'a missing prompt.txt is an OMISSION — the wrapper default applies, the build must not refuse');
+ assert.strictEqual(byId.get('22222222-2222-2222-2222-222222222222').prompt, '',
+ 'a present-but-blank file stays explicit so the blank-provenance guard still fails closed');
+ assert.strictEqual(byId.get('33333333-3333-3333-3333-333333333333').prompt, 'real prompt');
+
+ // The emitted spec must not carry the key at all for the omitted case — `undefined` is dropped by
+ // JSON.stringify, which is what makes the rebuild use the default rather than refuse.
+ const round = JSON.parse(JSON.stringify(byId.get('11111111-1111-1111-1111-111111111111')));
+ assert.ok(!('prompt' in round), `prompt must be absent from the serialized page; got ${JSON.stringify(round)}`);
+
+ fs.rmSync(root, { recursive: true, force: true });
+});
+
+// `existsSync` returns false for a file that exists but cannot be OPENED, which made an unreadable
+// config indistinguishable from a missing one: the page was emitted with no bindings and never
+// recorded as unreadable, slipping past the --allow-lossy-download gate entirely.
+test('a config that exists but cannot be READ is recorded unreadable, not treated as absent', () => {
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'dlacl-'));
+ const d = path.join(root, '44444444-4444-4444-4444-444444444444');
+ fs.mkdirSync(d, { recursive: true });
+ fs.writeFileSync(path.join(d, 'page.tsx'), 'export default () => null;', 'utf8');
+ // A DIRECTORY named config.json reproduces "exists but unreadable" portably: readFileSync fails
+ // with EISDIR, which is emphatically not ENOENT.
+ fs.mkdirSync(path.join(d, 'config.json'));
+
+ const unreadable = [];
+ const pages = parseDownloadedPages(root, root, null, unreadable);
+ assert.strictEqual(pages.length, 1, 'the page is still emitted');
+ assert.deepStrictEqual(unreadable.map((u) => u.pageId), ['44444444-4444-4444-4444-444444444444'],
+ 'an unreadable config must reach the lossy-download gate rather than read as "no bindings"');
+
+ fs.rmSync(root, { recursive: true, force: true });
+});
diff --git a/plugins/model-apps/scripts/tests/download-relationships.test.js b/plugins/model-apps/scripts/tests/download-relationships.test.js
index cb076d98a..8014b3c1a 100644
--- a/plugins/model-apps/scripts/tests/download-relationships.test.js
+++ b/plugins/model-apps/scripts/tests/download-relationships.test.js
@@ -152,7 +152,11 @@ test('reconstructs N:N only when both ends are in the app, and reports the rest
},
});
const { relationships, skipped } = await readRelationships(sdk, ['new_ticket', 'new_tag'], 'new');
- assert.deepStrictEqual(relationships, [{ type: 'ManyToMany', entity1: 'new_ticket', entity2: 'new_tag' }]);
+ // `schemaName` is carried because the deployed name diverges from the generated default:
+ // `manyToManySchemaName` SORTS the pair, so it would compose `new_tag_new_ticket`. Without the
+ // deployed name a rebuild into this environment creates a SECOND intersect relationship instead of
+ // matching the existing one.
+ assert.deepStrictEqual(relationships, [{ type: 'ManyToMany', entity1: 'new_ticket', entity2: 'new_tag', schemaName: 'new_ticket_new_tag' }]);
assert.strictEqual(skipped.length, 1);
assert.match(skipped[0].reason, /does not include both tables/i);
});
@@ -170,7 +174,7 @@ test('an N:N is emitted once even though it appears on BOTH tables metadata (#56
const r = rel({ SchemaName: 'new_ticket_new_tag', Entity1LogicalName: 'new_ticket', Entity2LogicalName: 'new_tag' });
const sdk = makeSdk({ m2m: { new_ticket: [r], new_tag: [r] } });
const { relationships } = await readRelationships(sdk, ['new_ticket', 'new_tag'], 'new');
- assert.deepStrictEqual(relationships, [{ type: 'ManyToMany', entity1: 'new_ticket', entity2: 'new_tag' }]);
+ assert.deepStrictEqual(relationships, [{ type: 'ManyToMany', entity1: 'new_ticket', entity2: 'new_tag', schemaName: 'new_ticket_new_tag' }]);
});
test('a failed relationship read is REPORTED, not silently read as "this table has none" (#567)', async () => {
diff --git a/plugins/model-apps/scripts/tests/form-field-options.test.js b/plugins/model-apps/scripts/tests/form-field-options.test.js
index 214152465..3de55e628 100644
--- a/plugins/model-apps/scripts/tests/form-field-options.test.js
+++ b/plugins/model-apps/scripts/tests/form-field-options.test.js
@@ -182,14 +182,22 @@ test('normalizeFieldEntry lower-cases both name and anchor (every downstream com
assert.deepStrictEqual(normalizeFieldEntry({ name: 'New_B', after: 'New_A' }), { name: 'new_b', readOnly: false, hidden: false, after: 'new_a', colspan: undefined, rowspan: undefined });
});
-test('normalizeFieldEntry keeps a span only when it exceeds the adapter default of 1', () => {
- // A colspan of 1 IS the default, so recording it would make the cell builder emit an explicit
- // attribute for every ordinary field and overwrite a span widened by hand in the designer.
- assert.strictEqual(normalizeFieldEntry({ name: 'a', colspan: 1 }).colspan, undefined);
+test('normalizeFieldEntry keeps an explicit span, including 1, and drops only omission', () => {
+ // An explicit `colspan: 1` is the author CLAIMING the default, which is different from saying
+ // nothing. The old rule folded both to undefined, so a reset from 2 to 1 was unrepresentable and
+ // the deployed cell kept its old span — live-reproduced across two applies.
+ assert.strictEqual(normalizeFieldEntry({ name: 'a', colspan: 1 }).colspan, 1);
+ assert.strictEqual(normalizeFieldEntry({ name: 'a', rowspan: 1 }).rowspan, 1);
assert.strictEqual(normalizeFieldEntry({ name: 'a', colspan: 2 }).colspan, 2);
assert.strictEqual(normalizeFieldEntry({ name: 'a', rowspan: 3 }).rowspan, 3);
- // Non-numeric and fractional values must not reach the serializer as-is.
+ // Omission stays omission — this is what keeps an ordinary cell from overwriting a span widened
+ // by hand in the designer.
+ assert.strictEqual(normalizeFieldEntry({ name: 'a' }).colspan, undefined);
+ assert.strictEqual(normalizeFieldEntry('a').colspan, undefined);
+ // Non-numeric, fractional and nonsensical values must not reach the serializer as-is.
assert.strictEqual(normalizeFieldEntry({ name: 'a', colspan: 'wide' }).colspan, undefined);
+ assert.strictEqual(normalizeFieldEntry({ name: 'a', colspan: 0 }).colspan, undefined);
+ assert.strictEqual(normalizeFieldEntry({ name: 'a', colspan: -2 }).colspan, undefined);
assert.strictEqual(normalizeFieldEntry({ name: 'a', colspan: 2.7 }).colspan, 2);
});
diff --git a/plugins/model-apps/scripts/tests/form-preview.test.js b/plugins/model-apps/scripts/tests/form-preview.test.js
index 94dd46267..3a27c0555 100644
--- a/plugins/model-apps/scripts/tests/form-preview.test.js
+++ b/plugins/model-apps/scripts/tests/form-preview.test.js
@@ -155,3 +155,116 @@ test('a single-column tab shows no column banner (the common case stays clean)',
] }];
assert.doesNotMatch(renderFormWireframe(s, s.forms[0]), /column 1 of/);
});
+
+// #591 — the wireframe is the form APPROVAL gate, but every bound cell rendered as an ordinary
+// visible, editable field regardless of authored state. A maker could approve an apparently
+// editable required field that deploys read-only, or a field they believe is visible that deploys
+// hidden. Hidden tabs and sections were already annotated for exactly this reason; cells were not.
+//
+// Hidden cells are annotated rather than OMITTED, deliberately: the approval artifact should show
+// that the field exists and is intentionally hidden, which dropping it cannot convey.
+function stateSpec(fields, fieldOptions) {
+ const s = spec();
+ s.forms = [{
+ entity: 'new_wo', name: 'WO', layout: 'explicit',
+ tabs: [{ name: 't1', label: 'Main', columns: [{ sections: [{ name: 'a', label: 'Order', columns: 1, fields }] }] }],
+ }];
+ if (fieldOptions) s.forms[0].fieldOptions = fieldOptions;
+ return s;
+}
+const render = (s) => renderFormWireframe(s, s.forms[0]);
+
+test('the wireframe annotates a read-only field, a hidden field, and one that is both', () => {
+ const plain = render(stateSpec(['new_status']));
+ assert.match(plain, /Status/);
+ assert.doesNotMatch(plain, /read-only|hidden/, `an ordinary field must carry NO state annotation:\n${plain}`);
+
+ const ro = render(stateSpec([{ name: 'new_status', readOnly: true }]));
+ assert.match(ro, /Status.*\(read-only\)/, `a read-only field must be annotated:\n${ro}`);
+
+ const hid = render(stateSpec([{ name: 'new_status', hidden: true }]));
+ assert.match(hid, /Status.*\(hidden\)/, `a hidden field must be annotated:\n${hid}`);
+ assert.match(hid, /Status/, 'and must still be LISTED — omitting it hides the field from the approval');
+
+ const both = render(stateSpec([{ name: 'new_status', hidden: true, readOnly: true }]));
+ assert.match(both, /Status.*\(hidden, read-only\)/, `both states must be reported together:\n${both}`);
+});
+
+// The same state can be authored inline on the field entry OR through the form's `fieldOptions`
+// map. They compile to the same cell, so the preview must not depend on which one the author used.
+test('the wireframe annotates field state authored through fieldOptions as well as inline', () => {
+ const viaOptions = render(stateSpec(['new_status', 'new_cost'], {
+ new_status: { readOnly: true },
+ new_cost: { hidden: true },
+ }));
+ assert.match(viaOptions, /Status.*\(read-only\)/, `fieldOptions readOnly must be shown:\n${viaOptions}`);
+ assert.match(viaOptions, /Total Cost.*\(hidden\)/, `fieldOptions hidden must be shown:\n${viaOptions}`);
+});
+
+// The annotation sits BEFORE the widget hint on purpose. Cells are clipped to the column width —
+// about 30 columns in a two-column section — so an annotation appended after the widget is exactly
+// what `clip()` truncates away, and the approval gate would go back to hiding the state while
+// looking like it reports it. Ordering by importance makes truncation degrade the widget instead.
+test('field state survives clipping in a narrow two-column section', () => {
+ const s = stateSpec([{ name: 'new_cost', readOnly: true }, { name: 'new_when', hidden: true }]);
+ s.forms[0].tabs[0].columns[0].sections[0].columns = 2;
+ const out = render(s);
+ assert.match(out, /\(read-only\)/, `read-only state must survive a narrow column:\n${out}`);
+ assert.match(out, /\(hidden\)/, `hidden state must survive a narrow column:\n${out}`);
+});
+
+// Putting the state before the widget is necessary but NOT sufficient. With a long display name in
+// a two-column section the annotation itself is what `clip()` cuts, producing "(read-o…" or
+// "(hidden, read-on…" — a half-printed state flag, which is precisely the silent-state failure the
+// annotation exists to prevent. A truncated LABEL is still recognisable; a truncated state is not.
+//
+// So the renderer gives up the decorative widget hint first, and truncates the NAME after that,
+// but never the state.
+test('a long field name never truncates the state annotation', () => {
+ const s = spec();
+ s.entities[0].columns.push({
+ schemaName: 'new_verylongfieldname',
+ displayName: 'Extremely Long Inspection Field Name For Clipping',
+ type: 'Money',
+ });
+ s.forms = [{
+ entity: 'new_wo', name: 'WO', layout: 'explicit',
+ tabs: [{ name: 't1', label: 'Main', columns: [{ sections: [{
+ name: 'a', label: 'Order', columns: 2,
+ fields: [{ name: 'new_verylongfieldname', hidden: true, readOnly: true }, { name: 'new_cost', readOnly: true }],
+ }] }] }],
+ }];
+ const out = renderFormWireframe(s, s.forms[0]);
+ assert.match(out, /\(hidden, read-only\)/, `the full state must survive a long name:\n${out}`);
+ assert.match(out, /\(read-only\)/, `the second cell's state must survive too:\n${out}`);
+ // And the guarantee stated positively: no rendered line may contain a state tag that was cut off.
+ assert.doesNotMatch(out, /\((?:hidden|read-only)[^)]*…/, `a state tag was truncated mid-word:\n${out}`);
+});
+
+// Adversarial review caught the fix above being INCOMPLETE. Reserving "at least one name character"
+// still lets the outer clip() eat the tag itself once the tag alone is wider than the column: a
+// combined ` (hidden, read-only)` needs 20 columns, but a three-column row gives 18 and a
+// four-column row 13. Measured before the fix: 1/4 and 0/4 tags rendered complete.
+//
+// Four columns is a valid authored layout, so the approval gate was still lying — just in narrower
+// forms than the two-column case I had tested.
+test('field state survives at EVERY supported section column count', () => {
+ const s = spec();
+ for (const i of [1, 2, 3, 4]) {
+ s.entities[0].columns.push({ schemaName: `new_col${i}`, displayName: `Column Number ${i}`, type: 'Text' });
+ }
+ for (const columns of [1, 2, 3, 4]) {
+ s.forms = [{
+ entity: 'new_wo', name: 'WO', layout: 'explicit',
+ tabs: [{ name: 't1', label: 'Main', columns: [{ sections: [{
+ name: 'a', label: 'Order', columns,
+ fields: [1, 2, 3, 4].map((i) => ({ name: `new_col${i}`, hidden: true, readOnly: true })),
+ }] }] }],
+ }];
+ const out = renderFormWireframe(s, s.forms[0]);
+ assert.doesNotMatch(out, /\((?:hidden|read-only)[^)]*…/,
+ `a state tag was truncated at columns=${columns}:\n${out}`);
+ assert.strictEqual((out.match(/\(hidden, read-only\)/g) || []).length, 4,
+ `all four fields must report their full state at columns=${columns}:\n${out}`);
+ }
+});
diff --git a/plugins/model-apps/scripts/tests/genpage-cli.test.js b/plugins/model-apps/scripts/tests/genpage-cli.test.js
index 69ba9f087..e30b2c3e9 100644
--- a/plugins/model-apps/scripts/tests/genpage-cli.test.js
+++ b/plugins/model-apps/scripts/tests/genpage-cli.test.js
@@ -600,3 +600,37 @@ test('download passes --page-id for a single id (no trailing comma)', async () =
const i = seen.indexOf('--page-id');
assert.ok(i > 0 && seen[i + 1] === GP_A, 'single id, no trailing comma');
});
+
+// --- PR review: duplicate-create recovery must not depend on a NAME ------------------------------
+// Both the pre-create snapshot and the uncertain-result reconciliation used to require `name`, so a
+// name-less create skipped both and retried BLINDLY after an uncertain result — the way pac ends up
+// with duplicate pages. The recovery is pure id arithmetic (enumerateEnv is id-keyed and name
+// matching is explicitly never used), so the name was vestigial in those gates.
+test('a name-less create still snapshots and reconciles an uncertain result (no blind retry)', async () => {
+ const GP_NEW = '13ecbc57-a3a4-4132-b0a2-a6c6b12691e8';
+ const seen = [];
+ let uploads = 0;
+ const cli = makeGenpageCli('https://contoso.crm.dynamics.com/', {
+ run: async (args) => {
+ seen.push(args);
+ if (args.includes('list')) {
+ // Before the create: empty. After it: the page exists, so the create DID land.
+ return { status: 0, stdout: uploads === 0 ? LIST_EMPTY : listText([{ pageId: GP_NEW, name: 'Whatever' }]), stderr: '' };
+ }
+ uploads += 1;
+ // An UNCERTAIN result: zero exit, no Page ID. The create may or may not have landed.
+ if (uploads === 1) return { status: 0, stdout: 'done', stderr: '' };
+ return { status: 0, stdout: `Page ID: ${GP_NEW}`, stderr: '' };
+ },
+ sleep: async () => {},
+ });
+ const res = await cli.upload({ appId: 'a1', codeFile: 'p.tsx', prompt: 'p', agentMessage: 'm' }); // NO name
+ assert.strictEqual(res.pageId, GP_NEW,
+ 'the landed create must be ADOPTED, not created a second time');
+ // The retry must have run as an UPDATE against the adopted id, never as a second blind create.
+ const uploadCalls = seen.filter((a) => a.includes('upload'));
+ assert.strictEqual(uploadCalls.length, 2, `expected one create + one adopted update; got ${uploadCalls.length}`);
+ assert.ok(!uploadCalls[0].includes('--page-id'), 'the first attempt is a create');
+ assert.deepStrictEqual(uploadCalls[1].slice(uploadCalls[1].indexOf('--page-id'), uploadCalls[1].indexOf('--page-id') + 2),
+ ['--page-id', GP_NEW], 'the retry targets the adopted page instead of creating a duplicate');
+});
diff --git a/plugins/model-apps/scripts/tests/genpage-upload.test.js b/plugins/model-apps/scripts/tests/genpage-upload.test.js
new file mode 100644
index 000000000..8237c9772
--- /dev/null
+++ b/plugins/model-apps/scripts/tests/genpage-upload.test.js
@@ -0,0 +1,898 @@
+'use strict';
+// #589 — the standalone /genpage skill composed a raw `pac model genpage upload --prompt "<text>"`
+// command line in Markdown, while /app-builder went through the quoting-safe wrapper. Same upload
+// contract, two transports, and only one of them survives a realistic prompt.
+//
+// Observed live, for a prompt containing an ASCII-quoted multiword page name:
+// Error: Not a valid command.
+// Parse failed on: Inspection
+// Was it quote wrapped? No, be sure to wrap values that contain spaces.
+//
+// The dangerous "fix" is to edit the approved prompt until it parses, which deploys text the user
+// never approved. These tests pin the transport instead: the prompt must reach pac BY FILE and
+// arrive byte-identical, and it must never appear on the command line at all.
+const test = require('node:test');
+const assert = require('node:assert');
+const os = require('node:os');
+const path = require('node:path');
+const fs = require('node:fs');
+
+const { main } = require('../genpage-upload.js');
+const { buildPacInvocation, makeGenpageCli } = require('../lib/genpage-cli.js');
+
+const dirs = [];
+test.after(() => { for (const d of dirs) fs.rmSync(d, { recursive: true, force: true }); });
+function tmp() {
+ const d = fs.mkdtempSync(path.join(os.tmpdir(), 'gp589-'));
+ dirs.push(d);
+ return d;
+}
+
+// Every hazard the live failure and the issue name, in one string:
+// multi-line, ASCII-quoted multiword name, Unicode, and shell metacharacters.
+const HOSTILE_PROMPT = [
+ 'Create and LIVE DEPLOY one isolated generative page named "Facilities Inspection Live Overview"',
+ 'with a résumé of 100% & <b>bold</b> | piped ^ caret %PATH% $(whoami) `backtick`',
+ '',
+ "and a trailing line with an apostrophe's quote",
+].join('\n');
+
+// What a DOWNLOADED page prompt actually looks like — a conversation transcript whose line breaks
+// are the content. Passed inline these are collapsed to spaces and the transcript is destroyed.
+const TRANSCRIPT = 'Conversation with 3 prompts:\r\n1. Build a list of inspections\r\n2. Add a search box\r\n3. Sort by "Company Name" desc';
+
+function capturingCli(opts = {}) {
+ const calls = [];
+ return {
+ calls,
+ factory: () => ({
+ upload: async (o) => { calls.push(o); return { pageId: '13ecbc57-a3a4-4132-b0a2-a6c6b12691e8' }; },
+ // Default: the requested page exists. Tests that care override this.
+ enumerateEnvironment: async () => ({ ok: true, ids: ['9f1b2c3d-4e5f-4a6b-8c9d-0e1f2a3b4c5d'] }),
+ // An update reads the page's CURRENT bindings so omitting `--data-sources` preserves them
+ // instead of persisting `[]`. pac writes this config UTF-8 with a BOM, so the fixture does too.
+ download: async ({ outputDir, pageIds }) => {
+ for (const pid of (pageIds || [])) {
+ fs.mkdirSync(path.join(outputDir, pid), { recursive: true });
+ const body = JSON.stringify({ dataSources: opts.liveDataSources || ['contoso_ticket'] });
+ fs.writeFileSync(path.join(outputDir, pid, 'config.json'), Buffer.from('\uFEFF' + body, 'utf8'));
+ }
+ return true;
+ },
+ }),
+ };
+}
+
+// LIVE-REPRODUCED: pac treats an unknown `--page-id` as a CREATE and returns the NEW page's id, so
+// the wrapper's identity guard (returned id === requested id) matched and a UUID proven absent
+// beforehand became a brand-new, UNPLACED page reported as `updated: true`.
+test('an update of a page that does not exist is refused instead of creating one', async () => {
+ const calls = [];
+ const factory = () => ({
+ upload: async (o) => { calls.push(o); return { pageId: 'NEW' }; },
+ enumerateEnvironment: async () => ({ ok: true, ids: ['aaaaaaaa-1111-4111-8111-aaaaaaaaaaaa'] }),
+ });
+ const r = await new Promise((resolve) => {
+ main(['--env', 'https://x/', '--app-id', 'a1', '--code-file', 'p.tsx',
+ '--page-id', '9f1b2c3d-4e5f-4a6b-8c9d-0e1f2a3b4c5d', '--prompt', 'p'],
+ { makeGenpageCli: factory, emit: (ok, payload) => resolve({ ok, payload }) });
+ });
+ assert.strictEqual(r.ok, false);
+ assert.match(r.payload.error, /does not exist in this environment/);
+ assert.strictEqual(calls.length, 0, 'nothing may be uploaded against an absent target');
+});
+
+// Fail CLOSED: an unreadable listing is not permission to write.
+test('an unverifiable update target is refused rather than assumed present', async () => {
+ const calls = [];
+ const factory = () => ({
+ upload: async (o) => { calls.push(o); return { pageId: 'NEW' }; },
+ enumerateEnvironment: async () => ({ ok: false, error: 'pac genpage list failed after 3 attempts' }),
+ });
+ const r = await new Promise((resolve) => {
+ main(['--env', 'https://x/', '--app-id', 'a1', '--code-file', 'p.tsx',
+ '--page-id', '9f1b2c3d-4e5f-4a6b-8c9d-0e1f2a3b4c5d', '--prompt', 'p'],
+ { makeGenpageCli: factory, emit: (ok, payload) => resolve({ ok, payload }) });
+ });
+ assert.strictEqual(r.ok, false);
+ assert.match(r.payload.error, /cannot verify that page/);
+ assert.strictEqual(calls.length, 0);
+});
+
+// CONTROL — an update whose target DOES exist still proceeds, and a CREATE is never gated on a
+// listing at all. Without these the rule above could be satisfied by refusing everything.
+test('an update of an existing page, and any create, still proceed', async () => {
+ const cli = capturingCli();
+ const upd = await runMain(['--env', 'https://x/', '--app-id', 'a1', '--code-file', 'p.tsx',
+ '--page-id', '9f1b2c3d-4e5f-4a6b-8c9d-0e1f2a3b4c5d', '--prompt', 'p'], cli);
+ assert.strictEqual(upd.ok, true, `an existing target must update: ${JSON.stringify(upd.payload)}`);
+ assert.strictEqual(upd.payload.updated, true);
+
+ const create = await runMain(['--env', 'https://x/', '--app-id', 'a1', '--code-file', 'p.tsx',
+ '--name', 'N', '--prompt', 'p'], cli);
+ assert.strictEqual(create.ok, true, 'a create must not be gated on an existence check');
+ assert.strictEqual(create.payload.updated, false);
+});
+
+// An explicitly EMPTY agent message deployed fabricated provenance ('Authored by app-builder'),
+// while an empty PROMPT was already refused — the same fabrication, unguarded on the other field.
+test('an explicitly empty agent-message file is refused rather than silently defaulted', async () => {
+ const d = tmp();
+ const af = path.join(d, 'agent.txt');
+ fs.writeFileSync(af, '', 'utf8');
+ const cli = capturingCli();
+ const r = await runMain(['--env', 'https://x/', '--app-id', 'a1', '--code-file', 'p.tsx',
+ '--name', 'N', '--prompt', 'p', '--agent-message-file', af], cli);
+ assert.strictEqual(r.ok, false, 'an empty agent message must not become fabricated provenance');
+ assert.match(r.payload.error, /resolved to empty/);
+ assert.strictEqual(cli.calls.length, 0);
+});
+
+function runMain(argv, cli) {
+ return new Promise((resolve) => {
+ main(argv, { makeGenpageCli: cli.factory, emit: (ok, payload) => resolve({ ok, payload }) });
+ });
+}
+
+test('a hostile multi-line prompt reaches upload() byte-identical when passed by file', async () => {
+ const d = tmp();
+ const pf = path.join(d, 'prompt.txt');
+ const af = path.join(d, 'agent.txt');
+ fs.writeFileSync(pf, HOSTILE_PROMPT, 'utf8');
+ fs.writeFileSync(af, 'Initial deploy of the inspection page', 'utf8');
+
+ const cli = capturingCli();
+ const r = await runMain(['--env', 'https://contoso.crm.dynamics.com/', '--app-id', 'a1', '--code-file', 'page.tsx',
+ '--prompt-file', pf, '--agent-message-file', af, '--name', 'Facilities Inspection Live Overview'], cli);
+
+ assert.strictEqual(r.ok, true, `upload should succeed; got ${JSON.stringify(r.payload)}`);
+ assert.strictEqual(cli.calls.length, 1);
+ assert.strictEqual(cli.calls[0].prompt, HOSTILE_PROMPT,
+ 'the prompt must arrive VERBATIM — quotes, newlines, Unicode and metacharacters intact');
+ assert.strictEqual(cli.calls[0].name, 'Facilities Inspection Live Overview');
+ assert.strictEqual(r.payload.pageId, '13ecbc57-a3a4-4132-b0a2-a6c6b12691e8');
+});
+
+test('a downloaded conversation transcript survives an update by file', async () => {
+ const d = tmp();
+ const pf = path.join(d, 'prompt.txt');
+ fs.writeFileSync(pf, TRANSCRIPT, 'utf8');
+
+ const cli = capturingCli();
+ const r = await runMain(['--env', 'https://contoso.crm.dynamics.com/', '--app-id', 'a1', '--code-file', 'page.tsx',
+ '--page-id', '9f1b2c3d-4e5f-4a6b-8c9d-0e1f2a3b4c5d', '--prompt-file', pf, '--agent-message', 'Re-upload after edit'], cli);
+
+ assert.strictEqual(r.ok, true);
+ // \r\n is normalized by neither side: only a SINGLE trailing newline is stripped, so every
+ // interior line break — which is what makes a transcript a transcript — is preserved.
+ assert.strictEqual(cli.calls[0].prompt, TRANSCRIPT, 'the transcript must not be flattened');
+ assert.strictEqual(cli.calls[0].pageId, '9f1b2c3d-4e5f-4a6b-8c9d-0e1f2a3b4c5d');
+ assert.strictEqual(r.payload.updated, true, 'an upload carrying --page-id is an update');
+});
+
+// Prompt provenance: two different texts, one deploy. Silently preferring either means building the
+// page from text the caller did not intend, which is the failure this whole issue is about.
+test('passing both an inline prompt and a prompt file is refused rather than silently resolved', async () => {
+ const d = tmp();
+ const pf = path.join(d, 'prompt.txt');
+ fs.writeFileSync(pf, 'from the file', 'utf8');
+ const cli = capturingCli();
+ const r = await runMain(['--env', 'https://x/', '--app-id', 'a1', '--code-file', 'p.tsx',
+ '--prompt', 'inline text', '--prompt-file', pf], cli);
+ assert.strictEqual(r.ok, false);
+ assert.match(r.payload.error, /only one of --prompt or --prompt-file/);
+ assert.strictEqual(cli.calls.length, 0, 'nothing may be uploaded when the prompt is ambiguous');
+});
+
+// LIVE-VERIFICATION FINDING, not a hypothetical. Deploying a page for real and then running
+// `pac model genpage download` showed pac writes the recovered `prompt.txt` with a UTF-8 BOM
+// (measured: first bytes `ef bb bf`). The documented edit flow re-feeds exactly that file through
+// `--prompt-file`, and Node's 'utf8' decode does NOT strip a BOM — so the prompt handed to pac
+// began with an invisible U+FEFF. That silently alters the first character of a prompt the user
+// approved, which is the same prompt-provenance failure this whole path exists to prevent.
+test('a BOM written by `pac genpage download` is stripped, not sent as part of the prompt', async () => {
+ const d = tmp();
+ const pf = path.join(d, 'prompt.txt');
+ const body = 'Create a read-only overview page named "Live Check Overview".';
+ fs.writeFileSync(pf, '\uFEFF' + body, 'utf8');
+ // The fixture really is BOM-prefixed on disk, so this cannot pass by writing a plain file.
+ assert.deepStrictEqual([...fs.readFileSync(pf).slice(0, 3)], [0xef, 0xbb, 0xbf]);
+
+ const cli = capturingCli();
+ const r = await runMain(['--env', 'https://x/', '--app-id', 'a1', '--code-file', 'p.tsx',
+ '--prompt-file', pf, '--agent-message', 'm'], cli);
+
+ assert.strictEqual(r.ok, true);
+ assert.strictEqual(cli.calls[0].prompt.charCodeAt(0) !== 0xFEFF, true,
+ 'the prompt must not start with a BOM');
+ assert.strictEqual(cli.calls[0].prompt, body, 'and the rest must be untouched');
+});
+
+// A BOM in the MIDDLE is content, not an encoding marker, so it must survive — stripping every
+// U+FEFF would be a different bug in the same place.
+test('a U+FEFF inside the prompt body is preserved', async () => {
+ const d = tmp();
+ const pf = path.join(d, 'prompt.txt');
+ const body = 'Line one\nmid\uFEFFdle\nLine three';
+ fs.writeFileSync(pf, body, 'utf8');
+ const cli = capturingCli();
+ await runMain(['--env', 'https://x/', '--app-id', 'a1', '--code-file', 'p.tsx', '--prompt-file', pf], cli);
+ assert.strictEqual(cli.calls[0].prompt, body, 'only a LEADING BOM is an encoding marker');
+});
+
+// Adversarial review (astra HIGH 3 / grok MEDIUM 4). The wrapper OMITS `--add-to-sitemap` on an
+// update as a backstop, but omission is not an answer to an explicit contradictory request: the
+// caller believes a placement happened and it never did. The docs claimed "refused"; now it is.
+test('--add-to-sitemap combined with --page-id is refused, not silently dropped', async () => {
+ const cli = capturingCli();
+ const r = await runMain(['--env', 'https://x/', '--app-id', 'a1', '--code-file', 'p.tsx',
+ '--page-id', '9f1b2c3d-4e5f-4a6b-8c9d-0e1f2a3b4c5d', '--prompt', 'p', '--add-to-sitemap'], cli);
+ assert.strictEqual(r.ok, false);
+ assert.match(r.payload.error, /cannot be combined with --page-id/);
+ assert.strictEqual(cli.calls.length, 0, 'nothing may be uploaded on a contradictory request');
+});
+
+// grok MEDIUM 5 — `upload()` substitutes `Generative page <name>` for a blank prompt. That is fine
+// when no prompt was supplied, but a caller who passed --prompt-file asked for THAT text, and
+// deploying a generated placeholder instead is exactly the provenance break this path exists to
+// prevent. A blank, newline-only or BOM-only file is the realistic way it happens.
+test('a prompt file that resolves to empty is refused rather than silently defaulted', async () => {
+ const d = tmp();
+ for (const [label, body] of [['blank', ''], ['newline-only', '\n'], ['BOM-only', '\uFEFF'], ['whitespace', ' \n ']]) {
+ const pf = path.join(d, `p-${label}.txt`);
+ fs.writeFileSync(pf, body, 'utf8');
+ const cli = capturingCli();
+ const r = await runMain(['--env', 'https://x/', '--app-id', 'a1', '--code-file', 'p.tsx',
+ '--name', 'NamedPage', '--prompt-file', pf], cli);
+ assert.strictEqual(r.ok, false, `${label} must be refused`);
+ assert.match(r.payload.error, /resolved to empty/);
+ assert.strictEqual(cli.calls.length, 0, `${label}: nothing may be uploaded`);
+ }
+ // CONTROL: a file with real content still deploys, so this is not a blanket refusal.
+ const good = path.join(d, 'good.txt');
+ fs.writeFileSync(good, 'A real approved prompt', 'utf8');
+ const cli = capturingCli();
+ const r = await runMain(['--env', 'https://x/', '--app-id', 'a1', '--code-file', 'p.tsx', '--prompt-file', good], cli);
+ assert.strictEqual(r.ok, true);
+ assert.strictEqual(cli.calls[0].prompt, 'A real approved prompt');
+});
+
+// astra HIGH 3b — the worse half. A CREATE that asked for placement, crashed mid-flight and was
+// recovered as an UPDATE leaves the page deployed but absent from the app's navigation, and the old
+// code returned plain success. An unreachable page is an incomplete deployment, not a success.
+test('a page deployed but left out of the sitemap is reported as incomplete, with its id', async () => {
+ const cli = {
+ calls: [],
+ factory: () => ({ upload: async (o) => { cli.calls.push(o); return { pageId: 'f3ea07fc-bd57-4d73-af69-b2b64d3ccd85', sitemapPending: true }; } }),
+ };
+ const r = await runMain(['--env', 'https://x/', '--app-id', 'a1', '--code-file', 'p.tsx',
+ '--name', 'N', '--prompt', 'p', '--add-to-sitemap'], cli);
+ assert.strictEqual(r.ok, false, 'an unplaced page is not a successful deployment');
+ assert.strictEqual(r.payload.pageId, 'f3ea07fc-bd57-4d73-af69-b2b64d3ccd85',
+ 'the id must still be reported so the operator can place it');
+ assert.match(r.payload.error, /NOT added to the sitemap/);
+});
+
+test('an unreadable prompt file fails closed instead of deploying a default prompt', async () => { const cli = capturingCli();
+ const r = await runMain(['--env', 'https://x/', '--app-id', 'a1', '--code-file', 'p.tsx',
+ '--prompt-file', path.join(tmp(), 'missing.txt')], cli);
+ assert.strictEqual(r.ok, false);
+ assert.match(r.payload.error, /could not be read/);
+ assert.strictEqual(cli.calls.length, 0);
+});
+
+// The POINT of the file transport. Even with the hostile text, the Windows command line pac is
+// handed must not contain the prompt — if it does, cmd.exe gets to reinterpret it and the live
+// "Parse failed on: Inspection" failure is back.
+test('WINDOWS: the prompt never appears on the command line pac is invoked with', async () => {
+ const seen = [];
+ // upload() snapshots the environment with `genpage list` before creating, so the double has to
+ // answer that too — an empty-but-VALID listing, otherwise it fails closed before ever uploading.
+ const cli = makeGenpageCli('https://contoso.crm.dynamics.com/', {
+ run: async (args) => {
+ seen.push(args);
+ if (args.includes('list')) {
+ return { status: 0, stdout: 'Connected as [email protected]\nRetrieving generated pages...\nFound 0 generated page(s):\n', stderr: '' };
+ }
+ return { status: 0, stdout: 'Page ID: 13ecbc57-a3a4-4132-b0a2-a6c6b12691e8', stderr: '' };
+ },
+ sleep: async () => {},
+ });
+ await cli.upload({ appId: 'a1', codeFile: 'page.tsx', name: 'Facilities Inspection Live Overview', prompt: HOSTILE_PROMPT, agentMessage: 'msg' });
+
+ const args = seen.find((a) => a.includes('upload'));
+ assert.ok(args, `pac upload should have been invoked; saw ${JSON.stringify(seen)}`);
+ assert.ok(args.includes('--prompt-file'), `prompt must be delivered by file; got ${JSON.stringify(args)}`);
+ assert.ok(!args.includes('--prompt'), 'the inline --prompt flag must not be used');
+
+ // Render the ACTUAL Windows command line and prove the hostile text is absent from it.
+ // Fragments must be unique to the PROMPT: `--name` is legitimately passed inline (a short,
+ // caller-controlled value), and the first version of this test matched the quoted name instead
+ // of the prompt — a test that would have failed on correct code.
+ const win = buildPacInvocation(args, 'win32');
+ for (const fragment of ['résumé', '$(whoami)', '<b>bold</b>', '%PATH%', "apostrophe's"]) {
+ assert.ok(!win.command.includes(fragment),
+ `prompt fragment ${JSON.stringify(fragment)} leaked onto the command line:\n${win.command}`);
+ }
+ // Controls, so this cannot pass merely because the command line is empty or the probe is reading
+ // the wrong string: the inline name IS there, and so is the file flag that replaced --prompt.
+ assert.ok(win.command.includes('Facilities Inspection Live Overview'),
+ `expected the inline --name on the command line, got:\n${win.command}`);
+ assert.ok(win.command.includes('--prompt-file'), `expected --prompt-file, got:\n${win.command}`);
+});
+
+// The standalone skill needs flags /app-builder must never send. They are opt-in for that reason,
+// and `--add-to-sitemap` carries an extra rule: pac rejects it together with --page-id, and adding
+// a sitemap entry on an UPDATE would duplicate the subarea. Enforced in the wrapper so every caller
+// inherits it rather than each one restating the rule in prose.
+test('the standalone flags are emitted, and --add-to-sitemap only on a create', async () => {
+ const seen = [];
+ // The double must echo back the page id it was given: upload() refuses an UPDATE whose returned
+ // Page ID differs from the one requested (a real guard against pac silently writing a different
+ // page), so a fixed id would fail the update leg for the wrapper's own correct reason.
+ const mk = () => makeGenpageCli('https://contoso.crm.dynamics.com/', {
+ run: async (args) => {
+ seen.push(args);
+ if (args.includes('list')) return { status: 0, stdout: 'Found 0 generated page(s):\n', stderr: '' };
+ const i = args.indexOf('--page-id');
+ const id = i === -1 ? '13ecbc57-a3a4-4132-b0a2-a6c6b12691e8' : args[i + 1];
+ return { status: 0, stdout: `Page ID: ${id}`, stderr: '' };
+ },
+ sleep: async () => {},
+ });
+
+ await mk().upload({
+ appId: 'a1', codeFile: 'p.tsx', name: 'New Page', prompt: 'p', agentMessage: 'm',
+ dataSources: 'account,contact', model: 'gpt-x', connectors: 'c.json', actions: 'a.json', addToSitemap: true,
+ });
+ const create = seen.find((a) => a.includes('upload'));
+ assert.deepStrictEqual(
+ ['--data-sources', '--model', '--connectors', '--actions', '--add-to-sitemap'].filter((f) => !create.includes(f)),
+ [], `a create should carry every requested flag; got ${JSON.stringify(create)}`);
+ // A CSV STRING must survive: the build passes an array, a CLI caller passes a string, and
+ // `dataSources.join(',')` on a string throws rather than degrading.
+ assert.strictEqual(create[create.indexOf('--data-sources') + 1], 'account,contact');
+
+ seen.length = 0;
+ // A REAL GUID: parsePageId only recognises a 36-char id, so a placeholder like 'p1' makes the
+ // wrapper report "returned no Page ID" — a failure of the double, not of the code under test.
+ const EXISTING = '9f1b2c3d-4e5f-4a6b-8c9d-0e1f2a3b4c5d';
+ await mk().upload({
+ appId: 'a1', pageId: EXISTING, codeFile: 'p.tsx', name: 'New Page', prompt: 'p', agentMessage: 'm',
+ dataSources: ['account', 'contact'], addToSitemap: true,
+ });
+ const update = seen.find((a) => a.includes('upload'));
+ assert.ok(!update.includes('--add-to-sitemap'),
+ `an UPDATE must not add a sitemap entry even when asked; got ${JSON.stringify(update)}`);
+ assert.ok(update.includes('--page-id'), 'and it must still be an update');
+ // The ARRAY shape still works — normalizing for strings must not break the build's caller.
+ assert.strictEqual(update[update.indexOf('--data-sources') + 1], 'account,contact');
+});
+
+// astra MEDIUM 8 — the option tests above call the LIBRARY directly and mostly check flag presence.
+// Astra mutated `main()` to drop forwarding of model/connectors/actions/addToSitemap, and replaced
+// the library's model and file arguments with "WRONG", and every committed test stayed green. So the
+// wiring from CLI flag → wrapper → actual pac invocation was unprotected.
+//
+// This drives the REAL wrapper through `main()` and asserts exact flag/value pairs on the captured
+// pac argv, with values distinct enough that a swap cannot pass.
+test('main forwards every option through the real wrapper to the pac invocation, by value', async () => {
+ const d = tmp();
+ const pf = path.join(d, 'prompt.txt');
+ fs.writeFileSync(pf, 'the approved prompt', 'utf8');
+
+ const seen = [];
+ // The wrapper deletes its temp dir in a `finally`, so the prompt file cannot be read after
+ // upload() returns. Capture the contents DURING the invocation instead.
+ let promptOnDisk = null;
+ const factory = (env) => makeGenpageCli(env, {
+ run: async (args) => {
+ seen.push(args);
+ const i = args.indexOf('--prompt-file');
+ if (i !== -1) promptOnDisk = fs.readFileSync(args[i + 1], 'utf8');
+ if (args.includes('list')) return { status: 0, stdout: 'Found 0 generated page(s):\n', stderr: '' };
+ return { status: 0, stdout: 'Page ID: 13ecbc57-a3a4-4132-b0a2-a6c6b12691e8', stderr: '' };
+ },
+ sleep: async () => {},
+ });
+
+ const r = await new Promise((resolve) => {
+ main([
+ '--env', 'https://contoso.crm.dynamics.com/', '--app-id', 'APPID-1', '--code-file', 'CODE.tsx',
+ '--name', 'NamedPage', '--data-sources', 'account,contact',
+ '--model', 'MODEL-9', '--connectors', 'CONN.json', '--actions', 'ACT.json',
+ '--prompt-file', pf, '--agent-message', 'msg', '--add-to-sitemap',
+ ], { makeGenpageCli: factory, emit: (ok, payload) => resolve({ ok, payload }) });
+ });
+ assert.strictEqual(r.ok, true, `expected success, got ${JSON.stringify(r.payload)}`);
+
+ const args = seen.find((a) => a.includes('upload'));
+ assert.ok(args, `pac upload should have been invoked; saw ${JSON.stringify(seen)}`);
+ const valueOf = (flag) => args[args.indexOf(flag) + 1];
+
+ // EXACT pairs. A dropped flag or a swapped value fails here, which is what the old tests missed.
+ assert.strictEqual(valueOf('--environment'), 'https://contoso.crm.dynamics.com/');
+ assert.strictEqual(valueOf('--app-id'), 'APPID-1');
+ assert.strictEqual(valueOf('--code-file'), 'CODE.tsx');
+ assert.strictEqual(valueOf('--name'), 'NamedPage');
+ assert.strictEqual(valueOf('--data-sources'), 'account,contact');
+ assert.strictEqual(valueOf('--model'), 'MODEL-9');
+ assert.strictEqual(valueOf('--connectors'), 'CONN.json');
+ assert.strictEqual(valueOf('--actions'), 'ACT.json');
+ assert.ok(args.includes('--add-to-sitemap'), 'a create that asked for placement must carry the flag');
+
+ // And the prompt still travels by FILE, with the file holding the approved text.
+ assert.ok(args.includes('--prompt-file'), 'the prompt must be delivered by file');
+ assert.strictEqual(promptOnDisk, 'the approved prompt',
+ 'the temp file must hold exactly what the caller supplied');
+});
+test('an /app-builder-shaped upload sends none of the standalone flags', async () => {
+ const seen = [];
+ const cli = makeGenpageCli('https://contoso.crm.dynamics.com/', {
+ run: async (args) => {
+ seen.push(args);
+ if (args.includes('list')) return { status: 0, stdout: 'Found 0 generated page(s):\n', stderr: '' };
+ return { status: 0, stdout: 'Page ID: 13ecbc57-a3a4-4132-b0a2-a6c6b12691e8', stderr: '' };
+ },
+ sleep: async () => {},
+ });
+ await cli.upload({ appId: 'a1', codeFile: 'p.tsx', name: 'N', prompt: 'p', agentMessage: 'm', dataSources: ['account'] });
+ const args = seen.find((a) => a.includes('upload'));
+ for (const f of ['--add-to-sitemap', '--model', '--connectors', '--actions']) {
+ assert.ok(!args.includes(f), `${f} must not appear unless asked; got ${JSON.stringify(args)}`);
+ }
+});
+
+// --- The update guard must survive the REAL wrapper, not just a capturing stub --------------------
+// Every negative test above supplies its OWN enumerator, so all of them keep passing even if the
+// wrapper stops exporting one and the guard silently turns itself off. These drive main() through
+// the real `makeGenpageCli` with only `run` faked, so the production handoff is what is asserted.
+
+// pac's env-wide listing, in the LIVE shape (auto-sized fixed-width columns) — an invented format is
+// correctly rejected as 'unrecognized', so a fixture that only LOOKS plausible tests the wrong path.
+const envListing = (ids) => {
+ const names = ids.map((_, i) => `Page${i}`);
+ const nameW = Math.max(4, ...names.map((n) => n.length));
+ const header = 'Page ID'.padEnd(37) + 'Name'.padEnd(nameW + 1) + 'Published';
+ const body = ids.map((id, i) => `${id} ${names[i].padEnd(nameW)} -`).join('\n');
+ return `Connected as [email protected]\nRetrieving generated pages...\n`
+ + `Found ${ids.length} generated page(s):\n\n${header}\n${body}\n`;
+};
+
+test('REAL wrapper: updating an id absent from the environment is refused and never uploads', async () => {
+ const seen = [];
+ const factory = (env) => makeGenpageCli(env, {
+ run: async (args) => {
+ seen.push(args);
+ if (args.includes('list')) return { status: 0, stdout: envListing(['9e1d3a20-0000-4000-8000-000000000001']), stderr: '' };
+ return { status: 0, stdout: 'Page ID: 13ecbc57-a3a4-4132-b0a2-a6c6b12691e8', stderr: '' };
+ },
+ sleep: async () => {},
+ });
+ const r = await new Promise((resolve) => {
+ main(['--env', 'https://contoso.crm.dynamics.com/', '--app-id', 'a1', '--code-file', 'c.tsx',
+ '--page-id', 'deadbeef-0000-4000-8000-00000000ffff', '--prompt', 'p'],
+ { makeGenpageCli: factory, emit: (ok, payload) => resolve({ ok, payload }) });
+ });
+ assert.strictEqual(r.ok, false, `an absent target must be refused; got ${JSON.stringify(r.payload)}`);
+ assert.match(r.payload.error, /does not exist in this environment/);
+ assert.deepStrictEqual(seen.filter((a) => a.includes('upload')), [],
+ 'pac upload must never run — it would CREATE a new unplaced page and report it as an update');
+});
+
+test('REAL wrapper: a target that DOES exist still updates (the guard blocks nothing legitimate)', async () => {
+ const id = '9e1d3a20-0000-4000-8000-000000000001';
+ const seen = [];
+ const factory = (env) => makeGenpageCli(env, {
+ run: async (args) => {
+ seen.push(args);
+ if (args.includes('list')) return { status: 0, stdout: envListing([id]), stderr: '' };
+ // The update reads current bindings first, so the fake must produce what pac produces: a
+ // per-page directory holding a BOM-prefixed config.json.
+ if (args.includes('download')) {
+ const out = args[args.indexOf('--output-directory') + 1];
+ fs.mkdirSync(path.join(out, id), { recursive: true });
+ fs.writeFileSync(path.join(out, id, 'config.json'),
+ Buffer.from('\uFEFF' + JSON.stringify({ dataSources: ['contoso_ticket'] }), 'utf8'));
+ return { status: 0, stdout: 'Downloaded 1 page(s)', stderr: '' };
+ }
+ return { status: 0, stdout: `Page ID: ${id}`, stderr: '' };
+ },
+ sleep: async () => {},
+ });
+ const r = await new Promise((resolve) => {
+ main(['--env', 'https://contoso.crm.dynamics.com/', '--app-id', 'a1', '--code-file', 'c.tsx',
+ '--page-id', id.toUpperCase(), '--prompt', 'p'], // upper-case: pac's ids are case-insensitive
+ { makeGenpageCli: factory, emit: (ok, payload) => resolve({ ok, payload }) });
+ });
+ assert.strictEqual(r.ok, true, `an existing target must update; got ${JSON.stringify(r.payload)}`);
+ assert.ok(seen.some((a) => a.includes('upload')), 'pac upload must run for a real target');
+});
+
+test('a wrapper exposing NO environment listing is refused, not waved through', async () => {
+ // Gating the guard on `typeof cli.enumerateEnvironment === 'function'` was fail-OPEN: an older or
+ // custom wrapper skipped verification entirely and restored the original defect.
+ let uploads = 0;
+ const factory = () => ({ upload: async () => { uploads += 1; return { ok: true, pageId: 'x' }; } });
+ const r = await new Promise((resolve) => {
+ main(['--env', 'https://contoso.crm.dynamics.com/', '--app-id', 'a1', '--code-file', 'c.tsx',
+ '--page-id', 'deadbeef-0000-4000-8000-00000000ffff', '--prompt', 'p'],
+ { makeGenpageCli: factory, emit: (ok, payload) => resolve({ ok, payload }) });
+ });
+ assert.strictEqual(r.ok, false, `a wrapper that cannot prove existence must refuse; got ${JSON.stringify(r.payload)}`);
+ assert.match(r.payload.error, /exposes no environment listing/);
+ assert.strictEqual(uploads, 0, 'nothing may be uploaded when the target cannot be verified');
+});
+
+test('a wrapper exposing only the older enumerateEnv name is still verified', async () => {
+ let uploads = 0;
+ const factory = () => ({
+ enumerateEnv: async () => ({ ok: true, ids: ['9e1d3a20-0000-4000-8000-000000000001'] }),
+ upload: async () => { uploads += 1; return { ok: true, pageId: 'x' }; },
+ });
+ const r = await new Promise((resolve) => {
+ main(['--env', 'https://contoso.crm.dynamics.com/', '--app-id', 'a1', '--code-file', 'c.tsx',
+ '--page-id', 'deadbeef-0000-4000-8000-00000000ffff', '--prompt', 'p'],
+ { makeGenpageCli: factory, emit: (ok, payload) => resolve({ ok, payload }) });
+ });
+ assert.strictEqual(r.ok, false, 'the alternate enumerator name must be used, not ignored');
+ assert.match(r.payload.error, /does not exist in this environment/);
+ assert.strictEqual(uploads, 0);
+});
+
+// --- The provenance rule lives in the WRAPPER; assert it there ------------------------------------
+// The standalone refusal is a second line of defence. /app-builder calls upload() directly, so the
+// fabrication this fixes is only actually prevented by the wrapper's own fallback rule.
+test('wrapper: an explicitly empty agent message is sent verbatim, never replaced with a default', async () => {
+ const read = {};
+ const cli = makeGenpageCli('https://contoso.crm.dynamics.com/', {
+ run: async (args) => {
+ const i = args.indexOf('--agent-message-file');
+ if (i !== -1) read.text = fs.readFileSync(args[i + 1], 'utf8');
+ if (args.includes('list')) return { status: 0, stdout: 'Found 0 generated page(s):\n', stderr: '' };
+ return { status: 0, stdout: 'Page ID: 13ecbc57-a3a4-4132-b0a2-a6c6b12691e8', stderr: '' };
+ },
+ sleep: async () => {},
+ });
+ await cli.upload({ appId: 'a1', codeFile: 'p.tsx', name: 'N', prompt: 'p', agentMessage: '' });
+ assert.strictEqual(read.text, '', 'an empty agent message must reach pac as written, not as fabricated provenance');
+});
+
+test('wrapper: an OMITTED agent message still gets the default (that fallback is deliberate)', async () => {
+ const read = {};
+ const mk = () => makeGenpageCli('https://contoso.crm.dynamics.com/', {
+ run: async (args) => {
+ const i = args.indexOf('--agent-message-file');
+ if (i !== -1) read.text = fs.readFileSync(args[i + 1], 'utf8');
+ if (args.includes('list')) return { status: 0, stdout: 'Found 0 generated page(s):\n', stderr: '' };
+ return { status: 0, stdout: 'Page ID: 13ecbc57-a3a4-4132-b0a2-a6c6b12691e8', stderr: '' };
+ },
+ sleep: async () => {},
+ });
+ await mk().upload({ appId: 'a1', codeFile: 'p.tsx', name: 'N', prompt: 'p' });
+ assert.strictEqual(read.text, 'Authored by app-builder', 'omission is not a claim, so the default applies');
+ await mk().upload({ appId: 'a1', codeFile: 'p.tsx', name: 'N', prompt: 'p', agentMessage: null });
+ assert.strictEqual(read.text, 'Authored by app-builder', 'null is omission too');
+});
+
+// --- #G1: an update must not silently UNBIND the page ---------------------------------------------
+// LIVE-REPRODUCED: pac rewrites the binding list from the flags it is given, so an update that omits
+// `--data-sources` persists `[]`. The page goes on querying the table while its stored binding is
+// gone — and the Phase 7.5 fix-redeploy command in verify-flow.md omits exactly that flag.
+test('an update that says nothing about data sources PRESERVES the existing bindings', async () => {
+ const cli = capturingCli({ liveDataSources: ['contoso_ticket', 'contoso_asset'] });
+ const r = await new Promise((resolve) => {
+ main(['--env', 'https://contoso.crm.dynamics.com/', '--app-id', 'a1', '--code-file', 'c.tsx',
+ '--page-id', '9f1b2c3d-4e5f-4a6b-8c9d-0e1f2a3b4c5d', '--prompt', 'fix the sort handler'],
+ { makeGenpageCli: cli.factory, emit: (ok, payload) => resolve({ ok, payload }) });
+ });
+ assert.strictEqual(r.ok, true, `the update must succeed; got ${JSON.stringify(r.payload)}`);
+ assert.deepStrictEqual(cli.calls[0].dataSources, ['contoso_ticket', 'contoso_asset'],
+ 'the page\'s existing bindings must be re-sent, not dropped');
+});
+
+test('an explicit --data-sources still WINS over the preserved list', async () => {
+ const cli = capturingCli({ liveDataSources: ['contoso_ticket'] });
+ const r = await new Promise((resolve) => {
+ main(['--env', 'https://contoso.crm.dynamics.com/', '--app-id', 'a1', '--code-file', 'c.tsx',
+ '--page-id', '9f1b2c3d-4e5f-4a6b-8c9d-0e1f2a3b4c5d', '--prompt', 'p', '--data-sources', 'contoso_other'],
+ { makeGenpageCli: cli.factory, emit: (ok, payload) => resolve({ ok, payload }) });
+ });
+ assert.strictEqual(r.ok, true);
+ assert.strictEqual(cli.calls[0].dataSources, 'contoso_other', 'an explicit value is the caller\'s intent');
+});
+
+test('--clear-data-sources really unbinds, and does not read the old list first', async () => {
+ let probed = false;
+ const factory = () => ({
+ enumerateEnvironment: async () => ({ ok: true, ids: ['9f1b2c3d-4e5f-4a6b-8c9d-0e1f2a3b4c5d'] }),
+ download: async () => { probed = true; return true; },
+ upload: async (o) => { probed = probed || false; return { pageId: o.pageId, _ds: o.dataSources }; },
+ });
+ const seen = [];
+ const capture = () => {
+ const f = factory();
+ return { ...f, upload: async (o) => { seen.push(o); return { pageId: o.pageId }; } };
+ };
+ const r = await new Promise((resolve) => {
+ main(['--env', 'https://contoso.crm.dynamics.com/', '--app-id', 'a1', '--code-file', 'c.tsx',
+ '--page-id', '9f1b2c3d-4e5f-4a6b-8c9d-0e1f2a3b4c5d', '--prompt', 'p', '--clear-data-sources'],
+ { makeGenpageCli: capture, emit: (ok, payload) => resolve({ ok, payload }) });
+ });
+ assert.strictEqual(r.ok, true, `a deliberate unbind must be allowed; got ${JSON.stringify(r.payload)}`);
+ assert.strictEqual(seen[0].dataSources, undefined, 'nothing is sent, so pac clears the bindings');
+ assert.strictEqual(probed, false, 'a deliberate clear need not read the list it is discarding');
+});
+
+test('an unreadable current binding list refuses the update rather than unbinding the page', async () => {
+ // Fail CLOSED: "I could not read it" must never become "it had none".
+ let uploads = 0;
+ const factory = () => ({
+ enumerateEnvironment: async () => ({ ok: true, ids: ['9f1b2c3d-4e5f-4a6b-8c9d-0e1f2a3b4c5d'] }),
+ download: async () => true, // writes nothing — the config is then missing
+ upload: async () => { uploads += 1; return { pageId: 'x' }; },
+ });
+ const r = await new Promise((resolve) => {
+ main(['--env', 'https://contoso.crm.dynamics.com/', '--app-id', 'a1', '--code-file', 'c.tsx',
+ '--page-id', '9f1b2c3d-4e5f-4a6b-8c9d-0e1f2a3b4c5d', '--prompt', 'p'],
+ { makeGenpageCli: factory, emit: (ok, payload) => resolve({ ok, payload }) });
+ });
+ assert.strictEqual(r.ok, false, 'an unreadable binding list must not be treated as "no bindings"');
+ assert.match(r.payload.error, /--clear-data-sources/, 'the refusal names the deliberate-unbind escape hatch');
+ assert.strictEqual(uploads, 0);
+});
+
+test('a CREATE never probes for bindings (there is nothing to preserve)', async () => {
+ let probed = false;
+ const seen = [];
+ const factory = () => ({
+ download: async () => { probed = true; return true; },
+ upload: async (o) => { seen.push(o); return { pageId: '13ecbc57-a3a4-4132-b0a2-a6c6b12691e8' }; },
+ });
+ const r = await new Promise((resolve) => {
+ main(['--env', 'https://contoso.crm.dynamics.com/', '--app-id', 'a1', '--code-file', 'c.tsx',
+ '--name', 'New Page', '--prompt', 'p', '--data-sources', 'contoso_ticket'],
+ { makeGenpageCli: factory, emit: (ok, payload) => resolve({ ok, payload }) });
+ });
+ assert.strictEqual(r.ok, true, `a create must not be gated; got ${JSON.stringify(r.payload)}`);
+ assert.strictEqual(probed, false, 'a create has no existing bindings to read');
+ assert.strictEqual(seen[0].dataSources, 'contoso_ticket');
+});
+
+// Mutation-exposed: an over-strict shape check refused a config that parses but carries no
+// `dataSources` key. That is how a genuinely UNBOUND page looks, and `download-model-app.js` reads
+// it as "no bindings" (`config.dataSources || []`) — so refusing here would have blocked updating
+// any unbound page. Unknown means MISSING or UNPARSEABLE, nothing else.
+test('a page whose config has no dataSources key updates normally (it simply has no bindings)', async () => {
+ const seen = [];
+ const factory = () => ({
+ enumerateEnvironment: async () => ({ ok: true, ids: ['9f1b2c3d-4e5f-4a6b-8c9d-0e1f2a3b4c5d'] }),
+ download: async ({ outputDir, pageIds }) => {
+ for (const pid of (pageIds || [])) {
+ fs.mkdirSync(path.join(outputDir, pid), { recursive: true });
+ fs.writeFileSync(path.join(outputDir, pid, 'config.json'),
+ Buffer.from('\uFEFF' + JSON.stringify({ model: 'some-model' }), 'utf8'));
+ }
+ return true;
+ },
+ upload: async (o) => { seen.push(o); return { pageId: o.pageId }; },
+ });
+ const r = await new Promise((resolve) => {
+ main(['--env', 'https://contoso.crm.dynamics.com/', '--app-id', 'a1', '--code-file', 'c.tsx',
+ '--page-id', '9f1b2c3d-4e5f-4a6b-8c9d-0e1f2a3b4c5d', '--prompt', 'p'],
+ { makeGenpageCli: factory, emit: (ok, payload) => resolve({ ok, payload }) });
+ });
+ assert.strictEqual(r.ok, true, `an unbound page must still be updatable; got ${JSON.stringify(r.payload)}`);
+ assert.deepStrictEqual(seen[0].dataSources, [], 'nothing to preserve, so nothing is sent');
+});
+
+test('a config that is PRESENT but unparseable refuses the update', async () => {
+ // The distinction that matters: corrupt or non-object bytes are UNKNOWN bindings, not absent ones.
+ // `{ truncated` fails JSON.parse; `[]`, `null` and `42` parse but are not a config object, and
+ // reading any of them as "no bindings" would silently unbind the page.
+ for (const body of ['{ truncated', '[]', 'null', '42']) {
+ let uploads = 0;
+ const factory = () => ({
+ enumerateEnvironment: async () => ({ ok: true, ids: ['9f1b2c3d-4e5f-4a6b-8c9d-0e1f2a3b4c5d'] }),
+ download: async ({ outputDir, pageIds }) => {
+ for (const pid of (pageIds || [])) {
+ fs.mkdirSync(path.join(outputDir, pid), { recursive: true });
+ fs.writeFileSync(path.join(outputDir, pid, 'config.json'), Buffer.from(body, 'utf8'));
+ }
+ return true;
+ },
+ upload: async () => { uploads += 1; return { pageId: 'x' }; },
+ });
+ // eslint-disable-next-line no-await-in-loop
+ const r = await new Promise((resolve) => {
+ main(['--env', 'https://contoso.crm.dynamics.com/', '--app-id', 'a1', '--code-file', 'c.tsx',
+ '--page-id', '9f1b2c3d-4e5f-4a6b-8c9d-0e1f2a3b4c5d', '--prompt', 'p'],
+ { makeGenpageCli: factory, emit: (ok, payload) => resolve({ ok, payload }) });
+ });
+ assert.strictEqual(r.ok, false, `config body ${JSON.stringify(body)} must not be read as "no bindings"`);
+ assert.strictEqual(uploads, 0, `nothing may upload for config body ${JSON.stringify(body)}`);
+ }
+});
+
+// Regression: pac names the downloaded directory with its own casing of the page id. Joining the
+// CALLER's spelling passed on Windows (case-insensitive paths) and failed on Linux, where a
+// differently-cased --page-id lost the config and refused a perfectly good update.
+//
+// NOTE: this test is VACUOUS on a case-insensitive filesystem — Windows resolves the path either
+// way, so it passes there with or without the fix. It is a real guard only on Linux/macOS-CI, which
+// is precisely where the defect surfaced. Do not read a local pass as proof.
+test('the current bindings are found even when --page-id casing differs from pac\'s directory', async () => {
+ const canonical = '9f1b2c3d-4e5f-4a6b-8c9d-0e1f2a3b4c5d';
+ const seen = [];
+ const factory = () => ({
+ enumerateEnvironment: async () => ({ ok: true, ids: [canonical] }),
+ download: async ({ outputDir }) => {
+ // pac writes the directory in ITS casing, not the caller's.
+ fs.mkdirSync(path.join(outputDir, canonical), { recursive: true });
+ fs.writeFileSync(path.join(outputDir, canonical, 'config.json'),
+ Buffer.from('\uFEFF' + JSON.stringify({ dataSources: ['contoso_ticket'] }), 'utf8'));
+ return true;
+ },
+ upload: async (o) => { seen.push(o); return { pageId: o.pageId }; },
+ });
+ const r = await new Promise((resolve) => {
+ main(['--env', 'https://contoso.crm.dynamics.com/', '--app-id', 'a1', '--code-file', 'c.tsx',
+ '--page-id', canonical.toUpperCase(), '--prompt', 'p'],
+ { makeGenpageCli: factory, emit: (ok, payload) => resolve({ ok, payload }) });
+ });
+ assert.strictEqual(r.ok, true, `casing must not lose the config; got ${JSON.stringify(r.payload)}`);
+ assert.deepStrictEqual(seen[0].dataSources, ['contoso_ticket'], 'the bindings must still be preserved');
+});
+
+// --- Review follow-ups on the unbind guard --------------------------------------------------------
+
+// `parseArgs` yields the STRING "false" for `--clear-data-sources=false`, which is truthy. Testing
+// the raw flag read an explicit refusal to clear as permission to clear — unbinding the page the
+// guard exists to protect.
+test('--clear-data-sources=false does NOT authorise clearing; bindings are still preserved', async () => {
+ const cli = capturingCli({ liveDataSources: ['contoso_ticket'] });
+ const r = await new Promise((resolve) => {
+ main(['--env', 'https://contoso.crm.dynamics.com/', '--app-id', 'a1', '--code-file', 'c.tsx',
+ '--page-id', '9f1b2c3d-4e5f-4a6b-8c9d-0e1f2a3b4c5d', '--prompt', 'p', '--clear-data-sources=false'],
+ { makeGenpageCli: cli.factory, emit: (ok, payload) => resolve({ ok, payload }) });
+ });
+ assert.strictEqual(r.ok, true, `the update must proceed; got ${JSON.stringify(r.payload)}`);
+ assert.deepStrictEqual(cli.calls[0].dataSources, ['contoso_ticket'],
+ 'an explicit "false" must not be read as permission to unbind');
+});
+
+test('--clear-data-sources combined with --data-sources is refused, not silently resolved', async () => {
+ let uploads = 0;
+ const factory = () => ({
+ enumerateEnvironment: async () => ({ ok: true, ids: ['9f1b2c3d-4e5f-4a6b-8c9d-0e1f2a3b4c5d'] }),
+ upload: async () => { uploads += 1; return { pageId: 'x' }; },
+ });
+ const r = await new Promise((resolve) => {
+ main(['--env', 'https://contoso.crm.dynamics.com/', '--app-id', 'a1', '--code-file', 'c.tsx',
+ '--page-id', '9f1b2c3d-4e5f-4a6b-8c9d-0e1f2a3b4c5d', '--prompt', 'p',
+ '--clear-data-sources', '--data-sources', 'contoso_other'],
+ { makeGenpageCli: factory, emit: (ok, payload) => resolve({ ok, payload }) });
+ });
+ assert.strictEqual(r.ok, false, 'one unbinds and the other binds — guessing is not an option');
+ assert.match(r.payload.error, /cannot be combined/);
+ assert.strictEqual(uploads, 0);
+});
+
+// A PRESENT but non-array `dataSources` is malformed, not absent. Reading it as "no bindings" would
+// unbind the page on the strength of a value we could not interpret.
+test('a dataSources value of the wrong type refuses the update, rather than unbinding', async () => {
+ for (const bad of ['"contoso_ticket"', '42', '{"a":1}']) {
+ let uploads = 0;
+ const factory = () => ({
+ enumerateEnvironment: async () => ({ ok: true, ids: ['9f1b2c3d-4e5f-4a6b-8c9d-0e1f2a3b4c5d'] }),
+ download: async ({ outputDir, pageIds }) => {
+ for (const pid of (pageIds || [])) {
+ fs.mkdirSync(path.join(outputDir, pid), { recursive: true });
+ fs.writeFileSync(path.join(outputDir, pid, 'config.json'),
+ Buffer.from(`{"dataSources":${bad}}`, 'utf8'));
+ }
+ return true;
+ },
+ upload: async () => { uploads += 1; return { pageId: 'x' }; },
+ });
+ // eslint-disable-next-line no-await-in-loop
+ const r = await new Promise((resolve) => {
+ main(['--env', 'https://contoso.crm.dynamics.com/', '--app-id', 'a1', '--code-file', 'c.tsx',
+ '--page-id', '9f1b2c3d-4e5f-4a6b-8c9d-0e1f2a3b4c5d', '--prompt', 'p'],
+ { makeGenpageCli: factory, emit: (ok, payload) => resolve({ ok, payload }) });
+ });
+ assert.strictEqual(r.ok, false, `dataSources ${bad} is malformed, not empty`);
+ assert.strictEqual(uploads, 0, `nothing may upload for dataSources ${bad}`);
+ }
+});
+
+// The real `emitResult` calls process.exit(1), so a `return emit(...)` inside the try/finally never
+// reaches the cleanup. The probe directory — holding the page's downloaded source and prompt — was
+// left on disk. The error is recorded and emitted AFTER cleanup instead.
+test('the probe directory is removed even when the read fails', async () => {
+ const probes = [];
+ const factory = () => ({
+ enumerateEnvironment: async () => ({ ok: true, ids: ['9f1b2c3d-4e5f-4a6b-8c9d-0e1f2a3b4c5d'] }),
+ download: async ({ outputDir }) => { probes.push(outputDir); return true; }, // writes no config
+ upload: async () => ({ pageId: 'x' }),
+ });
+ const r = await new Promise((resolve) => {
+ main(['--env', 'https://contoso.crm.dynamics.com/', '--app-id', 'a1', '--code-file', 'c.tsx',
+ '--page-id', '9f1b2c3d-4e5f-4a6b-8c9d-0e1f2a3b4c5d', '--prompt', 'p'],
+ { makeGenpageCli: factory, emit: (ok, payload) => resolve({ ok, payload }) });
+ });
+ assert.strictEqual(r.ok, false, 'the unreadable config still refuses');
+ assert.strictEqual(probes.length, 1, 'a probe directory was created');
+ assert.strictEqual(fs.existsSync(probes[0]), false,
+ `the probe directory must be cleaned up on the failure path; ${probes[0]} survived`);
+});
+
+// Cleanup is best-effort: its failure must not replace the outcome of an otherwise good update.
+test('a cleanup failure does not fail an update whose bindings were read', async () => {
+ const cli = capturingCli({ liveDataSources: ['contoso_ticket'] });
+ const realRm = fs.rmSync;
+ fs.rmSync = () => { throw new Error('EPERM'); };
+ let r;
+ try {
+ r = await new Promise((resolve) => {
+ main(['--env', 'https://contoso.crm.dynamics.com/', '--app-id', 'a1', '--code-file', 'c.tsx',
+ '--page-id', '9f1b2c3d-4e5f-4a6b-8c9d-0e1f2a3b4c5d', '--prompt', 'p'],
+ { makeGenpageCli: cli.factory, emit: (ok, payload) => resolve({ ok, payload }) });
+ });
+ } finally { fs.rmSync = realRm; }
+ assert.strictEqual(r.ok, true, `a temp-dir cleanup failure must not abort the update; got ${JSON.stringify(r.payload)}`);
+ assert.deepStrictEqual(cli.calls[0].dataSources, ['contoso_ticket']);
+});
+
+// --- PR review: --prompt-file must deliver the file byte-for-byte -------------------------------
+// A trailing newline used to be stripped here while the direct /app-builder wrapper path preserved
+// it, so the SAME text deployed differently depending on which path carried it. This transport
+// exists precisely so an arbitrary prompt survives verbatim.
+test('a prompt file reaches pac byte-for-byte, including a trailing newline', async () => {
+ const d = tmp();
+ const pf = path.join(d, 'prompt.txt');
+ const BODY = 'Conversation with 2 prompts:\n1. Build a list\n2. Add a search box\n';
+ fs.writeFileSync(pf, BODY, 'utf8');
+
+ let onDisk = null;
+ const factory = (env) => makeGenpageCli(env, {
+ run: async (args) => {
+ const i = args.indexOf('--prompt-file');
+ if (i !== -1) onDisk = fs.readFileSync(args[i + 1], 'utf8');
+ if (args.includes('list')) return { status: 0, stdout: 'Found 0 generated page(s):\n', stderr: '' };
+ return { status: 0, stdout: 'Page ID: 13ecbc57-a3a4-4132-b0a2-a6c6b12691e8', stderr: '' };
+ },
+ sleep: async () => {},
+ });
+ const r = await new Promise((resolve) => {
+ main(['--env', 'https://contoso.crm.dynamics.com/', '--app-id', 'a1', '--code-file', 'c.tsx',
+ '--name', 'P', '--prompt-file', pf, '--agent-message', 'm'],
+ { makeGenpageCli: factory, emit: (ok, payload) => resolve({ ok, payload }) });
+ });
+ assert.strictEqual(r.ok, true, `expected success, got ${JSON.stringify(r.payload)}`);
+ assert.strictEqual(onDisk, BODY,
+ 'the prompt must reach pac exactly as written — no trailing-newline normalization');
+});
+
+// A BOM is an ENCODING MARKER, not content, so it is still removed — the one deliberate exception.
+test('a BOM is still stripped even though the rest of the file is passed through', async () => {
+ const d = tmp();
+ const pf = path.join(d, 'prompt.txt');
+ fs.writeFileSync(pf, Buffer.from('\uFEFFkeep this\n', 'utf8'));
+ let onDisk = null;
+ const factory = (env) => makeGenpageCli(env, {
+ run: async (args) => {
+ const i = args.indexOf('--prompt-file');
+ if (i !== -1) onDisk = fs.readFileSync(args[i + 1], 'utf8');
+ if (args.includes('list')) return { status: 0, stdout: 'Found 0 generated page(s):\n', stderr: '' };
+ return { status: 0, stdout: 'Page ID: 13ecbc57-a3a4-4132-b0a2-a6c6b12691e8', stderr: '' };
+ },
+ sleep: async () => {},
+ });
+ await new Promise((resolve) => {
+ main(['--env', 'https://contoso.crm.dynamics.com/', '--app-id', 'a1', '--code-file', 'c.tsx',
+ '--name', 'P', '--prompt-file', pf, '--agent-message', 'm'],
+ { makeGenpageCli: factory, emit: (ok, payload) => resolve({ ok, payload }) });
+ });
+ assert.strictEqual(onDisk, 'keep this\n', 'the BOM goes, the trailing newline stays');
+});
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 7bdfc606b..6ac07b532 100644
--- a/plugins/model-apps/scripts/tests/hardening2-real-bundle.test.js
+++ b/plugins/model-apps/scripts/tests/hardening2-real-bundle.test.js
@@ -343,4 +343,101 @@ test('REAL BUNDLE: an unrecognised tab or section property is refused, not silen
// 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
+});
+// --- The real SDK's addElement POSITION contract -------------------------------------------------
+// The row re-pack that follows a span widening inserts a row immediately below the widened one. It
+// does that with `addElement(..., { position: { index } })`, and the SDK resolves position as
+// `undefined | 'end' | 'start' | { index } | { before } | { after } ` — testing `'index' in position`.
+//
+// A BARE NUMBER therefore throws, and the test mock originally accepted one: the whole suite passed
+// green while every real insertion failed with "Cannot use 'in' operator to search for 'index' in 1".
+// Only the real bundle can hold this contract honest, so it is pinned here.
+test('real SDK: addElement inserts at { position: { index } } and REJECTS a bare number', async () => {
+ const sdk = await freshSdk(null, null);
+ const art = await sdk.createArtifact('form', {
+ name: 'PositionContract', entityLogicalName: 'new_customer', formType: 'Main', status: 'Draft',
+ });
+ await sdk.addElement('form', art.id, '/tabs', {
+ name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [{ name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 2,
+ rows: [{ cells: [{ control: { fieldName: 'new_name' } }] }, { cells: [{ control: { fieldName: 'new_tier' } }] }] }] }],
+ });
+ await sdk.removeElement('form', art.id, '/tabs/0');
+ const rowsPtr = '/tabs/0/columns/0/sections/0/rows';
+
+ // Insert BETWEEN the two existing rows — the case the re-pack depends on.
+ await sdk.addElement('form', art.id, rowsPtr, { cells: [] }, { position: { index: 1 } });
+ let form = await sdk.getArtifact('form', art.id);
+ let rows = form.tabs[0].columns[0].sections[0].rows;
+ assert.strictEqual(rows.length, 3, 'a row was inserted');
+ assert.strictEqual((rows[0].cells[0].control || {}).fieldName, 'new_name');
+ assert.strictEqual((rows[1].cells || []).length, 0, 'the NEW row lands at index 1, between the two');
+ assert.strictEqual((rows[2].cells[0].control || {}).fieldName, 'new_tier');
+
+ // The contract the mock got wrong: a bare number is not a position. Written as an explicit
+ // try/catch with a real `await` so the repo's "every SDK call is awaited" guard still sees it —
+ // an `assert.rejects(() => sdk...)` thunk hides the call from that check.
+ let threw = null;
+ try {
+ await sdk.addElement('form', art.id, rowsPtr, { cells: [] }, { position: 1 });
+ } catch (e) { threw = e; }
+ assert.ok(threw && /index/.test(String(threw.message)),
+ `a bare numeric position must be rejected, not silently appended; got ${threw && threw.message}`);
+
+ // Omitting position still appends, which is what every other call site relies on.
+ await sdk.addElement('form', art.id, rowsPtr, { cells: [] });
+ form = await sdk.getArtifact('form', art.id);
+ rows = form.tabs[0].columns[0].sections[0].rows;
+ assert.strictEqual(rows.length, 4, 'an omitted position appends');
+ assert.strictEqual((rows[3].cells || []).length, 0);
+});
+
+// The row re-pack moves existing cells between rows with `updateElement`, having created the new row
+// EMPTY with `addElement`. That strategy rests on two real-engine behaviours the mock cannot prove:
+// `updateElement` must REPLACE a cells array rather than merge it, and a cell object moved between
+// rows must keep its id (a re-keyed cell loses maker-edited control state). Pinned against the real
+// bundle because the mock's permissiveness already hid one contract bug on this exact call.
+test('real SDK: the row re-pack sequence preserves cell identity and lands the rows correctly', async () => {
+ const sdk = await freshSdk(null, null);
+ const art = await sdk.createArtifact('form', {
+ name: 'RepackSequence', entityLogicalName: 'new_customer', formType: 'Main', status: 'Draft',
+ });
+ await sdk.addElement('form', art.id, '/tabs', {
+ name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [{ name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 2,
+ rows: [{ cells: [{ control: { fieldName: 'new_name' } }, { control: { fieldName: 'new_tier' } }] }] }] }],
+ });
+ await sdk.removeElement('form', art.id, '/tabs/0');
+
+ const secPtr = '/tabs/0/columns/0/sections/0';
+ const before = await sdk.getArtifact('form', art.id);
+ const [cellA, cellB] = before.tabs[0].columns[0].sections[0].rows[0].cells;
+ assert.ok(cellA.id && cellB.id, 'the engine assigned cell ids');
+
+ // 1. Widen the first cell — the row now holds 2 + 1 = 3 columns of content in a 2-column section.
+ await sdk.updateElement('form', art.id, `${secPtr}/rows/0/cells/0`, { colspan: 2 });
+ // 2. Re-pack exactly as `repackRowAt` does: new EMPTY row directly below, then fill it, then
+ // rewrite the original row.
+ await sdk.addElement('form', art.id, `${secPtr}/rows`, { cells: [] }, { position: { index: 1 } });
+ const widened = await sdk.getArtifact('form', art.id);
+ const live = widened.tabs[0].columns[0].sections[0].rows[0].cells;
+ await sdk.updateElement('form', art.id, `${secPtr}/rows/1`, { cells: [live[1]] });
+ await sdk.updateElement('form', art.id, `${secPtr}/rows/0`, { cells: [live[0]] });
+
+ const after = await sdk.getArtifact('form', art.id);
+ const rows = after.tabs[0].columns[0].sections[0].rows;
+ assert.strictEqual(rows.length, 2, `the row split in two; got ${JSON.stringify(rows)}`);
+ assert.strictEqual(rows[0].cells.length, 1, 'updateElement REPLACED the cells array rather than merging it');
+ assert.strictEqual(rows[0].cells[0].control.fieldName, 'new_name');
+ assert.strictEqual(rows[0].cells[0].colspan, 2, 'the widened span survives the re-pack');
+ assert.strictEqual(rows[0].cells[0].id, cellA.id, 'the widened cell keeps its identity');
+ assert.strictEqual(rows[1].cells.length, 1);
+ assert.strictEqual(rows[1].cells[0].control.fieldName, 'new_tier');
+ assert.strictEqual(rows[1].cells[0].id, cellB.id, 'the displaced cell is MOVED, not re-keyed');
+
+ // Occupancy is now legal in every row — the defect was 3 columns of content in a 2-column section.
+ for (const r of rows) {
+ const used = r.cells.reduce((n, c) => n + (c.colspan || 1), 0);
+ assert.ok(used <= 2, `row exceeds the section width: ${JSON.stringify(r.cells)}`);
+ }
+});
diff --git a/plugins/model-apps/scripts/tests/sdk-build-pages-deploy.test.js b/plugins/model-apps/scripts/tests/sdk-build-pages-deploy.test.js
index 1a5262086..11c3a0ea9 100644
--- a/plugins/model-apps/scripts/tests/sdk-build-pages-deploy.test.js
+++ b/plugins/model-apps/scripts/tests/sdk-build-pages-deploy.test.js
@@ -459,3 +459,48 @@ test('changed-only selectedKeysOnly: uploads ONLY the selected page(s), never cl
assert.ok(!r.created.pageDeployedShas.detail, 'no deployed hash for the page we did not touch');
} finally { fs.rmSync(appDir, { recursive: true, force: true }); }
});
+
+// A page that SUPPLIES a blank prompt or agent message would otherwise have generated text deployed
+// in its place — the fabricated-provenance defect, reached through /app-builder rather than the
+// standalone CLI. The standalone path refuses it; this asserts app-builder refuses it too, and does
+// so BEFORE any upload so a bad spec cannot leave half the pages deployed.
+test('deploy: a page with a present-but-blank agent message HALTS before any upload', async () => {
+ const { appDir, spec } = makeTwoPageApp();
+ try {
+ spec.pages[0].agentMessage = ' \n'; // whitespace-only: a blank file is how this really arrives
+ const { sdk } = mockSdk();
+ const genpageCli = mockGenpageCli();
+ await assert.rejects(
+ runSdkBuild(spec, { sdk, apply: true, env: 'https://x', appDir, genpageCli, phases: PHASES }),
+ (e) => e && e.phase === 'pages' && e.code === 'pages-blank-provenance'
+ );
+ assert.strictEqual(genpageCli.uploads.length, 0, 'nothing may deploy when provenance is blank');
+ } finally { fs.rmSync(appDir, { recursive: true, force: true }); }
+});
+
+test('deploy: a page with a present-but-blank prompt HALTS before any upload', async () => {
+ const { appDir, spec } = makeTwoPageApp();
+ try {
+ spec.pages[0].prompt = '';
+ const { sdk } = mockSdk();
+ const genpageCli = mockGenpageCli();
+ await assert.rejects(
+ runSdkBuild(spec, { sdk, apply: true, env: 'https://x', appDir, genpageCli, phases: PHASES }),
+ (e) => e && e.phase === 'pages' && e.code === 'pages-blank-provenance'
+ );
+ assert.strictEqual(genpageCli.uploads.length, 0);
+ } finally { fs.rmSync(appDir, { recursive: true, force: true }); }
+});
+
+// The control: an ABSENT key is not a claim, so the wrapper's default still applies and the build
+// proceeds. Without this, the guard above could be satisfied by refusing every page.
+test('deploy: pages that omit prompt/agentMessage entirely still deploy', async () => {
+ const { appDir, spec } = makeTwoPageApp();
+ try {
+ for (const p of spec.pages) { delete p.prompt; delete p.agentMessage; }
+ const { sdk } = mockSdk();
+ const genpageCli = mockGenpageCli();
+ await runSdkBuild(spec, { sdk, apply: true, env: 'https://x', appDir, genpageCli, phases: PHASES });
+ assert.ok(genpageCli.uploads.length > 0, 'an omitted key is not an authoring mistake');
+ } finally { fs.rmSync(appDir, { recursive: true, force: true }); }
+});
diff --git a/plugins/model-apps/scripts/tests/sdk-build.test.js b/plugins/model-apps/scripts/tests/sdk-build.test.js
index 890761c10..44f0d5185 100644
--- a/plugins/model-apps/scripts/tests/sdk-build.test.js
+++ b/plugins/model-apps/scripts/tests/sdk-build.test.js
@@ -263,11 +263,28 @@ function mockSdk(opts = {}) {
// Generic mutation surface (mirrors the SDK). The mock does NOT mint layout ids (tests don't
// assert on them); it just maintains a coherent in-memory tree so getArtifact/firstSectionRowsPointer
// and reconcile see the effects of adds/removes.
- addElement: async (t, id, ptr, el) => { await Promise.resolve();
- calls.push({ name: 'addElement', args: [t, id, ptr, el] });
+ addElement: async (t, id, ptr, el, opts) => { await Promise.resolve();
+ calls.push({ name: 'addElement', args: [t, id, ptr, el, opts] });
const art = store[`${t}:${id}`] || (store[`${t}:${id}`] = { id });
const arr = jpGet(art, ptr);
- if (Array.isArray(arr)) arr.push(clone(el));
+ // Model the REAL SDK's position contract exactly, INCLUDING its failure mode. It resolves
+ // `undefined | 'end' | 'start' | { index } | { before } | { after }` and tests
+ // `'index' in position`, so a BARE NUMBER throws. A permissive mock that accepted a number
+ // hid exactly that bug: the suite passed green while every real insertion failed with
+ // "Cannot use 'in' operator to search for 'index' in 1".
+ if (Array.isArray(arr)) {
+ const pos = opts && opts.position;
+ let at;
+ if (pos === undefined || pos === 'end') at = arr.length;
+ else if (pos === 'start') at = 0;
+ else if (pos && typeof pos === 'object' && 'index' in pos) at = Math.max(0, Math.min(pos.index, arr.length));
+ else if (pos && typeof pos === 'object' && 'before' in pos) {
+ const n = arr.findIndex((x) => x && x.id === pos.before); at = n < 0 ? arr.length : n;
+ } else if (pos && typeof pos === 'object' && 'after' in pos) {
+ const n = arr.findIndex((x) => x && x.id === pos.after); at = n < 0 ? arr.length : n + 1;
+ } else throw new TypeError(`Cannot use 'in' operator to search for 'index' in ${pos}`);
+ arr.splice(at, 0, clone(el));
+ }
return clone(art);
},
updateElement: async (t, id, ptr, patch) => { await Promise.resolve();
@@ -1899,7 +1916,13 @@ test('form topology: a field sitting in the wrong section is MOVED, never duplic
await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
const moves = find(calls, 'moveElement');
assert.strictEqual(moves.length, 1, `exactly one move; saw ${moves.map((c) => `${c.args[2]} -> ${c.args[3]}`).join(', ')}`);
- assert.strictEqual(moves[0].args[3], '/tabs/0/columns/0/sections/1/rows/0/cells', 'moved INTO section_more');
+ // Row 1, not row 0. `section_more` is a ONE-column section whose row 0 already holds
+ // `new_obsolete`, so packing the relocated cell onto it would produce a two-cell row in a
+ // one-column section — a shape `rowsFromCells` never emits on the create path. The reconcile now
+ // uses that same packing rule, so it opens a new row instead.
+ assert.strictEqual(moves[0].args[3], '/tabs/0/columns/0/sections/1/rows/1/cells', 'moved INTO section_more, in a row that has space');
+ const seededRow = find(calls, 'addElement').find((c) => String(c.args[2]) === '/tabs/0/columns/0/sections/1/rows' && Array.isArray(c.args[3].cells) && c.args[3].cells.length === 0);
+ assert.ok(seededRow, 'and the row it moves into was seeded empty rather than overfilling row 0');
const dupAdds = find(calls, 'addElement').filter((c) => /\/rows$/.test(String(c.args[2])) && ((c.args[3].cells || [])[0] || {}).control && c.args[3].cells[0].control.fieldName === 'new_tier');
assert.strictEqual(dupAdds.length, 0, 'a relocated field must never be re-added as a second control');
});
@@ -4145,4 +4168,478 @@ test('a failed default-form promotion WARNS instead of reporting a silent succes
await runSdkBuild(makeSpec(), { sdk, apply: true, phases: ['solution', 'data-model', 'forms'], warn: (m) => warnings.push(m) });
assert.ok(warnings.some((w) => /could not make form the default/.test(w) && /privilege check failed/.test(w)),
`expected a promotion-failure warning naming the reason; got ${JSON.stringify(warnings)}`);
+});
+
+// --- #581: field placement must pack to the section's grid width ---------------------------------
+//
+// The reconcile path ignored `section.columns` entirely: an ADDED field became its own single-cell
+// row, and a MOVED field was appended to whatever row happened to be last. So the same spec produced
+// a structurally different form depending only on whether the form already existed — a 2-column
+// section that `rowsFromCells` would lay out as [[a,b],[c,d]] came out as one four-cell row on a
+// rebuild, a shape the create path can never emit.
+
+test('form topology: fields ADDED to a 2-column section pack two per row, like the create path', async () => {
+ const spec = makeSpec();
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'General', columns: 2, fields: ['new_name', 'new_tier', 'new_note', 'new_extra'] },
+ ] }]);
+ // Deployed with ONLY new_name, so the other three are adds onto an existing form.
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 2,
+ rows: [{ cells: [{ control: { fieldName: 'new_name' } }] }] },
+ ] }] }], bag: { a: [], c: [] } };
+ const { sdk, calls } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+
+ const sec = '/tabs/0/columns/0/sections/0';
+ // new_tier fits beside new_name in row 0, so the ROW is rewritten rather than a new row appended.
+ const rowPatch = find(calls, 'updateElement').find((c) => String(c.args[2]) === sec + '/rows/0' && Array.isArray(c.args[3].cells));
+ assert.ok(rowPatch, `the first add must pack onto row 0; row writes: ${find(calls, 'updateElement').map((c) => c.args[2]).join(', ')}`);
+ assert.deepStrictEqual(rowPatch.args[3].cells.map((c) => c.control.fieldName), ['new_name', 'new_tier'],
+ 'row 0 carries both cells, and the existing cell object is re-sent so its id survives');
+ // The third field does NOT fit in row 0, so it opens row 1.
+ const rowAdds = find(calls, 'addElement').filter((c) => String(c.args[2]) === sec + '/rows');
+ assert.strictEqual(rowAdds.length, 1, `exactly one new row; saw ${rowAdds.length}`);
+ assert.deepStrictEqual(rowAdds[0].args[3].cells.map((c) => c.control.fieldName), ['new_note']);
+});
+
+test('form topology: a 1-column section never packs two cells into one row', async () => {
+ const spec = makeSpec();
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'General', columns: 1, fields: ['new_name', 'new_tier'] },
+ ] }]);
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 1,
+ rows: [{ cells: [{ control: { fieldName: 'new_name' } }] }] },
+ ] }] }], bag: { a: [], c: [] } };
+ const { sdk, calls } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+
+ const sec = '/tabs/0/columns/0/sections/0';
+ const rowPatches = find(calls, 'updateElement').filter((c) => String(c.args[2]) === sec + '/rows/0' && Array.isArray(c.args[3].cells));
+ assert.deepStrictEqual(rowPatches, [], 'a full one-column row must not be rewritten to hold two cells');
+ const rowAdds = find(calls, 'addElement').filter((c) => String(c.args[2]) === sec + '/rows');
+ assert.strictEqual(rowAdds.length, 1, 'the field opens its own row instead');
+ assert.deepStrictEqual(rowAdds[0].args[3].cells.map((c) => c.control.fieldName), ['new_tier']);
+});
+
+// A colspan is load-bearing for packing: a full-width title in a 2-column section consumes the whole
+// row, so the next field must NOT be packed beside it even though the row holds only one cell.
+test('form topology: packing counts colspan, not cell count', async () => {
+ const spec = makeSpec();
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'General', columns: 2, fields: [{ name: 'new_name', colspan: 2 }, 'new_tier'] },
+ ] }]);
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 2,
+ rows: [{ cells: [{ colspan: 2, control: { fieldName: 'new_name' } }] }] },
+ ] }] }], bag: { a: [], c: [] } };
+ const { sdk, calls } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+
+ const sec = '/tabs/0/columns/0/sections/0';
+ assert.deepStrictEqual(
+ find(calls, 'updateElement').filter((c) => String(c.args[2]) === sec + '/rows/0' && Array.isArray(c.args[3].cells)), [],
+ 'a row already filled by a colspan:2 cell has no space left, despite holding one cell');
+ const rowAdds = find(calls, 'addElement').filter((c) => String(c.args[2]) === sec + '/rows');
+ assert.strictEqual(rowAdds.length, 1, 'so the next field opens a new row');
+});
+
+// --- #581 item 2: a section the layout VACATED is reclaimed, not left as an empty twin ----------
+//
+// A generated section name encodes POSITION (`section_<tab>[_<column>]_<index>`), so moving a
+// section between form-columns or tabs under a generated name changes its identity: the topology
+// pass creates a new section and never matches the old one again. The field pass then empties it,
+// and the deployed form ends up with two sections headed the same thing, one blank — stable across
+// rebuilds and permanently wrong. Reported in #581 as: two sections headed "B", one empty.
+
+const vacateSpec = () => {
+ const spec = makeSpec();
+ // One tab, TWO form-columns. The authored section carrying new_tier now lives in column 1; the
+ // deployed form has it in column 0 under the generated name column 0 would have produced.
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', columns: [
+ { width: '60%', sections: [{ label: 'A', columns: 1, fields: ['new_name'] }] },
+ { width: '40%', sections: [{ label: 'B', columns: 1, fields: ['new_tier'] }] },
+ ] }]);
+ return spec;
+};
+const vacatedForm = () => ({ id: 'f1', tabs: [
+ { id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true, columns: [
+ { width: '60%', sections: [
+ { id: 's0', name: 'section_0_0', label: 'A', visible: true, showLabel: true, columns: 1, rows: [{ cells: [{ control: { fieldName: 'new_name' } }] }] },
+ // Deployed in column 0 under the name column 0 generates; the spec now wants it in column 1,
+ // where the generated name is `section_0_1_0`. Different identity -> new section created.
+ { id: 's1', name: 'section_0_1', label: 'B', visible: true, showLabel: true, columns: 1, rows: [{ cells: [{ control: { fieldName: 'new_tier' } }] }] },
+ ] },
+ { width: '40%', sections: [] },
+ ] },
+], bag: { a: [], c: [] } });
+
+test('form topology: a section emptied by a layout move is removed, not left as a blank twin', async () => {
+ const { sdk, calls } = mockSdk({ artifactsExist: true, existingFormJson: vacatedForm() });
+ const warnings = [];
+ await runSdkBuild(vacateSpec(), { sdk, apply: true, phases: ['solution', 'data-model', 'forms'], warn: (m) => warnings.push(m) });
+
+ const removedSections = find(calls, 'removeElement').filter((c) => /\/sections\/\d+$/.test(String(c.args[2])));
+ assert.strictEqual(removedSections.length, 1,
+ `exactly one vacated section should be reclaimed; saw ${removedSections.map((c) => c.args[2]).join(', ')}`);
+ assert.ok(warnings.some((w) => /removed the now-empty section/.test(w) && /section_0_1/.test(w)),
+ `the removal must be reported and name the section; got ${JSON.stringify(warnings)}`);
+});
+
+// The sweep must never touch a section that still holds anything, nor one the engine owns.
+test('form topology: the vacated-section sweep spares populated, claimed and engine-owned sections', async () => {
+ const spec = makeSpec();
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'General', columns: 1, fields: ['new_name', 'new_tier'] },
+ ] }]);
+ // section_more still holds new_obsolete (pruned below), section_extra is EMPTY but engine-owned
+ // via a control with no fieldName, and tab_extra's section carries a sub-grid.
+ const deployed = { id: 'f1', tabs: [
+ { id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true, columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 1, rows: [{ cells: [{ control: { fieldName: 'new_name' } }] }] },
+ { id: 's1', name: 'section_grid_x', label: 'Related', visible: true, showLabel: true, columns: 1,
+ rows: [{ cells: [{ control: { parameters: { RelationshipName: 'r' } } }] }] },
+ ] }] },
+ ], bag: { a: [], c: [] } };
+ const { sdk, calls } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+
+ const removedSections = find(calls, 'removeElement').filter((c) => /\/sections\/\d+$/.test(String(c.args[2])));
+ assert.deepStrictEqual(removedSections.map((c) => c.args[2]), [],
+ 'an engine-owned sub-grid section, and the section the layout claims, must both survive');
+});
+
+// `prune: false` means "leave what I did not re-declare" — the sweep honours the same opt-out the
+// field prune does, so a partial layout edit cannot silently delete containers.
+test('form topology: prune:false leaves a vacated section alone', async () => {
+ const spec = vacateSpec();
+ spec.forms[0].prune = false;
+ const { sdk, calls } = mockSdk({ artifactsExist: true, existingFormJson: vacatedForm() });
+ await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+ const removedSections = find(calls, 'removeElement').filter((c) => /\/sections\/\d+$/.test(String(c.args[2])));
+ assert.deepStrictEqual(removedSections.map((c) => c.args[2]), [], 'prune:false must not remove containers either');
+});
+
+// The zero-cells guard, exercised where it actually decides. The PRIMARY field is never pruned, so
+// an unclaimed section holding it still has a cell when the sweep runs — and deleting that section
+// would take the record's title off the form. (The earlier "spares populated" test does not reach
+// this guard: its surviving sections are spared by the claimed-name and engine-owned checks first,
+// which mutation testing exposed.)
+test('form topology: an UNCLAIMED section that still holds a cell is never removed', async () => {
+ const spec = makeSpec();
+ // The layout claims only section_general/new_tier. new_name is the primary, so the field prune
+ // leaves it where it is — in a section the layout does not claim.
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'General', columns: 1, fields: ['new_tier'] },
+ ] }]);
+ const deployed = { id: 'f1', tabs: [
+ { id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true, columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 1, rows: [{ cells: [{ control: { fieldName: 'new_tier' } }] }] },
+ { id: 's1', name: 'section_leftover', label: 'Leftover', visible: true, showLabel: true, columns: 1, rows: [{ cells: [{ control: { fieldName: 'new_name' } }] }] },
+ ] }] },
+ ], bag: { a: [], c: [] } };
+ const { sdk, calls } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+
+ const removedSections = find(calls, 'removeElement').filter((c) => /\/sections\/\d+$/.test(String(c.args[2])));
+ assert.deepStrictEqual(removedSections.map((c) => c.args[2]), [],
+ 'a section still holding the primary field must survive — removing it would take the record title off the form');
+});
+
+// Astra review, HIGH: "zero cells" does not establish that THIS reconcile vacated the section. A
+// maker-added section that was ALREADY empty — one a form script may show/hide by name — would be
+// deleted by an otherwise no-op rebuild, and the destructive preflight cannot see it because that
+// compares fields and sitemap targets, not containers.
+test('form topology: a pre-existing EMPTY section the layout never touched is not deleted', async () => {
+ const spec = makeSpec();
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'A', columns: 1, fields: ['new_name'] },
+ ] }]);
+ const deployed = { id: 'f1', tabs: [
+ { id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true, columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'A', visible: true, showLabel: true, columns: 1, rows: [{ cells: [{ control: { fieldName: 'new_name' } }] }] },
+ // Added by a maker, deliberately empty, never mentioned by the spec. This reconcile does not
+ // vacate it — it was already like this.
+ { id: 's9', name: 'maker_script_target', label: 'Maker Panel', visible: true, showLabel: true, columns: 1, rows: [] },
+ ] }] },
+ ], bag: { a: [], c: [] } };
+ const { sdk, calls } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+
+ const removedSections = find(calls, 'removeElement').filter((c) => /\/sections\/\d+$/.test(String(c.args[2])));
+ assert.deepStrictEqual(removedSections.map((c) => c.args[2]), [],
+ 'only a section THIS run emptied may be reclaimed; a pre-existing empty section is the maker\'s, not ours');
+});
+
+// Same rule from the other side: a section named `__proto__` must still be claimable. `sectionTargets`
+// is keyed by section name, and a plain object turns that assignment into a prototype mutation rather
+// than an own property — so the claimed-set lookup missed it and the sweep deleted a section the
+// layout explicitly asked for.
+test('form topology: a section named __proto__ is claimed like any other', async () => {
+ const spec = makeSpec();
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'A', columns: 1, fields: ['new_name'] },
+ { name: '__proto__', label: 'Odd', columns: 1, fields: [] },
+ ] }]);
+ const deployed = { id: 'f1', tabs: [
+ { id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true, columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'A', visible: true, showLabel: true, columns: 1, rows: [{ cells: [{ control: { fieldName: 'new_name' } }] }] },
+ { id: 's1', name: '__proto__', label: 'Odd', visible: true, showLabel: true, columns: 1, rows: [] },
+ ] }] },
+ ], bag: { a: [], c: [] } };
+ const { sdk, calls } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+
+ const removedSections = find(calls, 'removeElement').filter((c) => /\/sections\/\d+$/.test(String(c.args[2])));
+ assert.deepStrictEqual(removedSections.map((c) => c.args[2]), [],
+ 'an explicitly authored section must be claimed whatever its name');
+});
+
+// The `__proto__` claim, exercised where it actually decides. The previous test passes even with a
+// plain-object `sectionTargets`, because the vacated-set check spares the section first — a test
+// that passes for the wrong reason. Here the section IS vacated (its field moves out), so the ONLY
+// thing standing between it and deletion is whether the claimed-set saw it.
+test('form topology: a vacated section named __proto__ is still claimed, not reclaimed', async () => {
+ const spec = makeSpec();
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'A', columns: 1, fields: ['new_name', 'new_tier'] },
+ { name: '__proto__', label: 'Odd', columns: 1, fields: [] },
+ ] }]);
+ // new_tier is deployed inside `__proto__` and the spec moves it to section_general, so the sweep
+ // sees `__proto__` vacated AND empty. It must survive because the layout still declares it.
+ const deployed = { id: 'f1', tabs: [
+ { id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true, columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'A', visible: true, showLabel: true, columns: 1, rows: [{ cells: [{ control: { fieldName: 'new_name' } }] }] },
+ { id: 's1', name: '__proto__', label: 'Odd', visible: true, showLabel: true, columns: 1, rows: [{ cells: [{ control: { fieldName: 'new_tier' } }] }] },
+ ] }] },
+ ], bag: { a: [], c: [] } };
+ const { sdk, calls } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+
+ const removedSections = find(calls, 'removeElement').filter((c) => /\/sections\/\d+$/.test(String(c.args[2])));
+ assert.deepStrictEqual(removedSections.map((c) => c.args[2]), [],
+ 'a section the layout claims must never be reclaimed, whatever its name');
+});
+// A RESET is what an author hits after widening a field and changing their mind: the declared span
+// goes from 2 back to 1. Folding an explicit 1 into "no opinion" made that unrepresentable, so the
+// deployed cell kept its old width across repeated applies — live-reproduced, twice, before the fix.
+// The omission control above ("a field with no authored span leaves the deployed cell alone") is what
+// still protects a maker's hand-widened cell; these two only cover a span the author DECLARED.
+test('form topology: an authored span RESET to 1 converges on a deployed cell that is wider', async () => {
+ const spec = makeSpec();
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'General', columns: 2, fields: [{ name: 'new_name', colspan: 1, rowspan: 1 }, 'new_tier'] },
+ ] }]);
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 2,
+ rows: [{ cells: [{ colspan: 2, rowspan: 3, control: { fieldName: 'new_name' } }] },
+ { cells: [{ control: { fieldName: 'new_tier' } }] }] },
+ ] }] }], bag: { a: [], c: [] } };
+ const { sdk, calls } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+ const patches = find(calls, 'updateElement').filter((c) => /\/cells\/\d+$/.test(String(c.args[2]))
+ && c.args[3] && (c.args[3].colspan !== undefined || c.args[3].rowspan !== undefined));
+ assert.strictEqual(patches.length, 1,
+ `the reset must reach the deployed cell; saw ${JSON.stringify(patches.map((c) => [c.args[2], c.args[3]]))}`);
+ assert.strictEqual(patches[0].args[3].colspan, 1, 'colspan must be reset to 1, not left at 2');
+ assert.strictEqual(patches[0].args[3].rowspan, 1, 'rowspan must be reset to 1, not left at 3');
+});
+
+// The same reset declared through the OTHER route. `fieldOptions` has its own span normalizer, so a
+// fix applied only to inline entries leaves this path still dropping the reset.
+test('form topology: a span RESET declared via fieldOptions converges too', async () => {
+ const spec = makeSpec();
+ spec.forms = [{ entity: 'new_customer', name: 'Customer', fieldOptions: { new_name: { colspan: 1 } } }];
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 2,
+ rows: [{ cells: [{ colspan: 2, control: { fieldName: 'new_name' } }] }] },
+ ] }] }], bag: { a: [], c: [] } };
+ const { sdk, calls } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+ const patches = find(calls, 'updateElement').filter((c) => /\/cells\/\d+$/.test(String(c.args[2]))
+ && c.args[3] && c.args[3].colspan !== undefined);
+ assert.strictEqual(patches.length, 1,
+ `the fieldOptions reset must reach the deployed cell; saw ${JSON.stringify(patches.map((c) => [c.args[2], c.args[3]]))}`);
+ assert.strictEqual(patches[0].args[3].colspan, 1, 'colspan must be reset to 1 through the fieldOptions route as well');
+});
+
+// Converged state must be a fixed point: re-applying the same spec against the now-correct form must
+// issue NO span write at all, or every rebuild churns the form and its audit history.
+test('form topology: a span already at the authored value is not rewritten', async () => {
+ const spec = makeSpec();
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'General', columns: 2, fields: [{ name: 'new_name', colspan: 1 }, 'new_tier'] },
+ ] }]);
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 2,
+ rows: [{ cells: [{ control: { fieldName: 'new_name' } }, { control: { fieldName: 'new_tier' } }] }] },
+ ] }] }], bag: { a: [], c: [] } };
+ const { sdk, calls } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+ const patches = find(calls, 'updateElement').filter((c) => c.args[3]
+ && (c.args[3].colspan !== undefined || c.args[3].rowspan !== undefined));
+ assert.deepStrictEqual(patches, [],
+ 'an absent colspan already MEANS 1, so declaring 1 must not produce a write');
+});
+
+// --- #N2: widening a field on a DEPLOYED form must re-pack its row -------------------------------
+// LIVE-REPRODUCED: widening an existing field left three columns of content in a two-column row.
+// The span was patched in place, but the packing that the create path applies (`rowsFromCells`)
+// never re-ran, so the row kept both its original cells and the newly widened one.
+test('form topology: widening a field re-packs the row it overflows', async () => {
+ const spec = makeSpec();
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'General', columns: 2, fields: [{ name: 'new_name', colspan: 2 }, 'new_tier'] },
+ ] }]);
+ // Deployed: two colspan-1 cells sharing one row of a 2-column section — occupancy 2, exactly full.
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 2,
+ rows: [{ cells: [{ id: 'c1', control: { fieldName: 'new_name' } }, { id: 'c2', control: { fieldName: 'new_tier' } }] }] },
+ ] }] }], bag: { a: [], c: [] } };
+ const { sdk, calls } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+
+ const sec = '/tabs/0/columns/0/sections/0';
+ // Assert the RESULTING form, not just that some calls were made: emptying either packed row left
+ // the call-shape assertions passing while the primary field was deleted, or the displaced field
+ // was recreated later and lost its cell id and control state.
+ // The mock keys the store by the id the BUILD resolved, not the fixture's — take it from a call.
+ const formCall = calls.find((c) => (c.name === 'updateElement' || c.name === 'addElement') && c.args[0] === 'form');
+ assert.ok(formCall, 'the build must have written to the form');
+ const finalForm = await sdk.getArtifact('form', formCall.args[1]);
+ const rows = finalForm.tabs[0].columns[0].sections[0].rows || [];
+ assert.strictEqual(rows.length, 2, `the row must split in two; got ${JSON.stringify(rows)}`);
+
+ const names = rows.map((r) => (r.cells || []).map((c) => c.control && c.control.fieldName));
+ assert.deepStrictEqual(names, [['new_name'], ['new_tier']],
+ `the widened field keeps its row and the displaced one moves DOWN; got ${JSON.stringify(names)}`);
+ assert.strictEqual(rows[0].cells[0].colspan, 2, 'the widened cell keeps its span');
+ // Identity must survive: a cell recreated instead of moved loses its id and any maker-edited state.
+ assert.strictEqual(rows[0].cells[0].id, 'c1', 'the widened cell is the SAME cell, not a new one');
+ assert.strictEqual(rows[1].cells[0].id, 'c2', 'the displaced cell is MOVED, not recreated');
+
+ for (const r of rows) {
+ const width = (r.cells || []).reduce((n, c) => n + (c.colspan || 1), 0);
+ assert.ok(width <= 2, `no row may exceed the section's 2 columns; got ${JSON.stringify(r.cells)}`);
+ }
+
+ // The new row goes immediately BELOW the widened one, and carries the SDK's real position shape:
+ // it resolves `'index' in position`, so a bare number throws at the SDK boundary.
+ const inserted = find(calls, 'addElement').filter((c) => String(c.args[2]) === sec + '/rows');
+ assert.strictEqual(inserted.length, 1, 'exactly one row is created');
+ assert.deepStrictEqual(inserted[0].args[4] && inserted[0].args[4].position, { index: 1 },
+ `position must be { index: n }; got ${JSON.stringify(inserted[0].args[4])}`);
+
+ // Converged state is a fixed point: re-applying the same spec must write nothing more.
+ const before = calls.length;
+ await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+ const second = calls.slice(before);
+ assert.deepStrictEqual(find(second, 'addElement').filter((c) => String(c.args[2]) === sec + '/rows'), [],
+ 'a second apply must not create another row');
+ assert.deepStrictEqual(
+ find(second, 'updateElement').filter((c) => /\/rows\/\d+$/.test(String(c.args[2])) && c.args[3] && Array.isArray(c.args[3].cells)),
+ [], 'a second apply must not rewrite the rows it already packed');
+});
+
+// A span change that does NOT overflow must not churn the form.
+test('form topology: widening a field that still fits re-packs nothing', async () => {
+ const spec = makeSpec();
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'General', columns: 4, fields: [{ name: 'new_name', colspan: 2 }, 'new_tier'] },
+ ] }]);
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 4,
+ rows: [{ cells: [{ id: 'c1', control: { fieldName: 'new_name' } }, { id: 'c2', control: { fieldName: 'new_tier' } }] }] },
+ ] }] }], bag: { a: [], c: [] } };
+ const { sdk, calls } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+ const sec = '/tabs/0/columns/0/sections/0';
+ // 2 + 1 = 3 <= 4, so the row still fits and must be left alone.
+ assert.deepStrictEqual(find(calls, 'addElement').filter((c) => String(c.args[2]) === sec + '/rows'), [],
+ 'no row may be created when the widened cell still fits');
+ assert.deepStrictEqual(
+ find(calls, 'updateElement').filter((c) => /\/rows\/\d+$/.test(String(c.args[2])) && c.args[3] && Array.isArray(c.args[3].cells)),
+ [], 'no row may be rewritten when nothing overflowed');
+});
+
+// A MIDDLE row is where the insertion index actually matters: appending would drop the displaced
+// field below every later row instead of immediately beneath the field it was sharing a row with.
+// With a single-row section, "insert at 1" and "append" are indistinguishable — so this is the case
+// that holds the packer honest.
+test('form topology: widening a field in a MIDDLE row inserts directly below it, not at the end', async () => {
+ const spec = makeSpec();
+ spec.entities[0].columns.push(
+ { schemaName: 'new_alpha', displayName: 'Alpha', type: 'Text' },
+ { schemaName: 'new_beta', displayName: 'Beta', type: 'Text' },
+ { schemaName: 'new_gamma', displayName: 'Gamma', type: 'Text' },
+ );
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'section_general', label: 'General', columns: 2,
+ fields: ['new_name', 'new_tier', { name: 'new_alpha', colspan: 2 }, 'new_beta', 'new_gamma'] },
+ ] }]);
+ const cell = (id, f) => ({ id, control: { fieldName: f } });
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'section_general', label: 'General', visible: true, showLabel: true, columns: 2,
+ rows: [
+ { cells: [cell('c1', 'new_name'), cell('c2', 'new_tier')] },
+ { cells: [cell('c3', 'new_alpha'), cell('c4', 'new_beta')] }, // new_alpha widens here
+ { cells: [cell('c5', 'new_gamma')] },
+ ] },
+ ] }] }], bag: { a: [], c: [] } };
+ const { sdk, calls } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+
+ const formCall = calls.find((c) => (c.name === 'updateElement' || c.name === 'addElement') && c.args[0] === 'form');
+ const finalForm = await sdk.getArtifact('form', formCall.args[1]);
+ const names = (finalForm.tabs[0].columns[0].sections[0].rows || [])
+ .map((r) => (r.cells || []).map((c) => c.control && c.control.fieldName));
+ assert.deepStrictEqual(names,
+ [['new_name', 'new_tier'], ['new_alpha'], ['new_beta'], ['new_gamma']],
+ `the displaced field goes DIRECTLY below, keeping author order; got ${JSON.stringify(names)}`);
+
+ const sec = '/tabs/0/columns/0/sections/0';
+ const inserted = find(calls, 'addElement').filter((c) => String(c.args[2]) === sec + '/rows');
+ assert.strictEqual(inserted.length, 1, 'exactly one row is created');
+ assert.deepStrictEqual(inserted[0].args[4] && inserted[0].args[4].position, { index: 2 },
+ `the row goes immediately below row 1; got ${JSON.stringify(inserted[0].args[4])}`);
+});
+
+// A span must be clamped against the section the field is MOVING TO, not the one it is leaving.
+// Converging before the relocation cut a `colspan: 4` down to the 2-column source's width and then
+// moved the narrowed cell, so the destination showed 2 and only reached 4 on a second apply.
+test('form topology: a relocated field is clamped against its DESTINATION, not its source', async () => {
+ const spec = makeSpec();
+ spec.forms = explicitForm([{ name: 'tab_general', label: 'General', sections: [
+ { name: 'sec_narrow', label: 'Narrow', columns: 2, fields: ['new_tier'] },
+ { name: 'sec_wide', label: 'Wide', columns: 4, fields: [{ name: 'new_name', colspan: 4 }] },
+ ] }]);
+ // Deployed: new_name sits in the 2-column section beside new_tier and must move to the 4-column one.
+ const deployed = { id: 'f1', tabs: [{ id: 't0', name: 'tab_general', label: 'General', expanded: true, visible: true,
+ columns: [{ width: '100%', sections: [
+ { id: 's0', name: 'sec_narrow', label: 'Narrow', visible: true, showLabel: true, columns: 2,
+ rows: [{ cells: [{ id: 'c1', control: { fieldName: 'new_name' } }, { id: 'c2', control: { fieldName: 'new_tier' } }] }] },
+ { id: 's1', name: 'sec_wide', label: 'Wide', visible: true, showLabel: true, columns: 4, rows: [] },
+ ] }] }], bag: { a: [], c: [] } };
+ const { sdk, calls } = mockSdk({ artifactsExist: true, existingFormJson: deployed });
+ await runSdkBuild(spec, { sdk, apply: true, phases: ['solution', 'data-model', 'forms'] });
+
+ const formCall = calls.find((c) => (c.name === 'updateElement' || c.name === 'addElement') && c.args[0] === 'form');
+ const finalForm = await sdk.getArtifact('form', formCall.args[1]);
+ const wide = finalForm.tabs[0].columns[0].sections[1];
+ const moved = (wide.rows || []).flatMap((r) => r.cells || [])
+ .find((c) => c.control && c.control.fieldName === 'new_name');
+ assert.ok(moved, `new_name must land in the wide section; got ${JSON.stringify(wide.rows)}`);
+ assert.strictEqual(moved.colspan, 4,
+ 'the authored span is clamped against the 4-column DESTINATION, not the 2-column source');
+ assert.strictEqual(moved.id, 'c1', 'the cell is moved, not recreated');
});
diff --git a/plugins/model-apps/scripts/tests/sdk-teardown.test.js b/plugins/model-apps/scripts/tests/sdk-teardown.test.js
index cda36463a..6f0a57b2d 100644
--- a/plugins/model-apps/scripts/tests/sdk-teardown.test.js
+++ b/plugins/model-apps/scripts/tests/sdk-teardown.test.js
@@ -1701,3 +1701,167 @@ test('the teardown filter does NOT depend on businessRuleFilter\'s spelling', as
assert.strictEqual(importLine.includes('businessRuleFilter'), false,
`teardown must not import businessRuleFilter; got: ${importLine.trim().slice(0, 160)}`);
});
+
+// #587 item 7 — the role resolver read the appmodule<->role association to avoid deleting a role
+// ANOTHER app still uses, but a failed read set `sharedWithAnotherApp = false`, i.e. "not shared",
+// leaving the role eligible for deletion. That is the wrong direction for a destructive decision,
+// and it was inconsistent with the very same function: a failure to resolve the business unit
+// already returns [] and deletes nothing.
+//
+// Cost of being wrong each way: fail-closed leaves a role behind that an operator can delete by
+// hand; fail-open silently strips permissions from a DIFFERENT app that shares the persona.
+test('#587 a role whose sharing check cannot be read is retained, not deleted', async () => {
+ const ROLE_ID = '11111111-2222-4333-8444-555555555555';
+ const sdkWith = (appmodule) => ({
+ deleteSecurityRole: async () => {},
+ queryRecords: async (set) => {
+ if (set === 'businessunit') return [{ businessunitid: '44444444-4444-4444-4444-444444444444' }];
+ if (set === 'role') return [{ roleid: ROLE_ID, name: 'Dispatcher', description: SDK_ROLE_MARKER, ismanaged: false }];
+ if (set === 'appmodule') return appmodule();
+ return [];
+ },
+ });
+
+ // CONTROLS first, so a blanket "never delete anything" regression cannot pass this test.
+ const deletable = await KIND_HANDLERS.role.resolve(sdkWith(() => []), { name: 'Dispatcher' });
+ assert.deepStrictEqual(deletable, [{ id: ROLE_ID, name: 'Dispatcher' }],
+ 'a role no app still references must remain deletable');
+
+ const shared = await KIND_HANDLERS.role.resolve(sdkWith(() => [{ appmoduleid: 'other-app' }]), { name: 'Dispatcher' });
+ assert.deepStrictEqual(shared, [], 'a role another app still references must be retained');
+
+ // The fix: an UNREADABLE sharing check must behave like "shared", not like "not shared".
+ const unreadable = await KIND_HANDLERS.role.resolve(
+ sdkWith(() => { throw new Error('403 read denied'); }), { name: 'Dispatcher' });
+ assert.deepStrictEqual(unreadable, [],
+ 'an unreadable sharing check must fail CLOSED and retain the role');
+});
+
+// #587 item 5 — teardown continued after the APP delete failed. The app module is the dependency
+// ROOT: tables, forms, views and charts are its components. Continuing past a failed app delete
+// therefore strips a LIVE app of everything it renders, leaving a broken app in the environment —
+// strictly worse than stopping and leaving a consistent one for the operator to retry.
+//
+// Continue-on-error is right for the steps AFTER the root is gone (one undeletable view should not
+// strand the rest); it is wrong for the root itself.
+test('#587 a failed app delete stops dependent teardown instead of stripping a live app', async () => {
+ const seed = {
+ appmodules: { [appUniqueName(desk)]: { appmoduleid: 'app-1', name: 'Support Desk' } },
+ tables: ['new_customer', 'new_ticket', 'new_comment'],
+ solutions: { ContosoSupportDesk: { solutionid: 'sol-1', uniquename: 'ContosoSupportDesk' } },
+ };
+ const base = mockSdk(seed);
+ const sdk = {
+ ...base,
+ deleteAppCascade: async () => { throw new Error('HTTP 400 app delete refused'); },
+ };
+ const r = await runTeardown(desk, { apply: true }, { sdk, emit: () => {} });
+
+ assert.strictEqual(r.ok, false, 'a failed app delete must fail the run');
+ const destructive = base.calls.filter((c) => /^delete/.test(c.method) && c.method !== 'deleteAppCascade');
+ assert.deepStrictEqual(destructive.map((c) => c.method), [],
+ 'nothing dependent may be deleted once the app itself was not removed');
+ assert.ok(r.errors.some((e) => /app delete refused/.test(e.message)), 'the real cause must be reported');
+ assert.strictEqual(base.db.tables.size, 3, 'the tables the live app renders must still be there');
+});
+
+// The distinction that makes the rule safe. `app.del` ALSO throws when the app record WAS removed
+// and only a cascade cleanup step failed — aborting there would strand MORE orphans, not fewer. So
+// the abort is conditioned on the app not being proven deleted, not on "the app step threw".
+test('#587 a cascade-cleanup failure still lets teardown continue — the app itself is gone', async () => {
+ const seed = {
+ appmodules: { [appUniqueName(desk)]: { appmoduleid: 'app-1', name: 'Support Desk' } },
+ tables: ['new_customer', 'new_ticket', 'new_comment'],
+ solutions: { ContosoSupportDesk: { solutionid: 'sol-1', uniquename: 'ContosoSupportDesk' } },
+ };
+ const base = mockSdk(seed);
+ const sdk = {
+ ...base,
+ deleteAppCascade: async (id, unique) => {
+ await base.deleteAppCascade(id, unique); // the app row really is removed
+ return { success: false, deleted: [], retained: [], failures: [{ operation: 'delete', type: 'sitemap', id: 's1', error: new Error('HTTP 500 cleanup failed') }] };
+ },
+ };
+ const r = await runTeardown(desk, { apply: true }, { sdk, emit: () => {} });
+
+ assert.strictEqual(r.ok, false, 'the cleanup failure is still a failure');
+ assert.strictEqual(base.db.tables.size, 0,
+ 'the app is gone, so its dependents must still be torn down rather than left orphaned');
+});
+// is not a GUID skips the association query entirely — and that is deliberate: FORM_GUID_RE is an
+// injection guard on the OData filter, not an existence check. Every Dataverse `roleid` is an
+// astra HIGH — the abort added above is DOWNSTREAM of deleteStep, which treats any not-found error
+// as a successful delete. But the SDK also throws 404 when an ATOMIC app+sitemap changeset is
+// ROLLED BACK by the platform — the app is still there. That was recorded as a phantom delete, the
+// abort never fired, and dependent teardown went on to strip a live app: `ok: true`, no errors.
+//
+// For the dependency ROOT, "not found" must be MEASURED, not inferred.
+test('#587 a rolled-back atomic app delete is not mistaken for a successful one', async () => {
+ const seed = {
+ appmodules: { [appUniqueName(desk)]: { appmoduleid: 'app-1', name: 'Support Desk' } },
+ tables: ['new_customer', 'new_ticket', 'new_comment'],
+ solutions: { ContosoSupportDesk: { solutionid: 'sol-1', uniquename: 'ContosoSupportDesk' } },
+ };
+ const base = mockSdk(seed);
+ const sdk = {
+ ...base,
+ // The app row is deliberately LEFT IN PLACE: the changeset rolled back.
+ deleteAppCascade: async (id, unique) => {
+ base.calls.push({ method: 'deleteAppCascade', appModuleId: id, appModuleIdUnique: unique });
+ const err = new Error('The atomic delete of app and sitemap was rolled back');
+ err.statusCode = 404;
+ throw err;
+ },
+ };
+ const r = await runTeardown(desk, { apply: true }, { sdk, emit: () => {} });
+
+ assert.strictEqual(r.ok, false, 'a rolled-back delete must not report success');
+ assert.deepStrictEqual(r.deleted.app || [], [], 'and must not be recorded as a deleted app');
+ const destructive = base.calls.filter((c) => /^delete/.test(c.method) && c.method !== 'deleteAppCascade');
+ assert.deepStrictEqual(destructive.map((c) => c.method), [],
+ 'the app is still live, so nothing it renders may be deleted');
+ assert.strictEqual(base.db.tables.size, 3, 'its tables must survive');
+});
+
+// The CONTROL that keeps the rule honest: an app genuinely already gone (a re-run of a completed
+// teardown) must still be tolerated, or every second teardown would fail.
+test('#587 an app that is genuinely absent is still tolerated as already deleted', async () => {
+ const base = mockSdk({
+ appmodules: { [appUniqueName(desk)]: { appmoduleid: 'app-1', name: 'Support Desk' } },
+ tables: ['new_customer', 'new_ticket', 'new_comment'],
+ solutions: { ContosoSupportDesk: { solutionid: 'sol-1', uniquename: 'ContosoSupportDesk' } },
+ });
+ const sdk = {
+ ...base,
+ deleteAppCascade: async (id, unique) => {
+ // Remove the row (it really is gone), THEN report 404 — the shape a cascade race produces.
+ await base.deleteAppCascade(id, unique);
+ const err = new Error('Not Found');
+ err.statusCode = 404;
+ throw err;
+ },
+ };
+ const r = await runTeardown(desk, { apply: true }, { sdk, emit: () => {} });
+ assert.strictEqual(r.ok, true, `a genuinely-absent app is not a failure: ${JSON.stringify(r.errors)}`);
+ assert.strictEqual(base.db.tables.size, 0, 'and its dependents are still torn down');
+});
+
+// The OTHER branch of the same resolver, pinned so it is not "fixed" later without being thought
+// through. A roleid that is not a GUID skips the association query entirely — deliberately:
+// FORM_GUID_RE is an injection guard on the OData filter, not an existence check. Every Dataverse
+// roleid is an Edm.Guid, so an id failing it never came from the platform and has no app
+// association to protect.
+// Making it fail closed was considered and rejected: no real row benefits, and role ownership would
+// start depending on id formatting.
+test('#587 a non-GUID role id still resolves — the GUID test is an injection guard, not a safety check', async () => {
+ const sdk = {
+ deleteSecurityRole: async () => {},
+ queryRecords: async (set) => {
+ if (set === 'businessunit') return [{ businessunitid: '44444444-4444-4444-4444-444444444444' }];
+ if (set === 'role') return [{ roleid: 'r1', name: 'Dispatcher', description: SDK_ROLE_MARKER, ismanaged: false }];
+ return [];
+ },
+ };
+ assert.deepStrictEqual(await KIND_HANDLERS.role.resolve(sdk, { name: 'Dispatcher' }),
+ [{ id: 'r1', name: 'Dispatcher' }]);
+});
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 93f5c3d29..f3aab08aa 100644
--- a/plugins/model-apps/scripts/tests/teardown-model-app.test.js
+++ b/plugins/model-apps/scripts/tests/teardown-model-app.test.js
@@ -106,7 +106,17 @@ test('apply --allow-destructive performs the deletes', async () => {
assert.ok(sdk.calls.some((c) => c.method === 'deleteAppCascade'), 'app deleted');
});
-test('deleteAppCascade rejection is reported as a failed app step and teardown continues', async () => {
+// REVERSED by #587 item 5, deliberately. This test used to assert that teardown CONTINUES after a
+// failed app delete ("later steps still run after the app refusal"), on a best-effort rationale:
+// one failure should not strand the rest. Deep lifecycle testing showed that is the wrong rule for
+// THIS step specifically — the app module is the dependency ROOT, and tables/forms/views/charts are
+// its components. Continuing strips a LIVE app of everything it renders and leaves it broken in the
+// environment, which is strictly worse than stopping and leaving a consistent app to retry against.
+//
+// Continue-on-error still applies to every step after the root is gone, and to the case where the
+// app row WAS deleted and only a cascade cleanup step failed (see the `success:false` test below,
+// which still expects later steps to run).
+test('deleteAppCascade rejection is reported as a failed app step and dependent teardown STOPS', async () => {
const sdk = presentSdk();
sdk.deleteAppCascade = async (appModuleId, appModuleIdUnique) => {
sdk.calls.push({ method: 'deleteAppCascade', appModuleId, appModuleIdUnique });
@@ -119,7 +129,10 @@ test('deleteAppCascade rejection is reported as a failed app step and teardown c
assert.strictEqual(r.ok, false);
assert.ok(r.errors.some((e) => e.step === 'app module "Support Desk"' && /delete not confirmed/.test(e.message)));
assert.ok(cap.logs.some((l) => /✗ app module "Support Desk" — delete not confirmed/.test(l)));
- assert.ok(sdk.calls.some((c) => c.method === 'deleteSolution'), 'later steps still run after the app refusal');
+ assert.ok(!sdk.calls.some((c) => c.method === 'deleteSolution'),
+ 'the app was not deleted, so nothing that depends on it may be torn down');
+ assert.ok(!sdk.calls.some((c) => /^delete/.test(c.method) && c.method !== 'deleteAppCascade'),
+ 'no dependent delete of any kind may run');
assert.ok(cap.logs.some((l) => /teardown finished with errors/.test(l)), 'the summary stays visibly non-clean');
});
@@ -199,6 +212,9 @@ function loadTeardownCli({
workspaceExists = true,
invokeAsMain = false,
emitThrows = false,
+ // #587 item 8 — lets a test drive the destructive-cleanup guard both ways. `null` means the
+ // guard accepts (the ordinary case); a string is the refusal reason.
+ clearRefusedBecause = null,
}) {
const scriptPath = path.join(__dirname, '..', 'teardown-model-app.js');
const source = `${fs.readFileSync(scriptPath, 'utf8')}\nmodule.exports.__mainForTest = main;\n`;
@@ -243,6 +259,17 @@ function loadTeardownCli({
if (id === './lib/op-diff.js') {
return { classifyOps: () => ({ hasDestructive: false, destructive: [] }) };
}
+ if (id === './lib/workspace-paths.js') {
+ return {
+ WORKSPACE_DIR_NAME: '.maker-workspace',
+ checkWorkspaceClearable: (dir) => {
+ events.push({ type: 'checkWorkspaceClearable', dir });
+ return clearRefusedBecause
+ ? { ok: false, reason: clearRefusedBecause }
+ : { ok: true, target: dir };
+ },
+ };
+ }
if (id === './lib/sdk-http-client.js') {
return { createAzHttpClient: (env) => ({ env }) };
}
@@ -350,6 +377,42 @@ test('teardown CLI applies, clears the local workspace only after a clean run, a
assert.strictEqual(harness.events[emitIndex].ok, true);
});
+// #587 item 8 — the destructive half of the same flag. Cleanup runs right after a SUCCESSFUL
+// teardown, so an unguarded recursive delete on a caller-supplied `--workspace` destroys data at
+// the moment an operator is least expecting it. When the guard refuses, NOTHING may be removed —
+// and the teardown must still report success, because the teardown itself did succeed and failing
+// it would push the operator to re-run a destructive command.
+test('teardown CLI does not delete a workspace the safety guard refuses', async () => {
+ const workspaceDir = 'D:\\Projects\\power-platform-skills-sdk\\.test-workspace\\not-a-workspace';
+ const harness = loadTeardownCli({
+ clearRefusedBecause: "refusing to delete 'D:\\src': only a directory named '.maker-workspace' may be cleared",
+ parseResult: {
+ positional: [],
+ flags: {
+ env: 'https://org.example',
+ spec: '@D:\\Projects\\power-platform-skills-sdk\\plugins\\model-apps\\samples\\app-spec.support-desk.json',
+ apply: true,
+ 'allow-destructive': true,
+ 'clear-workspace': true,
+ workspace: workspaceDir,
+ },
+ },
+ });
+
+ await harness.main();
+
+ assert.ok(harness.events.some((e) => e.type === 'checkWorkspaceClearable' && e.dir === workspaceDir),
+ 'the guard must be consulted before any delete');
+ assert.ok(!harness.events.some((e) => e.type === 'rmSync' && e.dir === workspaceDir),
+ 'a refused workspace must NOT be removed');
+ const err = harness.stderr.join('');
+ assert.match(err, /skipped --clear-workspace/, 'the refusal must be reported, not silent');
+ assert.doesNotMatch(err, /cleared workspace/, 'and it must not claim to have cleared anything');
+ const emitted = harness.events.find((e) => e.type === 'emitResult');
+ assert.strictEqual(emitted.ok, true,
+ 'the teardown succeeded; refusing an unsafe cleanup must not turn it into a failure');
+});
+
test('teardown CLI dry-runs a positional spec with the default workspace and no destructive cleanup', async () => {
const specPath = 'D:\\Projects\\power-platform-skills-sdk\\plugins\\model-apps\\samples\\app-spec.support-desk.json';
const harness = loadTeardownCli({
diff --git a/plugins/model-apps/scripts/tests/verify-spec.test.js b/plugins/model-apps/scripts/tests/verify-spec.test.js
index 8d3a9df39..858344a9b 100644
--- a/plugins/model-apps/scripts/tests/verify-spec.test.js
+++ b/plugins/model-apps/scripts/tests/verify-spec.test.js
@@ -1211,4 +1211,309 @@ test('parseFetchXml keeps the value attribute authoritative, and no-operand oper
const noOperand = `<fetch><entity name="a"><condition attribute="ownerid" operator="eq-userid"/></entity></fetch>`;
assert.deepStrictEqual(parseFetchXml(noOperand).conditions, [{ attribute: 'ownerid', operator: 'eq-userid', value: undefined }]);
-});
\ No newline at end of file
+});
+
+// --- #584 item 6: --verify proves the deployed form TOPOLOGY, not just that a form exists ---------
+//
+// Form verification used to check (entity, name, type) identity and the default flag only, so every
+// wrong-layout failure this plugin has hit — fields flattened into the first section, a tab appended
+// on every rebuild, a relocated field piled into a full row — finished with an unqualified PASS.
+const TOPO_SPEC = () => ({
+ solution: { uniqueName: 's', publisherPrefix: 'new' },
+ app: { name: 'A' },
+ entities: [{ schemaName: 'new_ticket', primaryAttribute: { schemaName: 'new_name' }, columns: [] }],
+ forms: [{ entity: 'new_ticket', name: 'Ticket Main', layout: 'explicit', tabs: [
+ { name: 'tab_overview', label: 'Overview', columns: [
+ { width: '60%', sections: [{ name: 'sec_left', label: 'L', fields: ['new_name'] }] },
+ { width: '40%', sections: [{ name: 'sec_right', label: 'R', fields: ['new_notes'] }] },
+ ] },
+ ] }],
+});
+const topoXml = (placement) => `<form><tabs><tab name="tab_overview"><columns>`
+ + `<column width="60%"><sections><section name="sec_left"><rows><row>`
+ + (placement.left || []).map((f) => `<cell><control datafieldname="${f}" /></cell>`).join('')
+ + `</row></rows></section></sections></column>`
+ + `<column width="40%"><sections><section name="sec_right"><rows><row>`
+ + (placement.right || []).map((f) => `<cell><control datafieldname="${f}" /></cell>`).join('')
+ + `</row></rows></section></sections></column>`
+ + `</columns></tab></tabs></form>`;
+
+const topoRead = (xml, over) => Object.assign({
+ // Enough of the reader surface for verifySpec to run end to end; only the form checks matter here.
+ findTable: async () => ({ logicalName: 'new_ticket' }),
+ findColumns: async () => [],
+ sitemapXml: async () => '',
+ queryRecords: async (set) => (set === 'systemform' ? [{ formid: 'f1', name: 'Ticket Main', objecttypecode: 'new_ticket', type: 2, isdefault: true }] : []),
+ formTopology: async () => xml,
+}, over || {});
+
+const topoCheck = async (xml, specMutator) => {
+ const spec = TOPO_SPEC();
+ if (specMutator) specMutator(spec);
+ const res = await verifySpec(spec, topoRead(xml));
+ return (res.checks || []).find((c) => c.kind === 'form-topology');
+};
+
+test('verify PASSES when the deployed layout matches the authored one', async () => {
+ const chk = await topoCheck(topoXml({ left: ['new_name'], right: ['new_notes'] }));
+ assert.ok(chk, 'a form-topology check must be produced for an explicit layout');
+ assert.strictEqual(chk.present, true, `expected a pass; got ${chk && chk.detail}`);
+});
+
+// THE regression this exists for: the exact shape #575 deployed — everything flattened into the
+// first section. The field list is complete, so every pre-existing check still passes.
+test('verify FAILS when fields are flattened into the first section', async () => {
+ const chk = await topoCheck(topoXml({ left: ['new_name', 'new_notes'], right: [] }));
+ assert.strictEqual(chk.present, false, 'a flattened layout must not verify');
+ assert.match(chk.detail, /new_notes/, `the offending field should be named; got ${chk.detail}`);
+ assert.match(chk.detail, /sec_left/, 'and where it actually landed');
+});
+
+test('verify FAILS when an authored section is absent from the deployed form', async () => {
+ const xml = `<form><tabs><tab name="tab_overview"><columns>`
+ + `<column width="60%"><sections><section name="sec_left"><rows><row><cell><control datafieldname="new_name" /></cell></row></rows></section></sections></column>`
+ + `</columns></tab></tabs></form>`;
+ const chk = await topoCheck(xml);
+ assert.strictEqual(chk.present, false);
+ assert.match(chk.detail, /sec_right/, `the missing section should be named; got ${chk.detail}`);
+});
+
+// Fail-closed: an unreadable layout is UNVERIFIED, which must never read as correct.
+test('verify reports a form whose layout cannot be read as NOT proven, rather than skipping it', async () => {
+ const spec = TOPO_SPEC();
+ const res = await verifySpec(spec, topoRead(null, { formTopology: async () => { throw new Error('boom'); } }));
+ const chk = (res.checks || []).find((c) => c.kind === 'form-topology');
+ assert.ok(chk, 'the check must still be produced');
+ assert.strictEqual(chk.present, false, 'an unreadable layout is not a passing layout');
+ assert.match(chk.detail, /unverified|could not read/i);
+});
+
+// An `auto` layout declares no shape, so there is nothing to prove and no check is emitted — this
+// keeps the oracle from inventing a topology expectation the author never stated.
+test('verify emits no topology check for an auto layout', async () => {
+ const spec = TOPO_SPEC();
+ spec.forms = [{ entity: 'new_ticket', name: 'Ticket Main' }];
+ const res = await verifySpec(spec, topoRead(topoXml({ left: ['new_name'], right: [] })));
+ assert.strictEqual((res.checks || []).filter((c) => c.kind === 'form-topology').length, 0);
+});
+
+// The engine appends sub-grid and notes sections the spec never declares, and a maker may add their
+// own fields. The oracle grades the AUTHORED subset, so extras must not fail it.
+test('verify tolerates deployed sections and fields the spec never declared', async () => {
+ const xml = `<form><tabs><tab name="tab_overview"><columns>`
+ + `<column width="60%"><sections>`
+ + `<section name="sec_left"><rows><row><cell><control datafieldname="new_name" /></cell></row></rows></section>`
+ + `<section name="section_grid_new_note"><rows><row><cell><control id="g" /></cell></row></rows></section>`
+ + `</sections></column>`
+ + `<column width="40%"><sections><section name="sec_right"><rows><row>`
+ + `<cell><control datafieldname="new_notes" /></cell><cell><control datafieldname="new_makeradded" /></cell>`
+ + `</row></rows></section></sections></column>`
+ + `</columns></tab></tabs></form>`;
+ const chk = await topoCheck(xml);
+ assert.strictEqual(chk.present, true, `extras must not fail the authored subset; got ${chk && chk.detail}`);
+});
+// --- #N3: the verifier must match containers the way the BUILD does ------------------------------
+// LIVE-REPRODUCED: reshaping an auto-built form to an explicit layout succeeds — the build reuses
+// the existing containers and deliberately does NOT rename them, because form scripts and business
+// rules reference a section by name — and then verify failed the very build it had just done,
+// because it looked the section up by the AUTHORED name only.
+const migratedXml = () => `<form><tabs><tab name="section_0_0_tab"><labels><label description="Overview" languagecode="1033"/></labels><columns>`
+ + `<column width="60%"><sections><section name="section_0_0"><labels><label description="L" languagecode="1033"/></labels><rows><row>`
+ + `<cell><labels><label description="Name" languagecode="1033"/></labels><control datafieldname="new_name" /></cell>`
+ + `</row></rows></section></sections></column>`
+ + `<column width="40%"><sections><section name="section_0_1_0"><labels><label description="R" languagecode="1033"/></labels><rows><row>`
+ + `<cell><control datafieldname="new_notes" /></cell>`
+ + `</row></rows></section></sections></column>`
+ + `</columns></tab></tabs></form>`;
+
+test('verify PASSES an auto-to-explicit migration where containers kept their deployed names', async () => {
+ const chk = await topoCheck(migratedXml());
+ assert.ok(chk, 'a form-topology check must be produced');
+ assert.strictEqual(chk.present, true,
+ `a reshape the build performed correctly must verify; got ${chk && chk.detail}`);
+});
+
+// The position fallback must not become a rubber stamp: a genuinely WRONG placement still fails,
+// even though every container matches positionally. The fields are SWAPPED rather than removed, so
+// this cannot pass merely because a field is absent — both are present, in the wrong sections.
+test('verify still FAILS a wrong placement when containers matched by position', async () => {
+ const swapped = migratedXml()
+ .replace('datafieldname="new_name"', 'datafieldname="__TMP__"')
+ .replace('datafieldname="new_notes"', 'datafieldname="new_name"')
+ .replace('datafieldname="__TMP__"', 'datafieldname="new_notes"');
+ const chk = await topoCheck(swapped);
+ assert.strictEqual(chk.present, false, 'two fields swapped between sections must fail');
+ assert.match(chk.detail, /new_name|new_notes/, `the offending field should be named; got ${chk.detail}`);
+});
+
+
+
+
+// --- N3 label/exclusion tests, built so the LABEL pass is the only route to the right answer ------
+// A fixture whose authored name matches a deployed name is resolved by the NAME pass and proves
+// nothing about labels, exclusions or defaults. In each test below the authored name matches
+// NOTHING and the positional slot points at the WRONG container, so only the behaviour under test
+// can produce a pass.
+
+// One tab, two sections; `fields` is placed in the section named by `inSection`.
+const twoSectionXml = ({ s0, s1, tabLabel = 'Overview', tabName = 'zz_tab' }) =>
+ `<form><tabs><tab name="${tabName}"><labels><label description="${tabLabel}" languagecode="1033"/></labels><columns>`
+ + `<column width="100%"><sections>${s0}${s1}</sections></column>`
+ + `</columns></tab></tabs></form>`;
+const sectionXml = (name, label, field, opts = {}) =>
+ `<section name="${name}">`
+ + (label === null ? '' : `<labels><label description="${label}" languagecode="1033"/></labels>`)
+ + `<rows><row><cell>`
+ + (opts.cellLabel ? `<labels><label description="${opts.cellLabel}" languagecode="1033"/></labels>` : '')
+ + (field ? `<control datafieldname="${field}" />` : '<control id="notescontrol" classid="{06375649}" />')
+ + `</cell></row></rows></section>`;
+// Authored: ONE section with no name (so the generated name matches nothing deployed).
+const oneAuthoredSection = (label, fields) => (spec) => {
+ spec.forms[0].tabs = [{ columns: [{ width: '100%', sections: [{ label, fields }] }] }];
+};
+
+test('container labels are XML-decoded before matching', async () => {
+ // The target is at index 1; the positional slot is index 0. Only a DECODED label resolves it.
+ const xml = twoSectionXml({
+ s0: sectionXml('zz_other', 'Other', 'new_name'),
+ s1: sectionXml('zz_rnd', 'R &amp; D', 'new_notes'),
+ });
+ const chk = await topoCheck(xml, oneAuthoredSection('R & D', ['new_notes']));
+ assert.strictEqual(chk.present, true, `an encoded label must still match; got ${chk && chk.detail}`);
+});
+
+test('an engine-owned section is not claimed by the label pass', async () => {
+ // Both sections carry label 'L'. The first is the NOTES host (a control with no datafieldname);
+ // only the engine-owned exclusion keeps the label pass off it.
+ const xml = twoSectionXml({
+ s0: sectionXml('zz_notes', 'L', null),
+ s1: sectionXml('zz_real', 'L', 'new_name'),
+ });
+ const chk = await topoCheck(xml, oneAuthoredSection('L', ['new_name']));
+ assert.strictEqual(chk.present, true,
+ `the engine-owned section must be skipped so the author's section matches; got ${chk && chk.detail}`);
+});
+
+test('a cell label is not mistaken for its section label', async () => {
+ // Section 0 has NO label of its own but contains a cell labelled 'Right'. If that leaked, the
+ // label pass would claim section 0 and the field check would fail.
+ const xml = twoSectionXml({
+ s0: sectionXml('zz_a', null, 'new_name', { cellLabel: 'Right' }),
+ s1: sectionXml('zz_b', 'Right', 'new_notes'),
+ });
+ const chk = await topoCheck(xml, oneAuthoredSection('Right', ['new_notes']));
+ assert.strictEqual(chk.present, true, `a cell label must not claim a section; got ${chk && chk.detail}`);
+});
+
+test('an omitted section label matches the compiler default the deployed form carries', async () => {
+ // `compileFormIntent` labels an unlabelled section 'Details', so the DEPLOYED section says
+ // 'Details'. Passing the raw (undefined) label would skip the label pass and take index 0.
+ const xml = twoSectionXml({
+ s0: sectionXml('zz_other', 'Other', 'new_name'),
+ s1: sectionXml('zz_details', 'Details', 'new_notes'),
+ });
+ const chk = await topoCheck(xml, oneAuthoredSection(undefined, ['new_notes']));
+ assert.strictEqual(chk.present, true,
+ `an unlabelled section must match the compiler's 'Details' default; got ${chk && chk.detail}`);
+});
+
+test('an omitted TAB label matches the compiler default the deployed form carries', async () => {
+ // Two deployed tabs; the authored (unnamed, unlabelled) tab belongs to the SECOND, which carries
+ // the compiler's 'General' default. Index 0 is the wrong tab.
+ const xml = `<form><tabs>`
+ + `<tab name="zz_other"><labels><label description="Other" languagecode="1033"/></labels><columns>`
+ + `<column width="100%"><sections>${sectionXml('zz_s0', 'Details', 'new_name')}</sections></column></columns></tab>`
+ + `<tab name="zz_general"><labels><label description="General" languagecode="1033"/></labels><columns>`
+ + `<column width="100%"><sections>${sectionXml('zz_s1', 'Details', 'new_notes')}</sections></column></columns></tab>`
+ + `</tabs></form>`;
+ const chk = await topoCheck(xml, (spec) => {
+ spec.forms[0].tabs = [{ columns: [{ width: '100%', sections: [{ fields: ['new_notes'] }] }] }];
+ });
+ assert.strictEqual(chk.present, true,
+ `an unlabelled tab must match the compiler's 'General' default; got ${chk && chk.detail}`);
+});
+
+// --- PR review: a missing CAPABILITY is not a verified layout ------------------------------------
+// Gating the whole oracle on `typeof read.formTopology === 'function'` meant a reader without that
+// capability skipped EVERY layout check, so an explicit form passed verify on identity and default
+// checks alone — no layout proof at all. Same fail-open shape as gating a guard on a method's
+// existence elsewhere in this PR.
+test('verify reports an explicit layout as UNVERIFIED when the reader cannot read layouts', async () => {
+ const spec = TOPO_SPEC();
+ const read = topoRead(null);
+ delete read.formTopology; // a reader that simply does not expose the capability
+ const res = await verifySpec(spec, read);
+ const chk = (res.checks || []).find((c) => c.kind === 'form-topology');
+ assert.ok(chk, 'an explicit layout must still produce a form-topology check');
+ assert.strictEqual(chk.present, false, 'no layout source means UNVERIFIED, not verified');
+ assert.match(chk.detail, /no deployed-layout source|UNVERIFIED/);
+});
+
+// A FAILED form-id resolution is not the same as a form that does not exist: the form may be there
+// and correct, and skipping the check let a transient read failure pass as a verified layout.
+test('verify reports UNVERIFIED when the deployed form id cannot be resolved', async () => {
+ const spec = TOPO_SPEC();
+ const res = await verifySpec(spec, topoRead(topoXml({ left: ['new_name'], right: ['new_notes'] }), {
+ queryRecords: async (set) => {
+ if (set === 'systemform') throw new Error('transient systemform read failure');
+ return [];
+ },
+ }));
+ const chk = (res.checks || []).find((c) => c.kind === 'form-topology');
+ assert.ok(chk, 'a resolution FAILURE must be reported, not silently skipped');
+ assert.strictEqual(chk.present, false);
+ assert.match(chk.detail, /could not resolve the deployed form id/);
+});
+
+// --- PR review: the oracle must prove SHAPE, not just field-to-section membership ---------------
+// Comparing only "is each field in the right section" meant the exact regression this branch fixes
+// — a field piled into an already-full row, or a widened span overflowing one — still produced a
+// PASSING form-topology check. Occupancy and authored spans are now proven.
+const shapeXml = ({ cells, columns = '11' }) =>
+ `<form><tabs><tab name="tab_overview"><labels><label description="Overview" languagecode="1033"/></labels><columns>`
+ + `<column width="100%"><sections><section name="sec_left" columns="${columns}">`
+ + `<labels><label description="L" languagecode="1033"/></labels><rows><row>`
+ + cells.map((c) => `<cell colspan="${c.span}"><control datafieldname="${c.f}" /></cell>`).join('')
+ + `</row></rows></section></sections></column>`
+ + `</columns></tab></tabs></form>`;
+const shapeSpec = (fields) => (spec) => {
+ spec.forms[0].tabs = [{ name: 'tab_overview', label: 'Overview', columns: [
+ { width: '100%', sections: [{ name: 'sec_left', label: 'L', columns: 2, fields }] }] }];
+};
+
+test('verify FAILS when a deployed row carries more content than its grid', async () => {
+ // Two colspan-1 cells plus a widened one: 2 + 1 = 3 columns of content in a 2-column section.
+ const chk = await topoCheck(
+ shapeXml({ cells: [{ f: 'new_name', span: 2 }, { f: 'new_notes', span: 1 }] }),
+ shapeSpec([{ name: 'new_name', colspan: 2 }, 'new_notes']));
+ assert.strictEqual(chk.present, false, 'an overflowing row must not verify');
+ assert.match(chk.detail, /3 columns of content in a 2-column section/);
+});
+
+test('verify FAILS when an AUTHORED span does not match the deployed one', async () => {
+ const chk = await topoCheck(
+ shapeXml({ cells: [{ f: 'new_name', span: 1 }] }),
+ shapeSpec([{ name: 'new_name', colspan: 2 }]));
+ assert.strictEqual(chk.present, false, 'a declared span that did not deploy must fail');
+ assert.match(chk.detail, /colspan 1, the spec declares 2/);
+});
+
+// The counterpart rule the build itself follows: an UNDECLARED span is "no opinion", so a cell a
+// maker widened by hand must survive both the rebuild and the verification.
+test('verify TOLERATES a deployed span the spec never declared', async () => {
+ const chk = await topoCheck(
+ shapeXml({ cells: [{ f: 'new_name', span: 2 }], columns: '1111' }),
+ shapeSpec(['new_name']));
+ assert.strictEqual(chk.present, true, `an undeclared span must not fail; got ${chk && chk.detail}`);
+});
+
+// A section that declares no width cannot be checked for overflow — unknown is not "one column".
+test('verify skips the occupancy check when the deployed section declares no width', async () => {
+ const xml = `<form><tabs><tab name="tab_overview"><labels><label description="Overview" languagecode="1033"/></labels><columns>`
+ + `<column width="100%"><sections><section name="sec_left">`
+ + `<labels><label description="L" languagecode="1033"/></labels><rows><row>`
+ + `<cell><control datafieldname="new_name" /></cell><cell><control datafieldname="new_notes" /></cell>`
+ + `</row></rows></section></sections></column></columns></tab></tabs></form>`;
+ const chk = await topoCheck(xml, shapeSpec(['new_name', 'new_notes']));
+ assert.strictEqual(chk.present, true, `unknown width must not invent an overflow; got ${chk && chk.detail}`);
+});
diff --git a/plugins/model-apps/scripts/tests/workspace-paths.test.js b/plugins/model-apps/scripts/tests/workspace-paths.test.js
new file mode 100644
index 000000000..0b4be106a
--- /dev/null
+++ b/plugins/model-apps/scripts/tests/workspace-paths.test.js
@@ -0,0 +1,167 @@
+'use strict';
+// #587 item 8 — `--clear-workspace` ran a recursive delete on whatever `--workspace` named.
+//
+// The danger is the timing: cleanup happens after a SUCCESSFUL teardown, which is the moment an
+// operator is least expecting data loss. A mistyped path, or a shell variable that expanded to a
+// repo root or home directory, was recursively removed with `force: true`.
+//
+// The first fix keyed on the directory NAME, and a live run caught that being wrong: every CLI here
+// accepts `--workspace <any-dir>`, so `--workspace lvws` — a genuine workspace the build had just
+// written 20 files into — was refused. Identity is therefore established by CONTENT: the SDK's own
+// workspace manifest. These tests pin BOTH directions, because a guard that refuses everything is
+// as broken as one that permits everything.
+const test = require('node:test');
+const assert = require('node:assert');
+const path = require('node:path');
+const os = require('node:os');
+const fs = require('node:fs');
+
+const { WORKSPACE_DIR_NAME, WORKSPACE_MANIFEST, checkWorkspaceClearable } = require('../lib/workspace-paths.js');
+
+const dirs = [];
+test.after(() => { for (const d of dirs) fs.rmSync(d, { recursive: true, force: true }); });
+
+// Real directories on disk, so the accept path is never proved with a stub alone.
+function makeDir(name, manifest) {
+ const base = fs.mkdtempSync(path.join(os.tmpdir(), 'wsclear-'));
+ dirs.push(base);
+ const d = path.join(base, 'app', name);
+ fs.mkdirSync(d, { recursive: true });
+ if (manifest !== undefined) fs.writeFileSync(path.join(d, WORKSPACE_MANIFEST), manifest, 'utf8');
+ return d;
+}
+const SDK_MANIFEST = JSON.stringify({ instanceUrl: 'https://contoso.crm.dynamics.com/', artifacts: [] });
+
+// A directory named `.maker-workspace` is clearable only when it PROVES it is one. The name alone
+// is not identity: `--workspace` is caller-supplied, so accepting the basename let
+// `--workspace /some/important/.maker-workspace` reach recursive deletion with no manifest at all.
+test('the conventionally-named workspace is clearable WHEN it carries the manifest', () => {
+ const r = checkWorkspaceClearable(makeDir(WORKSPACE_DIR_NAME, SDK_MANIFEST));
+ assert.strictEqual(r.ok, true, `a genuine workspace must be clearable, got ${JSON.stringify(r)}`);
+ assert.strictEqual(path.basename(r.target), WORKSPACE_DIR_NAME);
+});
+
+test('a directory with the conventional NAME but no manifest is refused', () => {
+ const r = checkWorkspaceClearable(makeDir(WORKSPACE_DIR_NAME));
+ assert.strictEqual(r.ok, false, 'the default name is not proof of identity');
+ assert.match(r.reason, /not an SDK workspace/);
+});
+
+// The regression a LIVE run caught: `--workspace lvws` is supported by every CLI here, and the
+// first version of this guard refused it — breaking cleanup for anyone using a custom name.
+test('a CUSTOM-named directory carrying the SDK workspace manifest is clearable', () => {
+ const d = makeDir('lvws', SDK_MANIFEST);
+ const r = checkWorkspaceClearable(d);
+ assert.strictEqual(r.ok, true,
+ `--workspace <custom-dir> is supported, so a real workspace must clear: ${JSON.stringify(r)}`);
+});
+
+test('a custom-named directory with no manifest is refused', () => {
+ const r = checkWorkspaceClearable(makeDir('src'));
+ assert.strictEqual(r.ok, false);
+ assert.match(r.reason, /neither named|not an SDK workspace/);
+});
+
+// Identity is the manifest's CONTENT, not its filename — otherwise any npm package or bundler
+// output directory would qualify, and the original bug returns wearing a different hat.
+test('a manifest.json belonging to something else does not make a directory clearable', () => {
+ for (const foreign of [
+ JSON.stringify({ name: 'my-pkg', version: '1.0.0' }), // npm
+ JSON.stringify({ artifacts: [] }), // no instanceUrl
+ JSON.stringify({ instanceUrl: 'https://x/' }), // no artifacts
+ JSON.stringify([{ instanceUrl: 'https://x/', artifacts: [] }]), // array, not an object
+ 'not json at all',
+ ]) {
+ const r = checkWorkspaceClearable(makeDir('build', foreign));
+ assert.strictEqual(r.ok, false, `${foreign.slice(0, 40)} must not qualify`);
+ }
+});
+
+test('a BOM-prefixed manifest is still recognised', () => {
+ // pac and some editors write UTF-8 with a BOM; JSON.parse throws on it, so it is stripped.
+ const r = checkWorkspaceClearable(makeDir('ws2', '\uFEFF' + SDK_MANIFEST));
+ assert.strictEqual(r.ok, true, `a BOM must not make a real workspace unrecognisable: ${JSON.stringify(r)}`);
+});
+
+test('empty, blank and non-string paths are refused rather than resolved to the cwd', () => {
+ // `path.resolve('')` is the CWD — so an unset shell variable used to mean "delete the directory
+ // the command happens to be running in".
+ for (const bad of ['', ' ', undefined, null, 42]) {
+ assert.strictEqual(checkWorkspaceClearable(bad).ok, false, `${JSON.stringify(bad)} must not be clearable`);
+ }
+});
+
+test('a filesystem root, and a workspace directly inside one, are refused', () => {
+ const root = path.parse(process.cwd()).root;
+ assert.strictEqual(checkWorkspaceClearable(root).ok, false);
+ const wsAtRoot = checkWorkspaceClearable(path.join(root, WORKSPACE_DIR_NAME));
+ assert.strictEqual(wsAtRoot.ok, false, 'a workspace directly inside a root is a truncated path, not a project');
+ assert.match(wsAtRoot.reason, /filesystem root/);
+});
+
+// Junctions need elevation on Windows, so the filesystem answers are injected. The RULES are what
+// is under test, not node's fs.
+test('a symlinked or junctioned workspace is refused', () => {
+ const ws = path.join(os.tmpdir(), 'proj', WORKSPACE_DIR_NAME);
+ const r = checkWorkspaceClearable(ws, {
+ lstatSync: () => ({ isSymbolicLink: () => true, isDirectory: () => true }),
+ realpathSync: () => ws,
+ readFileSync: () => SDK_MANIFEST,
+ });
+ assert.strictEqual(r.ok, false);
+ assert.match(r.reason, /symlink\/junction/);
+});
+
+// The escape a name check alone cannot catch: the lexical name is right, but it resolves elsewhere.
+test('a workspace name that resolves to a non-workspace is refused', () => {
+ const ws = path.join(os.tmpdir(), 'proj', WORKSPACE_DIR_NAME);
+ const r = checkWorkspaceClearable(ws, {
+ lstatSync: () => ({ isSymbolicLink: () => false, isDirectory: () => true }),
+ realpathSync: () => path.join(os.homedir(), 'Documents'),
+ readFileSync: () => { throw Object.assign(new Error('ENOENT'), { code: 'ENOENT' }); },
+ });
+ assert.strictEqual(r.ok, false, 'identity must be tested on the RESOLVED path');
+ assert.match(r.reason, /neither named|not an SDK workspace/);
+});
+
+test('a file wearing the workspace name is refused', () => {
+ const ws = path.join(os.tmpdir(), 'proj', WORKSPACE_DIR_NAME);
+ const r = checkWorkspaceClearable(ws, {
+ lstatSync: () => ({ isSymbolicLink: () => false, isDirectory: () => false }),
+ realpathSync: () => ws,
+ readFileSync: () => SDK_MANIFEST,
+ });
+ assert.strictEqual(r.ok, false);
+ assert.match(r.reason, /not a directory/);
+});
+
+test('a missing workspace is reported as nothing to clear, not as an error to fix', () => {
+ const r = checkWorkspaceClearable(path.join(os.tmpdir(), 'no-such-proj-xyz', WORKSPACE_DIR_NAME));
+ assert.strictEqual(r.ok, false);
+ assert.match(r.reason, /nothing to clear/);
+});
+
+// Adversarial review: the root rules were applied to the LEXICAL path only, so an ancestor junction
+// could land the delete at a root-level directory that passing directly would have refused.
+// Measured: `D:\review-link\project\.maker-workspace` resolving to `D:\.maker-workspace` was
+// accepted. The rules must hold for the path actually deleted, not merely the one typed.
+test('an ancestor junction cannot land the delete at a filesystem root', () => {
+ const root = path.parse(process.cwd()).root;
+ const typed = path.join(root, 'review-link', 'project', WORKSPACE_DIR_NAME);
+ const r = checkWorkspaceClearable(typed, {
+ lstatSync: () => ({ isSymbolicLink: () => false, isDirectory: () => true }),
+ realpathSync: () => path.join(root, WORKSPACE_DIR_NAME),
+ readFileSync: () => JSON.stringify({ instanceUrl: 'https://x/', artifacts: [] }),
+ });
+ assert.strictEqual(r.ok, false, 'the canonical target is root-level and must be refused');
+ assert.match(r.reason, /filesystem root/);
+
+ // CONTROL: the same junction landing somewhere ordinary is still allowed, so this is a root rule
+ // and not a blanket ban on resolving elsewhere.
+ const ok = checkWorkspaceClearable(typed, {
+ lstatSync: () => ({ isSymbolicLink: () => false, isDirectory: () => true }),
+ realpathSync: () => path.join(root, 'real', 'project', WORKSPACE_DIR_NAME),
+ readFileSync: () => JSON.stringify({ instanceUrl: 'https://x/', artifacts: [] }),
+ });
+ assert.strictEqual(ok.ok, true, `an ordinary canonical target must still clear: ${JSON.stringify(ok)}`);
+});
diff --git a/plugins/model-apps/scripts/vendor/PROVENANCE.json b/plugins/model-apps/scripts/vendor/PROVENANCE.json
index fc0d62e26..006cb8207 100644
--- a/plugins/model-apps/scripts/vendor/PROVENANCE.json
+++ b/plugins/model-apps/scripts/vendor/PROVENANCE.json
@@ -1,14 +1,14 @@
{
- "commit": "9719a713a0e9cec3353ff042a1bf22c34c7ce6ed",
- "subject": "Fix Monitoring Hub time-series routing",
+ "commit": "50a43bd3f570ec9ea5545dcc257fae1949f22aaa",
+ "subject": "fix(cds-maker-sdk): three regressions from the last two PRs, plus BPF concurrency tokens",
"dirtySdkPackage": 0,
- "libBuiltAt": "2026-09-17T00:49:27.419Z",
- "newestSrcAt": "2026-09-16T22:30:59.712Z",
+ "libBuiltAt": "2026-09-17T23:34:42.907Z",
+ "newestSrcAt": "2026-09-17T23:33:11.099Z",
"libIsStale": false,
"nostub": false,
"esbuildVersion": "0.28.1",
"nodeVersion": "v20.20.2",
- "builtAt": "2026-09-17T00:49:41.071Z",
- "bundleSha256": "7b3394af03f9cb701e5ac23dcd5064fbf9e31870712d642872aff0b9d0fd442b",
- "bundleBytes": 702409
+ "builtAt": "2026-09-17T23:35:33.267Z",
+ "bundleSha256": "609cfc9fda047b2a3f6cbea80823942e81e8b99b44a044a681ca98dcb6379467",
+ "bundleBytes": 708362
}
diff --git a/plugins/model-apps/scripts/vendor/cds-maker-sdk.cjs b/plugins/model-apps/scripts/vendor/cds-maker-sdk.cjs
index df01b4f01..043abad41 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;
})();
-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}:
+var XT=Object.create;var gs=Object.defineProperty;var YT=Object.getOwnPropertyDescriptor;var ZT=Object.getOwnPropertyNames;var eP=Object.getPrototypeOf,tP=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 v=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Ur=(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 ZT(t))!tP.call(e,i)&&i!==r&&gs(e,i,{get:()=>t[i],enumerable:!(n=YT(t,i))||n.enumerable});return e},dn=(e,t,r)=>(hs(e,t,"default"),r&&hs(r,t,"default")),ne=(e,t,r)=>(r=e!=null?XT(eP(e)):{},hs(t||!e||!e.__esModule?gs(r,"default",{value:e,enumerable:!0}):r,e)),mr=e=>hs(gs({},"__esModule",{value:!0}),e);var Wn=v(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 Zm;(function(e){e.None="None",e.UserOwned="UserOwned",e.TeamOwned="TeamOwned",e.BusinessOwned="BusinessOwned",e.OrganizationOwned="OrganizationOwned",e.BusinessParented="BusinessParented",e.Filtered="Filtered"})(Zm||(C.OwnershipTypes=Zm={}));var eh;(function(e){e.User="Microsoft.Dynamics.CRM.systemuser",e.Team="Microsoft.Dynamics.CRM.team"})(eh||(C.PrincipalType=eh={}));var th;(function(e){e[e.DoNotDisplayInActivityMenus=0]="DoNotDisplayInActivityMenus",e[e.DisplayInActivityMenus=1]="DisplayInActivityMenus"})(th||(C.ActivityTypeMask=th={}));var rh;(function(e){e.Activity="Activity",e.Virtual="Virtual",e.Standard="Standard",e.Elastic="Elastic"})(rh||(C.TableTypes=rh={}));var nh;(function(e){e.Standard="Standard",e.Virtual="Virtual",e.Elastic="Elastic"})(nh||(C.TableTypeCode=nh={}));var ih;(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"})(ih||(C.FormType=ih={}));var ah;(function(e){e[e.ClassicForm=0]="ClassicForm",e[e.AirForm=1]="AirForm",e[e.ConvertedICForm=2]="ConvertedICForm"})(ah||(C.FormPresentation=ah={}));var oh;(function(e){e[e.Inactive=0]="Inactive",e[e.Active=1]="Active"})(oh||(C.ActivationState=oh={}));var sh;(function(e){e[e.String=0]="String",e[e.Number=1]="Number",e[e.Picklist=2]="Picklist"})(sh||(C.AttributeType=sh={}));var lh;(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"})(lh||(C.ViewType=lh={}));var uh;(function(e){e[e.ASPChart=0]="ASPChart",e[e.PowerBI=1]="PowerBI"})(uh||(C.ChartsType=uh={}));var ch;(function(e){e[e.DataAndInteractionCentric=0]="DataAndInteractionCentric",e[e.InteractionCentric=1]="InteractionCentric"})(ch||(C.ChartType=ch={}));var dh;(function(e){e[e.Published=0]="Published",e[e.Unpublished=1]="Unpublished",e[e.Deleted=2]="Deleted",e[e.DeletedUnpublished=3]="DeletedUnpublished"})(dh||(C.ComponentState=dh={}));var ph;(function(e){e[e.None=1]="None",e[e.Sandbox=2]="Sandbox",e[e.External=3]="External"})(ph||(C.PluginIsolationMode=ph={}));var fh;(function(e){e[e.BasicAuth=0]="BasicAuth"})(fh||(C.AuthType=fh={}));var mh;(function(e){e[e.Database=0]="Database",e[e.Disk=1]="Disk",e[e.Normal=2]="Normal",e[e.AzureWebApp=3]="AzureWebApp"})(mh||(C.PluginSourceType=mh={}));var hh;(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"})(hh||(C.AttributeTypeCode=hh={}));var gh;(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"})(gh||(C.AttributeTypeName=gh={}));var vh;(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"})(vh||(C.AttributeFormatCode=vh={}));var yh;(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"})(yh||(C.AttributeFormatName=yh={}));var bh;(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"})(bh||(C.AttributeTypeCodeNum=bh={}));var wh;(function(e){e.Picklist="Picklist",e.State="State",e.Status="Status",e.Boolean="Boolean"})(wh||(C.OptionSetType=wh={}));var Ah;(function(e){e[e.Draft=0]="Draft",e[e.Activated=1]="Activated"})(Ah||(C.StateCode=Ah={}));var Ch;(function(e){e[e.Draft=1]="Draft",e[e.Activated=2]="Activated"})(Ch||(C.StatusCode=Ch={}));var Sh;(function(e){e[e.Enabled=0]="Enabled",e[e.Disabled=1]="Disabled"})(Sh||(C.StateCodeEnabledDisabled=Sh={}));var Eh;(function(e){e[e.Enabled=1]="Enabled",e[e.Disabled=2]="Disabled"})(Eh||(C.StatusCodeEnabledDisabled=Eh={}));var Nh;(function(e){e[e.Definition=1]="Definition",e[e.Activation=2]="Activation",e[e.Template=3]="Template"})(Nh||(C.WorkflowTypeCode=Nh={}));var Dh;(function(e){e[e.User=1]="User",e[e.BusinessUnit=2]="BusinessUnit",e[e.ParentChildBusinessUnit=3]="ParentChildBusinessUnit",e[e.Organization=4]="Organization"})(Dh||(C.WorkflowScope=Dh={}));var Ih;(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"})(Ih||(C.WorkflowCategory=Ih={}));var _h;(function(e){e[e.None=-1]="None",e[e.BusinessFlow=0]="BusinessFlow",e[e.TaskFlow=1]="TaskFlow"})(_h||(C.BusinessProcessType=_h={}));var Th;(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"})(Th||(C.AppSubType=Th={}));var Ph;(function(e){e.OneToManyRelationship="OneToManyRelationship",e.ManyToManyRelationship="ManyToManyRelationship"})(Ph||(C.RelationshipType=Ph={}));var Oh;(function(e){e.ManyToOneRelationship="ManyToOneRelationship",e.OneToManyRelationship="OneToManyRelationship",e.ManyToManyRelationship="ManyToManyRelationship"})(Oh||(C.RelationshipTypeExt=Oh={}));var Rh;(function(e){e.NoCascade="NoCascade",e.Cascade="Cascade",e.Active="Active",e.UserOwned="UserOwned",e.RemoveLink="RemoveLink",e.Restrict="Restrict"})(Rh||(C.CascadeType=Rh={}));var Fh;(function(e){e.None="None",e.Append="Append",e.ParentChild="ParentChild",e.Pointer="Pointer",e.Inheritance="Inheritance"})(Fh||(C.RelationshipSecurityTypes=Fh={}));var xh;(function(e){e[e.Active=1]="Active",e[e.Inactive=2]="Inactive"})(xh||(C.ViewStatusCode=xh={}));var Lh;(function(e){e[e.Active=0]="Active",e[e.Inactive=1]="Inactive"})(Lh||(C.ViewStateCode=Lh={}));var kh;(function(e){e.Active="Active",e.Failed="Failed",e.InProgress="InProgress",e.Pending="Pending"})(kh||(C.EntityKeyIndexStatus=kh={}));var Mh;(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"})(Mh||(C.SolutionComponentTypeCode=Mh={}));var Bh;(function(e){e[e.IncludeSubcomponents=0]="IncludeSubcomponents",e[e.DoNotIncludeSubcomponents=1]="DoNotIncludeSubcomponents",e[e.IncludeAsShellOnly=2]="IncludeAsShellOnly"})(Bh||(C.RootComponentBehavior=Bh={}));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 Uh;(function(e){e.MultiSelectPicklist="MultiSelectPicklist",e.File="File",e.Image="Image"})(Uh||(C.SolutionComponentVirtualAttributeSubtype=Uh={}));function rP(e){let t=vs[e];return ys[t]}C.SolutionComponentTypeCodeToEntityTypeCodeExt=rP;function nP(e){let t=ys[e];return vs[t]}C.SolutionEntityTypeCodeExtToComponentTypeCode=nP;var $h;(function(e){e.Active="Active",e.Auto="Auto",e.Disabled="Disabled",e.Inactive="Inactive"})($h||(C.ImeMode=$h={}));var qh;(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"})(qh||(C.SourceType=qh={}));var Vh;(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"})(Vh||(C.StringFormatName=Vh={}));var Gh;(function(e){e[e.PrecisionProperty=0]="PrecisionProperty",e[e.Organization=1]="Organization",e[e.TransactionCurrency=2]="TransactionCurrency"})(Gh||(C.PrecisionSource=Gh={}));var zh;(function(e){e.UserLocal="UserLocal",e.DateOnly="DateOnly",e.TimeZoneIndependent="TimeZoneIndependent"})(zh||(C.DateTimeBehavior=zh={}));var Wh;(function(e){e.DateOnly="DateOnly",e.DateAndTime="DateAndTime"})(Wh||(C.DateTimeFormat=Wh={}));var Hh;(function(e){e.None="None",e.Duration="Duration",e.TimeZone="TimeZone",e.Language="Language",e.Locale="Locale"})(Hh||(C.IntegerFormat=Hh={}));var jh;(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"})(jh||(C.WebResourceTypeCode=jh={}));var Jh;(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"})(Jh||(C.SdkMessageProcessingStage=Jh={}));var Qh;(function(e){e[e.ServerOnly=0]="ServerOnly",e[e.OutlookClientOnly=1]="OutlookClientOnly",e[e.Both=2]="Both"})(Qh||(C.SupportedDeployment=Qh={}));var Kh;(function(e){e[e.Synchronous=0]="Synchronous",e[e.Asynchronous=1]="Asynchronous"})(Kh||(C.SdkMessageProcessingMode=Kh={}));var Xh;(function(e){e[e.ReportingServicesReport=1]="ReportingServicesReport",e[e.OtherReport=2]="OtherReport",e[e.LinkedReport=3]="LinkedReport"})(Xh||(C.ReportTypeCode=Xh={}));var Yh;(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"})(Yh||(C.ConnectionRoleCategory=Yh={}));var Zh;(function(e){e[e.Name=1]="Name",e[e.Address=2]="Address"})(Zh||(C.ServiceNamespaceFormat=Zh={}));var eg;(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"})(eg||(C.ServiceEndpointContract=eg={}));var tg;(function(e){e[e.Normal=1]="Normal",e[e.Federated=2]="Federated"})(tg||(C.ServiceEndpointConnectionMode=tg={}));var rg;(function(e){e.CannotDeleteInUseComponent="0x8004f01f",e.CannotDeleteInUseAttribute="0x80048418",e.CannotDeleteInUseOptionSet="0x80048417",e.CannotDeleteInUseEntity="0x80048420",e.CannotUninstallWithDependencies="0x8004F01D"})(rg||(C.DeleteDependencyErrorCode=rg={}));var ng;(function(e){e.SystemAdministrator="627090FF-40A3-4053-8790-584EDC5BE201",e.SystemCustomizer="119F245C-3CC8-4B62-B31C-D1A046CED15D"})(ng||(C.DefaultRoleTemplates=ng={}));var ig;(function(e){e[e.DefaultTeamPrivilege=0]="DefaultTeamPrivilege",e[e.DirectUserAndTeamPrivilege=1]="DirectUserAndTeamPrivilege"})(ig||(C.RoleInheritance=ig={}));var ag;(function(e){e[e.NotSpecified=0]="NotSpecified",e[e.CustomConnector=1]="CustomConnector"})(ag||(C.ConnectorTypeEnum=ag={}));var og;(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"})(og||(C.EnvironmentVariableDefinitionTypeEnum=og={}));var sg;(function(e){e[e.Owner=0]="Owner",e[e.Access=1]="Access",e[e.AADSecurityGroup=2]="AADSecurityGroup",e[e.AADOfficeGroup=3]="AADOfficeGroup"})(sg||(C.TeamTypeEnum=sg={}));var lg;(function(e){e.Bots="bots"})(lg||(C.KnownCustomSolutionComponentEntitySetName=lg={}));var ug;(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"})(ug||(C.QueryType=ug={}))});var re=v(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 cg=Symbol.for("cds-maker-sdk.partialWriteTokens");function iP(e,t){return typeof e=="object"&&e!==null&&(e[cg]=t),e}Y.withPartialTokens=iP;function aP(e){let t=e;for(let r=0;t&&typeof t=="object"&&r<8;r++){let n=t[cg];if(n&&typeof n=="object")return n;t=t.cause}}Y.readPartialTokens=aP;var cc=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=cc;var dc=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=dc;var pc=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 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
+`)),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=pc;var fc=class extends Xe{constructor(t){super("INVALID_ARGUMENT",t)}};Y.InvalidArgumentError=fc;var mc=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=mc;var hc=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=hc;var gc=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=gc;var vc=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=vc;var yc=class extends Xe{constructor(t){super("WORKSPACE_NOT_INITIALIZED",`Workspace not initialized at ${t}. Call initWorkspace() first.`),this.workspacePath=t}};Y.WorkspaceNotInitializedError=yc;var bc=class extends Xe{constructor(t,r){super("NOT_IMPLEMENTED",`Operation '${t}' is not implemented yet${r?`: ${r}`:""}.`),this.operation=t}};Y.NotImplementedError=bc;var wc=class extends Xe{constructor(t,r){super("INVALID_JSON_POINTER",`Invalid JSON Pointer '${t}': ${r}`),this.pointer=t}};Y.JsonPointerError=wc;var Ac=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=Ac;var Cc=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=Cc;var Sc=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=Sc});var ie=v(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.odataQuery=Oe.normalizeGuid=Oe.createSafeXmlElement=Oe.assertNoControlChars=Oe.assertODataName=Oe.assertXmlName=Oe.xmlText=Oe.odataPathLiteral=Oe.odataLiteral=void 0;var bs=re();function dg(e){return String(e??"").replace(/'/g,"''")}Oe.odataLiteral=dg;function oP(e){return encodeURIComponent(dg(e))}Oe.odataPathLiteral=oP;function sP(e){return String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}Oe.xmlText=sP;function pg(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}Oe.assertXmlName=pg;function lP(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}Oe.assertODataName=lP;function uP(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}Oe.assertNoControlChars=uP;function cP(e,t,r){return e.createElement(pg(t,r))}Oe.createSafeXmlElement=cP;var dP=/^[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 pP(e,t){let r=String(e??""),n=r.length===38&&r.startsWith("{")&&r.endsWith("}")?r.slice(1,-1):r;if(!dP.test(n))throw new bs.InvalidArgumentError(`${t} must be a valid GUID (got '${e}')`);return n.toLowerCase()}Oe.normalizeGuid=pP;function fP(e){let t=[];for(let[r,n]of e)n!=null&&n!==""&&t.push(`${r}=${encodeURIComponent(String(n))}`);return t.length>0?`?${t.join("&")}`:""}Oe.odataQuery=fP});var be=v(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 yi=re(),qa=ie();ae.VERSION_CONFLICT_CODE="VERSION_CONFLICT";ae.UPDATE_NO_ETAG_CODE="ARTIFACT_UPDATE_NO_ETAG";function mP(e,t){return{query:`?$select=${encodeURIComponent(e)}`,options:{headers:{...t??{},Prefer:"return=representation"}}}}ae.echoWrite=mP;function hP(e,t,r){if(!e)throw new yi.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=hP;function gP(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=gP;function Ec(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=Ec;function vP(e,t,r){return r?{...e,[t]:(0,qa.normalizeGuid)(r,t)}:e}ae.withClientMintedId=vP;function yP(e,t,r){let n=Ec(e,t);if(!n)throw new yi.InvalidArgumentError(`Dataverse did not return an id for the created ${r}`);return n}ae.requireCreatedId=yP;function bP(e,t,r,n){let i=Ec(e,t);if(i)return i;if(n)return(0,qa.normalizeGuid)(n,t);throw new yi.InvalidArgumentError(`Dataverse did not return an id for the created ${r}`)}ae.resolveCreatedId=bP;function fg(e,t){if(e.status===412)throw new yi.SdkError(ae.VERSION_CONFLICT_CODE,`Version conflict (412) from ${t}`);if(e.status<200||e.status>=300)throw new yi.ConnectionError(t,e.status,wP(e.body),e.body);return e}ae.ensureSuccess=fg;function wP(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 AP(e,t,r,n){let i=(0,qa.normalizeGuid)(r,"id"),a=`/${t}(${i})`;fg(await e.delete(a,n?{headers:{"If-Match":n}}:void 0),e.apiUrl(a))}ae.deleteRecord=AP;function CP(e){return e instanceof yi.ConnectionError&&e.statusCode===404}ae.isAlreadyDeleted=CP;function SP(){return new Date().toISOString()}ae.nowIso=SP});var $t=v(bi=>{"use strict";Object.defineProperty(bi,"__esModule",{value:!0});bi.describeMalformedValue=bi.collectPages=void 0;var mg=be(),Nc=re();async function EP(e,t,r,n){let i=[],a=new Set,o=e.apiUrl(t),s=(0,mg.ensureSuccess)(await e.get(t),o);for(n?.(s);;){let l=s.body,u=l?.value;if(!Array.isArray(u))throw new Nc.ConnectionError(o,s.status,`${r}: paginated read returned a malformed page \u2014 expected an OData 'value' array but got ${Dc(u)}; refusing to return partial results.`);for(let d of u)i.push(d);let c=l?.["@odata.nextLink"];if(c==null)break;if(typeof c!="string"||c.length===0)throw new Nc.ConnectionError(o,s.status,`${r}: paginated read returned a malformed @odata.nextLink (${Dc(c)}); cannot follow it, and refusing to return partial results.`);if(a.has(c))throw new Nc.InvalidArgumentError(`${r}: aborting pagination \u2014 the server returned a repeated @odata.nextLink ('${c}'), which would loop indefinitely.`);a.add(c),o=c,s=(0,mg.ensureSuccess)(await e.getAbsolute(c),c)}return i}bi.collectPages=EP;function Dc(e){return e===null?"null":e===void 0?"undefined (missing)":`a ${typeof e}`}bi.describeMalformedValue=Dc});var Ic=v(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.businessRuleApi=hr.BUSINESS_RULE_LEFT_DEACTIVATED_CODE=hr.WFOM_API_UNAVAILABLE_CODE=void 0;var $r=Wn(),NP=$t(),Ye=be(),pn=ie(),As=re();hr.WFOM_API_UNAVAILABLE_CODE="BUSINESS_RULE_API_UNAVAILABLE";hr.BUSINESS_RULE_LEFT_DEACTIVATED_CODE="BUSINESS_RULE_LEFT_DEACTIVATED";async function hg(e,t,r,n){let i=`/workflows(${_P})/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(hr.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 DP(e,t){let r=`/workflows(${t})${(0,pn.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 IP(e,t,r){let n=await DP(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 _P="00000000-0000-0000-0000-000000000000",ws={"Content-Type":"application/json",Accept:"application/json","OData-Version":"4.0","OData-MaxVersion":"4.0"},TP="workflowid,name,description,primaryentity,statecode,category,type",PP="category eq 2 and type eq 1";async function gg(e,t,r){var n;if(r==="Draft")return null;let i=(0,pn.normalizeGuid)(t,"workflowid"),a=r==="Active",o={statecode:a?$r.StateCode.Activated:$r.StateCode.Draft,statuscode:a?$r.StatusCode.Activated:$r.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,pn.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 OP(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}}hr.businessRuleApi={async get(e,t){let r=(0,pn.normalizeGuid)(t,"id"),n=`/workflows(${r})/Microsoft.Dynamics.CRM.RetrieveProcessWithWfomJson`,{response:i,etag:a}=await OP(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=[PP];t?.entityLogicalName&&r.push(`primaryentity eq '${(0,pn.odataLiteral)(t.entityLogicalName)}'`);let n=`/workflows${(0,pn.odataQuery)([["$select",TP],["$filter",r.join(" and ")]])}`;return(await(0,NP.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,pn.normalizeGuid)(n.Entity.workflowid,"workflowid"),a=await hg(e,"CreateProcessWithWfomJson",n,ws),o=(0,Ye.resolveCreatedId)(a,"workflowid","business rule",i),s=null;try{s=await gg(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,pn.normalizeGuid)(t,"id"),l=`/workflows(${s})`,u={...ws,"If-Match":(0,Ye.requireEtag)(n,"business rule",s)},c=await IP(e,s,u["If-Match"]),d=c.statecode===$r.StateCode.Activated;d&&(0,Ye.ensureSuccess)(await e.patch(l,{statecode:$r.StateCode.Draft,statuscode:$r.StatusCode.Draft},{headers:u}),e.apiUrl(l));let p;try{p=await hg(e,"UpdateProcessWithWfomJson",o,u)}catch(h){if(d)try{(0,Ye.ensureSuccess)(await e.patch(l,{statecode:$r.StateCode.Activated,statuscode:(i=c.statuscode)!==null&&i!==void 0?i:$r.StatusCode.Activated},{headers:ws}),e.apiUrl(l))}catch(g){throw new As.SdkError(hr.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: ${g instanceof Error?g.message:String(g)}`)}throw h}let f=await gg(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=v(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.JsonPointer=void 0;var Rt=re(),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 Rt.JsonPointerError(t,'non-empty pointers must start with "/"');return t.substring(1).split("/").map(r=>{if(/~(?![01])/.test(r))throw new Rt.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 Rt.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 Rt.JsonPointerError(r,`'${o}' is not a valid array index`);if(s>a.length)throw new Rt.JsonPointerError(r,`array index '${o}' is out of range`);a[s]=n}else{if(e.isReservedToken(o))throw new Rt.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 Rt.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 Rt.JsonPointerError(r,`array index '${a}' is out of range`);i.splice(o,1)}else{if(e.isReservedToken(a))throw new Rt.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 Rt.JsonPointerError(r,"add target must be an array");u.push(n);return}let o=e.resolve(t,r);if(!Array.isArray(o))throw new Rt.JsonPointerError(r,"add target must be an array");let s=i===void 0?o.length:i;if(s<0||s>o.length)throw new Rt.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 Rt.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 yg=v(Ns=>{"use strict";Object.defineProperty(Ns,"__esModule",{value:!0});Ns.findElements=void 0;var vg=Es();function RP(e,t){let r=[];return _c(e,"",t,r),r}Ns.findElements=RP;function _c(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)=>{_c(i,vg.JsonPointer.append(t,a),r,n)});else for(let i of Object.keys(e))_c(e[i],vg.JsonPointer.append(t,i),r,n)}});var Tc=v(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.assertMutationResult=gr.assertExistsResult=gr.assertReadResult=gr.assertStorageContract=void 0;var FP=["readText","writeTextAtomic","deleteFile","deleteByPrefix"],xP=["ensureContainer","exists"];function LP(e){if(typeof e!="object"||e===null)throw new Error("workspaceStorage must be an object implementing WorkspaceStorage.");for(let t of FP)if(typeof e[t]!="function")throw new Error(`workspaceStorage is missing the required method '${t}'.`);for(let t of xP){let r=e[t];if(r!==void 0&&typeof r!="function")throw new Error(`workspaceStorage.${t} must be a function when present.`)}return e}gr.assertStorageContract=LP;function kP(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.`)}gr.assertReadResult=kP;function MP(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.`)}gr.assertExistsResult=MP;function BP(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.`)}gr.assertMutationResult=BP});var Pc=v(wi=>{"use strict";Object.defineProperty(wi,"__esModule",{value:!0});wi.retryTransientIoAsync=wi.retryTransientIo=void 0;var UP=new Set(["EPERM","EACCES","EBUSY","UNKNOWN"]),$P=5,bg=10;function qP(e){for(let t=1;;t+=1)try{return e()}catch(r){if(!wg(r,t))throw r;GP(bg*t)}}wi.retryTransientIo=qP;async function VP(e){for(let t=1;;t+=1)try{return await e()}catch(r){if(!wg(r,t))throw r;await new Promise(n=>setTimeout(n,bg*t))}}wi.retryTransientIoAsync=VP;function wg(e,t){let r=e.code;return t<$P&&!!r&&UP.has(r)}function GP(e){try{Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)}catch{let t=Date.now()+e;for(;Date.now()<t;);}}});var Eg=v(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.canonicalArtifactId=Ft.WorkspaceManager=Ft.WORKSPACE_SCHEMA_VERSION=Ft.retryTransientIo=void 0;var er=Tc(),Ds=re(),zP=Pc();Object.defineProperty(Ft,"retryTransientIo",{enumerable:!0,get:function(){return zP.retryTransientIo}});function Ag(e){let t=e;return typeof t.pathFor=="function"&&typeof t.getRoot=="function"?e:null}Ft.WORKSPACE_SCHEMA_VERSION=1;var fn={form:"forms",view:"views",businessRule:"business-rules",app:"apps",command:"commands",chart:"charts",dashboard:"dashboards",genPage:"gen-pages",bpf:"business-process-flows"},WP="manifest.json",Ga=".metadata",Cg="entities";function Sg(e){try{return Promise.resolve(e())}catch(t){return Promise.reject(t)}}var Oc=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),[fn[t],`${za(r)}.json`]}metaKey(t,r){return this.assertSafeId(r),[Ga,fn[t],`${za(r)}.meta.json`]}entityKey(t){return this.assertSafeId(t),[Ga,Cg,`${t}.json`]}fsStore(){let t=Ag(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=Ag(this.storage);return t?t.getRoot():this.workspaceLabel}getArtifactDir(t){return this.fsStore().pathFor([fn[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[WP]}async init(){if(this.storage.ensureContainer){let t=this.storage.ensureContainer.bind(this.storage),r=[[Ga,Cg]];for(let i of Object.keys(fn))r.push([fn[i]],[Ga,fn[i]]);let n=await Promise.allSettled(r.map(i=>Sg(()=>t(i))));for(let i of n){if(i.status==="rejected")throw i.reason;(0,er.assertMutationResult)(i.value,"ensureContainer")}}await this.withManifest(async()=>{if(await this.isInitialized())return;let t={instanceUrl:this.instanceUrl,createdAt:new Date().toISOString(),artifacts:[]};await this.writeManifest(t)})}async isInitialized(){return this.storage.exists?(0,er.assertExistsResult)(await this.storage.exists(this.manifestKey),"manifest.json"):(0,er.assertReadResult)(await this.storage.readText(this.manifestKey),"manifest.json")!==null}async ensureInitialized(){if(!await this.isInitialized())throw new Ds.WorkspaceNotInitializedError(this.workspaceLabel)}async clean(){let t=Object.keys(fn).map(i=>[fn[i]]);t.push([Ga]);let r=await Promise.allSettled(t.map(i=>Sg(()=>this.storage.deleteByPrefix(i))));for(let i of r){if(i.status==="rejected")throw i.reason;(0,er.assertMutationResult)(i.value,"deleteByPrefix")}let n=await this.getManifest();n.artifacts=[],n.lastSyncAt=void 0,await this.init(),await this.writeManifest(n)}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,er.assertMutationResult)(await this.storage.deleteFile(this.artifactKey(t,r)),"deleteFile"),(0,er.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>Ft.WORKSPACE_SCHEMA_VERSION)throw new Ds.IncompatibleWorkspaceError(t.schemaVersion,Ft.WORKSPACE_SCHEMA_VERSION);return t}async writeManifest(t){await this.writeJson(this.manifestKey,{...t,schemaVersion:Ft.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,er.assertReadResult)(await this.storage.readText(t),t.join("/"));return r===null?null:JSON.parse(r)}async writeJson(t,r){(0,er.assertMutationResult)(await this.storage.writeTextAtomic(t,`${JSON.stringify(r,null,2)}
+`),"writeTextAtomic")}async removeFile(t){(0,er.assertMutationResult)(await this.storage.deleteFile(t),"deleteFile")}async exists(t){return this.storage.exists?(0,er.assertExistsResult)(await this.storage.exists(t),t.join("/")):(0,er.assertReadResult)(await this.storage.readText(t),t.join("/"))!==null}};Ft.WorkspaceManager=Oc;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()}Ft.canonicalArtifactId=za});var Rc=v(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});Ai.deepEqual=Ai.deepDiff=void 0;var HP=Es();function jP(e,t){let r=[];return Dg(e,t,"",r,0),r}Ai.deepDiff=jP;var Is=Symbol("missing"),_s=512;function Dg(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=JP(e,t);for(let l of s){let u=Ng(e,l),c=Ng(t,l),d=HP.JsonPointer.append(r,l);u===Is?n.push({pointer:d,type:"added",newValue:c}):c===Is?n.push({pointer:d,type:"removed",oldValue:u}):Dg(u,c,d,n,i+1)}return}Ig(e,t)||n.push({pointer:r,type:"modified",oldValue:e,newValue:t})}function Ts(e){return e!==null&&typeof e=="object"}function JP(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 Ng(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 Ig(e,t){return _g(e,t,0)}Ai.deepEqual=Ig;function _g(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&&_g(e[a],t[a],r+1))}});var Pg=v(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});Ps.VersionManager=void 0;var Tg=Rc(),Fc=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,Tg.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,Tg.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=Fc});var Rg=v((xc,Og)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof xc=="object"?Og.exports=t():e.compareVersions=t()})(xc,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 g=f.split(".").map(n),w=h.split(".").map(n);for(c=0;c<Math.max(g.length,w.length);c++){if(g[c]===void 0||typeof w[c]=="string"&&typeof g[c]=="number")return-1;if(w[c]===void 0||typeof g[c]=="string"&&typeof w[c]=="number"||g[c]>w[c])return 1;if(w[c]>g[c])return-1}}else if(f||h)return f?-1:1;return 0}})});var Mg=v(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 Fg;(function(e){e.CommonDataService="CommonDataService",e.None="None"})(Fg||(Ee.DatabaseType=Fg={}));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 xg;(function(e){e[e.CDS2=0]="CDS2",e[e.CDS1=1]="CDS1",e[e.Empty=2]="Empty"})(xg||(Ee.EnvironmentType=xg={}));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 Lg;(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"})(Lg||(Ee.EnvironmentDisableReasonCode=Lg={}));var kg;(function(e){e.LogicApps="LogicApps",e.SelfHostSingleTenant="SelfHostSingleTenant",e.SelfHostMultiTenant="SelfHostMultiTenant"})(kg||(Ee.EnvironmentFlowHostingType=kg={}))});var Wg=v(A=>{"use strict";var QP=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 KP=QP(Rg()),ce=Mg(),Wa=kc();function XP(e){let t=Vr(e);return t&&t.version}A.getCrmVersion=XP;function Vr(e){return e&&e.properties&&e.properties.linkedEnvironmentMetadata}A.getLinkedEnvironmentMetadata=Vr;function qr(e,t){return e?!!e[t]:!1}A.doesUserHavePermission=qr;A.crmBapSolutionId="00000001-0000-0000-0001-00000000009b";A.DEFAULT_SOLUTION_ID="fd140aaf-4df4-11dd-bd17-0019b9312238";A.DEFAULT_SOLUTION_UNIQUE_NAME="Default";function Hn(e){return!!Vr(e)&&Bg(e)}A.environmentHasCds2Database=Hn;function YP(e){if(e&&Hn(e)){let t=mn(e);return(0,Wa.getCrmAdminSecurityRolesUrl)(t)}return""}A.getSecurityUsersUrl=YP;function ZP(e){if(e&&Hn(e)){let t=mn(e);return(0,Wa.getCrmAdminSecurityUsersUrl)(t)}return""}A.getSecurityRolesUrl=ZP;function e1(e){if(e&&Hn(e)){let t=mn(e);(0,Wa.getCrmAllSolutionsUrl)(t)}return""}A.getAllSolutionsUrl=e1;function t1(e){if(e&&Hn(e)){let t=mn(e);return(0,Wa.getCrmAllPublishersUrl)(t)}return""}A.getAllPublishersUrl=t1;function r1(e){return e&&Hn(e)?mn(e):""}A.getAllThemesUrl=r1;function Bg(e){return!!e&&e.properties&&!!e.properties.provisioningState&&e.properties.provisioningState.toUpperCase()===ce.EnvironmentProvisioningStates.Succeeded.toUpperCase()}A.isEnvironmentInSuccessfulState=Bg;function n1(e){if(e&&Hn(e)){let t=mn(e);return(0,Wa.getCrmDevResourcesUrl)(t)}return""}A.getDevResourcesUrl=n1;function i1(e){return`${e}designer/app/{${A.crmBapSolutionId}}/CreateNewApp}}`}A.getCrmAppDesignerUrl=i1;function mn(e){let t=Vr(e);if(t){let r=t.instanceUrl;return r?r.endsWith("/")?r:r+"/":""}return""}A.getCrmInstanceUrl=mn;function a1(e){let t=Vr(e);return t?t.uniqueName:""}A.getCrmInstanceName=a1;function o1(e){return Vr(e)?ce.EnvironmentType.CDS2:e&&e.properties&&e.properties.namespace?ce.EnvironmentType.CDS1:ce.EnvironmentType.Empty}A.getEnvironmentType=o1;function s1(e){return e&&e.properties&&e.properties.environmentSku===ce.EnvironmentSkuConstants.Developer}A.isDevEnvironment=s1;function l1(e){return e&&e.properties&&e.properties.environmentSku===ce.EnvironmentSkuConstants.Production}A.isProdEnvironment=l1;function u1(e){return e&&e.properties&&e.properties.environmentSku===ce.EnvironmentSkuConstants.Sandbox}A.isSandboxEnvironment=u1;function Ha(e){return e&&e.properties&&e.properties.environmentSku===ce.EnvironmentSkuConstants.Teams}A.isTeamsEnvironment=Ha;function c1(e){return e&&e.properties&&e.properties.environmentSku===ce.EnvironmentSkuConstants.Platform}A.isPlatformEnvironment=c1;var d1=e=>{var t;return((t=e.properties)===null||t===void 0?void 0:t.environmentSku)===ce.EnvironmentSkuConstants.Trial};A.isTrialEnvironment=d1;function p1(e){return e&&e.properties&&(e.properties.isDefault||e.properties.creationType===ce.EnvironmentCreationTypeConstants.DefaultTenant)}A.isDefaultEnvironment=p1;function f1(e){return e&&e.properties&&!!e.properties.states&&!!e.properties.states.runtime&&e.properties.states.runtime.id==="Disabled"}A.isDisabledEnvironment=f1;function m1(e){return e&&e.properties&&qr(e.properties.permissions,ce.environmentPermissions.CreateDatabase)}A.canUserCreateDatabase=m1;function h1(e){return!!(e&&e.properties&&e.properties.provisioningState&&zg(e.properties.provisioningState,ce.EnvironmentProvisioningStates.LinkedDatabaseProvisioning))}A.isDatabaseInProvisioningState=h1;function g1(e){return!!e&&!!e.properties&&e.properties.provisioningState===ce.EnvironmentProvisioningStates.Creating}A.isEnvironmentInCreatingState=g1;function v1(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=v1;function y1(e){return!!e&&!!e.properties&&!!e.properties.expirationTime&&Date.parse(e.properties.expirationTime)<Date.now()}A.isEnvironmentExpired=y1;function b1(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=b1;function w1(e){return!!e&&!!e.properties&&!!e.properties.cluster&&e.properties.cluster.category==="Test"}A.isEnvironmentInTestCluster=w1;function A1(e){return!!e&&!!e.properties&&!!e.properties.cluster&&e.properties.cluster.category==="Preprod"}A.isEnvironmentInPreprodCluster=A1;function C1(e){return!!e&&!!e.properties&&!!e.properties.cluster&&e.properties.cluster.category==="FirstRelease"}A.isEnvironmentInFirstReleaseCluster=C1;function S1(e){return e&&e.name||""}A.getEnvironmentName=S1;function E1(e){return e&&e.properties&&e.properties.displayName||""}A.getEnvironmentDisplayName=E1;var Ug="9.1.0.8202";A.cdsVersionSupportingOSColorEdit="9.1.0000.20708";function N1(e){return Vg(e,Ug)}A.doesCds2EnvironmentSupportApiVersion9_1=N1;function D1(e){return Lc(e,Ug)}A.doesCds2VersionSupportApiVersion9_1=D1;function $g(e){let t=Vr(e);if(t)return t.securityGroupId}function qg(e){return e&&e.properties&&e.properties.connectedGroups}function I1(e,t){let r=qg(e);return!!r&&!!r.find(n=>n.id===t)||$g(e)===t}A.hasSecurityGroupId=I1;function _1(e){let t=qg(e);return t&&t.length>0&&t[0].id?t[0].id:$g(e)}A.getSecurityOrConnectedGroupId=_1;function Vg(e,t){let r=e.version;return r?Lc(r,t):!1}A.isCds2EnvironmentVersionAtLeast=Vg;function Lc(e,t){return t?e?(0,KP.default)(e,t)>=0:!1:!0}A.checkVersions=Lc;function T1(e){return e&&e.properties&&e.properties.updateCadence&&e.properties.updateCadence.id||"NotSpecified"}A.getEnvironmentUpdateCadence=T1;function P1(e){let t=Vr(e);return t?Number(t.baseLanguage):0}A.getEnvironmentLanguageCode=P1;function Gg(e){let t=Vr(e);return t?t.instanceApiUrl:void 0}A.getEnvironmentInstanceApiUrl=Gg;function O1(e){let t=Gg(e);return t?t+"/api/data/v9.2":""}A.getEnvironmentWebApiUrl=O1;function R1(e){let t=mn(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=R1;var F1=e=>{var t;return((t=e.properties)===null||t===void 0?void 0:t.databaseType)===ce.DatabaseType.CommonDataService};A.hasCommonDataServiceDatabase=F1;var x1=e=>{var t;return qr((t=e.properties)===null||t===void 0?void 0:t.permissions,ce.environmentPermissions.AdminReadEnvironment)};A.doesUserHaveAdminPermission=x1;var L1=e=>{var t;return qr((t=e.properties)===null||t===void 0?void 0:t.permissions,ce.environmentPermissions.CreatePowerApp)};A.doesUserHaveCreateAppPermission=L1;var k1=e=>(0,A.doesUserHaveAdminPermission)(e)&&(0,A.hasCommonDataServiceDatabase)(e)?!0:(0,A.doesUserHaveCreateAppPermission)(e)?Ha(e)||(0,A.doesUserHaveDatabaseTablePermissions)(e):!1;A.isUserMakerWithDataAccess=k1;var M1=e=>(0,A.doesUserHaveCreateAppPermission)(e)&&!Ha(e)&&!(0,A.doesUserHaveDatabaseTablePermissions)(e)&&(!(0,A.doesUserHaveAdminPermission)(e)||!(0,A.hasCommonDataServiceDatabase)(e));A.isUserMakerWithoutDataAccess=M1;var B1=e=>[ce.environmentPermissions.CreateDatabaseEntities,ce.environmentPermissions.ListDatabaseEntities,ce.environmentPermissions.UpdateDatabaseEntities,ce.environmentPermissions.DeleteDatabaseEntities].every(t=>{var r;return qr((r=e.properties)===null||r===void 0?void 0:r.permissions,t)});A.doesUserHaveDatabaseTablePermissions=B1;var U1=e=>{var t;return qr((t=e.properties)===null||t===void 0?void 0:t.permissions,ce.environmentPermissions.CreateDatabase)};A.doesUserHaveCreateDatabasePermission=U1;function zg(e,t){return!e&&!t?!0:!e||!t?!1:e.toUpperCase()===t.toUpperCase()}A.equalsIgnoreCase=zg;var $1=e=>{var t;return qr((t=e.properties)===null||t===void 0?void 0:t.permissions,ce.environmentPermissions.CreateFlow)};A.doesUserHaveCreateFlowPermission=$1;var q1=e=>(0,A.doesUserHaveAdminPermission)(e)&&(0,A.hasCommonDataServiceDatabase)(e)?!0:(0,A.doesUserHaveCreateFlowPermission)(e)?Ha(e)||(0,A.doesUserHaveDatabaseTablePermissions)(e):!1;A.isUserPautoMakerWithDataAccess=q1;var V1=e=>(0,A.doesUserHaveCreateFlowPermission)(e)&&!Ha(e)&&!(0,A.doesUserHaveDatabaseTablePermissions)(e)&&(!(0,A.doesUserHaveAdminPermission)(e)||!(0,A.hasCommonDataServiceDatabase)(e));A.isUserPautoMakerWithoutDataAccess=V1;var G1=e=>{var t,r;return!qr((t=e.properties)===null||t===void 0?void 0:t.permissions,ce.environmentPermissions.CreateFlow)&&qr((r=e.properties)===null||r===void 0?void 0:r.permissions,ce.environmentPermissions.ReadEnvironment)};A.doesUserHaveFlowRunOnlyPermission=G1});var kc=v(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 Hg=Wg();b.ODATA_MAX_PAGE_SIZE="odata.maxpagesize";b.ODATA_NEXT_LINK="@odata.nextLink";b.cdsServiceUrl="https://cds-org/";var Ja;(function(e){e.AllSolutions="11",e.AllPublishers="10",e.DevResources="05"})(Ja||(Ja={}));function z1(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=z1;function W1(e,t){let r=`dType=1&isproactivecheck=true&objecttype=7100&operationtype=dependenciesforuninstall&objectid=${t}`;return`${e}tools/dependency/dependencyviewdialog.aspx?${r}`}b.getShowSolutionDependenciesUrl=W1;function H1(e,t){return`${e}tools/muiProvisioning/Dialogs/LangTranslationsImport.aspx?dType=1&appSolutionId=${t}`}b.getImportSolutionTranslationUrl=H1;function j1(e,t){return`${e}_grid/cmds/dlg_exportsolution.aspx?command=exporttranslation&appSolutionId=${t}`}b.getExportSolutionTranslationUrl=j1;function J1(e,t){return e!==void 0&&t!==void 0&&`CrmTranslations_${e}_${t.replace(/[.]/g,"_")}.zip`||""}b.getExportTranslationFileName=J1;function Q1(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=Q1;function Mc(e,t){return`${e}tools/systemcustomization/systemCustomization.aspx?pid=${t}`}function K1(e){return Mc(e,Ja.AllSolutions)}b.getCrmAllSolutionsUrl=K1;function X1(e){return Mc(e,Ja.AllPublishers)}b.getCrmAllPublishersUrl=X1;function Y1(e){return Mc(e,Ja.DevResources)}b.getCrmDevResourcesUrl=Y1;function Z1(e,t=Hg.crmBapSolutionId){return`${e}designer/app/${t}#/CreateNewApp`}b.getCrmAppDesignerUrl=Z1;function eO(e){return`${e}apps`}b.getCrmMyAppsUrl=eO;function tO(e){return jg(e,"role")+"&forceUCI=0"}b.getCrmAdminSecurityRolesUrl=tO;function rO(e){return`${jg(e,"systemuser")}&forceclassic=1`}b.getCrmAdminSecurityUsersUrl=rO;function jg(e,t){return`${e}main.aspx?pagetype=entitylist&etn=${t}`}function nO(e,t){return`${e}main.aspx?appid=${t}`}b.getPlayAppModuleUrl=nO;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 iO(e,t,r=Hg.crmBapSolutionId){return`${e}designer/app/${r}/${t}/AppDesignerCanvas/${t}`}b.getAppModuleDesignerUrl=iO;function aO(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=aO;function oO(e,t,r){return`/e/${e}/s/${t}/dashboard/${r}`}b.getOpenModernDashboardUrl=oO;function sO(e,t,r){let n=r!==void 0?r.toString():void 0;return`/e/${e}/s/${t}/dashboard/new${n?`/${n}`:""}`}b.getNewModernDashboardUrl=sO;function lO(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=lO;function uO(e,t,r,n){return`/e/${e}/s/${t}/n/${r}/dashboard/${n}`}b.getOpenModernEntityDashboardUrl=uO;function cO(e,t,r,n){return`${e}main.aspx?appSolutionId=%7b${t}%7d&extraqs=etc=${r||""}`+(n?`%26id=${n}`:"")+"&pagetype=vizdesigner"}b.getChartDesignerUrl=cO;function dO(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=dO;function pO(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=pO;function fO(e,t){return`${e}Tools/ProcessControl/UnifiedProcessDesigner.aspx?id=${t}`}b.getBusinessProcessFlowDesignerUrl=fO;function mO(e,t,r){return`${e}CRMReports/reportproperty.aspx?appSolutionId=%7b${r}%7d&disablePersonal=true&id=%7b${t}%7d`}b.getReportDesignerUrl=mO;function hO(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=hO;function gO(e,t){return`${e}WebResources/${t}`}b.getWebResourceFileUrl=gO;function vO(e,t,r){return`${e}designer/sitemap/${r}/${t}/SiteMapHome/${t}`}b.getSiteMapDesignerUrl=vO;function yO(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=yO;function bO(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=bO;function wO(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=wO;function AO(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=AO;function CO(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=CO;function SO(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=SO;function EO(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=EO;function NO(e){return`${e}tools/publisher/edit.aspx`}b.getCreateNewPublisherUrl=NO;function DO(e,t){return`${e}tools/kbtemplateeditor/kbtemplateeditor.aspx?appSolutionId=${t}`}b.getCreateNewArticleTemplateUrl=DO;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 IO(e,t){return`${b.xrmApiUrl}/RetrieveRequiredComponents(ObjectId=${e},ComponentType=${t})`}b.getRequiredComponentsQueryUrl=IO;function _O(e,t){return`${b.cdsServiceUrl}${b.xrmApiUrl}/RetrieveDependentComponentsWithMetadata(ObjectId=${e},ComponentType=${t})`}b.getDependentComponentsWithMetadataQueryUrl=_O;b.solutionsQueryUrl="/api/data/v9.0/solutions?$expand=publisherid&$filter=(isvisible eq true)";function TO(e){return`/api/data/v9.0/solutions?$expand=publisherid&$filter=(uniquename eq '${e}')`}b.getSolutionsByUniqueNameQueryUrl=TO;function PO(e){return`/api/data/v9.0/solutions(${e})?$expand=publisherid`}b.getSolutionQueryUrl=PO;function OO(e){return`${e}api/data/v9.1/ProvisionLanguageForUser`}b.getProvisionLanguageUrl=OO;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 RO(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=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
+ &$orderby=starttime desc`}b.getDeploymentStageRunsUrl=RO;function FO(e,t,r){return`/api/data/v9.1/RetrieveDeploymentPipelineInfo(DeploymentPipelineId=${e},SourceEnvironmentId='${t}',ArtifactName='${r}')`}b.retrieveDeploymentPipelineInfoUrl=FO;function xO(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=_O;function TO(e){return`/api/data/v9.0/deploymentstages
+ &$filter=(environmentid eq '${e}')`}b.retrievePipelinesUrl=xO;function LO(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=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
+ &$expand=targetdeploymentenvironmentid($select=deploymentenvironmentid,environmentid,name)`}b.retrieveDeploymentStagesUrl=LO;function kO(){return"/api/data/v9.0/deploymentstageruns?$select=deploymentstagerunid"}b.createDeploymentStageRunUrl=kO;function MO(e){return`/api/data/v9.0/deploymentstageruns(${e})`}b.updateDeploymentStageRunUrl=MO;function BO(){return"/api/data/v9.0/DeployPackageAsync"}b.deployPackageAsyncUrl=BO;function UO(){return"/api/data/v9.0/ValidatePackageAsync"}b.validatePackageAsyncUrl=UO;function $O(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=$O;function qO(e){return`/api/data/v9.0/deploymentstageruns(${e})
+ ?$select=aigenerateddeploymentnotes,deploymentstagerunid`}b.getAIGeneratedDeploymentNotesUrl=qO;function VO(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=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=_deploymentstageid_value,deploymentstagerunid,stagerunstatus,operation,operationstatus,suboperation,artifactname`}b.deployOperationStatusUrl=VO;function GO(e){return`/api/data/v9.0/solutions(${e})
+ ?$select=solutionid,uniquename,version`}b.devSolutionInfoUrl=GO;function zO(e){return`/api/data/v9.0/deploymentenvironments
?$select=deploymentenvironmentid,environmentid,environmenttype,name
- &$filter=(environmentid eq '${e}')`}b.retrieveDeploymentEnvironmentInfoUrl=BO;var UO=e=>`/api/data/v9.0/systemusers
+ &$filter=(environmentid eq '${e}')`}b.retrieveDeploymentEnvironmentInfoUrl=zO;var WO=e=>`/api/data/v9.0/systemusers
?$select=azureactivedirectoryobjectid
- &$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
+ &$filter=(applicationid eq '${e}')`;b.SPNPrincipalIdUrl=WO;function HO(){return"/api/data/v9.0/appmodules?$filter=(uniquename eq 'AppDeploymentConfiguration')"}b.retrieveDeploymentPipelineConfigAppUrl=HO;b.retrieveFeatureControlSettingsByNamespaceUrl="/api/data/v9.1/RetrieveFeatureControlSettingsByNamespace";function jO(e){return`/api/data/v9.0/settingdefinitions${e}`}b.getSettingDefinitionsUri=jO;b.OrgSettingOverrideName="organizationsettings";function JO(e,t=!1){let r=`/api/data/v9.0/${b.OrgSettingOverrideName}${e}`;return t?`${b.cdsServiceUrl}${r}`:r}b.getOrgSettingOverrideUri=JO;b.AppSettingOverrideName="appsettings";function QO(e,t=!1){let r=`/api/data/v9.0/${b.AppSettingOverrideName}${e}`;return t?`${b.cdsServiceUrl.replace("/$","")}${r}`:r}b.getAppSettingOverrideUri=QO;var ja;(function(e){e[e.All=0]="All",e[e.IsPlatformOnly=1]="IsPlatformOnly",e[e.NotPlatformOnly=2]="NotPlatformOnly"})(ja||(b.RetrievePlatform=ja={}));function KO(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=KO;function XO(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=XO;function YO(e=!1){let t="/api/data/v9.0/SaveSettingValue()";return e?`${b.cdsServiceUrl}${t}`:t}b.getSavePowerSettingUri=YO;b.retrieveUnpublishedSuffix="Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()";function ZO(e){return`tools/systemcustomization/businessrules/businessRulesDesigner.aspx?BRlaunchpoint=BRGrid&appSolutionId={${e}}`}b.getBusinessRuleDesignerUri=ZO;function Jg({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=Jg;function eR({baseUrl:e,environmentInstanceUrl:t,entityLogicalName:r,recordId:n}){let i=e||Jg({environmentInstanceUrl:t,entityLogicalName:r});return i&&n?`${i}&id=${n}`:void 0}b.getUCIEntityRecordEditUrl=eR;b.retrieveOrganizationResources=`${b.cdsServiceUrl}api/data/v9.0/RetrieveOrganizationResources`});var Qg=v(Os=>{"use strict";Object.defineProperty(Os,"__esModule",{value:!0});Os.DataverseClient=void 0;var tR=kc(),jn=re(),Bc=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}/${tR.xrmApiUrl}${n}`}async send(t,r){try{return await r()}catch(n){throw n instanceof jn.SdkError?n:new jn.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 jn.InvalidArgumentError(`Refusing to follow a malformed absolute URL: '${t}'`)}if(r.protocol!==n.protocol||r.host!==n.host)throw new jn.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 jn.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 jn.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 jn.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=Bc});var Kg=v(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.findColumns=gn.findTables=gn.fetchEntityMetadataFromApi=void 0;var Uc=be(),vr=ie();function Qa(e){var t,r;return(r=(t=e?.UserLocalizedLabel)===null||t===void 0?void 0:t.Label)!==null&&r!==void 0?r:""}function Ci(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 Si(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 hn(e){return`/EntityDefinitions(LogicalName='${(0,vr.odataPathLiteral)(e)}')`}async function rR(e,t,r){let n=await Si(e,`${hn(t)}/Attributes/Microsoft.Dynamics.CRM.StringAttributeMetadata${(0,vr.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 nR(e,t,r){var n;let i=await Si(e,`${hn(t)}/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata${(0,vr.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:Qa(s.Label),...Ci(s.Label)?{localizedLabel:Ci(s.Label)}:{}}}))}}async function iR(e,t,r){let n=await Si(e,`${hn(t)}/Attributes/Microsoft.Dynamics.CRM.LookupAttributeMetadata${(0,vr.odataQuery)([["$select","LogicalName,Targets"]])}`);for(let i of n){let a=r.get(i.LogicalName);a&&i.Targets&&(a.targets=i.Targets)}}async function aR(e,t){var r,n,i,a;let o=[],s=await Si(e,`${hn(t)}/OneToManyRelationships${(0,vr.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 Si(e,`${hn(t)}/ManyToOneRelationships${(0,vr.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 Si(e,`${hn(t)}/ManyToManyRelationships${(0,vr.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 oR(e,t){var r,n,i,a,o;let s=`${hn(t)}`+(0,vr.odataQuery)([["$select","LogicalName,SchemaName,DisplayName,EntitySetName,IsCustomEntity,PrimaryNameAttribute,PrimaryIdAttribute"],["$expand","Attributes($select=LogicalName,DisplayName,AttributeType,IsCustomAttribute)"]]),u=(0,Uc.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:Qa(f.DisplayName),...Ci(f.DisplayName)?{localizedDisplayName:Ci(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([rR(e,t,d),nR(e,t,d),iR(e,t,d),aR(e,t)]);return{logicalName:u.LogicalName,schemaName:(n=u.SchemaName)!==null&&n!==void 0?n:u.LogicalName,displayName:Qa(u.DisplayName),...Ci(u.DisplayName)?{localizedDisplayName:Ci(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}}gn.fetchEntityMetadataFromApi=oR;async function sR(e,t,r){var n,i;let a=`/EntityDefinitions${(0,vr.odataQuery)([["$select","LogicalName,SchemaName,EntitySetName,DisplayName,IsCustomEntity"]])}`,s=(i=(n=(0,Uc.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:Qa(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}gn.findTables=sR;async function lR(e,t,r,n){var i,a;let o=`${hn(t)}/Attributes`+(0,vr.odataQuery)([["$select","LogicalName,SchemaName,DisplayName,AttributeType,IsCustomAttribute"]]),l=(a=(i=(0,Uc.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:Qa(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}gn.findColumns=lR});var Ei=v(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});Rs.DEFAULT_LCID=void 0;Rs.DEFAULT_LCID=1033});var ct=v(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.assignMissingIds=Ni.newId=void 0;function Xg(){return globalThis.crypto.randomUUID().toLowerCase()}Ni.newId=Xg;function uR(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var cR=new Set(["parameters","bag","expression","rawExpression","lookupValue","stepLabels"]);function dR(e){return $c(e),e}Ni.assignMissingIds=dR;function $c(e){if(Array.isArray(e)){e.forEach(t=>$c(t));return}if(uR(e)){(typeof e.id!="string"||e.id.length===0)&&(e.id=Xg());for(let t of Object.keys(e))t==="id"||cR.has(t)||$c(e[t])}}});var qc=v(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});vn.postChangeSet=vn.parseChangeSetStatuses=vn.renderChangeSet=void 0;var Fs=re(),pR=be(),Yg=ct(),Zg=ie();function e0(e,t){let r=`batch_${(0,Yg.newId)()}`,n=`changeset_${(0,Yg.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,Zg.assertNoControlChars)(s.path,"batch operation path"),s.etag&&(0,Zg.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}}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
+`),batchId:r,contentIds:i}}vn.renderChangeSet=e0;function t0(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),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,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,`
+`);if(f===-1)return;let h=p.slice(0,f),g=p.slice(f+4);if(!/^Content-Type:\s*application\/http\b/im.test(h))return;let w=/^HTTP\/1\.[01] (\d{3})\b/.exec(g);if(!w||((i=g.match(/^HTTP\/1\.[01] \d{3}\b/gm))!==null&&i!==void 0?i:[]).length!==1)return;let S=(a=/^Content-ID:\s*(\S+)/im.exec(h))===null||a===void 0?void 0:a[1];if(S===void 0||d.has(S)||!u.has(S))return;d.add(S),c.push(Number(w[1]))}return c.length===0?void 0:c}vn.parseChangeSetStatuses=t0;async function fR(e,t,r){if(t.length===0)return;let{body:n,batchId:i,contentIds:a}=e0(e,t),o=await e.postBatch(n,i),s=e.apiUrl("/$batch");if((0,pR.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=t0(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}`)}vn.postChangeSet=fR});var xs=v(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 oe=be(),J=ie(),yr=Ei(),fe=re(),mR=qc(),hR={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:gR(e,t)}}var r0=65535;function gR(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>r0)throw new fe.InvalidArgumentError(`localized label LCID ${s} is out of range (1-${r0})`);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 o0(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`]}))}Q.pluralFallback=o0;function Ka(e){return{Value:e,CanBeChanged:!0,ManagedPropertyLogicalName:"canmodifyrequirementlevelsettings"}}function zc(e){let t=e.indexOf("_");return t>0?e.slice(0,t):e}function n0(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 vR(e,t,r){var n,i,a,o,s,l,u,c,d,p,f,h,g,w,S,D,x,F,G,L,q,U,$,W;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:(g=t.precision)!==null&&g!==void 0?g:2,PrecisionSource:2,MinValue:(w=t.minValue)!==null&&w!==void 0?w:0,MaxValue:(S=t.maxValue)!==null&&S!==void 0?S: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:(G=t.dateFormat)!==null&&G!==void 0?G:"DateAndTime"};case"choice":return i0(t,r,!1);case"multiChoice":return i0(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:(q=t.isPrimaryImage)!==null&&q!==void 0?q:!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:($=t.maxLength)!==null&&$!==void 0?$:100,AutoNumberFormat:(W=t.autoNumberFormat)!==null&&W!==void 0?W:""};default:throw new fe.InvalidArgumentError(`unsupported column type '${String(e)}'`)}}function i0(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,J.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 Vc=new WeakMap;async function yR(e,t){var r,n;let i=(r=Vc.get(e))===null||r===void 0?void 0:r.get(t);if(i)return i;let a=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(t)}')${(0,J.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,J.assertODataName)(s,`server-derived EntitySetName for '${t}'`);let l=Vc.get(e);return l||(l=new Map,Vc.set(e,l)),l.set(t,s),s}Q.resolveEntitySetName=yR;async function bR(e,t){var r,n,i,a,o,s,l,u,c,d,p,f,h,g,w;let S=(r=t.languageCode)!==null&&r!==void 0?r:yr.DEFAULT_LCID,D=zc(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",S),IsPrimaryName:!0};t.primaryColumnAutoNumberFormat&&(F.AutoNumberFormat=t.primaryColumnAutoNumberFormat),t.columns&&u0(t.columns,"createTable");let G={"@odata.type":"Microsoft.Dynamics.CRM.EntityMetadata",SchemaName:t.schemaName,DisplayName:_e(t.displayName,S),DisplayCollectionName:_e((o=t.pluralName)!==null&&o!==void 0?o:o0(t.displayName),S),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=>Wc(pe,S))]};t.description&&(G.Description=_e(t.description,S));let L="/EntityDefinitions",q=(0,oe.ensureSuccess)(await e.post(L,G),e.apiUrl(L)),U=Xa(q),$=`/EntityDefinitions(${U})`+(0,J.odataQuery)([["$select","LogicalName,EntitySetName,PrimaryIdAttribute,PrimaryNameAttribute"]]),W=Math.max(1,Math.trunc((d=t.readBackAttempts)!==null&&d!==void 0?d:6)),B=Math.max(0,(p=t.readBackDelayMs)!==null&&p!==void 0?p:1e3),Qe;for(let pe=1;pe<=W;pe+=1){let Ke=await e.get($);if(Ke.status>=200&&Ke.status<300){Qe=Ke;break}Ke.status!==404&&(0,oe.ensureSuccess)(Ke,e.apiUrl($)),pe<W&&B>0&&await new Promise(Z=>setTimeout(Z,B))}if(!Qe)throw new fe.SdkError("TABLE_METADATA_NOT_VISIBLE",`Table '${t.schemaName}' WAS CREATED (MetadataId ${U}) but its metadata was still not readable after ${W} 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 vt=Qe.body;return{logicalName:(f=vt.LogicalName)!==null&&f!==void 0?f:t.schemaName.toLowerCase(),metadataId:U,entitySetName:(h=vt.EntitySetName)!==null&&h!==void 0?h:"",primaryIdAttribute:(g=vt.PrimaryIdAttribute)!==null&&g!==void 0?g:`${t.schemaName.toLowerCase()}id`,primaryNameAttribute:(w=vt.PrimaryNameAttribute)!==null&&w!==void 0?w:x.toLowerCase()}}Q.createTable=bR;function Wc(e,t){var r,n;let i=(r=e.languageCode)!==null&&r!==void 0?r:t,a={...vR(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)),s0(a,e),a}function s0(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 wR(e,t,r){var n;let i=Wc(r,(n=r.languageCode)!==null&&n!==void 0?n:yr.DEFAULT_LCID),a=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(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 p0(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}Q.createColumn=wR;var Di="/controlconfigurations",l0="CustomRenderersConfiguration",Gc={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 u0(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 c0(e){return JSON.stringify({type:Gc[e]})}function AR(e){if(!e)return"None";let t;try{t=JSON.parse(e)}catch{return"None"}let r=t?.type,n=Object.keys(Gc).find(i=>Gc[i]===r);return n??"None"}async function d0(e,t,r){var n,i;let a=`entitylogicalname eq '${(0,J.odataLiteral)(t)}' and Attribute/logicalname eq '${(0,J.odataLiteral)(r)}'`,o=`${Di}${(0,J.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 CR(e,t,r){var n;let i=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(t)}')/Attributes(LogicalName='${(0,J.odataPathLiteral)(r)}')${(0,J.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,J.normalizeGuid)(o,"MetadataId")}async function p0(e,t,r,n,i){let a={name:l0,uniquename:`msdyn_${t}_${r}_customrenderers`,metadatajson:c0(i),"[email protected]":`/attributes(${(0,J.normalizeGuid)(n,"MetadataId")})`,entitylogicalname:t};(0,oe.ensureSuccess)(await e.post(Di,a),e.apiUrl(Di))}async function SR(e,t,r){var n;let i=await d0(e,t,r);return AR((n=i[0])===null||n===void 0?void 0:n.metadatajson)}Q.getColumnVisualization=SR;async function ER(e,t,r,n){let a=(await d0(e,t,r)).map(u=>u.controlconfigurationid).filter(u=>!!u);if(n==="None"){for(let u of a){let c=`${Di}(${(0,J.normalizeGuid)(u,"controlconfigurationid")})`;(0,oe.ensureSuccess)(await e.delete(c),e.apiUrl(c))}return}let[o,...s]=a,l=await CR(e,t,r);if(o){let u=`${Di}(${(0,J.normalizeGuid)(o,"controlconfigurationid")})`,c={name:l0,metadatajson:c0(n),"[email protected]":`/attributes(${l})`,entitylogicalname:t};(0,oe.ensureSuccess)(await e.patch(u,c),e.apiUrl(u))}else await p0(e,t,r,l,n);for(let u of s){let c=`${Di}(${(0,J.normalizeGuid)(u,"controlconfigurationid")})`;(0,oe.ensureSuccess)(await e.delete(c),e.apiUrl(c))}}Q.setColumnVisualization=ER;async function NR(e,t,r){if(r.length===0)return;if(u0(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,J.odataPathLiteral)(t)}')/Attributes`;await(0,mR.postChangeSet)(e,r.map(i=>{var a;return{method:"POST",path:n,body:Wc(i,(a=i.languageCode)!==null&&a!==void 0?a:yr.DEFAULT_LCID)}}),`${r.length} column(s) on '${t}'`)}Q.createColumns=NR;async function DR(e,t,r){var n,i,a,o;let s=(n=r.languageCode)!==null&&n!==void 0?n:yr.DEFAULT_LCID,l=zc(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:""}}Q.createCustomerColumn=DR;async function IR(e,t,r){var n,i,a,o,s;let l=(n=r.languageCode)!==null&&n!==void 0?n:yr.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)}Q.insertStatusValue=IR;async function _R(e,t){var r,n,i,a,o;let s=(r=t.languageCode)!==null&&r!==void 0?r:yr.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:`${zc(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}}Q.createRelationship=_R;async function TR(e,t){let r=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(t)}')`;(0,oe.ensureSuccess)(await e.delete(r),e.apiUrl(r))}Q.deleteTable=TR;async function PR(e,t,r,n){var i,a;let o=(i=n.languageCode)!==null&&i!==void 0?i:yr.DEFAULT_LCID,s=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(t)}')/Attributes`,l=`${s}(LogicalName='${(0,J.odataPathLiteral)(r)}')${(0,J.odataQuery)([["$select","MetadataId,AttributeType"]])}`,c=(0,oe.ensureSuccess)(await e.get(l),e.apiUrl(l)).body,d=hR[(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,J.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),s0(h,n);let g=`${s}(${p})`;(0,oe.ensureSuccess)(await e.put(g,h,{headers:{"MSCRM.MergeLabels":"true"}}),e.apiUrl(g))}Q.updateColumn=PR;async function OR(e,t,r){var n;let i=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(t)}')/Attributes`,a=`${i}(LogicalName='${(0,J.odataPathLiteral)(r)}')${(0,J.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,J.normalizeGuid)(s,"MetadataId")})`;(0,oe.ensureSuccess)(await e.delete(l),e.apiUrl(l))}Q.deleteColumn=OR;async function RR(e,t){var r,n,i;let a=`/RelationshipDefinitions${(0,J.odataQuery)([["$filter",`SchemaName eq '${(0,J.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,J.normalizeGuid)(s,"MetadataId")})`;(0,oe.ensureSuccess)(await e.delete(l),e.apiUrl(l))}Q.deleteRelationship=RR;async function a0(e,t){var r;let n=`/GlobalOptionSetDefinitions(Name='${(0,J.odataPathLiteral)(t)}')${(0,J.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,J.normalizeGuid)(o,"MetadataId"):void 0}async function FR(e,t){var r;let n=t.name.toLowerCase(),i=await a0(e,n);if(i)return{name:n,metadataId:i};let a=(r=t.languageCode)!==null&&r!==void 0?r:yr.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 a0(e,n)}catch{u=void 0}if(u)return{name:n,metadataId:u};throw l}}Q.createGlobalOptionSet=FR;async function xR(e,t){let r=`/GlobalOptionSetDefinitions(Name='${(0,J.odataPathLiteral)(t.toLowerCase())}')`;(0,oe.ensureSuccess)(await e.delete(r),e.apiUrl(r))}Q.deleteGlobalOptionSet=xR;async function LR(e,t,r){var n;let i=(n=r.languageCode)!==null&&n!==void 0?n:yr.DEFAULT_LCID,a={"@odata.type":"Microsoft.Dynamics.CRM.EntityKeyMetadata",SchemaName:r.schemaName,DisplayName:_e(r.displayName,i),KeyAttributes:r.keyAttributes},o=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(t)}')/Keys`,s=(0,oe.ensureSuccess)(await e.post(o,a),e.apiUrl(o));return{logicalName:r.schemaName.toLowerCase(),metadataId:Xa(s)}}Q.createAlternateKey=LR;async function kR(e,t,r){var n;let i=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(t)}')/Keys`,a=`${i}(LogicalName='${(0,J.odataPathLiteral)(r.toLowerCase())}')${(0,J.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,J.normalizeGuid)(s,"MetadataId")})`;(0,oe.ensureSuccess)(await e.delete(l),e.apiUrl(l))}Q.deleteAlternateKey=kR;async function MR(e,t,r){var n;let i=(n=r.languageCode)!==null&&n!==void 0?n:yr.DEFAULT_LCID,a=`/EntityDefinitions(LogicalName='${(0,J.odataPathLiteral)(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,J.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&&n0(s,"IsAuditEnabled",r.auditEnabled),r.duplicateDetectionEnabled!==void 0&&n0(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))}Q.updateTable=MR});var bn=v(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.rebuildRaw=bt.assembleChildren=bt.spliceChildren=bt.mergeAttrs=bt.rawFromNode=bt.emptyBag=void 0;var yn=re(),f0=1e6,ks=512;function BR(){return{a:[],c:[]}}bt.emptyBag=BR;function m0(e,t=0){if(t>ks)throw new yn.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=>m0(r,t+1))}}bt.rawFromNode=m0;function UR(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}bt.mergeAttrs=UR;function Ls(e,t){let r=new Set;for(let s of e){let l=s.i;if(!Number.isInteger(l)||l<0||l>f0)throw new yn.InvalidArgumentError(`Bag child index must be an integer in [0, ${f0}] (got ${String(l)})`);if(r.has(l))throw new yn.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}bt.spliceChildren=Ls;function $R(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)}bt.assembleChildren=$R;function h0(e,t,r,n=0){if(n>ks)throw new yn.InvalidArgumentError(`Artifact node tree exceeds the maximum depth of ${ks}`);qR(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,h0(a,t,i,n+1));return i}bt.rebuildRaw=h0;function qR(e,t){if(e===null||typeof e!="object"||Array.isArray(e))throw new yn.InvalidArgumentError(`Malformed hybrid node at depth ${t}: expected a JSON object`);let r=e;if(typeof r.n!="string")throw new yn.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 yn.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 yn.InvalidArgumentError(`Malformed hybrid node '${r.n}': each attribute must be a [string, string] pair`)}});var Ya=v(Ii=>{"use strict";function VR(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 Hc(e,t){return t===void 0&&(t=Object),t&&typeof t.freeze=="function"?t.freeze(e):e}function GR(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 g0=Hc({HTML:"text/html",isHTML:function(e){return e===g0.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),v0=Hc({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===v0.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});Ii.assign=GR;Ii.find=VR;Ii.freeze=Hc;Ii.MIME_TYPE=g0;Ii.NAMESPACE=v0});var id=v(Hr=>{var N0=Ya(),br=N0.find,Za=N0.NAMESPACE;function zR(e){return e!==""}function WR(e){return e?e.split(/[\t\n\f\r ]+/).filter(zR):[]}function HR(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function y0(e){if(!e)return[];var t=WR(e);return Object.keys(t.reduce(HR,{}))}function jR(e){return function(t){return e&&e.indexOf(t)!==-1}}function to(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function At(e,t){var r=e.prototype;if(!(r instanceof t)){let i=function(){};var n=i;i.prototype=t.prototype,i=new i,to(r,i),e.prototype=r=i}r.constructor!=e&&(typeof e!="function"&&console.error("unknown Class:"+e),r.constructor=e)}var Ct={},qt=Ct.ELEMENT_NODE=1,Ti=Ct.ATTRIBUTE_NODE=2,Bs=Ct.TEXT_NODE=3,D0=Ct.CDATA_SECTION_NODE=4,I0=Ct.ENTITY_REFERENCE_NODE=5,JR=Ct.ENTITY_NODE=6,jc=Ct.PROCESSING_INSTRUCTION_NODE=7,Jc=Ct.COMMENT_NODE=8,_0=Ct.DOCUMENT_NODE=9,T0=Ct.DOCUMENT_TYPE_NODE=10,Gr=Ct.DOCUMENT_FRAGMENT_NODE=11,QR=Ct.NOTATION_NODE=12,et={},qe={},Tz=et.INDEX_SIZE_ERR=(qe[1]="Index size error",1),Pz=et.DOMSTRING_SIZE_ERR=(qe[2]="DOMString size error",2),wt=et.HIERARCHY_REQUEST_ERR=(qe[3]="Hierarchy request error",3),Oz=et.WRONG_DOCUMENT_ERR=(qe[4]="Wrong document",4),KR=et.INVALID_CHARACTER_ERR=(qe[5]="Invalid character",5),Rz=et.NO_DATA_ALLOWED_ERR=(qe[6]="No data allowed",6),Fz=et.NO_MODIFICATION_ALLOWED_ERR=(qe[7]="No modification allowed",7),P0=et.NOT_FOUND_ERR=(qe[8]="Not found",8),xz=et.NOT_SUPPORTED_ERR=(qe[9]="Not supported",9),b0=et.INUSE_ATTRIBUTE_ERR=(qe[10]="Attribute in use",10),_i=et.INVALID_STATE_ERR=(qe[11]="Invalid state",11),Lz=et.SYNTAX_ERR=(qe[12]="Syntax error",12),kz=et.INVALID_MODIFICATION_ERR=(qe[13]="Invalid modification",13),Mz=et.NAMESPACE_ERR=(qe[14]="Invalid namespace",14),Bz=et.INVALID_ACCESS_ERR=(qe[15]="Invalid access",15);function de(e,t){if(t instanceof Error)var r=t;else r=this,Error.call(this,qe[e]),this.message=qe[e],Error.captureStackTrace&&Error.captureStackTrace(this,de);return r.code=e,t&&(this.message=this.message+": "+t),r}de.prototype=Error.prototype;to(et,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++)nd(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 Pi(e,t){this._node=e,this._refresh=t,Qc(this)}function Qc(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var r=e._refresh(e._node);if(V0(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];to(r,e),e._inc=t}}Pi.prototype.item=function(e){return Qc(this),this[e]||null};At(Pi,zr);function Us(){}function O0(e,t){for(var r=e.length;r--;)if(e[r]===t)return r}function w0(e,t,r,n){if(n?t[O0(t,n)]=r:t[t.length++]=r,e){r.ownerElement=e;var i=e.ownerDocument;i&&(n&&x0(i,e,n),XR(i,e,r))}}function A0(e,t,r){var n=O0(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&&(x0(a,e,r),r.ownerElement=null)}}else throw new de(P0,new Error(e.tagName+"@"+r))}Us.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(b0);var r=this.getNamedItem(e.nodeName);return w0(this._ownerElement,this,e,r),r},setNamedItemNS:function(e){var t=e.ownerElement,r;if(t&&t!=this._ownerElement)throw new de(b0);return r=this.getNamedItemNS(e.namespaceURI,e.localName),w0(this._ownerElement,this,e,r),r},removeNamedItem:function(e){var t=this.getNamedItem(e);return A0(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var r=this.getNamedItemNS(e,t);return A0(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 R0(){}R0.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,r){var n=new ro;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 Gs;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 qs(this,e,t)},replaceChild:function(e,t){qs(this,e,t,k0),t&&this.removeChild(t)},removeChild:function(e){return L0(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(e){return q0(this.ownerDocument||this,this,e)},normalize:function(){$e(this,null,{enter:function(e){for(var t=e.firstChild;t;){var r=t.nextSibling;r!==null&&r.nodeType===Bs&&t.nodeType===Bs?(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==Ti?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==Ti?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){var t=this.lookupPrefix(e);return t==null}};function F0(e){return e=="<"&&"&lt;"||e==">"&&"&gt;"||e=="&"&&"&amp;"||e=='"'&&"&quot;"||"&#"+e.charCodeAt()+";"}to(Ct,ue);to(Ct,ue.prototype);function $s(e,t){return $e(e,null,{enter:function(r){return t(r)?$e.STOP:!0}})===$e.STOP}function $e(e,t,r){for(var n=[{node:e,context:t,phase:$e.ENTER}];n.length>0;){var i=n.pop();if(i.phase===$e.ENTER){var a=r.enter(i.node,i.context);if(a===$e.STOP)return $e.STOP;if(n.push({node:i.node,context:a,phase:$e.EXIT}),a==null)continue;for(var o=i.node.lastChild;o;)n.push({node:o,context:a,phase:$e.ENTER}),o=o.previousSibling}else r.exit&&r.exit(i.node,i.context)}}$e.STOP=Symbol("walkDOM.STOP");$e.ENTER=0;$e.EXIT=1;function ro(){this.ownerDocument=this}function XR(e,t,r){e&&e._inc++;var n=r.namespaceURI;n===Za.XMLNS&&(t._nsMap[r.prefix?r.localName:""]=r.value)}function x0(e,t,r,n){e&&e._inc++;var i=r.namespaceURI;i===Za.XMLNS&&delete t._nsMap[r.prefix?r.localName:""]}function Kc(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 L0(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,Kc(e.ownerDocument,e),t}function YR(e){return e&&(e.nodeType===ue.DOCUMENT_NODE||e.nodeType===ue.DOCUMENT_FRAGMENT_NODE||e.nodeType===ue.ELEMENT_NODE)}function ZR(e){return e&&(wr(e)||Xc(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 wr(e){return e&&e.nodeType===ue.ELEMENT_NODE}function Xc(e){return e&&e.nodeType===ue.TEXT_NODE}function C0(e,t){var r=e.childNodes||[];if(br(r,wr)||Wr(t))return!1;var n=br(r,Wr);return!(t&&n&&r.indexOf(n)>r.indexOf(t))}function S0(e,t){var r=e.childNodes||[];function n(a){return wr(a)&&a!==t}if(br(r,n))return!1;var i=br(r,Wr);return!(t&&i&&r.indexOf(i)>r.indexOf(t))}function eF(e,t,r){if(!YR(e))throw new de(wt,"Unexpected parent node type "+e.nodeType);if(r&&r.parentNode!==e)throw new de(P0,"child not in parent");if(!ZR(t)||Wr(t)&&e.nodeType!==ue.DOCUMENT_NODE)throw new de(wt,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function tF(e,t,r){var n=e.childNodes||[],i=t.childNodes||[];if(t.nodeType===ue.DOCUMENT_FRAGMENT_NODE){var a=i.filter(wr);if(a.length>1||br(i,Xc))throw new de(wt,"More than one element or text in fragment");if(a.length===1&&!C0(e,r))throw new de(wt,"Element in fragment can not be inserted before doctype")}if(wr(t)&&!C0(e,r))throw new de(wt,"Only one element can be added and only after doctype");if(Wr(t)){if(br(n,Wr))throw new de(wt,"Only one doctype is allowed");var o=br(n,wr);if(r&&n.indexOf(o)<n.indexOf(r))throw new de(wt,"Doctype can only be inserted before an element");if(!r&&o)throw new de(wt,"Doctype can not be appended since element is present")}}function k0(e,t,r){var n=e.childNodes||[],i=t.childNodes||[];if(t.nodeType===ue.DOCUMENT_FRAGMENT_NODE){var a=i.filter(wr);if(a.length>1||br(i,Xc))throw new de(wt,"More than one element or text in fragment");if(a.length===1&&!S0(e,r))throw new de(wt,"Element in fragment can not be inserted before doctype")}if(wr(t)&&!S0(e,r))throw new de(wt,"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(br(n,l))throw new de(wt,"Only one doctype is allowed");var o=br(n,wr);if(r&&n.indexOf(o)<n.indexOf(r))throw new de(wt,"Doctype can only be inserted before an element")}}function qs(e,t,r,n){eF(e,t,r),e.nodeType===ue.DOCUMENT_NODE&&(n||tF)(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;eo(a,l)}while(a!==o&&(a=a.nextSibling));return Kc(e.ownerDocument||e,e),t.nodeType==Gr&&(t.firstChild=t.lastChild=null),t}function eo(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;)eo(i,t),i=i.nextSibling}}function rF(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,Kc(e.ownerDocument,e,t);var r=e.ownerDocument||e;return eo(t,r),t}ro.prototype={nodeName:"#document",nodeType:_0,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 qs(this,e,t),eo(e,this),this.documentElement===null&&e.nodeType===qt&&(this.documentElement=e),e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),L0(this,e)},replaceChild:function(e,t){qs(this,e,t,k0),eo(e,this),t&&this.removeChild(t),wr(e)&&(this.documentElement=e)},importNode:function(e,t){return nF(this,e,t)},getElementById:function(e){var t=null;return $s(this.documentElement,function(r){if(r.nodeType==qt&&r.getAttribute("id")==e)return t=r,!0}),t},getElementsByClassName:function(e){var t=y0(e);return new Pi(this,function(r){var n=[];return t.length>0&&$s(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=y0(a);o=t.every(jR(s))}o&&n.push(i)}}}),n})},createElement:function(e){var t=new Jn;t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new zr;var r=t.attributes=new Us;return r._ownerElement=t,t},createDocumentFragment:function(){var e=new zs;return e.ownerDocument=this,e.childNodes=new zr,e},createTextNode:function(e){var t=new Yc;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new Zc;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){if(e.indexOf("]]>")!==-1)throw new de(KR,'data contains "]]>"');var t=new ed;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var r=new rd;return r.ownerDocument=this,r.tagName=r.nodeName=r.target=e,r.nodeValue=r.data=t,r},createAttribute:function(e){var t=new Vs;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new td;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var r=new Jn,n=t.split(":"),i=r.attributes=new Us;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 Vs,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}};At(ro,ue);function Jn(){this._nsMap={}}Jn.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):rF(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 Pi(this,function(t){var r=[];return $s(t,function(n){n!==t&&n.nodeType==qt&&(e==="*"||n.tagName==e)&&r.push(n)}),r})},getElementsByTagNameNS:function(e,t){return new Pi(this,function(r){var n=[];return $s(r,function(i){i!==r&&i.nodeType===qt&&(e==="*"||i.namespaceURI===e)&&(t==="*"||i.localName==t)&&n.push(i)}),n})}};ro.prototype.getElementsByTagName=Jn.prototype.getElementsByTagName;ro.prototype.getElementsByTagNameNS=Jn.prototype.getElementsByTagNameNS;At(Jn,ue);function Vs(){}Vs.prototype.nodeType=Ti;At(Vs,ue);function no(){}no.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(qe[wt])},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}};At(no,ue);function Yc(){}Yc.prototype={nodeName:"#text",nodeType:Bs,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}};At(Yc,no);function Zc(){}Zc.prototype={nodeName:"#comment",nodeType:Jc};At(Zc,no);function ed(){}ed.prototype={nodeName:"#cdata-section",nodeType:D0};At(ed,no);function Gs(){}Gs.prototype.nodeType=T0;At(Gs,ue);function M0(){}M0.prototype.nodeType=QR;At(M0,ue);function B0(){}B0.prototype.nodeType=JR;At(B0,ue);function td(){}td.prototype.nodeType=I0;At(td,ue);function zs(){}zs.prototype.nodeName="#document-fragment";zs.prototype.nodeType=Gr;At(zs,ue);function rd(){}rd.prototype.nodeType=jc;At(rd,ue);function U0(){}U0.prototype.serializeToString=function(e,t,r,n){return $0.call(e,t,r,n)};ue.prototype.toString=$0;function $0(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 nd(this,i,e,t,l,n),i.join("")}function E0(e,t,r){var n=e.prefix||"",i=e.namespaceURI;if(!i||n==="xml"&&i===Za.XML||i===Za.XMLNS)return!1;for(var a=r.length;a--;){var o=r[a];if(o.prefix===n)return o.namespace!==i}return!0}function Ms(e,t,r){e.push(" ",t,'="',r.replace(/[<>&"\t\n\r]/g,F0),'"')}function nd(e,t,r,n,i,a){i||(i=[]),$e(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=Za.isHTML(o.namespaceURI)||u;var f=p;if(!u&&!o.prefix&&o.namespaceURI){for(var h,g=0;g<c.length;g++)if(c.item(g).name==="xmlns"){h=c.item(g).value;break}if(!h)for(var w=l.length-1;w>=0;w--){var S=l[w];if(S.prefix===""&&S.namespace===o.namespaceURI){h=S.namespace;break}}if(h!==o.namespaceURI)for(var w=l.length-1;w>=0;w--){var S=l[w];if(S.namespace===o.namespaceURI){S.prefix&&(f=S.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(E0(F,u,D)){var G=F.prefix||"",L=F.namespaceURI;Ms(t,G?"xmlns:"+G:"xmlns",L),D.push({prefix:G,namespace:L})}var q=n?n(F):F;q&&(typeof q=="string"?t.push(q):Ms(t,q.name,q.value))}if(p===f&&E0(o,u,D)){var U=o.prefix||"",L=o.namespaceURI;Ms(t,U?"xmlns:"+U:"xmlns",L),D.push({prefix:U,namespace:L})}var $=o.firstChild;if($||u&&!/^(?:meta|link|img|br|hr|input)$/i.test(p)){if(t.push(">"),u&&/^script$/i.test(p)){for(;$;)$.data?t.push($.data):nd($,t,u,n,D.slice(),a),$=$.nextSibling;return t.push("</",p,">"),null}return{ns:D,isHTML:u,tag:f}}else return t.push("/>"),null;case _0:case Gr:return{ns:l.slice(),isHTML:u,tag:null};case Ti:return Ms(t,o.name,o.value),null;case Bs:return t.push(o.data.replace(/[<&>]/g,F0)),null;case D0:if(a&&o.data.indexOf("]]>")!==-1)throw new de(_i,'The CDATASection data contains "]]>"');return t.push("<![CDATA[",o.data.replace(/]]>/g,"]]]]><![CDATA[>"),"]]>"),null;case Jc:if(a&&o.data.indexOf("-->")!==-1)throw new de(_i,'The comment node data contains "-->"');return t.push("<!--",o.data,"-->"),null;case T0:if(a){if(o.publicId&&!/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(o.publicId))throw new de(_i,"DocumentType publicId is not a valid PubidLiteral");if(o.systemId&&!/^("[^"]*"|'[^']*')$/.test(o.systemId))throw new de(_i,"DocumentType systemId is not a valid SystemLiteral");if(o.internalSubset&&o.internalSubset.indexOf("]>")!==-1)throw new de(_i,'DocumentType internalSubset contains "]>"')}var W=o.publicId,B=o.systemId;if(t.push("<!DOCTYPE ",o.name),W)t.push(" PUBLIC ",W),B&&B!="."&&t.push(" ",B),t.push(">");else if(B&&B!=".")t.push(" SYSTEM ",B,">");else{var Qe=o.internalSubset;Qe&&t.push(" [",Qe,"]"),t.push(">")}return null;case jc:if(a&&o.data.indexOf("?>")!==-1)throw new de(_i,'The ProcessingInstruction data contains "?>"');return t.push("<?",o.target," ",o.data,"?>"),null;case I0: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 nF(e,t,r){var n;return $e(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===Ti||r;return s?o:null}}),n}function q0(e,t,r){var n;return $e(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 Us,p=c.length;d._ownerElement=o;for(var f=0;f<p;f++)o.setAttributeNode(q0(e,c.item(f),!0));break;case Ti:u=!0}return a!==null?a.appendChild(o):n=o,u?o:null}}),n}function V0(e,t,r){e[t]=r}try{Object.defineProperty&&(Object.defineProperty(Pi.prototype,"length",{get:function(){return Qc(this),this.$$length}}),Object.defineProperty(ue.prototype,"textContent",{get:function(){if(this.nodeType===qt||this.nodeType===Gr){var e=[];return $e(this,null,{enter:function(t){if(t.nodeType===qt||t.nodeType===Gr)return!0;if(t.nodeType===jc||t.nodeType===Jc)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}}}),V0=function(e,t,r){e["$$"+t]=r})}catch{}Hr.DocumentType=Gs;Hr.DOMException=de;Hr.DOMImplementation=R0;Hr.Element=Jn;Hr.Node=ue;Hr.NodeList=zr;Hr.walkDOM=$e;Hr.XMLSerializer=U0});var z0=v(io=>{"use strict";var G0=Ya().freeze;io.XML_ENTITIES=G0({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});io.HTML_ENTITIES=G0({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"});io.entityMap=io.HTML_ENTITIES});var Y0=v(od=>{var lo=Ya().NAMESPACE,ad=/[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]/,W0=new RegExp("[\\-\\.0-9"+ad.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),H0=new RegExp("^"+ad.source+W0.source+"*(?::"+ad.source+W0.source+"*)?$"),ao=0,wn=1,Oi=2,oo=3,Ri=4,Fi=5,so=6,Ws=7;function xi(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,xi)}xi.prototype=new Error;xi.prototype.name=xi.name;function Q0(){}Q0.prototype={parse:function(e,t,r){var n=this.domBuilder;n.startDocument(),K0(t,t={}),iF(e,t,r,n,this.errorHandler),n.endDocument()}};function iF(e,t,r,n,i){function a(Z){if(Z>65535){Z-=65536;var yt=55296+(Z>>10),uc=56320+(Z&1023);return String.fromCharCode(yt,uc)}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>g){var yt=e.substring(g,Z).replace(/&#?\w+;/g,o);p&&l(g),n.characters(yt,0,Z-g),g=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={},g=0;;){try{var w=e.indexOf("<",g);if(w<0){if(!e.substr(g).match(/^\s*$/)){var S=n.doc,D=S.createTextNode(e.substr(g));S.appendChild(D),n.currentElement=D}return}switch(w>g&&s(w),e.charAt(w+1)){case"/":var B=e.indexOf(">",w+3),x=e.substring(w+2,B).replace(/[ \t\n\r]+$/g,""),F=f.pop();B<0?(x=e.substring(w+2).replace(/[\s<].*/,""),i.error("end tag name: "+x+" is not complete:"+F.tagName),B=w+1+x.length):x.match(/\s</)&&(x=x.replace(/[\s<].*/,""),i.error("end tag name: "+x+" maybe not complete"),B=w+1+x.length);var G=F.localNSMap,L=F.tagName==x,q=L||F.tagName&&F.tagName.toLowerCase()==x.toLowerCase();if(q){if(n.endElement(F.uri,F.localName,x),G)for(var U in G)Object.prototype.hasOwnProperty.call(G,U)&&n.endPrefixMapping(U);L||i.fatalError("end tag name: "+x+" is not match the current start tagName:"+F.tagName)}else f.push(F);B++;break;case"?":p&&l(w),B=uF(e,w,n);break;case"!":p&&l(w),B=lF(e,w,n,i);break;default:p&&l(w);var $=new X0,W=f[f.length-1].currentNSMap,B=aF(e,w,$,W,o,i),Qe=$.length;if(!$.closed&&sF(e,B,$.tagName,h)&&($.closed=!0,r.nbsp||i.warning("unclosed xml attribute")),p&&Qe){for(var vt=j0(p,{}),pe=0;pe<Qe;pe++){var Ke=$[pe];l(Ke.offset),Ke.locator=j0(p,{})}n.locator=vt,J0($,n,W)&&f.push($),n.locator=p}else J0($,n,W)&&f.push($);lo.isHTML($.uri)&&!$.closed?B=oF(e,B,$.tagName,o,n):B++}}catch(Z){if(Z instanceof xi)throw Z;i.error("element parse error: "+Z),B=-1}B>g?g=B:s(Math.max(w,g)+1)}}function j0(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function aF(e,t,r,n,i,a){function o(f,h,g){r.attributeNames.hasOwnProperty(f)&&a.fatalError("Attribute "+f+" redefined"),r.addValue(f,h.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,i),g)}for(var s,l,u=++t,c=ao;;){var d=e.charAt(u);switch(d){case"=":if(c===wn)s=e.slice(t,u),c=oo;else if(c===Oi)c=oo;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(c===oo||c===wn)if(c===wn&&(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=Fi;else throw new Error("attribute value no end '"+d+"' match");else if(c==Ri)l=e.slice(t,u),o(s,l,t),a.warning('attribute "'+s+'" missed start quot('+d+")!!"),t=u+1,c=Fi;else throw new Error('attribute value must after "="');break;case"/":switch(c){case ao:r.setTagName(e.slice(t,u));case Fi:case so:case Ws:c=Ws,r.closed=!0;case Ri:case wn:break;case Oi:r.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return a.error("unexpected end of input"),c==ao&&r.setTagName(e.slice(t,u)),u;case">":switch(c){case ao:r.setTagName(e.slice(t,u));case Fi:case so:case Ws:break;case Ri:case wn:l=e.slice(t,u),l.slice(-1)==="/"&&(r.closed=!0,l=l.slice(0,-1));case Oi:c===Oi&&(l=s),c==Ri?(a.warning('attribute "'+l+'" missed quot(")!'),o(s,l,t)):((!lo.isHTML(n[""])||!l.match(/^(?:disabled|checked|selected)$/i))&&a.warning('attribute "'+l+'" missed value!! "'+l+'" instead!!'),o(l,l,t));break;case oo:throw new Error("attribute value missed!!")}return u;case"\x80":d=" ";default:if(d<=" ")switch(c){case ao:r.setTagName(e.slice(t,u)),c=so;break;case wn:s=e.slice(t,u),c=Oi;break;case Ri:var l=e.slice(t,u);a.warning('attribute "'+l+'" missed quot(")!!'),o(s,l,t);case Fi:c=so;break}else switch(c){case Oi:var p=r.tagName;(!lo.isHTML(n[""])||!s.match(/^(?:disabled|checked|selected)$/i))&&a.warning('attribute "'+s+'" missed value!! "'+s+'" instead2!!'),o(s,s,t),t=u,c=wn;break;case Fi:a.warning('attribute space is required"'+s+'"!!');case so:c=wn,t=u;break;case oo:c=Ri,t=u;break;case Ws:throw new Error("elements closed character '/' and '>' must be connected to")}}u++}}function J0(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={},K0(r,r={})),r[c]=i[c]=s,a.uri=lo.XMLNS,t.startPrefixMapping(c,s))}for(var d=e.length;d--;){a=e[d];var l=a.prefix;l&&(l==="xml"&&(a.uri=lo.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 oF(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 sF(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 K0(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function lF(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=cF(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 uF(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 X0(){this.attributeNames={}}X0.prototype={setTagName:function(e){if(!H0.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,r){if(!H0.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 cF(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}od.XMLReader=Q0;od.ParseError=xi});var av=v(js=>{var dF=Ya(),pF=id(),Z0=z0(),rv=Y0(),fF=pF.DOMImplementation,ev=dF.NAMESPACE,mF=rv.ParseError,hF=rv.XMLReader;function nv(e){return e.replace(/\r[\n\u0085]/g,`
`).replace(/[\r\u0085\u2028]/g,`
-`)}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);
+`)}function iv(e){this.options=e||{locator:{}}}iv.prototype.parseFromString=function(e,t){var r=this.options,n=new hF,i=r.domBuilder||new uo,a=r.errorHandler,o=r.locator,s=r.xmlns||{},l=/\/x?html?$/.test(t),u=l?Z0.HTML_ENTITIES:Z0.XML_ENTITIES;o&&i.setDocumentLocator(o),n.errorHandler=gF(a,i,o),n.domBuilder=r.domBuilder||i,l&&(s[""]=ev.HTML),s.xml=s.xml||ev.XML;var c=r.normalizeLineEndings||nv;return e&&typeof e=="string"?n.parse(c(e),s,u):n.errorHandler.error("invalid doc source"),i.doc};function gF(e,t,r){if(!e){if(t instanceof uo)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+sd(r))}||function(){}}return a("warning"),a("error"),a("fatalError"),n}function uo(){this.cdata=!1}function Li(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}uo.prototype={startDocument:function(){this.doc=new fF().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;Hs(this,a),this.currentElement=a,this.locator&&Li(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&&Li(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&&Li(this.locator,r),Hs(this,r)},ignorableWhitespace:function(e,t,r){},characters:function(e,t,r){if(e=tv.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&&Li(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=tv.apply(this,arguments);var n=this.doc.createComment(e);this.locator&&Li(this.locator,n),Hs(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&&Li(this.locator,i),Hs(this,i),this.doc.doctype=i}},warning:function(e){console.warn("[xmldom warning] "+e,sd(this.locator))},error:function(e){console.error("[xmldom error] "+e,sd(this.locator))},fatalError:function(e){throw new mF(e,this.locator)}};function sd(e){if(e)return`
+@`+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function tv(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){uo.prototype[e]=function(){return null}});function Hs(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}js.__DOMHandler=uo;js.normalizeLineEndings=nv;js.DOMParser=iv});var ld=v(Js=>{var ov=id();Js.DOMImplementation=ov.DOMImplementation;Js.XMLSerializer=ov.XMLSerializer;Js.DOMParser=av().DOMParser});var An=v(Qs=>{"use strict";Object.defineProperty(Qs,"__esModule",{value:!0});Qs.installDomShim=void 0;var sv=ld(),lv=!1,vF={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 yF(){if(lv)return;let e=globalThis;typeof e.DOMParser>"u"&&(e.DOMParser=sv.DOMParser),typeof e.XMLSerializer>"u"&&(e.XMLSerializer=sv.XMLSerializer),typeof e.Node>"u"&&(e.Node=vF),lv=!0}Qs.installDomShim=yF});var Qn=v(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 bF=bn(),co=re(),wF=An();Te.TEXT_SENTINEL="#text";Te.EMPTY_FORM_SENTINEL="#empty";var Xs=new WeakSet;function AF(e,t){(0,wF.installDomShim)();let r=e&&e.trim()!==""?e:t,i=new DOMParser().parseFromString(r,"text/xml").documentElement;if(!i)throw new co.InvalidArgumentError("XML source has no root element (empty or malformed input)");return SF(i),EF(i),IF(i,r),i}Te.parseXmlRoot=AF;var CF=new Set([1,3]);function SF(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(!CF.has(a.nodeType))throw new co.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 EF(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 co.InvalidArgumentError(`Unsupported document-level XML node (type ${o.nodeType}: declaration / comment / processing-instruction outside the root element) cannot be round-tripped`)}}function NF(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 DF(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 cv(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 IF(e,t){let r=NF(t),n=DF(e),i=Math.min(r.length,n.length);for(let a=0;a<i;a+=1){if(r[a])continue;let o=n[a];cv(o)||Xs.add(o)}}function ud(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 Xs.has(e)&&!cv(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(ud(a))}return r}}}Te.nodeLikeFromDom=ud;function _F(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?Xs.add(t):t.setAttribute(r,n)},addChild:(t,r)=>{t.appendChild(r)}}}Te.domEngine=_F;function dv(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 Ks(r);if(r>=55296&&r<=56319){let n=e.charCodeAt(t+1);if(!(n>=56320&&n<=57343))throw Ks(r);t+=1;continue}if(r>=56320&&r<=57343)throw Ks(r)}}function Ks(e){let t=e.toString(16).toUpperCase().padStart(4,"0");return new co.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 TF(e){return dv(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 PF(e){return dv(e),String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function OF(e){return pv(e,0)}Te.serializeNode=OF;var uv=512;function pv(e,t){var r;if(t>uv)throw new co.InvalidArgumentError(`XML nesting exceeds the maximum supported depth of ${uv}`);if(e.nodeType===3)return PF((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+'="'+TF(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 Xs.has(n)?i+"></"+n.tagName+">":i+" />";i+=">";for(let l of o)i+=pv(l,t+1);return i+"</"+n.tagName+">"}function RF(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,bF.rawFromNode)(r)}))}}Te.projectElementBag=RF});var pd=v(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.getFormSecurityRoles=Cn.setFormSecurityRoles=Cn.formApi=void 0;var FF=$t(),me=be(),Vt=ie(),ki=re(),cd=Qn(),xF="formid,formxml,name,type,objecttypecode,formpresentation,formactivationstate,uniquename,description,versionnumber",LF="formid,name,type,objecttypecode",kF=2,MF={Main:kF,QuickView:6,QuickCreate:7,Card:11};Cn.formApi={async get(e,t){let n=`/systemforms(${(0,Vt.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Vt.odataQuery)([["$select",xF]]),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=>MF[u]))],o=[i.length===1?`type eq ${i[0]}`:`(${i.map(u=>`type eq ${u}`).join(" or ")})`];t?.entityLogicalName&&o.push(`objecttypecode eq '${(0,Vt.odataLiteral)(t.entityLogicalName)}'`);let s=`/systemforms${(0,Vt.odataQuery)([["$select",LF],["$filter",o.join(" and ")]])}`;return(await(0,FF.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,Vt.normalizeGuid)(t,"id");await hv(e,i,mv(i),n);let a=await fv(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 UF(e,i)}},delete(e,t){return(0,me.deleteRecord)(e,"systemforms",t)}};var dd="DisplayConditions";async function BF(e,t,r){var n,i,a,o;if(r.everyone&&r.roleIds&&r.roleIds.length>0)throw new ki.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 s=(0,Vt.normalizeGuid)(t,"formId"),l=`/systemforms(${s})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Vt.odataQuery)([["$select","formid,formxml"]]),u=(0,me.ensureSuccess)(await e.get(l),e.apiUrl(l)),c=(0,me.readEtag)(u),d=u.body,p=d?.formxml;if(!p)throw new ki.InvalidArgumentError(`form '${s}' returned no formxml, so its roles cannot be set`);let f=(0,cd.parseXmlRoot)(p,"<form/>"),h=f.ownerDocument;if(!h)throw new ki.InvalidArgumentError(`form '${s}' produced no owner document`);let g=gv(f,dd),w=g?.hasAttribute("Order")&&(n=g.getAttribute("Order"))!==null&&n!==void 0?n:void 0,S=g?.getAttribute("FallbackForm")||void 0;g&&f.removeChild(g);let D=!!r.everyone||((a=(i=r.roleIds)===null||i===void 0?void 0:i.length)!==null&&a!==void 0?a:0)>0;if(!D&&(r.order!==void 0||r.fallbackForm!==void 0)){if(!g)throw new ki.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&&g.setAttribute("Order",String(r.order)),r.fallbackForm!==void 0&&g.setAttribute("FallbackForm",String(r.fallbackForm)),f.appendChild(g)}else if(D){let q=h.createElement(dd),U=r.order!==void 0?String(r.order):w;U!==void 0&&q.setAttribute("Order",U);let $=r.fallbackForm!==void 0?String(r.fallbackForm):S??"false";if(q.setAttribute("FallbackForm",$),r.everyone)q.appendChild(h.createElement("Everyone"));else for(let W of(o=r.roleIds)!==null&&o!==void 0?o:[]){let B=h.createElement("Role");B.setAttribute("Id",`{${(0,Vt.normalizeGuid)(W,"roleId")}}`),q.appendChild(B)}f.appendChild(q)}let F=(0,cd.serializeNode)(f);await hv(e,s,l,c);let G=await fv(e,s),L=`/systemforms(${s})`;(0,me.ensureSuccess)(await e.patch(L,{formxml:F},{headers:{"Content-Type":"application/json","If-Match":(0,me.requireEtag)(G,"form",s)}}),e.apiUrl(L))}Cn.setFormSecurityRoles=BF;async function fv(e,t){let r=`/systemforms(${t})${(0,Vt.odataQuery)([["$select","formid"]])}`;return(0,me.readEtag)((0,me.ensureSuccess)(await e.get(r),e.apiUrl(r)))}function mv(e){return`/systemforms(${e})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Vt.odataQuery)([["$select","formid"]])}async function UF(e,t){let r=mv(t);return(0,me.readEtag)((0,me.ensureSuccess)(await e.get(r),e.apiUrl(r)))}async function hv(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 ki.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 ki.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 gv(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 $F(e,t){var r,n;let a=`/systemforms(${(0,Vt.normalizeGuid)(t,"formId")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Vt.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,cd.parseXmlRoot)(s,"<form/>"),u=gv(l,dd);if(!u)return;let c=[],d=!1,p=u.childNodes;for(let h=0;h<p.length;h+=1){let g=p[h];if(g.nodeType!==1)continue;let w=g;if(w.tagName==="Everyone")d=!0;else if(w.tagName==="Role"){let S=(n=w.getAttribute("Id"))!==null&&n!==void 0?n:"";S&&c.push(S.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)}:{}}}Cn.getFormSecurityRoles=$F});var el=v(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 qF=$t(),tr=be(),tt=ie(),Ys=re(),Ar=xs();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 VF(e,t,r){let i=`/${await(0,Ar.resolveEntitySetName)(e,t)}`,a=(0,tr.ensureSuccess)(await e.post(i,Zs(r)),e.apiUrl(i)),o=(0,tr.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}}Ne.createRecord=VF;async function GF(e,t,r,n){let i=(0,tt.normalizeGuid)(r,"id"),o=`/${await(0,Ar.resolveEntitySetName)(e,t)}(${i})`;(0,tr.ensureSuccess)(await e.patch(o,Zs(n)),e.apiUrl(o))}Ne.updateRecord=GF;async function zF(e,t,r){let n=(0,tt.normalizeGuid)(r,"id"),a=`/${await(0,Ar.resolveEntitySetName)(e,t)}(${n})`;(0,tr.ensureSuccess)(await e.delete(a),e.apiUrl(a))}Ne.deleteRecord=zF;async function WF(e,t,r,n){var i;let a=(0,tt.normalizeGuid)(r,"id"),o=await(0,Ar.resolveEntitySetName)(e,t),s=(0,tt.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=WF;function HF(e){return e?.fetchXml?(0,tt.odataQuery)([["fetchXml",e.fetchXml]]):(0,tt.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 vv(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,Ar.resolveEntitySetName)(e,t)}${HF(r)}`;return r?.paginate?(0,qF.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=vv;async function jF(e,t,r){return vv(e,t,{...r,paginate:!0})}Ne.queryAllRecords=jF;function JF(e){if("id"in e)return`(${(0,tt.normalizeGuid)(e.id,"id")})`;let t=typeof e.value=="string"?`'${(0,tt.odataPathLiteral)(e.value)}'`:e.value;return`(${(0,tt.assertODataName)(e.key,"alternate key name")}=${t})`}async function QF(e,t,r,n){let i=JF(r),o=`/${await(0,Ar.resolveEntitySetName)(e,t)}${i}`,s=(0,tr.ensureSuccess)(await e.patch(o,Zs(n)),e.apiUrl(o)),l=s.status===201,u=(0,tr.readCreatedId)(s,`${t}id`);return{id:u??("id"in r?(0,tt.normalizeGuid)(r.id,"id"):""),created:l}}Ne.upsertRecord=QF;async function KF(e,t,r){var n,i;if(r.length===0)return[];let a=await(0,Ar.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,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 Ys.InvalidArgumentError(`CreateMultiple on '${t}' returned ${u.length} id(s) for ${r.length} row(s)`);return u}Ne.createRecordsBulk=KF;async function XF(e,t,r,n){let i=(0,tt.normalizeGuid)(r,"id"),a=(0,tt.normalizeGuid)(n.targetId,"targetId"),o=await(0,Ar.resolveEntitySetName)(e,t),s=await(0,Ar.resolveEntitySetName)(e,n.targetEntity),l=(0,tt.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=XF;async function YF(e,t,r,n,i){let a=(0,tt.normalizeGuid)(r,"id"),o=(0,tt.normalizeGuid)(i,"targetId"),s=await(0,Ar.resolveEntitySetName)(e,t),l=(0,tt.assertODataName)(n,"relationshipName"),u=`/${s}(${a})/${l}(${o})/$ref`;(0,tr.ensureSuccess)(await e.delete(u),e.apiUrl(u))}Ne.disassociateRecords=YF});var rr=v(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.publishBoundEntity=Ve.boundEntityPublishScope=Ve.publishGenPageById=Ve.publishDashboardById=Ve.publishWebResourceById=Ve.publishEntity=Ve.publishAppModule=Ve.publishXml=void 0;var ZF=be(),po=ie(),yv="/PublishXml";async function Mi(e,t){(0,ZF.ensureSuccess)(await e.post(yv,{ParameterXml:t}),e.apiUrl(yv))}Ve.publishXml=Mi;function ex(e,t){return Mi(e,`<importexportxml><appmodules><appmodule>${(0,po.xmlText)(t)}</appmodule></appmodules></importexportxml>`)}Ve.publishAppModule=ex;function bv(e,t){return Mi(e,`<importexportxml><entities><entity>${(0,po.xmlText)(t)}</entity></entities></importexportxml>`)}Ve.publishEntity=bv;function tx(e,t){return Mi(e,`<importexportxml><webresources><webresource>${(0,po.xmlText)(t)}</webresource></webresources></importexportxml>`)}Ve.publishWebResourceById=tx;function rx(e,t){return Mi(e,`<importexportxml><dashboards><dashboard>${(0,po.xmlText)(t)}</dashboard></dashboards></importexportxml>`)}Ve.publishDashboardById=rx;function nx(e,t){return Mi(e,`<importexportxml><uxagentprojects><uxagentproject>${(0,po.xmlText)(t)}</uxagentproject></uxagentprojects></importexportxml>`)}Ve.publishGenPageById=nx;function ix(e){let t=e?.entityLogicalName;return t?{envelope:"entity",entityLogicalName:t,blastRadiusWarning:"ENTITY_ENVELOPE_ALSO_SHIPS_UNRELATED_UNPUBLISHED_CHANGES"}:{envelope:"entity"}}Ve.boundEntityPublishScope=ix;function ax(e,t){let r=t?.entityLogicalName;return r?bv(e,r):Promise.resolve()}Ve.publishBoundEntity=ax});var md=v(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.base64ToBytes=Sn.bytesToBase64=Sn.utf8ToBase64=void 0;var wv=32768,St="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function fd(){return globalThis}function ox(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 sx(e){let t="";for(let r=0;r<e.length;r+=wv)t+=String.fromCharCode(...e.subarray(r,r+wv));return t}function lx(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+="/":St.indexOf(n)>=0&&(t+=n)}for(t.length%4===1&&(t=t.slice(0,-1));t.length%4!==0;)t+="=";return t}function ux(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+=St[i>>18&63]+St[i>>12&63]+St[i>>6&63]+St[i&63]}let n=e.length-r;if(n===1){let i=e[r]<<16;t+=`${St[i>>18&63]}${St[i>>12&63]}==`}else if(n===2){let i=e[r]<<16|e[r+1]<<8,a=St[i>>18&63],o=St[i>>12&63],s=St[i>>6&63];t+=`${a}${o}${s}=`}return t}function cx(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=St.indexOf(e[a])<<18|St.indexOf(e[a+1])<<12|(e[a+2]==="="?0:St.indexOf(e[a+2]))<<6|(e[a+3]==="="?0:St.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 dx(e){let t=fd();if(t.Buffer)return t.Buffer.from(e,"utf8").toString("base64");let r=t.TextEncoder;return Av(r?new r().encode(e):ox(e))}Sn.utf8ToBase64=dx;function Av(e){let t=fd();return t.Buffer?t.Buffer.from(e).toString("base64"):t.btoa?t.btoa(sx(e)):ux(e)}Sn.bytesToBase64=Av;function px(e){let t=fd();if(t.Buffer)return new Uint8Array(t.Buffer.from(e,"base64"));let r=lx(e);if(t.atob){let n=t.atob(r);return Uint8Array.from(n,i=>i.charCodeAt(0))}return cx(r)}Sn.base64ToBytes=px});var Nv=v(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.deleteWebResource=Cr.getWebResource=Cr.updateWebResource=Cr.createWebResource=void 0;var fx=rr(),fo=be(),tl=ie(),mx=md(),Cv=re(),hx={html:1,css:2,js:3,xml:4,png:5,jpg:6,gif:7,xsl:9,ico:10,svg:11,resx:12};function Sv(e){if(e.contentBase64!==void 0)return e.contentBase64;if(e.content!==void 0)return(0,mx.utf8ToBase64)(e.content)}async function Ev(e,t){return(0,fx.publishWebResourceById)(e,t)}async function gx(e,t){var r;let n=Sv(t);if(n===void 0)throw new Cv.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:hx[t.type],content:n};t.description&&(i.description=t.description);let a=(0,fo.ensureSuccess)(await e.post("/webresourceset",i),e.apiUrl("/webresourceset")),o=(0,fo.readCreatedId)(a,"webresourceid");if(!o)throw new Cv.InvalidArgumentError(`Dataverse did not return an id for web resource '${t.name}'`);return t.publish!==!1&&await Ev(e,o),{id:o,name:t.name}}Cr.createWebResource=gx;async function vx(e,t,r){let n=(0,tl.normalizeGuid)(t,"id"),i={},a=Sv(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,fo.ensureSuccess)(await e.patch(o,i),e.apiUrl(o)),r.publish!==!1&&await Ev(e,n)}Cr.updateWebResource=vx;async function yx(e,t){var r;let i=`/webresourceset(${(0,tl.normalizeGuid)(t,"id")})${(0,tl.odataQuery)([["$select","name,displayname,webresourcetype,content,description"]])}`;return(r=(0,fo.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)!==null&&r!==void 0?r:{}}Cr.getWebResource=yx;async function bx(e,t){let n=`/webresourceset(${(0,tl.normalizeGuid)(t,"id")})`;(0,fo.ensureSuccess)(await e.delete(n),e.apiUrl(n))}Cr.deleteWebResource=bx});var rl=v(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.applyAppSettings=Ge.setAppSetting=Ge.readAppSettings=Ge.resolveSettingDefinitions=Ge.APP_SETTING_UNSET=Ge.APP_SETTING_OFF=Ge.APP_SETTING_ON=Ge.HEADER_AND_NAVIGATION_REFRESH=void 0;var Bi=be(),jr=ie();Ge.HEADER_AND_NAVIGATION_REFRESH="HeaderAndNavigationRefresh";Ge.APP_SETTING_ON="2";Ge.APP_SETTING_OFF="1";Ge.APP_SETTING_UNSET="0";function _v(e,t){return"/appsettings/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,jr.odataQuery)([["$select",e],["$filter",t]])}async function Tv(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,jr.odataLiteral)(c)}'`).join(" or "),s=`/settingdefinitions${(0,jr.odataQuery)([["$select","settingdefinitionid,uniquename,displayname"],["$filter",o]])}`,u=((n=(r=(0,Bi.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}Ge.resolveSettingDefinitions=Tv;async function wx(e,t){var r,n,i,a;let o=(0,jr.normalizeGuid)(t,"App id"),s=_v("appsettingid,value,_settingdefinitionid_value",`_parentappmoduleid_value eq ${o}`),u=((n=(r=(0,Bi.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(g=>`settingdefinitionid eq ${(0,jr.normalizeGuid)(g,"Setting definition id")}`).join(" or "),f=`/settingdefinitions${(0,jr.odataQuery)([["$select","settingdefinitionid,uniquename,displayname"],["$filter",p]])}`,h=(0,Bi.ensureSuccess)(await e.get(f),e.apiUrl(f));for(let g of((a=(i=h.body)===null||i===void 0?void 0:i.value)!==null&&a!==void 0?a:[]).filter(Boolean))g.settingdefinitionid&&d.set(g.settingdefinitionid.toLowerCase(),g)}return u.map(p=>{var f,h,g,w,S;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=(g=D?.uniquename)!==null&&g!==void 0?g:p._settingdefinitionid_value)!==null&&w!==void 0?w:"",value:(S=p.value)!==null&&S!==void 0?S:"",...D?.displayname?{displayName:D.displayname}:{}}})}Ge.readAppSettings=wx;async function Dv(e,t,r){var n,i,a;let o=_v("appsettingid,value",`_parentappmoduleid_value eq ${t} and _settingdefinitionid_value eq ${r}`),l=((i=(n=(0,Bi.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 Pv(e,t,r,n){let i=(0,jr.normalizeGuid)(t,"App id"),o=(await Tv(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,jr.normalizeGuid)(s,"Setting definition id"),u=await Dv(e,i,l);if(u)return Iv(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(g){f=g}let h;try{h=await Dv(e,i,l)}catch{h=void 0}if(h)return Iv(e,h,n);throw p&&(0,Bi.ensureSuccess)(p,e.apiUrl(c)),f}Ge.setAppSetting=Pv;async function Iv(e,t,r){if(t.value===r)return"unchanged";let n=`/appsettings(${(0,jr.normalizeGuid)(t.id,"App setting id")})`;return(0,Bi.ensureSuccess)(await e.patch(n,{value:r}),e.apiUrl(n)),"updated"}async function Ax(e,t,r){var n;let i=[];for(let[a,o]of Object.entries(r??{}))try{await Pv(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}Ge.applyAppSettings=Ax});var il=v(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 Rv=v(te=>{"use strict";Object.defineProperty(te,"__esModule",{value:!0});te.deleteSolution=te.importSolution=te.exportSolution=te.removeSolutionComponent=te.addSolutionComponent=te.setSolutionVersion=te.createSolution=te.createPublisher=te.getSolution=te.fetchSolutionComponents=te.SolutionComponentType=void 0;var Ov=$t(),nr=be(),Et=ie(),Kn=re();te.SolutionComponentType={SavedQuery:26,Workflow:29,SavedQueryVisualization:59,SystemForm:60,AppModule:80,UxAgentProject:10372};var Cx=[te.SolutionComponentType.SavedQuery,te.SolutionComponentType.Workflow,te.SolutionComponentType.SavedQueryVisualization,te.SolutionComponentType.SystemForm,te.SolutionComponentType.AppModule,te.SolutionComponentType.UxAgentProject];async function Sx(e,t){let r=(0,Et.normalizeGuid)(t,"solutionId"),n=Cx.map(s=>`msdyn_componenttype eq ${s}`).join(" or "),i=`/msdyn_solutioncomponentsummaries${(0,Et.odataQuery)([["$select","msdyn_objectid,msdyn_componenttype,msdyn_workflowcategory,msdyn_displayname,msdyn_name"],["$filter",`msdyn_solutionid eq ${r} and (${n})`]])}`,o=(await(0,Ov.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 Ex(e,r,o)]}te.fetchSolutionComponents=Sx;async function Ex(e,t,r){let n=new Set(r.map(s=>s.objectId.toLowerCase())),i=`/solutioncomponents${(0,Et.odataQuery)([["$select","objectid,componenttype"],["$filter",`_solutionid_value eq ${t} and componenttype eq ${te.SolutionComponentType.UxAgentProject}`]])}`,a=await(0,Ov.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:te.SolutionComponentType.UxAgentProject}))}return o}function Nx(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 Dx(e,t){var r,n,i,a,o,s,l,u,c,d;let p=String(t??"").trim();if(!p)throw new Kn.InvalidArgumentError("getSolution: a solution unique name or id is required.");let f=Nx(p)?`solutionid eq ${(0,Et.normalizeGuid)(p,"solutionId")}`:`uniquename eq '${(0,Et.odataLiteral)(p)}'`,h=`/solutions${(0,Et.odataQuery)([["$select","solutionid,uniquename,friendlyname,version,ismanaged"],["$expand","publisherid($select=publisherid,uniquename,customizationprefix,customizationoptionvalueprefix)"],["$filter",f]])}`,S=((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(!S?.solutionid)throw new Kn.InvalidArgumentError(`No solution found for '${t}'.`);let D=S.publisherid;if(!D?.publisherid)throw new Kn.InvalidArgumentError(`Solution '${(i=S.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 Kn.InvalidArgumentError(`Solution '${(a=S.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,Et.normalizeGuid)(S.solutionid,"solutionId"),uniqueName:(o=S.uniquename)!==null&&o!==void 0?o:"",friendlyName:(s=S.friendlyname)!==null&&s!==void 0?s:"",version:(l=S.version)!==null&&l!==void 0?l:"",isManaged:!!S.ismanaged,publisherId:(0,Et.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}}te.getSolution=Dx;async function Ix(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 Kn.InvalidArgumentError(`Dataverse did not return an id for publisher '${t.uniqueName}'`);return{id:a,uniqueName:t.uniqueName}}te.createPublisher=Ix;async function _x(e,t){var r;let n=(0,Et.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 Kn.InvalidArgumentError(`Dataverse did not return an id for solution '${t.uniqueName}'`);return{id:o,uniqueName:t.uniqueName}}te.createSolution=_x;async function Tx(e,t,r){let i=`/solutions(${(0,Et.normalizeGuid)(t,"solutionId")})`;(0,nr.ensureSuccess)(await e.patch(i,{version:r}),e.apiUrl(i))}te.setSolutionVersion=Tx;async function Px(e,t){var r;let i={ComponentId:(0,Et.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"))}te.addSolutionComponent=Px;async function Ox(e,t,r,n){let a={SolutionComponent:{"@odata.type":"Microsoft.Dynamics.CRM.solutioncomponent",solutioncomponentid:(0,Et.normalizeGuid)(t,"componentId")},ComponentType:r,SolutionUniqueName:n};(0,nr.ensureSuccess)(await e.post("/RemoveSolutionComponent",a),e.apiUrl("/RemoveSolutionComponent"))}te.removeSolutionComponent=Ox;async function Rx(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 Kn.InvalidArgumentError(`ExportSolution returned no file for '${t.solutionName}'`);return{base64:o}}te.exportSolution=Rx;async function Fx(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,Et.normalizeGuid)(t.importJobId,"importJobId")),(0,nr.ensureSuccess)(await e.post("/ImportSolution",i),e.apiUrl("/ImportSolution"))}te.importSolution=Fx;async function xx(e,t){let n=`/solutions(${(0,Et.normalizeGuid)(t,"solutionId")})`;(0,nr.ensureSuccess)(await e.delete(n),e.apiUrl(n))}te.deleteSolution=xx});var sl=v(En=>{"use strict";Object.defineProperty(En,"__esModule",{value:!0});En.appApi=En.deleteAppResolvingOnce=En.unpublishedAppModulesQuery=void 0;var wd=$t(),Lx=Cd(),Fv=rr(),kx=rl(),Ae=be(),se=ie(),bd=ct(),Mx=qc(),he=re(),Bx=(0,se.odataQuery)([["$select","appmoduleid,name,uniquename,description,aiappdescription"]]),hd="appmoduleid,name,uniquename,description,aiappdescription";function $v(e,t,r){return"/appmodules/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,se.odataQuery)([["$select",e],["$filter",t],["$top",r]])}En.unpublishedAppModulesQuery=$v;function gd(e,t){return $v(e,t?`appmoduleid eq ${t}`:void 0,t?1:void 0)}function ol(e,t){return"/sitemaps/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,se.odataQuery)([["$select",t],["$filter",`sitemapid eq ${e}`],["$top",1]])}function Ui(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 mo(e){let t=new Set,r=[];for(let n of e??[])n&&!t.has(n)&&(t.add(n),r.push(n));return r}function Ux(e){return`cdsapp_${(e||"").replace(/[^a-zA-Z0-9]/g,"")||"app"}`}async function qv(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 $x(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 Ad(e){return e instanceof Error?e.message:String(e)}async function qx(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,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 (${Ad(a)}); it will not be visible or playable until a role is granted access to it.`}}async function Vx(e,t){let r=[];async function n(s,l,u){try{return(await(0,wd.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}' (${Ad(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 xv=new WeakMap;async function Gx(e,t){let r=xv.get(e);r||(r=new Map,xv.set(e,r));let n=r.get(t);if(n!==void 0)return n;let i=await zx(e,t);return i&&r.set(t,i),i}async function Lv(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 zx(e,t){let r=`/EntityDefinitions(LogicalName='${(0,se.odataPathLiteral)(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 kv(e,t){let r=[],n=mo(t.entities),i=4,a=await Lv(n,i,f=>Gx(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 mo(t.components.forms))r.push({"@odata.type":"Microsoft.Dynamics.CRM.systemform",formid:f});for(let f of mo(t.components.views))r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedquery",savedqueryid:f});for(let f of mo(t.components.charts))r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedqueryvisualization",savedqueryvisualizationid:f});for(let f of mo(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 Lv(n,i,f=>Vx(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 Mv(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 Wx(e){return"/appmodules/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,se.odataQuery)([["$select","appmoduleid,appmoduleidunique"],["$filter",`appmoduleid eq ${e}`],["$top",1]])}async function Bv(e,t,r){var n;if(r.length===0)return;let i=Wx(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=Ui(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 Hx(e,t,r){let n=`/appmodules(${t})`,i=`/sitemaps(${r.sitemapId})`;try{let a=await jx(e,r.sitemapId,r.sitemapNameUnique);if(a==="absent"){r.serverRefusedSitemap&&(0,Ae.ensureSuccess)(await e.delete(n),e.apiUrl(n));return}if(a==="foreign"){r.serverRefusedSitemap&&(0,Ae.ensureSuccess)(await e.delete(n),e.apiUrl(n));return}e.supportsAtomicBatch&&await Gv(e,[{path:n},{path:i,etag:r.sitemapEtag}])}catch{}}async function jx(e,t,r){var n,i,a;let o=ol(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 Vv(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})${Bx}`,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 qv(e,s);if(!l)return{uniquename:s,appEtag:(0,Ae.readEtag)(o)};let u=(0,se.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=Ui(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 Jx(e,t,r){let n=(0,se.normalizeGuid)(t,"id"),i=await Vv(e,n);await r?.(i.sitemapXml),await zv(e,n,i)}En.deleteAppResolvingOnce=Jx;async function Gv(e,t){let r=`batch_${(0,bd.newId)()}`,n=`changeset_${(0,bd.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,Mx.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 vd(e,t){try{let r=ol(t,"sitemapid"),n=await e.get(r);return n.status<200||n.status>=300?null:al(Ui(n))}catch{return null}}function Qx(e){return e>=400&&e<500&&e!==408&&e!==429}function yd(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 zv(e,t,r){let n=`/appmodules(${t})`;if(!r.sitemapId){await Kx(e,n,yd(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 Gv(e,[{path:n,etag:yd(r.appEtag,t,"app")},{path:`/sitemaps(${r.sitemapId})`,etag:yd(r.sitemapEtag,t,"sitemap")}])}async function Kx(e,t,r){(0,Ae.ensureSuccess)(await e.delete(t,{headers:{"If-Match":r}}),e.apiUrl(t))}async function Uv(e,t){if(!/GenPageId/i.test(t))return;let r;try{r=[...new Set((0,Lx.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 (${Ad(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,wd.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 Xx(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")}En.appApi={async get(e,t){var r;let n=(0,se.normalizeGuid)(t,"id"),i=gd(hd,n),a=(0,Ae.ensureSuccess)(await e.get(i),e.apiUrl(i)),o=(r=Ui(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 qv(e,o.uniquename),l=s?(0,se.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=Ui(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,se.normalizeGuid)(o.appmoduleid,"appmoduleid")]:c}}:{}}},async list(e,t){let r=gd(hd);return(await(0,wd.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 Uv(e,n.sitemapxml);let i=n.iconWebResourceId?void 0:await $x(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||Ux(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,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"},g=n.sitemapId?(0,se.normalizeGuid)(n.sitemapId,"sitemapId"):(0,bd.newId)(),w=!1;try{let D="/sitemaps",x=await e.post(D,{sitemapid:g,sitemapnameunique:s,sitemapname:n.sitemapname,sitemapxml:n.sitemapxml});w=Qx(x.status);let F=(0,Ae.ensureSuccess)(x,e.apiUrl(D));p=(0,Ae.readEtag)(F),p||(p=await vd(e,g));let G=await kv(e,n);f.push(...G.warnings);let L=G.components;L.unshift({"@odata.type":"Microsoft.Dynamics.CRM.sitemap",sitemapid:g}),await Mv(e,d,L),await Bv(e,d,G.tables);let q=await qx(e,d);q&&f.push(q),n.appSettings&&Object.keys(n.appSettings).length>0&&f.push(...await(0,kx.applyAppSettings)(e,d,n.appSettings)),n.published!==!1&&(await(0,Fv.publishAppModule)(e,d),h={kind:"submitted"})}catch(D){throw await Hx(e,d,{sitemapId:g,sitemapNameUnique:s,serverRefusedSitemap:w,sitemapEtag:p}),D}let S=null;if(h.kind==="submitted")try{let D=await e.get(`/appmodules(${d})?$select=appmoduleid`);D.status>=200&&D.status<300&&(S=(0,Ae.readEtag)(D))}catch{}return{id:d,etag:p,serverIdentity:{sitemapId:g},siblingEtags:{[d]:S},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,g=(0,se.normalizeGuid)(t,"id");if(await Uv(e,h.sitemapxml),!h.sitemapId)throw new he.ValidationError("app",g,"/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 '${g}': 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 S=await kv(e,h),D=`/appmodules(${g})`,x=(o=a?.[g])!==null&&o!==void 0?o:null,F=!0,G=!1;try{let pe=gd(hd,g),Ke=await e.get(pe);if(Ke.status>=200&&Ke.status<300){let Z=(s=Ui(Ke))!==null&&s!==void 0?s:{};G=!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=G?x:null,Ke=pe?(0,Ae.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(Xx(Z))throw new he.SdkError("APP_DRAFT_HEADER_NOT_WRITABLE",`Refusing to update app '${g}': 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)(Z,e.apiUrl(D)),L=(0,Ae.readEtag)(Z)}let q={"If-Match":n},U=`/sitemaps(${w})`,$;try{$=(0,Ae.ensureSuccess)(await e.patch(U,{sitemapxml:h.sitemapxml,sitemapname:h.sitemapname},q?{headers:q}:void 0),e.apiUrl(U))}catch(pe){throw(0,he.withPartialTokens)(pe,{siblingEtags:{[g]:L}})}let W=[...S.warnings];try{await Mv(e,g,S.components),await Bv(e,g,S.tables)}catch(pe){W.push(`App '${g}': one or more components were not pinned (${pe.message}). Navigation may reference content not included in the app; re-push to retry.`)}let B={kind:"notRequested"},Qe=L,vt=(0,Ae.readEtag)($);if(h.published===!0){try{await(0,Fv.publishAppModule)(e,g),B={kind:"submitted"}}catch(pe){B={kind:"failed",error:pe},W.push(`App '${g}': saved, but publishing failed (${pe.message}). The app remains unpublished; re-push to retry.`)}if(B.kind==="submitted"){Qe=null;try{let pe=await e.get(`/appmodules(${g})?$select=appmoduleid`);pe.status>=200&&pe.status<300&&(Qe=(0,Ae.readEtag)(pe)),vt=(f=await vd(e,w))!==null&&f!==void 0?f:vt}catch{}}}return{id:g,etag:vt??await vd(e,w),siblingEtags:{[g]:Qe},publish:B,...W.length>0?{warnings:W}:{}}},async delete(e,t){let r=(0,se.normalizeGuid)(t,"id");await zv(e,r,await Vv(e,r))}}});var Cd=v($i=>{"use strict";Object.defineProperty($i,"__esModule",{value:!0});$i.deleteAppCascade=$i.collectGenPageIds=void 0;var Yx=sl(),Zx=re(),Sd=ie(),eL=ld();function Wv(e){let t=[],r=s=>l=>t.push(`${s}: ${l}`),i=new eL.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,Sd.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}$i.collectGenPageIds=Wv;async function tL(e,t,r){let n=(0,Sd.normalizeGuid)(t,"appModuleId");(0,Sd.normalizeGuid)(r,"appModuleIdUnique");let i=[],a=[],o=[];await(0,Yx.deleteAppResolvingOnce)(e,n,l=>{l!==void 0&&o.push(...Wv(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}}$i.deleteAppCascade=tL});var Hv={};Ur(Hv,{Guid:()=>T});var T,xe=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";Re();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 jv={};Ur(jv,{ScriptUtilities:()=>N});var N,Re=I(()=>{"use strict";xe();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,Xn,cl,Ed,dl,Nd=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}},Xn=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)}},Ed=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 Ed(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 Jv={};Ur(Jv,{ChartGridMode:()=>Gt,ColumnLayoutWidths:()=>oL,ComponentCategory:()=>fl,ComponentType:()=>Dd,ControlLayoutTypes:()=>Fd,DisplayConditionsInfo:()=>iL,ElementNames:()=>y,ElementProperties:()=>m,ElementType:()=>_d,EntityAttributeProperty:()=>Td,EventType:()=>ho,FormActivationState:()=>Rd,FormCanvasServiceScope:()=>yL,FormDesignerSideBarTab:()=>Id,FormPresentation:()=>Pd,FormState:()=>pl,FormType:()=>Le,HeaderDensityType:()=>Nn,LookUpTable:()=>Sr,MORE_TAB_PREFIX:()=>lL,NavBarChildElementType:()=>Od,PREVIEW_ID_HEADER_FLYOUT:()=>pL,PREVIEW_ID_HEADER_OVERFLOW_BUTTON:()=>mL,PREVIEW_ID_NAVIGATION_AREA:()=>cL,PREVIEW_ID_QUICKCREATE_ROOT:()=>gL,PREVIEW_ID_TAB:()=>hL,PREVIEW_ID_TAB_LIST:()=>fL,PREVIEW_ID_TAB_PANEL:()=>dL,PropertyModelKeys:()=>kd,PropertyModelSectionKeys:()=>sL,RELATED_TAB_ID:()=>Md,RELATED_TAB_PREFIX:()=>uL,SectionDefaultProperties:()=>aL,SectionLayoutTypes:()=>Se,TabContentType:()=>xd,TabDefaultProperties:()=>Dn,TabLayoutTypes:()=>Ce,TelemetryPropertyNames:()=>vL,UnboundControlPropertyKeys:()=>Ld,compositeAddressFields:()=>nL,compositeFieldNames:()=>xt,compositeFields:()=>rL});var Le,Dd,Id,y,m,_d,xt,rL,nL,Td,Sr,pl,Nn,Pd,iL,Od,Rd,Ce,aL,Dn,Se,Fd,xd,oL,Ld,kd,sL,ho,Gt,Md,lL,uL,cL,dL,pL,fL,mL,hL,gL,vL,fl,yL,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"})(Le||(Le={}));(function(e){e[e.Form=0]="Form",e[e.Dialog=1]="Dialog"})(Dd||(Dd={}));(function(e){e[e.Components=0]="Components",e[e.Properties=1]="Properties",e[e.Relationship=2]="Relationship",e[e.BusinessRules=3]="BusinessRules"})(Id||(Id={}));(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"})(_d||(_d={}));xt={fullname:"fullname",yomifullname:"yomifullname",address1_composite:"address1_composite",address2_composite:"address2_composite",address3_composite:"address3_composite",billto:"billto_composite",shipto:"shipto_composite"},rL=[xt.fullname,xt.yomifullname,xt.address1_composite,xt.address2_composite,xt.address3_composite,xt.billto,xt.shipto],nL=[xt.address1_composite,xt.address2_composite,xt.address3_composite,xt.billto,xt.shipto];(function(e){e[e.IsValidForForm=0]="IsValidForForm",e[e.IsValidForCreate=1]="IsValidForCreate"})(Td||(Td={}));(function(e){e[e.DependencyFieldTable=0]="DependencyFieldTable",e[e.LockedFieldTable=1]="LockedFieldTable"})(Sr||(Sr={}));(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"})(Nn||(Nn={}));(function(e){e[e.ClassicForm=0]="ClassicForm",e[e.AirForm=1]="AirForm",e[e.ConvertedICForm=2]="ConvertedICForm"})(Pd||(Pd={}));iL={TopOrderFormId:"topOrderFormId",NextDisplayOrder:"nextDisplayOrder"};(function(e){e[e.NavBarRelationShipItem=0]="NavBarRelationShipItem",e[e.NavBarItem=1]="NavBarItem"})(Od||(Od={}));(function(e){e[e.InActive=0]="InActive",e[e.Active=1]="Active"})(Rd||(Rd={}));(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={}));aL={ShowLabel:"false",LockLevel:"0",IsUserDefined:"0",LabelWidth:"115",columns:"1",ShowBar:"false",Layout:"varwidth",namePrefix:"_section_"},Dn={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"})(Fd||(Fd={}));(function(e){e.cardSections="cardSections",e.singleComponent="singleComponent",e.default="default",e.expandAvailableSpace="expandAvailableSpace"})(xd||(xd={}));oL={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"})(Ld||(Ld={}));(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"})(kd||(kd={}));sL={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"})(Gt||(Gt={}));Md="tab_related3b554255-7717-4d17-bb7f-9936fb1e75ca",lL="more_tab_",uL="related_tab_",cL="preview_id_navigation_area",dL="tab-section",pL="headerFieldsFlyout",fL="tablist",mL="header_overflowButton",hL="tab",gL="quickCreateRoot",vL={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={}));yL="CellCanvasServiceScope"});var Qv={};Ur(Qv,{Attribute:()=>ml,FormElementNode:()=>H});var ml,H,ze=I(()=>{"use strict";Re();rt();Nd();X();xe();ml=class{key;value;constructor(t,r){this.key=t,this.value=r}},H=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 Xn(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 Xn(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 Xn(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 Xn(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 Kv={};Ur(Kv,{ControlClassId:()=>E,ControlNamePrefixes:()=>hl,getControlDisplayNames:()=>bL});function bL(e){return{[E.AccessPrivilegeControl]:e("controls.controlNames.accessPrivilege"),[E.AccessTeamTablePickerControl]:e("controls.controlNames.accessTeamTablePicker"),[E.ACIControl]:e("controls.controlNames.aci"),[E.ActivitiesContainerControl]:e("controls.controlNames.activitiesContainer"),[E.ActivitiesWallControl]:e("controls.controlNames.activitiesWall"),[E.AppliedFiltersControl]:e("controls.controlNames.appliedFilters"),[E.ArticleContentControl]:e("controls.controlNames.articleContent"),[E.BooleanControl]:e("controls.controlNames.twoOption"),[E.ButtonControl]:e("controls.controlNames.button"),[E.CheckboxControl]:e("controls.controlNames.checkbox"),[E.CompositionLinkControl]:e("controls.controlNames.compositionLink"),[E.ConnectionControl]:e("controls.controlNames.connection"),[E.ConnectionRoleObjectTypeListControl]:e("controls.controlNames.connectionRoleObjectTypeList"),[E.CoverageChoiceControl]:e("controls.controlNames.coverageChoice"),[E.DashboardControl]:e("controls.controlNames.dashboard"),[E.DynamicPropertyListControl]:e("controls.controlNames.dynamicPropertyList"),[E.EditFilterControl]:e("controls.controlNames.editFilter"),[E.ErrorStatusControl]:e("controls.controlNames.errorStatus"),[E.GlobalFilterControl]:e("controls.controlNames.globalFilter"),[E.HiddenInputControl]:e("controls.controlNames.hiddenInput"),[E.KBViewerControl]:e("controls.controlNames.kbViewer"),[E.LabelControl]:e("controls.controlNames.label"),[E.MailMergeLanguagePickerControl]:e("controls.controlNames.mailMergeLanguagePicker"),[E.MapLinkControl]:e("controls.controlNames.mapLink"),[E.OrgInsightsControl]:e("controls.controlNames.orgInsights"),[E.ChoiceLookupControl]:e("controls.controlNames.choiceLookup"),[E.PowerBIControl]:e("controls.controlNames.powerBI"),[E.ProcessControl]:e("controls.controlNames.process"),[E.RelatedInformationControl]:e("controls.controlNames.relatedInformation"),[E.RelationshipRoleChoiceControl]:e("controls.controlNames.relationshipRoleChoice"),[E.ReportControl]:e("controls.controlNames.report"),[E.StreamsControl]:e("controls.controlNames.streams"),[E.WebResourceSilverlightControl]:e("controls.controlNames.webResourceSilverlight"),[E.CurrencyControl]:e("controls.controlNames.currency"),[E.DateTimeControl]:e("controls.controlNames.dateAndTime"),[E.DecimalControl]:e("controls.controlNames.decimal"),[E.DurationControl]:e("controls.controlNames.duration"),[E.EmailAddressControl]:e("controls.controlNames.email"),[E.FileControl]:e("controls.controlNames.file"),[E.FloatingNumberControl]:e("controls.controlNames.floatingNumber"),[E.IframeControl]:e("controls.controlNames.iframe"),[E.ImageControl]:e("controls.controlNames.image"),[E.LookupControl]:e("controls.controlNames.lookup"),[E.MapsControl]:e("controls.controlNames.maps"),[E.PhoneNumberControl]:e("controls.controlNames.phoneNumber"),[E.ChoiceControl]:e("controls.controlNames.choice"),[E.QuickViewControl]:e("controls.controlNames.quickView"),[E.QuickFormControl]:e("controls.controlNames.quickForm"),[E.CustomControl]:e("controls.controlNames.customControl"),[E.SearchWidgetControl]:e("controls.controlNames.searchWidget"),[E.SocialInsightsControl]:e("controls.controlNames.socialInsights"),[E.SubgridControl]:e("controls.controlNames.subgrid"),[E.TextAreaControl]:e("controls.controlNames.textArea"),[E.TextboxControl]:e("controls.controlNames.textBox"),[E.TickerControl]:e("controls.controlNames.ticker"),[E.UrlControl]:e("controls.controlNames.url"),[E.WebResourceHTMLControl]:e("controls.controlNames.webResourceHTML"),[E.WebResourceImageControl]:e("controls.controlNames.webResourceImage"),[E.IntegerControl]:e("controls.controlNames.integer"),[E.TimerControl]:e("controls.controlNames.timer"),[E.TimelineControl]:e("controls.controlNames.timeline"),[E.EmailBodyControl]:e("controls.controlNames.emailBody"),[E.PartyListControl]:e("controls.controlNames.partyList"),[E.TimezoneControl]:e("controls.controlNames.timezone"),[E.LanguageControl]:e("controls.controlNames.language"),[E.ChoiceStatusControl]:e("controls.controlNames.choiceStatus"),[E.ChoicesControl]:e("controls.controlNames.choices"),[E.RegardingControl]:e("controls.controlNames.regarding"),[E.EmailEngagementActionsControl]:e("controls.controlNames.emailEngagementActions"),[E.EmailRecipientActivityControl]:e("controls.controlNames.emailRecipientActivity"),[E.ReferencePanelSearchWidgetControl]:e("controls.controlNames.referencePanelSearchWidget"),[E.ReferencePanelQuickViewControl]:e("controls.controlNames.referencePanelQuickView"),[E.ReferencePanelSubgridControl]:e("controls.controlNames.referencePanelSubgrid"),[E.KBEditorControl]:e("controls.controlNames.KBEditor"),[E.LinkControl]:e("controls.controlNames.link")}}var E,hl,Yn=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"})(E||(E={}));hl={[E.WebResourceHTMLControl]:"WebResource",[E.WebResourceImageControl]:"WebResource",[E.IframeControl]:"IFRAME",[E.SearchWidgetControl]:"Search widget",[E.SubgridControl]:"Subgrid",[E.TimelineControl]:"Timeline",[E.QuickViewControl]:"QuickviewControl"}});var Zn=v((pW,Yv)=>{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{}}}),Xv=function(){return go};Object.setPrototypeOf(Xv,go);Yv.exports=Xv});var dt,Jr,Zv,ey,qi=I(()=>{"use strict";dt="cds-designer-models",Jr="FormCustomControl",Zv="FormCell",ey="Form"});var Vi,pt,vo=I(()=>{"use strict";Vi=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 ei,Bd=I(()=>{"use strict";vo();X();ei=class e{static lockedFieldCount=new pt;static dependencyFieldCount=new pt;static getNecessaryLookUpTable(t){switch(t){case Sr.DependencyFieldTable:return e.dependencyFieldCount;case Sr.LockedFieldTable:return e.lockedFieldCount}}static initCanvasLockedFieldLookUp(t){switch(t){case Sr.DependencyFieldTable:e.dependencyFieldCount=new pt;case Sr.LockedFieldTable:e.lockedFieldCount=new pt}}}});var gl,ty=I(()=>{"use strict";xe();Re();X();ze();gl=class extends H{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 ny,iy,ft,_,ry,In,ti,Gi,Ud,$d,zi=I(()=>{"use strict";ny={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"},iy={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"})(ry||(ry={}));(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"})(In||(In={}));(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"})(ti||(ti={}));(function(e){e[e.Bound=0]="Bound",e[e.Input=1]="Input",e[e.Output=2]="Output"})(Gi||(Gi={}));Ud=[_.LookupCustomer,_.LookupOwner,_.LookupPartyList,_.LookupRegarding,_.LookupSimple],$d=[_.WholeNone,_.WholeDuration,_.WholeLanguage,_.WholeTimeZone,_.FP,_.Decimal]});function Qr(){return Er||(Er=window._makerConfig,Er&&window?.location?.search?.indexOf("useProductionConfig")>-1&&(Er={...Er,region:"prod",graphQLEndpoint:"https://graph.make.powerapps.com/"}),Er?.region==="prod"&&(Er={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/"}}},...Er}),Er||{aadClientId:"a8f7a65c-f5ba-4859-b2d6-df772c264e9d",location:"cus",region:"test",publicPath:"/",graphQLEndpoint:"https://graph.make.test.powerapps.com/"})}var Er,vl=I(()=>{"use strict";});function ay(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 wL(e){return ay(e,qd,"Location dictionary")?qd[e.toLowerCase()]:"us"}function AL(){let e=Qr().location.toLowerCase();return ay(e,qd,"Current location dictionary")?e:"us"}var yl,qd,IW,oy=I(()=>{"use strict";vl();yl=new Set,qd={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"};IW=wL(AL())});var k,TW,sy=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"},TW={[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 ly=I(()=>{"use strict";vl();});var yo=I(()=>{"use strict";vl();oy();sy();ly();});function bo(e,t){return uy?uy.isOverridden(e,t):{overridden:!1}}var uy,wo=I(()=>{"use strict";});var Vd=I(()=>{"use strict";yo();wo();});function CL(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"?SL(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 SL(e){return isNaN(Number(e))?e==="true"?!0:e==="false"?!1:e:Number(e)}function EL(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=>zd(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){EL(e);let t={};return Object.keys(e.settings).forEach(r=>{t[r]={enumerable:!0,get:CL(e,r)}}),bl.set(e.packageName,e),Object.defineProperties({},t)}function Gd(e,t){return bl.has(e)?!!bl.get(e).settings[t]:!1}var bl,wl=I(()=>{"use strict";yo();wo();Wd();Co();bl=new Map});function cy(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 NL(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=>Gd(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 Hd(e){NL(e);let t={};Object.keys(e.features).forEach(i=>{t[i]={enumerable:!0,configurable:!0,get:cy(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:cy(e,a.toString())}}),Object.defineProperties(r,i),n.clear()}},Cl.set(e.packageName,e),Object.defineProperties(r,t)}function zd(e,t){return Cl.has(e)?!!Cl.get(e).features[t]:!1}var Cl,Wd=I(()=>{"use strict";yo();Co();wo();wl();Cl=new Map});var py=v((eH,dy)=>{"use strict";dy.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 hy=v(jd=>{"use strict";var DL=Object.prototype.hasOwnProperty,IL;function fy(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return null}}function my(e){try{return encodeURIComponent(e)}catch{return null}}function _L(e){for(var t=/([^=?#&]+)=?([^&]*)/g,r={},n;n=t.exec(e);){var i=fy(n[1]),a=fy(n[2]);i===null||a===null||i in r||(r[i]=a)}return r}function TL(e,t){t=t||"";var r=[],n,i;typeof t!="string"&&(t="?");for(i in e)if(DL.call(e,i)){if(n=e[i],!n&&(n===null||n===IL||isNaN(n))&&(n=""),i=my(i),n=my(n),i===null||n===null)continue;r.push(i+"="+n)}return r.length?t+r.join("&"):""}jd.stringify=TL;jd.parse=_L});var Kd=v((rH,Ay)=>{"use strict";var vy=py(),Sl=hy(),yy=/[\n\r\t]/g,PL=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,OL=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,RL=/^[a-zA-Z]:/,FL=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/;function Qd(e){return(e||"").toString().replace(FL,"")}var Jd=[["#","hash"],["?","query"],function(t,r){return Nr(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]],gy={hash:1,query:1};function by(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 Dr(unescape(e.pathname),{});else if(i==="string"){n=new Dr(e,{});for(a in gy)delete n[a]}else if(i==="object"){for(a in e)a in gy||(n[a]=e[a]);n.slashes===void 0&&(n.slashes=PL.test(e.href))}return n}function Nr(e){return e==="file:"||e==="ftp:"||e==="http:"||e==="https:"||e==="ws:"||e==="wss:"}function wy(e,t){e=Qd(e),e=e.replace(yy,""),t=t||{};var r=OL.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)):Nr(n)?s=r[4]:n?i&&(s=s.slice(2)):o>=2&&Nr(t.protocol)&&(s=r[4]),{protocol:n,slashes:i||Nr(n),slashesCount:o,rest:s}}function xL(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 Dr(e,t,r){if(e=Qd(e),e=e.replace(yy,""),!(this instanceof Dr))return new Dr(e,t,r);var n,i,a,o,s,l,u=Jd.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=by(t),i=wy(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||RL.test(e))||!i.slashes&&(i.protocol||i.slashesCount<2||!Nr(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=xL(d.pathname,t.pathname)),d.pathname.charAt(0)!=="/"&&Nr(d.protocol)&&(d.pathname="/"+d.pathname),vy(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:"&&Nr(d.protocol)&&d.host?d.protocol+"//"+d.host:"null",d.href=d.toString()}function LL(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,vy(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<Jd.length;o++){var s=Jd[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:"&&Nr(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function kL(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||Nr(r.protocol)?"//":"");return r.username?(a+=r.username,r.password&&(a+=":"+r.password),a+="@"):r.password?(a+=":"+r.password,a+="@"):r.protocol!=="file:"&&Nr(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}Dr.prototype={set:LL,toString:kL};Dr.extractProtocol=wy;Dr.location=by;Dr.trimLeft=Qd;Dr.qs=Sl;Ay.exports=Dr});var ML,Cy=I(()=>{"use strict";ML=ne(Kd());});function Xd(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 Yd,Zd,ep=I(()=>{"use strict";El();Yd=class{features=new Map;register(t,r){let n=Xd(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()}},Zd=new Yd});var tp=I(()=>{"use strict";});function Al(e){return BL.has(e)}var BL,Co=I(()=>{"use strict";Vd();Wd();wl();wo();Vd();Cy();ep();El();tp();BL=new Set(["tie","test","prod","preview","preprod","gov","high","dod","mooncake","ex","rx"])});var UL,Sy=I(()=>{"use strict";Co();UL=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,ri,Wi,Dl,Ey,Ny,rp,So=I(()=>{"use strict";vo();Nl=class{name;constructor(t){this.name=t}toString(){return this.name}getName(){return this.name}getDisplayNameResourceKey(){return rp.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={}));ri=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"}},Wi=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"})(Ey||(Ey={}));(function(e){e[e.Attribute=0]="Attribute",e[e.Organization=1]="Organization",e[e.Currency=2]="Currency"})(Ny||(Ny={}));rp=class e{static resourceKeyMap=e.initResourceKeyMap();static initResourceKeyMap(){let t=new Vi;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(Wi.Persistent,"SystemCustomization.String.Source.persistent"),t.add(Wi.Calculated,"SystemCustomization.String.Source.calculated"),t.add(Wi.Rollup,"SystemCustomization.String.Source.rollup"),t.add(Wi.None,"SystemCustomization.String.Source.none"),t}static getDisplayNameResourceKey(t){return e.resourceKeyMap.getValue(t)}}});var Ty,ip,Hi,ni,np,Il,ji,Kr,we,Dy,Iy,_y,ir=I(()=>{"use strict";Ty={ThreeEqColumn_FirstColumn:34,ThreeEqColumn_SecondColumn:33,ThreeEqColumn_ThirdColumn:33,FiveEqColumn:20},ip={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"})(Hi||(Hi={}));(function(e){e.Left="Left",e.Right="Right",e.Center="Center"})(ni||(ni={}));(function(e){e[e.Mobile=0]="Mobile",e[e.Tablet=1]="Tablet",e[e.Web=2]="Web"})(np||(np={}));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"})(ji||(ji={}));Kr=class{static StartTag="<"},we={ShowLabel:"true",LockLevel:"0",IsUserDefined:"0",LabelWidth:"115",columns:"1",ShowBar:"false",Layout:"varwidth",namePrefix:"_section_",labelAlignment:ni.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"})(Dy||(Dy={}));(function(e){e.TabWithLockedFieldRemoval="TabWithLockedFieldRemoval",e.SectionWithLockedFieldRemoval="SectionWithLockedFieldRemoval",e.LockedSectionRemoval="LockedSectionRemoval",e.LockedFieldRemoval="LockedFieldRemoval",e.RequiredFieldRemoval="RequiredFieldRemoval",e.LastRemainingTab="LastRemainingTab",e.UnknownRemoval="UnknownRemoval"})(Iy||(Iy={}));(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"})(_y||(_y={}))});var ap,Py=I(()=>{"use strict";(function(e){e.DefaultValue="defaultValue",e.Loaded="loaded"})(ap||(ap={}))});var Fy,$L,Oy,ej,tj,Eo,Ry,rj,nj,xy=I(()=>{"use strict";Fy=ne(Zn());Re();qi();Sy();So();ir();zi();X();$L=ne(Wn());Py();(function(e){e.Model="Model",e.Canvas="Canvas",e.CustomPages="CustomPages"})(Oy||(Oy={}));ej={Read:ti.Read,Edit:ti.Edit,Both:ti.Both,Container:ti.Container},tj={input:Gi.Input,bound:Gi.Bound,output:Gi.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"})(Ry||(Ry={}));rj=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]),nj={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,Ly=I(()=>{"use strict";ar=ne(Zn());xe();Re();rt();qi();zi();xy();So();X();ze();ir();_l=class extends H{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(Kr.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:iy.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=>!Ud.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===In.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(ny.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 Ud.includes(t)}isNumberTypeProperty(t,r){return $d.includes(r)||t.ofTypeGroup.some(n=>$d.includes(n))}isDataSet(t){return ft.dataset===t}isGroups(t){return!!t[0].getAllProperties().find(n=>n.key==="isGroup"&&n.value==="true")}}});var V,op=I(()=>{"use strict";V=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,Ji,ke,Tl=I(()=>{"use strict";xe();vo();Re();rt();So();Yn();op();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"}},Ji=class{static get RelationshipAssistant(){return"3ff9a528-dd50-4aca-8f10-2e5ed73513ad"}static get PredictiveLeadScoring(){return"6f503f2a-d033-4106-b62c-f8f2e5f01a57"}},ke=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 g=e.getControlName(O.LookupType,M.None);t.add(g,new T(R.LookupControl));let w=e.getControlName(O.CustomerType,M.None);t.add(w,new T(R.LookupControl));let S=e.getControlName(O.FloatingPointNumber,M.None);t.add(S,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 G=e.getControlName(O.MultipleLineofText,M.Text);t.add(G,new T(R.TextAreaControl));let L=e.getControlName(O.MultipleLineofText,M.TextArea);t.add(L,new T(R.TextAreaControl));let q=e.getControlName(O.MultipleLineofText,M.Email);t.add(q,new T(R.EmailBodyControl));let U=e.getControlName(O.OptionSet,M.None);t.add(U,new T(R.PicklistControl));let $=e.getControlName(O.TwoOptions,M.None);t.add($,new T(R.RadioControl));let W=e.getControlName(O.Image,M.None);t.add(W,new T(R.WebResourceImageControl));let B=e.getControlName(O.Image,M.None);t.add(B,new T(R.WebResourceHtmlControl));let Qe=e.getControlName(O.TwoOptions,"Radio");t.add(Qe,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 uc=e.getControlName(O.PartyListType,M.None);t.add(uc,new T(R.PartyListControl));let QT=e.getControlName(O.LookupType,M.Regarding);t.add(QT,new T(R.RegardingControl));let KT=e.getControlName(O.MultiSelectOptionSet,M.None);return t.add(KT,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,V.ACIControl),t.add(R.IframeControl,V.IframeControl),t.add(R.SearchWidgetControl,V.SearchWidgetControl),t.add(R.MapsControl,V.MapsControl),t.add(R.QuickFormCollectionControl,V.QuickFormCollectionControl),t.add(R.GridControl,V.SubGridControl),t.add(R.WebResourceImageControl,V.WebResourceImageControl),t.add(R.WebResourceHtmlControl,V.WebResourceHtmlControl),t.add(R.ReferencePanelSearchWidget,V.SearchWidgetControl),t.add(R.ReferencePanelQuickFormCollectionControl,V.QuickFormCollectionControl),t.add(R.ReferencePanelSubgridControl,V.SubGridControl),t.add(R.TimerControl,V.TimerControl),t.add(R.TimeLineControl,V.NotesControl),t.add(R.TimeLineControlUC,V.NotesControl),t.add(R.SocialInsightControl,V.SocialInsightControl),t.add(Ji.RelationshipAssistant,V.CustomControl),t}static initializeReferencePanelControls(){let t=new pt;return t.add(R.IframeControl,V.IframeControl),t.add(R.ReferencePanelSearchWidget,V.SearchWidgetControl),t.add(R.ReferencePanelQuickFormCollectionControl,V.QuickFormCollectionControl),t.add(R.ReferencePanelSubgridControl,V.SubGridControl),t.add(R.WebResourceHtmlControl,V.WebResourceHtmlControl),t.add(R.WebResourceImageControl,V.WebResourceHtmlControl),t}static initializeFooterControls(){let t=new Vi;return t.add(Hi.IFRAME,!0),t.add(Hi.SPACER,!0),t.add(Hi.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(we.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 V.IframeControl:case V.ACIControl:case V.SocialInsightControl:return 6;case V.SubGridControl:case V.CustomControl:return 4;case V.WebResourceImageControl:return 15;case V.WebResourceHtmlControl:return 15;case V.MapsControl:return 8;case V.SearchWidgetControl:return 10;case V.NotesControl:case V.TimeLineControl:return 15;case V.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===Ji.RelationshipAssistant||t.guidString===Ji.PredictiveLeadScoring)}static isRelationshipAssistantControl(t){return!N.IsNullOrUndefined(t)&&e.isRelationshipAssistant(t.UniqueId)}static isRelationshipAssistant(t){return!N.IsNullOrUndefined(t)&&t.guidString===Ji.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,ky=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 ii,Qi,My,By,_n,Uy,$y,sp=I(()=>{"use strict";(function(e){e[e.Center=0]="Center",e[e.Left=1]="Left",e[e.Right=2]="Right"})(ii||(ii={}));(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"})(My||(My={}));(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"})(By||(By={}));(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"})(_n||(_n={}));(function(e){e[e.None=0]="None",e[e.SystemRequired=1]="SystemRequired",e[e.ApplicationRequired=2]="ApplicationRequired",e[e.Recommended=3]="Recommended"})(Uy||(Uy={}));(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"})($y||($y={}))});var Ki,qy=I(()=>{"use strict";Co();Ki=Hd({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 Vy(e){return{...e,extractConfig:t=>qL(t,Object.keys(e.fallback))}}function qL(e,t){let r={};for(let n of t)typeof e[n]<"u"&&(r[n]=e[n]);return r}var lp=I(()=>{"use strict";});var up=v((Oj,zy)=>{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{}}}),Gy=function(){return No};Object.setPrototypeOf(Gy,No);zy.exports=Gy});var jy=v((Rj,Hy)=>{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{}}}),Wy=function(){return Do};Object.setPrototypeOf(Wy,Do);Hy.exports=Wy});var cp=v((Fj,Qy)=>{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{}}}),Jy=function(){return Io};Object.setPrototypeOf(Jy,Io);Qy.exports=Jy});var Xy=v((xj,Ky)=>{function VL(){this.__data__=[],this.size=0}Ky.exports=VL});var Xi=v((Lj,Yy)=>{function GL(e,t){return e===t||e!==e&&t!==t}Yy.exports=GL});var _o=v((kj,Zy)=>{var zL=Xi();function WL(e,t){for(var r=e.length;r--;)if(zL(e[r][0],t))return r;return-1}Zy.exports=WL});var tb=v((Mj,eb)=>{var HL=_o(),jL=Array.prototype,JL=jL.splice;function QL(e){var t=this.__data__,r=HL(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():JL.call(t,r,1),--this.size,!0}eb.exports=QL});var nb=v((Bj,rb)=>{var KL=_o();function XL(e){var t=this.__data__,r=KL(t,e);return r<0?void 0:t[r][1]}rb.exports=XL});var ab=v((Uj,ib)=>{var YL=_o();function ZL(e){return YL(this.__data__,e)>-1}ib.exports=ZL});var sb=v(($j,ob)=>{var ek=_o();function tk(e,t){var r=this.__data__,n=ek(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}ob.exports=tk});var To=v((qj,lb)=>{var rk=Xy(),nk=tb(),ik=nb(),ak=ab(),ok=sb();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=rk;Yi.prototype.delete=nk;Yi.prototype.get=ik;Yi.prototype.has=ak;Yi.prototype.set=ok;lb.exports=Yi});var cb=v((Vj,ub)=>{var sk=To();function lk(){this.__data__=new sk,this.size=0}ub.exports=lk});var pb=v((Gj,db)=>{function uk(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}db.exports=uk});var mb=v((zj,fb)=>{function ck(e){return this.__data__.get(e)}fb.exports=ck});var gb=v((Wj,hb)=>{function dk(e){return this.__data__.has(e)}hb.exports=dk});var dp=v((Hj,vb)=>{var pk=typeof global=="object"&&global&&global.Object===Object&&global;vb.exports=pk});var or=v((jj,yb)=>{var fk=dp(),mk=typeof self=="object"&&self&&self.Object===Object&&self,hk=fk||mk||Function("return this")();yb.exports=hk});var Po=v((Jj,bb)=>{var gk=or(),vk=gk.Symbol;bb.exports=vk});var Sb=v((Qj,Cb)=>{var wb=Po(),Ab=Object.prototype,yk=Ab.hasOwnProperty,bk=Ab.toString,Oo=wb?wb.toStringTag:void 0;function wk(e){var t=yk.call(e,Oo),r=e[Oo];try{e[Oo]=void 0;var n=!0}catch{}var i=bk.call(e);return n&&(t?e[Oo]=r:delete e[Oo]),i}Cb.exports=wk});var Nb=v((Kj,Eb)=>{var Ak=Object.prototype,Ck=Ak.toString;function Sk(e){return Ck.call(e)}Eb.exports=Sk});var ai=v((Xj,_b)=>{var Db=Po(),Ek=Sb(),Nk=Nb(),Dk="[object Null]",Ik="[object Undefined]",Ib=Db?Db.toStringTag:void 0;function _k(e){return e==null?e===void 0?Ik:Dk:Ib&&Ib in Object(e)?Ek(e):Nk(e)}_b.exports=_k});var Xr=v((Yj,Tb)=>{function Tk(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}Tb.exports=Tk});var Ol=v((Zj,Pb)=>{var Pk=ai(),Ok=Xr(),Rk="[object AsyncFunction]",Fk="[object Function]",xk="[object GeneratorFunction]",Lk="[object Proxy]";function kk(e){if(!Ok(e))return!1;var t=Pk(e);return t==Fk||t==xk||t==Rk||t==Lk}Pb.exports=kk});var Rb=v((eJ,Ob)=>{var Mk=or(),Bk=Mk["__core-js_shared__"];Ob.exports=Bk});var Lb=v((tJ,xb)=>{var pp=Rb(),Fb=(function(){var e=/[^.]+$/.exec(pp&&pp.keys&&pp.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function Uk(e){return!!Fb&&Fb in e}xb.exports=Uk});var fp=v((rJ,kb)=>{var $k=Function.prototype,qk=$k.toString;function Vk(e){if(e!=null){try{return qk.call(e)}catch{}try{return e+""}catch{}}return""}kb.exports=Vk});var Bb=v((nJ,Mb)=>{var Gk=Ol(),zk=Lb(),Wk=Xr(),Hk=fp(),jk=/[\\^$.*+?()[\]{}|]/g,Jk=/^\[object .+?Constructor\]$/,Qk=Function.prototype,Kk=Object.prototype,Xk=Qk.toString,Yk=Kk.hasOwnProperty,Zk=RegExp("^"+Xk.call(Yk).replace(jk,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function eM(e){if(!Wk(e)||zk(e))return!1;var t=Gk(e)?Zk:Jk;return t.test(Hk(e))}Mb.exports=eM});var $b=v((iJ,Ub)=>{function tM(e,t){return e?.[t]}Ub.exports=tM});var Tn=v((aJ,qb)=>{var rM=Bb(),nM=$b();function iM(e,t){var r=nM(e,t);return rM(r)?r:void 0}qb.exports=iM});var Rl=v((oJ,Vb)=>{var aM=Tn(),oM=or(),sM=aM(oM,"Map");Vb.exports=sM});var Ro=v((sJ,Gb)=>{var lM=Tn(),uM=lM(Object,"create");Gb.exports=uM});var Hb=v((lJ,Wb)=>{var zb=Ro();function cM(){this.__data__=zb?zb(null):{},this.size=0}Wb.exports=cM});var Jb=v((uJ,jb)=>{function dM(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}jb.exports=dM});var Kb=v((cJ,Qb)=>{var pM=Ro(),fM="__lodash_hash_undefined__",mM=Object.prototype,hM=mM.hasOwnProperty;function gM(e){var t=this.__data__;if(pM){var r=t[e];return r===fM?void 0:r}return hM.call(t,e)?t[e]:void 0}Qb.exports=gM});var Yb=v((dJ,Xb)=>{var vM=Ro(),yM=Object.prototype,bM=yM.hasOwnProperty;function wM(e){var t=this.__data__;return vM?t[e]!==void 0:bM.call(t,e)}Xb.exports=wM});var ew=v((pJ,Zb)=>{var AM=Ro(),CM="__lodash_hash_undefined__";function SM(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=AM&&t===void 0?CM:t,this}Zb.exports=SM});var rw=v((fJ,tw)=>{var EM=Hb(),NM=Jb(),DM=Kb(),IM=Yb(),_M=ew();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=EM;Zi.prototype.delete=NM;Zi.prototype.get=DM;Zi.prototype.has=IM;Zi.prototype.set=_M;tw.exports=Zi});var aw=v((mJ,iw)=>{var nw=rw(),TM=To(),PM=Rl();function OM(){this.size=0,this.__data__={hash:new nw,map:new(PM||TM),string:new nw}}iw.exports=OM});var sw=v((hJ,ow)=>{function RM(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}ow.exports=RM});var Fo=v((gJ,lw)=>{var FM=sw();function xM(e,t){var r=e.__data__;return FM(t)?r[typeof t=="string"?"string":"hash"]:r.map}lw.exports=xM});var cw=v((vJ,uw)=>{var LM=Fo();function kM(e){var t=LM(this,e).delete(e);return this.size-=t?1:0,t}uw.exports=kM});var pw=v((yJ,dw)=>{var MM=Fo();function BM(e){return MM(this,e).get(e)}dw.exports=BM});var mw=v((bJ,fw)=>{var UM=Fo();function $M(e){return UM(this,e).has(e)}fw.exports=$M});var gw=v((wJ,hw)=>{var qM=Fo();function VM(e,t){var r=qM(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}hw.exports=VM});var Fl=v((AJ,vw)=>{var GM=aw(),zM=cw(),WM=pw(),HM=mw(),jM=gw();function ea(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])}}ea.prototype.clear=GM;ea.prototype.delete=zM;ea.prototype.get=WM;ea.prototype.has=HM;ea.prototype.set=jM;vw.exports=ea});var bw=v((CJ,yw)=>{var JM=To(),QM=Rl(),KM=Fl(),XM=200;function YM(e,t){var r=this.__data__;if(r instanceof JM){var n=r.__data__;if(!QM||n.length<XM-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new KM(n)}return r.set(e,t),this.size=r.size,this}yw.exports=YM});var mp=v((SJ,ww)=>{var ZM=To(),eB=cb(),tB=pb(),rB=mb(),nB=gb(),iB=bw();function ta(e){var t=this.__data__=new ZM(e);this.size=t.size}ta.prototype.clear=eB;ta.prototype.delete=tB;ta.prototype.get=rB;ta.prototype.has=nB;ta.prototype.set=iB;ww.exports=ta});var Cw=v((EJ,Aw)=>{var aB="__lodash_hash_undefined__";function oB(e){return this.__data__.set(e,aB),this}Aw.exports=oB});var Ew=v((NJ,Sw)=>{function sB(e){return this.__data__.has(e)}Sw.exports=sB});var Dw=v((DJ,Nw)=>{var lB=Fl(),uB=Cw(),cB=Ew();function xl(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new lB;++t<r;)this.add(e[t])}xl.prototype.add=xl.prototype.push=uB;xl.prototype.has=cB;Nw.exports=xl});var _w=v((IJ,Iw)=>{function dB(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}Iw.exports=dB});var Pw=v((_J,Tw)=>{function pB(e,t){return e.has(t)}Tw.exports=pB});var hp=v((TJ,Ow)=>{var fB=Dw(),mB=_w(),hB=Pw(),gB=1,vB=2;function yB(e,t,r,n,i,a){var o=r&gB,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&vB?new fB:void 0;for(a.set(e,t),a.set(t,e);++d<s;){var h=e[d],g=t[d];if(n)var w=o?n(g,h,d,t,e,a):n(h,g,d,e,t,a);if(w!==void 0){if(w)continue;p=!1;break}if(f){if(!mB(t,function(S,D){if(!hB(f,D)&&(h===S||i(h,S,r,n,a)))return f.push(D)})){p=!1;break}}else if(!(h===g||i(h,g,r,n,a))){p=!1;break}}return a.delete(e),a.delete(t),p}Ow.exports=yB});var gp=v((PJ,Rw)=>{var bB=or(),wB=bB.Uint8Array;Rw.exports=wB});var xw=v((OJ,Fw)=>{function AB(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}Fw.exports=AB});var kw=v((RJ,Lw)=>{function CB(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}Lw.exports=CB});var qw=v((FJ,$w)=>{var Mw=Po(),Bw=gp(),SB=Xi(),EB=hp(),NB=xw(),DB=kw(),IB=1,_B=2,TB="[object Boolean]",PB="[object Date]",OB="[object Error]",RB="[object Map]",FB="[object Number]",xB="[object RegExp]",LB="[object Set]",kB="[object String]",MB="[object Symbol]",BB="[object ArrayBuffer]",UB="[object DataView]",Uw=Mw?Mw.prototype:void 0,vp=Uw?Uw.valueOf:void 0;function $B(e,t,r,n,i,a,o){switch(r){case UB:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case BB:return!(e.byteLength!=t.byteLength||!a(new Bw(e),new Bw(t)));case TB:case PB:case FB:return SB(+e,+t);case OB:return e.name==t.name&&e.message==t.message;case xB:case kB:return e==t+"";case RB:var s=NB;case LB:var l=n&IB;if(s||(s=DB),e.size!=t.size&&!l)return!1;var u=o.get(e);if(u)return u==t;n|=_B,o.set(e,t);var c=EB(s(e),s(t),n,i,a,o);return o.delete(e),c;case MB:if(vp)return vp.call(e)==vp.call(t)}return!1}$w.exports=$B});var Gw=v((xJ,Vw)=>{function qB(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}Vw.exports=qB});var Pn=v((LJ,zw)=>{var VB=Array.isArray;zw.exports=VB});var Hw=v((kJ,Ww)=>{var GB=Gw(),zB=Pn();function WB(e,t,r){var n=t(e);return zB(e)?n:GB(n,r(e))}Ww.exports=WB});var Jw=v((MJ,jw)=>{function HB(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}jw.exports=HB});var Kw=v((BJ,Qw)=>{function jB(){return[]}Qw.exports=jB});var Zw=v((UJ,Yw)=>{var JB=Jw(),QB=Kw(),KB=Object.prototype,XB=KB.propertyIsEnumerable,Xw=Object.getOwnPropertySymbols,YB=Xw?function(e){return e==null?[]:(e=Object(e),JB(Xw(e),function(t){return XB.call(e,t)}))}:QB;Yw.exports=YB});var tA=v(($J,eA)=>{function ZB(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}eA.exports=ZB});var On=v((qJ,rA)=>{function eU(e){return e!=null&&typeof e=="object"}rA.exports=eU});var iA=v((VJ,nA)=>{var tU=ai(),rU=On(),nU="[object Arguments]";function iU(e){return rU(e)&&tU(e)==nU}nA.exports=iU});var yp=v((GJ,sA)=>{var aA=iA(),aU=On(),oA=Object.prototype,oU=oA.hasOwnProperty,sU=oA.propertyIsEnumerable,lU=aA((function(){return arguments})())?aA:function(e){return aU(e)&&oU.call(e,"callee")&&!sU.call(e,"callee")};sA.exports=lU});var uA=v((zJ,lA)=>{function uU(){return!1}lA.exports=uU});var Ll=v((xo,ra)=>{var cU=or(),dU=uA(),pA=typeof xo=="object"&&xo&&!xo.nodeType&&xo,cA=pA&&typeof ra=="object"&&ra&&!ra.nodeType&&ra,pU=cA&&cA.exports===pA,dA=pU?cU.Buffer:void 0,fU=dA?dA.isBuffer:void 0,mU=fU||dU;ra.exports=mU});var kl=v((WJ,fA)=>{var hU=9007199254740991,gU=/^(?:0|[1-9]\d*)$/;function vU(e,t){var r=typeof e;return t=t??hU,!!t&&(r=="number"||r!="symbol"&&gU.test(e))&&e>-1&&e%1==0&&e<t}fA.exports=vU});var bp=v((HJ,mA)=>{var yU=9007199254740991;function bU(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=yU}mA.exports=bU});var gA=v((jJ,hA)=>{var wU=ai(),AU=bp(),CU=On(),SU="[object Arguments]",EU="[object Array]",NU="[object Boolean]",DU="[object Date]",IU="[object Error]",_U="[object Function]",TU="[object Map]",PU="[object Number]",OU="[object Object]",RU="[object RegExp]",FU="[object Set]",xU="[object String]",LU="[object WeakMap]",kU="[object ArrayBuffer]",MU="[object DataView]",BU="[object Float32Array]",UU="[object Float64Array]",$U="[object Int8Array]",qU="[object Int16Array]",VU="[object Int32Array]",GU="[object Uint8Array]",zU="[object Uint8ClampedArray]",WU="[object Uint16Array]",HU="[object Uint32Array]",ge={};ge[BU]=ge[UU]=ge[$U]=ge[qU]=ge[VU]=ge[GU]=ge[zU]=ge[WU]=ge[HU]=!0;ge[SU]=ge[EU]=ge[kU]=ge[NU]=ge[MU]=ge[DU]=ge[IU]=ge[_U]=ge[TU]=ge[PU]=ge[OU]=ge[RU]=ge[FU]=ge[xU]=ge[LU]=!1;function jU(e){return CU(e)&&AU(e.length)&&!!ge[wU(e)]}hA.exports=jU});var yA=v((JJ,vA)=>{function JU(e){return function(t){return e(t)}}vA.exports=JU});var wA=v((Lo,na)=>{var QU=dp(),bA=typeof Lo=="object"&&Lo&&!Lo.nodeType&&Lo,ko=bA&&typeof na=="object"&&na&&!na.nodeType&&na,KU=ko&&ko.exports===bA,wp=KU&&QU.process,XU=(function(){try{var e=ko&&ko.require&&ko.require("util").types;return e||wp&&wp.binding&&wp.binding("util")}catch{}})();na.exports=XU});var Ml=v((QJ,SA)=>{var YU=gA(),ZU=yA(),AA=wA(),CA=AA&&AA.isTypedArray,e$=CA?ZU(CA):YU;SA.exports=e$});var Ap=v((KJ,EA)=>{var t$=tA(),r$=yp(),n$=Pn(),i$=Ll(),a$=kl(),o$=Ml(),s$=Object.prototype,l$=s$.hasOwnProperty;function u$(e,t){var r=n$(e),n=!r&&r$(e),i=!r&&!n&&i$(e),a=!r&&!n&&!i&&o$(e),o=r||n||i||a,s=o?t$(e.length,String):[],l=s.length;for(var u in e)(t||l$.call(e,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||a$(u,l)))&&s.push(u);return s}EA.exports=u$});var Bl=v((XJ,NA)=>{var c$=Object.prototype;function d$(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||c$;return e===r}NA.exports=d$});var Cp=v((YJ,DA)=>{function p$(e,t){return function(r){return e(t(r))}}DA.exports=p$});var _A=v((ZJ,IA)=>{var f$=Cp(),m$=f$(Object.keys,Object);IA.exports=m$});var PA=v((eQ,TA)=>{var h$=Bl(),g$=_A(),v$=Object.prototype,y$=v$.hasOwnProperty;function b$(e){if(!h$(e))return g$(e);var t=[];for(var r in Object(e))y$.call(e,r)&&r!="constructor"&&t.push(r);return t}TA.exports=b$});var Mo=v((tQ,OA)=>{var w$=Ol(),A$=bp();function C$(e){return e!=null&&A$(e.length)&&!w$(e)}OA.exports=C$});var FA=v((rQ,RA)=>{var S$=Ap(),E$=PA(),N$=Mo();function D$(e){return N$(e)?S$(e):E$(e)}RA.exports=D$});var LA=v((nQ,xA)=>{var I$=Hw(),_$=Zw(),T$=FA();function P$(e){return I$(e,T$,_$)}xA.exports=P$});var BA=v((iQ,MA)=>{var kA=LA(),O$=1,R$=Object.prototype,F$=R$.hasOwnProperty;function x$(e,t,r,n,i,a){var o=r&O$,s=kA(e),l=s.length,u=kA(t),c=u.length;if(l!=c&&!o)return!1;for(var d=l;d--;){var p=s[d];if(!(o?p in t:F$.call(t,p)))return!1}var f=a.get(e),h=a.get(t);if(f&&h)return f==t&&h==e;var g=!0;a.set(e,t),a.set(t,e);for(var w=o;++d<l;){p=s[d];var S=e[p],D=t[p];if(n)var x=o?n(D,S,p,t,e,a):n(S,D,p,e,t,a);if(!(x===void 0?S===D||i(S,D,r,n,a):x)){g=!1;break}w||(w=p=="constructor")}if(g&&!w){var F=e.constructor,G=t.constructor;F!=G&&"constructor"in e&&"constructor"in t&&!(typeof F=="function"&&F instanceof F&&typeof G=="function"&&G instanceof G)&&(g=!1)}return a.delete(e),a.delete(t),g}MA.exports=x$});var $A=v((aQ,UA)=>{var L$=Tn(),k$=or(),M$=L$(k$,"DataView");UA.exports=M$});var VA=v((oQ,qA)=>{var B$=Tn(),U$=or(),$$=B$(U$,"Promise");qA.exports=$$});var zA=v((sQ,GA)=>{var q$=Tn(),V$=or(),G$=q$(V$,"Set");GA.exports=G$});var HA=v((lQ,WA)=>{var z$=Tn(),W$=or(),H$=z$(W$,"WeakMap");WA.exports=H$});var eC=v((uQ,ZA)=>{var Sp=$A(),Ep=Rl(),Np=VA(),Dp=zA(),Ip=HA(),YA=ai(),ia=fp(),jA="[object Map]",j$="[object Object]",JA="[object Promise]",QA="[object Set]",KA="[object WeakMap]",XA="[object DataView]",J$=ia(Sp),Q$=ia(Ep),K$=ia(Np),X$=ia(Dp),Y$=ia(Ip),oi=YA;(Sp&&oi(new Sp(new ArrayBuffer(1)))!=XA||Ep&&oi(new Ep)!=jA||Np&&oi(Np.resolve())!=JA||Dp&&oi(new Dp)!=QA||Ip&&oi(new Ip)!=KA)&&(oi=function(e){var t=YA(e),r=t==j$?e.constructor:void 0,n=r?ia(r):"";if(n)switch(n){case J$:return XA;case Q$:return jA;case K$:return JA;case X$:return QA;case Y$:return KA}return t});ZA.exports=oi});var lC=v((cQ,sC)=>{var _p=mp(),Z$=hp(),eq=qw(),tq=BA(),tC=eC(),rC=Pn(),nC=Ll(),rq=Ml(),nq=1,iC="[object Arguments]",aC="[object Array]",Ul="[object Object]",iq=Object.prototype,oC=iq.hasOwnProperty;function aq(e,t,r,n,i,a){var o=rC(e),s=rC(t),l=o?aC:tC(e),u=s?aC:tC(t);l=l==iC?Ul:l,u=u==iC?Ul:u;var c=l==Ul,d=u==Ul,p=l==u;if(p&&nC(e)){if(!nC(t))return!1;o=!0,c=!1}if(p&&!c)return a||(a=new _p),o||rq(e)?Z$(e,t,r,n,i,a):eq(e,t,l,r,n,i,a);if(!(r&nq)){var f=c&&oC.call(e,"__wrapped__"),h=d&&oC.call(t,"__wrapped__");if(f||h){var g=f?e.value():e,w=h?t.value():t;return a||(a=new _p),i(g,w,r,n,a)}}return p?(a||(a=new _p),tq(e,t,r,n,i,a)):!1}sC.exports=aq});var pC=v((dQ,dC)=>{var oq=lC(),uC=On();function cC(e,t,r,n,i){return e===t?!0:e==null||t==null||!uC(e)&&!uC(t)?e!==e&&t!==t:oq(e,t,r,n,cC,i)}dC.exports=cC});var mC=v((pQ,fC)=>{var sq=pC();function lq(e,t){return sq(e,t)}fC.exports=lq});var Tp=v((fQ,hC)=>{var uq=Tn(),cq=(function(){try{var e=uq(Object,"defineProperty");return e({},"",{}),e}catch{}})();hC.exports=cq});var $l=v((mQ,vC)=>{var gC=Tp();function dq(e,t,r){t=="__proto__"&&gC?gC(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}vC.exports=dq});var Pp=v((hQ,yC)=>{var pq=$l(),fq=Xi();function mq(e,t,r){(r!==void 0&&!fq(e[t],r)||r===void 0&&!(t in e))&&pq(e,t,r)}yC.exports=mq});var wC=v((gQ,bC)=>{function hq(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}}bC.exports=hq});var CC=v((vQ,AC)=>{var gq=wC(),vq=gq();AC.exports=vq});var IC=v((Bo,aa)=>{var yq=or(),DC=typeof Bo=="object"&&Bo&&!Bo.nodeType&&Bo,SC=DC&&typeof aa=="object"&&aa&&!aa.nodeType&&aa,bq=SC&&SC.exports===DC,EC=bq?yq.Buffer:void 0,NC=EC?EC.allocUnsafe:void 0;function wq(e,t){if(t)return e.slice();var r=e.length,n=NC?NC(r):new e.constructor(r);return e.copy(n),n}aa.exports=wq});var PC=v((yQ,TC)=>{var _C=gp();function Aq(e){var t=new e.constructor(e.byteLength);return new _C(t).set(new _C(e)),t}TC.exports=Aq});var RC=v((bQ,OC)=>{var Cq=PC();function Sq(e,t){var r=t?Cq(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}OC.exports=Sq});var xC=v((wQ,FC)=>{function Eq(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}FC.exports=Eq});var MC=v((AQ,kC)=>{var Nq=Xr(),LC=Object.create,Dq=(function(){function e(){}return function(t){if(!Nq(t))return{};if(LC)return LC(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}})();kC.exports=Dq});var Op=v((CQ,BC)=>{var Iq=Cp(),_q=Iq(Object.getPrototypeOf,Object);BC.exports=_q});var $C=v((SQ,UC)=>{var Tq=MC(),Pq=Op(),Oq=Bl();function Rq(e){return typeof e.constructor=="function"&&!Oq(e)?Tq(Pq(e)):{}}UC.exports=Rq});var VC=v((EQ,qC)=>{var Fq=Mo(),xq=On();function Lq(e){return xq(e)&&Fq(e)}qC.exports=Lq});var WC=v((NQ,zC)=>{var kq=ai(),Mq=Op(),Bq=On(),Uq="[object Object]",$q=Function.prototype,qq=Object.prototype,GC=$q.toString,Vq=qq.hasOwnProperty,Gq=GC.call(Object);function zq(e){if(!Bq(e)||kq(e)!=Uq)return!1;var t=Mq(e);if(t===null)return!0;var r=Vq.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&GC.call(r)==Gq}zC.exports=zq});var Rp=v((DQ,HC)=>{function Wq(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}HC.exports=Wq});var Fp=v((IQ,jC)=>{var Hq=$l(),jq=Xi(),Jq=Object.prototype,Qq=Jq.hasOwnProperty;function Kq(e,t,r){var n=e[t];(!(Qq.call(e,t)&&jq(n,r))||r===void 0&&!(t in e))&&Hq(e,t,r)}jC.exports=Kq});var QC=v((_Q,JC)=>{var Xq=Fp(),Yq=$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?Yq(r,s,l):Xq(r,s,l)}return r}JC.exports=Zq});var XC=v((TQ,KC)=>{function e3(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}KC.exports=e3});var ZC=v((PQ,YC)=>{var t3=Xr(),r3=Bl(),n3=XC(),i3=Object.prototype,a3=i3.hasOwnProperty;function o3(e){if(!t3(e))return n3(e);var t=r3(e),r=[];for(var n in e)n=="constructor"&&(t||!a3.call(e,n))||r.push(n);return r}YC.exports=o3});var xp=v((OQ,eS)=>{var s3=Ap(),l3=ZC(),u3=Mo();function c3(e){return u3(e)?s3(e,!0):l3(e)}eS.exports=c3});var rS=v((RQ,tS)=>{var d3=QC(),p3=xp();function f3(e){return d3(e,p3(e))}tS.exports=f3});var lS=v((FQ,sS)=>{var nS=Pp(),m3=IC(),h3=RC(),g3=xC(),v3=$C(),iS=yp(),aS=Pn(),y3=VC(),b3=Ll(),w3=Ol(),A3=Xr(),C3=WC(),S3=Ml(),oS=Rp(),E3=rS();function N3(e,t,r,n,i,a,o){var s=oS(e,r),l=oS(t,r),u=o.get(l);if(u){nS(e,r,u);return}var c=a?a(s,l,r+"",e,t,o):void 0,d=c===void 0;if(d){var p=aS(l),f=!p&&b3(l),h=!p&&!f&&S3(l);c=l,p||f||h?aS(s)?c=s:y3(s)?c=g3(s):f?(d=!1,c=m3(l,!0)):h?(d=!1,c=h3(l,!0)):c=[]:C3(l)||iS(l)?(c=s,iS(s)?c=E3(s):(!A3(s)||w3(s))&&(c=v3(l))):d=!1}d&&(o.set(l,c),i(c,l,n,a,o),o.delete(l)),nS(e,r,c)}sS.exports=N3});var Lp=v((xQ,cS)=>{var D3=mp(),I3=Pp(),_3=CC(),T3=lS(),P3=Xr(),O3=xp(),R3=Rp();function uS(e,t,r,n,i){e!==t&&_3(t,function(a,o){if(i||(i=new D3),P3(a))T3(e,t,o,r,uS,n,i);else{var s=n?n(R3(e,o),a,o+"",e,t,i):void 0;s===void 0&&(s=a),I3(e,o,s)}},O3)}cS.exports=uS});var kp=v((LQ,dS)=>{function F3(e){return e}dS.exports=F3});var fS=v((kQ,pS)=>{function x3(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)}pS.exports=x3});var gS=v((MQ,hS)=>{var L3=fS(),mS=Math.max;function k3(e,t,r){return t=mS(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,a=mS(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),L3(e,this,s)}}hS.exports=k3});var yS=v((BQ,vS)=>{function M3(e){return function(){return e}}vS.exports=M3});var AS=v((UQ,wS)=>{var B3=yS(),bS=Tp(),U3=kp(),$3=bS?function(e,t){return bS(e,"toString",{configurable:!0,enumerable:!1,value:B3(t),writable:!0})}:U3;wS.exports=$3});var SS=v(($Q,CS)=>{var q3=800,V3=16,G3=Date.now;function z3(e){var t=0,r=0;return function(){var n=G3(),i=V3-(n-r);if(r=n,i>0){if(++t>=q3)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}CS.exports=z3});var NS=v((qQ,ES)=>{var W3=AS(),H3=SS(),j3=H3(W3);ES.exports=j3});var IS=v((VQ,DS)=>{var J3=kp(),Q3=gS(),K3=NS();function X3(e,t){return K3(Q3(e,t,J3),e+"")}DS.exports=X3});var TS=v((GQ,_S)=>{var Y3=Xi(),Z3=Mo(),e4=kl(),t4=Xr();function r4(e,t,r){if(!t4(r))return!1;var n=typeof t;return(n=="number"?Z3(r)&&e4(t,r.length):n=="string"&&t in r)?Y3(r[t],e):!1}_S.exports=r4});var Mp=v((zQ,PS)=>{var n4=IS(),i4=TS();function a4(e){return n4(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&&i4(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})}PS.exports=a4});var RS=v((WQ,OS)=>{var o4=Lp(),s4=Mp(),l4=s4(function(e,t,r,n){o4(e,t,r,n)});OS.exports=l4});var zt,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"})(zt||(zt={}))});function xS(e,t,r="PROD"){let n=i=>`ShellSettings_ECS_ClientCache_${e}_${FS.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 FS,u4,LS=I(()=>{"use strict";FS=ne(cp()),u4=ne(up());});var Bp,kS=I(()=>{"use strict";wl();Bp=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 BS,US,$S,qS,Up,c4,ql,MS,$p=I(()=>{"use strict";BS=ne(up()),US=ne(jy()),$S=ne(cp()),qS=ne(mC()),Up=ne(RS());Uo();LS();kS();c4=60*1e3,ql=class{clientName;logger;ecsEndpoint;resolveLoadingPromise;loadingPromise=new Promise(t=>this.resolveLoadingPromise=t);_status=zt.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"?Bp.prodEcsEndpoint:Bp.integrationEcsEndpoint}client=new US.default;init=async({clientVersion:t,getFilters:r,cacheStorage:n=BS.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:[$S.EcsConfigType.Default],hosts:[this.ecsEndpoint],initialAppActiveState:!0,getEcsParameters:o,databaseInterface:xS(this.clientName,n,this.endpointType),...a}),this.client.requestUpdate(),this._status===zt.NotLoaded&&(this._status=zt.Initialized)}catch(s){this._status=zt.Error,this.resolveLoadingPromise(),this.logEvent("FeaturesClient/initializationFailed",{ecsClientName:this.clientName,error:s},"Error")}i&&window.setInterval(()=>this.client.requestUpdate(),i*c4)};getConfig=t=>{let r=this.getMergedClientConfigByTeamName(t.teamName),n=r?t.extractConfig(r):{};return(0,Up.default)({},t.fallback,n,t.override,MS)};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,qS.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,Up.default)({},this.client.getConfig()?.config,this.clientConfigOverride,MS);getMergedClientConfigByTeamName=t=>this.getMergedClientConfig()?.[t];handleConfigUpdated=()=>{let t=this.client.getConfig();if(t===void 0)return;this.resolveLoadingPromise(),this._status=zt.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})}},MS=(e,t)=>{if(Array.isArray(t))return t}});var GS=v((eK,VS)=>{"use strict";var d4=()=>{let e={};return e.promise=new Promise((t,r)=>{e.resolve=t,e.reject=r}),e};VS.exports=d4});var qp=v((tK,WS)=>{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{}}}),zS=function(){return $o};Object.setPrototypeOf(zS,$o);WS.exports=zS});var JS=v((rK,jS)=>{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{}}}),HS=function(){return qo};Object.setPrototypeOf(HS,qo);jS.exports=HS});var tE=v((nK,eE)=>{"use strict";var Vp=JS(),p4={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},f4={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},m4={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},YS={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Gp={};Gp[Vp.ForwardRef]=m4;Gp[Vp.Memo]=YS;function QS(e){return Vp.isMemo(e)?YS:Gp[e.$$typeof]||p4}var h4=Object.defineProperty,g4=Object.getOwnPropertyNames,KS=Object.getOwnPropertySymbols,v4=Object.getOwnPropertyDescriptor,y4=Object.getPrototypeOf,XS=Object.prototype;function ZS(e,t,r){if(typeof t!="string"){if(XS){var n=y4(t);n&&n!==XS&&ZS(e,n,r)}var i=g4(t);KS&&(i=i.concat(KS(t)));for(var a=QS(e),o=QS(t),s=0;s<i.length;++s){var l=i[s];if(!f4[l]&&!(r&&r[l])&&!(o&&o[l])&&!(a&&a[l])){var u=v4(t,l);try{h4(e,l,u)}catch{}}}}return e}eE.exports=ZS});function nE(e,t,r){let[n,i]=(0,oa.useState)(e.getConfig(t));return(0,oa.useEffect)(()=>{if(!r?.subscribe&&e.status===zt.ConfigsLoaded)return;let a=e.subscribe(t,o=>{i(o),r?.subscribe||a.unsubscribe()});return a?.unsubscribe},[]),n}function iE(e){return function(t,r){return nE(e,t,r)}}function aE(e,t,r,n){let i=a=>{let o=nE(e,t,n),s={...a,...o};return oa.default.createElement(r,{...s})};return(0,rE.default)(i,r),i.displayName=`WithFeature(${r.name})`,i}function oE(e,t,r,n){return t.reduce((i,a)=>aE(e,a,i,n),r)}function sE(e){return function(t,r,n){return aE(e,t,r,n)}}var rE,oa,zp=I(()=>{"use strict";rE=ne(tE()),oa=ne(qp());Uo();});var uE=v((oK,lE)=>{var b4=Lp(),w4=Mp(),A4=w4(function(e,t,r){b4(e,t,r)});lE.exports=A4});var Vl=v((sK,cE)=>{var C4=ai(),S4=On(),E4="[object Symbol]";function N4(e){return typeof e=="symbol"||S4(e)&&C4(e)==E4}cE.exports=N4});var pE=v((lK,dE)=>{var D4=Pn(),I4=Vl(),_4=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,T4=/^\w*$/;function P4(e,t){if(D4(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||I4(e)?!0:T4.test(e)||!_4.test(e)||t!=null&&e in Object(t)}dE.exports=P4});var hE=v((uK,mE)=>{var fE=Fl(),O4="Expected a function";function Wp(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(O4);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(Wp.Cache||fE),r}Wp.Cache=fE;mE.exports=Wp});var vE=v((cK,gE)=>{var R4=hE(),F4=500;function x4(e){var t=R4(e,function(n){return r.size===F4&&r.clear(),n}),r=t.cache;return t}gE.exports=x4});var bE=v((dK,yE)=>{var L4=vE(),k4=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,M4=/\\(\\)?/g,B4=L4(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(k4,function(r,n,i,a){t.push(i?a.replace(M4,"$1"):n||r)}),t});yE.exports=B4});var AE=v((pK,wE)=>{function U4(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}wE.exports=U4});var IE=v((fK,DE)=>{var CE=Po(),$4=AE(),q4=Pn(),V4=Vl(),G4=1/0,SE=CE?CE.prototype:void 0,EE=SE?SE.toString:void 0;function NE(e){if(typeof e=="string")return e;if(q4(e))return $4(e,NE)+"";if(V4(e))return EE?EE.call(e):"";var t=e+"";return t=="0"&&1/e==-G4?"-0":t}DE.exports=NE});var TE=v((mK,_E)=>{var z4=IE();function W4(e){return e==null?"":z4(e)}_E.exports=W4});var OE=v((hK,PE)=>{var H4=Pn(),j4=pE(),J4=bE(),Q4=TE();function K4(e,t){return H4(e)?e:j4(e,t)?[e]:J4(Q4(e))}PE.exports=K4});var FE=v((gK,RE)=>{var X4=Vl(),Y4=1/0;function Z4(e){if(typeof e=="string"||X4(e))return e;var t=e+"";return t=="0"&&1/e==-Y4?"-0":t}RE.exports=Z4});var kE=v((vK,LE)=>{var eV=Fp(),tV=OE(),rV=kl(),xE=Xr(),nV=FE();function iV(e,t,r,n){if(!xE(e))return e;t=tV(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var l=nV(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=xE(c)?c:rV(t[i+1])?[]:{})}eV(s,l,u),s=s[l]}return e}LE.exports=iV});var BE=v((yK,ME)=>{var aV=kE();function oV(e,t,r){return e==null?e:aV(e,t,r)}ME.exports=oV});function VE(e){let{query:t}=(0,qE.default)(window.location.href,!0);return lV(e,t),e}function lV(e,t){let r=sV+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+GE,u={};if(a===r)u=s;else if(a.startsWith(l)){let c=a.substring(l.length);(0,$E.default)(u,c,s)}(0,UE.default)(i,u)}catch{}}),Object.keys(i).length>0&&e.overrideClientConfig(i)}var UE,$E,qE,GE,sV,zE=I(()=>{"use strict";UE=ne(uE()),$E=ne(BE()),qE=ne(Kd());GE=".",sV="ecs"+GE});function zl(e,t,r){let n=VE(new ql(e,t,r));function i(a){(0,Gl.useEffect)(()=>{n.init(a)},[])}return{featuresClient:n,createFeature:cV(n),useFeaturesClientInitParams:i,withFeatures:(a,o,s)=>oE(n,a,o,s)}}function cV(e){let t=iE(e),r=sE(e);return function(i){let a=Vy(i);return a.getConfig=()=>e.getConfig(a),a.isLoaded=()=>e.status===zt.ConfigsLoaded,Zd.register(a,e.clientName),{useFeature:o=>t(a,o),withFeature:(o,s)=>r(a,o,s),feature:a}}}var uV,Gl,Hp=I(()=>{"use strict";uV=ne(GS()),Gl=ne(qp());lp();$p();Uo();zp();zE();ep();});var WE=I(()=>{"use strict";lp();$p();Hp();Uo();zp();El();tp();});function Wl(e){return{logEvent:(t,r,n)=>{switch(n){case"Error":(0,sa.trackErrorTrace)(e,{eventName:t,eventData:r});break;case"Warning":(0,sa.trackWarningTrace)(e,{eventName:t,eventData:r});break;default:(0,sa.trackInfoTrace)(e,{eventName:t,eventData:r});break}}}}var sa,jp=I(()=>{"use strict";sa=ne(Zn());});var BK,UK,$K,HE=I(()=>{"use strict";WE();jp();({featuresClient:BK,createFeature:UK,useFeaturesClientInitParams:$K}=zl("PowerApps-Shell-Test",Wl("shell-features")))});var QE=v((VK,JE)=>{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{}}}),jE=function(){return Vo};Object.setPrototypeOf(jE,Vo);JE.exports=jE});var dV,pV,KE=I(()=>{"use strict";yo();dV=ne(QE()),pV=ne(Zn());});var XE=I(()=>{"use strict";HE();jp();KE();});var XK,la,YK,YE=I(()=>{"use strict";XE();Hp();({featuresClient:XK,createFeature:la,useFeaturesClientInitParams:YK}=zl("PowerApps-MakerPortal",Wl("powerapps-features")))});var ZE,eN,rX,nX,iX,aX,Jp=I(()=>{"use strict";qy();YE();({feature:ZE}=la({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:Ki.enableAutoInsertionOfCellInRow}})),{feature:eN}=la({teamName:"MakerPortal",owners:["aansu"],description:"Enable the one grid events for form designer",createdOn:"08/21/2024",fallback:{enableOneGridEventsForFormDesigner:Ki.enableOneGridEvents}}),{feature:rX}=la({teamName:"MakerPortal",owners:["adekulkarni"],description:"Disables PBI components and cleans them up from the form",createdOn:"01/03/2023",fallback:{enableFallbackFormTemplate:Ki.disablePBIComponents}}),{feature:nX}=la({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:Ki.enableAgentResponse}}),{feature:iX,useFeature:aX}=la({teamName:"MakerPortal",owners:["aansu"],description:"Enables delayed localization of custom control",createdOn:"06/08/2025",fallback:{enableDelayedLocalizationForCustomControls:Ki.enableDelayedLocalizationForCustomControls}})});var nN=v((sX,rN)=>{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{}}}),tN=function(){return Go};Object.setPrototypeOf(tN,Go);rN.exports=tN});var nt,Rn=I(()=>{"use strict";xe();Re();rt();Tl();X();ze();nt=class extends H{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 H(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=ke.getUniqueIdentifierForControl(t);return!N.IsNullOrUndefined(r)&&ke.isUnboundFormControlByIdentifier(r)}else return!1}IsAllowedUBCForAvailableOnPhone(){let t=this.getFirstChild(y.formControl);if(t){let n=ke.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=ke.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 ua,Qp=I(()=>{"use strict";rt();X();ze();ua=class extends H{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 iN,ca,Kp=I(()=>{"use strict";Re();Qp();X();ze();Rn();(function(e){e[e.Form=0]="Form",e[e.Cell=1]="Cell",e[e.Tab=2]="Tab",e[e.Control=3]="Control"})(iN||(iN={}));ca=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 H(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 ua(r,n.toString()))}}}});var sr,zo=I(()=>{"use strict";xe();vo();Re();Yn();X();ze();ir();sr=class extends H{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=(Kr.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 H(i,o))}else n||(o=new H(t,a),o.addChild(new H(i,o)),a.addChild(o))}else if(!n){a=new H("parameters",this);let o=new H(t,a);o.addChild(new H(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)===Kr.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 E.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 E.BooleanControl:case E.CheckboxControl:return 0;case E.DateTimeControl:return 2;case E.DecimalControl:return 3;case E.FloatingNumberControl:return 4;case E.IntegerControl:case E.DurationControl:case E.LanguageControl:case E.TimezoneControl:return 5;case E.LookupControl:return 6;case E.CurrencyControl:return 8;case E.PartyListControl:return 10;case E.ChoiceControl:case E.RelationshipRoleChoiceControl:return 11;case E.ChoiceStatusControl:return 13;case E.TextAreaControl:case E.TextboxControl:case E.LabelControl:case E.EmailAddressControl:case E.UrlControl:case E.TickerControl:case E.ButtonControl:case E.PhoneNumberControl:return 14;case E.ChoicesControl:return 24;default:return}return 14}async toJSON(t){let r=this.getParent(),n=t&&t.formModelService&&t.formModelService.getFormType()===Le.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 da,Xp=I(()=>{"use strict";rt();zi();zo();X();ze();da=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 Gt.Chart:return Gt.Chart;case Gt.Grid:return Gt.Grid;default:return Gt.All}}set chartGridMode(t){this.setParameter(m.chartGridMode,t)}updateChartGridMode(t){t?this.chartGridMode=Gt.Chart:this.chartGridMode=this.enableChartPicker?Gt.All:Gt.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 H(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 pa,Yp=I(()=>{"use strict";rt();zi();zo();X();pa=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 aN,Zp,Nt,Wo=I(()=>{"use strict";aN=ne(nN());Rn();X();Re();xe();Kp();zo();Tl();op();Bd();ir();Yn();qi();Xp();Yp();ef();So();Zp="_",Nt=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:!ei.dependencyFieldCount.containsKey(this.control.id):!ei.dependencyFieldCount.containsKey(this.control.dataFieldName)}createOnLoadEvent(){this.addEvent(new ca(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,Zp)+Zp;else{a="Control_";let u=new Error("Control class id does not exist or is undefined");(0,aN.trackErrorTrace)(dt,{eventName:`${Zv}/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===Wt.Grid?(l=new da(this),l.indicationOfSubgrid=!0):a===Wt.Lookup?l=new pa(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=ke.getUniqueIdentifierForControl(l);N.IsNullOrUndefined(d)||(ke.getControlDataTypeByControlOrUniqueId(d)===V.QuickFormCollectionControl||!ke.isUnboundFormControlByIdentifier(d)?a!==Wt.Grid&&o&&u!==E.IframeControl&&u!==E.SubgridControl&&u!==E.ReferencePanelSubgridControl&&(l.dataFieldName=o,e.prototype.setProperty.call(l,m.disabled,"false")):(this.rowspan=ke.GetRowSpan(l),(ke.getControlDataTypeByControlOrUniqueId(d)===V.NotesControl||ke.getControlDataTypeByControlOrUniqueId(d)===V.TimeLineControl)&&(e.prototype.setProperty.call(l,m.disabled,"false"),l.id=V.NotesControl)),(ke.getUnboundControlNameFromIdentifier(n)===V.SubGridControl||ke.getUnboundControlNameFromIdentifier(n)===V.NotesControl||ke.getUnboundControlNameFromIdentifier(n)===V.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(ip.ONE_COLUMN),n=Number(ip.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===ri.ApplicationRequired||o===ri.SystemRequired)&&!a||this.isCellLockedByExternal(t)&&!a)return!0}}return!1}getRequiredLevel(t){return!this.control?.dataFieldName||!this.control?.id||this.IsNewField||!this.control?.ClassId?ri.None:t.getEntityAttributeByName(this.control.dataFieldName)?.requiredLevel?.toString()??ri.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)===Zp&&(r++,n=parseInt(t.substr(r,t.length-r),10)),n}}});var fa,tf=I(()=>{"use strict";rt();X();ze();fa=class extends H{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 si,rf=I(()=>{"use strict";Re();Wo();X();ze();si=class extends H{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 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(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 fV(e){switch(e){case ni.Left:return ii.Left;case ni.Right:return ii.Right;case ni.Center:return ii.Center;default:return ii.Left}}function mV(e){switch(e){case ji.Left:return Qi.Left;case ji.Top:return Qi.Top;default:return Qi.Left}}function oN(e){switch(e){case 1:return 1;case 2:return 11;case 3:return 111;case 4:return 1111;default:return 1}}var hV,Ir,Ho=I(()=>{"use strict";sp();xe();Re();rt();Jp();Wo();X();ir();Rn();rf();hV=115,Ir=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=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}${T.NewGuid()}${we.namePrefix}`;this.addProperty(m.Name,i)}else this.setUniqueName();if(this.addProperty(m.id,new T(T.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),N.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 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 si(null);if(this.addGrandChild(y.formRows,r),ZE.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(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 oN(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=we.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)?we.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?hV: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:fV(this.fieldLabelAlignment),Position:mV(this.fieldLabelPosition)},Columns:oN(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(we.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 Fn,Hl=I(()=>{"use strict";X();ze();Ho();Fn=class e extends H{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 Ir(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,sN=I(()=>{"use strict";xe();X();ir();Ho();jl=class extends Ir{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,we.columns),this.setDisplayName(r,t)}}});var Jl,lN=I(()=>{"use strict";Hl();X();sN();Jl=class extends Fn{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 Yr,Ql=I(()=>{"use strict";xe();Re();rt();Hl();X();ze();Rn();Yr=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,Dn.namePrefix+t.toString()),this.addProperty(m.id,new T(T.NewGuid()).guidString),this.addProperty(m.IsUserDefined,Dn.IsUserDefined),this.addProperty(m.locklevel,Dn.LockLevel),this.addProperty(m.showlabel,Dn.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 Fn(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 H(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 li,nf=I(()=>{"use strict";xe();X();ze();ir();lN();Ql();li=class extends Yr{constructor(t,r,n){super(t,Ce.THREE_COLUMN_EQUAL),this.setDisplayName(r,n),this.id=new T(T.NewGuid())}initializeDefaultProps(){this.addChild(new H(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 Jl(this.getChildren(y.formColumns)[0]);r.initializeDefaultProperties(Ty.FiveEqColumn),this.addGrandChild(y.formColumns,r)}}}});function vV(e){switch(e){case Le.Main:return _n.Main;case Le.QuickCreate:return _n.QuickCreate;case Le.QuickViewForm:return _n.Quick;case Le.Dialog:return _n.Dialog;default:return _n.None}}function yV(e,t){if(t===Le.Main){if(e)switch(e.toLowerCase()){case"low":return Nn.Low;case"highreadonlyvalues":return Nn.HighReadOnlyValues;default:return Nn.HighWithControls}return Nn.Low}}var Xl,gV,Kl,uN=I(()=>{"use strict";ky();Xl=ne(Zn());sp();Re();rt();qi();Jp();X();zi();Nd();Yn();Wo();X();Rn();tf();nf();Ql();gV="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 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()===y.internalLibraries),r=[],n="src";return t.length>0&&(r=t.map(i=>{let a=i.GetPropertyByParameter(n).replace("$webresource:",""),o=new fa(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)(ey,{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))?gV: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===Le.Main?this.setProperty(m.HeaderDensityType,t):this.formType!==Le.Main&&this.headerDensityType&&this.removeProperty(m.HeaderDensityType)}IsMainOrQuickCreateForm(){return this.formType===Le.Main||this.formType===Le.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 Yr(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 Yr(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===Dn.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 li)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 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()!==E.CustomControl?!1:this.cellHasCustomControlWithName(t,In.EditableGridControl)||eN.getConfig()?.enableOneGridEventsForFormDesigner&&this.cellHasCustomControlWithName(t,In.PowerAppsOneGrid)}isCellCanvasAppControl(t){return t?.control?.ClassId.guidString.toUpperCase()===E.CustomControl&&this.cellHasCustomControlWithName(t,In.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 li)){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===Le.Main?{HeaderDensity:yV(this.headerDensityType,this.formType)}:{},InlineEditGridRow:[],InlineQuickForms:[],QuickFormEntities:[],EventHandlers:[],LinkControlSections:[],FormType:vV(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,af,cN=I(()=>{"use strict";xe();Re();X();ze();Rn();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 af(this))}},af=class extends H{constructor(t){super(y.formEveryOne,t)}}});var Zl,dN=I(()=>{"use strict";X();ze();Zl=class extends H{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 ma,of=I(()=>{"use strict";X();Ho();ma=class extends Ir{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,pN=I(()=>{"use strict";X();of();jo=class extends ma{_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 Jo,fN=I(()=>{"use strict";X();of();Jo=class extends ma{_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 Dt,ui=I(()=>{"use strict";xe();rt();X();Rn();Dt=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 Qo,mN=I(()=>{"use strict";(function(e){e[e.NavLinkNotAvailable=-1]="NavLinkNotAvailable",e[e.NavLinkIdConflict=-2]="NavLinkIdConflict",e[e.NavBarNotAvailable=-3]="NavBarNotAvailable"})(Qo||(Qo={}))});var eu,hN=I(()=>{"use strict";Re();X();ui();mN();eu=class extends Dt{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)?Qo.NavLinkNotAvailable:r.length===1?this.deleteChild(r[0]):Qo.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,bV,gN,KZ,ha,sf=I(()=>{"use strict";xe();X();ui();(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={}));bV=new Map([[ve.Info,"Info"],[ve.Sales,"Sales"],[ve.Service,"Service"],[ve.Marketing,"Marketing"],[ve.ProcessCenter,"ProcessCenter"]]),gN=new Map([["Info",ve.Info],["Sales",ve.Sales],["Service",ve.Service],["Marketing",ve.Marketing],["ProcessCenter",ve.ProcessCenter]]),KZ=new Map([[ve.Info,9e3],[ve.Sales,9200],[ve.Service,9400],[ve.Marketing,9600],[ve.ProcessCenter,9800],[ve.InternetMarketing,1e4],[ve.Async,10200]]),ha=class extends Dt{constructor(t,r){super(y.formNavBarArea,r)}setDefaultPropertiesByType(t,r,n){this.AreaId=bV.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 ga,lf=I(()=>{"use strict";X();ui();ga=class extends Dt{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,vN=I(()=>{"use strict";Re();X();ui();tu=class extends Dt{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,yN=I(()=>{"use strict";X();ui();ru=class extends Dt{constructor(t){super(y.formNavBarItem,t)}get Url(){return this.getProperty(m.url)}set Url(t){this.setProperty(m.url,t)}}});var nu,bN=I(()=>{"use strict";xe();X();sf();lf();ui();nu=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(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=>gN.get(o.AreaId)));n=n.filter(o=>!a.has(o))}}else{let i=new ga(y.formNavBarAreas,this);i.isTransient=!0,this.addChild(i)}return n.length>0?(n.forEach(i=>{let a=new ha(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(Md,!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 wN={};Ur(wN,{ControlType:()=>Wt,DeserializationService:()=>df,DeserializationServiceScope:()=>cf,DeserializedFormElementNode:()=>It});var uf,It,cf,Wt,df,ef=I(()=>{"use strict";uf=ne(Zn());xe();Re();rt();qi();Bd();Yn();ty();Ly();Tl();uN();Wo();Hl();zo();Qp();X();X();cN();ze();ir();Kp();dN();pN();Xp();Yp();fN();tf();rf();Ho();Ql();hN();sf();lf();vN();yN();bN();It=class extends H{constructor(t,r){super(t,r)}insertProperty(t,r){this.addProperty(t,r)}insertChild(t){this.addChild(t)}},cf="DeserializationService";(function(e){e.Grid="Grid",e.Lookup="Lookup",e.Base="Base"})(Wt||(Wt={}));df=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,uf.trackErrorTrace)(dt,{eventName:cf,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!==Le.Dialog&&this.appendDefaultDisplayCondition(p),p}upsertFieldCount(t,r){let n=ei.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===Le.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 Jo(r,!0):new jo(r,!0);It.prototype.insertProperty.call(i,m.id,"{"+T.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 si(a);for(let s=0;s<i.maxColumns;s++){let l=new Nt(o);It.prototype.insertProperty.call(l,m.id,"{"+T.NewGuid()+"}"),l.setDisplayName(P.EmptyString,this.lcid),It.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 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,uf.trackErrorTrace)(dt,{eventName:cf,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()===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&&It.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 Yr(r);case y.formColumn:return new Fn(r);case y.formHeader:return new Jo(r,!1);case y.formFooter:return new jo(r,!1);case y.formSection:return new Ir(y.formSection,r);case y.formRow:return new si(r);case y.formCell:return new Nt(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()===`{${E.SubgridControl}}`||l.value?.toLocaleUpperCase()===`{${E.ReferencePanelSubgridControl}}`))a=Wt.Grid;else if(l.name===m.classid&&l.value?.toLocaleUpperCase()===`{${E.LookupControl}}`)a=Wt.Lookup;else if(l.name===m.classid&&l.value?.toLocaleUpperCase()===`{${E.CustomControl}}`)for(let u=0;u<i?.length;u++)i[u].nodeName===m.DefaultViewId&&(a=Wt.Lookup)}return a===Wt.Grid?new da(r):a===Wt.Lookup?new pa(r):new sr(r);case y.formEvent:return new ca(r,P.EmptyString);case y.dependency:return this.populateDependencyTable(t),new ua(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 ha(t.nodeName,r);case y.formNavBarAreas:return new ga(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 fa(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 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,Sr.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);ke.CustomControlIdMap.upsert(l,a);break}}break}}}}});var AN={};Ur(AN,{SerializationService:()=>pf,SerializationServiceScope:()=>wV,SerializedFormElementNode:()=>va});var wV,va,pf,CN=I(()=>{"use strict";rt();ze();ir();nf();wV="SerializationService",va=class extends H{fetchNodeName(){return this.getNodeName()}enumerateProperties(){return this.getAllProperties()}enumerateChildren(){return this.getAllChildren()}},pf=class{langCode;constructor(t){this.langCode=t}serializeFormXmlNode(t){let r=va.prototype.fetchNodeName.call(t);if(r.charAt(0)===Kr.StartTag)return P.EscapeXml(r.substr(1),!1);if(t.isTransient&&!t.isDirty())return P.EmptyString;let n=va.prototype.enumerateProperties.call(t),i=va.prototype.enumerateChildren.call(t);if(!(t instanceof li)){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 _r=v(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 SN(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}it.isJsonObject=SN;function ya(e,t,r,n){return n?{pointer:e,rule:t,message:r,fatal:n}:{pointer:e,rule:t,message:r}}it.issue=ya;function EN(e,t,r,n){if(!Array.isArray(e))return[];let i=[];return e.forEach((a,o)=>{SN(a)?i.push({node:a,index:o}):n.push(ya(`${t}/${o}`,`${r}-must-be-object`,`a ${r} must be a JSON object, got ${a===null?"null":typeof a}`))}),i}it.eachObject=EN;function AV(e,t,r,n,i,a){let o=e[t];o!==void 0&&(typeof o!="string"||!r.includes(o))&&a.push(ya(`${n}/${t}`,i,`${t} must be one of ${r.map(s=>`'${s}'`).join(", ")}, got ${JSON.stringify(o)}`))}it.optionalEnum=AV;var CV=/^(?:\{[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 SV(e,t,r,n,i){let a=e[t];typeof a=="string"&&a!==""&&!CV.test(a)&&i.push(ya(`${r}/${t}`,n,`${t} must be a GUID or empty, got '${a}'`))}it.optionalGuidId=SV;function EV(e,t,r,n,i){let a=e[t],o=`${r}/${t}`;return a===void 0?[]:Array.isArray(a)?EN(a,o,n,i):(i.push(ya(o,`${n}-list-must-be-array`,`${t} must be an array when present, got ${typeof a}`)),[])}it.childObjects=EV;function NV(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(ya(`${r}/${l}`,`${n}-unknown-key`,`'${l}' is not a ${n} property, and would be SILENTLY DROPPED at serialization.${d}`))}}it.rejectUnknownKeys=NV});var $N=v(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.classIdForAttributeType=Tt.QUICK_VIEW_CLASS_ID=Tt.NOTES_CLASS_ID=Tt.SUBGRID_CLASS_ID=Tt.formRegistration=Tt.FormAdapter=void 0;var Zr=(xe(),mr(Hv)),DV=(Re(),mr(jv)),IV=(ze(),mr(Qv)),at=(X(),mr(Jv)),Fe=(Yn(),mr(Kv)),_V=(ef(),mr(wN)),TV=(CN(),mr(AN)),Me=bn(),NN=rr(),_t=_r(),PV=pd(),Ko=ct(),gf=ie(),PN=An(),ON=Ei(),OV={[at.FormType.Main]:"Main",[at.FormType.QuickCreate]:"QuickCreate",[at.FormType.QuickViewForm]:"QuickView",[at.FormType.Card]:"Card"},ff={Main:at.FormType.Main,QuickCreate:at.FormType.QuickCreate,QuickView:at.FormType.QuickViewForm,Card:at.FormType.Card},RV=new Map(Object.entries(Fe.ControlClassId).map(([e,t])=>[String(t).toUpperCase(),e]));function RN(e){var t;return e&&(t=RV.get(e.toUpperCase()))!==null&&t!==void 0?t:"Unknown"}function Xo(e){return e.getAllProperties().map(t=>[t.key,t.value])}function ci(e){let t=new Map;for(let r of e.getAllProperties())t.has(r.key)||t.set(r.key,r.value);return t}function FN(e,t){return e.getAllChildren().find(r=>r.getNodeName()===t)}function vf(e,t){var r,n;let i=FN(e,"labels");if(!i)return"";let a=i.getAllChildren().filter(s=>s.getNodeName()==="label"),o=(r=a.find(s=>ci(s).get("languagecode")===String(t)))!==null&&r!==void 0?r:a[0];return o&&(n=ci(o).get("description"))!==null&&n!==void 0?n:""}function FV(e){let t=FN(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 xN(e){return/^1+$/.test(e)&&e.length>=1&&e.length<=4?e.length:1}function mf(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 hf(e){return`{${Yo(e)}}`}function DN(e,t){if(e===void 0||e==="")return t;let r=Number(e);return Number.isNaN(r)?t:r}function au(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,Me.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,Me.rawFromNode)(u)})}),{modeled:s,bag:{a:Xo(e),c:a,w:{n:o.getNodeName(),a:Xo(o),c:l}}}}function LN(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,Me.rawFromNode)(a)})}),{modeled:n,bag:{a:Xo(e),c:i}}}function xV(e,t){let{modeled:r,bag:n}=au(e,"tabs","tab");return{tabs:r.map(i=>LV(i,t)),bag:n}}function LV(e,t){var r,n;let i=ci(e),{modeled:a,bag:o}=au(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:vf(e,t),expanded:i.get("expanded")==="true",visible:i.has("visible")?i.get("visible")==="true":!0,columns:a.map(s=>kV(s,t)),bag:o}}function kV(e,t){let r=ci(e),{modeled:n,bag:i}=au(e,"sections","section");return{width:r.get("width"),sections:n.map(a=>MV(a,t)),bag:i}}function MV(e,t){var r,n,i;let a=ci(e),{modeled:o,bag:s}=au(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:vf(e,t),visible:a.has("visible")?a.get("visible")==="true":!0,showLabel:a.get("showlabel")==="true",columns:xN((i=a.get("columns"))!==null&&i!==void 0?i:"1"),rows:o.map(l=>BV(l,t)),bag:s}}function BV(e,t){let{modeled:r,bag:n}=LN(e,"cell",!1);return{cells:r.map(i=>UV(i,t)),bag:n}}function UV(e,t){var r;let n=ci(e),{modeled:i,bag:a}=LN(e,"control",!0),o=vf(e,t),s=n.get("showlabel")==="true",l=i[0]?$V(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:DN(n.get("colspan"),1),rowspan:DN(n.get("rowspan"),1),control:l,bag:a}}function $V(e,t,r){var n,i;let a=ci(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:RN(o),isRequired:a.get("isrequired")==="true",isReadOnly:a.get("disabled")==="true",label:t,showLabel:r,parameters:FV(e),bag:{a:Xo(e),c:e.getAllChildren().map((l,u)=>({i:u,node:(0,Me.rawFromNode)(l)}))}}}function ba(e){return e.a.length===0&&e.c.length===0&&!e.w}function kN(e,t){let r=e.a.find(n=>n[0]===t);return r?r[1]:void 0}function di(e,t){var r;let n=new Set(e.a.map(o=>o[0])),i=ba(e),a=[];for(let o of t)if(n.has(o.key)){let s=(r=kN(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,Me.mergeAttrs)(e.a,a)}var xn=(e,t)=>({key:e,matches:r=>r===t,render:()=>t,absentDefault:""}),Ln=(e,t,r=!1)=>({key:e,matches:n=>n==="true"===t,render:()=>String(t),absentDefault:String(r)}),IN=(e,t,r=1)=>({key:e,matches:n=>Number(n)===t,render:()=>String(t),absentDefault:String(r)});function yf(e,t){return{n:"labels",a:[],c:[{n:"label",a:[["description",e],["languagecode",String(t)]],c:[]}]}}function MN(e){return{n:"parameters",a:[],c:Object.keys(e).map(t=>({n:(0,gf.assertXmlName)(t,"Form control parameter name"),a:[],c:[{n:`<${e[t]}`,a:[],c:[]}]}))}}function qV(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 VV(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 bf(e,t,r){let n=e.c.findIndex(a=>a.node.n==="labels");if(n<0||qV(e.c[n].node,r)===t)return e;let i=VV(e.c[n].node,t,r);return{...e,c:e.c.map((a,o)=>o===n?{...a,node:i}:a)}}function GV(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 zV(e,t){let r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every(i=>e[i]===t[i])}function WV(e,t){return e.a.some(r=>r[0]===t)?{...e,a:e.a.filter(r=>r[0]!==t)}:e}function HV(e,t){let r=e.c.findIndex(i=>i.node.n==="parameters");if(r<0||zV(GV(e.c[r].node),t))return e;let n=MN(t);return{...e,c:e.c.map((i,a)=>a===r?{...i,node:n}:i)}}function ou(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,Me.spliceChildren)(e.w.c,r)};return(0,Me.spliceChildren)(e.c,[o])}let i=n(),a={n:t,a:[],c:r};return e.c.length===0?[...i,a]:(0,Me.spliceChildren)(e.c,[...i,a])}function jV(e,t){let r=e.tabs.map(n=>JV(n,t));return{n:"form",a:di(e.bag,[]),c:e.tabs.length===0&&ba(e.bag)?[]:ou(e.bag,"tabs",r,()=>[])}}function JV(e,t){let r=[xn("id",e.id),xn("name",e.name),Ln("expanded",e.expanded),Ln("visible",e.visible,!0)],n=e.columns.map(a=>QV(a,t)),i=bf(e.bag,e.label,t);return{n:"tab",a:di(i,r),c:ou(i,"columns",n,()=>e.label?[yf(e.label,t)]:[])}}function QV(e,t){let r=e.width!==void 0?[xn("width",e.width)]:[],n=e.sections.map(i=>KV(i,t));return{n:"column",a:di(e.bag,r),c:ou(e.bag,"sections",n,()=>[])}}function KV(e,t){let r=[xn("id",e.id),xn("name",e.name),Ln("showlabel",e.showLabel),Ln("visible",e.visible,!0),{key:"columns",matches:a=>xN(a)===e.columns,render:()=>mf(e.columns),absentDefault:mf(1)}],n=e.rows.map(a=>XV(a,t)),i=bf(e.bag,e.label,t);return{n:"section",a:di(i,r),c:ou(i,"rows",n,()=>e.label?[yf(e.label,t)]:[])}}function XV(e,t){let r=e.cells.map(n=>YV(n,t));return{n:"row",a:di(e.bag,[]),c:ba(e.bag)?r:(0,Me.assembleChildren)(e.bag,r)}}function YV(e,t){let r=e.control?e.control.showLabel:kN(e.bag,"showlabel")==="true",n=[xn("id",e.id),Ln("showlabel",r),Ln("visible",e.visible,!0),IN("colspan",e.colspan),IN("rowspan",e.rowspan)],i=e.control?[ZV(e.control)]:[],a;if(ba(e.bag))a=[...e.control&&e.control.label?[yf(e.control.label,t)]:[],...i];else{let o=e.control?bf(e.bag,e.control.label,t):e.bag;a=(0,Me.assembleChildren)(o,i)}return{n:"cell",a:di(e.bag,n),c:a}}function ZV(e){let t=[xn("id",e.id),{key:"classid",matches:i=>Yo(i)===e.classId,render:()=>hf(e.classId),absentDefault:""}];e.fieldName!==null&&t.push(xn("datafieldname",e.fieldName)),t.push(Ln("disabled",e.isReadOnly)),t.push(Ln("isrequired",e.isRequired));let r=e.fieldName===null?WV(e.bag,"datafieldname"):e.bag,n;return ba(r)?n=Object.keys(e.parameters).length>0?[MN(e.parameters)]:[]:n=(0,Me.assembleChildren)(HV(r,e.parameters),[]),{n:"control",a:di(r,t),c:n}}var e5={make:(e,t)=>new IV.FormElementNode(e,t),setProp:(e,t,r)=>e.setProperty(t,r),addChild:(e,t)=>e.addChild(t)};function _N(e,t,r){(0,PN.installDomShim)();let n=r5(e,r),i=(0,Me.rebuildRaw)(jV(n,t),e5,null);return new TV.SerializationService(t).serializeFormXmlNode(i)}function t5(e){return JSON.parse(JSON.stringify(e))}function r5(e,t){var r;let n=t5(e);n.bag||(n.bag=(0,Me.emptyBag)()),c5(n.bag),t&&n5(n,t);for(let i of(r=n.tabs)!==null&&r!==void 0?r:[])i5(i);return n}function n5(e,t){var r;let n=(r=e.entityLogicalName)!==null&&r!==void 0?r:"";BN(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=UN(s.attributeType)))})}function BN(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 i5(e){e.id||(e.id=Zr.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)a5(t);e.bag||(e.bag=(0,Me.emptyBag)())}function a5(e){e.sections||(e.sections=[]);for(let t of e.sections)o5(t);e.bag||(e.bag=(0,Me.emptyBag)()),e.width===void 0&&ba(e.bag)&&(e.width="100%")}function o5(e){e.id||(e.id=Zr.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)s5(t);e.bag||(e.bag=(0,Me.emptyBag)())}function s5(e){e.cells||(e.cells=[]);for(let t of e.cells)l5(t);e.bag||(e.bag=(0,Me.emptyBag)())}function l5(e){e.id||(e.id=Zr.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&&u5(e.control),e.bag||(e.bag=(0,Me.emptyBag)())}function u5(e){var t;e.id||(e.id=Zr.Guid.NewGuid()),e.classId===void 0&&(e.classId=String(Fe.ControlClassId.TextboxControl)),e.fieldName===void 0&&(e.fieldName=null),e.type===void 0&&(e.type=e.fieldName?"Field":RN(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,gf.assertXmlName)(r,"Form control parameter name");e.bag||(e.bag=(0,Me.emptyBag)())}function c5(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"&&!TN(a,"handlerUniqueId")&&a.a.push(["handlerUniqueId",hf(Zr.Guid.NewGuid())])}}else if(r.n==="formLibraries")for(let n of r.c)n.n==="Library"&&!TN(n,"libraryUniqueId")&&n.a.push(["libraryUniqueId",hf(Zr.Guid.NewGuid())])}}var iu=class{constructor(t=ON.DEFAULT_LCID){this.lcid=t}toArtifact(t,r){var n,i,a;let{tabs:o,bag:s}=xV(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=OV[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:_N(t,this.lcid),formid:t.id||(0,Ko.newId)(),objecttypecode:t.entityLogicalName,type:ff[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:_N(t,this.lcid,n),name:t.name,type:ff[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 BN(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:b5(this.lcid),h=f!==void 0?f:t.tabs.map(S=>d5(S,this.lcid)).join(""),g=this.deserialize({formxml:`<form><tabs>${h}</tabs></form>`,formid:t.id||(0,Ko.newId)(),objecttypecode:(r=t.entityLogicalName)!==null&&r!==void 0?r:"",type:ff[(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(g,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 _5(t)}deserialize(t){(0,PN.installDomShim)();let r=DV.ScriptUtilities.ParseXml(t.formxml),n=new _V.DeserializationService(this.lcid).deSerializeFormXml(r,new Zr.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"}};Tt.FormAdapter=iu;function lr(e){return String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function wf(e,t){return e?`<labels><label description="${lr(e)}" languagecode="${t}" /></labels>`:""}function Af(e){return e&&e.length>0?Yo(e):(0,Ko.newId)()}function d5(e,t){var r,n,i,a;let o=(r=e.columns)!==null&&r!==void 0?r:[],s=(o.length>0?o:[y5()]).map(l=>p5(l,t)).join("");return`<tab id="{${lr(Af(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}">${wf(e.label,t)}<columns>${s}</columns></tab>`}function p5(e,t){var r,n;let i=((r=e.sections)!==null&&r!==void 0?r:[]).map(a=>f5(a,t)).join("");return`<column width="${lr((n=e.width)!==null&&n!==void 0?n:"100%")}"><sections>${i}</sections></column>`}function f5(e,t){var r,n,i,a,o;let s=((r=e.rows)!==null&&r!==void 0?r:[]).map(l=>m5(l,t)).join("");return`<section id="{${lr(Af(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="${mf((o=e.columns)!==null&&o!==void 0?o:1)}">${wf(e.label,t)}<rows>${s}</rows></section>`}function m5(e,t){var r;return`<row>${((r=e.cells)!==null&&r!==void 0?r:[]).map(n=>h5(n,t)).join("")}</row>`}function h5(e,t){var r,n,i,a,o,s;let l=e.control,u=l?wf((n=(r=l.label)!==null&&r!==void 0?r:l.fieldName)!==null&&n!==void 0?n:"",t):"",c=l?g5(l):"";return`<cell id="{${lr(Af(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 g5(e){var t,r,n;let i=e.fieldName?` datafieldname="${lr(e.fieldName)}"`:"",a=v5(e.parameters),o=e.classId?Yo(e.classId):String(Fe.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 v5(e){let t=Object.keys(e??{});return t.length===0?"":(t.forEach(n=>(0,gf.assertXmlName)(n,"Form control parameter name")),`<parameters>${t.map(n=>`<${n}>${lr(e[n])}</${n}>`).join("")}</parameters>`)}function y5(){return{width:"100%",sections:[],bag:{a:[],c:[]}}}function b5(e){return`<tab id="{${Zr.Guid.NewGuid()}}" name="tab_general" expanded="true" visible="true"><labels><label description="General" languagecode="${e}" /></labels><columns><column width="100%"><sections><section id="{${Zr.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 w5(e=ON.DEFAULT_LCID){return{adapter:new iu(e),api:PV.formApi,languageSensitive:!0,publish:(t,r,n)=>(0,NN.publishBoundEntity)(t,n),publishScope:(t,r)=>(0,NN.boundEntityPublishScope)(r)}}Tt.formRegistration=w5;var A5=new Set(["id","name","label","expanded","visible","columns","bag"]),C5=new Set(["id","width","sections","bag"]),S5=new Set(["id","name","label","visible","showLabel","columns","rows","bag"]),E5=new Set(["id","cells","bag"]),N5=new Set(["id","visible","colspan","rowspan","control","bag"]),D5=new Set(["id","classId","fieldName","type","isRequired","isReadOnly","label","showLabel","parameters","bag"]),I5={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 _5(e){let t=[];return(0,_t.childObjects)(e,"tabs","","tab",t).forEach(({node:n,index:i})=>{let a=`/tabs/${i}`;(0,_t.rejectUnknownKeys)(n,A5,a,"tab",t),(0,_t.childObjects)(n,"columns",a,"column",t).forEach(({node:s,index:l})=>{let u=`${a}/columns/${l}`;(0,_t.rejectUnknownKeys)(s,C5,u,"column",t),(0,_t.childObjects)(s,"sections",u,"section",t).forEach(({node:d,index:p})=>{let f=`${u}/sections/${p}`;(0,_t.rejectUnknownKeys)(d,S5,f,"section",t),(0,_t.childObjects)(d,"rows",f,"row",t).forEach(({node:g,index:w})=>{let S=`${f}/rows/${w}`;(0,_t.rejectUnknownKeys)(g,E5,S,"row",t),(0,_t.childObjects)(g,"cells",S,"cell",t).forEach(({node:x,index:F})=>{let G=`${S}/cells/${F}`;(0,_t.rejectUnknownKeys)(x,N5,G,"cell",t,I5);let L=x.control;L!=null&&!(0,_t.isJsonObject)(L)?t.push((0,_t.issue)(`${G}/control`,"control-must-be-object-or-null",`a cell control must be a JSON object or null, got ${typeof L}`)):(0,_t.isJsonObject)(L)&&(0,_t.rejectUnknownKeys)(L,D5,`${G}/control`,"control",t)})})})})}),t}Tt.SUBGRID_CLASS_ID=Fe.ControlClassId.SubgridControl;Tt.NOTES_CLASS_ID=Fe.ControlClassId.TimelineControl;Tt.QUICK_VIEW_CLASS_ID=Fe.ControlClassId.QuickViewControl;var T5={Lookup:String(Fe.ControlClassId.LookupControl),Customer:String(Fe.ControlClassId.LookupControl),Owner:String(Fe.ControlClassId.LookupControl),PartyList:String(Fe.ControlClassId.PartyListControl),Boolean:String(Fe.ControlClassId.BooleanControl),DateTime:String(Fe.ControlClassId.DateTimeControl),Decimal:String(Fe.ControlClassId.DecimalControl),Double:String(Fe.ControlClassId.FloatingNumberControl),Money:String(Fe.ControlClassId.CurrencyControl),Integer:String(Fe.ControlClassId.IntegerControl),BigInt:String(Fe.ControlClassId.IntegerControl),Memo:String(Fe.ControlClassId.TextAreaControl),String:String(Fe.ControlClassId.TextboxControl)},P5="3EF39988-22BB-4F0B-BBBE-64B5A3748AEE";function UN(e){return e==="Picklist"||e==="State"||e==="Status"?P5:e&&T5[e]||String(Fe.ControlClassId.TextboxControl)}Tt.classIdForAttributeType=UN;function TN(e,t){let r=e.a.find(n=>n[0]===t);return r?r[1]:void 0}});var Cf=v(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});wa.viewApi=wa.findDefaultViews=void 0;var VN=$t(),Ht=be(),en=ie(),O5="savedqueryid,name,description,fetchxml,layoutxml,querytype,returnedtypecode,isdefault",R5="savedqueryid,name,returnedtypecode,querytype,isdefault";async function F5(e,t,r={}){var n;let i=new Set(((n=r.excludeViewIds)!==null&&n!==void 0?n:[]).filter(Boolean)),a=`returnedtypecode eq '${(0,en.odataLiteral)(t)}' and querytype eq 0`,o=`/savedqueries${(0,en.odataQuery)([["$select","savedqueryid,name,isdefault"],["$filter",a]])}`;return(await(0,VN.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:"")}})}wa.findDefaultViews=F5;async function x5(e,t){var r;let n=`/EntityDefinitions(LogicalName='${(0,en.odataPathLiteral)(t)}')${(0,en.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 qN(e,t,r){if(!r||!/<grid\b/.test(t)||/<grid[^>]*\bobject=/.test(t))return t;let n=await x5(e,r);return n===void 0?t:t.replace(/<grid\b/,`<grid object="${n}"`)}wa.viewApi={async get(e,t){let n=`/savedqueries(${(0,en.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,en.odataQuery)([["$select",O5]]),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=`/savedqueries${(0,en.odataQuery)([["$select",R5],["$filter",t?.entityLogicalName?`returnedtypecode eq '${(0,en.odataLiteral)(t.entityLogicalName)}'`:void 0]])}`;return(await(0,VN.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,Ht.echoWrite)("savedqueryid"),a=`/savedqueries${i.query}`,o=await qN(e,n.layoutxml,n.returnedtypecode),s=(0,Ht.ensureSuccess)(await e.post(a,(0,Ht.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,Ht.resolveCreatedId)(s,"savedqueryid","view",r),etag:(0,Ht.readEtag)(s)}},async update(e,t,r,n){let i=r,a=(0,en.normalizeGuid)(t,"id"),o=(0,Ht.echoWrite)("savedqueryid",{"If-Match":(0,Ht.requireEtag)(n,"view",a)}),s=`/savedqueries(${a})${o.query}`,l=await qN(e,i.layoutxml,i.returnedtypecode),u=(0,Ht.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,Ht.readEtag)(u)}},delete(e,t){return(0,Ht.deleteRecord)(e,"savedqueries",t)}}});var nD=v(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});Aa.viewRegistration=Aa.ViewAdapter=void 0;var QN=re(),Lt=_r(),Sf=bn(),pi=Qn(),GN=rr(),L5=Cf(),Ef=An(),k5=ct(),KN=100,lu=class{toArtifact(t){var r,n,i,a,o,s,l,u;(0,Ef.installDomShim)();let c=(r=t.fetchxml)!==null&&r!==void 0?r:"",d=(n=t.layoutxml)!==null&&n!==void 0?n:"",p=(0,pi.parseXmlRoot)(c,"<fetch/>"),f=(0,pi.parseXmlRoot)(d,"<grid/>"),h=YN(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:B5(p),queryType:(l=t.querytype)!==null&&l!==void 0?l:0,isDefault:(u=t.isdefault)!==null&&u!==void 0?u:!1,columns:XN(f,p),filters:eD(p),sort:ZN(p),...h.length>0?{linkEntities:h}:{},fetchBag:c?(0,pi.projectElementBag)(p):void 0,layoutBag:d?(0,pi.projectElementBag)(f):void 0}}fromArtifact(t){(0,Ef.installDomShim)();let{fetchxml:r,layoutxml:n}=zN(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,Ef.installDomShim)();let{fetchxml:s,layoutxml:l}=zN(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,k5.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,Lt.childObjects)(n,"columns","","column",r),(0,Lt.childObjects)(n,"sort","","sort",r),(0,Lt.childObjects)(n,"linkEntities","","linkEntity",r),M5(n.linkEntities,r);let i=n.filters;return i!=null&&((0,Lt.isJsonObject)(i)?Nf(i,"/filters",r):r.push((0,Lt.issue)("/filters","filters-must-be-object",`filters must be a JSON object, got ${typeof i}`))),r}};Aa.ViewAdapter=lu;function M5(e,t){Array.isArray(e)&&e.forEach((r,n)=>{if(!(0,Lt.isJsonObject)(r))return;for(let a of["name","from","to"]){let o=r[a];(typeof o!="string"||o.trim()==="")&&t.push((0,Lt.issue)(`/linkEntities/${n}/${a}`,"linkentity-needs-keys",`a join needs a non-empty '${a}' \u2014 'from'/'to' are what DEFINE the relationship, and a link without them is unresolvable. Got ${JSON.stringify(o)}.`))}let i=r.filters;i!=null&&((0,Lt.isJsonObject)(i)?Nf(i,`/linkEntities/${n}/filters`,t):t.push((0,Lt.issue)(`/linkEntities/${n}/filters`,"filters-must-be-object",`filters must be a JSON object, got ${typeof i}`)))})}function Nf(e,t,r){(0,Lt.childObjects)(e,"conditions",t,"condition",r),(0,Lt.childObjects)(e,"groups",t,"filterGroup",r).forEach(({node:i,index:a})=>Nf(i,`${t}/groups/${a}`,r))}function B5(e){var t;let r=e.getElementsByTagName("entity")[0];return(t=r?.getAttribute("name"))!==null&&t!==void 0?t:""}function XN(e,t){var r;let n=Df(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)?KN:c,order:o},p=n.get(u);p&&(d.relatedEntity=p.linkKey,p.attributeName&&p.attributeName!==u&&(d.sourceAttribute=p.attributeName)),o+=1,a.push(d)}return a}function Df(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("name")||"",c=l.getAttribute("alias")||u;c&&t.set(c,{linkKey:i.getAttribute("alias")||a,linkName:a,attributeName:u,link:i})}}return t}function YN(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").find(c=>!uu(c));r.push({name:i,from:a,to:o,...s?{alias:s}:{},...l==="inner"||l==="outer"?{linkType:l}:{},...u?{filters:If(u)}:{}})}return r}function ZN(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 eD(e){let t=e.getElementsByTagName("entity")[0],r={type:"and",conditions:[],groups:[]};if(!t)return r;let n=ot(t,"filter").filter(i=>!uu(i)).map(If);return n.length===0?r:n.length===1?n[0]:{type:"and",conditions:[],groups:n}}function uu(e){if(e.getAttribute("isquickfindfields")==="1")return!0;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||$5(r))}var U5=new Set(["attribute","operator","value","entityname","uiname","uitype"]);function $5(e){var t;let r=e.attributes;for(let n=0;n<r.length;n+=1){let i=(t=r[n])===null||t===void 0?void 0:t.name;if(i&&!U5.has(i))return!0}return!1}function If(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);let p=l.getAttribute("entityname")||"";p&&(c.entityname=p),i.push(c)}else l.tagName==="filter"&&a.push(If(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}var _f=e=>{var t,r;return`${(t=e.relatedEntity)!==null&&t!==void 0?t:""}::${(r=e.sourceAttribute)!==null&&r!==void 0?r:e.name}`};function q5(e,t){let r=Df(e),n=new Map;for(let i of t){if(!i.relatedEntity)continue;let a=r.get(i.name);if(a){let o=_f(i),s=n.get(o);s?s.push(a.link):n.set(o,[a.link])}}return n}function V5(e,t,r,n){if(!n||n.size===0)return;let i=new Set,a=t.getElementsByTagName("link-entity");for(let s=0;s<a.length;s+=1)i.add(a[s]);let o=r.filter(s=>{if(!s.relatedEntity)return!1;let l=n.get(_f(s));return!!l&&l.some(u=>!i.has(u))});if(o.length!==0)throw new QN.ValidationError("view",e.id,o.map(s=>(0,Lt.issue)(`/columns/${r.indexOf(s)}`,"view-column-orphaned-by-join-removal",`column '${s.name}' came from a join this push REMOVED. Another join matching '${s.relatedEntity}' still exists, but nothing can say whether it is the one the column belonged to \u2014 re-attaching it there would silently change the data the column shows. Remove the column too, keep the join it came from, or point the column at the join you want by setting relatedEntity to that join's alias.`)))}function zN(e){let t=G5(e.columns);if(!WN(e.fetchBag)||!WN(e.layoutBag))return{fetchxml:t9({...e,columns:t}),layoutxml:r9({...e,columns:t},`${e.entityLogicalName}id`)};let r=new DOMParser().parseFromString("<root/>","text/xml"),n=HN(e.fetchBag,"fetch",r),i=HN(e.layoutBag,"grid",r),a=XN(i,n),o=!su(t,a),s=!su(e.sort,ZN(n)),l=!su(e.filters,eD(n)),u=e.linkEntities,c=u!==void 0&&!su(u,YN(n)),d=c?q5(n,a):void 0;return c&&Y5(r,n,u),c&&(e9(e,n,t,d),V5(e,n,t,d)),o?(jN(r,n,t,a),j5(r,i,t)):c&&jN(r,n,t,a),s&&K5(r,n,e.sort),l&&X5(r,n,e.filters),{fetchxml:(0,pi.serializeNode)(n),layoutxml:(0,pi.serializeNode)(i)}}function G5(e){return(e??[]).map((t,r)=>{var n,i;return{name:String(t.name).toLowerCase(),width:(n=t.width)!==null&&n!==void 0?n:KN,order:(i=t.order)!==null&&i!==void 0?i:r,...t.relatedEntity?{relatedEntity:t.relatedEntity}:{},...t.sourceAttribute?{sourceAttribute:String(t.sourceAttribute).toLowerCase()}:{}}})}function WN(e){return!!e&&(e.c.length>0||e.a.length>0)}function HN(e,t,r){let n={n:t,a:(0,Sf.mergeAttrs)(e.a,[]),c:(0,Sf.spliceChildren)(e.c,[])};return(0,Sf.rebuildRaw)(n,(0,pi.domEngine)(r),null)}function jN(e,t,r,n){var i,a;let o=t.getElementsByTagName("entity")[0];if(!o)return;let s=d=>{var p,f;return`${(p=d.relatedEntity)!==null&&p!==void 0?p:""}:${d.name}:${(f=d.sourceAttribute)!==null&&f!==void 0?f:d.name}`},l=new Set(r.map(s));for(let d of n)l.has(s(d))||z5(o,d);let u=Df(t),c=new Set(ot(o,"attribute").map(d=>d.getAttribute("name")).filter(d=>!!d));for(let d of[...r].sort((p,f)=>p.order-f.order))if(d.relatedEntity){let p=u.get(d.name);if(p&&p.attributeName===((i=d.sourceAttribute)!==null&&i!==void 0?i:d.name)&&(p.linkKey===d.relatedEntity||p.linkName===d.relatedEntity||!rD(o,d.relatedEntity)))continue;let f=W5(e,o,d.relatedEntity),h=e.createElement("attribute");tD(h,d),f.appendChild(h),u.set(d.name,{linkKey:d.relatedEntity,linkName:f.getAttribute("name")||d.relatedEntity,attributeName:(a=d.sourceAttribute)!==null&&a!==void 0?a:d.name,link:f})}else{if(c.has(d.name))continue;let p=e.createElement("attribute");p.setAttribute("name",d.name),H5(o,p),c.add(d.name)}}function tD(e,t){if(t.sourceAttribute&&t.sourceAttribute!==t.name){e.setAttribute("name",t.sourceAttribute),e.setAttribute("alias",t.name);return}e.setAttribute("name",t.name)}function z5(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 rD(e,t,r=!1){let n=a=>a.getAttribute("alias")===t||a.getAttribute("name")===t;for(let a of ot(e,"link-entity"))if(n(a))return a;if(r)return;let i=e.getElementsByTagName("link-entity");for(let a=0;a<i.length;a+=1)if(n(i[a]))return i[a]}function W5(e,t,r){let n=rD(t,r);if(n)return n;let i=e.createElement("link-entity");return i.setAttribute("name",r),t.appendChild(i),i}function H5(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 j5(e,t,r){let n=t.getElementsByTagName("row")[0];if(!n)return;let i=[...r].sort((s,l)=>s.order-l.order),a=J5(n);if(Q5(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 J5(e){return ot(e,"cell").filter(t=>!!t.getAttribute("name")&&t.getAttribute("ishidden")!=="1")}function Q5(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 K5(e,t,r){let n=t.getElementsByTagName("entity")[0];if(!n)return;let i=new Map;for(let a of ot(n,"order")){let o=(a.getAttribute("attribute")||"").toLowerCase();if(o){let s=i.get(o);s?s.push(a):i.set(o,[a])}n.removeChild(a)}for(let a of r){let o=i.get(String(a.attribute).toLowerCase()),s=o&&o.length>0?o.shift():void 0,l=s??e.createElement("order");l.setAttribute("attribute",a.attribute),l.setAttribute("descending",String(a.descending)),n.appendChild(l)}}function X5(e,t,r){let n=t.getElementsByTagName("entity")[0];if(n){for(let i of ot(n,"filter"))uu(i)||n.removeChild(i);(r.conditions.length>0||r.groups.length>0)&&n.appendChild(Zo(e,r))}}function su(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Y5(e,t,r){var n;let i=t.getElementsByTagName("entity")[0];if(!i)return;let a=ot(i,"link-entity").filter(h=>h.getAttribute("name")&&h.getAttribute("from")&&h.getAttribute("to")),o=(h,g)=>h.getAttribute(g)||"",s=new Array(r.length),l=new Set,u=h=>{r.forEach((g,w)=>{if(s[w])return;let S=a.filter(F=>!l.has(F)&&h(F,g));if(S.length!==1)return;let D=S[0];r.some((F,G)=>G!==w&&!s[G]&&h(D,F))||(s[w]=D,l.add(D))})};u((h,g)=>!!g.alias&&o(h,"name")===g.name&&o(h,"alias")===g.alias),u((h,g)=>o(h,"name")===g.name&&o(h,"from")===g.from&&o(h,"to")===g.to),u((h,g)=>o(h,"name")===g.name&&o(h,"from")===g.from),u((h,g)=>o(h,"name")===g.name&&o(h,"to")===g.to),u((h,g)=>o(h,"name")===g.name);let c=r.map((h,g)=>g).filter(h=>!s[h]),d=a.filter(h=>!l.has(h)),p=new Map;for(let h of d){let g=p.get(o(h,"name"));g?g.push(h):p.set(o(h,"name"),[h])}let f=new Map;for(let h of c){let g=f.get(r[h].name);g?g.push(h):f.set(r[h].name,[h])}for(let[h,g]of f){let w=(n=p.get(h))!==null&&n!==void 0?n:[];w.length===g.length&&g.forEach((S,D)=>{s[S]=w[D],l.add(w[D])})}r.forEach((h,g)=>{let w=s[g];if(w){JN(e,w,h);return}let S=e.createElement("link-entity");JN(e,S,h),i.appendChild(S)});for(let h of a)l.has(h)||i.removeChild(h)}var Z5=new Set(["inner","outer"]);function e9(e,t,r,n){if(!t.getElementsByTagName("entity")[0])return;let a=new Set,o=t.getElementsByTagName("link-entity");for(let c=0;c<o.length;c+=1){let d=o[c],p=d.getAttribute("name"),f=d.getAttribute("alias");p&&a.add(p),f&&a.add(f)}let s=new Set;for(let c=0;c<o.length;c+=1)s.add(o[c]);let l=c=>{let d=n?.get(_f(c));return!!d&&d.every(p=>s.has(p))},u=r.filter(c=>c.relatedEntity&&!a.has(c.relatedEntity)&&!l(c));if(u.length!==0)throw new QN.ValidationError("view",e.id,u.map(c=>{var d;let p=((d=e.linkEntities)!==null&&d!==void 0?d:[]).some(f=>f.name===c.relatedEntity||f.alias===c.relatedEntity);return(0,Lt.issue)(`/columns/${r.indexOf(c)}`,"view-column-dangling-link",`column '${c.name}' has relatedEntity '${c.relatedEntity}', but no matching join remains in linkEntities. `+(p?"Remove the column too, or keep the join.":"That join is NESTED (a join off a join), which the typed layer does not model, so it cannot be re-declared in linkEntities \u2014 it only survives while the join above it does. Remove the column, or restore the parent join this push replaced."))}))}function JN(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):Z5.has(t.getAttribute("link-type")||"")&&t.removeAttribute("link-type");let n=ot(t,"filter").find(a=>!uu(a)),i=r.filters&&(r.filters.conditions.length>0||r.filters.groups.length>0)?Zo(e,r.filters):null;n&&i?t.replaceChild(i,n):n?t.removeChild(n):i&&t.appendChild(i)}function t9(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);for(let l of[o.alias||o.name,o.name])a.has(l)||a.set(l,s)}for(let o of[...e.columns].sort((s,l)=>s.order-l.order)){let s=r.createElement("attribute");if(o.relatedEntity){tD(s,o);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 s.setAttribute("name",o.name),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.entityname&&i.setAttribute("entityname",n.entityname),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 r9(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 n9(){return{adapter:new lu,api:L5.viewApi,publish:(e,t,r)=>(0,GN.publishBoundEntity)(e,r),publishScope:(e,t)=>(0,GN.boundEntityPublishScope)(t)}}Aa.viewRegistration=n9});function cu(e,t){return e==="SetFieldValue"&&t!==void 0&&i9.has(t.attributeType)&&(t.requiredLevel==="None"||t.requiredLevel==="Recommended")}var i9,Tf=I(()=>{"use strict";i9=new Set(["Integer","Double","Decimal","Money","String","Memo","DateTime","Picklist","Lookup"])});function iD(e){return e!=="Entity"&&e!=="AllForms"&&typeof e=="string"&&e.trim()!==""}function Pf(e){return iD(e)?1:2}function Of(e){return iD(e)?e:void 0}function aD(e,t){let r=Of(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:Ca.WorkflowCategory.BusinessRule,type:Ca.WorkflowTypeCode.Definition,mode:1,scope:Ca.WorkflowScope.Organization,primaryentity:e.entityLogicalName,iscrmuiworkflow:!0,processtriggerscope:Pf(e.scope),...r!==void 0?{processtriggerformid:r}:{}}}var Ca,oD=I(()=>{"use strict";Ca=ne(Wn());});function sD(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,lD=I(()=>{Ze=[];for(let e=0;e<256;++e)Ze.push((e+256).toString(16).slice(1))});function Rf(){return du>pu.length-16&&((0,uD.randomFillSync)(pu),du=0),pu.slice(du,du+=16)}var uD,pu,du,cD=I(()=>{uD=require("crypto"),pu=new Uint8Array(256),du=pu.length});var dD,Ff,pD=I(()=>{dD=require("crypto"),Ff={randomUUID:dD.randomUUID}});function a9(e,t,r){if(Ff.randomUUID&&!t&&!e)return Ff.randomUUID();e=e||{};let n=e.random??e.rng?.()??Rf();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 sD(n)}var mt,fD=I(()=>{pD();cD();lD();mt=a9});var xf=I(()=>{fD()});var mD=I(()=>{"use strict";});var Lf=v(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.WorkflowConditionOperator=jt.WorkflowAttributeType=jt.SystemStep=jt.FieldRequiredLevelTypes=jt.AttributeDateTimeBehavior=void 0;jt.AttributeDateTimeBehavior={None:0,Dynamic:1,DateOnly:2,StaticTimeZoneInvariant:3,UserLocal:4};jt.FieldRequiredLevelTypes={None:"0",Required:"1",Recommended:"2"};jt.SystemStep={IdentifyContact:"IdentifyContact",IdentifyAccount:"IdentifyAccount",IdentifyCustomer:"IdentifyCustomer",IdentifyCase:"IdentifyCase",Solution:"Solution",Resolve:"Resolve"};jt.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"};jt.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 yD(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 ND(e){return e&&e!==ye.WorkflowAttributeType.String?e:void 0}function l9(e){return{__class:ED,parameterName:"primaryEntity",entityName:e}}function hD(e){return{__class:Mf,type:kf,typeSet:!1,behavior:ye.AttributeDateTimeBehavior.None,method:bD,parameters:[e]}}function gD(e,t,r=ye.WorkflowAttributeType.String){return{__class:AD,type:r,behavior:ye.AttributeDateTimeBehavior.None,typeSet:!1,entity:l9(t),attributeName:e}}function u9(e,t=ye.WorkflowAttributeType.String){return{__class:CD,type:t,behavior:ye.AttributeDateTimeBehavior.None,typeSet:!1,primitiveValue:e}}function c9(e){return{__class:SD,type:kf,typeSet:!1,behavior:ye.AttributeDateTimeBehavior.None,days:e,hours:"0",minutes:"0",months:"0",years:"0"}}function DD(e,t){let r=o9[e.operator],n=hD(gD(e.leftField,t,e.leftWorkflowType)),i;e.dateArithmetic?i=c9(e.right.value??"0"):e.right.kind==="field"?i=gD(e.right.field??"",t,e.right.workflowType):i=u9(e.right.value??"",e.right.workflowType??e.leftWorkflowType);let a=hD(i);return{__class:Mf,type:kf,typeSet:!1,behavior:ye.AttributeDateTimeBehavior.None,method:wD,parameters:[r,n,a]}}function ID(e){return typeof e=="object"&&e.__class===Mf}function d9(e){return typeof e=="object"&&e.__class===SD}function fu(e){return ID(e)&&e.method===bD&&e.parameters.length>0?fu(e.parameters[0]):e}function vD(e){if(typeof e!="object"||e.__class!==AD)return null;let t=e.entity;if(t&&t.__class&&t.__class!==ED)return null;let r=e.attributeName;return r?{field:r,workflowType:ND(e.type)}:null}function _D(e){if(!e)return null;let t=fu(e);if(!ID(t)||t.method!==wD||t.parameters.length!==3)return null;let r=t.parameters[0],n=s9[String(r)];if(!n)return null;let i=vD(fu(t.parameters[1]));if(!i)return null;let a=fu(t.parameters[2]);if(d9(a))return n!=="+"&&n!=="-"?null:{leftField:i.field,leftWorkflowType:i.workflowType,operator:n,right:{kind:"value",value:String(a.days??"")},dateArithmetic:!0};let o=vD(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===CD){let s=a.primitiveValue;return{leftField:i.field,leftWorkflowType:i.workflowType,operator:n,right:{kind:"value",value:s!=null?String(s):"",workflowType:ND(a.type)}}}return null}function Uf(e){let t=(e??"").trim();if(!/^\d+$/.test(t))return!1;let r=Number(t);return Number.isSafeInteger(r)&&r>=Bf&&r<=Sa}function fi(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&&!Uf(t)?"invalidDayCount":null}function Ea(e){return fi(e)===null}var ye,bD,wD,kf,AD,CD,Mf,SD,ED,o9,s9,Bf,Sa,es=I(()=>{"use strict";ye=ne(Lf());bD="0",wD="3",kf="0",AD="EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions",CD="PrimitiveExpression:#Microsoft.Crm.Workflow.Expressions",Mf="MethodCallExpression:#Microsoft.Crm.Workflow.Expressions",SD="TimeSpanExpression:#Microsoft.Crm.Workflow.Expressions",ED="PrimaryEntity:#Microsoft.Crm.Workflow.Expressions";o9={"+":0,"-":1,"*":2,"/":3},s9={0:"+",1:"-",2:"*",3:"/"};Bf=0,Sa=2147483647});function TD(e){return e.__class==="BinaryExpression:#Microsoft.Crm.Workflow.Expressions"}function p9(e){return e.__class==="ConditionBranchStep:#Microsoft.Crm.Workflow.ObjectModel"}function ts(){return{list:[]}}function PD(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 Gf(e){return{__class:"PrimaryEntity:#Microsoft.Crm.Workflow.Expressions",parameterName:"primaryEntity",entityName:e}}function zf(e,t,r){return{__class:"EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions",type:r,behavior:z.AttributeDateTimeBehavior.None,typeSet:!1,entity:Gf(t),attributeName:e}}function rs(e,t){return{__class:"PrimitiveExpression:#Microsoft.Crm.Workflow.Expressions",type:t,behavior:z.AttributeDateTimeBehavior.None,typeSet:!1,primitiveValue:e}}function MD(e){return{__class:"LookupExpression:#Microsoft.Crm.Workflow.Expressions",type:e.workflowType??z.WorkflowAttributeType.Lookup,behavior:z.AttributeDateTimeBehavior.None,typeSet:!1,entityType:e.entityType,label:e.label??"",staticValue:rs(e.id.replace(/[{}]/g,""),z.WorkflowAttributeType.UniqueIdentifier)}}function OD(e,t){let r=e.valueType==="Lookup"?e.lookupValue?.workflowType??z.WorkflowAttributeType.Lookup:e.valueWorkflowType??z.WorkflowAttributeType.String,n=Vf[e.operator]??z.WorkflowConditionOperator.Equal,i=zf(e.field,t,r),a;if(e.operator==="ContainsData"||e.operator==="DoesNotContainData")a=[];else if(e.valueType==="Field"&&e.valueField)a=[zf(e.valueField,t,r)];else if(e.valueType==="Lookup"){if(!e.lookupValue)throw new Error("Lookup condition is missing its record value.");a=[MD(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:z.WorkflowAttributeType.Boolean,behavior:z.AttributeDateTimeBehavior.None,typeSet:!1,conditionOperatoroperator:n,left:i,right:a}}function f9(e,t,r){if(e.length===0)return null;if(e.length===1)return OD(e[0],r);let n=t==="AND"?z.WorkflowConditionOperator.LogicalAnd:z.WorkflowConditionOperator.LogicalOr,[i,...a]=e.map(o=>OD(o,r));return{__class:"BinaryExpression:#Microsoft.Crm.Workflow.Expressions",type:z.WorkflowAttributeType.Boolean,behavior:z.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!==z.WorkflowAttributeType.Lookup?{workflowType:e.type}:{}}}}if(e.__class==="MethodCallExpression:#Microsoft.Crm.Workflow.Expressions"){let t=_D(e);return t?{valueType:"Expression",expression:t}:{valueType:"Expression",rawExpression:e}}return{valueType:"Value",value:""}}function $f(e){let t=kD[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 RD(e){if(!e||e.__class!=="BinaryExpression:#Microsoft.Crm.Workflow.Expressions")return{clauses:[],logic:"AND"};let t=e.conditionOperatoroperator;if(t===z.WorkflowConditionOperator.LogicalAnd||t===z.WorkflowConditionOperator.LogicalOr){let r=t===z.WorkflowConditionOperator.LogicalAnd?"AND":"OR";return{clauses:[...TD(e.left)?[$f(e.left)]:[],...e.right.filter(TD).map($f)],logic:r}}return{clauses:[$f(e)],logic:"AND"}}function hu(e,t,r,n,i,a,o,s){if(e==="Field"&&r)return zf(r,n,z.WorkflowAttributeType.String);if(e==="Expression"){if(i)return DD(i,n);if(a!=null)return a}return e==="Lookup"&&o?MD(o):e==="Clear"?rs(null,s??z.WorkflowAttributeType.String):rs(t??"",z.WorkflowAttributeType.String)}function qf(e,t){return{propertyName:e,propertyValueExpr:t}}function Na(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 FD(e,t,r){return e&&!r.used.has(e)?(r.used.add(e),e):Jt(t,r)}function m9(e){return e===LD.StateCode.Activated?"Active":"Draft"}function h9(e,t){let r=e.processtriggerscope,n=e.processtriggerformid;return r===1&&n?n:r===2?"Entity":t??"Entity"}function BD(e,t=1033){return new Da({languageCode:t}).serialize(e)}function UD(e){return new Da().deserialize(e)}var LD,z,Vf,kD,Wf,Da,Hf=I(()=>{"use strict";xf();LD=ne(Wn());mD();es();z=ne(Lf());Vf={Equals:z.WorkflowConditionOperator.Equal,DoesNotEqual:z.WorkflowConditionOperator.NotEqual,IsGreaterThan:z.WorkflowConditionOperator.GreaterThan,IsLessThan:z.WorkflowConditionOperator.LessThan,IsGreaterThanEqualTo:z.WorkflowConditionOperator.GreaterThanOrEqual,IsLessThanEqualTo:z.WorkflowConditionOperator.LessThanOrEqual,Contains:z.WorkflowConditionOperator.Contains,DoesNotContain:z.WorkflowConditionOperator.DoesNotContain,BeginsWith:z.WorkflowConditionOperator.BeginsWith,DoesNotBeginWith:z.WorkflowConditionOperator.DoesNotBeginWith,EndsWith:z.WorkflowConditionOperator.EndsWith,DoesNotEndWith:z.WorkflowConditionOperator.DoesNotEndWith,On:z.WorkflowConditionOperator.On,NotOn:z.WorkflowConditionOperator.NotOn,ContainsData:z.WorkflowConditionOperator.NotNull,DoesNotContainData:z.WorkflowConditionOperator.IsNull},kD={};for(let e of Object.keys(Vf))kD[Vf[e]]=e;Wf={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"};Da=class{resolveLabel;languageCode;entityName="";stepCounter={value:0};idCounter={counts:{},used:new Set};constructor(t={}){this.resolveLabel=t.resolveLabel??(r=>Wf[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??Na(this.stepCounter),stepLabels:{list:[]},specification:qf(t.field,hu(t.valueType,t.value,t.valueField,this.entityName,t.expression,t.rawExpression,t.lookupValue,t.valueWorkflowType)),entity:Gf(this.entityName)}}makeRecommendationActionStep(t,r,n){let i=r.map(l=>this.makeApplyActionStep(l)),a=t??"",o=n?.stepLabels,s=PD(o,a,this.languageCode);return{__class:"ActionStep:#Microsoft.Crm.Workflow.ObjectModel",id:FD(n?.id,"ActionStep",this.idCounter),name:n?.name??Na(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=Gf(this.entityName),n=t.stepName??Na(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:qf(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:qf(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?z.FieldRequiredLevelTypes.Required:z.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=PD(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??Na(this.stepCounter),n=Jt("ConditionStep",this.idCounter),i=[],a=t,o=!0;for(;a;){let s=f9(a.clauses,a.logic,this.entityName),l=o?a.branchName??Na(this.stepCounter):Na(this.stepCounter),c={__class:"ConditionBranchStep:#Microsoft.Crm.Workflow.ObjectModel",id:o?FD(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:h9(r,i?.formId),status:m9(t.statecode),rootCondition:n,wfomRoot:i}}deserializeConditionStep(t){let r=(t.steps?.list??[]).filter(p9);return this.buildConditionNodeFromBranches(r,t,!0)}buildConditionNodeFromBranches(t,r,n){let[i,...a]=t,{clauses:o,logic:s}=RD(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}=RD(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!==z.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 kn(e){return!g9.has(e)}function GD(e){return S9.has(e)}function gu(e){return qD.has(e)?v9:A9.has(e)?y9:VD.has(e)?b9:w9}function zD(e){return gu(e)[0]}function WD(e,t){return gu(t).includes(e)}function $D(e){return qD.has(e)?"string":e==="Money"?"money":e==="Integer"||e==="BigInt"?"integer":e==="Decimal"||e==="Double"?"decimal":VD.has(e)?"date":C9.has(e)?"boolean":"other"}function vu(e,t){let r=$D(e),n=$D(t);return r==="other"||n==="other"?e===t:r===n}var g9,v9,y9,b9,w9,qD,A9,VD,C9,S9,jf=I(()=>{"use strict";g9=new Set(["ContainsData","DoesNotContainData"]);v9=["Equals","DoesNotEqual","Contains","DoesNotContain","BeginsWith","DoesNotBeginWith","EndsWith","DoesNotEndWith","ContainsData","DoesNotContainData"],y9=["Equals","DoesNotEqual","IsGreaterThan","IsGreaterThanEqualTo","IsLessThan","IsLessThanEqualTo","ContainsData","DoesNotContainData"],b9=["On","NotOn","IsGreaterThan","IsGreaterThanEqualTo","IsLessThan","IsLessThanEqualTo","ContainsData","DoesNotContainData"],w9=["Equals","DoesNotEqual","ContainsData","DoesNotContainData"],qD=new Set(["String","Memo","EntityName"]),A9=new Set(["Integer","BigInt","Money","Decimal","Double"]),VD=new Set(["DateTime"]),C9=new Set(["Boolean"]),S9=new Set(["Equals","DoesNotEqual"])});function Xf(e){return E9.has(e.type)}function Jf(e,t,r,n,i,a,o){let s=i.get(r);!s||!N9.has(s.attributeType)||n!=="Value"||o?.operator&&!GD(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 Qf(e){return!!(e?.entityType?.trim()&&e.id?.trim())}function Kf(e,t,r){return{nodeId:e,kind:"INVALID_DAY_COUNT",message:`Please enter a whole number of days between 0 and ${Sa}.`,target:t,itemId:r,messageKey:"Validation.InvalidDayCount",messageParams:{max:Sa}}}function HD(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(Xf(t))return!0}else if(bu(t))return!0;return!1}function Yf(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=Yf(r,t);if(n)return n}}return null}function Ia(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=Ia(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=Ia(n,t);if(i)return i}}return null}function Zf(e,t){return{...e,trueBranch:jD(e.trueBranch,t),falseBranch:jD(e.falseBranch,t)}}function jD(e,t){return e.filter(r=>r.id!==t).map(r=>r.kind==="condition"?Zf(r,t):r)}function Mn(e,t,r){return e.id===t?r(e):{...e,trueBranch:e.trueBranch.map(n=>n.kind==="condition"?Mn(n,t,r):n),falseBranch:e.falseBranch.map(n=>n.kind==="condition"?Mn(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 JD(e,t,r,n){return Mn(e,t,i=>({...i,trueBranch:r==="true"?[...i.trueBranch,n]:i.trueBranch,falseBranch:r==="false"?[...i.falseBranch,n]:i.falseBranch}))}function em(e){return e.length===1&&e[0].kind==="condition"}function I9(e){let t=0,r=e??void 0;for(;r;){t+=1;let{falseBranch:n}=r;if(em(n)){r=n[0];continue}n.length>0&&(t+=1),r=void 0}return t}function _9(e){return!!e&&I9(e)<D9}function T9(e,t){if(!e)return;let r=(n,i)=>{if(n.id===t)return i;let a=[];if(em(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 QD(e,t,r){let n=T9(e,t);return!n||!_9(n)?e:Mn(e,t,i=>KD(i,r))}function KD(e,t){if(em(e.falseBranch))return{...e,falseBranch:[KD(e.falseBranch[0],t)]};let r=tm(t);return r.falseBranch=e.falseBranch,{...e,falseBranch:[r]}}function XD(e,t){let r=Ia(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 Mn(e,r.node.id,a=>({...a,falseBranch:i}))}function YD(e,t,r){let n=Ia(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 Mn(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 tm(e){return{kind:"condition",id:mt(),displayName:e??"New Condition",clauses:[],logic:"AND",trueBranch:[],falseBranch:[],isCollapsed:!1}}function ZD(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 e2(e){if(!e)return[];let t=[];return t2(e,t),[...new Set(t)]}function t2(e,t){e.clauses.forEach(r=>{r.field&&t.push(r.field)}),[...e.trueBranch,...e.falseBranch].forEach(r=>{r.kind==="condition"?t2(r,t):"field"in r&&r.field&&t.push(r.field)})}function r2(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 n2(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 n2(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?fi(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(kn(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(kn(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 kn(n.operator)&&n.valueType==="Expression"&&!n.rawExpression&&!Ea(n.expression)&&t.push(i==="invalidDayCount"?Kf(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"});kn(n.operator)&&n.valueType==="Lookup"&&(Qf(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"})),kn(n.operator)&&Jf(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")n2(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:fi(n.expression);!n.rawExpression&&!Ea(n.expression)&&t.push(i==="invalidDayCount"?Kf(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"&&!Qf(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&&(Jf(n.id,n.type,n.field,n.valueType,r,t,{target:"actionValue"}),HD(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:fi(a.expression);!a.rawExpression&&!Ea(a.expression)&&t.push(o==="invalidDayCount"?Kf(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"?Qf(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&&(Jf(n.id,"Recommendation",a.field,a.valueType,r,t,{target:"applyActionValue",itemId:a.id}),HD(n.id,"Recommendation","SetFieldValue",a.field,a.valueType,r,t,{target:"applyActionValue",itemId:a.id}))})}}})}var E9,N9,D9,rm=I(()=>{"use strict";xf();Tf();jf();es();E9=new Set(["LockUnlock","ShowErrorMessage","SetFieldValue","SetDefaultValue","SetBusinessRequired","SetVisibility"]);N9=new Set(["Lookup","Customer","Owner"]);D9=10});var i2={};Ur(i2,{DAY_COUNT_MAX:()=>Sa,DAY_COUNT_MIN:()=>Bf,DEFAULT_DESERIALIZE_LABELS:()=>Wf,WorkflowJsonMapper:()=>Da,addElseIfInTree:()=>QD,appendToBranch:()=>JD,areFieldKindsCompatible:()=>vu,attributeTypeToWorkflowType:()=>yD,buildWorkflowEntity:()=>aD,collectUsedFields:()=>e2,createEmptyAction:()=>ZD,createEmptyCondition:()=>tm,deserializeWorkflowJson:()=>UD,findNode:()=>Yf,findParent:()=>Ia,getDefaultOperatorForFieldType:()=>zD,getExpressionModelIssue:()=>fi,getOperatorsForFieldType:()=>gu,hasAnyTriggerGeneratingAction:()=>bu,isDayCountValid:()=>Uf,isExpressionModelComplete:()=>Ea,isOperatorCompatible:()=>WD,isTriggerGeneratingAction:()=>Xf,moveBranchItemInTree:()=>YD,operatorNeedsValue:()=>kn,processTriggerFormIdFromScope:()=>Of,processTriggerScopeFromScope:()=>Pf,removeElseIfInTree:()=>XD,removeNodeFromTree:()=>Zf,serializeToWorkflowJson:()=>BD,supportsClearForActionType:()=>cu,updateActionInTree:()=>yu,updateConditionInTree:()=>Mn,validateBusinessRule:()=>r2});var a2=I(()=>{"use strict";Tf();oD();Hf();Hf();rm();rm();jf();es();es();});var nm=v(wu=>{"use strict";Object.defineProperty(wu,"__esModule",{value:!0});wu.cloneJson=void 0;function P9(e){return JSON.parse(JSON.stringify(e))}wu.cloneJson=P9});var g2=v(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.BUSINESS_RULE_NULL_GUID=Bn.businessRuleRegistration=Bn.BusinessRuleAdapter=void 0;var o2=ct(),ns=(a2(),mr(i2)),s2=rr(),l2=re(),O9=nm(),Tr=_r(),R9=Ic(),F9=ct();function x9(e){return p2((0,O9.cloneJson)(e))}function p2(e){var t,r;let n=i=>(i??[]).map(a=>L9(a)?p2(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 L9(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 k9(e){var t;if(e===null||typeof e!="object"||Array.isArray(e))throw new l2.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 l2.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 M9="00000000-0000-0000-0000-000000000000";Bn.BUSINESS_RULE_NULL_GUID=M9;var B9=new Set(["Recommendation","LockUnlock","ShowErrorMessage","SetFieldValue","SetDefaultValue","SetBusinessRequired","SetVisibility"]),U9=["ruleId","name","description","entityLogicalName","scope","status","rootCondition"],$9=["kind","id","displayName","logic","clauses","trueBranch","falseBranch"],q9=["id","field","fieldDisplayName","operator","valueType","value","valueField","lookupValue","expression","rawExpression","valueWorkflowType"];function ur(e,t){return e===void 0?t:{...e,...t}}var mi=["kind","id","type","displayName","field","stepName","stepLabels"],u2=["valueType","valueWorkflowType","value","valueField","lookupValue","expression","rawExpression"],V9={Recommendation:[...mi,"recommendationTitle","messageText","acceptanceText","applyActions","recommendationActionStepMeta"],LockUnlock:[...mi,"lock"],ShowErrorMessage:[...mi,"errorMessage","messageLevel","messageActionSteps"],SetFieldValue:[...mi,...u2],SetDefaultValue:[...mi,...u2],SetBusinessRequired:[...mi,"required"],SetVisibility:[...mi,"visible"]};function j(e,t){return t===void 0?{}:{[e]:t}}function f2(e){var t;return e===void 0?void 0:{...e,label:(t=e.label)!==null&&t!==void 0?t:""}}function im(e){return{valueType:e.valueType,...j("valueWorkflowType",e.valueWorkflowType),...j("value",e.value),...j("valueField",e.valueField),...j("lookupValue",f2(e.lookupValue)),...j("expression",e.expression),...j("rawExpression",e.rawExpression)}}function m2(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 G9=["id","field","valueType","valueWorkflowType","value","valueField","lookupValue","expression","rawExpression","stepName","displayName"];function z9(e){return ur(e.bag,{id:e.id,field:e.field,...im(e),...j("stepName",e.stepName),...j("displayName",e.displayName)})}function W9(e){let t=m2(e,G9);return{id:e.id,field:e.field,valueType:e.valueType,...j("valueWorkflowType",e.valueWorkflowType),...j("value",e.value),...j("valueField",e.valueField),...j("lookupValue",e.lookupValue),...j("expression",e.expression),...j("rawExpression",e.rawExpression),...j("stepName",e.stepName),...j("displayName",e.displayName),...j("bag",t)}}function c2(e){return{valueType:e.valueType,...j("valueWorkflowType",e.valueWorkflowType),...j("value",e.value),...j("valueField",e.valueField),...j("lookupValue",e.lookupValue),...j("expression",e.expression),...j("rawExpression",e.rawExpression)}}function d2(e){throw new Error(`Unsupported business-rule action type: ${e.type}`)}var H9=new Set(["INVALID_CLEAR_FOR_FIELD","INVALID_VALUE_TYPE_FOR_FIELD","CLAUSE_VALUE_TOO_LONG","ACTION_VALUE_TOO_LONG"]),j9=new Set,J9="INVALID_CLEAR_FOR_FIELD";function Q9(e){let t=n=>{var i;return(0,Tr.isJsonObject)(n)&&(n.label===""||n.label===void 0)?{...n,label:String((i=n.id)!==null&&i!==void 0?i:"")}:n},r=n=>{if(!(0,Tr.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,U9),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,o2.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(x9(k9(t.rootCondition)))},u=this.toArtifact(l);return u.id||(u.id=(0,o2.newId)()),u}assignMissingIds(t){return(0,F9.assignMissingIds)(t)}validate(t){let r=[],n=t.rootCondition;return n==null?r:(0,Tr.isJsonObject)(n)?(h2(n,"/rootCondition",r),r):(r.push((0,Tr.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,Tr.issue)("/rootCondition","rule-not-representable",o instanceof Error?o.message:String(o))]}let i=n.rootCondition===null?null:Q9(n.rootCondition),a;return r.length===0?a=H9:r.some(o=>o.requiredLevel!==void 0)?a=j9:a=new Set([J9]),(0,ns.validateBusinessRule)(i,r).filter(o=>!a.has(o.kind)).map(o=>(0,Tr.issue)(`/rootCondition (${o.nodeId})`,`business-rule-${o.kind}`,o.message))}issuesBlockingPush(t,r=[],n){return this.semanticIssues(t,r)}residualBag(t,r){return m2(t,r)}buildWorkflowEntity(t,r){return(0,ns.buildWorkflowEntity)(t,r)}conditionToJson(t){let r=this.residualBag(t,$9),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,q9),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,V9[t.type]),n={kind:"action",id:t.id,displayName:t.displayName,field:t.field,...j("stepName",t.stepName),...j("stepLabels",t.stepLabels),...j("bag",r)};switch(t.type){case"Recommendation":return{...n,type:"Recommendation",recommendationTitle:t.recommendationTitle,messageText:t.messageText,...j("acceptanceText",t.acceptanceText),applyActions:t.applyActions.map(W9),...j("recommendationActionStepMeta",t.recommendationActionStepMeta)};case"LockUnlock":return{...n,type:"LockUnlock",lock:t.lock};case"ShowErrorMessage":return{...n,type:"ShowErrorMessage",errorMessage:t.errorMessage,...j("messageLevel",t.messageLevel),...j("messageActionSteps",t.messageActionSteps)};case"SetFieldValue":return{...n,type:"SetFieldValue",...c2(t)};case"SetDefaultValue":return{...n,type:"SetDefaultValue",...c2(t)};case"SetBusinessRequired":return{...n,type:"SetBusinessRequired",required:t.required};case"SetVisibility":return{...n,type:"SetVisibility",visible:t.visible};default:return d2(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,...j("value",t.value),...j("valueField",t.valueField),...j("lookupValue",f2(t.lookupValue)),...j("expression",t.expression),...j("rawExpression",t.rawExpression),...j("valueWorkflowType",t.valueWorkflowType)})}branchItemFromJson(t){return this.isConditionJson(t)?this.conditionFromJson(t):this.actionFromJson(t)}actionFromJson(t){if(!B9.has(t.type))throw new Error(`Unsupported business-rule action type: ${t.type}`);X9(t);let r={kind:"action",id:t.id,displayName:t.displayName,field:t.field,...j("stepName",t.stepName),...j("stepLabels",t.stepLabels)};switch(t.type){case"Recommendation":return ur(t.bag,{...r,type:"Recommendation",recommendationTitle:t.recommendationTitle,messageText:t.messageText,...j("acceptanceText",t.acceptanceText),applyActions:t.applyActions.map(z9),...j("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,...j("messageLevel",t.messageLevel),...j("messageActionSteps",t.messageActionSteps)});case"SetFieldValue":return ur(t.bag,{...r,type:"SetFieldValue",...im(t)});case"SetDefaultValue":return ur(t.bag,{...r,type:"SetDefaultValue",...im(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 d2(t)}}isConditionJson(t){return Object.prototype.hasOwnProperty.call(t,"clauses")&&Object.prototype.hasOwnProperty.call(t,"logic")&&!Object.prototype.hasOwnProperty.call(t,"type")}};Bn.BusinessRuleAdapter=Au;function h2(e,t,r){(0,Tr.optionalEnum)(e,"logic",["AND","OR"],t,"condition-logic-invalid",r),(0,Tr.childObjects)(e,"clauses",t,"clause",r);for(let n of["trueBranch","falseBranch"])(0,Tr.childObjects)(e,n,t,"branchItem",r).forEach(({node:a,index:o})=>{"clauses"in a||"trueBranch"in a||"falseBranch"in a?h2(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,Tr.issue)(`${t}/valueType`,"clear-only-set-field-value","Clear is only supported for SetFieldValue actions."))}function X9(e){if(e.type==="SetDefaultValue"&&e.valueType==="Clear")throw new Error("Clear is only supported for SetFieldValue actions.")}function Y9(){return{adapter:new Au,api:R9.businessRuleApi,publish:(e,t,r)=>(0,s2.publishBoundEntity)(e,r),publishScope:(e,t)=>(0,s2.boundEntityPublishScope)(t)}}Bn.businessRuleRegistration=Y9});var R2=v(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.appRegistration=Un.AppAdapter=Un.HEADER_NAV_BOOLEAN_RULE=void 0;var tn=_r(),We=bn(),as=Qn(),Z9=rr(),e8=sl(),am=rl(),om=An(),t8=ct(),r8=ie(),D2=Ei(),I2=re(),_2=il();Object.defineProperty(Un,"HEADER_NAV_BOOLEAN_RULE",{enumerable:!0,get:function(){return _2.HEADER_NAV_BOOLEAN_RULE}});var Nu="7.0.0.0",v2=`<SiteMap IntroducedVersion="${Nu}"></SiteMap>`,y2="/_imgs/imagestrips/transparent_spacer.gif",b2="/_imgs/TableIconsFluentV9/document_one_page_sparkle.svg",n8=["Entity","Url","DefaultDashboard","Page","GenPageId"],is="sitemapId",w2="sitemapName",i8="sitemapNameUnique",A2="aiDescription",C2="[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}",a8=new RegExp(`^(?:\\{${C2}\\}|${C2})$`);function S2(e,t){if(!a8.test(e.trim()))throw new I2.ValidationError("app",t,[{pointer:"/sitemapId",rule:"app-sitemapid-guid",message:`sitemapId must be a GUID; received '${e}'.`}]);return e.trim()}function E2(e,t,r){if(e===void 0)return r;if(typeof e!="boolean")throw new I2.ValidationError("app",t,[T2(e)]);return e}function T2(e){return(0,tn.issue)("/headerAndNavigationRefresh",_2.HEADER_NAV_BOOLEAN_RULE,`headerAndNavigationRefresh must be a boolean, got ${typeof e}`)}function o8(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,r8.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=D2.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,We.emptyBag)()}}fromArtifact(t){(0,om.installDomShim)();let r=this.assignMissingIds(JSON.parse(JSON.stringify(t))),n=new DOMParser().parseFromString("<root/>","text/xml"),i=this.rootToRaw(r);return(0,We.rebuildRaw)(i,(0,as.domEngine)(n),null)}fromApiResponse(t){var r,n,i,a,o,s,l,u,c,d,p;(0,om.installDomShim)();let f=t??{},h=(r=f.$sitemap)!==null&&r!==void 0?r:f,g=(0,as.parseXmlRoot)((n=h.sitemapxml)!==null&&n!==void 0?n:v2,v2),w=this.toArtifact(g);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:""],[w2,(c=h.sitemapname)!==null&&c!==void 0?c:""],[i8,(d=h.sitemapnameunique)!==null&&d!==void 0?d:""],[A2,(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,g;(0,om.installDomShim)();let w=(0,as.serializeNode)(this.fromArtifact(t)),S=[],D=[];for(let F of(n=(r=t.siteMap)===null||r===void 0?void 0:r.areas)!==null&&n!==void 0?n:[])for(let G of(i=F.groups)!==null&&i!==void 0?i:[])for(let L of(a=G.subAreas)!==null&&a!==void 0?a:[])L.type==="Entity"&&L.entity?S.push(L.entity):L.type==="DashBoard"&&L.dashboardId&&D.push(L.dashboardId);let x=(o=t.bag)!==null&&o!==void 0?o:(0,We.emptyBag)();return{sitemapId:lm(x,is)||(t.sitemapId?S2(t.sitemapId,t.id):""),sitemapxml:w,sitemapname:lm(x,w2)||t.name,appModuleId:t.id,appModuleName:t.name,appModuleDescription:t.description,...t.aiDescription!==void 0&&t.aiDescription!==lm(x,A2)?{appModuleAiDescription:t.aiDescription}:{},appModuleUniqueName:t.uniqueName,...t.iconWebResourceId?{iconWebResourceId:t.iconWebResourceId}:{},...t.headerAndNavigationRefresh===void 0?{}:{appSettings:{[am.HEADER_AND_NAVIGATION_REFRESH]:E2(t.headerAndNavigationRefresh,(s=t.id)!==null&&s!==void 0?s:"(unknown)",!0)?am.APP_SETTING_ON:am.APP_SETTING_OFF}},...typeof t.published=="boolean"?{published:t.published}:{},entities:S,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:[...(g=(h=t.components)===null||h===void 0?void 0:h.dashboards)!==null&&g!==void 0?g:[],...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,t8.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:S2(t.sitemapId,u)}:{},...t.iconWebResourceId?{iconWebResourceId:t.iconWebResourceId}:{},headerAndNavigationRefresh:E2(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(cm):Array.isArray(r.areas)?r.areas.forEach(cm):Array.isArray(r.groups)?cm(r):Array.isArray(r.subAreas)?O2(r):"type"in r&&Iu(r,"subarea"),t}validate(t){let r=[],n=t.published;n!==void 0&&typeof n!="boolean"&&r.push((0,tn.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(T2(a)),i==null)return r;if(!(0,tn.isJsonObject)(i))return r.push((0,tn.issue)("/siteMap","sitemap-must-be-object",`siteMap must be a JSON object, got ${typeof i}`)),r;let o=(0,tn.childObjects)(i,"areas","/siteMap","area",r),s=new Map;return o.forEach(({node:l,index:u})=>{let c=`/siteMap/areas/${u}`;(0,tn.childObjects)(l,"groups",c,"group",r).forEach(({node:p,index:f})=>{let h=`${c}/groups/${f}`;(0,tn.childObjects)(p,"subAreas",h,"subArea",r).forEach(({node:w,index:S})=>{let D=`${h}/subAreas/${S}`;(0,tn.optionalEnum)(w,"type",["Entity","URL","DashBoard","CustomPage","GenPage"],D,"subarea-type-invalid",r);let x=o8(w);if(!x)return;let F=s.get(x);if(F===void 0){s.set(x,D);return}r.push((0,tn.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,We.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:sm(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:sm(t,this.lcid),subAreas:i.map(a=>this.subAreaToJson(a)),bag:n}}subAreaToJson(t){var r;let{bag:n}=Cu(t,null),i=s8(t),a={id:(r=t.getAttribute("Id"))!==null&&r!==void 0?r:"",type:i,title:sm(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!==y2&&(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,We.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,We.mergeAttrs)(o.a,l),c:(0,We.spliceChildren)(o.c,u)}}areaToRaw(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:(0,We.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=um((0,We.spliceChildren)(n.c,s),t.title,i,this.lcid);return{n:"Area",a:(0,We.mergeAttrs)(n.a,a,o),c:l}}groupToRaw(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:(0,We.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=um((0,We.spliceChildren)(n.c,o),t.title,i,this.lcid);return{n:"Group",a:(0,We.mergeAttrs)(n.a,a),c:s}}subAreaToRaw(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:(0,We.emptyBag)(),i=Su(n),a=u8(n.a,t.type),o=[],s=[];t.id&&o.push(["Id",t.id]),d8(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",y2)&&s.push("Icon"),t.vectorIcon!==void 0?o.push(["VectorIcon",t.vectorIcon]):Eu(a,"VectorIcon")?t.type==="GenPage"?o.push(["VectorIcon",b2]):s.push("VectorIcon"):t.type==="GenPage"&&!l8(a,"VectorIcon")&&o.push(["VectorIcon",b2]);let l=um((0,We.spliceChildren)(n.c,[]),t.title,i,this.lcid);return{n:"SubArea",a:(0,We.mergeAttrs)(a,o,s),c:l}}};Un.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,We.rawFromNode)((0,as.nodeLikeFromDom)(l))}),o+=1)}return{bag:{a:r,c:n},modeledEls:i}}function N2(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 sm(e,t){var r;let n=N2(e,"Titles")[0];if(!n)return"";let a=N2(n,"Title").find(o=>o.getAttribute("LCID")===String(t));return a&&(r=a.getAttribute("Title"))!==null&&r!==void 0?r:""}function s8(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 l8(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 lm(e,t){let r=e.a.find(([n])=>n===t);return r?r[1]:void 0}function u8(e,t){let r=c8(t);return e.filter(([n])=>!n8.includes(n)||r.has(n)).map(n=>[n[0],n[1]])}function c8(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 d8(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 um(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]=p8(e[i],t,n),a}return r?[f8(t,n),...e]:e}function p8(e,t,r){let n=!1,i=e.c.map(a=>!n&&a.n==="Title"&&m8(a,"LCID")===String(r)?(n=!0,{n:a.n,a:(0,We.mergeAttrs)(a.a,[["Title",t]]),c:a.c}):a);return n||i.unshift(P2(t,r)),{n:e.n,a:e.a.map(a=>[a[0],a[1]]),c:i}}function f8(e,t){return{n:"Titles",a:[],c:[P2(e,t)]}}function P2(e,t){return{n:"Title",a:[["LCID",String(t)],["Title",e]],c:[]}}function m8(e,t){let r=e.a.find(([n])=>n===t);return r?r[1]:void 0}function h8(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}_${h8(8)}`)}function cm(e){var t;Iu(e,"area");for(let r of(t=e.groups)!==null&&t!==void 0?t:[])O2(r)}function O2(e){var t;Iu(e,"group");for(let r of(t=e.subAreas)!==null&&t!==void 0?t:[])Iu(r,"subarea")}function g8(e=D2.DEFAULT_LCID){return{adapter:new Du(e),api:e8.appApi,languageSensitive:!0,publish:(t,r)=>(0,Z9.publishAppModule)(t,r),publishScope:t=>({envelope:"appmodule",targetIds:[t]})}}Un.appRegistration=g8});var F2={};Ur(F2,{ActionType:()=>pm,AppActionOrigin:()=>wm,AppActionVisibilityType:()=>bm,ButtonType:()=>mm,CannotUpdateAppActionColumns:()=>v8,Context:()=>gm,IconType:()=>fm,Location:()=>hm,OnClickEventType:()=>ym,Scope:()=>vm,VisibilityType:()=>dm});var dm,pm,fm,mm,hm,gm,vm,ym,bm,wm,v8,x2=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"})(dm||(dm={}));(function(e){e[e.NotSupported=0]="NotSupported",e[e.None=1]="None",e[e.JavaScript=2]="JavaScript",e[e.Expression=3]="Expression"})(pm||(pm={}));(function(e){e[e.NoIcon=0]="NoIcon",e[e.UseIcon=1]="UseIcon",e[e.UseWebResource=2]="UseWebResource"})(fm||(fm={}));(function(e){e[e.Standard=0]="Standard",e[e.Dropdown=1]="Dropdown",e[e.Split=2]="Split",e[e.Group=3]="Group"})(mm||(mm={}));(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"})(hm||(hm={}));(function(e){e[e.All=0]="All",e[e.Entity=1]="Entity"})(gm||(gm={}));(function(e){e[e.App=0]="App",e[e.Entity=1]="Entity",e[e.Global=2]="Global"})(vm||(vm={}));(function(e){e[e.None=0]="None",e[e.Formula=1]="Formula",e[e.JavaScript=2]="JavaScript"})(ym||(ym={}));(function(e){e[e.None=0]="None",e[e.Formula=1]="Formula",e[e.ClassicRules=2]="ClassicRules"})(bm||(bm={}));(function(e){e[e.Default=0]="Default",e[e.Migrated=1]="Migrated",e[e.MigratedClone=2]="MigratedClone"})(wm||(wm={}));v8=["appactionid","appmoduleid","context","contextvalue","location","name","type","uniquename","isdisabled","origin"]});var B2=v(Tu=>{"use strict";Object.defineProperty(Tu,"__esModule",{value:!0});Tu.commandApi=void 0;var L2=$t(),cr=be(),M2=re(),Qt=ie(),y8="OnClickEventJavaScriptWebResourceId($select=name,webresourceid),IconWebResourceId($select=name,webresourceid)";async function _u(e,t){let r=`/EntityDefinitions(LogicalName='${(0,Qt.odataPathLiteral)(t)}')${(0,Qt.odataQuery)([["$select","MetadataId"]])}`,i=(0,cr.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){let r=t,n=await _u(e,r),i=n?`_contextentity_value eq ${n}`:`contextvalue eq '${(0,Qt.odataLiteral)(r)}'`,a=`/appactions${(0,Qt.odataQuery)([["$expand",y8],["$filter",i]])}`,o,s=await(0,L2.collectPages)(e,a,"fetchArtifact('command')",c=>{o=c}),l={entityLogicalName:r,entityMetadataId:n,appActions:s},u={};for(let c of s){let d=typeof c.appactionid=="string"?c.appactionid:void 0;if(d){let p=c["@odata.etag"];u[(0,Qt.normalizeGuid)(d,"appactionid")]=typeof p=="string"?p:null}}return{raw:l,etag:o?(0,cr.readEtag)(o):null,memberEtags:u}},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 k2(e,{...r,entityMetadataId:n},!1)},async update(e,t,r,n,i){let a=r,o=a.entityMetadataId||await _u(e,a.entityLogicalName);return k2(e,{...a,entityMetadataId:o},!0,i)},async delete(e,t){let r=await _u(e,t),n=r?`_contextentity_value eq ${r}`:`contextvalue eq '${(0,Qt.odataLiteral)(t)}'`,i=`/appactions${(0,Qt.odataQuery)([["$select","appactionid"],["$filter",n]])}`,a=await(0,L2.collectPages)(e,i,"deleteArtifact('command')");for(let o of a)o.appactionid&&await(0,cr.deleteRecord)(e,"appactions",o.appactionid)}};async function k2(e,t,r,n){let i=t.entityMetadataId?(0,Qt.normalizeGuid)(t.entityMetadataId,"entityMetadataId"):"",a=w8(t.rows),o={};try{await b8(e,t,a,i,r,n,o)}catch(s){throw(0,M2.withPartialTokens)(s,{memberEtags:o})}return{id:t.entityLogicalName,etag:null,memberEtags:o}}async function b8(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,cr.echoWrite)("appactionid",p?{"If-Match":p}:void 0),h=`/appactions(${d})${f.query}`,g=(0,cr.ensureSuccess)(await e.patch(h,c.body,f.options),e.apiUrl(h));o[d]=(0,cr.readEtag)(g)}else{let d=(0,cr.echoWrite)("appactionid"),p=`/appactions${d.query}`,f={...c.body};if(f["[email protected]"]===void 0){if(!n)throw new M2.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,cr.ensureSuccess)(await e.post(p,f,d.options),e.apiUrl(p)),g=(0,cr.readCreatedId)(h,"appactionid");g&&(o[(0,Qt.normalizeGuid)(g,"appactionid")]=(0,cr.readEtag)(h))}for(let c of[...(l=t.deletedRowIds)!==null&&l!==void 0?l:[]].reverse()){let d=(0,Qt.normalizeGuid)(c,"id");await(0,cr.deleteRecord)(e,"appactions",d,(u=a?.[d])!==null&&u!==void 0?u:void 0),delete o[d]}}function w8(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 Z2=v(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});_a.commandRegistration=_a.CommandAdapter=void 0;var Be=(x2(),mr(F2)),U2=rr(),Kt=_r(),A8=B2(),q2=ct(),Ta=ie(),Cm="$ClientSvg:",Sm=".svg",C8=2,S8=1,E8=1,V2="entityMetadataId",N8=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:"",g=(i=c.get(h))!==null&&i!==void 0?i:[];g.push(f),c.set(h,g)}let d=new Map;for(let f of(a=c.get(""))!==null&&a!==void 0?a:[]){let h=P8(f.location),g=(o=d.get(h))!==null&&o!==void 0?o:[];g.push(f),d.set(h,g)}let p=[];for(let[f,h]of d)p.push({location:f,groups:I8(h,c,j2(f),u)});return{id:u,entityLogicalName:u,commandBars:T8(p),bag:{a:[[V2,(s=t.entityMetadataId)!==null&&s!==void 0?s:""]]}}}fromArtifact(t){return{entityLogicalName:t.entityLogicalName,entityMetadataId:Nm(t),appActions:Am(t).map(r=>r.row)}}fromApiResponse(t){return this.toArtifact(t??{})}toApiPayload(t,r){let n=new Set(r?Am(r).map(l=>l.appactionid):[]),i=Am(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?V8(l.row):Y2(l.row)}}),s=[...n].filter(l=>!a.has(l));return{entityLogicalName:t.entityLogicalName,entityMetadataId:Nm(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,q2.assignMissingIds)(t)}validate(t){let r=[];return(0,Kt.childObjects)(t,"commandBars","","commandBar",r).forEach(({node:i,index:a})=>{let o=`/commandBars/${a}`;(0,Kt.optionalEnum)(i,"location",["MainTab","ContextualTab","HomeTab"],o,"bar-location-invalid",r),(0,Kt.childObjects)(i,"groups",o,"group",r).forEach(({node:l,index:u})=>{let c=`${o}/groups/${u}`;(0,Kt.optionalGuidId)(l,"id",c,"group-id-invalid",r),G2((0,Kt.childObjects)(l,"controls",c,"control",r),`${c}/controls`,r)})}),r}};_a.CommandAdapter=Pu;function G2(e,t,r){e.forEach(({node:n,index:i})=>{let a=`${t}/${i}`;(0,Kt.optionalGuidId)(n,"id",a,"control-id-invalid",r),(0,Kt.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,Kt.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,Kt.isJsonObject)(n.action)?(0,Kt.optionalEnum)(n.action,"type",["javascript"],`${a}/action`,"action-type-invalid",r):r.push((0,Kt.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,Kt.childObjects)(n,"children",a,"control",r);s.length>0&&G2(s,`${a}/children`,r)})}function z2(e){return{a:Object.entries(e)}}function D8(e){return Object.fromEntries(e.a)}function Em(e,t){if(e){for(let[r,n]of e.a)if(r===t)return n}}function Nm(e){let t=Em(e.bag,V2);return typeof t=="string"?t:""}function I8(e,t,r,n){var i,a;let o=[],s=[];for(let l of Ru(e))l.type===Be.ButtonType.Group?o.push({id:H2(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:z2(l)}):s.push(Ou(l,t,r,n));return s.length>0&&o.unshift({id:(0,q2.newId)(),title:"",controls:s}),o}function Ou(e,t,r,n){var i,a,o,s;let l=H2(e.name,n),u={id:l,type:O8(e.type),label:typeof e.buttonlabeltext=="string"?e.buttonlabeltext:"",command:typeof e.appactionid=="string"?e.appactionid:l,bag:z2(e)},c=W2(e);c&&(u.icon=c);let d=_8(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===Be.ButtonType.Group){u.flyoutGroupId=(a=h.appactionid)!==null&&a!==void 0?a:void 0;for(let g of Ru((s=t.get((o=h.appactionid)!==null&&o!==void 0?o:""))!==null&&s!==void 0?s:[]))f.push(Ou(g,t,r,n))}else f.push(Ou(h,t,r,n));u.children=f}return u}function W2(e){var t;if(!((t=e.IconWebResourceId)===null||t===void 0)&&t.name)return e.IconWebResourceId.name;if(e.fonticon)return e.fonticon.startsWith(Cm)?e.fonticon.slice(Cm.length)+Sm:e.fonticon}function _8(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 $2(e){return typeof e.sequence=="number"?e.sequence:typeof e.buttonsequencepriority=="number"?e.buttonsequencepriority:0}function Ru(e){return[...e].sort((t,r)=>$2(t)-$2(r))}function T8(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 H2(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 P8(e){switch(e){case Be.Location.Form:case Be.Location.QuickForm:return"MainTab";case Be.Location.HomePageGrid:case Be.Location.Dashboard:return"HomeTab";default:return"ContextualTab"}}function j2(e){switch(e){case"MainTab":return Be.Location.Form;case"HomeTab":return Be.Location.HomePageGrid;default:return Be.Location.SubGridStandard}}function O8(e){switch(e){case Be.ButtonType.Dropdown:return"FlyoutAnchor";case Be.ButtonType.Split:return"SplitButton";default:return"Button"}}function R8(e){switch(e){case"FlyoutAnchor":return Be.ButtonType.Dropdown;case"SplitButton":return Be.ButtonType.Split;default:return Be.ButtonType.Standard}}function F8(e){var t;return e.bag&&e.bag.a.length>0?!0:((t=e.title)!==null&&t!==void 0?t:"").length>0}function J2(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 Am(e,t=new Set){var r,n,i,a;let o=[],s=Nm(e);for(let l of(r=e.commandBars)!==null&&r!==void 0?r:[]){let u=j2(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=>!J2(f,t)),p=0;for(let f of(i=l.groups)!==null&&i!==void 0?i:[]){let h;if(F8(f)){let g=L8(f,u,void 0,e,s);o.push(g),h=g.appactionid}for(let g of(a=f.controls)!==null&&a!==void 0?a:[])Q2(g,u,h,e,s,o,d?p:void 0,t),p+=1}}return o}function Q2(e,t,r,n,i,a,o,s=new Set){var l;let u=x8(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||q8(u.appactionid);a.push(k8(d,t,u.appactionid,n,i));let p=c.every(f=>!J2(f,s));for(let[f,h]of c.entries())Q2(h,t,d,n,i,a,p?f:void 0,s)}function x8(e,t,r,n,i,a){let o=K2(e,t,r,n,i),s=o.row;a!==void 0&&typeof s.sequence!="number"&&(s.sequence=a);let l=W2(s);return e.location!==void 0&&(s.location=e.location),s.type=R8(e.type),s.buttonlabeltext=e.label,M8(s,e.icon,l),U8(s,e.action),B8(s),e.hidden!==void 0&&(s.hidden=e.hidden),e.disabled!==void 0&&(s.isdisabled=e.disabled),{...o,row:s}}function L8(e,t,r,n,i){let a=K2(e,t,r,n,i);return a.row.type=Be.ButtonType.Group,a.row.grouptitle=e.title,a}function k8(e,t,r,n,i){let a=X2(e,t,n,i);return a["[email protected]"]=`/appactions(${(0,Ta.normalizeGuid)(r,"Command flyout group id")})`,a.type=Be.ButtonType.Group,a.grouptitle===void 0&&(a.grouptitle=""),a.isgrouptitlehidden=!0,{appactionid:e,exists:!1,etag:null,row:a}}function K2(e,t,r,n,i){let a,o,s,l;if(e.bag&&e.bag.a.length>0){a=D8(e.bag),o=!0;let u=Em(e.bag,"@odata.etag");s=typeof u=="string"?u:null;let c=Em(e.bag,"appactionid");l=typeof c=="string"&&c?c:e.id}else l=e.id,a=X2(l,t,n,i),o=!1,s=null;return r&&(a["[email protected]"]=`/appactions(${(0,Ta.normalizeGuid)(r,"Command parent appaction id")})`),{appactionid:l,exists:o,etag:s,row:a}}function X2(e,t,r,n){let i={appactionid:e,name:`${e}!${e.replace(/-/g,"").slice(0,32)}`,uniquename:"",location:t,context:Be.Context.Entity,contextvalue:r.entityLogicalName,scope:Be.Scope.Entity};return n&&(i["[email protected]"]=`/entities(${(0,Ta.normalizeGuid)(n,"Command context entity metadata id")})`),i}function M8(e,t,r){if(t===r){let n=e._iconwebresourceid_value;typeof n=="string"&&n&&!e.fonticon&&(e["[email protected]"]=`/webresourceset(${(0,Ta.normalizeGuid)(n,"Command icon web resource id")})`);return}if(t===void 0){e.fonticon="",e.IconWebResourceId=null;return}e.fonticon=t.toLowerCase().endsWith(Sm)?Cm+t.slice(0,t.length-Sm.length):t,e.IconWebResourceId=null}function B8(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,Ta.normalizeGuid)(a,`Command ${i}`);e[`${i}@odata.bind`]=`/canvasapps(${o})`};e.onclickeventtype===S8&&t("_onclickeventformulacomponentlibraryid_value","OnClickEventFormulaComponentLibraryId");let r=e.visibilitytype;(!r||r===E8)&&t("_visibilityformulacomponentlibraryid_value","VisibilityFormulaComponentLibraryId")}function U8(e,t){if(!(!t||t.type!=="javascript")){if(e.onclickeventtype=C8,t.webResourceId){let r=(0,Ta.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 $8(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 q8(e){let t="";for(let r=0;r<4;r+=1)t+=$8(`${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 Y2(e){let t={...e};for(let r of N8)delete t[r];return t}function V8(e){let t=Y2(e);for(let r of Be.CannotUpdateAppActionColumns)delete t[r];return t}function G8(){return{adapter:new Pu,api:A8.commandApi,publish:(e,t,r)=>(0,U2.publishBoundEntity)(e,r),publishScope:(e,t)=>(0,U2.boundEntityPublishScope)(t)}}_a.commandRegistration=G8});var eI=v(Fu=>{"use strict";Object.defineProperty(Fu,"__esModule",{value:!0});Fu.chartApi=void 0;var z8=$t(),Xt=be(),os=ie(),W8="savedqueryvisualizationid,name,description,primaryentitytypecode,datadescription,presentationdescription,charttype,type,isdefault",H8="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",W8]]),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=`/savedqueryvisualizations${(0,os.odataQuery)([["$select",H8],["$filter",t?.entityLogicalName?`primaryentitytypecode eq '${(0,os.odataLiteral)(t.entityLogicalName)}'`:void 0]])}`;return(await(0,z8.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,Xt.echoWrite)("savedqueryvisualizationid"),a=`/savedqueryvisualizations${i.query}`,o=(0,Xt.ensureSuccess)(await e.post(a,(0,Xt.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,Xt.resolveCreatedId)(o,"savedqueryvisualizationid","chart",r),etag:(0,Xt.readEtag)(o)}},async update(e,t,r,n){let i=r,a=(0,os.normalizeGuid)(t,"id"),o=(0,Xt.echoWrite)("savedqueryvisualizationid",{"If-Match":(0,Xt.requireEtag)(n,"chart",a)}),s=`/savedqueryvisualizations(${a})${o.query}`,l=(0,Xt.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,Xt.readEtag)(l)}},delete(e,t){return(0,Xt.deleteRecord)(e,"savedqueryvisualizations",t)}}});var gI=v(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});Pa.chartRegistration=Pa.ChartAdapter=void 0;var Dm=bn(),tI=_r(),rn=Qn(),rI=rr(),j8=eI(),Im=An(),J8=ct(),Q8=["Column","StackedColumn","StackedColumn100","Bar","StackedBar","StackedBar100","Area","StackedArea","StackedArea100","Line","Pie","Doughnut","Funnel","Tag"],K8=new Map(Q8.map(e=>[e.toLowerCase(),e]));function oI(e){var t;return e&&(t=K8.get(e.toLowerCase()))!==null&&t!==void 0?t:"Column"}function X8(){return'<Chart Palette="BrightPastel"><Series><Series ChartType="Column" ChartArea="Default" /></Series><ChartAreas><ChartArea Name="Default" /></ChartAreas><Legends><Legend Name="Default" /></Legends></Chart>'}function Y8(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,Im.installDomShim)();let u=(r=t.datadescription)!==null&&r!==void 0?r:"",c=(n=t.presentationdescription)!==null&&n!==void 0?n:"",d=(0,rn.parseXmlRoot)(u,"<datadefinition/>"),p=(0,rn.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:sI(p),isDefault:(l=t.isdefault)!==null&&l!==void 0?l:!1,series:cI(d),categories:dI(d),presentation:lI(p),dataBag:u?(0,rn.projectElementBag)(d):void 0,presentationBag:c?(0,rn.projectElementBag)(p):void 0,rowBag:Z8(t.charttype,t.type)}}fromArtifact(t){(0,Im.installDomShim)();let{datadescription:r,presentationdescription:n}=eG(t);return{savedqueryvisualizationid:t.id,name:t.name,description:t.description,primaryentitytypecode:t.entityLogicalName,datadescription:r,presentationdescription:n,charttype:nI(t.rowBag,"charttype"),type:nI(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,Im.installDomShim)();let u=(r=t.entityLogicalName)!==null&&r!==void 0?r:"";return{id:(n=t.id)!==null&&n!==void 0?n:(0,J8.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,tI.childObjects)(n,"series","","series",r),(0,tI.childObjects)(n,"categories","","category",r),r}};Pa.ChartAdapter=xu;function Z8(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 nI(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 sI(e){let t=e.getElementsByTagName("Series");for(let r=0;r<t.length;r+=1)if(t[r].getAttribute("ChartType"))return oI(t[r].getAttribute("ChartType"));return"Column"}function lI(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 uI(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 cI(e){let t=Lu(e);if(!t)return[];let r=uI(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=oI(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 dI(e){var t;let r=Lu(e);if(!r)return[];let n=uI(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 eG(e){if(!iI(e.dataBag)||!iI(e.presentationBag))return{datadescription:Y8(e),presentationdescription:wG(e)};let t=new DOMParser().parseFromString("<root/>","text/xml"),r=aI(e.dataBag,"datadefinition",t),n=aI(e.presentationBag,"Chart",t);return _m(e.series,cI(r))||(rG(t,r,e.series),tG(t,n,e.series.length,e.chartType)),_m(e.categories,dI(r))||nG(t,r,e.categories),e.chartType!==sI(n)&&mI(n,e.chartType),_m(e.presentation,lI(n))||hI(n,e.presentation),{datadescription:(0,rn.serializeNode)(r),presentationdescription:(0,rn.serializeNode)(n)}}function iI(e){return!!e&&(e.c.length>0||e.a.length>0)}function tG(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 aI(e,t,r){let n={n:t,a:(0,Dm.mergeAttrs)(e.a,[]),c:(0,Dm.spliceChildren)(e.c,[])};return(0,Dm.rebuildRaw)(n,(0,rn.domEngine)(r),null)}function rG(e,t,r){let n=Lu(t),i=n?.getElementsByTagName("entity")[0];!n||!i||pI(e,t,i,cG(n),r,pG,{aliasPrefix:"aggregate_column",addRef:oG,removeRef:uG})}function nG(e,t,r){let n=Lu(t),i=n?.getElementsByTagName("entity")[0];!n||!i||pI(e,t,i,dG(n),r,fG,{aliasPrefix:"groupby_column",addRef:sG,removeRef:lG})}function pI(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||aG(t,o.aliasPrefix);f.setAttribute("alias",h),a(f,p),mG(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),gG(p)}}function iG(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 aG(e,t){let r=iG(e);if(!r.has(t))return t;for(let n=2;;n+=1){let i=`${t}_${n}`;if(!r.has(i))return i}}function fI(e,t){let r=t.getElementsByTagName("categorycollection")[0];if(r)return r;let n=e.createElement("categorycollection");return t.appendChild(n),n}function oG(e,t,r){let n=fI(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 sG(e,t,r){let n=fI(e,t),i=e.createElement("category");i.setAttribute("alias",r),n.appendChild(i)}function lG(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 uG(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"&&!yG(o)&&((r=o.parentNode)===null||r===void 0||r.removeChild(o))}}function cG(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 dG(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 pG(e,t){e.setAttribute("name",t.attribute),e.setAttribute("aggregate",t.aggregate),t.seriesType&&e.setAttribute("charttype",t.seriesType)}function fG(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 mG(e,t,r,n){n?hG(e,t,n).appendChild(r):t.appendChild(r)}function hG(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 gG(e){let t=e.parentNode;if(t&&(t.removeChild(e),t.tagName==="link-entity"&&!vG(t))){let r=t.parentNode;r&&r.removeChild(t)}}function vG(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 yG(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(!bG(r[i])){r[i].setAttribute("ChartType",t);return}}}function bG(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 hI(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 wG(e){let t=(0,rn.parseXmlRoot)(X8(),"<Chart/>");return mI(t,e.chartType),hI(t,e.presentation),(0,rn.serializeNode)(t)}function _m(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 AG(){return{adapter:new xu,api:j8.chartApi,publish:(e,t,r)=>(0,rI.publishBoundEntity)(e,r),publishScope:(e,t)=>(0,rI.boundEntityPublishScope)(t)}}Pa.chartRegistration=AG});var vI=v(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.dashboardApi=void 0;var CG=$t(),Yt=be(),ls=ie(),SG="formid,name,description,formxml,type,objecttypecode,istabletenabled,iscustomizable,componentstate,versionnumber",EG="formid,name,type,objecttypecode",NG=0,DG=10;ku.dashboardApi={async get(e,t){let n=`/systemforms(${(0,ls.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,ls.odataQuery)([["$select",SG]]),i=(0,Yt.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,Yt.readEtag)(i)}},async list(e,t){let r=[`(type eq ${NG} or type eq ${DG})`];t?.entityLogicalName&&r.push(`objecttypecode eq '${(0,ls.odataLiteral)(t.entityLogicalName)}'`);let n=`/systemforms${(0,ls.odataQuery)([["$select",EG],["$filter",r.join(" and ")]])}`;return(await(0,CG.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,Yt.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,Yt.ensureSuccess)(await e.post(a,(0,Yt.withClientMintedId)(o,"formid",r),i.options),e.apiUrl(a));return{id:(0,Yt.resolveCreatedId)(s,"formid","dashboard",r),etag:(0,Yt.readEtag)(s)}},async update(e,t,r,n){let i=r,a=(0,ls.normalizeGuid)(t,"id"),o=(0,Yt.echoWrite)("formid",{"If-Match":(0,Yt.requireEtag)(n,"dashboard",a)}),s=`/systemforms(${a})${o.query}`,l=(0,Yt.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,Yt.readEtag)(l)}},delete(e,t){return(0,Yt.deleteRecord)(e,"systemforms",t)}}});var TI=v(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.dashboardRegistration=Pr.TILE_CLASS_ID=Pr.DashboardAdapter=void 0;var cs=bn(),Zt=Qn(),Tm=rr(),us=_r(),IG=vI(),Pm=An(),hi=ct(),SI=ie(),EI=Ei(),yI="0",Om="10",_G=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"]]),TG="{3FF9A528-DD50-4ACA-8F10-2E5ED73513AD}",Bu=class{constructor(t=EI.DEFAULT_LCID){this.lcid=t}toArtifact(t){var r,n,i,a;(0,Pm.installDomShim)();let o=(r=t.formxml)!==null&&r!==void 0?r:"",s=(0,Zt.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:PG(t.type),entityLogicalName:t.objecttypecode?t.objecttypecode:null,enabledForMobile:!!t.istabletenabled,layoutType:OG(s),components:bI(s,this.lcid),bag:(0,Zt.projectElementBag)(s)}}fromArtifact(t){var r;return(0,Pm.installDomShim)(),{formid:t.id,name:t.name,description:t.description,type:t.dashboardType==="Interactive"?Om:yI,objecttypecode:(r=t.entityLogicalName)!==null&&r!==void 0?r:"",istabletenabled:t.enabledForMobile,formxml:wI(t,this.lcid)}}fromApiResponse(t){return this.toArtifact(t??{})}toApiPayload(t){return{name:t.name,description:t.description,formxml:wI(t,this.lcid),istabletenabled:t.enabledForMobile,type:t.dashboardType==="Interactive"?Om:yI,objecttypecode:t.entityLogicalName}}createDefault(t){var r,n,i,a,o,s,l,u;(0,Pm.installDomShim)();let c=(0,Zt.parseXmlRoot)(zG(),"<form/>");return{id:(r=t.id)!==null&&r!==void 0?r:(0,hi.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:bI(c,this.lcid),bag:(0,Zt.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,hi.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}};Pr.DashboardAdapter=Bu;function PG(e){return String(e??"")===Om?"Interactive":"Standard"}function OG(e){let t=e?.getAttribute("formLayout")||e?.getAttribute("layoutType"),r=parseInt(t??"",10);return Number.isNaN(r)?0:r}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 bI(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)=>{RG(c,{tabIndex:a,columnIndex:l,sectionIndex:d},r,t)})})}),r}function RG(e,t,r,n){K(e,"rows").flatMap(a=>K(a,"row")).forEach((a,o)=>{K(a,"cell").forEach((s,l)=>{let u=FG(s,{...t,rowIndex:o,cellIndex:l},n);u&&r.push(u)})})}function FG(e,t,r){var n,i;let a=II((n=e.getAttribute("id"))!==null&&n!==void 0?n:"");if(a.toLowerCase().startsWith("spacer"))return null;let o=K(e,"control")[0];if(!o)return null;let s=(i=o.getAttribute("classid"))!==null&&i!==void 0?i:"",l=kG(o),u=MG(s,l,o),c=xG(o);return{id:o.getAttribute("id")||a,type:u,name:DI(e,r),classId:s,position:t,colspan:Rm(e,"colspan",1),rowspan:Rm(e,"rowspan",1),parameters:l,bag:(0,Zt.projectElementBag)(e),...c?{icProperties:c}:{}}}function NI(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 xG(e){let t=NI(e);return t?(0,Zt.serializeNode)(t):void 0}function LG(e,t,r){let n=NI(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,Zt.nodeLikeFromDom)(i)),(0,Zt.domEngine)(e),null);n&&(0,Zt.serializeNode)(n)===(0,Zt.serializeNode)(a)||(n?t.replaceChild(a,n):t.appendChild(a))}function DI(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 kG(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 MG(e,t,r){var n;let i=_G.get(e.toUpperCase());return i?i==="chart"?t.ChartGridMode==="Chart"?"chart":"list":i==="assistant"&&((n=r.getAttribute("uniqueid"))!==null&&n!==void 0?n:"").toUpperCase()===TG?"assistant":i:"unknown"}function Rm(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 II(e){return e.replace(/^\{/,"").replace(/\}$/,"")}function BG(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,Zt.domEngine)(t),null)}function wI(e,t){let r=new DOMParser().parseFromString("<root/>","text/xml"),n=BG(e,r);return qG(r,n,e.components,t),UG(r,n,e.components,t),(0,Zt.serializeNode)(n)}function UG(e,t,r,n){let i=_I(t);for(let a of r)i.has(ds(a.position))||$G(e,t,a,n)}function $G(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=WG(t,e,l);for(let W of K(u,"row"))K(W,"cell").some(B=>K(B,"control").length>0)||u.removeChild(W);let c=r.classId||Pr.TILE_CLASS_ID[r.type]||Pr.TILE_CLASS_ID.iframe,d=r.rowspan&&r.rowspan>0?r.rowspan:4,p=r.bag&&AI(r.bag,"id")?String(AI(r.bag,"id")):Mu((0,hi.newId)()),f=r.id?Mu(r.id):Mu((0,hi.newId)()),h=u.parentNode,g=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),g),S=K(u,"row"),D=S[S.length-1],x=D?K(D,"cell").reduce((W,B)=>W+Rm(B,"colspan",1),0):0;(!D||x+w>g)&&(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 G=e.createElement("labels"),L=e.createElement("label");L.setAttribute("description",(o=r.name)!==null&&o!==void 0?o:""),L.setAttribute("languagecode",String(n)),G.appendChild(L),F.appendChild(G);let q=e.createElement("control");q.setAttribute("id",f),q.setAttribute("classid",Mu(c));let U=e.createElement("parameters"),$=(s=r.parameters)!==null&&s!==void 0?s:{};for(let W of Object.keys($)){let B=(0,SI.createSafeXmlElement)(e,W,"dashboard tile parameter");B.textContent=$[W],U.appendChild(B)}q.appendChild(U),F.appendChild(q),D.appendChild(F)}function AI(e,t){if(!e)return;let r=e.a.find(n=>n[0]===t);return r?r[1]:void 0}function qG(e,t,r,n){var i;let a=_I(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&&(VG(e,l,s.name,n),GG(e,u,s.parameters),CI(l,"colspan",s.colspan),CI(l,"rowspan",s.rowspan),s.icProperties!==void 0&&LG(e,u,s.icProperties))}for(let[s,l]of a)o.has(s)||(i=l.parentNode)===null||i===void 0||i.removeChild(l)}function _I(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,g)=>{var w;II((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:g}),h)})})})})}),t}function ds(e){let t=e??{};return`${t.tabIndex}.${t.columnIndex}.${t.sectionIndex}.${t.rowIndex}.${t.cellIndex}`}function VG(e,t,r,n){if(r===DI(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 GG(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,SI.createSafeXmlElement)(e,l,"dashboard component parameter");d.textContent=u,a.appendChild(d)}}}function CI(e,t,r){var n;((n=e.getAttribute(t))!==null&&n!==void 0?n:"")!==String(r)&&e.setAttribute(t,String(r))}function zG(e=2){let t=`{${(0,hi.newId)()}}`,r=`{${(0,hi.newId)()}}`,n=`{${(0,hi.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>`}Pr.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 WG(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 HG(e=EI.DEFAULT_LCID){return{adapter:new Bu(e),api:IG.dashboardApi,languageSensitive:!0,publish:(t,r,n)=>n?.entityLogicalName?(0,Tm.publishBoundEntity)(t,n):(0,Tm.publishDashboardById)(t,r),publishScope:(t,r)=>r?.entityLogicalName?(0,Tm.boundEntityPublishScope)(r):{envelope:"dashboard",targetIds:[t]}}}Pr.dashboardRegistration=HG});var LI=v(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});qu.genPageApi=void 0;var xI=$t(),De=be(),Pt=ie(),Uu=md(),Or=re();function jG(e){let t=globalThis;return t.Buffer?t.Buffer.isBuffer(e):!1}var $n="uxagentprojects",Ra="uxagentprojectfiles",Oa="uxagentprojectid",Rr="uxagentprojectfileid",$u=`${Oa},name`,JG=`${Rr},filename,filetype`;async function Fm(e,t,r,n){var i;let a=`/${t}(${r})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Pt.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 QG(e,t){let r=`/${Ra}(${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||jG(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 Or.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 Or.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=`/${Ra}(${t})/filecontent`,a=(0,Uu.base64ToBytes)(n);(0,Pt.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 xm(e,t){let r=`/${Ra}/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()`+(0,Pt.odataQuery)([["$select",JG],["$filter",`_${Oa}_value eq ${t}`]]);return(await(0,xI.collectPages)(e,r,"fetchArtifact('genPage')")).map(i=>({row:i,etag:typeof i["@odata.etag"]=="string"?i["@odata.etag"]:null}))}async function PI(e,t,r){var n;let{etag:i}=await Fm(e,$n,t,$u),a={};for(let{row:l,etag:u}of await xm(e,t))a[(0,Pt.normalizeGuid)(String((n=l[Rr])!==null&&n!==void 0?n:""),Rr)]=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 OI(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,Pt.normalizeGuid)(t,"id"),{row:i,etag:a}=await Fm(e,$n,n,$u),o=await xm(e,n),s={},l=[];for(let{row:u,etag:c}of o){let d=(0,Pt.normalizeGuid)(String((r=u[Rr])!==null&&r!==void 0?r:""),Rr);s[d]=c;let p=await QG(e,d);l.push({...u,content:p})}return{raw:{project:i,files:l},etag:a,memberEtags:s}},async list(e,t){let r=`/${$n}/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()`+(0,Pt.odataQuery)([["$select",$u]]);return(await(0,xI.collectPages)(e,r,"listArtifacts('genPage')")).map(i=>{var a,o;return{type:"genPage",id:String((a=i[Oa])!==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;RI(e,n);let i=`/${$n}`,a=(0,De.ensureSuccess)(await e.post(i,(0,De.withClientMintedId)({name:n.name},Oa,r)),e.apiUrl(i)),o=(0,De.resolveCreatedId)(a,Oa,"generative page",r),s=new Set;for(let l of n.files){let u=await FI(e,o,l,!0);s.add((0,Pt.normalizeGuid)(u.id,"file id"))}try{return{id:o,...OI(o,await PI(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");RI(e,a);let s=await xm(e,o),{etag:l}=await Fm(e,$n,o,$u);if(n&&l&&n!==l)throw new Or.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 Or.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,Pt.normalizeGuid)(String((h=f[Rr])!==null&&h!==void 0?h:""),Rr)})),c=new Set(a.files.map(f=>(0,Pt.normalizeGuid)(f.id,"file id")));if(!i)throw new Or.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 Or.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 Or.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:g})=>{var w;return[(0,Pt.normalizeGuid)(String((w=h[Rr])!==null&&w!==void 0?w:""),Rr),g]}));for(let[h,g]of Object.entries(i??{})){let w=h.toLowerCase();if(!u.has(w))continue;let S=f.get(w);if(!g||!S)throw new Or.SdkError(De.VERSION_CONFLICT_CODE,`Cannot verify generative-page file '${w}' before writing: ${g?"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(g!==S)throw new Or.SdkError(De.VERSION_CONFLICT_CODE,`Generative-page file '${w}' changed on the server after this page was fetched (baseline ${g}, server ${S}) \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=`/${$n}(${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,Pt.normalizeGuid)(f.id,"file id");await FI(e,o,f,!u.has(h))}for(let f of u)c.has(f)||await(0,De.deleteRecord)(e,Ra,f);try{return{id:o,...OI(o,await PI(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,$n,t)}};function RI(e,t){var r;if(((r=t.files)!==null&&r!==void 0?r:[]).some(i=>i.content.status==="available")&&!e.supportsBinaryPatch)throw new Or.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 FI(e,t,r,n){let i=(0,Pt.normalizeGuid)(r.id,"file id"),a;if(n){let o=`/${Ra}`,s=(0,De.ensureSuccess)(await e.post(o,(0,De.withClientMintedId)({filename:r.name,filetype:r.fileType,[`${Oa}@odata.bind`]:`/${$n}(${t})`},Rr,i)),e.apiUrl(o));a=(0,De.readEtag)(s)}else{let o=`/${Ra}(${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 UI=v(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:!0});xa.genPageRegistration=xa.GenPageAdapter=void 0;var XG=LI(),YG=rr(),qn=_r(),BI=ct(),kI=2e8;function MI(e){return typeof e=="string"&&e.trim()!==""?e:(0,BI.newId)()}function Fa(e){return(0,qn.isJsonObject)(e)?e:{}}function ZG(e){let t=Fa(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=Fa(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=Fa(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:kI),content:ZG(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:MI(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:MI(i.id),name:(a=i.name)!==null&&a!==void 0?a:"index.tsx",fileType:(o=i.fileType)!==null&&o!==void 0?o:kI,content:(s=i.content)!==null&&s!==void 0?s:{status:"available",data:""}}})}}assignMissingIds(t){let r=Fa(t);return(typeof r.id!="string"||r.id.trim()==="")&&(r.id=(0,BI.newId)()),r}validate(t){let r=[],n=t.files;if(n!==void 0&&!Array.isArray(n))return r.push((0,qn.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=Fa(a),u=typeof l.id=="string"?l.id.trim().toLowerCase():"";if(u==="")r.push((0,qn.issue)(s,"file-id-required","a generative-page file needs an id"));else{let f=i.get(u);f!==void 0?r.push((0,qn.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,qn.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,qn.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=Fa(d);p.status==="available"?typeof p.data!="string"&&r.push((0,qn.issue)(s+"/content/data","file-content-data-invalid","available content needs base64 `data`")):p.status!=="unavailable"&&r.push((0,qn.issue)(s+"/content/status","file-content-status-invalid",`content.status must be 'available' or 'unavailable', got ${String(p.status)}`))}),r}};xa.GenPageAdapter=Vu;function e6(){return{adapter:new Vu,api:XG.genPageApi,publish:(e,t)=>(0,YG.publishGenPageById)(e,t),publishScope:e=>({envelope:"uxagentproject",targetIds:[e]})}}xa.genPageRegistration=e6});var qI=v(Wu=>{"use strict";Object.defineProperty(Wu,"__esModule",{value:!0});Wu.reconcileBpfSecurityRoles=void 0;var zu=be(),Gu=ie(),t6="Global",$I={create:"Create",read:"Read",write:"Write",delete:"Delete"};async function r6(e,t){var r,n;let i=`/EntityDefinitions(LogicalName='${(0,Gu.odataPathLiteral)(t)}')?$select=LogicalName,Privileges`,o=(n=(r=(0,zu.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($I).forEach(u=>{let c=o.find(d=>d.PrivilegeType===$I[u]);if(c){let d=(0,Gu.normalizeGuid)(c.PrivilegeId,"PrivilegeId");s[u]=d,l.add(d)}}),{byAccess:s,all:l}}async function n6(e,t){var r,n;let i=`/RetrieveRolePrivilegesRole(RoleId=${t})`,o=(n=(r=(0,zu.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,Gu.normalizeGuid)(s.PrivilegeId,"PrivilegeId")))}async function i6(e,t,r){if(r.length===0)return;let n={Privileges:r.map(a=>({Depth:t6,PrivilegeId:a}))},i=`/roles(${t})/Microsoft.Dynamics.CRM.AddPrivilegesRole`;(0,zu.ensureSuccess)(await e.post(i,n),e.apiUrl(i))}async function a6(e,t,r){let n={Privilege:{"@odata.type":"Microsoft.Dynamics.CRM.privilege",privilegeid:r}},i=`/roles(${t})/Microsoft.Dynamics.CRM.RemovePrivilegeRole`;(0,zu.ensureSuccess)(await e.post(i,n),e.apiUrl(i))}async function o6(e,t,r){var n;if(!r||r.length===0)return;let i=await r6(e,t.toLowerCase());for(let a of r){let o=(0,Gu.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 n6(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 i6(e,o,c);for(let p of d)await a6(e,o,p)}}Wu.reconcileBpfSecurityRoles=o6});var WI=v(ju=>{"use strict";Object.defineProperty(ju,"__esModule",{value:!0});ju.bpfApi=void 0;var Vn=Wn(),s6=$t(),kt=be(),Fr=ie(),l6=qI(),Hu={"Content-Type":"application/json",Accept:"application/json"},u6=`category eq ${Vn.WorkflowCategory.BusinessProcessFlow} and type eq ${Vn.WorkflowTypeCode.Definition} and businessprocesstype eq ${Vn.BusinessProcessType.BusinessFlow}`,c6="workflowid,name,description,primaryentity,statecode,category,type,businessprocesstype,processorder",d6="workflowid,name,uniquename,description,primaryentity,statecode,statuscode,category,type,businessprocesstype,processorder,xaml,clientdata",p6=["xaml","name","description","processorder"];async function VI(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,l6.reconcileBpfSecurityRoles)(e,n,t.securityRoles)}async function Lm(e,t,r){var n;if(r==="Draft")return null;let i=(0,Fr.normalizeGuid)(t,"workflowid"),a={statecode:Vn.StateCode.Activated,statuscode:Vn.StatusCode.Activated},o=`/workflows(${i})`,s=(0,kt.ensureSuccess)(await e.patch(o,a,{headers:Hu}),e.apiUrl(o));return(n=(0,kt.readEtag)(s))!==null&&n!==void 0?n:await km(e,i)}async function km(e,t){let r=`/workflows(${t})${(0,Fr.odataQuery)([["$select","workflowid"]])}`,n=await e.get(r);return n.status>=200&&n.status<300?(0,kt.readEtag)(n):null}async function f6(e,t){var r;let n=`/workflows(${t})${(0,Fr.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 GI(e,t,r){if(await f6(e,t)!==Vn.StateCode.Activated)return!1;let n={statecode:Vn.StateCode.Draft,statuscode:Vn.StatusCode.Draft},i=`/workflows(${t})`,a={...Hu};return r&&(a["If-Match"]=r),(0,kt.ensureSuccess)(await e.patch(i,n,{headers:a}),e.apiUrl(i)),!0}async function zI(e,t){try{await Lm(e,t,"Active")}catch{}}function m6(e){let t={};for(let r of p6)e[r]!==void 0&&(t[r]=e[r]);return t}ju.bpfApi={async get(e,t){let n=`/workflows(${(0,Fr.normalizeGuid)(t,"id")})${(0,Fr.odataQuery)([["$select",d6]])}`,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=[u6];t?.entityLogicalName&&r.push(`primaryentity eq '${(0,Fr.odataLiteral)(t.entityLogicalName)}'`);let n=`/workflows${(0,Fr.odataQuery)([["$select",c6],["$filter",r.join(" and ")]])}`;return(await(0,s6.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){var r;let n=t,i=(0,Fr.normalizeGuid)(n.record.workflowid,"workflowid"),a="/workflows",o=(0,kt.ensureSuccess)(await e.post(a,n.record,{headers:Hu}),e.apiUrl(a)),s=null;try{s=await Lm(e,i,n.status),await VI(e,n)}catch(u){try{await(0,kt.deleteRecord)(e,"workflows",i)}catch{}throw u}let l=(r=s??(0,kt.readEtag)(o))!==null&&r!==void 0?r:await km(e,i);return{id:i,etag:l}},async update(e,t,r,n){var i;let a=r,o=(0,Fr.normalizeGuid)(t,"id"),s=(0,kt.requireEtag)(n,"bpf",o),l=await GI(e,o,s);try{let u=`/workflows(${o})`,c={...Hu};l||(c["If-Match"]=s);let d=(0,kt.ensureSuccess)(await e.patch(u,m6(a.record),{headers:c}),e.apiUrl(u)),p=await Lm(e,o,a.status);return await VI(e,a),{id:o,etag:(i=p??(0,kt.readEtag)(d))!==null&&i!==void 0?i:await km(e,o)}}catch(u){throw l&&await zI(e,o),u}},async delete(e,t){let r=(0,Fr.normalizeGuid)(t,"id"),n=await GI(e,r,null);try{await(0,kt.deleteRecord)(e,"workflows",r)}catch(i){throw n&&await zI(e,r),i}}}});var __=v(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});ka.bpfRegistration=ka.BpfAdapter=void 0;var Ju=Wn(),h6=WI(),Mm=bn(),gi=Qn(),i_=An(),Mt=_r(),Ot=ct(),xr=re(),g6=100,Um='<?xml version="1.0" encoding="utf-16"?>',HI=1033,a_="mxswa:Workflow",v6="mxswa:ActivityReference.Properties",y6="mcwo:StepLabel",b6="mcwb:Control",jI="mcwb:Control.ControlDisplayName",o_="mcwb:Control.DataFieldName",s_="DataFieldName",JI="ControlDisplayName",l_="Literal",Qu="x:Null",QI="x:String",$m="x:Key",qm="DisplayName",Xu="Activities",w6="StepLabels",u_="StageId",c_="StageCategory",d_="NextStageId",p_="ProcessStepId",Vm="IsProcessRequired",f_="EntityComposite",m_="StageComposite",h_="StepComposite";function Bm(e){return(0,Mt.isJsonObject)(e)?e:{}}function Lr(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 vi(e,t){var r;return(r=Lr(e).find(n=>n.tagName===t))!==null&&r!==void 0?r:null}function kr(e){return vi(e,v6)}function ht(e,t){var r;return(r=Lr(e).find(n=>n.getAttribute($m)===t))!==null&&r!==void 0?r:null}function La(e,t){var r;return((r=e.getAttribute("AssemblyQualifiedName"))!==null&&r!==void 0?r:"").includes(t)}function an(e){var t;return!e||!e.firstChild?"":(t=e.firstChild.nodeValue)!==null&&t!==void 0?t:""}function g_(e,t,r){e.firstChild?e.firstChild.nodeValue=r:e.appendChild(t.createTextNode(r))}function ps(e){var t;let r=(t=e.getAttribute(qm))!==null&&t!==void 0?t:"",n=r.indexOf(": ");return n>=0?r.slice(n+2):r}function v_(e,t){var r;let n=(r=e.getAttribute(qm))!==null&&r!==void 0?r:"",i=n.indexOf(": ");e.setAttribute(qm,i>=0?n.slice(0,i+2)+t:t)}function y_(e,t){let r=ht(e,w6),n=vi(r,y6);n&&n.setAttribute("Description",t)}function A6(e){let t=ht(e,c_);if(!t||t.tagName===Qu)return;let r=an(t).trim();return r===""?void 0:Number(r)}function C6(e){let t=ht(e,d_);if(!t||t.tagName===Qu)return;let r=an(t).trim();return r===""?void 0:r}function b_(e){let t=w_(e);if(!t)return;let r=C_(t,s_,o_);return r===""?void 0:r}function Gm(e,t){let r=Lr(e);for(;r.length>0;){let n=r.pop();if(n.tagName===t)return n;for(let i of Lr(n))r.push(i)}return null}function w_(e){let t=ht(kr(e),Xu);return t?Gm(t,b6):null}function A_(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 C_(e,t,r){var n;return A_(e,t)?(n=e.getAttribute(t))!==null&&n!==void 0?n:"":I6(e,r)}function KI(e,t,r,n){if(A_(e,t)){e.setAttribute(t,n);return}if(vi(e,r)){S6(e,r,n);return}throw new xr.InvalidArgumentError(`BPF step control exposes neither a '${t}' attribute nor a <${r}> wrapper to bind a column`)}function S6(e,t,r){let n=vi(e,t),i=n?Gm(n,l_):null;i&&i.setAttribute("Value",r)}function S_(e){return ps(e)}function Yu(e){let t=vi(e,a_),r=[];for(let n of Lr(t).filter(i=>La(i,f_))){let i=ht(kr(n),Xu);for(let a of Lr(i).filter(o=>La(o,m_)))r.push({el:a,entity:S_(n)})}return r}function zm(e){let t=ht(kr(e),Xu);return Lr(t).filter(r=>La(r,h_))}function E6(e){let t=kr(e),r=an(ht(t,Vm)).trim().toLowerCase(),n=b_(e),i={id:an(ht(t,p_)),name:ps(e)};return n!==void 0&&(i.fieldName=n),r==="true"&&(i.required=!0),i}function N6(e,t){let r=kr(e),n=A6(r),i=C6(r),a={id:an(ht(r,u_)),name:ps(e),entityLogicalName:t,steps:zm(e).map(E6)};return n!==void 0&&(a.category=n),i!==void 0&&(a.nextStageId=i),a}function D6(e){return Yu(e).map(({el:t,entity:r})=>N6(t,r))}function nn(e){return new xr.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 I6(e,t){var r;let n=vi(e,t),i=n?Gm(n,l_):null;return(r=i?.getAttribute("Value"))!==null&&r!==void 0?r:""}function Wm(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(Wm(e,s)):s.nodeType===3&&n.appendChild(e.createTextNode((r=s.nodeValue)!==null&&r!==void 0?r:""))}return n}function E_(e){return ht(kr(e),Xu)}function _6(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,Ot.newId)(),{body:o}=Zu(Hm(i,(0,Ot.newId)(),t.id,a));return Wm(e,Yu((0,gi.parseXmlRoot)(o,"<Activity/>"))[0].el)}function T6(e,t){let{body:r}=Zu(Hm("account",(0,Ot.newId)(),(0,Ot.newId)(),t.id));return Wm(e,zm(Yu((0,gi.parseXmlRoot)(r,"<Activity/>"))[0].el)[0])}function N_(e,t){for(;e.firstChild;)e.removeChild(e.firstChild);for(let r of t)e.appendChild(r)}function D_(e,t,r,n){let i=ht(e,r);if(!i||!i.parentNode){if(n!==void 0&&n!=="")throw nn(`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($m,r),a.replaceChild(s,i)}return}if(i.tagName===QI){an(i)!==n&&g_(i,t,n);return}let o=t.createElement(QI);o.setAttribute($m,r),o.appendChild(t.createTextNode(n)),a.replaceChild(o,i)}function P6(e,t,r){D_(e,t,c_,r===void 0?void 0:String(r))}function O6(e,t,r){D_(e,t,d_,r)}function I_(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 XI(e){return an(ht(kr(e),u_))}function YI(e){return an(ht(kr(e),p_))}function ZI(e,t,r){var n,i,a,o;let s=kr(e);r.name!==ps(e)&&(v_(e,r.name),y_(s,r.name));let l=an(ht(s,Vm)).trim().toLowerCase()==="true";if(((n=r.required)!==null&&n!==void 0?n:!1)!==l){let u=ht(s,Vm);u&&g_(u,t,r.required?"True":"False")}if(((i=r.fieldName)!==null&&i!==void 0?i:"")!==((a=b_(e))!==null&&a!==void 0?a:"")){let u=w_(e);if(!u)throw new xr.InvalidArgumentError("BPF step has no <mcwb:Control> element to bind a column to");let c=(o=r.fieldName)!==null&&o!==void 0?o:"";KI(u,s_,o_,c),c!==""&&C_(u,JI,jI)===""&&KI(u,JI,jI,c)}}function e_(e,t,r,n){var i;let a=kr(e);if(!a)throw new xr.InvalidArgumentError("BPF stage composite has no <\u2026ActivityReference.Properties>");if(r.name!==ps(e)&&(v_(e,r.name),y_(a,r.name)),P6(a,t,r.category),O6(a,t,n),r.relationshipName&&r.relationshipName.trim()!=="")throw nn("a stage relationship / table change (multi-table authoring)");if(r.actions&&r.actions.length>0||r.branch)throw nn("stage actions or conditional branching");let o=E_(e);if(!o)throw new xr.InvalidArgumentError("BPF stage has no [Activities] collection");let s=(i=r.steps)!==null&&i!==void 0?i:[];if(s.length===0)throw new xr.InvalidArgumentError(`BPF stage '${r.name}' must have at least one step`);let l=zm(e);if(I_(l,s.map(d=>d.id),YI)){l.forEach((d,p)=>ZI(d,t,s[p]));return}let u=new Map(l.map(d=>[YI(d),d]));if(Lr(o).some(d=>!La(d,h_)))throw nn("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:T6(t,d)});N_(o,c),c.forEach((d,p)=>ZI(d,t,s[p]))}function R6(e,t,r){let n=vi(e,a_);if(!n)throw new xr.InvalidArgumentError("BPF xaml has no <mxswa:Workflow> root activity");if(r.globalActions&&r.globalActions.length>0)throw nn("global (process-completed/abandoned) actions");if(!r.stages||r.stages.length===0)throw new xr.InvalidArgumentError("a BPF must have at least one stage");let i=Yu(e),a=i.map(p=>p.el);if(I_(a,r.stages.map(p=>p.id),XI)){i.forEach(({el:p,entity:f},h)=>{let g=r.stages[h];if(g.entityLogicalName&&g.entityLogicalName.trim()!==""&&g.entityLogicalName!==f)throw nn(`changing a stage's table ('${g.entityLogicalName}' vs the process's '${f}')`);e_(p,t,g,g.nextStageId)});return}let o=Lr(n).filter(p=>La(p,f_));if(o.length!==1)throw nn("adding, removing or reordering stages on a multi-table process");let s=o[0],l=S_(s),u=E_(s);if(!u)throw new xr.InvalidArgumentError("BPF primary entity composite has no [Activities] collection");if(Lr(u).some(p=>!La(p,m_)))throw nn("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 nn(`a stage on a different table ('${p.entityLogicalName}') than the process primary ('${l}')`);let c=new Map(a.map(p=>[XI(p),p])),d=r.stages.map(p=>{var f;return(f=c.get(p.id))!==null&&f!==void 0?f:_6(t,p,l)});N_(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 Zu(e){let t=e.match(/^<\?xml[^>]*\?>\s*/),r=t?t[0]:"";return{prolog:r,body:e.slice(r.length)}}function F6(e){var t,r,n,i,a,o;(0,i_.installDomShim)();let s=(t=e.bag)===null||t===void 0?void 0:t.xaml;if(s){let p=new DOMParser().parseFromString("<root/>","text/xml"),f={n:"Activity",a:(0,Mm.mergeAttrs)(s.a,[]),c:(0,Mm.spliceChildren)(s.c,[])};return{root:(0,Mm.rebuildRaw)(f,(0,gi.domEngine)(p),null),prolog:(n=(r=e.bag)===null||r===void 0?void 0:r.xamlProlog)!==null&&n!==void 0?n:Um,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=Hm(e.entityLogicalName,(0,Ot.newId)(),l?.id&&l.id.trim()!==""?l.id:(0,Ot.newId)(),u?.id&&u.id.trim()!==""?u.id:(0,Ot.newId)()),{body:d}=Zu(c);return{root:(0,gi.parseXmlRoot)(d,"<Activity/>"),prolog:Um,eol:"lf"}}function x6(e){let{root:t,prolog:r,eol:n}=F6(e);R6(t,t.ownerDocument,e);let i=(0,gi.serializeNode)(t);return n==="crlf"&&(i=i.replace(/\n/g,`\r
+`)),r+i}function L6(e){return e.uniqueName&&e.uniqueName.trim()!==""?e.uniqueName:`new_${(e.name||"businessprocessflow").toLowerCase().replace(/[^a-z0-9]/g,"")||"businessprocessflow"}`}var Ku=class{toArtifact(t){return t}fromArtifact(t){return t}fromApiResponse(t){var r,n;(0,i_.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}=Zu(a),u=(0,gi.parseXmlRoot)(l,"<Activity/>");o.stages=D6(u),o.bag={xaml:(0,gi.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,Ot.newId)(),name:t.name,uniquename:L6(t),primaryentity:t.entityLogicalName,xaml:x6(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:g6};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 xr.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(r_):[r_({id:(0,Ot.newId)(),name:"New Stage",steps:[]})],o={id:t.id&&t.id.trim()!==""?t.id:(0,Ot.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=Bm(t);(typeof r.id!="string"||r.id.trim()==="")&&(r.id=(0,Ot.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=Bm(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((g,w)=>{let S=`${c}/steps/${w}`,D=typeof Bm(g).id=="string"?g.id.trim():"";D===""?r.push((0,Mt.issue)(`${S}/id`,"step-id-required","a step needs an id")):h.has(D.toLowerCase())?r.push((0,Mt.issue)(`${S}/id`,"step-id-duplicate",`two steps in this stage share the id '${g.id}'`)):h.set(D.toLowerCase(),w)}),l.branch&&!t_(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!==""&&!t_(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=k6(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}};ka.BpfAdapter=Ku;function k6(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 t_(e,t){return e.some(r=>r.id===t)}function r_(e){var t,r;let n=e.steps&&e.steps.length>0?e.steps.map(n_):[n_({id:(0,Ot.newId)(),name:"New Step"})],i={id:e.id&&e.id.trim()!==""?e.id:(0,Ot.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 n_(e){var t;let r={id:e.id&&e.id.trim()!==""?e.id:(0,Ot.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 Hm(e,t,r,n){return`${Um}<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="${HI}" /></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="${HI}" /></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 M6(){return{adapter:new Ku,api:h6.bpfApi,languageSensitive:!0}}ka.bpfRegistration=M6});var T_=v(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});ec.buildRegistrations=void 0;var B6=$N(),U6=nD(),$6=g2(),q6=R2(),V6=Z2(),G6=gI(),z6=TI(),W6=UI(),H6=__();function j6(e){let t=new Map;return t.set("form",(0,B6.formRegistration)(e)),t.set("view",(0,U6.viewRegistration)()),t.set("businessRule",(0,$6.businessRuleRegistration)()),t.set("app",(0,q6.appRegistration)(e)),t.set("command",(0,V6.commandRegistration)()),t.set("chart",(0,G6.chartRegistration)()),t.set("dashboard",(0,z6.dashboardRegistration)(e)),t.set("genPage",(0,W6.genPageRegistration)()),t.set("bpf",(0,H6.bpfRegistration)()),t}ec.buildRegistrations=j6});var B_=v(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 dr=be(),He=ie(),P_=ct(),on=re();Pe.AI_GATE={formFill:"FormFillBarUXEnabled",formFillSuggestions:"FormPredictEnabled",formFillSmartPaste:"FormPredictSmartPasteEnabled",formFillFiles:"FormFillFileUploadEnabled",nlSearch:"EnableNLGridSearch",nlChart:"NLChartVisualizationSetting",summaries:"EnableFormInsights",m365:"m365copilotmodelappenabled"};var x_={formFill:"FormFillBarUXEnabled",formFillSuggestions:"FormPredictEnabled",formFillSmartPaste:"FormPredictSmartPasteEnabledOnByDefault",formFillFiles:"FormFillFileUploadEnabled",nlSearch:"NLGridSearchSetting",nlChart:"NLChartDataVisualizationSetting",m365:"m365copilotmodelappenabled"},J6=new Set(Object.entries(Pe.AI_GATE).filter(([e,t])=>x_[e]===t).map(([e])=>e)),Q6={formFill:{enabled:"2",disabled:"1"},formFillSuggestions:{enabled:"2",disabled:"1"},formFillSmartPaste:{enabled:"2",disabled:"1"},formFillFiles:{enabled:"2",disabled:"1"}};function jm(e){return Q6[e]}var tc=1e6;function K6(e,t){let r=jm(t),n=()=>{throw new on.InvalidArgumentError(`setAppAiFeatures: '${t}' must be a boolean or an integer between 0 and ${tc} (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>tc?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(tc).length||Number(s)>tc?n():s}}return n()}function X6(e,t){let r=jm(t);return r?e===r.enabled:e!=="0"}async function Y6(e,t){var r,n,i;let a=`/appmodules${(0,He.odataQuery)([["$select","appmoduleid"],["$filter",`uniquename eq '${(0,He.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 Z6(e,t){var r,n;let i=`/appmodules${(0,He.odataQuery)([["$select","appmoduleid"],["$filter",`uniquename eq '${(0,He.odataLiteral)(t)}'`]])}`,a;try{a=await e.get(i)}catch(l){throw new on.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 on.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 on.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 on.InvalidArgumentError(`setAppAiFeatures: cannot confirm that the supplied appModuleId belongs to app '${t}' \u2014 the lookup returned a row with no appmoduleid.`);return s}var O_=new WeakMap;async function e7(e,t){var r,n,i;let a=O_.get(e);if(a||(a=new Map,O_.set(e,a)),a.has(t))return a.get(t);let o=`/settingdefinitions${(0,He.odataQuery)([["$select","settingdefinitionid"],["$filter",`uniquename eq '${(0,He.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 t7(e,t,r){var n,i;let a=await e7(e,r);if(!t||!a)return;let o=`/appsettings${(0,He.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 r7=4,n7=500,R_=20,F_=3e4;function i7(e){if(e===void 0)return r7;if(!Number.isFinite(e))throw new on.InvalidArgumentError(`setAppAiFeatures: verifyAttempts must be a finite integer between 1 and ${R_}; got ${e}.`);return Math.min(R_,Math.max(1,Math.floor(e)))}function a7(e){if(e===void 0)return n7;if(!Number.isFinite(e))throw new on.InvalidArgumentError(`setAppAiFeatures: verifyDelayMs must be a finite number between 0 and ${F_}; got ${e}.`);return Math.min(F_,Math.max(0,Math.floor(e)))}async function o7(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 t7(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 rc(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 L_(e,t,r){if(t===2)return String(e).toLowerCase()==="true";let n=r?jm(r):void 0;return n?e===n.enabled:e!=null&&e!=="0"&&e!==""}async function rc(e,t,r={}){var n,i;let a=[`SettingName='${(0,He.odataPathLiteral)(t)}'`];r.appUniqueName&&a.push(`AppUniqueName='${(0,He.odataPathLiteral)(r.appUniqueName)}'`);let o=`/RetrieveSetting(${a.join(",")})`,l=(i=(n=(0,dr.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=rc;async function k_(e,t,r,n={}){let i={SettingName:t,Value:r};n.appUniqueName&&(i.AppUniqueName=n.appUniqueName),n.solutionUniqueName&&(i.SolutionUniqueName=n.solutionUniqueName),(0,dr.ensureSuccess)(await e.post("/SaveSettingValue",i),e.apiUrl("/SaveSettingValue"))}Pe.saveSettingValue=k_;async function s7(e,t={}){let r={};for(let[n,i]of Object.entries(Pe.AI_GATE)){let{value:a,dataType:o}=await rc(e,i,t);r[n]={enabled:L_(a,o,n),setting:i,value:a}}return r}Pe.getAiReadiness=s7;async function l7(e,t,r,n={}){var i,a;if(!t||!t.trim())throw new on.InvalidArgumentError("setAppAiFeatures: a non-empty appUniqueName is required (an empty value would write the setting at organization scope, affecting every app).");let o=i7(n.verifyAttempts),s=a7(n.verifyDelayMs),l=[];for(let[g,w]of Object.entries(r)){if(w===void 0)continue;let S=x_[g];S&&l.push({feature:g,setting:S,requestedValue:K6(w,g)})}let u=[],c=n.appModuleId?(0,He.normalizeGuid)(n.appModuleId,"appModuleId"):void 0;if(c){let g=await Z6(e,t);if(g&&(0,He.normalizeGuid)(g,"appModuleId")!==c)throw new on.InvalidArgumentError(`setAppAiFeatures: appModuleId '${c}' does not belong to app '${t}' (which resolves to '${g}'). 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 Y6(e,t)),d),f=new Map,h=async g=>{if(J6.has(g))return;let w=Pe.AI_GATE[g];if(w){if(!f.has(w))try{let{value:S,dataType:D}=await rc(e,w);f.set(w,{enabled:L_(S,D,g),setting:w,value:S})}catch{f.set(w,void 0)}return f.get(w)}};for(let{feature:g,setting:w,requestedValue:S}of l)try{await k_(e,w,S,{appUniqueName:t,solutionUniqueName:n.solutionUniqueName});let D=await o7(e,p,t,w,S,o,s),x={feature:g,setting:w,requestedValue:S,effectiveValue:D.effectiveValue,appOverrideExists:D.appOverrideExists};if(D.result==="proven")u.push({...x,status:"applied"});else if(D.result==="absent"){let F=X6(S,g)?await h(g):void 0;F&&!F.enabled?u.push({...x,status:"skipped",reason:`the write was issued and no app-scope override holding '${S}' 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 '${S}' 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:g,setting:w,requestedValue:S,status:"failed",reason:D.message})}return{applied:u.filter(g=>g.status==="applied").map(g=>g.feature),skipped:u.filter(g=>g.status==="skipped").map(g=>g.feature),notPersisted:u.filter(g=>g.status==="notPersisted").map(g=>g.feature),unverified:u.filter(g=>g.status==="unverified").map(g=>g.feature),failed:u.filter(g=>g.status==="failed").map(g=>g.feature),outcomes:u}}Pe.setAppAiFeatures=l7;var u7="GptPowerPrompt",c7='{ "consumptionSource": "Api", "partnerSource": "AIBuilder", "consumptionSourceVersion": "GptApiClient"}';function M_(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=M_;async function d7(e,t){var r,n;let i=`/EntityDefinitions(LogicalName='${(0,He.odataPathLiteral)(t)}')${(0,He.odataQuery)([["$select","MetadataId"]])}`;return(n=(r=(0,dr.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)===null||r===void 0?void 0:r.MetadataId)!==null&&n!==void 0?n:""}async function p7(e,t,r={}){var n,i,a,o,s;let l=`ais_RowSummary_${t.entityLogicalName}`,u=`/aiskillconfigs${(0,He.odataQuery)([["$select","aiskillconfigid,_aimodel_value"],["$filter",`uniquename eq '${(0,He.odataLiteral)(l)}'`],["$top",1]])}`,c=((i=(n=(0,dr.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,He.odataQuery)([["$select","msdyn_aitemplateid"],["$filter",`msdyn_uniquename eq '${u7}'`],["$top",1]])}`,p=((s=(o=(a=(0,dr.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,P_.newId)(),h=(0,P_.newId)(),g=JSON.stringify(M_(t)),w={ModelId:f,RunConfigurationId:h,ModelName:`${t.entityLogicalName} row summary`,TemplateId:p,CustomConfiguration:g,Source:c7,RunConfiguration:""};(0,dr.ensureSuccess)(await e.post("/AIModelPublish",w),e.apiUrl("/AIModelPublish"));try{let S=await d7(e,t.entityLogicalName),D={uniquename:l,description:`${t.entityLogicalName} row summary`,"[email protected]":`/entities(${S})`,"[email protected]":`/msdyn_aimodels(${f})`,aiskill:"RowSummary"},x=(0,dr.ensureSuccess)(await e.post("/aiskillconfigs",D),e.apiUrl("/aiskillconfigs")),F=(0,dr.requireCreatedId)(x,"aiskillconfigid","row-summary skill");return{modelId:f,aiSkillConfigId:F}}catch(S){try{await e.delete(`/msdyn_aimodels(${f})`)}catch{}throw S}}Pe.configureRowSummary=p7;async function f7(e,t){var r,n;let i=`ais_RowSummary_${t.entityLogicalName}`,a=`/aiskillconfigs${(0,He.odataQuery)([["$select","aiskillconfigid,_aimodel_value"],["$filter",`uniquename eq '${(0,He.odataLiteral)(i)}'`],["$top",1]])}`,o=((n=(r=(0,dr.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,dr.ensureSuccess)(await e.delete(s),e.apiUrl(s)),o._aimodel_value){let l=`/msdyn_aimodels(${o._aimodel_value})`;(0,dr.ensureSuccess)(await e.delete(l),e.apiUrl(l))}}Pe.removeRowSummary=f7});var U_=v(Ma=>{"use strict";Object.defineProperty(Ma,"__esModule",{value:!0});Ma.findArtifact=Ma.resolveArtifact=void 0;var gt=ie(),sn=el(),m7=sl(),h7=be(),g7=re();async function v7(e,t,r){var n,i,a,o,s,l,u,c,d,p,f,h;switch(t){case"app":{let g=(0,m7.unpublishedAppModulesQuery)("appmoduleid,name,appmoduleidunique",`uniquename eq '${(0,gt.odataLiteral)((n=r.uniqueName)!==null&&n!==void 0?n:"")}'`,1),S=(i=(0,h7.ensureSuccess)(await e.get(g),e.apiUrl(g)).body)===null||i===void 0?void 0:i.value,D=S&&S[0];return D?[{id:String(D.appmoduleid),name:String(D.name),appModuleIdUnique:String(D.appmoduleidunique)}]:[]}case"dashboard":return(await(0,sn.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 g=await(0,sn.queryRecords)(e,"appaction",{select:["appactionid","buttonlabeltext"],filter:`contextvalue eq '${(0,gt.odataLiteral)((o=r.entity)!==null&&o!==void 0?o:"")}'`,top:1});return g&&g.length?[{id:String(r.entity),entity:String(r.entity)}]:[]}case"form":return(await(0,sn.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,sn.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,sn.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,sn.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,sn.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[]}}Ma.resolveArtifact=v7;async function y7(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,sn.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=b7(t,l,u,r),d=t!=="app",p=await(0,sn.queryRecords)(e,c.set,{select:[c.idField],filter:c.filter,top:d?2:1});if(d&&p&&p.length>1)throw new g7.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}Ma.findArtifact=y7;function b7(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 q_=v(ic=>{"use strict";Object.defineProperty(ic,"__esModule",{value:!0});ic.seedRecordGraph=void 0;var $_=el(),w7=xs(),nc=ie(),A7=re();async function C7(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,w7.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(),g=[];for(let L of p.records){let q={...L.body};for(let U of(o=L.binds)!==null&&o!==void 0?o:[]){let $=U.parentEntity.toLowerCase(),W=(s=d($))===null||s===void 0?void 0:s[U.parentIndex];if(!W)throw new A7.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 B=(0,nc.assertODataName)(await u($),`entity set for parent '${U.parentEntity}'`),Qe=(0,nc.normalizeGuid)(W,`parent id for bind '${U.navProperty}'`);q[`${U.navProperty}@odata.bind`]=`/${B}(${Qe})`}g.push(q)}let w=h?g.map(L=>{let q=L[h];return q!=null&&q!==""?String(q):null}):g.map(()=>null),S=new Map;if(h){let L=(0,nc.assertODataName)(h,"RecordGraph matchOn key"),q=[...new Set(w.filter(U=>U!==null))];if(q.length){let U=q.map(W=>`${L} eq '${(0,nc.odataLiteral)(W)}'`).join(" or "),$=await(0,$_.queryRecords)(e,f,{select:[L,`${f}id`],filter:U,top:5e3});for(let W of $??[]){let B=W[L];B!=null&&S.set(String(B).toLowerCase(),String(W[`${f}id`]))}}}let D=[],x=new Map,F=g.map((L,q)=>{let U=w[q];if(U&&S.has(U.toLowerCase()))return null;if(U){let $=U.toLowerCase(),W=x.get($);if(W!==void 0)return W;let B=D.push(L)-1;return x.set($,B),B}return D.push(L)-1}),G=D.length?await(0,$_.createRecordsBulk)(e,f,D):[];c[f]=g.map((L,q)=>{let U=w[q];return U&&S.has(U.toLowerCase())?S.get(U.toLowerCase()):G[F[q]]})}return{createdIds:c}}ic.seedRecordGraph=C7});var X_=v(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 pr=be(),je=ie(),Bt=re(),ac={read:"Read",create:"Create",write:"Write",delete:"Delete",append:"Append",appendTo:"AppendTo",assign:"Assign",share:"Share"},Qm={user:"Basic",businessUnit:"Local",parentChild:"Deep",organization:"Global"},V_={user:1,businessUnit:2,parentChild:3,organization:4},Jm={user:"CanBeBasic",businessUnit:"CanBeLocal",parentChild:"CanBeDeep",organization:"CanBeGlobal"};st.SDK_ROLE_MARKER="Authored by @maker-studio/cds-maker-sdk (persona/security role).";function S7(e){return Object.prototype.hasOwnProperty.call(ac,e)?ac[e]:void 0}function E7(e){return Object.prototype.hasOwnProperty.call(Qm,e)}var G_=new WeakMap,z_=new WeakMap;async function j_(e,t){var r,n;(0,je.assertODataName)(t,"entity logical name");let i=G_.get(e);i||(i=new Map,G_.set(e,i));let a=i.get(t);if(a)return a;let o=`/EntityDefinitions(LogicalName='${(0,je.odataPathLiteral)(t)}')${(0,je.odataQuery)([["$select","LogicalName,Privileges"]])}`,l=(n=(r=(0,pr.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 N7(e){var t,r,n;let i=z_.get(e);if(i)return i;let a=`/businessunits${(0,je.odataQuery)([["$select","businessunitid"],["$filter","_parentbusinessunitid_value eq null"],["$top",1]])}`,l=(n=((r=(t=(0,pr.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,je.normalizeGuid)(l,"businessUnitId");return z_.set(e,u),u}async function J_(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(!E7(a))throw new Bt.InvalidArgumentError(`Unknown privilege scope '${a}' for entity '${i.entity}'.`);let o=await j_(e,i.entity);for(let s of i.access){let l=S7(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=Jm[a];if(u[c]===!1)throw new Bt.InvalidArgumentError(`Privilege '${u.Name}' on '${i.entity}' does not support the '${a}' scope.`);let d=(0,je.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=V_[a]>V_[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 D7(e,t,r,n){if(r.length===0&&!n)return;let i={Privileges:r.map(o=>({Depth:Qm[o.scope],PrivilegeId:o.privilegeId}))},a=`/roles(${t})/Microsoft.Dynamics.CRM.ReplacePrivilegesRole`;(0,pr.ensureSuccess)(await e.post(a,i),e.apiUrl(a))}async function W_(e,t,r,n,i){var a,o;let s=`/${t}(${r})/${n}${(0,je.odataQuery)([["$select","roleid"],["$filter",`roleid eq ${i}`]])}`;return((o=(a=(0,pr.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 I7(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,je.normalizeGuid)(l,"teamId");if(!await W_(e,"teams",u,"teamroles_association",t)){let c=`/teams(${u})/teamroles_association/$ref`;(0,pr.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,je.normalizeGuid)(l,"userId");if(!await W_(e,"systemusers",u,"systemuserroles_association",t)){let c=`/systemusers(${u})/systemuserroles_association/$ref`;(0,pr.ensureSuccess)(await e.post(c,s),e.apiUrl(c))}o.push(u)}return{teams:a,users:o}}async function H_(e,t,r){var n,i;let a=`/roles${(0,je.odataQuery)([["$select","roleid,description,ismanaged"],["$filter",`name eq '${(0,je.odataLiteral)(t)}' and _businessunitid_value eq ${r}`]])}`,l=((i=(n=(0,pr.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,je.normalizeGuid)(c,"roleId"):void 0}function _7(e){var t,r;return{teams:((t=e?.teams)!==null&&t!==void 0?t:[]).map(n=>(0,je.normalizeGuid)(n,"teamId")),users:((r=e?.users)!==null&&r!==void 0?r:[]).map(n=>(0,je.normalizeGuid)(n,"userId"))}}function Q_(e){return e.map(t=>({entity:t.entity,privilegeName:t.privilegeName,privilegeType:t.privilegeType,scope:t.scope}))}async function K_(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,je.normalizeGuid)(t.businessUnitId,"businessUnitId"):await N7(e),o=await J_(e,(n=t.privileges)!==null&&n!==void 0?n:[]),s=_7(t.assignTo),l=await H_(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,pr.ensureSuccess)(await e.post(d,p),e.apiUrl(d));l=(0,je.normalizeGuid)((0,pr.requireCreatedId)(f,"roleid","role"),"roleId")}catch(f){let h;try{h=await H_(e,i,a)}catch{h=void 0}if(!h)throw f;l=h}}await D7(e,l,o,u);let c=await I7(e,l,s);return{roleId:l,name:i,reused:u,appliedPrivileges:Q_(o),assignedTeams:c.teams,assignedUsers:c.users}}st.createSecurityRole=K_;async function T7(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 K_(e,{name:i,businessUnitId:t.businessUnitId,privileges:a,assignTo:t.assignTo})}st.createPersonaRole=T7;async function P7(e,t){let n=`/roles(${(0,je.normalizeGuid)(t,"roleId")})`;(0,pr.ensureSuccess)(await e.delete(n),e.apiUrl(n))}st.deleteSecurityRole=P7;async function O7(e,t,r){let n=(0,je.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 J_(e,r),a={Privileges:i.map(s=>({Depth:Qm[s.scope],PrivilegeId:s.privilegeId}))},o=`/roles(${n})/Microsoft.Dynamics.CRM.AddPrivilegesRole`;return(0,pr.ensureSuccess)(await e.post(o,a),e.apiUrl(o)),Q_(i)}st.addEntityPrivilegesToRole=O7;var R7=new Map(Object.keys(ac).map(e=>[ac[e],e]));async function F7(e,t){return(await j_(e,t)).map(n=>{let i=Object.keys(Jm).filter(o=>n[Jm[o]]!==!1),a=R7.get(n.PrivilegeType);return{name:n.Name,privilegeId:n.PrivilegeId,privilegeType:n.PrivilegeType,...a?{access:a}:{},scopes:i}})}st.getEntityPrivileges=F7});var nT=v(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 Y_=Ic(),ee=re(),fr=Es(),x7=yg(),rT=Eg(),L7=Pg(),k7=Tc(),M7=Qg(),Km=Kg(),Je=xs(),Z_=pd(),ln=el(),oc=Nv(),Ba=rl(),B7=il(),lt=Rv(),U7=Cd(),$7=T_(),q7=ct(),V7=Ei(),un=nm(),eT=Rc(),G7=3e5,Mr=be(),Gn=ie(),Ua=B_(),tT=U_(),z7=q_(),W7=Cf(),fs=X_();function H7(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 rT.WorkspaceManager(j7,e.instanceUrl,(0,k7.assertStorageContract)(t))}Ut.ALREADY_EXISTS_CODE="ARTIFACT_ALREADY_EXISTS";Ut.PUSH_NOT_ATTEMPTED_CODE="PUSH_NOT_ATTEMPTED";var j7="<injected workspaceStorage>",sc=class{constructor(t){var r,n;this.artifactLocks=new Map,this.languageCode=(r=t.languageCode)!==null&&r!==void 0?r:V7.DEFAULT_LCID,this.cacheStalenessMs=(n=t.cacheStalenessMs)!==null&&n!==void 0?n:G7,this.workspace=H7(t),this.versions=new L7.VersionManager(this.workspace),this.dataverse=new M7.DataverseClient(t.instanceUrl,t.httpClient,t.solutionUniqueName),this.registrations=(0,$7.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,rT.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 ee.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,eT.deepEqual)(h.snapshot,d))throw new ee.LocalEditsWouldBeLostError(t,r,p,l);await this.versions.storeMeta(t,r,{...h,etag:l,fetchedAt:(0,Mr.nowIso)()})}return(0,un.cloneJson)(f)}}return await this.workspace.writeArtifact(t,r,d),await this.versions.storeMeta(t,r,{etag:l,languageCode:this.languageCode,fetchedAt:(0,Mr.nowIso)(),snapshot:(0,un.cloneJson)(d),...u?{memberEtags:u}:{},...c?{siblingEtags:c}:{}}),(0,un.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,Mr.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,Mr.nowIso)()}),{summaries:i,skipped:a}}async fetchEntityMetadata(t){let r=await(0,Km.fetchEntityMetadataFromApi)(this.dataverse,t);return await this.workspace.writeEntityMetadata(t,r),r}findTables(t,r){return(0,Km.findTables)(this.dataverse,t,r)}findColumns(t,r,n){return(0,Km.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,Z_.setFormSecurityRoles)(this.dataverse,t,r)}getFormSecurityRoles(t){return(0,Z_.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,Gn.xmlText)(t)}</entity></entities></importexportxml>`;(0,Mr.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,ln.createRecord)(this.dataverse,t,r)}createRecordsBulk(t,r){return(0,ln.createRecordsBulk)(this.dataverse,t,r)}updateRecord(t,r,n){return(0,ln.updateRecord)(this.dataverse,t,r,n)}upsertRecord(t,r,n){return(0,ln.upsertRecord)(this.dataverse,t,r,n)}deleteRecord(t,r){return(0,ln.deleteRecord)(this.dataverse,t,r)}getRecord(t,r,n){return(0,ln.getRecord)(this.dataverse,t,r,n)}queryRecords(t,r){return(0,ln.queryRecords)(this.dataverse,t,r)}seedRecordGraph(t,r){return(0,z7.seedRecordGraph)(this.dataverse,t,r)}resolveArtifact(t,r){return(0,tT.resolveArtifact)(this.dataverse,t,r)}findArtifact(t,r){return(0,tT.findArtifact)(this.dataverse,t,r)}async deleteAppCascade(t,r){let n=await(0,U7.deleteAppCascade)(this.dataverse,t,r),i=(0,Gn.normalizeGuid)(t,"appModuleId");return await this.workspace.readArtifact("app",i)&&await this.workspace.deleteArtifact("app",i),n}associateRecords(t,r,n){return(0,ln.associateRecords)(this.dataverse,t,r,n)}disassociateRecords(t,r,n,i){return(0,ln.disassociateRecords)(this.dataverse,t,r,n,i)}createWebResource(t){return(0,oc.createWebResource)(this.dataverse,t)}updateWebResource(t,r){return(0,oc.updateWebResource)(this.dataverse,t,r)}getWebResource(t){return(0,oc.getWebResource)(this.dataverse,t)}deleteWebResource(t){return(0,oc.deleteWebResource)(this.dataverse,t)}getAppSettings(t){return(0,Ba.readAppSettings)(this.dataverse,t)}setAppSetting(t,r,n){return(0,Ba.setAppSetting)(this.dataverse,t,r,n)}setHeaderAndNavigationRefresh(t,r){if(typeof r!="boolean")throw new ee.ValidationError("app",t,[{pointer:"/headerAndNavigationRefresh",rule:B7.HEADER_NAV_BOOLEAN_RULE,message:`enabled must be a boolean, got ${typeof r}`}]);return(0,Ba.setAppSetting)(this.dataverse,t,Ba.HEADER_AND_NAVIGATION_REFRESH,r?Ba.APP_SETTING_ON:Ba.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,un.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 ee.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 ee.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,eT.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=fr.JsonPointer.resolve(i,n);if(a===void 0)throw new ee.PathNotFoundError(t,r,n);return a})}async findElements(t,r,n){return this.withArtifactLock(t,r,async()=>(0,x7.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 ee.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 ee.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=fr.JsonPointer.resolve(a,n);if(o===void 0)throw new ee.PathNotFoundError(t,r,n);let s=zn(o)&&zn(i)?{...o,...i}:i;return fr.JsonPointer.set(a,n,(0,un.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=fr.JsonPointer.resolve(o,n);if(s===void 0)throw new ee.PathNotFoundError(t,r,n);if(!Array.isArray(s)){if(!zn(s)||!zn(i))throw new ee.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 ee.ValidationError(t,r,n,"position is not supported for an object parent");let c={};for(let d of Object.keys(i)){if(d==="id")throw new ee.ValidationError(t,r,n,"refusing to write 'id' \u2014 that re-keys the node rather than adding a property");let p=(0,un.cloneJson)(i[d]);c[d]=Array.isArray(p)?p.map(f=>zn(f)?this.assignMissingIds(t,f):f):zn(p)?this.assignMissingIds(t,p):p}for(let d of Object.keys(c))fr.JsonPointer.set(o,fr.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,un.cloneJson)(i)),u=K7(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=fr.JsonPointer.resolve(s,n);if(l===void 0)throw new ee.PathNotFoundError(t,r,n);let u=fr.JsonPointer.resolve(s,i);if(u===void 0)throw new ee.PathNotFoundError(t,r,i);if(!Array.isArray(u))throw new ee.ValidationError(t,r,i,"move target must be an array");if(i===n||i.startsWith(`${n}/`))throw new ee.ValidationError(t,r,i,"cannot move an element into its own subtree");fr.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(fr.JsonPointer.resolve(i,n)===void 0)throw new ee.PathNotFoundError(t,r,n);return fr.JsonPointer.remove(i,n),this.assertStructurallyValid(t,r,i,Q7(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 ee.ValidationError(t,r,u)}retrieveSetting(t,r){return(0,Ua.retrieveSetting)(this.dataverse,t,r)}saveSettingValue(t,r,n){return(0,Ua.saveSettingValue)(this.dataverse,t,r,n)}getAiReadiness(t){return(0,Ua.getAiReadiness)(this.dataverse,t)}setAppAiFeatures(t,r,n){return(0,Ua.setAppAiFeatures)(this.dataverse,t,r,n)}configureRowSummary(t,r){return(0,Ua.configureRowSummary)(this.dataverse,t,r)}removeRowSummary(t){return(0,Ua.removeRowSummary)(this.dataverse,t)}async enrichDefaultViews(t,r,n={}){let i=await(0,W7.findDefaultViews)(this.dataverse,t,n),a=[];for(let o of i)await this.fetchArtifact("view",o.id),await this.updateElement("view",o.id,"/columns",r),(await this.pushArtifact("view",o.id)).saved&&a.push(o.id);if(a.length){let o=await this.publishArtifact("view",a[0]);if(o.publish.kind==="failed")throw new ee.SdkError("ENRICH_DEFAULT_VIEWS_PUBLISH_FAILED",`enrichDefaultViews: ${a.length} view(s) on '${t}' were saved but the publish FAILED, so none of them is live (${o.publish.error.message}). Re-publish the entity to make them visible; the saves themselves are unaffected.`)}return{updated:a}}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 ee.ValidationError(t,"(new)","/id","created artifact must have an id");return this.withArtifactLock(t,a,async()=>(await this.workspace.writeArtifact(t,a,i),(0,un.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,Gn.normalizeGuid)(r,"id")})${(0,Gn.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 ee.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),g=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),g=h.id),await this.workspace.writeArtifact(l,g,d)),await this.versions.storeMeta(l,g,{etag:h.etag,languageCode:this.languageCode,fetchedAt:(0,Mr.nowIso)(),snapshot:(0,un.cloneJson)(d),...h.memberEtags?{memberEtags:h.memberEtags}:{},...h.siblingEtags?{siblingEtags:h.siblingEtags}:{}}),{type:l,id:g,saved:!0,shipped:!1,publish:(r=h.publish)!==null&&r!==void 0?r:{kind:"notRequested"},...h.publish&&h.publish.kind!=="notRequested"?(()=>{var w;let S=(w=c.publishScope)===null||w===void 0?void 0:w.call(c,g,d);return S?{publishScope:S}:{}})():{},...h.warnings&&h.warnings.length>0?{warnings:h.warnings}:{}}}catch(h){let g=(0,ee.readPartialTokens)(h);if(g&&p){let w={...(n=p.memberEtags)!==null&&n!==void 0?n:{},...(i=g.memberEtags)!==null&&i!==void 0?i:{}},S={...(a=p.siblingEtags)!==null&&a!==void 0?a:{},...(o=g.siblingEtags)!==null&&o!==void 0?o:{}};await this.versions.storeMeta(l,u,{...p,...Object.keys(w).length>0?{memberEtags:w}:{},...Object.keys(S).length>0?{siblingEtags:S}:{}})}if(h instanceof ee.SdkError&&h.code===Ut.ALREADY_EXISTS_CODE)return{type:l,id:u,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:h};if(h instanceof ee.SdkError&&h.code===Y_.WFOM_API_UNAVAILABLE_CODE)return{type:l,id:u,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:h};if(h instanceof ee.SdkError&&h.code===Y_.BUSINESS_RULE_LEFT_DEACTIVATED_CODE)return{type:l,id:u,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:h};if(h instanceof ee.SdkError&&h.code===Mr.VERSION_CONFLICT_CODE)return{type:l,id:u,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:new ee.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 ee.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 ee.SdkError)||a.code!==Mr.VERSION_CONFLICT_CODE?a:new ee.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 ee.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,q7.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,Gn.normalizeGuid)(t,"formId")})${(0,Gn.odataQuery)([["$select","type"]])}`,i=(0,Mr.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,Gn.normalizeGuid)(t,"workflowId")})${(0,Gn.odataQuery)([["$select","businessprocesstype"]])}`,i=(0,Mr.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 ee.NotImplementedError(r,`no adapter registered for artifact type '${t}'`);return n}};Ut.MakerSdk=sc;function J7(e){return new sc(e)}Ut.createMakerSdk=J7;function ms(e){return e instanceof Error?e:new Error(String(e))}function zn(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Q7(e){let t=e.lastIndexOf("/");return t<=0?"":e.slice(0,t)}function K7(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=>zn(i)&&i.id===t.before);return n<0?e.length:n}let r=e.findIndex(n=>zn(n)&&n.id===t.after);return r<0?e.length:r+1}});var iT=v(lc=>{"use strict";Object.defineProperty(lc,"__esModule",{value:!0});lc.ARTIFACT_TYPES=void 0;lc.ARTIFACT_TYPES=["form","view","businessRule","app","command","chart","dashboard","genPage","bpf"]});var oT=v(aT=>{"use strict";Object.defineProperty(aT,"__esModule",{value:!0})});var lT=v(sT=>{"use strict";Object.defineProperty(sT,"__esModule",{value:!0})});var cT=v(uT=>{"use strict";Object.defineProperty(uT,"__esModule",{value:!0})});var pT=v(dT=>{"use strict";Object.defineProperty(dT,"__esModule",{value:!0})});var mT=v(fT=>{"use strict";Object.defineProperty(fT,"__esModule",{value:!0})});var gT=v(hT=>{"use strict";Object.defineProperty(hT,"__esModule",{value:!0})});var yT=v(vT=>{"use strict";Object.defineProperty(vT,"__esModule",{value:!0})});var wT=v(bT=>{"use strict";Object.defineProperty(bT,"__esModule",{value:!0})});var CT=v(AT=>{"use strict";Object.defineProperty(AT,"__esModule",{value:!0})});var ET=v(ST=>{"use strict";Object.defineProperty(ST,"__esModule",{value:!0})});var DT=v(NT=>{"use strict";Object.defineProperty(NT,"__esModule",{value:!0})});var _T=v(IT=>{"use strict";Object.defineProperty(IT,"__esModule",{value:!0})});var PT=v(TT=>{"use strict";Object.defineProperty(TT,"__esModule",{value:!0})});var RT=v(OT=>{"use strict";Object.defineProperty(OT,"__esModule",{value:!0})});var xT=v(FT=>{"use strict";Object.defineProperty(FT,"__esModule",{value:!0})});var kT=v(LT=>{"use strict";Object.defineProperty(LT,"__esModule",{value:!0})});var BT=v(MT=>{"use strict";Object.defineProperty(MT,"__esModule",{value:!0})});var $T=v(UT=>{"use strict";Object.defineProperty(UT,"__esModule",{value:!0})});var VT=v(qT=>{"use strict";Object.defineProperty(qT,"__esModule",{value:!0})});var GT=v(le=>{"use strict";var X7=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)&&X7(t,e,r)};Object.defineProperty(le,"__esModule",{value:!0});le.createMakerSdk=void 0;var Y7=nT();Object.defineProperty(le,"createMakerSdk",{enumerable:!0,get:function(){return Y7.createMakerSdk}});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(ET(),le);Ie(DT(),le);Ie(_T(),le);Ie(il(),le);Ie(PT(),le);Ie(RT(),le);Ie(xT(),le);Ie(kT(),le);Ie(BT(),le);Ie($T(),le);Ie(VT(),le);Ie(re(),le)});var Ym=v(Br=>{"use strict";var Z7=Br&&Br.__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]})),ez=Br&&Br.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),HT=Br&&Br.__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)&&Z7(t,e,r);return ez(t,e),t};Object.defineProperty(Br,"__esModule",{value:!0});Br.NodeFileSystemStorage=void 0;var Ue=HT(require("fs")),ut=HT(require("path")),zT=re(),WT=Pc();async function jT(e){let t;try{t=await Ue.promises.lstat(e)}catch{return}if(t.isSymbolicLink()){try{await Ue.promises.unlink(e)}catch{await Ue.promises.rmdir(e)}return}if(!t.isDirectory()){await Ue.promises.unlink(e);return}for(let r of await Ue.promises.readdir(e))await jT(ut.join(e,r));await Ue.promises.rmdir(e)}var Xm=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(;!Ue.existsSync(r);){n.unshift(ut.basename(r));let i=ut.dirname(r);if(i===r)return ut.resolve(t);r=i}return ut.resolve(Ue.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 zT.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 zT.PathTraversalError(t,this.root);return i}async readText(t){let r=this.pathFor(t);if(!Ue.existsSync(r))return null;try{return await(0,WT.retryTransientIoAsync)(()=>Ue.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 Ue.promises.mkdir(i,{recursive:!0});let a=ut.join(i,`.${ut.basename(n)}.${Date.now()}.${Math.random().toString(36).slice(2)}.tmp`);try{await Ue.promises.writeFile(a,r,"utf8"),await(0,WT.retryTransientIoAsync)(()=>Ue.promises.rename(a,n))}catch(o){try{Ue.existsSync(a)&&await Ue.promises.unlink(a)}catch{}throw o}}async deleteFile(t){let r=this.pathFor(t);Ue.existsSync(r)&&await Ue.promises.unlink(r)}async deleteByPrefix(t){await jT(this.pathFor(t,!1))}async ensureContainer(t){await Ue.promises.mkdir(this.pathFor(t),{recursive:!0})}async exists(t){return Ue.existsSync(this.pathFor(t))}};Br.NodeFileSystemStorage=Xm});var JT=v($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});$a.createNodeWorkspaceStorage=$a.NodeFileSystemStorage=void 0;var tz=Ym(),rz=Ym();Object.defineProperty($a,"NodeFileSystemStorage",{enumerable:!0,get:function(){return rz.NodeFileSystemStorage}});function nz(e){return new tz.NodeFileSystemStorage(e)}$a.createNodeWorkspaceStorage=nz});var cn={};module.exports=mr(cn);dn(cn,ne(GT()),module.exports);dn(cn,ne(JT()),module.exports);
diff --git a/plugins/model-apps/scripts/verify-model-app.js b/plugins/model-apps/scripts/verify-model-app.js
index a1ef5427d..fde604f07 100644
--- a/plugins/model-apps/scripts/verify-model-app.js
+++ b/plugins/model-apps/scripts/verify-model-app.js
@@ -235,6 +235,18 @@ function readerFor(sdk, appUnique, opts) {
const row = rows && rows[0];
return row ? { isDefault: row.isdefault === true } : null;
},
+ // formTopology(entity, formId): the deployed FormXml, so verify can prove the LAYOUT and not just
+ // that a form row exists. Errors propagate to verify-spec, which reports the read failure as a
+ // not-present check — a layout nobody could read is unverified, not correct.
+ formTopology: async (_entity, formId) => {
+ const rows = await sdk.queryRecords('systemform', {
+ select: ['formid', 'formxml'],
+ filter: `formid eq ${formId}`,
+ top: 1,
+ });
+ const row = rows && rows[0];
+ return (row && row.formxml) || null;
+ },
// sitemapXml (string, fail-closed '') for entity/icon hasElement checks — from the discriminated sitemap
// read. Returning '' on failure suppresses entity/icon checks without aborting the whole verify.
sitemapXml: async () => { const r = await memoSitemap(); return r.ok ? r.xml : ''; },
diff --git a/plugins/model-apps/skills/genpage/SKILL.md b/plugins/model-apps/skills/genpage/SKILL.md
index 610210ecc..570efcad3 100644
--- a/plugins/model-apps/skills/genpage/SKILL.md
+++ b/plugins/model-apps/skills/genpage/SKILL.md
@@ -761,20 +761,36 @@ Custom API deployment follows the **identical matrix** as connectors, substituti
when bindings changed/added/removed (full replace); omit it on an unrelated edit (pac preserves
existing); write `[]` and pass it to clear all `actionBindings`.
-**Copy the upload commands below exactly — `--app-id`, `--code-file`, `--prompt`, `--agent-message` are all required and must use these exact flag names.**
+**Deploy through `scripts/genpage-upload.js`, never by composing a raw `pac model genpage upload` command.** The script is a thin wrapper over the same upload path `/app-builder` uses: it hands the prompt and agent-message to pac **by file** (`--prompt-file`/`--agent-message-file`). A prompt is arbitrary user text — quotes, newlines, `%VAR%`, `&`, `|`, non-ASCII — and putting it on a command line means the shell gets to reinterpret it. That failed live with:
-**Log the full command verbatim into `workflow-log.md` under a `## Phase 6 — Deploy` section before invoking it.** Including `--prompt` and all other flags. The eval harness greps the log for these tokens — a terse summary like `Command: pac model genpage upload --add-to-sitemap` will fail the `--prompt scoping` assertion. Format:
+```text
+Error: Not a valid command.
+Parse failed on: Inspection
+Was it quote wrapped? No, be sure to wrap values that contain spaces.
+```
+
+…for a prompt containing an ASCII-quoted multiword page name. **Never "fix" that by editing the approved prompt** (for example swapping in typographic quotes): the page would then be built from text the user never approved.
+
+**Write the prompt and agent-message to files first**, then pass the paths:
+
+```powershell
+Set-Content -Path "<working-dir>/prompt.txt" -Value $prompt -Encoding UTF8 -NoNewline
+Set-Content -Path "<working-dir>/agent-message.txt" -Value $agentMessage -Encoding UTF8 -NoNewline
+```
+
+**Log the invocation into `workflow-log.md` under a `## Phase 6 — Deploy` section before running it.** Record the flags and the prompt-file path, plus the prompt's scope, so the approved text is preserved semantically without embedding arbitrary text as an executable command. Format:
```markdown
## Phase 6 — Deploy
-- Command: `pac model genpage upload --app-id <id> --code-file <path> --data-sources '<entities>' --prompt "<full prompt>" --model <model-id> --name "<page name>" --agent-message "<description>" --add-to-sitemap`
+- Command: `node "${PLUGIN_ROOT}/scripts/genpage-upload.js" --env <org-url> --app-id <id> --code-file "<path>" --data-sources '<entities>' --prompt-file "<working-dir>/prompt.txt" --model <model-id> --name "<page name>" --agent-message-file "<working-dir>/agent-message.txt" --add-to-sitemap`
+- Prompt scope: full page description from plan's `## User Requirements` (create) — or the delta only (update)
- Result: page-id = <returned-id>, status = success
```
When present, the logged command must also include `--connectors "<working-dir>/connectors.json"`
and/or `--actions "<working-dir>/actions.json"`.
-#### `--prompt` semantics
+#### Prompt semantics
- **First upload** (`--add-to-sitemap`, no `--page-id`): full page description
from plan's `## User Requirements`.
@@ -782,22 +798,28 @@ and/or `--actions "<working-dir>/actions.json"`.
the changes in this upload, written like a commit message, never a
re-statement of the original.
+`--add-to-sitemap` is **refused** together with `--page-id` — an update cannot add a sitemap
+entry, and the page it names is already placed. If a create is recovered as an update after a
+mid-flight failure, the page is deployed but **not** placed, and that is reported as a failed
+(incomplete) deployment carrying the page id, not as success.
+
Applies in Phase 6 updates, Phase 6.5 PAGEREF re-uploads, Phase 7.5 fix
re-deploys, and the entire edit flow.
#### For Dataverse entity pages (first upload — create):
```powershell
-pac model genpage upload `
+node "${PLUGIN_ROOT}/scripts/genpage-upload.js" `
+ --env <org-url> `
--app-id <app-id> `
--code-file <working-dir>/<file>.tsx `
--name "Page Display Name" `
--data-sources "entity1,entity2" `
--connectors "<working-dir>/connectors.json" `
--actions "<working-dir>/actions.json" `
- --prompt "<Full page description from plan's ## User Requirements>" `
+ --prompt-file "<working-dir>/prompt.txt" `
--model "<current-model-id>" `
- --agent-message "Description of what was built and any relevant details" `
+ --agent-message-file "<working-dir>/agent-message.txt" `
--add-to-sitemap
```
@@ -808,19 +830,20 @@ Omit the `--connectors` line when Phase 4.5 did not write `connectors.json`, and
#### For updating existing pages (subsequent upload):
-Use `--page-id`, omit `--add-to-sitemap`, and **scope `--prompt` to the delta only**:
+Use `--page-id`, omit `--add-to-sitemap`, and **scope the prompt to the delta only**:
```powershell
-pac model genpage upload `
+node "${PLUGIN_ROOT}/scripts/genpage-upload.js" `
+ --env <org-url> `
--app-id <app-id> `
--page-id <page-id> `
--code-file <working-dir>/<file>.tsx `
--data-sources "entity1,entity2" `
--connectors "<working-dir>/connectors.json" `
--actions "<working-dir>/actions.json" `
- --prompt "<Only the changes in this upload, e.g. 'Add a search box and sort by company name'>" `
+ --prompt-file "<working-dir>/prompt.txt" `
--model "<current-model-id>" `
- --agent-message "Description of what was changed in this upload"
+ --agent-message-file "<working-dir>/agent-message.txt"
```
For updates, include the `--connectors` line only when this upload intentionally
@@ -846,19 +869,25 @@ phase substitutes the real GUIDs.
4. If a placeholder doesn't match any map key (typo, missing sibling), stop
and report — never silently ship the literal string.
5. Re-upload only the files that had at least one replacement. Use the update form
- of `pac model genpage upload` (`--page-id`, no `--add-to-sitemap`). Per the
- "`--prompt` semantics" rule in Phase 6, this is an **update**, so `--prompt`
+ of `scripts/genpage-upload.js` (`--page-id`, no `--add-to-sitemap`). Per the
+ "Prompt semantics" rule in Phase 6, this is an **update**, so the prompt
describes the delta only — not the original page description:
```powershell
- pac model genpage upload `
+ Set-Content -Path "<working-dir>/prompt.txt" -Encoding UTF8 -NoNewline `
+ -Value "Resolve cross-page navigation placeholders to real page GUIDs (post-deploy fix-up)"
+ Set-Content -Path "<working-dir>/agent-message.txt" -Encoding UTF8 -NoNewline `
+ -Value "Replaced PAGEREF_<name> tokens with actual page IDs returned by Phase 6"
+
+ node "${PLUGIN_ROOT}/scripts/genpage-upload.js" `
+ --env <org-url> `
--app-id <app-id> `
--page-id <page-id-from-Phase-6> `
--code-file <working-dir>/<file>.tsx `
--data-sources "entity1,entity2" `
- --prompt "Resolve cross-page navigation placeholders to real page GUIDs (post-deploy fix-up)" `
+ --prompt-file "<working-dir>/prompt.txt" `
--model "<current-model-id>" `
- --agent-message "Replaced PAGEREF_<name> tokens with actual page IDs returned by Phase 6"
+ --agent-message-file "<working-dir>/agent-message.txt"
```
Pages with no `PAGEREF_` strings need no second upload.
diff --git a/plugins/model-apps/skills/genpage/edit-flow.md b/plugins/model-apps/skills/genpage/edit-flow.md
index bd8f96a78..c46e35d81 100644
--- a/plugins/model-apps/skills/genpage/edit-flow.md
+++ b/plugins/model-apps/skills/genpage/edit-flow.md
@@ -322,9 +322,10 @@ the regex also catches quoted keys and whitespace before the colon. Replace ever
## Edit Phase 6: Deploy Updated Page
-This is an **update** (existing page-id), so `--prompt` must describe the
+This is an **update** (existing page-id), so the prompt must describe the
**delta of changes only** — not a re-statement of the original page description.
-See SKILL.md Phase 6 "`--prompt` semantics".
+It is written to a file and passed as `--prompt-file`; see SKILL.md Phase 6
+"Prompt semantics".
Connector binding rules for edit deploy:
- **Add / replace / discover / remove one connector:** the `genpage-connector-builder`
@@ -353,20 +354,29 @@ Custom API binding rules for edit deploy (identical matrix, `--actions` for
clears `config.json.actionBindings`.
```powershell
-pac model genpage upload `
+# The edit request is arbitrary user text, and a downloaded prompt is a multi-line
+# conversation transcript. Both go to pac BY FILE via scripts/genpage-upload.js, never on a
+# command line, so quotes/newlines/metacharacters cannot be reinterpreted by the shell.
+Set-Content -Path "<working-dir>/prompt.txt" -Value $editRequest -Encoding UTF8 -NoNewline
+Set-Content -Path "<working-dir>/agent-message.txt" -Value $changeSummary -Encoding UTF8 -NoNewline
+
+node "${PLUGIN_ROOT}/scripts/genpage-upload.js" `
+ --env <org-url> `
--app-id <app-id> `
--page-id <page-id> `
--code-file <working-dir>/<page-id>/page.tsx `
--data-sources "entity1,entity2" `
--connectors "<working-dir>/connectors.json" `
--actions "<working-dir>/actions.json" `
- --prompt "<User's edit request — only the changes, not the full page>" `
+ --prompt-file "<working-dir>/prompt.txt" `
--model "<current-model-id>" `
- --agent-message "Description of what was changed in this upload"
+ --agent-message-file "<working-dir>/agent-message.txt"
```
+The prompt file holds the user's edit request — **only the changes, not the full page**.
+
Use `--page-id` for updates. Omit `--add-to-sitemap` (the page is already in
-the sitemap).
+the sitemap; the wrapper refuses the combination anyway).
Omit `--data-sources` when `config.json.dataSources` was empty.
Omit `--connectors` when connector bindings are unchanged.
Omit `--actions` when Custom API bindings are unchanged.
diff --git a/plugins/model-apps/skills/genpage/verify-flow.md b/plugins/model-apps/skills/genpage/verify-flow.md
index b0579ca94..9f508568a 100644
--- a/plugins/model-apps/skills/genpage/verify-flow.md
+++ b/plugins/model-apps/skills/genpage/verify-flow.md
@@ -95,10 +95,32 @@ complete visual record for the deployment summary.
## 7.5 Fix and Re-deploy
If issues are found: fix the code, re-deploy using the **update form** from
-Phase 6 (`--page-id`, no `--add-to-sitemap`). Per the "`--prompt` semantics"
-rule, `--prompt` for this re-deploy describes the fix delta only — e.g.
+Phase 6 — `node "${PLUGIN_ROOT}/scripts/genpage-upload.js"` with `--page-id` and
+no `--add-to-sitemap`. Per the "Prompt semantics" rule, the prompt for this
+re-deploy describes the fix delta only — e.g.
`"Fix sort handler on Name column; correct accidental DataGrid type prop"` —
-not a re-statement of the full page description.
+not a re-statement of the full page description. Write it to a file and pass
+`--prompt-file`; never put it on a command line.
+
+Omitting `--data-sources` here is safe: the page's existing table bindings are
+read and re-sent, so a fix re-deploy does not unbind it. Pass `--data-sources`
+to change the bindings, or `--clear-data-sources` to remove them deliberately.
+
+```powershell
+Set-Content -Path "<working-dir>/prompt.txt" -Encoding UTF8 -NoNewline `
+ -Value "Fix sort handler on Name column; correct accidental DataGrid type prop"
+Set-Content -Path "<working-dir>/agent-message.txt" -Encoding UTF8 -NoNewline `
+ -Value "Phase 7.5 fix re-deploy"
+
+node "${PLUGIN_ROOT}/scripts/genpage-upload.js" `
+ --env <org-url> `
+ --app-id <app-id> `
+ --page-id <page-id> `
+ --code-file "<working-dir>/<file>.tsx" `
+ --prompt-file "<working-dir>/prompt.txt" `
+ --model "<current-model-id>" `
+ --agent-message-file "<working-dir>/agent-message.txt"
+```
**Common Playwright issues:**
- "Target page, context or browser has been closed" → retry the navigation.