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 2.6.0: Business Process Flows + SDK uptake (business-rule preview gate) + view-column validation (#512)

Akshay Maloo1781b8ee935c
diff --git a/evals/model-apps/app-builder/EVAL_GUIDE.md b/evals/model-apps/app-builder/EVAL_GUIDE.md
index 32da95ac8..7a45e9e0d 100644
--- a/evals/model-apps/app-builder/EVAL_GUIDE.md
+++ b/evals/model-apps/app-builder/EVAL_GUIDE.md
@@ -18,10 +18,17 @@
| **app** | Every sitemap subarea resolves to a concrete target · no dangling `navigatesTo` keys | `sdk-build.js` `appDef` |
| **security** | Each declared persona maps to exactly one role · the role **injects** `appmodule` read for app-access personas (and only those) · every persona privilege on an **app-owned** table (the app's own publisher prefix) resolves to a provisioned entity (JTBD coverage) · the role grants **exactly** its jobs' declared privileges — no extra entity, access token, or inflated scope beyond the declared union + the documented `appmodule` injection (least privilege) | `sdk-build.js` `personaRoleSpecFor` |
| **verify** | Reconcile against a synthetic all-present reader returns `ok: true` | `verify-spec.js` `verifySpec` |
+| **process** | Declarative logic binds real columns — every business-rule clause/action and every BPF step resolves to a column the spec creates (or a lookup its relationships create) | `sdk-build.js` `businessRuleDef` + `bpfDef` |
| **generate-pages** | No `PAGEREF_` nav targets unresolved (Plan 3 — degrades to SKIP if absent) | `pageref-resolver.js` `resolvePageRefs` |
-| **teardown** | The reverse-of-build delete plan is dependency-safe (solution last · web resources after tables · every table has a step) | `sdk-teardown.js` `planTeardown` |
+| **teardown** | The reverse-of-build delete plan is dependency-safe (solution last · web resources after tables · every table, business rule and process flow has a step) | `sdk-teardown.js` `planTeardown` |
| **round-trip** | The download→rebuild is lossless — a synthetic deployed read hydrates back the same solution / tables / page-keys / sitemap subareas (incl. classic dashboards) | `hydrate-spec.js` `hydrateSpec` |
+The **process** oracle exists because both surfaces share a failure mode nothing downstream detects:
+the platform *accepts* a definition whose column bindings are wrong or missing, and the artifact then
+does nothing. A business rule with a mis-shaped condition tree deploys, activates and never fires; a
+BPF step with no bound field is refused only at push time, on a live environment. Counting artifacts
+would stay green through both, so the assertions grade the **bindings** the pure def builders emit.
+
## Fixtures
Each fixture lives in `fixtures/<id>-<slug>/` and contains `app-spec.json`.
@@ -33,6 +40,7 @@ Naming is numeric-prefix; `fixture-loader.js` matches `^(\d+)(?:-(.+))?$`.
| 2 | `2-orders-multipage` | Page intents + navigation + design contract; page-key round-trip |
| 3 | `3-assets-dashboard` | Global choice + column binding, on-click command, and a classic **dashboard** pinned to the nav — exercises teardown (dashboard/command/web-resource/global-choice steps) + the dashboard round-trip |
| 4 | `4-hardening` | The 2026-07-15 review fixes: a lookup-heavy child (8 scalars + a 1:N parent lookup) proves the default view keeps the lookup (#2) and drops `createdon` (#7); an N:N proves the alphabetically-sorted schema name `new_tag_new_ticket` (#3); a no-label sub-grid proves the own-section + pluralName title (#5); relational sample data proves `validateAppSpec` accepts a resolvable `$parent` match and declared Choice labels (#1/#4) |
+| 5 | `5-process-logic` | The two declarative-logic surfaces: a 3-stage **business process flow** whose steps bind both the table's own columns and a **relationship lookup** (`new_customerid`, which is absent from `columns[]`), plus two **business rules** — one multi-action, one multi-condition including a value-less presence operator. Grades stage order, step bindings, clause/action survival, and one teardown step each |
> **Fixture 2 note:** `appShell.subAreas[].page` references use the page's **key** (e.g. `"overview"`). For `schemaVersion: 2`, `validateAppSpec` validates `sa.page` against `pages[].key`, while `lintAppSpec` validates against `pages[].name`. Setting `p.key === p.name` (lowercase identifiers) satisfies both validators without modifying plugin code.
diff --git a/evals/model-apps/app-builder/evals.json b/evals/model-apps/app-builder/evals.json
index 60c26a07f..ff0f3bbd4 100644
--- a/evals/model-apps/app-builder/evals.json
+++ b/evals/model-apps/app-builder/evals.json
@@ -27,6 +27,11 @@
"round-trip: authored directEntry survives unchanged",
"teardown: every declared dashboard has a teardown step",
"teardown: every declared command bar has a teardown step",
+ "teardown: every declared business rule and process flow has a teardown step",
+ "process: every business rule binds only columns the spec creates",
+ "process: every business rule compiles at least one condition and one action",
+ "process: every BPF step binds a field on the flow entity",
+ "process: every BPF stage is scoped to the flow entity (v1 is single-entity)",
"ui: enriched default views keep parent lookups and drop createdon",
"ui: each sub-grid is a full-width section titled by the child display name"
],
@@ -131,6 +136,31 @@
"validateAppSpec accepts the relational sample data: the $parent match resolves and the Choice labels are declared (#1/#4)",
"quick create is enabled on the new_ticket table (#8)"
]
+ },
+ {
+ "id": 5,
+ "tier": "full",
+ "spec": "app-spec.json",
+ "prompt": "Process logic: a case table worked through a staged business process flow, with two business rules gating its fields — exercises businessProcessFlows[] and businessRules[].",
+ "expect": {
+ "tables": [
+ "new_customer",
+ "new_case"
+ ],
+ "relationships": [
+ "new_customer_new_case"
+ ],
+ "views": [
+ "Open Cases"
+ ],
+ "charts": []
+ },
+ "expectations": [
+ "the BPF stage order is Intake, Investigate, Resolve and every step binds a declared column",
+ "the BPF binds the relationship lookup new_accountref, not just the case table’s own columns",
+ "a rule with two conditions compiles both, ANDed, and neither is dropped",
+ "every business rule and the process flow each get exactly one teardown step"
+ ]
}
]
}
diff --git a/evals/model-apps/app-builder/fixtures/5-process-logic/app-spec.json b/evals/model-apps/app-builder/fixtures/5-process-logic/app-spec.json
new file mode 100644
index 000000000..7de1eda1b
--- /dev/null
+++ b/evals/model-apps/app-builder/fixtures/5-process-logic/app-spec.json
@@ -0,0 +1,140 @@
+{
+ "schemaVersion": 2,
+ "solution": { "uniqueName": "ProcessLogic", "displayName": "Process Logic", "publisherPrefix": "new" },
+ "app": {
+ "name": "Process Logic",
+ "description": "Exercises the two DECLARATIVE-LOGIC surfaces — businessRules[] and businessProcessFlows[] — whose shared failure mode is an artifact the platform accepts and then does nothing with."
+ },
+ "entities": [
+ {
+ "schemaName": "new_customer",
+ "displayName": "Customer",
+ "pluralName": "Customers",
+ "description": "The organisation a case belongs to.",
+ "primaryAttribute": { "schemaName": "new_name", "displayName": "Name" },
+ "columns": [
+ { "schemaName": "new_tier", "displayName": "Tier", "type": "Choice", "options": ["Free", "Pro"], "description": "Support entitlement." }
+ ]
+ },
+ {
+ "schemaName": "new_case",
+ "displayName": "Case",
+ "pluralName": "Cases",
+ "description": "A unit of support work, worked through a staged process.",
+ "primaryAttribute": { "schemaName": "new_subject", "displayName": "Subject" },
+ "columns": [
+ { "schemaName": "new_status", "displayName": "Status", "type": "Choice", "options": ["New", "Investigating", "Resolved"], "description": "Where the case sits in its lifecycle." },
+ { "schemaName": "new_summary", "displayName": "Summary", "type": "Memo", "description": "What the customer reported." },
+ { "schemaName": "new_owner", "displayName": "Owner", "type": "Text", "description": "Who is accountable for the case." },
+ { "schemaName": "new_diagnosis", "displayName": "Diagnosis", "type": "Memo", "description": "What was found during investigation." },
+ { "schemaName": "new_resolution", "displayName": "Resolution", "type": "Memo", "description": "What was done to close the case." }
+ ]
+ }
+ ],
+ "relationships": [
+ {
+ "type": "OneToMany",
+ "referenced": "new_customer",
+ "referencing": "new_case",
+ "lookup": { "schemaName": "new_AccountRef", "displayName": "Customer" }
+ }
+ ],
+ "businessRules": [
+ {
+ "entity": "new_case",
+ "name": "Lock the summary once resolved",
+ "description": "A resolved case is history, so its reported summary stops being editable.",
+ "scope": "Entity",
+ "status": "Active",
+ "conditions": [
+ { "field": "new_status", "operator": "Equals", "value": "100000002", "dataType": "Picklist" }
+ ],
+ "actions": [
+ { "type": "LockUnlock", "field": "new_summary", "lock": true },
+ { "type": "SetBusinessRequired", "field": "new_resolution", "required": true }
+ ]
+ },
+ {
+ "entity": "new_case",
+ "name": "Hide the diagnosis until investigation starts",
+ "description": "The diagnosis field is noise while a case is still new.",
+ "scope": "Entity",
+ "status": "Active",
+ "conditions": [
+ { "field": "new_status", "operator": "Equals", "value": "100000000", "dataType": "Picklist" },
+ { "field": "new_owner", "operator": "DoesNotContainData" }
+ ],
+ "actions": [
+ { "type": "SetVisibility", "field": "new_diagnosis", "visible": false }
+ ]
+ }
+ ],
+ "businessProcessFlows": [
+ {
+ "entity": "new_case",
+ "name": "Case Resolution Process",
+ "description": "Intake, investigation and closure — the stages an agent works a case through.",
+ "status": "Active",
+ "stages": [
+ {
+ "name": "Intake",
+ "steps": [
+ { "name": "Subject", "field": "new_subject", "required": true },
+ { "name": "Customer", "field": "new_accountref", "required": true },
+ { "name": "Summary", "field": "new_summary" }
+ ]
+ },
+ {
+ "name": "Investigate",
+ "steps": [
+ { "name": "Owner", "field": "new_owner", "required": true },
+ { "name": "Diagnosis", "field": "new_diagnosis" }
+ ]
+ },
+ {
+ "name": "Resolve",
+ "steps": [
+ { "name": "Resolution", "field": "new_resolution", "required": true },
+ { "name": "Status", "field": "new_status", "required": true }
+ ]
+ }
+ ]
+ }
+ ],
+ "views": [
+ {
+ "entity": "new_case",
+ "type": "main",
+ "name": "Open Cases",
+ "description": "Cases that have not been resolved.",
+ "columns": ["new_subject", "new_status", "new_owner"],
+ "sort": [{ "attr": "new_subject", "dir": "asc" }],
+ "activeOnly": true
+ }
+ ],
+ "forms": [
+ {
+ "entity": "new_case",
+ "type": "main",
+ "name": "Case",
+ "description": "The form the staged process runs over.",
+ "layout": "auto"
+ }
+ ],
+ "appShell": {
+ "areas": [
+ {
+ "label": "Main",
+ "groups": [
+ {
+ "label": "Records",
+ "subAreas": [
+ { "entity": "new_customer", "title": "Customers" },
+ { "entity": "new_case", "title": "Cases" }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+}
diff --git a/evals/model-apps/app-builder/lib/assertions.js b/evals/model-apps/app-builder/lib/assertions.js
index 21d9c3db0..f9ffff32c 100644
--- a/evals/model-apps/app-builder/lib/assertions.js
+++ b/evals/model-apps/app-builder/lib/assertions.js
@@ -2,6 +2,9 @@
// Maps each assertion text in evals.json to a check function receiving { facts, spec, eval } and
// returning { status: 'pass'|'fail'|'skip', reason? }. Mirrors evals/model-apps/genpage/lib/assertions-*.js.
// Register every text in common_stage_assertions here; any unregistered text gets a SKIP.
+const path = require('node:path');
+// Same reach as facts.js: 4 levels up to the repo root. Pure, offline plugin primitives only.
+const { declaredColumnLogicals } = require(path.join(__dirname, '..', '..', '..', '..', 'plugins', 'model-apps', 'scripts', 'lib', 'app-spec.js'));
const PASS = { status: 'pass' };
const fail = (reason) => ({ status: 'fail', reason });
const skip = (reason) => ({ status: 'skip', reason });
@@ -312,6 +315,141 @@ ASSERTIONS.set('teardown: every declared command bar has a teardown step', ({ fa
return steps === entities.size ? PASS : fail(`expected ${entities.size} command-bar teardown step(s), got ${steps}`);
});
+// declarative logic: businessRules[] + businessProcessFlows[] ------------------------------------
+//
+// Both surfaces share one failure mode that no downstream check catches: the platform ACCEPTS a
+// definition whose column bindings are wrong or missing, and the artifact then simply does nothing.
+// A business rule that binds a column the app never creates deploys, activates and never fires; a
+// BPF is refused outright for a field-less step, but only at push time on a live environment.
+//
+// So these grade the BINDINGS, against the spec's own data model, from the same pure def builders
+// the engine pushes. Each skips when the fixture declares none, so they are safe as common
+// assertions across every fixture.
+
+// Resolve the column names an entity legitimately offers a rule or a flow.
+//
+// This delegates to the plugin's own `declaredColumnLogicals` rather than re-deriving the set here.
+// The first version of this helper did re-derive it, and guessed the lookup column as
+// `rel.lookupName || '<referenced>id'` — but the App Spec stores the authored name at
+// `rel.lookup.schemaName`. The consequence was the worst kind for an eval: with a custom lookup name
+// it REJECTED correct builder output, and it ACCEPTED the default-named column the builder had not
+// emitted. An oracle that can be wrong in both directions is worse than no oracle, so it now shares
+// the production definition and cannot drift from it.
+const boundColumnsFor = (spec, entityLogical) => {
+ // `declaredColumnLogicals` keys on the spec's EXACT `schemaName`, while the facts carry the
+ // lower-cased Dataverse logical name — so resolve back to the declared spelling first.
+ const ent = (spec.entities || []).find((e) => e && String(e.schemaName || '').toLowerCase() === entityLogical);
+ if (!ent) return null;
+ return declaredColumnLogicals(spec, ent.schemaName);
+};
+
+ASSERTIONS.set('process: every business rule binds only columns the spec creates', ({ facts, spec }) => {
+ const rules = (facts.process && facts.process.rules) || [];
+ if (!rules.length) return skip('spec declares no business rules');
+ const bad = [];
+ for (const r of rules) {
+ const cols = boundColumnsFor(spec, r.entity);
+ if (!cols) { bad.push(`${r.name}: unknown entity '${r.entity}'`); continue; }
+ // An EMPTY binding set is the dangerous case, not merely an unknown one: it is what a
+ // mis-shaped condition tree produces, and it deploys as a rule with no clauses and no actions.
+ if (!r.fields.length) { bad.push(`${r.name}: compiles to NO column bindings at all`); continue; }
+ const unknown = r.fields.filter((f) => !cols.has(f));
+ if (unknown.length) bad.push(`${r.name}: binds unknown column(s) ${unknown.join(', ')}`);
+ }
+ return bad.length ? fail(bad.join('; ')) : PASS;
+});
+
+ASSERTIONS.set('process: every business rule compiles at least one condition and one action', ({ facts }) => {
+ const rules = (facts.process && facts.process.rules) || [];
+ if (!rules.length) return skip('spec declares no business rules');
+ const bad = rules.filter((r) => !r.operators.length || !r.actionTypes.length)
+ .map((r) => `${r.name}: ${r.operators.length} condition(s), ${r.actionTypes.length} action(s)`);
+ return bad.length ? fail(bad.join('; ')) : PASS;
+});
+
+ASSERTIONS.set('process: every BPF step binds a field on the flow entity', ({ facts, spec }) => {
+ const flows = (facts.process && facts.process.flows) || [];
+ if (!flows.length) return skip('spec declares no business process flows');
+ const bad = [];
+ for (const f of flows) {
+ const cols = boundColumnsFor(spec, f.entity);
+ if (!cols) { bad.push(`${f.name}: unknown entity '${f.entity}'`); continue; }
+ if (!f.stages.length) { bad.push(`${f.name}: has no stages`); continue; }
+ for (const st of f.stages) {
+ if (!st.steps.length) bad.push(`${f.name}/${st.name}: stage has no steps`);
+ // The platform rejects a field-less step outright ("datafieldname of ControlStep cannot be
+ // null or empty"), so an unbound step is a build failure, not a cosmetic gap.
+ for (const s of st.steps) {
+ if (!s.field) bad.push(`${f.name}/${st.name}/${s.name}: step binds no field`);
+ else if (!cols.has(s.field)) bad.push(`${f.name}/${st.name}/${s.name}: unknown column '${s.field}'`);
+ }
+ }
+ }
+ return bad.length ? fail(bad.join('; ')) : PASS;
+});
+
+ASSERTIONS.set('process: every BPF stage is scoped to the flow entity (v1 is single-entity)', ({ facts }) => {
+ const flows = (facts.process && facts.process.flows) || [];
+ if (!flows.length) return skip('spec declares no business process flows');
+ const bad = flows.flatMap((f) => f.stages.filter((st) => st.entity !== f.entity)
+ .map((st) => `${f.name}/${st.name}: stage entity '${st.entity}' != flow entity '${f.entity}'`));
+ return bad.length ? fail(bad.join('; ')) : PASS;
+});
+
+ASSERTIONS.set('teardown: every declared business rule and process flow has a teardown step', ({ facts, spec }) => {
+ const rules = (spec.businessRules || []).length;
+ const flows = (spec.businessProcessFlows || []).length;
+ if (!rules && !flows) return skip('spec declares no business rules or process flows');
+ const ruleSteps = facts.teardown.kinds.filter((k) => k === 'businessRules').length;
+ const flowSteps = facts.teardown.kinds.filter((k) => k === 'businessProcessFlows').length;
+ if (ruleSteps !== rules) return fail(`expected ${rules} business-rule teardown step(s), got ${ruleSteps}`);
+ if (flowSteps !== flows) return fail(`expected ${flows} process-flow teardown step(s), got ${flowSteps}`);
+ return PASS;
+});
+
+// per-eval expectations (eval 5 "process logic") — the declarative-logic surfaces, by value --------
+
+ASSERTIONS.set('the BPF stage order is Intake, Investigate, Resolve and every step binds a declared column', ({ facts }) => {
+ const flow = (facts.process.flows || [])[0];
+ if (!flow) return fail('no business process flow fact');
+ const order = flow.stages.map((s) => s.name);
+ if (!eq(order, ['Intake', 'Investigate', 'Resolve'])) return fail(`stage order = [${order}]`);
+ // Stage order is positional, not a sortable field: the SDK emits stages in array order and the
+ // stage bar renders them that way, so a mapping that reordered them would silently change the
+ // process an agent is walked through.
+ const unbound = flow.steps.filter((s) => !s.field).map((s) => `${s.stage}/${s.name}`);
+ return unbound.length ? fail(`step(s) with no field: ${unbound.join(', ')}`) : PASS;
+});
+
+ASSERTIONS.set('the BPF binds the relationship lookup new_accountref, not just the case table’s own columns', ({ facts }) => {
+ // A lookup column exists only because a relationship creates it, so it is absent from the
+ // entity's `columns[]`. The fixture deliberately gives it a NON-DEFAULT name: an oracle that
+ // guessed `<referenced>id` would agree with `new_customerid` here and so could neither reject a
+ // builder that emitted the wrong column nor accept the right one.
+ const flow = (facts.process.flows || [])[0];
+ if (!flow) return fail('no business process flow fact');
+ const fields = flow.steps.map((s) => s.field);
+ return fields.includes('new_accountref') ? PASS : fail(`bound fields = [${fields}]`);
+});
+
+ASSERTIONS.set('a rule with two conditions compiles both, ANDed, and neither is dropped', ({ facts }) => {
+ const rule = (facts.process.rules || []).find((r) => r.name === 'Hide the diagnosis until investigation starts');
+ if (!rule) return fail('no two-condition rule fact');
+ if (rule.operators.length !== 2) return fail(`compiled ${rule.operators.length} condition(s), expected 2: [${rule.operators}]`);
+ // The presence operator carries no value, so a mapper that assumed every clause has one would
+ // drop it — and the rule would then fire on status alone.
+ if (!rule.operators.includes('DoesNotContainData')) return fail(`presence operator lost: [${rule.operators}]`);
+ return rule.fields.includes('new_owner') ? PASS : fail(`the presence clause lost its column: [${rule.fields}]`);
+});
+
+ASSERTIONS.set('every business rule and the process flow each get exactly one teardown step', ({ facts, spec }) => {
+ const rules = facts.teardown.kinds.filter((k) => k === 'businessRules').length;
+ const flows = facts.teardown.kinds.filter((k) => k === 'businessProcessFlows').length;
+ if (rules !== (spec.businessRules || []).length) return fail(`business-rule teardown steps = ${rules}`);
+ if (flows !== (spec.businessProcessFlows || []).length) return fail(`process-flow teardown steps = ${flows}`);
+ return PASS;
+});
+
// per-eval expectations (eval 4 "hardening") — explicit, value-specific checks of each fix ---------
ASSERTIONS.set('the ticket default view keeps new_customerid even though the table has 8 scalar columns (#2)', ({ facts }) => {
diff --git a/evals/model-apps/app-builder/lib/facts.js b/evals/model-apps/app-builder/lib/facts.js
index 4b8ba4313..3fc88be1c 100644
--- a/evals/model-apps/app-builder/lib/facts.js
+++ b/evals/model-apps/app-builder/lib/facts.js
@@ -8,7 +8,7 @@ function pluginLib(name) { return require(path.join(__dirname, '..', '..', '..',
const { migrateAppSpec, validateAppSpec, lookupColumnsFor, SDK_ROLE_MARKER } = pluginLib('app-spec.js');
const { lintAppSpec } = pluginLib('spec-lint.js');
-const { planFor, PHASES, appDef, viewDef, chartDef, compileFormIntent, formFieldLogicals, defaultViewColumns, enrichesDefaultViews, subgridLabel, personaRoleSpecFor } = pluginLib('sdk-build.js');
+const { planFor, PHASES, appDef, viewDef, chartDef, compileFormIntent, formFieldLogicals, defaultViewColumns, enrichesDefaultViews, subgridLabel, personaRoleSpecFor, businessRuleDef, bpfDef } = pluginLib('sdk-build.js');
const { subgridSectionIntent } = pluginLib('artifact-intent.js');
const { schemaFacts } = pluginLib('schema-facts.js');
const { verifySpec } = pluginLib('verify-spec.js');
@@ -201,16 +201,41 @@ function makeAllPresentReader(spec) {
}
const xml = `<SiteMap>${tags.join('')}</SiteMap>`;
+ // Business rules and BPFs are both `workflows` rows, and verifySpec reads them with a raw OData
+ // filter rather than by name — so an "all present" reader has to answer that query specifically.
+ // Returning the generic one-row stub is not enough: the row carries no `statecode`, and verify
+ // compares the deployed state against the spec's declared `status`, so every Active rule read as
+ // Draft and the fixture failed on an artifact that is, by construction, present.
+ //
+ // The filters are built by `businessRuleFilter` / `bpfFilter` and differ only by category:
+ // category eq 2 and type eq 1 and name eq 'Lock the summary' and primaryentity eq 'new_case'
+ // category eq 4 and type eq 1 and businessprocesstype eq 0 and name eq '...' and primaryentity eq '...'
+ // `odataLit` doubles a literal apostrophe, so undo that when matching the name back.
+ const workflowRow = (filter) => {
+ const f = String(filter || '');
+ const nameMatch = /name eq '((?:[^']|'')*)'/.exec(f);
+ if (!nameMatch) return [];
+ const wanted = nameMatch[1].replace(/''/g, "'");
+ const declared = /category eq 4/.test(f) ? (spec.businessProcessFlows || []) : (spec.businessRules || []);
+ const hit = declared.find((x) => x && x.name === wanted);
+ if (!hit) return [];
+ // Exactly ONE row: verify treats two rows sharing a name as duplicates, which is a real failure
+ // and must stay detectable rather than be papered over by a reader that always says "fine".
+ return [{ workflowid: `wf-${wanted}`, statecode: (hit.status || 'Active') === 'Active' ? 1 : 0 }];
+ };
+
return {
findTable: async (logical) => (entities.has(logical) ? { logicalName: logical } : null),
findColumns: async (logical) => columnsByEntity[logical] || [],
// All view/chart/form/dashboard existence checks pass — the reader always reports present. A
// `role` query (verifySpec's persona-role check) returns an SDK-authored (marker) role, and a
// `businessunit` query returns a root BU so the BU-scoped, fail-closed role check resolves offline.
- queryRecords: async (set) => (set === 'role'
+ queryRecords: async (set, opts) => (set === 'role'
? [{ roleid: 'role-x', description: SDK_ROLE_MARKER, ismanaged: false }]
: set === 'businessunit'
? [{ businessunitid: '00000000-0000-0000-0000-000000000001' }]
+ : set === 'workflow'
+ ? workflowRow(opts && opts.filter)
: [{ savedqueryid: 'x', savedqueryvisualizationid: 'x', formid: 'x' }]),
sitemapXml: async () => xml,
};
@@ -275,6 +300,53 @@ function teardownFacts(spec) {
return { kinds };
}
+// process: the two DECLARATIVE-LOGIC surfaces — `businessRules[]` and `businessProcessFlows[]`.
+//
+// Both compile to a nested node shape that the platform accepts far more readily than it honours: a
+// business rule whose condition tree is mis-shaped deploys, activates, and never fires, and a BPF
+// step with no bound field is refused outright by the platform rather than by any local check. So
+// what matters here is not "did we emit something" but WHICH COLUMNS the emitted definition actually
+// binds — the one property a downstream reader can compare against the spec's own data model.
+//
+// Facts are taken from the same pure def builders the engine pushes (`businessRuleDef` / `bpfDef`),
+// so a mapping change that silently drops a field shows up as a missing binding rather than as a
+// still-green count.
+function processFacts(spec) {
+ const rules = (spec.businessRules || []).map((r) => {
+ const def = businessRuleDef(r);
+ const clauses = (def.rootCondition && def.rootCondition.clauses) || [];
+ const actions = (def.rootCondition && def.rootCondition.trueBranch) || [];
+ return {
+ name: def.name,
+ entity: lc(def.entityLogicalName),
+ status: def.status,
+ // Every column the compiled rule touches, from both halves of the tree. A rule that binds a
+ // column the app does not create is authored against nothing.
+ fields: [...clauses.map((c) => lc(c.field)), ...actions.map((a) => lc(a.field))].filter(Boolean),
+ operators: clauses.map((c) => c.operator),
+ actionTypes: actions.map((a) => a.type),
+ };
+ });
+ const flows = (spec.businessProcessFlows || []).map((f) => {
+ const def = bpfDef(f);
+ const stages = (def.stages || []).map((st) => ({
+ name: st.name,
+ entity: lc(st.entityLogicalName),
+ steps: (st.steps || []).map((s) => ({ name: s.name, field: lc(s.fieldName), required: s.required === true })),
+ }));
+ return {
+ name: def.name,
+ entity: lc(def.entityLogicalName),
+ status: def.status,
+ stages,
+ // Flattened for the binding check: a step whose `fieldName` did not survive the mapping
+ // arrives here as an empty string, which the assertion reports by stage and step name.
+ steps: stages.flatMap((st) => st.steps.map((s) => ({ stage: st.name, ...s }))),
+ };
+ });
+ return { rules, flows };
+}
+
// A synthetic "deployed app" reader built from the spec, so hydrateSpec (the pure download primitive)
// round-trips offline: the spec is projected into the deployed shapes hydrate consumes (sitemap JSON,
// pages with a GenPageId, entities, dashboards keyed by id), then hydrated back. Synthetic ids are
@@ -409,6 +481,7 @@ async function stageFacts(rawSpec) {
security: securityFacts(spec),
verify: await verifyFacts(spec),
page: pageFacts(spec),
+ process: processFacts(spec),
teardown: teardownFacts(spec),
roundTrip: await roundTripFacts(spec),
PHASES,
diff --git a/evals/model-apps/app-builder/tests/run-app-builder.test.js b/evals/model-apps/app-builder/tests/run-app-builder.test.js
index e937d6324..3e14b38eb 100644
--- a/evals/model-apps/app-builder/tests/run-app-builder.test.js
+++ b/evals/model-apps/app-builder/tests/run-app-builder.test.js
@@ -7,6 +7,11 @@ const os = require('node:os');
const { spawnSync } = require('node:child_process');
const runner = path.join(__dirname, '..', 'run-app-builder.js');
+// The fixture roster comes from the CONTRACT (evals.json), not from a number typed here. A hardcoded
+// count turns "someone added an eval" into a red build for a reason unrelated to the runner, and the
+// obvious fix — bump the number — is indistinguishable from silently accepting a fixture that
+// vanished. Reading the manifest keeps the check meaningful in both directions.
+const evalsManifest = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'evals.json'), 'utf8'));
function run(args) {
const r = spawnSync(process.execPath, [runner, ...args], { encoding: 'utf8' });
@@ -21,7 +26,10 @@ test('runner: real fixtures all pass and emit TAP v13', () => {
assert.match(stdout, /# Subtest: 2-orders-multipage/);
assert.match(stdout, /# Subtest: 3-assets-dashboard/);
assert.match(stdout, /# Subtest: 4-hardening/);
- assert.match(stdout, /# fixtures 4 \(pass 4, fail 0\)/);
+ assert.match(stdout, /# Subtest: 5-process-logic/);
+ const n = evalsManifest.evals.length;
+ assert.ok(n >= 5, `the manifest should still carry every fixture; got ${n}`);
+ assert.match(stdout, new RegExp(`# fixtures ${n} \\(pass ${n}, fail 0\\)`));
});
test('runner: --eval selects one fixture; --tier smoke filters', () => {
diff --git a/plugins/model-apps/.claude-plugin/plugin.json b/plugins/model-apps/.claude-plugin/plugin.json
index 413dd8d76..9d913dc7b 100644
--- a/plugins/model-apps/.claude-plugin/plugin.json
+++ b/plugins/model-apps/.claude-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "model-apps",
- "version": "2.5.1",
+ "version": "2.6.0",
"description": "Build model-driven Power Apps end to end: /app-builder authors whole apps (tables, relationships, forms, views, charts, security roles, app + sitemap) from a natural-language intent, and /genpage builds generative pages with specialist agents for planning, entity creation, and parallel code generation. Requires PAC CLI > 2.10.0 and Azure CLI (`az`). See CHANGELOG.md for v1.x -> v2.x migration.",
"author": {
"name": "Microsoft",
diff --git a/plugins/model-apps/.plugin/plugin.json b/plugins/model-apps/.plugin/plugin.json
index 413dd8d76..9d913dc7b 100644
--- a/plugins/model-apps/.plugin/plugin.json
+++ b/plugins/model-apps/.plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "model-apps",
- "version": "2.5.1",
+ "version": "2.6.0",
"description": "Build model-driven Power Apps end to end: /app-builder authors whole apps (tables, relationships, forms, views, charts, security roles, app + sitemap) from a natural-language intent, and /genpage builds generative pages with specialist agents for planning, entity creation, and parallel code generation. Requires PAC CLI > 2.10.0 and Azure CLI (`az`). See CHANGELOG.md for v1.x -> v2.x migration.",
"author": {
"name": "Microsoft",
diff --git a/plugins/model-apps/AGENTS.md b/plugins/model-apps/AGENTS.md
index dd2b38702..b1462d072 100644
--- a/plugins/model-apps/AGENTS.md
+++ b/plugins/model-apps/AGENTS.md
@@ -111,6 +111,25 @@ the pipeline and delegates each script's **behavioral spec** to the entries belo
buttons** (`commands[]` — functional JS on-click + static hidden/disabled, incl. **flyout/split-button
menus** via `type`+`children[]`), and **dashboards** (`dashboards[]` — chart/list/iframe/webresource
tiles) with **sitemap placement** (a `dashboard` subarea auto-pins the dashboard as an app component).
+ It also builds **business process flows** (`businessProcessFlows[]` — the staged process bar on a
+ record): a `workflows` row of category 4 / type 1 / businessprocesstype 0 whose XAML the SDK compiles
+ from ordered `stages[]`/`steps[]`, activated in the same push. The phase is additive
+ discover-reconcile keyed on `(entity, name)` like `business-rules` — it creates what is missing and
+ converges only Active/Draft **state**, never stage structure — and `bpfFilter` scopes every query in
+ build/verify/teardown to the DEFINITION row, excluding both the platform's activated `type 2` copy and
+ same-named TASK flows (also category 4). v1 is deliberately single-entity and linear: cross-entity
+ stages, branching, stage actions and `securityRoles` are **rejected at the spec gate** rather than
+ silently dropped, because the build cannot yet verify them (a BPF's role grants are privileges on the
+ backing table that ACTIVATION creates, so they belong to the `security` phase). The rejection is an
+ **allow-list at flow, stage AND step level**, because the SDK's normalizers copy a fixed key set and
+ discard the rest — so a `branch` written on a stage (where the SDK actually models it), or the very
+ plausible `fieldLogicalName` instead of `field` on a step, would otherwise validate clean and deploy
+ as if it had never been written. Two further platform facts the validator encodes: a flow's **name
+ must be unique across the whole spec**, because the SDK derives `uniquename` as
+ `new_<name lowercased, non-alphanumerics stripped>` — **ignoring the table** — and activation creates
+ a backing table with that name; and a stage must carry **at least one step**, because the SDK
+ substitutes a placeholder step named "New Step" for an empty one (its own `stage-needs-step` rule
+ never fires, as the placeholder is injected before it looks).
Following a **genpage-first policy**, overview/dashboard/analytics surfaces are authored as **generative
pages** (`pages[]`) rather than classic dashboards — the build's `pages` phase uses a **three-authority
model**: IDENTITY (durable `<app>_pagemanifest`, outranked by a downloaded spec's `pages[].pageId`),
@@ -132,8 +151,8 @@ the pipeline and delegates each script's **behavioral spec** to the entries belo
fails **closed** rather than scanning a partial list. Classic `dashboards[]` are opt-in.
**All of the build's Dataverse access is via the SDK** (see "Dataverse Access From Scripts" for the
sanctioned exceptions elsewhere), so metadata is persisted under
- `<app-folder>/.maker-workspace/` for reuse/edits. The 14 phases
- (`solution·data-model·sample-data·web-resources·views·charts·forms·commands·dashboards·app-shell·pages·ai-features·security·publish`)
+ `<app-folder>/.maker-workspace/` for reuse/edits. The 16 phases
+ (`solution·data-model·sample-data·web-resources·views·charts·forms·business-rules·business-process-flows·commands·dashboards·app-shell·pages·ai-features·security·publish`)
are unchanged; independent ops run with bounded parallelism.
Emits `[n/total]` events the orchestrator narrates + a `BuildHalt` it gates on. Dry-run by
default; `--apply` writes, `--sample-data` / `--publish` opt-in (`--publish` gates the final *bulk*
@@ -221,11 +240,15 @@ the pipeline and delegates each script's **behavioral spec** to the entries belo
- **`scripts/teardown-model-app.js` → `scripts/lib/sdk-teardown.js`** — the first-class, **classifier-safe**
teardown (reverse of the build), for cleaning up live-verification probes or a failed build. Deletes
exactly the artifacts a given App Spec declares, in dependency-safe order (**app module → security
- roles → dashboards → command bars → forms → charts → views → reset enriched default views to drop
+ roles → dashboards → command bars → business rules → business process flows → forms → charts → views
+ → reset enriched default views to drop
parent lookups → relationships → AI row summaries → tables [reverse-topological, children-first] →
web resources (generated app icon + page manifest + declared) → global choices → solution**). Forms/charts/views/relationships
are deleted **explicitly before tables** (a table delete does not reliably cascade cross-references; it
- does remove the table's own columns). **Web resources are deleted after tables**: a table's vector/raster
+ does remove the table's own columns). A business rule and a business process flow are `workflows` rows
+ bound to the entity, so they too are deleted before their table — and each is **deactivated first**,
+ because Dataverse refuses to delete an activated process. Deleting an activated BPF is also what
+ removes the org-owned **backing table** the platform creates on activation. **Web resources are deleted after tables**: a table's vector/raster
**icon** web resource is referenced by the table itself, so Dataverse refuses to delete it until the table
is gone (form JS, referenced by its already-deleted form, is safe either way). Teardown also removes the
build's **generated default app icon** (`<appUnique>_icon`, created in-solution when the spec sets no
diff --git a/plugins/model-apps/CHANGELOG.md b/plugins/model-apps/CHANGELOG.md
index 367fb1666..978bab16c 100644
--- a/plugins/model-apps/CHANGELOG.md
+++ b/plugins/model-apps/CHANGELOG.md
@@ -5,20 +5,72 @@ All notable changes to the **model-apps** plugin.
Entries are deliberately short: what changed and why it matters to you. The reasoning,
evidence and trade-offs behind a change live in its PR, in `docs/`, or in the linked issue.
-## [Unreleased] — 2.5.1
-
-SDK uptake. Adds per-form security roles and three column capabilities; **business rules now require
-an environment that supports them**.
+## [Unreleased] — 2.6.0
+
+Business process flows, plus an SDK uptake that changes how business rules fail on an environment
+that cannot host them.
+
+### Added
+
+- **`businessProcessFlows[]` — guided, staged processes on a table.** Ordered stages with steps bound
+ to that table's columns, activated on create (an inactive flow is invisible, not merely inert).
+ Every step must bind a `field`; the platform refuses one without. v1 is single-entity and linear —
+ branching, stage actions and role grants ([#513]) are rejected rather than silently dropped.
+
+### Changed
+
+- **A business rule is validated before it is written.** A rule the SDK's compiler cannot understand
+ used to deploy as an empty rule that never fires. The build now runs the designer's own
+ completeness validator first and fails with its findings. No rule this spec surface can author is
+ affected — the whole operator/action/scope matrix was measured clean.
+
+### Fixed
+
+- **A build no longer halts on an environment that cannot host business rules.** The SDK now reports
+ the preview gate as a returned no-op instead of a thrown error; the build read that as a version
+ conflict and stopped. Such rules are skipped with a warning again, as documented — which matters
+ because those environments are the common case.
+- **A failed push reports the SDK's own reason.** Any push failure the build had no specific remedy
+ for was reported as *"the artifact changed in Maker"*, sending you to re-download an app nobody had
+ touched.
+- **Download round-trips `app.newLook` and `app.headerNavigationRefresh`** ([#514]). A downloaded spec
+ carried neither, so rebuilding it into another environment produced a classic-shell app and nothing
+ reported the loss.
+- **`views[].columns` rejects a non-string entry** ([#525]). An object was accepted by validation and
+ written into the view's fetchxml as `[object object]`; the build then failed at the platform and
+ left behind a view row that could not be read or deleted, so every later build failed the same way.
+- **A business process flow whose derived unique name is already taken is refused up front.** That
+ name is a *table* name — activation creates a backing table from it — and the derivation ignores
+ both the table and your publisher prefix, so a flow named after its own table collided silently and
+ failed late, mid-build. Now rejected at the plan gate against declared tables, and at build time
+ against any flow or table already in the environment.
+- **A reused business rule rejoins its solution on every build.** Solution membership was reconciled
+ only on the create path, so a rule that already existed — because an earlier component add failed,
+ or because it came from a different solution — stayed outside the solution permanently and never
+ travelled on export/import, with nothing saying so.
+- **A push that fails with the SDK's `VERSION_CONFLICT` still tells you to re-download.** Reporting
+ unrecognised SDK codes verbatim had dropped that remedy from a real 412.
+- **A table reference that is not a string is rejected instead of being coerced.** `charts[].entity`,
+ a subgrid's `childEntity`, a sitemap subarea's `entity` and a dashboard tile's `entity` were
+ stringified before the check, so a nested array passed validation and then crashed the build with a
+ raw `TypeError`.
+
+[#513]: https://github.com/microsoft/power-platform-skills/issues/513
+[#514]: https://github.com/microsoft/power-platform-skills/issues/514
+[#525]: https://github.com/microsoft/power-platform-skills/issues/525
+
+## [2.5.1]
+
+SDK uptake. Adds per-form security roles and three column capabilities; **business rules now require
+an environment that supports them**.
### Changed
- **Business rules are environment-gated.** The SDK writes a rule only through the bound
- `CreateProcessWithWfomJson` member; the workflow-XAML fallback was removed upstream because it
- silently narrowed a rule into something you did not write. An environment that does not declare
- that member **cannot host business rules at all** — the common case, not an edge case. Such rules
- are **skipped** with a warning; everything else builds normally, and `--verify` reports them as
- *not applicable on this environment* rather than failing the build.
-
+ `CreateProcessWithWfomJson` member, and an environment that does not declare it **cannot host
+ business rules at all** — the common case, not an edge case. Such rules are skipped with a warning;
+ everything else builds, and `--verify` reports them as *not applicable on this environment*.
+
### Added
- **Generated pages can report to the customer's Application Insights** — behind the new
@@ -40,51 +92,48 @@ an environment that supports them**.
reaching PROD. Not to be confused with the plugin's own usage telemetry
(`/model-apps:telemetry`), which is unrelated and unchanged.
- **Per-form security roles** — `forms[].securityRoles`: offer a form to named `personas[]` or to
- `everyone`. A form with no assignment is visible to **every** role, so this *restricts* a form;
- undo with `everyone: true`, not by deleting the block. Takes effect after a publish. (AB#6648526)
+ `everyone`. A form with no assignment is visible to **every** role, so this *restricts* a form; undo
+ with `everyone: true`, not by deleting the block. Takes effect after a publish. (AB#6648526)
- **Boolean `defaultValue`, whole-number `integerFormat`, and per-column `isValidForCreate` /
- `isValidForUpdate` / `isValidForRead`** — the last of these is how you make a column read-only.
+ `isValidForUpdate` / `isValidForRead`** — the last is how you make a column read-only.
([#495], AB#6648523, AB#6648522, AB#6651276)
- **Twelve more business-rule operators** and **multi-condition rules** (ANDed). Spelling matters:
- `IsGreaterThan`, not `GreaterThan` — the SDK resolves an unknown operator to `Equals`, so the spec
- rejects anything outside its table and suggests the right spelling.
-- **A `description` on every artifact that accepts one.** Written at create time and omitted when
+ `IsGreaterThan`, not `GreaterThan` — the SDK silently resolves an unknown operator to `Equals`, so
+ the spec rejects anything outside its table.
+- **A `description` on every artifact that accepts one**, written at create time and omitted when
absent, so a rebuild never blanks text typed in the maker.
-- **Per-field form control** — `readOnly`, `hidden` and `after` (reposition), via a form-level
- `fieldOptions` map or inline on an explicit layout. `prune: false` edits a subset of a form without
- re-declaring every field, and only the enabled state is written, so a designer edit survives.
+- **Per-field form control** — `readOnly`, `hidden` and `after`, via a form-level `fieldOptions` map
+ or inline on an explicit layout. `prune: false` edits part of a form without re-declaring it.
- **The AI form-fill family is controllable per capability** — assist toolbar, edit-form predictions,
smart paste and file upload, instead of one flag that only governed the toolbar.
### Fixed
-- **Dashboards survive a download again** — the SDK could not deserialize a dashboard it had
- serialized, so no tiles were recovered and the download failed without `--allow-lossy-download`.
- ([#478])
+- **A `businessRules[]`-only edit is no longer treated as "nothing changed."** The diff driving
+ `--changed-only` had no entry for that phase, so the run did nothing at all. ([#478] fixed
+ alongside: the SDK could not deserialize a dashboard it had serialized, so downloads lost tiles.)
- **Descriptions converge on existing views and charts** — previously written only at create, so the
- platform's auto-created *"Active &lt;Plural&gt;"* view never got one. ([#496])
-- **Downloaded specs preserve deployed descriptions** where the artifact is reconstructed, and list
- the rest in a read-only inventory. ([#494])
-- **Teardown removes the activated copy of a business rule**, which previously stranded an
- undeletable row. ([#493])
-- **Existing columns honour an explicit `required` change on rebuild**; an omitted `required` still
- leaves the live column alone.
-- **Big Integer columns are no longer placed on auto-generated forms** — Big Integer has no Unified
- Interface control, so the field rendered *"Error loading control"* on every record.
+ auto-created *"Active &lt;Plural&gt;"* view never got one. ([#496])
+- **Downloaded specs preserve deployed descriptions**, listing the rest in a read-only inventory. ([#494])
+- **Teardown removes the activated copy of a business rule**, previously stranding an undeletable
+ row ([#493]), and clears column visualizations for a table the spec keeps (`existing: true`).
+- **Existing columns honour an explicit `required` change on rebuild**; an omitted one still leaves
+ the live column alone.
+- **Big Integer columns are no longer auto-placed on forms** — they have no Unified Interface control
+ and rendered *"Error loading control"* on every record.
- **AI on/off is read with the platform's semantics** — `0` = platform default, `1` = disabled,
`2` = enabled. Treating any non-zero value as "on" reported a disabled feature as enabled.
- **Presence operators** (`ContainsData` / `DoesNotContainData`) deploy; the compiler bug behind the
- `HTTP 500 — Error generating UiData` failures is gone with the compiler. ([#481])
+ `HTTP 500 — Error generating UiData` failures went with the compiler. ([#481])
- **The async-surface guard is AST-based** — a regex could not decide the remaining cases. ([#475])
- **`ai.summaries.default: "off"` no longer discards a per-table `enabled: true`**, and a
differently-cased `tables[]` key keeps its `instruction` and `columns`.
-- **A row summary an environment cannot license is skipped, not fatal** — and the AI model row the
- refused publish leaves behind is swept, so a rebuild does not then fail on a duplicate key.
+- **A row summary an environment cannot license is skipped, not fatal** — and the model row the
+ refused publish leaves behind is swept, so a rebuild does not fail on a duplicate key.
- **A spec with no `appShell` reports what to add** instead of dying with
- `Cannot read properties of undefined (reading 'areas')` after the app was already half-created.
+ `Cannot read properties of undefined (reading 'areas')` after the app was half-created.
- **A malformed `businessRules` is a validation error**, not a raw `TypeError`; duplicate-cleanup
warnings report the real failure instead of asserting a wedged platform row.
-- **Column visualizations are cleared on teardown for a table the spec keeps** (`existing: true`).
[#475]: https://github.com/microsoft/power-platform-skills/issues/475
[#478]: https://github.com/microsoft/power-platform-skills/issues/478
@@ -92,7 +141,8 @@ an environment that supports them**.
[#493]: https://github.com/microsoft/power-platform-skills/issues/493
[#494]: https://github.com/microsoft/power-platform-skills/issues/494
[#495]: https://github.com/microsoft/power-platform-skills/issues/495
-[#496]: https://github.com/microsoft/power-platform-skills/issues/496
+[#496]: https://github.com/microsoft/power-platform-skills/issues/496
+[#513]: https://github.com/microsoft/power-platform-skills/issues/513
## [2.5.0]
@@ -106,7 +156,7 @@ and jobs-to-be-done checkable, and fixes a class of failures that were silent.
create. Every field is checked against the rule's own entity, because a rule naming a column that
does not exist is accepted by the platform and then simply never fires. Operators `Equals` ·
`DoesNotEqual`. Additive on rebuild, torn down with the app, and a new `business-rules` build
- phase (15 now).
+ phase.
- **Custom grid rendering (preview) — `entities[].columns[].visualization`.** Render a column as a
radial dial, line chart, heat map or star rating in every grid and view that shows it. Per-column,
so it is declared once rather than per view. Where the platform has not provisioned the preview the
diff --git a/plugins/model-apps/docs/app-builder-capabilities.md b/plugins/model-apps/docs/app-builder-capabilities.md
index c59096d1c..990c7bb7c 100644
--- a/plugins/model-apps/docs/app-builder-capabilities.md
+++ b/plugins/model-apps/docs/app-builder-capabilities.md
@@ -67,6 +67,16 @@ apart deliberately.
not recognise to **Equals**, so `GreaterThan` (the natural misspelling of `IsGreaterThan`) would
deploy, activate and quietly test equality. The spec pins the list against the bundle's own table
in both directions.
+- **Every rule is checked by the business-rule designer's own completeness validator before it is
+ written.** The push cannot tell you a rule is wrong: a condition tree in an unexpected shape is
+ merged onto the node, ignored by the serializer, and written as a rule with no clauses and no
+ actions — HTTP 204, activated, and it never fires. The SDK exposes the same validator the designer
+ gates its Save button on, and nothing on the push path runs it, so the build does. Findings **halt**
+ the build and are reported verbatim; a bundle without the validator, or one that faults, is skipped
+ rather than allowed to block a build it cannot judge. Measured against the bundle: every shape this
+ spec surface can author — all sixteen operators, all four action types, every scope and status,
+ multi-condition and multi-action — reports zero findings, so this cannot reject a rule that was
+ previously buildable.
- `dataType` is currently **decorative** — measured across every accepted token, on both the
condition and the action path, the SDK types every literal as `String`. It is still validated as a
closed set so a typo is caught.
@@ -166,13 +176,65 @@ apart deliberately.
`success`→`saved` rename that silently disarmed the 412 guard. `sdk-uptake-contract.test.js`
compares `AI_APP_SETTING` to the SDK's map and asserts the gate/per-app names stay distinct.
+### Business process flows — ✅ verified live
+- `businessProcessFlows[]` — the staged process bar on a record: ordered `stages[]`, each with
+ ordered `steps[]` bound to columns of the same table. **Every step must bind a `field`**: the
+ platform refuses a step without one (`datafieldname of ControlStep cannot be null or empty`), so
+ there is no field-less "checklist" step — bind a Boolean flag for a manual check-off. `status`
+ defaults to `Active` because an inactive BPF is not merely inert, it is **invisible** — the stage
+ bar does not render at all.
+- Deployed as a `workflows` row (**category 4 / type 1 / businessprocesstype 0**) whose XAML the
+ vendored SDK compiles from the authored stages; an `Active` flow is activated in the same push
+ (`statecode 1` / `statuscode 2`). Every query in build, verify and teardown goes through one
+ `bpfFilter`, which scopes to the DEFINITION row and excludes both the platform's activated `type 2`
+ copy and same-named **task flows** (also category 4) — the two mistakes that cost real time on
+ business rules.
+- Additive on rebuild (matched by `entity` + `name`, reused if present, Active/Draft state converged
+ in both directions, and re-added to the solution on every run so a failed component add is repaired
+ rather than inherited); torn down with the app, deactivate-then-delete, before its table. Deleting
+ an activated flow cascades a **backing-table** drop and regularly runs past the client's 60s HTTP
+ timeout, so teardown polls the row rather than reporting a failure for work the server completed.
+ A new `business-process-flows` build phase sits next to `business-rules` (16 now).
+- **The derived unique name is a TABLE name, and it is guarded on both sides.** Dataverse stores the
+ flow as `new_<name lower-cased, non-alphanumerics stripped>` — the derivation ignores the table
+ *and* the solution's publisher prefix — and activation creates an org-owned backing table with that
+ logical name. So the name collides with three things, not one: another flow, a table the spec
+ declares, and anything already in the environment. The first two are rejected at the plan gate; the
+ third is a build-time probe that checks **both** `workflows` (by `uniquename`) and table metadata
+ (by logical name) and **halts** naming whichever owns it, instead of letting the create fail with a
+ platform error about a table the author never mentioned. It runs only on the create path, never on
+ reuse, and is best-effort — a diagnostic must never be the thing that breaks a build.
+- **v1 is single-entity and linear on purpose.** The SDK also models cross-entity stages, branching,
+ stage actions and security-role grants; the spec gate **rejects** those keys — as an allow-list at
+ flow, stage *and* step level — rather than ignoring them, so a flow never quietly deploys as
+ something other than what was authored. The allow-list shape matters: the SDK's normalizers copy a
+ fixed key set and discard the rest, so a stage `branch` or a step's `fieldLogicalName` (instead of
+ `field`) would otherwise pass validation and deploy bound to nothing. `securityRoles` needs role ids
+ and belongs to the `security` phase (a BPF's grants are privileges on the backing table that
+ activation creates) — tracked in
+ [#513](https://github.com/microsoft/power-platform-skills/issues/513).
+- **Live-verified**: build (11 created, verify 8/8), rebuild (flow reused, solution component
+ re-added), and teardown (exit 0, with an independent query confirming both the workflow row and its
+ activation-created backing table are gone). An invalid spec is refused pre-flight with no writes.
+- Two platform facts the validator encodes, both found by adversarial review and measured against the
+ bundle: a flow **name must be unique across the whole spec** (the derived `uniquename` ignores the
+ table and strips case/punctuation, and activation creates a backing table with that name, so two
+ colliding flows cannot both deploy); and a stage must carry **at least one step** (the SDK
+ substitutes a placeholder named "New Step" for an empty stage).
+- Unblocked a defect in the vendored SDK, fixed upstream and re-vendored: the hybrid XML grammar walk
+ descended into TEXT nodes, and `@xmldom/xmldom` (what the SDK's DOM shim installs headlessly)
+ exposes a text node's `childNodes` as `null` where jsdom returns an empty NodeList. Every BPF push
+ therefore threw `TypeError: Cannot read properties of null (reading 'length')` in the vendored
+ bundle — input-independent — while the SDK's own jsdom-only suite stayed green. Pinned by a real-bundle
+ test here and by a `@jest-environment node` regression upstream.
+
### Edit flow (download → edit → rebuild) — ✅ verified live
- `download-model-app.js` pulls a **deployed app** back into an editable App Spec (+ page code, icons, referenced entities, and the app's **real unmanaged solution** — `recoverAppSolution` enumerates the app's solution memberships and excludes the built-in `Active`/`Default`/`Basic` system solutions, so the spec names the right container for a later clean teardown); edit the spec and re-run the idempotent build — **create and edit share one path** (reuses app/tables, updates pages in place, keeps `GenPage` subareas). The app-shell phase **re-syncs the sitemap + components of any existing app** (fetch → recompute-from-spec → push → publish), so subarea add/rename/reorder edits land for **page-less apps too** — not just generative-page apps — and `--only app-shell` can force the rewrite. **Classic DashBoard subareas are *designed* to round-trip** — the dashboard is reconstructed into `dashboards[]` with **id-passthrough tiles** (each tile carries the deployed view/chart ids), so a rebuild recreates it against the existing views/charts without re-declaring them. **This now works end to end.** It previously did not: the vendored SDK’s `fetchArtifact(‘dashboard’, …)` threw `Cannot read properties of null (reading ‘length’)` while deserializing the `<parameters>` block it had itself serialized, so no tiles were recovered and the subarea was dropped — which failed the whole download unless `--allow-lossy-download` was passed. Root cause upstream: the grammar walk descended into **text** nodes, and the bundled XML parser returns `null` for a text node’s children. Fixed in the SDK and re-vendored; measured across the re-vendor as **0/4 → 4/4** round-trips (list tile, both chart-parameter spellings, and a tile with an empty parameter value), and pinned by `scripts/tests/dashboard-roundtrip.test.js`, which feeds a serialized dashboard straight back in. ([#478](https://github.com/microsoft/power-platform-skills/issues/478)) **Round-trip scope (not yet "complete"):** tables, sitemap/appShell, generative pages, icons, dashboards, and solution round-trip; **forms, views, charts, and commands do NOT yet** — view hydration was tried and reverted (LIVE-verified the deployed savedquery set can't reliably distinguish author views from Dataverse's auto-generated Active/Inactive/QuickFind system views). All survive on the live app (a rebuild preserves them by discovery) but are absent from the downloaded spec, so edit them in Maker or a fresh spec.
- Live regression on the edit path found + fixed **4 bugs**, then re-verified clean.
- `verify-model-app.js` — read-only reconcile of spec vs deployed (exits non-zero on anything missing). Sitemap checks are **element-scoped**: an area/subarea icon is matched on its own `<Area>`/`<SubArea>` element, and a **dashboard subarea** is verified by resolving the dashboard id (systemform type 0, by name) and matching the sitemap's `DefaultDashboard` — so a value reused elsewhere can't produce a false pass. **Multi-area sitemaps** and the dashboard-subarea path were re-verified live (positive + negative).
### Teardown — ✅ verified live
-- `teardown-model-app.js` deletes exactly what an App Spec declares, in dependency-safe order (app → dashboards → commands → forms → **security roles** → charts → views → relationships → AI row summaries → tables [children-first] → web-resources → global choices → solution). Forms/charts/views/relationships are removed **before** tables (a table delete doesn't reliably cascade cross-references); **web resources are removed AFTER tables** (a table's icon web resource is referenced by the table).
+- `teardown-model-app.js` deletes exactly what an App Spec declares, in dependency-safe order (app → dashboards → commands → business rules → business process flows → forms → **security roles** → charts → views → relationships → AI row summaries → tables [children-first] → web-resources → global choices → solution). Forms/charts/views/relationships are removed **before** tables (a table delete doesn't reliably cascade cross-references); **web resources are removed AFTER tables** (a table's icon web resource is referenced by the table). A business rule / business process flow is deactivated before it is deleted, because Dataverse refuses to delete an activated process.
- **Classifier-safe** (every id resolved from a spec-declared name via an exact-match, entity-scoped filter), dry-run by default, best-effort continue, not-found aware, undeletable (system/managed) artifacts recorded as `skipped`. A **restricted system solution** (`Active`/`Default`/`Basic`) is skipped rather than attempted (Dataverse 400s any delete of one), so a downloaded spec that defaulted its solution to `Default` tears down cleanly. An already-gone relationship (Dataverse 400 *"…but 0 were found"*) is tolerated as deleted, like the table not-found case.
### Tooling & internals — ✅ verified live
diff --git a/plugins/model-apps/docs/architecture.md b/plugins/model-apps/docs/architecture.md
index c70d0ea82..1193d3373 100644
--- a/plugins/model-apps/docs/architecture.md
+++ b/plugins/model-apps/docs/architecture.md
@@ -160,7 +160,7 @@ deterministic, idempotent, narrated SDK build. Create and **edit share one path*
┌────────────────────────────┐ STAGE: data (engine run 1)
│ Data pre-build │ build-model-app.js --stage data --apply
│ solution + data-model │ → tables exist for type-gen
- │ (NOT sample-data yet) │ 13 phases unchanged; this run covers:
+ │ (NOT sample-data yet) │ 16 phases unchanged; this run covers:
│ │ solution · data-model
└──────────────┬─────────────┘
│
@@ -178,12 +178,13 @@ deterministic, idempotent, narrated SDK build. Create and **edit share one path*
┌───────────────────────────────────────────────────────────────────┐
│ Full idempotent build build-model-app.js --apply --verify │ STAGES: ui · app · publish · verify
│ (engine run 2 — full; rediscovers data-model, then continues) │
- │ 13 phases: │
+ │ 16 phases: │
│ solution · data-model · sample-data (data) │
│ web-resources · views · charts · forms · │
+ │ business-rules · business-process-flows · │
│ commands · dashboards (ui) │
│ app-shell · pages [upload + PAGEREF_ resolve + │
- │ sitemap finalize] · ai-features (app) │
+ │ sitemap finalize] · ai-features · security (app) │
│ publish (publish) │
│ bounded parallelism; emits [n/total] events + BuildHalt gate │
│ --verify: auto-reconciles spec vs deployed after apply │
@@ -211,8 +212,8 @@ deterministic, idempotent, narrated SDK build. Create and **edit share one path*
| **author** | main loop | *(none — design-only)* |
| **data** | run 1 (schema) + run 2 (rows) | `solution` · `data-model` (run 1); `sample-data` (run 2) |
| **generate-pages** | main loop + agents | *(none — writes .tsx files)* |
-| **ui** | run 2 | `web-resources` · `views` · `charts` · `forms` · `commands` · `dashboards` |
-| **app** | run 2 | `app-shell` · `pages` · `ai-features` |
+| **ui** | run 2 | `web-resources` · `views` · `charts` · `forms` · `business-rules` · `business-process-flows` · `commands` · `dashboards` |
+| **app** | run 2 | `app-shell` · `pages` · `ai-features` · `security` |
| **publish** | run 2 | `publish` |
| **verify** | run 2 or standalone | *(reconcile pass)* |
diff --git a/plugins/model-apps/references/app-spec-schema.md b/plugins/model-apps/references/app-spec-schema.md
index fbb19c7b6..62e297b0f 100644
--- a/plugins/model-apps/references/app-spec-schema.md
+++ b/plugins/model-apps/references/app-spec-schema.md
@@ -428,6 +428,13 @@ Reference from a column via `"globalChoice": "new_priority"` (built before the c
{ "attr": "new_duedate", "op": "this-week" } // relative-date — no value
] }
```
+- **`columns[]` is an array of column NAMES (strings)**, and so are `sort[].attr` and
+ `filters[].attr`. Not `[{ "name": "..." }]` — that is the shape `forms[]` uses for its fields, and
+ it used to be accepted here and stringified into the view's FetchXML as `[object object]`. The
+ build then failed at the platform, mid-run, and left behind a view row that could not be read or
+ deleted, so every later build failed the same way
+ ([#525](https://github.com/microsoft/power-platform-skills/issues/525)). It is now rejected up
+ front, naming the view and the offending entry.
- `activeOnly` (default `true`) adds `statecode eq 0`. `filters[]` add conditions: `op` is any
FetchXML operator — `eq`/`ne`/`lt`/`le`/`gt`/`ge`/`like`, no-value ops (`eq-userid`, `null`,
`not-null`, `this-week`/`this-month`/`today`/…), and multi-value `in`/`not-in` (use `values[]`).
@@ -710,9 +717,82 @@ custom control), but the spec validator emits a warning.
- Every `field` must be a column on the rule's own `entity` (its own columns, its primary name, or a
lookup a relationship creates). A rule naming a column that does not exist is accepted by the
platform and then simply **never fires**, so this is validated up front.
+- **A rule is validated against the designer's own completeness rules before it is written.** The
+ push cannot tell you a rule is wrong — a condition tree in an unexpected shape is ignored by the
+ serializer and written as a rule with no clauses and no actions, which returns 204, activates, and
+ never fires. The build runs the same validator the business-rule designer gates its Save button on
+ and **halts** with its findings. Nothing this schema allows is rejected by it; if you hit it, the
+ rule genuinely would not have worked.
- **Rebuild behaviour is additive** — a rule is matched by `(entity, name)` and reused if present;
edits are **not** re-applied. Recreate the rule to change it.
+## businessProcessFlows[] (optional — guided, staged process on a table)
+
+A BPF is the stage bar across the top of a record: an ordered set of stages, each with steps the user
+works through.
+
+```jsonc
+{ "entity": "new_ticket", "name": "Ticket Handling",
+ "description": "How support tickets move to resolution", // optional
+ "status": "Active", // Active (default) | Draft — a Draft flow is deployed but does NOT
+ // appear on the form
+ "order": 1, // optional; the workflow's processorder when several flows apply
+ "stages": [
+ { "name": "Triage", "steps": [
+ { "name": "Subject", "field": "new_subject", "required": true },
+ { "name": "Priority", "field": "new_priority" } ] },
+ { "name": "Resolve", "steps": [
+ { "name": "Resolution notes", "field": "new_notes" },
+ { "name": "Confirmed with customer", "field": "new_confirmed" } ] }
+ ] }
+```
+
+- **Stages are ordered** (array order) and each needs a unique `name` **and at least one step**; steps
+ within a stage need unique names too. `stages[]` is required — a flow with no stage is not a
+ process. A stage with no steps is rejected because the SDK substitutes a placeholder step literally
+ named *"New Step"*, which would then appear on the stage bar without ever having been authored.
+- **A flow's `name` must be unique across the whole spec, not just per table.** The unique name
+ Dataverse stores is derived as `new_<name lower-cased, non-alphanumerics stripped>` — it **ignores
+ the table**, and the `new_` prefix is fixed regardless of your `publisherPrefix` — and activation
+ creates a backing table with that name, so `"Ticket Handling"` on two
+ different tables (or `"Ticket Handling"` and `"ticket-handling"` on one) cannot both deploy.
+ Validation rejects the collision and names the derived value; rename one, e.g.
+ `"Ticket Handling (Cases)"`.
+- **The derived name is a TABLE name, so it also collides with your tables.** A flow named
+ `"Ticket"` derives `new_ticket`; if the spec declares a table `new_ticket`, the flow cannot
+ deploy — and because the prefix is always `new_`, this is easy to hit on a spec using the default
+ `new` publisher prefix. Validation rejects that too, naming both. A collision the spec cannot see
+ (a rename between builds that preserves the derived name, or a flow — or a table — already in the
+ environment) is caught at build time by a probe that checks both `workflows` and table metadata,
+ and **halts** naming whichever owns the name rather than letting the create fail with a platform
+ error about a table you never mentioned. The probe is best-effort — if it cannot run, the build
+ proceeds.
+- **Every step must bind a `field`**, and it must be a column on the flow's own `entity` (its own
+ columns, its primary name, or a lookup a relationship creates). The platform rejects a step with no
+ column outright — `datafieldname of ControlStep cannot be null or empty` — so there is no such
+ thing as a field-less "checklist" step; for a manual check-off, bind a Boolean column such as a
+ `Confirmed` flag. Like a business rule, the platform *accepts* a step bound to a column that does
+ not exist and simply renders it bound to nothing, so the column is validated up front too.
+- **At most 30 stages per flow and 30 steps per stage** — ceilings the SDK enforces, checked here so
+ an over-large flow is a spec error rather than a failure in a late build phase.
+- **`status`** matters more than it does for a rule: an inactive BPF is not merely inert, it is
+ **invisible** — the stage bar does not render at all. `Active` is the default for that reason.
+- **v1 is single-entity and linear.** Every stage must be on the flow's own `entity`. The SDK also
+ models cross-entity stages, branching, stage actions and security-role grants; keys carrying them
+ are **rejected** at flow, stage **and** step level (the allowed keys are `name`/`entity`/
+ `description`/`status`/`order`/`stages`; per stage `name`/`entity`/`steps`; per step
+ `name`/`field`/`required`). The rejection is an allow-list rather than a list of known-bad names
+ because the SDK's own normalizers silently discard any key they do not copy — so an unguarded
+ `branch` on a stage, or `fieldLogicalName` instead of `field` on a step, would validate clean and
+ deploy as though it had never been written. Configure those in Maker after the flow deploys.
+- **Activation creates a backing table** (an org-owned table named after the flow's unique name)
+ that the platform manages. Teardown deactivates and deletes the flow, which removes it.
+- **Rebuild behaviour is additive**, exactly like business rules — a flow is matched by
+ `(entity, name)` and reused if present; only its Active/Draft **state** is converged. Stage and
+ step edits are **not** re-applied: recreate the flow to change its structure.
+- Verified by `--verify` on three axes: it exists, there is exactly **one** of it (duplicates would
+ offer users the same process twice), and its deployed state matches `status`.
+
## dashboards[] (optional — chart/list/iframe/web-resource tiles)
```jsonc
{ "name": "Operations", "description": "Daily queue health for the support lead.", "tiles": [
@@ -932,12 +1012,23 @@ entirely optional; omitting it leaves every AI feature at its platform default.
```jsonc
"ai": {
// appFeatures: opt specific AI features in or out for this app (all optional).
- // Values are `true`/`false` (the ergonomic spellings of the underlying numeric settings' 1/0) or an
- // explicit integer between 0 and 1000000 for a platform-defined value — notably `2` = "on for
- // everyone". The bound mirrors the SDK's own, so an out-of-range value is rejected here rather
- // than aborting the build half-applied.
+ //
+ // `false` DOES NOT MEAN "leave alone". It writes an explicit app-scope override that BEATS the
+ // org value, so setting it on a feature the org has enabled turns that feature OFF for this app.
+ // To leave a feature as the environment provides it, omit the whole `ai.appFeatures` block.
+ //
+ // The numeric value written is NOT a flat 1/0 — it differs by family (captured from the bundle):
+ // formFill, formFillSuggestions, formFillSmartPaste, formFillFiles -> true writes 2, false writes 1
+ // nlSearch, nlChart, m365 -> true writes 1, false writes 0
+ // For the form-fill family the tri-state is 0 = platform default, 1 = DISABLED, 2 = enabled, so
+ // `false` there means "explicitly disabled", not "unset".
+ // An explicit integer (0-1000000) is also accepted for a platform-defined value; the bound mirrors
+ // the SDK's own, so an out-of-range value is rejected here rather than aborting the build half-applied.
+ //
// These write PER-APP settings, which are distinct from the org-level admin gates the build
// preflights; a feature whose org gate is off is skipped with a warning and never silently applied.
+ // ENABLING is gated that way; DISABLING is not — a `false` is written even when the gate is off,
+ // which is why an incorrect `false` is the more damaging mistake of the two.
"appFeatures": {
"formFill": true, // Copilot-assisted form fill (data entry)
"nlSearch": true, // natural-language grid/view search (data exploration)
@@ -980,7 +1071,8 @@ auto-selects tables that are good row-summary candidates and skips those that ar
- State an **explicit output shape**: a short paragraph is the recommended default.
**Validation rules** (`validateAppSpec` / `lintAppSpec`):
-- `ai.appFeatures` keys must be one of `formFill · nlSearch · nlChart · m365`; values must be a boolean or an integer between `0` and `1000000` (hard error) — the same range the SDK enforces, so an out-of-range value is rejected here rather than aborting the build half-applied. `true`/`false` mean the underlying numeric setting's `1`/`0`; use an explicit integer (e.g. `2`) for a platform value like "on for everyone".
+- `ai.appFeatures` keys must be one of `formFill · nlSearch · nlChart · m365`; values must be a boolean or an integer between `0` and `1000000` (hard error) — the same range the SDK enforces, so an out-of-range value is rejected here rather than aborting the build half-applied. The boolean spelling is **not** a flat `1`/`0`: the **form-fill family** (`formFill` and its siblings) writes `2` for `true` and **`1` for `false`**, where `1` means *disabled* and `0` means *platform default*; `nlSearch`/`nlChart`/`m365` write `1`/`0`. Use an explicit integer for a platform value like "on for everyone".
+- **`false` is not "leave alone".** It writes an app-scope override that beats the org value, and unlike enabling it is **not** gated — so `false` on a feature the org has enabled will turn that feature off for this app. To inherit the environment's setting, omit `ai.appFeatures` entirely.
- Omitting `ai.appFeatures` does **not** mean "no AI features": a spec carrying any `ai` block gets the defaults `formFill · nlSearch · nlChart` on and `m365` off, and `--verify` reconciles that whole resolved set.
- `ai.summaries.default` must be `"auto"` or `"off"` (hard error).
- `ai.summaries.tables` keys must match a declared entity `schemaName` (case-insensitive, hard error).
diff --git a/plugins/model-apps/scripts/download-model-app.js b/plugins/model-apps/scripts/download-model-app.js
index 05837c867..a5580801a 100644
--- a/plugins/model-apps/scripts/download-model-app.js
+++ b/plugins/model-apps/scripts/download-model-app.js
@@ -18,6 +18,7 @@ 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 } = require('./lib/app-spec.js');
+const { odataGuid } = require('./lib/ai-app-settings.js');
// webresourcetype (int) -> app-spec web-resource type.
const WR_TYPE = { 1: 'html', 2: 'css', 3: 'js', 4: 'xml', 5: 'png', 6: 'jpg', 7: 'gif', 8: 'xap', 9: 'xsl', 10: 'ico', 11: 'svg', 12: 'resx' };
@@ -246,6 +247,67 @@ async function rowsByIds(sdk, set, idField, ids, select, mapRow) {
return out;
}
+// Read the two app-shell settings the BUILD writes but the download previously dropped, so a
+// downloaded spec round-trips them instead of silently reverting an app to the classic shell when it
+// is rebuilt into a fresh environment (#514).
+//
+// Only an EXPLICIT app-scope override is emitted. An absent row means "inherits the environment", and
+// the build treats an omitted field the same way — so omitting is the faithful representation, and
+// emitting a value for an inherited setting would invent an override the app never had.
+//
+// Encoding, and the trap it hides:
+// NewLookAlwaysOn stored as the string 'true' / 'false'
+// HeaderAndNavigationRefresh stored as a Number TRI-STATE where 2 = on, 1 = OFF, 0 = platform
+// default. A truthy read reports 1 — which means disabled — as enabled,
+// which is the same mistake that made `ai.appFeatures: false` disable a
+// live app's features.
+const SHELL_SETTINGS = {
+ NewLookAlwaysOn: { field: 'newLook', decode: (v) => (String(v).toLowerCase() === 'true' ? true : (String(v).toLowerCase() === 'false' ? false : undefined)) },
+ HeaderAndNavigationRefresh: { field: 'headerNavigationRefresh', decode: (v) => (String(v) === '2' ? true : (String(v) === '1' ? false : undefined)) },
+};
+
+async function readAppShellSettings(sdk, appId) {
+ const out = {};
+ try {
+ const defs = await sdk.queryRecords('settingdefinition', {
+ select: ['settingdefinitionid', 'uniquename'],
+ filter: Object.keys(SHELL_SETTINGS).map((n) => `uniquename eq '${n}'`).join(' or '),
+ top: 10,
+ });
+ const byId = new Map((defs || []).map((d) => [odataGuid(d.settingdefinitionid).toLowerCase(), d.uniquename]));
+ if (!byId.size) return out;
+ // Bound the read by the two DEFINITIONS, not by `$top`. Dataverse honours `$top` as a hard cap and
+ // omits `@odata.nextLink` (see COMPONENT_PAGE_CAP above), so an app-scoped read that leans on a row
+ // limit can return a partial page — and here a partial page is not a visible truncation but a WRONG
+ // ANSWER, because an absent row is indistinguishable from "inherits the environment". The app would
+ // round-trip without its override and rebuild into the classic shell, silently, which is the exact
+ // loss this function exists to stop. Filtering server-side makes the result at most one row per
+ // definition, so no number of unrelated settings on the app can push the shell rows off the page.
+ const defFilter = [...byId.keys()].map((id) => `_settingdefinitionid_value eq ${id}`).join(' or ');
+ const rows = await sdk.queryRecords('appsetting', {
+ select: ['value', '_settingdefinitionid_value'],
+ filter: `_parentappmoduleid_value eq ${odataGuid(appId)} and (${defFilter})`,
+ top: 10,
+ });
+ for (const r of rows || []) {
+ // Both sides of this join are normalized because a miss here is SILENT — an unrecognized id just
+ // `continue`s and the setting vanishes from the spec. Measured live, Dataverse returns both
+ // `settingdefinitionid` and `_settingdefinitionid_value` as bare lower-case GUIDs, so this is
+ // belt-and-braces on a fail-quiet path rather than a fix for an observed mismatch.
+ const name = byId.get(odataGuid(r && r._settingdefinitionid_value).toLowerCase());
+ const spec = name && SHELL_SETTINGS[name];
+ if (!spec) continue;
+ const decoded = spec.decode(r.value);
+ if (decoded !== undefined) out[spec.field] = decoded;
+ }
+ } catch {
+ // Best-effort, like every other capture here: a tenant without these setting definitions, or a
+ // caller without read access to appsettings, still gets a usable spec. Losing an optional shell
+ // setting must never fail a download.
+ }
+ return out;
+}
+
async function readDescriptionInventory(sdk, appId, solutionUniqueName) {
const inventory = { views: [], charts: [], forms: [], businessRules: [], globalChoices: [], roleRestrictedForms: [] };
try {
@@ -629,7 +691,7 @@ const IMAGE_WR_TYPES = new Set([5, 6, 7, 10, 11]);
// genuinely IS 'new': when the prefix is UNVERIFIED we cannot trust `startsWith(ownPrefix)`, so a genuine
// own custom icon (e.g. `crba3_nav.svg` while the fallback prefix is `new`) would fail the own-prefix test
// and — without this guard — be silently skipped with NO warning, re-introducing the exact broken-icon bug
-// this fix exists to prevent (Opus review, Medium). So when `prefixResolved` is false we do NOT re-declare
+// this fix exists to prevent. So when `prefixResolved` is false we do NOT re-declare
// any path-derived WR (an unknown non-'new' prefix would BuildHalt on a fresh env) but we PROBE every
// customRef and surface each genuine CUSTOM (unmanaged image) one as `unresolved` — a managed/OOB/absent
// ref is a system icon present in every env, so it stays silent (no false alarm).
@@ -654,7 +716,7 @@ async function iconWebResources(sdk, icons, customRefs, ownPrefix, prefixResolve
// PASS 1 — path-derived custom icons (safety-gated). Done FIRST so a name referenced BOTH by a platform
// path AND by a bare name is classified by the STRICTER path rules (and flagged `external`) before the
// lenient bare pass can re-declare it as deletable — otherwise the overlap silently loses teardown
- // protection and a shared nav icon gets deleted (Sol review, High).
+ // protection and a shared nav icon gets deleted.
for (const name of [...(customRefs || []), ...(navRefs || [])]) {
const key = String(name).toLowerCase();
if (seen.has(key)) continue;
@@ -999,7 +1061,7 @@ async function runDownload({ sdk, genpageCli, outDir, appId, appUnique, allowLos
// survives a rebuild into a fresh env that lacks it — but ONLY when it belongs to THIS app's own
// publisher (`solution.publisherPrefix`). A FOREIGN-prefix / OOB reference is left as a bare reference:
// re-declaring it would make the build try to createWebResource under an unregistered prefix on a fresh
- // env → a hard BuildHalt, turning a cosmetic broken icon into a failed build (Opus review).
+ // env → a hard BuildHalt, turning a cosmetic broken icon into a failed build.
const { webResources, unresolved: unresolvedIcons } = await iconWebResources(sdk, icons, customRefs, solution.publisherPrefix, solution.prefixResolved, navRefs);
if (unresolvedIcons && unresolvedIcons.length) {
// A custom nav icon we couldn't safely round-trip: either an own-prefix WR that's absent on the source
@@ -1035,7 +1097,7 @@ async function runDownload({ sdk, genpageCli, outDir, appId, appUnique, allowLos
// read didn't surface it: `appUnique` is the authoritative value (from the appmodule query) and is
// guaranteed present here (the sitemap gate above bails when it's falsy). This is what lets a rebuild
// resolve the EXISTING app by identity after a display-name rename instead of creating a duplicate.
- app: async () => ({ ...app, uniquename: (app && app.uniquename) || appUnique }),
+ app: async () => ({ ...app, uniquename: (app && app.uniquename) || appUnique, ...(await readAppShellSettings(sdk, appId)) }),
pages: async () => pages,
entities: async () => entities,
webResources: async () => webResources,
@@ -1180,4 +1242,4 @@ if (require.main === module) {
main().catch((err) => emitResult(false, err));
}
-module.exports = { untypedColumnNames, isRoleRestrictedFormXml, resolveAppId, collectSitemap, appComponentEntities, parseDownloadedPages, assignPageKeys, missingDownloads, entityFromMetadata, readEntityWithDescriptions, readDescriptionInventory, iconWebResources, readDashboards, droppedSubareaCount, recoverAppSolution, runDownload, preserveAuthoredLanguageCode };
+module.exports = { untypedColumnNames, isRoleRestrictedFormXml, resolveAppId, collectSitemap, appComponentEntities, parseDownloadedPages, assignPageKeys, missingDownloads, entityFromMetadata, readEntityWithDescriptions, readDescriptionInventory, readAppShellSettings, iconWebResources, readDashboards, droppedSubareaCount, recoverAppSolution, runDownload, preserveAuthoredLanguageCode };
diff --git a/plugins/model-apps/scripts/lib/ai-app-settings.js b/plugins/model-apps/scripts/lib/ai-app-settings.js
index 2de8d307a..0ae0de8e0 100644
--- a/plugins/model-apps/scripts/lib/ai-app-settings.js
+++ b/plugins/model-apps/scripts/lib/ai-app-settings.js
@@ -269,11 +269,19 @@ function settingIsOn(value, feature) {
}
/**
- * Normalize a GUID for use as an UNQUOTED OData lookup comparand. Dataverse returns bare GUIDs, but
- * a caller-supplied id can arrive `{braced}` (the form `normalizeGuid` also accepts); interpolating
- * that raw produces `_x_value eq {0000…}`, a malformed filter that 400s and — because the proof
- * fails closed — reports every feature as unprovable. Stripping braces keeps a legitimate id
- * working; anything else is passed through so a genuinely bad id still fails loudly.
+ * Normalize a GUID before it is interpolated into a Dataverse request. Dataverse returns bare GUIDs,
+ * but a caller-supplied id can arrive `{braced}` (the form `normalizeGuid` also accepts).
+ *
+ * This previously documented itself as the thing that keeps the `$filter` valid — that a braced
+ * comparand "400s". MEASURED against a live environment, that is not what the server does: a braced
+ * GUID in a `$filter` comparand is ACCEPTED and returns the right row (200), quoted or unquoted, on
+ * both a primary-key column and a lookup `_value` column. The shape that genuinely rejects braces is
+ * the URL KEY SEGMENT — `workflows({0000…})` returns 400 where `workflows(0000…)` succeeds.
+ *
+ * So normalize for the two reasons that hold: an id is also used as a plain string KEY for
+ * comparison (a Map join, a Set membership test), where a formatting difference is a SILENT miss
+ * rather than an error; and an id normalized here stays safe if it is later moved into a key
+ * segment. Anything that is not a brace passes through, so a genuinely bad id still fails loudly.
*/
function odataGuid(id) {
return String(id === undefined || id === null ? '' : id).replace(/[{}]/g, '');
diff --git a/plugins/model-apps/scripts/lib/app-spec.js b/plugins/model-apps/scripts/lib/app-spec.js
index d5e210663..fa3ab42fd 100644
--- a/plugins/model-apps/scripts/lib/app-spec.js
+++ b/plugins/model-apps/scripts/lib/app-spec.js
@@ -451,6 +451,68 @@ const BUSINESS_RULE_DATA_TYPES = ['String', 'Memo', 'Picklist', 'State', 'Status
// which cannot be resolved before the forms phase has run.
const BUSINESS_RULE_SCOPES = ['Entity'];
+// --- Business process flows (BPF) ---------------------------------------------------------------
+//
+// A BPF is a `workflows` row (category 4 / type 1 / businessprocesstype 0) whose XAML the platform
+// reads to materialize the read-only `processstage` rows. The vendored SDK owns that serialization;
+// the plugin owns the judgment below.
+//
+// v1 is deliberately a SINGLE-ENTITY, linear flow: ordered stages, each with ordered steps bound to
+// columns of that same entity. The SDK's artifact additionally models `category`, `nextStageId`,
+// `relationshipName`, `branch`, stage `actions` and `securityRoles`, and those are NOT exposed here:
+// * cross-entity stages / branching change what the flow MEANS and need live verification per
+// shape before being offered;
+// * `securityRoles` needs role IDs (the SDK grants CRUD privileges on the backing table that
+// ACTIVATION creates, via `reconcileBpfSecurityRoles({ roleId, access })`) — that is the
+// `security` phase's job, not this one, and is tracked as a follow-up.
+// Offering a knob the build cannot verify is how a spec deploys something the author did not mean.
+const BPF_STATUSES = ['Active', 'Draft'];
+
+// Mirror of the vendored SDK's BPF `uniquename` derivation:
+// uniqueName || `new_${name.toLowerCase().replace(/[^a-z0-9]/g, '') || 'businessprocessflow'}`
+// Two properties of it drive the collision check below, and both are easy to get wrong:
+// * it IGNORES the entity, so two flows on DIFFERENT tables can derive one unique name; and
+// * it strips case and punctuation, so "Ticket Handling" and "ticket-handling" derive the same one.
+// The plugin does not supply an explicit `uniqueName` (bpfDef leaves it to the SDK), so an author has
+// no way to disambiguate. This is not merely a name clash: ACTIVATION creates an org-owned backing
+// TABLE named after the derived value, so the second flow cannot deploy at all.
+function bpfUniqueName(name) {
+ const normalized = String(name === undefined || name === null ? '' : name).toLowerCase().replace(/[^a-z0-9]/g, '');
+ return `new_${normalized || 'businessprocessflow'}`;
+}
+
+// The keys a stage / step may carry. Everything else is REJECTED rather than dropped: the SDK's own
+// normalizers copy a fixed key set (stage: id/name/entityLogicalName/steps + category/nextStageId/
+// relationshipName/actions/branch; step: id/name/fieldName/required) and discard the rest, so an
+// unmapped key an author wrote — a stage `branch`, or the very plausible `fieldLogicalName` instead of
+// `field` — would otherwise validate clean and deploy as if it had never been written.
+const BPF_STAGE_KEYS = new Set(['name', 'entity', 'steps']);
+const BPF_STEP_KEYS = new Set(['name', 'field', 'required']);
+// Hard ceilings the vendored SDK enforces on a BPF. Pinned here so an over-large flow is a spec
+// error, not a throw from inside the bundle in a late build phase.
+const BPF_MAX_STAGES = 30;
+const BPF_MAX_STEPS = 30;
+
+// The column logical names an entity legitimately exposes to a rule / process step: its declared
+// columns, its primary name column, and any lookup a relationship creates ON it (a lookup is a real
+// column on the referencing table, just declared elsewhere in the spec).
+//
+// Shared by the business-rule and BPF validators — they ask the identical question, and an answer
+// that drifts between them would let one accept a field the other rejects.
+function declaredColumnLogicals(spec, entitySchemaName) {
+ const ent = (spec.entities || []).find((e) => e && e.schemaName === entitySchemaName);
+ const cols = new Set();
+ if (!ent) return cols;
+ if (ent.primaryAttribute && ent.primaryAttribute.schemaName) cols.add(String(ent.primaryAttribute.schemaName).toLowerCase());
+ for (const c of ent.columns || []) if (c && c.schemaName) cols.add(String(c.schemaName).toLowerCase());
+ for (const rel of spec.relationships || []) {
+ if (rel && rel.referencing === entitySchemaName && rel.lookup && rel.lookup.schemaName) {
+ cols.add(String(rel.lookup.schemaName).toLowerCase());
+ }
+ }
+ return cols;
+}
+
// Normalize a Dataverse language identifier (LCID) to a positive integer, or null if it is not one.
//
// This is the SINGLE definition used by all three entry points an LCID can arrive from, so they can
@@ -846,6 +908,21 @@ function validateAppSpec(spec, opts = {}) {
}
const entityNames = new Set();
const entityByLower = new Map(); // logical (lowercased schemaName) -> entity
+ // Describe a rejected value for an error message WITHOUT being able to throw doing it.
+ // `JSON.stringify` throws on a BigInt and on a getter that throws, which would turn a structured
+ // validation error into a raw crash — the exact outcome this validator exists to prevent.
+ const describeValue = (v) => { try { return JSON.stringify(v); } catch { return Object.prototype.toString.call(v); } };
+ // A table reference an author writes becomes a Dataverse METADATA NAME, so it has to be a string
+ // BEFORE it is compared. `String([["new_ticket"]])` is `"new_ticket"`, so a nested array passes an
+ // entity-membership check and then throws a raw TypeError deep in the build, where the engine
+ // calls `.toLowerCase()` on the array itself. It is the same trap as `views[].columns` (#525):
+ // coercing during validation makes the validator agree with a value the builder cannot use.
+ // Returns true when it reported a problem, so callers can `continue`.
+ const badEntityRef = (value, where) => {
+ if (typeof value === 'string' && value.trim()) return false;
+ errors.push(`${where}: entity must be a table name (a string), got ${describeValue(value)}`);
+ return true;
+ };
for (const e of spec.entities || []) {
if (!e.schemaName) {
errors.push('entity.schemaName is required');
@@ -1031,7 +1108,7 @@ function validateAppSpec(spec, opts = {}) {
if (!qv.targetEntity || !entityByLower.has(String(qv.targetEntity).toLowerCase())) errors.push(`form ${f.entity}: quickView references unknown targetEntity '${qv.targetEntity}'`);
if (!qv.form) { errors.push(`form ${f.entity}: quickView is missing form (the name of a QuickView form in forms[])`); continue; }
// Resolve by (name, targetEntity) AND prefer the QuickView — a same-named Main on the target entity
- // must not shadow the intended QuickView (order-dependent otherwise; Sol review). The build keys the
+ // must not shadow the intended QuickView (order-dependent otherwise). The build keys the
// quick-view lookup by (entity, QuickView, name) too.
const qvCandidates = (spec.forms || []).filter((x) => x.name === qv.form && String(x.entity).toLowerCase() === String(qv.targetEntity || '').toLowerCase());
const qf = qvCandidates.find((x) => (x.formType || 'Main') === 'QuickView') || qvCandidates[0];
@@ -1047,6 +1124,7 @@ function validateAppSpec(spec, opts = {}) {
errors.push(`form ${f.entity}: a subgrid is missing childEntity`);
continue;
}
+ if (badEntityRef(sg.childEntity, `form ${f.entity}: subgrid childEntity`)) continue;
if (!entityByLower.has(String(sg.childEntity).toLowerCase())) {
errors.push(`form ${f.entity}: subgrid references unknown childEntity '${sg.childEntity}'`);
continue;
@@ -1072,7 +1150,7 @@ function validateAppSpec(spec, opts = {}) {
}
// Two QuickView forms sharing (entity, name) make a quick-view reference — which resolves a QuickView by
// (targetEntity, name) — ambiguous (the build map keeps only one, order-dependently). Reject the
- // ambiguity at author time (Sol review). Main/Card share the "Information" name harmlessly (they're not
+ // ambiguity at author time. Main/Card share the "Information" name harmlessly (they're not
// quick-view targets), so this is scoped to QuickView.
const qvIdentity = new Set();
for (const f of spec.forms || []) {
@@ -1083,7 +1161,8 @@ function validateAppSpec(spec, opts = {}) {
}
for (const ch of spec.charts || []) {
validateDescription(ch && ch.description, `chart '${(ch && (ch.name || ch.entity)) || '(unnamed)'}'`, errors);
- if (!ch || !ch.entity || !entityByLower.has(String(ch.entity).toLowerCase())) {
+ if (!ch || badEntityRef(ch.entity, `chart '${(ch && (ch.name || ch.entity)) || '(unnamed)'}'`)) continue;
+ if (!ch.entity || !entityByLower.has(String(ch.entity).toLowerCase())) {
errors.push(`chart references unknown entity '${ch && ch.entity}'`);
continue;
}
@@ -1104,10 +1183,42 @@ function validateAppSpec(spec, opts = {}) {
}
}
for (const v of spec.views || []) {
- validateDescription(v && v.description, `view '${(v && (v.name || v.entity)) || '(unnamed)'}'`, errors);
+ const vlabel = `view '${(v && (v.name || v.entity)) || '(unnamed)'}'`;
+ validateDescription(v && v.description, vlabel, errors);
if (!entityNames.has(v.entity)) {
errors.push(`view references unknown entity '${v.entity}'`);
}
+ // A column/attribute reference is STRINGIFIED downstream, never type-checked: `viewDef` maps
+ // every one of them with `String(x).toLowerCase()`. So a non-string is not rejected — it is
+ // silently turned into text, and an object becomes the literal `[object object]`, which lands
+ // in the view's fetchxml. Dataverse refuses it with an opaque metadata error ("entity doesn't
+ // contain attribute with Name = '[object object]'") mid-build, after the solution, tables and
+ // columns already exist.
+ //
+ // The damage outlives that run. The savedquery row is created holding the bad fetchxml, so
+ // every later READ of it also 400s and the next build dies at the same step; Dataverse reports
+ // the row as system-defined and refuses to delete it, so recovery means tearing the table down.
+ // https://github.com/microsoft/power-platform-skills/issues/525
+ //
+ // `{ "name": "..." }` is not an exotic mistake: it is exactly the shape `forms[]` uses for its
+ // fields, so an author moving between the two surfaces writes it naturally.
+ const attrRef = (value, where) => {
+ if (typeof value !== 'string' || !value.trim()) {
+ errors.push(`${vlabel}: ${where} must be a non-empty column name (a string), got ${describeValue(value)}`);
+ }
+ };
+ if (v && v.columns !== undefined) {
+ if (!Array.isArray(v.columns)) errors.push(`${vlabel}: columns must be an array of column names`);
+ else v.columns.forEach((c, i) => attrRef(c, `columns[${i}]`));
+ }
+ if (v && v.sort !== undefined) {
+ if (!Array.isArray(v.sort)) errors.push(`${vlabel}: sort must be an array`);
+ else v.sort.forEach((s, i) => attrRef(s && s.attr, `sort[${i}].attr`));
+ }
+ if (v && v.filters !== undefined) {
+ if (!Array.isArray(v.filters)) errors.push(`${vlabel}: filters must be an array`);
+ else v.filters.forEach((f, i) => attrRef(f && f.attr, `filters[${i}].attr`));
+ }
}
// Commands (modern command-bar buttons). A functional button needs a JS library + function;
// the library must be a declared web resource (the on-click binds to it).
@@ -1160,16 +1271,7 @@ function validateAppSpec(spec, opts = {}) {
}
// Columns the rule may reference: the entity's own declared columns plus its primary name.
- const ent = (spec.entities || []).find((e) => e && e.schemaName === r.entity);
- const cols = new Set();
- if (ent) {
- if (ent.primaryAttribute && ent.primaryAttribute.schemaName) cols.add(String(ent.primaryAttribute.schemaName).toLowerCase());
- for (const c of ent.columns || []) if (c && c.schemaName) cols.add(String(c.schemaName).toLowerCase());
- // A lookup created by a relationship is a real column on the referencing table.
- for (const rel of spec.relationships || []) {
- if (rel && rel.referencing === r.entity && rel.lookup && rel.lookup.schemaName) cols.add(String(rel.lookup.schemaName).toLowerCase());
- }
- }
+ const cols = declaredColumnLogicals(spec, r.entity);
const checkField = (field, what) => {
if (!field) { errors.push(`${label}: ${what} needs a field`); return; }
if (cols.size && !cols.has(String(field).toLowerCase())) {
@@ -1237,6 +1339,154 @@ function validateAppSpec(spec, opts = {}) {
}
}
}
+ // Business process flows. Same discipline as business rules and for the same reason: the platform
+ // accepts a BPF whose step names a column that does not exist, materializes its stages, and then
+ // simply renders a step bound to nothing — no error at deploy time, and nothing downstream to
+ // catch it. So every field is checked against the flow's own entity here.
+ const bpfUniques = new Map();
+ for (const p of spec.businessProcessFlows || []) {
+ const label = `business process flow '${(p && p.name) || '(unnamed)'}'`;
+ if (!p || typeof p !== 'object' || Array.isArray(p)) { errors.push('businessProcessFlows[] entries must be objects'); continue; }
+ if (!p.name) errors.push(`${label}: name is required`);
+ else if (typeof p.name !== 'string' || !p.name.trim()) {
+ // The SDK derives the server unique name by lower-casing this value, so a non-string reaches
+ // `.toLowerCase()` and dies with a TypeError inside the bundle rather than a spec error here.
+ errors.push(`${label}: name must be a non-empty string`);
+ } else {
+ // Keyed on the DERIVED unique name, not on (entity, name). The build identifies a flow by
+ // (entity, name) for reuse, but the SERVER identity the SDK derives ignores the entity and
+ // strips case/punctuation — so an (entity, name) key would let two flows through that cannot
+ // both exist. See bpfUniqueName.
+ const unique = bpfUniqueName(p.name);
+ const clash = bpfUniques.get(unique);
+ if (clash !== undefined) {
+ errors.push(`${label}: collides with '${clash}' — both derive the Dataverse unique name '${unique}' (the derivation lower-cases the name, strips punctuation, and ignores the table). Activation creates a backing table with that name, so the second flow cannot deploy. Rename one, e.g. "${p.name} (Cases)".`);
+ } else {
+ bpfUniques.set(unique, p.name);
+ }
+ // The derived name is a TABLE name, so it collides with tables too — not only with other
+ // flows. Activation creates an org-owned backing table called `unique`, and a table with that
+ // logical name cannot be created twice.
+ //
+ // This axis is easy to hit precisely because the derivation ignores the solution's publisher
+ // prefix and always emits `new_`: on a spec using the default `new` prefix, a flow named after
+ // its own table ("Ticket" on `new_ticket`) derives exactly that table's logical name. Without
+ // this check it validates clean and then fails in the business-process-flows phase — after the
+ // solution, tables, columns, views, forms and the app already exist — with a platform error
+ // naming a table the author never meant to create.
+ //
+ // `existing: true` tables are included deliberately: the build does not create them, but they
+ // are still in the org, so the backing table clashes just the same.
+ const tableClash = entityByLower.get(unique);
+ if (tableClash) {
+ errors.push(`${label}: derives the Dataverse unique name '${unique}', which is already the logical name of the table '${tableClash.schemaName}' in this spec. Activating a flow creates a backing table with that name (the derivation lower-cases the name, strips punctuation, and always uses the 'new_' prefix regardless of your publisher prefix), so the flow cannot deploy. Rename the flow, e.g. "${p.name} Process".`);
+ }
+ }
+ if (!p.entity || !entityNames.has(p.entity)) { errors.push(`${label}: references unknown entity '${p.entity}'`); continue; }
+ if (p.status !== undefined && !BPF_STATUSES.includes(p.status)) {
+ errors.push(`${label}: status must be ${BPF_STATUSES.join('|')}`);
+ }
+ if (p.order !== undefined && (!Number.isInteger(p.order) || p.order < 1)) {
+ errors.push(`${label}: order must be a positive integer (it becomes the workflow's processorder)`);
+ }
+ // Allow-list the flow's own keys for the same reason as the stage/step ones below: naming only the
+ // three knobs we knew about left others (the SDK also models `globalActions`) neither mapped nor
+ // rejected — silently dropped, which is the failure this guard exists to prevent.
+ const BPF_FLOW_KEYS = new Set(['name', 'entity', 'description', 'status', 'order', 'stages']);
+ for (const k of Object.keys(p)) {
+ if (!BPF_FLOW_KEYS.has(k)) {
+ errors.push(`${label}: unsupported key '${k}' (allowed: ${[...BPF_FLOW_KEYS].join(', ')}). Security-role grants, branching and process actions are modelled by the SDK but cannot be verified by this build, so they are rejected rather than silently dropped — configure them in Maker after the flow deploys.`);
+ }
+ }
+ const cols = declaredColumnLogicals(spec, p.entity);
+ validateDescription(p.description, label, errors);
+ if (!Array.isArray(p.stages) || !p.stages.length) {
+ errors.push(`${label}: stages[] is required (a flow with no stage is not a process)`);
+ continue;
+ }
+ // The SDK enforces a hard ceiling of 30 stages per flow and 30 steps per stage. Without these
+ // the spec validates, the build runs, and the SDK throws in a late phase with the earlier
+ // artifacts already created — the same half-built-app failure the step-field rule above exists
+ // to prevent.
+ if (p.stages.length > BPF_MAX_STAGES) {
+ errors.push(`${label}: ${p.stages.length} stages — the platform allows at most ${BPF_MAX_STAGES}`);
+ }
+ const stageNames = new Set();
+ for (const st of p.stages) {
+ if (!st || typeof st !== 'object' || Array.isArray(st)) { errors.push(`${label}: each stage must be an object`); continue; }
+ if (!st.name) { errors.push(`${label}: every stage needs a name`); continue; }
+ if (stageNames.has(st.name)) errors.push(`${label}: duplicate stage name '${st.name}'`);
+ stageNames.add(st.name);
+ // Reject an unmapped stage key rather than dropping it. `branch`, `actions`, `nextStageId`,
+ // `category` and `relationshipName` are STAGE-level in the SDK's model — which is exactly where
+ // an author would write them — and bpfDef maps only name/entity/steps, so without this they
+ // would vanish silently.
+ for (const k of Object.keys(st)) {
+ if (!BPF_STAGE_KEYS.has(k)) {
+ errors.push(`${label}: stage '${st.name}' has unsupported key '${k}' (allowed: ${[...BPF_STAGE_KEYS].join(', ')}). Branching, stage actions and cross-entity flow are modelled by the SDK but cannot be verified by this build, so they are rejected rather than silently dropped — configure them in Maker.`);
+ }
+ }
+ // v1 is single-entity: a stage on another table is a cross-entity flow, which changes what the
+ // process means (it spans records) and is rejected rather than silently retargeted.
+ if (st.entity !== undefined && st.entity !== p.entity) {
+ errors.push(`${label}: stage '${st.name}' targets '${st.entity}' — cross-entity flows are not supported; every stage must be on ${p.entity}`);
+ }
+ if (st.steps !== undefined && !Array.isArray(st.steps)) {
+ errors.push(`${label}: stage '${st.name}': steps must be an array`);
+ continue;
+ }
+ // A stage MUST carry at least one step. The SDK's createDefault substitutes a placeholder step
+ // literally named "New Step" when a stage has none, so an empty stage deploys a step the author
+ // never wrote (and the SDK's own `stage-needs-step` rule never fires, because the placeholder is
+ // injected before it looks).
+ if (!(st.steps || []).length) {
+ errors.push(`${label}: stage '${st.name}' has no steps — a stage with none deploys a placeholder step named "New Step" that you did not author`);
+ }
+ if ((st.steps || []).length > BPF_MAX_STEPS) {
+ errors.push(`${label}: stage '${st.name}' has ${st.steps.length} steps — the platform allows at most ${BPF_MAX_STEPS} per stage`);
+ }
+ const stepNames = new Set();
+ for (const step of st.steps || []) {
+ if (!step || typeof step !== 'object' || Array.isArray(step)) { errors.push(`${label}: stage '${st.name}': each step must be an object`); continue; }
+ if (!step.name) { errors.push(`${label}: stage '${st.name}': every step needs a name`); continue; }
+ if (stepNames.has(step.name)) errors.push(`${label}: stage '${st.name}': duplicate step name '${step.name}'`);
+ stepNames.add(step.name);
+ // Same reason as the stage allow-list, and the likeliest instance of it: a step written with
+ // `fieldLogicalName` (the name used elsewhere in the SDK's own artifact shapes) is dropped by
+ // the step normalizer and deploys bound to nothing.
+ for (const k of Object.keys(step)) {
+ if (!BPF_STEP_KEYS.has(k)) {
+ errors.push(`${label}: stage '${st.name}' step '${step.name}' has unsupported key '${k}' (allowed: ${[...BPF_STEP_KEYS].join(', ')}${k === 'fieldLogicalName' ? " — the column key is 'field'" : ''})`);
+ }
+ }
+ // `field` is REQUIRED on every step. This was originally modelled as optional — a step with
+ // no field was documented as a "checklist item" — but the platform rejects it outright:
+ //
+ // HTTP 400 from .../api/data/v9.0/workflows(<id>)
+ // Attribute - datafieldname of ControlStep cannot be null or empty
+ //
+ // MEASURED live, and isolated by A/B: the identical flow with every step bound to a column
+ // deploys and activates cleanly. Because the push happens in a late phase, accepting the
+ // shape here meant the build HALTED after the solution, table, columns, views and forms were
+ // already created — the author got a half-built app and a platform error naming an internal
+ // XAML element they never wrote. So it is rejected up front, where it is actionable.
+ //
+ // `null` and a blank/whitespace string are the SAME defect as `undefined` and must give the
+ // same message. Treating only `undefined` as missing let them fall through to the column
+ // check, which reported `references ''` — or, worse, `references 'null'` from stringifying
+ // the value — instead of saying what was actually wrong.
+ const fieldGiven = step.field !== undefined && step.field !== null && String(step.field).trim() !== '';
+ if (!fieldGiven) {
+ errors.push(`${label}: stage '${st.name}' step '${step.name}' binds no field — every step must set 'field' (the platform rejects a step with no column: "datafieldname of ControlStep cannot be null or empty"). For a manual check-off, bind a Boolean column such as a "Confirmed" flag.`);
+ } else if (cols.size && !cols.has(String(step.field).toLowerCase())) {
+ errors.push(`${label}: stage '${st.name}' step '${step.name}' references '${step.field}', which is not a column on ${p.entity}`);
+ }
+ if (step.required !== undefined && typeof step.required !== 'boolean') {
+ errors.push(`${label}: stage '${st.name}' step '${step.name}': required must be a boolean`);
+ }
+ }
+ }
+ }
// Dashboards: chart/list tiles reference a declared chart/view; iframe needs a url; webresource a
// declared web resource.
const DASH_TILE_TYPES = new Set(['chart', 'list', 'iframe', 'webresource']);
@@ -1255,6 +1505,7 @@ function validateAppSpec(spec, opts = {}) {
if (byId) {
if (!t.viewId) errors.push(`dashboard '${d.name}': chart tile with visualizationId also needs viewId`);
if (!t.entity) errors.push(`dashboard '${d.name}': id-based chart tile needs entity`);
+ else badEntityRef(t.entity, `dashboard '${d.name}': chart tile`);
} else {
if (!t.chart || !chartNamesSet.has(t.chart)) errors.push(`dashboard '${d.name}': chart tile references unknown chart '${t.chart}'`);
if (!t.view || !viewNamesSet.has(t.view)) errors.push(`dashboard '${d.name}': chart tile needs a declared view for its data — '${t.view}' not found`);
@@ -1262,6 +1513,7 @@ function validateAppSpec(spec, opts = {}) {
} else if (t.type === 'list') {
if (byId) {
if (!t.entity) errors.push(`dashboard '${d.name}': id-based list tile needs entity`);
+ else badEntityRef(t.entity, `dashboard '${d.name}': list tile`);
} else if (!t.view || !viewNamesSet.has(t.view)) {
errors.push(`dashboard '${d.name}': list tile references unknown view '${t.view}'`);
}
@@ -1508,7 +1760,7 @@ function validateAppSpec(spec, opts = {}) {
// (`Account`), and a sitemap subarea's `entity` comes from the deployed sitemap XML as a
// LOGICAL name. A downloaded spec therefore legitimately pairs `schemaName: "Account"` with
// `entity: "account"`. Matches the chart check above, which already uses `entityByLower`.
- if (sa.entity && !entityByLower.has(String(sa.entity).toLowerCase())) errors.push(`sitemap subArea references unknown entity '${sa.entity}'`);
+ if (sa.entity && !badEntityRef(sa.entity, 'sitemap subArea') && !entityByLower.has(String(sa.entity).toLowerCase())) errors.push(`sitemap subArea references unknown entity '${sa.entity}'`);
if (sa.dashboard && !dashNamesSet.has(sa.dashboard)) errors.push(`sitemap subArea references unknown dashboard '${sa.dashboard}' (declare it in dashboards[])`);
// A sitemap URL subarea is EITHER a real link OR a web-resource reference —
// `$webresource:<name>` (what the Site Map Designer writes for a "custom page backed by an
@@ -1949,6 +2201,9 @@ module.exports = {
BUSINESS_RULE_ACTIONS,
BUSINESS_RULE_ACTION_TYPES,
BUSINESS_RULE_DATA_TYPES,
+ BPF_STATUSES,
+ bpfUniqueName,
+ declaredColumnLogicals,
BUSINESS_RULE_SCOPES,
migrateAppSpec,
columnTypeMap,
diff --git a/plugins/model-apps/scripts/lib/classify-changes.js b/plugins/model-apps/scripts/lib/classify-changes.js
index 71a021acc..95ad19879 100644
--- a/plugins/model-apps/scripts/lib/classify-changes.js
+++ b/plugins/model-apps/scripts/lib/classify-changes.js
@@ -36,6 +36,10 @@ const identityOf = {
form: (f) => `${low(f.entity)}|${f.formType || 'Main'}|${f.name || ''}`,
page: (p) => `${p.key || p.name}`,
webResource: (w) => `${w.name}`,
+ // A rule and a flow are both identified by (entity, name) — the same pair the build's reuse query
+ // and the teardown resolver use, so the classifier cannot disagree with them about which is which.
+ businessRule: (r) => `${low(r.entity)}|${r.name}`,
+ businessProcessFlow: (p) => `${low(p.entity)}|${p.name}`,
};
function low(s) { return String(s == null ? '' : s).toLowerCase(); }
@@ -150,15 +154,24 @@ function classifyAppShell(cur, prior) {
// Additive-skipped artifacts (charts/commands/dashboards) + web-resources: an ADDED one is created by a
// full build (no debt); an EDITED existing one is SKIPPED by the additive engine (debt); a REMOVED one's
// deletion is unproven (debt). Always full build (never a fast shape in v1).
-function classifyAdditive(cur, prior, phase, type, arrKey) {
+function classifyAdditive(cur, prior, phase, type, arrKey, opts = {}) {
+ // `convergedKeys` names the fields the ENGINE reconciles on an existing artifact. An edit confined
+ // to them still needs a full build, but it is applied — so recording it as permanent debt claims a
+ // divergence that will not exist after the rebuild. Business rules and business process flows both
+ // converge `status` (each reuse branch flips statecode in both directions), so a Draft->Active edit
+ // must not be filed as `-edit-not-convergent`.
+ const convergedKeys = opts.convergedKeys || [];
const out = { fast: [], full: [], debt: [] };
const { added, removed, common } = alignByIdentity(cur[arrKey], prior[arrKey], identityOf[type]);
if (added.length) out.full.push(`${phase}: ${added.length} new ${type}(s) added — full build`);
for (const r of removed) { out.full.push(`${phase}: ${type} '${r.id}' removed`); out.debt.push({ artifactType: type, identity: r.id, reason: `${type}-removed` }); }
for (const c of common) {
if (stableStringify(c.cur) !== stableStringify(c.prior)) {
- out.full.push(`${phase}: ${type} '${c.id}' edited — the additive build engine skips edits to an existing ${type}`);
- out.debt.push({ artifactType: type, identity: c.id, reason: `${type}-edit-not-convergent` });
+ const onlyConverged = convergedKeys.length && equalExcept(c.cur, c.prior, convergedKeys);
+ out.full.push(onlyConverged
+ ? `${phase}: ${type} '${c.id}' ${convergedKeys.join('/')} changed — reconciled by a full build`
+ : `${phase}: ${type} '${c.id}' edited — the additive build engine skips edits to an existing ${type}`);
+ if (!onlyConverged) out.debt.push({ artifactType: type, identity: c.id, reason: `${type}-edit-not-convergent` });
}
}
return out;
@@ -213,6 +226,12 @@ function classifyChanges(current, prior) {
case 'commands': merge(classifyAdditive(cur, prior, 'commands', 'command', 'commands')); break;
case 'dashboards': merge(classifyAdditive(cur, prior, 'dashboards', 'dashboard', 'dashboards')); break;
case 'web-resources': merge(classifyAdditive(cur, prior, 'web-resources', 'webResource', 'webResources')); break;
+ // Both are additive discover-reconcile: the engine creates what is missing and explicitly does
+ // NOT reapply stage/condition edits to an existing rule/flow ("recreate to change"), so an edit
+ // is real debt. The ONE exception is `status`: both reuse branches converge statecode in both
+ // directions, so a status-only change is applied by a rebuild and is not debt.
+ case 'business-rules': merge(classifyAdditive(cur, prior, 'business-rules', 'businessRule', 'businessRules', { convergedKeys: ['status'] })); break;
+ case 'business-process-flows': merge(classifyAdditive(cur, prior, 'business-process-flows', 'businessProcessFlow', 'businessProcessFlows', { convergedKeys: ['status'] })); break;
default:
// An unrecognized changed phase must never silently pass as fast (fail-closed).
fullReasons.push(`${phase}: changed — no fast-path shape recognized`);
diff --git a/plugins/model-apps/scripts/lib/entity-provision.js b/plugins/model-apps/scripts/lib/entity-provision.js
index 5baf9caf9..4509583dd 100644
--- a/plugins/model-apps/scripts/lib/entity-provision.js
+++ b/plugins/model-apps/scripts/lib/entity-provision.js
@@ -216,6 +216,29 @@ class BuildHalt extends Error {
}
}
+// Collect every `code` along an error's `cause` chain, outermost first.
+//
+// A phase-level `skipIf` predicate is handed whatever reached the runner, and that is NOT always the
+// SDK's own error: a failure the SDK reports BY VALUE goes through `requireSuccessfulPush`, which
+// wraps it in a `BuildHalt` carrying the SdkError as `cause`. A predicate that only reads `err.code`
+// therefore matches the thrown form and silently misses the returned form of the SAME condition —
+// which is exactly how a preview-gated capability turned from a clean skip into a build halt when
+// the SDK moved it from a throw to a return.
+//
+// Depth is bounded so a self-referential `cause` (seen in the wild when an error is re-wrapped with
+// itself) cannot spin here.
+function errorCodeChain(err, maxDepth = 5) {
+ const codes = [];
+ const seen = new Set();
+ let e = err;
+ for (let i = 0; e && typeof e === 'object' && i < maxDepth && !seen.has(e); i += 1) {
+ seen.add(e);
+ if (e.code) codes.push(e.code);
+ e = e.cause;
+ }
+ return codes;
+}
+
// A metadata create that fails because the component already exists (the classic re-run
// case). Dataverse answers 409, or 400 with a duplicate-name message. Used to make
// otherwise non-idempotent creates (e.g. alternate keys — the SDK has no key lister) safe
@@ -383,17 +406,36 @@ function requireSuccessfulPush(result, what, warn) {
if (!result) return result;
const committed = result.saved !== undefined ? result.saved : result.success;
if (committed === false || (committed === undefined && result.error)) {
- // Two DIFFERENT by-value failures reach here, and they need different remedies. Reporting an
- // already-exists collision as a concurrent edit tells the operator to re-download when nothing
- // changed under them, and hides the actual cause.
- const alreadyExists = result.error && result.error.code === 'ARTIFACT_ALREADY_EXISTS';
+ // SEVERAL different by-value failures reach here and they need different remedies, so the
+ // diagnosis is SELECTED from the SDK's own error code rather than assumed.
+ //
+ // The set is open and it grows: the SDK keeps moving failures from a throw to a return, and
+ // every newly-returned one landed on the "changed in Maker" wording below — telling the operator
+ // to re-download an app nobody had touched, over a cause that wording cannot describe. (Measured
+ // on the business-rule preview gate: an environment without the bound member now RESOLVES with
+ // `saved:false` where it used to throw.) So an unrecognised code is reported VERBATIM and
+ // propagated as the halt's own `code`, which also lets a phase-level `skipIf` match on it.
+ const label = what || result.type || 'artifact';
+ const sdkCode = (result.error && result.error.code) || null;
const detail = (result.error && result.error.message) || 'version conflict (412)';
- throw new BuildHalt(
- alreadyExists
- ? `push ${what || result.type || 'artifact'} failed: ${detail} — a row already exists at that id and no duplicate was created; adopt it (fetchArtifact) instead of re-creating it`
- : `push ${what || result.type || 'artifact'} failed: ${detail} — the artifact changed in Maker since it was fetched; re-download the app and rebuild (never overwrite a concurrent edit)`,
- { phase: 'push', code: alreadyExists ? 'already-exists' : 'version-conflict', recoverable: true, cause: result.error }
- );
+ const opts = { phase: 'push', recoverable: true, cause: result.error };
+ // Reporting an already-exists collision as a concurrent edit tells the operator to re-download
+ // when nothing changed under them, and hides the actual cause.
+ if (sdkCode === 'ARTIFACT_ALREADY_EXISTS') {
+ throw new BuildHalt(`push ${label} failed: ${detail} — a row already exists at that id and no duplicate was created; adopt it (fetchArtifact) instead of re-creating it`, { ...opts, code: 'already-exists' });
+ }
+ // No code at all is the bare 412 this guard was originally written for, and `VERSION_CONFLICT`
+ // is the code the SDK actually attaches to one — both mean the artifact moved under us, and
+ // re-downloading genuinely IS the remedy.
+ //
+ // `VERSION_CONFLICT` has to be named explicitly. Routing it to the generic branch below silently
+ // DROPPED the re-download instruction from a real 412, and nothing caught that: the unit
+ // fixtures here use a code-less error, and the real-bundle test never routes its result through
+ // this function.
+ if (!sdkCode || sdkCode === 'VERSION_CONFLICT') {
+ throw new BuildHalt(`push ${label} failed: ${detail} — the artifact changed in Maker since it was fetched; re-download the app and rebuild (never overwrite a concurrent edit)`, { ...opts, code: 'version-conflict' });
+ }
+ throw new BuildHalt(`push ${label} failed: ${detail}`, { ...opts, code: sdkCode });
}
// A push can COMMIT and still be partially wrong, and the SDK reports that by value rather than
// failing: an app whose components could not all be pinned, whose system-admin role assignment
@@ -890,4 +932,4 @@ async function provisionSampleData({ sdk, provision, runner, spec, dataModel })
return { records: result.records, entitySetFor };
}
-module.exports = { makeRunner, requireSuccessfulPush, reportPartialPush, makeEntitySetResolver, resolveLanguageCode, resolveAuthoringLanguage, provisionSolution, provisionDataModel, provisionSampleData, buildSeedGroup, BuildHalt, SDK_COLUMN_TYPE, isVisualizationUnsupported };
+module.exports = { makeRunner, requireSuccessfulPush, reportPartialPush, errorCodeChain, makeEntitySetResolver, resolveLanguageCode, resolveAuthoringLanguage, provisionSolution, provisionDataModel, provisionSampleData, buildSeedGroup, BuildHalt, SDK_COLUMN_TYPE, isVisualizationUnsupported };
diff --git a/plugins/model-apps/scripts/lib/hydrate-spec.js b/plugins/model-apps/scripts/lib/hydrate-spec.js
index 84fdd7c6c..86eb8540f 100644
--- a/plugins/model-apps/scripts/lib/hydrate-spec.js
+++ b/plugins/model-apps/scripts/lib/hydrate-spec.js
@@ -192,8 +192,19 @@ async function hydrateSpec(read) {
solution,
// Round-trip the app's REAL, immutable uniquename so a rebuild resolves the EXISTING app by identity
// (appUniqueName prefers this over the display-name derivation) — survives a display-name rename and
- // never creates a duplicate app (Sol review). Omitted for a legacy read that didn't surface it.
- app: { name: app.name, description: app.description || '', ...(app.uniquename ? { uniqueName: app.uniquename } : {}) },
+ // never creates a duplicate app. Omitted for a legacy read that didn't surface it.
+ //
+ // `newLook` / `headerNavigationRefresh` are emitted ONLY when the app carries an explicit app-scope
+ // override (#514). Absent means the app inherits the environment, and the build treats an omitted
+ // field the same way, so omitting is faithful — emitting a value for an inherited setting would
+ // invent an override the app never had.
+ app: {
+ name: app.name,
+ description: app.description || '',
+ ...(app.uniquename ? { uniqueName: app.uniquename } : {}),
+ ...(typeof app.newLook === 'boolean' ? { newLook: app.newLook } : {}),
+ ...(typeof app.headerNavigationRefresh === 'boolean' ? { headerNavigationRefresh: app.headerNavigationRefresh } : {}),
+ },
entities,
webResources,
views: [],
diff --git a/plugins/model-apps/scripts/lib/phase-diff.js b/plugins/model-apps/scripts/lib/phase-diff.js
index f5fb7df40..774f1427a 100644
--- a/plugins/model-apps/scripts/lib/phase-diff.js
+++ b/plugins/model-apps/scripts/lib/phase-diff.js
@@ -27,6 +27,12 @@ const PHASE_SLICES = {
views: (s) => s.views,
charts: (s) => s.charts,
forms: (s) => s.forms,
+ // business-rules / business-process-flows were MISSING here, which made a spec whose only change
+ // was a rule or a flow diff as "nothing changed" — so `--changed-only` classified a real edit as a
+ // no-op and did nothing at all. Both phases are additive discover-reconcile (see classifyAdditive),
+ // so their edits force a full build and record debt rather than a silent skip.
+ 'business-rules': (s) => s.businessRules,
+ 'business-process-flows': (s) => s.businessProcessFlows,
commands: (s) => s.commands,
dashboards: (s) => s.dashboards,
'app-shell': (s) => ({ app: s.app, appShell: s.appShell }),
diff --git a/plugins/model-apps/scripts/lib/projection.js b/plugins/model-apps/scripts/lib/projection.js
index 30b5f8a52..031f938b8 100644
--- a/plugins/model-apps/scripts/lib/projection.js
+++ b/plugins/model-apps/scripts/lib/projection.js
@@ -5,7 +5,7 @@
// `--changed-only` fast path, so a spec-side projection and a deployed-side projection can be compared
// EXACTLY (a mis-placed field add, a stale page, or an out-of-band sitemap edit all produce a different
// projection hash). Static classification alone is NOT trusted — these projections are the post-apply
-// EXACT verifiers (Sol design review, High #4).
+// EXACT verifiers.
//
// Three projections, one per convergent shape that has structure worth verifying:
// · formProjection — placement-exact: tab/section/row/cell + binding + isRequired + subgrid, NO ids.
diff --git a/plugins/model-apps/scripts/lib/sdk-build.js b/plugins/model-apps/scripts/lib/sdk-build.js
index 9349c29fe..93eab4090 100644
--- a/plugins/model-apps/scripts/lib/sdk-build.js
+++ b/plugins/model-apps/scripts/lib/sdk-build.js
@@ -34,6 +34,7 @@ const {
FORM_GUID_RE,
canonicalPersonaName,
BUSINESS_RULE_VALUELESS_OPERATORS,
+ bpfUniqueName,
} = require('./app-spec.js');
const { PHASES } = require('./stages.js');
const { topoOrderEntities, entityByLogical } = require('./_graph.js');
@@ -41,6 +42,7 @@ const {
makeRunner,
requireSuccessfulPush,
reportPartialPush,
+ errorCodeChain,
makeEntitySetResolver,
provisionSolution,
provisionDataModel,
@@ -358,6 +360,10 @@ function planFor(spec, opts) {
if ((f.quickViews || []).length) items.push({ phase: 'forms', label: `place ${f.quickViews.length} quick-view(s) on ${f.entity}` });
}
if (has('business-rules')) for (const r of spec.businessRules || []) items.push({ phase: 'business-rules', label: `business rule "${r.name}" on ${r.entity}` });
+ if (has('business-process-flows')) for (const p of spec.businessProcessFlows || []) {
+ const stages = (p.stages || []).length;
+ items.push({ phase: 'business-process-flows', label: `business process flow "${p.name}" on ${p.entity} (${stages} stage${stages === 1 ? '' : 's'})` });
+ }
if (has('commands')) for (const [entity, cmds] of Object.entries(commandsByEntity(spec))) items.push({ phase: 'commands', label: `command bar for ${entity} (${cmds.length} button(s))` });
if (has('dashboards')) for (const d of spec.dashboards || []) items.push({ phase: 'dashboards', label: `dashboard "${d.name}" (${(d.tiles || []).length} tile(s))` });
if (has('app-shell')) items.push({ phase: 'app-shell', label: `app module "${spec.app.name}" + sitemap` });
@@ -529,13 +535,13 @@ async function resolveExistingFormId(provision, def) {
const row = rows && rows[0];
// A pinned id names an EXISTING form to reconcile. If it's ABSENT this is a stale/wrong pin, NOT a
// create trigger — returning null would drop to the create path and mint a NEW form on EVERY rerun
- // (the pin stays in the spec), silently accumulating duplicate forms (Sol review). Fail loud instead.
+ // (the pin stays in the spec), silently accumulating duplicate forms. Fail loud instead.
if (!row) throw new Error(`form "${def.name}": pinned formId ${def.formId} does not exist on this environment — remove the pin to create a new form, or correct the id`);
// The pin must point at the SAME (table, type, name) the spec intends. reconcileForm blindly pushes the
// spec layout onto whatever id it gets, so a wrong pin (a Quick View id under formType:"Main", a form on
// another table, or an unrelated form) would CORRUPT that form. The pin's only legitimate use — two
// forms with identical (entity, type, name) — matches all three, so validating all three never rejects
- // a valid pin, only a mistaken one (Opus + Sol review).
+ // a valid pin, only a mistaken one.
const wantType = FORM_TYPE_CODE[def.formType || 'Main'];
if (String(row.objecttypecode).toLowerCase() !== String(def.entityLogicalName).toLowerCase()) {
throw new Error(`form "${def.name}": formId ${def.formId} belongs to table '${row.objecttypecode}', not '${def.entityLogicalName}'`);
@@ -623,7 +629,7 @@ function chartDef(spec, ch) { const entityLogical = ch.entity.toLowerCase();
// `spec.app.uniqueName` — return it VERBATIM so the build's existing-app lookup (findArtifact) AND teardown
// resolve the SAME deployed app even after a display-name RENAME. A Dataverse appmodule uniquename never
// changes once created, so deriving it from the MUTABLE display name would miss the existing app on a
-// rebuild and CREATE A DUPLICATE (Sol review). An AUTHORED create-fresh spec has no `app.uniqueName`, so
+// rebuild and CREATE A DUPLICATE. An AUTHORED create-fresh spec has no `app.uniqueName`, so
// derive it deterministically from the publisher prefix + display name — the exact rule the builder creates
// with. Shared with the teardown engine so both agree on the identity.
function appUniqueName(spec) {
@@ -857,6 +863,58 @@ function businessRuleFilter(name, entityLogical) {
return `category eq 2 and type eq 1 and name eq '${odataLit(name)}' and primaryentity eq '${odataLit(String(entityLogical).toLowerCase())}'`;
}
+// A BPF is a `workflows` row like a business rule, but a DIFFERENT category, so it needs its own
+// filter rather than a parameterized one — sharing it would invite passing the wrong category.
+//
+// category 4 = BusinessProcessFlow; type 1 = definition (activating a process creates a `type 2`
+// activated copy the platform owns and refuses to delete directly — see businessRuleFilter for the
+// full story, which cost real time there). `businessprocesstype eq 0` excludes TASK FLOWS, which are
+// also category 4; without it a task flow with the same name would be adopted as this flow.
+// See: https://learn.microsoft.com/en-us/power-apps/developer/data-platform/reference/entities/workflow
+function bpfFilter(name, entityLogical) {
+ return `category eq 4 and type eq 1 and businessprocesstype eq 0 and name eq '${odataLit(name)}' and primaryentity eq '${odataLit(String(entityLogical).toLowerCase())}'`;
+}
+
+// Map one App Spec `businessProcessFlows[]` entry to the vendored SDK's BpfArtifact shape.
+//
+// Pure: spec shape -> SDK shape. Three normalizations that are easy to get wrong:
+// 1. `entity` (a spec schemaName) becomes `entityLogicalName`, lower-cased — Dataverse logical
+// names are lower-case and the XAML binds on them.
+// 2. Each stage repeats the entity. The SDK models a per-stage entity (that is how a cross-entity
+// flow is expressed); v1 validates them equal, and stamping it here keeps the artifact valid
+// rather than relying on the adapter's `''` default.
+// 3. The step's column key is `fieldName`, NOT `fieldLogicalName`. The adapter's step normalizer
+// copies exactly `id`/`name`/`fieldName`/`required` and DROPS anything else, so a mis-named key
+// is silently discarded and the step deploys bound to nothing. Measured against the real bundle
+// and pinned in bpf-real-bundle.test.js.
+//
+// Ids are deliberately NOT minted here: the adapter assigns any missing stage/step id itself, and a
+// stable id would only matter for an edit-in-place path the build does not have (a flow is
+// reused-as-is or created whole).
+function bpfDef(flow) {
+ const entityLogicalName = String(flow.entity).toLowerCase();
+ const def = {
+ name: flow.name,
+ entityLogicalName,
+ // Active unless the author asks for Draft. A BPF is not merely inert when inactive — the stage
+ // bar does not render at all — so Active is the only useful default.
+ status: flow.status || 'Active',
+ stages: (flow.stages || []).map((st) => ({
+ name: st.name,
+ entityLogicalName,
+ steps: (st.steps || []).map((step) => ({
+ name: step.name,
+ ...(step.field !== undefined ? { fieldName: String(step.field).toLowerCase() } : {}),
+ ...(step.required !== undefined ? { required: step.required } : {}),
+ })),
+ })),
+ };
+ if (flow.description !== undefined) def.description = flow.description;
+ if (flow.order !== undefined) def.order = flow.order;
+ return def;
+}
+
+
// The (entity, formType, name) triple the App Spec uses to identify a form. Used to address a form
// from a LATER phase: `forms[].securityRoles` is applied during `security`, because a persona's role
// does not exist until then, and by that point the forms phase has finished and only the entity's
@@ -896,7 +954,7 @@ function businessRuleDef(rule) {
scope: rule.scope || 'Entity',
// Omitted when the spec has none, so a rebuild never blanks one added in the maker.
...(rule.description ? { description: rule.description } : {}),
- // Draft unless the author asks for Active. A rule is inert until activated, so defaulting to
+ // Active unless the author asks for Draft. A rule is inert until activated, so defaulting to
// Active is what makes `businessRules[]` do something on the first build.
status: rule.status || 'Active',
rootCondition: {
@@ -1066,7 +1124,7 @@ async function runSdkBuild(spec, opts = {}) {
return { ok: true, dryRun: true, plan: plan.map((p) => p.label) };
}
- const result = { ok: true, created: { entities: {}, relationships: {}, records: {}, webResources: {}, views: {}, charts: {}, forms: {}, formIds: {}, businessRules: {}, commands: {}, dashboards: {}, pages: {}, pageDeployedShas: {}, ai: { appFeatures: null, summaries: {} }, roles: {}, app: null }, skipped: { businessRules: [], aiSummaries: [] } };
+ const result = { ok: true, created: { entities: {}, relationships: {}, records: {}, webResources: {}, views: {}, charts: {}, forms: {}, formIds: {}, businessRules: {}, businessProcessFlows: {}, commands: {}, dashboards: {}, pages: {}, pageDeployedShas: {}, ai: { appFeatures: null, summaries: {} }, roles: {}, app: null }, skipped: { businessRules: [], aiSummaries: [] } };
// #changed-only (pages-only fast apply): seed the LIVE app id (discovered by unique name upstream) so the
// pages phase's `pages-requires-app` guard passes WITHOUT running the app-shell phase in this invocation.
// The full-build path never sets opts.changedOnly, so result.created.app stays null and app-shell
@@ -1731,7 +1789,7 @@ async function runSdkBuild(spec, opts = {}) {
const formIdByEntityName = {};
// Only QuickView forms are quick-view targets. Keying ALL forms by (entity, name) let a same-named
// Main form on the SAME entity OVERWRITE the QuickView entry (order-dependent), embedding the wrong
- // form id — so key QuickView forms only (Sol review).
+ // form id — so key QuickView forms only.
defs.forEach((d, i) => { if (d.f.name && (d.f.formType || 'Main') === 'QuickView') formIdByEntityName[`${String(d.f.entity).toLowerCase()}|${d.f.name}`] = ids[i]; });
for (let i = 0; i < defs.length; i++) {
const f = defs[i].f;
@@ -1743,7 +1801,7 @@ async function runSdkBuild(spec, opts = {}) {
let changed = false;
for (const qv of qvs) {
// A quick-view embeds a QuickView form OF THE TARGET ENTITY — key by (targetEntity, name), not a
- // global name, so two entities with same-named QuickView forms don't cross-wire (Sol review).
+ // global name, so two entities with same-named QuickView forms don't cross-wire.
const qvFormId = formIdByEntityName[`${String(qv.targetEntity).toLowerCase()}|${qv.form}`];
if (!qvFormId) throw new Error(`form "${f.name || f.entity}" quick-view references form '${qv.form}' on '${qv.targetEntity}' which wasn't built — declare it in forms[] with formType: "QuickView", entity "${qv.targetEntity}", and a matching name`);
const lookup = String(qv.lookup).toLowerCase();
@@ -1791,9 +1849,26 @@ async function runSdkBuild(spec, opts = {}) {
// SDK's documented `code`, never on `err.name` — the bundle is minified, so the class name is a
// rebuild-unstable string (`Xe`, which is really the base SdkError), and matching it would
// silently disarm this guard the next time the bundle is rebuilt.
- const businessRuleApiUnavailable = (err) => (err && err.code === 'BUSINESS_RULE_API_UNAVAILABLE'
- ? 'unsupported in this environment'
- : false);
+ //
+ // The code is looked for along the whole CAUSE CHAIN, not just on the error handed to us,
+ // because the SDK signals this condition two different ways and both mean the same thing:
+ // * it THROWS the SdkError (older bundles), which arrives here directly; or
+ // * `pushArtifact` RESOLVES with `{ saved: false, error }` — the preview rollout is a reported
+ // no-op rather than a failure — and `requireSuccessfulPush` wraps that into a BuildHalt
+ // whose `cause` is the SdkError.
+ // Reading only `err.code` matched the first and missed the second, so once the SDK moved this to
+ // a return, every build on an environment without the member HALTED instead of skipping — and
+ // AGENTS.md records that such environments are the common case, not the edge case.
+ const businessRuleApiUnavailable = (err) => {
+ const codes = errorCodeChain(err);
+ // `BUSINESS_RULE_LEFT_DEACTIVATED` must NEVER collapse into this skip. It means a write failed
+ // AND the SDK could not put the rule back into the Activated state it found it in, so a live
+ // rule is sitting Draft on the server — reporting that as "this environment cannot host rules"
+ // tells the operator the opposite of what they need to act on. The SDK raises it as a distinct
+ // code for exactly this reason; honour the distinction here.
+ if (codes.includes('BUSINESS_RULE_LEFT_DEACTIVATED')) return false;
+ return codes.includes('BUSINESS_RULE_API_UNAVAILABLE') ? 'unsupported in this environment' : false;
+ };
for (const rule of spec.businessRules || []) {
const entityLogical = String(rule.entity).toLowerCase();
const existing = await provision.queryRecords('workflow', {
@@ -1867,6 +1942,22 @@ async function runSdkBuild(spec, opts = {}) {
runner.skip('business-rules', `business rule "${rule.name}" on ${rule.entity} (exists — reuse; rule edits aren't applied on rebuild, recreate to change)`);
}
result.created.businessRules[`${entityLogical}|${rule.name}`] = existingId;
+ // Reconcile solution membership on the REUSE path too, for the same reason the BPF phase
+ // does. `addSolutionComponent` is otherwise only reached by the create branch, so a run
+ // where the rule was written but the component add failed — or a rule created by an earlier
+ // build of a DIFFERENT solution — is reused forever and never joins this one, leaving it out
+ // of export/import with nothing in the output saying so. The SDK treats an already-present
+ // component as success, so re-issuing it every build is safe.
+ //
+ // A failure here warns rather than halts: the rule itself is correct and running, and
+ // blocking an otherwise-good build over solution bookkeeping would be the worse outcome.
+ try {
+ await provision.addSolutionComponent({ componentId: existingId, componentType: COMPONENT_TYPE.workflow, solutionUniqueName: sol.uniqueName });
+ } catch (e) {
+ if (typeof opts.warn === 'function') {
+ opts.warn(`business rule "${rule.name}" on ${rule.entity} exists but could not be added to solution '${sol.uniqueName}' (${e && e.message}). The rule works, but it will not travel on solution export until it is added.`);
+ }
+ }
continue;
}
await runner.run('business-rules', `business rule "${rule.name}" on ${rule.entity}`, async () => {
@@ -1875,6 +1966,41 @@ async function runSdkBuild(spec, opts = {}) {
// The condition tree is a nested object, so it goes on through the generic element surface
// rather than the create payload — mirroring how the SDK's own workflow test authors one.
await provision.updateElement('businessRule', art.id, '/rootCondition', def.rootCondition);
+ // The push CANNOT tell you a rule is wrong. A mis-shaped condition tree is MERGED onto the
+ // node, ignored by the serializer, and written as a rule with no clauses and no actions:
+ // HTTP 204, activated, and it never fires. That trap is pinned in sdk-uptake-contract.test.js
+ // ("a wrongly-shaped condition produces an EMPTY rule rather than erroring") and, until this
+ // SDK, the spec gate was the only thing standing in front of it.
+ //
+ // The SDK now exposes the business-rule designer's OWN completeness validator — the same one
+ // the designer gates its Save button on — and states plainly that nothing on the push path
+ // runs it, so run it here, BEFORE the write.
+ //
+ // Strict about FINDINGS, best-effort about the VALIDATOR. Findings halt: a rule that reports
+ // success and never fires is exactly the silent-wrong-artifact class this engine exists to
+ // prevent, and it is invisible afterwards. But a bundle without the method, or a validator
+ // that throws, must not block a build it cannot judge.
+ //
+ // Field metadata is deliberately NOT passed: without it the SDK SUPPRESSES the
+ // metadata-dependent checks (Clear eligibility, value-type compatibility, max length) rather
+ // than failing them, and the structural checks are the ones that close the trap above.
+ // Passing them would cost an attribute read per rule for checks the spec gate already covers.
+ //
+ // MEASURED against this bundle: every shape this spec surface can author — all 16 operators,
+ // all 4 action types, every scope and status, multi-condition and multi-action — reports zero
+ // issues, so this cannot reject a rule that was previously buildable.
+ if (typeof provision.validateBusinessRule === 'function') {
+ let issues = null;
+ try {
+ issues = provision.validateBusinessRule(Object.assign({}, art, { rootCondition: def.rootCondition }));
+ } catch { /* a diagnostic that cannot run must never fail the build */ }
+ if (Array.isArray(issues) && issues.length) {
+ const detail = issues.map((i) => `${(i && i.rule) || 'issue'}: ${(i && i.message) || ''}`.trim()).join('; ');
+ throw new BuildHalt(
+ `business rule "${rule.name}" on ${rule.entity} is incomplete and would deploy as a rule that never fires — ${detail}`,
+ { phase: 'business-rules', code: 'business-rule-incomplete', recoverable: false });
+ }
+ }
const pushed = requireSuccessfulPush(await provision.pushArtifact('businessRule', art.id), `business rule ${rule.name}`, opts.warn);
result.created.businessRules[`${entityLogical}|${rule.name}`] = pushed.id;
await provision.addSolutionComponent({ componentId: pushed.id, componentType: COMPONENT_TYPE.workflow, solutionUniqueName: sol.uniqueName });
@@ -1945,6 +2071,131 @@ async function runSdkBuild(spec, opts = {}) {
}
}
+ // 6b-post. Business process flows. Additive discover-reconcile, exactly like business rules and for
+ // the same reasons: a flow is identified by (entity, name), and pushing unconditionally on every
+ // rebuild would stack duplicate processes on the table. Unlike a rule, a BPF goes through the SDK's
+ // GENERIC artifact surface (createArtifact -> pushArtifact) — there is no bound member and no
+ // fallback path, so there is no double-write hazard to sweep up after.
+ if (has('business-process-flows')) {
+ for (const flow of spec.businessProcessFlows || []) {
+ const entityLogical = String(flow.entity).toLowerCase();
+ const key = `${entityLogical}|${flow.name}`;
+ const existing = await provision.queryRecords('workflow', {
+ select: ['workflowid', 'statecode', 'createdon'],
+ // Definition rows only, and BusinessFlow only — see bpfFilter.
+ filter: bpfFilter(flow.name, entityLogical),
+ // Ordered and > 1 for the same reason as business rules: `top: 1` unordered adopts an
+ // ARBITRARY row, and seeing more than one is the only way to report a pre-existing duplicate.
+ orderBy: 'createdon asc',
+ top: 50,
+ });
+ const existingId = existing && existing[0] && existing[0].workflowid;
+ if (existingId) {
+ if ((existing || []).length > 1 && typeof opts.warn === 'function') {
+ opts.warn(`business process flow "${flow.name}" on ${flow.entity}: ${existing.length} definitions exist with this name — the oldest is being reused. Remove the extras in Maker so users are not offered the same process twice.`);
+ }
+ // Exists, but a flow left in Draft is invisible on the form — "exists, so skip" would report
+ // success over a process nobody can run. Converge the one property that is cheap and safe to
+ // reconcile, in BOTH directions, exactly as the business-rule phase does.
+ const wantActive = (flow.status || 'Active') === 'Active';
+ const isActive = existing[0].statecode === 1;
+ if (wantActive !== isActive) {
+ // statecode 1 / statuscode 2 = Activated; 0 / 1 = Draft. Best-effort, NOT a build halt: a
+ // process the platform refuses to toggle should not block an otherwise-good app, and
+ // `--verify` reports the real deployed state.
+ const target = wantActive ? { statecode: 1, statuscode: 2 } : { statecode: 0, statuscode: 1 };
+ const verb = wantActive ? 'activated' : 'deactivated';
+ try {
+ await provision.updateRecord('workflow', existingId, target);
+ runner.skip('business-process-flows', `business process flow "${flow.name}" on ${flow.entity} (existed in the wrong state — ${verb})`);
+ } catch (e) {
+ if (typeof opts.warn === 'function') {
+ opts.warn(`business process flow "${flow.name}" on ${flow.entity} exists but could not be ${verb} (${e && e.message}). It is ${isActive ? 'still running' : 'inert'}. Delete it and rebuild to recreate it cleanly.`);
+ }
+ runner.skip('business-process-flows', `business process flow "${flow.name}" on ${flow.entity} (exists but could not be ${verb})`);
+ }
+ } else {
+ runner.skip('business-process-flows', `business process flow "${flow.name}" on ${flow.entity} (exists — reuse; stage edits aren't applied on rebuild, recreate to change)`);
+ }
+ result.created.businessProcessFlows[key] = existingId;
+ // Reconcile solution membership on the REUSE path too. `addSolutionComponent` is otherwise
+ // only reached by the create branch, so a run where the flow was created but the component
+ // add failed (or a flow created by an earlier build of a different solution) would be reused
+ // forever and never join this solution — leaving it out of export/import with nothing in the
+ // output saying so. The SDK treats an already-present component as success, so this is safe
+ // to re-issue every build; a failure here is a warning, not a halt, because the flow itself
+ // is correct and blocking the build over solution bookkeeping would be worse than reporting it.
+ try {
+ await provision.addSolutionComponent({ componentId: existingId, componentType: COMPONENT_TYPE.workflow, solutionUniqueName: sol.uniqueName });
+ } catch (e) {
+ if (typeof opts.warn === 'function') {
+ opts.warn(`business process flow "${flow.name}" on ${flow.entity} exists but could not be added to solution '${sol.uniqueName}' (${e && e.message}). The flow works, but it will not travel on solution export until it is added.`);
+ }
+ }
+ continue;
+ }
+ const stageCount = (flow.stages || []).length;
+ await runner.run('business-process-flows', `business process flow "${flow.name}" on ${flow.entity} (${stageCount} stage${stageCount === 1 ? '' : 's'})`, async () => {
+ // The reuse query above keys on (name, entity). The SERVER key does not: it is the DERIVED
+ // unique name, which strips case and punctuation and ignores the table entirely. So two
+ // situations are invisible to that query and fail inside the create instead:
+ // * a RENAME that preserves the derived name — "Ticket Handling" -> "ticket-handling";
+ // * a flow with the same derived name on a DIFFERENT table, including one this spec did
+ // not author.
+ // Both then fail with a platform error about a backing TABLE the author never mentioned,
+ // because activation creates an org-owned table with that logical name. Naming the real
+ // conflict here is the difference between a two-minute rename and an afternoon.
+ //
+ // The in-spec cases (two flows colliding, or a flow colliding with a declared table) are
+ // rejected at the plan gate; this covers only what the spec cannot see.
+ //
+ // Best-effort: a DIAGNOSTIC must never be the thing that breaks a build, so a query that
+ // fails or is unsupported proceeds and lets the platform speak for itself.
+ const unique = bpfUniqueName(flow.name);
+ let clash = null;
+ try {
+ const rows = await provision.queryRecords('workflow', {
+ select: ['workflowid', 'name', 'primaryentity'],
+ filter: `uniquename eq '${odataLit(unique)}'`,
+ top: 5,
+ });
+ const row = (rows || [])[0];
+ if (row) clash = `the flow "${row.name}"${row.primaryentity ? ` on ${row.primaryentity}` : ''}`;
+ } catch { /* diagnostic only — fall through to the create */ }
+ // A flow is only ONE of the things that can own that name. Activation creates a real TABLE
+ // called `unique`, so an unrelated table already holding that logical name blocks the flow
+ // just as surely — and that table need not have come from any flow at all. Checking only
+ // `workflows` left the commonest environment-side collision undetected.
+ //
+ // `findTables` is the SDK's only table-existence surface and takes no server-side filter, so
+ // the match is made here. It runs ONLY on the create path (never on reuse), and the SDK
+ // caches the metadata read, so this does not add a per-build enumeration.
+ if (!clash && typeof provision.findTables === 'function') {
+ try {
+ const tables = await provision.findTables();
+ const owner = (tables || []).find((t) => t && String(t.logicalName || '').toLowerCase() === unique);
+ if (owner) clash = `the table '${owner.logicalName}'`;
+ } catch { /* diagnostic only */ }
+ }
+ if (clash) {
+ throw new BuildHalt(
+ `business process flow "${flow.name}" on ${flow.entity} cannot be created: the Dataverse unique name it derives ('${unique}') is already used by ${clash}. The derivation lower-cases the name, strips punctuation and always uses the 'new_' prefix, so two differently-spelled names can collide — and activation creates a backing TABLE with that name, so only one owner can exist. Rename this flow, or remove the existing one.`,
+ { phase: 'business-process-flows', code: 'bpf-unique-name-conflict', recoverable: false });
+ }
+ // The whole flow — including its stages and steps — is carried on the CREATE payload. The
+ // adapter normalizes and id-stamps the stage/step tree there, so unlike a business rule's
+ // condition tree there is no element-surface follow-up to make.
+ const art = provision.createArtifact('bpf', bpfDef(flow));
+ const pushed = requireSuccessfulPush(await provision.pushArtifact('bpf', art.id), `business process flow ${flow.name}`, opts.warn);
+ result.created.businessProcessFlows[key] = pushed.id;
+ // componentType 29 (workflow) — a BPF is a workflow row, so it ships in the solution the same
+ // way a business rule does. Without this the process is left out of the solution and does not
+ // travel on export/import.
+ await provision.addSolutionComponent({ componentId: pushed.id, componentType: COMPONENT_TYPE.workflow, solutionUniqueName: sol.uniqueName });
+ });
+ }
+ }
+
if (has('commands')) {
for (const [entityLogical, cmds] of Object.entries(commandsByEntity(spec))) {
// Additive discover-reconcile (design §14): one command artifact per entity (identity = entity).
@@ -2840,4 +3091,4 @@ async function runSdkBuild(spec, opts = {}) {
return result;
}
-module.exports = { runSdkBuild, planFor, resolvePhases, PHASES, BuildHalt, SDK_COLUMN_TYPE, viewDef, defaultViewColumns, subgridLabel, enrichesDefaultViews, artifactIdentityQuery, resolveExistingFormId, FORM_TYPE_CODE, chartDef, dashboardTileOpts, dashboardComponent, compileFormIntent, formFieldLogicals, appDef, appUniqueName, commandsByEntity, commandDef, businessRuleDef, businessRuleFilter, webResourceOpts, WEB_RESOURCE_KINDS, FORM_EVENTS, acquireAppPagesLease, personaRoleSpecFor, resolveRoleBusinessUnit, roleBuClause };
+module.exports = { runSdkBuild, planFor, resolvePhases, PHASES, BuildHalt, SDK_COLUMN_TYPE, viewDef, defaultViewColumns, subgridLabel, enrichesDefaultViews, artifactIdentityQuery, resolveExistingFormId, FORM_TYPE_CODE, chartDef, dashboardTileOpts, dashboardComponent, compileFormIntent, formFieldLogicals, appDef, appUniqueName, commandsByEntity, commandDef, businessRuleDef, businessRuleFilter, bpfDef, bpfFilter, webResourceOpts, WEB_RESOURCE_KINDS, FORM_EVENTS, acquireAppPagesLease, personaRoleSpecFor, resolveRoleBusinessUnit, roleBuClause };
diff --git a/plugins/model-apps/scripts/lib/sdk-teardown.js b/plugins/model-apps/scripts/lib/sdk-teardown.js
index c9f996c4c..5fc1a28a4 100644
--- a/plugins/model-apps/scripts/lib/sdk-teardown.js
+++ b/plugins/model-apps/scripts/lib/sdk-teardown.js
@@ -53,7 +53,7 @@
// the identical phase-grouped, status-marked log.
const { topoOrderEntities } = require('./_graph.js');
-const { appUniqueName, commandsByEntity, defaultViewColumns, resolveExistingFormId, resolveRoleBusinessUnit, roleBuClause } = require('./sdk-build.js');
+const { appUniqueName, commandsByEntity, defaultViewColumns, resolveExistingFormId, resolveRoleBusinessUnit, roleBuClause, bpfFilter } = require('./sdk-build.js');
const { manifestResourceName, parseManifestBase64 } = require('./page-manifest.js');
const { relationshipSchemaName, manyToManySchemaName, lookupColumnsFor, SDK_ROLE_MARKER, canonicalPersonaName, FORM_GUID_RE } = require('./app-spec.js');
const { selectSummaryTables } = require('./ai-candidates.js');
@@ -407,6 +407,69 @@ const KIND_HANDLERS = {
},
tolerateNotFound: true,
},
+ businessProcessFlows: {
+ // Same shape as a business rule — a `workflows` row the SDK does not model as a deletable
+ // artifact kind — so resolve and delete it over queryRecords/deleteRecord.
+ //
+ // Scoped by (category 4, businessprocesstype 0, name, primaryentity): a same-named process on
+ // another table, and a same-named TASK FLOW on this one, are both left alone.
+ async resolve(sdk, target) {
+ const rows = await sdk.queryRecords('workflow', {
+ select: ['workflowid', 'statecode'],
+ // DEFINITION rows only (see bpfFilter in sdk-build.js). Activating a process makes the
+ // platform create a `type 2` activated copy parented to the definition; it refuses to delete
+ // that copy directly (405) and removes it with its parent, so an unfiltered query would
+ // produce a guaranteed per-flow teardown failure — the exact bug fixed for business rules.
+ filter: bpfFilter(target.name, target.entity),
+ top: 50,
+ });
+ return (rows || []).map((r) => ({ id: r.workflowid, name: target.name, statecode: r.statecode }));
+ },
+ async del(sdk, item) {
+ // Deactivate before delete: Dataverse refuses to delete an activated process. An activated BPF
+ // additionally owns a backing TABLE (logical name = the workflow's uniquename) that the
+ // platform creates on activation and removes with the process — so this delete is what cleans
+ // that up too, and skipping it would strand a table this app created.
+ if (item.statecode === 1) {
+ try { await sdk.updateRecord('workflow', item.id, { statecode: 0, statuscode: 1 }); } catch { /* fall through: the delete below reports the real failure */ }
+ }
+ try {
+ return await sdk.deleteRecord('workflow', item.id);
+ } catch (e) {
+ // Because the delete cascades a TABLE drop, it is slow — MEASURED live at longer than the
+ // client's 60s HTTP timeout on two of three runs. The server keeps working after the client
+ // gives up, so a timeout here says nothing about whether the flow was removed; reporting it
+ // as a failure made teardown exit non-zero and tell the operator to go clean up something
+ // that was, in fact, already gone.
+ //
+ // So on a TRANSPORT failure only (never on a real HTTP error, which carries a status and a
+ // meaning), POLL for the row to disappear and let the environment decide the verdict.
+ // Polling rather than a single re-read is the whole point: measured, the row is still present
+ // at the moment the client times out and only disappears ~1-2 minutes later, so a single peek
+ // reproduces exactly the false failure this exists to remove.
+ const transport = /timed out|timeout|socket hang up|ECONNRESET|ETIMEDOUT|Transport failure/i.test(String((e && e.message) || ''));
+ if (!transport) throw e;
+ // Bounded by ATTEMPTS, not by wall-clock. A time-based deadline cannot be shortened by a test
+ // that stubs the sleep, so the "row never disappears" case would genuinely block a unit test
+ // for the full budget — which it did, taking the suite from 28s to 242s.
+ const POLL_ATTEMPTS = 16;
+ const POLL_INTERVAL_MS = 15000; // ~4 minutes total; measured worst case is well inside that
+ for (let attempt = 1; ; attempt++) {
+ let rows;
+ try {
+ rows = await sdk.queryRecords('workflow', { select: ['workflowid'], filter: `workflowid eq ${item.id}`, top: 1 });
+ } catch {
+ // A failed probe is not evidence either way; keep waiting until the budget runs out.
+ rows = [{ unknown: true }];
+ }
+ if (!(rows || []).length) return undefined;
+ if (attempt >= POLL_ATTEMPTS) throw e;
+ await new Promise((r) => setTimeout(r, POLL_INTERVAL_MS));
+ }
+ }
+ },
+ tolerateNotFound: true,
+ },
commands: {
// The vendored SDK models a table's command bar as ONE artifact per entity (identity = entity):
// resolveArtifact('command', { entity }) returns that single per-entity artifact and
@@ -488,7 +551,7 @@ const KIND_HANDLERS = {
form: {
async resolve(sdk, target) {
// Resolve by (entity, name, TYPE) or a pinned formId — NOT name alone — so tearing down a Main form
- // never ALSO deletes the table's same-named Quick View / Card siblings (Sol review: the old name-only
+ // never ALSO deletes the table's same-named Quick View / Card siblings (the old name-only
// resolveArtifact returned every match and del() deleted each). resolveExistingFormId returns the ONE
// intended form (null if absent → nothing to delete; throws on a residual (entity,type,name) collision
// → teardown halts fail-closed rather than delete an arbitrary form).
@@ -688,6 +751,13 @@ function planTeardown(spec) {
const entity = String(r.entity).toLowerCase();
steps.push({ kind: 'businessRules', phase: 'business-rules', label: `business rule "${r.name}" (${entity})`, target: { entity, name: r.name } });
}
+ // Business process flows, for the same reasons and in the same position: an activated BPF is a
+ // workflow row bound to the entity (plus a platform-owned backing table), so it has to go before
+ // the table it references and is not something a table delete cascades away.
+ for (const p of spec.businessProcessFlows || []) {
+ const entity = String(p.entity).toLowerCase();
+ steps.push({ kind: 'businessProcessFlows', phase: 'business-process-flows', label: `business process flow "${p.name}" (${entity})`, target: { entity, name: p.name } });
+ }
// Delete forms so a QuickView form referenced by another form's `quickViews[]` is removed AFTER its
// HOST form. The host embeds a quick-view CONTROL that references the QV form, so deleting the QV
// form first makes Dataverse 400 ("cannot be deleted because it is referenced by 1 other
@@ -799,7 +869,7 @@ function planTeardown(spec) {
// app.icon is set — that image is a declared webResources[] entry handled by the loop above.
// ALSO skipped when the derived name collides with a DECLARED webResources[] entry: if that entry is
// `external:true` the loop deliberately protected it (a shared nav icon named `<appUnique>_icon`), so
- // this derived delete must not clobber the skip and delete a shared resource (Sol review, High); if it
+ // this derived delete must not clobber the skip and delete a shared resource; if it
// is a normal declared entry the loop already scheduled it, so skipping here just avoids a duplicate.
if (spec.app && spec.solution && !spec.app.icon) {
const generatedIcon = `${appUniqueName(spec)}_icon`;
diff --git a/plugins/model-apps/scripts/lib/spec-lint.js b/plugins/model-apps/scripts/lib/spec-lint.js
index 55c313cd5..12ac7e73a 100644
--- a/plugins/model-apps/scripts/lib/spec-lint.js
+++ b/plugins/model-apps/scripts/lib/spec-lint.js
@@ -169,7 +169,7 @@ function lintAppSpec(spec) {
if (!qv || !qv.lookup) { E(`Form ${f.entity} has a quickView missing lookup (the lookup column logical name)`); continue; }
if (!qv.targetEntity || !entityNames.has(lc(qv.targetEntity))) E(`Form ${f.entity} quickView references unknown targetEntity '${qv.targetEntity}'`);
// Resolve by (name, targetEntity) preferring the QuickView so a same-named Main on the target entity
- // doesn't shadow it (order-dependent otherwise; Sol review).
+ // doesn't shadow it (order-dependent otherwise).
const qvCandidates = qv.form ? (spec.forms || []).filter((x) => x.name === qv.form && lc(x.entity) === lc(qv.targetEntity)) : [];
const qf = qvCandidates.find((x) => (x.formType || 'Main') === 'QuickView') || qvCandidates[0];
if (!qf) E(`Form ${f.entity} quickView references form '${qv.form}' (a QuickView on '${qv.targetEntity}') not found in forms[]`);
diff --git a/plugins/model-apps/scripts/lib/spec-shape.js b/plugins/model-apps/scripts/lib/spec-shape.js
index 653253afb..ba8575947 100644
--- a/plugins/model-apps/scripts/lib/spec-shape.js
+++ b/plugins/model-apps/scripts/lib/spec-shape.js
@@ -50,6 +50,11 @@ const COLLECTIONS = {
// TypeError instead of producing a validation error naming the field — the exact failure this map
// exists to prevent.
businessRules: { children: { conditions: {}, actions: {} } },
+ // Business process flows, for exactly the reason recorded above — and this collection repeated the
+ // mistake: an object-valued `businessProcessFlows`, `stages` or `steps` reached the phase's
+ // `for...of` and threw `object is not iterable` instead of "must be an array". A flow is edited
+ // stage-by-stage while a process is being designed, so a mid-edit object here is realistic.
+ businessProcessFlows: { children: { stages: { children: { steps: {} } } } },
dashboards: { children: { tiles: {} } },
pages: { children: { navigatesTo: {}, dataSources: { scalar: true } } },
personas: { children: { jobs: { children: { privileges: {} } }, additionalPrivileges: {} } },
diff --git a/plugins/model-apps/scripts/lib/stages.js b/plugins/model-apps/scripts/lib/stages.js
index c57a5ea00..47e5abfd2 100644
--- a/plugins/model-apps/scripts/lib/stages.js
+++ b/plugins/model-apps/scripts/lib/stages.js
@@ -1,14 +1,19 @@
'use strict';
-// Canonical ordered list of the engine's 15 build phases. This is the SINGLE source of truth —
+// Canonical ordered list of the engine's 16 build phases. This is the SINGLE source of truth —
// sdk-build.js imports it from here so the stage layer and the engine can never drift. Order is
// load-bearing: phases run top-to-bottom, and downstream phases depend on earlier ones (e.g. the
// app phase consumes forms/views/charts built earlier). `business-rules` runs after `forms` because
// a rule is authored against the entity's COLUMNS (data-model) but belongs with the record UI it
-// governs; it has no dependency on the command bar. The `security` phase runs AFTER app-shell
-// because a persona role grants read on (and is associated to) the app module created there, so the
-// generated app opens for that persona. See docs/app-builder-design.md §6.
-const PHASES = ['solution', 'data-model', 'sample-data', 'web-resources', 'views', 'charts', 'forms', 'business-rules', 'commands', 'dashboards', 'app-shell', 'pages', 'ai-features', 'security', 'publish'];
+// governs; it has no dependency on the command bar. `business-process-flows` sits next to it for the
+// same reason and with the same dependency (entity + columns only): a BPF's XAML binds stage steps
+// to attribute logical names, nothing later. Note it deliberately does NOT need to run after
+// `security` — a BPF's role grants are privileges on the backing table that activation creates, so
+// if/when they are authored they belong in the `security` phase (which runs later and already owns
+// role creation), not here. The `security` phase runs AFTER app-shell because a persona role grants
+// read on (and is associated to) the app module created there, so the generated app opens for that
+// persona. See docs/app-builder-design.md §6.
+const PHASES = ['solution', 'data-model', 'sample-data', 'web-resources', 'views', 'charts', 'forms', 'business-rules', 'business-process-flows', 'commands', 'dashboards', 'app-shell', 'pages', 'ai-features', 'security', 'publish'];
// User-facing stages, each a contiguous range of engine phases. Stages are the vocabulary the
// orchestrator narrates, gates consent on, and evals assert against — they do NOT rename or merge
@@ -18,7 +23,7 @@ const PHASES = ['solution', 'data-model', 'sample-data', 'web-resources', 'views
// persona access model is part of standing the app up for its users. See the design doc §5–§6.
const STAGES = {
data: ['solution', 'data-model', 'sample-data'],
- ui: ['web-resources', 'views', 'charts', 'forms', 'business-rules', 'commands', 'dashboards'],
+ ui: ['web-resources', 'views', 'charts', 'forms', 'business-rules', 'business-process-flows', 'commands', 'dashboards'],
app: ['app-shell', 'pages', 'ai-features', 'security'],
publish: ['publish'],
};
diff --git a/plugins/model-apps/scripts/lib/verify-spec.js b/plugins/model-apps/scripts/lib/verify-spec.js
index f7fbd0c91..3f5976a56 100644
--- a/plugins/model-apps/scripts/lib/verify-spec.js
+++ b/plugins/model-apps/scripts/lib/verify-spec.js
@@ -6,7 +6,7 @@
const { odataLit } = require('./odata.js');
const { normalizePageSource, relationshipSchemaName, manyToManySchemaName, SDK_ROLE_MARKER, canonicalPersonaName } = require('./app-spec.js');
-const { resolveExistingFormId, resolveRoleBusinessUnit, roleBuClause, appUniqueName, businessRuleFilter } = require('./sdk-build.js');
+const { resolveExistingFormId, resolveRoleBusinessUnit, roleBuClause, appUniqueName, businessRuleFilter, bpfFilter } = require('./sdk-build.js');
const { extractNavTargets } = require('./pageref-resolver.js');
const { AI_APP_SETTING, resolveAiFlags, featureWantValue, sameSettingValue, resolveAppModuleId, proveAppOverride } = require('./ai-app-settings.js');
const { declaredPrivileges, compareRolePrivileges } = require('./role-privileges.js');
@@ -248,6 +248,40 @@ async function verifySpec(spec, read, opts = {}) {
wantActive === isActive ? '' : (wantActive ? 'deployed but DRAFT — the rule does not run' : 'deployed ACTIVE but the spec asks for Draft — the rule is running'));
}
+ // Business process flows. Reconciled on the same three axes as business rules, because a BPF fails
+ // the same three silent ways: it never built, it built twice (users are offered the same process
+ // more than once), or it is deployed Draft and therefore invisible on the form. Activation is
+ // best-effort in the build, so verify is what makes the outcome loud.
+ for (const flow of spec.businessProcessFlows || []) {
+ const entityLogical = String(flow.entity).toLowerCase();
+ const name = `${entityLogical}.${flow.name}`;
+ let rows;
+ try {
+ // DEFINITION rows only, BusinessFlow only (see bpfFilter) — counting the platform's activated
+ // `type 2` copy would report every healthy ACTIVE flow as a duplicate, and counting task flows
+ // would report an unrelated process as one.
+ rows = await read.queryRecords('workflow', {
+ select: ['workflowid', 'statecode'],
+ filter: bpfFilter(flow.name, entityLogical),
+ top: 50,
+ });
+ } catch (e) {
+ // Fail CLOSED: a read that could not run must not read as "present and correct".
+ add('business-process-flow', name, false, `could not be read: ${e && e.message}`);
+ continue;
+ }
+ const list = rows || [];
+ if (!list.length) { add('business-process-flow', name, false, 'not deployed'); continue; }
+ if (list.length > 1) {
+ add('business-process-flow', name, false, `${list.length} process flows share this name on ${entityLogical} — users are offered the same process more than once`);
+ continue;
+ }
+ const wantActive = (flow.status || 'Active') === 'Active';
+ const isActive = list[0].statecode === 1;
+ add('business-process-flow', name, wantActive === isActive,
+ wantActive === isActive ? '' : (wantActive ? 'deployed but DRAFT — the process does not appear on the form' : 'deployed ACTIVE but the spec asks for Draft — the process is running'));
+ }
+
// Sitemap subareas (+ icons). Scope every check to the specific element type (and, for a subarea
// icon, the owning entity) so an icon/entity value reused elsewhere in the XML can't satisfy an
// unrelated check (e.g. an Area icon must not make a missing SubArea icon look present).
diff --git a/plugins/model-apps/scripts/tests/ai-app-features-real-bundle.test.js b/plugins/model-apps/scripts/tests/ai-app-features-real-bundle.test.js
index f78d77554..70a73ea95 100644
--- a/plugins/model-apps/scripts/tests/ai-app-features-real-bundle.test.js
+++ b/plugins/model-apps/scripts/tests/ai-app-features-real-bundle.test.js
@@ -238,3 +238,42 @@ test('REAL BUNDLE: a malformed appModuleId is rejected up front', async () => {
const { sdk } = freshSdk({ gate: '1', effective: '1', overrideRows: [{ value: '1' }] });
await assert.rejects(() => sdk.setAppAiFeatures(APP, { formFill: true }, { ...FAST, appModuleId: 'not-a-guid' }));
});
+
+// The boolean spelling is NOT a flat 1/0, and the schema doc said it was. That inaccuracy caused a
+// real incident: `appFeatures: { nlSearch: false, nlChart: false }` was written believing it meant
+// "leave alone", and it DISABLED two features a live app was inheriting as on. For the form-fill
+// family the tri-state is 0 = platform default, 1 = DISABLED, 2 = enabled, so `false` there is an
+// explicit off rather than an unset.
+//
+// Pinned against the real bundle in BOTH directions, so a re-vendor that changes the encoding fails
+// here instead of silently making the documentation wrong again.
+test('REAL BUNDLE: the boolean-to-numeric mapping is per-family, not a flat 1/0', async () => {
+ const EXPECTED = {
+ formFill: { setting: 'FormFillBarUXEnabled', onValue: '2', offValue: '1' },
+ nlSearch: { setting: 'NLGridSearchSetting', onValue: '1', offValue: '0' },
+ nlChart: { setting: 'NLChartDataVisualizationSetting', onValue: '1', offValue: '0' },
+ m365: { setting: 'm365copilotmodelappenabled', onValue: '1', offValue: '0' },
+ };
+
+ for (const [feature, want] of Object.entries(EXPECTED)) {
+ for (const [flag, expected] of [[true, want.onValue], [false, want.offValue]]) {
+ // Gate reported ON so the SDK writes in both directions (enabling is gated; disabling is not).
+ const { sdk, calls } = freshSdk({ gate: '2', effective: '2', overrideRows: [{ appsettingid: 'a1', value: expected }] });
+ await sdk.setAppAiFeatures(APP, { [feature]: flag }, { appModuleId: APP_ID, verifyAttempts: 1, verifyDelayMs: 1 });
+ const save = calls.find((c) => c.method === 'POST' && /SaveSettingValue/i.test(c.url));
+ assert.ok(save, `${feature}=${flag}: a SaveSettingValue must be issued`);
+ assert.strictEqual(save.body.SettingName, want.setting, `${feature}: setting name`);
+ assert.strictEqual(String(save.body.Value), expected,
+ `${feature}=${flag} must write ${expected} — the docs previously claimed a flat 1/0, which is wrong for the form-fill family`);
+ }
+ }
+});
+
+test('REAL BUNDLE: disabling is NOT gated — a false is written even when the org gate is off', async () => {
+ // This asymmetry is why an incorrect `false` is the more damaging mistake: it always lands.
+ const { sdk, calls } = freshSdk({ gate: '0', effective: '0', overrideRows: [{ appsettingid: 'a1', value: '1' }] });
+ await sdk.setAppAiFeatures(APP, { formFill: false }, { appModuleId: APP_ID, verifyAttempts: 1, verifyDelayMs: 1 });
+ const save = calls.find((c) => c.method === 'POST' && /SaveSettingValue/i.test(c.url));
+ assert.ok(save, 'a disable must be written even with the gate off');
+ assert.strictEqual(String(save.body.Value), '1', 'and 1 means DISABLED, not platform default');
+});
diff --git a/plugins/model-apps/scripts/tests/app-spec.test.js b/plugins/model-apps/scripts/tests/app-spec.test.js
index 473323512..cdefcbc8a 100644
--- a/plugins/model-apps/scripts/tests/app-spec.test.js
+++ b/plugins/model-apps/scripts/tests/app-spec.test.js
@@ -1072,3 +1072,107 @@ test('validateAppSpec detects whitespace-distinct persona names as duplicates (S
]));
assert.ok(!r.ok && r.errors.some((e) => /duplicate persona name/.test(e)), JSON.stringify(r.errors));
});
+
+// --- views[]: a column reference must be a STRING (#525) ---------------------------------------
+//
+// `viewDef` maps every entry with `String(name).toLowerCase()`, so a non-string is not rejected —
+// it is STRINGIFIED. An object becomes the literal `[object object]`, which reaches the view's
+// fetchxml and is refused by the platform with an opaque metadata error, mid-build, after the
+// solution and tables already exist.
+//
+// The damage outlives the run: the savedquery row is created carrying that fetchxml, and every
+// later read of it also fails, so the next build dies at the same step. Dataverse reports the row
+// as system-defined and refuses to delete it, so recovering means tearing the table down.
+//
+// `{ "name": "..." }` is not a wild guess either — it is exactly the shape `forms[]` uses for its
+// fields, so an author moving between the two surfaces writes it naturally.
+const viewSpec = (view) => {
+ const s = cloneDesk();
+ s.views = [Object.assign({ entity: 'new_customer', name: 'Active Customers' }, view)];
+ return s;
+};
+const viewErrors = (view) => (validateAppSpec(viewSpec(view)).errors || []);
+
+test('validateAppSpec rejects a non-string entry in views[].columns (#525)', () => {
+ for (const bad of [{ name: 'new_name' }, 42, null, ['new_name'], true]) {
+ const errs = viewErrors({ columns: ['new_name', bad] });
+ assert.ok(
+ errs.some((e) => /columns/.test(e) && /string/.test(e)),
+ `${JSON.stringify(bad)} must be rejected as a column; got ${JSON.stringify(errs)}`
+ );
+ // The message has to name the view, or an author with a dozen views cannot act on it.
+ assert.ok(errs.some((e) => /Active Customers/.test(e)), `the error must name the view; got ${JSON.stringify(errs)}`);
+ }
+});
+
+test('validateAppSpec rejects a blank column name, which fetchxml cannot express either', () => {
+ for (const bad of ['', ' ']) {
+ const errs = viewErrors({ columns: [bad] });
+ assert.ok(errs.some((e) => /columns/.test(e)), `${JSON.stringify(bad)} must be rejected; got ${JSON.stringify(errs)}`);
+ }
+});
+
+test('validateAppSpec rejects a non-string sort/filter attribute for the same reason', () => {
+ // `viewDef` stringifies these two the same way (`String(s.attr)` / `String(f.attr)`), so they
+ // carry the identical failure and were fixed together rather than one at a time.
+ const sortErrs = viewErrors({ columns: ['new_name'], sort: [{ attr: { name: 'new_name' }, dir: 'asc' }] });
+ assert.ok(sortErrs.some((e) => /sort/.test(e) && /string/.test(e)), `got ${JSON.stringify(sortErrs)}`);
+ const filterErrs = viewErrors({ columns: ['new_name'], filters: [{ attr: { name: 'new_name' }, op: 'eq', value: 'x' }] });
+ assert.ok(filterErrs.some((e) => /filter/.test(e) && /string/.test(e)), `got ${JSON.stringify(filterErrs)}`);
+});
+
+test('validateAppSpec still accepts a well-formed view (the guard adds no false positive)', () => {
+ const r = validateAppSpec(viewSpec({ columns: ['new_name', 'new_segment'], sort: [{ attr: 'new_name', dir: 'asc' }], filters: [{ attr: 'new_segment', op: 'eq', value: 'SMB' }] }));
+ assert.strictEqual(r.ok, true, JSON.stringify(r.errors));
+ // Omitted collections must stay optional — the primary name column is substituted downstream.
+ assert.strictEqual(validateAppSpec(viewSpec({})).ok, true);
+});
+
+test('the whole shipped sample set still validates (no regression from the views guard)', () => {
+ for (const s of [sample, desk]) {
+ const r = validateAppSpec(s);
+ assert.strictEqual(r.ok, true, JSON.stringify(r.errors));
+ }
+});
+
+// --- an entity reference is a METADATA NAME, so it must be a string too (#525's sibling) ---------
+//
+// `String([["new_ticket"]])` is `"new_ticket"`, so a one-element nested array passed every
+// entity-membership check and then threw a RAW TypeError deep in the build, where the engine calls
+// `.toLowerCase()` on the array itself. These are valid JSON, so they reach the CLI from a spec file
+// — unlike a Symbol or a throwing getter, which cannot survive JSON.
+test('a nested-array entity reference is a structured error, not a late TypeError', () => {
+ const NESTED = [['new_ticket']];
+ const cases = [
+ ['chart', (s) => { s.charts = [{ name: 'C', entity: NESTED, chartType: 'Column', groupBy: 'new_priority' }]; }],
+ ['form subgrid childEntity', (s) => { s.forms = [{ entity: 'new_customer', name: 'F', subgrids: [{ childEntity: NESTED }] }]; }],
+ ['sitemap subArea', (s) => { s.appShell.areas[0].groups[0].subAreas.push({ entity: NESTED, title: 'X' }); }],
+ ['dashboard chart tile', (s) => { s.dashboards = [{ name: 'D', tiles: [{ type: 'chart', viewId: '11111111-1111-1111-1111-111111111111', visualizationId: '22222222-2222-2222-2222-222222222222', entity: NESTED }] }]; }],
+ ['dashboard list tile', (s) => { s.dashboards = [{ name: 'D2', tiles: [{ type: 'list', viewId: '11111111-1111-1111-1111-111111111111', entity: NESTED }] }]; }],
+ ];
+ for (const [label, mutate] of cases) {
+ const spec = cloneDesk();
+ mutate(spec);
+ let res;
+ assert.doesNotThrow(() => { res = validateAppSpec(spec, { profile: 'plan' }); },
+ `${label}: validation must not throw on a JSON-representable wrong type`);
+ assert.strictEqual(res.ok, false, `${label}: must be rejected`);
+ assert.ok((res.errors || []).some((e) => /must be a table name \(a string\)/.test(e)),
+ `${label}: expected a table-name type error; got ${JSON.stringify(res.errors)}`);
+ }
+});
+
+test('the value describer cannot itself throw (BigInt / a throwing getter)', () => {
+ // A validator that crashes while formatting its own error message is worse than one that misses
+ // the case: the caller gets a stack trace instead of a finding.
+ for (const [label, bad] of [
+ ['BigInt', 10n],
+ ['throwing getter', Object.defineProperty({}, 'toJSON', { get() { throw new Error('nope'); } })],
+ ]) {
+ const spec = cloneDesk();
+ spec.views = [{ entity: 'new_customer', name: 'V', columns: [bad] }];
+ let res;
+ assert.doesNotThrow(() => { res = validateAppSpec(spec, { profile: 'plan' }); }, `${label} must not crash the validator`);
+ assert.strictEqual(res.ok, false, `${label} must still be rejected`);
+ }
+});
diff --git a/plugins/model-apps/scripts/tests/artifact-descriptions.test.js b/plugins/model-apps/scripts/tests/artifact-descriptions.test.js
index d95d4e28a..7fdf01f7d 100644
--- a/plugins/model-apps/scripts/tests/artifact-descriptions.test.js
+++ b/plugins/model-apps/scripts/tests/artifact-descriptions.test.js
@@ -342,23 +342,80 @@ test('REAL BUNDLE: a view accepts /description as an updateElement pointer, and
assert.strictEqual(patch.body.description, 'Authored text.');
});
-test('a persona NEVER sends a description — it would break the SDK ownership guard', () => {
- // The bundle builds its role payload as
- // { name, description: SDK_ROLE_MARKER, '[email protected]': ... }
- // and gates reuse on
- // d.ismanaged !== true && (d.description ?? '') === SDK_ROLE_MARKER
- // so a role carrying an author's prose is treated as somebody else's role and the SDK THROWS
- // ("already exists ... and was not created by the SDK; refusing to modify or assign it").
- // Teardown and verify re-implement the same marker check, so all three would disagree at once.
+const AUTHOR_PROSE = 'Handles field work orders end to end.';
+
+// A real-bundle SDK wired just far enough for `createPersonaRole` to reach its `/roles` write.
+// Two stubs are load-bearing and were both found by measuring:
+// * the root business unit is resolved with `_parentbusinessunitid_value eq null`;
+// * each entity's privilege must have a DISTINCT PrivilegeId, or the SDK refuses the role with
+// "share the Dataverse privilege ... but request different scopes" (the persona's own table is
+// user-scoped while the injected `appmodule` read is organization-scoped).
+function roleSdk() {
+ const { createMakerSdk } = require(BUNDLE);
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'role-'));
+ dirs.push(dir);
+ const calls = [];
+ const sdk = createMakerSdk({
+ workspacePath: dir,
+ instanceUrl: 'https://contoso.crm.dynamics.com',
+ httpClient: {
+ get: async (url) => {
+ calls.push({ verb: 'GET', url: String(url) });
+ if (/businessunits/i.test(url)) return { status: 200, headers: {}, body: { value: [{ businessunitid: '00000000-0000-0000-0000-0000000000b1' }] } };
+ // e.g. EntityDefinitions(LogicalName='new_ticket')?$select=LogicalName,Privileges
+ const ed = /EntityDefinitions\(LogicalName='([^']+)'\)/.exec(String(url));
+ if (ed) {
+ const logical = ed[1];
+ const pid = logical === 'appmodule' ? '33333333-3333-3333-3333-333333333333' : '11111111-1111-1111-1111-111111111111';
+ return { status: 200, headers: {}, body: { LogicalName: logical, Privileges: [{ PrivilegeId: pid, Name: `prvRead${logical}`, PrivilegeType: 'Read', CanBeBasic: true, CanBeLocal: true, CanBeDeep: true, CanBeGlobal: true }] } };
+ }
+ return { status: 200, headers: {}, body: { value: [] } }; // no existing role -> create path
+ },
+ post: async (url, body) => { calls.push({ verb: 'POST', url: String(url), body }); return { status: 204, headers: { 'odata-entityid': 'https://x/roles(22222222-2222-2222-2222-222222222222)' }, body: {} }; },
+ patch: async (url, body) => { calls.push({ verb: 'PATCH', url: String(url), body }); return { status: 204, headers: {}, body: {} }; },
+ put: async () => ({ status: 204, headers: {}, body: {} }),
+ delete: async () => ({ status: 204, headers: {}, body: {} }),
+ },
+ });
+ sdk.initWorkspace();
+ return { sdk, calls };
+}
+
+test('a persona NEVER sends a description — it would break the SDK ownership guard', async () => {
+ // The bundle builds its role payload with its OWN marker as the description, and gates reuse on
+ // an exact match of that marker, so a role carrying an author's prose is treated as somebody
+ // else's role and the SDK THROWS ("already exists ... and was not created by the SDK; refusing to
+ // modify or assign it"). Teardown and verify re-implement the same marker check, so all three
+ // would disagree at once.
const spec = personaRoleSpecFor({
- persona: 'Agent', description: 'should be ignored',
+ persona: 'Field Agent', description: AUTHOR_PROSE,
jobs: [{ name: 'Job', privileges: [{ entity: 'new_ticket', access: ['read'], scope: 'user' }] }],
});
assert.ok(!('description' in spec), 'persona description must not be forwarded to createPersonaRole');
- const bundle = fs.readFileSync(BUNDLE, 'utf8');
- assert.ok(
- bundle.includes('description:It.SDK_ROLE_MARKER'),
- 'the bundle still hardcodes the marker as the role description — if this changes, revisit the exclusion'
- );
+ // Proven against the REAL bundle by observing the wire, not by grepping it. The previous version
+ // of this guard asserted the literal `description:It.SDK_ROLE_MARKER`, where `It` is a namespace
+ // alias the MINIFIER assigns — it became `Pt` on the next re-vendor and the test failed for a
+ // reason that had nothing to do with the behaviour it was protecting. Drive the call instead.
+ const { sdk, calls } = roleSdk();
+ await sdk.createPersonaRole(spec);
+
+ const create = calls.find((c) => c.verb === 'POST' && /\/roles$/.test(String(c.url)));
+ assert.ok(create, `the role create must POST /roles; got ${JSON.stringify(calls.map((c) => `${c.verb} ${c.url}`))}`);
+ assert.strictEqual(typeof create.body.description, 'string');
+ assert.ok(create.body.description.length > 0,
+ 'the SDK still stamps a description of its own — if it stops, the exclusion below has no purpose and must be revisited');
+ assert.match(create.body.description, /cds-maker-sdk/,
+ `the description must be the SDK's ownership marker; got ${JSON.stringify(create.body.description)}`);
+
+ // The decisive half: the author's prose reaches NOTHING on the wire.
+ assert.strictEqual(JSON.stringify(calls).includes(AUTHOR_PROSE), false,
+ 'an author-supplied persona description must never reach the role write');
+
+ // And the ownership gate really does read `description` back, which is why sending prose would
+ // make the SDK disown its own role.
+ const reuseQuery = calls.find((c) => c.verb === 'GET' && /\/roles\?/.test(String(c.url)));
+ assert.ok(reuseQuery, 'the SDK must look for an existing role before creating one');
+ assert.match(decodeURIComponent(String(reuseQuery.url)), /\$select=[^&]*description/,
+ 'the reuse gate selects description — that is the field the marker defends');
});
diff --git a/plugins/model-apps/scripts/tests/business-process-flows.test.js b/plugins/model-apps/scripts/tests/business-process-flows.test.js
new file mode 100644
index 000000000..5a6e7fa6a
--- /dev/null
+++ b/plugins/model-apps/scripts/tests/business-process-flows.test.js
@@ -0,0 +1,1005 @@
+'use strict';
+// `businessProcessFlows[]` — the App Spec surface over the SDK's BPF authoring.
+//
+// Layered the same way as business-rules.test.js, because each layer fails silently in its own way:
+// 1. VALIDATION — the spec surface mirrors the slice the build can actually deploy AND verify.
+// A step bound to a column that does not exist is accepted by the platform and simply renders
+// bound to nothing, so nothing downstream would catch it.
+// 2. MAPPING — `bpfDef` produces the SDK's artifact shape. This is the dangerous layer: the
+// adapter's step normalizer copies exactly id/name/fieldName/required and DROPS every other
+// key, so the plausible spelling (`fieldLogicalName`) is silently discarded and the step
+// deploys bound to nothing.
+// 3. REAL BUNDLE — the mapped def is pushed through the shipped SDK and the wire payload is
+// inspected. Only this proves the authored stages and columns reach the platform.
+// 4. BUILD / TEARDOWN / VERIFY — the phase is additive-idempotent, the teardown is ordered and
+// scoped, and verify reconciles existence + cardinality + state.
+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 { validateAppSpec } = require('../lib/app-spec.js');
+const { bpfDef, bpfFilter, runSdkBuild, planFor, PHASES } = require('../lib/sdk-build.js');
+const { verifySpec } = require('../lib/verify-spec.js');
+const { planTeardown, KIND_HANDLERS } = require('../lib/sdk-teardown.js');
+const { PHASES: STAGE_PHASES, STAGES } = require('../lib/stages.js');
+
+const BUNDLE = path.resolve(__dirname, '..', 'vendor', 'cds-maker-sdk.cjs');
+const dirs = [];
+test.after(() => { for (const d of dirs) fs.rmSync(d, { recursive: true, force: true }); });
+
+// Minimal spec that is valid on its own, so a validation failure below is always about the flow.
+function specWith(flows) {
+ return {
+ solution: { uniqueName: 'BPF', displayName: 'BPF', publisherPrefix: 'new' },
+ app: { name: 'BPF App', description: '' },
+ entities: [{
+ schemaName: 'new_ticket', displayName: 'Ticket', pluralName: 'Tickets',
+ primaryAttribute: { schemaName: 'new_subject', displayName: 'Subject' },
+ columns: [
+ { schemaName: 'new_status', displayName: 'Status', type: 'Choice', options: ['New', 'Closed'] },
+ { schemaName: 'new_notes', displayName: 'Notes', type: 'Memo' },
+ { schemaName: 'new_owner', displayName: 'Owner', type: 'Text' },
+ ],
+ }],
+ appShell: { areas: [{ label: 'Main', groups: [{ label: 'Records', subAreas: [{ entity: 'new_ticket', title: 'Tickets' }] }] }] },
+ businessProcessFlows: flows,
+ };
+}
+
+const FLOW = {
+ name: 'Ticket Handling',
+ entity: 'new_ticket',
+ stages: [
+ { name: 'Triage', steps: [{ name: 'Subject', field: 'new_subject', required: true }] },
+ // Every step binds a column: the platform rejects a step with no `datafieldname`, so there is no
+ // field-less "checklist" step to fixture here. See the step-field test below.
+ { name: 'Resolve', steps: [{ name: 'Notes', field: 'new_notes' }, { name: 'Confirmed with customer', field: 'new_owner' }] },
+ ],
+};
+const errorsFor = (flows) => (validateAppSpec(specWith(flows), { profile: 'plan' }).errors || []);
+
+// --- 1. validation ------------------------------------------------------------------------------
+
+test('a well-formed business process flow validates', () => {
+ const v = validateAppSpec(specWith([FLOW]), { profile: 'plan' });
+ assert.strictEqual(v.ok, true, JSON.stringify(v.errors));
+});
+
+test('a flow must name a known entity, and its steps must name that entity\'s own columns', () => {
+ assert.ok(errorsFor([{ ...FLOW, entity: 'new_nope' }]).some((e) => /unknown entity/.test(e)));
+ // The silent case: the platform materializes the stage and renders a step bound to nothing.
+ const bad = errorsFor([{ ...FLOW, stages: [{ name: 'Triage', steps: [{ name: 'Ghost', field: 'new_ghost' }] }] }]);
+ assert.ok(bad.some((e) => /'new_ghost', which is not a column on new_ticket/.test(e)), JSON.stringify(bad));
+});
+
+test('a lookup created by a relationship counts as a column of the referencing table', () => {
+ // Same rule the business-rule validator applies — a lookup IS a real column, just declared under
+ // relationships[]. Sharing one helper is what keeps the two from disagreeing.
+ const spec = specWith([{ ...FLOW, stages: [{ name: 'Triage', steps: [{ name: 'Acct', field: 'new_accountid' }] }] }]);
+ spec.entities.push({
+ schemaName: 'new_account', displayName: 'Account', pluralName: 'Accounts',
+ primaryAttribute: { schemaName: 'new_name', displayName: 'Name' }, columns: [],
+ });
+ spec.relationships = [{ type: 'OneToMany', referenced: 'new_account', referencing: 'new_ticket', lookup: { schemaName: 'new_accountid', displayName: 'Account' } }];
+ const v = validateAppSpec(spec, { profile: 'plan' });
+ assert.strictEqual(v.ok, true, JSON.stringify(v.errors));
+});
+
+test('a flow needs stages, stages need names and at least one step, and names must be unique', () => {
+ assert.ok(errorsFor([{ ...FLOW, stages: [] }]).some((e) => /stages\[\] is required/.test(e)));
+ assert.ok(errorsFor([{ ...FLOW, stages: [{ steps: [{ name: 'S' }] }] }]).some((e) => /every stage needs a name/.test(e)));
+ assert.ok(errorsFor([{ ...FLOW, stages: [{ name: 'A', steps: [{ name: 'S' }] }, { name: 'A', steps: [{ name: 'T' }] }] }])
+ .some((e) => /duplicate stage name 'A'/.test(e)));
+ assert.ok(errorsFor([{ ...FLOW, stages: [{ name: 'A', steps: [{ name: 'S', field: 'new_notes' }, { name: 'S', field: 'new_owner' }] }] }])
+ .some((e) => /duplicate step name 'S'/.test(e)));
+});
+
+test('a stage with no steps is rejected — the SDK would substitute a phantom "New Step"', () => {
+ // createDefault injects a placeholder step when a stage has none, so an empty stage deploys a step
+ // the author never wrote — and the SDK's own stage-needs-step rule never fires, because the
+ // placeholder is injected before it looks.
+ for (const stages of [[{ name: 'Only', steps: [] }], [{ name: 'Only' }]]) {
+ assert.ok(errorsFor([{ ...FLOW, stages }]).some((e) => /has no steps/.test(e) && /New Step/.test(e)), JSON.stringify(stages));
+ }
+});
+
+test('two flows whose names derive the same Dataverse unique name are rejected', () => {
+ // The SDK derives `uniquename` as new_<name lower-cased, non-alphanumerics stripped> — it IGNORES
+ // the table. Activation then creates a backing TABLE with that name, so the second flow cannot
+ // deploy at all. An (entity, name) key would let all three of these through.
+ assert.ok(errorsFor([FLOW, { ...FLOW }]).some((e) => /derive the Dataverse unique name 'new_tickethandling'/.test(e)));
+ // Same name, DIFFERENT table — still a collision, because the derivation ignores the entity.
+ const spec = specWith([FLOW, { ...FLOW, entity: 'new_other' }]);
+ spec.entities.push({
+ schemaName: 'new_other', displayName: 'Other', pluralName: 'Others',
+ primaryAttribute: { schemaName: 'new_othername', displayName: 'Name' }, columns: [],
+ });
+ spec.businessProcessFlows[1].stages = [{ name: 'Triage', steps: [{ name: 'Name', field: 'new_othername' }] }];
+ const errs = validateAppSpec(spec, { profile: 'plan' }).errors || [];
+ assert.ok(errs.some((e) => /derive the Dataverse unique name/.test(e)), JSON.stringify(errs));
+ // Case and punctuation are stripped, so these collide too.
+ assert.ok(errorsFor([FLOW, { ...FLOW, name: 'ticket-handling' }]).some((e) => /derive the Dataverse unique name/.test(e)));
+ // Renaming clears it — the message suggests exactly this shape.
+ spec.businessProcessFlows[1].name = 'Ticket Handling (Cases)';
+ assert.strictEqual(validateAppSpec(spec, { profile: 'plan' }).ok, true, JSON.stringify(validateAppSpec(spec, { profile: 'plan' }).errors));
+});
+
+test('bpfUniqueName mirrors the SDK derivation exactly', () => {
+ const { bpfUniqueName } = require('../lib/app-spec.js');
+ assert.strictEqual(bpfUniqueName('Ticket Handling'), 'new_tickethandling');
+ assert.strictEqual(bpfUniqueName('ticket-handling'), 'new_tickethandling');
+ assert.strictEqual(bpfUniqueName('Ticket Handling!'), 'new_tickethandling');
+ // The SDK falls back to a literal when the name normalizes to nothing, so two such flows collide.
+ assert.strictEqual(bpfUniqueName('!!!'), 'new_businessprocessflow');
+ assert.strictEqual(bpfUniqueName(''), 'new_businessprocessflow');
+});
+
+test('REAL BUNDLE: the derived uniquename really does ignore the table and the punctuation', async () => {
+ // bpfUniqueName is a MIRROR of SDK behaviour, so it has to be checked against the bundle — a mirror
+ // that drifts would silently stop catching the collision it exists to catch.
+ const { bpfUniqueName } = require('../lib/app-spec.js');
+ for (const [name, entity] of [['Ticket Handling', 'new_ticket'], ['ticket-handling', 'new_case'], ['!!!', 'new_ticket']]) {
+ const { sdk, writes } = realSdk();
+ const art = sdk.createArtifact('bpf', bpfDef({ name, entity, status: 'Draft', stages: [{ name: 'S', steps: [{ name: 'P' }] }] }));
+ await sdk.pushArtifact('bpf', art.id);
+ const post = writes.find((w) => w.verb === 'POST' && /\/workflows$/.test(w.url));
+ assert.strictEqual(post.body.uniquename, bpfUniqueName(name), `${name} on ${entity}`);
+ }
+});
+
+// The platform rejects a step with no bound column:
+// HTTP 400 ... Attribute - datafieldname of ControlStep cannot be null or empty
+// This was originally modelled as optional ("a checklist item"), which validated fine and then HALTED
+// a live build in the business-process-flows phase — after the solution, table, columns, views and
+// forms were already created. Isolated by A/B live: the identical flow with every step bound deploys
+// and activates cleanly.
+test('a step that binds no field is rejected — the platform requires a datafieldname', () => {
+ const errs = errorsFor([{ ...FLOW, stages: [{ name: 'A', steps: [{ name: 'Call the customer' }] }] }]);
+ assert.ok(errs.some((e) => /binds no field/.test(e)), `expected a step-field error, got ${JSON.stringify(errs)}`);
+ // The message has to tell the author what to do instead, not just say no.
+ assert.ok(errs.some((e) => /datafieldname of ControlStep/.test(e)), 'must quote the platform error so it is searchable');
+ assert.ok(errs.some((e) => /Boolean/.test(e)), 'must name the workaround (bind a Boolean flag)');
+ // A required-but-unbound step is the same defect, and must not slip through a different branch.
+ assert.ok(errorsFor([{ ...FLOW, stages: [{ name: 'A', steps: [{ name: 'Nothing', required: true }] }] }])
+ .some((e) => /binds no field/.test(e)));
+ // A bound step is still fine.
+ assert.deepStrictEqual(errorsFor([{ ...FLOW, stages: [{ name: 'A', steps: [{ name: 'Call the customer', field: 'new_owner' }] }] }]), []);
+});
+
+test('a BLANK or null field is the same defect as a missing one, and says so', () => {
+ // Treating only `undefined` as missing let these fall through to the column check, which reported
+ // `references ''` — or `references 'null'` from stringifying the value — instead of the actionable
+ // message. Same defect, same guidance.
+ for (const bad of ['', ' ', null]) {
+ const errs = errorsFor([{ ...FLOW, stages: [{ name: 'A', steps: [{ name: 'X', field: bad }] }] }]);
+ assert.ok(
+ errs.some((e) => /binds no field/.test(e)),
+ `field ${JSON.stringify(bad)} must report "binds no field"; got ${JSON.stringify(errs)}`,
+ );
+ assert.ok(!errs.some((e) => /references '/.test(e)), `field ${JSON.stringify(bad)} must not report a bogus column reference`);
+ }
+ // A real column name that simply does not exist STILL reports the column error — the blank check
+ // must not swallow that case.
+ assert.ok(errorsFor([{ ...FLOW, stages: [{ name: 'A', steps: [{ name: 'X', field: 'new_nope' }] }] }])
+ .some((e) => /references 'new_nope'/.test(e)));
+});
+
+test('status and order are constrained', () => {
+ assert.ok(errorsFor([{ ...FLOW, status: 'Published' }]).some((e) => /status must be Active\|Draft/.test(e)));
+ assert.ok(errorsFor([{ ...FLOW, order: 0 }]).some((e) => /order must be a positive integer/.test(e)));
+ assert.ok(errorsFor([{ ...FLOW, order: 1.5 }]).some((e) => /order must be a positive integer/.test(e)));
+ assert.deepStrictEqual(errorsFor([{ ...FLOW, status: 'Draft', order: 3 }]), []);
+});
+
+test('a cross-entity stage is rejected rather than silently retargeted', () => {
+ // The SDK models a per-stage entity, so this would deploy as a DIFFERENT process (one spanning
+ // records) instead of failing — the author would not find out from the build.
+ assert.ok(errorsFor([{ ...FLOW, stages: [{ name: 'A', entity: 'new_other', steps: [{ name: 'S' }] }] }])
+ .some((e) => /cross-entity flows are not supported/.test(e)));
+ // Restating the flow's own entity is harmless.
+ assert.deepStrictEqual(errorsFor([{ ...FLOW, stages: [{ name: 'A', entity: 'new_ticket', steps: [{ name: 'S', field: 'new_notes' }] }] }]), []);
+});
+
+test('a knob the build cannot verify is REJECTED, not ignored — at flow, stage AND step level', () => {
+ // Silently dropping a key the author wrote is how a spec "deploys" something it does not: they
+ // would see the stages appear and reasonably assume the rest applied.
+ for (const key of ['securityRoles', 'branch', 'actions', 'globalActions']) {
+ const errs = errorsFor([{ ...FLOW, [key]: key === 'securityRoles' ? ['Salesperson'] : [{}] }]);
+ assert.ok(errs.some((e) => new RegExp(`unsupported key '${key}'`).test(e)), `${key}: ${JSON.stringify(errs)}`);
+ }
+ // STAGE level is where an author would naturally write branching/actions — the SDK models them
+ // there, and bpfDef maps only name/entity/steps, so an unguarded key vanishes without a word.
+ for (const key of ['branch', 'actions', 'nextStageId', 'category', 'relationshipName']) {
+ const errs = errorsFor([{ ...FLOW, stages: [{ name: 'A', [key]: key === 'category' ? 3 : [{}], steps: [{ name: 'S' }] }] }]);
+ assert.ok(errs.some((e) => new RegExp(`stage 'A' has unsupported key '${key}'`).test(e)), `stage.${key}: ${JSON.stringify(errs)}`);
+ }
+ // STEP level: `fieldLogicalName` is the plausible spelling (it is what the SDK calls the key on
+ // other artifacts), and the step normalizer drops it — deploying a step bound to nothing.
+ const stepErrs = errorsFor([{ ...FLOW, stages: [{ name: 'A', steps: [{ name: 'S', fieldLogicalName: 'new_notes' }] }] }]);
+ assert.ok(stepErrs.some((e) => /step 'S' has unsupported key 'fieldLogicalName'/.test(e)), JSON.stringify(stepErrs));
+ assert.ok(stepErrs.some((e) => /the column key is 'field'/.test(e)), 'the message must name the right key');
+});
+
+// --- 2. mapping ---------------------------------------------------------------------------------
+
+test('bpfDef maps onto the SDK artifact shape — and uses `fieldName`, not `fieldLogicalName`', () => {
+ const def = bpfDef({ ...FLOW, description: 'How tickets are handled', order: 7 });
+ assert.strictEqual(def.name, 'Ticket Handling');
+ assert.strictEqual(def.entityLogicalName, 'new_ticket');
+ assert.strictEqual(def.status, 'Active', 'a flow is invisible until activated, so Active is the default');
+ assert.strictEqual(def.description, 'How tickets are handled');
+ assert.strictEqual(def.order, 7);
+
+ // THE trap this test exists for. The adapter's step normalizer copies id/name/fieldName/required
+ // and drops everything else, so `fieldLogicalName` would vanish without any error and the step
+ // would deploy bound to nothing.
+ assert.deepStrictEqual(def.stages, [
+ { name: 'Triage', entityLogicalName: 'new_ticket', steps: [{ name: 'Subject', fieldName: 'new_subject', required: true }] },
+ { name: 'Resolve', entityLogicalName: 'new_ticket', steps: [{ name: 'Notes', fieldName: 'new_notes' }, { name: 'Confirmed with customer', fieldName: 'new_owner' }] },
+ ]);
+});
+
+test('bpfDef omits absent optionals rather than emitting undefined', () => {
+ // `{ required: undefined }` is not the same as no key: the adapter checks `!== undefined`.
+ const def = bpfDef(FLOW);
+ assert.ok(!('description' in def), 'no description key when none was authored');
+ assert.ok(!('order' in def), 'no order key when none was authored');
+ assert.deepStrictEqual(Object.keys(def.stages[1].steps[1]), ['name', 'fieldName'], 'a step with no `required` carries only name + fieldName');
+});
+
+test('bpfDef lower-cases the entity everywhere it appears', () => {
+ const def = bpfDef({ ...FLOW, entity: 'New_Ticket', stages: [{ name: 'A', steps: [{ name: 'S', field: 'New_Notes' }] }] });
+ assert.strictEqual(def.entityLogicalName, 'new_ticket');
+ assert.strictEqual(def.stages[0].entityLogicalName, 'new_ticket');
+ assert.strictEqual(def.stages[0].steps[0].fieldName, 'new_notes');
+});
+
+test('bpfFilter selects the BPF definition only — not the activated copy, not a task flow', () => {
+ const f = bpfFilter('Ticket Handling', 'new_ticket');
+ assert.match(f, /category eq 4/, 'category 4 = BusinessProcessFlow');
+ assert.match(f, /type eq 1/, 'definition rows only; the platform owns the type-2 activated copy');
+ assert.match(f, /businessprocesstype eq 0/, 'BusinessFlow only — a task flow is also category 4');
+ assert.match(f, /name eq 'Ticket Handling'/);
+ assert.match(f, /primaryentity eq 'new_ticket'/);
+ // Scoping to the entity as well as the name is what stops a same-named flow on another table
+ // being adopted as this one.
+ assert.strictEqual(bpfFilter("O'Brien", 'NEW_Ticket').includes("name eq 'O''Brien'"), true, 'OData literals are escaped');
+ assert.match(bpfFilter('x', 'NEW_Ticket'), /primaryentity eq 'new_ticket'/, 'the entity is lower-cased');
+});
+
+test('every BPF query in build, verify and teardown goes through bpfFilter', () => {
+ // The business-rule equivalent of this test exists because an unfiltered query made teardown fail
+ // on every activated rule. Enforce the same discipline here by construction rather than by review.
+ for (const file of ['sdk-build.js', 'verify-spec.js', 'sdk-teardown.js']) {
+ const src = fs.readFileSync(path.join(__dirname, '..', 'lib', file), 'utf8');
+ const category4 = [...src.matchAll(/category eq 4/g)].length;
+ const inFilter = [...src.matchAll(/bpfFilter\(/g)].length;
+ if (file === 'sdk-build.js') {
+ assert.strictEqual(category4, 1, 'sdk-build.js defines the filter exactly once');
+ } else {
+ assert.strictEqual(category4, 0, `${file} must not hand-roll a category-4 filter`);
+ assert.ok(inFilter > 0, `${file} must use bpfFilter`);
+ }
+ }
+});
+
+// --- 3. real bundle -----------------------------------------------------------------------------
+
+function realSdk() {
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'bpf-'));
+ dirs.push(dir);
+ const writes = [];
+ const { createMakerSdk } = require(BUNDLE);
+ const sdk = createMakerSdk({
+ workspacePath: dir, instanceUrl: 'https://contoso.crm.dynamics.com',
+ httpClient: {
+ get: async () => ({ status: 200, headers: {}, body: { value: [] } }),
+ post: async (url, body) => { writes.push({ verb: 'POST', url: String(url), body }); return { status: 200, headers: {}, body: { workflowid: '44444444-4444-4444-4444-444444444444' } }; },
+ patch: async (url, body) => { writes.push({ verb: 'PATCH', url: String(url), body }); return { status: 204, headers: {}, body: {} }; },
+ put: async () => ({ status: 204, headers: {}, body: {} }),
+ delete: async () => ({ status: 204, headers: {}, body: {} }),
+ },
+ });
+ sdk.initWorkspace();
+ return { sdk, writes };
+}
+
+test('REAL BUNDLE: a BPF is authored through the generic artifact lifecycle', async () => {
+ // There is no dedicated BPF method on the SDK surface — it is createArtifact -> pushArtifact, and
+ // the whole stage/step tree rides on the create payload (unlike a business rule's condition tree,
+ // which needs an updateElement). Pinning that tells a future implementer which surface to build on.
+ const { sdk } = realSdk();
+ const art = sdk.createArtifact('bpf', bpfDef(FLOW));
+ assert.ok(art && art.id, 'createArtifact returns an artifact with an id');
+ assert.deepStrictEqual(Object.keys(art).sort(), ['entityLogicalName', 'id', 'name', 'stages', 'status']);
+ // The adapter stamps ids on stages and steps; the plugin deliberately does not mint them.
+ assert.strictEqual(art.stages.length, 2);
+ assert.ok(art.stages.every((s) => s.id), 'every stage is id-stamped by the adapter');
+ assert.ok(art.stages.every((s) => (s.steps || []).every((p) => p.id)), 'every step is id-stamped by the adapter');
+ const pushed = await sdk.pushArtifact('bpf', art.id);
+ assert.strictEqual(pushed.saved, true, 'the push commits');
+});
+
+test('REAL BUNDLE: the wire payload is a category-4 BusinessFlow definition carrying the stages', async () => {
+ const { sdk, writes } = realSdk();
+ const art = sdk.createArtifact('bpf', bpfDef({ ...FLOW, status: 'Draft', description: 'd' }));
+ await sdk.pushArtifact('bpf', art.id);
+
+ const post = writes.find((w) => w.verb === 'POST' && /\/workflows$/.test(w.url));
+ assert.ok(post, `a workflows create must be issued; got ${JSON.stringify(writes.map((w) => w.verb + ' ' + w.url))}`);
+ // The discriminating columns. A flow written with the wrong category/businessprocesstype is not a
+ // BPF at all — and would then be invisible to every query in build, verify and teardown.
+ assert.strictEqual(post.body.category, 4, 'category 4 = BusinessProcessFlow');
+ assert.strictEqual(post.body.type, 1, 'type 1 = definition');
+ assert.strictEqual(post.body.businessprocesstype, 0, 'businessprocesstype 0 = BusinessFlow (not a task flow)');
+ assert.strictEqual(post.body.scope, 4, 'scope 4 = Organization');
+ assert.strictEqual(post.body.primaryentity, 'new_ticket');
+ assert.strictEqual(post.body.name, 'Ticket Handling');
+
+ // The authored stages and the bound columns must survive compilation into the XAML — if they did
+ // not, the flow would deploy as an empty process and nothing would report it.
+ const xaml = post.body.xaml;
+ assert.ok(typeof xaml === 'string' && xaml.length > 1000, `expected substantial XAML, got ${xaml && xaml.length}`);
+ assert.match(xaml, /StageStep\d+: Triage/);
+ assert.match(xaml, /StageStep\d+: Resolve/);
+ assert.ok(xaml.includes('new_subject'), 'the bound column reached the compiled process');
+ assert.ok(xaml.includes('new_notes'), 'the second bound column reached the compiled process');
+});
+
+test('REAL BUNDLE: an Active flow is activated in the same push (statecode 1 / statuscode 2)', async () => {
+ // Activation is a SECOND, non-atomic request. It is what makes the process appear on the form, so
+ // a re-vendor that stopped issuing it would deploy flows nobody can see.
+ const { sdk, writes } = realSdk();
+ const art = sdk.createArtifact('bpf', bpfDef({ ...FLOW, status: 'Active' }));
+ await sdk.pushArtifact('bpf', art.id);
+ const patch = writes.find((w) => w.verb === 'PATCH' && /workflows\(/.test(w.url));
+ assert.ok(patch, `an activation PATCH must follow the create; got ${JSON.stringify(writes.map((w) => w.verb + ' ' + w.url))}`);
+ assert.deepStrictEqual(patch.body, { statecode: 1, statuscode: 2 });
+});
+
+test('REAL BUNDLE: a Draft flow is NOT activated', async () => {
+ const { sdk, writes } = realSdk();
+ const art = sdk.createArtifact('bpf', bpfDef({ ...FLOW, status: 'Draft' }));
+ await sdk.pushArtifact('bpf', art.id);
+ assert.strictEqual(writes.some((w) => w.verb === 'PATCH'), false, 'Draft must not be activated');
+});
+
+test('REAL BUNDLE: XML carrying character data still parses (the headless text-node regression)', async () => {
+ // Every BPF push crashed with `TypeError: Cannot read properties of null (reading 'length')` in the
+ // vendored (headless) bundle, and ONLY there: the SDK's grammar walk descended into TEXT nodes, and
+ // @xmldom/xmldom exposes a text node's `childNodes` as null where jsdom returns an empty NodeList.
+ // The BPF XAML template always contains text (`<mva:VisualBasic.Settings>`, stage/step ids,
+ // `False`), so this was input-independent — while the SDK's own jsdom suite stayed green.
+ //
+ // This asserts the SHIPPED bundle is fixed. A re-vendor that reintroduces it fails here rather
+ // than in a user's build.
+ const { sdk } = realSdk();
+ const art = sdk.createArtifact('bpf', bpfDef(FLOW));
+ await assert.doesNotReject(() => sdk.pushArtifact('bpf', art.id));
+});
+
+// --- 4. build phase -----------------------------------------------------------------------------
+
+test('the phase is registered in PHASES and in the ui stage', () => {
+ assert.ok(PHASES.includes('business-process-flows'));
+ assert.deepStrictEqual(STAGE_PHASES, PHASES, 'stages.js is the single source of truth for the engine');
+ assert.ok(STAGES.ui.includes('business-process-flows'));
+ // Right after business-rules: both are authored against the entity's columns and nothing later.
+ assert.strictEqual(PHASES[PHASES.indexOf('business-rules') + 1], 'business-process-flows');
+});
+
+test('planFor lists each flow with its stage count', () => {
+ const items = planFor(specWith([FLOW]), { phases: ['business-process-flows'] });
+ const labels = items.filter((i) => i.phase === 'business-process-flows').map((i) => i.label);
+ assert.deepStrictEqual(labels, ['business process flow "Ticket Handling" on new_ticket (2 stages)']);
+ // Singular/plural, because a plan is read by a human before they approve it.
+ const one = planFor(specWith([{ ...FLOW, stages: [FLOW.stages[0]] }]), { phases: ['business-process-flows'] });
+ assert.match(one.find((i) => i.phase === 'business-process-flows').label, /\(1 stage\)$/);
+});
+
+// Minimal provision double: only the surface the business-process-flows phase touches.
+function provisionWithFlows(rows) {
+ const calls = [];
+ return {
+ calls,
+ provision: {
+ queryRecords: async (entity, opts) => {
+ if (entity === 'workflow') { calls.push(['queryRecords', entity, opts]); return rows; }
+ return entity === 'solution' ? [] : [{ publisherid: 'pub-1' }];
+ },
+ updateRecord: async (e, id, patch) => { calls.push(['updateRecord', e, id, patch]); },
+ deleteRecord: async (e, id) => { calls.push(['deleteRecord', e, id]); },
+ createArtifact: (kind, def) => { calls.push(['createArtifact', kind, def]); return { id: 'bpf-new' }; },
+ updateElement: async () => undefined,
+ pushArtifact: async (kind, id) => { calls.push(['pushArtifact', kind, id]); return { id: 'bpf-new', saved: true, publish: { kind: 'notRequested' } }; },
+ addSolutionComponent: async (a) => { calls.push(['addSolutionComponent', a]); },
+ },
+ };
+}
+const buildFlow = async (rows, opts = {}) => {
+ const { sdk } = require('./helpers/mock-sdk.js').makeSimpleMockSdk();
+ const { provision, calls } = provisionWithFlows(rows);
+ const warnings = [];
+ const spec = specWith([{ ...FLOW, ...(opts.status ? { status: opts.status } : {}) }]);
+ await runSdkBuild(spec, { sdk, provisionSdk: provision, apply: true, phases: ['business-process-flows'], warn: (m) => warnings.push(m) });
+ return { calls, warnings };
+};
+
+test('a new flow is created, pushed, and added to the solution as a workflow component', async () => {
+ const { calls } = await buildFlow([]);
+ const created = calls.find((c) => c[0] === 'createArtifact');
+ assert.ok(created, 'the flow is created');
+ assert.strictEqual(created[1], 'bpf');
+ assert.strictEqual(created[2].entityLogicalName, 'new_ticket');
+ assert.ok(calls.some((c) => c[0] === 'pushArtifact' && c[1] === 'bpf'));
+ const solComponent = calls.find((c) => c[0] === 'addSolutionComponent');
+ assert.ok(solComponent, 'the flow must join the solution or it will not travel on export/import');
+ assert.strictEqual(solComponent[1].componentId, 'bpf-new');
+ assert.strictEqual(solComponent[1].componentType, 29, 'componentType 29 = workflow');
+});
+
+test('an existing flow is REUSED, not duplicated (the rebuild path)', async () => {
+ const { calls } = await buildFlow([{ workflowid: 'existing', statecode: 1, createdon: '2026-01-01T00:00:00Z' }]);
+ assert.strictEqual(calls.some((c) => c[0] === 'createArtifact'), false, 'a rebuild must not stack a second process on the table');
+ assert.strictEqual(calls.some((c) => c[0] === 'updateRecord'), false, 'an already-correct flow is left alone');
+});
+
+test('the reuse query is ORDERED and asks for more than one row', async () => {
+ // `top: 1` unordered adopts an arbitrary row and hides duplicates entirely — the business-rule bug.
+ const { calls } = await buildFlow([{ workflowid: 'only', statecode: 1, createdon: '2026-01-01T00:00:00Z' }]);
+ const q = calls.find((c) => c[0] === 'queryRecords');
+ assert.ok(q[2].top > 1, `the reuse query must be able to SEE duplicates; top was ${q[2].top}`);
+ assert.match(String(q[2].orderBy), /createdon asc/, 'oldest-first makes the surviving row deterministic');
+ assert.match(String(q[2].filter), /category eq 4 and type eq 1 and businessprocesstype eq 0/);
+});
+
+test('a flow deployed in the WRONG state is converged, in both directions', async () => {
+ // "Exists, so skip" would report success over a process nobody can see (Draft), or one still
+ // running after the spec asked for Draft.
+ const draftOnServer = await buildFlow([{ workflowid: 'w1', statecode: 0, createdon: '2026-01-01T00:00:00Z' }], { status: 'Active' });
+ assert.deepStrictEqual(draftOnServer.calls.find((c) => c[0] === 'updateRecord').slice(1), ['workflow', 'w1', { statecode: 1, statuscode: 2 }]);
+
+ const activeOnServer = await buildFlow([{ workflowid: 'w1', statecode: 1, createdon: '2026-01-01T00:00:00Z' }], { status: 'Draft' });
+ assert.deepStrictEqual(activeOnServer.calls.find((c) => c[0] === 'updateRecord').slice(1), ['workflow', 'w1', { statecode: 0, statuscode: 1 }]);
+});
+
+test('pre-existing duplicates are WARNED about, not silently adopted', async () => {
+ const { warnings } = await buildFlow([
+ { workflowid: 'oldest', statecode: 1, createdon: '2026-01-01T00:00:00Z' },
+ { workflowid: 'dupe', statecode: 1, createdon: '2026-01-01T00:00:05Z' },
+ ]);
+ assert.ok(warnings.some((w) => /2 definitions exist with this name/.test(w)), JSON.stringify(warnings));
+});
+
+test('a flow that cannot be activated warns instead of halting the build', async () => {
+ // One wedged process must not block an otherwise-good app; `--verify` reports the real state.
+ const { sdk } = require('./helpers/mock-sdk.js').makeSimpleMockSdk();
+ const { provision } = provisionWithFlows([{ workflowid: 'w1', statecode: 0, createdon: '2026-01-01T00:00:00Z' }]);
+ provision.updateRecord = async () => { throw new Error('Invalid operation'); };
+ const warnings = [];
+ const res = await runSdkBuild(specWith([FLOW]), { sdk, provisionSdk: provision, apply: true, phases: ['business-process-flows'], warn: (m) => warnings.push(m) });
+ assert.strictEqual(res.ok, true, 'the build survives');
+ assert.ok(warnings.some((w) => /could not be activated/.test(w)), JSON.stringify(warnings));
+});
+
+test('a spec with no flows makes no workflow calls at all', async () => {
+ const { sdk } = require('./helpers/mock-sdk.js').makeSimpleMockSdk();
+ const { provision, calls } = provisionWithFlows([]);
+ const spec = specWith([]);
+ delete spec.businessProcessFlows;
+ await runSdkBuild(spec, { sdk, provisionSdk: provision, apply: true, phases: ['business-process-flows'] });
+ assert.strictEqual(calls.length, 0);
+});
+
+// --- 5. teardown --------------------------------------------------------------------------------
+
+test('teardown removes each flow BEFORE the table it is bound to', async () => {
+ const steps = planTeardown(specWith([FLOW]));
+ const kinds = steps.map((s) => s.kind);
+ const flowAt = kinds.indexOf('businessProcessFlows');
+ assert.ok(flowAt > -1, `a flow step must be planned; got ${JSON.stringify(kinds)}`);
+ // The kind is SINGULAR (`table`) — planTeardown emits kind 'table' with phase 'tables'. Guarding on
+ // 'tables' made `tableAt` permanently -1, so the ordering assertion below never ran and moving BPF
+ // teardown after the table delete stayed green. Assert the index is real before comparing.
+ const tableAt = kinds.indexOf('table');
+ assert.ok(tableAt > -1, `a table step must be planned; got ${JSON.stringify(kinds)}`);
+ assert.ok(flowAt < tableAt, 'an activated flow is a workflow row bound to the entity — it cannot be left for the table delete to cascade');
+ assert.deepStrictEqual(steps[flowAt].target, { entity: 'new_ticket', name: 'Ticket Handling' });
+});
+
+test('teardown resolves a flow through bpfFilter and deactivates before deleting', async () => {
+ const handler = KIND_HANDLERS.businessProcessFlows;
+ const queries = [];
+ const ops = [];
+ const sdk = {
+ queryRecords: async (e, o) => { queries.push([e, o]); return [{ workflowid: 'w1', statecode: 1 }]; },
+ updateRecord: async (e, id, patch) => { ops.push(['update', id, patch]); },
+ deleteRecord: async (e, id) => { ops.push(['delete', id]); },
+ };
+ const items = await handler.resolve(sdk, { entity: 'new_ticket', name: 'Ticket Handling' });
+ assert.match(String(queries[0][1].filter), /category eq 4 and type eq 1 and businessprocesstype eq 0/);
+ assert.deepStrictEqual(items, [{ id: 'w1', name: 'Ticket Handling', statecode: 1 }]);
+
+ await handler.del(sdk, items[0]);
+ // Dataverse refuses to delete an ACTIVATED process, and the error names neither the flow nor why.
+ assert.deepStrictEqual(ops, [['update', 'w1', { statecode: 0, statuscode: 1 }], ['delete', 'w1']]);
+ assert.strictEqual(handler.tolerateNotFound, true, 'an already-gone flow is "deleted"');
+});
+
+test('teardown does not deactivate a flow that is already Draft', async () => {
+ const ops = [];
+ const sdk = {
+ queryRecords: async () => [{ workflowid: 'w1', statecode: 0 }],
+ updateRecord: async (e, id) => { ops.push(['update', id]); },
+ deleteRecord: async (e, id) => { ops.push(['delete', id]); },
+ };
+ const handler = KIND_HANDLERS.businessProcessFlows;
+ await handler.del(sdk, (await handler.resolve(sdk, { entity: 'new_ticket', name: 'X' }))[0]);
+ assert.deepStrictEqual(ops, [['delete', 'w1']]);
+});
+
+// --- 6. verify ----------------------------------------------------------------------------------
+
+const flowReader = (workflows) => ({
+ findTable: async () => ({ logicalName: 'new_ticket' }),
+ findColumns: async () => [{ logicalName: 'new_subject' }, { logicalName: 'new_notes' }, { logicalName: 'new_owner' }, { logicalName: 'new_status' }],
+ queryRecords: async (entity) => (entity === 'workflow' ? workflows : []),
+ sitemapXml: async () => '',
+});
+const flowCheck = (r) => r.checks.find((c) => c.kind === 'business-process-flow');
+const flowSpec = (status) => specWith([{ ...FLOW, ...(status ? { status } : {}) }]);
+
+test('verify PASSES an Active flow the spec wants Active', async () => {
+ const c = flowCheck(await verifySpec(flowSpec(), flowReader([{ workflowid: 'w1', statecode: 1 }])));
+ assert.strictEqual(c.present, true);
+});
+
+test('verify FAILS a flow that never deployed', async () => {
+ const c = flowCheck(await verifySpec(flowSpec(), flowReader([])));
+ assert.strictEqual(c.present, false);
+ assert.match(c.detail, /not deployed/);
+});
+
+test('verify FAILS a flow deployed as Draft — "exists" is not "appears on the form"', async () => {
+ const c = flowCheck(await verifySpec(flowSpec(), flowReader([{ workflowid: 'w1', statecode: 0 }])));
+ assert.strictEqual(c.present, false);
+ assert.match(c.detail, /DRAFT/);
+});
+
+test('verify FAILS duplicates — users would be offered the same process twice', async () => {
+ const c = flowCheck(await verifySpec(flowSpec(), flowReader([{ workflowid: 'w1', statecode: 1 }, { workflowid: 'w2', statecode: 1 }])));
+ assert.strictEqual(c.present, false);
+ assert.match(c.detail, /2 process flows share this name/);
+});
+
+test('verify FAILS an ACTIVE flow the spec asks to be Draft', async () => {
+ const c = flowCheck(await verifySpec(flowSpec('Draft'), flowReader([{ workflowid: 'w1', statecode: 1 }])));
+ assert.strictEqual(c.present, false);
+ assert.match(c.detail, /running/);
+});
+
+test('verify fails CLOSED when the workflow read itself errors', async () => {
+ // "Could not look" must never read as "present and correct".
+ const read = Object.assign(flowReader([]), {
+ queryRecords: async (entity) => { if (entity === 'workflow') throw new Error('HTTP 401'); return []; },
+ });
+ const c = flowCheck(await verifySpec(flowSpec(), read));
+ assert.strictEqual(c.present, false);
+ assert.match(c.detail, /could not be read/);
+});
+
+// --- 7. the spec diff SEES a flow change --------------------------------------------------------
+//
+// `PHASE_SLICES` is an explicit map, so a phase missing from it makes its slice invisible: the diff
+// reports "nothing changed" and `--changed-only` classifies a real edit as a NO-OP and does nothing.
+// business-rules was in exactly that state, which is why these assertions cover both phases.
+
+const { diffPhases } = require('../lib/phase-diff.js');
+const { classifyChanges } = require('../lib/classify-changes.js');
+
+test('a flow-only edit is a real change, not a no-op', () => {
+ const prior = specWith([FLOW]);
+ // The added stage binds a real column. A field-less step is not a valid spec (the platform rejects
+ // an empty `datafieldname`), and a diff fixture that the validator would reject is a trap: it makes
+ // the test pass on input a build could never carry. Assert the fixture's validity so it stays honest.
+ const current = specWith([{ ...FLOW, stages: [...FLOW.stages, { name: 'Close', steps: [{ name: 'Sign off', field: 'new_status' }] }] }]);
+ assert.strictEqual(validateAppSpec(current, { profile: 'plan' }).ok, true, 'the diff fixture must itself be a valid spec');
+ assert.deepStrictEqual(diffPhases(current, prior), ['business-process-flows']);
+});
+
+test('a business-RULE-only edit is a real change too (the same map governs both)', () => {
+ const rule = { name: 'R', entity: 'new_ticket', conditions: [{ field: 'new_owner', operator: 'Equals', value: 'x' }], actions: [{ type: 'SetVisibility', field: 'new_notes', visible: false }] };
+ const prior = { ...specWith([]), businessRules: [rule] };
+ const current = { ...specWith([]), businessRules: [{ ...rule, actions: [{ type: 'SetVisibility', field: 'new_notes', visible: true }] }] };
+ assert.deepStrictEqual(diffPhases(current, prior), ['business-rules']);
+});
+
+test('an EDITED flow forces a full build and records debt — the engine skips edits to an existing flow', () => {
+ const prior = specWith([FLOW]);
+ const current = specWith([{ ...FLOW, stages: [{ name: 'Renamed', steps: [{ name: 'Subject', field: 'new_subject' }] }, FLOW.stages[1]] }]);
+ const r = classifyChanges(current, prior);
+ assert.strictEqual(r.verdict, 'full');
+ assert.ok(r.fullReasons.some((x) => /business-process-flows.*edited/.test(x)), JSON.stringify(r.fullReasons));
+ assert.deepStrictEqual(r.debt, [{ artifactType: 'businessProcessFlow', identity: 'new_ticket|Ticket Handling', reason: 'businessProcessFlow-edit-not-convergent' }]);
+});
+
+test('an ADDED flow forces a full build with NO debt — a full build creates it correctly', () => {
+ const prior = specWith([]);
+ const current = specWith([FLOW]);
+ const r = classifyChanges(current, prior);
+ assert.strictEqual(r.verdict, 'full');
+ assert.deepStrictEqual(r.debt, []);
+});
+
+// --- 6. regressions found by live-testing the feature ------------------------------------------
+// Each block below guards a defect that ALREADY SHIPPED in the first cut of this feature. They are
+// grouped here rather than scattered so the provenance stays attached to the assertion.
+
+test('REGRESSION: an object-valued businessProcessFlows is a validation error, not a TypeError', () => {
+ // `businessProcessFlows` was missing from spec-shape COLLECTIONS, so a mid-edit object reached the
+ // phase`s for...of and threw `object is not iterable`. businessRules already handled this; the new
+ // collection repeated the mistake it documents.
+ const spec = specWith([FLOW]);
+ spec.businessProcessFlows = { name: 'X', entity: 'new_ticket', stages: [] };
+ let errs;
+ assert.doesNotThrow(() => { errs = validateAppSpec(spec, { profile: 'plan' }).errors || []; });
+ assert.ok(errs.some((e) => /businessProcessFlows must be an array/.test(e)), `got ${JSON.stringify(errs)}`);
+});
+
+test('REGRESSION: object-valued stages and steps are validation errors too', () => {
+ for (const [label, flow] of Object.entries({
+ stages: { ...FLOW, stages: { name: 'S' } },
+ steps: { ...FLOW, stages: [{ name: 'S', steps: { name: 'x' } }] },
+ })) {
+ const spec = specWith([flow]);
+ let errs;
+ assert.doesNotThrow(() => { errs = validateAppSpec(spec, { profile: 'plan' }).errors || []; }, `${label} threw`);
+ assert.ok(errs.length, `${label}: expected a validation error`);
+ }
+});
+
+test('REGRESSION: a non-string flow name is rejected before the SDK lower-cases it', () => {
+ // The SDK derives the unique name via `.toLowerCase()`, so a non-string died inside the bundle.
+ assert.ok(errorsFor([{ ...FLOW, name: {} }]).some((e) => /name must be a non-empty string/.test(e)));
+ assert.ok(errorsFor([{ ...FLOW, name: ' ' }]).some((e) => /name (is required|must be a non-empty string)/.test(e)));
+});
+
+test('REGRESSION: a non-string description is rejected', () => {
+ assert.ok(errorsFor([{ ...FLOW, description: {} }]).length, 'a non-string description must not reach the SDK');
+});
+
+test('REGRESSION: the SDK stage/step ceilings are enforced as spec errors', () => {
+ const many = (n) => Array.from({ length: n }, (_, i) => ({ name: `S${i}`, steps: [{ name: 'x', field: 'new_notes' }] }));
+ assert.deepStrictEqual(errorsFor([{ ...FLOW, stages: many(30) }]), [], '30 stages is allowed');
+ assert.ok(errorsFor([{ ...FLOW, stages: many(31) }]).some((e) => /at most 30/.test(e)), '31 stages must be rejected');
+
+ const steps = (n) => [{ name: 'S', steps: Array.from({ length: n }, (_, i) => ({ name: `Step${i}`, field: 'new_notes' })) }];
+ assert.deepStrictEqual(errorsFor([{ ...FLOW, stages: steps(30) }]), [], '30 steps is allowed');
+ assert.ok(errorsFor([{ ...FLOW, stages: steps(31) }]).some((e) => /at most 30 per stage/.test(e)), '31 steps must be rejected');
+});
+
+test('REGRESSION: a REUSED flow is still added to the solution', async () => {
+ // addSolutionComponent was only on the create path, so a flow created by an earlier run whose
+ // component add failed would be reused forever and never travel on export.
+ const { calls } = await buildFlow([{ workflowid: 'w-existing', statecode: 1, createdon: '2020-01-01T00:00:00Z' }]);
+ const added = calls.filter((c) => c[0] === 'addSolutionComponent');
+ assert.strictEqual(added.length, 1, `a reused flow must still be added to the solution; calls: ${JSON.stringify(calls.map((c) => c[0]))}`);
+ assert.strictEqual(added[0][1].componentId, 'w-existing');
+});
+
+test('REGRESSION: a failing solution add on the reuse path warns, it does not halt', async () => {
+ const { sdk } = require('./helpers/mock-sdk.js').makeSimpleMockSdk();
+ const { provision } = provisionWithFlows([{ workflowid: 'w-existing', statecode: 1, createdon: '2020-01-01T00:00:00Z' }]);
+ provision.addSolutionComponent = async () => { throw new Error('component add refused'); };
+ const warnings = [];
+ const res = await runSdkBuild(specWith([FLOW]), { sdk, provisionSdk: provision, apply: true, phases: ['business-process-flows'], warn: (m) => warnings.push(m) });
+ assert.strictEqual(res.ok, true, 'solution bookkeeping must not fail an otherwise-good build');
+ assert.ok(warnings.some((w) => /could not be added to solution/.test(w)), `got ${JSON.stringify(warnings)}`);
+});
+
+test('REGRESSION: a transport TIMEOUT on the flow delete is resolved by POLLING, not reported as failure', async () => {
+ // Deleting an activated BPF cascades a backing-TABLE drop, measured live at longer than the 60s
+ // client timeout on two of three runs. The server completes anyway, so reporting the timeout as a
+ // failure told the operator to clean up something already gone.
+ //
+ // The row is STILL PRESENT at the moment the client times out — a single re-read reproduces the
+ // false failure, which is exactly what the first version of this fix did. So the row here only
+ // disappears on the third probe.
+ const handler = KIND_HANDLERS.businessProcessFlows;
+ let queried = 0;
+ const sdk = {
+ queryRecords: async () => { queried++; return queried < 3 ? [{ workflowid: 'w1' }] : []; },
+ updateRecord: async () => {},
+ deleteRecord: async () => { throw new Error('Transport failure reaching https://example.crm.dynamics.com/api/data/v9.0/workflows(w1): Request failed: Request timed out'); },
+ };
+ const realDelay = global.setTimeout;
+ global.setTimeout = (fn) => realDelay(fn, 0); // keep the test fast; the polling shape is what matters
+ try {
+ await assert.doesNotReject(() => handler.del(sdk, { id: 'w1', statecode: 1 }));
+ } finally {
+ global.setTimeout = realDelay;
+ }
+ assert.ok(queried >= 3, `must keep polling until the row is gone; polled ${queried}x`);
+});
+
+test('REGRESSION: a probe that itself fails does not end the wait early', async () => {
+ const handler = KIND_HANDLERS.businessProcessFlows;
+ let queried = 0;
+ const sdk = {
+ queryRecords: async () => { queried++; if (queried < 3) throw new Error('probe blew up'); return []; },
+ updateRecord: async () => {},
+ deleteRecord: async () => { throw new Error('Request timed out'); },
+ };
+ const realDelay = global.setTimeout;
+ global.setTimeout = (fn) => realDelay(fn, 0);
+ try {
+ await assert.doesNotReject(() => handler.del(sdk, { id: 'w1', statecode: 1 }));
+ } finally {
+ global.setTimeout = realDelay;
+ }
+ assert.ok(queried >= 3, 'a failed probe is not evidence the row survived');
+});
+
+test('REGRESSION: a timeout is NOT swallowed when the row survives the whole wait', async () => {
+ const handler = KIND_HANDLERS.businessProcessFlows;
+ let queried = 0;
+ const sdk = {
+ queryRecords: async () => { queried++; return [{ workflowid: 'w1' }]; }, // never goes away: a real failure
+ updateRecord: async () => {},
+ deleteRecord: async () => { throw new Error('Request timed out'); },
+ };
+ const realDelay = global.setTimeout;
+ global.setTimeout = (fn) => realDelay(fn, 0);
+ try {
+ await assert.rejects(() => handler.del(sdk, { id: 'w1', statecode: 1 }), /timed out/);
+ } finally {
+ global.setTimeout = realDelay;
+ }
+ // The budget must be bounded by ATTEMPTS: a wall-clock deadline cannot be shortened by stubbing the
+ // sleep, so this exact case blocked the suite for four real minutes.
+ assert.ok(queried > 1 && queried <= 20, `polled a bounded number of times; got ${queried}`);
+});
+
+test('REGRESSION: a real HTTP error on delete is never re-read away', async () => {
+ const handler = KIND_HANDLERS.businessProcessFlows;
+ let queried = 0;
+ const sdk = {
+ queryRecords: async () => { queried++; return []; },
+ updateRecord: async () => {},
+ deleteRecord: async () => { throw new Error('HTTP 403 from .../workflows(w1): principal lacks prvDeleteWorkflow'); },
+ };
+ await assert.rejects(() => handler.del(sdk, { id: 'w1', statecode: 1 }), /403/);
+ assert.strictEqual(queried, 0, 'a status-carrying error means something specific and must not be second-guessed');
+});
+
+test('REGRESSION: a status-only edit is a full build but NOT permanent debt', () => {
+ // The build DOES converge status (the reuse branch flips statecode in both directions), so filing
+ // `-edit-not-convergent` debt claimed a divergence that a rebuild removes. Anything else about the
+ // flow genuinely is not reapplied, so it must still be recorded.
+ const { classifyChanges } = require('../lib/classify-changes.js');
+ const draft = specWith([{ ...FLOW, status: 'Draft' }]);
+ const active = specWith([{ ...FLOW, status: 'Active' }]);
+
+ const statusOnly = classifyChanges(active, draft);
+ assert.deepStrictEqual(statusOnly.debt, [], `a status-only edit is reconciled; got ${JSON.stringify(statusOnly.debt)}`);
+ assert.ok(statusOnly.changedPhases.includes('business-process-flows'), 'it still needs a full build');
+ assert.ok(statusOnly.fullReasons.some((r) => /status changed — reconciled/.test(r)), JSON.stringify(statusOnly.fullReasons));
+
+ // A stage edit is NOT converged and must still be debt.
+ const restaged = specWith([{ ...FLOW, stages: [{ name: 'Only', steps: [{ name: 'S', field: 'new_notes' }] }] }]);
+ const stageEdit = classifyChanges(restaged, draft);
+ assert.ok(stageEdit.debt.some((d) => /edit-not-convergent/.test(d.reason)), `a stage edit is real debt; got ${JSON.stringify(stageEdit.debt)}`);
+});
+
+test('REGRESSION: the same status-only rule applies to business rules', () => {
+ // Business rules converge status in their reuse branch too, so they shared the bug and the fix.
+ const { classifyChanges } = require('../lib/classify-changes.js');
+ const rule = (status) => ({
+ solution: { uniqueName: 'BPF', displayName: 'BPF', publisherPrefix: 'new' },
+ app: { name: 'BPF App', description: '' },
+ entities: [{ schemaName: 'new_ticket', displayName: 'Ticket', pluralName: 'Tickets', primaryAttribute: { schemaName: 'new_subject', displayName: 'Subject' } }],
+ appShell: { areas: [{ label: 'Main', groups: [{ label: 'Records', subAreas: [{ entity: 'new_ticket', title: 'Tickets' }] }] }] },
+ businessRules: [{ name: 'R', entity: 'new_ticket', status, conditions: [], actions: [] }],
+ });
+ const r = classifyChanges(rule('Active'), rule('Draft'));
+ assert.deepStrictEqual(r.debt, [], `got ${JSON.stringify(r.debt)}`);
+});
+
+test('REAL BUNDLE: the 30-stage / 30-step ceilings match the SDK rule, not a magic number of ours', () => {
+ // MEASURED: neither `createArtifact` nor `pushArtifact` enforces these — both happily accept 31
+ // stages and 31 steps. The SDK's `too-many-stages` / `too-many-steps` rules live in a validator the
+ // plugin never calls, so the spec-level ceiling is the ONLY enforcement on the path we use. That
+ // makes it worth pinning, and it cannot be pinned behaviourally: assert the bundle still states the
+ // same number, so a re-vendor that changes the limit fails here rather than letting the spec quietly
+ // reject flows the platform would now accept (or accept ones it would not).
+ const bundle = fs.readFileSync(BUNDLE, 'utf8');
+ const stageRule = bundle.match(/a BPF allows at most (\d+) stages/);
+ const stepRule = bundle.match(/a stage allows at most (\d+) steps/);
+ assert.ok(stageRule, "the bundle no longer states a stage ceiling — re-check what the SDK enforces");
+ assert.ok(stepRule, "the bundle no longer states a step ceiling — re-check what the SDK enforces");
+ assert.strictEqual(Number(stageRule[1]), 30, 'the SDK stage ceiling changed; update BPF_MAX_STAGES');
+ assert.strictEqual(Number(stepRule[1]), 30, 'the SDK step ceiling changed; update BPF_MAX_STEPS');
+
+ // And the spec agrees with that number at exactly the boundary, in both directions.
+ const stages = (n) => Array.from({ length: n }, (_, i) => ({ name: `S${i}`, steps: [{ name: 'x', field: 'new_notes' }] }));
+ const steps = (n) => [{ name: 'S', steps: Array.from({ length: n }, (_, i) => ({ name: `P${i}`, field: 'new_notes' })) }];
+ assert.deepStrictEqual(errorsFor([{ ...FLOW, stages: stages(30) }]), [], 'the spec accepts the ceiling');
+ assert.ok(errorsFor([{ ...FLOW, stages: stages(31) }]).some((e) => /at most 30/.test(e)), 'and rejects one over');
+ assert.deepStrictEqual(errorsFor([{ ...FLOW, stages: steps(30) }]), []);
+ assert.ok(errorsFor([{ ...FLOW, stages: steps(31) }]).some((e) => /at most 30 per stage/.test(e)));
+});
+
+// --- the derived unique name is a TABLE name, not just a flow name ------------------------------
+//
+// Activating a flow makes the platform create an org-owned BACKING TABLE whose logical name is the
+// flow's derived unique name (`new_` + the display name lower-cased with punctuation stripped —
+// note the `new_` is fixed, it is NOT the solution's publisher prefix). The spec already rejects two
+// flows that derive the same name, for exactly that reason.
+//
+// But the same collision exists against a TABLE, and that axis was unchecked: a flow named "Ticket"
+// on a spec that also creates `new_ticket` derives `new_ticket`, validates clean, and then fails in
+// the business-process-flows phase — after the solution, tables, columns, views, forms and the app
+// have all been created. The maker is left with a half-built app and a platform error naming a
+// table they did not think they were creating.
+test('a flow whose derived unique name collides with a DECLARED TABLE is rejected', () => {
+ const { bpfUniqueName } = require('../lib/app-spec.js');
+ // Guard the premise, so this test cannot quietly stop testing anything if the derivation changes.
+ assert.strictEqual(bpfUniqueName('Ticket'), 'new_ticket',
+ 'the premise of this test is that the derivation can produce a declared table name');
+
+ const res = validateAppSpec(specWith([{ ...FLOW, name: 'Ticket' }]), { profile: 'plan' });
+ assert.strictEqual(res.ok, false, 'this collision must not validate clean');
+ const err = (res.errors || []).find((e) => /new_ticket/.test(e) && /table/i.test(e));
+ assert.ok(err, `expected a table-collision error; got ${JSON.stringify(res.errors)}`);
+ // The message has to say what to do — the maker cannot rename the derivation, only the flow.
+ assert.match(err, /rename/i, `the error must tell the author how to resolve it; got: ${err}`);
+});
+
+test('the table collision is case- and punctuation-insensitive, like the derivation itself', () => {
+ for (const name of ['ticket', 'Ticket!', 'T I C K E T']) {
+ const res = validateAppSpec(specWith([{ ...FLOW, name }]), { profile: 'plan' });
+ assert.strictEqual(res.ok, false, `${JSON.stringify(name)} derives new_ticket and must be rejected`);
+ }
+});
+
+test('a flow name that does NOT collide still validates (the guard adds no false positive)', () => {
+ const res = validateAppSpec(specWith([{ ...FLOW, name: 'Ticket Handling' }]), { profile: 'plan' });
+ assert.strictEqual(res.ok, true, JSON.stringify(res.errors));
+});
+
+test('an EXISTING (not-created) table still collides — the backing table clashes either way', () => {
+ // `existing: true` means the build does not create the table, but it is still there in the org,
+ // and activation would still try to create a table with that logical name.
+ const spec = specWith([{ ...FLOW, name: 'Ticket' }]);
+ spec.entities[0].existing = true;
+ const res = validateAppSpec(spec, { profile: 'plan' });
+ assert.strictEqual(res.ok, false, 'a referenced table collides exactly like a created one');
+});
+
+// --- the derived unique name can collide with something the SPEC CANNOT SEE ---------------------
+//
+// The reuse query keys on (name, entity); the server keys on the derived unique name, which ignores
+// the entity and strips case and punctuation. A rename that preserves the derived name, or a flow of
+// the same derived name on another table, is therefore invisible to reuse and fails inside the
+// create — with a platform error about a BACKING TABLE the author never mentioned.
+function provisionWithUniqueClash({ clashRows, failUniqueQuery = false }) {
+ const calls = [];
+ return {
+ calls,
+ provision: {
+ queryRecords: async (entity, opts) => {
+ if (entity !== 'workflow') return entity === 'solution' ? [] : [{ publisherid: 'pub-1' }];
+ calls.push(['queryRecords', opts.filter]);
+ // The uniquename probe is the ONLY workflow query that filters on uniquename; the reuse
+ // query filters on name+primaryentity and must keep returning nothing so the create path runs.
+ if (/uniquename eq /.test(opts.filter || '')) {
+ if (failUniqueQuery) throw new Error('uniquename is not filterable here');
+ return clashRows;
+ }
+ return [];
+ },
+ updateRecord: async () => undefined,
+ deleteRecord: async () => undefined,
+ createArtifact: (kind, def) => { calls.push(['createArtifact', kind, def]); return { id: 'bpf-new' }; },
+ updateElement: async () => undefined,
+ pushArtifact: async (kind, id) => { calls.push(['pushArtifact', kind, id]); return { id: 'bpf-new', saved: true, publish: { kind: 'notRequested' } }; },
+ addSolutionComponent: async () => undefined,
+ },
+ };
+}
+
+test('a flow whose derived unique name is already taken HALTS instead of failing inside the create', async () => {
+ const { sdk } = require('./helpers/mock-sdk.js').makeSimpleMockSdk();
+ const { provision, calls } = provisionWithUniqueClash({
+ clashRows: [{ workflowid: 'other-1', name: 'ticket-handling', primaryentity: 'new_other' }],
+ });
+ const err = await runSdkBuild(specWith([FLOW]), {
+ sdk, provisionSdk: provision, apply: true, phases: ['business-process-flows'], warn: () => {},
+ }).then(() => null, (e) => e);
+
+ assert.ok(err, 'the collision must stop the build rather than be attempted');
+ assert.match(err.message, /ticket-handling/, `the halt must name the conflicting flow; got: ${err.message}`);
+ assert.match(err.message, /new_tickethandling/, 'and the derived name that actually collides');
+ assert.match(err.message, /new_other/, 'and the table it is on, so the author can find it');
+ assert.match(err.message, /[Rr]ename/, 'and what to do about it');
+ assert.strictEqual(calls.some((c) => c[0] === 'createArtifact'), false,
+ 'nothing may be written once the collision is known');
+});
+
+test('the uniquename probe is BEST-EFFORT: a query it cannot run does not block the build', async () => {
+ // A diagnostic must never be the thing that breaks a build. If the probe cannot run, the create
+ // proceeds and the platform gets to speak for itself.
+ const { sdk } = require('./helpers/mock-sdk.js').makeSimpleMockSdk();
+ const { provision, calls } = provisionWithUniqueClash({ clashRows: [], failUniqueQuery: true });
+ await runSdkBuild(specWith([FLOW]), {
+ sdk, provisionSdk: provision, apply: true, phases: ['business-process-flows'], warn: () => {},
+ });
+ assert.ok(calls.some((c) => c[0] === 'createArtifact'), 'the flow is still created');
+ assert.ok(calls.some((c) => c[0] === 'pushArtifact'), 'and still pushed');
+});
+
+test('no clash means no interference — the create path is unchanged', async () => {
+ const { sdk } = require('./helpers/mock-sdk.js').makeSimpleMockSdk();
+ const { provision, calls } = provisionWithUniqueClash({ clashRows: [] });
+ await runSdkBuild(specWith([FLOW]), {
+ sdk, provisionSdk: provision, apply: true, phases: ['business-process-flows'], warn: () => {},
+ });
+ assert.ok(calls.some((c) => c[0] === 'createArtifact'), 'the flow is created');
+ // The probe must query the DERIVED name, not the display name — that is the whole point.
+ const probe = calls.find((c) => c[0] === 'queryRecords' && /uniquename eq /.test(c[1] || ''));
+ assert.ok(probe, `expected a uniquename probe; got ${JSON.stringify(calls.filter((c) => c[0] === 'queryRecords'))}`);
+ assert.match(probe[1], /uniquename eq 'new_tickethandling'/);
+});
+
+// --- the derived name can also be owned by a TABLE, not only by another flow --------------------
+test('the build-time probe also refuses when a TABLE already owns the derived name', async () => {
+ // Activation creates a real table called `new_<derived>`. An unrelated table already holding that
+ // logical name blocks the flow just as surely as a rival flow does — and that table need not have
+ // come from any flow at all, so querying only `workflows` missed the commonest environment-side
+ // collision. Reported by peer review; the workflows-only probe let this reach the push and fail
+ // as an opaque "Entity ... already exists".
+ const { sdk } = require('./helpers/mock-sdk.js').makeSimpleMockSdk();
+ const { provision, calls } = provisionWithUniqueClash({ clashRows: [] });
+ provision.findTables = async () => ([{ logicalName: 'new_unrelated' }, { logicalName: 'new_tickethandling' }]);
+
+ const err = await runSdkBuild(specWith([FLOW]), {
+ sdk, provisionSdk: provision, apply: true, phases: ['business-process-flows'], warn: () => {},
+ }).then(() => null, (e) => e);
+
+ assert.ok(err, 'a table owning the derived name must stop the build');
+ assert.match(err.message, /new_tickethandling/, `the halt must name the derived value; got: ${err.message}`);
+ assert.match(err.message, /table/i, 'and say it is a TABLE that owns it, not a flow');
+ assert.strictEqual(calls.some((c) => c[0] === 'createArtifact'), false, 'nothing may be written');
+});
+
+test('the table probe is best-effort and absent-safe (an older transport has no findTables)', async () => {
+ const { sdk } = require('./helpers/mock-sdk.js').makeSimpleMockSdk();
+ for (const [label, mutate] of [
+ ['absent', (p) => { delete p.findTables; }],
+ ['throws', (p) => { p.findTables = async () => { throw new Error('metadata read refused'); }; }],
+ ['no match', (p) => { p.findTables = async () => ([{ logicalName: 'new_something_else' }]); }],
+ ]) {
+ const { provision, calls } = provisionWithUniqueClash({ clashRows: [] });
+ mutate(provision);
+ await runSdkBuild(specWith([FLOW]), {
+ sdk, provisionSdk: provision, apply: true, phases: ['business-process-flows'], warn: () => {},
+ });
+ assert.ok(calls.some((c) => c[0] === 'createArtifact'), `findTables ${label}: the flow is still created`);
+ }
+});
+
+test('a flow clash is reported as a FLOW and a table clash as a TABLE — the remedy differs', async () => {
+ const { sdk } = require('./helpers/mock-sdk.js').makeSimpleMockSdk();
+ const { provision } = provisionWithUniqueClash({
+ clashRows: [{ workflowid: 'other-1', name: 'ticket-handling', primaryentity: 'new_other' }],
+ });
+ // Both owners present: the flow is the more actionable one to name, and it is found first.
+ provision.findTables = async () => ([{ logicalName: 'new_tickethandling' }]);
+ const err = await runSdkBuild(specWith([FLOW]), {
+ sdk, provisionSdk: provision, apply: true, phases: ['business-process-flows'], warn: () => {},
+ }).then(() => null, (e) => e);
+ assert.ok(err);
+ assert.match(err.message, /the flow "ticket-handling"/, `got: ${err.message}`);
+});
diff --git a/plugins/model-apps/scripts/tests/business-rules.test.js b/plugins/model-apps/scripts/tests/business-rules.test.js
index 918734db5..1c71a2bb6 100644
--- a/plugins/model-apps/scripts/tests/business-rules.test.js
+++ b/plugins/model-apps/scripts/tests/business-rules.test.js
@@ -430,6 +430,118 @@ function provisionWithRules(rows) {
};
}
+// --- the designer's own completeness validator, run BEFORE the push -----------------------------
+//
+// The trap it closes is pinned in sdk-uptake-contract.test.js: a condition tree in the wrong shape is
+// MERGED onto the node, ignored by the serializer, and written as a rule with no clauses and no
+// actions — 204, activated, and it never fires. Nothing on the push path detects that, and nothing
+// afterwards can either. This SDK exposes the validator the designer gates Save on; the build runs it.
+
+test('a rule the designer calls incomplete HALTS before anything is written', async () => {
+ const { sdk } = require('./helpers/mock-sdk.js').makeSimpleMockSdk();
+ const { provision } = provisionWithRules([]);
+ const pushes = [];
+ // `provisionWithRules` does not record pushes, and an assertion against a call list that can never
+ // contain the value is vacuous — so record it here rather than assert on nothing.
+ provision.pushArtifact = async (...a) => { pushes.push(a); return { id: 'br-new', saved: true, publish: { kind: 'notRequested' } }; };
+ provision.validateBusinessRule = () => ([
+ { pointer: '/rootCondition (root)', rule: 'business-rule-NO_ACTION', message: 'A business rule must include at least one action step.' },
+ ]);
+
+ const err = await runBuild(ruleOnlySpec(), {
+ sdk, provisionSdk: provision, apply: true, phases: ['business-rules'], warn: () => {},
+ }).then(() => null, (e) => e);
+
+ assert.ok(err, 'an incomplete rule must not be pushed');
+ assert.match(err.message, /never fires/, `the halt must say what the rule would do; got: ${err && err.message}`);
+ assert.match(err.message, /NO_ACTION/, "the designer's own finding is the actionable part");
+ assert.deepStrictEqual(pushes, [], 'the refusal must come BEFORE the write, not after it');
+});
+
+test('the validator is best-effort: an older bundle without it, or one that throws, still builds', async () => {
+ // A DIAGNOSTIC must never be the thing that breaks a build. The bundle is re-vendored routinely and
+ // the plugin supports the generation before this method existed, so absence is a normal state —
+ // and a validator that itself faults tells us nothing about the rule.
+ const { sdk } = require('./helpers/mock-sdk.js').makeSimpleMockSdk();
+ for (const [label, mutate] of [
+ ['absent', (p) => { delete p.validateBusinessRule; }],
+ ['throws', (p) => { p.validateBusinessRule = () => { throw new Error('validator exploded'); }; }],
+ ['returns a non-array', (p) => { p.validateBusinessRule = () => undefined; }],
+ ]) {
+ const { provision } = provisionWithRules([]);
+ mutate(provision);
+ const res = await runBuild(ruleOnlySpec(), {
+ sdk, provisionSdk: provision, apply: true, phases: ['business-rules'], warn: () => {},
+ });
+ assert.strictEqual(res.ok, true, `validator ${label} must not fail the build`);
+ const only = ruleOnlySpec().businessRules[0];
+ assert.strictEqual(res.created.businessRules[`${only.entity.toLowerCase()}|${only.name}`], 'br-new',
+ `validator ${label}: the rule must still be authored`);
+ assert.deepStrictEqual(res.skipped.businessRules, [], `validator ${label}: and not recorded as skipped`);
+ }
+});
+
+test('REAL BUNDLE: the validator accepts EVERY shape this spec surface can author', () => {
+ // The one way wiring the validator could regress a working build is if it rejected something the
+ // App Spec already allows. So the assertion is over the spec surface's OWN declared sets rather
+ // than a hand-picked sample — a future operator or action type added to app-spec.js is covered the
+ // day it is added, without anyone remembering to extend this test.
+ const { BUSINESS_RULE_OPERATORS, BUSINESS_RULE_VALUELESS_OPERATORS, BUSINESS_RULE_ACTION_TYPES, BUSINESS_RULE_SCOPES, BUSINESS_RULE_DATA_TYPES } = require('../lib/app-spec.js');
+ const { createMakerSdk } = require(BUNDLE);
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'brval-'));
+ dirs.push(dir);
+ const noop = async () => ({ status: 200, headers: {}, body: { value: [] } });
+ const sdk = createMakerSdk({
+ workspacePath: dir, instanceUrl: 'https://contoso.crm.dynamics.com',
+ httpClient: { get: noop, post: noop, patch: noop, put: noop, delete: noop },
+ });
+ sdk.initWorkspace();
+
+ // The payload each action type carries — mirrors BUSINESS_RULE_ACTIONS in app-spec.js.
+ const ACTION_PAYLOAD = { SetVisibility: { visible: false }, LockUnlock: { lock: true }, SetBusinessRequired: { required: true }, SetFieldValue: { value: 'x', dataType: 'String' } };
+ const shapes = [];
+ for (const op of BUSINESS_RULE_OPERATORS) {
+ const valueless = BUSINESS_RULE_VALUELESS_OPERATORS.has(op);
+ shapes.push([`operator ${op}`, { entity: 'new_ticket', name: `Op ${op}`, conditions: [Object.assign({ field: 'new_owner', operator: op }, valueless ? {} : { value: 'x', dataType: 'String' })], actions: [{ type: 'SetVisibility', field: 'new_notes', visible: false }] }]);
+ }
+ for (const type of BUSINESS_RULE_ACTION_TYPES) {
+ assert.ok(ACTION_PAYLOAD[type], `this test must be taught the payload for a new action type '${type}'`);
+ shapes.push([`action ${type}`, { entity: 'new_ticket', name: `Act ${type}`, conditions: [{ field: 'new_owner', operator: 'Equals', value: 'x', dataType: 'String' }], actions: [Object.assign({ type, field: 'new_notes' }, ACTION_PAYLOAD[type])] }]);
+ }
+ for (const scope of BUSINESS_RULE_SCOPES) {
+ shapes.push([`scope ${scope}`, { entity: 'new_ticket', name: `Sc ${scope}`, scope, conditions: [{ field: 'new_owner', operator: 'Equals', value: 'x', dataType: 'String' }], actions: [{ type: 'SetVisibility', field: 'new_notes', visible: false }] }]);
+ }
+ // `status` and `dataType` are separately-accepted axes, and the build's comment claims BOTH are
+ // covered — so iterate them here rather than leave the claim resting on a hand-picked sample. A
+ // future validator that started rejecting `Draft`, or one literal type, would otherwise stay green.
+ for (const status of ['Active', 'Draft']) {
+ shapes.push([`status ${status}`, { entity: 'new_ticket', name: `St ${status}`, status, conditions: [{ field: 'new_owner', operator: 'Equals', value: 'x', dataType: 'String' }], actions: [{ type: 'SetVisibility', field: 'new_notes', visible: false }] }]);
+ }
+ for (const dataType of BUSINESS_RULE_DATA_TYPES) {
+ shapes.push([`dataType ${dataType} (condition)`, { entity: 'new_ticket', name: `Dt ${dataType}`, conditions: [{ field: 'new_owner', operator: 'Equals', value: '1', dataType }], actions: [{ type: 'SetVisibility', field: 'new_notes', visible: false }] }]);
+ shapes.push([`dataType ${dataType} (SetFieldValue)`, { entity: 'new_ticket', name: `Dv ${dataType}`, conditions: [{ field: 'new_owner', operator: 'Equals', value: 'x', dataType: 'String' }], actions: [{ type: 'SetFieldValue', field: 'new_notes', value: '1', dataType }] }]);
+ }
+ shapes.push(['multi-condition + multi-action', { entity: 'new_ticket', name: 'Multi', conditions: [{ field: 'new_owner', operator: 'Equals', value: 'x', dataType: 'String' }, { field: 'new_notes', operator: 'ContainsData' }], actions: [{ type: 'SetVisibility', field: 'new_notes', visible: false }, { type: 'LockUnlock', field: 'new_owner', lock: true }] }]);
+
+ const rejected = [];
+ for (const [label, rule] of shapes) {
+ const def = businessRuleDef(rule);
+ const art = sdk.createArtifact('businessRule', def);
+ const issues = sdk.validateBusinessRule(Object.assign({}, art, { rootCondition: def.rootCondition }));
+ if (issues && issues.length) rejected.push(`${label}: ${JSON.stringify(issues)}`);
+ }
+ assert.deepStrictEqual(rejected, [],
+ `the build HALTS on findings, so a rejected authorable shape is a build the spec gate said was fine:\n${rejected.join('\n')}`);
+ assert.ok(shapes.length >= 20, `the matrix must be broad enough to mean something; got ${shapes.length}`);
+
+ // Negative control: without this the assertion above is satisfied by a validator that finds
+ // nothing at all, and the gate would be inert while looking healthy.
+ const empty = sdk.createArtifact('businessRule', { name: 'Empty', entityLogicalName: 'new_ticket', scope: 'Entity', status: 'Draft' });
+ const control = sdk.validateBusinessRule(empty);
+ assert.ok(control && control.length > 0, 'the validator must actually report on a rule with no clauses and no actions');
+ assert.match(JSON.stringify(control), /NO_ACTION/, 'and name the missing action step');
+});
+
test('a rebuild REMOVES duplicates an earlier build left behind', async () => {
const { sdk } = require('./helpers/mock-sdk.js').makeSimpleMockSdk();
const { provision, calls } = provisionWithRules([
@@ -683,6 +795,106 @@ test('any OTHER business-rule failure still HALTS — the skip is not a blanket
}
});
+// --- the SDK moved this signal from a THROW to a RETURN (SDK uptake) -----------------------------
+//
+// The bundle used to throw `BUSINESS_RULE_API_UNAVAILABLE` out of `pushArtifact`. It now treats the
+// preview rollout as a reported no-op and RESOLVES with `{ saved: false, error }` instead — measured
+// against the vendored bundle, a 404 on the bound member resolves while 400/401/403/429/500 still
+// throw.
+//
+// That is invisible to a mock that keeps throwing, which is exactly why the whole plugin suite
+// stayed green through the uptake while the real bundle would have HALTED every build on an
+// environment without the member — i.e. most of them. `requireSuccessfulPush` turns any by-value
+// failure into a BuildHalt, so the error the skip predicate sees is the halt, not the SdkError.
+//
+// These two tests pin the RESULT-shaped contract so it cannot regress back.
+function byValuePushFailure(code, message) {
+ const { provision, calls } = provisionThatCannotAuthorRules();
+ provision.pushArtifact = async () => {
+ calls.push(['pushArtifact']);
+ // The exact shape the bundle returns: a PushResult carrying the SdkError, not a throw.
+ return { type: 'businessRule', id: 'br-new', saved: false, shipped: false, publish: { kind: 'notRequested' }, error: Object.assign(new Error(message), { code }) };
+ };
+ return { provision, calls };
+}
+
+test('an unavailable bound member reported BY VALUE still skips, and does not halt the build', async () => {
+ const { sdk } = require('./helpers/mock-sdk.js').makeSimpleMockSdk();
+ const { provision, calls } = byValuePushFailure('BUSINESS_RULE_API_UNAVAILABLE',
+ "Business-rule authoring (preview) is not enabled on this environment yet: it does not expose 'Microsoft.Dynamics.CRM.CreateProcessWithWfomJson'.");
+ const warnings = [];
+ const events = [];
+ const res = await runBuild(ruleOnlySpec(), {
+ sdk, provisionSdk: provision, apply: true,
+ phases: ['business-rules'], warn: (m) => warnings.push(m), emit: (e) => events.push(e),
+ });
+
+ assert.strictEqual(res.ok, true, 'the build must complete, exactly as it does for the thrown form');
+ const only = ruleOnlySpec().businessRules[0];
+ assert.deepStrictEqual(res.skipped.businessRules, [`${only.entity.toLowerCase()}|${only.name}`]);
+ assert.strictEqual(Object.keys(res.created.businessRules).length, 0);
+ assert.strictEqual(calls.some((c) => c[0] === 'addSolutionComponent'), false,
+ 'a rule that was never created must not be added to the solution');
+
+ assert.strictEqual(warnings.length, 1, `expected exactly one warning, got ${JSON.stringify(warnings)}`);
+ assert.match(warnings[0], /business rules were NOT created/);
+ const skip = events.find((e) => e.phase === 'business-rules' && e.status === 'skip');
+ assert.ok(skip, `expected a skip event; got ${JSON.stringify(events.map((e) => [e.phase, e.status, e.label]))}`);
+ assert.match(skip.label, /unsupported in this environment/);
+});
+
+test('BUSINESS_RULE_LEFT_DEACTIVATED is NOT swallowed by the preview skip — it halts and says why', async () => {
+ // The SDK raises this DISTINCT code when a write failed AND it could not put the rule back into
+ // the Activated state it found it in, so a live rule is sitting Draft on the server. Collapsing it
+ // into the preview no-op would tell the operator "not enabled here" while their rule is disabled —
+ // the SDK's own comment says it must not collapse, so the plugin must not collapse it either.
+ const { sdk } = require('./helpers/mock-sdk.js').makeSimpleMockSdk();
+ const { provision } = byValuePushFailure('BUSINESS_RULE_LEFT_DEACTIVATED',
+ "The business-rule write failed AND the rule could not be re-activated, so 'br-9' is left DEACTIVATED (Draft) on the server.");
+ const err = await runBuild(ruleOnlySpec(), {
+ sdk, provisionSdk: provision, apply: true, phases: ['business-rules'], warn: () => {},
+ }).then(() => null, (e) => e);
+
+ assert.ok(err, 'a rule left deactivated must not be reported as a benign skip');
+ assert.match(err.message, /DEACTIVATED/,
+ `the halt must carry the SDK's own diagnosis; got: ${err && err.message}`);
+ assert.doesNotMatch(err.message, /changed in Maker since it was fetched/,
+ 'reporting this as a concurrent Maker edit sends the operator to re-download over an unrelated cause');
+});
+
+test('a LEFT_DEACTIVATED that WRAPS the preview failure still halts — broad matching must not swallow it', async () => {
+ // This is the shape the exclusion actually defends, and it exists BECAUSE the predicate matches on
+ // the whole cause chain rather than the top-level code.
+ //
+ // The two conditions are causally linked in the SDK: the rule is deactivated, the write fails, and
+ // the re-activation fails — so the write failure is the natural `cause` of the LEFT_DEACTIVATED
+ // error, and the SDK already embeds its text in the message. If that write failure is the preview
+ // gate, a chain walk sees BOTH codes. Taking the first match it recognises would report "this
+ // environment cannot host business rules" for a rule that is sitting DISABLED on a server that
+ // plainly can — the operator is told to stop worrying about the exact thing they must go fix.
+ const { sdk } = require('./helpers/mock-sdk.js').makeSimpleMockSdk();
+ const preview = Object.assign(new Error("does not expose 'Microsoft.Dynamics.CRM.CreateProcessWithWfomJson'"), { code: 'BUSINESS_RULE_API_UNAVAILABLE' });
+ const { provision } = byValuePushFailure('BUSINESS_RULE_LEFT_DEACTIVATED',
+ "The business-rule write failed AND the rule could not be re-activated, so 'br-9' is left DEACTIVATED (Draft) on the server.");
+ const inner = provision.pushArtifact;
+ provision.pushArtifact = async (...args) => {
+ const res = await inner(...args);
+ res.error.cause = preview; // the linkage the SDK's own message already describes
+ return res;
+ };
+
+ const events = [];
+ const err = await runBuild(ruleOnlySpec(), {
+ sdk, provisionSdk: provision, apply: true, phases: ['business-rules'], warn: () => {}, emit: (e) => events.push(e),
+ }).then(() => null, (e) => e);
+
+ assert.ok(err, 'the deactivated rule outranks the preview code anywhere else in the chain');
+ assert.match(err.message, /DEACTIVATED/);
+ const skip = events.find((e) => e.phase === 'business-rules' && e.status === 'skip');
+ assert.strictEqual(skip, undefined,
+ `this must not be recorded as a skip; got ${JSON.stringify(skip && skip.label)}`);
+});
+
// --- the operator table, and why it must mirror the SDK exactly ---------------------------------
test('REAL BUNDLE: every spec operator EXISTS in the SDK table, and none silently becomes Equals', () => {
@@ -894,3 +1106,40 @@ test('a phase list that INCLUDES business-rules still demands the rule', async (
assert.strictEqual(ruleCheck(r).present, false);
assert.ok(r.missing.some((m) => m.kind === 'business-rule'));
});
+
+// --- a REUSED business rule must still join the solution ----------------------------------------
+//
+// `addSolutionComponent` used to be reached only by the create branch, so a rule that already
+// existed was recorded and skipped. Two ordinary situations then left it permanently outside the
+// solution, with nothing in the output saying so: a run where the rule was written but the
+// component add failed (the retry reuses and reports success), and a rule created by an earlier
+// build of a DIFFERENT solution. Neither is visible afterwards — the rule works, it just never
+// travels on export/import.
+test('a reused business rule is re-added to the solution on every run', async () => {
+ const { sdk } = require('./helpers/mock-sdk.js').makeSimpleMockSdk();
+ const { provision, calls } = provisionWithRules([{ workflowid: 'existing-1', statecode: 1, createdon: '2026-01-01T00:00:00Z' }]);
+ const adds = [];
+ provision.addSolutionComponent = async (a) => { adds.push(a); };
+ const res = await runBuild(ruleOnlySpec(), {
+ sdk, provisionSdk: provision, apply: true, phases: ['business-rules'], warn: () => {},
+ });
+ assert.strictEqual(res.ok, true);
+ assert.strictEqual(adds.length, 1, `the reused rule must be re-added; got ${JSON.stringify(adds)}`);
+ assert.strictEqual(adds[0].componentId, 'existing-1', 'and it must be the EXISTING id, not a new one');
+ assert.strictEqual(calls.some((c) => c[0] === 'deleteRecord'), false, 'reuse must not delete anything');
+});
+
+test('a failed solution add on the reuse path WARNS — it never fails an otherwise-good build', async () => {
+ // The rule itself is correct and running; blocking the build over solution bookkeeping is worse
+ // than reporting it. Mirrors the business-process-flows policy exactly.
+ const { sdk } = require('./helpers/mock-sdk.js').makeSimpleMockSdk();
+ const { provision } = provisionWithRules([{ workflowid: 'existing-1', statecode: 1, createdon: '2026-01-01T00:00:00Z' }]);
+ provision.addSolutionComponent = async () => { throw new Error('component add refused'); };
+ const warnings = [];
+ const res = await runBuild(ruleOnlySpec(), {
+ sdk, provisionSdk: provision, apply: true, phases: ['business-rules'], warn: (m) => warnings.push(m),
+ });
+ assert.strictEqual(res.ok, true, 'the build must still complete');
+ assert.ok(warnings.some((w) => /could not be added to solution/.test(w)),
+ `the operator must be told; got ${JSON.stringify(warnings)}`);
+});
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 a41aba7e4..f7c83c127 100644
--- a/plugins/model-apps/scripts/tests/download-model-app.test.js
+++ b/plugins/model-apps/scripts/tests/download-model-app.test.js
@@ -866,7 +866,7 @@ test('recoverAppSolution enumerates ALL memberships and returns the real unmanag
};
const sol = await recoverAppSolution(sdk, APP);
assert.deepStrictEqual(sol, { uniqueName: 'NucleoLive2' }, 'returns ONLY the real solution uniquename');
- assert.strictEqual(publisherQueried, false, 'no publisher lookup — the prefix is NOT sourced from an arbitrary solution membership (Sol review)');
+ assert.strictEqual(publisherQueried, false, 'no publisher lookup — the prefix is NOT sourced from an arbitrary solution membership');
});
test('recoverAppSolution ignores managed solutions and returns null when only system/managed remain', async () => {
@@ -1373,3 +1373,128 @@ test('runDownload stays SILENT when no form is role-restricted', async () => {
}
assert.doesNotMatch(written.join(''), /restricted to specific security roles/);
});
+
+
+// Minimal hydrateSpec input: only the app block varies across the #514 tests, so everything else is
+// a fixed stub. Keeps each assertion about the one field it is testing.
+const makeRead = (over = {}) => ({
+ // hydrateSpec walks app.siteMap.areas, so the stub has to carry a (minimal) sitemap.
+ app: async () => ({ siteMap: { areas: [] }, ...(over.app || { name: 'A', description: '', uniquename: 'p_a' }) }),
+ pages: async () => [],
+ entities: async () => [],
+ webResources: async () => [],
+ solution: async () => ({ uniqueName: 'S', publisherPrefix: 'new' }),
+});
+// --- #514: the app-shell settings the build writes but the download used to drop ------------------
+// A live app had NewLookAlwaysOn=true and HeaderAndNavigationRefresh=2 (the only app in its org with
+// either) and the downloaded spec carried neither. Rebuilding it into a FRESH environment would have
+// produced a classic-shell app with nothing reporting the loss.
+//
+// Plugin gap, not an SDK one: the SDK already exposes getAppSettings/retrieveSetting; the download
+// called neither.
+test('#514: hydrateSpec round-trips newLook and headerNavigationRefresh when the app overrides them', async () => {
+ const { hydrateSpec } = require('../lib/hydrate-spec.js');
+ const spec = await hydrateSpec(makeRead({
+ app: { name: 'A', description: '', uniquename: 'p_a', newLook: true, headerNavigationRefresh: true },
+ }));
+ assert.strictEqual(spec.app.newLook, true);
+ assert.strictEqual(spec.app.headerNavigationRefresh, true);
+});
+
+test('#514: an app with NO override omits them, so the rebuild keeps inheriting', async () => {
+ // Omitting is the faithful representation: the build leaves an omitted field alone, so emitting a
+ // value for an inherited setting would invent an override the app never had.
+ const { hydrateSpec } = require('../lib/hydrate-spec.js');
+ const spec = await hydrateSpec(makeRead({ app: { name: 'A', description: '', uniquename: 'p_a' } }));
+ assert.ok(!('newLook' in spec.app), 'no newLook key when the app has no override');
+ assert.ok(!('headerNavigationRefresh' in spec.app), 'no headerNavigationRefresh key either');
+});
+
+test('#514: an explicit OFF round-trips as false, not as absent', async () => {
+ // false and absent mean different things: false is an explicit override, absent is inheritance.
+ const { hydrateSpec } = require('../lib/hydrate-spec.js');
+ const spec = await hydrateSpec(makeRead({
+ app: { name: 'A', description: '', uniquename: 'p_a', newLook: false, headerNavigationRefresh: false },
+ }));
+ assert.strictEqual(spec.app.newLook, false);
+ assert.strictEqual(spec.app.headerNavigationRefresh, false);
+});
+
+test('#514: readAppShellSettings decodes the header tri-state, where 1 means DISABLED', async () => {
+ // THE trap. HeaderAndNavigationRefresh is a Number tri-state: 2 = on, 1 = OFF, 0 = platform
+ // default. A truthy read reports 1 as enabled, which is the same class of mistake that made
+ // `ai.appFeatures: false` silently disable a live app's features.
+ const { readAppShellSettings } = require('../download-model-app.js');
+ const sdk = (headerValue, newLookValue) => ({
+ queryRecords: async (entity) => {
+ if (entity === 'settingdefinition') {
+ return [
+ { settingdefinitionid: 'd1', uniquename: 'NewLookAlwaysOn' },
+ { settingdefinitionid: 'd2', uniquename: 'HeaderAndNavigationRefresh' },
+ ];
+ }
+ return [
+ { _settingdefinitionid_value: 'd1', value: newLookValue },
+ { _settingdefinitionid_value: 'd2', value: headerValue },
+ ];
+ },
+ });
+
+ assert.deepStrictEqual(await readAppShellSettings(sdk('2', 'true'), 'app-1'), { newLook: true, headerNavigationRefresh: true }, '2 = on');
+ assert.deepStrictEqual(await readAppShellSettings(sdk('1', 'false'), 'app-1'), { newLook: false, headerNavigationRefresh: false }, '1 = DISABLED, not enabled');
+ // 0 is "platform default", which is not an override at all — it must not be emitted either way.
+ assert.deepStrictEqual(await readAppShellSettings(sdk('0', 'false'), 'app-1'), { newLook: false }, '0 = platform default, so no header key');
+});
+
+test('#514: the appsetting read is bound by setting DEFINITION, so $top cannot decide the answer', async () => {
+ // `$top` is a hard cap in Dataverse and no `@odata.nextLink` is returned, so a row-limited read can
+ // come back partial. Here a partial page is not a visible truncation but a WRONG ANSWER: an absent
+ // row means "inherits the environment", so a shell override pushed off the page round-trips as
+ // inheritance and the rebuilt app silently reverts to the classic shell — the exact loss #514 fixed.
+ // Bounding the query by the two definitions makes the result at most one row each, whatever the cap.
+ const { readAppShellSettings } = require('../download-model-app.js');
+ let appsettingOpts = null;
+ const sdk = {
+ queryRecords: async (entity, opts) => {
+ if (entity === 'settingdefinition') {
+ return [
+ { settingdefinitionid: 'D1', uniquename: 'NewLookAlwaysOn' },
+ { settingdefinitionid: 'D2', uniquename: 'HeaderAndNavigationRefresh' },
+ ];
+ }
+ appsettingOpts = opts;
+ return [{ _settingdefinitionid_value: 'd1', value: 'true' }];
+ },
+ };
+ assert.deepStrictEqual(await readAppShellSettings(sdk, 'app-1'), { newLook: true });
+ assert.match(appsettingOpts.filter, /_parentappmoduleid_value eq app-1/);
+ assert.match(appsettingOpts.filter, /_settingdefinitionid_value eq d1/, 'the read must name the NewLookAlwaysOn definition');
+ assert.match(appsettingOpts.filter, /_settingdefinitionid_value eq d2/, 'and the HeaderAndNavigationRefresh one');
+});
+
+test('#514: a brace-wrapped id on either side of the join still resolves the setting', async () => {
+ // The join is FAIL-QUIET — an unrecognized id just `continue`s and the setting disappears from the
+ // spec with no error — so both sides are normalized. Measured live, Dataverse returns these ids
+ // bare, so this guards the caller-supplied `appId` and any future formatting drift, not an observed
+ // mismatch.
+ const { readAppShellSettings } = require('../download-model-app.js');
+ let appsettingOpts = null;
+ const sdk = {
+ queryRecords: async (entity, opts) => {
+ if (entity === 'settingdefinition') return [{ settingdefinitionid: '{D1}', uniquename: 'NewLookAlwaysOn' }];
+ appsettingOpts = opts;
+ return [{ _settingdefinitionid_value: '{d1}', value: 'true' }];
+ },
+ };
+ assert.deepStrictEqual(await readAppShellSettings(sdk, '{app-1}'), { newLook: true });
+ assert.ok(!/[{}]/.test(appsettingOpts.filter), `no braces reach the OData filter: ${appsettingOpts.filter}`);
+});
+
+test('#514: a tenant without the setting definitions still downloads cleanly', async () => {
+ // Best-effort: losing an optional shell setting must never fail a download.
+ const { readAppShellSettings } = require('../download-model-app.js');
+ const noDefs = { queryRecords: async () => [] };
+ assert.deepStrictEqual(await readAppShellSettings(noDefs, 'app-1'), {});
+ const throws = { queryRecords: async () => { throw new Error('no access to appsettings'); } };
+ assert.deepStrictEqual(await readAppShellSettings(throws, 'app-1'), {});
+});
diff --git a/plugins/model-apps/scripts/tests/entity-provision.test.js b/plugins/model-apps/scripts/tests/entity-provision.test.js
index fb22aac20..f76d6a0a5 100644
--- a/plugins/model-apps/scripts/tests/entity-provision.test.js
+++ b/plugins/model-apps/scripts/tests/entity-provision.test.js
@@ -4,7 +4,7 @@
const { test } = require('node:test');
const assert = require('node:assert');
const path = require('node:path');
-const { makeRunner, requireSuccessfulPush, reportPartialPush, provisionDataModel, provisionSampleData, provisionSolution, buildSeedGroup } = require(path.join(__dirname, '..', 'lib', 'entity-provision.js'));
+const { makeRunner, requireSuccessfulPush, reportPartialPush, errorCodeChain, BuildHalt, provisionDataModel, provisionSampleData, provisionSolution, buildSeedGroup } = require(path.join(__dirname, '..', 'lib', 'entity-provision.js'));
function mockSdk(existing = {}) {
const calls = [];
@@ -784,6 +784,51 @@ test('requireSuccessfulPush distinguishes an already-exists collision from a ver
);
});
+// The set of by-value push failures is OPEN and it grows: the SDK keeps moving failures from a throw
+// to a return. Every newly-returned one used to land on the "changed in Maker" wording, which named
+// a cause that could not possibly apply and sent the operator to re-download an untouched app.
+test('requireSuccessfulPush reports an UNRECOGNISED SDK code verbatim, and propagates the code', () => {
+ const err = new Error("Business-rule authoring (preview) is not enabled on this environment yet: it does not expose 'Microsoft.Dynamics.CRM.CreateProcessWithWfomJson'.");
+ err.code = 'BUSINESS_RULE_API_UNAVAILABLE';
+ assert.throws(
+ () => requireSuccessfulPush({ type: 'businessRule', id: 'br1', saved: false, error: err }, 'business rule R'),
+ (e) => {
+ assert.strictEqual(e.name, 'BuildHalt');
+ // The code is propagated so a phase-level `skipIf` can still match on it after the wrap.
+ assert.strictEqual(e.code, 'BUSINESS_RULE_API_UNAVAILABLE', `got ${e.code}`);
+ assert.strictEqual(e.cause, err, 'the SdkError must remain reachable as the cause');
+ assert.match(e.message, /not enabled on this environment/, 'the SDK\'s own diagnosis is what the operator needs');
+ assert.doesNotMatch(e.message, /changed in Maker since it was fetched/,
+ 'a cause the SDK named must not be overwritten with a guess');
+ return true;
+ }
+ );
+});
+
+test('errorCodeChain reads codes through the cause chain, and cannot spin on a cycle', () => {
+ // `skipIf` predicates are handed whatever reached the runner. A failure the SDK reports BY VALUE
+ // arrives wrapped in a BuildHalt, so the SDK's own code is one level down; reading only the top
+ // level silently misses it.
+ const inner = Object.assign(new Error('inner'), { code: 'SDK_CODE' });
+ const outer = new BuildHalt('outer', { code: 'push-failed', cause: inner });
+ assert.deepStrictEqual(errorCodeChain(outer), ['push-failed', 'SDK_CODE']);
+ assert.deepStrictEqual(errorCodeChain(inner), ['SDK_CODE']);
+ assert.deepStrictEqual(errorCodeChain(new Error('no code')), []);
+ assert.deepStrictEqual(errorCodeChain(null), []);
+ assert.deepStrictEqual(errorCodeChain(undefined), []);
+
+ // A self-referential cause is not hypothetical — it happens when an error is re-wrapped with
+ // itself — and an unbounded walk would hang the build rather than fail it.
+ const loop = Object.assign(new Error('loop'), { code: 'A' });
+ loop.cause = loop;
+ assert.deepStrictEqual(errorCodeChain(loop), ['A']);
+
+ // Depth is bounded even for a long, non-cyclic chain.
+ let deep = Object.assign(new Error('d0'), { code: 'C0' });
+ for (let i = 1; i < 10; i += 1) deep = Object.assign(new Error(`d${i}`), { code: `C${i}`, cause: deep });
+ assert.strictEqual(errorCodeChain(deep).length, 5, 'the walk stops at maxDepth');
+});
+
// #455 wiring: the CLI resolves the authoring LCID BEFORE constructing the SDK (because
// MakerSdkOptions.languageCode is a construction-time option) and then hands the SAME value to the
// data-model phase. Two things must hold, and neither is covered by testing resolveLanguageCode
@@ -851,3 +896,20 @@ test('without a pre-resolved language the data-model phase still resolves one it
assert.ok(withLang.length > 0 && withLang.every((o) => o.languageCode === 1031),
'the org base language is still resolved when nothing was pre-resolved');
});
+
+test('requireSuccessfulPush keeps the re-download remedy for the SDK\u0027s own VERSION_CONFLICT code', () => {
+ // The regression this pins: the "report an unrecognised code verbatim" branch swallowed the 412
+ // remedy, because the REAL bundle attaches `code: "VERSION_CONFLICT"` to a version conflict while
+ // every fixture here used a code-less error. So the guard still halted, but the one instruction
+ // the operator needs — re-download, never overwrite a concurrent edit — silently disappeared.
+ const err = Object.assign(new Error('Version conflict'), { code: 'VERSION_CONFLICT' });
+ assert.throws(
+ () => requireSuccessfulPush({ type: 'form', id: 'f1', saved: false, error: err }, 'form F'),
+ (e) => {
+ assert.strictEqual(e.name, 'BuildHalt');
+ assert.strictEqual(e.code, 'version-conflict', `got ${e.code}`);
+ assert.match(e.message, /re-download the app and rebuild/, 'the remedy must survive');
+ return true;
+ }
+ );
+});
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 65d20bfb5..1a5262086 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
@@ -239,7 +239,7 @@ test('deploy: a rebuild re-binds ids from the live enumeration and issues only U
} finally { fs.rmSync(appDir, { recursive: true, force: true }); }
});
-// Sol review (dup-page-name fix): validateAppSpec TOLERATES a duplicate name when both pages carry a
+// Duplicate page names: validateAppSpec TOLERATES a duplicate name when both pages carry a
// pageId, but a pageId is only a CLAIM. A STALE snapshot (a page deleted in Maker since download) reconciles
// its id as ABSENT, so the upload loop would CREATE it fresh and re-materialize the duplicate. The
// post-reconcile gate must HALT before any write; a fresh download (both ids live) must still build.
@@ -264,7 +264,7 @@ function makeDupNamePageApp() {
return { appDir, spec, GA, GB, manifest };
}
-test('deploy: a STALE duplicate-named page (its pageId absent from live) HALTS before creating a dupe (Sol review)', async () => {
+test('deploy: a STALE duplicate-named page (its pageId absent from live) HALTS before creating a dupe', async () => {
const { appDir, spec, GA, manifest } = makeDupNamePageApp();
try {
const { sdk } = mockSdk({ pageManifest: manifest, manifestId: 'wr-manifest' });
diff --git a/plugins/model-apps/scripts/tests/sdk-build.test.js b/plugins/model-apps/scripts/tests/sdk-build.test.js
index 8ceacf797..19bbd6ca8 100644
--- a/plugins/model-apps/scripts/tests/sdk-build.test.js
+++ b/plugins/model-apps/scripts/tests/sdk-build.test.js
@@ -2332,8 +2332,8 @@ test('security phase: a spec with no personas makes no security calls', async ()
test('resolvePhases honors only/skip/from/to', () => {
assert.deepStrictEqual(resolvePhases({ only: ['views', 'charts'] }), ['views', 'charts']);
- assert.deepStrictEqual(resolvePhases({ skip: ['data-model', 'sample-data', 'publish'] }), ['solution', 'web-resources', 'views', 'charts', 'forms', 'business-rules', 'commands', 'dashboards', 'app-shell', 'pages', 'ai-features', 'security']);
- assert.deepStrictEqual(resolvePhases({ from: 'views' }), ['views', 'charts', 'forms', 'business-rules', 'commands', 'dashboards', 'app-shell', 'pages', 'ai-features', 'security', 'publish']);
+ assert.deepStrictEqual(resolvePhases({ skip: ['data-model', 'sample-data', 'publish'] }), ['solution', 'web-resources', 'views', 'charts', 'forms', 'business-rules', 'business-process-flows', 'commands', 'dashboards', 'app-shell', 'pages', 'ai-features', 'security']);
+ assert.deepStrictEqual(resolvePhases({ from: 'views' }), ['views', 'charts', 'forms', 'business-rules', 'business-process-flows', 'commands', 'dashboards', 'app-shell', 'pages', 'ai-features', 'security', 'publish']);
assert.deepStrictEqual(resolvePhases({ to: 'data-model' }), ['solution', 'data-model']);
});
diff --git a/plugins/model-apps/scripts/tests/sdk-surface-contract.test.js b/plugins/model-apps/scripts/tests/sdk-surface-contract.test.js
index 9929d79aa..4ae28b6d4 100644
--- a/plugins/model-apps/scripts/tests/sdk-surface-contract.test.js
+++ b/plugins/model-apps/scripts/tests/sdk-surface-contract.test.js
@@ -98,6 +98,10 @@ const SKILL_SDK_SURFACE = [
'updateRecord',
'updateTable',
'updateWebResource',
+ // The business-rule designer's OWN completeness validator. Nothing on the push path runs it, and a
+ // rule the compiler could not understand deploys as an EMPTY rule with HTTP 204 — so losing this
+ // method silently re-opens a trap that has no other detector.
+ 'validateBusinessRule',
];
function realSdk() {
diff --git a/plugins/model-apps/scripts/tests/sdk-uptake-contract.test.js b/plugins/model-apps/scripts/tests/sdk-uptake-contract.test.js
index ee09c0db9..08e990eb6 100644
--- a/plugins/model-apps/scripts/tests/sdk-uptake-contract.test.js
+++ b/plugins/model-apps/scripts/tests/sdk-uptake-contract.test.js
@@ -211,7 +211,7 @@ test('REAL BUNDLE: a NON-qualifying failure must NOT fall back (a second write c
test('REAL BUNDLE: a 404 on the bound member is refused with a STABLE, matchable code', async () => {
// The plugin degrades gracefully on an environment that does not declare the member (it skips the
// rules and builds the rest of the app rather than halting 90% of the way through). That branch is
- // selected by `err.code`, so the code is a contract, not an implementation detail.
+ // selected by the error's `code`, so the code is a contract, not an implementation detail.
//
// It must NOT be selected by `err.name`: the bundle is minified, so the class name is a
// rebuild-unstable two-letter string that also happens to be the shared base error. Matching it
@@ -219,17 +219,32 @@ test('REAL BUNDLE: a 404 on the bound member is refused with a STABLE, matchable
//
// MEASURED live: `$metadata` on a real environment (16.5 MB) does not mention the member, and every
// POST to it answers 404. The SDK's own message reports 18 of 20 environments in the same state.
+ //
+ // ⚠ HOW it is refused CHANGED, and the change was invisible to every mock-based test in the suite.
+ // The SDK used to THROW here; it now treats the preview rollout as a reported no-op and RESOLVES
+ // with `saved: false` carrying the same code, so a `pushAll` can carry on with the other artifacts.
+ // `saved` staying FALSE is the load-bearing half — "skipped" must never read as "written". The
+ // plugin reads the code off the CAUSE CHAIN so both shapes reach the same skip; asserting only
+ // one of them here is what let the by-value form turn into a build halt on most environments.
const { sdk, calls } = sdkWith({
post: (url) => (/WithWfomJson/i.test(url) ? { status: 404, headers: {}, body: {} } : undefined),
});
const art = authorRule(sdk);
await sdk.updateElement('businessRule', art.id, '/rootCondition', CONDITION);
- const err = await sdk.pushArtifact('businessRule', art.id).then(() => null, (e) => e);
- assert.ok(err, 'an undeclared member must be refused, not silently substituted');
+ const res = await sdk.pushArtifact('businessRule', art.id).then((r) => r, (e) => ({ threw: e }));
+ // Accept EITHER shape deliberately: a bundle that goes back to throwing must not fail this guard,
+ // because the plugin still handles it. What may never happen is a reported SUCCESS.
+ const err = res.threw || res.error;
+ assert.ok(err, `an undeclared member must be refused, not silently substituted; got ${JSON.stringify(res)}`);
+ if (!res.threw) {
+ assert.strictEqual(res.saved, false, 'a no-op must never be reported as a write that committed');
+ assert.strictEqual(res.shipped, false, 'nor as live');
+ }
assert.strictEqual(err.code, 'BUSINESS_RULE_API_UNAVAILABLE',
`the plugin branches on this exact code; got ${JSON.stringify(err.code)}`);
- assert.match(err.message, /does not expose/i, 'the message must name the cause for the operator');
+ assert.match(err.message, /not enabled on this environment|does not expose/i,
+ 'the message must name the cause for the operator');
assert.strictEqual(calls.some((c) => c.verb === 'POST' && /\/workflows$/.test(String(c.url))), false,
'and nothing else may be written in its place');
});
@@ -338,9 +353,15 @@ test('REAL BUNDLE: no failure of the bound member produces a second write', asyn
// fallback, so they are the two that would resurrect the duplicate. The rest are included because
// "nothing else writes twice either" is the actual invariant, and a partial check would let a
// narrower fallback back in unnoticed.
+ //
+ // The invariant is NO SECOND WRITE — deliberately not "throws". How each failure is SURFACED is a
+ // separate contract (pinned above) and it is not uniform: the 404 preview gate is reported by
+ // value, everything else throws. Conflating the two is what made this test fail on an uptake that
+ // changed only the reporting shape, while the duplicate-write invariant it exists to protect was
+ // never at risk.
const FAILURES = [
[400, '0x80040216'], // committed-then-faulted: the exact #482 trigger
- [404, null], // member not declared on this environment
+ [404, null], // member not declared on this environment -> reported BY VALUE
[400, '0x80040265'], // an unrelated 400
[401, null],
[403, null],
@@ -353,7 +374,13 @@ test('REAL BUNDLE: no failure of the bound member produces a second write', asyn
? { status, headers: {}, body: code ? { error: { code, message: 'fault' } } : {} }
: undefined),
});
- await assert.rejects(() => authorDupGuard(sdk), `HTTP ${status} ${code || ''} must surface, not be absorbed`);
+ const outcome = await authorDupGuard(sdk).then((r) => r, (e) => ({ threw: e }));
+ // Whichever way it is surfaced, it must NOT be a success.
+ const failed = Boolean(outcome.threw) || outcome.saved === false;
+ assert.ok(failed,
+ `HTTP ${status} ${code || ''} must surface, not be absorbed; got ${JSON.stringify(outcome)}`);
+ assert.ok(outcome.threw || outcome.error,
+ `HTTP ${status} ${code || ''} must carry the cause either way`);
// The decisive assertion: no classic row, and no retry of the member either. Either one would be
// a second rule on the table for a single authored rule.
diff --git a/plugins/model-apps/scripts/tests/stages.test.js b/plugins/model-apps/scripts/tests/stages.test.js
index 51bd388ae..a2019fab2 100644
--- a/plugins/model-apps/scripts/tests/stages.test.js
+++ b/plugins/model-apps/scripts/tests/stages.test.js
@@ -5,13 +5,13 @@ const path = require('node:path');
const { PHASES, STAGES, phasesForStage, stagePhasesOrResolve } = require(path.join(__dirname, '..', 'lib', 'stages.js'));
const { resolvePhases } = require(path.join(__dirname, '..', 'lib', 'sdk-build.js'));
-test('PHASES is the canonical 15-phase ordered list', () => {
- assert.deepStrictEqual(PHASES, ['solution', 'data-model', 'sample-data', 'web-resources', 'views', 'charts', 'forms', 'business-rules', 'commands', 'dashboards', 'app-shell', 'pages', 'ai-features', 'security', 'publish']);
+test('PHASES is the canonical 16-phase ordered list', () => {
+ assert.deepStrictEqual(PHASES, ['solution', 'data-model', 'sample-data', 'web-resources', 'views', 'charts', 'forms', 'business-rules', 'business-process-flows', 'commands', 'dashboards', 'app-shell', 'pages', 'ai-features', 'security', 'publish']);
});
test('STAGES map groups contiguous phase ranges', () => {
assert.deepStrictEqual(STAGES.data, ['solution', 'data-model', 'sample-data']);
- assert.deepStrictEqual(STAGES.ui, ['web-resources', 'views', 'charts', 'forms', 'business-rules', 'commands', 'dashboards']);
+ assert.deepStrictEqual(STAGES.ui, ['web-resources', 'views', 'charts', 'forms', 'business-rules', 'business-process-flows', 'commands', 'dashboards']);
assert.deepStrictEqual(STAGES.app, ['app-shell', 'pages', 'ai-features', 'security']);
assert.deepStrictEqual(STAGES.publish, ['publish']);
// Every stage phase is a real engine phase, and the four stages tile PHASES with no gaps/overlaps.
@@ -29,7 +29,7 @@ test('stagePhasesOrResolve: --stage wins; conflicting selectors throw', () => {
});
test('stagePhasesOrResolve without --stage delegates to resolvePhases', () => {
- assert.deepStrictEqual(stagePhasesOrResolve({ from: 'forms' }), ['forms', 'business-rules', 'commands', 'dashboards', 'app-shell', 'pages', 'ai-features', 'security', 'publish']);
+ assert.deepStrictEqual(stagePhasesOrResolve({ from: 'forms' }), ['forms', 'business-rules', 'business-process-flows', 'commands', 'dashboards', 'app-shell', 'pages', 'ai-features', 'security', 'publish']);
});
test('resolvePhases rejects an unknown phase instead of silently ignoring it', () => {
diff --git a/plugins/model-apps/scripts/vendor/PROVENANCE.json b/plugins/model-apps/scripts/vendor/PROVENANCE.json
index 2533bb9dc..2f114265d 100644
--- a/plugins/model-apps/scripts/vendor/PROVENANCE.json
+++ b/plugins/model-apps/scripts/vendor/PROVENANCE.json
@@ -1,14 +1,14 @@
{
- "commit": "5dcb83986fb7b396b2c033089ab89a199665a830",
- "subject": "loc(copilot-studio): add catalogues for 12 new locales (additions-only)",
+ "commit": "e7e8e601a5587ebed523bf9de0043130eafa7888",
+ "subject": "Fix PPAPI licensing recommendation pagination",
"dirtySdkPackage": 0,
- "libBuiltAt": "2026-08-31T21:41:17.872Z",
- "newestSrcAt": "2026-08-31T21:40:14.316Z",
+ "libBuiltAt": "2026-09-04T21:32:20.419Z",
+ "newestSrcAt": "2026-09-04T21:24:55.321Z",
"libIsStale": false,
"nostub": false,
"esbuildVersion": "0.28.1",
"nodeVersion": "v22.13.1",
- "builtAt": "2026-08-31T21:41:40.924Z",
- "bundleSha256": "2d459dec4bad316c468a05ce9d21f13eef48984a483b0aaa29d3f627213db0f5",
- "bundleBytes": 682531
+ "builtAt": "2026-09-04T21:43:31.252Z",
+ "bundleSha256": "dabef5c4e76ce646d613834d1114f32e89c013a6a16b91e1fb83c7f4ee4494ed",
+ "bundleBytes": 692039
}
diff --git a/plugins/model-apps/scripts/vendor/cds-maker-sdk.cjs b/plugins/model-apps/scripts/vendor/cds-maker-sdk.cjs
index 11210ca9d..9d9c25921 100644
--- a/plugins/model-apps/scripts/vendor/cds-maker-sdk.cjs
+++ b/plugins/model-apps/scripts/vendor/cds-maker-sdk.cjs
@@ -25,37 +25,37 @@
}
globalThis.document=globalThis.document||globalThis.window.document;
})();
-"use strict";var T1=Object.create;var ns=Object.defineProperty;var O1=Object.getOwnPropertyDescriptor;var R1=Object.getOwnPropertyNames;var x1=Object.getPrototypeOf,F1=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}},ar=(e,t)=>{for(var r in t)ns(e,r,{get:t[r],enumerable:!0})},Um=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of R1(t))!F1.call(e,i)&&i!==r&&ns(e,i,{get:()=>t[i],enumerable:!(n=O1(t,i))||n.enumerable});return e};var le=(e,t,r)=>(r=e!=null?T1(x1(e)):{},Um(t||!e||!e.__esModule?ns(r,"default",{value:e,enumerable:!0}):r,e)),or=e=>Um(ns({},"__esModule",{value:!0}),e);var ne=g(K=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});K.IncompatibleWorkspaceError=K.PathTraversalError=K.AmbiguousArtifactError=K.JsonPointerError=K.NotImplementedError=K.WorkspaceNotInitializedError=K.ConnectionError=K.VersionConflictError=K.LocalEditsWouldBeLostError=K.StaleArtifactError=K.InvalidArgumentError=K.ValidationError=K.PathNotFoundError=K.ArtifactNotFoundError=K.readPartialTokens=K.withPartialTokens=K.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}};K.SdkError=Xe;var Bm=Symbol.for("cds-maker-sdk.partialWriteTokens");function L1(e,t){return typeof e=="object"&&e!==null&&(e[Bm]=t),e}K.withPartialTokens=L1;function k1(e){let t=e;for(let r=0;t&&typeof t=="object"&&r<8;r++){let n=t[Bm];if(n&&typeof n=="object")return n;t=t.cause}}K.readPartialTokens=k1;var Ju=class extends Xe{constructor(t,r){super("ARTIFACT_NOT_FOUND",`Artifact ${t}/${r} not found in workspace`),this.type=t,this.id=r}};K.ArtifactNotFoundError=Ju;var Xu=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}};K.PathNotFoundError=Xu;var Ku=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}:
+"use strict";var aP=Object.create;var us=Object.defineProperty;var oP=Object.getOwnPropertyDescriptor;var sP=Object.getOwnPropertyNames;var lP=Object.getPrototypeOf,uP=Object.prototype.hasOwnProperty;var I=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var g=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Rr=(e,t)=>{for(var r in t)us(e,r,{get:t[r],enumerable:!0})},ih=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of sP(t))!uP.call(e,i)&&i!==r&&us(e,i,{get:()=>t[i],enumerable:!(n=oP(t,i))||n.enumerable});return e};var se=(e,t,r)=>(r=e!=null?aP(lP(e)):{},ih(t||!e||!e.__esModule?us(r,"default",{value:e,enumerable:!0}):r,e)),Fr=e=>ih(us({},"__esModule",{value:!0}),e);var Mn=g(C=>{"use strict";Object.defineProperty(C,"__esModule",{value:!0});C.DateTimeBehavior=C.PrecisionSource=C.StringFormatName=C.SourceType=C.ImeMode=C.SolutionEntityTypeCodeExtToComponentTypeCode=C.SolutionComponentTypeCodeToEntityTypeCodeExt=C.SolutionComponentVirtualAttributeSubtype=C.EntityTypeCode=C.SolutionComponentTypeCodeExt=C.RootComponentBehavior=C.SolutionComponentTypeCode=C.EntityKeyIndexStatus=C.ViewStateCode=C.ViewStatusCode=C.RelationshipSecurityTypes=C.CascadeType=C.RelationshipTypeExt=C.RelationshipType=C.AppSubType=C.BusinessProcessType=C.WorkflowCategory=C.WorkflowScope=C.WorkflowTypeCode=C.StatusCodeEnabledDisabled=C.StateCodeEnabledDisabled=C.StatusCode=C.StateCode=C.OptionSetType=C.AttributeTypeCodeNum=C.AttributeFormatName=C.AttributeFormatCode=C.AttributeTypeName=C.AttributeTypeCode=C.PluginSourceType=C.AuthType=C.PluginIsolationMode=C.ComponentState=C.ChartType=C.ChartsType=C.ViewType=C.AttributeType=C.ActivationState=C.FormPresentation=C.FormType=C.TableTypeCode=C.TableTypes=C.ActivityTypeMask=C.PrincipalType=C.OwnershipTypes=void 0;C.QueryType=C.KnownCustomSolutionComponentEntitySetName=C.TeamTypeEnum=C.EnvironmentVariableDefinitionTypeEnum=C.ConnectorTypeEnum=C.RoleInheritance=C.DefaultRoleTemplates=C.DeleteDependencyErrorCode=C.ServiceEndpointConnectionMode=C.ServiceEndpointContract=C.ServiceNamespaceFormat=C.ConnectionRoleCategory=C.ReportTypeCode=C.SdkMessageProcessingMode=C.SupportedDeployment=C.SdkMessageProcessingStage=C.WebResourceTypeCode=C.IntegerFormat=C.DateTimeFormat=void 0;var ah;(function(e){e.None="None",e.UserOwned="UserOwned",e.TeamOwned="TeamOwned",e.BusinessOwned="BusinessOwned",e.OrganizationOwned="OrganizationOwned",e.BusinessParented="BusinessParented",e.Filtered="Filtered"})(ah||(C.OwnershipTypes=ah={}));var oh;(function(e){e.User="Microsoft.Dynamics.CRM.systemuser",e.Team="Microsoft.Dynamics.CRM.team"})(oh||(C.PrincipalType=oh={}));var sh;(function(e){e[e.DoNotDisplayInActivityMenus=0]="DoNotDisplayInActivityMenus",e[e.DisplayInActivityMenus=1]="DisplayInActivityMenus"})(sh||(C.ActivityTypeMask=sh={}));var lh;(function(e){e.Activity="Activity",e.Virtual="Virtual",e.Standard="Standard",e.Elastic="Elastic"})(lh||(C.TableTypes=lh={}));var uh;(function(e){e.Standard="Standard",e.Virtual="Virtual",e.Elastic="Elastic"})(uh||(C.TableTypeCode=uh={}));var ch;(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"})(ch||(C.FormType=ch={}));var dh;(function(e){e[e.ClassicForm=0]="ClassicForm",e[e.AirForm=1]="AirForm",e[e.ConvertedICForm=2]="ConvertedICForm"})(dh||(C.FormPresentation=dh={}));var ph;(function(e){e[e.Inactive=0]="Inactive",e[e.Active=1]="Active"})(ph||(C.ActivationState=ph={}));var fh;(function(e){e[e.String=0]="String",e[e.Number=1]="Number",e[e.Picklist=2]="Picklist"})(fh||(C.AttributeType=fh={}));var mh;(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"})(mh||(C.ViewType=mh={}));var hh;(function(e){e[e.ASPChart=0]="ASPChart",e[e.PowerBI=1]="PowerBI"})(hh||(C.ChartsType=hh={}));var gh;(function(e){e[e.DataAndInteractionCentric=0]="DataAndInteractionCentric",e[e.InteractionCentric=1]="InteractionCentric"})(gh||(C.ChartType=gh={}));var vh;(function(e){e[e.Published=0]="Published",e[e.Unpublished=1]="Unpublished",e[e.Deleted=2]="Deleted",e[e.DeletedUnpublished=3]="DeletedUnpublished"})(vh||(C.ComponentState=vh={}));var yh;(function(e){e[e.None=1]="None",e[e.Sandbox=2]="Sandbox",e[e.External=3]="External"})(yh||(C.PluginIsolationMode=yh={}));var bh;(function(e){e[e.BasicAuth=0]="BasicAuth"})(bh||(C.AuthType=bh={}));var wh;(function(e){e[e.Database=0]="Database",e[e.Disk=1]="Disk",e[e.Normal=2]="Normal",e[e.AzureWebApp=3]="AzureWebApp"})(wh||(C.PluginSourceType=wh={}));var Ah;(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"})(Ah||(C.AttributeTypeCode=Ah={}));var Ch;(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"})(Ch||(C.AttributeTypeName=Ch={}));var Sh;(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"})(Sh||(C.AttributeFormatCode=Sh={}));var Eh;(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"})(Eh||(C.AttributeFormatName=Eh={}));var Nh;(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"})(Nh||(C.AttributeTypeCodeNum=Nh={}));var Dh;(function(e){e.Picklist="Picklist",e.State="State",e.Status="Status",e.Boolean="Boolean"})(Dh||(C.OptionSetType=Dh={}));var Ih;(function(e){e[e.Draft=0]="Draft",e[e.Activated=1]="Activated"})(Ih||(C.StateCode=Ih={}));var _h;(function(e){e[e.Draft=1]="Draft",e[e.Activated=2]="Activated"})(_h||(C.StatusCode=_h={}));var Ph;(function(e){e[e.Enabled=0]="Enabled",e[e.Disabled=1]="Disabled"})(Ph||(C.StateCodeEnabledDisabled=Ph={}));var Th;(function(e){e[e.Enabled=1]="Enabled",e[e.Disabled=2]="Disabled"})(Th||(C.StatusCodeEnabledDisabled=Th={}));var Oh;(function(e){e[e.Definition=1]="Definition",e[e.Activation=2]="Activation",e[e.Template=3]="Template"})(Oh||(C.WorkflowTypeCode=Oh={}));var Rh;(function(e){e[e.User=1]="User",e[e.BusinessUnit=2]="BusinessUnit",e[e.ParentChildBusinessUnit=3]="ParentChildBusinessUnit",e[e.Organization=4]="Organization"})(Rh||(C.WorkflowScope=Rh={}));var Fh;(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"})(Fh||(C.WorkflowCategory=Fh={}));var xh;(function(e){e[e.None=-1]="None",e[e.BusinessFlow=0]="BusinessFlow",e[e.TaskFlow=1]="TaskFlow"})(xh||(C.BusinessProcessType=xh={}));var Lh;(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"})(Lh||(C.AppSubType=Lh={}));var kh;(function(e){e.OneToManyRelationship="OneToManyRelationship",e.ManyToManyRelationship="ManyToManyRelationship"})(kh||(C.RelationshipType=kh={}));var Mh;(function(e){e.ManyToOneRelationship="ManyToOneRelationship",e.OneToManyRelationship="OneToManyRelationship",e.ManyToManyRelationship="ManyToManyRelationship"})(Mh||(C.RelationshipTypeExt=Mh={}));var Uh;(function(e){e.NoCascade="NoCascade",e.Cascade="Cascade",e.Active="Active",e.UserOwned="UserOwned",e.RemoveLink="RemoveLink",e.Restrict="Restrict"})(Uh||(C.CascadeType=Uh={}));var Bh;(function(e){e.None="None",e.Append="Append",e.ParentChild="ParentChild",e.Pointer="Pointer",e.Inheritance="Inheritance"})(Bh||(C.RelationshipSecurityTypes=Bh={}));var $h;(function(e){e[e.Active=1]="Active",e[e.Inactive=2]="Inactive"})($h||(C.ViewStatusCode=$h={}));var qh;(function(e){e[e.Active=0]="Active",e[e.Inactive=1]="Inactive"})(qh||(C.ViewStateCode=qh={}));var Vh;(function(e){e.Active="Active",e.Failed="Failed",e.InProgress="InProgress",e.Pending="Pending"})(Vh||(C.EntityKeyIndexStatus=Vh={}));var Gh;(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"})(Gh||(C.SolutionComponentTypeCode=Gh={}));var zh;(function(e){e[e.IncludeSubcomponents=0]="IncludeSubcomponents",e[e.DoNotIncludeSubcomponents=1]="DoNotIncludeSubcomponents",e[e.IncludeAsShellOnly=2]="IncludeAsShellOnly"})(zh||(C.RootComponentBehavior=zh={}));var cs;(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"})(cs||(C.SolutionComponentTypeCodeExt=cs={}));var ds;(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"})(ds||(C.EntityTypeCode=ds={}));var Wh;(function(e){e.MultiSelectPicklist="MultiSelectPicklist",e.File="File",e.Image="Image"})(Wh||(C.SolutionComponentVirtualAttributeSubtype=Wh={}));function cP(e){let t=cs[e];return ds[t]}C.SolutionComponentTypeCodeToEntityTypeCodeExt=cP;function dP(e){let t=ds[e];return cs[t]}C.SolutionEntityTypeCodeExtToComponentTypeCode=dP;var jh;(function(e){e.Active="Active",e.Auto="Auto",e.Disabled="Disabled",e.Inactive="Inactive"})(jh||(C.ImeMode=jh={}));var Hh;(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"})(Hh||(C.SourceType=Hh={}));var Jh;(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"})(Jh||(C.StringFormatName=Jh={}));var Qh;(function(e){e[e.PrecisionProperty=0]="PrecisionProperty",e[e.Organization=1]="Organization",e[e.TransactionCurrency=2]="TransactionCurrency"})(Qh||(C.PrecisionSource=Qh={}));var Xh;(function(e){e.UserLocal="UserLocal",e.DateOnly="DateOnly",e.TimeZoneIndependent="TimeZoneIndependent"})(Xh||(C.DateTimeBehavior=Xh={}));var Kh;(function(e){e.DateOnly="DateOnly",e.DateAndTime="DateAndTime"})(Kh||(C.DateTimeFormat=Kh={}));var Yh;(function(e){e.None="None",e.Duration="Duration",e.TimeZone="TimeZone",e.Language="Language",e.Locale="Locale"})(Yh||(C.IntegerFormat=Yh={}));var Zh;(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"})(Zh||(C.WebResourceTypeCode=Zh={}));var eg;(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"})(eg||(C.SdkMessageProcessingStage=eg={}));var tg;(function(e){e[e.ServerOnly=0]="ServerOnly",e[e.OutlookClientOnly=1]="OutlookClientOnly",e[e.Both=2]="Both"})(tg||(C.SupportedDeployment=tg={}));var rg;(function(e){e[e.Synchronous=0]="Synchronous",e[e.Asynchronous=1]="Asynchronous"})(rg||(C.SdkMessageProcessingMode=rg={}));var ng;(function(e){e[e.ReportingServicesReport=1]="ReportingServicesReport",e[e.OtherReport=2]="OtherReport",e[e.LinkedReport=3]="LinkedReport"})(ng||(C.ReportTypeCode=ng={}));var ig;(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"})(ig||(C.ConnectionRoleCategory=ig={}));var ag;(function(e){e[e.Name=1]="Name",e[e.Address=2]="Address"})(ag||(C.ServiceNamespaceFormat=ag={}));var og;(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"})(og||(C.ServiceEndpointContract=og={}));var sg;(function(e){e[e.Normal=1]="Normal",e[e.Federated=2]="Federated"})(sg||(C.ServiceEndpointConnectionMode=sg={}));var lg;(function(e){e.CannotDeleteInUseComponent="0x8004f01f",e.CannotDeleteInUseAttribute="0x80048418",e.CannotDeleteInUseOptionSet="0x80048417",e.CannotDeleteInUseEntity="0x80048420",e.CannotUninstallWithDependencies="0x8004F01D"})(lg||(C.DeleteDependencyErrorCode=lg={}));var ug;(function(e){e.SystemAdministrator="627090FF-40A3-4053-8790-584EDC5BE201",e.SystemCustomizer="119F245C-3CC8-4B62-B31C-D1A046CED15D"})(ug||(C.DefaultRoleTemplates=ug={}));var cg;(function(e){e[e.DefaultTeamPrivilege=0]="DefaultTeamPrivilege",e[e.DirectUserAndTeamPrivilege=1]="DirectUserAndTeamPrivilege"})(cg||(C.RoleInheritance=cg={}));var dg;(function(e){e[e.NotSpecified=0]="NotSpecified",e[e.CustomConnector=1]="CustomConnector"})(dg||(C.ConnectorTypeEnum=dg={}));var pg;(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"})(pg||(C.EnvironmentVariableDefinitionTypeEnum=pg={}));var fg;(function(e){e[e.Owner=0]="Owner",e[e.Access=1]="Access",e[e.AADSecurityGroup=2]="AADSecurityGroup",e[e.AADOfficeGroup=3]="AADOfficeGroup"})(fg||(C.TeamTypeEnum=fg={}));var mg;(function(e){e.Bots="bots"})(mg||(C.KnownCustomSolutionComponentEntitySetName=mg={}));var hg;(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"})(hg||(C.QueryType=hg={}))});var ie=g(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.IncompatibleWorkspaceError=Y.PathTraversalError=Y.AmbiguousArtifactError=Y.JsonPointerError=Y.NotImplementedError=Y.WorkspaceNotInitializedError=Y.ConnectionError=Y.VersionConflictError=Y.LocalEditsWouldBeLostError=Y.StaleArtifactError=Y.InvalidArgumentError=Y.ValidationError=Y.PathNotFoundError=Y.ArtifactNotFoundError=Y.readPartialTokens=Y.withPartialTokens=Y.SdkError=void 0;var Ye=class extends Error{constructor(t,r){super(r),this.code=t,Object.setPrototypeOf(this,new.target.prototype),this.name=new.target.name}};Y.SdkError=Ye;var gg=Symbol.for("cds-maker-sdk.partialWriteTokens");function pP(e,t){return typeof e=="object"&&e!==null&&(e[gg]=t),e}Y.withPartialTokens=pP;function fP(e){let t=e;for(let r=0;t&&typeof t=="object"&&r<8;r++){let n=t[gg];if(n&&typeof n=="object")return n;t=t.cause}}Y.readPartialTokens=fP;var sc=class extends Ye{constructor(t,r){super("ARTIFACT_NOT_FOUND",`Artifact ${t}/${r} not found in workspace`),this.type=t,this.id=r}};Y.ArtifactNotFoundError=sc;var lc=class extends Ye{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=lc;var uc=class extends Ye{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"}};K.ValidationError=Ku;var Yu=class extends Xe{constructor(t){super("INVALID_ARGUMENT",t)}};K.InvalidArgumentError=Yu;var Zu=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}};K.StaleArtifactError=Zu;var ec=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}};K.LocalEditsWouldBeLostError=ec;var tc=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}};K.VersionConflictError=tc;var rc=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}};K.ConnectionError=rc;var nc=class extends Xe{constructor(t){super("WORKSPACE_NOT_INITIALIZED",`Workspace not initialized at ${t}. Call initWorkspace() first.`),this.workspacePath=t}};K.WorkspaceNotInitializedError=nc;var ic=class extends Xe{constructor(t,r){super("NOT_IMPLEMENTED",`Operation '${t}' is not implemented yet${r?`: ${r}`:""}.`),this.operation=t}};K.NotImplementedError=ic;var ac=class extends Xe{constructor(t,r){super("INVALID_JSON_POINTER",`Invalid JSON Pointer '${t}': ${r}`),this.pointer=t}};K.JsonPointerError=ac;var oc=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}};K.AmbiguousArtifactError=oc;var sc=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}};K.PathTraversalError=sc;var lc=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}};K.IncompatibleWorkspaceError=lc});var os=g(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});as.JsonPointer=void 0;var _t=ne(),is=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 _t.JsonPointerError(t,'non-empty pointers must start with "/"');return t.substring(1).split("/").map(r=>{if(/~(?![01])/.test(r))throw new _t.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 _t.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 _t.JsonPointerError(r,`'${o}' is not a valid array index`);if(s>a.length)throw new _t.JsonPointerError(r,`array index '${o}' is out of range`);a[s]=n}else{if(e.isReservedToken(o))throw new _t.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 _t.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 _t.JsonPointerError(r,`array index '${a}' is out of range`);i.splice(o,1)}else{if(e.isReservedToken(a))throw new _t.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 _t.JsonPointerError(r,"add target must be an array");u.push(n);return}let o=e.resolve(t,r);if(!Array.isArray(o))throw new _t.JsonPointerError(r,"add target must be an array");let s=i===void 0?o.length:i;if(s<0||s>o.length)throw new _t.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 _t.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)}};as.JsonPointer=is;is.RESERVED_TOKENS=new Set(["__proto__","prototype","constructor"])});var qm=g(ss=>{"use strict";Object.defineProperty(ss,"__esModule",{value:!0});ss.findElements=void 0;var $m=os();function M1(e,t){let r=[];return uc(e,"",t,r),r}ss.findElements=M1;function uc(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)=>{uc(i,$m.JsonPointer.append(t,a),r,n)});else for(let i of Object.keys(e))uc(e[i],$m.JsonPointer.append(t,i),r,n)}});var zm=g(Ke=>{"use strict";var U1=Ke&&Ke.__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]})),B1=Ke&&Ke.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Gm=Ke&&Ke.__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)&&U1(t,e,r);return B1(t,e),t};Object.defineProperty(Ke,"__esModule",{value:!0});Ke.canonicalArtifactId=Ke.WorkspaceManager=Ke.WORKSPACE_SCHEMA_VERSION=void 0;var De=Gm(require("fs")),Pe=Gm(require("path")),li=ne();Ke.WORKSPACE_SCHEMA_VERSION=1;var ls={form:"forms",view:"views",businessRule:"business-rules",app:"apps",command:"commands",chart:"charts",dashboard:"dashboards",genPage:"gen-pages",bpf:"business-process-flows"},$1="manifest.json",us=".metadata",Vm="entities",cc=class{constructor(t,r){this.workspacePath=t,this.instanceUrl=r}getRoot(){return this.workspacePath}getArtifactDir(t){return Pe.join(this.workspacePath,ls[t])}getArtifactFilePath(t,r){return this.assertSafeId(r),this.assertWithinRoot(Pe.join(this.getArtifactDir(t),`${Ia(r)}.json`))}getMetaFilePath(t,r){return this.assertSafeId(r),this.assertWithinRoot(Pe.join(this.workspacePath,us,ls[t],`${Ia(r)}.meta.json`))}getEntityMetaFilePath(t){return this.assertSafeId(t),this.assertWithinRoot(Pe.join(this.workspacePath,us,Vm,`${t}.json`))}assertSafeId(t){if(typeof t!="string"||t.length===0||/[\u0000-\u001f]/.test(t)||t.includes("/")||t.includes("\\")||t.includes(":")||t==="."||t===".."||t.includes("..")||Pe.basename(t)!==t)throw new li.PathTraversalError(String(t),this.workspacePath)}assertWithinRoot(t){let r=Pe.resolve(this.workspacePath),n=Pe.resolve(t);if(n!==r&&!n.startsWith(r+Pe.sep))throw new li.PathTraversalError(t,this.workspacePath);let i=De.existsSync(r)?De.realpathSync(r):r,a=n,o=[];for(;!De.existsSync(a);){o.unshift(Pe.basename(a));let l=Pe.dirname(a);if(l===a)break;a=l}let s=Pe.resolve(De.realpathSync(a),...o);if(s!==i&&!s.startsWith(i+Pe.sep))throw new li.PathTraversalError(t,this.workspacePath);return n}get manifestPath(){return Pe.join(this.workspacePath,$1)}init(){for(let t of Object.keys(ls))De.mkdirSync(this.getArtifactDir(t),{recursive:!0}),De.mkdirSync(Pe.dirname(this.getMetaFilePath(t,"x")),{recursive:!0});if(De.mkdirSync(Pe.join(this.workspacePath,us,Vm),{recursive:!0}),!this.exists(this.manifestPath)){let t={instanceUrl:this.instanceUrl,createdAt:new Date().toISOString(),artifacts:[]};this.writeManifest(t)}}isInitialized(){return this.exists(this.manifestPath)}ensureInitialized(){if(!this.isInitialized())throw new li.WorkspaceNotInitializedError(this.workspacePath)}clean(){for(let r of Object.keys(ls))dc(this.getArtifactDir(r));dc(Pe.join(this.workspacePath,us));let t=this.getManifest();t.artifacts=[],t.lastSyncAt=void 0,this.init(),this.writeManifest(t)}readArtifact(t,r){return this.ensureInitialized(),this.readJson(this.getArtifactFilePath(t,r))}writeArtifact(t,r,n){this.ensureInitialized(),this.writeJson(this.getArtifactFilePath(t,r),n),this.upsertManifestEntry(t,r,n)}deleteArtifact(t,r){this.ensureInitialized(),this.removeFile(this.getArtifactFilePath(t,r)),this.removeFile(this.getMetaFilePath(t,r));let n=Ia(r),i=this.getManifest();i.artifacts=i.artifacts.filter(a=>!(a.type===t&&a.id===n)),this.writeManifest(i)}listArtifacts(t,r){return this.ensureInitialized(),this.getManifest().artifacts.filter(n=>!(t&&n.type!==t||r?.entityLogicalName&&n.entityLogicalName!==r.entityLogicalName))}readEntityMetadata(t){this.ensureInitialized();let r=this.readJson(this.getEntityMetaFilePath(t));return!r||typeof r.schemaName!="string"||typeof r.primaryNameAttribute!="string"||typeof r.primaryIdAttribute!="string"||typeof r.isCustomEntity!="boolean"?null:r}writeEntityMetadata(t,r){this.ensureInitialized(),this.writeJson(this.getEntityMetaFilePath(t),r)}getManifest(){this.ensureInitialized();let t=this.readJson(this.manifestPath);if(!t)throw new li.WorkspaceNotInitializedError(this.workspacePath);if(t.schemaVersion!==void 0&&t.schemaVersion>Ke.WORKSPACE_SCHEMA_VERSION)throw new li.IncompatibleWorkspaceError(t.schemaVersion,Ke.WORKSPACE_SCHEMA_VERSION);return t}writeManifest(t){this.writeJson(this.manifestPath,{...t,schemaVersion:Ke.WORKSPACE_SCHEMA_VERSION})}updateManifest(t){let r=this.getManifest();this.writeManifest({...r,...t})}upsertManifestEntry(t,r,n){let i=this.getManifest(),a=Ia(r),o=n,s=typeof o.name=="string"?o.name:`${t}:${a}`,l=typeof o.entityLogicalName=="string"?o.entityLogicalName:void 0,u=i.artifacts.find(c=>c.type===t&&c.id===a);u?(u.name=s,u.entityLogicalName=l):i.artifacts.push({type:t,id:a,name:s,entityLogicalName:l,isDirty:!1}),this.writeManifest(i)}readJson(t){return this.exists(t)?JSON.parse(De.readFileSync(t,"utf8")):null}writeJson(t,r){let n=Pe.dirname(t);De.mkdirSync(n,{recursive:!0});let i=Pe.join(n,`.${Pe.basename(t)}.${Date.now()}.${Math.random().toString(36).slice(2)}.tmp`);try{De.writeFileSync(i,`${JSON.stringify(r,null,2)}
-`,"utf8"),De.renameSync(i,t)}catch(a){try{De.existsSync(i)&&De.unlinkSync(i)}catch{}throw a}}removeFile(t){this.exists(t)&&De.unlinkSync(t)}exists(t){return De.existsSync(t)}};Ke.WorkspaceManager=cc;function Ia(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()}Ke.canonicalArtifactId=Ia;function dc(e){let t;try{t=De.lstatSync(e)}catch{return}if(t.isSymbolicLink()){try{De.unlinkSync(e)}catch{De.rmdirSync(e)}return}if(!t.isDirectory()){De.unlinkSync(e);return}for(let r of De.readdirSync(e))dc(Pe.join(e,r));De.rmdirSync(e)}});var pc=g(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.deepEqual=ui.deepDiff=void 0;var q1=os();function V1(e,t){let r=[];return jm(e,t,"",r,0),r}ui.deepDiff=V1;var cs=Symbol("missing"),ds=512;function jm(e,t,r,n,i){if(e===t)return;if(i>ds)throw new RangeError(`deepDiff exceeded the maximum supported depth of ${ds}`);let a=ps(e),o=ps(t);if(a&&o&&Array.isArray(e)===Array.isArray(t)){let s=G1(e,t);for(let l of s){let u=Wm(e,l),c=Wm(t,l),d=q1.JsonPointer.append(r,l);u===cs?n.push({pointer:d,type:"added",newValue:c}):c===cs?n.push({pointer:d,type:"removed",oldValue:u}):jm(u,c,d,n,i+1)}return}Hm(e,t)||n.push({pointer:r,type:"modified",oldValue:e,newValue:t})}function ps(e){return e!==null&&typeof e=="object"}function G1(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 Wm(e,t){if(Array.isArray(e)){let r=Number(t);return r<e.length?e[r]:cs}return t in e?e[t]:cs}function Hm(e,t){return Qm(e,t,0)}ui.deepEqual=Hm;function Qm(e,t,r){if(e===t)return!0;if(r>ds)throw new RangeError(`deepEqual exceeded the maximum supported depth of ${ds}`);if(!ps(e)||!ps(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&&Qm(e[a],t[a],r+1))}});var Xm=g(fs=>{"use strict";Object.defineProperty(fs,"__esModule",{value:!0});fs.VersionManager=void 0;var Jm=pc(),fc=class{constructor(t){this.workspace=t}storeMeta(t,r,n){this.workspace.writeJson(this.workspace.getMetaFilePath(t,r),n)}getMeta(t,r){return this.workspace.readJson(this.workspace.getMetaFilePath(t,r))}isDirty(t,r){let n=this.workspace.readArtifact(t,r);if(n===null)return!1;let i=this.getMeta(t,r);return i?!(0,Jm.deepEqual)(i.snapshot,n):!0}diff(t,r){let n=this.workspace.readArtifact(t,r),i=this.getMeta(t,r),a;return n===null?a=i?[{pointer:"",type:"removed",oldValue:i.snapshot}]:[]:i?a=(0,Jm.deepDiff)(i.snapshot,n):a=[{pointer:"",type:"added",newValue:n}],{artifactType:t,artifactId:r,changes:a}}checkConflict(t,r,n){let i=this.getMeta(t,r);return!i||i.etag===null?!1:i.etag!==n}};fs.VersionManager=fc});var Ym=g((mc,Km)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof mc=="object"?Km.exports=t():e.compareVersions=t()})(mc,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 m=l[l.length-1],h=u[u.length-1];if(m&&h){var w=m.split(".").map(n),y=h.split(".").map(n);for(c=0;c<Math.max(w.length,y.length);c++){if(w[c]===void 0||typeof y[c]=="string"&&typeof w[c]=="number")return-1;if(y[c]===void 0||typeof w[c]=="string"&&typeof y[c]=="number"||w[c]>y[c])return 1;if(y[c]>w[c])return-1}}else if(m||h)return m?-1:1;return 0}})});var nh=g(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.EnvironmentFlowHostingType=Ce.EnvironmentDisableReasonCode=Ce.EnvironmentMigrationConstants=Ce.EnvironmentProvisioningStates=Ce.EnvironmentLocations=Ce.EnvironmentCreationTypeConstants=Ce.EnvironmentType=Ce.EnvironmentSkuConstants=Ce.environmentPermissions=Ce.DatabaseType=void 0;var Zm;(function(e){e.CommonDataService="CommonDataService",e.None="None"})(Zm||(Ce.DatabaseType=Zm={}));Ce.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"};Ce.EnvironmentSkuConstants={NotSpecified:"NotSpecified",Standard:"Standard",Premium:"Premium",Developer:"Developer",Basic:"Basic",Production:"Production",Sandbox:"Sandbox",Trial:"Trial",Default:"Default",Teams:"Teams",Platform:"Platform"};var eh;(function(e){e[e.CDS2=0]="CDS2",e[e.CDS1=1]="CDS1",e[e.Empty=2]="Empty"})(eh||(Ce.EnvironmentType=eh={}));Ce.EnvironmentCreationTypeConstants={NotSpecified:"NotSpecified",Legacy:"Legacy",DefaultTenant:"DefaultTenant",User:"User",CommonDataModelLegacy:"CommonDataModelLegacy"};Ce.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"};Ce.EnvironmentProvisioningStates={NotSpecified:"NotSpecified",Succeeded:"Succeeded",Deleting:"Deleting",Deleted:"Deleted",FailedDeleting:"FailedDeleting",LinkedDatabaseProvisioning:"LinkedDatabaseProvisioning",LinkedDatabaseFailedProvisioning:"LinkedDatabaseFailedProvisioning",LinkedDatabaseFailedConfiguring:"LinkedDatabaseFailedConfiguring",LinkedDatabaseUnavailable:"LinkedDatabaseUnavailable",Creating:"Creating"};Ce.EnvironmentMigrationConstants={phases:{completed:"Completed"}};var th;(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"})(th||(Ce.EnvironmentDisableReasonCode=th={}));var rh;(function(e){e.LogicApps="LogicApps",e.SelfHostSingleTenant="SelfHostSingleTenant",e.SelfHostMultiTenant="SelfHostMultiTenant"})(rh||(Ce.EnvironmentFlowHostingType=rh={}))});var dh=g(A=>{"use strict";var z1=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 W1=z1(Ym()),oe=nh(),_a=gc();function j1(e){let t=Or(e);return t&&t.version}A.getCrmVersion=j1;function Or(e){return e&&e.properties&&e.properties.linkedEnvironmentMetadata}A.getLinkedEnvironmentMetadata=Or;function Tr(e,t){return e?!!e[t]:!1}A.doesUserHavePermission=Tr;A.crmBapSolutionId="00000001-0000-0000-0001-00000000009b";A.DEFAULT_SOLUTION_ID="fd140aaf-4df4-11dd-bd17-0019b9312238";A.DEFAULT_SOLUTION_UNIQUE_NAME="Default";function Rn(e){return!!Or(e)&&ih(e)}A.environmentHasCds2Database=Rn;function H1(e){if(e&&Rn(e)){let t=en(e);return(0,_a.getCrmAdminSecurityRolesUrl)(t)}return""}A.getSecurityUsersUrl=H1;function Q1(e){if(e&&Rn(e)){let t=en(e);return(0,_a.getCrmAdminSecurityUsersUrl)(t)}return""}A.getSecurityRolesUrl=Q1;function J1(e){if(e&&Rn(e)){let t=en(e);(0,_a.getCrmAllSolutionsUrl)(t)}return""}A.getAllSolutionsUrl=J1;function X1(e){if(e&&Rn(e)){let t=en(e);return(0,_a.getCrmAllPublishersUrl)(t)}return""}A.getAllPublishersUrl=X1;function K1(e){return e&&Rn(e)?en(e):""}A.getAllThemesUrl=K1;function ih(e){return!!e&&e.properties&&!!e.properties.provisioningState&&e.properties.provisioningState.toUpperCase()===oe.EnvironmentProvisioningStates.Succeeded.toUpperCase()}A.isEnvironmentInSuccessfulState=ih;function Y1(e){if(e&&Rn(e)){let t=en(e);return(0,_a.getCrmDevResourcesUrl)(t)}return""}A.getDevResourcesUrl=Y1;function Z1(e){return`${e}designer/app/{${A.crmBapSolutionId}}/CreateNewApp}}`}A.getCrmAppDesignerUrl=Z1;function en(e){let t=Or(e);if(t){let r=t.instanceUrl;return r?r.endsWith("/")?r:r+"/":""}return""}A.getCrmInstanceUrl=en;function eP(e){let t=Or(e);return t?t.uniqueName:""}A.getCrmInstanceName=eP;function tP(e){return Or(e)?oe.EnvironmentType.CDS2:e&&e.properties&&e.properties.namespace?oe.EnvironmentType.CDS1:oe.EnvironmentType.Empty}A.getEnvironmentType=tP;function rP(e){return e&&e.properties&&e.properties.environmentSku===oe.EnvironmentSkuConstants.Developer}A.isDevEnvironment=rP;function nP(e){return e&&e.properties&&e.properties.environmentSku===oe.EnvironmentSkuConstants.Production}A.isProdEnvironment=nP;function iP(e){return e&&e.properties&&e.properties.environmentSku===oe.EnvironmentSkuConstants.Sandbox}A.isSandboxEnvironment=iP;function Pa(e){return e&&e.properties&&e.properties.environmentSku===oe.EnvironmentSkuConstants.Teams}A.isTeamsEnvironment=Pa;function aP(e){return e&&e.properties&&e.properties.environmentSku===oe.EnvironmentSkuConstants.Platform}A.isPlatformEnvironment=aP;var oP=e=>{var t;return((t=e.properties)===null||t===void 0?void 0:t.environmentSku)===oe.EnvironmentSkuConstants.Trial};A.isTrialEnvironment=oP;function sP(e){return e&&e.properties&&(e.properties.isDefault||e.properties.creationType===oe.EnvironmentCreationTypeConstants.DefaultTenant)}A.isDefaultEnvironment=sP;function lP(e){return e&&e.properties&&!!e.properties.states&&!!e.properties.states.runtime&&e.properties.states.runtime.id==="Disabled"}A.isDisabledEnvironment=lP;function uP(e){return e&&e.properties&&Tr(e.properties.permissions,oe.environmentPermissions.CreateDatabase)}A.canUserCreateDatabase=uP;function cP(e){return!!(e&&e.properties&&e.properties.provisioningState&&ch(e.properties.provisioningState,oe.EnvironmentProvisioningStates.LinkedDatabaseProvisioning))}A.isDatabaseInProvisioningState=cP;function dP(e){return!!e&&!!e.properties&&e.properties.provisioningState===oe.EnvironmentProvisioningStates.Creating}A.isEnvironmentInCreatingState=dP;function pP(e){return e&&e.properties&&(e.properties.provisioningState===oe.EnvironmentProvisioningStates.Deleted||e.properties.provisioningState===oe.EnvironmentProvisioningStates.Deleting||e.properties.provisioningState===oe.EnvironmentProvisioningStates.FailedDeleting)}A.isEnvironmentInDeletedState=pP;function fP(e){return!!e&&!!e.properties&&!!e.properties.expirationTime&&Date.parse(e.properties.expirationTime)<Date.now()}A.isEnvironmentExpired=fP;function mP(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=mP;function hP(e){return!!e&&!!e.properties&&!!e.properties.cluster&&e.properties.cluster.category==="Test"}A.isEnvironmentInTestCluster=hP;function gP(e){return!!e&&!!e.properties&&!!e.properties.cluster&&e.properties.cluster.category==="Preprod"}A.isEnvironmentInPreprodCluster=gP;function vP(e){return!!e&&!!e.properties&&!!e.properties.cluster&&e.properties.cluster.category==="FirstRelease"}A.isEnvironmentInFirstReleaseCluster=vP;function bP(e){return e&&e.name||""}A.getEnvironmentName=bP;function yP(e){return e&&e.properties&&e.properties.displayName||""}A.getEnvironmentDisplayName=yP;var ah="9.1.0.8202";A.cdsVersionSupportingOSColorEdit="9.1.0000.20708";function wP(e){return lh(e,ah)}A.doesCds2EnvironmentSupportApiVersion9_1=wP;function AP(e){return hc(e,ah)}A.doesCds2VersionSupportApiVersion9_1=AP;function oh(e){let t=Or(e);if(t)return t.securityGroupId}function sh(e){return e&&e.properties&&e.properties.connectedGroups}function CP(e,t){let r=sh(e);return!!r&&!!r.find(n=>n.id===t)||oh(e)===t}A.hasSecurityGroupId=CP;function SP(e){let t=sh(e);return t&&t.length>0&&t[0].id?t[0].id:oh(e)}A.getSecurityOrConnectedGroupId=SP;function lh(e,t){let r=e.version;return r?hc(r,t):!1}A.isCds2EnvironmentVersionAtLeast=lh;function hc(e,t){return t?e?(0,W1.default)(e,t)>=0:!1:!0}A.checkVersions=hc;function NP(e){return e&&e.properties&&e.properties.updateCadence&&e.properties.updateCadence.id||"NotSpecified"}A.getEnvironmentUpdateCadence=NP;function EP(e){let t=Or(e);return t?Number(t.baseLanguage):0}A.getEnvironmentLanguageCode=EP;function uh(e){let t=Or(e);return t?t.instanceApiUrl:void 0}A.getEnvironmentInstanceApiUrl=uh;function DP(e){let t=uh(e);return t?t+"/api/data/v9.2":""}A.getEnvironmentWebApiUrl=DP;function IP(e){let t=en(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=IP;var _P=e=>{var t;return((t=e.properties)===null||t===void 0?void 0:t.databaseType)===oe.DatabaseType.CommonDataService};A.hasCommonDataServiceDatabase=_P;var PP=e=>{var t;return Tr((t=e.properties)===null||t===void 0?void 0:t.permissions,oe.environmentPermissions.AdminReadEnvironment)};A.doesUserHaveAdminPermission=PP;var TP=e=>{var t;return Tr((t=e.properties)===null||t===void 0?void 0:t.permissions,oe.environmentPermissions.CreatePowerApp)};A.doesUserHaveCreateAppPermission=TP;var OP=e=>(0,A.doesUserHaveAdminPermission)(e)&&(0,A.hasCommonDataServiceDatabase)(e)?!0:(0,A.doesUserHaveCreateAppPermission)(e)?Pa(e)||(0,A.doesUserHaveDatabaseTablePermissions)(e):!1;A.isUserMakerWithDataAccess=OP;var RP=e=>(0,A.doesUserHaveCreateAppPermission)(e)&&!Pa(e)&&!(0,A.doesUserHaveDatabaseTablePermissions)(e)&&(!(0,A.doesUserHaveAdminPermission)(e)||!(0,A.hasCommonDataServiceDatabase)(e));A.isUserMakerWithoutDataAccess=RP;var xP=e=>[oe.environmentPermissions.CreateDatabaseEntities,oe.environmentPermissions.ListDatabaseEntities,oe.environmentPermissions.UpdateDatabaseEntities,oe.environmentPermissions.DeleteDatabaseEntities].every(t=>{var r;return Tr((r=e.properties)===null||r===void 0?void 0:r.permissions,t)});A.doesUserHaveDatabaseTablePermissions=xP;var FP=e=>{var t;return Tr((t=e.properties)===null||t===void 0?void 0:t.permissions,oe.environmentPermissions.CreateDatabase)};A.doesUserHaveCreateDatabasePermission=FP;function ch(e,t){return!e&&!t?!0:!e||!t?!1:e.toUpperCase()===t.toUpperCase()}A.equalsIgnoreCase=ch;var LP=e=>{var t;return Tr((t=e.properties)===null||t===void 0?void 0:t.permissions,oe.environmentPermissions.CreateFlow)};A.doesUserHaveCreateFlowPermission=LP;var kP=e=>(0,A.doesUserHaveAdminPermission)(e)&&(0,A.hasCommonDataServiceDatabase)(e)?!0:(0,A.doesUserHaveCreateFlowPermission)(e)?Pa(e)||(0,A.doesUserHaveDatabaseTablePermissions)(e):!1;A.isUserPautoMakerWithDataAccess=kP;var MP=e=>(0,A.doesUserHaveCreateFlowPermission)(e)&&!Pa(e)&&!(0,A.doesUserHaveDatabaseTablePermissions)(e)&&(!(0,A.doesUserHaveAdminPermission)(e)||!(0,A.hasCommonDataServiceDatabase)(e));A.isUserPautoMakerWithoutDataAccess=MP;var UP=e=>{var t,r;return!Tr((t=e.properties)===null||t===void 0?void 0:t.permissions,oe.environmentPermissions.CreateFlow)&&Tr((r=e.properties)===null||r===void 0?void 0:r.permissions,oe.environmentPermissions.ReadEnvironment)};A.doesUserHaveFlowRunOnlyPermission=UP});var gc=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 ph=dh();b.ODATA_MAX_PAGE_SIZE="odata.maxpagesize";b.ODATA_NEXT_LINK="@odata.nextLink";b.cdsServiceUrl="https://cds-org/";var Oa;(function(e){e.AllSolutions="11",e.AllPublishers="10",e.DevResources="05"})(Oa||(Oa={}));function BP(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=BP;function $P(e,t){let r=`dType=1&isproactivecheck=true&objecttype=7100&operationtype=dependenciesforuninstall&objectid=${t}`;return`${e}tools/dependency/dependencyviewdialog.aspx?${r}`}b.getShowSolutionDependenciesUrl=$P;function qP(e,t){return`${e}tools/muiProvisioning/Dialogs/LangTranslationsImport.aspx?dType=1&appSolutionId=${t}`}b.getImportSolutionTranslationUrl=qP;function VP(e,t){return`${e}_grid/cmds/dlg_exportsolution.aspx?command=exporttranslation&appSolutionId=${t}`}b.getExportSolutionTranslationUrl=VP;function GP(e,t){return e!==void 0&&t!==void 0&&`CrmTranslations_${e}_${t.replace(/[.]/g,"_")}.zip`||""}b.getExportTranslationFileName=GP;function zP(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=zP;function vc(e,t){return`${e}tools/systemcustomization/systemCustomization.aspx?pid=${t}`}function WP(e){return vc(e,Oa.AllSolutions)}b.getCrmAllSolutionsUrl=WP;function jP(e){return vc(e,Oa.AllPublishers)}b.getCrmAllPublishersUrl=jP;function HP(e){return vc(e,Oa.DevResources)}b.getCrmDevResourcesUrl=HP;function QP(e,t=ph.crmBapSolutionId){return`${e}designer/app/${t}#/CreateNewApp`}b.getCrmAppDesignerUrl=QP;function JP(e){return`${e}apps`}b.getCrmMyAppsUrl=JP;function XP(e){return fh(e,"role")+"&forceUCI=0"}b.getCrmAdminSecurityRolesUrl=XP;function KP(e){return`${fh(e,"systemuser")}&forceclassic=1`}b.getCrmAdminSecurityUsersUrl=KP;function fh(e,t){return`${e}main.aspx?pagetype=entitylist&etn=${t}`}function YP(e,t){return`${e}main.aspx?appid=${t}`}b.getPlayAppModuleUrl=YP;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 ZP(e,t,r=ph.crmBapSolutionId){return`${e}designer/app/${r}/${t}/AppDesignerCanvas/${t}`}b.getAppModuleDesignerUrl=ZP;function eT(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=eT;function tT(e,t,r){return`/e/${e}/s/${t}/dashboard/${r}`}b.getOpenModernDashboardUrl=tT;function rT(e,t,r){let n=r!==void 0?r.toString():void 0;return`/e/${e}/s/${t}/dashboard/new${n?`/${n}`:""}`}b.getNewModernDashboardUrl=rT;function nT(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=nT;function iT(e,t,r,n){return`/e/${e}/s/${t}/n/${r}/dashboard/${n}`}b.getOpenModernEntityDashboardUrl=iT;function aT(e,t,r,n){return`${e}main.aspx?appSolutionId=%7b${t}%7d&extraqs=etc=${r||""}`+(n?`%26id=${n}`:"")+"&pagetype=vizdesigner"}b.getChartDesignerUrl=aT;function oT(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=oT;function sT(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=sT;function lT(e,t){return`${e}Tools/ProcessControl/UnifiedProcessDesigner.aspx?id=${t}`}b.getBusinessProcessFlowDesignerUrl=lT;function uT(e,t,r){return`${e}CRMReports/reportproperty.aspx?appSolutionId=%7b${r}%7d&disablePersonal=true&id=%7b${t}%7d`}b.getReportDesignerUrl=uT;function cT(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=cT;function dT(e,t){return`${e}WebResources/${t}`}b.getWebResourceFileUrl=dT;function pT(e,t,r){return`${e}designer/sitemap/${r}/${t}/SiteMapHome/${t}`}b.getSiteMapDesignerUrl=pT;function fT(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=fT;function mT(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=mT;function hT(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=hT;function gT(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=gT;function vT(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=vT;function bT(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=bT;function yT(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=yT;function wT(e){return`${e}tools/publisher/edit.aspx`}b.getCreateNewPublisherUrl=wT;function AT(e,t){return`${e}tools/kbtemplateeditor/kbtemplateeditor.aspx?appSolutionId=${t}`}b.getCreateNewArticleTemplateUrl=AT;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 CT(e,t){return`${b.xrmApiUrl}/RetrieveRequiredComponents(ObjectId=${e},ComponentType=${t})`}b.getRequiredComponentsQueryUrl=CT;function ST(e,t){return`${b.cdsServiceUrl}${b.xrmApiUrl}/RetrieveDependentComponentsWithMetadata(ObjectId=${e},ComponentType=${t})`}b.getDependentComponentsWithMetadataQueryUrl=ST;b.solutionsQueryUrl="/api/data/v9.0/solutions?$expand=publisherid&$filter=(isvisible eq true)";function NT(e){return`/api/data/v9.0/solutions?$expand=publisherid&$filter=(uniquename eq '${e}')`}b.getSolutionsByUniqueNameQueryUrl=NT;function ET(e){return`/api/data/v9.0/solutions(${e})?$expand=publisherid`}b.getSolutionQueryUrl=ET;function DT(e){return`${e}api/data/v9.1/ProvisionLanguageForUser`}b.getProvisionLanguageUrl=DT;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 IT(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=uc;var cc=class extends Ye{constructor(t){super("INVALID_ARGUMENT",t)}};Y.InvalidArgumentError=cc;var dc=class extends Ye{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=dc;var pc=class extends Ye{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=pc;var fc=class extends Ye{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=fc;var mc=class extends Ye{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=mc;var hc=class extends Ye{constructor(t){super("WORKSPACE_NOT_INITIALIZED",`Workspace not initialized at ${t}. Call initWorkspace() first.`),this.workspacePath=t}};Y.WorkspaceNotInitializedError=hc;var gc=class extends Ye{constructor(t,r){super("NOT_IMPLEMENTED",`Operation '${t}' is not implemented yet${r?`: ${r}`:""}.`),this.operation=t}};Y.NotImplementedError=gc;var vc=class extends Ye{constructor(t,r){super("INVALID_JSON_POINTER",`Invalid JSON Pointer '${t}': ${r}`),this.pointer=t}};Y.JsonPointerError=vc;var yc=class extends Ye{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=yc;var bc=class extends Ye{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=bc;var wc=class extends Ye{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=wc});var ee=g(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 ps=ie();function vg(e){return String(e??"").replace(/'/g,"''")}Oe.odataLiteral=vg;function mP(e){return encodeURIComponent(vg(e))}Oe.odataPathLiteral=mP;function hP(e){return String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}Oe.xmlText=hP;function yg(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 ps.InvalidArgumentError(`${t} must be a valid XML element name (got '${e}')`);return e}Oe.assertXmlName=yg;function gP(e,t){let r=String(e??"");if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(r))throw new ps.InvalidArgumentError(`${t} must be a valid OData identifier (letters, digits, underscore): got '${e}'`);return e}Oe.assertODataName=gP;function vP(e,t){if(/[\u0000-\u001F\u007F]/.test(String(e??"")))throw new ps.InvalidArgumentError(`${t} must not contain control characters (including CR/LF): they would inject additional lines into the request`);return e}Oe.assertNoControlChars=vP;function yP(e,t,r){return e.createElement(yg(t,r))}Oe.createSafeXmlElement=yP;var bP=/^[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 wP(e,t){let r=String(e??""),n=r.length===38&&r.startsWith("{")&&r.endsWith("}")?r.slice(1,-1):r;if(!bP.test(n))throw new ps.InvalidArgumentError(`${t} must be a valid GUID (got '${e}')`);return n.toLowerCase()}Oe.normalizeGuid=wP;function AP(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=AP});var ye=g(te=>{"use strict";Object.defineProperty(te,"__esModule",{value:!0});te.nowIso=te.isAlreadyDeleted=te.deleteRecord=te.ensureSuccess=te.resolveCreatedId=te.requireCreatedId=te.withClientMintedId=te.readCreatedId=te.readEtag=te.requireEtag=te.echoWrite=te.UPDATE_NO_ETAG_CODE=te.VERSION_CONFLICT_CODE=void 0;var pi=ie(),Fa=ee();te.VERSION_CONFLICT_CODE="VERSION_CONFLICT";te.UPDATE_NO_ETAG_CODE="ARTIFACT_UPDATE_NO_ETAG";function CP(e,t){return{query:`?$select=${encodeURIComponent(e)}`,options:{headers:{...t??{},Prefer:"return=representation"}}}}te.echoWrite=CP;function SP(e,t,r){if(!e)throw new pi.SdkError(te.UPDATE_NO_ETAG_CODE,`Refusing to push ${t} '${r}': no concurrency token is held for it, so the write could not be made conditional and would silently overwrite a concurrent edit. Re-fetch the ${t} and re-apply the change.`);return e}te.requireEtag=SP;function EP(e){var t;let r=(t=e.headers)!==null&&t!==void 0?t:{};for(let i of Object.keys(r))if(i.toLowerCase()==="etag")return r[i];let n=e.body;return n&&typeof n["@odata.etag"]=="string"?n["@odata.etag"]:null}te.readEtag=EP;function Ac(e,t){var r;let n=e.body;if(n&&typeof n[t]=="string")return(0,Fa.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,Fa.normalizeGuid)(o[1],t)}return null}te.readCreatedId=Ac;function NP(e,t,r){return r?{...e,[t]:(0,Fa.normalizeGuid)(r,t)}:e}te.withClientMintedId=NP;function DP(e,t,r){let n=Ac(e,t);if(!n)throw new pi.InvalidArgumentError(`Dataverse did not return an id for the created ${r}`);return n}te.requireCreatedId=DP;function IP(e,t,r,n){let i=Ac(e,t);if(i)return i;if(n)return(0,Fa.normalizeGuid)(n,t);throw new pi.InvalidArgumentError(`Dataverse did not return an id for the created ${r}`)}te.resolveCreatedId=IP;function bg(e,t){if(e.status===412)throw new pi.SdkError(te.VERSION_CONFLICT_CODE,`Version conflict (412) from ${t}`);if(e.status<200||e.status>=300)throw new pi.ConnectionError(t,e.status,_P(e.body),e.body);return e}te.ensureSuccess=bg;function _P(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 PP(e,t,r,n){let i=(0,Fa.normalizeGuid)(r,"id"),a=`/${t}(${i})`;bg(await e.delete(a,n?{headers:{"If-Match":n}}:void 0),e.apiUrl(a))}te.deleteRecord=PP;function TP(e){return e instanceof pi.ConnectionError&&e.statusCode===404}te.isAlreadyDeleted=TP;function OP(){return new Date().toISOString()}te.nowIso=OP});var Kt=g(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0});fi.describeMalformedValue=fi.collectPages=void 0;var wg=ye(),Cc=ie();async function RP(e,t,r){let n=[],i=new Set,a=e.apiUrl(t),o=(0,wg.ensureSuccess)(await e.get(t),a);for(;;){let s=o.body,l=s?.value;if(!Array.isArray(l))throw new Cc.ConnectionError(a,o.status,`${r}: paginated read returned a malformed page \u2014 expected an OData 'value' array but got ${Sc(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 Cc.ConnectionError(a,o.status,`${r}: paginated read returned a malformed @odata.nextLink (${Sc(u)}); cannot follow it, and refusing to return partial results.`);if(i.has(u))throw new Cc.InvalidArgumentError(`${r}: aborting pagination \u2014 the server returned a repeated @odata.nextLink ('${u}'), which would loop indefinitely.`);i.add(u),a=u,o=(0,wg.ensureSuccess)(await e.getAbsolute(u),u)}return n}fi.collectPages=RP;function Sc(e){return e===null?"null":e===void 0?"undefined (missing)":`a ${typeof e}`}fi.describeMalformedValue=Sc});var Ec=g(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.businessRuleApi=lr.BUSINESS_RULE_LEFT_DEACTIVATED_CODE=lr.WFOM_API_UNAVAILABLE_CODE=void 0;var xr=Mn(),FP=Kt(),Ze=ye(),an=ee(),ms=ie();lr.WFOM_API_UNAVAILABLE_CODE="BUSINESS_RULE_API_UNAVAILABLE";lr.BUSINESS_RULE_LEFT_DEACTIVATED_CODE="BUSINESS_RULE_LEFT_DEACTIVATED";async function Ag(e,t,r,n){let i=`/workflows(${kP})/Microsoft.Dynamics.CRM.${t}`;try{return(0,Ze.ensureSuccess)(await e.post(i,{Entity:r.Entity,WfomJson:r.WfomJson},{headers:n}),e.apiUrl(i))}catch(a){throw a?.statusCode!==404?a:new ms.SdkError(lr.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 xP(e,t){let r=`/workflows(${t})${(0,an.odataQuery)([["$select","workflowid,statecode,statuscode"]])}`;try{let n=await e.get(r);if(n.status<200||n.status>=300)return null;let i=n.body;return{etag:(0,Ze.readEtag)(n),statecode:typeof i?.statecode=="number"?i.statecode:null,statuscode:typeof i?.statuscode=="number"?i.statuscode:null}}catch{return null}}async function LP(e,t,r){let n=await xP(e,t);if(n===null||n.etag===null)throw new ms.SdkError(Ze.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 ms.SdkError(Ze.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 kP="00000000-0000-0000-0000-000000000000",fs={"Content-Type":"application/json",Accept:"application/json","OData-Version":"4.0","OData-MaxVersion":"4.0"},MP="workflowid,name,description,primaryentity,statecode,category,type",UP="category eq 2 and type eq 1";async function Cg(e,t,r){var n;if(r==="Draft")return null;let i=(0,an.normalizeGuid)(t,"workflowid"),a=r==="Active",o={statecode:a?xr.StateCode.Activated:xr.StateCode.Draft,statuscode:a?xr.StatusCode.Activated:xr.StatusCode.Draft},s=`/workflows(${i})`,l=(0,Ze.ensureSuccess)(await e.patch(s,o,{headers:fs}),e.apiUrl(s));return(n=(0,Ze.readEtag)(l))!==null&&n!==void 0?n:await xa(e,i)}async function xa(e,t){let r=`/workflows(${t})${(0,an.odataQuery)([["$select","workflowid"]])}`;try{let n=await e.get(r);return n.status>=200&&n.status<300?(0,Ze.readEtag)(n):null}catch{return null}}async function BP(e,t,r){let n=await xa(e,t),i=await r(),a=(0,Ze.readEtag)(i);if(a)return{response:i,etag:a};let o=await xa(e,t);return{response:i,etag:n!==null&&n===o?o:null}}lr.businessRuleApi={async get(e,t){let r=(0,an.normalizeGuid)(t,"id"),n=`/workflows(${r})/Microsoft.Dynamics.CRM.RetrieveProcessWithWfomJson`,{response:i,etag:a}=await BP(e,r,async()=>(0,Ze.ensureSuccess)(await e.get(n),e.apiUrl(n)));return{raw:i.body,etag:a}},async list(e,t){let r=[UP];t?.entityLogicalName&&r.push(`primaryentity eq '${(0,an.odataLiteral)(t.entityLogicalName)}'`);let n=`/workflows${(0,an.odataQuery)([["$select",MP],["$filter",r.join(" and ")]])}`;return(await(0,FP.collectPages)(e,n,"listArtifacts('businessRule')")).map(a=>{var o,s;return{type:"businessRule",id:(o=a.workflowid)!==null&&o!==void 0?o:"",name:(s=a.name)!==null&&s!==void 0?s:"",entityLogicalName:a.primaryentity,isDirty:!1}})},async create(e,t){var r;let n=t,i=(0,an.normalizeGuid)(n.Entity.workflowid,"workflowid"),a=await Ag(e,"CreateProcessWithWfomJson",n,fs),o=(0,Ze.resolveCreatedId)(a,"workflowid","business rule",i),s=null;try{s=await Cg(e,o,n.status)}catch(l){try{await(0,Ze.deleteRecord)(e,"workflows",o)}catch{}throw l}return{id:o,etag:(r=s??(0,Ze.readEtag)(a))!==null&&r!==void 0?r:await xa(e,o)}},async update(e,t,r,n){var i,a;let o=r,s=(0,an.normalizeGuid)(t,"id"),l=`/workflows(${s})`,u={...fs,"If-Match":(0,Ze.requireEtag)(n,"business rule",s)},c=await LP(e,s,u["If-Match"]),d=c.statecode===xr.StateCode.Activated;d&&(0,Ze.ensureSuccess)(await e.patch(l,{statecode:xr.StateCode.Draft,statuscode:xr.StatusCode.Draft},{headers:u}),e.apiUrl(l));let p;try{p=await Ag(e,"UpdateProcessWithWfomJson",o,u)}catch(h){if(d)try{(0,Ze.ensureSuccess)(await e.patch(l,{statecode:xr.StateCode.Activated,statuscode:(i=c.statuscode)!==null&&i!==void 0?i:xr.StatusCode.Activated},{headers:fs}),e.apiUrl(l))}catch(w){throw new ms.SdkError(lr.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: ${w instanceof Error?w.message:String(w)}`)}throw h}let m=await Cg(e,s,o.status);return{id:s,etag:(a=m??(0,Ze.readEtag)(p))!==null&&a!==void 0?a:await xa(e,s)}},delete(e,t){return(0,Ze.deleteRecord)(e,"workflows",t)}}});var Sg=g(Nc=>{"use strict";Object.defineProperty(Nc,"__esModule",{value:!0});Nc.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var Eg=g(Dc=>{"use strict";Object.defineProperty(Dc,"__esModule",{value:!0});Dc.default="00000000-0000-0000-0000-000000000000"});var Ng=g(Ic=>{"use strict";Object.defineProperty(Ic,"__esModule",{value:!0});Ic.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i});var La=g(_c=>{"use strict";Object.defineProperty(_c,"__esModule",{value:!0});var $P=Ng();function qP(e){return typeof e=="string"&&$P.default.test(e)}_c.default=qP});var ka=g(Pc=>{"use strict";Object.defineProperty(Pc,"__esModule",{value:!0});var VP=La();function GP(e){if(!(0,VP.default)(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}Pc.default=GP});var Lr=g(Ma=>{"use strict";Object.defineProperty(Ma,"__esModule",{value:!0});Ma.unsafeStringify=void 0;var zP=La(),et=[];for(let e=0;e<256;++e)et.push((e+256).toString(16).slice(1));function Dg(e,t=0){return(et[e[t+0]]+et[e[t+1]]+et[e[t+2]]+et[e[t+3]]+"-"+et[e[t+4]]+et[e[t+5]]+"-"+et[e[t+6]]+et[e[t+7]]+"-"+et[e[t+8]]+et[e[t+9]]+"-"+et[e[t+10]]+et[e[t+11]]+et[e[t+12]]+et[e[t+13]]+et[e[t+14]]+et[e[t+15]]).toLowerCase()}Ma.unsafeStringify=Dg;function WP(e,t=0){let r=Dg(e,t);if(!(0,zP.default)(r))throw TypeError("Stringified UUID is invalid");return r}Ma.default=WP});var vs=g(Tc=>{"use strict";Object.defineProperty(Tc,"__esModule",{value:!0});var jP=require("crypto"),gs=new Uint8Array(256),hs=gs.length;function HP(){return hs>gs.length-16&&((0,jP.randomFillSync)(gs),hs=0),gs.slice(hs,hs+=16)}Tc.default=HP});var Oc=g(Ba=>{"use strict";Object.defineProperty(Ba,"__esModule",{value:!0});Ba.updateV1State=void 0;var Ig=vs(),JP=Lr(),Ua={};function QP(e,t,r){let n,i=e?._v6??!1;if(e){let a=Object.keys(e);a.length===1&&a[0]==="_v6"&&(e=void 0)}if(e)n=_g(e.random??e.rng?.()??(0,Ig.default)(),e.msecs,e.nsecs,e.clockseq,e.node,t,r);else{let a=Date.now(),o=(0,Ig.default)();Pg(Ua,a,o),n=_g(o,Ua.msecs,Ua.nsecs,i?void 0:Ua.clockseq,i?void 0:Ua.node,t,r)}return t??(0,JP.unsafeStringify)(n)}function Pg(e,t,r){return e.msecs??=-1/0,e.nsecs??=0,t===e.msecs?(e.nsecs++,e.nsecs>=1e4&&(e.node=void 0,e.nsecs=0)):t>e.msecs?e.nsecs=0:t<e.msecs&&(e.node=void 0),e.node||(e.node=r.slice(10,16),e.node[0]|=1,e.clockseq=(r[8]<<8|r[9])&16383),e.msecs=t,e}Ba.updateV1State=Pg;function _g(e,t,r,n,i,a,o=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(!a)a=new Uint8Array(16),o=0;else if(o<0||o+16>a.length)throw new RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`);t??=Date.now(),r??=0,n??=(e[8]<<8|e[9])&16383,i??=e.slice(10,16),t+=122192928e5;let s=((t&268435455)*1e4+r)%4294967296;a[o++]=s>>>24&255,a[o++]=s>>>16&255,a[o++]=s>>>8&255,a[o++]=s&255;let l=t/4294967296*1e4&268435455;a[o++]=l>>>8&255,a[o++]=l&255,a[o++]=l>>>24&15|16,a[o++]=l>>>16&255,a[o++]=n>>>8|128,a[o++]=n&255;for(let u=0;u<6;++u)a[o++]=i[u];return a}Ba.default=QP});var Fc=g(Rc=>{"use strict";Object.defineProperty(Rc,"__esModule",{value:!0});var XP=ka(),KP=Lr();function YP(e){let t=typeof e=="string"?(0,XP.default)(e):e,r=ZP(t);return typeof e=="string"?(0,KP.unsafeStringify)(r):r}Rc.default=YP;function ZP(e){return Uint8Array.of((e[6]&15)<<4|e[7]>>4&15,(e[7]&15)<<4|(e[4]&240)>>4,(e[4]&15)<<4|(e[5]&240)>>4,(e[5]&15)<<4|(e[0]&240)>>4,(e[0]&15)<<4|(e[1]&240)>>4,(e[1]&15)<<4|(e[2]&240)>>4,96|e[2]&15,e[3],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}});var Tg=g(xc=>{"use strict";Object.defineProperty(xc,"__esModule",{value:!0});var eT=require("crypto");function tT(e){return Array.isArray(e)?e=Buffer.from(e):typeof e=="string"&&(e=Buffer.from(e,"utf8")),(0,eT.createHash)("md5").update(e).digest()}xc.default=tT});var $a=g(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.URL=kr.DNS=kr.stringToBytes=void 0;var Og=ka(),rT=Lr();function Rg(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t}kr.stringToBytes=Rg;kr.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";kr.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function nT(e,t,r,n,i,a){let o=typeof r=="string"?Rg(r):r,s=typeof n=="string"?(0,Og.default)(n):n;if(typeof n=="string"&&(n=(0,Og.default)(n)),n?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let l=new Uint8Array(16+o.length);if(l.set(s),l.set(o,s.length),l=t(l),l[6]=l[6]&15|e,l[8]=l[8]&63|128,i){if(a=a||0,a<0||a+16>i.length)throw new RangeError(`UUID byte range ${a}:${a+15} is out of buffer bounds`);for(let u=0;u<16;++u)i[a+u]=l[u];return i}return(0,rT.unsafeStringify)(l)}kr.default=nT});var xg=g(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.URL=Un.DNS=void 0;var iT=Tg(),Lc=$a(),Fg=$a();Object.defineProperty(Un,"DNS",{enumerable:!0,get:function(){return Fg.DNS}});Object.defineProperty(Un,"URL",{enumerable:!0,get:function(){return Fg.URL}});function kc(e,t,r,n){return(0,Lc.default)(48,iT.default,e,t,r,n)}kc.DNS=Lc.DNS;kc.URL=Lc.URL;Un.default=kc});var Lg=g(Mc=>{"use strict";Object.defineProperty(Mc,"__esModule",{value:!0});var aT=require("crypto");Mc.default={randomUUID:aT.randomUUID}});var Mg=g(Uc=>{"use strict";Object.defineProperty(Uc,"__esModule",{value:!0});var kg=Lg(),oT=vs(),sT=Lr();function lT(e,t,r){if(kg.default.randomUUID&&!t&&!e)return kg.default.randomUUID();e=e||{};let n=e.random??e.rng?.()??(0,oT.default)();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return(0,sT.unsafeStringify)(n)}Uc.default=lT});var Ug=g(Bc=>{"use strict";Object.defineProperty(Bc,"__esModule",{value:!0});var uT=require("crypto");function cT(e){return Array.isArray(e)?e=Buffer.from(e):typeof e=="string"&&(e=Buffer.from(e,"utf8")),(0,uT.createHash)("sha1").update(e).digest()}Bc.default=cT});var $g=g(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.URL=Bn.DNS=void 0;var dT=Ug(),$c=$a(),Bg=$a();Object.defineProperty(Bn,"DNS",{enumerable:!0,get:function(){return Bg.DNS}});Object.defineProperty(Bn,"URL",{enumerable:!0,get:function(){return Bg.URL}});function qc(e,t,r,n){return(0,$c.default)(80,dT.default,e,t,r,n)}qc.DNS=$c.DNS;qc.URL=$c.URL;Bn.default=qc});var qg=g(Vc=>{"use strict";Object.defineProperty(Vc,"__esModule",{value:!0});var pT=Lr(),fT=Oc(),mT=Fc();function hT(e,t,r){e??={},r??=0;let n=(0,fT.default)({...e,_v6:!0},new Uint8Array(16));if(n=(0,mT.default)(n),t){if(r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;i++)t[r+i]=n[i];return t}return(0,pT.unsafeStringify)(n)}Vc.default=hT});var Vg=g(Gc=>{"use strict";Object.defineProperty(Gc,"__esModule",{value:!0});var gT=ka(),vT=Lr();function yT(e){let t=typeof e=="string"?(0,gT.default)(e):e,r=bT(t);return typeof e=="string"?(0,vT.unsafeStringify)(r):r}Gc.default=yT;function bT(e){return Uint8Array.of((e[3]&15)<<4|e[4]>>4&15,(e[4]&15)<<4|(e[5]&240)>>4,(e[5]&15)<<4|e[6]&15,e[7],(e[1]&15)<<4|(e[2]&240)>>4,(e[2]&15)<<4|(e[3]&240)>>4,16|(e[0]&240)>>4,(e[0]&15)<<4|(e[1]&240)>>4,e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}});var jg=g(qa=>{"use strict";Object.defineProperty(qa,"__esModule",{value:!0});qa.updateV7State=void 0;var Gg=vs(),wT=Lr(),zc={};function AT(e,t,r){let n;if(e)n=zg(e.random??e.rng?.()??(0,Gg.default)(),e.msecs,e.seq,t,r);else{let i=Date.now(),a=(0,Gg.default)();Wg(zc,i,a),n=zg(a,zc.msecs,zc.seq,t,r)}return t??(0,wT.unsafeStringify)(n)}function Wg(e,t,r){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=r[6]<<23|r[7]<<16|r[8]<<8|r[9],e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}qa.updateV7State=Wg;function zg(e,t,r,n,i=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(!n)n=new Uint8Array(16),i=0;else if(i<0||i+16>n.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),r??=e[6]*127<<24|e[7]<<16|e[8]<<8|e[9],n[i++]=t/1099511627776&255,n[i++]=t/4294967296&255,n[i++]=t/16777216&255,n[i++]=t/65536&255,n[i++]=t/256&255,n[i++]=t&255,n[i++]=112|r>>>28&15,n[i++]=r>>>20&255,n[i++]=128|r>>>14&63,n[i++]=r>>>6&255,n[i++]=r<<2&255|e[10]&3,n[i++]=e[11],n[i++]=e[12],n[i++]=e[13],n[i++]=e[14],n[i++]=e[15],n}qa.default=AT});var Hg=g(Wc=>{"use strict";Object.defineProperty(Wc,"__esModule",{value:!0});var CT=La();function ST(e){if(!(0,CT.default)(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)}Wc.default=ST});var ys=g(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.version=re.validate=re.v7=re.v6ToV1=re.v6=re.v5=re.v4=re.v3=re.v1ToV6=re.v1=re.stringify=re.parse=re.NIL=re.MAX=void 0;var ET=Sg();Object.defineProperty(re,"MAX",{enumerable:!0,get:function(){return ET.default}});var NT=Eg();Object.defineProperty(re,"NIL",{enumerable:!0,get:function(){return NT.default}});var DT=ka();Object.defineProperty(re,"parse",{enumerable:!0,get:function(){return DT.default}});var IT=Lr();Object.defineProperty(re,"stringify",{enumerable:!0,get:function(){return IT.default}});var _T=Oc();Object.defineProperty(re,"v1",{enumerable:!0,get:function(){return _T.default}});var PT=Fc();Object.defineProperty(re,"v1ToV6",{enumerable:!0,get:function(){return PT.default}});var TT=xg();Object.defineProperty(re,"v3",{enumerable:!0,get:function(){return TT.default}});var OT=Mg();Object.defineProperty(re,"v4",{enumerable:!0,get:function(){return OT.default}});var RT=$g();Object.defineProperty(re,"v5",{enumerable:!0,get:function(){return RT.default}});var FT=qg();Object.defineProperty(re,"v6",{enumerable:!0,get:function(){return FT.default}});var xT=Vg();Object.defineProperty(re,"v6ToV1",{enumerable:!0,get:function(){return xT.default}});var LT=jg();Object.defineProperty(re,"v7",{enumerable:!0,get:function(){return LT.default}});var kT=La();Object.defineProperty(re,"validate",{enumerable:!0,get:function(){return kT.default}});var MT=Hg();Object.defineProperty(re,"version",{enumerable:!0,get:function(){return MT.default}})});function bs(e,t){return e==="SetFieldValue"&&t!==void 0&&UT.has(t.attributeType)&&(t.requiredLevel==="None"||t.requiredLevel==="Recommended")}var UT,jc=I(()=>{"use strict";UT=new Set(["Integer","Double","Decimal","Money","String","Memo","DateTime","Picklist","Lookup"])});function Jg(e){return e!=="Entity"&&e!=="AllForms"&&typeof e=="string"&&e.trim()!==""}function Hc(e){return Jg(e)?1:2}function Jc(e){return Jg(e)?e:void 0}function Qg(e,t){let r=Jc(e.scope);return{"@odata.type":"#Microsoft.Dynamics.CRM.workflow",name:e.name,description:e.description,workflowid:t,ondemand:!1,subprocess:!1,triggeroncreate:!1,triggerondelete:!1,category:mi.WorkflowCategory.BusinessRule,type:mi.WorkflowTypeCode.Definition,mode:1,scope:mi.WorkflowScope.Organization,primaryentity:e.entityLogicalName,iscrmuiworkflow:!0,processtriggerscope:Hc(e.scope),...r!==void 0?{processtriggerformid:r}:{}}}var mi,Xg=I(()=>{"use strict";mi=se(Mn());});function Kg(e,t=0){return(tt[e[t+0]]+tt[e[t+1]]+tt[e[t+2]]+tt[e[t+3]]+"-"+tt[e[t+4]]+tt[e[t+5]]+"-"+tt[e[t+6]]+tt[e[t+7]]+"-"+tt[e[t+8]]+tt[e[t+9]]+"-"+tt[e[t+10]]+tt[e[t+11]]+tt[e[t+12]]+tt[e[t+13]]+tt[e[t+14]]+tt[e[t+15]]).toLowerCase()}var tt,Yg=I(()=>{tt=[];for(let e=0;e<256;++e)tt.push((e+256).toString(16).slice(1))});function Qc(){return ws>As.length-16&&((0,Zg.randomFillSync)(As),ws=0),As.slice(ws,ws+=16)}var Zg,As,ws,e0=I(()=>{Zg=require("crypto"),As=new Uint8Array(256),ws=As.length});var t0,Xc,r0=I(()=>{t0=require("crypto"),Xc={randomUUID:t0.randomUUID}});function BT(e,t,r){if(Xc.randomUUID&&!t&&!e)return Xc.randomUUID();e=e||{};let n=e.random??e.rng?.()??Qc();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 Kg(n)}var ct,n0=I(()=>{r0();e0();Yg();ct=BT});var Kc=I(()=>{n0()});var i0=I(()=>{"use strict";});var Yc=g(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.WorkflowConditionOperator=xt.WorkflowAttributeType=xt.SystemStep=xt.FieldRequiredLevelTypes=xt.AttributeDateTimeBehavior=void 0;xt.AttributeDateTimeBehavior={None:0,Dynamic:1,DateOnly:2,StaticTimeZoneInvariant:3,UserLocal:4};xt.FieldRequiredLevelTypes={None:"0",Required:"1",Recommended:"2"};xt.SystemStep={IdentifyContact:"IdentifyContact",IdentifyAccount:"IdentifyAccount",IdentifyCustomer:"IdentifyCustomer",IdentifyCase:"IdentifyCase",Solution:"Solution",Resolve:"Resolve"};xt.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"};xt.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 l0(e){switch(e){case"Boolean":return pe.WorkflowAttributeType.Boolean;case"Customer":return pe.WorkflowAttributeType.Customer;case"DateTime":return pe.WorkflowAttributeType.DateTime;case"Decimal":return pe.WorkflowAttributeType.Decimal;case"Double":return pe.WorkflowAttributeType.Float;case"Integer":return pe.WorkflowAttributeType.Integer;case"Lookup":return pe.WorkflowAttributeType.Lookup;case"Money":return pe.WorkflowAttributeType.Money;case"Owner":return pe.WorkflowAttributeType.Owner;case"Picklist":return pe.WorkflowAttributeType.Picklist;case"State":return pe.WorkflowAttributeType.State;case"Status":return pe.WorkflowAttributeType.Status;case"Uniqueidentifier":case"UniqueIdentifier":return pe.WorkflowAttributeType.UniqueIdentifier;case"BigInt":return pe.WorkflowAttributeType.BigType;default:return pe.WorkflowAttributeType.String}}function h0(e){return e&&e!==pe.WorkflowAttributeType.String?e:void 0}function VT(e){return{__class:m0,parameterName:"primaryEntity",entityName:e}}function a0(e){return{__class:ed,type:Zc,typeSet:!1,behavior:pe.AttributeDateTimeBehavior.None,method:u0,parameters:[e]}}function o0(e,t,r=pe.WorkflowAttributeType.String){return{__class:d0,type:r,behavior:pe.AttributeDateTimeBehavior.None,typeSet:!1,entity:VT(t),attributeName:e}}function GT(e,t=pe.WorkflowAttributeType.String){return{__class:p0,type:t,behavior:pe.AttributeDateTimeBehavior.None,typeSet:!1,primitiveValue:e}}function zT(e){return{__class:f0,type:Zc,typeSet:!1,behavior:pe.AttributeDateTimeBehavior.None,days:e,hours:"0",minutes:"0",months:"0",years:"0"}}function g0(e,t){let r=$T[e.operator],n=a0(o0(e.leftField,t,e.leftWorkflowType)),i;e.dateArithmetic?i=zT(e.right.value??"0"):e.right.kind==="field"?i=o0(e.right.field??"",t,e.right.workflowType):i=GT(e.right.value??"",e.right.workflowType??e.leftWorkflowType);let a=a0(i);return{__class:ed,type:Zc,typeSet:!1,behavior:pe.AttributeDateTimeBehavior.None,method:c0,parameters:[r,n,a]}}function v0(e){return typeof e=="object"&&e.__class===ed}function WT(e){return typeof e=="object"&&e.__class===f0}function Cs(e){return v0(e)&&e.method===u0&&e.parameters.length>0?Cs(e.parameters[0]):e}function s0(e){if(typeof e!="object"||e.__class!==d0)return null;let t=e.entity;if(t&&t.__class&&t.__class!==m0)return null;let r=e.attributeName;return r?{field:r,workflowType:h0(e.type)}:null}function y0(e){if(!e)return null;let t=Cs(e);if(!v0(t)||t.method!==c0||t.parameters.length!==3)return null;let r=t.parameters[0],n=qT[String(r)];if(!n)return null;let i=s0(Cs(t.parameters[1]));if(!i)return null;let a=Cs(t.parameters[2]);if(WT(a))return n!=="+"&&n!=="-"?null:{leftField:i.field,leftWorkflowType:i.workflowType,operator:n,right:{kind:"value",value:String(a.days??"")},dateArithmetic:!0};let o=s0(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===p0){let s=a.primitiveValue;return{leftField:i.field,leftWorkflowType:i.workflowType,operator:n,right:{kind:"value",value:s!=null?String(s):"",workflowType:h0(a.type)}}}return null}function hi(e){return!e||!e.leftField?!1:e.right.kind==="field"?!!(e.right.field&&e.right.field.trim()):!!(e.right.value&&e.right.value.trim())}var pe,u0,c0,Zc,d0,p0,ed,f0,m0,$T,qT,Ss=I(()=>{"use strict";pe=se(Yc());u0="0",c0="3",Zc="0",d0="EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions",p0="PrimitiveExpression:#Microsoft.Crm.Workflow.Expressions",ed="MethodCallExpression:#Microsoft.Crm.Workflow.Expressions",f0="TimeSpanExpression:#Microsoft.Crm.Workflow.Expressions",m0="PrimaryEntity:#Microsoft.Crm.Workflow.Expressions";$T={"+":0,"-":1,"*":2,"/":3},qT={0:"+",1:"-",2:"*",3:"/"}});function b0(e){return e.__class==="BinaryExpression:#Microsoft.Crm.Workflow.Expressions"}function jT(e){return e.__class==="ConditionBranchStep:#Microsoft.Crm.Workflow.ObjectModel"}function Va(){return{list:[]}}function w0(e,t,r){return e&&e.list.length>0?{list:[{...e.list[0],description:t},...e.list.slice(1)]}:{list:[{labelId:ct(),languageCode:r,description:t}]}}function id(e){return{__class:"PrimaryEntity:#Microsoft.Crm.Workflow.Expressions",parameterName:"primaryEntity",entityName:e}}function ad(e,t,r){return{__class:"EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions",type:r,behavior:z.AttributeDateTimeBehavior.None,typeSet:!1,entity:id(t),attributeName:e}}function Ga(e,t){return{__class:"PrimitiveExpression:#Microsoft.Crm.Workflow.Expressions",type:t,behavior:z.AttributeDateTimeBehavior.None,typeSet:!1,primitiveValue:e}}function I0(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:Ga(e.id.replace(/[{}]/g,""),z.WorkflowAttributeType.UniqueIdentifier)}}function A0(e,t){let r=e.valueType==="Lookup"?e.lookupValue?.workflowType??z.WorkflowAttributeType.Lookup:e.valueType==="Clear"?e.valueWorkflowType??z.WorkflowAttributeType.String:z.WorkflowAttributeType.String,n=nd[e.operator]??z.WorkflowConditionOperator.Equal,i=ad(e.field,t,r),a;if(e.operator==="ContainsData"||e.operator==="DoesNotContainData")a=[];else if(e.valueType==="Field"&&e.valueField)a=[ad(e.valueField,t,r)];else if(e.valueType==="Lookup"){if(!e.lookupValue)throw new Error("Lookup condition is missing its record value.");a=[I0(e.lookupValue)]}else e.valueType==="Clear"?a=[Ga(null,r)]:e.valueType==="Expression"?a=[Ns(e.valueType,e.value,e.valueField,t,e.expression,e.rawExpression)]:a=[Ga(e.value??"",r)];return{__class:"BinaryExpression:#Microsoft.Crm.Workflow.Expressions",type:r,behavior:z.AttributeDateTimeBehavior.None,typeSet:!1,conditionOperatoroperator:n,left:i,right:a}}function HT(e,t,r){if(e.length===0)return null;if(e.length===1)return A0(e[0],r);let n=t==="AND"?z.WorkflowConditionOperator.LogicalAnd:z.WorkflowConditionOperator.LogicalOr,[i,...a]=e.map(o=>A0(o,r));return{__class:"BinaryExpression:#Microsoft.Crm.Workflow.Expressions",type:z.WorkflowAttributeType.String,behavior:z.AttributeDateTimeBehavior.None,typeSet:!1,conditionOperatoroperator:n,left:i,right:a}}function Es(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=y0(e);return t?{valueType:"Expression",expression:t}:{valueType:"Expression",rawExpression:e}}return{valueType:"Value",value:""}}function td(e){let t=D0[e.conditionOperatoroperator]??"Equals",r=e.left.__class==="EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions"?e.left.attributeName:"",i=t==="ContainsData"||t==="DoesNotContainData"?{valueType:"Value"}:Es(e.right[0]);return{id:ct(),field:r,fieldDisplayName:r,operator:t,...i}}function C0(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:[...b0(e.left)?[td(e.left)]:[],...e.right.filter(b0).map(td)],logic:r}}return{clauses:[td(e)],logic:"AND"}}function Ns(e,t,r,n,i,a,o,s){if(e==="Field"&&r)return ad(r,n,z.WorkflowAttributeType.String);if(e==="Expression"){if(i)return g0(i,n);if(a!=null)return a}return e==="Lookup"&&o?I0(o):e==="Clear"?Ga(null,s??z.WorkflowAttributeType.String):Ga(t??"",z.WorkflowAttributeType.String)}function rd(e,t){return{propertyName:e,propertyValueExpr:t}}function gi(e){return`Step_${e.value++}`}function Lt(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 S0(e,t,r){return e&&!r.used.has(e)?(r.used.add(e),e):Lt(t,r)}function JT(e){return e===N0.StateCode.Activated?"Active":"Draft"}function QT(e,t){let r=e.processtriggerscope,n=e.processtriggerformid;return r===1&&n?n:r===2?"Entity":t??"Entity"}function _0(e,t=1033){return new vi({languageCode:t}).serialize(e)}function P0(e){return new vi().deserialize(e)}var N0,z,nd,D0,od,vi,sd=I(()=>{"use strict";Kc();N0=se(Mn());i0();Ss();z=se(Yc());nd={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},D0={};for(let e of Object.keys(nd))D0[nd[e]]=e;od={setFieldValue:"Set Field Value",setDefaultValue:"Set Default Value",lockUnlock:"Lock/Unlock",setBusinessRequired:"Set Business Required",setVisibility:"Set Visibility",recommendation:"Recommendation",showErrorMessage:"Show Error Message",condition:"Condition"};vi=class{resolveLabel;languageCode;entityName="";stepCounter={value:0};idCounter={counts:{},used:new Set};constructor(t={}){this.resolveLabel=t.resolveLabel??(r=>od[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??ct(),name:r?.name??"Step_0",description:r!==void 0?r.description:t.description||null,stepLabels:Va(),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:Lt("SetAttributeValueStep",this.idCounter),description:t.displayName||"New Action",name:t.stepName??gi(this.stepCounter),stepLabels:{list:[]},specification:rd(t.field,Ns(t.valueType,t.value,t.valueField,this.entityName,t.expression,t.rawExpression,t.lookupValue,t.valueWorkflowType)),entity:id(this.entityName)}}makeRecommendationActionStep(t,r,n){let i=r.map(l=>this.makeApplyActionStep(l)),a=t??"",o=n?.stepLabels,s=w0(o,a,this.languageCode);return{__class:"ActionStep:#Microsoft.Crm.Workflow.ObjectModel",id:S0(n?.id,"ActionStep",this.idCounter),name:n?.name??gi(this.stepCounter),description:n?.description??"Action step",stepLabels:s,steps:{list:i},actionId:null,actionType:n?.actionType??"4",processId:n?.processId??ct(),uniqueName:n?.uniqueName??`id_${ct().replace(/-/g,"")}ActionStep`}}serializeAction(t){let r=id(this.entityName),n=t.stepName??gi(this.stepCounter),i=t.stepLabels??Va(),a={name:n,stepLabels:i,description:t.displayName},o=t.type;switch(o){case"SetFieldValue":return{...a,id:Lt("SetAttributeValueStep",this.idCounter),__class:"SetAttributeValueStep:#Microsoft.Crm.Workflow.ObjectModel",entity:r,specification:rd(t.field,Ns(t.valueType,t.value,t.valueField,this.entityName,t.expression,t.rawExpression,t.lookupValue,t.valueWorkflowType))};case"SetDefaultValue":return{...a,id:Lt("SetDefaultValueStep",this.idCounter),__class:"SetDefaultValueStep:#Microsoft.Crm.Workflow.ObjectModel",entity:r,specification:rd(t.field,Ns(t.valueType,t.value,t.valueField,this.entityName,t.expression,t.rawExpression,t.lookupValue,t.valueWorkflowType))};case"LockUnlock":return{...a,id:Lt("SetDisplayModeStep",this.idCounter),__class:"SetDisplayModeStep:#Microsoft.Crm.Workflow.ObjectModel",controlId:t.field,controlType:"standard",isReadOnly:t.lock,entity:r};case"SetBusinessRequired":return{...a,id:Lt("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:Lt("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:ct(),languageCode:this.languageCode,description:s}]};return{...a,id:Lt("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=w0(t.stepLabels,s,this.languageCode),u={list:[this.makeRecommendationActionStep(t.acceptanceText,t.applyActions??[],t.recommendationActionStepMeta)]};return{...a,id:Lt("SetMessageStep",this.idCounter),__class:"SetMessageStep:#Microsoft.Crm.Workflow.ObjectModel",stepLabels:l,description:t.recommendationTitle||t.displayName,controlId:t.field,entity:r,level:"RECOMMENDATION",actionSteps:u}}default:throw new Error(`Unsupported action type: ${o}`)}}serializeConditionNode(t){let r=t.stepName??gi(this.stepCounter),n=Lt("ConditionStep",this.idCounter),i=[],a=t,o=!0;for(;a;){let s=HT(a.clauses,a.logic,this.entityName),l=o?a.branchName??gi(this.stepCounter):gi(this.stepCounter),c={__class:"ConditionBranchStep:#Microsoft.Crm.Workflow.ObjectModel",id:o?S0(a.branchId,"ConditionBranchStep",this.idCounter):Lt("ConditionBranchStep",this.idCounter),name:l,description:a.displayName,stepLabels:Va(),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:Va(),containsElsebranch:i.length>1,steps:{list:i}}}makeTerminalElseBranch(t){return{__class:"ConditionBranchStep:#Microsoft.Crm.Workflow.ObjectModel",id:Lt("ConditionBranchStep",this.idCounter),name:"Else",description:null,stepLabels:Va(),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??ct():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:QT(r,i?.formId),status:JT(t.statecode),rootCondition:n,wfomRoot:i}}deserializeConditionStep(t){let r=(t.steps?.list??[]).filter(jT);return this.buildConditionNodeFromBranches(r,t,!0)}buildConditionNodeFromBranches(t,r,n){let[i,...a]=t,{clauses:o,logic:s}=C0(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)??ct(),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}=C0(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||ct(),field:u?.propertyName??"",stepName:l.name??void 0,displayName:l.description??void 0,...Es(u?.propertyValueExpr)}}),meta:i,acceptanceText:o}}deserializeAction(t){switch(t.__class){case"SetAttributeValueStep:#Microsoft.Crm.Workflow.ObjectModel":{let r=Es(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=Es(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 on(e){return!XT.has(e)}function F0(e){return nO.has(e)}function Ds(e){return O0.has(e)?KT:tO.has(e)?YT:R0.has(e)?ZT:eO}function x0(e){return Ds(e)[0]}function L0(e,t){return Ds(t).includes(e)}function T0(e){return O0.has(e)?"string":e==="Money"?"money":e==="Integer"||e==="BigInt"?"integer":e==="Decimal"||e==="Double"?"decimal":R0.has(e)?"date":rO.has(e)?"boolean":"other"}function Is(e,t){let r=T0(e),n=T0(t);return r==="other"||n==="other"?e===t:r===n}var XT,KT,YT,ZT,eO,O0,tO,R0,rO,nO,ld=I(()=>{"use strict";XT=new Set(["ContainsData","DoesNotContainData"]);KT=["Equals","DoesNotEqual","Contains","DoesNotContain","BeginsWith","DoesNotBeginWith","EndsWith","DoesNotEndWith","ContainsData","DoesNotContainData"],YT=["Equals","DoesNotEqual","IsGreaterThan","IsGreaterThanEqualTo","IsLessThan","IsLessThanEqualTo","ContainsData","DoesNotContainData"],ZT=["On","NotOn","IsGreaterThan","IsGreaterThanEqualTo","IsLessThan","IsLessThanEqualTo","ContainsData","DoesNotContainData"],eO=["Equals","DoesNotEqual","ContainsData","DoesNotContainData"],O0=new Set(["String","Memo","EntityName"]),tO=new Set(["Integer","BigInt","Money","Decimal","Double"]),R0=new Set(["DateTime"]),rO=new Set(["Boolean"]),nO=new Set(["Equals","DoesNotEqual"])});function cd(e){return iO.has(e.type)}function ud(e,t,r,n,i,a,o){let s=i.get(r);!s||!aO.has(s.attributeType)||n!=="Value"||o?.operator&&!F0(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 k0(e,t,r,n,i,a,o,s){if(i!=="Clear")return;let l=a.get(n);bs(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 Ps(e){if(!e)return!1;for(let t of[...e.trueBranch,...e.falseBranch])if(t.kind==="action"){if(cd(t))return!0}else if(Ps(t))return!0;return!1}function dd(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=dd(r,t);if(n)return n}}return null}function yi(e,t){for(let r=0;r<e.trueBranch.length;r++){let n=e.trueBranch[r];if(n.id===t)return{node:e,branch:"true",index:r};if(n.kind==="condition"){let i=yi(n,t);if(i)return i}}for(let r=0;r<e.falseBranch.length;r++){let n=e.falseBranch[r];if(n.id===t)return{node:e,branch:"false",index:r};if(n.kind==="condition"){let i=yi(n,t);if(i)return i}}return null}function pd(e,t){return{...e,trueBranch:M0(e.trueBranch,t),falseBranch:M0(e.falseBranch,t)}}function M0(e,t){return e.filter(r=>r.id!==t).map(r=>r.kind==="condition"?pd(r,t):r)}function sn(e,t,r){return e.id===t?r(e):{...e,trueBranch:e.trueBranch.map(n=>n.kind==="condition"?sn(n,t,r):n),falseBranch:e.falseBranch.map(n=>n.kind==="condition"?sn(n,t,r):n)}}function _s(e,t,r){return{...e,trueBranch:e.trueBranch.map(n=>n.kind==="action"&&n.id===t?r(n):n.kind==="condition"?_s(n,t,r):n),falseBranch:e.falseBranch.map(n=>n.kind==="action"&&n.id===t?r(n):n.kind==="condition"?_s(n,t,r):n)}}function U0(e,t,r,n){return sn(e,t,i=>({...i,trueBranch:r==="true"?[...i.trueBranch,n]:i.trueBranch,falseBranch:r==="false"?[...i.falseBranch,n]:i.falseBranch}))}function oO(e){return e.length===1&&e[0].kind==="condition"}function B0(e,t,r){return sn(e,t,n=>$0(n,r))}function $0(e,t){if(oO(e.falseBranch))return{...e,falseBranch:[$0(e.falseBranch[0],t)]};let r=fd(t);return r.falseBranch=e.falseBranch,{...e,falseBranch:[r]}}function q0(e,t){let r=yi(e,t);if(!r||r.branch!=="false")return e;let n=r.node.falseBranch[r.index];if(!n||n.kind!=="condition")return e;let i=n.falseBranch;return sn(e,r.node.id,a=>({...a,falseBranch:i}))}function V0(e,t,r){let n=yi(e,t);if(!n)return e;let i=a=>{let o=[...a],s=o[n.index+r];return s?(o[n.index+r]=o[n.index],o[n.index]=s,o):a};return sn(e,n.node.id,a=>({...a,trueBranch:n.branch==="true"?i(a.trueBranch):a.trueBranch,falseBranch:n.branch==="false"?i(a.falseBranch):a.falseBranch}))}function fd(e){return{kind:"condition",id:ct(),displayName:e??"New Condition",clauses:[],logic:"AND",trueBranch:[],falseBranch:[],isCollapsed:!1}}function G0(e,t){let r={kind:"action",id:ct(),type:e,displayName:t??`New ${e}`};switch(e){case"Recommendation":return{...r,type:"Recommendation",field:"",recommendationTitle:"",messageText:"",applyActions:[{id:ct(),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 z0(e){if(!e)return[];let t=[];return W0(e,t),[...new Set(t)]}function W0(e,t){e.clauses.forEach(r=>{r.field&&t.push(r.field)}),[...e.trueBranch,...e.falseBranch].forEach(r=>{r.kind==="condition"?W0(r,t):"field"in r&&r.field&&t.push(r.field)})}function j0(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 H0(e,r,n),Ps(e)||r.push({nodeId:"root",kind:"NO_ACTION",message:"A business rule must include at least one action step.",target:"node"}),r}function H0(e,t,r){e.clauses.length===0&&t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_FIELD",message:"Add at least one clause to this condition.",target:"node",messageKey:"Validation.AddClause"}),e.clauses.forEach(n=>{if(!n.field)t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_FIELD",message:"Please select a field for this clause.",target:"clauseField",itemId:n.id});else if(on(n.operator)&&n.valueType==="Value"&&!n.value)t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_VALUE",message:"Please enter a value for this clause.",target:"clauseValue",itemId:n.id});else if(on(n.operator)&&n.valueType==="Value"&&n.value){let i=r.get(n.field);i?.maxLength&&n.value.length>i.maxLength&&t.push({nodeId:e.id,kind:"CLAUSE_VALUE_TOO_LONG",message:`Value exceeds the field's maximum length of ${i.maxLength} characters.`,target:"clauseValue",itemId:n.id,messageParams:{maxLength:i.maxLength}})}else on(n.operator)&&n.valueType==="Expression"&&!n.rawExpression&&!hi(n.expression)&&t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_VALUE",message:"Please complete the formula for this clause.",target:"clauseValue",itemId:n.id,messageKey:"Validation.CompleteClauseFormula"});on(n.operator)&&n.valueType==="Lookup"&&(!n.lookupValue?.entityType||!n.lookupValue.id||!n.lookupValue.label)&&t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_VALUE",message:"Please select a lookup record for this clause.",target:"clauseValue",itemId:n.id,messageKey:"Validation.EmptyClauseLookupValue"}),on(n.operator)&&ud(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")H0(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&&!Is(i.attributeType,a.attributeType)&&t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:`${n.type}: the source field's type is not compatible with the target field.`,target:"actionValue",messageKey:"Validation.IncompatibleActionSourceField",messageParams:{actionType:n.type}})}}else(n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&n.valueType==="Expression"?!n.rawExpression&&!hi(n.expression)&&t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:`${n.type}: please complete the formula.`,target:"actionValue",messageKey:"Validation.CompleteActionFormula",messageParams:{actionType:n.type}}):(n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&n.valueType==="Lookup"&&(!n.lookupValue?.entityType||!n.lookupValue.id||!n.lookupValue.label)&&t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:`${n.type}: please complete the lookup record.`,target:"actionValue",messageKey:"Validation.EmptyActionLookupValue",messageParams:{actionType:n.type}});if((n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&n.field&&(ud(n.id,n.type,n.field,n.valueType,r,t,{target:"actionValue"}),k0(n.id,n.type,n.type,n.field,n.valueType,r,t,{target:"actionValue"})),n.type==="ShowErrorMessage"&&!n.errorMessage?.trim()&&t.push({nodeId:n.id,kind:"EMPTY_ACTION_MESSAGE",message:"Show error message: please enter an error message.",target:"actionMessage"}),n.type==="Recommendation"){let i=n.applyActions??[];n.recommendationTitle?.trim()||t.push({nodeId:n.id,kind:"EMPTY_RECOMMENDATION_TITLE",message:"Recommendation: please enter a recommendation title.",target:"recommendationTitle"}),n.messageText?.trim()||t.push({nodeId:n.id,kind:"EMPTY_RECOMMENDATION_MESSAGE",message:"Recommendation: please enter a recommendation message.",target:"recommendationMessage"}),i.length===0&&t.push({nodeId:n.id,kind:"RECOMMENDATION_NO_APPLY_ACTION",message:"Recommendation: add at least one action to apply.",target:"node"}),i.forEach(a=>{a.field?a.valueType==="Field"?a.valueField||t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:"Recommendation: please select a field to copy from.",target:"applyActionValue",itemId:a.id,messageKey:"Validation.RecommendationApplySourceField"}):a.valueType==="Expression"?!a.rawExpression&&!hi(a.expression)&&t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:"Recommendation: please complete the formula.",target:"applyActionValue",itemId:a.id,messageKey:"Validation.RecommendationApplyFormula"}):a.valueType==="Lookup"?(!a.lookupValue?.entityType||!a.lookupValue.id||!a.lookupValue.label)&&t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:"Recommendation: please complete the lookup record.",target:"applyActionValue",itemId:a.id,messageKey:"Validation.RecommendationApplyLookupValue"}):a.valueType==="Clear"||a.value?.trim()||t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:"Recommendation: please enter a value for each action to apply.",target:"applyActionValue",itemId:a.id,messageKey:"Validation.RecommendationApplyValue"}):t.push({nodeId:n.id,kind:"EMPTY_ACTION_FIELD",message:"Recommendation: a target field is required for each action to apply.",target:"applyActionField",itemId:a.id,messageKey:"Validation.RecommendationApplyField"}),a.field&&(ud(n.id,"Recommendation",a.field,a.valueType,r,t,{target:"applyActionValue",itemId:a.id}),k0(n.id,"Recommendation","SetFieldValue",a.field,a.valueType,r,t,{target:"applyActionValue",itemId:a.id}))})}}})}var iO,aO,md=I(()=>{"use strict";Kc();jc();ld();Ss();iO=new Set(["LockUnlock","ShowErrorMessage","SetFieldValue","SetDefaultValue","SetBusinessRequired","SetVisibility"]);aO=new Set(["Lookup","Customer","Owner"])});var J0={};Rr(J0,{DEFAULT_DESERIALIZE_LABELS:()=>od,WorkflowJsonMapper:()=>vi,addElseIfInTree:()=>B0,appendToBranch:()=>U0,areFieldKindsCompatible:()=>Is,attributeTypeToWorkflowType:()=>l0,buildWorkflowEntity:()=>Qg,collectUsedFields:()=>z0,createEmptyAction:()=>G0,createEmptyCondition:()=>fd,deserializeWorkflowJson:()=>P0,findNode:()=>dd,findParent:()=>yi,getDefaultOperatorForFieldType:()=>x0,getOperatorsForFieldType:()=>Ds,hasAnyTriggerGeneratingAction:()=>Ps,isExpressionModelComplete:()=>hi,isOperatorCompatible:()=>L0,isTriggerGeneratingAction:()=>cd,moveBranchItemInTree:()=>V0,operatorNeedsValue:()=>on,processTriggerFormIdFromScope:()=>Jc,processTriggerScopeFromScope:()=>Hc,removeElseIfInTree:()=>q0,removeNodeFromTree:()=>pd,serializeToWorkflowJson:()=>_0,supportsClearForActionType:()=>bs,updateActionInTree:()=>_s,updateConditionInTree:()=>sn,validateBusinessRule:()=>j0});var Q0=I(()=>{"use strict";jc();Xg();sd();sd();md();md();ld();Ss();});var Yt=g(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.publishBoundEntity=Ge.boundEntityPublishScope=Ge.publishGenPageById=Ge.publishDashboardById=Ge.publishWebResourceById=Ge.publishEntity=Ge.publishAppModule=Ge.publishXml=void 0;var sO=ye(),za=ee(),X0="/PublishXml";async function bi(e,t){(0,sO.ensureSuccess)(await e.post(X0,{ParameterXml:t}),e.apiUrl(X0))}Ge.publishXml=bi;function lO(e,t){return bi(e,`<importexportxml><appmodules><appmodule>${(0,za.xmlText)(t)}</appmodule></appmodules></importexportxml>`)}Ge.publishAppModule=lO;function K0(e,t){return bi(e,`<importexportxml><entities><entity>${(0,za.xmlText)(t)}</entity></entities></importexportxml>`)}Ge.publishEntity=K0;function uO(e,t){return bi(e,`<importexportxml><webresources><webresource>${(0,za.xmlText)(t)}</webresource></webresources></importexportxml>`)}Ge.publishWebResourceById=uO;function cO(e,t){return bi(e,`<importexportxml><dashboards><dashboard>${(0,za.xmlText)(t)}</dashboard></dashboards></importexportxml>`)}Ge.publishDashboardById=cO;function dO(e,t){return bi(e,`<importexportxml><uxagentprojects><uxagentproject>${(0,za.xmlText)(t)}</uxagentproject></uxagentprojects></importexportxml>`)}Ge.publishGenPageById=dO;function pO(e){let t=e?.entityLogicalName;return t?{envelope:"entity",entityLogicalName:t,blastRadiusWarning:"ENTITY_ENVELOPE_ALSO_SHIPS_UNRELATED_UNPUBLISHED_CHANGES"}:{envelope:"entity"}}Ge.boundEntityPublishScope=pO;function fO(e,t){let r=t?.entityLogicalName;return r?K0(e,r):Promise.resolve()}Ge.publishBoundEntity=fO});var hd=g(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.cloneJson=void 0;function mO(e){return JSON.parse(JSON.stringify(e))}Ts.cloneJson=mO});var ur=g(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.childObjects=vt.optionalGuidId=vt.optionalEnum=vt.eachObject=vt.issue=vt.isJsonObject=void 0;function Y0(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}vt.isJsonObject=Y0;function Wa(e,t,r,n){return n?{pointer:e,rule:t,message:r,fatal:n}:{pointer:e,rule:t,message:r}}vt.issue=Wa;function Z0(e,t,r,n){if(!Array.isArray(e))return[];let i=[];return e.forEach((a,o)=>{Y0(a)?i.push({node:a,index:o}):n.push(Wa(`${t}/${o}`,`${r}-must-be-object`,`a ${r} must be a JSON object, got ${a===null?"null":typeof a}`))}),i}vt.eachObject=Z0;function hO(e,t,r,n,i,a){let o=e[t];o!==void 0&&(typeof o!="string"||!r.includes(o))&&a.push(Wa(`${n}/${t}`,i,`${t} must be one of ${r.map(s=>`'${s}'`).join(", ")}, got ${JSON.stringify(o)}`))}vt.optionalEnum=hO;var gO=/^(?:\{[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 vO(e,t,r,n,i){let a=e[t];typeof a=="string"&&a!==""&&!gO.test(a)&&i.push(Wa(`${r}/${t}`,n,`${t} must be a GUID or empty, got '${a}'`))}vt.optionalGuidId=vO;function yO(e,t,r,n,i){let a=e[t],o=`${r}/${t}`;return a===void 0?[]:Array.isArray(a)?Z0(a,o,n,i):(i.push(Wa(o,`${n}-list-must-be-array`,`${t} must be an array when present, got ${typeof a}`)),[])}vt.childObjects=yO});var yt=g(wi=>{"use strict";Object.defineProperty(wi,"__esModule",{value:!0});wi.assignMissingIds=wi.newId=void 0;var bO=ys();function ev(){return(0,bO.v4)()}wi.newId=ev;function wO(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var AO=new Set(["parameters","bag","expression","rawExpression","lookupValue","stepLabels"]);function CO(e){return gd(e),e}wi.assignMissingIds=CO;function gd(e){if(Array.isArray(e)){e.forEach(t=>gd(t));return}if(wO(e)){(typeof e.id!="string"||e.id.length===0)&&(e.id=ev());for(let t of Object.keys(e))t==="id"||AO.has(t)||gd(e[t])}}});var yd=g(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.BUSINESS_RULE_NULL_GUID=ln.businessRuleRegistration=ln.BusinessRuleAdapter=void 0;var tv=ys(),ja=(Q0(),Fr(J0)),rv=Yt(),nv=ie(),SO=hd(),cr=ur(),EO=Ec(),NO=yt();function DO(e){return sv((0,SO.cloneJson)(e))}function sv(e){var t,r;let n=i=>(i??[]).map(a=>IO(a)?sv(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 IO(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 _O(e){var t;if(e===null||typeof e!="object"||Array.isArray(e))throw new nv.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 nv.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 PO="00000000-0000-0000-0000-000000000000";ln.BUSINESS_RULE_NULL_GUID=PO;var TO=new Set(["Recommendation","LockUnlock","ShowErrorMessage","SetFieldValue","SetDefaultValue","SetBusinessRequired","SetVisibility"]),OO=["ruleId","name","description","entityLogicalName","scope","status","rootCondition"],RO=["kind","id","displayName","logic","clauses","trueBranch","falseBranch"],FO=["id","field","fieldDisplayName","operator","valueType","value","valueField","lookupValue","expression","rawExpression","valueWorkflowType"];function Zt(e,t){return e===void 0?t:{...e,...t}}var $n=["kind","id","type","displayName","field","stepName","stepLabels"],iv=["valueType","valueWorkflowType","value","valueField","lookupValue","expression","rawExpression"],xO={Recommendation:[...$n,"recommendationTitle","messageText","acceptanceText","applyActions","recommendationActionStepMeta"],LockUnlock:[...$n,"lock"],ShowErrorMessage:[...$n,"errorMessage","messageLevel","messageActionSteps"],SetFieldValue:[...$n,...iv],SetDefaultValue:[...$n,...iv],SetBusinessRequired:[...$n,"required"],SetVisibility:[...$n,"visible"]};function j(e,t){return t===void 0?{}:{[e]:t}}function lv(e){var t;return e===void 0?void 0:{...e,label:(t=e.label)!==null&&t!==void 0?t:""}}function vd(e){return{valueType:e.valueType,...j("valueWorkflowType",e.valueWorkflowType),...j("value",e.value),...j("valueField",e.valueField),...j("lookupValue",lv(e.lookupValue)),...j("expression",e.expression),...j("rawExpression",e.rawExpression)}}function uv(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 LO=["id","field","valueType","valueWorkflowType","value","valueField","lookupValue","expression","rawExpression","stepName","displayName"];function kO(e){return Zt(e.bag,{id:e.id,field:e.field,...vd(e),...j("stepName",e.stepName),...j("displayName",e.displayName)})}function MO(e){let t=uv(e,LO);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 av(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 ov(e){throw new Error(`Unsupported business-rule action type: ${e.type}`)}var UO=new Set(["INVALID_CLEAR_FOR_FIELD","INVALID_VALUE_TYPE_FOR_FIELD","CLAUSE_VALUE_TOO_LONG","ACTION_VALUE_TOO_LONG"]),BO=new Set;function $O(e){let t=n=>{var i;return(0,cr.isJsonObject)(n)&&(n.label===""||n.label===void 0)?{...n,label:String((i=n.id)!==null&&i!==void 0?i:"")}:n},r=n=>{if(!(0,cr.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 Os=class{toArtifact(t){let r=this.residualBag(t,OO),n={id:t.ruleId,name:t.name,description:t.description,entityLogicalName:t.entityLogicalName,scope:t.scope,status:t.status,rootCondition:t.rootCondition?this.conditionToJson(t.rootCondition):null};return r&&(n.bag=r),n}fromArtifact(t){let r=t.rootCondition?this.conditionFromJson(t.rootCondition):null;return Zt(t.bag,{ruleId:t.id,name:t.name,description:t.description,entityLogicalName:t.entityLogicalName,scope:t.scope,status:t.status,rootCondition:r})}fromApiResponse(t){var r;let n=t??{},i={...(r=n.Entity)!==null&&r!==void 0?r:{},wfomJson:n.WfomJson},a=(0,ja.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,ja.serializeToWorkflowJson)(n),a=(r=n.ruleId)!==null&&r!==void 0?r:(0,tv.v4)();return{Entity:this.buildWorkflowEntity(n,a),WfomJson:i,status:t.status}}createDefault(t){var r,n,i,a,o,s;let l={ruleId:(r=t.id)!==null&&r!==void 0?r:null,name:(n=t.name)!==null&&n!==void 0?n:"New business rule",description:(i=t.description)!==null&&i!==void 0?i:"",entityLogicalName:(a=t.entityLogicalName)!==null&&a!==void 0?a:"",scope:(o=t.scope)!==null&&o!==void 0?o:"Entity",status:(s=t.status)!==null&&s!==void 0?s:"Draft",rootCondition:t.rootCondition===void 0?(0,ja.createEmptyCondition)():t.rootCondition===null?null:this.conditionFromJson(DO(_O(t.rootCondition)))},u=this.toArtifact(l);return u.id||(u.id=(0,tv.v4)()),u}assignMissingIds(t){return(0,NO.assignMissingIds)(t)}validate(t){let r=[],n=t.rootCondition;return n==null?r:(0,cr.isJsonObject)(n)?(cv(n,"/rootCondition",r),r):(r.push((0,cr.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,cr.issue)("/rootCondition","rule-not-representable",o instanceof Error?o.message:String(o))]}let i=n.rootCondition===null?null:$O(n.rootCondition),a=r.length===0?UO:BO;return(0,ja.validateBusinessRule)(i,r).filter(o=>!a.has(o.kind)).map(o=>(0,cr.issue)(`/rootCondition (${o.nodeId})`,`business-rule-${o.kind}`,o.message))}residualBag(t,r){return uv(t,r)}buildWorkflowEntity(t,r){return(0,ja.buildWorkflowEntity)(t,r)}conditionToJson(t){let r=this.residualBag(t,RO),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,FO),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,xO[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(MO),...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",...av(t)};case"SetDefaultValue":return{...n,type:"SetDefaultValue",...av(t)};case"SetBusinessRequired":return{...n,type:"SetBusinessRequired",required:t.required};case"SetVisibility":return{...n,type:"SetVisibility",visible:t.visible};default:return ov(t)}}conditionFromJson(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:{};return Zt(n,{kind:"condition",isCollapsed:typeof n.isCollapsed=="boolean"?n.isCollapsed:!1,id:t.id,displayName:t.displayName,logic:t.logic,clauses:t.clauses.map(i=>this.clauseFromJson(i)),trueBranch:t.trueBranch.map(i=>this.branchItemFromJson(i)),falseBranch:t.falseBranch.map(i=>this.branchItemFromJson(i))})}clauseFromJson(t){var r;return Zt(t.bag,{id:t.id,field:t.field,fieldDisplayName:(r=t.fieldDisplayName)!==null&&r!==void 0?r:t.field,operator:t.operator,valueType:t.valueType,...j("value",t.value),...j("valueField",t.valueField),...j("lookupValue",lv(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(!TO.has(t.type))throw new Error(`Unsupported business-rule action type: ${t.type}`);VO(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 Zt(t.bag,{...r,type:"Recommendation",recommendationTitle:t.recommendationTitle,messageText:t.messageText,...j("acceptanceText",t.acceptanceText),applyActions:t.applyActions.map(kO),...j("recommendationActionStepMeta",t.recommendationActionStepMeta)});case"LockUnlock":return Zt(t.bag,{...r,type:"LockUnlock",lock:t.lock});case"ShowErrorMessage":return Zt(t.bag,{...r,type:"ShowErrorMessage",errorMessage:t.errorMessage,...j("messageLevel",t.messageLevel),...j("messageActionSteps",t.messageActionSteps)});case"SetFieldValue":return Zt(t.bag,{...r,type:"SetFieldValue",...vd(t)});case"SetDefaultValue":return Zt(t.bag,{...r,type:"SetDefaultValue",...vd(t)});case"SetBusinessRequired":return Zt(t.bag,{...r,type:"SetBusinessRequired",required:t.required});case"SetVisibility":return Zt(t.bag,{...r,type:"SetVisibility",visible:t.visible});default:return ov(t)}}isConditionJson(t){return Object.prototype.hasOwnProperty.call(t,"clauses")&&Object.prototype.hasOwnProperty.call(t,"logic")&&!Object.prototype.hasOwnProperty.call(t,"type")}};ln.BusinessRuleAdapter=Os;function cv(e,t,r){(0,cr.optionalEnum)(e,"logic",["AND","OR"],t,"condition-logic-invalid",r),(0,cr.childObjects)(e,"clauses",t,"clause",r);for(let n of["trueBranch","falseBranch"])(0,cr.childObjects)(e,n,t,"branchItem",r).forEach(({node:a,index:o})=>{"clauses"in a||"trueBranch"in a||"falseBranch"in a?cv(a,`${t}/${n}/${o}`,r):qO(a,`${t}/${n}/${o}`,r)})}function qO(e,t,r){e.type==="SetDefaultValue"&&e.valueType==="Clear"&&r.push((0,cr.issue)(`${t}/valueType`,"clear-only-set-field-value","Clear is only supported for SetFieldValue actions."))}function VO(e){if(e.type==="SetDefaultValue"&&e.valueType==="Clear")throw new Error("Clear is only supported for SetFieldValue actions.")}function GO(){return{adapter:new Os,api:EO.businessRuleApi,publish:(e,t,r)=>(0,rv.publishBoundEntity)(e,r),publishScope:(e,t)=>(0,rv.boundEntityPublishScope)(t)}}ln.businessRuleRegistration=GO});var xs=g(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});Fs.JsonPointer=void 0;var Tt=ie(),Rs=class e{static isReservedToken(t){return e.RESERVED_TOKENS.has(t)}static decodeToken(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}static encodeToken(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}static parse(t){if(t==="")return[];if(t[0]!=="/")throw new Tt.JsonPointerError(t,'non-empty pointers must start with "/"');return t.substring(1).split("/").map(r=>{if(/~(?![01])/.test(r))throw new Tt.JsonPointerError(t,`invalid '~' escape in token '${r}' (expected ~0 or ~1)`);return e.decodeToken(r)})}static compile(t){return t.length===0?"":"/"+t.map(r=>e.encodeToken(r)).join("/")}static resolve(t,r){let n=e.parse(r),i=t;for(let a of n)if(Array.isArray(i)){let o=e.toArrayIndex(a,i.length);if(o===void 0)return;i=i[o]}else if(i!==null&&typeof i=="object"){let o=i;if(e.isReservedToken(a)||!Object.prototype.hasOwnProperty.call(o,a))return;i=o[a]}else return;return i}static set(t,r,n){let i=e.parse(r);if(i.length===0)throw new Tt.JsonPointerError(r,"cannot set the document root");let{parent:a,lastToken:o}=e.resolveParent(t,i,r);if(Array.isArray(a)){let s=e.toArrayIndex(o,a.length);if(s===void 0)throw new Tt.JsonPointerError(r,`'${o}' is not a valid array index`);if(s>a.length)throw new Tt.JsonPointerError(r,`array index '${o}' is out of range`);a[s]=n}else{if(e.isReservedToken(o))throw new Tt.JsonPointerError(r,`refusing to write reserved property '${o}'`);a[o]=n}}static remove(t,r){let n=e.parse(r);if(n.length===0)throw new Tt.JsonPointerError(r,"cannot remove the document root");let{parent:i,lastToken:a}=e.resolveParent(t,n,r);if(Array.isArray(i)){let o=e.toArrayIndex(a,i.length);if(o===void 0||o>=i.length)throw new Tt.JsonPointerError(r,`array index '${a}' is out of range`);i.splice(o,1)}else{if(e.isReservedToken(a))throw new Tt.JsonPointerError(r,`refusing to remove reserved property '${a}'`);delete i[a]}}static add(t,r,n,i){let a=e.parse(r);if(a.length>0&&a[a.length-1]==="-"){let l=e.compile(a.slice(0,-1)),u=e.resolve(t,l);if(!Array.isArray(u))throw new Tt.JsonPointerError(r,"add target must be an array");u.push(n);return}let o=e.resolve(t,r);if(!Array.isArray(o))throw new Tt.JsonPointerError(r,"add target must be an array");let s=i===void 0?o.length:i;if(s<0||s>o.length)throw new Tt.JsonPointerError(r,`insert index ${s} is out of range`);o.splice(s,0,n)}static parent(t){let r=e.parse(t);return r.pop(),e.compile(r)}static lastToken(t){let r=e.parse(t);return r.length===0?"":r[r.length-1]}static append(t,r){return`${t}/${e.encodeToken(String(r))}`}static resolveParent(t,r,n){let i=r[r.length-1],a=e.compile(r.slice(0,-1)),o=e.resolve(t,a);if(o===null||typeof o!="object")throw new Tt.JsonPointerError(n,"parent path does not resolve to an object or array");return{parent:o,lastToken:i}}static toArrayIndex(t,r){if(t==="-")return r;if(/^(0|[1-9][0-9]*)$/.test(t))return Number(t)}};Fs.JsonPointer=Rs;Rs.RESERVED_TOKENS=new Set(["__proto__","prototype","constructor"])});var pv=g(Ls=>{"use strict";Object.defineProperty(Ls,"__esModule",{value:!0});Ls.findElements=void 0;var dv=xs();function zO(e,t){let r=[];return bd(e,"",t,r),r}Ls.findElements=zO;function bd(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)=>{bd(i,dv.JsonPointer.append(t,a),r,n)});else for(let i of Object.keys(e))bd(e[i],dv.JsonPointer.append(t,i),r,n)}});var hv=g(rt=>{"use strict";var WO=rt&&rt.__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]})),jO=rt&&rt.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),mv=rt&&rt.__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)&&WO(t,e,r);return jO(t,e),t};Object.defineProperty(rt,"__esModule",{value:!0});rt.canonicalArtifactId=rt.WorkspaceManager=rt.WORKSPACE_SCHEMA_VERSION=void 0;var _e=mv(require("fs")),Re=mv(require("path")),Ai=ie();rt.WORKSPACE_SCHEMA_VERSION=1;var ks={form:"forms",view:"views",businessRule:"business-rules",app:"apps",command:"commands",chart:"charts",dashboard:"dashboards",genPage:"gen-pages",bpf:"business-process-flows"},HO="manifest.json",Ms=".metadata",fv="entities",wd=class{constructor(t,r){this.workspacePath=t,this.instanceUrl=r}getRoot(){return this.workspacePath}getArtifactDir(t){return Re.join(this.workspacePath,ks[t])}getArtifactFilePath(t,r){return this.assertSafeId(r),this.assertWithinRoot(Re.join(this.getArtifactDir(t),`${Ha(r)}.json`))}getMetaFilePath(t,r){return this.assertSafeId(r),this.assertWithinRoot(Re.join(this.workspacePath,Ms,ks[t],`${Ha(r)}.meta.json`))}getEntityMetaFilePath(t){return this.assertSafeId(t),this.assertWithinRoot(Re.join(this.workspacePath,Ms,fv,`${t}.json`))}assertSafeId(t){if(typeof t!="string"||t.length===0||/[\u0000-\u001f]/.test(t)||t.includes("/")||t.includes("\\")||t.includes(":")||t==="."||t===".."||t.includes("..")||Re.basename(t)!==t)throw new Ai.PathTraversalError(String(t),this.workspacePath)}assertWithinRoot(t){let r=Re.resolve(this.workspacePath),n=Re.resolve(t);if(n!==r&&!n.startsWith(r+Re.sep))throw new Ai.PathTraversalError(t,this.workspacePath);let i=_e.existsSync(r)?_e.realpathSync(r):r,a=n,o=[];for(;!_e.existsSync(a);){o.unshift(Re.basename(a));let l=Re.dirname(a);if(l===a)break;a=l}let s=Re.resolve(_e.realpathSync(a),...o);if(s!==i&&!s.startsWith(i+Re.sep))throw new Ai.PathTraversalError(t,this.workspacePath);return n}get manifestPath(){return Re.join(this.workspacePath,HO)}init(){for(let t of Object.keys(ks))_e.mkdirSync(this.getArtifactDir(t),{recursive:!0}),_e.mkdirSync(Re.dirname(this.getMetaFilePath(t,"x")),{recursive:!0});if(_e.mkdirSync(Re.join(this.workspacePath,Ms,fv),{recursive:!0}),!this.exists(this.manifestPath)){let t={instanceUrl:this.instanceUrl,createdAt:new Date().toISOString(),artifacts:[]};this.writeManifest(t)}}isInitialized(){return this.exists(this.manifestPath)}ensureInitialized(){if(!this.isInitialized())throw new Ai.WorkspaceNotInitializedError(this.workspacePath)}clean(){for(let r of Object.keys(ks))Ad(this.getArtifactDir(r));Ad(Re.join(this.workspacePath,Ms));let t=this.getManifest();t.artifacts=[],t.lastSyncAt=void 0,this.init(),this.writeManifest(t)}readArtifact(t,r){return this.ensureInitialized(),this.readJson(this.getArtifactFilePath(t,r))}writeArtifact(t,r,n){this.ensureInitialized(),this.writeJson(this.getArtifactFilePath(t,r),n),this.upsertManifestEntry(t,r,n)}deleteArtifact(t,r){this.ensureInitialized(),this.removeFile(this.getArtifactFilePath(t,r)),this.removeFile(this.getMetaFilePath(t,r));let n=Ha(r),i=this.getManifest();i.artifacts=i.artifacts.filter(a=>!(a.type===t&&a.id===n)),this.writeManifest(i)}listArtifacts(t,r){return this.ensureInitialized(),this.getManifest().artifacts.filter(n=>!(t&&n.type!==t||r?.entityLogicalName&&n.entityLogicalName!==r.entityLogicalName))}readEntityMetadata(t){this.ensureInitialized();let r=this.readJson(this.getEntityMetaFilePath(t));return!r||typeof r.schemaName!="string"||typeof r.primaryNameAttribute!="string"||typeof r.primaryIdAttribute!="string"||typeof r.isCustomEntity!="boolean"?null:r}writeEntityMetadata(t,r){this.ensureInitialized(),this.writeJson(this.getEntityMetaFilePath(t),r)}getManifest(){this.ensureInitialized();let t=this.readJson(this.manifestPath);if(!t)throw new Ai.WorkspaceNotInitializedError(this.workspacePath);if(t.schemaVersion!==void 0&&t.schemaVersion>rt.WORKSPACE_SCHEMA_VERSION)throw new Ai.IncompatibleWorkspaceError(t.schemaVersion,rt.WORKSPACE_SCHEMA_VERSION);return t}writeManifest(t){this.writeJson(this.manifestPath,{...t,schemaVersion:rt.WORKSPACE_SCHEMA_VERSION})}updateManifest(t){let r=this.getManifest();this.writeManifest({...r,...t})}upsertManifestEntry(t,r,n){let i=this.getManifest(),a=Ha(r),o=n,s=typeof o.name=="string"?o.name:`${t}:${a}`,l=typeof o.entityLogicalName=="string"?o.entityLogicalName:void 0,u=i.artifacts.find(c=>c.type===t&&c.id===a);u?(u.name=s,u.entityLogicalName=l):i.artifacts.push({type:t,id:a,name:s,entityLogicalName:l,isDirty:!1}),this.writeManifest(i)}readJson(t){return this.exists(t)?JSON.parse(_e.readFileSync(t,"utf8")):null}writeJson(t,r){let n=Re.dirname(t);_e.mkdirSync(n,{recursive:!0});let i=Re.join(n,`.${Re.basename(t)}.${Date.now()}.${Math.random().toString(36).slice(2)}.tmp`);try{_e.writeFileSync(i,`${JSON.stringify(r,null,2)}
+`,"utf8"),_e.renameSync(i,t)}catch(a){try{_e.existsSync(i)&&_e.unlinkSync(i)}catch{}throw a}}removeFile(t){this.exists(t)&&_e.unlinkSync(t)}exists(t){return _e.existsSync(t)}};rt.WorkspaceManager=wd;function Ha(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()}rt.canonicalArtifactId=Ha;function Ad(e){let t;try{t=_e.lstatSync(e)}catch{return}if(t.isSymbolicLink()){try{_e.unlinkSync(e)}catch{_e.rmdirSync(e)}return}if(!t.isDirectory()){_e.unlinkSync(e);return}for(let r of _e.readdirSync(e))Ad(Re.join(e,r));_e.rmdirSync(e)}});var Cd=g(Ci=>{"use strict";Object.defineProperty(Ci,"__esModule",{value:!0});Ci.deepEqual=Ci.deepDiff=void 0;var JO=xs();function QO(e,t){let r=[];return vv(e,t,"",r,0),r}Ci.deepDiff=QO;var Us=Symbol("missing"),Bs=512;function vv(e,t,r,n,i){if(e===t)return;if(i>Bs)throw new RangeError(`deepDiff exceeded the maximum supported depth of ${Bs}`);let a=$s(e),o=$s(t);if(a&&o&&Array.isArray(e)===Array.isArray(t)){let s=XO(e,t);for(let l of s){let u=gv(e,l),c=gv(t,l),d=JO.JsonPointer.append(r,l);u===Us?n.push({pointer:d,type:"added",newValue:c}):c===Us?n.push({pointer:d,type:"removed",oldValue:u}):vv(u,c,d,n,i+1)}return}yv(e,t)||n.push({pointer:r,type:"modified",oldValue:e,newValue:t})}function $s(e){return e!==null&&typeof e=="object"}function XO(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 gv(e,t){if(Array.isArray(e)){let r=Number(t);return r<e.length?e[r]:Us}return t in e?e[t]:Us}function yv(e,t){return bv(e,t,0)}Ci.deepEqual=yv;function bv(e,t,r){if(e===t)return!0;if(r>Bs)throw new RangeError(`deepEqual exceeded the maximum supported depth of ${Bs}`);if(!$s(e)||!$s(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&&bv(e[a],t[a],r+1))}});var Av=g(qs=>{"use strict";Object.defineProperty(qs,"__esModule",{value:!0});qs.VersionManager=void 0;var wv=Cd(),Sd=class{constructor(t){this.workspace=t}storeMeta(t,r,n){this.workspace.writeJson(this.workspace.getMetaFilePath(t,r),n)}getMeta(t,r){return this.workspace.readJson(this.workspace.getMetaFilePath(t,r))}isDirty(t,r){let n=this.workspace.readArtifact(t,r);if(n===null)return!1;let i=this.getMeta(t,r);return i?!(0,wv.deepEqual)(i.snapshot,n):!0}diff(t,r){let n=this.workspace.readArtifact(t,r),i=this.getMeta(t,r),a;return n===null?a=i?[{pointer:"",type:"removed",oldValue:i.snapshot}]:[]:i?a=(0,wv.deepDiff)(i.snapshot,n):a=[{pointer:"",type:"added",newValue:n}],{artifactType:t,artifactId:r,changes:a}}checkConflict(t,r,n){let i=this.getMeta(t,r);return!i||i.etag===null?!1:i.etag!==n}};qs.VersionManager=Sd});var Sv=g((Ed,Cv)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof Ed=="object"?Cv.exports=t():e.compareVersions=t()})(Ed,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 m=l[l.length-1],h=u[u.length-1];if(m&&h){var w=m.split(".").map(n),b=h.split(".").map(n);for(c=0;c<Math.max(w.length,b.length);c++){if(w[c]===void 0||typeof b[c]=="string"&&typeof w[c]=="number")return-1;if(b[c]===void 0||typeof w[c]=="string"&&typeof b[c]=="number"||w[c]>b[c])return 1;if(b[c]>w[c])return-1}}else if(m||h)return m?-1:1;return 0}})});var _v=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 Ev;(function(e){e.CommonDataService="CommonDataService",e.None="None"})(Ev||(Ee.DatabaseType=Ev={}));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 Nv;(function(e){e[e.CDS2=0]="CDS2",e[e.CDS1=1]="CDS1",e[e.Empty=2]="Empty"})(Nv||(Ee.EnvironmentType=Nv={}));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 Dv;(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"})(Dv||(Ee.EnvironmentDisableReasonCode=Dv={}));var Iv;(function(e){e.LogicApps="LogicApps",e.SelfHostSingleTenant="SelfHostSingleTenant",e.SelfHostMultiTenant="SelfHostMultiTenant"})(Iv||(Ee.EnvironmentFlowHostingType=Iv={}))});var kv=g(A=>{"use strict";var KO=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 YO=KO(Sv()),le=_v(),Ja=Dd();function ZO(e){let t=Ur(e);return t&&t.version}A.getCrmVersion=ZO;function Ur(e){return e&&e.properties&&e.properties.linkedEnvironmentMetadata}A.getLinkedEnvironmentMetadata=Ur;function Mr(e,t){return e?!!e[t]:!1}A.doesUserHavePermission=Mr;A.crmBapSolutionId="00000001-0000-0000-0001-00000000009b";A.DEFAULT_SOLUTION_ID="fd140aaf-4df4-11dd-bd17-0019b9312238";A.DEFAULT_SOLUTION_UNIQUE_NAME="Default";function qn(e){return!!Ur(e)&&Pv(e)}A.environmentHasCds2Database=qn;function eR(e){if(e&&qn(e)){let t=un(e);return(0,Ja.getCrmAdminSecurityRolesUrl)(t)}return""}A.getSecurityUsersUrl=eR;function tR(e){if(e&&qn(e)){let t=un(e);return(0,Ja.getCrmAdminSecurityUsersUrl)(t)}return""}A.getSecurityRolesUrl=tR;function rR(e){if(e&&qn(e)){let t=un(e);(0,Ja.getCrmAllSolutionsUrl)(t)}return""}A.getAllSolutionsUrl=rR;function nR(e){if(e&&qn(e)){let t=un(e);return(0,Ja.getCrmAllPublishersUrl)(t)}return""}A.getAllPublishersUrl=nR;function iR(e){return e&&qn(e)?un(e):""}A.getAllThemesUrl=iR;function Pv(e){return!!e&&e.properties&&!!e.properties.provisioningState&&e.properties.provisioningState.toUpperCase()===le.EnvironmentProvisioningStates.Succeeded.toUpperCase()}A.isEnvironmentInSuccessfulState=Pv;function aR(e){if(e&&qn(e)){let t=un(e);return(0,Ja.getCrmDevResourcesUrl)(t)}return""}A.getDevResourcesUrl=aR;function oR(e){return`${e}designer/app/{${A.crmBapSolutionId}}/CreateNewApp}}`}A.getCrmAppDesignerUrl=oR;function un(e){let t=Ur(e);if(t){let r=t.instanceUrl;return r?r.endsWith("/")?r:r+"/":""}return""}A.getCrmInstanceUrl=un;function sR(e){let t=Ur(e);return t?t.uniqueName:""}A.getCrmInstanceName=sR;function lR(e){return Ur(e)?le.EnvironmentType.CDS2:e&&e.properties&&e.properties.namespace?le.EnvironmentType.CDS1:le.EnvironmentType.Empty}A.getEnvironmentType=lR;function uR(e){return e&&e.properties&&e.properties.environmentSku===le.EnvironmentSkuConstants.Developer}A.isDevEnvironment=uR;function cR(e){return e&&e.properties&&e.properties.environmentSku===le.EnvironmentSkuConstants.Production}A.isProdEnvironment=cR;function dR(e){return e&&e.properties&&e.properties.environmentSku===le.EnvironmentSkuConstants.Sandbox}A.isSandboxEnvironment=dR;function Qa(e){return e&&e.properties&&e.properties.environmentSku===le.EnvironmentSkuConstants.Teams}A.isTeamsEnvironment=Qa;function pR(e){return e&&e.properties&&e.properties.environmentSku===le.EnvironmentSkuConstants.Platform}A.isPlatformEnvironment=pR;var fR=e=>{var t;return((t=e.properties)===null||t===void 0?void 0:t.environmentSku)===le.EnvironmentSkuConstants.Trial};A.isTrialEnvironment=fR;function mR(e){return e&&e.properties&&(e.properties.isDefault||e.properties.creationType===le.EnvironmentCreationTypeConstants.DefaultTenant)}A.isDefaultEnvironment=mR;function hR(e){return e&&e.properties&&!!e.properties.states&&!!e.properties.states.runtime&&e.properties.states.runtime.id==="Disabled"}A.isDisabledEnvironment=hR;function gR(e){return e&&e.properties&&Mr(e.properties.permissions,le.environmentPermissions.CreateDatabase)}A.canUserCreateDatabase=gR;function vR(e){return!!(e&&e.properties&&e.properties.provisioningState&&Lv(e.properties.provisioningState,le.EnvironmentProvisioningStates.LinkedDatabaseProvisioning))}A.isDatabaseInProvisioningState=vR;function yR(e){return!!e&&!!e.properties&&e.properties.provisioningState===le.EnvironmentProvisioningStates.Creating}A.isEnvironmentInCreatingState=yR;function bR(e){return e&&e.properties&&(e.properties.provisioningState===le.EnvironmentProvisioningStates.Deleted||e.properties.provisioningState===le.EnvironmentProvisioningStates.Deleting||e.properties.provisioningState===le.EnvironmentProvisioningStates.FailedDeleting)}A.isEnvironmentInDeletedState=bR;function wR(e){return!!e&&!!e.properties&&!!e.properties.expirationTime&&Date.parse(e.properties.expirationTime)<Date.now()}A.isEnvironmentExpired=wR;function AR(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=AR;function CR(e){return!!e&&!!e.properties&&!!e.properties.cluster&&e.properties.cluster.category==="Test"}A.isEnvironmentInTestCluster=CR;function SR(e){return!!e&&!!e.properties&&!!e.properties.cluster&&e.properties.cluster.category==="Preprod"}A.isEnvironmentInPreprodCluster=SR;function ER(e){return!!e&&!!e.properties&&!!e.properties.cluster&&e.properties.cluster.category==="FirstRelease"}A.isEnvironmentInFirstReleaseCluster=ER;function NR(e){return e&&e.name||""}A.getEnvironmentName=NR;function DR(e){return e&&e.properties&&e.properties.displayName||""}A.getEnvironmentDisplayName=DR;var Tv="9.1.0.8202";A.cdsVersionSupportingOSColorEdit="9.1.0000.20708";function IR(e){return Fv(e,Tv)}A.doesCds2EnvironmentSupportApiVersion9_1=IR;function _R(e){return Nd(e,Tv)}A.doesCds2VersionSupportApiVersion9_1=_R;function Ov(e){let t=Ur(e);if(t)return t.securityGroupId}function Rv(e){return e&&e.properties&&e.properties.connectedGroups}function PR(e,t){let r=Rv(e);return!!r&&!!r.find(n=>n.id===t)||Ov(e)===t}A.hasSecurityGroupId=PR;function TR(e){let t=Rv(e);return t&&t.length>0&&t[0].id?t[0].id:Ov(e)}A.getSecurityOrConnectedGroupId=TR;function Fv(e,t){let r=e.version;return r?Nd(r,t):!1}A.isCds2EnvironmentVersionAtLeast=Fv;function Nd(e,t){return t?e?(0,YO.default)(e,t)>=0:!1:!0}A.checkVersions=Nd;function OR(e){return e&&e.properties&&e.properties.updateCadence&&e.properties.updateCadence.id||"NotSpecified"}A.getEnvironmentUpdateCadence=OR;function RR(e){let t=Ur(e);return t?Number(t.baseLanguage):0}A.getEnvironmentLanguageCode=RR;function xv(e){let t=Ur(e);return t?t.instanceApiUrl:void 0}A.getEnvironmentInstanceApiUrl=xv;function FR(e){let t=xv(e);return t?t+"/api/data/v9.2":""}A.getEnvironmentWebApiUrl=FR;function xR(e){let t=un(e);if(t==="")return"";let r=t.split("/");if(r.length!==4)return"";let n=r[2].split(".");return n[0]="globaldisco",r[2]=n.join("."),r.join("/")+"api/discovery/v2.0/Instances"}A.getEnvironmentDiscoveryUrl=xR;var LR=e=>{var t;return((t=e.properties)===null||t===void 0?void 0:t.databaseType)===le.DatabaseType.CommonDataService};A.hasCommonDataServiceDatabase=LR;var kR=e=>{var t;return Mr((t=e.properties)===null||t===void 0?void 0:t.permissions,le.environmentPermissions.AdminReadEnvironment)};A.doesUserHaveAdminPermission=kR;var MR=e=>{var t;return Mr((t=e.properties)===null||t===void 0?void 0:t.permissions,le.environmentPermissions.CreatePowerApp)};A.doesUserHaveCreateAppPermission=MR;var UR=e=>(0,A.doesUserHaveAdminPermission)(e)&&(0,A.hasCommonDataServiceDatabase)(e)?!0:(0,A.doesUserHaveCreateAppPermission)(e)?Qa(e)||(0,A.doesUserHaveDatabaseTablePermissions)(e):!1;A.isUserMakerWithDataAccess=UR;var BR=e=>(0,A.doesUserHaveCreateAppPermission)(e)&&!Qa(e)&&!(0,A.doesUserHaveDatabaseTablePermissions)(e)&&(!(0,A.doesUserHaveAdminPermission)(e)||!(0,A.hasCommonDataServiceDatabase)(e));A.isUserMakerWithoutDataAccess=BR;var $R=e=>[le.environmentPermissions.CreateDatabaseEntities,le.environmentPermissions.ListDatabaseEntities,le.environmentPermissions.UpdateDatabaseEntities,le.environmentPermissions.DeleteDatabaseEntities].every(t=>{var r;return Mr((r=e.properties)===null||r===void 0?void 0:r.permissions,t)});A.doesUserHaveDatabaseTablePermissions=$R;var qR=e=>{var t;return Mr((t=e.properties)===null||t===void 0?void 0:t.permissions,le.environmentPermissions.CreateDatabase)};A.doesUserHaveCreateDatabasePermission=qR;function Lv(e,t){return!e&&!t?!0:!e||!t?!1:e.toUpperCase()===t.toUpperCase()}A.equalsIgnoreCase=Lv;var VR=e=>{var t;return Mr((t=e.properties)===null||t===void 0?void 0:t.permissions,le.environmentPermissions.CreateFlow)};A.doesUserHaveCreateFlowPermission=VR;var GR=e=>(0,A.doesUserHaveAdminPermission)(e)&&(0,A.hasCommonDataServiceDatabase)(e)?!0:(0,A.doesUserHaveCreateFlowPermission)(e)?Qa(e)||(0,A.doesUserHaveDatabaseTablePermissions)(e):!1;A.isUserPautoMakerWithDataAccess=GR;var zR=e=>(0,A.doesUserHaveCreateFlowPermission)(e)&&!Qa(e)&&!(0,A.doesUserHaveDatabaseTablePermissions)(e)&&(!(0,A.doesUserHaveAdminPermission)(e)||!(0,A.hasCommonDataServiceDatabase)(e));A.isUserPautoMakerWithoutDataAccess=zR;var WR=e=>{var t,r;return!Mr((t=e.properties)===null||t===void 0?void 0:t.permissions,le.environmentPermissions.CreateFlow)&&Mr((r=e.properties)===null||r===void 0?void 0:r.permissions,le.environmentPermissions.ReadEnvironment)};A.doesUserHaveFlowRunOnlyPermission=WR});var Dd=g(y=>{"use strict";Object.defineProperty(y,"__esModule",{value:!0});y.getRequiredComponentsQueryUrl=y.solutionComponentCountSummariesQueryUrl=y.solutionComponentSummariesQueryUrl=y.solutionComponentConfigurationsQueryUrl=y.chartsQueryUrl=y.workflowsQueryUrl=y.entityDefinitionsQueryUrl=y.solutionComponentDefinitionsQueryUrl=y.getCreateNewArticleTemplateUrl=y.getCreateNewPublisherUrl=y.getEnableSecurityRolesUrl=y.getArticleTemplateUrl=y.getFieldSecurityProfileDesignerUrl=y.getSecurityRoleDesignerUrl=y.getMailMergeTemplateDesignerUrl=y.getEmailTemplateDesignerUrl=y.getConnectionRoleDesignerUrl=y.getSiteMapDesignerUrl=y.getWebResourceFileUrl=y.getWebResourceDesignerUrl=y.getReportDesignerUrl=y.getBusinessProcessFlowDesignerUrl=y.getProcessShareUrl=y.getProcessDesignerUrl=y.getChartDesignerUrl=y.getOpenModernEntityDashboardUrl=y.getNewModernEntityDashboardUrl=y.getNewModernDashboardUrl=y.getOpenModernDashboardUrl=y.getDashboardDesignerUrl=y.getAppModuleDesignerUrl=y.privilegesQueryUrls=y.xrmApiUrl=y.getPlayAppModuleUrl=y.getCrmAdminSecurityUsersUrl=y.getCrmAdminSecurityRolesUrl=y.getCrmMyAppsUrl=y.getCrmAppDesignerUrl=y.getCrmDevResourcesUrl=y.getCrmAllPublishersUrl=y.getCrmAllSolutionsUrl=y.getSolutionPublisherUrl=y.getExportTranslationFileName=y.getExportSolutionTranslationUrl=y.getImportSolutionTranslationUrl=y.getShowSolutionDependenciesUrl=y.getShowComponentDependenciesUrl=y.cdsServiceUrl=y.ODATA_NEXT_LINK=y.ODATA_MAX_PAGE_SIZE=void 0;y.retrieveOrganizationResources=y.getUCIEntityRecordEditUrl=y.getUCIEntityRecordBaseUrl=y.getBusinessRuleDesignerUri=y.retrieveUnpublishedSuffix=y.getSavePowerSettingUri=y.getPowerSettingUri=y.getPowerSettingsUri=y.RetrievePlatform=y.getAppSettingOverrideUri=y.AppSettingOverrideName=y.getOrgSettingOverrideUri=y.OrgSettingOverrideName=y.getSettingDefinitionsUri=y.retrieveFeatureControlSettingsByNamespaceUrl=y.retrieveDeploymentPipelineConfigAppUrl=y.SPNPrincipalIdUrl=y.retrieveDeploymentEnvironmentInfoUrl=y.devSolutionInfoUrl=y.deployOperationStatusUrl=y.getAIGeneratedDeploymentNotesUrl=y.deploymentStageRunUrl=y.validatePackageAsyncUrl=y.deployPackageAsyncUrl=y.updateDeploymentStageRunUrl=y.createDeploymentStageRunUrl=y.retrieveDeploymentStagesUrl=y.retrievePipelinesUrl=y.retrieveDeploymentPipelineInfoUrl=y.getDeploymentStageRunsUrl=y.appDeploymentUrls=y.getProvisionLanguageUrl=y.getSolutionQueryUrl=y.getSolutionsByUniqueNameQueryUrl=y.solutionsQueryUrl=y.getDependentComponentsWithMetadataQueryUrl=void 0;var Mv=kv();y.ODATA_MAX_PAGE_SIZE="odata.maxpagesize";y.ODATA_NEXT_LINK="@odata.nextLink";y.cdsServiceUrl="https://cds-org/";var Ka;(function(e){e.AllSolutions="11",e.AllPublishers="10",e.DevResources="05"})(Ka||(Ka={}));function jR(e,t,r,n){return`${e}tools/dependency/dependencyviewdialog.aspx?appSolutionId=%7b${t}%7d&dType=1&objectid=%7b${r}%7d&objecttype=${n}&operationtype=showdependency`}y.getShowComponentDependenciesUrl=jR;function HR(e,t){let r=`dType=1&isproactivecheck=true&objecttype=7100&operationtype=dependenciesforuninstall&objectid=${t}`;return`${e}tools/dependency/dependencyviewdialog.aspx?${r}`}y.getShowSolutionDependenciesUrl=HR;function JR(e,t){return`${e}tools/muiProvisioning/Dialogs/LangTranslationsImport.aspx?dType=1&appSolutionId=${t}`}y.getImportSolutionTranslationUrl=JR;function QR(e,t){return`${e}_grid/cmds/dlg_exportsolution.aspx?command=exporttranslation&appSolutionId=${t}`}y.getExportSolutionTranslationUrl=QR;function XR(e,t){return e!==void 0&&t!==void 0&&`CrmTranslations_${e}_${t.replace(/[.]/g,"_")}.zip`||""}y.getExportTranslationFileName=XR;function KR(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`}y.getSolutionPublisherUrl=KR;function Id(e,t){return`${e}tools/systemcustomization/systemCustomization.aspx?pid=${t}`}function YR(e){return Id(e,Ka.AllSolutions)}y.getCrmAllSolutionsUrl=YR;function ZR(e){return Id(e,Ka.AllPublishers)}y.getCrmAllPublishersUrl=ZR;function eF(e){return Id(e,Ka.DevResources)}y.getCrmDevResourcesUrl=eF;function tF(e,t=Mv.crmBapSolutionId){return`${e}designer/app/${t}#/CreateNewApp`}y.getCrmAppDesignerUrl=tF;function rF(e){return`${e}apps`}y.getCrmMyAppsUrl=rF;function nF(e){return Uv(e,"role")+"&forceUCI=0"}y.getCrmAdminSecurityRolesUrl=nF;function iF(e){return`${Uv(e,"systemuser")}&forceclassic=1`}y.getCrmAdminSecurityUsersUrl=iF;function Uv(e,t){return`${e}main.aspx?pagetype=entitylist&etn=${t}`}function aF(e,t){return`${e}main.aspx?appid=${t}`}y.getPlayAppModuleUrl=aF;y.xrmApiUrl="api/data/v9.0";y.privilegesQueryUrls={systemUserInfo:e=>`${e}${y.xrmApiUrl}/WhoAmI`,userPrivileges:(e,t)=>`${e}${y.xrmApiUrl}/systemusers(${t})/Microsoft.Dynamics.CRM.RetrieveUserPrivileges`,systemPrivileges:e=>`${e}${y.xrmApiUrl}/privileges/Microsoft.Dynamics.CRM.RetrievePrivilegeSet`};function oF(e,t,r=Mv.crmBapSolutionId){return`${e}designer/app/${r}/${t}/AppDesignerCanvas/${t}`}y.getAppModuleDesignerUrl=oF;function sF(e,t,r,n){return`${e}main.aspx?appSolutionId=%7b${r}%7d&extraqs=%26formId%3d%7b${t}%7d%26dashboardType%3d1030&pagetype=${`${n?"ic":""}dashboardeditor`}`}y.getDashboardDesignerUrl=sF;function lF(e,t,r){return`/e/${e}/s/${t}/dashboard/${r}`}y.getOpenModernDashboardUrl=lF;function uF(e,t,r){let n=r!==void 0?r.toString():void 0;return`/e/${e}/s/${t}/dashboard/new${n?`/${n}`:""}`}y.getNewModernDashboardUrl=uF;function cF(e,t,r,n){let i=n!==void 0?n.toString():void 0;return`/e/${e}/s/${t}/n/${r}/dashboard/new${i?`/${i}`:""}`}y.getNewModernEntityDashboardUrl=cF;function dF(e,t,r,n){return`/e/${e}/s/${t}/n/${r}/dashboard/${n}`}y.getOpenModernEntityDashboardUrl=dF;function pF(e,t,r,n){return`${e}main.aspx?appSolutionId=%7b${t}%7d&extraqs=etc=${r||""}`+(n?`%26id=${n}`:"")+"&pagetype=vizdesigner"}y.getChartDesignerUrl=pF;function fF(e,t,r){return`${e}sfa/workflow/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}y.getProcessDesignerUrl=fF;function mF(e,t,r){return`${e}sfa/workflow/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}y.getProcessShareUrl=mF;function hF(e,t){return`${e}Tools/ProcessControl/UnifiedProcessDesigner.aspx?id=${t}`}y.getBusinessProcessFlowDesignerUrl=hF;function gF(e,t,r){return`${e}CRMReports/reportproperty.aspx?appSolutionId=%7b${r}%7d&disablePersonal=true&id=%7b${t}%7d`}y.getReportDesignerUrl=gF;function vF(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`}y.getWebResourceDesignerUrl=vF;function yF(e,t){return`${e}WebResources/${t}`}y.getWebResourceFileUrl=yF;function bF(e,t,r){return`${e}designer/sitemap/${r}/${t}/SiteMapHome/${t}`}y.getSiteMapDesignerUrl=bF;function wF(e,t,r){return`${e}connections/connectionroles/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}y.getConnectionRoleDesignerUrl=wF;function AF(e,t,r){return`${e}tools/emailtemplateeditor/emailtemplateeditor.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}y.getEmailTemplateDesignerUrl=AF;function CF(e,t,r){return`${e}tools/mailmerge/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}y.getMailMergeTemplateDesignerUrl=CF;function SF(e,t,r){return`${e}biz/roles/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}y.getSecurityRoleDesignerUrl=SF;function EF(e,t,r){return`${e}biz/fieldsecurityprofiles/edit.aspx?_CreateFromId=%7b${r}%7d&_CreateFromType=7100&appSolutionId=%7b${r}%7d&id=%7b${t}%7d`}y.getFieldSecurityProfileDesignerUrl=EF;function NF(e,t,r){return`${e}tools/kbtemplateeditor/kbtemplateeditor.aspx?_CreateFromId=%7b${t}%7d&_CreateFromType=7100&appSolutionId=%7b${t}%7d&id=%7b${r}%7d`}y.getArticleTemplateUrl=NF;function DF(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}`}y.getEnableSecurityRolesUrl=DF;function IF(e){return`${e}tools/publisher/edit.aspx`}y.getCreateNewPublisherUrl=IF;function _F(e,t){return`${e}tools/kbtemplateeditor/kbtemplateeditor.aspx?appSolutionId=${t}`}y.getCreateNewArticleTemplateUrl=_F;y.solutionComponentDefinitionsQueryUrl="api/data/v9.0/solutioncomponentdefinitions";y.entityDefinitionsQueryUrl="api/data/v9.0/EntityDefinitions?$select=EntitySetName,DisplayName,LogicalName&$filter=";y.workflowsQueryUrl="api/data/v9.0/workflows";y.chartsQueryUrl="/api/data/v9.0/savedqueryvisualizations";y.solutionComponentConfigurationsQueryUrl="/api/data/v9.1/solutioncomponentconfigurations?$filter=isdisplayable eq true&$select=name";y.solutionComponentSummariesQueryUrl="/api/data/v9.0/msdyn_solutioncomponentsummaries";y.solutionComponentCountSummariesQueryUrl="/api/data/v9.0/msdyn_solutioncomponentcountsummaries";function PF(e,t){return`${y.xrmApiUrl}/RetrieveRequiredComponents(ObjectId=${e},ComponentType=${t})`}y.getRequiredComponentsQueryUrl=PF;function TF(e,t){return`${y.cdsServiceUrl}${y.xrmApiUrl}/RetrieveDependentComponentsWithMetadata(ObjectId=${e},ComponentType=${t})`}y.getDependentComponentsWithMetadataQueryUrl=TF;y.solutionsQueryUrl="/api/data/v9.0/solutions?$expand=publisherid&$filter=(isvisible eq true)";function OF(e){return`/api/data/v9.0/solutions?$expand=publisherid&$filter=(uniquename eq '${e}')`}y.getSolutionsByUniqueNameQueryUrl=OF;function RF(e){return`/api/data/v9.0/solutions(${e})?$expand=publisherid`}y.getSolutionQueryUrl=RF;function FF(e){return`${e}api/data/v9.1/ProvisionLanguageForUser`}y.getProvisionLanguageUrl=FF;y.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 xF(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=IT;function _T(e,t,r){return`/api/data/v9.1/RetrieveDeploymentPipelineInfo(DeploymentPipelineId=${e},SourceEnvironmentId='${t}',ArtifactName='${r}')`}b.retrieveDeploymentPipelineInfoUrl=_T;function PT(e){return`/api/data/v9.0/deploymentenvironments
+ &$orderby=starttime desc`}y.getDeploymentStageRunsUrl=xF;function LF(e,t,r){return`/api/data/v9.1/RetrieveDeploymentPipelineInfo(DeploymentPipelineId=${e},SourceEnvironmentId='${t}',ArtifactName='${r}')`}y.retrieveDeploymentPipelineInfoUrl=LF;function kF(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=PT;function TT(e){return`/api/data/v9.0/deploymentstages
+ &$filter=(environmentid eq '${e}')`}y.retrievePipelinesUrl=kF;function MF(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=TT;function OT(){return"/api/data/v9.0/deploymentstageruns?$select=deploymentstagerunid"}b.createDeploymentStageRunUrl=OT;function RT(e){return`/api/data/v9.0/deploymentstageruns(${e})`}b.updateDeploymentStageRunUrl=RT;function xT(){return"/api/data/v9.0/DeployPackageAsync"}b.deployPackageAsyncUrl=xT;function FT(){return"/api/data/v9.0/ValidatePackageAsync"}b.validatePackageAsyncUrl=FT;function LT(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=LT;function kT(e){return`/api/data/v9.0/deploymentstageruns(${e})
- ?$select=aigenerateddeploymentnotes,deploymentstagerunid`}b.getAIGeneratedDeploymentNotesUrl=kT;function MT(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)`}y.retrieveDeploymentStagesUrl=MF;function UF(){return"/api/data/v9.0/deploymentstageruns?$select=deploymentstagerunid"}y.createDeploymentStageRunUrl=UF;function BF(e){return`/api/data/v9.0/deploymentstageruns(${e})`}y.updateDeploymentStageRunUrl=BF;function $F(){return"/api/data/v9.0/DeployPackageAsync"}y.deployPackageAsyncUrl=$F;function qF(){return"/api/data/v9.0/ValidatePackageAsync"}y.validatePackageAsyncUrl=qF;function VF(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)":""}`}y.deploymentStageRunUrl=VF;function GF(e){return`/api/data/v9.0/deploymentstageruns(${e})
+ ?$select=aigenerateddeploymentnotes,deploymentstagerunid`}y.getAIGeneratedDeploymentNotesUrl=GF;function zF(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=MT;function UT(e){return`/api/data/v9.0/solutions(${e})
- ?$select=solutionid,uniquename,version`}b.devSolutionInfoUrl=UT;function BT(e){return`/api/data/v9.0/deploymentenvironments
+ &$select=_deploymentstageid_value,deploymentstagerunid,stagerunstatus,operation,operationstatus,suboperation,artifactname`}y.deployOperationStatusUrl=zF;function WF(e){return`/api/data/v9.0/solutions(${e})
+ ?$select=solutionid,uniquename,version`}y.devSolutionInfoUrl=WF;function jF(e){return`/api/data/v9.0/deploymentenvironments
?$select=deploymentenvironmentid,environmentid,environmenttype,name
- &$filter=(environmentid eq '${e}')`}b.retrieveDeploymentEnvironmentInfoUrl=BT;var $T=e=>`/api/data/v9.0/systemusers
+ &$filter=(environmentid eq '${e}')`}y.retrieveDeploymentEnvironmentInfoUrl=jF;var HF=e=>`/api/data/v9.0/systemusers
?$select=azureactivedirectoryobjectid
- &$filter=(applicationid eq '${e}')`;b.SPNPrincipalIdUrl=$T;function qT(){return"/api/data/v9.0/appmodules?$filter=(uniquename eq 'AppDeploymentConfiguration')"}b.retrieveDeploymentPipelineConfigAppUrl=qT;b.retrieveFeatureControlSettingsByNamespaceUrl="/api/data/v9.1/RetrieveFeatureControlSettingsByNamespace";function VT(e){return`/api/data/v9.0/settingdefinitions${e}`}b.getSettingDefinitionsUri=VT;b.OrgSettingOverrideName="organizationsettings";function GT(e,t=!1){let r=`/api/data/v9.0/${b.OrgSettingOverrideName}${e}`;return t?`${b.cdsServiceUrl}${r}`:r}b.getOrgSettingOverrideUri=GT;b.AppSettingOverrideName="appsettings";function zT(e,t=!1){let r=`/api/data/v9.0/${b.AppSettingOverrideName}${e}`;return t?`${b.cdsServiceUrl.replace("/$","")}${r}`:r}b.getAppSettingOverrideUri=zT;var Ta;(function(e){e[e.All=0]="All",e[e.IsPlatformOnly=1]="IsPlatformOnly",e[e.NotPlatformOnly=2]="NotPlatformOnly"})(Ta||(b.RetrievePlatform=Ta={}));function WT(e,t,r,n=Ta.All,i=!1){let a=[];e&&a.push(`AppUniqueName='${e}'`),t!=null&&a.push(`ReleaseLevel=${t}`),r&&a.push(`RetrieveHiddenSettings=${r}`),n!==Ta.All&&a.push(`RetrievePlatformSettings=${n===Ta.IsPlatformOnly?1:0}`);let o="/api/data/v9.0/RetrieveUnpublishedOverridableSettingsInfo";return a.length&&(o=`${o}(${a.join(",")})`),i?`${b.cdsServiceUrl}${o}`:o}b.getPowerSettingsUri=WT;function jT(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=jT;function HT(e=!1){let t="/api/data/v9.0/SaveSettingValue()";return e?`${b.cdsServiceUrl}${t}`:t}b.getSavePowerSettingUri=HT;b.retrieveUnpublishedSuffix="Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()";function QT(e){return`tools/systemcustomization/businessrules/businessRulesDesigner.aspx?BRlaunchpoint=BRGrid&appSolutionId={${e}}`}b.getBusinessRuleDesignerUri=QT;function mh({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=mh;function JT({baseUrl:e,environmentInstanceUrl:t,entityLogicalName:r,recordId:n}){let i=e||mh({environmentInstanceUrl:t,entityLogicalName:r});return i&&n?`${i}&id=${n}`:void 0}b.getUCIEntityRecordEditUrl=JT;b.retrieveOrganizationResources=`${b.cdsServiceUrl}api/data/v9.0/RetrieveOrganizationResources`});var hh=g(ms=>{"use strict";Object.defineProperty(ms,"__esModule",{value:!0});ms.DataverseClient=void 0;var XT=gc(),xn=ne(),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}/${XT.xrmApiUrl}${n}`}async send(t,r){try{return await r()}catch(n){throw n instanceof xn.SdkError?n:new xn.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 xn.InvalidArgumentError(`Refusing to follow a malformed absolute URL: '${t}'`)}if(r.protocol!==n.protocol||r.host!==n.host)throw new xn.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 xn.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 xn.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 xn.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)))}};ms.DataverseClient=bc});var Z=g(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.odataQuery=Te.normalizeGuid=Te.createSafeXmlElement=Te.assertNoControlChars=Te.assertODataName=Te.assertXmlName=Te.xmlText=Te.odataPathLiteral=Te.odataLiteral=void 0;var hs=ne();function gh(e){return String(e??"").replace(/'/g,"''")}Te.odataLiteral=gh;function KT(e){return encodeURIComponent(gh(e))}Te.odataPathLiteral=KT;function YT(e){return String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}Te.xmlText=YT;function vh(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 hs.InvalidArgumentError(`${t} must be a valid XML element name (got '${e}')`);return e}Te.assertXmlName=vh;function ZT(e,t){let r=String(e??"");if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(r))throw new hs.InvalidArgumentError(`${t} must be a valid OData identifier (letters, digits, underscore): got '${e}'`);return e}Te.assertODataName=ZT;function eO(e,t){if(/[\u0000-\u001F\u007F]/.test(String(e??"")))throw new hs.InvalidArgumentError(`${t} must not contain control characters (including CR/LF): they would inject additional lines into the request`);return e}Te.assertNoControlChars=eO;function tO(e,t,r){return e.createElement(vh(t,r))}Te.createSafeXmlElement=tO;var rO=/^[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 nO(e,t){let r=String(e??""),n=r.length===38&&r.startsWith("{")&&r.endsWith("}")?r.slice(1,-1):r;if(!rO.test(n))throw new hs.InvalidArgumentError(`${t} must be a valid GUID (got '${e}')`);return n.toLowerCase()}Te.normalizeGuid=nO;function iO(e){let t=[];for(let[r,n]of e)n!=null&&n!==""&&t.push(`${r}=${encodeURIComponent(String(n))}`);return t.length>0?`?${t.join("&")}`:""}Te.odataQuery=iO});var ge=g(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.nowIso=ee.isAlreadyDeleted=ee.deleteRecord=ee.ensureSuccess=ee.resolveCreatedId=ee.requireCreatedId=ee.withClientMintedId=ee.readCreatedId=ee.readEtag=ee.requireEtag=ee.echoWrite=ee.UPDATE_NO_ETAG_CODE=ee.VERSION_CONFLICT_CODE=void 0;var ci=ne(),Ra=Z();ee.VERSION_CONFLICT_CODE="VERSION_CONFLICT";ee.UPDATE_NO_ETAG_CODE="ARTIFACT_UPDATE_NO_ETAG";function aO(e,t){return{query:`?$select=${encodeURIComponent(e)}`,options:{headers:{...t??{},Prefer:"return=representation"}}}}ee.echoWrite=aO;function oO(e,t,r){if(!e)throw new ci.SdkError(ee.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}ee.requireEtag=oO;function sO(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}ee.readEtag=sO;function yc(e,t){var r;let n=e.body;if(n&&typeof n[t]=="string")return(0,Ra.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,Ra.normalizeGuid)(o[1],t)}return null}ee.readCreatedId=yc;function lO(e,t,r){return r?{...e,[t]:(0,Ra.normalizeGuid)(r,t)}:e}ee.withClientMintedId=lO;function uO(e,t,r){let n=yc(e,t);if(!n)throw new ci.InvalidArgumentError(`Dataverse did not return an id for the created ${r}`);return n}ee.requireCreatedId=uO;function cO(e,t,r,n){let i=yc(e,t);if(i)return i;if(n)return(0,Ra.normalizeGuid)(n,t);throw new ci.InvalidArgumentError(`Dataverse did not return an id for the created ${r}`)}ee.resolveCreatedId=cO;function bh(e,t){if(e.status===412)throw new ci.SdkError(ee.VERSION_CONFLICT_CODE,`Version conflict (412) from ${t}`);if(e.status<200||e.status>=300)throw new ci.ConnectionError(t,e.status,dO(e.body),e.body);return e}ee.ensureSuccess=bh;function dO(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 pO(e,t,r,n){let i=(0,Ra.normalizeGuid)(r,"id"),a=`/${t}(${i})`;bh(await e.delete(a,n?{headers:{"If-Match":n}}:void 0),e.apiUrl(a))}ee.deleteRecord=pO;function fO(e){return e instanceof ci.ConnectionError&&e.statusCode===404}ee.isAlreadyDeleted=fO;function mO(){return new Date().toISOString()}ee.nowIso=mO});var yh=g(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.findColumns=rn.findTables=rn.fetchEntityMetadataFromApi=void 0;var wc=ge(),sr=Z();function xa(e){var t,r;return(r=(t=e?.UserLocalizedLabel)===null||t===void 0?void 0:t.Label)!==null&&r!==void 0?r:""}async function di(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 tn(e){return`/EntityDefinitions(LogicalName='${(0,sr.odataLiteral)(e)}')`}async function hO(e,t,r){let n=await di(e,`${tn(t)}/Attributes/Microsoft.Dynamics.CRM.StringAttributeMetadata${(0,sr.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 gO(e,t,r){var n;let i=await di(e,`${tn(t)}/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata${(0,sr.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:xa(s.Label)}}))}}async function vO(e,t,r){let n=await di(e,`${tn(t)}/Attributes/Microsoft.Dynamics.CRM.LookupAttributeMetadata${(0,sr.odataQuery)([["$select","LogicalName,Targets"]])}`);for(let i of n){let a=r.get(i.LogicalName);a&&i.Targets&&(a.targets=i.Targets)}}async function bO(e,t){var r,n,i,a;let o=[],s=await di(e,`${tn(t)}/OneToManyRelationships${(0,sr.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 di(e,`${tn(t)}/ManyToOneRelationships${(0,sr.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 di(e,`${tn(t)}/ManyToManyRelationships${(0,sr.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 yO(e,t){var r,n,i,a,o;let s=`${tn(t)}`+(0,sr.odataQuery)([["$select","LogicalName,SchemaName,DisplayName,EntitySetName,IsCustomEntity,PrimaryNameAttribute,PrimaryIdAttribute"],["$expand","Attributes($select=LogicalName,DisplayName,AttributeType,IsCustomAttribute)"]]),u=(0,wc.ensureSuccess)(await e.get(s),e.apiUrl(s)).body,c=((r=u.Attributes)!==null&&r!==void 0?r:[]).map(m=>{var h;return{logicalName:m.LogicalName,displayName:xa(m.DisplayName),attributeType:(h=m.AttributeType)!==null&&h!==void 0?h:"Unknown",isCustomAttribute:!!m.IsCustomAttribute}}),d=new Map(c.map(m=>[m.logicalName,m])),[,,,p]=await Promise.all([hO(e,t,d),gO(e,t,d),vO(e,t,d),bO(e,t)]);return{logicalName:u.LogicalName,schemaName:(n=u.SchemaName)!==null&&n!==void 0?n:u.LogicalName,displayName:xa(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}}rn.fetchEntityMetadataFromApi=yO;async function wO(e,t,r){var n,i;let a=`/EntityDefinitions${(0,sr.odataQuery)([["$select","LogicalName,SchemaName,EntitySetName,DisplayName,IsCustomEntity"]])}`,s=(i=(n=(0,wc.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:xa(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}rn.findTables=wO;async function AO(e,t,r,n){var i,a;let o=`${tn(t)}/Attributes`+(0,sr.odataQuery)([["$select","LogicalName,SchemaName,DisplayName,AttributeType,IsCustomAttribute"]]),l=(a=(i=(0,wc.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,m;return{logicalName:d.LogicalName,schemaName:(p=d.SchemaName)!==null&&p!==void 0?p:d.LogicalName,displayName:xa(d.DisplayName),attributeType:(m=d.AttributeType)!==null&&m!==void 0?m:"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}rn.findColumns=AO});var pi=g(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.DEFAULT_LCID=void 0;gs.DEFAULT_LCID=1033});var wh=g(Ac=>{"use strict";Object.defineProperty(Ac,"__esModule",{value:!0});Ac.default="ffffffff-ffff-ffff-ffff-ffffffffffff"});var Ah=g(Cc=>{"use strict";Object.defineProperty(Cc,"__esModule",{value:!0});Cc.default="00000000-0000-0000-0000-000000000000"});var Ch=g(Sc=>{"use strict";Object.defineProperty(Sc,"__esModule",{value:!0});Sc.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i});var Fa=g(Nc=>{"use strict";Object.defineProperty(Nc,"__esModule",{value:!0});var CO=Ch();function SO(e){return typeof e=="string"&&CO.default.test(e)}Nc.default=SO});var La=g(Ec=>{"use strict";Object.defineProperty(Ec,"__esModule",{value:!0});var NO=Fa();function EO(e){if(!(0,NO.default)(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}Ec.default=EO});var Rr=g(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});ka.unsafeStringify=void 0;var DO=Fa(),Ye=[];for(let e=0;e<256;++e)Ye.push((e+256).toString(16).slice(1));function Sh(e,t=0){return(Ye[e[t+0]]+Ye[e[t+1]]+Ye[e[t+2]]+Ye[e[t+3]]+"-"+Ye[e[t+4]]+Ye[e[t+5]]+"-"+Ye[e[t+6]]+Ye[e[t+7]]+"-"+Ye[e[t+8]]+Ye[e[t+9]]+"-"+Ye[e[t+10]]+Ye[e[t+11]]+Ye[e[t+12]]+Ye[e[t+13]]+Ye[e[t+14]]+Ye[e[t+15]]).toLowerCase()}ka.unsafeStringify=Sh;function IO(e,t=0){let r=Sh(e,t);if(!(0,DO.default)(r))throw TypeError("Stringified UUID is invalid");return r}ka.default=IO});var ys=g(Dc=>{"use strict";Object.defineProperty(Dc,"__esModule",{value:!0});var _O=require("crypto"),bs=new Uint8Array(256),vs=bs.length;function PO(){return vs>bs.length-16&&((0,_O.randomFillSync)(bs),vs=0),bs.slice(vs,vs+=16)}Dc.default=PO});var Ic=g(Ua=>{"use strict";Object.defineProperty(Ua,"__esModule",{value:!0});Ua.updateV1State=void 0;var Nh=ys(),TO=Rr(),Ma={};function OO(e,t,r){let n,i=e?._v6??!1;if(e){let a=Object.keys(e);a.length===1&&a[0]==="_v6"&&(e=void 0)}if(e)n=Eh(e.random??e.rng?.()??(0,Nh.default)(),e.msecs,e.nsecs,e.clockseq,e.node,t,r);else{let a=Date.now(),o=(0,Nh.default)();Dh(Ma,a,o),n=Eh(o,Ma.msecs,Ma.nsecs,i?void 0:Ma.clockseq,i?void 0:Ma.node,t,r)}return t??(0,TO.unsafeStringify)(n)}function Dh(e,t,r){return e.msecs??=-1/0,e.nsecs??=0,t===e.msecs?(e.nsecs++,e.nsecs>=1e4&&(e.node=void 0,e.nsecs=0)):t>e.msecs?e.nsecs=0:t<e.msecs&&(e.node=void 0),e.node||(e.node=r.slice(10,16),e.node[0]|=1,e.clockseq=(r[8]<<8|r[9])&16383),e.msecs=t,e}Ua.updateV1State=Dh;function Eh(e,t,r,n,i,a,o=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(!a)a=new Uint8Array(16),o=0;else if(o<0||o+16>a.length)throw new RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`);t??=Date.now(),r??=0,n??=(e[8]<<8|e[9])&16383,i??=e.slice(10,16),t+=122192928e5;let s=((t&268435455)*1e4+r)%4294967296;a[o++]=s>>>24&255,a[o++]=s>>>16&255,a[o++]=s>>>8&255,a[o++]=s&255;let l=t/4294967296*1e4&268435455;a[o++]=l>>>8&255,a[o++]=l&255,a[o++]=l>>>24&15|16,a[o++]=l>>>16&255,a[o++]=n>>>8|128,a[o++]=n&255;for(let u=0;u<6;++u)a[o++]=i[u];return a}Ua.default=OO});var Pc=g(_c=>{"use strict";Object.defineProperty(_c,"__esModule",{value:!0});var RO=La(),xO=Rr();function FO(e){let t=typeof e=="string"?(0,RO.default)(e):e,r=LO(t);return typeof e=="string"?(0,xO.unsafeStringify)(r):r}_c.default=FO;function LO(e){return Uint8Array.of((e[6]&15)<<4|e[7]>>4&15,(e[7]&15)<<4|(e[4]&240)>>4,(e[4]&15)<<4|(e[5]&240)>>4,(e[5]&15)<<4|(e[0]&240)>>4,(e[0]&15)<<4|(e[1]&240)>>4,(e[1]&15)<<4|(e[2]&240)>>4,96|e[2]&15,e[3],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}});var Ih=g(Tc=>{"use strict";Object.defineProperty(Tc,"__esModule",{value:!0});var kO=require("crypto");function MO(e){return Array.isArray(e)?e=Buffer.from(e):typeof e=="string"&&(e=Buffer.from(e,"utf8")),(0,kO.createHash)("md5").update(e).digest()}Tc.default=MO});var Ba=g(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});xr.URL=xr.DNS=xr.stringToBytes=void 0;var _h=La(),UO=Rr();function Ph(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t}xr.stringToBytes=Ph;xr.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";xr.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function BO(e,t,r,n,i,a){let o=typeof r=="string"?Ph(r):r,s=typeof n=="string"?(0,_h.default)(n):n;if(typeof n=="string"&&(n=(0,_h.default)(n)),n?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let l=new Uint8Array(16+o.length);if(l.set(s),l.set(o,s.length),l=t(l),l[6]=l[6]&15|e,l[8]=l[8]&63|128,i){if(a=a||0,a<0||a+16>i.length)throw new RangeError(`UUID byte range ${a}:${a+15} is out of buffer bounds`);for(let u=0;u<16;++u)i[a+u]=l[u];return i}return(0,UO.unsafeStringify)(l)}xr.default=BO});var Oh=g(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.URL=Fn.DNS=void 0;var $O=Ih(),Oc=Ba(),Th=Ba();Object.defineProperty(Fn,"DNS",{enumerable:!0,get:function(){return Th.DNS}});Object.defineProperty(Fn,"URL",{enumerable:!0,get:function(){return Th.URL}});function Rc(e,t,r,n){return(0,Oc.default)(48,$O.default,e,t,r,n)}Rc.DNS=Oc.DNS;Rc.URL=Oc.URL;Fn.default=Rc});var Rh=g(xc=>{"use strict";Object.defineProperty(xc,"__esModule",{value:!0});var qO=require("crypto");xc.default={randomUUID:qO.randomUUID}});var Fh=g(Fc=>{"use strict";Object.defineProperty(Fc,"__esModule",{value:!0});var xh=Rh(),VO=ys(),GO=Rr();function zO(e,t,r){if(xh.default.randomUUID&&!t&&!e)return xh.default.randomUUID();e=e||{};let n=e.random??e.rng?.()??(0,VO.default)();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return(0,GO.unsafeStringify)(n)}Fc.default=zO});var Lh=g(Lc=>{"use strict";Object.defineProperty(Lc,"__esModule",{value:!0});var WO=require("crypto");function jO(e){return Array.isArray(e)?e=Buffer.from(e):typeof e=="string"&&(e=Buffer.from(e,"utf8")),(0,WO.createHash)("sha1").update(e).digest()}Lc.default=jO});var Mh=g(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.URL=Ln.DNS=void 0;var HO=Lh(),kc=Ba(),kh=Ba();Object.defineProperty(Ln,"DNS",{enumerable:!0,get:function(){return kh.DNS}});Object.defineProperty(Ln,"URL",{enumerable:!0,get:function(){return kh.URL}});function Mc(e,t,r,n){return(0,kc.default)(80,HO.default,e,t,r,n)}Mc.DNS=kc.DNS;Mc.URL=kc.URL;Ln.default=Mc});var Uh=g(Uc=>{"use strict";Object.defineProperty(Uc,"__esModule",{value:!0});var QO=Rr(),JO=Ic(),XO=Pc();function KO(e,t,r){e??={},r??=0;let n=(0,JO.default)({...e,_v6:!0},new Uint8Array(16));if(n=(0,XO.default)(n),t){if(r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;i++)t[r+i]=n[i];return t}return(0,QO.unsafeStringify)(n)}Uc.default=KO});var Bh=g(Bc=>{"use strict";Object.defineProperty(Bc,"__esModule",{value:!0});var YO=La(),ZO=Rr();function eR(e){let t=typeof e=="string"?(0,YO.default)(e):e,r=tR(t);return typeof e=="string"?(0,ZO.unsafeStringify)(r):r}Bc.default=eR;function tR(e){return Uint8Array.of((e[3]&15)<<4|e[4]>>4&15,(e[4]&15)<<4|(e[5]&240)>>4,(e[5]&15)<<4|e[6]&15,e[7],(e[1]&15)<<4|(e[2]&240)>>4,(e[2]&15)<<4|(e[3]&240)>>4,16|(e[0]&240)>>4,(e[0]&15)<<4|(e[1]&240)>>4,e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}});var Gh=g($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});$a.updateV7State=void 0;var $h=ys(),rR=Rr(),$c={};function nR(e,t,r){let n;if(e)n=qh(e.random??e.rng?.()??(0,$h.default)(),e.msecs,e.seq,t,r);else{let i=Date.now(),a=(0,$h.default)();Vh($c,i,a),n=qh(a,$c.msecs,$c.seq,t,r)}return t??(0,rR.unsafeStringify)(n)}function Vh(e,t,r){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=r[6]<<23|r[7]<<16|r[8]<<8|r[9],e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}$a.updateV7State=Vh;function qh(e,t,r,n,i=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(!n)n=new Uint8Array(16),i=0;else if(i<0||i+16>n.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),r??=e[6]*127<<24|e[7]<<16|e[8]<<8|e[9],n[i++]=t/1099511627776&255,n[i++]=t/4294967296&255,n[i++]=t/16777216&255,n[i++]=t/65536&255,n[i++]=t/256&255,n[i++]=t&255,n[i++]=112|r>>>28&15,n[i++]=r>>>20&255,n[i++]=128|r>>>14&63,n[i++]=r>>>6&255,n[i++]=r<<2&255|e[10]&3,n[i++]=e[11],n[i++]=e[12],n[i++]=e[13],n[i++]=e[14],n[i++]=e[15],n}$a.default=nR});var zh=g(qc=>{"use strict";Object.defineProperty(qc,"__esModule",{value:!0});var iR=Fa();function aR(e){if(!(0,iR.default)(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)}qc.default=aR});var ws=g(te=>{"use strict";Object.defineProperty(te,"__esModule",{value:!0});te.version=te.validate=te.v7=te.v6ToV1=te.v6=te.v5=te.v4=te.v3=te.v1ToV6=te.v1=te.stringify=te.parse=te.NIL=te.MAX=void 0;var oR=wh();Object.defineProperty(te,"MAX",{enumerable:!0,get:function(){return oR.default}});var sR=Ah();Object.defineProperty(te,"NIL",{enumerable:!0,get:function(){return sR.default}});var lR=La();Object.defineProperty(te,"parse",{enumerable:!0,get:function(){return lR.default}});var uR=Rr();Object.defineProperty(te,"stringify",{enumerable:!0,get:function(){return uR.default}});var cR=Ic();Object.defineProperty(te,"v1",{enumerable:!0,get:function(){return cR.default}});var dR=Pc();Object.defineProperty(te,"v1ToV6",{enumerable:!0,get:function(){return dR.default}});var pR=Oh();Object.defineProperty(te,"v3",{enumerable:!0,get:function(){return pR.default}});var fR=Fh();Object.defineProperty(te,"v4",{enumerable:!0,get:function(){return fR.default}});var mR=Mh();Object.defineProperty(te,"v5",{enumerable:!0,get:function(){return mR.default}});var hR=Uh();Object.defineProperty(te,"v6",{enumerable:!0,get:function(){return hR.default}});var gR=Bh();Object.defineProperty(te,"v6ToV1",{enumerable:!0,get:function(){return gR.default}});var vR=Gh();Object.defineProperty(te,"v7",{enumerable:!0,get:function(){return vR.default}});var bR=Fa();Object.defineProperty(te,"validate",{enumerable:!0,get:function(){return bR.default}});var yR=zh();Object.defineProperty(te,"version",{enumerable:!0,get:function(){return yR.default}})});var ht=g(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0});fi.assignMissingIds=fi.newId=void 0;var wR=ws();function Wh(){return(0,wR.v4)()}fi.newId=Wh;function AR(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var CR=new Set(["parameters","bag","expression","rawExpression","lookupValue","stepLabels"]);function SR(e){return Vc(e),e}fi.assignMissingIds=SR;function Vc(e){if(Array.isArray(e)){e.forEach(t=>Vc(t));return}if(AR(e)){(typeof e.id!="string"||e.id.length===0)&&(e.id=Wh());for(let t of Object.keys(e))t==="id"||CR.has(t)||Vc(e[t])}}});var Gc=g(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.postChangeSet=nn.parseChangeSetStatuses=nn.renderChangeSet=void 0;var As=ne(),NR=ge(),jh=ht(),Hh=Z();function Qh(e,t){let r=`batch_${(0,jh.newId)()}`,n=`changeset_${(0,jh.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,Hh.assertNoControlChars)(s.path,"batch operation path"),s.etag&&(0,Hh.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}')`;y.SPNPrincipalIdUrl=HF;function JF(){return"/api/data/v9.0/appmodules?$filter=(uniquename eq 'AppDeploymentConfiguration')"}y.retrieveDeploymentPipelineConfigAppUrl=JF;y.retrieveFeatureControlSettingsByNamespaceUrl="/api/data/v9.1/RetrieveFeatureControlSettingsByNamespace";function QF(e){return`/api/data/v9.0/settingdefinitions${e}`}y.getSettingDefinitionsUri=QF;y.OrgSettingOverrideName="organizationsettings";function XF(e,t=!1){let r=`/api/data/v9.0/${y.OrgSettingOverrideName}${e}`;return t?`${y.cdsServiceUrl}${r}`:r}y.getOrgSettingOverrideUri=XF;y.AppSettingOverrideName="appsettings";function KF(e,t=!1){let r=`/api/data/v9.0/${y.AppSettingOverrideName}${e}`;return t?`${y.cdsServiceUrl.replace("/$","")}${r}`:r}y.getAppSettingOverrideUri=KF;var Xa;(function(e){e[e.All=0]="All",e[e.IsPlatformOnly=1]="IsPlatformOnly",e[e.NotPlatformOnly=2]="NotPlatformOnly"})(Xa||(y.RetrievePlatform=Xa={}));function YF(e,t,r,n=Xa.All,i=!1){let a=[];e&&a.push(`AppUniqueName='${e}'`),t!=null&&a.push(`ReleaseLevel=${t}`),r&&a.push(`RetrieveHiddenSettings=${r}`),n!==Xa.All&&a.push(`RetrievePlatformSettings=${n===Xa.IsPlatformOnly?1:0}`);let o="/api/data/v9.0/RetrieveUnpublishedOverridableSettingsInfo";return a.length&&(o=`${o}(${a.join(",")})`),i?`${y.cdsServiceUrl}${o}`:o}y.getPowerSettingsUri=YF;function ZF(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?`${y.cdsServiceUrl}${a}`:a}y.getPowerSettingUri=ZF;function ex(e=!1){let t="/api/data/v9.0/SaveSettingValue()";return e?`${y.cdsServiceUrl}${t}`:t}y.getSavePowerSettingUri=ex;y.retrieveUnpublishedSuffix="Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()";function tx(e){return`tools/systemcustomization/businessrules/businessRulesDesigner.aspx?BRlaunchpoint=BRGrid&appSolutionId={${e}}`}y.getBusinessRuleDesignerUri=tx;function Bv({environmentInstanceUrl:e,entityLogicalName:t}){return e&&t?`${e}main.aspx?cmdbar=true&forceUCI=1&navbar=off&newWindow=true&pageType=entityRecord&etn=${t}`:void 0}y.getUCIEntityRecordBaseUrl=Bv;function rx({baseUrl:e,environmentInstanceUrl:t,entityLogicalName:r,recordId:n}){let i=e||Bv({environmentInstanceUrl:t,entityLogicalName:r});return i&&n?`${i}&id=${n}`:void 0}y.getUCIEntityRecordEditUrl=rx;y.retrieveOrganizationResources=`${y.cdsServiceUrl}api/data/v9.0/RetrieveOrganizationResources`});var $v=g(Vs=>{"use strict";Object.defineProperty(Vs,"__esModule",{value:!0});Vs.DataverseClient=void 0;var nx=Dd(),Vn=ie(),_d=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}/${nx.xrmApiUrl}${n}`}async send(t,r){try{return await r()}catch(n){throw n instanceof Vn.SdkError?n:new Vn.ConnectionError(t,0,n instanceof Error?n.message:String(n),n)}}get(t,r){let n=this.apiUrl(t);return this.send(n,()=>this.httpClient.get(n,r))}getAbsolute(t,r){return this.assertSameOrigin(t),this.send(t,()=>this.httpClient.get(t,r))}assertSameOrigin(t){let r,n;try{r=new URL(t),n=new URL(this.instanceUrl)}catch{throw new Vn.InvalidArgumentError(`Refusing to follow a malformed absolute URL: '${t}'`)}if(r.protocol!==n.protocol||r.host!==n.host)throw new Vn.InvalidArgumentError(`Refusing to follow a cross-origin link ('${r.origin}' is not the configured instance '${n.origin}'); server-driven pagination must stay on-instance.`)}post(t,r,n){let i=this.apiUrl(t);return this.send(i,()=>this.httpClient.post(i,r,this.withSolution(n)))}get supportsAtomicBatch(){return typeof this.httpClient.postRaw=="function"}get solutionName(){return this.solutionUniqueName}postBatch(t,r,n){if(!this.httpClient.postRaw)throw new Vn.InvalidArgumentError("The injected HttpClient does not implement postRaw(), required for atomic $batch change sets");let i=this.apiUrl("/$batch"),a={...n,headers:{...n?.headers,"Content-Type":`multipart/mixed;boundary=${r}`}};return this.send(i,()=>this.httpClient.postRaw(i,t,a))}patch(t,r,n){let i=this.apiUrl(t);return this.send(i,()=>this.httpClient.patch(i,r,this.withSolution(n)))}get supportsBinaryPatch(){return typeof this.httpClient.patchRaw=="function"}patchRaw(t,r,n){if(!this.httpClient.patchRaw)throw new Vn.InvalidArgumentError("The injected HttpClient does not implement patchRaw(), required to upload file content (a Dataverse File column cannot be written through a JSON body)");let i=this.apiUrl(t);return this.send(i,()=>this.httpClient.patchRaw(i,r,this.withSolution(n)))}put(t,r,n){if(!this.httpClient.put)throw new Vn.InvalidArgumentError("The injected HttpClient does not implement put(), required for metadata replace operations (e.g. updateColumn)");let i=this.apiUrl(t);return this.send(i,()=>this.httpClient.put(i,r,this.withSolution(n)))}delete(t,r){let n=this.apiUrl(t);return this.send(n,()=>this.httpClient.delete(n,this.withSolution(r)))}};Vs.DataverseClient=_d});var qv=g(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.findColumns=dn.findTables=dn.fetchEntityMetadataFromApi=void 0;var Pd=ye(),dr=ee();function Ya(e){var t,r;return(r=(t=e?.UserLocalizedLabel)===null||t===void 0?void 0:t.Label)!==null&&r!==void 0?r:""}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 cn(e){return`/EntityDefinitions(LogicalName='${(0,dr.odataLiteral)(e)}')`}async function ix(e,t,r){let n=await Si(e,`${cn(t)}/Attributes/Microsoft.Dynamics.CRM.StringAttributeMetadata${(0,dr.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 ax(e,t,r){var n;let i=await Si(e,`${cn(t)}/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata${(0,dr.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:Ya(s.Label)}}))}}async function ox(e,t,r){let n=await Si(e,`${cn(t)}/Attributes/Microsoft.Dynamics.CRM.LookupAttributeMetadata${(0,dr.odataQuery)([["$select","LogicalName,Targets"]])}`);for(let i of n){let a=r.get(i.LogicalName);a&&i.Targets&&(a.targets=i.Targets)}}async function sx(e,t){var r,n,i,a;let o=[],s=await Si(e,`${cn(t)}/OneToManyRelationships${(0,dr.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,`${cn(t)}/ManyToOneRelationships${(0,dr.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,`${cn(t)}/ManyToManyRelationships${(0,dr.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 lx(e,t){var r,n,i,a,o;let s=`${cn(t)}`+(0,dr.odataQuery)([["$select","LogicalName,SchemaName,DisplayName,EntitySetName,IsCustomEntity,PrimaryNameAttribute,PrimaryIdAttribute"],["$expand","Attributes($select=LogicalName,DisplayName,AttributeType,IsCustomAttribute)"]]),u=(0,Pd.ensureSuccess)(await e.get(s),e.apiUrl(s)).body,c=((r=u.Attributes)!==null&&r!==void 0?r:[]).map(m=>{var h;return{logicalName:m.LogicalName,displayName:Ya(m.DisplayName),attributeType:(h=m.AttributeType)!==null&&h!==void 0?h:"Unknown",isCustomAttribute:!!m.IsCustomAttribute}}),d=new Map(c.map(m=>[m.logicalName,m])),[,,,p]=await Promise.all([ix(e,t,d),ax(e,t,d),ox(e,t,d),sx(e,t)]);return{logicalName:u.LogicalName,schemaName:(n=u.SchemaName)!==null&&n!==void 0?n:u.LogicalName,displayName:Ya(u.DisplayName),entitySetName:(i=u.EntitySetName)!==null&&i!==void 0?i:"",primaryNameAttribute:(a=u.PrimaryNameAttribute)!==null&&a!==void 0?a:"",primaryIdAttribute:(o=u.PrimaryIdAttribute)!==null&&o!==void 0?o:"",isCustomEntity:!!u.IsCustomEntity,attributes:c,relationships:p}}dn.fetchEntityMetadataFromApi=lx;async function ux(e,t,r){var n,i;let a=`/EntityDefinitions${(0,dr.odataQuery)([["$select","LogicalName,SchemaName,EntitySetName,DisplayName,IsCustomEntity"]])}`,s=(i=(n=(0,Pd.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:Ya(c.DisplayName),entitySetName:(p=c.EntitySetName)!==null&&p!==void 0?p:"",isCustom:!!c.IsCustomEntity}}).filter(c=>c.logicalName.toLowerCase().includes(l)||c.schemaName.toLowerCase().includes(l)||c.displayName.toLowerCase().includes(l));return typeof r?.top=="number"?u.slice(0,r.top):u}dn.findTables=ux;async function cx(e,t,r,n){var i,a;let o=`${cn(t)}/Attributes`+(0,dr.odataQuery)([["$select","LogicalName,SchemaName,DisplayName,AttributeType,IsCustomAttribute"]]),l=(a=(i=(0,Pd.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,m;return{logicalName:d.LogicalName,schemaName:(p=d.SchemaName)!==null&&p!==void 0?p:d.LogicalName,displayName:Ya(d.DisplayName),attributeType:(m=d.AttributeType)!==null&&m!==void 0?m:"Unknown",isCustom:!!d.IsCustomAttribute}}).filter(d=>d.logicalName.toLowerCase().includes(u)||d.schemaName.toLowerCase().includes(u)||d.displayName.toLowerCase().includes(u));return typeof n?.top=="number"?c.slice(0,n.top):c}dn.findColumns=cx});var Ei=g(Gs=>{"use strict";Object.defineProperty(Gs,"__esModule",{value:!0});Gs.DEFAULT_LCID=void 0;Gs.DEFAULT_LCID=1033});var Td=g(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.postChangeSet=pn.parseChangeSetStatuses=pn.renderChangeSet=void 0;var zs=ie(),dx=ye(),Vv=yt(),Gv=ee();function zv(e,t){let r=`batch_${(0,Vv.newId)()}`,n=`changeset_${(0,Vv.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,Gv.assertNoControlChars)(s.path,"batch operation path"),s.etag&&(0,Gv.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}}nn.renderChangeSet=Qh;function Jh(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 m=p.indexOf(`\r
+`),batchId:r,contentIds:i}}pn.renderChangeSet=zv;function Wv(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 m=p.indexOf(`\r
\r
-`);if(m===-1)return;let h=p.slice(0,m),w=p.slice(m+4);if(!/^Content-Type:\s*application\/http\b/im.test(h))return;let y=/^HTTP\/1\.[01] (\d{3})\b/.exec(w);if(!y||((i=w.match(/^HTTP\/1\.[01] \d{3}\b/gm))!==null&&i!==void 0?i:[]).length!==1)return;let N=(a=/^Content-ID:\s*(\S+)/im.exec(h))===null||a===void 0?void 0:a[1];if(N===void 0||d.has(N)||!u.has(N))return;d.add(N),c.push(Number(y[1]))}return c.length===0?void 0:c}nn.parseChangeSetStatuses=Jh;async function ER(e,t,r){if(t.length===0)return;let{body:n,batchId:i,contentIds:a}=Qh(e,t),o=await e.postBatch(n,i),s=e.apiUrl("/$batch");if((0,NR.ensureSuccess)(o,s),typeof o.body!="string"||o.body.length===0)throw new As.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=Jh(o.body,a);if(l===void 0)throw new As.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 As.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 As.ConnectionError(s,u,`atomic write of ${r} was rolled back: the change set reported HTTP ${u}`)}nn.postChangeSet=ER});var Cs=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=void 0;var re=ge(),H=Z(),lr=pi(),Oe=ne(),DR=Gc(),IR={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 Ie(e,t){return{"@odata.type":"Microsoft.Dynamics.CRM.Label",LocalizedLabels:[{"@odata.type":"Microsoft.Dynamics.CRM.LocalizedLabel",Label:e,LanguageCode:t}]}}function qa(e){return{Value:e,CanBeChanged:!0,ManagedPropertyLogicalName:"canmodifyrequirementlevelsettings"}}function jc(e){let t=e.indexOf("_");return t>0?e.slice(0,t):e}function Xh(e,t,r){let n=e[t];n&&typeof n=="object"?n.Value=r:e[t]={Value:r}}function Va(e){let t=(0,re.readCreatedId)(e,"MetadataId");if(!t)throw new Oe.InvalidArgumentError("Dataverse did not return a MetadataId for the created metadata component");return t}function _R(e,t,r){var n,i,a,o,s,l,u,c,d,p,m,h,w,y,N,D,x,F,q,G,M,U,B,W;if(t.defaultValue!==void 0&&e!=="boolean")throw new Oe.InvalidArgumentError(`createColumn: 'defaultValue' applies to boolean columns, but '${t.schemaName}' is of type '${e}'.`);if(t.integerFormat!==void 0&&e!=="integer")throw new Oe.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:(m=t.minValue)!==null&&m!==void 0?m:-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:(w=t.precision)!==null&&w!==void 0?w:2,PrecisionSource:2,MinValue:(y=t.minValue)!==null&&y!==void 0?y:0,MaxValue:(N=t.maxValue)!==null&&N!==void 0?N:1e9};case"boolean":return{"@odata.type":"Microsoft.Dynamics.CRM.BooleanAttributeMetadata",AttributeType:"Boolean",AttributeTypeName:{Value:"BooleanType"},DefaultValue:(D=t.defaultValue)!==null&&D!==void 0?D:!1,OptionSet:{"@odata.type":"Microsoft.Dynamics.CRM.BooleanOptionSetMetadata",TrueOption:{Value:1,Label:Ie((x=t.trueLabel)!==null&&x!==void 0?x:"Yes",r)},FalseOption:{Value:0,Label:Ie((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:(q=t.dateFormat)!==null&&q!==void 0?q:"DateAndTime"};case"choice":return Kh(t,r,!1);case"multiChoice":return Kh(t,r,!0);case"file":return{"@odata.type":"Microsoft.Dynamics.CRM.FileAttributeMetadata",AttributeType:"Virtual",AttributeTypeName:{Value:"FileType"},MaxSizeInKB:(G=t.maxSizeKb)!==null&&G!==void 0?G:10240};case"image":return{"@odata.type":"Microsoft.Dynamics.CRM.ImageAttributeMetadata",AttributeType:"Virtual",AttributeTypeName:{Value:"ImageType"},IsPrimaryImage:(M=t.isPrimaryImage)!==null&&M!==void 0?M:!1,MaxSizeInKB:(U=t.maxSizeKb)!==null&&U!==void 0?U:10240};case"autonumber":return{"@odata.type":"Microsoft.Dynamics.CRM.StringAttributeMetadata",AttributeType:"String",AttributeTypeName:{Value:"StringType"},FormatName:{Value:"Text"},MaxLength:(B=t.maxLength)!==null&&B!==void 0?B:100,AutoNumberFormat:(W=t.autoNumberFormat)!==null&&W!==void 0?W:""};default:throw new Oe.InvalidArgumentError(`unsupported column type '${String(e)}'`)}}function Kh(e,t,r){let i={"@odata.type":r?"Microsoft.Dynamics.CRM.MultiSelectPicklistAttributeMetadata":"Microsoft.Dynamics.CRM.PicklistAttributeMetadata",AttributeType:r?"Virtual":"Picklist",AttributeTypeName:{Value:r?"MultiSelectPicklistType":"PicklistType"}};if(e.globalChoiceMetadataId)return i["[email protected]"]=`/GlobalOptionSetDefinitions(${(0,H.normalizeGuid)(e.globalChoiceMetadataId,"globalChoiceMetadataId")})`,i;if(!e.options||e.options.length===0)throw new Oe.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:Ie(a.label,t)}))},i}var zc=new WeakMap;async function PR(e,t){var r,n;let i=(r=zc.get(e))===null||r===void 0?void 0:r.get(t);if(i)return i;let a=`/EntityDefinitions(LogicalName='${(0,H.odataLiteral)(t)}')${(0,H.odataQuery)([["$select","EntitySetName"]])}`,s=(n=(0,re.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||n===void 0?void 0:n.EntitySetName;if(!s)throw new Oe.InvalidArgumentError(`could not resolve EntitySetName for '${t}'`);(0,H.assertODataName)(s,`server-derived EntitySetName for '${t}'`);let l=zc.get(e);return l||(l=new Map,zc.set(e,l)),l.set(t,s),s}J.resolveEntitySetName=PR;async function TR(e,t){var r,n,i,a,o,s,l,u,c,d,p,m,h,w,y;let N=(r=t.languageCode)!==null&&r!==void 0?r:lr.DEFAULT_LCID,D=jc(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:qa("None"),MaxLength:(i=t.primaryColumnMaxLength)!==null&&i!==void 0?i:100,FormatName:{Value:"Text"},DisplayName:Ie((a=t.primaryColumnDisplayName)!==null&&a!==void 0?a:"Name",N),IsPrimaryName:!0};t.primaryColumnAutoNumberFormat&&(F.AutoNumberFormat=t.primaryColumnAutoNumberFormat),t.columns&&tg(t.columns,"createTable");let q={"@odata.type":"Microsoft.Dynamics.CRM.EntityMetadata",SchemaName:t.schemaName,DisplayName:Ie(t.displayName,N),DisplayCollectionName:Ie((o=t.pluralName)!==null&&o!==void 0?o:`${t.displayName}s`,N),OwnershipType:(s=t.ownership)!==null&&s!==void 0?s:"UserOwned",IsActivity:!1,HasActivities:(l=t.hasActivities)!==null&&l!==void 0?l:!1,HasNotes:(u=t.hasNotes)!==null&&u!==void 0?u:!1,Attributes:[F,...((c=t.columns)!==null&&c!==void 0?c:[]).map($e=>Hc($e,N))]};t.description&&(q.Description=Ie(t.description,N));let G="/EntityDefinitions",M=(0,re.ensureSuccess)(await e.post(G,q),e.apiUrl(G)),U=Va(M),B=`/EntityDefinitions(${U})`+(0,H.odataQuery)([["$select","LogicalName,EntitySetName,PrimaryIdAttribute,PrimaryNameAttribute"]]),W=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),Ae;for(let $e=1;$e<=W;$e+=1){let Je=await e.get(B);if(Je.status>=200&&Je.status<300){Ae=Je;break}Je.status!==404&&(0,re.ensureSuccess)(Je,e.apiUrl(B)),$e<W&&$>0&&await new Promise(ce=>setTimeout(ce,$))}if(!Ae)throw new Oe.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 he=Ae.body;return{logicalName:(m=he.LogicalName)!==null&&m!==void 0?m:t.schemaName.toLowerCase(),metadataId:U,entitySetName:(h=he.EntitySetName)!==null&&h!==void 0?h:"",primaryIdAttribute:(w=he.PrimaryIdAttribute)!==null&&w!==void 0?w:`${t.schemaName.toLowerCase()}id`,primaryNameAttribute:(y=he.PrimaryNameAttribute)!==null&&y!==void 0?y:x.toLowerCase()}}J.createTable=TR;function Hc(e,t){var r,n;let i=(r=e.languageCode)!==null&&r!==void 0?r:t,a={..._R(e.type,e,i),SchemaName:e.schemaName,RequiredLevel:qa((n=e.required)!==null&&n!==void 0?n:"None"),DisplayName:Ie(e.displayName,i)};return e.description&&(a.Description=Ie(e.description,i)),e.sourceType&&e.sourceType!=="Simple"&&(a.SourceType=e.sourceType==="Rollup"?2:1,e.formulaDefinition&&(a.FormulaDefinition=e.formulaDefinition)),Zh(a,e),a}function Zh(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 OR(e,t,r){var n;let i=Hc(r,(n=r.languageCode)!==null&&n!==void 0?n:lr.DEFAULT_LCID),a=`/EntityDefinitions(LogicalName='${(0,H.odataLiteral)(t)}')/Attributes`,o=(0,re.ensureSuccess)(await e.post(a,i),e.apiUrl(a)),s={logicalName:r.schemaName.toLowerCase(),metadataId:Va(o)};if(r.visualization&&r.visualization!=="None")try{await ig(e,t,s.logicalName,s.metadataId,r.visualization)}catch(l){let u=new Oe.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=OR;var mi="/controlconfigurations",eg="CustomRenderersConfiguration",Wc={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 tg(e,t){let r=e.find(n=>n.visualization&&n.visualization!=="None");if(r)throw new Oe.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 rg(e){return JSON.stringify({type:Wc[e]})}function RR(e){if(!e)return"None";let t;try{t=JSON.parse(e)}catch{return"None"}let r=t?.type,n=Object.keys(Wc).find(i=>Wc[i]===r);return n??"None"}async function ng(e,t,r){var n,i;let a=`entitylogicalname eq '${(0,H.odataLiteral)(t)}' and Attribute/logicalname eq '${(0,H.odataLiteral)(r)}'`,o=`${mi}${(0,H.odataQuery)([["$select","name,uniquename,metadatajson"],["$expand","Attribute($select=name,logicalname)"],["$filter",a]])}`,l=(i=(n=(0,re.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 xR(e,t,r){var n;let i=`/EntityDefinitions(LogicalName='${(0,H.odataLiteral)(t)}')/Attributes(LogicalName='${(0,H.odataLiteral)(r)}')${(0,H.odataQuery)([["$select","MetadataId"]])}`,o=(n=(0,re.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)===null||n===void 0?void 0:n.MetadataId;if(!o)throw new Oe.InvalidArgumentError(`cannot resolve column '${r}' on '${t}' to set its visualization`);return(0,H.normalizeGuid)(o,"MetadataId")}async function ig(e,t,r,n,i){let a={name:eg,uniquename:`msdyn_${t}_${r}_customrenderers`,metadatajson:rg(i),"[email protected]":`/attributes(${(0,H.normalizeGuid)(n,"MetadataId")})`,entitylogicalname:t};(0,re.ensureSuccess)(await e.post(mi,a),e.apiUrl(mi))}async function FR(e,t,r){var n;let i=await ng(e,t,r);return RR((n=i[0])===null||n===void 0?void 0:n.metadatajson)}J.getColumnVisualization=FR;async function LR(e,t,r,n){let a=(await ng(e,t,r)).map(u=>u.controlconfigurationid).filter(u=>!!u);if(n==="None"){for(let u of a){let c=`${mi}(${(0,H.normalizeGuid)(u,"controlconfigurationid")})`;(0,re.ensureSuccess)(await e.delete(c),e.apiUrl(c))}return}let[o,...s]=a,l=await xR(e,t,r);if(o){let u=`${mi}(${(0,H.normalizeGuid)(o,"controlconfigurationid")})`,c={name:eg,metadatajson:rg(n),"[email protected]":`/attributes(${l})`,entitylogicalname:t};(0,re.ensureSuccess)(await e.patch(u,c),e.apiUrl(u))}else await ig(e,t,r,l,n);for(let u of s){let c=`${mi}(${(0,H.normalizeGuid)(u,"controlconfigurationid")})`;(0,re.ensureSuccess)(await e.delete(c),e.apiUrl(c))}}J.setColumnVisualization=LR;async function kR(e,t,r){if(r.length===0)return;if(tg(r,"createColumns"),!e.supportsAtomicBatch)throw new Oe.InvalidArgumentError(`createColumns writes ${r.length} columns on '${t}' as ONE atomic change set, which needs a verbatim request body. Implement HttpClient.postRaw, or call createColumn per column and accept that a failure can leave the table partly extended.`);let n=`/EntityDefinitions(LogicalName='${(0,H.odataLiteral)(t)}')/Attributes`;await(0,DR.postChangeSet)(e,r.map(i=>{var a;return{method:"POST",path:n,body:Hc(i,(a=i.languageCode)!==null&&a!==void 0?a:lr.DEFAULT_LCID)}}),`${r.length} column(s) on '${t}'`)}J.createColumns=kR;async function MR(e,t,r){var n,i,a,o;let s=(n=r.languageCode)!==null&&n!==void 0?n:lr.DEFAULT_LCID,l=jc(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:Ie(r.displayName,s),RequiredLevel:qa((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,re.ensureSuccess)(await e.post("/CreateCustomerRelationships",d),e.apiUrl("/CreateCustomerRelationships")),{logicalName:r.schemaName.toLowerCase(),metadataId:""}}J.createCustomerColumn=MR;async function UR(e,t,r){var n,i,a,o,s;let l=(n=r.languageCode)!==null&&n!==void 0?n:lr.DEFAULT_LCID,u={EntityLogicalName:t,AttributeLogicalName:"statuscode",Label:Ie(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,re.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=UR;async function BR(e,t){var r,n,i,a,o;let s=(r=t.languageCode)!==null&&r!==void 0?r:lr.DEFAULT_LCID,l,u;if(t.type==="OneToMany"){if(!t.referencedEntity||!t.referencingEntity)throw new Oe.InvalidArgumentError("OneToMany relationship requires referencedEntity and referencingEntity");let p=(n=t.lookupSchemaName)!==null&&n!==void 0?n:`${jc(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:qa((i=t.lookupRequired)!==null&&i!==void 0?i:"None"),DisplayName:Ie((a=t.lookupDisplayName)!==null&&a!==void 0?a:t.referencedEntity,s)}}}else{if(!t.entity1||!t.entity2)throw new Oe.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,re.ensureSuccess)(await e.post(c,l),e.apiUrl(c));return{schemaName:t.schemaName,metadataId:Va(d),lookupLogicalName:u}}J.createRelationship=BR;async function $R(e,t){let r=`/EntityDefinitions(LogicalName='${(0,H.odataLiteral)(t)}')`;(0,re.ensureSuccess)(await e.delete(r),e.apiUrl(r))}J.deleteTable=$R;async function qR(e,t,r,n){var i,a;let o=(i=n.languageCode)!==null&&i!==void 0?i:lr.DEFAULT_LCID,s=`/EntityDefinitions(LogicalName='${(0,H.odataLiteral)(t)}')/Attributes`,l=`${s}(LogicalName='${(0,H.odataLiteral)(r)}')${(0,H.odataQuery)([["$select","MetadataId,AttributeType"]])}`,c=(0,re.ensureSuccess)(await e.get(l),e.apiUrl(l)).body,d=IR[(a=c.AttributeType)!==null&&a!==void 0?a:""];if(!c.MetadataId||!d)throw new Oe.InvalidArgumentError(`cannot update column '${r}' on '${t}' (type '${c.AttributeType}' not supported)`);let p=(0,H.normalizeGuid)(c.MetadataId,"MetadataId"),m=`${s}(${p})/${d}`,h=(0,re.ensureSuccess)(await e.get(m),e.apiUrl(m)).body;for(let y of Object.keys(h))y.startsWith("@odata.")&&delete h[y];if(h["@odata.type"]=d,n.displayName!==void 0&&(h.DisplayName=Ie(n.displayName,o)),n.description!==void 0&&(h.Description=Ie(n.description,o)),n.required!==void 0&&(h.RequiredLevel=qa(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 Oe.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 Oe.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),Zh(h,n);let w=`${s}(${p})`;(0,re.ensureSuccess)(await e.put(w,h,{headers:{"MSCRM.MergeLabels":"true"}}),e.apiUrl(w))}J.updateColumn=qR;async function VR(e,t,r){var n;let i=`/EntityDefinitions(LogicalName='${(0,H.odataLiteral)(t)}')/Attributes`,a=`${i}(LogicalName='${(0,H.odataLiteral)(r)}')${(0,H.odataQuery)([["$select","MetadataId"]])}`,s=(n=(0,re.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||n===void 0?void 0:n.MetadataId;if(!s)throw new Oe.InvalidArgumentError(`column '${r}' not found on '${t}'`);let l=`${i}(${(0,H.normalizeGuid)(s,"MetadataId")})`;(0,re.ensureSuccess)(await e.delete(l),e.apiUrl(l))}J.deleteColumn=VR;async function GR(e,t){var r,n,i;let a=`/RelationshipDefinitions${(0,H.odataQuery)([["$filter",`SchemaName eq '${(0,H.odataLiteral)(t)}'`],["$select","MetadataId"]])}`,s=(i=(n=(r=(0,re.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 Oe.InvalidArgumentError(`relationship '${t}' not found`);let l=`/RelationshipDefinitions(${(0,H.normalizeGuid)(s,"MetadataId")})`;(0,re.ensureSuccess)(await e.delete(l),e.apiUrl(l))}J.deleteRelationship=GR;async function Yh(e,t){var r;let n=`/GlobalOptionSetDefinitions(Name='${(0,H.odataPathLiteral)(t)}')${(0,H.odataQuery)([["$select","MetadataId"]])}`,i=await e.get(n);if(i.status===404)return;let o=(r=(0,re.ensureSuccess)(i,e.apiUrl(n)).body)===null||r===void 0?void 0:r.MetadataId;return o?(0,H.normalizeGuid)(o,"MetadataId"):void 0}async function zR(e,t){var r;let n=t.name.toLowerCase(),i=await Yh(e,n);if(i)return{name:n,metadataId:i};let a=(r=t.languageCode)!==null&&r!==void 0?r:lr.DEFAULT_LCID,o={"@odata.type":"Microsoft.Dynamics.CRM.OptionSetMetadata",Name:n,DisplayName:Ie(t.displayName,a),IsGlobal:!0,OptionSetType:"Picklist",Options:t.options.map(l=>({Value:l.value,Label:Ie(l.label,a)}))};t.description&&(o.Description=Ie(t.description,a));let s="/GlobalOptionSetDefinitions";try{let l=(0,re.ensureSuccess)(await e.post(s,o),e.apiUrl(s));return{name:n,metadataId:Va(l)}}catch(l){let u;try{u=await Yh(e,n)}catch{u=void 0}if(u)return{name:n,metadataId:u};throw l}}J.createGlobalOptionSet=zR;async function WR(e,t){let r=`/GlobalOptionSetDefinitions(Name='${(0,H.odataLiteral)(t.toLowerCase())}')`;(0,re.ensureSuccess)(await e.delete(r),e.apiUrl(r))}J.deleteGlobalOptionSet=WR;async function jR(e,t,r){var n;let i=(n=r.languageCode)!==null&&n!==void 0?n:lr.DEFAULT_LCID,a={"@odata.type":"Microsoft.Dynamics.CRM.EntityKeyMetadata",SchemaName:r.schemaName,DisplayName:Ie(r.displayName,i),KeyAttributes:r.keyAttributes},o=`/EntityDefinitions(LogicalName='${(0,H.odataLiteral)(t)}')/Keys`,s=(0,re.ensureSuccess)(await e.post(o,a),e.apiUrl(o));return{logicalName:r.schemaName.toLowerCase(),metadataId:Va(s)}}J.createAlternateKey=jR;async function HR(e,t,r){var n;let i=`/EntityDefinitions(LogicalName='${(0,H.odataLiteral)(t)}')/Keys`,a=`${i}(LogicalName='${(0,H.odataLiteral)(r.toLowerCase())}')${(0,H.odataQuery)([["$select","MetadataId"]])}`,s=(n=(0,re.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||n===void 0?void 0:n.MetadataId;if(!s)throw new Oe.InvalidArgumentError(`alternate key '${r}' not found on '${t}'`);let l=`${i}(${(0,H.normalizeGuid)(s,"MetadataId")})`;(0,re.ensureSuccess)(await e.delete(l),e.apiUrl(l))}J.deleteAlternateKey=HR;async function QR(e,t,r){var n;let i=(n=r.languageCode)!==null&&n!==void 0?n:lr.DEFAULT_LCID,a=`/EntityDefinitions(LogicalName='${(0,H.odataLiteral)(t)}')`,s=(0,re.ensureSuccess)(await e.get(a),e.apiUrl(a)).body,l=s.MetadataId;if(!l)throw new Oe.InvalidArgumentError(`table '${t}' not found`);let u=(0,H.normalizeGuid)(l,"MetadataId");for(let d of Object.keys(s))d.startsWith("@odata.")&&delete s[d];s["@odata.type"]="Microsoft.Dynamics.CRM.EntityMetadata",r.displayName!==void 0&&(s.DisplayName=Ie(r.displayName,i)),r.pluralName!==void 0&&(s.DisplayCollectionName=Ie(r.pluralName,i)),r.description!==void 0&&(s.Description=Ie(r.description,i)),r.auditEnabled!==void 0&&Xh(s,"IsAuditEnabled",r.auditEnabled),r.duplicateDetectionEnabled!==void 0&&Xh(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,re.ensureSuccess)(await e.put(c,s,{headers:{"MSCRM.MergeLabels":"true"}}),e.apiUrl(c))}J.updateTable=QR});var Jt=g(hi=>{"use strict";Object.defineProperty(hi,"__esModule",{value:!0});hi.describeMalformedValue=hi.collectPages=void 0;var ag=ge(),Qc=ne();async function JR(e,t,r){let n=[],i=new Set,a=e.apiUrl(t),o=(0,ag.ensureSuccess)(await e.get(t),a);for(;;){let s=o.body,l=s?.value;if(!Array.isArray(l))throw new Qc.ConnectionError(a,o.status,`${r}: paginated read returned a malformed page \u2014 expected an OData 'value' array but got ${Jc(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 Qc.ConnectionError(a,o.status,`${r}: paginated read returned a malformed @odata.nextLink (${Jc(u)}); cannot follow it, and refusing to return partial results.`);if(i.has(u))throw new Qc.InvalidArgumentError(`${r}: aborting pagination \u2014 the server returned a repeated @odata.nextLink ('${u}'), which would loop indefinitely.`);i.add(u),a=u,o=(0,ag.ensureSuccess)(await e.getAbsolute(u),u)}return n}hi.collectPages=JR;function Jc(e){return e===null?"null":e===void 0?"undefined (missing)":`a ${typeof e}`}hi.describeMalformedValue=Jc});var on=g(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.rebuildRaw=gt.assembleChildren=gt.spliceChildren=gt.mergeAttrs=gt.rawFromNode=gt.emptyBag=void 0;var an=ne(),og=1e6,Ns=512;function XR(){return{a:[],c:[]}}gt.emptyBag=XR;function sg(e,t=0){if(t>Ns)throw new an.InvalidArgumentError(`Artifact node tree exceeds the maximum depth of ${Ns}`);return{n:e.getNodeName(),a:e.getAllProperties().map(r=>[r.key,r.value]),c:e.getAllChildren().map(r=>sg(r,t+1))}}gt.rawFromNode=sg;function KR(e,t){let r=new Map;for(let[a,o]of t)r.set(a,o);let n=new Set,i=[];for(let[a,o]of e)r.has(a)?i.push([a,r.get(a)]):i.push([a,o]),n.add(a);for(let[a,o]of t)n.has(a)||(i.push([a,o]),n.add(a));return i}gt.mergeAttrs=KR;function Ss(e,t){let r=new Set;for(let s of e){let l=s.i;if(!Number.isInteger(l)||l<0||l>og)throw new an.InvalidArgumentError(`Bag child index must be an integer in [0, ${og}] (got ${String(l)})`);if(r.has(l))throw new an.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}gt.spliceChildren=Ss;function YR(e,t){if(e.w){let r={n:e.w.n,a:e.w.a.map(n=>[n[0],n[1]]),c:Ss(e.w.c,t)};return Ss(e.c,[r])}return Ss(e.c,t)}gt.assembleChildren=YR;function lg(e,t,r,n=0){if(n>Ns)throw new an.InvalidArgumentError(`Artifact node tree exceeds the maximum depth of ${Ns}`);ZR(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,lg(a,t,i,n+1));return i}gt.rebuildRaw=lg;function ZR(e,t){if(e===null||typeof e!="object"||Array.isArray(e))throw new an.InvalidArgumentError(`Malformed hybrid node at depth ${t}: expected a JSON object`);let r=e;if(typeof r.n!="string")throw new an.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 an.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 an.InvalidArgumentError(`Malformed hybrid node '${r.n}': each attribute must be a [string, string] pair`)}});var kn=g(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.projectElementBag=_e.serializeNode=_e.domEngine=_e.nodeLikeFromDom=_e.parseXmlRoot=_e.EMPTY_FORM_SENTINEL=_e.TEXT_SENTINEL=void 0;var ex=on(),Ga=ne();_e.TEXT_SENTINEL="#text";_e.EMPTY_FORM_SENTINEL="#empty";var Ds=new WeakSet;function tx(e,t){let r=e&&e.trim()!==""?e:t,i=new DOMParser().parseFromString(r,"text/xml").documentElement;if(!i)throw new Ga.InvalidArgumentError("XML source has no root element (empty or malformed input)");return nx(i),ix(i),sx(i,r),i}_e.parseXmlRoot=tx;var rx=new Set([1,3]);function nx(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(!rx.has(a.nodeType))throw new Ga.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 ix(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 Ga.InvalidArgumentError(`Unsupported document-level XML node (type ${o.nodeType}: declaration / comment / processing-instruction outside the root element) cannot be round-tripped`)}}function ax(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 ox(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 cg(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 sx(e,t){let r=ax(t),n=ox(e),i=Math.min(r.length,n.length);for(let a=0;a<i;a+=1){if(r[a])continue;let o=n[a];cg(o)||Ds.add(o)}}function Xc(e){let t=e.nodeType===3;return{getNodeName:()=>t?_e.TEXT_SENTINEL:e.tagName,getAllProperties:()=>{var r;if(t)return[{key:_e.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 Ds.has(e)&&!cg(e)&&i.push({key:_e.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(Xc(a))}return r}}}_e.nodeLikeFromDom=Xc;function lx(e){return{make:t=>t===_e.TEXT_SENTINEL?e.createTextNode(""):e.createElement(t),setProp:(t,r,n)=>{t.nodeType===3?t.nodeValue=n:r===_e.EMPTY_FORM_SENTINEL?Ds.add(t):t.setAttribute(r,n)},addChild:(t,r)=>{t.appendChild(r)}}}_e.domEngine=lx;function dg(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 Es(r);if(r>=55296&&r<=56319){let n=e.charCodeAt(t+1);if(!(n>=56320&&n<=57343))throw Es(r);t+=1;continue}if(r>=56320&&r<=57343)throw Es(r)}}function Es(e){let t=e.toString(16).toUpperCase().padStart(4,"0");return new Ga.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 ux(e){return dg(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 cx(e){return dg(e),String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function dx(e){return pg(e,0)}_e.serializeNode=dx;var ug=512;function pg(e,t){var r;if(t>ug)throw new Ga.InvalidArgumentError(`XML nesting exceeds the maximum supported depth of ${ug}`);if(e.nodeType===3)return cx((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+'="'+ux(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 Ds.has(n)?i+"></"+n.tagName+">":i+" />";i+=">";for(let l of o)i+=pg(l,t+1);return i+"</"+n.tagName+">"}function px(e){let t=Xc(e);return{a:t.getAllProperties().map(r=>[r.key,r.value]),c:t.getAllChildren().map((r,n)=>({i:n,node:(0,ex.rawFromNode)(r)}))}}_e.projectElementBag=px});var Zc=g(sn=>{"use strict";Object.defineProperty(sn,"__esModule",{value:!0});sn.getFormSecurityRoles=sn.setFormSecurityRoles=sn.formApi=void 0;var fx=Jt(),de=ge(),Rt=Z(),gi=ne(),Kc=kn(),mx="formid,formxml,name,type,objecttypecode,formpresentation,formactivationstate,uniquename,description,versionnumber",hx="formid,name,type,objecttypecode",gx=2;sn.formApi={async get(e,t){let n=`/systemforms(${(0,Rt.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Rt.odataQuery)([["$select",mx]]),i=(0,de.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,de.readEtag)(i)}},async list(e,t){let r=[`type eq ${gx}`];t?.entityLogicalName&&r.push(`objecttypecode eq '${(0,Rt.odataLiteral)(t.entityLogicalName)}'`);let n=`/systemforms${(0,Rt.odataQuery)([["$select",hx],["$filter",r.join(" and ")]])}`;return(await(0,fx.collectPages)(e,n,"listArtifacts('form')")).map(a=>{var o,s;return{type:"form",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=(0,de.echoWrite)("formid"),i=`/systemforms${n.query}`,a=(0,de.ensureSuccess)(await e.post(i,(0,de.withClientMintedId)(t,"formid",r),n.options),e.apiUrl(i));return{id:(0,de.resolveCreatedId)(a,"formid","form",r),etag:(0,de.readEtag)(a)}},async update(e,t,r,n){let i=(0,Rt.normalizeGuid)(t,"id");await hg(e,i,mg(i),n);let a=await fg(e,i),o=(0,de.echoWrite)("formid",{"If-Match":(0,de.requireEtag)(a,"form",i)}),s=`/systemforms(${i})${o.query}`;return(0,de.ensureSuccess)(await e.patch(s,r,o.options),e.apiUrl(s)),{id:i,etag:await bx(e,i)}},delete(e,t){return(0,de.deleteRecord)(e,"systemforms",t)}};var Yc="DisplayConditions";async function vx(e,t,r){var n,i,a,o,s;if(r.everyone&&r.roleIds&&r.roleIds.length>0)throw new gi.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,Rt.normalizeGuid)(t,"formId"),u=`/systemforms(${l})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Rt.odataQuery)([["$select","formid,formxml"]]),c=(0,de.ensureSuccess)(await e.get(u),e.apiUrl(u)),d=(0,de.readEtag)(c),p=c.body,m=p?.formxml;if(!m)throw new gi.InvalidArgumentError(`form '${l}' returned no formxml, so its roles cannot be set`);let h=(0,Kc.parseXmlRoot)(m,"<form/>"),w=h.ownerDocument;if(!w)throw new gi.InvalidArgumentError(`form '${l}' produced no owner document`);let y=gg(h,Yc),N=(n=y?.getAttribute("Order"))!==null&&n!==void 0?n:void 0,D=(i=y?.getAttribute("FallbackForm"))!==null&&i!==void 0?i:void 0;y&&h.removeChild(y);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(!y)throw new gi.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&&y.setAttribute("Order",String(r.order)),r.fallbackForm!==void 0&&y.setAttribute("FallbackForm",String(r.fallbackForm)),h.appendChild(y)}else if(x){let U=w.createElement(Yc),B=r.order!==void 0?String(r.order):N;B!==void 0&&U.setAttribute("Order",B);let W=r.fallbackForm!==void 0?String(r.fallbackForm):D??"false";if(U.setAttribute("FallbackForm",W),r.everyone)U.appendChild(w.createElement("Everyone"));else for(let $ of(s=r.roleIds)!==null&&s!==void 0?s:[]){let Ae=w.createElement("Role");Ae.setAttribute("Id",`{${(0,Rt.normalizeGuid)($,"roleId")}}`),U.appendChild(Ae)}h.appendChild(U)}let q=(0,Kc.serializeNode)(h);await hg(e,l,u,d);let G=await fg(e,l),M=`/systemforms(${l})`;(0,de.ensureSuccess)(await e.patch(M,{formxml:q},{headers:{"Content-Type":"application/json","If-Match":(0,de.requireEtag)(G,"form",l)}}),e.apiUrl(M))}sn.setFormSecurityRoles=vx;async function fg(e,t){let r=`/systemforms(${t})${(0,Rt.odataQuery)([["$select","formid"]])}`;return(0,de.readEtag)((0,de.ensureSuccess)(await e.get(r),e.apiUrl(r)))}function mg(e){return`/systemforms(${e})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Rt.odataQuery)([["$select","formid"]])}async function bx(e,t){let r=mg(t);return(0,de.readEtag)((0,de.ensureSuccess)(await e.get(r),e.apiUrl(r)))}async function hg(e,t,r,n){(0,de.requireEtag)(n,"form",t);let i=(0,de.readEtag)((0,de.ensureSuccess)(await e.get(r),e.apiUrl(r)));if(i===null)throw new gi.SdkError(de.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 gi.SdkError(de.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 gg(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 yx(e,t){var r,n;let a=`/systemforms(${(0,Rt.normalizeGuid)(t,"formId")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Rt.odataQuery)([["$select","formid,formxml"]]),s=(r=(0,de.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||r===void 0?void 0:r.formxml;if(!s)return;let l=(0,Kc.parseXmlRoot)(s,"<form/>"),u=gg(l,Yc);if(!u)return;let c=[],d=!1,p=u.childNodes;for(let h=0;h<p.length;h+=1){let w=p[h];if(w.nodeType!==1)continue;let y=w;if(y.tagName==="Everyone")d=!0;else if(y.tagName==="Role"){let N=(n=y.getAttribute("Id"))!==null&&n!==void 0?n:"";N&&c.push(N.replace(/[{}]/g,"").toLowerCase())}}let m=u.getAttribute("Order");return{...d?{everyone:!0}:{},...c.length>0?{roleIds:c}:{},fallbackForm:u.getAttribute("FallbackForm")==="true",...m!==null&&m!==""?{order:Number(m)}:{}}}sn.getFormSecurityRoles=yx});var Ps=g(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.disassociateRecords=Se.associateRecords=Se.createRecordsBulk=Se.upsertRecord=Se.queryAllRecords=Se.queryRecords=Se.getRecord=Se.deleteRecord=Se.updateRecord=Se.createRecord=void 0;var wx=Jt(),Xt=ge(),tt=Z(),Is=ne(),ur=Cs();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 Ax(e,t,r){let i=`/${await(0,ur.resolveEntitySetName)(e,t)}`,a=(0,Xt.ensureSuccess)(await e.post(i,_s(r)),e.apiUrl(i)),o=(0,Xt.readCreatedId)(a,`${t}id`);if(!o)throw new Is.InvalidArgumentError(`Dataverse did not return an id for the created '${t}' row`);return{id:o,entityType:t}}Se.createRecord=Ax;async function Cx(e,t,r,n){let i=(0,tt.normalizeGuid)(r,"id"),o=`/${await(0,ur.resolveEntitySetName)(e,t)}(${i})`;(0,Xt.ensureSuccess)(await e.patch(o,_s(n)),e.apiUrl(o))}Se.updateRecord=Cx;async function Sx(e,t,r){let n=(0,tt.normalizeGuid)(r,"id"),a=`/${await(0,ur.resolveEntitySetName)(e,t)}(${n})`;(0,Xt.ensureSuccess)(await e.delete(a),e.apiUrl(a))}Se.deleteRecord=Sx;async function Nx(e,t,r,n){var i;let a=(0,tt.normalizeGuid)(r,"id"),o=await(0,ur.resolveEntitySetName)(e,t),s=(0,tt.odataQuery)([["$select",n&&n.length>0?n.join(","):void 0]]),l=`/${o}(${a})${s}`;return(i=(0,Xt.ensureSuccess)(await e.get(l),e.apiUrl(l)).body)!==null&&i!==void 0?i:{}}Se.getRecord=Nx;function Ex(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 vg(e,t,r){var n,i;if(r?.paginate){if(r.top!==void 0)throw new Is.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 Is.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,ur.resolveEntitySetName)(e,t)}${Ex(r)}`;return r?.paginate?(0,wx.collectPages)(e,o,"queryRecords"):(i=(n=(0,Xt.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[]}Se.queryRecords=vg;async function Dx(e,t,r){return vg(e,t,{...r,paginate:!0})}Se.queryAllRecords=Dx;function Ix(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 _x(e,t,r,n){let i=Ix(r),o=`/${await(0,ur.resolveEntitySetName)(e,t)}${i}`,s=(0,Xt.ensureSuccess)(await e.patch(o,_s(n)),e.apiUrl(o)),l=s.status===201,u=(0,Xt.readCreatedId)(s,`${t}id`);return{id:u??("id"in r?(0,tt.normalizeGuid)(r.id,"id"):""),created:l}}Se.upsertRecord=_x;async function Px(e,t,r){var n,i;if(r.length===0)return[];let a=await(0,ur.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,Xt.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 Is.InvalidArgumentError(`CreateMultiple on '${t}' returned ${u.length} id(s) for ${r.length} row(s)`);return u}Se.createRecordsBulk=Px;async function Tx(e,t,r,n){let i=(0,tt.normalizeGuid)(r,"id"),a=(0,tt.normalizeGuid)(n.targetId,"targetId"),o=await(0,ur.resolveEntitySetName)(e,t),s=await(0,ur.resolveEntitySetName)(e,n.targetEntity),l=(0,tt.assertODataName)(n.relationshipName,"relationshipName"),u=`/${o}(${i})/${l}/$ref`,c={"@odata.id":e.apiUrl(`/${s}(${a})`)};(0,Xt.ensureSuccess)(await e.post(u,c),e.apiUrl(u))}Se.associateRecords=Tx;async function Ox(e,t,r,n,i){let a=(0,tt.normalizeGuid)(r,"id"),o=(0,tt.normalizeGuid)(i,"targetId"),s=await(0,ur.resolveEntitySetName)(e,t),l=(0,tt.assertODataName)(n,"relationshipName"),u=`/${s}(${a})/${l}(${o})/$ref`;(0,Xt.ensureSuccess)(await e.delete(u),e.apiUrl(u))}Se.disassociateRecords=Ox});var Kt=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 Rx=ge(),za=Z(),bg="/PublishXml";async function vi(e,t){(0,Rx.ensureSuccess)(await e.post(bg,{ParameterXml:t}),e.apiUrl(bg))}qe.publishXml=vi;function xx(e,t){return vi(e,`<importexportxml><appmodules><appmodule>${(0,za.xmlText)(t)}</appmodule></appmodules></importexportxml>`)}qe.publishAppModule=xx;function yg(e,t){return vi(e,`<importexportxml><entities><entity>${(0,za.xmlText)(t)}</entity></entities></importexportxml>`)}qe.publishEntity=yg;function Fx(e,t){return vi(e,`<importexportxml><webresources><webresource>${(0,za.xmlText)(t)}</webresource></webresources></importexportxml>`)}qe.publishWebResourceById=Fx;function Lx(e,t){return vi(e,`<importexportxml><dashboards><dashboard>${(0,za.xmlText)(t)}</dashboard></dashboards></importexportxml>`)}qe.publishDashboardById=Lx;function kx(e,t){return vi(e,`<importexportxml><uxagentprojects><uxagentproject>${(0,za.xmlText)(t)}</uxagentproject></uxagentprojects></importexportxml>`)}qe.publishGenPageById=kx;function Mx(e){let t=e?.entityLogicalName;return t?{envelope:"entity",entityLogicalName:t,blastRadiusWarning:"ENTITY_ENVELOPE_ALSO_SHIPS_UNRELATED_UNPUBLISHED_CHANGES"}:{envelope:"entity"}}qe.boundEntityPublishScope=Mx;function Ux(e,t){let r=t?.entityLogicalName;return r?yg(e,r):Promise.resolve()}qe.publishBoundEntity=Ux});var Cg=g(cr=>{"use strict";Object.defineProperty(cr,"__esModule",{value:!0});cr.deleteWebResource=cr.getWebResource=cr.updateWebResource=cr.createWebResource=void 0;var Bx=Kt(),Wa=ge(),Ts=Z(),ed=ne(),$x={html:1,css:2,js:3,xml:4,png:5,jpg:6,gif:7,xsl:9,ico:10,svg:11,resx:12};function qx(e){let t=globalThis;if(t.Buffer)return t.Buffer.from(e,"utf8").toString("base64");if(t.btoa){let r=globalThis.TextEncoder;if(r){let n=new r().encode(e),i="",a=32768;for(let o=0;o<n.length;o+=a)i+=String.fromCharCode(...n.subarray(o,o+a));return t.btoa(i)}return t.btoa(e)}throw new ed.InvalidArgumentError("no base64 encoder available; pass contentBase64 instead of content")}function wg(e){if(e.contentBase64!==void 0)return e.contentBase64;if(e.content!==void 0)return qx(e.content)}async function Ag(e,t){return(0,Bx.publishWebResourceById)(e,t)}async function Vx(e,t){var r;let n=wg(t);if(n===void 0)throw new ed.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:$x[t.type],content:n};t.description&&(i.description=t.description);let a=(0,Wa.ensureSuccess)(await e.post("/webresourceset",i),e.apiUrl("/webresourceset")),o=(0,Wa.readCreatedId)(a,"webresourceid");if(!o)throw new ed.InvalidArgumentError(`Dataverse did not return an id for web resource '${t.name}'`);return t.publish!==!1&&await Ag(e,o),{id:o,name:t.name}}cr.createWebResource=Vx;async function Gx(e,t,r){let n=(0,Ts.normalizeGuid)(t,"id"),i={},a=wg(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,Wa.ensureSuccess)(await e.patch(o,i),e.apiUrl(o)),r.publish!==!1&&await Ag(e,n)}cr.updateWebResource=Gx;async function zx(e,t){var r;let i=`/webresourceset(${(0,Ts.normalizeGuid)(t,"id")})${(0,Ts.odataQuery)([["$select","name,displayname,webresourcetype,content,description"]])}`;return(r=(0,Wa.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)!==null&&r!==void 0?r:{}}cr.getWebResource=zx;async function Wx(e,t){let n=`/webresourceset(${(0,Ts.normalizeGuid)(t,"id")})`;(0,Wa.ensureSuccess)(await e.delete(n),e.apiUrl(n))}cr.deleteWebResource=Wx});var Os=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 bi=ge(),Fr=Z();Ve.HEADER_AND_NAVIGATION_REFRESH="HeaderAndNavigationRefresh";Ve.APP_SETTING_ON="2";Ve.APP_SETTING_OFF="1";Ve.APP_SETTING_UNSET="0";function Eg(e,t){return"/appsettings/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,Fr.odataQuery)([["$select",e],["$filter",t]])}async function Dg(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,Fr.odataLiteral)(c)}'`).join(" or "),s=`/settingdefinitions${(0,Fr.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}Ve.resolveSettingDefinitions=Dg;async function jx(e,t){var r,n,i,a;let o=(0,Fr.normalizeGuid)(t,"App id"),s=Eg("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(w=>`settingdefinitionid eq ${(0,Fr.normalizeGuid)(w,"Setting definition id")}`).join(" or "),m=`/settingdefinitions${(0,Fr.odataQuery)([["$select","settingdefinitionid,uniquename,displayname"],["$filter",p]])}`,h=(0,bi.ensureSuccess)(await e.get(m),e.apiUrl(m));for(let w of((a=(i=h.body)===null||i===void 0?void 0:i.value)!==null&&a!==void 0?a:[]).filter(Boolean))w.settingdefinitionid&&d.set(w.settingdefinitionid.toLowerCase(),w)}return u.map(p=>{var m,h,w,y,N;let D=d.get(((m=p._settingdefinitionid_value)!==null&&m!==void 0?m:"").toLowerCase());return{id:(h=p.appsettingid)!==null&&h!==void 0?h:"",name:(y=(w=D?.uniquename)!==null&&w!==void 0?w:p._settingdefinitionid_value)!==null&&y!==void 0?y:"",value:(N=p.value)!==null&&N!==void 0?N:"",...D?.displayname?{displayName:D.displayname}:{}}})}Ve.readAppSettings=jx;async function Sg(e,t,r){var n,i,a;let o=Eg("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 Ig(e,t,r,n){let i=(0,Fr.normalizeGuid)(t,"App id"),o=(await Dg(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,Fr.normalizeGuid)(s,"Setting definition id"),u=await Sg(e,i,l);if(u)return Ng(e,u,n);let c="/appsettings",d={"[email protected]":`/appmodules(${i})`,"[email protected]":`/settingdefinitions(${l})`,value:n},p,m;try{if(p=await e.post(c,d),p.status>=200&&p.status<300)return"created"}catch(w){m=w}let h;try{h=await Sg(e,i,l)}catch{h=void 0}if(h)return Ng(e,h,n);throw p&&(0,bi.ensureSuccess)(p,e.apiUrl(c)),m}Ve.setAppSetting=Ig;async function Ng(e,t,r){if(t.value===r)return"unchanged";let n=`/appsettings(${(0,Fr.normalizeGuid)(t.id,"App setting id")})`;return(0,bi.ensureSuccess)(await e.patch(n,{value:r}),e.apiUrl(n)),"updated"}async function Hx(e,t,r){var n;let i=[];for(let[a,o]of Object.entries(r??{}))try{await Ig(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=Hx});var xs=g(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});Rs.HEADER_NAV_BOOLEAN_RULE=void 0;Rs.HEADER_NAV_BOOLEAN_RULE="headerAndNavigationRefresh-must-be-boolean"});var Pg=g(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.deleteSolution=Y.importSolution=Y.exportSolution=Y.removeSolutionComponent=Y.addSolutionComponent=Y.setSolutionVersion=Y.createSolution=Y.createPublisher=Y.getSolution=Y.fetchSolutionComponents=Y.SolutionComponentType=void 0;var _g=Jt(),Yt=ge(),vt=Z(),Mn=ne();Y.SolutionComponentType={SavedQuery:26,Workflow:29,SavedQueryVisualization:59,SystemForm:60,AppModule:80,UxAgentProject:10372};var Qx=[Y.SolutionComponentType.SavedQuery,Y.SolutionComponentType.Workflow,Y.SolutionComponentType.SavedQueryVisualization,Y.SolutionComponentType.SystemForm,Y.SolutionComponentType.AppModule,Y.SolutionComponentType.UxAgentProject];async function Jx(e,t){let r=(0,vt.normalizeGuid)(t,"solutionId"),n=Qx.map(s=>`msdyn_componenttype eq ${s}`).join(" or "),i=`/msdyn_solutioncomponentsummaries${(0,vt.odataQuery)([["$select","msdyn_objectid,msdyn_componenttype,msdyn_workflowcategory,msdyn_displayname,msdyn_name"],["$filter",`msdyn_solutionid eq ${r} and (${n})`]])}`,o=(await(0,_g.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 Xx(e,r,o)]}Y.fetchSolutionComponents=Jx;async function Xx(e,t,r){let n=new Set(r.map(s=>s.objectId.toLowerCase())),i=`/solutioncomponents${(0,vt.odataQuery)([["$select","objectid,componenttype"],["$filter",`_solutionid_value eq ${t} and componenttype eq ${Y.SolutionComponentType.UxAgentProject}`]])}`,a=await(0,_g.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:Y.SolutionComponentType.UxAgentProject}))}return o}function Kx(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 Yx(e,t){var r,n,i,a,o,s,l,u,c,d;let p=String(t??"").trim();if(!p)throw new Mn.InvalidArgumentError("getSolution: a solution unique name or id is required.");let m=Kx(p)?`solutionid eq ${(0,vt.normalizeGuid)(p,"solutionId")}`:`uniquename eq '${(0,vt.odataLiteral)(p)}'`,h=`/solutions${(0,vt.odataQuery)([["$select","solutionid,uniquename,friendlyname,version,ismanaged"],["$expand","publisherid($select=publisherid,uniquename,customizationprefix,customizationoptionvalueprefix)"],["$filter",m]])}`,N=((n=(r=(0,Yt.ensureSuccess)(await e.get(h),e.apiUrl(h)).body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[])[0];if(!N?.solutionid)throw new Mn.InvalidArgumentError(`No solution found for '${t}'.`);let D=N.publisherid;if(!D?.publisherid)throw new Mn.InvalidArgumentError(`Solution '${(i=N.uniquename)!==null&&i!==void 0?i:t}' returned no owning publisher, so its customization prefix cannot be determined; refusing to report an empty prefix that could be mistaken for "no prefix".`);if(!("customizationprefix"in D))throw new Mn.InvalidArgumentError(`Solution '${(a=N.uniquename)!==null&&a!==void 0?a:t}' returned a publisher without a customizationprefix property (partial expansion), so its prefix cannot be determined.`);return{solutionId:(0,vt.normalizeGuid)(N.solutionid,"solutionId"),uniqueName:(o=N.uniquename)!==null&&o!==void 0?o:"",friendlyName:(s=N.friendlyname)!==null&&s!==void 0?s:"",version:(l=N.version)!==null&&l!==void 0?l:"",isManaged:!!N.ismanaged,publisherId:(0,vt.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}}Y.getSolution=Yx;async function Zx(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,Yt.ensureSuccess)(await e.post("/publishers",n),e.apiUrl("/publishers")),a=(0,Yt.readCreatedId)(i,"publisherid");if(!a)throw new Mn.InvalidArgumentError(`Dataverse did not return an id for publisher '${t.uniqueName}'`);return{id:a,uniqueName:t.uniqueName}}Y.createPublisher=Zx;async function eF(e,t){var r;let n=(0,vt.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,Yt.ensureSuccess)(await e.post("/solutions",i),e.apiUrl("/solutions")),o=(0,Yt.readCreatedId)(a,"solutionid");if(!o)throw new Mn.InvalidArgumentError(`Dataverse did not return an id for solution '${t.uniqueName}'`);return{id:o,uniqueName:t.uniqueName}}Y.createSolution=eF;async function tF(e,t,r){let i=`/solutions(${(0,vt.normalizeGuid)(t,"solutionId")})`;(0,Yt.ensureSuccess)(await e.patch(i,{version:r}),e.apiUrl(i))}Y.setSolutionVersion=tF;async function rF(e,t){var r;let i={ComponentId:(0,vt.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,Yt.ensureSuccess)(await e.post("/AddSolutionComponent",i),e.apiUrl("/AddSolutionComponent"))}Y.addSolutionComponent=rF;async function nF(e,t,r,n){let a={SolutionComponent:{"@odata.type":"Microsoft.Dynamics.CRM.solutioncomponent",solutioncomponentid:(0,vt.normalizeGuid)(t,"componentId")},ComponentType:r,SolutionUniqueName:n};(0,Yt.ensureSuccess)(await e.post("/RemoveSolutionComponent",a),e.apiUrl("/RemoveSolutionComponent"))}Y.removeSolutionComponent=nF;async function iF(e,t){var r,n;let i={SolutionName:t.solutionName,Managed:(r=t.managed)!==null&&r!==void 0?r:!1},o=(n=(0,Yt.ensureSuccess)(await e.post("/ExportSolution",i),e.apiUrl("/ExportSolution")).body)===null||n===void 0?void 0:n.ExportSolutionFile;if(!o)throw new Mn.InvalidArgumentError(`ExportSolution returned no file for '${t.solutionName}'`);return{base64:o}}Y.exportSolution=iF;async function aF(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,vt.normalizeGuid)(t.importJobId,"importJobId")),(0,Yt.ensureSuccess)(await e.post("/ImportSolution",i),e.apiUrl("/ImportSolution"))}Y.importSolution=aF;async function oF(e,t){let n=`/solutions(${(0,vt.normalizeGuid)(t,"solutionId")})`;(0,Yt.ensureSuccess)(await e.delete(n),e.apiUrl(n))}Y.deleteSolution=oF});var ks=g(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.appApi=ln.deleteAppResolvingOnce=ln.unpublishedAppModulesQuery=void 0;var od=Jt(),sF=ld(),Tg=Kt(),lF=Os(),be=ge(),ie=Z(),ad=ht(),uF=Gc(),pe=ne(),cF=(0,ie.odataQuery)([["$select","appmoduleid,name,uniquename,description"]]),td="appmoduleid,name,uniquename,description";function Mg(e,t,r){return"/appmodules/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,ie.odataQuery)([["$select",e],["$filter",t],["$top",r]])}ln.unpublishedAppModulesQuery=Mg;function rd(e,t){return Mg(e,t?`appmoduleid eq ${t}`:void 0,t?1:void 0)}function Ls(e,t){return"/sitemaps/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,ie.odataQuery)([["$select",t],["$filter",`sitemapid eq ${e}`],["$top",1]])}function yi(e){var t;let r=(t=e.body)===null||t===void 0?void 0:t.value;if(Array.isArray(r))return r[0]}function Fs(e){let t=e?.["@odata.etag"];return typeof t=="string"?t:null}function ja(e){let t=new Set,r=[];for(let n of e??[])n&&!t.has(n)&&(t.add(n),r.push(n));return r}function dF(e){return`cdsapp_${(e||"").replace(/[^a-zA-Z0-9]/g,"")||"app"}`}async function Ug(e,t){var r,n;let i=u=>{throw new pe.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,ie.odataQuery)([["$select","sitemapid"],["$filter",`sitemapnameunique eq '${(0,ie.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 pF(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,ie.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 sd(e){return e instanceof Error?e.message:String(e)}async function fF(e,t){var r,n,i;try{let a=`/roles${(0,ie.odataQuery)([["$select","roleid"],["$filter","name eq 'System Administrator'"],["$top",1]])}`,s=(i=(n=(r=(0,be.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,be.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 (${sd(a)}); it will not be visible or playable until a role is granted access to it.`}}async function mF(e,t){let r=[];async function n(s,l,u){try{return(await(0,od.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}' (${sd(c)}); they were NOT added to the app.`),[]}}let[i,a,o]=await Promise.all([n(`/systemforms${(0,ie.odataQuery)([["$select","formid"],["$filter",`objecttypecode eq '${(0,ie.odataLiteral)(t)}' and type eq 2 and formactivationstate eq 1`]])}`,"formid","forms"),n(`/savedqueries${(0,ie.odataQuery)([["$select","savedqueryid"],["$filter",`returnedtypecode eq '${(0,ie.odataLiteral)(t)}' and querytype eq 0 and statecode eq 0`]])}`,"savedqueryid","views"),n(`/savedqueryvisualizations${(0,ie.odataQuery)([["$select","savedqueryvisualizationid"],["$filter",`primaryentitytypecode eq '${(0,ie.odataLiteral)(t)}'`]])}`,"savedqueryvisualizationid","charts")]);return{forms:i,views:a,charts:o,warnings:r}}var Og=new WeakMap;async function hF(e,t){let r=Og.get(e);r||(r=new Map,Og.set(e,r));let n=r.get(t);if(n!==void 0)return n;let i=await gF(e,t);return i&&r.set(t,i),i}async function Rg(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 gF(e,t){let r=`/EntityDefinitions(LogicalName='${(0,ie.odataLiteral)(t)}')${(0,ie.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 xg(e,t){let r=[],n=ja(t.entities),i=4,a=await Rg(n,i,m=>hF(e,m)),o=n.filter((m,h)=>!a[h]);if(o.length>0)throw new pe.SdkError("APP_ENTITY_COMPONENT_UNRESOLVED",`Refusing to build app components: table(s) ${o.map(m=>`'${m}'`).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(m=>!!m);for(let m of s)r.push({"@odata.id":`${m.entitySetName}(${m.metadataId})`});for(let m of ja(t.components.forms))r.push({"@odata.type":"Microsoft.Dynamics.CRM.systemform",formid:m});for(let m of ja(t.components.views))r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedquery",savedqueryid:m});for(let m of ja(t.components.charts))r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedqueryvisualization",savedqueryvisualizationid:m});for(let m of ja(t.components.dashboards))r.push({"@odata.type":"Microsoft.Dynamics.CRM.systemform",formid:m});let l=new Set(t.components.forms),u=new Set(t.components.views),c=new Set(t.components.charts),d=await Rg(n,i,m=>mF(e,m)),p=d.flatMap(m=>m.warnings);for(let m of d){for(let h of m.forms)l.has(h)||(l.add(h),r.push({"@odata.type":"Microsoft.Dynamics.CRM.systemform",formid:h}));for(let h of m.views)u.has(h)||(u.add(h),r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedquery",savedqueryid:h}));for(let h of m.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 Fg(e,t,r){if(r.length===0)return;let n="/AddAppComponents";(0,be.ensureSuccess)(await e.post(n,{AppId:t,Components:r}),e.apiUrl(n))}function vF(e){return"/appmodules/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,ie.odataQuery)([["$select","appmoduleid,appmoduleidunique"],["$filter",`appmoduleid eq ${e}`],["$top",1]])}async function Lg(e,t,r){var n;if(r.length===0)return;let i=vF(t),a=await e.get(i);if(a.status<200||a.status>=300)throw new pe.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=yi(a),s=o?.appmoduleidunique;if(typeof s!="string"||!s)throw new pe.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,ie.odataQuery)([["$select","objectid,componenttype"],["$filter",`_appmoduleidunique_value eq ${(0,ie.normalizeGuid)(s,`App '${t}' appmoduleidunique`)} and componenttype eq 1`]])}`,u=await e.get(l);if(u.status<200||u.status>=300)throw new pe.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 pe.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(m=>m.objectid).filter(m=>typeof m=="string").map(m=>m.toLowerCase())),p=r.filter(m=>!d.has(m.metadataId.toLowerCase()));if(p.length>0)throw new pe.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(m=>`'${m.logicalName}' (expected objectid ${m.metadataId})`).join(", ")}. The app's navigation would reference content the app does not contain.`)}async function bF(e,t,r){let n=`/appmodules(${t})`,i=`/sitemaps(${r.sitemapId})`;try{if(!await yF(e,r.sitemapId)){r.serverRefusedSitemap&&(0,be.ensureSuccess)(await e.delete(n),e.apiUrl(n));return}e.supportsAtomicBatch&&await $g(e,[{path:n,etag:r.appEtag},{path:i,etag:r.sitemapEtag}])}catch{}}async function yF(e,t){var r;let n=Ls(t,"sitemapid"),i=await e.get(n);if(i.status<200||i.status>=300)throw new pe.SdkError("APP_SITEMAP_UNRESOLVED",`The unpublished-aware read of sitemap '${t}' returned HTTP ${i.status}, so it cannot be determined whether the row exists.`);let a=(r=i.body)===null||r===void 0?void 0:r.value;if(!Array.isArray(a))throw new pe.SdkError("APP_SITEMAP_UNRESOLVED",`The unpublished-aware read of sitemap '${t}' returned no readable result set, so it cannot be determined whether the row exists.`);return a.length>0}async function Bg(e,t){var r;let n=(0,ie.normalizeGuid)(t,"id"),i=h=>{throw new pe.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})${cF}`,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 Ug(e,s);if(!l)return{uniquename:s,appEtag:(0,be.readEtag)(o)};let u=(0,ie.normalizeGuid)(l,"sitemapId"),c=Ls(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=yi(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 m=p.sitemapxml;return typeof m!="string"?i(`sitemap '${u}' returned no sitemapxml.`):{sitemapId:u,uniquename:s,sitemapXml:m,appEtag:(0,be.readEtag)(o),sitemapEtag:Fs(p)}}async function wF(e,t,r){let n=(0,ie.normalizeGuid)(t,"id"),i=await Bg(e,n);await r?.(i.sitemapXml),await qg(e,n,i)}ln.deleteAppResolvingOnce=wF;async function $g(e,t){let r=`batch_${(0,ad.newId)()}`,n=`changeset_${(0,ad.newId)()}`,i=t.map((d,p)=>[`--${n}`,"Content-Type: application/http","Content-Transfer-Encoding: binary",`Content-ID: ${p+1}`,"",`DELETE ${e.apiUrl(d.path)} HTTP/1.1`,...d.etag?[`If-Match: ${d.etag}`]:[],""].join(`\r
+`);if(m===-1)return;let h=p.slice(0,m),w=p.slice(m+4);if(!/^Content-Type:\s*application\/http\b/im.test(h))return;let b=/^HTTP\/1\.[01] (\d{3})\b/.exec(w);if(!b||((i=w.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(b[1]))}return c.length===0?void 0:c}pn.parseChangeSetStatuses=Wv;async function px(e,t,r){if(t.length===0)return;let{body:n,batchId:i,contentIds:a}=zv(e,t),o=await e.postBatch(n,i),s=e.apiUrl("/$batch");if((0,dx.ensureSuccess)(o,s),typeof o.body!="string"||o.body.length===0)throw new zs.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=Wv(o.body,a);if(l===void 0)throw new zs.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 zs.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 zs.ConnectionError(s,u,`atomic write of ${r} was rolled back: the change set reported HTTP ${u}`)}pn.postChangeSet=px});var Ws=g(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.updateTable=X.deleteAlternateKey=X.createAlternateKey=X.deleteGlobalOptionSet=X.createGlobalOptionSet=X.deleteRelationship=X.deleteColumn=X.updateColumn=X.deleteTable=X.createRelationship=X.insertStatusValue=X.createCustomerColumn=X.createColumns=X.setColumnVisualization=X.getColumnVisualization=X.createColumn=X.createTable=X.resolveEntitySetName=void 0;var ne=ye(),J=ee(),pr=Ei(),Fe=ie(),fx=Td(),mx={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 Pe(e,t){return{"@odata.type":"Microsoft.Dynamics.CRM.Label",LocalizedLabels:[{"@odata.type":"Microsoft.Dynamics.CRM.LocalizedLabel",Label:e,LanguageCode:t}]}}function Za(e){return{Value:e,CanBeChanged:!0,ManagedPropertyLogicalName:"canmodifyrequirementlevelsettings"}}function Fd(e){let t=e.indexOf("_");return t>0?e.slice(0,t):e}function jv(e,t,r){let n=e[t];n&&typeof n=="object"?n.Value=r:e[t]={Value:r}}function eo(e){let t=(0,ne.readCreatedId)(e,"MetadataId");if(!t)throw new Fe.InvalidArgumentError("Dataverse did not return a MetadataId for the created metadata component");return t}function hx(e,t,r){var n,i,a,o,s,l,u,c,d,p,m,h,w,b,E,D,F,x,q,G,M,U,B,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:(m=t.minValue)!==null&&m!==void 0?m:-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:(w=t.precision)!==null&&w!==void 0?w:2,PrecisionSource:2,MinValue:(b=t.minValue)!==null&&b!==void 0?b: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:Pe((F=t.trueLabel)!==null&&F!==void 0?F:"Yes",r)},FalseOption:{Value:0,Label:Pe((x=t.falseLabel)!==null&&x!==void 0?x:"No",r)}}};case"dateTime":return{"@odata.type":"Microsoft.Dynamics.CRM.DateTimeAttributeMetadata",AttributeType:"DateTime",AttributeTypeName:{Value:"DateTimeType"},Format:(q=t.dateFormat)!==null&&q!==void 0?q:"DateAndTime"};case"choice":return Hv(t,r,!1);case"multiChoice":return Hv(t,r,!0);case"file":return{"@odata.type":"Microsoft.Dynamics.CRM.FileAttributeMetadata",AttributeType:"Virtual",AttributeTypeName:{Value:"FileType"},MaxSizeInKB:(G=t.maxSizeKb)!==null&&G!==void 0?G:10240};case"image":return{"@odata.type":"Microsoft.Dynamics.CRM.ImageAttributeMetadata",AttributeType:"Virtual",AttributeTypeName:{Value:"ImageType"},IsPrimaryImage:(M=t.isPrimaryImage)!==null&&M!==void 0?M:!1,MaxSizeInKB:(U=t.maxSizeKb)!==null&&U!==void 0?U:10240};case"autonumber":return{"@odata.type":"Microsoft.Dynamics.CRM.StringAttributeMetadata",AttributeType:"String",AttributeTypeName:{Value:"StringType"},FormatName:{Value:"Text"},MaxLength:(B=t.maxLength)!==null&&B!==void 0?B:100,AutoNumberFormat:(W=t.autoNumberFormat)!==null&&W!==void 0?W:""};default:throw new Fe.InvalidArgumentError(`unsupported column type '${String(e)}'`)}}function Hv(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:Pe(a.label,t)}))},i}var Od=new WeakMap;async function gx(e,t){var r,n;let i=(r=Od.get(e))===null||r===void 0?void 0:r.get(t);if(i)return i;let a=`/EntityDefinitions(LogicalName='${(0,J.odataLiteral)(t)}')${(0,J.odataQuery)([["$select","EntitySetName"]])}`,s=(n=(0,ne.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||n===void 0?void 0:n.EntitySetName;if(!s)throw new Fe.InvalidArgumentError(`could not resolve EntitySetName for '${t}'`);(0,J.assertODataName)(s,`server-derived EntitySetName for '${t}'`);let l=Od.get(e);return l||(l=new Map,Od.set(e,l)),l.set(t,s),s}X.resolveEntitySetName=gx;async function vx(e,t){var r,n,i,a,o,s,l,u,c,d,p,m,h,w,b;let E=(r=t.languageCode)!==null&&r!==void 0?r:pr.DEFAULT_LCID,D=Fd(t.schemaName),F=(n=t.primaryColumnSchemaName)!==null&&n!==void 0?n:`${D}_Name`,x={"@odata.type":"Microsoft.Dynamics.CRM.StringAttributeMetadata",AttributeType:"String",AttributeTypeName:{Value:"StringType"},SchemaName:F,RequiredLevel:Za("None"),MaxLength:(i=t.primaryColumnMaxLength)!==null&&i!==void 0?i:100,FormatName:{Value:"Text"},DisplayName:Pe((a=t.primaryColumnDisplayName)!==null&&a!==void 0?a:"Name",E),IsPrimaryName:!0};t.primaryColumnAutoNumberFormat&&(x.AutoNumberFormat=t.primaryColumnAutoNumberFormat),t.columns&&Kv(t.columns,"createTable");let q={"@odata.type":"Microsoft.Dynamics.CRM.EntityMetadata",SchemaName:t.schemaName,DisplayName:Pe(t.displayName,E),DisplayCollectionName:Pe((o=t.pluralName)!==null&&o!==void 0?o:`${t.displayName}s`,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:[x,...((c=t.columns)!==null&&c!==void 0?c:[]).map(Ve=>xd(Ve,E))]};t.description&&(q.Description=Pe(t.description,E));let G="/EntityDefinitions",M=(0,ne.ensureSuccess)(await e.post(G,q),e.apiUrl(G)),U=eo(M),B=`/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)),$=Math.max(0,(p=t.readBackDelayMs)!==null&&p!==void 0?p:1e3),Se;for(let Ve=1;Ve<=W;Ve+=1){let Ke=await e.get(B);if(Ke.status>=200&&Ke.status<300){Se=Ke;break}Ke.status!==404&&(0,ne.ensureSuccess)(Ke,e.apiUrl(B)),Ve<W&&$>0&&await new Promise(de=>setTimeout(de,$))}if(!Se)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 ve=Se.body;return{logicalName:(m=ve.LogicalName)!==null&&m!==void 0?m:t.schemaName.toLowerCase(),metadataId:U,entitySetName:(h=ve.EntitySetName)!==null&&h!==void 0?h:"",primaryIdAttribute:(w=ve.PrimaryIdAttribute)!==null&&w!==void 0?w:`${t.schemaName.toLowerCase()}id`,primaryNameAttribute:(b=ve.PrimaryNameAttribute)!==null&&b!==void 0?b:F.toLowerCase()}}X.createTable=vx;function xd(e,t){var r,n;let i=(r=e.languageCode)!==null&&r!==void 0?r:t,a={...hx(e.type,e,i),SchemaName:e.schemaName,RequiredLevel:Za((n=e.required)!==null&&n!==void 0?n:"None"),DisplayName:Pe(e.displayName,i)};return e.description&&(a.Description=Pe(e.description,i)),e.sourceType&&e.sourceType!=="Simple"&&(a.SourceType=e.sourceType==="Rollup"?2:1,e.formulaDefinition&&(a.FormulaDefinition=e.formulaDefinition)),Qv(a,e),a}function Qv(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 yx(e,t,r){var n;let i=xd(r,(n=r.languageCode)!==null&&n!==void 0?n:pr.DEFAULT_LCID),a=`/EntityDefinitions(LogicalName='${(0,J.odataLiteral)(t)}')/Attributes`,o=(0,ne.ensureSuccess)(await e.post(a,i),e.apiUrl(a)),s={logicalName:r.schemaName.toLowerCase(),metadataId:eo(o)};if(r.visualization&&r.visualization!=="None")try{await ey(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}X.createColumn=yx;var Ni="/controlconfigurations",Xv="CustomRenderersConfiguration",Rd={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 Kv(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 Yv(e){return JSON.stringify({type:Rd[e]})}function bx(e){if(!e)return"None";let t;try{t=JSON.parse(e)}catch{return"None"}let r=t?.type,n=Object.keys(Rd).find(i=>Rd[i]===r);return n??"None"}async function Zv(e,t,r){var n,i;let a=`entitylogicalname eq '${(0,J.odataLiteral)(t)}' and Attribute/logicalname eq '${(0,J.odataLiteral)(r)}'`,o=`${Ni}${(0,J.odataQuery)([["$select","name,uniquename,metadatajson"],["$expand","Attribute($select=name,logicalname)"],["$filter",a]])}`,l=(i=(n=(0,ne.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[],u=r.toLowerCase();return l.filter(c=>{var d,p;return((p=(d=c.Attribute)===null||d===void 0?void 0:d.logicalname)===null||p===void 0?void 0:p.toLowerCase())===u})}async function wx(e,t,r){var n;let i=`/EntityDefinitions(LogicalName='${(0,J.odataLiteral)(t)}')/Attributes(LogicalName='${(0,J.odataLiteral)(r)}')${(0,J.odataQuery)([["$select","MetadataId"]])}`,o=(n=(0,ne.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)===null||n===void 0?void 0:n.MetadataId;if(!o)throw new Fe.InvalidArgumentError(`cannot resolve column '${r}' on '${t}' to set its visualization`);return(0,J.normalizeGuid)(o,"MetadataId")}async function ey(e,t,r,n,i){let a={name:Xv,uniquename:`msdyn_${t}_${r}_customrenderers`,metadatajson:Yv(i),"[email protected]":`/attributes(${(0,J.normalizeGuid)(n,"MetadataId")})`,entitylogicalname:t};(0,ne.ensureSuccess)(await e.post(Ni,a),e.apiUrl(Ni))}async function Ax(e,t,r){var n;let i=await Zv(e,t,r);return bx((n=i[0])===null||n===void 0?void 0:n.metadatajson)}X.getColumnVisualization=Ax;async function Cx(e,t,r,n){let a=(await Zv(e,t,r)).map(u=>u.controlconfigurationid).filter(u=>!!u);if(n==="None"){for(let u of a){let c=`${Ni}(${(0,J.normalizeGuid)(u,"controlconfigurationid")})`;(0,ne.ensureSuccess)(await e.delete(c),e.apiUrl(c))}return}let[o,...s]=a,l=await wx(e,t,r);if(o){let u=`${Ni}(${(0,J.normalizeGuid)(o,"controlconfigurationid")})`,c={name:Xv,metadatajson:Yv(n),"[email protected]":`/attributes(${l})`,entitylogicalname:t};(0,ne.ensureSuccess)(await e.patch(u,c),e.apiUrl(u))}else await ey(e,t,r,l,n);for(let u of s){let c=`${Ni}(${(0,J.normalizeGuid)(u,"controlconfigurationid")})`;(0,ne.ensureSuccess)(await e.delete(c),e.apiUrl(c))}}X.setColumnVisualization=Cx;async function Sx(e,t,r){if(r.length===0)return;if(Kv(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.odataLiteral)(t)}')/Attributes`;await(0,fx.postChangeSet)(e,r.map(i=>{var a;return{method:"POST",path:n,body:xd(i,(a=i.languageCode)!==null&&a!==void 0?a:pr.DEFAULT_LCID)}}),`${r.length} column(s) on '${t}'`)}X.createColumns=Sx;async function Ex(e,t,r){var n,i,a,o;let s=(n=r.languageCode)!==null&&n!==void 0?n:pr.DEFAULT_LCID,l=Fd(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:Pe(r.displayName,s),RequiredLevel:Za((o=r.required)!==null&&o!==void 0?o:"None"),Targets:["account","contact"]},OneToManyRelationships:[{"@odata.type":"Microsoft.Dynamics.CRM.ComplexOneToManyRelationshipMetadata",SchemaName:u,ReferencedEntity:"account",ReferencingEntity:t},{"@odata.type":"Microsoft.Dynamics.CRM.ComplexOneToManyRelationshipMetadata",SchemaName:c,ReferencedEntity:"contact",ReferencingEntity:t}]};return(0,ne.ensureSuccess)(await e.post("/CreateCustomerRelationships",d),e.apiUrl("/CreateCustomerRelationships")),{logicalName:r.schemaName.toLowerCase(),metadataId:""}}X.createCustomerColumn=Ex;async function Nx(e,t,r){var n,i,a,o,s;let l=(n=r.languageCode)!==null&&n!==void 0?n:pr.DEFAULT_LCID,u={EntityLogicalName:t,AttributeLogicalName:"statuscode",Label:Pe(r.label,l),StateCode:(i=r.stateCode)!==null&&i!==void 0?i:0};typeof r.value=="number"&&(u.Value=r.value),r.color&&(u.Color=r.color);let c=(0,ne.ensureSuccess)(await e.post("/InsertStatusValue",u),e.apiUrl("/InsertStatusValue"));return Number((s=(o=(a=c.body)===null||a===void 0?void 0:a.NewOptionValue)!==null&&o!==void 0?o:r.value)!==null&&s!==void 0?s:0)}X.insertStatusValue=Nx;async function Dx(e,t){var r,n,i,a,o;let s=(r=t.languageCode)!==null&&r!==void 0?r:pr.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:`${Fd(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:Za((i=t.lookupRequired)!==null&&i!==void 0?i:"None"),DisplayName:Pe((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,ne.ensureSuccess)(await e.post(c,l),e.apiUrl(c));return{schemaName:t.schemaName,metadataId:eo(d),lookupLogicalName:u}}X.createRelationship=Dx;async function Ix(e,t){let r=`/EntityDefinitions(LogicalName='${(0,J.odataLiteral)(t)}')`;(0,ne.ensureSuccess)(await e.delete(r),e.apiUrl(r))}X.deleteTable=Ix;async function _x(e,t,r,n){var i,a;let o=(i=n.languageCode)!==null&&i!==void 0?i:pr.DEFAULT_LCID,s=`/EntityDefinitions(LogicalName='${(0,J.odataLiteral)(t)}')/Attributes`,l=`${s}(LogicalName='${(0,J.odataLiteral)(r)}')${(0,J.odataQuery)([["$select","MetadataId,AttributeType"]])}`,c=(0,ne.ensureSuccess)(await e.get(l),e.apiUrl(l)).body,d=mx[(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"),m=`${s}(${p})/${d}`,h=(0,ne.ensureSuccess)(await e.get(m),e.apiUrl(m)).body;for(let b of Object.keys(h))b.startsWith("@odata.")&&delete h[b];if(h["@odata.type"]=d,n.displayName!==void 0&&(h.DisplayName=Pe(n.displayName,o)),n.description!==void 0&&(h.Description=Pe(n.description,o)),n.required!==void 0&&(h.RequiredLevel=Za(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),Qv(h,n);let w=`${s}(${p})`;(0,ne.ensureSuccess)(await e.put(w,h,{headers:{"MSCRM.MergeLabels":"true"}}),e.apiUrl(w))}X.updateColumn=_x;async function Px(e,t,r){var n;let i=`/EntityDefinitions(LogicalName='${(0,J.odataLiteral)(t)}')/Attributes`,a=`${i}(LogicalName='${(0,J.odataLiteral)(r)}')${(0,J.odataQuery)([["$select","MetadataId"]])}`,s=(n=(0,ne.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||n===void 0?void 0:n.MetadataId;if(!s)throw new Fe.InvalidArgumentError(`column '${r}' not found on '${t}'`);let l=`${i}(${(0,J.normalizeGuid)(s,"MetadataId")})`;(0,ne.ensureSuccess)(await e.delete(l),e.apiUrl(l))}X.deleteColumn=Px;async function Tx(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,ne.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||r===void 0?void 0:r.value)===null||n===void 0?void 0:n[0])===null||i===void 0?void 0:i.MetadataId;if(!s)throw new Fe.InvalidArgumentError(`relationship '${t}' not found`);let l=`/RelationshipDefinitions(${(0,J.normalizeGuid)(s,"MetadataId")})`;(0,ne.ensureSuccess)(await e.delete(l),e.apiUrl(l))}X.deleteRelationship=Tx;async function Jv(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,ne.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 Ox(e,t){var r;let n=t.name.toLowerCase(),i=await Jv(e,n);if(i)return{name:n,metadataId:i};let a=(r=t.languageCode)!==null&&r!==void 0?r:pr.DEFAULT_LCID,o={"@odata.type":"Microsoft.Dynamics.CRM.OptionSetMetadata",Name:n,DisplayName:Pe(t.displayName,a),IsGlobal:!0,OptionSetType:"Picklist",Options:t.options.map(l=>({Value:l.value,Label:Pe(l.label,a)}))};t.description&&(o.Description=Pe(t.description,a));let s="/GlobalOptionSetDefinitions";try{let l=(0,ne.ensureSuccess)(await e.post(s,o),e.apiUrl(s));return{name:n,metadataId:eo(l)}}catch(l){let u;try{u=await Jv(e,n)}catch{u=void 0}if(u)return{name:n,metadataId:u};throw l}}X.createGlobalOptionSet=Ox;async function Rx(e,t){let r=`/GlobalOptionSetDefinitions(Name='${(0,J.odataLiteral)(t.toLowerCase())}')`;(0,ne.ensureSuccess)(await e.delete(r),e.apiUrl(r))}X.deleteGlobalOptionSet=Rx;async function Fx(e,t,r){var n;let i=(n=r.languageCode)!==null&&n!==void 0?n:pr.DEFAULT_LCID,a={"@odata.type":"Microsoft.Dynamics.CRM.EntityKeyMetadata",SchemaName:r.schemaName,DisplayName:Pe(r.displayName,i),KeyAttributes:r.keyAttributes},o=`/EntityDefinitions(LogicalName='${(0,J.odataLiteral)(t)}')/Keys`,s=(0,ne.ensureSuccess)(await e.post(o,a),e.apiUrl(o));return{logicalName:r.schemaName.toLowerCase(),metadataId:eo(s)}}X.createAlternateKey=Fx;async function xx(e,t,r){var n;let i=`/EntityDefinitions(LogicalName='${(0,J.odataLiteral)(t)}')/Keys`,a=`${i}(LogicalName='${(0,J.odataLiteral)(r.toLowerCase())}')${(0,J.odataQuery)([["$select","MetadataId"]])}`,s=(n=(0,ne.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||n===void 0?void 0:n.MetadataId;if(!s)throw new Fe.InvalidArgumentError(`alternate key '${r}' not found on '${t}'`);let l=`${i}(${(0,J.normalizeGuid)(s,"MetadataId")})`;(0,ne.ensureSuccess)(await e.delete(l),e.apiUrl(l))}X.deleteAlternateKey=xx;async function Lx(e,t,r){var n;let i=(n=r.languageCode)!==null&&n!==void 0?n:pr.DEFAULT_LCID,a=`/EntityDefinitions(LogicalName='${(0,J.odataLiteral)(t)}')`,s=(0,ne.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=Pe(r.displayName,i)),r.pluralName!==void 0&&(s.DisplayCollectionName=Pe(r.pluralName,i)),r.description!==void 0&&(s.Description=Pe(r.description,i)),r.auditEnabled!==void 0&&jv(s,"IsAuditEnabled",r.auditEnabled),r.duplicateDetectionEnabled!==void 0&&jv(s,"IsDuplicateDetectionEnabled",r.duplicateDetectionEnabled),r.changeTrackingEnabled!==void 0&&(s.ChangeTrackingEnabled=r.changeTrackingEnabled),r.quickCreateEnabled!==void 0&&(s.IsQuickCreateEnabled=r.quickCreateEnabled),r.iconVectorName!==void 0&&(s.IconVectorName=r.iconVectorName),r.iconSmallName!==void 0&&(s.IconSmallName=r.iconSmallName),r.iconMediumName!==void 0&&(s.IconMediumName=r.iconMediumName),r.iconLargeName!==void 0&&(s.IconLargeName=r.iconLargeName);let c=`/EntityDefinitions(${u})`;(0,ne.ensureSuccess)(await e.put(c,s,{headers:{"MSCRM.MergeLabels":"true"}}),e.apiUrl(c))}X.updateTable=Lx});var mn=g(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.rebuildRaw=bt.assembleChildren=bt.spliceChildren=bt.mergeAttrs=bt.rawFromNode=bt.emptyBag=void 0;var fn=ie(),ty=1e6,Hs=512;function kx(){return{a:[],c:[]}}bt.emptyBag=kx;function ry(e,t=0){if(t>Hs)throw new fn.InvalidArgumentError(`Artifact node tree exceeds the maximum depth of ${Hs}`);return{n:e.getNodeName(),a:e.getAllProperties().map(r=>[r.key,r.value]),c:e.getAllChildren().map(r=>ry(r,t+1))}}bt.rawFromNode=ry;function Mx(e,t){let r=new Map;for(let[a,o]of t)r.set(a,o);let n=new Set,i=[];for(let[a,o]of e)r.has(a)?i.push([a,r.get(a)]):i.push([a,o]),n.add(a);for(let[a,o]of t)n.has(a)||(i.push([a,o]),n.add(a));return i}bt.mergeAttrs=Mx;function js(e,t){let r=new Set;for(let s of e){let l=s.i;if(!Number.isInteger(l)||l<0||l>ty)throw new fn.InvalidArgumentError(`Bag child index must be an integer in [0, ${ty}] (got ${String(l)})`);if(r.has(l))throw new fn.InvalidArgumentError(`Duplicate bag child index ${l}`);r.add(l)}let n=[...e].sort((s,l)=>s.i-l.i),i=[],a=0,o=0;for(let s of n){for(;o<s.i&&a<t.length;)i.push(t[a]),a+=1,o+=1;o<s.i&&(o=s.i),i.push(s.node),o+=1}for(;a<t.length;)i.push(t[a]),a+=1;return i}bt.spliceChildren=js;function Ux(e,t){if(e.w){let r={n:e.w.n,a:e.w.a.map(n=>[n[0],n[1]]),c:js(e.w.c,t)};return js(e.c,[r])}return js(e.c,t)}bt.assembleChildren=Ux;function ny(e,t,r,n=0){if(n>Hs)throw new fn.InvalidArgumentError(`Artifact node tree exceeds the maximum depth of ${Hs}`);Bx(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,ny(a,t,i,n+1));return i}bt.rebuildRaw=ny;function Bx(e,t){if(e===null||typeof e!="object"||Array.isArray(e))throw new fn.InvalidArgumentError(`Malformed hybrid node at depth ${t}: expected a JSON object`);let r=e;if(typeof r.n!="string")throw new fn.InvalidArgumentError(`Malformed hybrid node at depth ${t}: 'n' (tag name) must be a string`);if(!Array.isArray(r.a)||!Array.isArray(r.c))throw new fn.InvalidArgumentError(`Malformed hybrid node '${r.n}': 'a' and 'c' must be arrays`);for(let n of r.a)if(!Array.isArray(n)||n.length!==2||typeof n[0]!="string"||typeof n[1]!="string")throw new fn.InvalidArgumentError(`Malformed hybrid node '${r.n}': each attribute must be a [string, string] pair`)}});var Gn=g(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 $x=mn(),to=ie();Te.TEXT_SENTINEL="#text";Te.EMPTY_FORM_SENTINEL="#empty";var Qs=new WeakSet;function qx(e,t){let r=e&&e.trim()!==""?e:t,i=new DOMParser().parseFromString(r,"text/xml").documentElement;if(!i)throw new to.InvalidArgumentError("XML source has no root element (empty or malformed input)");return Gx(i),zx(i),Hx(i,r),i}Te.parseXmlRoot=qx;var Vx=new Set([1,3]);function Gx(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(!Vx.has(a.nodeType))throw new to.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 zx(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 to.InvalidArgumentError(`Unsupported document-level XML node (type ${o.nodeType}: declaration / comment / processing-instruction outside the root element) cannot be round-tripped`)}}function Wx(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 jx(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 ay(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 Hx(e,t){let r=Wx(t),n=jx(e),i=Math.min(r.length,n.length);for(let a=0;a<i;a+=1){if(r[a])continue;let o=n[a];ay(o)||Qs.add(o)}}function Ld(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 Qs.has(e)&&!ay(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(Ld(a))}return r}}}Te.nodeLikeFromDom=Ld;function Jx(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?Qs.add(t):t.setAttribute(r,n)},addChild:(t,r)=>{t.appendChild(r)}}}Te.domEngine=Jx;function oy(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 Js(r);if(r>=55296&&r<=56319){let n=e.charCodeAt(t+1);if(!(n>=56320&&n<=57343))throw Js(r);t+=1;continue}if(r>=56320&&r<=57343)throw Js(r)}}function Js(e){let t=e.toString(16).toUpperCase().padStart(4,"0");return new to.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 Qx(e){return oy(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 Xx(e){return oy(e),String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Kx(e){return sy(e,0)}Te.serializeNode=Kx;var iy=512;function sy(e,t){var r;if(t>iy)throw new to.InvalidArgumentError(`XML nesting exceeds the maximum supported depth of ${iy}`);if(e.nodeType===3)return Xx((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+'="'+Qx(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 Qs.has(n)?i+"></"+n.tagName+">":i+" />";i+=">";for(let l of o)i+=sy(l,t+1);return i+"</"+n.tagName+">"}function Yx(e){let t=Ld(e);return{a:t.getAllProperties().map(r=>[r.key,r.value]),c:t.getAllChildren().map((r,n)=>({i:n,node:(0,$x.rawFromNode)(r)}))}}Te.projectElementBag=Yx});var Ud=g(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});hn.getFormSecurityRoles=hn.setFormSecurityRoles=hn.formApi=void 0;var Zx=Kt(),fe=ye(),kt=ee(),Di=ie(),kd=Gn(),eL="formid,formxml,name,type,objecttypecode,formpresentation,formactivationstate,uniquename,description,versionnumber",tL="formid,name,type,objecttypecode",rL=2;hn.formApi={async get(e,t){let n=`/systemforms(${(0,kt.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,kt.odataQuery)([["$select",eL]]),i=(0,fe.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,fe.readEtag)(i)}},async list(e,t){let r=[`type eq ${rL}`];t?.entityLogicalName&&r.push(`objecttypecode eq '${(0,kt.odataLiteral)(t.entityLogicalName)}'`);let n=`/systemforms${(0,kt.odataQuery)([["$select",tL],["$filter",r.join(" and ")]])}`;return(await(0,Zx.collectPages)(e,n,"listArtifacts('form')")).map(a=>{var o,s;return{type:"form",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=(0,fe.echoWrite)("formid"),i=`/systemforms${n.query}`,a=(0,fe.ensureSuccess)(await e.post(i,(0,fe.withClientMintedId)(t,"formid",r),n.options),e.apiUrl(i));return{id:(0,fe.resolveCreatedId)(a,"formid","form",r),etag:(0,fe.readEtag)(a)}},async update(e,t,r,n){let i=(0,kt.normalizeGuid)(t,"id");await cy(e,i,uy(i),n);let a=await ly(e,i),o=(0,fe.echoWrite)("formid",{"If-Match":(0,fe.requireEtag)(a,"form",i)}),s=`/systemforms(${i})${o.query}`;return(0,fe.ensureSuccess)(await e.patch(s,r,o.options),e.apiUrl(s)),{id:i,etag:await iL(e,i)}},delete(e,t){return(0,fe.deleteRecord)(e,"systemforms",t)}};var Md="DisplayConditions";async function nL(e,t,r){var n,i,a,o,s;if(r.everyone&&r.roleIds&&r.roleIds.length>0)throw new Di.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,kt.normalizeGuid)(t,"formId"),u=`/systemforms(${l})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,kt.odataQuery)([["$select","formid,formxml"]]),c=(0,fe.ensureSuccess)(await e.get(u),e.apiUrl(u)),d=(0,fe.readEtag)(c),p=c.body,m=p?.formxml;if(!m)throw new Di.InvalidArgumentError(`form '${l}' returned no formxml, so its roles cannot be set`);let h=(0,kd.parseXmlRoot)(m,"<form/>"),w=h.ownerDocument;if(!w)throw new Di.InvalidArgumentError(`form '${l}' produced no owner document`);let b=dy(h,Md),E=(n=b?.getAttribute("Order"))!==null&&n!==void 0?n:void 0,D=(i=b?.getAttribute("FallbackForm"))!==null&&i!==void 0?i:void 0;b&&h.removeChild(b);let F=!!r.everyone||((o=(a=r.roleIds)===null||a===void 0?void 0:a.length)!==null&&o!==void 0?o:0)>0;if(!F&&(r.order!==void 0||r.fallbackForm!==void 0)){if(!b)throw new Di.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&&b.setAttribute("Order",String(r.order)),r.fallbackForm!==void 0&&b.setAttribute("FallbackForm",String(r.fallbackForm)),h.appendChild(b)}else if(F){let U=w.createElement(Md),B=r.order!==void 0?String(r.order):E;B!==void 0&&U.setAttribute("Order",B);let W=r.fallbackForm!==void 0?String(r.fallbackForm):D??"false";if(U.setAttribute("FallbackForm",W),r.everyone)U.appendChild(w.createElement("Everyone"));else for(let $ of(s=r.roleIds)!==null&&s!==void 0?s:[]){let Se=w.createElement("Role");Se.setAttribute("Id",`{${(0,kt.normalizeGuid)($,"roleId")}}`),U.appendChild(Se)}h.appendChild(U)}let q=(0,kd.serializeNode)(h);await cy(e,l,u,d);let G=await ly(e,l),M=`/systemforms(${l})`;(0,fe.ensureSuccess)(await e.patch(M,{formxml:q},{headers:{"Content-Type":"application/json","If-Match":(0,fe.requireEtag)(G,"form",l)}}),e.apiUrl(M))}hn.setFormSecurityRoles=nL;async function ly(e,t){let r=`/systemforms(${t})${(0,kt.odataQuery)([["$select","formid"]])}`;return(0,fe.readEtag)((0,fe.ensureSuccess)(await e.get(r),e.apiUrl(r)))}function uy(e){return`/systemforms(${e})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,kt.odataQuery)([["$select","formid"]])}async function iL(e,t){let r=uy(t);return(0,fe.readEtag)((0,fe.ensureSuccess)(await e.get(r),e.apiUrl(r)))}async function cy(e,t,r,n){(0,fe.requireEtag)(n,"form",t);let i=(0,fe.readEtag)((0,fe.ensureSuccess)(await e.get(r),e.apiUrl(r)));if(i===null)throw new Di.SdkError(fe.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 Di.SdkError(fe.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 dy(e,t){let r=e.childNodes;for(let n=0;n<r.length;n+=1){let i=r[n];if(i.nodeType===1&&i.tagName===t)return i}}async function aL(e,t){var r,n;let a=`/systemforms(${(0,kt.normalizeGuid)(t,"formId")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,kt.odataQuery)([["$select","formid,formxml"]]),s=(r=(0,fe.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||r===void 0?void 0:r.formxml;if(!s)return;let l=(0,kd.parseXmlRoot)(s,"<form/>"),u=dy(l,Md);if(!u)return;let c=[],d=!1,p=u.childNodes;for(let h=0;h<p.length;h+=1){let w=p[h];if(w.nodeType!==1)continue;let b=w;if(b.tagName==="Everyone")d=!0;else if(b.tagName==="Role"){let E=(n=b.getAttribute("Id"))!==null&&n!==void 0?n:"";E&&c.push(E.replace(/[{}]/g,"").toLowerCase())}}let m=u.getAttribute("Order");return{...d?{everyone:!0}:{},...c.length>0?{roleIds:c}:{},fallbackForm:u.getAttribute("FallbackForm")==="true",...m!==null&&m!==""?{order:Number(m)}:{}}}hn.getFormSecurityRoles=aL});var Ys=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 oL=Kt(),er=ye(),it=ee(),Xs=ie(),fr=Ws();function Ks(e){let t=e,r=!1,n={};for(let i of Object.keys(t)){let a=t[i];Array.isArray(a)&&a.every(o=>typeof o=="number")?(n[i]=a.join(","),r=!0):n[i]=a}return r?n:e}async function sL(e,t,r){let i=`/${await(0,fr.resolveEntitySetName)(e,t)}`,a=(0,er.ensureSuccess)(await e.post(i,Ks(r)),e.apiUrl(i)),o=(0,er.readCreatedId)(a,`${t}id`);if(!o)throw new Xs.InvalidArgumentError(`Dataverse did not return an id for the created '${t}' row`);return{id:o,entityType:t}}Ne.createRecord=sL;async function lL(e,t,r,n){let i=(0,it.normalizeGuid)(r,"id"),o=`/${await(0,fr.resolveEntitySetName)(e,t)}(${i})`;(0,er.ensureSuccess)(await e.patch(o,Ks(n)),e.apiUrl(o))}Ne.updateRecord=lL;async function uL(e,t,r){let n=(0,it.normalizeGuid)(r,"id"),a=`/${await(0,fr.resolveEntitySetName)(e,t)}(${n})`;(0,er.ensureSuccess)(await e.delete(a),e.apiUrl(a))}Ne.deleteRecord=uL;async function cL(e,t,r,n){var i;let a=(0,it.normalizeGuid)(r,"id"),o=await(0,fr.resolveEntitySetName)(e,t),s=(0,it.odataQuery)([["$select",n&&n.length>0?n.join(","):void 0]]),l=`/${o}(${a})${s}`;return(i=(0,er.ensureSuccess)(await e.get(l),e.apiUrl(l)).body)!==null&&i!==void 0?i:{}}Ne.getRecord=cL;function dL(e){return e?.fetchXml?(0,it.odataQuery)([["fetchXml",e.fetchXml]]):(0,it.odataQuery)([["$select",e?.select&&e.select.length>0?e.select.join(","):void 0],["$filter",e?.filter],["$orderby",e?.orderBy],["$expand",e?.expand],["$top",e?.top]])}async function py(e,t,r){var n,i;if(r?.paginate){if(r.top!==void 0)throw new Xs.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 Xs.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,fr.resolveEntitySetName)(e,t)}${dL(r)}`;return r?.paginate?(0,oL.collectPages)(e,o,"queryRecords"):(i=(n=(0,er.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[]}Ne.queryRecords=py;async function pL(e,t,r){return py(e,t,{...r,paginate:!0})}Ne.queryAllRecords=pL;function fL(e){if("id"in e)return`(${(0,it.normalizeGuid)(e.id,"id")})`;let t=typeof e.value=="string"?`'${(0,it.odataPathLiteral)(e.value)}'`:e.value;return`(${(0,it.assertODataName)(e.key,"alternate key name")}=${t})`}async function mL(e,t,r,n){let i=fL(r),o=`/${await(0,fr.resolveEntitySetName)(e,t)}${i}`,s=(0,er.ensureSuccess)(await e.patch(o,Ks(n)),e.apiUrl(o)),l=s.status===201,u=(0,er.readCreatedId)(s,`${t}id`);return{id:u??("id"in r?(0,it.normalizeGuid)(r.id,"id"):""),created:l}}Ne.upsertRecord=mL;async function hL(e,t,r){var n,i;if(r.length===0)return[];let a=await(0,fr.resolveEntitySetName)(e,t),o=r.map(c=>({"@odata.type":`Microsoft.Dynamics.CRM.${t}`,...Ks(c)})),s=`/${a}/Microsoft.Dynamics.CRM.CreateMultiple`,u=(i=(n=(0,er.ensureSuccess)(await e.post(s,{Targets:o}),e.apiUrl(s)).body)===null||n===void 0?void 0:n.Ids)!==null&&i!==void 0?i:[];if(u.length!==r.length)throw new Xs.InvalidArgumentError(`CreateMultiple on '${t}' returned ${u.length} id(s) for ${r.length} row(s)`);return u}Ne.createRecordsBulk=hL;async function gL(e,t,r,n){let i=(0,it.normalizeGuid)(r,"id"),a=(0,it.normalizeGuid)(n.targetId,"targetId"),o=await(0,fr.resolveEntitySetName)(e,t),s=await(0,fr.resolveEntitySetName)(e,n.targetEntity),l=(0,it.assertODataName)(n.relationshipName,"relationshipName"),u=`/${o}(${i})/${l}/$ref`,c={"@odata.id":e.apiUrl(`/${s}(${a})`)};(0,er.ensureSuccess)(await e.post(u,c),e.apiUrl(u))}Ne.associateRecords=gL;async function vL(e,t,r,n,i){let a=(0,it.normalizeGuid)(r,"id"),o=(0,it.normalizeGuid)(i,"targetId"),s=await(0,fr.resolveEntitySetName)(e,t),l=(0,it.assertODataName)(n,"relationshipName"),u=`/${s}(${a})/${l}(${o})/$ref`;(0,er.ensureSuccess)(await e.delete(u),e.apiUrl(u))}Ne.disassociateRecords=vL});var hy=g(mr=>{"use strict";Object.defineProperty(mr,"__esModule",{value:!0});mr.deleteWebResource=mr.getWebResource=mr.updateWebResource=mr.createWebResource=void 0;var yL=Yt(),ro=ye(),Zs=ee(),Bd=ie(),bL={html:1,css:2,js:3,xml:4,png:5,jpg:6,gif:7,xsl:9,ico:10,svg:11,resx:12};function wL(e){let t=globalThis;if(t.Buffer)return t.Buffer.from(e,"utf8").toString("base64");if(t.btoa){let r=globalThis.TextEncoder;if(r){let n=new r().encode(e),i="",a=32768;for(let o=0;o<n.length;o+=a)i+=String.fromCharCode(...n.subarray(o,o+a));return t.btoa(i)}return t.btoa(e)}throw new Bd.InvalidArgumentError("no base64 encoder available; pass contentBase64 instead of content")}function fy(e){if(e.contentBase64!==void 0)return e.contentBase64;if(e.content!==void 0)return wL(e.content)}async function my(e,t){return(0,yL.publishWebResourceById)(e,t)}async function AL(e,t){var r;let n=fy(t);if(n===void 0)throw new Bd.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:bL[t.type],content:n};t.description&&(i.description=t.description);let a=(0,ro.ensureSuccess)(await e.post("/webresourceset",i),e.apiUrl("/webresourceset")),o=(0,ro.readCreatedId)(a,"webresourceid");if(!o)throw new Bd.InvalidArgumentError(`Dataverse did not return an id for web resource '${t.name}'`);return t.publish!==!1&&await my(e,o),{id:o,name:t.name}}mr.createWebResource=AL;async function CL(e,t,r){let n=(0,Zs.normalizeGuid)(t,"id"),i={},a=fy(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,ro.ensureSuccess)(await e.patch(o,i),e.apiUrl(o)),r.publish!==!1&&await my(e,n)}mr.updateWebResource=CL;async function SL(e,t){var r;let i=`/webresourceset(${(0,Zs.normalizeGuid)(t,"id")})${(0,Zs.odataQuery)([["$select","name,displayname,webresourcetype,content,description"]])}`;return(r=(0,ro.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)!==null&&r!==void 0?r:{}}mr.getWebResource=SL;async function EL(e,t){let n=`/webresourceset(${(0,Zs.normalizeGuid)(t,"id")})`;(0,ro.ensureSuccess)(await e.delete(n),e.apiUrl(n))}mr.deleteWebResource=EL});var el=g(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.applyAppSettings=ze.setAppSetting=ze.readAppSettings=ze.resolveSettingDefinitions=ze.APP_SETTING_UNSET=ze.APP_SETTING_OFF=ze.APP_SETTING_ON=ze.HEADER_AND_NAVIGATION_REFRESH=void 0;var Ii=ye(),Br=ee();ze.HEADER_AND_NAVIGATION_REFRESH="HeaderAndNavigationRefresh";ze.APP_SETTING_ON="2";ze.APP_SETTING_OFF="1";ze.APP_SETTING_UNSET="0";function yy(e,t){return"/appsettings/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,Br.odataQuery)([["$select",e],["$filter",t]])}async function by(e,t){var r,n;let i=[...new Set(t.filter(Boolean))],a=new Map;if(i.length===0)return a;let o=i.map(c=>`uniquename eq '${(0,Br.odataLiteral)(c)}'`).join(" or "),s=`/settingdefinitions${(0,Br.odataQuery)([["$select","settingdefinitionid,uniquename,displayname"],["$filter",o]])}`,u=((n=(r=(0,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}ze.resolveSettingDefinitions=by;async function NL(e,t){var r,n,i,a;let o=(0,Br.normalizeGuid)(t,"App id"),s=yy("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(w=>`settingdefinitionid eq ${(0,Br.normalizeGuid)(w,"Setting definition id")}`).join(" or "),m=`/settingdefinitions${(0,Br.odataQuery)([["$select","settingdefinitionid,uniquename,displayname"],["$filter",p]])}`,h=(0,Ii.ensureSuccess)(await e.get(m),e.apiUrl(m));for(let w of((a=(i=h.body)===null||i===void 0?void 0:i.value)!==null&&a!==void 0?a:[]).filter(Boolean))w.settingdefinitionid&&d.set(w.settingdefinitionid.toLowerCase(),w)}return u.map(p=>{var m,h,w,b,E;let D=d.get(((m=p._settingdefinitionid_value)!==null&&m!==void 0?m:"").toLowerCase());return{id:(h=p.appsettingid)!==null&&h!==void 0?h:"",name:(b=(w=D?.uniquename)!==null&&w!==void 0?w:p._settingdefinitionid_value)!==null&&b!==void 0?b:"",value:(E=p.value)!==null&&E!==void 0?E:"",...D?.displayname?{displayName:D.displayname}:{}}})}ze.readAppSettings=NL;async function gy(e,t,r){var n,i,a;let o=yy("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 wy(e,t,r,n){let i=(0,Br.normalizeGuid)(t,"App id"),o=(await by(e,[r])).get(r),s=o?.settingdefinitionid;if(!s)throw new Error(`App setting '${r}' is not available in this environment: no settingdefinition row has that uniquename. The feature may be version-gated or its solution may not be installed.`);let l=(0,Br.normalizeGuid)(s,"Setting definition id"),u=await gy(e,i,l);if(u)return vy(e,u,n);let c="/appsettings",d={"[email protected]":`/appmodules(${i})`,"[email protected]":`/settingdefinitions(${l})`,value:n},p,m;try{if(p=await e.post(c,d),p.status>=200&&p.status<300)return"created"}catch(w){m=w}let h;try{h=await gy(e,i,l)}catch{h=void 0}if(h)return vy(e,h,n);throw p&&(0,Ii.ensureSuccess)(p,e.apiUrl(c)),m}ze.setAppSetting=wy;async function vy(e,t,r){if(t.value===r)return"unchanged";let n=`/appsettings(${(0,Br.normalizeGuid)(t.id,"App setting id")})`;return(0,Ii.ensureSuccess)(await e.patch(n,{value:r}),e.apiUrl(n)),"updated"}async function DL(e,t,r){var n;let i=[];for(let[a,o]of Object.entries(r??{}))try{await wy(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}ze.applyAppSettings=DL});var rl=g(tl=>{"use strict";Object.defineProperty(tl,"__esModule",{value:!0});tl.HEADER_NAV_BOOLEAN_RULE=void 0;tl.HEADER_NAV_BOOLEAN_RULE="headerAndNavigationRefresh-must-be-boolean"});var Cy=g(Z=>{"use strict";Object.defineProperty(Z,"__esModule",{value:!0});Z.deleteSolution=Z.importSolution=Z.exportSolution=Z.removeSolutionComponent=Z.addSolutionComponent=Z.setSolutionVersion=Z.createSolution=Z.createPublisher=Z.getSolution=Z.fetchSolutionComponents=Z.SolutionComponentType=void 0;var Ay=Kt(),tr=ye(),wt=ee(),zn=ie();Z.SolutionComponentType={SavedQuery:26,Workflow:29,SavedQueryVisualization:59,SystemForm:60,AppModule:80,UxAgentProject:10372};var IL=[Z.SolutionComponentType.SavedQuery,Z.SolutionComponentType.Workflow,Z.SolutionComponentType.SavedQueryVisualization,Z.SolutionComponentType.SystemForm,Z.SolutionComponentType.AppModule,Z.SolutionComponentType.UxAgentProject];async function _L(e,t){let r=(0,wt.normalizeGuid)(t,"solutionId"),n=IL.map(s=>`msdyn_componenttype eq ${s}`).join(" or "),i=`/msdyn_solutioncomponentsummaries${(0,wt.odataQuery)([["$select","msdyn_objectid,msdyn_componenttype,msdyn_workflowcategory,msdyn_displayname,msdyn_name"],["$filter",`msdyn_solutionid eq ${r} and (${n})`]])}`,o=(await(0,Ay.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 PL(e,r,o)]}Z.fetchSolutionComponents=_L;async function PL(e,t,r){let n=new Set(r.map(s=>s.objectId.toLowerCase())),i=`/solutioncomponents${(0,wt.odataQuery)([["$select","objectid,componenttype"],["$filter",`_solutionid_value eq ${t} and componenttype eq ${Z.SolutionComponentType.UxAgentProject}`]])}`,a=await(0,Ay.collectPages)(e,i,"fetchSolutionComponents(draft pages)"),o=[];for(let s of a){let l=typeof s.objectid=="string"?s.objectid:void 0;l&&!n.has(l.toLowerCase())&&(n.add(l.toLowerCase()),o.push({objectId:l,componentType:Z.SolutionComponentType.UxAgentProject}))}return o}function TL(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 OL(e,t){var r,n,i,a,o,s,l,u,c,d;let p=String(t??"").trim();if(!p)throw new zn.InvalidArgumentError("getSolution: a solution unique name or id is required.");let m=TL(p)?`solutionid eq ${(0,wt.normalizeGuid)(p,"solutionId")}`:`uniquename eq '${(0,wt.odataLiteral)(p)}'`,h=`/solutions${(0,wt.odataQuery)([["$select","solutionid,uniquename,friendlyname,version,ismanaged"],["$expand","publisherid($select=publisherid,uniquename,customizationprefix,customizationoptionvalueprefix)"],["$filter",m]])}`,E=((n=(r=(0,tr.ensureSuccess)(await e.get(h),e.apiUrl(h)).body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[])[0];if(!E?.solutionid)throw new zn.InvalidArgumentError(`No solution found for '${t}'.`);let D=E.publisherid;if(!D?.publisherid)throw new zn.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 zn.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,wt.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,wt.normalizeGuid)(D.publisherid,"publisherId"),publisherUniqueName:(u=D.uniquename)!==null&&u!==void 0?u:"",publisherPrefix:(c=D.customizationprefix)!==null&&c!==void 0?c:"",publisherOptionValuePrefix:(d=D.customizationoptionvalueprefix)!==null&&d!==void 0?d:0}}Z.getSolution=OL;async function RL(e,t){var r;let n={uniquename:t.uniqueName,friendlyname:t.friendlyName,customizationprefix:t.prefix,customizationoptionvalueprefix:(r=t.optionValuePrefix)!==null&&r!==void 0?r:1e4};t.description&&(n.description=t.description);let i=(0,tr.ensureSuccess)(await e.post("/publishers",n),e.apiUrl("/publishers")),a=(0,tr.readCreatedId)(i,"publisherid");if(!a)throw new zn.InvalidArgumentError(`Dataverse did not return an id for publisher '${t.uniqueName}'`);return{id:a,uniqueName:t.uniqueName}}Z.createPublisher=RL;async function FL(e,t){var r;let n=(0,wt.normalizeGuid)(t.publisherId,"publisherId"),i={uniquename:t.uniqueName,friendlyname:t.friendlyName,version:(r=t.version)!==null&&r!==void 0?r:"1.0.0.0","[email protected]":`/publishers(${n})`};t.description&&(i.description=t.description);let a=(0,tr.ensureSuccess)(await e.post("/solutions",i),e.apiUrl("/solutions")),o=(0,tr.readCreatedId)(a,"solutionid");if(!o)throw new zn.InvalidArgumentError(`Dataverse did not return an id for solution '${t.uniqueName}'`);return{id:o,uniqueName:t.uniqueName}}Z.createSolution=FL;async function xL(e,t,r){let i=`/solutions(${(0,wt.normalizeGuid)(t,"solutionId")})`;(0,tr.ensureSuccess)(await e.patch(i,{version:r}),e.apiUrl(i))}Z.setSolutionVersion=xL;async function LL(e,t){var r;let i={ComponentId:(0,wt.normalizeGuid)(t.componentId,"componentId"),ComponentType:t.componentType,SolutionUniqueName:t.solutionUniqueName,AddRequiredComponents:(r=t.addRequiredComponents)!==null&&r!==void 0?r:!1};t.doNotIncludeSubcomponents!==void 0&&(i.DoNotIncludeSubcomponents=t.doNotIncludeSubcomponents),(0,tr.ensureSuccess)(await e.post("/AddSolutionComponent",i),e.apiUrl("/AddSolutionComponent"))}Z.addSolutionComponent=LL;async function kL(e,t,r,n){let a={SolutionComponent:{"@odata.type":"Microsoft.Dynamics.CRM.solutioncomponent",solutioncomponentid:(0,wt.normalizeGuid)(t,"componentId")},ComponentType:r,SolutionUniqueName:n};(0,tr.ensureSuccess)(await e.post("/RemoveSolutionComponent",a),e.apiUrl("/RemoveSolutionComponent"))}Z.removeSolutionComponent=kL;async function ML(e,t){var r,n;let i={SolutionName:t.solutionName,Managed:(r=t.managed)!==null&&r!==void 0?r:!1},o=(n=(0,tr.ensureSuccess)(await e.post("/ExportSolution",i),e.apiUrl("/ExportSolution")).body)===null||n===void 0?void 0:n.ExportSolutionFile;if(!o)throw new zn.InvalidArgumentError(`ExportSolution returned no file for '${t.solutionName}'`);return{base64:o}}Z.exportSolution=ML;async function UL(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,wt.normalizeGuid)(t.importJobId,"importJobId")),(0,tr.ensureSuccess)(await e.post("/ImportSolution",i),e.apiUrl("/ImportSolution"))}Z.importSolution=UL;async function BL(e,t){let n=`/solutions(${(0,wt.normalizeGuid)(t,"solutionId")})`;(0,tr.ensureSuccess)(await e.delete(n),e.apiUrl(n))}Z.deleteSolution=BL});var al=g(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.appApi=gn.deleteAppResolvingOnce=gn.unpublishedAppModulesQuery=void 0;var Wd=Kt(),$L=Hd(),Sy=Yt(),qL=el(),we=ye(),ae=ee(),zd=yt(),VL=Td(),me=ie(),GL=(0,ae.odataQuery)([["$select","appmoduleid,name,uniquename,description"]]),$d="appmoduleid,name,uniquename,description";function Ty(e,t,r){return"/appmodules/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,ae.odataQuery)([["$select",e],["$filter",t],["$top",r]])}gn.unpublishedAppModulesQuery=Ty;function qd(e,t){return Ty(e,t?`appmoduleid eq ${t}`:void 0,t?1:void 0)}function il(e,t){return"/sitemaps/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,ae.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 nl(e){let t=e?.["@odata.etag"];return typeof t=="string"?t:null}function no(e){let t=new Set,r=[];for(let n of e??[])n&&!t.has(n)&&(t.add(n),r.push(n));return r}function zL(e){return`cdsapp_${(e||"").replace(/[^a-zA-Z0-9]/g,"")||"app"}`}async function Oy(e,t){var r,n;let i=u=>{throw new me.SdkError("APP_SITEMAP_UNRESOLVED",`The sitemap lookup for app uniquename '${t??""}' ${u}, so it cannot be determined whether this app has a sitemap. Retry; if the app is newly created, publish it first (an unpublished app is not readable).`)};if(!t)return i("cannot run because the app record carried no uniquename");let a=`/sitemaps${(0,ae.odataQuery)([["$select","sitemapid"],["$filter",`sitemapnameunique eq '${(0,ae.odataLiteral)(t)}'`],["$top",1]])}`,o;try{o=await e.get(a)}catch(u){return i(`failed (${u.message})`)}if(o.status<200||o.status>=300)return i(`returned HTTP ${o.status}`);let s=(r=o.body)===null||r===void 0?void 0:r.value;if(!Array.isArray(s))return i("returned a malformed body");let l=(n=s[0])===null||n===void 0?void 0:n.sitemapid;return s.length>0&&!l?i("returned a row with no sitemapid"):l}async function WL(e){let t=s=>{var l,u,c;return(c=(u=(l=s.body)===null||l===void 0?void 0:l.value)===null||u===void 0?void 0:u[0])===null||c===void 0?void 0:c.webresourceid},r=s=>`/webresourceset${(0,ae.odataQuery)([["$select","webresourceid"],["$top",1],["$filter",s]])}`,n="(webresourcetype eq 5 or webresourcetype eq 6 or webresourcetype eq 7 or webresourcetype eq 10 or webresourcetype eq 11)",i=t(await e.get(r("webresourcetype eq 5 and ismanaged eq false and contains(name,'icon')")));if(i)return{id:i,managed:!1};let a=t(await e.get(r(`${n} and ismanaged eq false`)));if(a)return{id:a,managed:!1};let o=t(await e.get(r(n)));return o?{id:o,managed:!0}:void 0}function jd(e){return e instanceof Error?e.message:String(e)}async function jL(e,t){var r,n,i;try{let a=`/roles${(0,ae.odataQuery)([["$select","roleid"],["$filter","name eq 'System Administrator'"],["$top",1]])}`,s=(i=(n=(r=(0,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 (${jd(a)}); it will not be visible or playable until a role is granted access to it.`}}async function HL(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}' (${jd(c)}); they were NOT added to the app.`),[]}}let[i,a,o]=await Promise.all([n(`/systemforms${(0,ae.odataQuery)([["$select","formid"],["$filter",`objecttypecode eq '${(0,ae.odataLiteral)(t)}' and type eq 2 and formactivationstate eq 1`]])}`,"formid","forms"),n(`/savedqueries${(0,ae.odataQuery)([["$select","savedqueryid"],["$filter",`returnedtypecode eq '${(0,ae.odataLiteral)(t)}' and querytype eq 0 and statecode eq 0`]])}`,"savedqueryid","views"),n(`/savedqueryvisualizations${(0,ae.odataQuery)([["$select","savedqueryvisualizationid"],["$filter",`primaryentitytypecode eq '${(0,ae.odataLiteral)(t)}'`]])}`,"savedqueryvisualizationid","charts")]);return{forms:i,views:a,charts:o,warnings:r}}var Ey=new WeakMap;async function JL(e,t){let r=Ey.get(e);r||(r=new Map,Ey.set(e,r));let n=r.get(t);if(n!==void 0)return n;let i=await QL(e,t);return i&&r.set(t,i),i}async function Ny(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 QL(e,t){let r=`/EntityDefinitions(LogicalName='${(0,ae.odataLiteral)(t)}')${(0,ae.odataQuery)([["$select","MetadataId,EntitySetName"]])}`,n=await e.get(r);if(n.status>=200&&n.status<300){let i=n.body;if(i?.MetadataId&&i.EntitySetName)return{logicalName:t,metadataId:i.MetadataId,entitySetName:i.EntitySetName}}}async function Dy(e,t){let r=[],n=no(t.entities),i=4,a=await Ny(n,i,m=>JL(e,m)),o=n.filter((m,h)=>!a[h]);if(o.length>0)throw new me.SdkError("APP_ENTITY_COMPONENT_UNRESOLVED",`Refusing to build app components: table(s) ${o.map(m=>`'${m}'`).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(m=>!!m);for(let m of s)r.push({"@odata.id":`${m.entitySetName}(${m.metadataId})`});for(let m of no(t.components.forms))r.push({"@odata.type":"Microsoft.Dynamics.CRM.systemform",formid:m});for(let m of no(t.components.views))r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedquery",savedqueryid:m});for(let m of no(t.components.charts))r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedqueryvisualization",savedqueryvisualizationid:m});for(let m of no(t.components.dashboards))r.push({"@odata.type":"Microsoft.Dynamics.CRM.systemform",formid:m});let l=new Set(t.components.forms),u=new Set(t.components.views),c=new Set(t.components.charts),d=await Ny(n,i,m=>HL(e,m)),p=d.flatMap(m=>m.warnings);for(let m of d){for(let h of m.forms)l.has(h)||(l.add(h),r.push({"@odata.type":"Microsoft.Dynamics.CRM.systemform",formid:h}));for(let h of m.views)u.has(h)||(u.add(h),r.push({"@odata.type":"Microsoft.Dynamics.CRM.savedquery",savedqueryid:h}));for(let h of m.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 Iy(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 XL(e){return"/appmodules/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,ae.odataQuery)([["$select","appmoduleid,appmoduleidunique"],["$filter",`appmoduleid eq ${e}`],["$top",1]])}async function _y(e,t,r){var n;if(r.length===0)return;let i=XL(t),a=await e.get(i);if(a.status<200||a.status>=300)throw new me.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 me.SdkError("APP_COMPONENTS_UNVERIFIED",`App '${t}': its components were written but could not be verified \u2014 the app did not return an 'appmoduleidunique' to file components under. Re-push to retry.`);let l=`/appmodulecomponents${(0,ae.odataQuery)([["$select","objectid,componenttype"],["$filter",`_appmoduleidunique_value eq ${(0,ae.normalizeGuid)(s,`App '${t}' appmoduleidunique`)} and componenttype eq 1`]])}`,u=await e.get(l);if(u.status<200||u.status>=300)throw new me.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 me.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(m=>m.objectid).filter(m=>typeof m=="string").map(m=>m.toLowerCase())),p=r.filter(m=>!d.has(m.metadataId.toLowerCase()));if(p.length>0)throw new me.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(m=>`'${m.logicalName}' (expected objectid ${m.metadataId})`).join(", ")}. The app's navigation would reference content the app does not contain.`)}async function KL(e,t,r){let n=`/appmodules(${t})`,i=`/sitemaps(${r.sitemapId})`;try{if(!await YL(e,r.sitemapId)){r.serverRefusedSitemap&&(0,we.ensureSuccess)(await e.delete(n),e.apiUrl(n));return}e.supportsAtomicBatch&&await Fy(e,[{path:n,etag:r.appEtag},{path:i,etag:r.sitemapEtag}])}catch{}}async function YL(e,t){var r;let n=il(t,"sitemapid"),i=await e.get(n);if(i.status<200||i.status>=300)throw new me.SdkError("APP_SITEMAP_UNRESOLVED",`The unpublished-aware read of sitemap '${t}' returned HTTP ${i.status}, so it cannot be determined whether the row exists.`);let a=(r=i.body)===null||r===void 0?void 0:r.value;if(!Array.isArray(a))throw new me.SdkError("APP_SITEMAP_UNRESOLVED",`The unpublished-aware read of sitemap '${t}' returned no readable result set, so it cannot be determined whether the row exists.`);return a.length>0}async function Ry(e,t){var r;let n=(0,ae.normalizeGuid)(t,"id"),i=h=>{throw new me.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})${GL}`,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 Oy(e,s);if(!l)return{uniquename:s,appEtag:(0,we.readEtag)(o)};let u=(0,ae.normalizeGuid)(l,"sitemapId"),c=il(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 m=p.sitemapxml;return typeof m!="string"?i(`sitemap '${u}' returned no sitemapxml.`):{sitemapId:u,uniquename:s,sitemapXml:m,appEtag:(0,we.readEtag)(o),sitemapEtag:nl(p)}}async function ZL(e,t,r){let n=(0,ae.normalizeGuid)(t,"id"),i=await Ry(e,n);await r?.(i.sitemapXml),await xy(e,n,i)}gn.deleteAppResolvingOnce=ZL;async function Fy(e,t){let r=`batch_${(0,zd.newId)()}`,n=`changeset_${(0,zd.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,be.ensureSuccess)(o,s);let l=`app '${t[0].path}'`;if(typeof o.body!="string"||o.body.length===0)throw new pe.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,uF.parseChangeSetStatuses)(o.body,i.map((d,p)=>String(p+1)));if(u===void 0)throw new pe.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 pe.ConnectionError(s,c,`atomic delete of ${l} was rolled back: the change set reported HTTP ${c}`);if(u.length!==i.length)throw new pe.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 nd(e,t){try{let r=Ls(t,"sitemapid"),n=await e.get(r);return n.status<200||n.status>=300?null:Fs(yi(n))}catch{return null}}function AF(e){return e>=400&&e<500&&e!==408&&e!==429}function id(e,t,r){if(!e)throw new pe.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 qg(e,t,r){let n=`/appmodules(${t})`;if(!r.sitemapId){await CF(e,n,id(r.appEtag,t,"app"));return}if(!e.supportsAtomicBatch)throw new pe.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 $g(e,[{path:n,etag:id(r.appEtag,t,"app")},{path:`/sitemaps(${r.sitemapId})`,etag:id(r.sitemapEtag,t,"sitemap")}])}async function CF(e,t,r){(0,be.ensureSuccess)(await e.delete(t,{headers:{"If-Match":r}}),e.apiUrl(t))}async function kg(e,t){if(!/GenPageId/i.test(t))return;let r;try{r=[...new Set((0,sF.collectGenPageIds)(t))]}catch(o){throw new pe.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 (${sd(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,ie.odataQuery)([["$select","uxagentprojectid"],["$filter",s.map(c=>`uxagentprojectid eq ${c}`).join(" or ")]]),u=await(0,od.collectPages)(e,l,"sitemap generative-page preflight");for(let c of u){let d=c.uxagentprojectid;typeof d=="string"&&d.trim()!==""&&n.add((0,ie.normalizeGuid)(d,"uxagentprojectid"))}}let a=r.filter(o=>!n.has(o));if(a.length>0)throw new pe.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 SF(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")}ln.appApi={async get(e,t){var r;let n=(0,ie.normalizeGuid)(t,"id"),i=rd(td,n),a=(0,be.ensureSuccess)(await e.get(i),e.apiUrl(i)),o=(r=yi(a))!==null&&r!==void 0?r:{};if(!o.appmoduleid)throw new pe.SdkError("APP_NOT_FOUND",`App '${n}' was not found (checked the unpublished-aware projection, which includes drafts).`);let s=await Ug(e,o.uniquename),l=s?(0,ie.normalizeGuid)(s,"sitemapId"):void 0,u=null;if(l){let d=Ls(l,"sitemapid,sitemapname,sitemapnameunique,sitemapxml"),p=(0,be.ensureSuccess)(await e.get(d),e.apiUrl(d)),m=yi(p);if(m&&m.sitemapnameunique!==o.uniquename)throw new pe.SdkError("APP_SITEMAP_UNRESOLVED",`Refusing to fetch app '${n}': sitemap '${l}' now carries sitemapnameunique '${String(m.sitemapnameunique)}', not '${String(o.uniquename)}', so it is no longer this app's sitemap. Retry.`);o.$sitemap=m??{},u=Fs(m)}let c=Fs(o);return{raw:o,etag:u,...o.appmoduleid?{siblingEtags:{[(0,ie.normalizeGuid)(o.appmoduleid,"appmoduleid")]:c}}:{}}},async list(e,t){let r=rd(td);return(await(0,od.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 kg(e,n.sitemapxml);let i=n.iconWebResourceId?void 0:await pF(e),a=n.iconWebResourceId||i?.id;if(!a)throw new pe.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||dF(n.appModuleId),l={name:n.appModuleName,uniquename:s,clienttype:4,formfactor:1,navigationtype:0};n.appModuleDescription&&(l.description=n.appModuleDescription),a&&(l.webresourceid=a);let u="/appmodules",c=(0,be.ensureSuccess)(await e.post(u,(0,be.withClientMintedId)(l,"appmoduleid",r)),e.apiUrl(u)),d=(0,be.resolveCreatedId)(c,"appmoduleid","app module",r),p=null,m=[];o&&m.push(o);let h={kind:"notRequested"},w=(0,ad.newId)(),y=!1;try{let D="/sitemaps",x=await e.post(D,{sitemapid:w,sitemapnameunique:s,sitemapname:n.sitemapname,sitemapxml:n.sitemapxml});y=AF(x.status);let F=(0,be.ensureSuccess)(x,e.apiUrl(D));p=(0,be.readEtag)(F),p||(p=await nd(e,w));let q=await xg(e,n);m.push(...q.warnings);let G=q.components;G.unshift({"@odata.type":"Microsoft.Dynamics.CRM.sitemap",sitemapid:w}),await Fg(e,d,G),await Lg(e,d,q.tables);let M=await fF(e,d);M&&m.push(M),n.appSettings&&Object.keys(n.appSettings).length>0&&m.push(...await(0,lF.applyAppSettings)(e,d,n.appSettings)),n.published!==!1&&(await(0,Tg.publishAppModule)(e,d),h={kind:"submitted"})}catch(D){throw await bF(e,d,{sitemapId:w,serverRefusedSitemap:y,appEtag:(0,be.readEtag)(c),sitemapEtag:p}),D}let N=null;if(h.kind==="submitted")try{let D=await e.get(`/appmodules(${d})?$select=appmoduleid`);D.status>=200&&D.status<300&&(N=(0,be.readEtag)(D))}catch{}return{id:d,etag:p,serverIdentity:{sitemapId:w},siblingEtags:{[d]:N},publish:h,...m.length>0?{warnings:m}:{}}},async update(e,t,r,n,i,a){var o,s,l,u,c,d,p;let m=r,h=(0,ie.normalizeGuid)(t,"id");if(await kg(e,m.sitemapxml),!m.sitemapId)throw new pe.ValidationError("app",h,"/sitemapId","missing sitemap identity \u2014 re-fetch the app before pushing edits");let w=(0,ie.normalizeGuid)(m.sitemapId,"sitemapId");if(!n)throw new pe.SdkError("APP_UPDATE_NO_ETAG",`Refusing to push app '${h}': no concurrency token is held for its sitemap row, so the write could not be made conditional and would silently overwrite a concurrent edit. Re-fetch the app and re-apply the change.`);let y=await xg(e,m),N=`/appmodules(${h})`,D=(o=a?.[h])!==null&&o!==void 0?o:null,x=!0,F=!1;try{let he=rd(td,h),$e=await e.get(he);if($e.status>=200&&$e.status<300){let Je=(s=yi($e))!==null&&s!==void 0?s:{};F=!0,x=String((l=Je.name)!==null&&l!==void 0?l:"")!==String((u=m.appModuleName)!==null&&u!==void 0?u:"")||String((c=Je.description)!==null&&c!==void 0?c:"")!==String((d=m.appModuleDescription)!==null&&d!==void 0?d:"")}}catch{}let q=D;if(x){let he=F?D:null,$e=he?(0,be.echoWrite)("appmoduleid",{"If-Match":he}):{query:"",options:void 0},Je=await e.patch(`${N}${$e.query}`,{name:m.appModuleName,description:m.appModuleDescription},$e.options);if(SF(Je))throw new pe.SdkError("APP_DRAFT_HEADER_NOT_WRITABLE",`Refusing to update app '${h}': its appmodule row is UNPUBLISHED, and Dataverse cannot resolve version numbers for a draft appmodule (HTTP 400). A draft header cannot be PATCHed at all \u2014 a plain retry fails too, as an upsert-create ("webresourceid cannot be NULL"). Publish the app first, then push the header edit. Nothing was modified by this call.`);(0,be.ensureSuccess)(Je,e.apiUrl(N)),q=(0,be.readEtag)(Je)}let G={"If-Match":n},M=`/sitemaps(${w})`,U;try{U=(0,be.ensureSuccess)(await e.patch(M,{sitemapxml:m.sitemapxml,sitemapname:m.sitemapname},G?{headers:G}:void 0),e.apiUrl(M))}catch(he){throw(0,pe.withPartialTokens)(he,{siblingEtags:{[h]:q}})}let B=[...y.warnings];try{await Fg(e,h,y.components),await Lg(e,h,y.tables)}catch(he){B.push(`App '${h}': one or more components were not pinned (${he.message}). Navigation may reference content not included in the app; re-push to retry.`)}let W={kind:"notRequested"},$=q,Ae=(0,be.readEtag)(U);if(m.published===!0){try{await(0,Tg.publishAppModule)(e,h),W={kind:"submitted"}}catch(he){W={kind:"failed",error:he},B.push(`App '${h}': saved, but publishing failed (${he.message}). The app remains unpublished; re-push to retry.`)}if(W.kind==="submitted"){$=null;try{let he=await e.get(`/appmodules(${h})?$select=appmoduleid`);he.status>=200&&he.status<300&&($=(0,be.readEtag)(he)),Ae=(p=await nd(e,w))!==null&&p!==void 0?p:Ae}catch{}}}return{id:h,etag:Ae??await nd(e,w),siblingEtags:{[h]:$},publish:W,...B.length>0?{warnings:B}:{}}},async delete(e,t){let r=(0,ie.normalizeGuid)(t,"id");await qg(e,r,await Bg(e,r))}}});var Ha=g(wi=>{"use strict";function NF(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 ud(e,t){return t===void 0&&(t=Object),t&&typeof t.freeze=="function"?t.freeze(e):e}function EF(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 Vg=ud({HTML:"text/html",isHTML:function(e){return e===Vg.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Gg=ud({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===Gg.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});wi.assign=EF;wi.find=NF;wi.freeze=ud;wi.MIME_TYPE=Vg;wi.NAMESPACE=Gg});var Ad=g(Ur=>{var Kg=Ha(),dr=Kg.find,Qa=Kg.NAMESPACE;function DF(e){return e!==""}function IF(e){return e?e.split(/[\t\n\f\r ]+/).filter(DF):[]}function _F(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function zg(e){if(!e)return[];var t=IF(e);return Object.keys(t.reduce(_F,{}))}function PF(e){return function(t){return e&&e.indexOf(t)!==-1}}function Xa(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function yt(e,t){var r=e.prototype;if(!(r instanceof t)){let i=function(){};var n=i;i.prototype=t.prototype,i=new i,Xa(r,i),e.prototype=r=i}r.constructor!=e&&(typeof e!="function"&&console.error("unknown Class:"+e),r.constructor=e)}var wt={},xt=wt.ELEMENT_NODE=1,Ci=wt.ATTRIBUTE_NODE=2,Us=wt.TEXT_NODE=3,Yg=wt.CDATA_SECTION_NODE=4,Zg=wt.ENTITY_REFERENCE_NODE=5,TF=wt.ENTITY_NODE=6,cd=wt.PROCESSING_INSTRUCTION_NODE=7,dd=wt.COMMENT_NODE=8,e0=wt.DOCUMENT_NODE=9,t0=wt.DOCUMENT_TYPE_NODE=10,Lr=wt.DOCUMENT_FRAGMENT_NODE=11,OF=wt.NOTATION_NODE=12,rt={},ze={},Qz=rt.INDEX_SIZE_ERR=(ze[1]="Index size error",1),Jz=rt.DOMSTRING_SIZE_ERR=(ze[2]="DOMString size error",2),bt=rt.HIERARCHY_REQUEST_ERR=(ze[3]="Hierarchy request error",3),Xz=rt.WRONG_DOCUMENT_ERR=(ze[4]="Wrong document",4),RF=rt.INVALID_CHARACTER_ERR=(ze[5]="Invalid character",5),Kz=rt.NO_DATA_ALLOWED_ERR=(ze[6]="No data allowed",6),Yz=rt.NO_MODIFICATION_ALLOWED_ERR=(ze[7]="No modification allowed",7),r0=rt.NOT_FOUND_ERR=(ze[8]="Not found",8),Zz=rt.NOT_SUPPORTED_ERR=(ze[9]="Not supported",9),Wg=rt.INUSE_ATTRIBUTE_ERR=(ze[10]="Attribute in use",10),Ai=rt.INVALID_STATE_ERR=(ze[11]="Invalid state",11),eW=rt.SYNTAX_ERR=(ze[12]="Syntax error",12),tW=rt.INVALID_MODIFICATION_ERR=(ze[13]="Invalid modification",13),rW=rt.NAMESPACE_ERR=(ze[14]="Invalid namespace",14),nW=rt.INVALID_ACCESS_ERR=(ze[15]="Invalid access",15);function se(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,se);return r.code=e,t&&(this.message=this.message+": "+t),r}se.prototype=Error.prototype;Xa(rt,se);function kr(){}kr.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++)wd(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 Si(e,t){this._node=e,this._refresh=t,pd(this)}function pd(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var r=e._refresh(e._node);if(m0(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];Xa(r,e),e._inc=t}}Si.prototype.item=function(e){return pd(this),this[e]||null};yt(Si,kr);function Bs(){}function n0(e,t){for(var r=e.length;r--;)if(e[r]===t)return r}function jg(e,t,r,n){if(n?t[n0(t,n)]=r:t[t.length++]=r,e){r.ownerElement=e;var i=e.ownerDocument;i&&(n&&o0(i,e,n),xF(i,e,r))}}function Hg(e,t,r){var n=n0(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&&(o0(a,e,r),r.ownerElement=null)}}else throw new se(r0,new Error(e.tagName+"@"+r))}Bs.prototype={length:0,item:kr.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 se(Wg);var r=this.getNamedItem(e.nodeName);return jg(this._ownerElement,this,e,r),r},setNamedItemNS:function(e){var t=e.ownerElement,r;if(t&&t!=this._ownerElement)throw new se(Wg);return r=this.getNamedItemNS(e.namespaceURI,e.localName),jg(this._ownerElement,this,e,r),r},removeNamedItem:function(e){var t=this.getNamedItem(e);return Hg(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var r=this.getNamedItemNS(e,t);return Hg(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 i0(){}i0.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,r){var n=new Ka;if(n.implementation=this,n.childNodes=new kr,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 ae(){}ae.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,l0),t&&this.removeChild(t)},removeChild:function(e){return s0(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(e){return f0(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===Us&&t.nodeType===Us?(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==Ci?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==Ci?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){var t=this.lookupPrefix(e);return t==null}};function a0(e){return e=="<"&&"&lt;"||e==">"&&"&gt;"||e=="&"&&"&amp;"||e=='"'&&"&quot;"||"&#"+e.charCodeAt()+";"}Xa(wt,ae);Xa(wt,ae.prototype);function $s(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 Ka(){this.ownerDocument=this}function xF(e,t,r){e&&e._inc++;var n=r.namespaceURI;n===Qa.XMLNS&&(t._nsMap[r.prefix?r.localName:""]=r.value)}function o0(e,t,r,n){e&&e._inc++;var i=r.namespaceURI;i===Qa.XMLNS&&delete t._nsMap[r.prefix?r.localName:""]}function fd(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 s0(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,fd(e.ownerDocument,e),t}function FF(e){return e&&(e.nodeType===ae.DOCUMENT_NODE||e.nodeType===ae.DOCUMENT_FRAGMENT_NODE||e.nodeType===ae.ELEMENT_NODE)}function LF(e){return e&&(pr(e)||md(e)||Mr(e)||e.nodeType===ae.DOCUMENT_FRAGMENT_NODE||e.nodeType===ae.COMMENT_NODE||e.nodeType===ae.PROCESSING_INSTRUCTION_NODE)}function Mr(e){return e&&e.nodeType===ae.DOCUMENT_TYPE_NODE}function pr(e){return e&&e.nodeType===ae.ELEMENT_NODE}function md(e){return e&&e.nodeType===ae.TEXT_NODE}function Qg(e,t){var r=e.childNodes||[];if(dr(r,pr)||Mr(t))return!1;var n=dr(r,Mr);return!(t&&n&&r.indexOf(n)>r.indexOf(t))}function Jg(e,t){var r=e.childNodes||[];function n(a){return pr(a)&&a!==t}if(dr(r,n))return!1;var i=dr(r,Mr);return!(t&&i&&r.indexOf(i)>r.indexOf(t))}function kF(e,t,r){if(!FF(e))throw new se(bt,"Unexpected parent node type "+e.nodeType);if(r&&r.parentNode!==e)throw new se(r0,"child not in parent");if(!LF(t)||Mr(t)&&e.nodeType!==ae.DOCUMENT_NODE)throw new se(bt,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function MF(e,t,r){var n=e.childNodes||[],i=t.childNodes||[];if(t.nodeType===ae.DOCUMENT_FRAGMENT_NODE){var a=i.filter(pr);if(a.length>1||dr(i,md))throw new se(bt,"More than one element or text in fragment");if(a.length===1&&!Qg(e,r))throw new se(bt,"Element in fragment can not be inserted before doctype")}if(pr(t)&&!Qg(e,r))throw new se(bt,"Only one element can be added and only after doctype");if(Mr(t)){if(dr(n,Mr))throw new se(bt,"Only one doctype is allowed");var o=dr(n,pr);if(r&&n.indexOf(o)<n.indexOf(r))throw new se(bt,"Doctype can only be inserted before an element");if(!r&&o)throw new se(bt,"Doctype can not be appended since element is present")}}function l0(e,t,r){var n=e.childNodes||[],i=t.childNodes||[];if(t.nodeType===ae.DOCUMENT_FRAGMENT_NODE){var a=i.filter(pr);if(a.length>1||dr(i,md))throw new se(bt,"More than one element or text in fragment");if(a.length===1&&!Jg(e,r))throw new se(bt,"Element in fragment can not be inserted before doctype")}if(pr(t)&&!Jg(e,r))throw new se(bt,"Only one element can be added and only after doctype");if(Mr(t)){let l=function(u){return Mr(u)&&u!==r};var s=l;if(dr(n,l))throw new se(bt,"Only one doctype is allowed");var o=dr(n,pr);if(r&&n.indexOf(o)<n.indexOf(r))throw new se(bt,"Doctype can only be inserted before an element")}}function qs(e,t,r,n){kF(e,t,r),e.nodeType===ae.DOCUMENT_NODE&&(n||MF)(e,t,r);var i=t.parentNode;if(i&&i.removeChild(t),t.nodeType===Lr){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;Ja(a,l)}while(a!==o&&(a=a.nextSibling));return fd(e.ownerDocument||e,e),t.nodeType==Lr&&(t.firstChild=t.lastChild=null),t}function Ja(e,t){if(e.ownerDocument!==t){if(e.ownerDocument=t,e.nodeType===xt&&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;)Ja(i,t),i=i.nextSibling}}function UF(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,fd(e.ownerDocument,e,t);var r=e.ownerDocument||e;return Ja(t,r),t}Ka.prototype={nodeName:"#document",nodeType:e0,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==Lr){for(var r=e.firstChild;r;){var n=r.nextSibling;this.insertBefore(r,t),r=n}return e}return qs(this,e,t),Ja(e,this),this.documentElement===null&&e.nodeType===xt&&(this.documentElement=e),e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),s0(this,e)},replaceChild:function(e,t){qs(this,e,t,l0),Ja(e,this),t&&this.removeChild(t),pr(e)&&(this.documentElement=e)},importNode:function(e,t){return BF(this,e,t)},getElementById:function(e){var t=null;return $s(this.documentElement,function(r){if(r.nodeType==xt&&r.getAttribute("id")==e)return t=r,!0}),t},getElementsByClassName:function(e){var t=zg(e);return new Si(this,function(r){var n=[];return t.length>0&&$s(r.documentElement,function(i){if(i!==r&&i.nodeType===xt){var a=i.getAttribute("class");if(a){var o=e===a;if(!o){var s=zg(a);o=t.every(PF(s))}o&&n.push(i)}}}),n})},createElement:function(e){var t=new Un;t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new kr;var r=t.attributes=new Bs;return r._ownerElement=t,t},createDocumentFragment:function(){var e=new zs;return e.ownerDocument=this,e.childNodes=new kr,e},createTextNode:function(e){var t=new hd;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new gd;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){if(e.indexOf("]]>")!==-1)throw new se(RF,'data contains "]]>"');var t=new vd;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var r=new yd;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 bd;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var r=new Un,n=t.split(":"),i=r.attributes=new Bs;return r.childNodes=new kr,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}};yt(Ka,ae);function Un(){this._nsMap={}}Un.prototype={nodeType:xt,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===Lr?this.insertBefore(e,null):UF(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 Si(this,function(t){var r=[];return $s(t,function(n){n!==t&&n.nodeType==xt&&(e==="*"||n.tagName==e)&&r.push(n)}),r})},getElementsByTagNameNS:function(e,t){return new Si(this,function(r){var n=[];return $s(r,function(i){i!==r&&i.nodeType===xt&&(e==="*"||i.namespaceURI===e)&&(t==="*"||i.localName==t)&&n.push(i)}),n})}};Ka.prototype.getElementsByTagName=Un.prototype.getElementsByTagName;Ka.prototype.getElementsByTagNameNS=Un.prototype.getElementsByTagNameNS;yt(Un,ae);function Vs(){}Vs.prototype.nodeType=Ci;yt(Vs,ae);function Ya(){}Ya.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[bt])},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}};yt(Ya,ae);function hd(){}hd.prototype={nodeName:"#text",nodeType:Us,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}};yt(hd,Ya);function gd(){}gd.prototype={nodeName:"#comment",nodeType:dd};yt(gd,Ya);function vd(){}vd.prototype={nodeName:"#cdata-section",nodeType:Yg};yt(vd,Ya);function Gs(){}Gs.prototype.nodeType=t0;yt(Gs,ae);function u0(){}u0.prototype.nodeType=OF;yt(u0,ae);function c0(){}c0.prototype.nodeType=TF;yt(c0,ae);function bd(){}bd.prototype.nodeType=Zg;yt(bd,ae);function zs(){}zs.prototype.nodeName="#document-fragment";zs.prototype.nodeType=Lr;yt(zs,ae);function yd(){}yd.prototype.nodeType=cd;yt(yd,ae);function d0(){}d0.prototype.serializeToString=function(e,t,r,n){return p0.call(e,t,r,n)};ae.prototype.toString=p0;function p0(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 wd(this,i,e,t,l,n),i.join("")}function Xg(e,t,r){var n=e.prefix||"",i=e.namespaceURI;if(!i||n==="xml"&&i===Qa.XML||i===Qa.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,a0),'"')}function wd(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 xt:var c=o.attributes,d=c.length,p=o.tagName;u=Qa.isHTML(o.namespaceURI)||u;var m=p;if(!u&&!o.prefix&&o.namespaceURI){for(var h,w=0;w<c.length;w++)if(c.item(w).name==="xmlns"){h=c.item(w).value;break}if(!h)for(var y=l.length-1;y>=0;y--){var N=l[y];if(N.prefix===""&&N.namespace===o.namespaceURI){h=N.namespace;break}}if(h!==o.namespaceURI)for(var y=l.length-1;y>=0;y--){var N=l[y];if(N.namespace===o.namespaceURI){N.prefix&&(m=N.prefix+":"+p);break}}}t.push("<",m);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(Xg(F,u,D)){var q=F.prefix||"",G=F.namespaceURI;Ms(t,q?"xmlns:"+q:"xmlns",G),D.push({prefix:q,namespace:G})}var M=n?n(F):F;M&&(typeof M=="string"?t.push(M):Ms(t,M.name,M.value))}if(p===m&&Xg(o,u,D)){var U=o.prefix||"",G=o.namespaceURI;Ms(t,U?"xmlns:"+U:"xmlns",G),D.push({prefix:U,namespace:G})}var B=o.firstChild;if(B||u&&!/^(?:meta|link|img|br|hr|input)$/i.test(p)){if(t.push(">"),u&&/^script$/i.test(p)){for(;B;)B.data?t.push(B.data):wd(B,t,u,n,D.slice(),a),B=B.nextSibling;return t.push("</",p,">"),null}return{ns:D,isHTML:u,tag:m}}else return t.push("/>"),null;case e0:case Lr:return{ns:l.slice(),isHTML:u,tag:null};case Ci:return Ms(t,o.name,o.value),null;case Us:return t.push(o.data.replace(/[<&>]/g,a0)),null;case Yg:if(a&&o.data.indexOf("]]>")!==-1)throw new se(Ai,'The CDATASection data contains "]]>"');return t.push("<![CDATA[",o.data.replace(/]]>/g,"]]]]><![CDATA[>"),"]]>"),null;case dd:if(a&&o.data.indexOf("-->")!==-1)throw new se(Ai,'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 se(Ai,"DocumentType publicId is not a valid PubidLiteral");if(o.systemId&&!/^("[^"]*"|'[^']*')$/.test(o.systemId))throw new se(Ai,"DocumentType systemId is not a valid SystemLiteral");if(o.internalSubset&&o.internalSubset.indexOf("]>")!==-1)throw new se(Ai,'DocumentType internalSubset contains "]>"')}var W=o.publicId,$=o.systemId;if(t.push("<!DOCTYPE ",o.name),W)t.push(" PUBLIC ",W),$&&$!="."&&t.push(" ",$),t.push(">");else if($&&$!=".")t.push(" SYSTEM ",$,">");else{var Ae=o.internalSubset;Ae&&t.push(" [",Ae,"]"),t.push(">")}return null;case cd:if(a&&o.data.indexOf("?>")!==-1)throw new se(Ai,'The ProcessingInstruction data contains "?>"');return t.push("<?",o.target," ",o.data,"?>"),null;case Zg: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 BF(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===Ci||r;return s?o:null}}),n}function f0(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 kr),o.ownerDocument=e;var u=r;switch(o.nodeType){case xt:var c=i.attributes,d=o.attributes=new Bs,p=c.length;d._ownerElement=o;for(var m=0;m<p;m++)o.setAttributeNode(f0(e,c.item(m),!0));break;case Ci:u=!0}return a!==null?a.appendChild(o):n=o,u?o:null}}),n}function m0(e,t,r){e[t]=r}try{Object.defineProperty&&(Object.defineProperty(Si.prototype,"length",{get:function(){return pd(this),this.$$length}}),Object.defineProperty(ae.prototype,"textContent",{get:function(){if(this.nodeType===xt||this.nodeType===Lr){var e=[];return Ge(this,null,{enter:function(t){if(t.nodeType===xt||t.nodeType===Lr)return!0;if(t.nodeType===cd||t.nodeType===dd)return null;e.push(t.nodeValue)}}),e.join("")}return this.nodeValue},set:function(e){switch(this.nodeType){case xt:case Lr: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}}}),m0=function(e,t,r){e["$$"+t]=r})}catch{}Ur.DocumentType=Gs;Ur.DOMException=se;Ur.DOMImplementation=i0;Ur.Element=Un;Ur.Node=ae;Ur.NodeList=kr;Ur.walkDOM=Ge;Ur.XMLSerializer=d0});var g0=g(Za=>{"use strict";var h0=Ha().freeze;Za.XML_ENTITIES=h0({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});Za.HTML_ENTITIES=h0({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"});Za.entityMap=Za.HTML_ENTITIES});var N0=g(Sd=>{var no=Ha().NAMESPACE,Cd=/[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]/,v0=new RegExp("[\\-\\.0-9"+Cd.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),b0=new RegExp("^"+Cd.source+v0.source+"*(?::"+Cd.source+v0.source+"*)?$"),eo=0,un=1,Ni=2,to=3,Ei=4,Di=5,ro=6,Ws=7;function Ii(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,Ii)}Ii.prototype=new Error;Ii.prototype.name=Ii.name;function A0(){}A0.prototype={parse:function(e,t,r){var n=this.domBuilder;n.startDocument(),C0(t,t={}),$F(e,t,r,n,this.errorHandler),n.endDocument()}};function $F(e,t,r,n,i){function a(ce){if(ce>65535){ce-=65536;var mt=55296+(ce>>10),Qu=56320+(ce&1023);return String.fromCharCode(mt,Qu)}else return String.fromCharCode(ce)}function o(ce){var mt=ce.slice(1,-1);return Object.hasOwnProperty.call(r,mt)?r[mt]:mt.charAt(0)==="#"?a(parseInt(mt.substr(1).replace("x","0x"))):(i.error("entity not found:"+ce),ce)}function s(ce){if(ce>w){var mt=e.substring(w,ce).replace(/&#?\w+;/g,o);p&&l(w),n.characters(mt,0,ce-w),w=ce}}function l(ce,mt){for(;ce>=c&&(mt=d.exec(e));)u=mt.index,c=u+mt[0].length,p.lineNumber++;p.columnNumber=ce-u+1}for(var u=0,c=0,d=/.*(?:\r\n?|\n)|.*$/g,p=n.locator,m=[{currentNSMap:t}],h={},w=0;;){try{var y=e.indexOf("<",w);if(y<0){if(!e.substr(w).match(/^\s*$/)){var N=n.doc,D=N.createTextNode(e.substr(w));N.appendChild(D),n.currentElement=D}return}switch(y>w&&s(y),e.charAt(y+1)){case"/":var $=e.indexOf(">",y+3),x=e.substring(y+2,$).replace(/[ \t\n\r]+$/g,""),F=m.pop();$<0?(x=e.substring(y+2).replace(/[\s<].*/,""),i.error("end tag name: "+x+" is not complete:"+F.tagName),$=y+1+x.length):x.match(/\s</)&&(x=x.replace(/[\s<].*/,""),i.error("end tag name: "+x+" maybe not complete"),$=y+1+x.length);var q=F.localNSMap,G=F.tagName==x,M=G||F.tagName&&F.tagName.toLowerCase()==x.toLowerCase();if(M){if(n.endElement(F.uri,F.localName,x),q)for(var U in q)Object.prototype.hasOwnProperty.call(q,U)&&n.endPrefixMapping(U);G||i.fatalError("end tag name: "+x+" is not match the current start tagName:"+F.tagName)}else m.push(F);$++;break;case"?":p&&l(y),$=WF(e,y,n);break;case"!":p&&l(y),$=zF(e,y,n,i);break;default:p&&l(y);var B=new S0,W=m[m.length-1].currentNSMap,$=qF(e,y,B,W,o,i),Ae=B.length;if(!B.closed&&GF(e,$,B.tagName,h)&&(B.closed=!0,r.nbsp||i.warning("unclosed xml attribute")),p&&Ae){for(var he=y0(p,{}),$e=0;$e<Ae;$e++){var Je=B[$e];l(Je.offset),Je.locator=y0(p,{})}n.locator=he,w0(B,n,W)&&m.push(B),n.locator=p}else w0(B,n,W)&&m.push(B);no.isHTML(B.uri)&&!B.closed?$=VF(e,$,B.tagName,o,n):$++}}catch(ce){if(ce instanceof Ii)throw ce;i.error("element parse error: "+ce),$=-1}$>w?w=$:s(Math.max(y,w)+1)}}function y0(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function qF(e,t,r,n,i,a){function o(m,h,w){r.attributeNames.hasOwnProperty(m)&&a.fatalError("Attribute "+m+" redefined"),r.addValue(m,h.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,i),w)}for(var s,l,u=++t,c=eo;;){var d=e.charAt(u);switch(d){case"=":if(c===un)s=e.slice(t,u),c=to;else if(c===Ni)c=to;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(c===to||c===un)if(c===un&&(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=Di;else throw new Error("attribute value no end '"+d+"' match");else if(c==Ei)l=e.slice(t,u),o(s,l,t),a.warning('attribute "'+s+'" missed start quot('+d+")!!"),t=u+1,c=Di;else throw new Error('attribute value must after "="');break;case"/":switch(c){case eo:r.setTagName(e.slice(t,u));case Di:case ro:case Ws:c=Ws,r.closed=!0;case Ei:case un:break;case Ni:r.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return a.error("unexpected end of input"),c==eo&&r.setTagName(e.slice(t,u)),u;case">":switch(c){case eo:r.setTagName(e.slice(t,u));case Di:case ro:case Ws:break;case Ei:case un:l=e.slice(t,u),l.slice(-1)==="/"&&(r.closed=!0,l=l.slice(0,-1));case Ni:c===Ni&&(l=s),c==Ei?(a.warning('attribute "'+l+'" missed quot(")!'),o(s,l,t)):((!no.isHTML(n[""])||!l.match(/^(?:disabled|checked|selected)$/i))&&a.warning('attribute "'+l+'" missed value!! "'+l+'" instead!!'),o(l,l,t));break;case to:throw new Error("attribute value missed!!")}return u;case"\x80":d=" ";default:if(d<=" ")switch(c){case eo:r.setTagName(e.slice(t,u)),c=ro;break;case un:s=e.slice(t,u),c=Ni;break;case Ei:var l=e.slice(t,u);a.warning('attribute "'+l+'" missed quot(")!!'),o(s,l,t);case Di:c=ro;break}else switch(c){case Ni:var p=r.tagName;(!no.isHTML(n[""])||!s.match(/^(?:disabled|checked|selected)$/i))&&a.warning('attribute "'+s+'" missed value!! "'+s+'" instead2!!'),o(s,s,t),t=u,c=un;break;case Di:a.warning('attribute space is required"'+s+'"!!');case ro:c=un,t=u;break;case to:c=Ei,t=u;break;case Ws:throw new Error("elements closed character '/' and '>' must be connected to")}}u++}}function w0(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={},C0(r,r={})),r[c]=i[c]=s,a.uri=no.XMLNS,t.startPrefixMapping(c,s))}for(var d=e.length;d--;){a=e[d];var l=a.prefix;l&&(l==="xml"&&(a.uri=no.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 m=e.uri=r[l||""];if(t.startElement(m,u,n,e),e.closed){if(t.endElement(m,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 VF(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 GF(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 C0(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function zF(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=jF(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 WF(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 S0(){this.attributeNames={}}S0.prototype={setTagName:function(e){if(!b0.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,r){if(!b0.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 jF(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}Sd.XMLReader=A0;Sd.ParseError=Ii});var O0=g(Hs=>{var HF=Ha(),QF=Ad(),E0=g0(),_0=N0(),JF=QF.DOMImplementation,D0=HF.NAMESPACE,XF=_0.ParseError,KF=_0.XMLReader;function P0(e){return e.replace(/\r[\n\u0085]/g,`
+`),o=await e.postBatch(a,r),s=e.apiUrl("/$batch");(0,we.ensureSuccess)(o,s);let l=`app '${t[0].path}'`;if(typeof o.body!="string"||o.body.length===0)throw new me.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,VL.parseChangeSetStatuses)(o.body,i.map((d,p)=>String(p+1)));if(u===void 0)throw new me.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 me.ConnectionError(s,c,`atomic delete of ${l} was rolled back: the change set reported HTTP ${c}`);if(u.length!==i.length)throw new me.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=il(t,"sitemapid"),n=await e.get(r);return n.status<200||n.status>=300?null:nl(_i(n))}catch{return null}}function ek(e){return e>=400&&e<500&&e!==408&&e!==429}function Gd(e,t,r){if(!e)throw new me.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 xy(e,t,r){let n=`/appmodules(${t})`;if(!r.sitemapId){await tk(e,n,Gd(r.appEtag,t,"app"));return}if(!e.supportsAtomicBatch)throw new me.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 Fy(e,[{path:n,etag:Gd(r.appEtag,t,"app")},{path:`/sitemaps(${r.sitemapId})`,etag:Gd(r.sitemapEtag,t,"sitemap")}])}async function tk(e,t,r){(0,we.ensureSuccess)(await e.delete(t,{headers:{"If-Match":r}}),e.apiUrl(t))}async function Py(e,t){if(!/GenPageId/i.test(t))return;let r;try{r=[...new Set((0,$L.collectGenPageIds)(t))]}catch(o){throw new me.SdkError("SITEMAP_TARGET_UNVERIFIABLE",`Refusing to push the app: its sitemap xml could not be parsed, so the generative pages it navigates to cannot be verified (${jd(o)}).`)}if(r.length===0)return;let n=new Set,i=50;for(let o=0;o<r.length;o+=i){let s=r.slice(o,o+i),l="/uxagentprojects/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()"+(0,ae.odataQuery)([["$select","uxagentprojectid"],["$filter",s.map(c=>`uxagentprojectid eq ${c}`).join(" or ")]]),u=await(0,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,ae.normalizeGuid)(d,"uxagentprojectid"))}}let a=r.filter(o=>!n.has(o));if(a.length>0)throw new me.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 rk(e){var t,r;if(e.status!==400)return!1;let n=e.body;return String((r=(t=n?.error)===null||t===void 0?void 0:t.message)!==null&&r!==void 0?r:"").includes("retrieval of version numbers failed")}gn.appApi={async get(e,t){var r;let n=(0,ae.normalizeGuid)(t,"id"),i=qd($d,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 me.SdkError("APP_NOT_FOUND",`App '${n}' was not found (checked the unpublished-aware projection, which includes drafts).`);let s=await Oy(e,o.uniquename),l=s?(0,ae.normalizeGuid)(s,"sitemapId"):void 0,u=null;if(l){let d=il(l,"sitemapid,sitemapname,sitemapnameunique,sitemapxml"),p=(0,we.ensureSuccess)(await e.get(d),e.apiUrl(d)),m=_i(p);if(m&&m.sitemapnameunique!==o.uniquename)throw new me.SdkError("APP_SITEMAP_UNRESOLVED",`Refusing to fetch app '${n}': sitemap '${l}' now carries sitemapnameunique '${String(m.sitemapnameunique)}', not '${String(o.uniquename)}', so it is no longer this app's sitemap. Retry.`);o.$sitemap=m??{},u=nl(m)}let c=nl(o);return{raw:o,etag:u,...o.appmoduleid?{siblingEtags:{[(0,ae.normalizeGuid)(o.appmoduleid,"appmoduleid")]:c}}:{}}},async list(e,t){let r=qd($d);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 Py(e,n.sitemapxml);let i=n.iconWebResourceId?void 0:await WL(e),a=n.iconWebResourceId||i?.id;if(!a)throw new me.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||zL(n.appModuleId),l={name:n.appModuleName,uniquename:s,clienttype:4,formfactor:1,navigationtype:0};n.appModuleDescription&&(l.description=n.appModuleDescription),a&&(l.webresourceid=a);let u="/appmodules",c=(0,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,m=[];o&&m.push(o);let h={kind:"notRequested"},w=(0,zd.newId)(),b=!1;try{let D="/sitemaps",F=await e.post(D,{sitemapid:w,sitemapnameunique:s,sitemapname:n.sitemapname,sitemapxml:n.sitemapxml});b=ek(F.status);let x=(0,we.ensureSuccess)(F,e.apiUrl(D));p=(0,we.readEtag)(x),p||(p=await Vd(e,w));let q=await Dy(e,n);m.push(...q.warnings);let G=q.components;G.unshift({"@odata.type":"Microsoft.Dynamics.CRM.sitemap",sitemapid:w}),await Iy(e,d,G),await _y(e,d,q.tables);let M=await jL(e,d);M&&m.push(M),n.appSettings&&Object.keys(n.appSettings).length>0&&m.push(...await(0,qL.applyAppSettings)(e,d,n.appSettings)),n.published!==!1&&(await(0,Sy.publishAppModule)(e,d),h={kind:"submitted"})}catch(D){throw await KL(e,d,{sitemapId:w,serverRefusedSitemap:b,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:w},siblingEtags:{[d]:E},publish:h,...m.length>0?{warnings:m}:{}}},async update(e,t,r,n,i,a){var o,s,l,u,c,d,p;let m=r,h=(0,ae.normalizeGuid)(t,"id");if(await Py(e,m.sitemapxml),!m.sitemapId)throw new me.ValidationError("app",h,"/sitemapId","missing sitemap identity \u2014 re-fetch the app before pushing edits");let w=(0,ae.normalizeGuid)(m.sitemapId,"sitemapId");if(!n)throw new me.SdkError("APP_UPDATE_NO_ETAG",`Refusing to push app '${h}': no concurrency token is held for its sitemap row, so the write could not be made conditional and would silently overwrite a concurrent edit. Re-fetch the app and re-apply the change.`);let b=await Dy(e,m),E=`/appmodules(${h})`,D=(o=a?.[h])!==null&&o!==void 0?o:null,F=!0,x=!1;try{let ve=qd($d,h),Ve=await e.get(ve);if(Ve.status>=200&&Ve.status<300){let Ke=(s=_i(Ve))!==null&&s!==void 0?s:{};x=!0,F=String((l=Ke.name)!==null&&l!==void 0?l:"")!==String((u=m.appModuleName)!==null&&u!==void 0?u:"")||String((c=Ke.description)!==null&&c!==void 0?c:"")!==String((d=m.appModuleDescription)!==null&&d!==void 0?d:"")}}catch{}let q=D;if(F){let ve=x?D:null,Ve=ve?(0,we.echoWrite)("appmoduleid",{"If-Match":ve}):{query:"",options:void 0},Ke=await e.patch(`${E}${Ve.query}`,{name:m.appModuleName,description:m.appModuleDescription},Ve.options);if(rk(Ke))throw new me.SdkError("APP_DRAFT_HEADER_NOT_WRITABLE",`Refusing to update app '${h}': its appmodule row is UNPUBLISHED, and Dataverse cannot resolve version numbers for a draft appmodule (HTTP 400). A draft header cannot be PATCHed at all \u2014 a plain retry fails too, as an upsert-create ("webresourceid cannot be NULL"). Publish the app first, then push the header edit. Nothing was modified by this call.`);(0,we.ensureSuccess)(Ke,e.apiUrl(E)),q=(0,we.readEtag)(Ke)}let G={"If-Match":n},M=`/sitemaps(${w})`,U;try{U=(0,we.ensureSuccess)(await e.patch(M,{sitemapxml:m.sitemapxml,sitemapname:m.sitemapname},G?{headers:G}:void 0),e.apiUrl(M))}catch(ve){throw(0,me.withPartialTokens)(ve,{siblingEtags:{[h]:q}})}let B=[...b.warnings];try{await Iy(e,h,b.components),await _y(e,h,b.tables)}catch(ve){B.push(`App '${h}': one or more components were not pinned (${ve.message}). Navigation may reference content not included in the app; re-push to retry.`)}let W={kind:"notRequested"},$=q,Se=(0,we.readEtag)(U);if(m.published===!0){try{await(0,Sy.publishAppModule)(e,h),W={kind:"submitted"}}catch(ve){W={kind:"failed",error:ve},B.push(`App '${h}': saved, but publishing failed (${ve.message}). The app remains unpublished; re-push to retry.`)}if(W.kind==="submitted"){$=null;try{let ve=await e.get(`/appmodules(${h})?$select=appmoduleid`);ve.status>=200&&ve.status<300&&($=(0,we.readEtag)(ve)),Se=(p=await Vd(e,w))!==null&&p!==void 0?p:Se}catch{}}}return{id:h,etag:Se??await Vd(e,w),siblingEtags:{[h]:$},publish:W,...B.length>0?{warnings:B}:{}}},async delete(e,t){let r=(0,ae.normalizeGuid)(t,"id");await xy(e,r,await Ry(e,r))}}});var io=g(Pi=>{"use strict";function nk(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 Jd(e,t){return t===void 0&&(t=Object),t&&typeof t.freeze=="function"?t.freeze(e):e}function ik(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 Ly=Jd({HTML:"text/html",isHTML:function(e){return e===Ly.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),ky=Jd({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===ky.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});Pi.assign=ik;Pi.find=nk;Pi.freeze=Jd;Pi.MIME_TYPE=Ly;Pi.NAMESPACE=ky});var op=g(Gr=>{var zy=io(),hr=zy.find,ao=zy.NAMESPACE;function ak(e){return e!==""}function ok(e){return e?e.split(/[\t\n\f\r ]+/).filter(ak):[]}function sk(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function My(e){if(!e)return[];var t=ok(e);return Object.keys(t.reduce(sk,{}))}function lk(e){return function(t){return e&&e.indexOf(t)!==-1}}function so(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function Ct(e,t){var r=e.prototype;if(!(r instanceof t)){let i=function(){};var n=i;i.prototype=t.prototype,i=new i,so(r,i),e.prototype=r=i}r.constructor!=e&&(typeof e!="function"&&console.error("unknown Class:"+e),r.constructor=e)}var St={},Mt=St.ELEMENT_NODE=1,Oi=St.ATTRIBUTE_NODE=2,sl=St.TEXT_NODE=3,Wy=St.CDATA_SECTION_NODE=4,jy=St.ENTITY_REFERENCE_NODE=5,uk=St.ENTITY_NODE=6,Qd=St.PROCESSING_INSTRUCTION_NODE=7,Xd=St.COMMENT_NODE=8,Hy=St.DOCUMENT_NODE=9,Jy=St.DOCUMENT_TYPE_NODE=10,$r=St.DOCUMENT_FRAGMENT_NODE=11,ck=St.NOTATION_NODE=12,at={},je={},aj=at.INDEX_SIZE_ERR=(je[1]="Index size error",1),oj=at.DOMSTRING_SIZE_ERR=(je[2]="DOMString size error",2),At=at.HIERARCHY_REQUEST_ERR=(je[3]="Hierarchy request error",3),sj=at.WRONG_DOCUMENT_ERR=(je[4]="Wrong document",4),dk=at.INVALID_CHARACTER_ERR=(je[5]="Invalid character",5),lj=at.NO_DATA_ALLOWED_ERR=(je[6]="No data allowed",6),uj=at.NO_MODIFICATION_ALLOWED_ERR=(je[7]="No modification allowed",7),Qy=at.NOT_FOUND_ERR=(je[8]="Not found",8),cj=at.NOT_SUPPORTED_ERR=(je[9]="Not supported",9),Uy=at.INUSE_ATTRIBUTE_ERR=(je[10]="Attribute in use",10),Ti=at.INVALID_STATE_ERR=(je[11]="Invalid state",11),dj=at.SYNTAX_ERR=(je[12]="Syntax error",12),pj=at.INVALID_MODIFICATION_ERR=(je[13]="Invalid modification",13),fj=at.NAMESPACE_ERR=(je[14]="Invalid namespace",14),mj=at.INVALID_ACCESS_ERR=(je[15]="Invalid access",15);function ue(e,t){if(t instanceof Error)var r=t;else r=this,Error.call(this,je[e]),this.message=je[e],Error.captureStackTrace&&Error.captureStackTrace(this,ue);return r.code=e,t&&(this.message=this.message+": "+t),r}ue.prototype=Error.prototype;so(at,ue);function qr(){}qr.prototype={length:0,item:function(e){return e>=0&&e<this.length?this[e]:null},toString:function(e,t,r){for(var n=!!r&&!!r.requireWellFormed,i=[],a=0;a<this.length;a++)ap(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,Kd(this)}function Kd(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var r=e._refresh(e._node);if(sb(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];so(r,e),e._inc=t}}Ri.prototype.item=function(e){return Kd(this),this[e]||null};Ct(Ri,qr);function ll(){}function Xy(e,t){for(var r=e.length;r--;)if(e[r]===t)return r}function By(e,t,r,n){if(n?t[Xy(t,n)]=r:t[t.length++]=r,e){r.ownerElement=e;var i=e.ownerDocument;i&&(n&&Zy(i,e,n),pk(i,e,r))}}function $y(e,t,r){var n=Xy(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&&(Zy(a,e,r),r.ownerElement=null)}}else throw new ue(Qy,new Error(e.tagName+"@"+r))}ll.prototype={length:0,item:qr.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var r=this[t];if(r.nodeName==e)return r}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new ue(Uy);var r=this.getNamedItem(e.nodeName);return By(this._ownerElement,this,e,r),r},setNamedItemNS:function(e){var t=e.ownerElement,r;if(t&&t!=this._ownerElement)throw new ue(Uy);return r=this.getNamedItemNS(e.namespaceURI,e.localName),By(this._ownerElement,this,e,r),r},removeNamedItem:function(e){var t=this.getNamedItem(e);return $y(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var r=this.getNamedItemNS(e,t);return $y(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 Ky(){}Ky.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,r){var n=new lo;if(n.implementation=this,n.childNodes=new qr,n.doctype=r||null,r&&n.appendChild(r),t){var i=n.createElementNS(e,t);n.appendChild(i)}return n},createDocumentType:function(e,t,r){var n=new pl;return n.name=e,n.nodeName=e,n.publicId=t||"",n.systemId=r||"",n}};function oe(){}oe.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return cl(this,e,t)},replaceChild:function(e,t){cl(this,e,t,tb),t&&this.removeChild(t)},removeChild:function(e){return eb(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(e){return ob(this.ownerDocument||this,this,e)},normalize:function(){We(this,null,{enter:function(e){for(var t=e.firstChild;t;){var r=t.nextSibling;r!==null&&r.nodeType===sl&&t.nodeType===sl?(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 Yy(e){return e=="<"&&"&lt;"||e==">"&&"&gt;"||e=="&"&&"&amp;"||e=='"'&&"&quot;"||"&#"+e.charCodeAt()+";"}so(St,oe);so(St,oe.prototype);function ul(e,t){return We(e,null,{enter:function(r){return t(r)?We.STOP:!0}})===We.STOP}function We(e,t,r){for(var n=[{node:e,context:t,phase:We.ENTER}];n.length>0;){var i=n.pop();if(i.phase===We.ENTER){var a=r.enter(i.node,i.context);if(a===We.STOP)return We.STOP;if(n.push({node:i.node,context:a,phase:We.EXIT}),a==null)continue;for(var o=i.node.lastChild;o;)n.push({node:o,context:a,phase:We.ENTER}),o=o.previousSibling}else r.exit&&r.exit(i.node,i.context)}}We.STOP=Symbol("walkDOM.STOP");We.ENTER=0;We.EXIT=1;function lo(){this.ownerDocument=this}function pk(e,t,r){e&&e._inc++;var n=r.namespaceURI;n===ao.XMLNS&&(t._nsMap[r.prefix?r.localName:""]=r.value)}function Zy(e,t,r,n){e&&e._inc++;var i=r.namespaceURI;i===ao.XMLNS&&delete t._nsMap[r.prefix?r.localName:""]}function Yd(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 eb(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,Yd(e.ownerDocument,e),t}function fk(e){return e&&(e.nodeType===oe.DOCUMENT_NODE||e.nodeType===oe.DOCUMENT_FRAGMENT_NODE||e.nodeType===oe.ELEMENT_NODE)}function mk(e){return e&&(gr(e)||Zd(e)||Vr(e)||e.nodeType===oe.DOCUMENT_FRAGMENT_NODE||e.nodeType===oe.COMMENT_NODE||e.nodeType===oe.PROCESSING_INSTRUCTION_NODE)}function Vr(e){return e&&e.nodeType===oe.DOCUMENT_TYPE_NODE}function gr(e){return e&&e.nodeType===oe.ELEMENT_NODE}function Zd(e){return e&&e.nodeType===oe.TEXT_NODE}function qy(e,t){var r=e.childNodes||[];if(hr(r,gr)||Vr(t))return!1;var n=hr(r,Vr);return!(t&&n&&r.indexOf(n)>r.indexOf(t))}function Vy(e,t){var r=e.childNodes||[];function n(a){return gr(a)&&a!==t}if(hr(r,n))return!1;var i=hr(r,Vr);return!(t&&i&&r.indexOf(i)>r.indexOf(t))}function hk(e,t,r){if(!fk(e))throw new ue(At,"Unexpected parent node type "+e.nodeType);if(r&&r.parentNode!==e)throw new ue(Qy,"child not in parent");if(!mk(t)||Vr(t)&&e.nodeType!==oe.DOCUMENT_NODE)throw new ue(At,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function gk(e,t,r){var n=e.childNodes||[],i=t.childNodes||[];if(t.nodeType===oe.DOCUMENT_FRAGMENT_NODE){var a=i.filter(gr);if(a.length>1||hr(i,Zd))throw new ue(At,"More than one element or text in fragment");if(a.length===1&&!qy(e,r))throw new ue(At,"Element in fragment can not be inserted before doctype")}if(gr(t)&&!qy(e,r))throw new ue(At,"Only one element can be added and only after doctype");if(Vr(t)){if(hr(n,Vr))throw new ue(At,"Only one doctype is allowed");var o=hr(n,gr);if(r&&n.indexOf(o)<n.indexOf(r))throw new ue(At,"Doctype can only be inserted before an element");if(!r&&o)throw new ue(At,"Doctype can not be appended since element is present")}}function tb(e,t,r){var n=e.childNodes||[],i=t.childNodes||[];if(t.nodeType===oe.DOCUMENT_FRAGMENT_NODE){var a=i.filter(gr);if(a.length>1||hr(i,Zd))throw new ue(At,"More than one element or text in fragment");if(a.length===1&&!Vy(e,r))throw new ue(At,"Element in fragment can not be inserted before doctype")}if(gr(t)&&!Vy(e,r))throw new ue(At,"Only one element can be added and only after doctype");if(Vr(t)){let l=function(u){return Vr(u)&&u!==r};var s=l;if(hr(n,l))throw new ue(At,"Only one doctype is allowed");var o=hr(n,gr);if(r&&n.indexOf(o)<n.indexOf(r))throw new ue(At,"Doctype can only be inserted before an element")}}function cl(e,t,r,n){hk(e,t,r),e.nodeType===oe.DOCUMENT_NODE&&(n||gk)(e,t,r);var i=t.parentNode;if(i&&i.removeChild(t),t.nodeType===$r){var a=t.firstChild;if(a==null)return t;var o=t.lastChild}else a=o=t;var s=r?r.previousSibling:e.lastChild;a.previousSibling=s,o.nextSibling=r,s?s.nextSibling=a:e.firstChild=a,r==null?e.lastChild=o:r.previousSibling=o;do{a.parentNode=e;var l=e.ownerDocument||e;oo(a,l)}while(a!==o&&(a=a.nextSibling));return Yd(e.ownerDocument||e,e),t.nodeType==$r&&(t.firstChild=t.lastChild=null),t}function oo(e,t){if(e.ownerDocument!==t){if(e.ownerDocument=t,e.nodeType===Mt&&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;)oo(i,t),i=i.nextSibling}}function vk(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,Yd(e.ownerDocument,e,t);var r=e.ownerDocument||e;return oo(t,r),t}lo.prototype={nodeName:"#document",nodeType:Hy,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==$r){for(var r=e.firstChild;r;){var n=r.nextSibling;this.insertBefore(r,t),r=n}return e}return cl(this,e,t),oo(e,this),this.documentElement===null&&e.nodeType===Mt&&(this.documentElement=e),e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),eb(this,e)},replaceChild:function(e,t){cl(this,e,t,tb),oo(e,this),t&&this.removeChild(t),gr(e)&&(this.documentElement=e)},importNode:function(e,t){return yk(this,e,t)},getElementById:function(e){var t=null;return ul(this.documentElement,function(r){if(r.nodeType==Mt&&r.getAttribute("id")==e)return t=r,!0}),t},getElementsByClassName:function(e){var t=My(e);return new Ri(this,function(r){var n=[];return t.length>0&&ul(r.documentElement,function(i){if(i!==r&&i.nodeType===Mt){var a=i.getAttribute("class");if(a){var o=e===a;if(!o){var s=My(a);o=t.every(lk(s))}o&&n.push(i)}}}),n})},createElement:function(e){var t=new Wn;t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new qr;var r=t.attributes=new ll;return r._ownerElement=t,t},createDocumentFragment:function(){var e=new fl;return e.ownerDocument=this,e.childNodes=new qr,e},createTextNode:function(e){var t=new ep;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new tp;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){if(e.indexOf("]]>")!==-1)throw new ue(dk,'data contains "]]>"');var t=new rp;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var r=new ip;return r.ownerDocument=this,r.tagName=r.nodeName=r.target=e,r.nodeValue=r.data=t,r},createAttribute:function(e){var t=new dl;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new np;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var r=new Wn,n=t.split(":"),i=r.attributes=new ll;return r.childNodes=new qr,r.ownerDocument=this,r.nodeName=t,r.tagName=t,r.namespaceURI=e,n.length==2?(r.prefix=n[0],r.localName=n[1]):r.localName=t,i._ownerElement=r,r},createAttributeNS:function(e,t){var r=new dl,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}};Ct(lo,oe);function Wn(){this._nsMap={}}Wn.prototype={nodeType:Mt,hasAttribute:function(e){return this.getAttributeNode(e)!=null},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var r=this.ownerDocument.createAttribute(e);r.value=r.nodeValue=""+t,this.setAttributeNode(r)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===$r?this.insertBefore(e,null):vk(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 ul(t,function(n){n!==t&&n.nodeType==Mt&&(e==="*"||n.tagName==e)&&r.push(n)}),r})},getElementsByTagNameNS:function(e,t){return new Ri(this,function(r){var n=[];return ul(r,function(i){i!==r&&i.nodeType===Mt&&(e==="*"||i.namespaceURI===e)&&(t==="*"||i.localName==t)&&n.push(i)}),n})}};lo.prototype.getElementsByTagName=Wn.prototype.getElementsByTagName;lo.prototype.getElementsByTagNameNS=Wn.prototype.getElementsByTagNameNS;Ct(Wn,oe);function dl(){}dl.prototype.nodeType=Oi;Ct(dl,oe);function uo(){}uo.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(je[At])},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}};Ct(uo,oe);function ep(){}ep.prototype={nodeName:"#text",nodeType:sl,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}};Ct(ep,uo);function tp(){}tp.prototype={nodeName:"#comment",nodeType:Xd};Ct(tp,uo);function rp(){}rp.prototype={nodeName:"#cdata-section",nodeType:Wy};Ct(rp,uo);function pl(){}pl.prototype.nodeType=Jy;Ct(pl,oe);function rb(){}rb.prototype.nodeType=ck;Ct(rb,oe);function nb(){}nb.prototype.nodeType=uk;Ct(nb,oe);function np(){}np.prototype.nodeType=jy;Ct(np,oe);function fl(){}fl.prototype.nodeName="#document-fragment";fl.prototype.nodeType=$r;Ct(fl,oe);function ip(){}ip.prototype.nodeType=Qd;Ct(ip,oe);function ib(){}ib.prototype.serializeToString=function(e,t,r,n){return ab.call(e,t,r,n)};oe.prototype.toString=ab;function ab(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 ap(this,i,e,t,l,n),i.join("")}function Gy(e,t,r){var n=e.prefix||"",i=e.namespaceURI;if(!i||n==="xml"&&i===ao.XML||i===ao.XMLNS)return!1;for(var a=r.length;a--;){var o=r[a];if(o.prefix===n)return o.namespace!==i}return!0}function ol(e,t,r){e.push(" ",t,'="',r.replace(/[<>&"\t\n\r]/g,Yy),'"')}function ap(e,t,r,n,i,a){i||(i=[]),We(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 Mt:var c=o.attributes,d=c.length,p=o.tagName;u=ao.isHTML(o.namespaceURI)||u;var m=p;if(!u&&!o.prefix&&o.namespaceURI){for(var h,w=0;w<c.length;w++)if(c.item(w).name==="xmlns"){h=c.item(w).value;break}if(!h)for(var b=l.length-1;b>=0;b--){var E=l[b];if(E.prefix===""&&E.namespace===o.namespaceURI){h=E.namespace;break}}if(h!==o.namespaceURI)for(var b=l.length-1;b>=0;b--){var E=l[b];if(E.namespace===o.namespaceURI){E.prefix&&(m=E.prefix+":"+p);break}}}t.push("<",m);for(var D=l.slice(),F=0;F<d;F++){var x=c.item(F);x.prefix=="xmlns"?D.push({prefix:x.localName,namespace:x.value}):x.nodeName=="xmlns"&&D.push({prefix:"",namespace:x.value})}for(var F=0;F<d;F++){var x=c.item(F);if(Gy(x,u,D)){var q=x.prefix||"",G=x.namespaceURI;ol(t,q?"xmlns:"+q:"xmlns",G),D.push({prefix:q,namespace:G})}var M=n?n(x):x;M&&(typeof M=="string"?t.push(M):ol(t,M.name,M.value))}if(p===m&&Gy(o,u,D)){var U=o.prefix||"",G=o.namespaceURI;ol(t,U?"xmlns:"+U:"xmlns",G),D.push({prefix:U,namespace:G})}var B=o.firstChild;if(B||u&&!/^(?:meta|link|img|br|hr|input)$/i.test(p)){if(t.push(">"),u&&/^script$/i.test(p)){for(;B;)B.data?t.push(B.data):ap(B,t,u,n,D.slice(),a),B=B.nextSibling;return t.push("</",p,">"),null}return{ns:D,isHTML:u,tag:m}}else return t.push("/>"),null;case Hy:case $r:return{ns:l.slice(),isHTML:u,tag:null};case Oi:return ol(t,o.name,o.value),null;case sl:return t.push(o.data.replace(/[<&>]/g,Yy)),null;case Wy:if(a&&o.data.indexOf("]]>")!==-1)throw new ue(Ti,'The CDATASection data contains "]]>"');return t.push("<![CDATA[",o.data.replace(/]]>/g,"]]]]><![CDATA[>"),"]]>"),null;case Xd:if(a&&o.data.indexOf("-->")!==-1)throw new ue(Ti,'The comment node data contains "-->"');return t.push("<!--",o.data,"-->"),null;case Jy:if(a){if(o.publicId&&!/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(o.publicId))throw new ue(Ti,"DocumentType publicId is not a valid PubidLiteral");if(o.systemId&&!/^("[^"]*"|'[^']*')$/.test(o.systemId))throw new ue(Ti,"DocumentType systemId is not a valid SystemLiteral");if(o.internalSubset&&o.internalSubset.indexOf("]>")!==-1)throw new ue(Ti,'DocumentType internalSubset contains "]>"')}var W=o.publicId,$=o.systemId;if(t.push("<!DOCTYPE ",o.name),W)t.push(" PUBLIC ",W),$&&$!="."&&t.push(" ",$),t.push(">");else if($&&$!=".")t.push(" SYSTEM ",$,">");else{var Se=o.internalSubset;Se&&t.push(" [",Se,"]"),t.push(">")}return null;case Qd:if(a&&o.data.indexOf("?>")!==-1)throw new ue(Ti,'The ProcessingInstruction data contains "?>"');return t.push("<?",o.target," ",o.data,"?>"),null;case jy: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 yk(e,t,r){var n;return We(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 ob(e,t,r){var n;return We(t,null,{enter:function(i,a){var o=new i.constructor;for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)){var l=i[s];typeof l!="object"&&l!=o[s]&&(o[s]=l)}i.childNodes&&(o.childNodes=new qr),o.ownerDocument=e;var u=r;switch(o.nodeType){case Mt:var c=i.attributes,d=o.attributes=new ll,p=c.length;d._ownerElement=o;for(var m=0;m<p;m++)o.setAttributeNode(ob(e,c.item(m),!0));break;case Oi:u=!0}return a!==null?a.appendChild(o):n=o,u?o:null}}),n}function sb(e,t,r){e[t]=r}try{Object.defineProperty&&(Object.defineProperty(Ri.prototype,"length",{get:function(){return Kd(this),this.$$length}}),Object.defineProperty(oe.prototype,"textContent",{get:function(){if(this.nodeType===Mt||this.nodeType===$r){var e=[];return We(this,null,{enter:function(t){if(t.nodeType===Mt||t.nodeType===$r)return!0;if(t.nodeType===Qd||t.nodeType===Xd)return null;e.push(t.nodeValue)}}),e.join("")}return this.nodeValue},set:function(e){switch(this.nodeType){case Mt:case $r:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),sb=function(e,t,r){e["$$"+t]=r})}catch{}Gr.DocumentType=pl;Gr.DOMException=ue;Gr.DOMImplementation=Ky;Gr.Element=Wn;Gr.Node=oe;Gr.NodeList=qr;Gr.walkDOM=We;Gr.XMLSerializer=ib});var ub=g(co=>{"use strict";var lb=io().freeze;co.XML_ENTITIES=lb({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});co.HTML_ENTITIES=lb({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"});co.entityMap=co.HTML_ENTITIES});var vb=g(lp=>{var ho=io().NAMESPACE,sp=/[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]/,cb=new RegExp("[\\-\\.0-9"+sp.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),db=new RegExp("^"+sp.source+cb.source+"*(?::"+sp.source+cb.source+"*)?$"),po=0,vn=1,Fi=2,fo=3,xi=4,Li=5,mo=6,ml=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 mb(){}mb.prototype={parse:function(e,t,r){var n=this.domBuilder;n.startDocument(),hb(t,t={}),bk(e,t,r,n,this.errorHandler),n.endDocument()}};function bk(e,t,r,n,i){function a(de){if(de>65535){de-=65536;var gt=55296+(de>>10),oc=56320+(de&1023);return String.fromCharCode(gt,oc)}else return String.fromCharCode(de)}function o(de){var gt=de.slice(1,-1);return Object.hasOwnProperty.call(r,gt)?r[gt]:gt.charAt(0)==="#"?a(parseInt(gt.substr(1).replace("x","0x"))):(i.error("entity not found:"+de),de)}function s(de){if(de>w){var gt=e.substring(w,de).replace(/&#?\w+;/g,o);p&&l(w),n.characters(gt,0,de-w),w=de}}function l(de,gt){for(;de>=c&&(gt=d.exec(e));)u=gt.index,c=u+gt[0].length,p.lineNumber++;p.columnNumber=de-u+1}for(var u=0,c=0,d=/.*(?:\r\n?|\n)|.*$/g,p=n.locator,m=[{currentNSMap:t}],h={},w=0;;){try{var b=e.indexOf("<",w);if(b<0){if(!e.substr(w).match(/^\s*$/)){var E=n.doc,D=E.createTextNode(e.substr(w));E.appendChild(D),n.currentElement=D}return}switch(b>w&&s(b),e.charAt(b+1)){case"/":var $=e.indexOf(">",b+3),F=e.substring(b+2,$).replace(/[ \t\n\r]+$/g,""),x=m.pop();$<0?(F=e.substring(b+2).replace(/[\s<].*/,""),i.error("end tag name: "+F+" is not complete:"+x.tagName),$=b+1+F.length):F.match(/\s</)&&(F=F.replace(/[\s<].*/,""),i.error("end tag name: "+F+" maybe not complete"),$=b+1+F.length);var q=x.localNSMap,G=x.tagName==F,M=G||x.tagName&&x.tagName.toLowerCase()==F.toLowerCase();if(M){if(n.endElement(x.uri,x.localName,F),q)for(var U in q)Object.prototype.hasOwnProperty.call(q,U)&&n.endPrefixMapping(U);G||i.fatalError("end tag name: "+F+" is not match the current start tagName:"+x.tagName)}else m.push(x);$++;break;case"?":p&&l(b),$=Ek(e,b,n);break;case"!":p&&l(b),$=Sk(e,b,n,i);break;default:p&&l(b);var B=new gb,W=m[m.length-1].currentNSMap,$=wk(e,b,B,W,o,i),Se=B.length;if(!B.closed&&Ck(e,$,B.tagName,h)&&(B.closed=!0,r.nbsp||i.warning("unclosed xml attribute")),p&&Se){for(var ve=pb(p,{}),Ve=0;Ve<Se;Ve++){var Ke=B[Ve];l(Ke.offset),Ke.locator=pb(p,{})}n.locator=ve,fb(B,n,W)&&m.push(B),n.locator=p}else fb(B,n,W)&&m.push(B);ho.isHTML(B.uri)&&!B.closed?$=Ak(e,$,B.tagName,o,n):$++}}catch(de){if(de instanceof ki)throw de;i.error("element parse error: "+de),$=-1}$>w?w=$:s(Math.max(b,w)+1)}}function pb(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function wk(e,t,r,n,i,a){function o(m,h,w){r.attributeNames.hasOwnProperty(m)&&a.fatalError("Attribute "+m+" redefined"),r.addValue(m,h.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,i),w)}for(var s,l,u=++t,c=po;;){var d=e.charAt(u);switch(d){case"=":if(c===vn)s=e.slice(t,u),c=fo;else if(c===Fi)c=fo;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(c===fo||c===vn)if(c===vn&&(a.warning('attribute value must after "="'),s=e.slice(t,u)),t=u+1,u=e.indexOf(d,t),u>0)l=e.slice(t,u),o(s,l,t-1),c=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 po:r.setTagName(e.slice(t,u));case Li:case mo:case ml:c=ml,r.closed=!0;case xi:case vn: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==po&&r.setTagName(e.slice(t,u)),u;case">":switch(c){case po:r.setTagName(e.slice(t,u));case Li:case mo:case ml:break;case xi:case vn: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)):((!ho.isHTML(n[""])||!l.match(/^(?:disabled|checked|selected)$/i))&&a.warning('attribute "'+l+'" missed value!! "'+l+'" instead!!'),o(l,l,t));break;case fo:throw new Error("attribute value missed!!")}return u;case"\x80":d=" ";default:if(d<=" ")switch(c){case po:r.setTagName(e.slice(t,u)),c=mo;break;case vn: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=mo;break}else switch(c){case Fi:var p=r.tagName;(!ho.isHTML(n[""])||!s.match(/^(?:disabled|checked|selected)$/i))&&a.warning('attribute "'+s+'" missed value!! "'+s+'" instead2!!'),o(s,s,t),t=u,c=vn;break;case Li:a.warning('attribute space is required"'+s+'"!!');case mo:c=vn,t=u;break;case fo:c=xi,t=u;break;case ml:throw new Error("elements closed character '/' and '>' must be connected to")}}u++}}function fb(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={},hb(r,r={})),r[c]=i[c]=s,a.uri=ho.XMLNS,t.startPrefixMapping(c,s))}for(var d=e.length;d--;){a=e[d];var l=a.prefix;l&&(l==="xml"&&(a.uri=ho.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 m=e.uri=r[l||""];if(t.startElement(m,u,n,e),e.closed){if(t.endElement(m,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 Ak(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 Ck(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 hb(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function Sk(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=Nk(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 Ek(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 gb(){this.attributeNames={}}gb.prototype={setTagName:function(e){if(!db.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,r){if(!db.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 Nk(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}lp.XMLReader=mb;lp.ParseError=ki});var Eb=g(gl=>{var Dk=io(),Ik=op(),yb=ub(),Ab=vb(),_k=Ik.DOMImplementation,bb=Dk.NAMESPACE,Pk=Ab.ParseError,Tk=Ab.XMLReader;function Cb(e){return e.replace(/\r[\n\u0085]/g,`
`).replace(/[\r\u0085\u2028]/g,`
-`)}function T0(e){this.options=e||{locator:{}}}T0.prototype.parseFromString=function(e,t){var r=this.options,n=new KF,i=r.domBuilder||new io,a=r.errorHandler,o=r.locator,s=r.xmlns||{},l=/\/x?html?$/.test(t),u=l?E0.HTML_ENTITIES:E0.XML_ENTITIES;o&&i.setDocumentLocator(o),n.errorHandler=YF(a,i,o),n.domBuilder=r.domBuilder||i,l&&(s[""]=D0.HTML),s.xml=s.xml||D0.XML;var c=r.normalizeLineEndings||P0;return e&&typeof e=="string"?n.parse(c(e),s,u):n.errorHandler.error("invalid doc source"),i.doc};function YF(e,t,r){if(!e){if(t instanceof io)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+Nd(r))}||function(){}}return a("warning"),a("error"),a("fatalError"),n}function io(){this.cdata=!1}function _i(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}io.prototype={startDocument:function(){this.doc=new JF().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;js(this,a),this.currentElement=a,this.locator&&_i(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&&_i(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&&_i(this.locator,r),js(this,r)},ignorableWhitespace:function(e,t,r){},characters:function(e,t,r){if(e=I0.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&&_i(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=I0.apply(this,arguments);var n=this.doc.createComment(e);this.locator&&_i(this.locator,n),js(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&&_i(this.locator,i),js(this,i),this.doc.doctype=i}},warning:function(e){console.warn("[xmldom warning] "+e,Nd(this.locator))},error:function(e){console.error("[xmldom error] "+e,Nd(this.locator))},fatalError:function(e){throw new XF(e,this.locator)}};function Nd(e){if(e)return`
-@`+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function I0(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){io.prototype[e]=function(){return null}});function js(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}Hs.__DOMHandler=io;Hs.normalizeLineEndings=P0;Hs.DOMParser=T0});var Js=g(Qs=>{var R0=Ad();Qs.DOMImplementation=R0.DOMImplementation;Qs.XMLSerializer=R0.XMLSerializer;Qs.DOMParser=O0().DOMParser});var ld=g(Pi=>{"use strict";Object.defineProperty(Pi,"__esModule",{value:!0});Pi.deleteAppCascade=Pi.collectGenPageIds=void 0;var ZF=ks(),eL=ne(),Ed=Z(),tL=Js();function x0(e){let t=[],r=s=>l=>t.push(`${s}: ${l}`),i=new tL.DOMParser({errorHandler:{warning:r("warning"),error:r("error"),fatalError:r("fatalError")}}).parseFromString(e,"text/xml").documentElement;if(!i||t.length>0)throw new eL.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,Ed.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}Pi.collectGenPageIds=x0;async function rL(e,t,r){let n=(0,Ed.normalizeGuid)(t,"appModuleId");(0,Ed.normalizeGuid)(r,"appModuleIdUnique");let i=[],a=[],o=[];await(0,ZF.deleteAppResolvingOnce)(e,n,l=>{l!==void 0&&o.push(...x0(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}}Pi.deleteAppCascade=rL});var F0={};ar(F0,{Guid:()=>P});var P,Le=I(()=>{"use strict";P=class e{guidString;guid;static get EmptyGuid(){return new e("00000000-0000-0000-0000-000000000000")}static NewGuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var r=Math.random()*16|0,n=t=="x"?r:r&3|8;return n.toString(16)})}constructor(t,r=!1){this.guidString=t;let n=new RegExp("[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$");(r||n.test(t))&&(this.guid=t)}ToString(){return this.guid}}});var T,nt=I(()=>{"use strict";Re();T=class e{static get EmptyString(){return""}static IsTrue(t){let r=!1;return r=t&&(this.IsStrictTrue(t)||this.IsYes(t)),r}static IsStrictTrue(t){let r=!1;return t&&(r=t.toLowerCase()==="true"),r}static IsYes(t){return t.toLowerCase()==="yes"||t.toLowerCase()==="y"}static get WhiteSpace(){return/ /g}static get EnglishAndNumericCharacters(){return/([a-z0-9A-Z]+)/g}static get ValidIdExpression(){return/([a-z0-9A-Z_]+)/g}static IsNullOrEmpty(t){return t==null||t==null||t==""}static Format(t,r){return e.IsNullOrEmpty(t)?t:t.replace(/\{\{|\}\}|\{(\d+)\}/g,function(n,i){return n=="{{"?"{":n=="}}"?"}":r[i]})}static EndsWithString(t,r){return t.indexOf(r,t.length-r.length)!==-1}static IsBlankString(t){return t.replace(/\s/g,"").length==0}static EscapeXml(t,r){let n=t;return this.IsNullOrEmpty(n)||(n=n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),r&&(n=n.replace(/"/g,"&quot;").replace(/'/g,"&apos;"))),n}static EscapeDomId(t){return t.replace(".","\\.")}static ToSnakeCase(t){let r=e.EmptyString;for(let n=0;n<t.length;n++)n!==0&&t[n]==t[n].toUpperCase()&&(r+="-"),r+=t[n].toLowerCase();return r}static GetSnakeCaseMarkup(t,r){let n="<"+this.ToSnakeCase(t);if(!E.IsNullOrUndefined(r))for(let i of r.getKeys())n+=" "+this.ToSnakeCase(i)+'="'+r.getValue(i)+'"';return n+">"}static StripBraces(t){return t&&t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?t.substr(1,t.length-2):t}static AddBraces(t){return E.IsNullOrUndefined(t)||t.charAt(0)==="{"||t.charAt(t.length-1)==="}"?t:`{${t}}`}static GuidStringEquals(t,r){return t===r?!0:!t||!r?!1:e.StripBraces(t).toUpperCase()===e.StripBraces(r).toUpperCase()}static AddBracesToArrayValues(t){return t.length>0?t.map(n=>(n.charAt(0)!=="{"&&(n="{"+n),n.charAt(n.length-1)!=="}"&&(n=n+"}"),n)):t}static StripBracesOnArrayValues(t){return t.length>0?t.map(n=>{let i;return n.charAt(0)==="{"&&(i=n.substr(1,n.length-1)),n.charAt(n.length-1)==="}"&&(i=i.substr(0,n.length-2)),i}):t}}});var L0={};ar(L0,{ScriptUtilities:()=>E});var E,Re=I(()=>{"use strict";Le();nt();E=class e{static IsNullOrUndefined(t){return t==null||t===void 0}static IsMacMachine(){return navigator.platform.indexOf("Mac")!==-1}static IsNullOrEmptyGuid(t){return T.IsNullOrEmpty(t.ToString())?!0:P.EmptyGuid.ToString()===t.ToString()}static IsNullOrUndefinedNested(t,r){return r.split(".").every(i=>typeof t!="object"||t==null||!(i in t)||t[i]==null?!1:(t=t[i],!0))}static ParseXml(t){return new DOMParser().parseFromString(t,"text/xml")}static IsWellFormedXml(t){return!e.ParseXml(t).querySelector("parsererror")}static getNamedItemValue(t,r){let n=t.getNamedItem(r);return e.IsNullOrUndefined(n)?null:n.value}static getBooleanValue(t,r){let n=e.getNamedItemValue(t,r);return e.IsNullOrUndefined(n)?null:T.IsTrue(n)}static getNumericValue(t){return e.IsNullOrUndefined(t)?null:parseInt(t)}static getAllUniqueTagNames(t){let r=new Set;return e.getAllUniqueTagNamesHelper(t,r),r}static getAllUniqueTagNamesHelper(t,r){if(t.nodeType===Node.ELEMENT_NODE&&(r.add(t.tagName),t.hasChildNodes()))for(let n=0;n<t.children.length;n++)this.getAllUniqueTagNamesHelper(t.children.item(n),r)}}});var Xs,Ks,Bn,Ys,Dd,Zs,Id=I(()=>{"use strict";(function(e){e[e.FormElementNodeChange=0]="FormElementNodeChange",e[e.FormElementAttributeChange=1]="FormElementAttributeChange"})(Xs||(Xs={}));Ks=class{type;targetNode;constructor(t,r){this.type=t,this.targetNode=r}},Bn=class extends Ks{key;oldValue;newValue;constructor(t,r,n,i){super(Xs.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)}},Ys=class extends Ks{property;oldValue;newValue;constructor(t,r,n,i){super(Xs.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)}},Dd=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()})}},Zs=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 Dd(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 k0={};ar(k0,{ChartGridMode:()=>Ft,ColumnLayoutWidths:()=>sL,ComponentCategory:()=>tl,ComponentType:()=>_d,ControlLayoutTypes:()=>Ld,DisplayConditionsInfo:()=>aL,ElementNames:()=>v,ElementProperties:()=>f,ElementType:()=>Td,EntityAttributeProperty:()=>Od,EventType:()=>ao,FormActivationState:()=>Fd,FormCanvasServiceScope:()=>yL,FormDesignerSideBarTab:()=>Pd,FormPresentation:()=>Rd,FormState:()=>el,FormType:()=>ke,HeaderDensityType:()=>cn,LookUpTable:()=>fr,MORE_TAB_PREFIX:()=>uL,NavBarChildElementType:()=>xd,PREVIEW_ID_HEADER_FLYOUT:()=>fL,PREVIEW_ID_HEADER_OVERFLOW_BUTTON:()=>hL,PREVIEW_ID_NAVIGATION_AREA:()=>dL,PREVIEW_ID_QUICKCREATE_ROOT:()=>vL,PREVIEW_ID_TAB:()=>gL,PREVIEW_ID_TAB_LIST:()=>mL,PREVIEW_ID_TAB_PANEL:()=>pL,PropertyModelKeys:()=>Ud,PropertyModelSectionKeys:()=>lL,RELATED_TAB_ID:()=>Bd,RELATED_TAB_PREFIX:()=>cL,SectionDefaultProperties:()=>oL,SectionLayoutTypes:()=>we,TabContentType:()=>kd,TabDefaultProperties:()=>dn,TabLayoutTypes:()=>ye,TelemetryPropertyNames:()=>bL,UnboundControlPropertyKeys:()=>Md,compositeAddressFields:()=>iL,compositeFieldNames:()=>Pt,compositeFields:()=>nL});var ke,_d,Pd,v,f,Td,Pt,nL,iL,Od,fr,el,cn,Rd,aL,xd,Fd,ye,oL,dn,we,Ld,kd,sL,Md,Ud,lL,ao,Ft,Bd,uL,cL,dL,pL,fL,mL,hL,gL,vL,bL,tl,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"})(ke||(ke={}));(function(e){e[e.Form=0]="Form",e[e.Dialog=1]="Dialog"})(_d||(_d={}));(function(e){e[e.Components=0]="Components",e[e.Properties=1]="Properties",e[e.Relationship=2]="Relationship",e[e.BusinessRules=3]="BusinessRules"})(Pd||(Pd={}));(function(e){e.form="form",e.formTab="tab",e.formColumn="column",e.formSection="section",e.formRow="row",e.formCell="cell",e.formLabel="label",e.formControl="control",e.formEvent="event",e.dependency="dependency",e.queryStringParameter="querystringparameter",e.controlDescriptions="controlDescriptions",e.controlDescription="controlDescription",e.customControl="customControl",e.dataset="data-set",e.formFooter="footer",e.formHeader="header",e.formNavigation="Navigation",e.formTabs="tabs",e.formColumns="columns",e.formSections="sections",e.formRows="rows",e.formEvents="events",e.quickFormDependencies="externaldependencies",e.controlParameters="parameters",e.formDependencies="dependencies",e.formNavBarAreas="NavBarAreas",e.formNavBarArea="NavBarArea",e.formNavBar="NavBar",e.spacerControl="SpacerControl",e.formField="Field",e.formNavBarByRelationshipItem="NavBarByRelationshipItem",e.formNavBarItem="NavBarItem",e.Title="Title",e.Titles="Titles",e.NavigationLink="Navigation Link",e.Relationship="Relationship",e.NavigationLinkIconClass="mscrm-glyph-NavLinkIcon",e.formDisplayConditions="DisplayConditions",e.formLibraries="formLibraries",e.internalLibraries="internaljscriptfile",e.eventHandlers="Handlers",e.handler="Handler",e.library="Library",e.formRoles="Role",e.formEveryOne="Everyone",e.Handler="Handler",e.EventHandlers="Handlers",e.InternalEventHandlers="InternalHandlers",e.HiddenControl="hiddencontrols",e.EventDependencies="dependencies",e.EventDependency="dependency",e.isvisibleinmocaonly="msinternal.isvisibleinmocaonly"})(v||(v={}));f={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"})(Td||(Td={}));Pt={fullname:"fullname",yomifullname:"yomifullname",address1_composite:"address1_composite",address2_composite:"address2_composite",address3_composite:"address3_composite",billto:"billto_composite",shipto:"shipto_composite"},nL=[Pt.fullname,Pt.yomifullname,Pt.address1_composite,Pt.address2_composite,Pt.address3_composite,Pt.billto,Pt.shipto],iL=[Pt.address1_composite,Pt.address2_composite,Pt.address3_composite,Pt.billto,Pt.shipto];(function(e){e[e.IsValidForForm=0]="IsValidForForm",e[e.IsValidForCreate=1]="IsValidForCreate"})(Od||(Od={}));(function(e){e[e.DependencyFieldTable=0]="DependencyFieldTable",e[e.LockedFieldTable=1]="LockedFieldTable"})(fr||(fr={}));(function(e){e[e.Published=0]="Published",e[e.Draft=1]="Draft",e[e.New=2]="New",e[e.SaveAs=3]="SaveAs"})(el||(el={}));(function(e){e.Low="Low",e.HighReadOnlyValues="HighReadOnlyValues",e.HighWithControls="HighWithControls"})(cn||(cn={}));(function(e){e[e.ClassicForm=0]="ClassicForm",e[e.AirForm=1]="AirForm",e[e.ConvertedICForm=2]="ConvertedICForm"})(Rd||(Rd={}));aL={TopOrderFormId:"topOrderFormId",NextDisplayOrder:"nextDisplayOrder"};(function(e){e[e.NavBarRelationShipItem=0]="NavBarRelationShipItem",e[e.NavBarItem=1]="NavBarItem"})(xd||(xd={}));(function(e){e[e.InActive=0]="InActive",e[e.Active=1]="Active"})(Fd||(Fd={}));(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"})(ye||(ye={}));oL={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"})(we||(we={}));(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"})(Ld||(Ld={}));(function(e){e.cardSections="cardSections",e.singleComponent="singleComponent",e.default="default",e.expandAvailableSpace="expandAvailableSpace"})(kd||(kd={}));sL={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"})(Md||(Md={}));(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"})(Ud||(Ud={}));lL={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"})(ao||(ao={}));(function(e){e.All="All",e.Chart="Chart",e.Grid="Grid"})(Ft||(Ft={}));Bd="tab_related3b554255-7717-4d17-bb7f-9936fb1e75ca",uL="more_tab_",cL="related_tab_",dL="preview_id_navigation_area",pL="tab-section",fL="headerFieldsFlyout",mL="tablist",hL="header_overflowButton",gL="tab",vL="quickCreateRoot",bL={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"})(tl||(tl={}));yL="CellCanvasServiceScope"});var M0={};ar(M0,{Attribute:()=>rl,FormElementNode:()=>j});var rl,j,We=I(()=>{"use strict";Re();nt();Id();X();Le();rl=class{key;value;constructor(t,r){this.key=t,this.value=r}},j=class e{nodeName;properties;childrenNodes;parentNode;nodeId;isTransient;constructor(t,r){this.nodeName=t,this.properties=[],this.childrenNodes=[],this.parentNode=r,this.isTransient=!1,this.nodeId=`nodeId-${P.NewGuid()}`}getProperty(t){for(let r of this.properties)if(r.key===t)return r.value;return null}getNodeId(){return this.nodeId}getNodeName(){return this.nodeName}setNodeName(t){this.trackObjectPropertyChange("nodeName",t)}get NodeName(){return this.getNodeName()}getAllProperties(){return this.properties}replaceAttributeValue(t,r){this.properties.find(n=>n===t)&&(t.value=r)}replaceObjectPropertyValue(t,r){this[t]=r}getAllChildren(){return this.childrenNodes}getParentNode(){return this.parentNode}visit(t){let r=!1;if(t){r=!!t(this);let n=this.childrenNodes;if(!r&&n)for(let i=0;!r&&i<n.length;i++)r=n[i].visit(t)}return r}findAll(t){let r=[];return t&&this.visit(n=>{t(n)&&r.push(n)}),r}findFirst(t){let r=null;return t&&this.visit(n=>{if(t(n))return r=n,!0}),r}raiseMetadataChange(t){let r=this.getAncestor(v.form);r&&r.raiseMetadataChange(t)}trackPropertyAddition(t,r){this.trackPropertyCollectionChange(()=>{this.properties.push(new rl(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 Bn(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 Bn(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 Bn(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 Ys(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 Bn(this,t,i,r))}else this[t]=r}setProperty(t,r){if(!t)throw new Error("Invalid property key");let n=this.properties.find(i=>i.key===t);n?this.trackAttributeValueChange(n,r):this.addProperty(t,r)}addProperty(t,r){if(!t)throw new Error("Invalid property key");this.trackPropertyAddition(t,r)}removeProperty(t){this.trackPropertyDeletion(t)}addChild(t){t.trackParentNodeChange(()=>{t.parentNode=this}),this.trackChildrenCollectionChange(()=>{this.childrenNodes.push(t)})}insertChildAtIndex(t,r){E.IsNullOrUndefined(t)||(t.trackParentNodeChange(()=>{t.parentNode=this}),this.trackChildrenCollectionChange(()=>{this.childrenNodes.splice(r,0,t)}))}moveChild(t,r){let n=this.childrenNodes.indexOf(t);if(n<0)return!1;let i=Math.min(Math.max(0,n+r),this.childrenNodes.length-1);return n!==i&&this.trackChildrenCollectionChange(()=>{this.childrenNodes.splice(i,0,this.childrenNodes.splice(n,1)[0])}),!0}getChildren(t){let r=[];for(let n of this.childrenNodes)n.nodeName===t&&r.push(n);return r}getFirstChild(t){for(let r of this.childrenNodes)if(r.nodeName===t)return r;return null}getAllGrandChildren(t){let r=this.getChildren(t),n=null;return r.length===0?new Array:(n=r[0],n.childrenNodes)}deleteChild(t){if(E.IsNullOrUndefined(t))return-1;for(let r=0;r<this.childrenNodes.length;r++)if(this.childrenNodes[r]===t)return this.trackChildrenCollectionChange(()=>{this.childrenNodes.splice(r,1)}),r;return-1}deleteAllChildren(){this.trackChildrenCollectionChange(()=>{this.childrenNodes=[]})}getParent(){return this.parentNode}getParentType(){return this.parentNode?this.parentNode.nodeName:T.EmptyString}updateChild(t,r){let n=this.childrenNodes.indexOf(t);return n>-1?(r.trackParentNodeChange(()=>{r.parentNode=this}),this.trackChildrenCollectionChange(()=>{this.childrenNodes.splice(n,1,r)}),!0):!1}getAncestor(t){let r=this.getParent(),n=this.getParentType();for(;r;){if(n===t)return r;n=r.getParentType(),r=r.getParent()}return null}deleteFirstGrandChildOfName(t,r){return this.getChildren(t)[0].deleteChild(r)}deleteChildren(t,r){r=E.IsNullOrUndefined(r)?this.childrenNodes.length:r,this.trackChildrenCollectionChange(()=>{this.childrenNodes.splice(t,r)})}deleteGrandChildren(t,r,n){this.getChildren(t)[0].deleteChildren(r,n)}addGrandChild(t,r){let n=this.getChildren(t),i=null;n.length===0?(i=new e(t,this),this.addChild(i)):i=n[0],i.addChild(r)}addGrandChildAtIndex(t,r,n){let i=this.getChildren(t),a=null;i.length===0?(a=new e(t,this),this.addChild(a)):a=i[0],a.insertChildAtIndex(r,n)}GetPropertyByParameter(t){return this.getProperty(t)}getSemanticParent(){switch(this.getNodeName()){case v.formCell:let t=this.getAncestor(v.formSection);return t||(t=this.getAncestor(v.formHeader),t)||(t=this.getAncestor(v.formFooter),t)?t:null;case v.formSection:return this.getAncestor(v.formTab);case v.formTab:return this.getAncestor(v.form);default:return null}}isDirty(){return this.visit(t=>t.isInChangeSet())}isInChangeSet(){return this.changeTracker().getChangeSets().some(r=>r.changeSet.some(n=>n.targetNode.getNodeId()===this.getNodeId()))}changeTracker(){let t=this.getAncestor(v.form);return t?t.changeTracker():null}}});var U0={};ar(U0,{ControlClassId:()=>S,ControlNamePrefixes:()=>nl,getControlDisplayNames:()=>wL});function wL(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,nl,$n=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={}));nl={[S.WebResourceHTMLControl]:"WebResource",[S.WebResourceImageControl]:"WebResource",[S.IframeControl]:"IFRAME",[S.SearchWidgetControl]:"Search widget",[S.SubgridControl]:"Subgrid",[S.TimelineControl]:"Timeline",[S.QuickViewControl]:"QuickviewControl"}});var qn=g((wW,$0)=>{var oo=new Proxy(function(){return oo},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:oo},apply:function(){return oo},construct:function(){return{}}}),B0=function(){return oo};Object.setPrototypeOf(B0,oo);$0.exports=B0});var lt,Br,q0,V0,Ti=I(()=>{"use strict";lt="cds-designer-models",Br="FormCustomControl",q0="FormCell",V0="Form"});var Oi,ut,so=I(()=>{"use strict";Oi=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}},ut=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 Vn,$d=I(()=>{"use strict";so();X();Vn=class e{static lockedFieldCount=new ut;static dependencyFieldCount=new ut;static getNecessaryLookUpTable(t){switch(t){case fr.DependencyFieldTable:return e.dependencyFieldCount;case fr.LockedFieldTable:return e.lockedFieldCount}}static initCanvasLockedFieldLookUp(t){switch(t){case fr.DependencyFieldTable:e.dependencyFieldCount=new ut;case fr.LockedFieldTable:e.lockedFieldCount=new ut}}}});var il,G0=I(()=>{"use strict";Le();Re();X();We();il=class extends j{constructor(t){super(v.controlDescription,t)}get forControl(){let t=this.getProperty(f.ForControl);return E.IsNullOrUndefined(t)?null:(t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"&&(t=t.substr(1,t.length-2)),new P(t))}set forControl(t){this.setProperty(f.ForControl,`{${t.ToString()}}`)}get customControls(){return this.getChildren(v.customControl)}set customControls(t){this.deleteAllChildren();for(let r of t)this.addChild(r)}get DefaultControlClassId(){for(let t of this.customControls)if(!E.IsNullOrUndefined(t.id))return t.id;return null}get DefaultCustomControl(){for(let t of this.customControls)if(!E.IsNullOrUndefined(t.id))return t;return null}get DefaultCustomControls(){let t=[];for(let r of this.customControls)E.IsNullOrUndefined(r.id)||t.push(r);return t}async toJSON(t){let r=await this.getCustomControlsJSON(t);return r?{UniqueId:this.forControl.guidString,CustomControls:r,VersionNumber:0,OverallVersionNumber:0}:null}async getCustomControlsJSON(t){if(this.customControls){let r=[];for(let n of this.customControls){let i=await n.toJSON(t);i&&r.push(i)}return r}return null}}});var W0,j0,ct,_,z0,pn,Gn,Ri,qd,Vd,xi=I(()=>{"use strict";W0={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"},j0={GroupDefinition:"GroupDefinition"},ct={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"})(z0||(z0={}));(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"})(pn||(pn={}));(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"})(Gn||(Gn={}));(function(e){e[e.Bound=0]="Bound",e[e.Input=1]="Input",e[e.Output=2]="Output"})(Ri||(Ri={}));qd=[_.LookupCustomer,_.LookupOwner,_.LookupPartyList,_.LookupRegarding,_.LookupSimple],Vd=[_.WholeNone,_.WholeDuration,_.WholeLanguage,_.WholeTimeZone,_.FP,_.Decimal]});function $r(){return mr||(mr=window._makerConfig,mr&&window?.location?.search?.indexOf("useProductionConfig")>-1&&(mr={...mr,region:"prod",graphQLEndpoint:"https://graph.make.powerapps.com/"}),mr?.region==="prod"&&(mr={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/"}}},...mr}),mr||{aadClientId:"a8f7a65c-f5ba-4859-b2d6-df772c264e9d",location:"cus",region:"test",publicPath:"/",graphQLEndpoint:"https://graph.make.test.powerapps.com/"})}var mr,al=I(()=>{"use strict";});function H0(e,t,r){if(!e)return ol.has(e)||(window._ppux?.log?.("PPUX/Geo/NonExistent",{eventType:"Trace",team:"Shell",severity:"Error",errorCode:"GeoIsEmpty"}),ol.add("")),!1;if(e){if(e=e.toLowerCase(),ol.has(e))return!1;if(!(e in t))return window._ppux?.log?.("PPUX/Geo/NonExistent",{eventType:"Trace",team:"Shell",severity:"Error",errorCode:"GeoNonExistent",eventInfo:{missinggeo:e,parent:r}}),ol.add(e),!1}return!0}function AL(e){return H0(e,Gd,"Location dictionary")?Gd[e.toLowerCase()]:"us"}function CL(){let e=$r().location.toLowerCase();return H0(e,Gd,"Current location dictionary")?e:"us"}var ol,Gd,LW,Q0=I(()=>{"use strict";al();ol=new Set,Gd={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"};LW=AL(CL())});var L,MW,J0=I(()=>{"use strict";L={USWest:"westus",USWest2:"westus2",USCentral:"centralus",USEast:"eastus",USEast2:"eastus2",USNorthCentral:"northcentralus",USSouthCentral:"southcentralus",USWestCentral:"westcentralus",CanadaCentral:"canadacentral",CanadaEast:"canadaeast",BrazilSouth:"brazilsouth",EuropeNorth:"northeurope",EuropeWest:"westeurope",UKSouth:"uksouth",UKWest:"ukwest",FranceCentral:"francecentral",FranceSouth:"francesouth",SwitzerlandNorth:"switzerlandnorth",SwitzerlandWest:"switzerlandwest",GermanyNorth:"germanynorth",GermanyWestCentral:"germanywestcentral",NorwayWest:"norwaywest",NorwayEast:"norwayeast",SwedenCentral:"swedencentral",ItalyNorth:"italynorth",PolandCentral:"polandcentral",AsiaEast:"eastasia",AsiaSouthEast:"southeastasia",JapanEast:"japaneast",JapanWest:"japanwest",AustraliaEast:"australiaeast",AustraliaSouthEast:"australiasoutheast",AustraliaCentral:"australiacentral",AustraliaCentral2:"australiacentral2",IndiaCentral:"centralindia",IndiaSouth:"southindia",IndiaWest:"westindia",KoreaSouth:"koreasouth",KoreaCentral:"koreacentral",NewZealandNorth:"newzealandnorth",UAECentral:"uaecentral",UAENorth:"uaenorth",SouthAfricaNorth:"southafricanorth",SouthAfricaWest:"southafricawest",QatarCentral:"qatarcentral",GermanyCentral:"germanycentral",GermanyNorthEast:"germanynortheast",SingaporeSouthEast:"southeastasia",GovernmentUSVirginia:"usgovvirginia",GovernmentUSIowa:"usgoviowa",GovernmentUSArizona:"usgovarizona",GovernmentUSTexas:"usgovtexas",GovernmentUSDodEast:"usdodeast",GovernmentUSDodCentral:"usdodcentral",ChinaNorth:"chinanorth",ChinaNorth2:"chinanorth2",ChinaNorth3:"chinanorth3",ChinaEast:"chinaeast",ChinaEast2:"chinaeast2",ChinaEast3:"chinaeast3",UssecEast:"usseceast",UssecWest:"ussecwest",UsnatEast:"usnateast",UsnatWest:"usnatwest"},MW={[L.USWest]:{geoName:"us",regionShortName:"wus"},[L.USCentral]:{geoName:"us",regionShortName:"cus"},[L.USEast]:{geoName:"us",regionShortName:"eus"},[L.USEast2]:{geoName:"us",regionShortName:"eus2"},[L.USWestCentral]:{geoName:"us",regionShortName:"wcus"},[L.USWest2]:{geoName:"us",regionShortName:"wus2"},[L.USSouthCentral]:{geoName:"br",regionShortName:"scus"},[L.BrazilSouth]:{geoName:"br",regionShortName:"sbr"},[L.UKSouth]:{geoName:"uk",regionShortName:"suk"},[L.UKWest]:{geoName:"uk",regionShortName:"wuk"},[L.JapanEast]:{geoName:"jp",regionShortName:"ejp"},[L.JapanWest]:{geoName:"jp",regionShortName:"wjp"},[L.IndiaCentral]:{geoName:"in",regionShortName:"cin"},[L.IndiaSouth]:{geoName:"in",regionShortName:"sin"},[L.ItalyNorth]:{geoName:"it",regionShortName:"nit"},[L.GermanyWestCentral]:{geoName:"de",regionShortName:"wcde"},[L.GermanyNorth]:{geoName:"de",regionShortName:"nde"},[L.EuropeNorth]:{geoName:"eu",regionShortName:"neu"},[L.EuropeWest]:{geoName:"eu",regionShortName:"weu"},[L.AustraliaEast]:{geoName:"au",regionShortName:"eau"},[L.AustraliaSouthEast]:{geoName:"au",regionShortName:"seau"},[L.AsiaSouthEast]:{geoName:"as",regionShortName:"seas"},[L.AsiaEast]:{geoName:"as",regionShortName:"eas"},[L.CanadaCentral]:{geoName:"ca",regionShortName:"cca"},[L.CanadaEast]:{geoName:"ca",regionShortName:"eca"},[L.SouthAfricaNorth]:{geoName:"za",regionShortName:"nza"},[L.SouthAfricaWest]:{geoName:"za",regionShortName:"wza"},[L.FranceCentral]:{geoName:"fr",regionShortName:"cfr"},[L.FranceSouth]:{geoName:"fr",regionShortName:"sfr"},[L.UAENorth]:{geoName:"ae",regionShortName:"nae"},[L.UAECentral]:{geoName:"ae",regionShortName:"cae"},[L.SwedenCentral]:{geoName:"se",regionShortName:"cse"},[L.SwitzerlandNorth]:{geoName:"ch",regionShortName:"nch"},[L.SwitzerlandWest]:{geoName:"ch",regionShortName:"wch"},[L.NorwayEast]:{geoName:"no",regionShortName:"eno"},[L.NorwayWest]:{geoName:"no",regionShortName:"wno"},[L.KoreaCentral]:{geoName:"kr",regionShortName:"ckr"},[L.KoreaSouth]:{geoName:"kr",regionShortName:"skr"},[L.SingaporeSouthEast]:{geoName:"sg",regionShortName:"seas"},[L.PolandCentral]:{geoName:"pl",regionShortName:"cpl"},[L.QatarCentral]:{geoName:"qa",regionShortName:"cqa"},[L.NewZealandNorth]:{geoName:"nz",regionShortName:"nnz"},[L.GovernmentUSTexas]:{geoName:"us",regionShortName:"ugtx"},[L.GovernmentUSVirginia]:{geoName:"us",regionShortName:"ugva"},[L.GovernmentUSDodCentral]:{regionShortName:"udc"},[L.GovernmentUSDodEast]:{regionShortName:"ude"},[L.ChinaEast]:{regionShortName:"cne"},[L.ChinaEast2]:{regionShortName:"cne2"},[L.ChinaEast3]:{regionShortName:"cne3"},[L.ChinaNorth]:{regionShortName:"cnn"},[L.ChinaNorth2]:{regionShortName:"cnn2"},[L.ChinaNorth3]:{regionShortName:"cnn3"},[L.UssecEast]:{geoName:"us",regionShortName:"erx"},[L.UssecWest]:{geoName:"us",regionShortName:"wrx"},[L.UsnatEast]:{geoName:"us",regionShortName:"eex"},[L.UsnatWest]:{geoName:"us",regionShortName:"wex"}}});var X0=I(()=>{"use strict";al();});var lo=I(()=>{"use strict";al();Q0();J0();X0();});function uo(e,t){return K0?K0.isOverridden(e,t):{overridden:!1}}var K0,co=I(()=>{"use strict";});var zd=I(()=>{"use strict";lo();co();});function SL(e,t){let{region:r}=$r();return()=>{let n=e.settings[t];if(n.allowOverrides){let s=uo(e.packageName,t);if(s.overridden)return typeof s.value=="string"?NL(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 NL(e){return isNaN(Number(e))?e==="true"?!0:e==="false"?!1:e:Number(e)}function EL(e){let t=e.packageName;if(sl.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=>jd(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=>!ul(i))){let i=`error parsing settings config for package ${t}, setting ${r} has invalid region`;throw console.error(i),new Error(i)}})}function po(e){EL(e);let t={};return Object.keys(e.settings).forEach(r=>{t[r]={enumerable:!0,get:SL(e,r)}}),sl.set(e.packageName,e),Object.defineProperties({},t)}function Wd(e,t){return sl.has(e)?!!sl.get(e).settings[t]:!1}var sl,ll=I(()=>{"use strict";lo();co();Hd();fo();sl=new Map});function Y0(e,t){let{region:r}=$r();return()=>{let n=uo(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 DL(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=>Wd(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=>!ul(i))){let i=`error parsing feature gates config for package ${t}, feature ${r} has invalid region`;throw console.error(i),new Error(i)}})}function Qd(e){DL(e);let t={};Object.keys(e.features).forEach(i=>{t[i]={enumerable:!0,configurable:!0,get:Y0(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:Y0(e,a.toString())}}),Object.defineProperties(r,i),n.clear()}},cl.set(e.packageName,e),Object.defineProperties(r,t)}function jd(e,t){return cl.has(e)?!!cl.get(e).features[t]:!1}var cl,Hd=I(()=>{"use strict";lo();fo();co();ll();cl=new Map});var ev=g((lj,Z0)=>{"use strict";Z0.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 nv=g(Jd=>{"use strict";var IL=Object.prototype.hasOwnProperty,_L;function tv(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return null}}function rv(e){try{return encodeURIComponent(e)}catch{return null}}function PL(e){for(var t=/([^=?#&]+)=?([^&]*)/g,r={},n;n=t.exec(e);){var i=tv(n[1]),a=tv(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(IL.call(e,i)){if(n=e[i],!n&&(n===null||n===_L||isNaN(n))&&(n=""),i=rv(i),n=rv(n),i===null||n===null)continue;r.push(i+"="+n)}return r.length?t+r.join("&"):""}Jd.stringify=TL;Jd.parse=PL});var Yd=g((cj,uv)=>{"use strict";var av=ev(),dl=nv(),ov=/[\n\r\t]/g,OL=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,RL=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,xL=/^[a-zA-Z]:/,FL=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/;function Kd(e){return(e||"").toString().replace(FL,"")}var Xd=[["#","hash"],["?","query"],function(t,r){return hr(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]],iv={hash:1,query:1};function sv(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 gr(unescape(e.pathname),{});else if(i==="string"){n=new gr(e,{});for(a in iv)delete n[a]}else if(i==="object"){for(a in e)a in iv||(n[a]=e[a]);n.slashes===void 0&&(n.slashes=OL.test(e.href))}return n}function hr(e){return e==="file:"||e==="ftp:"||e==="http:"||e==="https:"||e==="ws:"||e==="wss:"}function lv(e,t){e=Kd(e),e=e.replace(ov,""),t=t||{};var r=RL.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)):hr(n)?s=r[4]:n?i&&(s=s.slice(2)):o>=2&&hr(t.protocol)&&(s=r[4]),{protocol:n,slashes:i||hr(n),slashesCount:o,rest:s}}function LL(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 gr(e,t,r){if(e=Kd(e),e=e.replace(ov,""),!(this instanceof gr))return new gr(e,t,r);var n,i,a,o,s,l,u=Xd.slice(),c=typeof t,d=this,p=0;for(c!=="object"&&c!=="string"&&(r=t,t=null),r&&typeof r!="function"&&(r=dl.parse),t=sv(t),i=lv(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||xL.test(e))||!i.slashes&&(i.protocol||i.slashesCount<2||!hr(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=LL(d.pathname,t.pathname)),d.pathname.charAt(0)!=="/"&&hr(d.protocol)&&(d.pathname="/"+d.pathname),av(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:"&&hr(d.protocol)&&d.host?d.protocol+"//"+d.host:"null",d.href=d.toString()}function kL(e,t,r){var n=this;switch(e){case"query":typeof t=="string"&&t.length&&(t=(r||dl.parse)(t)),n[e]=t;break;case"port":n[e]=t,av(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<Xd.length;o++){var s=Xd[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:"&&hr(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function ML(e){(!e||typeof e!="function")&&(e=dl.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||hr(r.protocol)?"//":"");return r.username?(a+=r.username,r.password&&(a+=":"+r.password),a+="@"):r.password?(a+=":"+r.password,a+="@"):r.protocol!=="file:"&&hr(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}gr.prototype={set:kL,toString:ML};gr.extractProtocol=lv;gr.location=sv;gr.trimLeft=Kd;gr.qs=dl;uv.exports=gr});var UL,cv=I(()=>{"use strict";UL=le(Yd());});function Zd(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 pl=I(()=>{"use strict";});var ep,tp,rp=I(()=>{"use strict";pl();ep=class{features=new Map;register(t,r){let n=Zd(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()}},tp=new ep});var np=I(()=>{"use strict";});function ul(e){return BL.has(e)}var BL,fo=I(()=>{"use strict";zd();Hd();ll();co();zd();cv();rp();pl();np();BL=new Set(["tie","test","prod","preview","preprod","gov","high","dod","mooncake","ex","rx"])});var $L,dv=I(()=>{"use strict";fo();$L=po({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 fl,O,k,zn,Fi,ml,pv,fv,ip,mo=I(()=>{"use strict";so();fl=class{name;constructor(t){this.name=t}toString(){return this.name}getName(){return this.name}getDisplayNameResourceKey(){return ip.getDisplayNameResourceKey(this.name)}};(function(e){e.BigInt="BigIntType",e.CalendarRulesType="CalendarRulesType",e.Currency="MoneyType",e.Customer="Customer",e.CustomerType="CustomerType",e.DateTime="DateTimeType",e.DecimalNumber="DecimalType",e.EntityNameType="EntityNameType",e.FloatingPointNumber="DoubleType",e.Image="ImageType",e.File="FileType",e.Lookup="Lookup",e.LookupType="LookupType",e.ManagedPropertyType="ManagedPropertyType",e.MultipleLineofText="MemoType",e.MultiSelectOptionSet="MultiSelectPicklistType",e.OptionSet="PicklistType",e.Owner="Owner",e.OwnerType="OwnerType",e.PartyList="PartyList",e.PartyListType="PartyListType",e.PrimaryNameAttributeType="String",e.SingleLineofText="StringType",e.State="StateType",e.Status="StatusType",e.Subject="Subject",e.TimeStamp="TimeStampType",e.TwoOptions="BooleanType",e.UniqueIdentifier="Uniqueidentifier",e.UniqueIdentifierType="UniqueidentifierType",e.VirtualType="VirtualType",e.WholeNumber="IntegerType"})(O||(O={}));(function(e){e.Email="Email",e.Text="Text",e.TextArea="TextArea",e.Url="Url",e.TickerSymbol="TickerSymbol",e.PhoneticGuide="PhoneticGuide",e.VersionNumber="VersionNumber",e.Phone="Phone",e.None="None",e.Duration="Duration",e.TimeZone="TimeZone",e.Language="Language",e.Locale="Locale",e.DateOnly="DateOnly",e.DateAndTime="DateAndTime",e.Picklist="Picklist",e.State="State",e.Status="Status",e.Boolean="Boolean",e.Regarding="Regarding"})(k||(k={}));zn=class extends fl{constructor(t){super(t)}static get None(){return"None"}static get SystemRequired(){return"SystemRequired"}static get ApplicationRequired(){return"ApplicationRequired"}static get Recommended(){return"Recommended"}},Fi=class e extends fl{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?ml.Persistent:parseInt(ml[this.name])}};(function(e){e[e.Persistent=0]="Persistent",e[e.Calculated=1]="Calculated",e[e.Rollup=2]="Rollup"})(ml||(ml={}));(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"})(pv||(pv={}));(function(e){e[e.Attribute=0]="Attribute",e[e.Organization=1]="Organization",e[e.Currency=2]="Currency"})(fv||(fv={}));ip=class e{static resourceKeyMap=e.initResourceKeyMap();static initResourceKeyMap(){let t=new Oi;return t.add(O.TwoOptions,"SystemCustomization.type.bit.label"),t.add(O.Customer,"SystemCustomization.type.customer.label"),t.add(O.CustomerType,"SystemCustomization.type.customer.label"),t.add(O.DateTime,"SystemCustomization.type.datetime.label"),t.add(O.DecimalNumber,"SystemCustomization.type.decimal.label"),t.add(O.FloatingPointNumber,"SystemCustomization.type.float.label"),t.add(O.WholeNumber,"SystemCustomization.type.int.label"),t.add(O.LookupType,"SystemCustomization.type.lookup.label"),t.add(O.Lookup,"SystemCustomization.type.lookup.label"),t.add(O.MultipleLineofText,"SystemCustomization.type.ntext.label"),t.add(O.Currency,"SystemCustomization.type.money.label"),t.add(O.Owner,"SystemCustomization.type.owner.label"),t.add(O.OwnerType,"SystemCustomization.type.owner.label"),t.add(O.PartyList,"SystemCustomization.type.partylist.label"),t.add(O.PartyListType,"SystemCustomization.type.partylist.label"),t.add(O.OptionSet,"SystemCustomization.type.picklist.label"),t.add(O.State,"SystemCustomization.type.state.label"),t.add(O.Status,"SystemCustomization.type.status.label"),t.add(O.SingleLineofText,"SystemCustomization.type.nvarchar.label"),t.add(O.UniqueIdentifier,"SystemCustomization.type.uniqueidentifier.label"),t.add(O.UniqueIdentifierType,"SystemCustomization.type.uniqueidentifiertype.label"),t.add(O.CalendarRulesType,"SystemCustomization.type.calendarrules.label"),t.add(O.VirtualType,"SystemCustomization.type.virtual.label"),t.add(O.BigInt,"SystemCustomization.type.bigint.label"),t.add(O.ManagedPropertyType,"SystemCustomization.type.managedproperty.label"),t.add(O.EntityNameType,"SystemCustomization.type.entityname.label"),t.add(O.Image,"SystemCustomization.type.image.label"),t.add(O.MultiSelectOptionSet,"SystemCustomization.type.multiselectpicklist.label"),t.add(O.PrimaryNameAttributeType,"SystemCustomization.type.primaryname.label"),t.add(O.LookupType,"SystemCustomization.type.lookuptype.label"),t.add(O.Subject,"SystemCustomization.type.subject.label"),t.add(k.Email,"SystemCustomization.String.Format.email"),t.add(k.Text,"SystemCustomization.String.Format.text"),t.add(k.TextArea,"SystemCustomization.String.Format.textarea"),t.add(k.Url,"SystemCustomization.String.Format.url"),t.add(k.TickerSymbol,"SystemCustomization.String.Format.tickersymbol"),t.add(k.PhoneticGuide,"SystemCustomization.String.Format.phoneticguide"),t.add(k.VersionNumber,"SystemCustomization.String.Format.versionnumber"),t.add(k.Phone,"SystemCustomization.String.Format.phone"),t.add(k.None,"SystemCustomization.Integer.Format."),t.add(k.Duration,"SystemCustomization.Integer.Format.duration"),t.add(k.TimeZone,"SystemCustomization.Integer.Format.timezone"),t.add(k.Language,"SystemCustomization.Integer.Format.language"),t.add(k.Locale,"SystemCustomization.Integer.Format.language"),t.add(k.DateOnly,"SystemCustomization.DateTime.Format.date"),t.add(k.DateAndTime,"SystemCustomization.DateTime.Format.datetime"),t.add(k.Regarding,"SystemCustomization.Lookup.Format.regarding"),t.add(Fi.Persistent,"SystemCustomization.String.Source.persistent"),t.add(Fi.Calculated,"SystemCustomization.String.Source.calculated"),t.add(Fi.Rollup,"SystemCustomization.String.Source.rollup"),t.add(Fi.None,"SystemCustomization.String.Source.none"),t}static getDisplayNameResourceKey(t){return e.resourceKeyMap.getValue(t)}}});var vv,op,Li,Wn,ap,hl,ki,qr,ve,mv,hv,gv,Zt=I(()=>{"use strict";vv={ThreeEqColumn_FirstColumn:34,ThreeEqColumn_SecondColumn:33,ThreeEqColumn_ThirdColumn:33,FiveEqColumn:20},op={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"})(Li||(Li={}));(function(e){e.Left="Left",e.Right="Right",e.Center="Center"})(Wn||(Wn={}));(function(e){e[e.Mobile=0]="Mobile",e[e.Tablet=1]="Tablet",e[e.Web=2]="Web"})(ap||(ap={}));hl=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"})(ki||(ki={}));qr=class{static StartTag="<"},ve={ShowLabel:"true",LockLevel:"0",IsUserDefined:"0",LabelWidth:"115",columns:"1",ShowBar:"false",Layout:"varwidth",namePrefix:"_section_",labelAlignment:Wn.Left,labelPosition:ki.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"})(mv||(mv={}));(function(e){e.TabWithLockedFieldRemoval="TabWithLockedFieldRemoval",e.SectionWithLockedFieldRemoval="SectionWithLockedFieldRemoval",e.LockedSectionRemoval="LockedSectionRemoval",e.LockedFieldRemoval="LockedFieldRemoval",e.RequiredFieldRemoval="RequiredFieldRemoval",e.LastRemainingTab="LastRemainingTab",e.UnknownRemoval="UnknownRemoval"})(hv||(hv={}));(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"})(gv||(gv={}))});var jn=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 bv;(function(e){e.None="None",e.UserOwned="UserOwned",e.TeamOwned="TeamOwned",e.BusinessOwned="BusinessOwned",e.OrganizationOwned="OrganizationOwned",e.BusinessParented="BusinessParented",e.Filtered="Filtered"})(bv||(C.OwnershipTypes=bv={}));var yv;(function(e){e.User="Microsoft.Dynamics.CRM.systemuser",e.Team="Microsoft.Dynamics.CRM.team"})(yv||(C.PrincipalType=yv={}));var wv;(function(e){e[e.DoNotDisplayInActivityMenus=0]="DoNotDisplayInActivityMenus",e[e.DisplayInActivityMenus=1]="DisplayInActivityMenus"})(wv||(C.ActivityTypeMask=wv={}));var Av;(function(e){e.Activity="Activity",e.Virtual="Virtual",e.Standard="Standard",e.Elastic="Elastic"})(Av||(C.TableTypes=Av={}));var Cv;(function(e){e.Standard="Standard",e.Virtual="Virtual",e.Elastic="Elastic"})(Cv||(C.TableTypeCode=Cv={}));var Sv;(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"})(Sv||(C.FormType=Sv={}));var Nv;(function(e){e[e.ClassicForm=0]="ClassicForm",e[e.AirForm=1]="AirForm",e[e.ConvertedICForm=2]="ConvertedICForm"})(Nv||(C.FormPresentation=Nv={}));var Ev;(function(e){e[e.Inactive=0]="Inactive",e[e.Active=1]="Active"})(Ev||(C.ActivationState=Ev={}));var Dv;(function(e){e[e.String=0]="String",e[e.Number=1]="Number",e[e.Picklist=2]="Picklist"})(Dv||(C.AttributeType=Dv={}));var Iv;(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"})(Iv||(C.ViewType=Iv={}));var _v;(function(e){e[e.ASPChart=0]="ASPChart",e[e.PowerBI=1]="PowerBI"})(_v||(C.ChartsType=_v={}));var Pv;(function(e){e[e.DataAndInteractionCentric=0]="DataAndInteractionCentric",e[e.InteractionCentric=1]="InteractionCentric"})(Pv||(C.ChartType=Pv={}));var Tv;(function(e){e[e.Published=0]="Published",e[e.Unpublished=1]="Unpublished",e[e.Deleted=2]="Deleted",e[e.DeletedUnpublished=3]="DeletedUnpublished"})(Tv||(C.ComponentState=Tv={}));var Ov;(function(e){e[e.None=1]="None",e[e.Sandbox=2]="Sandbox",e[e.External=3]="External"})(Ov||(C.PluginIsolationMode=Ov={}));var Rv;(function(e){e[e.BasicAuth=0]="BasicAuth"})(Rv||(C.AuthType=Rv={}));var xv;(function(e){e[e.Database=0]="Database",e[e.Disk=1]="Disk",e[e.Normal=2]="Normal",e[e.AzureWebApp=3]="AzureWebApp"})(xv||(C.PluginSourceType=xv={}));var Fv;(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"})(Fv||(C.AttributeTypeCode=Fv={}));var Lv;(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"})(Lv||(C.AttributeTypeName=Lv={}));var kv;(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"})(kv||(C.AttributeFormatCode=kv={}));var Mv;(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"})(Mv||(C.AttributeFormatName=Mv={}));var Uv;(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"})(Uv||(C.AttributeTypeCodeNum=Uv={}));var Bv;(function(e){e.Picklist="Picklist",e.State="State",e.Status="Status",e.Boolean="Boolean"})(Bv||(C.OptionSetType=Bv={}));var $v;(function(e){e[e.Draft=0]="Draft",e[e.Activated=1]="Activated"})($v||(C.StateCode=$v={}));var qv;(function(e){e[e.Draft=1]="Draft",e[e.Activated=2]="Activated"})(qv||(C.StatusCode=qv={}));var Vv;(function(e){e[e.Enabled=0]="Enabled",e[e.Disabled=1]="Disabled"})(Vv||(C.StateCodeEnabledDisabled=Vv={}));var Gv;(function(e){e[e.Enabled=1]="Enabled",e[e.Disabled=2]="Disabled"})(Gv||(C.StatusCodeEnabledDisabled=Gv={}));var zv;(function(e){e[e.Definition=1]="Definition",e[e.Activation=2]="Activation",e[e.Template=3]="Template"})(zv||(C.WorkflowTypeCode=zv={}));var Wv;(function(e){e[e.User=1]="User",e[e.BusinessUnit=2]="BusinessUnit",e[e.ParentChildBusinessUnit=3]="ParentChildBusinessUnit",e[e.Organization=4]="Organization"})(Wv||(C.WorkflowScope=Wv={}));var jv;(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"})(jv||(C.WorkflowCategory=jv={}));var Hv;(function(e){e[e.None=-1]="None",e[e.BusinessFlow=0]="BusinessFlow",e[e.TaskFlow=1]="TaskFlow"})(Hv||(C.BusinessProcessType=Hv={}));var Qv;(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"})(Qv||(C.AppSubType=Qv={}));var Jv;(function(e){e.OneToManyRelationship="OneToManyRelationship",e.ManyToManyRelationship="ManyToManyRelationship"})(Jv||(C.RelationshipType=Jv={}));var Xv;(function(e){e.ManyToOneRelationship="ManyToOneRelationship",e.OneToManyRelationship="OneToManyRelationship",e.ManyToManyRelationship="ManyToManyRelationship"})(Xv||(C.RelationshipTypeExt=Xv={}));var Kv;(function(e){e.NoCascade="NoCascade",e.Cascade="Cascade",e.Active="Active",e.UserOwned="UserOwned",e.RemoveLink="RemoveLink",e.Restrict="Restrict"})(Kv||(C.CascadeType=Kv={}));var Yv;(function(e){e.None="None",e.Append="Append",e.ParentChild="ParentChild",e.Pointer="Pointer",e.Inheritance="Inheritance"})(Yv||(C.RelationshipSecurityTypes=Yv={}));var Zv;(function(e){e[e.Active=1]="Active",e[e.Inactive=2]="Inactive"})(Zv||(C.ViewStatusCode=Zv={}));var eb;(function(e){e[e.Active=0]="Active",e[e.Inactive=1]="Inactive"})(eb||(C.ViewStateCode=eb={}));var tb;(function(e){e.Active="Active",e.Failed="Failed",e.InProgress="InProgress",e.Pending="Pending"})(tb||(C.EntityKeyIndexStatus=tb={}));var rb;(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"})(rb||(C.SolutionComponentTypeCode=rb={}));var nb;(function(e){e[e.IncludeSubcomponents=0]="IncludeSubcomponents",e[e.DoNotIncludeSubcomponents=1]="DoNotIncludeSubcomponents",e[e.IncludeAsShellOnly=2]="IncludeAsShellOnly"})(nb||(C.RootComponentBehavior=nb={}));var gl;(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"})(gl||(C.SolutionComponentTypeCodeExt=gl={}));var vl;(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"})(vl||(C.EntityTypeCode=vl={}));var ib;(function(e){e.MultiSelectPicklist="MultiSelectPicklist",e.File="File",e.Image="Image"})(ib||(C.SolutionComponentVirtualAttributeSubtype=ib={}));function qL(e){let t=gl[e];return vl[t]}C.SolutionComponentTypeCodeToEntityTypeCodeExt=qL;function VL(e){let t=vl[e];return gl[t]}C.SolutionEntityTypeCodeExtToComponentTypeCode=VL;var ab;(function(e){e.Active="Active",e.Auto="Auto",e.Disabled="Disabled",e.Inactive="Inactive"})(ab||(C.ImeMode=ab={}));var ob;(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"})(ob||(C.SourceType=ob={}));var sb;(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"})(sb||(C.StringFormatName=sb={}));var lb;(function(e){e[e.PrecisionProperty=0]="PrecisionProperty",e[e.Organization=1]="Organization",e[e.TransactionCurrency=2]="TransactionCurrency"})(lb||(C.PrecisionSource=lb={}));var ub;(function(e){e.UserLocal="UserLocal",e.DateOnly="DateOnly",e.TimeZoneIndependent="TimeZoneIndependent"})(ub||(C.DateTimeBehavior=ub={}));var cb;(function(e){e.DateOnly="DateOnly",e.DateAndTime="DateAndTime"})(cb||(C.DateTimeFormat=cb={}));var db;(function(e){e.None="None",e.Duration="Duration",e.TimeZone="TimeZone",e.Language="Language",e.Locale="Locale"})(db||(C.IntegerFormat=db={}));var pb;(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"})(pb||(C.WebResourceTypeCode=pb={}));var fb;(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"})(fb||(C.SdkMessageProcessingStage=fb={}));var mb;(function(e){e[e.ServerOnly=0]="ServerOnly",e[e.OutlookClientOnly=1]="OutlookClientOnly",e[e.Both=2]="Both"})(mb||(C.SupportedDeployment=mb={}));var hb;(function(e){e[e.Synchronous=0]="Synchronous",e[e.Asynchronous=1]="Asynchronous"})(hb||(C.SdkMessageProcessingMode=hb={}));var gb;(function(e){e[e.ReportingServicesReport=1]="ReportingServicesReport",e[e.OtherReport=2]="OtherReport",e[e.LinkedReport=3]="LinkedReport"})(gb||(C.ReportTypeCode=gb={}));var vb;(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"})(vb||(C.ConnectionRoleCategory=vb={}));var bb;(function(e){e[e.Name=1]="Name",e[e.Address=2]="Address"})(bb||(C.ServiceNamespaceFormat=bb={}));var yb;(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"})(yb||(C.ServiceEndpointContract=yb={}));var wb;(function(e){e[e.Normal=1]="Normal",e[e.Federated=2]="Federated"})(wb||(C.ServiceEndpointConnectionMode=wb={}));var Ab;(function(e){e.CannotDeleteInUseComponent="0x8004f01f",e.CannotDeleteInUseAttribute="0x80048418",e.CannotDeleteInUseOptionSet="0x80048417",e.CannotDeleteInUseEntity="0x80048420",e.CannotUninstallWithDependencies="0x8004F01D"})(Ab||(C.DeleteDependencyErrorCode=Ab={}));var Cb;(function(e){e.SystemAdministrator="627090FF-40A3-4053-8790-584EDC5BE201",e.SystemCustomizer="119F245C-3CC8-4B62-B31C-D1A046CED15D"})(Cb||(C.DefaultRoleTemplates=Cb={}));var Sb;(function(e){e[e.DefaultTeamPrivilege=0]="DefaultTeamPrivilege",e[e.DirectUserAndTeamPrivilege=1]="DirectUserAndTeamPrivilege"})(Sb||(C.RoleInheritance=Sb={}));var Nb;(function(e){e[e.NotSpecified=0]="NotSpecified",e[e.CustomConnector=1]="CustomConnector"})(Nb||(C.ConnectorTypeEnum=Nb={}));var Eb;(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"})(Eb||(C.EnvironmentVariableDefinitionTypeEnum=Eb={}));var Db;(function(e){e[e.Owner=0]="Owner",e[e.Access=1]="Access",e[e.AADSecurityGroup=2]="AADSecurityGroup",e[e.AADOfficeGroup=3]="AADOfficeGroup"})(Db||(C.TeamTypeEnum=Db={}));var Ib;(function(e){e.Bots="bots"})(Ib||(C.KnownCustomSolutionComponentEntitySetName=Ib={}));var _b;(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"})(_b||(C.QueryType=_b={}))});var sp,Pb=I(()=>{"use strict";(function(e){e.DefaultValue="defaultValue",e.Loaded="loaded"})(sp||(sp={}))});var Rb,GL,Tb,uH,cH,ho,Ob,dH,pH,xb=I(()=>{"use strict";Rb=le(qn());Re();Ti();dv();mo();Zt();xi();X();GL=le(jn());Pb();(function(e){e.Model="Model",e.Canvas="Canvas",e.CustomPages="CustomPages"})(Tb||(Tb={}));uH={Read:Gn.Read,Edit:Gn.Edit,Both:Gn.Both,Container:Gn.Container},cH={input:Ri.Input,bound:Ri.Bound,output:Ri.Output};(function(e){e[e.dataset=0]="dataset",e[e.property=1]="property",e[e.groups=2]="groups",e[e.group=3]="group"})(ho||(ho={}));(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"})(Ob||(Ob={}));dH=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]),pH={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 er,bl,Fb=I(()=>{"use strict";er=le(qn());Le();Re();nt();Ti();xi();xb();mo();X();We();Zt();bl=class extends j{constructor(t){super(v.customControl,t)}customControlId;get id(){let t=this.getProperty(f.id);return E.IsNullOrUndefined(t)?null:t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?new P(t.substr(1,t.length-2)):new P(t)}getParameters(){let t=new Map,r=this.getAllChildren();if(r&&r.length!==0&&r[0]){let n=r[0].getAllChildren();if(n!=null){for(let i of n)if(i&&i.getAllChildren().length>0){let a=i.getNodeName();t.get(a)?t.get(a).push(i):t.set(a,[i])}}}return t}getFormComponentValueByParameterName(t){let r=this.getParameters()?.get(ct.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===ct.name)?.value}getParameterChildrenValues(t,r,n){if(this.isDataSet(t)){let i=r.find(u=>u.key===ct.name)?.value,a={Name:i,Type:_.Grid,Columns:[]},l=this.getParameters().get(ct.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===f.static&&a.value==="true"){r=!0;break}}return r}get name(){return this.getProperty(f.Name)}get formFactor(){return this.getProperty(f.formFactor)}set formFactor(t){this.setProperty(f.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(qr.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:j0.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===ho.dataset?a.get(ct.dataset)?.some(m=>this.getDatasetName(m)===d)||r.push({Name:d,Value:{Name:d,Columns:[],Type:_.Grid}}):c.propertyType===ho.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,er.trackInfoTrace)(lt,{eventName:`${Br}/parametersToJSON`,eventData:{message:`Configuration metadata for custom control parameter ${o} is not available for custom control : ${this.name}.`}}),r=[];break}}}else(0,er.trackErrorTrace)(lt,{eventName:`${Br}/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,er.trackErrorTrace)(lt,{eventName:`${Br}/parametersToJSON`,eventData:{message:"Custom Control Manifest not found"}},new Error(`No custom control manifest found for ${this.name}`))}catch(n){(0,er.trackErrorTrace)(lt,{eventName:`${Br}/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===ct.name)?.value;if(a)return this.getParameterChildrenValues(t,r);{let s=new Error(`No dataset manifest info for ${o}`);(0,er.trackErrorTrace)(lt,{eventName:`${Br}/parameterJSON`,eventData:{message:"Missing custom control manifest dataset info"}},s)}}else{let a=n,o=r&&r.find(l=>l.key===f.Type),s=a&&!a.ofTypeGroup.every(l=>!qd.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===pn.FormComponent){let d=this.getFormComponentValueByParameterName(f.bindAttribute),p=await i.formModelService.loadLookupModel(d),m=p.lookupColumn,h=this.getLookupDataTypeFromAttributeMetadata(m);return{Name:t,Type:h,Usage:l,Static:u,Primary:c,EntityName:p.primaryTableName,Value:d,ViewId:this.getFormComponentValueByParameterName(W0.DefaultViewId),TargetEntityType:m.targets[0],FilterRelationshipName:this.getFormComponentValueByParameterName(f.FilterRelationshipName),AvailableViewIds:this.getFormComponentValueByParameterName(f.AvailableViewIds),DependentAttributeName:this.getFormComponentValueByParameterName(f.DependentAttributeName),DependentAttributeType:this.getFormComponentValueByParameterName(f.DependentAttributeType),AllowFilterOff:T.IsStrictTrue(this.getFormComponentValueByParameterName(f.AllowFilterOff)),DisableQuickFind:T.IsStrictTrue(this.getFormComponentValueByParameterName(f.DisableQuickFind)),EnableViewPicker:!T.IsStrictTrue(this.getFormComponentValueByParameterName(f.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,er.trackErrorTrace)(lt,{eventName:`${Br}/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 m=o.value;return{Type:m,Static:u,Usage:l,Value:this.isNumberTypeProperty(a,m)&&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,er.trackErrorTrace)(lt,{eventName:`${Br}/parameterJSON`,eventData:{message:"Missing property type info"}},p)}else{let l=new Error(`No property manifest info for ${t}`);(0,er.trackWarningTrace)(lt,{eventName:`${Br}/parameterJSON`,eventData:{message:"Missing custom control manifest property info"}},l)}}return null}getLookupDataTypeFromAttributeMetadata(t){let{attributeType:r,format:n}=t;switch(r){case O.Customer:return _.LookupCustomer;case O.Owner:return _.LookupOwner;case O.PartyList:return _.LookupPartyList;default:return n===k.Regarding?_.LookupRegarding:_.LookupSimple}}isLookupType(t){return qd.includes(t)}isNumberTypeProperty(t,r){return Vd.includes(r)||t.ofTypeGroup.some(n=>Vd.includes(n))}isDataSet(t){return ct.dataset===t}isGroups(t){return!!t[0].getAllProperties().find(n=>n.key==="isGroup"&&n.value==="true")}}});var V,lp=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,Mi,Me,yl=I(()=>{"use strict";Le();so();Re();nt();mo();$n();lp();Zt();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"}},Mi=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 ut;static initializeFieldControls(){let t=new ut,r=e.getControlName(O.SingleLineofText,k.Phone);t.add(r,new P(R.PhoneNumberControl));let n=e.getControlName(O.SingleLineofText,k.TextArea);t.add(n,new P(R.TextAreaControl));let i=e.getControlName(O.SingleLineofText,k.Text);t.add(i,new P(R.TextBoxControl));let a=e.getControlName(O.SingleLineofText,k.Email);t.add(a,new P(R.EmailAddressControl));let o=e.getControlName(O.SingleLineofText,k.Url);t.add(o,new P(R.UrlControl));let s=e.getControlName(O.SingleLineofText,k.TickerSymbol);t.add(s,new P(R.TickerControl));let l=e.getControlName(O.SingleLineofText,k.PhoneticGuide);t.add(l,new P(R.TextBoxControl));let u=e.getControlName(O.WholeNumber,k.Duration);t.add(u,new P(R.DurationControl));let c=e.getControlName(O.WholeNumber,k.Language);t.add(c,new P(R.LanguagePickerControl));let d=e.getControlName(O.WholeNumber,k.TimeZone);t.add(d,new P(R.TimeZonePicklistControl));let p=e.getControlName(O.WholeNumber,k.None);t.add(p,new P(R.IntegerControl));let m=e.getControlName(O.DateTime,k.DateOnly);t.add(m,new P(R.DateTimeControl));let h=e.getControlName(O.DateTime,k.DateAndTime);t.add(h,new P(R.DateTimeControl));let w=e.getControlName(O.LookupType,k.None);t.add(w,new P(R.LookupControl));let y=e.getControlName(O.CustomerType,k.None);t.add(y,new P(R.LookupControl));let N=e.getControlName(O.FloatingPointNumber,k.None);t.add(N,new P(R.FloatControl));let D=e.getControlName(O.DecimalNumber,k.None);t.add(D,new P(R.DecimalControl));let x=e.getControlName(O.Currency,k.None);t.add(x,new P(R.MoneyControl));let F=e.getControlName(O.MultipleLineofText,k.None);t.add(F,new P(R.TextAreaControl));let q=e.getControlName(O.MultipleLineofText,k.Text);t.add(q,new P(R.TextAreaControl));let G=e.getControlName(O.MultipleLineofText,k.TextArea);t.add(G,new P(R.TextAreaControl));let M=e.getControlName(O.MultipleLineofText,k.Email);t.add(M,new P(R.EmailBodyControl));let U=e.getControlName(O.OptionSet,k.None);t.add(U,new P(R.PicklistControl));let B=e.getControlName(O.TwoOptions,k.None);t.add(B,new P(R.RadioControl));let W=e.getControlName(O.Image,k.None);t.add(W,new P(R.WebResourceImageControl));let $=e.getControlName(O.Image,k.None);t.add($,new P(R.WebResourceHtmlControl));let Ae=e.getControlName(O.TwoOptions,"Radio");t.add(Ae,new P(R.RadioControl));let he=e.getControlName(O.TwoOptions,"CheckBox");t.add(he,new P(R.CheckBoxControl));let $e=e.getControlName(O.TwoOptions,"List");t.add($e,new P(R.PicklistControl));let Je=e.getControlName(O.State,k.None);t.add(Je,new P(R.PicklistControl));let ce=e.getControlName(O.Status,k.None);t.add(ce,new P(R.PicklistStatusControl));let mt=e.getControlName(O.OwnerType,k.None);t.add(mt,new P(R.LookupControl));let Qu=e.getControlName(O.PartyListType,k.None);t.add(Qu,new P(R.PartyListControl));let _1=e.getControlName(O.LookupType,k.Regarding);t.add(_1,new P(R.RegardingControl));let P1=e.getControlName(O.MultiSelectOptionSet,k.None);return t.add(P1,new P(R.ChoicesControl)),t}static getControlName(t,r){return t+"_"+r}static getControlIdByTypeAndFormat(t,r){let n=e.getControlName(t.toString(),r.toString());return e.FieldControlIds.containsKey(n)?e.FieldControlIds.getValue(n):null}static getTypeAndFormatByControlOrUniqueId(t){for(let r in e.FieldControlIds.getKeys())if(e.FieldControlIds.getValue(e.FieldControlIds.getKeys()[r]).guidString.toLowerCase()===t)return e.FieldControlIds.getKeys()[r]}static getControlDataTypeByControlOrUniqueId(t){if(!E.IsNullOrEmptyGuid(t)){let r=e.getTypeAndFormatByControlOrUniqueId(t.guidString.toLowerCase());return r=E.IsNullOrUndefined(r)?e.getUnboundControlNameFromIdentifier(t):r.substring(0,r.indexOf("_")),r}return null}static isCustomControl(t){return E.IsNullOrUndefined(t.control)||E.IsNullOrUndefined(t.control.ClassId)||t.control.ClassId.guidString===R.CustomControl}static initializeUnboundControls(){let t=new ut;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(Mi.RelationshipAssistant,V.CustomControl),t}static initializeReferencePanelControls(){let t=new ut;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 Oi;return t.add(Li.IFRAME,!0),t.add(Li.SPACER,!0),t.add(Li.WEB_RESOURCE_HTML,!0),t}static isUnboundFormControl(t){if(E.IsNullOrUndefined(t)||E.IsNullOrUndefined(t.control)||E.IsNullOrUndefined(t.control.ClassId))return!1;let r=e.getUniqueIdentifierForControl(t.control);return e.UnboundControlIds.containsKey(r.guidString)}static isReferencePanelSection(t){return!E.IsNullOrUndefined(t)&&!E.IsNullOrUndefined(t.Name)&&t.Name.indexOf(ve.referencePanelNamePrefix)===0}static isUnboundFormControlByIdentifier(t){return E.IsNullOrUndefined(t)||E.IsNullOrUndefined(t.guidString)?!1:e.UnboundControlIds.containsKey(t.guidString)}static getUnboundFormControlName(t){let r=T.EmptyString;if(E.IsNullOrUndefined(t)||E.IsNullOrUndefined(t.control)||E.IsNullOrUndefined(t.control.ClassId))return r;let n=e.getUniqueIdentifierForControl(t.control);return e.UnboundControlIds.getValue(n.guidString).toString()}static getUnboundControlNameFromIdentifier(t){return E.IsNullOrUndefined(t)||E.IsNullOrUndefined(t.guidString)?T.EmptyString:e.UnboundControlIds.getValue(t.guidString).toString()}static isSpacerControl(t){return t===R.SpacerControl}static GetRowSpan(t){let r=t.ClassId;if(e.isRelationshipAssistantControl(t))r=t.UniqueId;else if(r.guidString===R.CustomControl&&!E.IsNullOrUndefined(t.UniqueId)){let n=t.UniqueId.ToString();e.CustomControlIdMap.containsKey(n)&&(r=e.CustomControlIdMap.getValue(n))}switch(e.UnboundControlIds.getValue(r.guidString)){case 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!E.IsNullOrUndefined(t)&&t.ClassId.guidString===R.LookupControl}static isRelationshipAssistantOrLeadScoringControl(t){return!E.IsNullOrUndefined(t)&&e.isRelationshipAssistantOrLeadScoring(t.UniqueId)}static isRelationshipAssistantOrLeadScoring(t){return!E.IsNullOrUndefined(t)&&(t.guidString===Mi.RelationshipAssistant||t.guidString===Mi.PredictiveLeadScoring)}static isRelationshipAssistantControl(t){return!E.IsNullOrUndefined(t)&&e.isRelationshipAssistant(t.UniqueId)}static isRelationshipAssistant(t){return!E.IsNullOrUndefined(t)&&t.guidString===Mi.RelationshipAssistant}static getUniqueIdentifierForControl(t){if(E.IsNullOrUndefined(t))return null;let r=t.ClassId;if(e.isRelationshipAssistantControl(t))r=t.UniqueId;else if(r.guidString===R.CustomControl&&!E.IsNullOrUndefined(t.UniqueId)){let n=t.UniqueId.ToString();e.CustomControlIdMap.containsKey(n)&&(r=e.CustomControlIdMap.getValue(n))}return r}}});var wl,Lb=I(()=>{"use strict";wl=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 Hn,Ui,kb,Mb,fn,Ub,Bb,up=I(()=>{"use strict";(function(e){e[e.Center=0]="Center",e[e.Left=1]="Left",e[e.Right=2]="Right"})(Hn||(Hn={}));(function(e){e[e.Left=0]="Left",e[e.Top=1]="Top"})(Ui||(Ui={}));(function(e){e[e.Top=0]="Top",e[e.Middle=1]="Middle"})(kb||(kb={}));(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"})(Mb||(Mb={}));(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"})(fn||(fn={}));(function(e){e[e.None=0]="None",e[e.SystemRequired=1]="SystemRequired",e[e.ApplicationRequired=2]="ApplicationRequired",e[e.Recommended=3]="Recommended"})(Ub||(Ub={}));(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"})(Bb||(Bb={}))});var Bi,$b=I(()=>{"use strict";fo();Bi=Qd({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 qb(e){return{...e,extractConfig:t=>zL(t,Object.keys(e.fallback))}}function zL(e,t){let r={};for(let n of t)typeof e[n]<"u"&&(r[n]=e[n]);return r}var cp=I(()=>{"use strict";});var dp=g(($H,Gb)=>{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{}}}),Vb=function(){return go};Object.setPrototypeOf(Vb,go);Gb.exports=Vb});var jb=g((qH,Wb)=>{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{}}}),zb=function(){return vo};Object.setPrototypeOf(zb,vo);Wb.exports=zb});var pp=g((VH,Qb)=>{var bo=new Proxy(function(){return bo},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:bo},apply:function(){return bo},construct:function(){return{}}}),Hb=function(){return bo};Object.setPrototypeOf(Hb,bo);Qb.exports=Hb});var Xb=g((GH,Jb)=>{function WL(){this.__data__=[],this.size=0}Jb.exports=WL});var $i=g((zH,Kb)=>{function jL(e,t){return e===t||e!==e&&t!==t}Kb.exports=jL});var yo=g((WH,Yb)=>{var HL=$i();function QL(e,t){for(var r=e.length;r--;)if(HL(e[r][0],t))return r;return-1}Yb.exports=QL});var ey=g((jH,Zb)=>{var JL=yo(),XL=Array.prototype,KL=XL.splice;function YL(e){var t=this.__data__,r=JL(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():KL.call(t,r,1),--this.size,!0}Zb.exports=YL});var ry=g((HH,ty)=>{var ZL=yo();function ek(e){var t=this.__data__,r=ZL(t,e);return r<0?void 0:t[r][1]}ty.exports=ek});var iy=g((QH,ny)=>{var tk=yo();function rk(e){return tk(this.__data__,e)>-1}ny.exports=rk});var oy=g((JH,ay)=>{var nk=yo();function ik(e,t){var r=this.__data__,n=nk(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}ay.exports=ik});var wo=g((XH,sy)=>{var ak=Xb(),ok=ey(),sk=ry(),lk=iy(),uk=oy();function qi(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])}}qi.prototype.clear=ak;qi.prototype.delete=ok;qi.prototype.get=sk;qi.prototype.has=lk;qi.prototype.set=uk;sy.exports=qi});var uy=g((KH,ly)=>{var ck=wo();function dk(){this.__data__=new ck,this.size=0}ly.exports=dk});var dy=g((YH,cy)=>{function pk(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}cy.exports=pk});var fy=g((ZH,py)=>{function fk(e){return this.__data__.get(e)}py.exports=fk});var hy=g((eQ,my)=>{function mk(e){return this.__data__.has(e)}my.exports=mk});var fp=g((tQ,gy)=>{var hk=typeof global=="object"&&global&&global.Object===Object&&global;gy.exports=hk});var tr=g((rQ,vy)=>{var gk=fp(),vk=typeof self=="object"&&self&&self.Object===Object&&self,bk=gk||vk||Function("return this")();vy.exports=bk});var Ao=g((nQ,by)=>{var yk=tr(),wk=yk.Symbol;by.exports=wk});var Cy=g((iQ,Ay)=>{var yy=Ao(),wy=Object.prototype,Ak=wy.hasOwnProperty,Ck=wy.toString,Co=yy?yy.toStringTag:void 0;function Sk(e){var t=Ak.call(e,Co),r=e[Co];try{e[Co]=void 0;var n=!0}catch{}var i=Ck.call(e);return n&&(t?e[Co]=r:delete e[Co]),i}Ay.exports=Sk});var Ny=g((aQ,Sy)=>{var Nk=Object.prototype,Ek=Nk.toString;function Dk(e){return Ek.call(e)}Sy.exports=Dk});var Qn=g((oQ,Iy)=>{var Ey=Ao(),Ik=Cy(),_k=Ny(),Pk="[object Null]",Tk="[object Undefined]",Dy=Ey?Ey.toStringTag:void 0;function Ok(e){return e==null?e===void 0?Tk:Pk:Dy&&Dy in Object(e)?Ik(e):_k(e)}Iy.exports=Ok});var Vr=g((sQ,_y)=>{function Rk(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}_y.exports=Rk});var Al=g((lQ,Py)=>{var xk=Qn(),Fk=Vr(),Lk="[object AsyncFunction]",kk="[object Function]",Mk="[object GeneratorFunction]",Uk="[object Proxy]";function Bk(e){if(!Fk(e))return!1;var t=xk(e);return t==kk||t==Mk||t==Lk||t==Uk}Py.exports=Bk});var Oy=g((uQ,Ty)=>{var $k=tr(),qk=$k["__core-js_shared__"];Ty.exports=qk});var Fy=g((cQ,xy)=>{var mp=Oy(),Ry=(function(){var e=/[^.]+$/.exec(mp&&mp.keys&&mp.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function Vk(e){return!!Ry&&Ry in e}xy.exports=Vk});var hp=g((dQ,Ly)=>{var Gk=Function.prototype,zk=Gk.toString;function Wk(e){if(e!=null){try{return zk.call(e)}catch{}try{return e+""}catch{}}return""}Ly.exports=Wk});var My=g((pQ,ky)=>{var jk=Al(),Hk=Fy(),Qk=Vr(),Jk=hp(),Xk=/[\\^$.*+?()[\]{}|]/g,Kk=/^\[object .+?Constructor\]$/,Yk=Function.prototype,Zk=Object.prototype,eM=Yk.toString,tM=Zk.hasOwnProperty,rM=RegExp("^"+eM.call(tM).replace(Xk,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function nM(e){if(!Qk(e)||Hk(e))return!1;var t=jk(e)?rM:Kk;return t.test(Jk(e))}ky.exports=nM});var By=g((fQ,Uy)=>{function iM(e,t){return e?.[t]}Uy.exports=iM});var mn=g((mQ,$y)=>{var aM=My(),oM=By();function sM(e,t){var r=oM(e,t);return aM(r)?r:void 0}$y.exports=sM});var Cl=g((hQ,qy)=>{var lM=mn(),uM=tr(),cM=lM(uM,"Map");qy.exports=cM});var So=g((gQ,Vy)=>{var dM=mn(),pM=dM(Object,"create");Vy.exports=pM});var Wy=g((vQ,zy)=>{var Gy=So();function fM(){this.__data__=Gy?Gy(null):{},this.size=0}zy.exports=fM});var Hy=g((bQ,jy)=>{function mM(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}jy.exports=mM});var Jy=g((yQ,Qy)=>{var hM=So(),gM="__lodash_hash_undefined__",vM=Object.prototype,bM=vM.hasOwnProperty;function yM(e){var t=this.__data__;if(hM){var r=t[e];return r===gM?void 0:r}return bM.call(t,e)?t[e]:void 0}Qy.exports=yM});var Ky=g((wQ,Xy)=>{var wM=So(),AM=Object.prototype,CM=AM.hasOwnProperty;function SM(e){var t=this.__data__;return wM?t[e]!==void 0:CM.call(t,e)}Xy.exports=SM});var Zy=g((AQ,Yy)=>{var NM=So(),EM="__lodash_hash_undefined__";function DM(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=NM&&t===void 0?EM:t,this}Yy.exports=DM});var tw=g((CQ,ew)=>{var IM=Wy(),_M=Hy(),PM=Jy(),TM=Ky(),OM=Zy();function Vi(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])}}Vi.prototype.clear=IM;Vi.prototype.delete=_M;Vi.prototype.get=PM;Vi.prototype.has=TM;Vi.prototype.set=OM;ew.exports=Vi});var iw=g((SQ,nw)=>{var rw=tw(),RM=wo(),xM=Cl();function FM(){this.size=0,this.__data__={hash:new rw,map:new(xM||RM),string:new rw}}nw.exports=FM});var ow=g((NQ,aw)=>{function LM(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}aw.exports=LM});var No=g((EQ,sw)=>{var kM=ow();function MM(e,t){var r=e.__data__;return kM(t)?r[typeof t=="string"?"string":"hash"]:r.map}sw.exports=MM});var uw=g((DQ,lw)=>{var UM=No();function BM(e){var t=UM(this,e).delete(e);return this.size-=t?1:0,t}lw.exports=BM});var dw=g((IQ,cw)=>{var $M=No();function qM(e){return $M(this,e).get(e)}cw.exports=qM});var fw=g((_Q,pw)=>{var VM=No();function GM(e){return VM(this,e).has(e)}pw.exports=GM});var hw=g((PQ,mw)=>{var zM=No();function WM(e,t){var r=zM(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}mw.exports=WM});var Sl=g((TQ,gw)=>{var jM=iw(),HM=uw(),QM=dw(),JM=fw(),XM=hw();function Gi(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])}}Gi.prototype.clear=jM;Gi.prototype.delete=HM;Gi.prototype.get=QM;Gi.prototype.has=JM;Gi.prototype.set=XM;gw.exports=Gi});var bw=g((OQ,vw)=>{var KM=wo(),YM=Cl(),ZM=Sl(),eU=200;function tU(e,t){var r=this.__data__;if(r instanceof KM){var n=r.__data__;if(!YM||n.length<eU-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new ZM(n)}return r.set(e,t),this.size=r.size,this}vw.exports=tU});var gp=g((RQ,yw)=>{var rU=wo(),nU=uy(),iU=dy(),aU=fy(),oU=hy(),sU=bw();function zi(e){var t=this.__data__=new rU(e);this.size=t.size}zi.prototype.clear=nU;zi.prototype.delete=iU;zi.prototype.get=aU;zi.prototype.has=oU;zi.prototype.set=sU;yw.exports=zi});var Aw=g((xQ,ww)=>{var lU="__lodash_hash_undefined__";function uU(e){return this.__data__.set(e,lU),this}ww.exports=uU});var Sw=g((FQ,Cw)=>{function cU(e){return this.__data__.has(e)}Cw.exports=cU});var Ew=g((LQ,Nw)=>{var dU=Sl(),pU=Aw(),fU=Sw();function Nl(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new dU;++t<r;)this.add(e[t])}Nl.prototype.add=Nl.prototype.push=pU;Nl.prototype.has=fU;Nw.exports=Nl});var Iw=g((kQ,Dw)=>{function mU(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}Dw.exports=mU});var Pw=g((MQ,_w)=>{function hU(e,t){return e.has(t)}_w.exports=hU});var vp=g((UQ,Tw)=>{var gU=Ew(),vU=Iw(),bU=Pw(),yU=1,wU=2;function AU(e,t,r,n,i,a){var o=r&yU,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,m=r&wU?new gU:void 0;for(a.set(e,t),a.set(t,e);++d<s;){var h=e[d],w=t[d];if(n)var y=o?n(w,h,d,t,e,a):n(h,w,d,e,t,a);if(y!==void 0){if(y)continue;p=!1;break}if(m){if(!vU(t,function(N,D){if(!bU(m,D)&&(h===N||i(h,N,r,n,a)))return m.push(D)})){p=!1;break}}else if(!(h===w||i(h,w,r,n,a))){p=!1;break}}return a.delete(e),a.delete(t),p}Tw.exports=AU});var bp=g((BQ,Ow)=>{var CU=tr(),SU=CU.Uint8Array;Ow.exports=SU});var xw=g(($Q,Rw)=>{function NU(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}Rw.exports=NU});var Lw=g((qQ,Fw)=>{function EU(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}Fw.exports=EU});var $w=g((VQ,Bw)=>{var kw=Ao(),Mw=bp(),DU=$i(),IU=vp(),_U=xw(),PU=Lw(),TU=1,OU=2,RU="[object Boolean]",xU="[object Date]",FU="[object Error]",LU="[object Map]",kU="[object Number]",MU="[object RegExp]",UU="[object Set]",BU="[object String]",$U="[object Symbol]",qU="[object ArrayBuffer]",VU="[object DataView]",Uw=kw?kw.prototype:void 0,yp=Uw?Uw.valueOf:void 0;function GU(e,t,r,n,i,a,o){switch(r){case VU:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case qU:return!(e.byteLength!=t.byteLength||!a(new Mw(e),new Mw(t)));case RU:case xU:case kU:return DU(+e,+t);case FU:return e.name==t.name&&e.message==t.message;case MU:case BU:return e==t+"";case LU:var s=_U;case UU:var l=n&TU;if(s||(s=PU),e.size!=t.size&&!l)return!1;var u=o.get(e);if(u)return u==t;n|=OU,o.set(e,t);var c=IU(s(e),s(t),n,i,a,o);return o.delete(e),c;case $U:if(yp)return yp.call(e)==yp.call(t)}return!1}Bw.exports=GU});var Vw=g((GQ,qw)=>{function zU(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}qw.exports=zU});var hn=g((zQ,Gw)=>{var WU=Array.isArray;Gw.exports=WU});var Ww=g((WQ,zw)=>{var jU=Vw(),HU=hn();function QU(e,t,r){var n=t(e);return HU(e)?n:jU(n,r(e))}zw.exports=QU});var Hw=g((jQ,jw)=>{function JU(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=JU});var Jw=g((HQ,Qw)=>{function XU(){return[]}Qw.exports=XU});var Yw=g((QQ,Kw)=>{var KU=Hw(),YU=Jw(),ZU=Object.prototype,eB=ZU.propertyIsEnumerable,Xw=Object.getOwnPropertySymbols,tB=Xw?function(e){return e==null?[]:(e=Object(e),KU(Xw(e),function(t){return eB.call(e,t)}))}:YU;Kw.exports=tB});var eA=g((JQ,Zw)=>{function rB(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}Zw.exports=rB});var gn=g((XQ,tA)=>{function nB(e){return e!=null&&typeof e=="object"}tA.exports=nB});var nA=g((KQ,rA)=>{var iB=Qn(),aB=gn(),oB="[object Arguments]";function sB(e){return aB(e)&&iB(e)==oB}rA.exports=sB});var wp=g((YQ,oA)=>{var iA=nA(),lB=gn(),aA=Object.prototype,uB=aA.hasOwnProperty,cB=aA.propertyIsEnumerable,dB=iA((function(){return arguments})())?iA:function(e){return lB(e)&&uB.call(e,"callee")&&!cB.call(e,"callee")};oA.exports=dB});var lA=g((ZQ,sA)=>{function pB(){return!1}sA.exports=pB});var El=g((Eo,Wi)=>{var fB=tr(),mB=lA(),dA=typeof Eo=="object"&&Eo&&!Eo.nodeType&&Eo,uA=dA&&typeof Wi=="object"&&Wi&&!Wi.nodeType&&Wi,hB=uA&&uA.exports===dA,cA=hB?fB.Buffer:void 0,gB=cA?cA.isBuffer:void 0,vB=gB||mB;Wi.exports=vB});var Dl=g((eJ,pA)=>{var bB=9007199254740991,yB=/^(?:0|[1-9]\d*)$/;function wB(e,t){var r=typeof e;return t=t??bB,!!t&&(r=="number"||r!="symbol"&&yB.test(e))&&e>-1&&e%1==0&&e<t}pA.exports=wB});var Ap=g((tJ,fA)=>{var AB=9007199254740991;function CB(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=AB}fA.exports=CB});var hA=g((rJ,mA)=>{var SB=Qn(),NB=Ap(),EB=gn(),DB="[object Arguments]",IB="[object Array]",_B="[object Boolean]",PB="[object Date]",TB="[object Error]",OB="[object Function]",RB="[object Map]",xB="[object Number]",FB="[object Object]",LB="[object RegExp]",kB="[object Set]",MB="[object String]",UB="[object WeakMap]",BB="[object ArrayBuffer]",$B="[object DataView]",qB="[object Float32Array]",VB="[object Float64Array]",GB="[object Int8Array]",zB="[object Int16Array]",WB="[object Int32Array]",jB="[object Uint8Array]",HB="[object Uint8ClampedArray]",QB="[object Uint16Array]",JB="[object Uint32Array]",fe={};fe[qB]=fe[VB]=fe[GB]=fe[zB]=fe[WB]=fe[jB]=fe[HB]=fe[QB]=fe[JB]=!0;fe[DB]=fe[IB]=fe[BB]=fe[_B]=fe[$B]=fe[PB]=fe[TB]=fe[OB]=fe[RB]=fe[xB]=fe[FB]=fe[LB]=fe[kB]=fe[MB]=fe[UB]=!1;function XB(e){return EB(e)&&NB(e.length)&&!!fe[SB(e)]}mA.exports=XB});var vA=g((nJ,gA)=>{function KB(e){return function(t){return e(t)}}gA.exports=KB});var yA=g((Do,ji)=>{var YB=fp(),bA=typeof Do=="object"&&Do&&!Do.nodeType&&Do,Io=bA&&typeof ji=="object"&&ji&&!ji.nodeType&&ji,ZB=Io&&Io.exports===bA,Cp=ZB&&YB.process,e$=(function(){try{var e=Io&&Io.require&&Io.require("util").types;return e||Cp&&Cp.binding&&Cp.binding("util")}catch{}})();ji.exports=e$});var Il=g((iJ,CA)=>{var t$=hA(),r$=vA(),wA=yA(),AA=wA&&wA.isTypedArray,n$=AA?r$(AA):t$;CA.exports=n$});var Sp=g((aJ,SA)=>{var i$=eA(),a$=wp(),o$=hn(),s$=El(),l$=Dl(),u$=Il(),c$=Object.prototype,d$=c$.hasOwnProperty;function p$(e,t){var r=o$(e),n=!r&&a$(e),i=!r&&!n&&s$(e),a=!r&&!n&&!i&&u$(e),o=r||n||i||a,s=o?i$(e.length,String):[],l=s.length;for(var u in e)(t||d$.call(e,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||l$(u,l)))&&s.push(u);return s}SA.exports=p$});var _l=g((oJ,NA)=>{var f$=Object.prototype;function m$(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||f$;return e===r}NA.exports=m$});var Np=g((sJ,EA)=>{function h$(e,t){return function(r){return e(t(r))}}EA.exports=h$});var IA=g((lJ,DA)=>{var g$=Np(),v$=g$(Object.keys,Object);DA.exports=v$});var PA=g((uJ,_A)=>{var b$=_l(),y$=IA(),w$=Object.prototype,A$=w$.hasOwnProperty;function C$(e){if(!b$(e))return y$(e);var t=[];for(var r in Object(e))A$.call(e,r)&&r!="constructor"&&t.push(r);return t}_A.exports=C$});var _o=g((cJ,TA)=>{var S$=Al(),N$=Ap();function E$(e){return e!=null&&N$(e.length)&&!S$(e)}TA.exports=E$});var RA=g((dJ,OA)=>{var D$=Sp(),I$=PA(),_$=_o();function P$(e){return _$(e)?D$(e):I$(e)}OA.exports=P$});var FA=g((pJ,xA)=>{var T$=Ww(),O$=Yw(),R$=RA();function x$(e){return T$(e,R$,O$)}xA.exports=x$});var MA=g((fJ,kA)=>{var LA=FA(),F$=1,L$=Object.prototype,k$=L$.hasOwnProperty;function M$(e,t,r,n,i,a){var o=r&F$,s=LA(e),l=s.length,u=LA(t),c=u.length;if(l!=c&&!o)return!1;for(var d=l;d--;){var p=s[d];if(!(o?p in t:k$.call(t,p)))return!1}var m=a.get(e),h=a.get(t);if(m&&h)return m==t&&h==e;var w=!0;a.set(e,t),a.set(t,e);for(var y=o;++d<l;){p=s[d];var N=e[p],D=t[p];if(n)var x=o?n(D,N,p,t,e,a):n(N,D,p,e,t,a);if(!(x===void 0?N===D||i(N,D,r,n,a):x)){w=!1;break}y||(y=p=="constructor")}if(w&&!y){var F=e.constructor,q=t.constructor;F!=q&&"constructor"in e&&"constructor"in t&&!(typeof F=="function"&&F instanceof F&&typeof q=="function"&&q instanceof q)&&(w=!1)}return a.delete(e),a.delete(t),w}kA.exports=M$});var BA=g((mJ,UA)=>{var U$=mn(),B$=tr(),$$=U$(B$,"DataView");UA.exports=$$});var qA=g((hJ,$A)=>{var q$=mn(),V$=tr(),G$=q$(V$,"Promise");$A.exports=G$});var GA=g((gJ,VA)=>{var z$=mn(),W$=tr(),j$=z$(W$,"Set");VA.exports=j$});var WA=g((vJ,zA)=>{var H$=mn(),Q$=tr(),J$=H$(Q$,"WeakMap");zA.exports=J$});var ZA=g((bJ,YA)=>{var Ep=BA(),Dp=Cl(),Ip=qA(),_p=GA(),Pp=WA(),KA=Qn(),Hi=hp(),jA="[object Map]",X$="[object Object]",HA="[object Promise]",QA="[object Set]",JA="[object WeakMap]",XA="[object DataView]",K$=Hi(Ep),Y$=Hi(Dp),Z$=Hi(Ip),eq=Hi(_p),tq=Hi(Pp),Jn=KA;(Ep&&Jn(new Ep(new ArrayBuffer(1)))!=XA||Dp&&Jn(new Dp)!=jA||Ip&&Jn(Ip.resolve())!=HA||_p&&Jn(new _p)!=QA||Pp&&Jn(new Pp)!=JA)&&(Jn=function(e){var t=KA(e),r=t==X$?e.constructor:void 0,n=r?Hi(r):"";if(n)switch(n){case K$:return XA;case Y$:return jA;case Z$:return HA;case eq:return QA;case tq:return JA}return t});YA.exports=Jn});var sC=g((yJ,oC)=>{var Tp=gp(),rq=vp(),nq=$w(),iq=MA(),eC=ZA(),tC=hn(),rC=El(),aq=Il(),oq=1,nC="[object Arguments]",iC="[object Array]",Pl="[object Object]",sq=Object.prototype,aC=sq.hasOwnProperty;function lq(e,t,r,n,i,a){var o=tC(e),s=tC(t),l=o?iC:eC(e),u=s?iC:eC(t);l=l==nC?Pl:l,u=u==nC?Pl:u;var c=l==Pl,d=u==Pl,p=l==u;if(p&&rC(e)){if(!rC(t))return!1;o=!0,c=!1}if(p&&!c)return a||(a=new Tp),o||aq(e)?rq(e,t,r,n,i,a):nq(e,t,l,r,n,i,a);if(!(r&oq)){var m=c&&aC.call(e,"__wrapped__"),h=d&&aC.call(t,"__wrapped__");if(m||h){var w=m?e.value():e,y=h?t.value():t;return a||(a=new Tp),i(w,y,r,n,a)}}return p?(a||(a=new Tp),iq(e,t,r,n,i,a)):!1}oC.exports=lq});var dC=g((wJ,cC)=>{var uq=sC(),lC=gn();function uC(e,t,r,n,i){return e===t?!0:e==null||t==null||!lC(e)&&!lC(t)?e!==e&&t!==t:uq(e,t,r,n,uC,i)}cC.exports=uC});var fC=g((AJ,pC)=>{var cq=dC();function dq(e,t){return cq(e,t)}pC.exports=dq});var Op=g((CJ,mC)=>{var pq=mn(),fq=(function(){try{var e=pq(Object,"defineProperty");return e({},"",{}),e}catch{}})();mC.exports=fq});var Tl=g((SJ,gC)=>{var hC=Op();function mq(e,t,r){t=="__proto__"&&hC?hC(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}gC.exports=mq});var Rp=g((NJ,vC)=>{var hq=Tl(),gq=$i();function vq(e,t,r){(r!==void 0&&!gq(e[t],r)||r===void 0&&!(t in e))&&hq(e,t,r)}vC.exports=vq});var yC=g((EJ,bC)=>{function bq(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=bq});var AC=g((DJ,wC)=>{var yq=yC(),wq=yq();wC.exports=wq});var DC=g((Po,Qi)=>{var Aq=tr(),EC=typeof Po=="object"&&Po&&!Po.nodeType&&Po,CC=EC&&typeof Qi=="object"&&Qi&&!Qi.nodeType&&Qi,Cq=CC&&CC.exports===EC,SC=Cq?Aq.Buffer:void 0,NC=SC?SC.allocUnsafe:void 0;function Sq(e,t){if(t)return e.slice();var r=e.length,n=NC?NC(r):new e.constructor(r);return e.copy(n),n}Qi.exports=Sq});var PC=g((IJ,_C)=>{var IC=bp();function Nq(e){var t=new e.constructor(e.byteLength);return new IC(t).set(new IC(e)),t}_C.exports=Nq});var OC=g((_J,TC)=>{var Eq=PC();function Dq(e,t){var r=t?Eq(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}TC.exports=Dq});var xC=g((PJ,RC)=>{function Iq(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}RC.exports=Iq});var kC=g((TJ,LC)=>{var _q=Vr(),FC=Object.create,Pq=(function(){function e(){}return function(t){if(!_q(t))return{};if(FC)return FC(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}})();LC.exports=Pq});var xp=g((OJ,MC)=>{var Tq=Np(),Oq=Tq(Object.getPrototypeOf,Object);MC.exports=Oq});var BC=g((RJ,UC)=>{var Rq=kC(),xq=xp(),Fq=_l();function Lq(e){return typeof e.constructor=="function"&&!Fq(e)?Rq(xq(e)):{}}UC.exports=Lq});var qC=g((xJ,$C)=>{var kq=_o(),Mq=gn();function Uq(e){return Mq(e)&&kq(e)}$C.exports=Uq});var zC=g((FJ,GC)=>{var Bq=Qn(),$q=xp(),qq=gn(),Vq="[object Object]",Gq=Function.prototype,zq=Object.prototype,VC=Gq.toString,Wq=zq.hasOwnProperty,jq=VC.call(Object);function Hq(e){if(!qq(e)||Bq(e)!=Vq)return!1;var t=$q(e);if(t===null)return!0;var r=Wq.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&VC.call(r)==jq}GC.exports=Hq});var Fp=g((LJ,WC)=>{function Qq(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}WC.exports=Qq});var Lp=g((kJ,jC)=>{var Jq=Tl(),Xq=$i(),Kq=Object.prototype,Yq=Kq.hasOwnProperty;function Zq(e,t,r){var n=e[t];(!(Yq.call(e,t)&&Xq(n,r))||r===void 0&&!(t in e))&&Jq(e,t,r)}jC.exports=Zq});var QC=g((MJ,HC)=>{var e3=Lp(),t3=Tl();function r3(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?t3(r,s,l):e3(r,s,l)}return r}HC.exports=r3});var XC=g((UJ,JC)=>{function n3(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}JC.exports=n3});var YC=g((BJ,KC)=>{var i3=Vr(),a3=_l(),o3=XC(),s3=Object.prototype,l3=s3.hasOwnProperty;function u3(e){if(!i3(e))return o3(e);var t=a3(e),r=[];for(var n in e)n=="constructor"&&(t||!l3.call(e,n))||r.push(n);return r}KC.exports=u3});var kp=g(($J,ZC)=>{var c3=Sp(),d3=YC(),p3=_o();function f3(e){return p3(e)?c3(e,!0):d3(e)}ZC.exports=f3});var tS=g((qJ,eS)=>{var m3=QC(),h3=kp();function g3(e){return m3(e,h3(e))}eS.exports=g3});var sS=g((VJ,oS)=>{var rS=Rp(),v3=DC(),b3=OC(),y3=xC(),w3=BC(),nS=wp(),iS=hn(),A3=qC(),C3=El(),S3=Al(),N3=Vr(),E3=zC(),D3=Il(),aS=Fp(),I3=tS();function _3(e,t,r,n,i,a,o){var s=aS(e,r),l=aS(t,r),u=o.get(l);if(u){rS(e,r,u);return}var c=a?a(s,l,r+"",e,t,o):void 0,d=c===void 0;if(d){var p=iS(l),m=!p&&C3(l),h=!p&&!m&&D3(l);c=l,p||m||h?iS(s)?c=s:A3(s)?c=y3(s):m?(d=!1,c=v3(l,!0)):h?(d=!1,c=b3(l,!0)):c=[]:E3(l)||nS(l)?(c=s,nS(s)?c=I3(s):(!N3(s)||S3(s))&&(c=w3(l))):d=!1}d&&(o.set(l,c),i(c,l,n,a,o),o.delete(l)),rS(e,r,c)}oS.exports=_3});var Mp=g((GJ,uS)=>{var P3=gp(),T3=Rp(),O3=AC(),R3=sS(),x3=Vr(),F3=kp(),L3=Fp();function lS(e,t,r,n,i){e!==t&&O3(t,function(a,o){if(i||(i=new P3),x3(a))R3(e,t,o,r,lS,n,i);else{var s=n?n(L3(e,o),a,o+"",e,t,i):void 0;s===void 0&&(s=a),T3(e,o,s)}},F3)}uS.exports=lS});var Up=g((zJ,cS)=>{function k3(e){return e}cS.exports=k3});var pS=g((WJ,dS)=>{function M3(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)}dS.exports=M3});var hS=g((jJ,mS)=>{var U3=pS(),fS=Math.max;function B3(e,t,r){return t=fS(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,a=fS(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),U3(e,this,s)}}mS.exports=B3});var vS=g((HJ,gS)=>{function $3(e){return function(){return e}}gS.exports=$3});var wS=g((QJ,yS)=>{var q3=vS(),bS=Op(),V3=Up(),G3=bS?function(e,t){return bS(e,"toString",{configurable:!0,enumerable:!1,value:q3(t),writable:!0})}:V3;yS.exports=G3});var CS=g((JJ,AS)=>{var z3=800,W3=16,j3=Date.now;function H3(e){var t=0,r=0;return function(){var n=j3(),i=W3-(n-r);if(r=n,i>0){if(++t>=z3)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}AS.exports=H3});var NS=g((XJ,SS)=>{var Q3=wS(),J3=CS(),X3=J3(Q3);SS.exports=X3});var DS=g((KJ,ES)=>{var K3=Up(),Y3=hS(),Z3=NS();function e4(e,t){return Z3(Y3(e,t,K3),e+"")}ES.exports=e4});var _S=g((YJ,IS)=>{var t4=$i(),r4=_o(),n4=Dl(),i4=Vr();function a4(e,t,r){if(!i4(r))return!1;var n=typeof t;return(n=="number"?r4(r)&&n4(t,r.length):n=="string"&&t in r)?t4(r[t],e):!1}IS.exports=a4});var Bp=g((ZJ,PS)=>{var o4=DS(),s4=_S();function l4(e){return o4(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&&s4(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=l4});var OS=g((eX,TS)=>{var u4=Mp(),c4=Bp(),d4=c4(function(e,t,r,n){u4(e,t,r,n)});TS.exports=d4});var Lt,To=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"})(Lt||(Lt={}))});function xS(e,t,r="PROD"){let n=i=>`ShellSettings_ECS_ClientCache_${e}_${RS.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 RS,p4,FS=I(()=>{"use strict";RS=le(pp()),p4=le(dp());});var $p,LS=I(()=>{"use strict";ll();$p=po({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 MS,US,BS,$S,qp,f4,Ol,kS,Vp=I(()=>{"use strict";MS=le(dp()),US=le(jb()),BS=le(pp()),$S=le(fC()),qp=le(OS());To();FS();LS();f4=60*1e3,Ol=class{clientName;logger;ecsEndpoint;resolveLoadingPromise;loadingPromise=new Promise(t=>this.resolveLoadingPromise=t);_status=Lt.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"?$p.prodEcsEndpoint:$p.integrationEcsEndpoint}client=new US.default;init=async({clientVersion:t,getFilters:r,cacheStorage:n=MS.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:[BS.EcsConfigType.Default],hosts:[this.ecsEndpoint],initialAppActiveState:!0,getEcsParameters:o,databaseInterface:xS(this.clientName,n,this.endpointType),...a}),this.client.requestUpdate(),this._status===Lt.NotLoaded&&(this._status=Lt.Initialized)}catch(s){this._status=Lt.Error,this.resolveLoadingPromise(),this.logEvent("FeaturesClient/initializationFailed",{ecsClientName:this.clientName,error:s},"Error")}i&&window.setInterval(()=>this.client.requestUpdate(),i*f4)};getConfig=t=>{let r=this.getMergedClientConfigByTeamName(t.teamName),n=r?t.extractConfig(r):{};return(0,qp.default)({},t.fallback,n,t.override,kS)};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,$S.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,qp.default)({},this.client.getConfig()?.config,this.clientConfigOverride,kS);getMergedClientConfigByTeamName=t=>this.getMergedClientConfig()?.[t];handleConfigUpdated=()=>{let t=this.client.getConfig();if(t===void 0)return;this.resolveLoadingPromise(),this._status=Lt.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})}},kS=(e,t)=>{if(Array.isArray(t))return t}});var VS=g((uX,qS)=>{"use strict";var m4=()=>{let e={};return e.promise=new Promise((t,r)=>{e.resolve=t,e.reject=r}),e};qS.exports=m4});var Gp=g((cX,zS)=>{var Oo=new Proxy(function(){return Oo},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:Oo},apply:function(){return Oo},construct:function(){return{}}}),GS=function(){return Oo};Object.setPrototypeOf(GS,Oo);zS.exports=GS});var HS=g((dX,jS)=>{var Ro=new Proxy(function(){return Ro},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:Ro},apply:function(){return Ro},construct:function(){return{}}}),WS=function(){return Ro};Object.setPrototypeOf(WS,Ro);jS.exports=WS});var eN=g((pX,ZS)=>{"use strict";var zp=HS(),h4={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},g4={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},v4={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},KS={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Wp={};Wp[zp.ForwardRef]=v4;Wp[zp.Memo]=KS;function QS(e){return zp.isMemo(e)?KS:Wp[e.$$typeof]||h4}var b4=Object.defineProperty,y4=Object.getOwnPropertyNames,JS=Object.getOwnPropertySymbols,w4=Object.getOwnPropertyDescriptor,A4=Object.getPrototypeOf,XS=Object.prototype;function YS(e,t,r){if(typeof t!="string"){if(XS){var n=A4(t);n&&n!==XS&&YS(e,n,r)}var i=y4(t);JS&&(i=i.concat(JS(t)));for(var a=QS(e),o=QS(t),s=0;s<i.length;++s){var l=i[s];if(!g4[l]&&!(r&&r[l])&&!(o&&o[l])&&!(a&&a[l])){var u=w4(t,l);try{b4(e,l,u)}catch{}}}}return e}ZS.exports=YS});function rN(e,t,r){let[n,i]=(0,Ji.useState)(e.getConfig(t));return(0,Ji.useEffect)(()=>{if(!r?.subscribe&&e.status===Lt.ConfigsLoaded)return;let a=e.subscribe(t,o=>{i(o),r?.subscribe||a.unsubscribe()});return a?.unsubscribe},[]),n}function nN(e){return function(t,r){return rN(e,t,r)}}function iN(e,t,r,n){let i=a=>{let o=rN(e,t,n),s={...a,...o};return Ji.default.createElement(r,{...s})};return(0,tN.default)(i,r),i.displayName=`WithFeature(${r.name})`,i}function aN(e,t,r,n){return t.reduce((i,a)=>iN(e,a,i,n),r)}function oN(e){return function(t,r,n){return iN(e,t,r,n)}}var tN,Ji,jp=I(()=>{"use strict";tN=le(eN()),Ji=le(Gp());To();});var lN=g((hX,sN)=>{var C4=Mp(),S4=Bp(),N4=S4(function(e,t,r){C4(e,t,r)});sN.exports=N4});var Rl=g((gX,uN)=>{var E4=Qn(),D4=gn(),I4="[object Symbol]";function _4(e){return typeof e=="symbol"||D4(e)&&E4(e)==I4}uN.exports=_4});var dN=g((vX,cN)=>{var P4=hn(),T4=Rl(),O4=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,R4=/^\w*$/;function x4(e,t){if(P4(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||T4(e)?!0:R4.test(e)||!O4.test(e)||t!=null&&e in Object(t)}cN.exports=x4});var mN=g((bX,fN)=>{var pN=Sl(),F4="Expected a function";function Hp(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(F4);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(Hp.Cache||pN),r}Hp.Cache=pN;fN.exports=Hp});var gN=g((yX,hN)=>{var L4=mN(),k4=500;function M4(e){var t=L4(e,function(n){return r.size===k4&&r.clear(),n}),r=t.cache;return t}hN.exports=M4});var bN=g((wX,vN)=>{var U4=gN(),B4=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,$4=/\\(\\)?/g,q4=U4(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(B4,function(r,n,i,a){t.push(i?a.replace($4,"$1"):n||r)}),t});vN.exports=q4});var wN=g((AX,yN)=>{function V4(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}yN.exports=V4});var DN=g((CX,EN)=>{var AN=Ao(),G4=wN(),z4=hn(),W4=Rl(),j4=1/0,CN=AN?AN.prototype:void 0,SN=CN?CN.toString:void 0;function NN(e){if(typeof e=="string")return e;if(z4(e))return G4(e,NN)+"";if(W4(e))return SN?SN.call(e):"";var t=e+"";return t=="0"&&1/e==-j4?"-0":t}EN.exports=NN});var _N=g((SX,IN)=>{var H4=DN();function Q4(e){return e==null?"":H4(e)}IN.exports=Q4});var TN=g((NX,PN)=>{var J4=hn(),X4=dN(),K4=bN(),Y4=_N();function Z4(e,t){return J4(e)?e:X4(e,t)?[e]:K4(Y4(e))}PN.exports=Z4});var RN=g((EX,ON)=>{var e5=Rl(),t5=1/0;function r5(e){if(typeof e=="string"||e5(e))return e;var t=e+"";return t=="0"&&1/e==-t5?"-0":t}ON.exports=r5});var LN=g((DX,FN)=>{var n5=Lp(),i5=TN(),a5=Dl(),xN=Vr(),o5=RN();function s5(e,t,r,n){if(!xN(e))return e;t=i5(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var l=o5(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=xN(c)?c:a5(t[i+1])?[]:{})}n5(s,l,u),s=s[l]}return e}FN.exports=s5});var MN=g((IX,kN)=>{var l5=LN();function u5(e,t,r){return e==null?e:l5(e,t,r)}kN.exports=u5});function qN(e){let{query:t}=(0,$N.default)(window.location.href,!0);return d5(e,t),e}function d5(e,t){let r=c5+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+VN,u={};if(a===r)u=s;else if(a.startsWith(l)){let c=a.substring(l.length);(0,BN.default)(u,c,s)}(0,UN.default)(i,u)}catch{}}),Object.keys(i).length>0&&e.overrideClientConfig(i)}var UN,BN,$N,VN,c5,GN=I(()=>{"use strict";UN=le(lN()),BN=le(MN()),$N=le(Yd());VN=".",c5="ecs"+VN});function Fl(e,t,r){let n=qN(new Ol(e,t,r));function i(a){(0,xl.useEffect)(()=>{n.init(a)},[])}return{featuresClient:n,createFeature:f5(n),useFeaturesClientInitParams:i,withFeatures:(a,o,s)=>aN(n,a,o,s)}}function f5(e){let t=nN(e),r=oN(e);return function(i){let a=qb(i);return a.getConfig=()=>e.getConfig(a),a.isLoaded=()=>e.status===Lt.ConfigsLoaded,tp.register(a,e.clientName),{useFeature:o=>t(a,o),withFeature:(o,s)=>r(a,o,s),feature:a}}}var p5,xl,Qp=I(()=>{"use strict";p5=le(VS()),xl=le(Gp());cp();Vp();To();jp();GN();rp();});var zN=I(()=>{"use strict";cp();Vp();Qp();To();jp();pl();np();});function Ll(e){return{logEvent:(t,r,n)=>{switch(n){case"Error":(0,Xi.trackErrorTrace)(e,{eventName:t,eventData:r});break;case"Warning":(0,Xi.trackWarningTrace)(e,{eventName:t,eventData:r});break;default:(0,Xi.trackInfoTrace)(e,{eventName:t,eventData:r});break}}}}var Xi,Jp=I(()=>{"use strict";Xi=le(qn());});var HX,QX,JX,WN=I(()=>{"use strict";zN();Jp();({featuresClient:HX,createFeature:QX,useFeaturesClientInitParams:JX}=Fl("PowerApps-Shell-Test",Ll("shell-features")))});var QN=g((KX,HN)=>{var xo=new Proxy(function(){return xo},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:xo},apply:function(){return xo},construct:function(){return{}}}),jN=function(){return xo};Object.setPrototypeOf(jN,xo);HN.exports=jN});var m5,h5,JN=I(()=>{"use strict";lo();m5=le(QN()),h5=le(qn());});var XN=I(()=>{"use strict";WN();Jp();JN();});var oK,Ki,sK,KN=I(()=>{"use strict";XN();Qp();({featuresClient:oK,createFeature:Ki,useFeaturesClientInitParams:sK}=Fl("PowerApps-MakerPortal",Ll("powerapps-features")))});var YN,ZN,dK,pK,fK,mK,Xp=I(()=>{"use strict";$b();KN();({feature:YN}=Ki({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:Bi.enableAutoInsertionOfCellInRow}})),{feature:ZN}=Ki({teamName:"MakerPortal",owners:["aansu"],description:"Enable the one grid events for form designer",createdOn:"08/21/2024",fallback:{enableOneGridEventsForFormDesigner:Bi.enableOneGridEvents}}),{feature:dK}=Ki({teamName:"MakerPortal",owners:["adekulkarni"],description:"Disables PBI components and cleans them up from the form",createdOn:"01/03/2023",fallback:{enableFallbackFormTemplate:Bi.disablePBIComponents}}),{feature:pK}=Ki({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:Bi.enableAgentResponse}}),{feature:fK,useFeature:mK}=Ki({teamName:"MakerPortal",owners:["aansu"],description:"Enables delayed localization of custom control",createdOn:"06/08/2025",fallback:{enableDelayedLocalizationForCustomControls:Bi.enableDelayedLocalizationForCustomControls}})});var rE=g((gK,tE)=>{var Fo=new Proxy(function(){return Fo},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:Fo},apply:function(){return Fo},construct:function(){return{}}}),eE=function(){return Fo};Object.setPrototypeOf(eE,Fo);tE.exports=eE});var it,vn=I(()=>{"use strict";Le();Re();nt();yl();X();We();it=class extends j{static HighestUsedIndexByClass=new Map;get colspan(){let t=this.getProperty(f.colspan);return E.IsNullOrUndefined(t)?null:parseInt(t,10)}set colspan(t){E.IsNullOrUndefined(t)||this.setProperty(f.colspan,String(t))}constructor(t,r){super(t,r)}get id(){let t=this.getProperty(f.id);return t==null?null:t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?new P(t.substr(1,t.length-2)):new P(t)}set id(t){this.setProperty(f.id,`{${t.ToString()}}`)}set labelId(t){this.setProperty(f.labelId,`{${t.ToString()}}`)}get labelId(){let t=this.getProperty(f.labelId);return t&&t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?new P(t.substr(1,t.length-2)):new P(t)}get Name(){return this.getProperty(f.Name)}set Name(t){this.setProperty(f.Name,t)}setDisplayName(t,r){for(let i of this.getAllLabels())if(+i.getProperty(f.languagecode)===r){i.setProperty(f.description,t);return}let n=new j(v.formLabel,null);n.setProperty(f.description,t),n.setProperty(f.languagecode,String(r)),this.addGrandChild("labels",n)}getDisplayName(t){for(let r of this.getAllLabels())if(+r.getProperty(f.languagecode)===t)return r.getProperty(f.description)}getAllLabels(){let t=this.getChildren("labels");return t.length!==1?[]:t[0].getChildren("label")}get isLocked(){return+this.getProperty(f.locklevel)==1}set isLocked(t){!this.IsUnboundControl&&this.setProperty(f.locklevel,t?"1":"0")}get availableforphone(){return this.getProcessedValue(f.availableforphone)}set availableforphone(t){E.IsNullOrUndefined(t)||!this.IsAllowedUBCForAvailableOnPhone()||this.setProperty(f.availableforphone,String(t))}get visible(){return this.getProcessedValue(f.visible)}set visible(t){E.IsNullOrUndefined(t)||!this.IsAllowedUBCForVisibleByDefault()||this.setProperty(f.visible,String(t))}isLockLevelSettable(){return!this.IsUnboundControl}get showlabel(){return this.getProcessedValue(f.showlabel)}set showlabel(t){E.IsNullOrUndefined(t)||this.setProperty(f.showlabel,String(t))}isAvailableForPhoneSettable(){return this.IsAllowedUBCForAvailableOnPhone()}isVisibleSettable(){return this.IsAllowedUBCForVisibleByDefault()}getProcessedValue(t){let r=this.getProperty(t);return E.IsNullOrUndefined(r)||this.getProperty(t)==="true"}get readonly(){let t=this.getFirstChild(v.formControl);return t?t.disabled:!1}set readonly(t){let r=this.getFirstChild(v.formControl);r&&(r.disabled=t)}get allowfilteroff(){let t=this.getFirstChild(v.formControl);if(t)return t.getParam(f.AllowFilterOff)==="true"}set allowfilteroff(t){let r=this.getFirstChild(v.formControl);r&&!this.IsUnboundControl&&r.setParameter(f.AllowFilterOff,t)}get autoresolve(){let t=this.getFirstChild(v.formControl);if(t)return t.getParam(f.AutoResolve)==="true"}set autoresolve(t){let r=this.getFirstChild(v.formControl);r&&!this.IsUnboundControl&&r.setParameter(f.AutoResolve,t)}get defaultviewid(){let t=this.getFirstChild(v.formControl);return t?t.getParam(f.DefaultViewId):T.EmptyString}set defaultviewid(t){let r=this.getFirstChild(v.formControl);r&&!this.IsUnboundControl&&r.setParameter(f.DefaultViewId,t)}get dependentattributename(){let t=this.getFirstChild(v.formControl);return t?t.getParam(f.DependentAttributeName):T.EmptyString}set dependentattributename(t){let r=this.getFirstChild(v.formControl);r&&!this.IsUnboundControl&&r.setParameter(f.DependentAttributeName,t)}get dependentattributetype(){let t=this.getFirstChild(v.formControl);return t?t.getParam(f.DependentAttributeType):T.EmptyString}set dependentattributetype(t){let r=this.getFirstChild(v.formControl);r&&!this.IsUnboundControl&&r.setParameter(f.DependentAttributeType,t)}get disablequickfind(){let t=this.getFirstChild(v.formControl);if(t)return t.getParam(f.DisableQuickFind)==="true"}set disablequickfind(t){let r=this.getFirstChild(v.formControl);r&&!this.IsUnboundControl&&r.setParameter(f.DisableQuickFind,t)}get disableviewpicker(){let t=this.getFirstChild(v.formControl);if(t)return t.getParam(f.DisableViewPicker)==="true"}set disableviewpicker(t){let r=this.getFirstChild(v.formControl);r&&!this.IsUnboundControl&&r.setParameter(f.DisableViewPicker,t)}get filterrelationshipname(){let t=this.getFirstChild(v.formControl);return t?t.getParam(f.FilterRelationshipName):T.EmptyString}set filterrelationshipname(t){let r=this.getFirstChild(v.formControl);r&&!this.IsUnboundControl&&r.setParameter(f.FilterRelationshipName,t)}get availableviewids(){let t=this.getFirstChild(v.formControl);return t?t.getParam(f.AvailableViewIds):T.EmptyString}set availableviewids(t){let r=this.getFirstChild(v.formControl);r&&!this.IsUnboundControl&&r.setParameter(f.AvailableViewIds,t)}get IsUnboundControl(){let t=this.getFirstChild(v.formControl);if(t&&t.ClassId){let r=Me.getUniqueIdentifierForControl(t);return!E.IsNullOrUndefined(r)&&Me.isUnboundFormControlByIdentifier(r)}else return!1}IsAllowedUBCForAvailableOnPhone(){let t=this.getFirstChild(v.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===v.formSection||this.NodeName===v.formTab}IsAllowedUBCForVisibleByDefault(){let t=this.getFirstChild(v.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(v.formEvents);return t.length===1?t[0].getAllChildren():[]}addEvent(t){this.addGrandChild(v.formEvents,t)}getUsedNodeNameSet(t){return null}getHighestIndexById(t,r){return null}}});var Yi,Kp=I(()=>{"use strict";nt();X();We();Yi=class extends j{constructor(t,r){super(v.dependency,t),T.IsNullOrEmpty(r)||this.setDefaultProperties(r)}set id(t){this.setProperty(f.id,t)}get id(){return this.getProperty(f.id)}setDefaultProperties(t){this.id=t}}});var nE,Zi,Yp=I(()=>{"use strict";Re();Kp();X();We();vn();(function(e){e[e.Form=0]="Form",e[e.Cell=1]="Cell",e[e.Tab=2]="Tab",e[e.Control=3]="Control"})(nE||(nE={}));Zi=class extends it{constructor(t,r){super(v.formEvent,t),r&&(this.eventName=r,this.application="false",this.active="false")}set eventName(t){this.setProperty(f.Name,t)}get eventName(){return this.getProperty(f.Name)}set application(t){this.setProperty(f.application,t)}get application(){return this.getProperty(f.application)}set attribute(t){this.setProperty(f.EventAttribute,t)}get attribute(){return this.getProperty(f.EventAttribute)}set relationship(t){this.setProperty(f.Relationship,t)}get relationship(){return this.getProperty(f.Relationship)}set control(t){this.setProperty(f.Control,t)}get control(){return this.getProperty(f.Control)}set active(t){this.setProperty(f.EventActive,t)}get active(){return this.getProperty(f.EventActive)}getAllHandlers(){let t=this.getChildren(v.EventHandlers);return t&&t.length?t[0].getChildren(v.handler):[]}getAllDependencies(){let t=this.getChildren(v.formDependencies);return t.length===0?[]:t[0].getAllChildren()}setDependencies(t){let r=this.getFirstChild(v.formDependencies);if(E.IsNullOrUndefined(r)){if(t.length===0)return;this.addChild(new j(v.formDependencies,this)),r=this.getFirstChild(v.formDependencies)}if(t.length===0)r.getParentNode().deleteChild(r);else{r.deleteAllChildren();for(let n of t)r.addChild(new Yi(r,n.toString()))}}}});var rr,Lo=I(()=>{"use strict";Le();so();Re();$n();X();We();Zt();rr=class extends j{previewVersion;constructor(t){super(v.formControl,t)}updatePreview(){this.previewVersion=Date.now()}get ClassId(){let t=this.getProperty(f.classid);return t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"&&(t=t.substr(1,t.length-2)),new P(t)}set ClassId(t){this.setProperty(f.classid,`{${t.ToString()}}`)}get dataFieldName(){return this.getProperty(f.datafieldname)}set dataFieldName(t){this.setProperty(f.datafieldname,t)}set id(t){this.setProperty(f.id,t)}get id(){return this.getProperty(f.id)}get UniqueId(){let t=this.getProperty(f.uniqueid);return E.IsNullOrUndefined(t)?null:(t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"&&(t=t.substr(1,t.length-2)),new P(t))}set UniqueId(t){this.setProperty(f.uniqueid,`{${t.ToString()}}`)}get isRequired(){return this.getProperty(f.isRequired)==="true"}set isRequired(t){E.IsNullOrUndefined(t)||this.setProperty(f.isRequired,String(t))}get disableMru(){return this.getParam(f.DisableMru)==="true"}set disableMru(t){E.IsNullOrUndefined(t)||this.setParameter(f.DisableMru,t)}get useMFDForCreate(){return this.getParam(f.UseMFDForCreate)==="true"}set useMFDForCreate(t){E.IsNullOrUndefined(t)||this.setParameter(f.UseMFDForCreate,t)}get useMFDForEdit(){return this.getParam(f.UseMFDForEdit)==="true"}set useMFDForEdit(t){E.IsNullOrUndefined(t)||this.setParameter(f.UseMFDForEdit,t)}get disabled(){return this.getProperty(f.disabled)==="true"}set disabled(t){E.IsNullOrUndefined(t)||this.setProperty(f.disabled,String(t))}get indicationOfSubgrid(){return this.getProperty(f.indicationOfSubgrid)==="true"}set indicationOfSubgrid(t){this.setProperty(f.indicationOfSubgrid,String(t))}getAllParameters(){let t=new ut,r=this.getFirstChild(f.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=(qr.StartTag+r).toString(),a=this.parametersNode;if(a){let o=a.findFirst(s=>s&&s.getNodeName()===t);if(o)if(n){this.deleteFirstGrandChildOfName(v.controlParameters,o);return}else{let s=o.getAllChildren();s&&s.length>0&&s[0]?s[0].setNodeName(i):o.addChild(new j(i,o))}else n||(o=new j(t,a),o.addChild(new j(i,o)),a.addChild(o))}else if(!n){a=new j("parameters",this);let o=new j(t,a);o.addChild(new j(i,o)),a.addChild(o),this.addChild(a)}}getParam(t){if(this.parametersNode){let r=this.parametersNode.findFirst(n=>n&&n.getNodeName()===t);if(r){let n=r.getAllChildren(),i=n&&n.length>0&&n[0];if(i){let a=i.getNodeName();return a.charAt(0)===qr.StartTag?a.substring(1):a}}}return null}get parametersNode(){let t=this.getChildren(f.parameters);return t.length===0?null:t[0]}async serializeParameters(t,r){let n=new ut;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(f.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 ea,Zp=I(()=>{"use strict";nt();xi();Lo();X();We();ea=class extends rr{constructor(t){super(t)}get targetEntityType(){return this.getParam(f.targetEntityType)||T.EmptyString}set targetEntityType(t){this.setParameter(f.targetEntityType,t)}get viewId(){return T.StripBraces(this.getParam(f.viewId))||T.EmptyString}set viewId(t){this.setParameter(f.viewId,T.AddBraces(t))}get viewIds(){return this.getParam(f.viewIds)||T.EmptyString}set viewIds(t){this.setParameter(f.viewIds,t)}get relationshipName(){return this.getParam(f.RelationshipName)||T.EmptyString}set relationshipName(t){this.setParameter(f.RelationshipName,t)}get isUserView(){return T.IsStrictTrue(this.getParam(f.isUserView))}set isUserView(t){this.setParameter(f.isUserView,t.toString())}get enableViewPicker(){return T.IsStrictTrue(this.getParam(f.enableViewPicker))}set enableViewPicker(t){this.setParameter(f.enableViewPicker,t)}get autoExpand(){return this.getParent().autoexpand&&this.getParam(f.autoExpand)===f.Auto}set autoExpand(t){let r=this.getParent();this.setParameter(f.autoExpand,t?f.Auto:f.Fixed),r.autoexpand=t}get recordsPerPage(){return this.getParam(f.recordsPerPage)?Number(this.getParam(f.recordsPerPage)):Number(f.RecordsPerPageRAControlDefault)}set recordsPerPage(t){this.setParameter(f.recordsPerPage,String(t))}get enableQuickFind(){return T.IsStrictTrue(this.getParam(f.enableQuickFind))}set enableQuickFind(t){this.setParameter(f.enableQuickFind,t)}get teamTemplateId(){return T.StripBraces(this.getParam(f.teamTemplateId))||T.EmptyString}set teamTemplateId(t){this.setParameter(f.teamTemplateId,T.AddBraces(t))}get chartId(){return this.getParam(f.visualizationId)||T.EmptyString}set chartId(t){this.setParameter(f.visualizationId,t)}get enableChartPicker(){return T.IsStrictTrue(this.getParam(f.enableChartPicker))}set enableChartPicker(t){this.setParameter(f.enableChartPicker,t)}get chartGridMode(){switch(this.getParam(f.chartGridMode)){case Ft.Chart:return Ft.Chart;case Ft.Grid:return Ft.Grid;default:return Ft.All}}set chartGridMode(t){this.setParameter(f.chartGridMode,t)}updateChartGridMode(t){t?this.chartGridMode=Ft.Chart:this.chartGridMode=this.enableChartPicker?Ft.All:Ft.Grid}updateDefaultProperties(t,r){for(let n of t)switch(n.getNodeName()){case f.targetEntityType:n.getAllChildren()[0].setNodeName("<"+r.targetEntityType);break;case f.viewId:n.getAllChildren()[0].setNodeName("<"+T.AddBraces(r.viewId));break;case f.isUserView:n.getAllChildren()[0].setNodeName("<"+r.isUserView);break;case f.enableViewPicker:n.getAllChildren()[0].setNodeName("<"+r.enableViewPicker);break;case f.RelationshipName:let i=n.getAllChildren(),a="<"+r.relationshipName;i.length?n.getAllChildren()[0].setNodeName(a):n.addChild(new j(a,n));break;default:break}}updateControlDescription(t){let r=t.getControlDescriptionByForControl(this.UniqueId);if(r){let n=r.customControls;for(let i=0;i<n.length;i++){let a=n[i].getParameters().get(ct.dataset)?n[i].getParameters().get(ct.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 ta,ef=I(()=>{"use strict";nt();xi();Lo();X();ta=class extends rr{constructor(t){super(t)}get defaultViewId(){return T.StripBraces(this.getParam(f.DefaultViewId))||T.EmptyString}set defaultViewId(t){this.setParameter(f.DefaultViewId,T.AddBraces(t))}get autoResolve(){return T.IsStrictTrue(this.getParam(f.AutoResolve))}set autoResolve(t){this.setParameter(f.AutoResolve,t)}get disableQuickFind(){return T.IsStrictTrue(this.getParam(f.DisableQuickFind))}set disableQuickFind(t){this.setParameter(f.DisableQuickFind,t)}get disableViewPicker(){return T.IsStrictTrue(this.getParam(f.DisableViewPicker))}set disableViewPicker(t){this.setParameter(f.DisableViewPicker,t)}get allowFilterOff(){return T.IsStrictTrue(this.getParam(f.AllowFilterOff))}set allowFilterOff(t){this.setParameter(f.AllowFilterOff,t)}get disableMru(){return T.IsStrictTrue(this.getParam(f.DisableMru))}set disableMru(t){this.setParameter(f.DisableMru,t)}get dependentAttributeName(){return this.getParam(f.DependentAttributeName)||T.EmptyString}set dependentAttributeName(t){this.setParameter(f.DependentAttributeName,t)}get dependentAttributeType(){return this.getParam(f.DependentAttributeType)||T.EmptyString}set dependentAttributeType(t){this.setParameter(f.DependentAttributeType,t)}get filterRelationshipName(){return this.getParam(f.FilterRelationshipName)||T.EmptyString}set filterRelationshipName(t){this.setParameter(f.FilterRelationshipName,t)}get availableViewIds(){return this.getParam(f.AvailableViewIds)||T.EmptyString}set availableViewIds(t){this.setParameter(f.AvailableViewIds,t)}updateDefaultProperties(t,r){for(let n of t)switch(n.getNodeName()){case f.datafieldname:case f.bindAttribute:n.getAllChildren()[0].setNodeName("<"+r.dataFieldName);break;case f.DefaultViewId:n.getAllChildren()[0].setNodeName("<"+T.AddBraces(r.defaultViewId));break;case f.AllowFilterOff:n.getAllChildren()[0].setNodeName("<"+r.allowFilterOff);break;case f.DisableQuickFind:n.getAllChildren()[0].setNodeName("<"+r.disableQuickFind);break;case f.DisableViewPicker:n.getAllChildren()[0].setNodeName("<"+r.disableViewPicker);break;case f.FilterRelationshipName:n.getAllChildren()[0].setNodeName("<"+r.filterRelationshipName);break;case f.DependentAttributeName:n.getAllChildren()[0].setNodeName("<"+r.dependentAttributeName);break;case f.DependentAttributeType:n.getAllChildren()[0].setNodeName("<"+r.dependentAttributeType);break;case f.AvailableViewIds:n.getAllChildren()[0].setNodeName("<"+r.availableViewIds);break;case f.DisableMru:n.getAllChildren()[0].setNodeName("<"+r.disableMru);break;case f.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(ct.value)?n[i].getParameters().get(ct.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 iE,tf,At,ko=I(()=>{"use strict";iE=le(rE());vn();X();Re();Le();Yp();Lo();yl();lp();$d();Zt();$n();Ti();Zp();ef();rf();mo();tf="_",At=class e extends it{fieldPlaceholder;fieldRequiredLevel;isNewField;cellColType;dependentFields=[];constructor(t){super(v.formCell,t),this.isNewField=!1}get cellType(){return this.cellColType}set cellType(t){this.cellColType=t}setDefaultProperties(t){this.showlabel=t,this.isLocked=!1,E.IsNullOrUndefined(this.getProperty(f.id))&&(this.id=new P(P.NewGuid()))}addControl(t,r,n,i,a,o,s){n instanceof rr?this.addChild(n):n instanceof P&&this.addChild(this.getControlWithControlSpecificProperties(t,r,n,i,a,o,s))}removeControl(){return this.deleteChild(this.control)>=0}get isIndependent(){if(!E.IsNullOrUndefined(this.control))return E.IsNullOrUndefined(this.control.dataFieldName)?E.IsNullOrUndefined(this.control.id)?!0:!Vn.dependencyFieldCount.containsKey(this.control.id):!Vn.dependencyFieldCount.containsKey(this.control.dataFieldName)}createOnLoadEvent(){this.addEvent(new Zi(this,ao.onLoad))}get dependencies(){let t=this.getChildren(v.formEvents);for(let r of t){let n=r.getChildren(v.formEvent);for(let i of n)this.buildDependencyList(i,this.dependentFields)}return this.dependentFields}getNextAvailableControlName(t,r,n,i){let a;if(i&&nl[i])a=nl[i].replace(/ /g,tf)+tf;else{a="Control_";let u=new Error("Control class id does not exist or is undefined");(0,iE.trackErrorTrace)(lt,{eventName:`${q0}/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,f.isUnbound,"true"),e.prototype.setProperty.call(t,f.isRequired,"false")}getControlWithControlSpecificProperties(t,r,n,i,a,o,s){let l;a===kt.Grid?(l=new ea(this),l.indicationOfSubgrid=!0):a===kt.Lookup?l=new ta(this):l=new rr(this);let u=n.guidString,c=o||this.getNextAvailableControlName(t,i,this.getUsedNodeNameSet(t),u);if(e.prototype.setProperty.call(l,f.id,c),l.ClassId=n,!E.IsNullOrUndefined(s)&&(l.UniqueId=s),!o&&r)this.getUnboundControlProperties(l);else{let d=Me.getUniqueIdentifierForControl(l);E.IsNullOrUndefined(d)||(Me.getControlDataTypeByControlOrUniqueId(d)===V.QuickFormCollectionControl||!Me.isUnboundFormControlByIdentifier(d)?a!==kt.Grid&&o&&u!==S.IframeControl&&u!==S.SubgridControl&&u!==S.ReferencePanelSubgridControl&&(l.dataFieldName=o,e.prototype.setProperty.call(l,f.disabled,"false")):(this.rowspan=Me.GetRowSpan(l),(Me.getControlDataTypeByControlOrUniqueId(d)===V.NotesControl||Me.getControlDataTypeByControlOrUniqueId(d)===V.TimeLineControl)&&(e.prototype.setProperty.call(l,f.disabled,"false"),l.id=V.NotesControl)),(Me.getUnboundControlNameFromIdentifier(n)===V.SubGridControl||Me.getUnboundControlNameFromIdentifier(n)===V.NotesControl||Me.getUnboundControlNameFromIdentifier(n)===V.TimeLineControl)&&(this.availableforphone=!0))}return l}buildDependencyList(t,r){if(E.IsNullOrUndefined(t))return;let n=t.getAllChildren();for(let i of n){let a=i.getAllChildren();for(let o of a){let s=o.GetPropertyByParameter(f.id);o.getNodeName()===v.dependency&&s?r.push(s):this.buildDependencyList(o,r)}}}get control(){return this.getFirstChild(v.formControl)}set rowspan(t){this.setProperty(f.rowspan,String(t))}get rowspan(){let t=this.getProperty(f.rowspan);return E.IsNullOrUndefined(t)?1:parseInt(t,10)}set autoexpand(t){this.setProperty(f.auto,String(t))}get autoexpand(){return this.getProperty(f.auto)==="true"}set colspan(t){let r=Number(op.ONE_COLUMN),n=Number(op.FOUR_COLUMN);E.IsNullOrUndefined(t)||t>n||t<r||this.setProperty(f.colspan,String(t))}get colspan(){let t=this.getProperty(f.colspan);return E.IsNullOrUndefined(t)?1:parseInt(t,10)}getParentRow(){return this.getAncestor(v.formRow)}getParentSection(){return this.getAncestor(v.formSection)}getParentTab(){return this.getAncestor(v.formTab)}getParentForm(){return this.getAncestor(v.form)}isInHeader(){let t=this.getAncestor(v.formHeader);return!E.IsNullOrUndefined(t)}isInFooter(){let t=this.getAncestor(v.formFooter);return!E.IsNullOrUndefined(t)}isEmpty(){return E.IsNullOrUndefined(this.control)&&!this.IsUserSpacer}getHeaderFooter(){return this.isInHeader()?this.getAncestor(v.formHeader):this.isInFooter()?this.getAncestor(v.formFooter):null}get FieldRequiredLevel(){return this.fieldRequiredLevel}set FieldRequiredLevel(t){this.fieldRequiredLevel=t}get FieldPlaceholder(){return this.fieldPlaceholder}set FieldPlaceholder(t){this.fieldPlaceholder=t}get IsNewField(){return this.isNewField}set IsNewField(t){this.isNewField=t}get IsUserSpacer(){let t=this.getProperty(f.userspacer);return E.IsNullOrUndefined(t)?!1:t==="true"}SetUserSpacer(){this.setProperty(f.userspacer,"true")}ClearUserSpacer(){this.setProperty(f.userspacer,"false")}get columns(){let t=this.getProperty(f.columnName);return E.IsNullOrUndefined(t)?null:parseInt(t,10)}getColumnLayoutValue(t){let r;switch(t){case we.TWO_COLUMN:r="11";break;case we.THREE_COLUMN:r="111";break;case we.FOUR_COLUMN:r="1111";break;default:r="1"}return r}findRowIndexByCellId(t){let r=this.getParentRow().cells.indexOf(this);for(let n=0;n<t.rows.length;n++)if(!E.IsNullOrUndefined(t.rows[n].cells[r])&&this.id.ToString()===t.rows[n].cells[r].id.ToString())return n;return-1}setAutoExpandDetailsForTab(){let t=this.getParentTab();E.IsNullOrUndefined(t)||(t.autoExpandCell=this,t.tabContainsAutoExpandControl=!0)}isCellRequiredOrLocked(t,r,n){let i=this.getParentForm();if(this?.control){if(this.IsUserSpacer)return!1;{if(this.isLocked||r().has(this.control.dataFieldName))return!0;let a=i.isDuplicateCell(this,n),o=this.getRequiredLevel(t);if((o===zn.ApplicationRequired||o===zn.SystemRequired)&&!a||this.isCellLockedByExternal(t)&&!a)return!0}}return!1}getRequiredLevel(t){return!this.control?.dataFieldName||!this.control?.id||this.IsNewField||!this.control?.ClassId?zn.None:t.getEntityAttributeByName(this.control.dataFieldName)?.requiredLevel?.toString()??zn.None}isCellLockedByExternal(t){return this.control||this.IsUnboundControl?!1:t.getEntityAttributeByName(this.control.dataFieldName).isRequiredForForm||!this.isIndependent}async toJSON(t){return{Id:this.id&&this.id.guidString,Name:this.Name,Label:this.getDisplayName(t.langCode),ShowLabel:this.showlabel,Visible:this.visible||t.formModelService.showHiddenElements,LabelId:this.labelId.guidString,PreviewId:this.id&&this.id.guidString,ColSpan:this.colspan,RowSpan:this.rowspan,AutoExpand:this.autoexpand,IsInFirstColumnOfSection:!1,IsInLastColumnOfSection:!1,AvailableForPhone:this.availableforphone,UserSpacer:this.IsUserSpacer,IsPreviewCell:!1,IsStreamCell:!1,IsChartCell:!1,IsTileCell:!1,Control:this.control&&await this.control.toJSON(t)}}getUsedNodeNameSet(t){let r=new Set;return t&&t.visit(n=>{if(n.getNodeName()===v.formCell){let i=n;i.control&&i!==this&&r.add(n.control.id)}return!1}),r}getHighestIndexById(t,r){let n=t.findAll(a=>a.getNodeName()===v.formCell&&a.control&&a.control.ClassId.guidString===r),i=0;return n.forEach(a=>{i=Math.max(this.parseControlNameIndex(a.control.id),i)}),i}parseControlNameIndex(t){let r=t.length-1,n=0;for(;r>0&&parseInt(t.charAt(r),10);)r--;return r>0&&r!==t.length-1&&t.charAt(r)===tf&&(r++,n=parseInt(t.substr(r,t.length-r),10)),n}}});var ra,nf=I(()=>{"use strict";nt();X();We();ra=class extends j{isInternal;constructor(t,r,n,i){super(v.library,t),this.isInternal=!!i,T.IsNullOrEmpty(n)||(this.name=r,this.libraryUniqueId=n)}get libraryUniqueId(){let t=this.getProperty(f.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(f.libraryUniqueId,t)}get name(){return this.getProperty(f.libraryName)}set name(t){this.setProperty(f.libraryName,t)}get displayName(){return this.getProperty(f.displayName)}set displayName(t){this.setProperty(f.displayName,t)}get description(){return this.getProperty(f.description)}set description(t){this.setProperty(f.description,t)}}});var Xn,af=I(()=>{"use strict";Re();ko();X();We();Xn=class extends j{isRowAddedOnDragOver;constructor(t){super(v.formRow,t)}addCell(t){this.addChild(t)}appendCells(t){for(let r of t)this.addChild(r)}updateCell(t,r){return this.updateChild(t,r)}removeCell(t){return E.IsNullOrUndefined(t)?!1:this.deleteChild(t)>=0}insertCellAtIndex(t,r){return E.IsNullOrUndefined(t)?!1:(this.insertChildAtIndex(t,r),!0)}isEmpty(){return!this.cells||this.cells.every(t=>t.isEmpty())}getParentSection(){return this.getAncestor(v.formSection)}insertPaddingCellAtIndex(t){let r=new At(this);r.setDefaultProperties(),this.insertCellAtIndex(r,t)}get firstCell(){let t=this.cells;return t.length>0?t[0]:null}get cells(){return this.getChildren(v.formCell)}get rowColspan(){return this.cells.reduce((t,r)=>t+r.colspan,0)}set IsRowAddedOnDragOver(t){this.isRowAddedOnDragOver=t}get IsRowAddedOnDragOver(){return this.isRowAddedOnDragOver}async getCellsJSON(t){let r=[],n=[];if(this.cells){for(let i of this.cells)n.push(i.toJSON(t));for(let i of n)r.push(await i)}return r}async toJSON(t){return{Cells:await this.getCellsJSON(t),Visible:!0,Height:"0"}}}});function g5(e){switch(e){case Wn.Left:return Hn.Left;case Wn.Right:return Hn.Right;case Wn.Center:return Hn.Center;default:return Hn.Left}}function v5(e){switch(e){case ki.Left:return Ui.Left;case ki.Top:return Ui.Top;default:return Ui.Left}}function aE(e){switch(e){case 1:return 1;case 2:return 11;case 3:return 111;case 4:return 1111;default:return 1}}var b5,vr,Mo=I(()=>{"use strict";up();Le();Re();nt();Xp();ko();X();Zt();vn();af();b5=115,vr=class e extends it{colSpan=1;constructor(t,r){super(t,r)}getSectionType(){let t;switch(this.columns){case 1:t=we.ONE_COLUMN;break;case 11:t=we.TWO_COLUMN;break;case 111:t=we.THREE_COLUMN;break;case 1111:t=we.FOUR_COLUMN;break;default:t=this.colSpan-1}return t}setUniqueName(){let t=this.getParentTab(),r=ve.namePrefix;if(t){let n=t.Name,i=t.TotalSectionsCount+1;r=n+ve.namePrefix+i.toString()}else r+=Math.floor(Math.random()*1e3);this.setProperty(f.Name,r)}initializeDefaultProperties(t,r,n){if(n===we.REFERENCE_PANEL){this.addProperty(f.rowheight,"25");let i=`${ve.referencePanelNamePrefix}${P.NewGuid()}${ve.namePrefix}`;this.addProperty(f.Name,i)}else this.setUniqueName();if(this.addProperty(f.id,new P(P.NewGuid()).guidString),this.addProperty(f.IsUserDefined,ve.IsUserDefined),this.addProperty(f.locklevel,ve.LockLevel),this.addProperty(f.showlabel,ve.ShowLabel),this.addProperty(f.showbar,ve.ShowBar),this.addProperty(f.layout,ve.Layout),this.addProperty(f.Fieldlabelalignment,ve.labelAlignment),this.addProperty(f.Fieldlabelposition,ve.labelPosition),E.IsNullOrUndefined(n))this.addProperty(f.columnName,ve.columns);else{let i=this.getColumnLayoutValue(n);this.addProperty(f.columnName,i)}this.addProperty(f.LabelWidth,ve.LabelWidth),this.setDisplayName(r,t)}getColumnLayoutValue(t){let r;switch(t){case we.TWO_COLUMN:r="11";break;case we.THREE_COLUMN:r="111";break;case we.FOUR_COLUMN:r="1111";break;default:r="1"}return r}getNumberOfColumns(){return e.getNumericColumnLayoutValue(this.columns)}static getNumericColumnLayoutValue(t){switch(t){case 1:return 1;case 11:return 2;case 111:return 3;case 1111:return 4;default:throw new Error("Unexpected Section Layout Value.")}}getColumnCountValue(){let t=0;return E.IsNullOrUndefined(this.columns)?t=this.ColSpan:this.columns.toString().split(T.EmptyString).forEach(r=>{t+=parseInt(r,10)}),t}get ColSpan(){return this.colSpan}initializeRow(t){if(t>0&&t<5){let r=new Xn(null);if(this.addGrandChild(v.formRows,r),YN.getConfig().enableAutoInsertionOfCellInRow)for(let n=0;n<t;n++){let i=new At(r);i.setDefaultProperties(!1),r.addCell(i)}}}initialize(t,r,n){this.initializeDefaultProperties(t,r,n),n===we.REFERENCE_PANEL&&(n=we.ONE_COLUMN),this.initializeRow(n+1)}setColSpan(t){this.colSpan=t}appendRow(t){this.addGrandChild(v.formRows,t)}insertRowAtIndex(t,r){this.addGrandChildAtIndex(v.formRows,t,r)}insertRowsAtIndex(t,r){if(t&&t.length>0)for(let n=0;n<t.length;n++)this.addGrandChildAtIndex(v.formRows,t[n],r+n)}indexOfRow(t){return this.rows.indexOf(t)}deleteRow(t){return this.deleteFirstGrandChildOfName(v.formRows,t)}deleteRows(t,r){this.deleteGrandChildren(v.formRows,t,r)}get rows(){return this.getRows()}getRows(){let t=this.getChildren(v.formRows);return t.length===0?[]:t[0].getChildren(v.formRow)}get columns(){let t=this.getProperty(f.columnName),r=E.IsNullOrUndefined(t)?NaN:parseInt(t,10);if(isNaN(r)){let n=1;for(let i of this.rows)n=Math.max(n,i.cells.length);return aE(n)}return r}set columns(t){E.IsNullOrUndefined(t)||this.setProperty(f.columnName,String(t))}get rowHeight(){let t=this.getProperty(f.rowheight);return E.IsNullOrUndefined(t)?null:parseInt(t,10)}set rowHeight(t){this.setProperty(f.rowheight,String(t))}set autoexpand(t){this.setProperty(f.autoExpand.toLowerCase(),String(t))}get autoexpand(){return this.getProperty(f.autoExpand.toLowerCase())==="true"}get isUserDefined(){return+this.getProperty(f.IsUserDefined)!=0}set isUserDefined(t){t?this.setProperty(f.IsUserDefined,"1"):this.setProperty(f.IsUserDefined,"0")}getParentColumn(){return this.getAncestor(v.formColumn)}getParentTab(){return this.getAncestor(v.formTab)}get hasMultiColumnRow(){return this.getColumnCountValue()>1}get showlabel(){return this.getProperty(f.showlabel)==="true"}set showlabel(t){E.IsNullOrUndefined(t)||this.setProperty(f.showlabel,String(t))}get fieldLabelAlignment(){let t=ve.labelAlignment,r=this.getProperty(f.Fieldlabelalignment);return E.IsNullOrUndefined(r)?t:r}set fieldLabelAlignment(t){E.IsNullOrUndefined(t)||this.setProperty(f.Fieldlabelalignment,t)}get fieldLabelPosition(){let t=this.getProperty(f.Fieldlabelposition);return E.IsNullOrUndefined(t)?ve.labelPosition:t}set fieldLabelPosition(t){E.IsNullOrUndefined(t)||this.setProperty(f.Fieldlabelposition,String(t))}get showbar(){return this.getProperty(f.showbar)==="true"}set showbar(t){E.IsNullOrUndefined(t)||this.setProperty(f.showbar,String(t))}get labelwidth(){let t=+this.getProperty(f.LabelWidth);return t===0?b5:t}set labelwidth(t){E.IsNullOrUndefined(t)||t>283&&t<57||this.setProperty(f.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:g5(this.fieldLabelAlignment),Position:v5(this.fieldLabelPosition)},Columns:aE(this.getColumnCountValue()),AvailableForPhone:this.availableforphone,Height:this.rowHeight&&this.rowHeight.toString()}}getUsedNodeNameSet(t){let r=new Set;return t&&t.visit(n=>{if(n.getNodeName()===v.formSection){let i=n;i.Name&&!T.GuidStringEquals(i.id.guidString,this.id.guidString)&&r.add(n.Name)}return!1}),r}isReferencePanelSection(){return!E.IsNullOrUndefined(this)&&!E.IsNullOrUndefined(this.Name)&&this.Name.indexOf(ve.referencePanelNamePrefix)===0}getAllMultiRowCells(){return this.findAll(t=>{if(t.getNodeName()===v.formCell){let r=t;return!r.isEmpty()&&r.rowspan>1}return!1})}isHeaderOrFooterSection(){return this.NodeName===v.formFooter||this.NodeName===v.formHeader}}});var bn,kl=I(()=>{"use strict";X();We();Mo();bn=class e extends j{constructor(t){super(v.formColumn,t)}initializeDefaultProperties(t){this.addProperty(f.width,t.toString()+"%")}insertSectionAtIndex(t,r){this.addGrandChildAtIndex(v.formSections,t,r)}static createAndInitNewSection(t,r,n){let i=new vr(v.formSection,null);return i.initialize(t,r,n),i}addSectionAtIndex(t,r){this.addGrandChildAtIndex(v.formSections,t,r)}initialize(t,r,n,i=we.ONE_COLUMN){this.initializeDefaultProperties(t);let a=e.createAndInitNewSection(r,n,i);this.addSectionAtIndex(a,this.sections.length),a.setUniqueName()}get parentTab(){return this.getAncestor(v.formTab)}get sections(){let t=this.getChildren("sections");return t.length!==1?[]:t[0].getChildren(v.formSection)}get width(){return this.getProperty(f.width)}set width(t){this.setProperty(f.width,t)}deleteSection(t){return this.deleteFirstGrandChildOfName(v.formSections,t)}async getSectionsJSON(t){let r=[];if(this.sections)for(let n of this.sections)r.push(await n.toJSON(t));return r}async toJSON(t){return{Name:this.getProperty(f.Name),Id:this.getProperty(f.id),Label:null,ShowLabel:!1,Visible:!0,LabelId:null,PreviewId:this.getProperty(f.id),Sections:await this.getSectionsJSON(t),Width:this.width}}}});var Ml,oE=I(()=>{"use strict";Le();X();Zt();Mo();Ml=class extends vr{initializeNavArea(t,r,n){this.initializeNavAreaProps(t,r,n)}get AreaName(){return this.Name}initializeNavAreaProps(t,r,n){this.addProperty(f.Name,n),this.addProperty(f.id,new P(P.NewGuid()).guidString),this.addProperty(f.columnName,ve.columns),this.setDisplayName(r,t)}}});var Ul,sE=I(()=>{"use strict";kl();X();oE();Ul=class extends bn{addAndIntializeNavBarSection(t,r,n,i){let a=new Ml(v.formSection,null);return a.initializeNavArea(t,r,i),this.addGrandChildAtIndex(v.formSections,a,n),a}}});var Gr,Bl=I(()=>{"use strict";Le();Re();nt();kl();X();We();vn();Gr=class extends it{tabContainsAutoExpandControl;autoExpandCell;constructor(t,r){super(v.formTab,t),this.tabContainsAutoExpandControl=!1}getParentForm(){return this.getAncestor(v.form)}getTabLayoutType(){let t;switch(this.columns.length){case 1:t=ye.ONE_COLUMN;break;case 2:if(parseInt(this.columns[0].width,10)===50&&parseInt(this.columns[1].width,10)===50){t=ye.TWO_COLUMN_EQUAL;break}if(parseInt(this.columns[0].width,10)===67&&parseInt(this.columns[1].width,10)===33){t=ye.TWO_COLUMN_WIDER_LEFT;break}if(parseInt(this.columns[0].width,10)===34&&parseInt(this.columns[1].width,10)===66){t=ye.TWO_COLUMN_WIDER_RIGHT;break}t=ye.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=ye.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=ye.THREE_COLUMN_WIDER_MID;break}t=ye.THREE_COLUMN_CUSTOM_LAYOUT;break;default:}return t}initializeProperties(t,r,n){this.addProperty(f.Name,dn.namePrefix+t.toString()),this.addProperty(f.id,new P(P.NewGuid()).guidString),this.addProperty(f.IsUserDefined,dn.IsUserDefined),this.addProperty(f.locklevel,dn.LockLevel),this.addProperty(f.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=we.ONE_COLUMN,a=!0,o){let s=this.getChildren(v.formColumns)[0],l=[];switch(t){case ye.ONE_COLUMN:l.push(100);break;case ye.TWO_COLUMN_EQUAL:l.push(50),l.push(50);break;case ye.TWO_COLUMN_WIDER_LEFT:l.push(67),l.push(33);break;case ye.TWO_COLUMN_WIDER_RIGHT:l.push(34),l.push(66);break;case ye.THREE_COLUMN_EQUAL:l.push(34),l.push(33),l.push(33);break;case ye.THREE_COLUMN_WIDER_MID:l.push(28),l.push(44),l.push(28);break;default:}for(let u of l){let c=new bn(s);c.initialize(u,r,n,i),this.addGrandChild(v.formColumns,c)}}initialize(t,r,n,i,a,o=we.ONE_COLUMN,s=!0,l){this.addChild(new j(v.formColumns,this)),this.initializeProperties(r,n,i),this.initializeColumns(t,n,a,o,s,l)}get columns(){let t=this.getChildren(v.formColumns);return t.length!==1?[]:t[0].getChildren(v.formColumn)}get expanded(){return this.getProcessedValue(f.expanded)}set expanded(t){E.IsNullOrUndefined(t)||this.setProperty(f.expanded,String(t))}get groupName(){return this.getProperty(f.groupName)}get contentType(){return this.getProperty(f.contentType)}set contentType(t){this.setProperty(f.contentType,t)}insertNewColumnAtIndex(t,r,n,i,a){t.initialize(n,i,a),this.addGrandChildAtIndex(v.formColumns,t,r)}insertColumnAtIndex(t,r){this.addGrandChildAtIndex(v.formColumns,t,r)}deleteColumn(t){return this.deleteFirstGrandChildOfName(v.formColumns,t)}async getColumnsJSON(t){let r=[],n=[];if(this.columns){for(let i of this.columns)n.push(i.toJSON(t));for(let i of n)r.push(await i)}return r}async toJSON(t){return{Name:this.Name,Id:this.id&&this.id.guidString,Label:this.getDisplayName(t.langCode)+(!this.visible&&t.formModelService.showHiddenElements?"\u3000\u3000":""),ShowLabel:this.showlabel,Visible:this.visible||t.formModelService.showHiddenElements,LabelId:this.labelId&&this.labelId.guidString,UniqueId:this.id&&this.id.guidString,PreviewId:this.id&&this.id.guidString,Columns:await this.getColumnsJSON(t),EventHandlers:[],Expanded:this.expanded,ContentType:this.contentType,AvailableForPhone:this.availableforphone,Header:void 0,Footer:void 0}}getUsedNodeNameSet(t){let r=new Set;return t&&t.visit(n=>{if(n.getNodeName()===v.formTab){let i=n;i.Name&&!T.GuidStringEquals(i.id.guidString,this.id.guidString)&&r.add(n.Name)}return!1}),r}}});var Kn,of=I(()=>{"use strict";Le();X();We();Zt();sE();Bl();Kn=class extends Gr{constructor(t,r,n){super(t,ye.THREE_COLUMN_EQUAL),this.setDisplayName(r,n),this.id=new P(P.NewGuid())}initializeDefaultProps(){this.addChild(new j(v.formColumns,this)),this.initializeFiveColumns()}get columns(){let t=this.getChildren("columns");return t.length!==1?[]:t[0].getChildren(v.formColumn)}getNavSectionForArea(t){for(let r of this.columns)for(let n of r.sections)if(n.AreaName===t)return n;return null}getNavCellFromNavId(t){for(let r of this.columns)for(let n of r.sections)for(let i of n.rows)for(let a of i.cells)if(a.NavId===t)return a;return null}initializeFiveColumns(){for(let t=0;t<hl.FIVE_COLUMN;t++){let r=new Ul(this.getChildren(v.formColumns)[0]);r.initializeDefaultProperties(vv.FiveEqColumn),this.addGrandChild(v.formColumns,r)}}}});function w5(e){switch(e){case ke.Main:return fn.Main;case ke.QuickCreate:return fn.QuickCreate;case ke.QuickViewForm:return fn.Quick;case ke.Dialog:return fn.Dialog;default:return fn.None}}function A5(e,t){if(t===ke.Main){if(e)switch(e.toLowerCase()){case"low":return cn.Low;case"highreadonlyvalues":return cn.HighReadOnlyValues;default:return cn.HighWithControls}return cn.Low}}var ql,y5,$l,lE=I(()=>{"use strict";Lb();ql=le(qn());up();Re();nt();Ti();Xp();X();xi();Id();$n();ko();X();vn();nf();of();Bl();y5="1920";$l=class e extends it{_formUniqueName;isHeaderDefaulted;consistencyStrong=!1;_formId;_rawFormXml;_entityName;_entityDisplayName;_status;_formName;_langCode;_description;_formType;_formPresentation;parameters=[];_formactivationstate;_changeTracker;_metadataChangeEvent;_etag;constructor(t,r,n,i,a,o,s,l,u){super(v.form,null),this._formUniqueName=a,this._formId=t,this._entityName=r,this._status=n,this._formName=i,this._description=l,this._formType=o,this._formPresentation=s,this._formactivationstate=u,this._changeTracker=new Zs,this._metadataChangeEvent=new wl}get FormLibraries(){let t=this.getFirstChild(v.formLibraries),r=t?t.getAllChildren():[],n=this._getInternalLibraries();return r.concat(n)}getAllEvents(){let t=[],r=this.events;r&&(t=t.concat(r));for(let n of this.tabs){let i=n.events;i&&(t=t.concat(i)),n.findAll(a=>a instanceof At).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 At){if(t.control?.dataFieldName){let r=this.events;return r?r.filter(n=>n.attribute&&t.control.dataFieldName===n.attribute):null}else if(this.isCellEditableGridControl(t)){let r=this.events;return r?r.filter(n=>n.control&&t.control.id===n.control):null}}return t?.events}_getInternalLibraries(){let t=this.findAll(i=>i.getNodeName()===v.internalLibraries),r=[],n="src";return t.length>0&&(r=t.map(i=>{let a=i.GetPropertyByParameter(n).replace("$webresource:",""),o=new ra(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,ql.trackErrorTrace)(V0,{eventName:"GetDependentFields_MissingDependencies",eventData:{Message:`Failed get dependencies for form event in form ${this.formId.guidString}.`,Attribute:n.attribute,EventName:n.eventName}}),i}}),r}get Parameters(){return this.parameters}set Parameters(t){this.parameters=t}get ShowImagecheck(){return T.IsNullOrEmpty(this.getProperty(f.ShowImage))?!0:this.getProperty(f.ShowImage)!=="false"}set ShowImagecheck(t){t?this.setProperty(f.ShowImage,String(t)):this.setProperty(f.ShowImage,"false")}get ShowNavigation(){return T.IsNullOrEmpty(this.getProperty(f.ShowNavigationbar))?!0:this.getProperty(f.ShowNavigationbar)!=="false"}set ShowNavigation(t){t?this.setProperty(f.ShowNavigationbar,String(t)):this.setProperty(f.ShowNavigationbar,"false")}get MaxWidth(){return T.IsNullOrEmpty(this.getProperty(f.MaxWidth))?y5:this.getProperty(f.MaxWidth)}set MaxWidth(t){this.setProperty(f.MaxWidth,t)}get headerDensityType(){return this.getProperty(f.HeaderDensityType)}set headerDensityType(t){t&&this.formType===ke.Main?this.setProperty(f.HeaderDensityType,t):this.formType!==ke.Main&&this.headerDensityType&&this.removeProperty(f.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(v.formHeader);return t.length!==1?null:t[0]}set header(t){E.IsNullOrUndefined(t)||(this.deleteChild(this.header),this.addChild(t))}getAllDependencies(){return this.getChildren(v.quickFormDependencies).length===0?[]:this.ConvertModelToArray(this.getChildren(v.quickFormDependencies)[0].getAllChildren())}ConvertModelToArray(t){let r=[];return E.IsNullOrUndefined(t)||t.forEach(n=>{r.push(n.id)}),r}get footer(){let t=this.getChildren(v.formFooter);return t.length!==1?null:t[0]}set footer(t){E.IsNullOrUndefined(t)||(this.deleteChild(this.footer),this.addChild(t))}createAndInitNewTab(t,r,n){let i=new Gr(null,t),a=this.getNextTabCounter(this.tabs.length+1);return i.initialize(t,a,this.LanguageCode,r,n),i}addTabAtIndex(t,r){this.addGrandChildAtIndex(v.formTabs,t,r)}createAndInitNewTabWithMarginalControl(t,r,n,i,a){let o=new Gr(null,ye.ONE_COLUMN),s=this.getNextTabCounter(this.tabs.length+1);o.initialize(ye.ONE_COLUMN,s,this.LanguageCode,r,n,a,!1),this.addGrandChildAtIndex(v.formTabs,o,i);let l=o.columns[0].sections[0];for(let u=0;u<t.rows.length;u++)l.appendRow(t.rows[u])}getNextTabCounter(t){for(let r=0;r<this.tabs.length;r++)if(this.tabs[r].Name===dn.namePrefix+t.toString())return this.getNextTabCounter(t+1);return t}get allTabs(){let t=this.getChildren(v.formTabs);return t.length!==1?[]:t[0].getChildren(v.formTab)}get CanvasNavigationTab(){if(this.tabs.length>0){let t=this.tabs[this.tabs.length-1];if(t instanceof Kn)return t}return null}get NavigationNode(){let t=this.getChildren(v.formNavigation);return t.length!==1?null:t[0]}set NavigationNode(t){let n=this.getAllChildren().indexOf(this.NavigationNode);n>=0&&(this.deleteChild(this.NavigationNode),this.insertChildAtIndex(t,n))}addNavigatioNode(t){this.addChild(t)}get tabs(){return this.allTabs}deleteTab(t){return this.deleteFirstGrandChildOfName(v.formTabs,t)}insertTabAtIndex(t,r){this.addGrandChildAtIndex(v.formTabs,t,r)}insertRelatedTab(t){let r=this.getAllGrandChildren(v.formTabs);if(!E.IsNullOrUndefined(r)){let n=r.length;this.insertTabAtIndex(t,n)}}get isfooterPresent(){return this.getChildren(v.formFooter).length>0}get displayCondition(){let t=this.getChildren(v.formDisplayConditions);return t.length>0?t[0]:null}set displayCondition(t){this.deleteChild(this.displayCondition),this.addChild(t)}get entityName(){return this._entityName}get formId(){return this._formId}set formId(t){this._formId=t}get rawFormXml(){return this._rawFormXml}set rawFormXml(t){this._rawFormXml=t}get status(){return this._status}set status(t){this._status=t}get formName(){return this._formName}set formName(t){this.trackObjectPropertyChange("_formName",t)}get formUniqueName(){return this._formUniqueName}set formUniqueName(t){this.trackObjectPropertyChange("_formUniqueName",t)}get formType(){return this._formType}get tabCount(){return this.allTabs.length}get description(){return this._description}set description(t){this.trackObjectPropertyChange("_description",t)}get formactivationstate(){return this._formactivationstate}set formactivationstate(t){this.trackObjectPropertyChange("_formactivationstate",t)}get entityDisplayName(){return this._entityDisplayName}set entityDisplayName(t){this._entityDisplayName=t}get etag(){return this._etag}set etag(t){this._etag=t}indexOfTab(t){return this.getAllGrandChildren(v.formTabs).indexOf(t)}get ControlDescriptions(){return this.getAllGrandChildren(v.controlDescriptions)}addControlDescriptionNode(t){this.addGrandChild(v.controlDescriptions,t)}deleteControlDescByForControlId(t){let r=this.getControlDescriptionByForControl(t);E.IsNullOrUndefined(r)||this.deleteFirstGrandChildOfName(v.controlDescriptions,r)}getControlDescriptionByForControl(t){if(!t)return null;for(let r of this.ControlDescriptions)if(r.forControl.guidString===t.guidString)return r;return null}cellHasCustomControlWithName(t,r){if(!t?.control||!r)return!1;let n=this.getControlDescriptionByForControl(t.control.UniqueId);return n?!!n.customControls.find(i=>i.name===r):!1}isDuplicateCell(t,r){return!!this.findFirst(i=>{if(!(i instanceof At))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 At&&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,pn.EditableGridControl)||ZN.getConfig()?.enableOneGridEventsForFormDesigner&&this.cellHasCustomControlWithName(t,pn.PowerAppsOneGrid)}isCellCanvasAppControl(t){return t?.control?.ClassId.guidString.toUpperCase()===S.CustomControl&&this.cellHasCustomControlWithName(t,pn.CanvasAppControl)}findFormNodeById(t,r=this){return r===null?null:r.findFirst(n=>{if(n===this&&t===this.formId.ToString()||n.id?.ToString?.()===t)return!0})}findFormCellByClassId(t,r=this){return r?r.findFirst(n=>{if(n.getNodeName()===v.formCell){let i=n;return i&&i.control&&i.control.ClassId.guidString===t}return!1}):null}async getTabsJSON(t){let r=this.tabs,n=[],i=[];if(r){for(let a of r)if(!(a instanceof Kn)){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,ql.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:A5(this.headerDensityType,this.formType)}:{},InlineEditGridRow:[],InlineQuickForms:[],QuickFormEntities:[],EventHandlers:[],LinkControlSections:[],FormType:w5(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 Vl,sf,uE=I(()=>{"use strict";Le();Re();X();We();vn();Vl=class extends it{constructor(t){super(v.formDisplayConditions,t)}get Order(){let t=this.getProperty(f.Order);return E.IsNullOrUndefined(t)?null:parseInt(t,10)}set Order(t){this.setProperty(f.Order,t.toString())}get FallbackForm(){return this.getProperty(f.FallbackForm)==="true"}set FallbackForm(t){this.setProperty(f.FallbackForm,t.toString())}addRoles(t){this.deleteAllChildren();for(let r=0;r<t.length;r++)this.addChild(t[r])}isRoleEveryone(){return!!(this.getChildren(v.formEveryOne)&&this.getChildren(v.formEveryOne)[0])}setRoleEveryone(){this.deleteAllChildren(),this.addChild(new sf(this))}},sf=class extends j{constructor(t){super(v.formEveryOne,t)}}});var Gl,cE=I(()=>{"use strict";X();We();Gl=class extends j{constructor(t,r){super(v.Handler,r),t.length>0&&this.setDefaultProperties(t)}setDefaultProperties(t){this.FunctionName=t[0],this.LibraryName=t[1],this.HandlerUniqueID=t[2],this.Enabled=t[3],this.Parameters=t[4],this.PassExecutionContext=t[5]}get HandlerUniqueID(){return this.getProperty(f.HandlerUniqueId)}set HandlerUniqueID(t){this.setProperty(f.HandlerUniqueId,t)}get FunctionName(){return this.getProperty(f.functionName)}set FunctionName(t){this.setProperty(f.functionName,t)}get LibraryName(){return this.getProperty(f.libraryNameEventHandler)}set LibraryName(t){this.setProperty(f.libraryNameEventHandler,t)}get Enabled(){return this.getProperty(f.enabledForField)}set Enabled(t){this.setProperty(f.enabledForField,t)}get PassExecutionContext(){return this.getProperty(f.passExecutionContext)}set PassExecutionContext(t){this.setProperty(f.passExecutionContext,t)}get Parameters(){return this.getProperty(f.parameters)}set Parameters(t){this.setProperty(f.parameters,t)}}});var na,lf=I(()=>{"use strict";X();Mo();na=class extends vr{constructor(t,r){super(t,r)}get cells(){let t=this.getRows(),r=[];if(this.rows&&t.length){for(let n of this.rows)if(n.cells){let i=n.getChildren(v.formCell);for(let a of i)r.push(a)}}return r}get occupiedCells(){return this.cells.filter(t=>!t.isEmpty())}get maxColumns(){return super.getColumnCountValue()}}});var Uo,dE=I(()=>{"use strict";X();lf();Uo=class extends na{_customFooter;constructor(t,r){super(v.formFooter,t),this._customFooter=r}get customFooter(){return this._customFooter}set customFooter(t){this._customFooter=t}async getControls(t){let r=[];if(this.rows){for(let n of this.rows)if(n.cells)for(let i of n.cells)i.control&&r.push(await i.control.toJSON(t))}return r}async toJSON(t){return{AvailableForPhone:this.availableforphone,Controls:await this.getControls(t),UniqueId:this.id&&this.id.guidString,PreviewId:this.id&&this.id.guidString}}isEmpty(){return!this.cells.find(t=>!!t.control)}}});var Bo,pE=I(()=>{"use strict";X();lf();Bo=class extends na{_customHeader;constructor(t,r){super(v.formHeader,t),this._customHeader=r}get customHeader(){return this._customHeader}set customHeader(t){this._customHeader=t}get showCommandBar(){return this.getProcessedValue(f.showCommandBar)}set showCommandBar(t){t!=null&&this.setProperty(f.showCommandBar,String(t))}get showBody(){return this.getProcessedValue(f.showBody)}set showBody(t){t!=null&&this.setProperty(f.showBody,String(t))}get showTabNavigator(){return this.getProcessedValue(f.showTabNavigator)}set showTabNavigator(t){t!=null&&this.setProperty(f.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 Ct,Yn=I(()=>{"use strict";Le();nt();X();vn();Ct=class e extends it{constructor(t,r){super(t,r)}getTitle(t){for(let r of this.getAllTitles())if(+r.getProperty(f.LCID)===t)return r.getProperty(f.text);return null}getAllTitles(){let t=this.getChildren(v.Titles);return t.length===0?[]:t[0].getChildren(v.Title)}setTitle(t,r){for(let i of this.getAllTitles())if(+i.getProperty(f.LCID)===r){i.setProperty(f.text,t);return}let n=new e(v.Title,null);n.setProperty(f.text,t),n.setProperty(f.LCID,String(r)),this.addGrandChild(v.Titles,n)}get Sequence(){return+this.getProperty(f.Sequence)}set Sequence(t){this.setProperty(f.Sequence,t.toString())}get Area(){return this.getProperty(f.Area)}set Area(t){this.setProperty(f.Area,t)}set Id(t){this.setProperty(f.Id,t)}get Id(){return this.getProperty(f.Id)}get id(){return new P(this.Id??"",!0)}set id(t){this.Id=t.guidString}get Show(){return!0}get Icon(){return this.getProperty(f.icon)}set Icon(t){t=t||T.EmptyString,this.setProperty(f.icon,t)}updateCommonProperties(t,r){this.Area=t.Area,this.Sequence=t.Sequence,this.setTitle(t.getDisplayName(r),r)}}});var $o,fE=I(()=>{"use strict";(function(e){e[e.NavLinkNotAvailable=-1]="NavLinkNotAvailable",e[e.NavLinkIdConflict=-2]="NavLinkIdConflict",e[e.NavBarNotAvailable=-3]="NavBarNotAvailable"})($o||($o={}))});var zl,mE=I(()=>{"use strict";Re();X();Yn();fE();zl=class extends Ct{constructor(t){super(v.formNavBar,t)}addChildElement(t){this.addChild(t)}getAllActiveNavBarChildren(){return this.getAllChildren().filter(n=>n.Show)}getAllInActiveActiveNavBarChildren(){return this.getAllChildren().filter(n=>!n.Show)}get AllRelationShipItems(){return this.getChildren("NavBarByRelationshipItem")}get AllNavLinkItems(){return this.getChildren("NavBarItem")}removeNavLink(t){let r=this.getNavBarLinkItemById(t);return E.IsNullOrUndefined(r)?$o.NavLinkNotAvailable:r.length===1?this.deleteChild(r[0]):$o.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 me,C5,hE,aee,ia,uf=I(()=>{"use strict";Le();X();Yn();(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"})(me||(me={}));C5=new Map([[me.Info,"Info"],[me.Sales,"Sales"],[me.Service,"Service"],[me.Marketing,"Marketing"],[me.ProcessCenter,"ProcessCenter"]]),hE=new Map([["Info",me.Info],["Sales",me.Sales],["Service",me.Service],["Marketing",me.Marketing],["ProcessCenter",me.ProcessCenter]]),aee=new Map([[me.Info,9e3],[me.Sales,9200],[me.Service,9400],[me.Marketing,9600],[me.ProcessCenter,9800],[me.InternetMarketing,1e4],[me.Async,10200]]),ia=class extends Ct{constructor(t,r){super(v.formNavBarArea,r)}setDefaultPropertiesByType(t,r,n){this.AreaId=C5.get(t);let i=n?.(`navBarArea.title.${this.AreaId}`)??this.AreaId;this.setTitle(i,r)}get ParentNavigation(){return this.getAncestor(v.formNavigation)}get AreaId(){return this.getProperty(f.Id)}set AreaId(t){this.setProperty(f.Id,t)}get id(){return new P(this.AreaId??"",!0)}set id(t){this.AreaId=t.guidString}async toJSON(t){return{Id:this.AreaId,Titles:[{LCID:t.langCode,Text:this.getTitle(t.langCode)}],PreviewId:this.AreaId}}}});var aa,cf=I(()=>{"use strict";X();Yn();aa=class extends Ct{constructor(t,r){super(v.formNavBarAreas,r)}get AllNavBarAreaItems(){return this.getChildren(v.formNavBarArea)}get ParentNavigation(){return this.getAncestor(v.formNavigation)}addNavBarArea(t){this.addChild(t)}}});var Wl,gE=I(()=>{"use strict";Re();X();Yn();Wl=class extends Ct{RelationshipNameUCIRuntime;constructor(t){super(v.formNavBarByRelationshipItem,t)}get RelationshipName(){return this.getProperty(f.RelationshipName)}set RelationshipName(t){this.setProperty(f.RelationshipName,t)}set Show(t){this.setProperty(f.Show,String(t))}get Show(){let t=this.getProperty(f.Show);return E.IsNullOrUndefined(t)||t==="true"}get TitleResourceId(){return this.getProperty(f.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 jl,vE=I(()=>{"use strict";X();Yn();jl=class extends Ct{constructor(t){super(v.formNavBarItem,t)}get Url(){return this.getProperty(f.url)}set Url(t){this.setProperty(f.url,t)}}});var Hl,bE=I(()=>{"use strict";Le();X();uf();cf();Yn();Hl=class extends Ct{constructor(t,r){super(t,r)}getNavBarAreaByAreaName(t){let r=this.navBarAreas.AllNavBarAreaItems.filter(n=>n.AreaId===t);return r.length===0?null:r[0]}get navBarAreas(){return this.getFirstChild(v.formNavBarAreas)}setDefaultNavBarAreas(t,r){let n=[me.Info,me.Sales,me.Service,me.Marketing,me.ProcessCenter];if(this.navBarAreas){let i=this.navBarAreas?.AllNavBarAreaItems;if(i&&i.length>0){let a=new Set(i.map(o=>hE.get(o.AreaId)));n=n.filter(o=>!a.has(o))}}else{let i=new aa(v.formNavBarAreas,this);i.isTransient=!0,this.addChild(i)}return n.length>0?(n.forEach(i=>{let a=new ia(v.formNavBarArea,this.navBarAreas);a.setDefaultPropertiesByType(i,t,r),this.navBarAreas.addNavBarArea(a)}),!0):!1}get navBar(){return this.getFirstChild(v.formNavBar)}get id(){return new P(Bd,!0)}replaceNavAreaToGivenIndex(t,r){this.navBarAreas?.AllNavBarAreaItems.indexOf(r)!==-1&&(this.deleteFirstGrandChildOfName(v.formNavBarAreas,r),this.addGrandChildAtIndex(v.formNavBarAreas,r,t))}async getNavBarAreasJSON(t){let r=[],n=[];if(this.navBarAreas?.AllNavBarAreaItems){for(let a of this.navBarAreas.AllNavBarAreaItems)n.push(a.toJSON(t));r=await Promise.all(n)}return r}async getNavBarRelationshipItemsJSON(t){let r=[],n=[];if(this.navBar?.AllRelationShipItems){for(let i of this.navBar.AllRelationShipItems)n.push(i.toJSON(t));r=await Promise.all(n)}return r}async toJSON(t){let r=await this.getNavBarAreasJSON(t),n=await this.getNavBarRelationshipItemsJSON(t);return{NavBarAreas:{NavBarAreas:r},NavBarByRelationshipItems:n,NavBarItems:[],NavPaneIsvItems:{NavBarIsvItems:[]},ShowEmptyNavBarAreas:t.formModelService.showHiddenElements}}}});var yE={};ar(yE,{ControlType:()=>kt,DeserializationService:()=>ff,DeserializationServiceScope:()=>pf,DeserializedFormElementNode:()=>St});var df,St,pf,kt,ff,rf=I(()=>{"use strict";df=le(qn());Le();Re();nt();Ti();$d();$n();G0();Fb();yl();lE();ko();kl();Lo();Kp();X();X();uE();We();Zt();Yp();cE();dE();Zp();ef();pE();nf();af();Mo();Bl();mE();uf();cf();gE();vE();bE();St=class extends j{constructor(t,r){super(t,r)}insertProperty(t,r){this.addProperty(t,r)}insertChild(t){this.addChild(t)}},pf="DeserializationService";(function(e){e.Grid="Grid",e.Lookup="Lookup",e.Base="Base"})(kt||(kt={}));ff=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 m="";throw d.length===0?m="FormXml has no form node.":m="FormXml has multiple form nodes.",(0,df.trackErrorTrace)(lt,{eventName:pf,eventData:{error:m}}),new Error(m)}let p=this.createFormModel(d.item(0),r,n,i,a,o,s,l,u,c);return E.IsNullOrUndefined(p.displayCondition)&&s!==ke.Dialog&&this.appendDefaultDisplayCondition(p),p}upsertFieldCount(t,r){let n=Vn.getNecessaryLookUpTable(r),i=1;n.containsKey(t)&&(i+=n.getValue(t)),n.upsert(t,i)}appendDefaultDisplayCondition(t){let r='<DisplayConditions Order="0" FallbackForm="true"><Everyone/></DisplayConditions>';if(!E.IsNullOrUndefined(t)){let n=E.ParseXml(r);n!==null&&this.populateElementChildren(t,n.childNodes)}}createFormModel(t,r,n,i,a,o,s,l,u,c){let d=new $l(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(v.formHeader,d,d.header),this.insertHeaderFooterElementProperties(v.formFooter,d,d.footer)),d}insertHeaderFooterElementProperties(t,r,n){if(E.IsNullOrUndefined(n)){let i=t===v.formHeader?new Bo(r,!0):new Uo(r,!0);St.prototype.insertProperty.call(i,f.id,"{"+P.NewGuid()+"}"),St.prototype.insertProperty.call(i,f.Fieldlabelposition,"Top"),St.prototype.insertProperty.call(i,f.columnName,ve.MarginalControlColumns),St.prototype.insertProperty.call(i,f.LabelWidth,ve.LabelWidth),St.prototype.insertProperty.call(i,f.Fieldlabelalignment,"Left");let a=null,o=new Xn(a);for(let s=0;s<i.maxColumns;s++){let l=new At(o);St.prototype.insertProperty.call(l,f.id,"{"+P.NewGuid()+"}"),l.setDisplayName(T.EmptyString,this.lcid),St.prototype.insertProperty.call(l,f.showlabel,"false"),o.addCell(l)}i.appendRow(o),t===v.formHeader?r.header=i:r.footer=i}}deSerializeFormXmlNode(t,r){if(t&&t.nodeValue&&(t.nodeType===Node.TEXT_NODE||t.nodeType===Node.CDATA_SECTION_NODE))return new St(`<${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,df.trackErrorTrace)(lt,{eventName:pf,eventData:{error:n}}),new Error(n)}for(let n=0;n<r.length;n++){let i=r.item(n);i&&(St.prototype.insertProperty.call(t,i.name,i.value),t.getNodeName()===v.formCell&&i.name===f.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&&St.prototype.insertChild.call(t,a)}}createModelNode(t,r){switch(t.nodeName){case v.form:throw new Error("Form node shouldn't be created using this method");case v.formTab:return new Gr(r);case v.formColumn:return new bn(r);case v.formHeader:return new Bo(r,!1);case v.formFooter:return new Uo(r,!1);case v.formSection:return new vr(v.formSection,r);case v.formRow:return new Xn(r);case v.formCell:return new At(r);case v.formControl:let n=t.attributes,i=t.childNodes.length>0?t.childNodes[0].childNodes:null,a;for(let s=0;s<n.length;s++){let l=n.item(s);if(l.name===f.indicationOfSubgrid&&l.value==="true"||l.name===f.classid&&(l.value?.toLocaleUpperCase()===`{${S.SubgridControl}}`||l.value?.toLocaleUpperCase()===`{${S.ReferencePanelSubgridControl}}`))a=kt.Grid;else if(l.name===f.classid&&l.value?.toLocaleUpperCase()===`{${S.LookupControl}}`)a=kt.Lookup;else if(l.name===f.classid&&l.value?.toLocaleUpperCase()===`{${S.CustomControl}}`)for(let u=0;u<i?.length;u++)i[u].nodeName===f.DefaultViewId&&(a=kt.Lookup)}return a===kt.Grid?new ea(r):a===kt.Lookup?new ta(r):new rr(r);case v.formEvent:return new Zi(r,T.EmptyString);case v.dependency:return this.populateDependencyTable(t),new Yi(r,T.EmptyString);case v.Handler:let o=[];return new Gl(o,r);case v.formNavigation:return new Hl(t.nodeName,r);case v.formNavBarArea:return new ia(t.nodeName,r);case v.formNavBarAreas:return new aa(t.nodeName,r);case v.formNavBar:return new zl(r);case v.formNavBarByRelationshipItem:return new Wl(r);case v.formNavBarItem:return new jl(r);case v.formDisplayConditions:return new Vl(r);case v.library:return new ra(r,T.EmptyString,T.EmptyString);case v.controlDescription:return new il(r);case v.customControl:return this.populateCustomControlConfigurationId(t),new bl(r);default:return new St(t.nodeName,r)}}populateDependencyTable(t){let r=t.attributes;for(let n=0;n<r.length;n++){let i=r.item(n);i.name===f.id&&this.upsertFieldCount(i.value,fr.DependencyFieldTable)}}populateCustomControlConfigurationId(t){let r=t.attributes;for(let n=0;n<r.length;n++){let i=r.item(n);if(i.name===f.id){let a=new P(i.value.substr(1,i.value.length-2));for(let o=0;o<t.parentNode.attributes.length;o++){let s=t.parentNode.attributes.item(o);if(s.name===f.ForControl){let l=s.value.substr(1,i.value.length-2);Me.CustomControlIdMap.upsert(l,a);break}}break}}}}});var wE={};ar(wE,{SerializationService:()=>mf,SerializationServiceScope:()=>S5,SerializedFormElementNode:()=>oa});var S5,oa,mf,AE=I(()=>{"use strict";nt();We();Zt();of();S5="SerializationService",oa=class extends j{fetchNodeName(){return this.getNodeName()}enumerateProperties(){return this.getAllProperties()}enumerateChildren(){return this.getAllChildren()}},mf=class{langCode;constructor(t){this.langCode=t}serializeFormXmlNode(t){let r=oa.prototype.fetchNodeName.call(t);if(r.charAt(0)===qr.StartTag)return T.EscapeXml(r.substr(1),!1);if(t.isTransient&&!t.isDirty())return T.EmptyString;let n=oa.prototype.enumerateProperties.call(t),i=oa.prototype.enumerateChildren.call(t);if(!(t instanceof Kn)){let a=`<${r}`;if(n.length!==0&&(a+=` ${this.getPropertiesString(n)}`),i.length===0)a+=" />";else{let o=T.EmptyString;for(let s of i)o+=this.serializeFormXmlNode(s);a+=`>${o}</${r}>`}return a}return T.EmptyString}getPropertiesString(t){let r=T.EmptyString;return t.forEach((n,i)=>{i!==0&&(r+=" "),r+=`${n.key}="${T.EscapeXml(n.value,!0)}"`}),r}}});var br=g(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.childObjects=Nt.optionalGuidId=Nt.optionalEnum=Nt.eachObject=Nt.issue=Nt.isJsonObject=void 0;function CE(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}Nt.isJsonObject=CE;function qo(e,t,r,n){return n?{pointer:e,rule:t,message:r,fatal:n}:{pointer:e,rule:t,message:r}}Nt.issue=qo;function SE(e,t,r,n){if(!Array.isArray(e))return[];let i=[];return e.forEach((a,o)=>{CE(a)?i.push({node:a,index:o}):n.push(qo(`${t}/${o}`,`${r}-must-be-object`,`a ${r} must be a JSON object, got ${a===null?"null":typeof a}`))}),i}Nt.eachObject=SE;function N5(e,t,r,n,i,a){let o=e[t];o!==void 0&&(typeof o!="string"||!r.includes(o))&&a.push(qo(`${n}/${t}`,i,`${t} must be one of ${r.map(s=>`'${s}'`).join(", ")}, got ${JSON.stringify(o)}`))}Nt.optionalEnum=N5;var E5=/^(?:\{[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 D5(e,t,r,n,i){let a=e[t];typeof a=="string"&&a!==""&&!E5.test(a)&&i.push(qo(`${r}/${t}`,n,`${t} must be a GUID or empty, got '${a}'`))}Nt.optionalGuidId=D5;function I5(e,t,r,n,i){let a=e[t],o=`${r}/${t}`;return a===void 0?[]:Array.isArray(a)?SE(a,o,n,i):(i.push(qo(o,`${n}-list-must-be-array`,`${t} must be an array when present, got ${typeof a}`)),[])}Nt.childObjects=I5});var yn=g(Ql=>{"use strict";Object.defineProperty(Ql,"__esModule",{value:!0});Ql.installDomShim=void 0;var NE=Js(),EE=!1,_5={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 P5(){if(EE)return;let e=globalThis;typeof e.DOMParser>"u"&&(e.DOMParser=NE.DOMParser),typeof e.XMLSerializer>"u"&&(e.XMLSerializer=NE.XMLSerializer),typeof e.Node>"u"&&(e.Node=_5),EE=!0}Ql.installDomShim=P5});var VE=g(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});Et.classIdForAttributeType=Et.QUICK_VIEW_CLASS_ID=Et.NOTES_CLASS_ID=Et.SUBGRID_CLASS_ID=Et.formRegistration=Et.FormAdapter=void 0;var Mt=(Le(),or(F0)),T5=(Re(),or(L0)),O5=(We(),or(M0)),at=(X(),or(k0)),xe=($n(),or(U0)),R5=(rf(),or(yE)),x5=(AE(),or(wE)),Ue=on(),DE=Kt(),Zn=br(),F5=Zc(),OE=ht(),bf=Z(),RE=yn(),xE=pi(),L5={[at.FormType.Main]:"Main",[at.FormType.QuickCreate]:"QuickCreate",[at.FormType.QuickViewForm]:"QuickView",[at.FormType.Card]:"Card"},hf={Main:at.FormType.Main,QuickCreate:at.FormType.QuickCreate,QuickView:at.FormType.QuickViewForm,Card:at.FormType.Card},k5=new Map(Object.entries(xe.ControlClassId).map(([e,t])=>[String(t).toUpperCase(),e]));function FE(e){var t;return e&&(t=k5.get(e.toUpperCase()))!==null&&t!==void 0?t:"Unknown"}function Vo(e){return e.getAllProperties().map(t=>[t.key,t.value])}function ei(e){let t=new Map;for(let r of e.getAllProperties())t.has(r.key)||t.set(r.key,r.value);return t}function LE(e,t){return e.getAllChildren().find(r=>r.getNodeName()===t)}function yf(e,t){var r,n;let i=LE(e,"labels");if(!i)return"";let a=i.getAllChildren().filter(s=>s.getNodeName()==="label"),o=(r=a.find(s=>ei(s).get("languagecode")===String(t)))!==null&&r!==void 0?r:a[0];return o&&(n=ei(o).get("description"))!==null&&n!==void 0?n:""}function M5(e){let t=LE(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 kE(e){return/^1+$/.test(e)&&e.length>=1&&e.length<=4?e.length:1}function gf(e){let t=Math.min(Math.max(Math.trunc(e),1),4);return"1".repeat(t)}function Go(e){return String(e??"").replace(/[{}]/g,"")}function vf(e){return`{${Go(e)}}`}function IE(e,t){if(e===void 0||e==="")return t;let r=Number(e);return Number.isNaN(r)?t:r}function Xl(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,Ue.rawFromNode)(u)})}),i<0)return{modeled:[],bag:{a:Vo(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,Ue.rawFromNode)(u)})}),{modeled:s,bag:{a:Vo(e),c:a,w:{n:o.getNodeName(),a:Vo(o),c:l}}}}function ME(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,Ue.rawFromNode)(a)})}),{modeled:n,bag:{a:Vo(e),c:i}}}function U5(e,t){let{modeled:r,bag:n}=Xl(e,"tabs","tab");return{tabs:r.map(i=>B5(i,t)),bag:n}}function B5(e,t){var r,n;let i=ei(e),{modeled:a,bag:o}=Xl(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:yf(e,t),expanded:i.get("expanded")==="true",visible:i.has("visible")?i.get("visible")==="true":!0,columns:a.map(s=>$5(s,t)),bag:o}}function $5(e,t){let r=ei(e),{modeled:n,bag:i}=Xl(e,"sections","section");return{width:r.get("width"),sections:n.map(a=>q5(a,t)),bag:i}}function q5(e,t){var r,n,i;let a=ei(e),{modeled:o,bag:s}=Xl(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:yf(e,t),visible:a.has("visible")?a.get("visible")==="true":!0,showLabel:a.get("showlabel")==="true",columns:kE((i=a.get("columns"))!==null&&i!==void 0?i:"1"),rows:o.map(l=>V5(l,t)),bag:s}}function V5(e,t){let{modeled:r,bag:n}=ME(e,"cell",!1);return{cells:r.map(i=>G5(i,t)),bag:n}}function G5(e,t){var r;let n=ei(e),{modeled:i,bag:a}=ME(e,"control",!0),o=yf(e,t),s=n.get("showlabel")==="true",l=i[0]?z5(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:IE(n.get("colspan"),1),rowspan:IE(n.get("rowspan"),1),control:l,bag:a}}function z5(e,t,r){var n,i;let a=ei(e),o=Go((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:FE(o),isRequired:a.get("isrequired")==="true",isReadOnly:a.get("disabled")==="true",label:t,showLabel:r,parameters:M5(e),bag:{a:Vo(e),c:e.getAllChildren().map((l,u)=>({i:u,node:(0,Ue.rawFromNode)(l)}))}}}function sa(e){return e.a.length===0&&e.c.length===0&&!e.w}function UE(e,t){let r=e.a.find(n=>n[0]===t);return r?r[1]:void 0}function ti(e,t){var r;let n=new Set(e.a.map(o=>o[0])),i=sa(e),a=[];for(let o of t)if(n.has(o.key)){let s=(r=UE(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,Ue.mergeAttrs)(e.a,a)}var wn=(e,t)=>({key:e,matches:r=>r===t,render:()=>t,absentDefault:""}),An=(e,t,r=!1)=>({key:e,matches:n=>n==="true"===t,render:()=>String(t),absentDefault:String(r)}),_E=(e,t,r=1)=>({key:e,matches:n=>Number(n)===t,render:()=>String(t),absentDefault:String(r)});function wf(e,t){return{n:"labels",a:[],c:[{n:"label",a:[["description",e],["languagecode",String(t)]],c:[]}]}}function BE(e){return{n:"parameters",a:[],c:Object.keys(e).map(t=>({n:(0,bf.assertXmlName)(t,"Form control parameter name"),a:[],c:[{n:`<${e[t]}`,a:[],c:[]}]}))}}function W5(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 j5(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 Af(e,t,r){let n=e.c.findIndex(a=>a.node.n==="labels");if(n<0||W5(e.c[n].node,r)===t)return e;let i=j5(e.c[n].node,t,r);return{...e,c:e.c.map((a,o)=>o===n?{...a,node:i}:a)}}function H5(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 Q5(e,t){let r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every(i=>e[i]===t[i])}function J5(e,t){return e.a.some(r=>r[0]===t)?{...e,a:e.a.filter(r=>r[0]!==t)}:e}function X5(e,t){let r=e.c.findIndex(i=>i.node.n==="parameters");if(r<0||Q5(H5(e.c[r].node),t))return e;let n=BE(t);return{...e,c:e.c.map((i,a)=>a===r?{...i,node:n}:i)}}function Kl(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,Ue.spliceChildren)(e.w.c,r)};return(0,Ue.spliceChildren)(e.c,[o])}let i=n(),a={n:t,a:[],c:r};return e.c.length===0?[...i,a]:(0,Ue.spliceChildren)(e.c,[...i,a])}function K5(e,t){let r=e.tabs.map(n=>Y5(n,t));return{n:"form",a:ti(e.bag,[]),c:e.tabs.length===0&&sa(e.bag)?[]:Kl(e.bag,"tabs",r,()=>[])}}function Y5(e,t){let r=[wn("id",e.id),wn("name",e.name),An("expanded",e.expanded),An("visible",e.visible,!0)],n=e.columns.map(a=>Z5(a,t)),i=Af(e.bag,e.label,t);return{n:"tab",a:ti(i,r),c:Kl(i,"columns",n,()=>e.label?[wf(e.label,t)]:[])}}function Z5(e,t){let r=e.width!==void 0?[wn("width",e.width)]:[],n=e.sections.map(i=>e9(i,t));return{n:"column",a:ti(e.bag,r),c:Kl(e.bag,"sections",n,()=>[])}}function e9(e,t){let r=[wn("id",e.id),wn("name",e.name),An("showlabel",e.showLabel),An("visible",e.visible,!0),{key:"columns",matches:a=>kE(a)===e.columns,render:()=>gf(e.columns),absentDefault:gf(1)}],n=e.rows.map(a=>t9(a,t)),i=Af(e.bag,e.label,t);return{n:"section",a:ti(i,r),c:Kl(i,"rows",n,()=>e.label?[wf(e.label,t)]:[])}}function t9(e,t){let r=e.cells.map(n=>r9(n,t));return{n:"row",a:ti(e.bag,[]),c:sa(e.bag)?r:(0,Ue.assembleChildren)(e.bag,r)}}function r9(e,t){let r=e.control?e.control.showLabel:UE(e.bag,"showlabel")==="true",n=[wn("id",e.id),An("showlabel",r),An("visible",e.visible,!0),_E("colspan",e.colspan),_E("rowspan",e.rowspan)],i=e.control?[n9(e.control)]:[],a;if(sa(e.bag))a=[...e.control&&e.control.label?[wf(e.control.label,t)]:[],...i];else{let o=e.control?Af(e.bag,e.control.label,t):e.bag;a=(0,Ue.assembleChildren)(o,i)}return{n:"cell",a:ti(e.bag,n),c:a}}function n9(e){let t=[wn("id",e.id),{key:"classid",matches:i=>Go(i)===e.classId,render:()=>vf(e.classId),absentDefault:""}];e.fieldName!==null&&t.push(wn("datafieldname",e.fieldName)),t.push(An("disabled",e.isReadOnly)),t.push(An("isrequired",e.isRequired));let r=e.fieldName===null?J5(e.bag,"datafieldname"):e.bag,n;return sa(r)?n=Object.keys(e.parameters).length>0?[BE(e.parameters)]:[]:n=(0,Ue.assembleChildren)(X5(r,e.parameters),[]),{n:"control",a:ti(r,t),c:n}}var i9={make:(e,t)=>new O5.FormElementNode(e,t),setProp:(e,t,r)=>e.setProperty(t,r),addChild:(e,t)=>e.addChild(t)};function PE(e,t,r){(0,RE.installDomShim)();let n=o9(e,r),i=(0,Ue.rebuildRaw)(K5(n,t),i9,null);return new x5.SerializationService(t).serializeFormXmlNode(i)}function a9(e){return JSON.parse(JSON.stringify(e))}function o9(e,t){var r;let n=a9(e);n.bag||(n.bag=(0,Ue.emptyBag)()),m9(n.bag),t&&s9(n,t);for(let i of(r=n.tabs)!==null&&r!==void 0?r:[])l9(i);return n}function s9(e,t){var r;let n=(r=e.entityLogicalName)!==null&&r!==void 0?r:"";$E(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=qE(s.attributeType)))})}function $E(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 l9(e){e.id||(e.id=Mt.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)u9(t);e.bag||(e.bag=(0,Ue.emptyBag)())}function u9(e){e.sections||(e.sections=[]);for(let t of e.sections)c9(t);e.bag||(e.bag=(0,Ue.emptyBag)()),e.width===void 0&&sa(e.bag)&&(e.width="100%")}function c9(e){e.id||(e.id=Mt.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)d9(t);e.bag||(e.bag=(0,Ue.emptyBag)())}function d9(e){e.cells||(e.cells=[]);for(let t of e.cells)p9(t);e.bag||(e.bag=(0,Ue.emptyBag)())}function p9(e){e.id||(e.id=Mt.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&&f9(e.control),e.bag||(e.bag=(0,Ue.emptyBag)())}function f9(e){var t;e.id||(e.id=Mt.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":FE(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,bf.assertXmlName)(r,"Form control parameter name");e.bag||(e.bag=(0,Ue.emptyBag)())}function m9(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"&&!TE(a,"handlerUniqueId")&&a.a.push(["handlerUniqueId",vf(Mt.Guid.NewGuid())])}}else if(r.n==="formLibraries")for(let n of r.c)n.n==="Library"&&!TE(n,"libraryUniqueId")&&n.a.push(["libraryUniqueId",vf(Mt.Guid.NewGuid())])}}var Jl=class{constructor(t=xE.DEFAULT_LCID){this.lcid=t}toArtifact(t,r){var n,i,a;let{tabs:o,bag:s}=U5(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=L5[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:PE(t,this.lcid),formid:t.id||Mt.Guid.NewGuid(),objecttypecode:t.entityLogicalName,type:hf[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:Mt.Guid.NewGuid(),objecttypecode:(i=u.objecttypecode)!==null&&i!==void 0?i:"",type:u.type,name:(a=u.name)!==null&&a!==void 0?a:"",uniquename:(o=u.uniquename)!==null&&o!==void 0?o:"",description:(s=u.description)!==null&&s!==void 0?s:"",formpresentation:u.formpresentation,formactivationstate:u.formactivationstate});return this.toArtifact(c,(l=u.description)!==null&&l!==void 0?l:void 0)}toApiPayload(t,r,n){return{formxml:PE(t,this.lcid,n),name:t.name,type:hf[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 $E(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 m=t.tabs&&t.tabs.length>0?void 0:S9(this.lcid),h=m!==void 0?m:t.tabs.map(N=>h9(N,this.lcid)).join(""),w=this.deserialize({formxml:`<form><tabs>${h}</tabs></form>`,formid:t.id||Mt.Guid.NewGuid(),objecttypecode:(r=t.entityLogicalName)!==null&&r!==void 0?r:"",type:hf[(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}),y=this.toArtifact(w,t.description);return{id:(l=t.id)!==null&&l!==void 0?l:y.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:y.tabs,bag:y.bag}}assignMissingIds(t){return(0,OE.assignMissingIds)(t)}validate(t){return E9(t)}deserialize(t){(0,RE.installDomShim)();let r=T5.ScriptUtilities.ParseXml(t.formxml),n=new R5.DeserializationService(this.lcid).deSerializeFormXml(r,new Mt.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"}};Et.FormAdapter=Jl;function nr(e){return String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Cf(e,t){return e?`<labels><label description="${nr(e)}" languagecode="${t}" /></labels>`:""}function Sf(e){return e&&e.length>0?Go(e):(0,OE.newId)()}function h9(e,t){var r,n,i,a;let o=(r=e.columns)!==null&&r!==void 0?r:[],s=(o.length>0?o:[C9()]).map(l=>g9(l,t)).join("");return`<tab id="{${nr(Sf(e.id))}}" name="${nr((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}">${Cf(e.label,t)}<columns>${s}</columns></tab>`}function g9(e,t){var r,n;let i=((r=e.sections)!==null&&r!==void 0?r:[]).map(a=>v9(a,t)).join("");return`<column width="${nr((n=e.width)!==null&&n!==void 0?n:"100%")}"><sections>${i}</sections></column>`}function v9(e,t){var r,n,i,a,o;let s=((r=e.rows)!==null&&r!==void 0?r:[]).map(l=>b9(l,t)).join("");return`<section id="{${nr(Sf(e.id))}}" name="${nr((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="${gf((o=e.columns)!==null&&o!==void 0?o:1)}">${Cf(e.label,t)}<rows>${s}</rows></section>`}function b9(e,t){var r;return`<row>${((r=e.cells)!==null&&r!==void 0?r:[]).map(n=>y9(n,t)).join("")}</row>`}function y9(e,t){var r,n,i,a,o,s;let l=e.control,u=l?Cf((n=(r=l.label)!==null&&r!==void 0?r:l.fieldName)!==null&&n!==void 0?n:"",t):"",c=l?w9(l):"";return`<cell id="{${nr(Sf(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 w9(e){var t,r,n;let i=e.fieldName?` datafieldname="${nr(e.fieldName)}"`:"",a=A9(e.parameters),o=e.classId?Go(e.classId):String(xe.ControlClassId.TextboxControl);return`<control id="${nr((t=e.id)!==null&&t!==void 0?t:"")}" classid="{${nr(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 A9(e){let t=Object.keys(e??{});return t.length===0?"":(t.forEach(n=>(0,bf.assertXmlName)(n,"Form control parameter name")),`<parameters>${t.map(n=>`<${n}>${nr(e[n])}</${n}>`).join("")}</parameters>`)}function C9(){return{width:"100%",sections:[],bag:{a:[],c:[]}}}function S9(e){return`<tab id="{${Mt.Guid.NewGuid()}}" name="tab_general" expanded="true" visible="true"><labels><label description="General" languagecode="${e}" /></labels><columns><column width="100%"><sections><section id="{${Mt.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 N9(e=xE.DEFAULT_LCID){return{adapter:new Jl(e),api:F5.formApi,languageSensitive:!0,publish:(t,r,n)=>(0,DE.publishBoundEntity)(t,n),publishScope:(t,r)=>(0,DE.boundEntityPublishScope)(r)}}Et.formRegistration=N9;function E9(e){let t=[];return(0,Zn.childObjects)(e,"tabs","","tab",t).forEach(({node:n,index:i})=>{(0,Zn.childObjects)(n,"columns",`/tabs/${i}`,"column",t).forEach(({node:o,index:s})=>{let l=`/tabs/${i}/columns/${s}`;(0,Zn.childObjects)(o,"sections",l,"section",t).forEach(({node:c,index:d})=>{let p=`${l}/sections/${d}`;(0,Zn.childObjects)(c,"rows",p,"row",t).forEach(({node:h,index:w})=>{let y=`${p}/rows/${w}`;(0,Zn.childObjects)(h,"cells",y,"cell",t).forEach(({node:D,index:x})=>{let F=D.control;F!=null&&!(0,Zn.isJsonObject)(F)&&t.push((0,Zn.issue)(`${y}/cells/${x}/control`,"control-must-be-object-or-null",`a cell control must be a JSON object or null, got ${typeof F}`))})})})})}),t}Et.SUBGRID_CLASS_ID=xe.ControlClassId.SubgridControl;Et.NOTES_CLASS_ID=xe.ControlClassId.TimelineControl;Et.QUICK_VIEW_CLASS_ID=xe.ControlClassId.QuickViewControl;var D9={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)},I9="3EF39988-22BB-4F0B-BBBE-64B5A3748AEE";function qE(e){return e==="Picklist"||e==="State"||e==="Status"?I9:e&&D9[e]||String(xe.ControlClassId.TextboxControl)}Et.classIdForAttributeType=qE;function TE(e,t){let r=e.a.find(n=>n[0]===t);return r?r[1]:void 0}});var Nf=g(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});la.viewApi=la.findDefaultViews=void 0;var zE=Jt(),Ut=ge(),zr=Z(),_9="savedqueryid,name,description,fetchxml,layoutxml,querytype,returnedtypecode,isdefault",P9="savedqueryid,name,returnedtypecode,querytype,isdefault";async function T9(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,zE.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:"")}})}la.findDefaultViews=T9;async function O9(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 GE(e,t,r){if(!r||!/<grid\b/.test(t)||/<grid[^>]*\bobject=/.test(t))return t;let n=await O9(e,r);return n===void 0?t:t.replace(/<grid\b/,`<grid object="${n}"`)}la.viewApi={async get(e,t){let n=`/savedqueries(${(0,zr.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,zr.odataQuery)([["$select",_9]]),i=(0,Ut.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,Ut.readEtag)(i)}},async list(e,t){let r=`/savedqueries${(0,zr.odataQuery)([["$select",P9],["$filter",t?.entityLogicalName?`returnedtypecode eq '${(0,zr.odataLiteral)(t.entityLogicalName)}'`:void 0]])}`;return(await(0,zE.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,Ut.echoWrite)("savedqueryid"),a=`/savedqueries${i.query}`,o=await GE(e,n.layoutxml,n.returnedtypecode),s=(0,Ut.ensureSuccess)(await e.post(a,(0,Ut.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,Ut.resolveCreatedId)(s,"savedqueryid","view",r),etag:(0,Ut.readEtag)(s)}},async update(e,t,r,n){let i=r,a=(0,zr.normalizeGuid)(t,"id"),o=(0,Ut.echoWrite)("savedqueryid",{"If-Match":(0,Ut.requireEtag)(n,"view",a)}),s=`/savedqueries(${a})${o.query}`,l=await GE(e,i.layoutxml,i.returnedtypecode),u=(0,Ut.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,Ut.readEtag)(u)}},delete(e,t){return(0,Ut.deleteRecord)(e,"savedqueries",t)}}});var nD=g(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});ca.viewRegistration=ca.ViewAdapter=void 0;var ua=br(),Ef=on(),ri=kn(),WE=Kt(),R9=Nf(),Df=yn(),x9=ht(),JE=100,Yl=class{toArtifact(t){var r,n,i,a,o,s,l,u;(0,Df.installDomShim)();let c=(r=t.fetchxml)!==null&&r!==void 0?r:"",d=(n=t.layoutxml)!==null&&n!==void 0?n:"",p=(0,ri.parseXmlRoot)(c,"<fetch/>"),m=(0,ri.parseXmlRoot)(d,"<grid/>");return{id:(i=t.savedqueryid)!==null&&i!==void 0?i:"",name:(a=t.name)!==null&&a!==void 0?a:"",description:(o=t.description)!==null&&o!==void 0?o:"",entityLogicalName:(s=t.returnedtypecode)!==null&&s!==void 0?s:F9(p),queryType:(l=t.querytype)!==null&&l!==void 0?l:0,isDefault:(u=t.isdefault)!==null&&u!==void 0?u:!1,columns:KE(m,p),filters:eD(p),sort:ZE(p),fetchBag:c?(0,ri.projectElementBag)(p):void 0,layoutBag:d?(0,ri.projectElementBag)(m):void 0}}fromArtifact(t){(0,Df.installDomShim)();let{fetchxml:r,layoutxml:n}=jE(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,Df.installDomShim)();let{fetchxml:s,layoutxml:l}=jE(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,x9.newId)(),name:(i=t.name)!==null&&i!==void 0?i:"New View",description:(a=t.description)!==null&&a!==void 0?a:"",entityLogicalName:c,queryType:(o=t.queryType)!==null&&o!==void 0?o:0,isDefault:(s=t.isDefault)!==null&&s!==void 0?s:!1,columns:t.columns&&t.columns.length>0?t.columns:[{name:`${c}id`,width:300,order:0}],filters:(l=t.filters)!==null&&l!==void 0?l:{type:"and",conditions:[],groups:[]},sort:(u=t.sort)!==null&&u!==void 0?u:[]}}assignMissingIds(t){return t}validate(t){let r=[],n=t;(0,ua.childObjects)(n,"columns","","column",r),(0,ua.childObjects)(n,"sort","","sort",r);let i=n.filters;return i!=null&&((0,ua.isJsonObject)(i)?XE(i,"/filters",r):r.push((0,ua.issue)("/filters","filters-must-be-object",`filters must be a JSON object, got ${typeof i}`))),r}};ca.ViewAdapter=Yl;function XE(e,t,r){(0,ua.childObjects)(e,"conditions",t,"condition",r),(0,ua.childObjects)(e,"groups",t,"filterGroup",r).forEach(({node:i,index:a})=>XE(i,`${t}/groups/${a}`,r))}function F9(e){var t;let r=e.getElementsByTagName("entity")[0];return(t=r?.getAttribute("name"))!==null&&t!==void 0?t:""}function KE(e,t){var r;let n=YE(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)?JE:c,order:o},p=n.get(u);p&&(d.relatedEntity=p),o+=1,a.push(d)}return a}function YE(e){var t;let r=new Map,n=e.getElementsByTagName("link-entity");for(let i=0;i<n.length;i+=1){let a=n[i],o=a.getAttribute("name");if(!o)continue;let s=a.getElementsByTagName("attribute");for(let l=0;l<s.length;l+=1){let u=s[l],c=(t=u.getAttribute("alias"))!==null&&t!==void 0?t:u.getAttribute("name");c&&r.set(c,o)}}return r}function ZE(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=Bt(t,"filter").filter(i=>!tD(i)).map(rD);return n.length===0?r:n.length===1?n[0]:{type:"and",conditions:[],groups:n}}function tD(e){if(Bt(e,"filter").length>0)return!1;let t=Bt(e,"condition");return t.length===0?!1:t.some(r=>r.getAttribute("isquickfindfields")==="1"||Bt(r,"value").length>0)}function rD(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(rD(l))}return{type:n,conditions:i,groups:a}}function Bt(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 jE(e){let t=L9(e.columns);if(!HE(e.fetchBag)||!HE(e.layoutBag))return{fetchxml:W9({...e,columns:t}),layoutxml:j9({...e,columns:t},`${e.entityLogicalName}id`)};let r=new DOMParser().parseFromString("<root/>","text/xml"),n=QE(e.fetchBag,"fetch",r),i=QE(e.layoutBag,"grid",r),a=KE(i,n),o=!If(t,a),s=!If(e.sort,ZE(n)),l=!If(e.filters,eD(n));return o&&(k9(r,n,t,a),$9(r,i,t)),s&&G9(r,n,e.sort),l&&z9(r,n,e.filters),{fetchxml:(0,ri.serializeNode)(n),layoutxml:(0,ri.serializeNode)(i)}}function L9(e){return(e??[]).map((t,r)=>{var n,i;return{name:String(t.name).toLowerCase(),width:(n=t.width)!==null&&n!==void 0?n:JE,order:(i=t.order)!==null&&i!==void 0?i:r,...t.relatedEntity?{relatedEntity:t.relatedEntity}:{}}})}function HE(e){return!!e&&(e.c.length>0||e.a.length>0)}function QE(e,t,r){let n={n:t,a:(0,Ef.mergeAttrs)(e.a,[]),c:(0,Ef.spliceChildren)(e.c,[])};return(0,Ef.rebuildRaw)(n,(0,ri.domEngine)(r),null)}function k9(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}`)||M9(a,u);let s=YE(t),l=new Set(Bt(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=U9(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),B9(a,c),l.add(u.name)}}function M9(e,t){var r;if(t.relatedEntity){for(let n of Bt(e,"link-entity"))if(n.getAttribute("name")===t.relatedEntity){for(let i of Bt(n,"attribute"))if(((r=i.getAttribute("alias"))!==null&&r!==void 0?r:i.getAttribute("name"))===t.name){n.removeChild(i);return}}return}for(let n of Bt(e,"attribute"))if(n.getAttribute("name")===t.name){e.removeChild(n);return}}function U9(e,t,r){for(let i of Bt(t,"link-entity"))if(i.getAttribute("name")===r)return i;let n=e.createElement("link-entity");return n.setAttribute("name",r),t.appendChild(n),n}function B9(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 $9(e,t,r){let n=t.getElementsByTagName("row")[0];if(!n)return;let i=[...r].sort((s,l)=>s.order-l.order),a=q9(n);if(V9(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 q9(e){return Bt(e,"cell").filter(t=>!!t.getAttribute("name")&&t.getAttribute("ishidden")!=="1")}function V9(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 G9(e,t,r){let n=t.getElementsByTagName("entity")[0];if(n){for(let i of Bt(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 z9(e,t,r){let n=t.getElementsByTagName("entity")[0];if(n){for(let i of Bt(n,"filter"))tD(i)||n.removeChild(i);(r.conditions.length>0||r.groups.length>0)&&n.appendChild(_f(e,r))}}function If(e,t){return JSON.stringify(e)===JSON.stringify(t)}function W9(e){let t=new DOMParser().parseFromString("<fetch/>","text/xml"),r=t.documentElement;r.setAttribute("version","1.0"),r.setAttribute("mapping","logical");let n=t.createElement("entity");n.setAttribute("name",e.entityLogicalName),r.appendChild(n);let i=new Map;for(let a of[...e.columns].sort((o,s)=>o.order-s.order)){let o=t.createElement("attribute");if(o.setAttribute("name",a.name),a.relatedEntity){let s=i.get(a.relatedEntity);s||(s=t.createElement("link-entity"),s.setAttribute("name",a.relatedEntity),n.appendChild(s),i.set(a.relatedEntity,s)),s.appendChild(o)}else n.appendChild(o)}for(let a of e.sort){let o=t.createElement("order");o.setAttribute("attribute",a.attribute),o.setAttribute("descending",String(a.descending)),n.appendChild(o)}return(e.filters.conditions.length>0||e.filters.groups.length>0)&&n.appendChild(_f(t,e.filters)),new XMLSerializer().serializeToString(t)}function _f(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(_f(e,n));return r}function j9(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 H9(){return{adapter:new Yl,api:R9.viewApi,publish:(e,t,r)=>(0,WE.publishBoundEntity)(e,r),publishScope:(e,t)=>(0,WE.boundEntityPublishScope)(t)}}ca.viewRegistration=H9});function iD(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,aD=I(()=>{Ze=[];for(let e=0;e<256;++e)Ze.push((e+256).toString(16).slice(1))});function Pf(){return Zl>eu.length-16&&((0,oD.randomFillSync)(eu),Zl=0),eu.slice(Zl,Zl+=16)}var oD,eu,Zl,sD=I(()=>{oD=require("crypto"),eu=new Uint8Array(256),Zl=eu.length});var lD,Tf,uD=I(()=>{lD=require("crypto"),Tf={randomUUID:lD.randomUUID}});function Q9(e,t,r){if(Tf.randomUUID&&!t&&!e)return Tf.randomUUID();e=e||{};let n=e.random??e.rng?.()??Pf();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 iD(n)}var dt,cD=I(()=>{uD();sD();aD();dt=Q9});var Of=I(()=>{cD()});var dD=I(()=>{"use strict";});var Rf=g($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.WorkflowConditionOperator=$t.WorkflowAttributeType=$t.SystemStep=$t.FieldRequiredLevelTypes=$t.AttributeDateTimeBehavior=void 0;$t.AttributeDateTimeBehavior={None:0,Dynamic:1,DateOnly:2,StaticTimeZoneInvariant:3,UserLocal:4};$t.FieldRequiredLevelTypes={None:"0",Required:"1",Recommended:"2"};$t.SystemStep={IdentifyContact:"IdentifyContact",IdentifyAccount:"IdentifyAccount",IdentifyCustomer:"IdentifyCustomer",IdentifyCase:"IdentifyCase",Solution:"Solution",Resolve:"Resolve"};$t.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"};$t.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 AD(e){return e&&e!==yr.WorkflowAttributeType.String?e:void 0}function K9(e){return{__class:wD,parameterName:"primaryEntity",entityName:e}}function pD(e){return{__class:Ff,type:xf,typeSet:!1,behavior:yr.AttributeDateTimeBehavior.None,method:hD,parameters:[e]}}function fD(e,t,r=yr.WorkflowAttributeType.String){return{__class:vD,type:r,behavior:yr.AttributeDateTimeBehavior.None,typeSet:!1,entity:K9(t),attributeName:e}}function Y9(e,t=yr.WorkflowAttributeType.String){return{__class:bD,type:t,behavior:yr.AttributeDateTimeBehavior.None,typeSet:!1,primitiveValue:e}}function Z9(e){return{__class:yD,type:xf,typeSet:!1,behavior:yr.AttributeDateTimeBehavior.None,days:e,hours:"0",minutes:"0",months:"0",years:"0"}}function CD(e,t){let r=J9[e.operator],n=pD(fD(e.leftField,t,e.leftWorkflowType)),i;e.dateArithmetic?i=Z9(e.right.value??"0"):e.right.kind==="field"?i=fD(e.right.field??"",t,e.right.workflowType):i=Y9(e.right.value??"",e.right.workflowType??e.leftWorkflowType);let a=pD(i);return{__class:Ff,type:xf,typeSet:!1,behavior:yr.AttributeDateTimeBehavior.None,method:gD,parameters:[r,n,a]}}function SD(e){return typeof e=="object"&&e.__class===Ff}function e8(e){return typeof e=="object"&&e.__class===yD}function tu(e){return SD(e)&&e.method===hD&&e.parameters.length>0?tu(e.parameters[0]):e}function mD(e){if(typeof e!="object"||e.__class!==vD)return null;let t=e.entity;if(t&&t.__class&&t.__class!==wD)return null;let r=e.attributeName;return r?{field:r,workflowType:AD(e.type)}:null}function ND(e){if(!e)return null;let t=tu(e);if(!SD(t)||t.method!==gD||t.parameters.length!==3)return null;let r=t.parameters[0],n=X9[String(r)];if(!n)return null;let i=mD(tu(t.parameters[1]));if(!i)return null;let a=tu(t.parameters[2]);if(e8(a))return n!=="+"&&n!=="-"?null:{leftField:i.field,leftWorkflowType:i.workflowType,operator:n,right:{kind:"value",value:String(a.days??"")},dateArithmetic:!0};let o=mD(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===bD){let s=a.primitiveValue;return{leftField:i.field,leftWorkflowType:i.workflowType,operator:n,right:{kind:"value",value:s!=null?String(s):"",workflowType:AD(a.type)}}}return null}function ru(e){return!e||!e.leftField?!1:e.right.kind==="field"?!!(e.right.field&&e.right.field.trim()):!!(e.right.value&&e.right.value.trim())}var yr,hD,gD,xf,vD,bD,Ff,yD,wD,J9,X9,Lf=I(()=>{"use strict";yr=le(Rf());hD="0",gD="3",xf="0",vD="EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions",bD="PrimitiveExpression:#Microsoft.Crm.Workflow.Expressions",Ff="MethodCallExpression:#Microsoft.Crm.Workflow.Expressions",yD="TimeSpanExpression:#Microsoft.Crm.Workflow.Expressions",wD="PrimaryEntity:#Microsoft.Crm.Workflow.Expressions";J9={"+":0,"-":1,"*":2,"/":3},X9={0:"+",1:"-",2:"*",3:"/"}});var LD={};ar(LD,{DEFAULT_DESERIALIZE_LABELS:()=>FD,WorkflowJsonMapper:()=>jo,deserializeWorkflowJson:()=>o8,serializeToWorkflowJson:()=>a8});function ED(e){return e.__class==="BinaryExpression:#Microsoft.Crm.Workflow.Expressions"}function t8(e){return e.__class==="ConditionBranchStep:#Microsoft.Crm.Workflow.ObjectModel"}function zo(){return{list:[]}}function DD(e,t,r){return e&&e.list.length>0?{list:[{...e.list[0],description:t},...e.list.slice(1)]}:{list:[{labelId:dt(),languageCode:r,description:t}]}}function Bf(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:z.AttributeDateTimeBehavior.None,typeSet:!1,entity:Bf(t),attributeName:e}}function Wo(e,t){return{__class:"PrimitiveExpression:#Microsoft.Crm.Workflow.Expressions",type:t,behavior:z.AttributeDateTimeBehavior.None,typeSet:!1,primitiveValue:e}}function xD(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:Wo(e.id.replace(/[{}]/g,""),z.WorkflowAttributeType.UniqueIdentifier)}}function ID(e,t){let r=e.valueType==="Lookup"?e.lookupValue?.workflowType??z.WorkflowAttributeType.Lookup:e.valueType==="Clear"?e.valueWorkflowType??z.WorkflowAttributeType.String:z.WorkflowAttributeType.String,n=Uf[e.operator]??z.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=[xD(e.lookupValue)]}else e.valueType==="Clear"?a=[Wo(null,r)]:e.valueType==="Expression"?a=[iu(e.valueType,e.value,e.valueField,t,e.expression,e.rawExpression)]:a=[Wo(e.value??"",r)];return{__class:"BinaryExpression:#Microsoft.Crm.Workflow.Expressions",type:r,behavior:z.AttributeDateTimeBehavior.None,typeSet:!1,conditionOperatoroperator:n,left:i,right:a}}function r8(e,t,r){if(e.length===0)return null;if(e.length===1)return ID(e[0],r);let n=t==="AND"?z.WorkflowConditionOperator.LogicalAnd:z.WorkflowConditionOperator.LogicalOr,[i,...a]=e.map(o=>ID(o,r));return{__class:"BinaryExpression:#Microsoft.Crm.Workflow.Expressions",type:z.WorkflowAttributeType.String,behavior:z.AttributeDateTimeBehavior.None,typeSet:!1,conditionOperatoroperator:n,left:i,right:a}}function nu(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=ND(e);return t?{valueType:"Expression",expression:t}:{valueType:"Expression",rawExpression:e}}return{valueType:"Value",value:""}}function kf(e){let t=RD[e.conditionOperatoroperator]??"Equals",r=e.left.__class==="EntityAttributeExpression:#Microsoft.Crm.Workflow.Expressions"?e.left.attributeName:"",i=t==="ContainsData"||t==="DoesNotContainData"?{valueType:"Value"}:nu(e.right[0]);return{id:dt(),field:r,fieldDisplayName:r,operator:t,...i}}function _D(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:[...ED(e.left)?[kf(e.left)]:[],...e.right.filter(ED).map(kf)],logic:r}}return{clauses:[kf(e)],logic:"AND"}}function iu(e,t,r,n,i,a,o,s){if(e==="Field"&&r)return $f(r,n,z.WorkflowAttributeType.String);if(e==="Expression"){if(i)return CD(i,n);if(a!=null)return a}return e==="Lookup"&&o?xD(o):e==="Clear"?Wo(null,s??z.WorkflowAttributeType.String):Wo(t??"",z.WorkflowAttributeType.String)}function Mf(e,t){return{propertyName:e,propertyValueExpr:t}}function da(e){return`Step_${e.value++}`}function qt(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 PD(e,t,r){return e&&!r.used.has(e)?(r.used.add(e),e):qt(t,r)}function n8(e){return e===OD.StateCode.Activated?"Active":"Draft"}function i8(e,t){let r=e.processtriggerscope,n=e.processtriggerformid;return r===1&&n?n:r===2?"Entity":t??"Entity"}function a8(e,t=1033){return new jo({languageCode:t}).serialize(e)}function o8(e){return new jo().deserialize(e)}var OD,z,Uf,RD,FD,jo,kD=I(()=>{"use strict";Of();OD=le(jn());dD();Lf();z=le(Rf());Uf={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},RD={};for(let e of Object.keys(Uf))RD[Uf[e]]=e;FD={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"};jo=class{resolveLabel;languageCode;entityName="";stepCounter={value:0};idCounter={counts:{},used:new Set};constructor(t={}){this.resolveLabel=t.resolveLabel??(r=>FD[r]),this.languageCode=t.languageCode??1033}label(t){return this.resolveLabel(t)}serialize(t){let r=t.wfomRoot;this.entityName=t.entityLogicalName,this.stepCounter={value:r?Number(r.nextStepIndex):1},this.idCounter={counts:{},used:new Set};let n=t.scope!=="Entity"&&t.scope!=="AllForms"?t.scope:null,i=t.rootCondition?[this.serializeConditionNode(t.rootCondition)]:[],a={__class:"WorkflowStep:#Microsoft.Crm.Workflow.ObjectModel",id:r?.id??t.ruleId??dt(),name:r?.name??"Step_0",description:r!==void 0?r.description:t.description||null,stepLabels:zo(),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:qt("SetAttributeValueStep",this.idCounter),description:t.displayName||"New Action",name:t.stepName??da(this.stepCounter),stepLabels:{list:[]},specification:Mf(t.field,iu(t.valueType,t.value,t.valueField,this.entityName,t.expression,t.rawExpression,t.lookupValue,t.valueWorkflowType)),entity:Bf(this.entityName)}}makeRecommendationActionStep(t,r,n){let i=r.map(l=>this.makeApplyActionStep(l)),a=t??"",o=n?.stepLabels,s=DD(o,a,this.languageCode);return{__class:"ActionStep:#Microsoft.Crm.Workflow.ObjectModel",id:PD(n?.id,"ActionStep",this.idCounter),name:n?.name??da(this.stepCounter),description:n?.description??"Action step",stepLabels:s,steps:{list:i},actionId:null,actionType:n?.actionType??"4",processId:n?.processId??dt(),uniqueName:n?.uniqueName??`id_${dt().replace(/-/g,"")}ActionStep`}}serializeAction(t){let r=Bf(this.entityName),n=t.stepName??da(this.stepCounter),i=t.stepLabels??zo(),a={name:n,stepLabels:i,description:t.displayName},o=t.type;switch(o){case"SetFieldValue":return{...a,id:qt("SetAttributeValueStep",this.idCounter),__class:"SetAttributeValueStep:#Microsoft.Crm.Workflow.ObjectModel",entity:r,specification:Mf(t.field,iu(t.valueType,t.value,t.valueField,this.entityName,t.expression,t.rawExpression,t.lookupValue,t.valueWorkflowType))};case"SetDefaultValue":return{...a,id:qt("SetDefaultValueStep",this.idCounter),__class:"SetDefaultValueStep:#Microsoft.Crm.Workflow.ObjectModel",entity:r,specification:Mf(t.field,iu(t.valueType,t.value,t.valueField,this.entityName,t.expression,t.rawExpression,t.lookupValue,t.valueWorkflowType))};case"LockUnlock":return{...a,id:qt("SetDisplayModeStep",this.idCounter),__class:"SetDisplayModeStep:#Microsoft.Crm.Workflow.ObjectModel",controlId:t.field,controlType:"attribute",isReadOnly:t.lock,entity:r};case"SetBusinessRequired":return{...a,id:qt("SetFieldRequiredLevelStep",this.idCounter),__class:"SetFieldRequiredLevelStep:#Microsoft.Crm.Workflow.ObjectModel",controlId:t.field,controlType:"attribute",requiredLevel:t.required?z.FieldRequiredLevelTypes.Required:z.FieldRequiredLevelTypes.None,entity:r};case"SetVisibility":return{...a,id:qt("SetVisibilityStep",this.idCounter),__class:"SetVisibilityStep:#Microsoft.Crm.Workflow.ObjectModel",controlId:t.field,controlType:"attribute",isVisible:t.visible,entity:r};case"ShowErrorMessage":{let s=t.errorMessage||t.displayName,l=t.stepLabels&&t.stepLabels.list.length>0?t.stepLabels:{list:[{labelId:dt(),languageCode:this.languageCode,description:s}]};return{...a,id:qt("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=DD(t.stepLabels,s,this.languageCode),u={list:[this.makeRecommendationActionStep(t.acceptanceText,t.applyActions??[],t.recommendationActionStepMeta)]};return{...a,id:qt("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??da(this.stepCounter),n=qt("ConditionStep",this.idCounter),i=[],a=t,o=!0;for(;a;){let s=r8(a.clauses,a.logic,this.entityName),l=o?a.branchName??da(this.stepCounter):da(this.stepCounter),c={__class:"ConditionBranchStep:#Microsoft.Crm.Workflow.ObjectModel",id:o?PD(a.branchId,"ConditionBranchStep",this.idCounter):qt("ConditionBranchStep",this.idCounter),name:l,description:a.displayName,stepLabels:zo(),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:zo(),containsElsebranch:i.length>1,steps:{list:i}}}makeTerminalElseBranch(t){return{__class:"ConditionBranchStep:#Microsoft.Crm.Workflow.ObjectModel",id:qt("ConditionBranchStep",this.idCounter),name:"Else",description:null,stepLabels:zo(),conditionExpression:void 0,steps:{list:t.map(r=>this.serializeBranchItem(r))}}}serializeBranchItem(t){return t.kind==="condition"?this.serializeConditionNode(t):this.serializeAction(t)}deserialize(t){let r=t,n=null,i;if(t.wfomJson)try{let a=JSON.parse(t.wfomJson);i={id:a.id==="WorkflowStep0"||!a.id?t.workflowid??dt():a.id,name:a.name,description:a.description,nextStepIndex:a.nextStepIndex,category:a.category==="0"||a.category===0?"2":a.category,businessProcessType:a.businessProcessType,mode:a.mode,title:a.title||t.name||"",primaryEntityName:a.primaryEntityName==="1"||!a.primaryEntityName?t.primaryentity??"":a.primaryEntityName,workflowEntityId:a.workflowEntityId==="00000000-0000-0000-0000-000000000000"||!a.workflowEntityId?t.workflowid??"":a.workflowEntityId,formId:a.formId,variables:a.variables,inputs:a.inputs};let s=(a.steps?.list??[]).find(l=>l.__class==="ConditionStep:#Microsoft.Crm.Workflow.ObjectModel");s&&(n=this.deserializeConditionStep(s))}catch{}return{ruleId:t.workflowid??null,name:t.name??"",description:t.description??"",entityLogicalName:t.primaryentity??"",scope:i8(r,i?.formId),status:n8(t.statecode),rootCondition:n,wfomRoot:i}}deserializeConditionStep(t){let r=(t.steps?.list??[]).filter(t8);return this.buildConditionNodeFromBranches(r,t,!0)}buildConditionNodeFromBranches(t,r,n){let[i,...a]=t,{clauses:o,logic:s}=_D(i?.conditionExpression),l=this.deserializeBranch(i?.steps?.list??[]),u=this.deserializeElseChain(a,r),c=i?.description||i?.name||r.description||r.name||this.label("condition");return{kind:"condition",id:(n?r.id:i?.id)??dt(),displayName:c,clauses:o,logic:s,trueBranch:l,falseBranch:u,isCollapsed:!1,stepName:n?r.name:void 0,branchId:n?i?.id:void 0,branchName:n?i?.name:void 0}}deserializeElseChain(t,r){if(t.length===0)return[];let[n]=t,{clauses:i}=_D(n.conditionExpression);return i.length===0?this.deserializeBranch(n.steps?.list??[]):[this.buildConditionNodeFromBranches(t,r,!1)]}deserializeBranch(t){return t.map(r=>r.__class==="ConditionStep:#Microsoft.Crm.Workflow.ObjectModel"?this.deserializeConditionStep(r):this.deserializeAction(r)).filter(r=>r!==null)}parseRecommendationApplyActions(t){let n=(t?.list??[])[0];if(!n)return{applyActions:[]};let i={id:n.id,name:n.name,description:n.description??void 0,stepLabels:n.stepLabels,processId:n.processId,uniqueName:n.uniqueName,actionType:n.actionType},a=n.stepLabels?.list,o=a&&a.length>0?a[0].description??"":"";return{applyActions:(n.steps?.list??[]).filter(l=>l.__class==="SetAttributeValueStep:#Microsoft.Crm.Workflow.ObjectModel").map(l=>{let u=l.specification;return{id:l.id||dt(),field:u?.propertyName??"",stepName:l.name??void 0,displayName:l.description??void 0,...nu(u?.propertyValueExpr)}}),meta:i,acceptanceText:o}}deserializeAction(t){switch(t.__class){case"SetAttributeValueStep:#Microsoft.Crm.Workflow.ObjectModel":{let r=nu(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=nu(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 MD(e,t){return e==="SetFieldValue"&&t!==void 0&&s8.has(t.attributeType)&&(t.requiredLevel==="None"||t.requiredLevel==="Recommended")}var s8,UD=I(()=>{"use strict";s8=new Set(["Integer","Double","Decimal","Money","String","Memo","DateTime","Picklist","Lookup"])});function pa(e){return!l8.has(e)}function BD(e){return u8.has(e)?"string":e==="Money"?"money":e==="Integer"||e==="BigInt"?"integer":e==="Decimal"||e==="Double"?"decimal":c8.has(e)?"date":d8.has(e)?"boolean":"other"}function $D(e,t){let r=BD(e),n=BD(t);return r==="other"||n==="other"?e===t:r===n}var l8,u8,c8,d8,qD=I(()=>{"use strict";l8=new Set(["ContainsData","DoesNotContainData"]);u8=new Set(["String","Memo","EntityName"]),c8=new Set(["DateTime"]),d8=new Set(["Boolean"])});var KD={};ar(KD,{addElseIfInTree:()=>g8,appendToBranch:()=>m8,buildBreadcrumb:()=>S8,collectUsedFields:()=>A8,createEmptyAction:()=>w8,createEmptyCondition:()=>QD,findNode:()=>WD,findParent:()=>fa,getBranchPosition:()=>y8,hasAnyTriggerGeneratingAction:()=>zf,isTriggerGeneratingAction:()=>zD,moveBranchItemInTree:()=>b8,removeElseIfInTree:()=>v8,removeNodeFromTree:()=>jD,updateActionInTree:()=>Vf,updateConditionInTree:()=>ni,validateTree:()=>C8});function zD(e){return p8.has(e.type)}function qf(e,t,r,n,i,a){let o=i.get(r);o&&f8.has(o.attributeType)&&n==="Value"&&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.`})}function VD(e,t,r,n,i,a,o){if(i!=="Clear")return;let s=a.get(n);MD(r,s)||o.push({nodeId:e,kind:"INVALID_CLEAR_FOR_FIELD",message:`${t}: Clear is only supported for optional fields with a legacy-compatible type.`})}function zf(e){if(!e)return!1;for(let t of[...e.trueBranch,...e.falseBranch])if(t.kind==="action"){if(zD(t))return!0}else if(zf(t))return!0;return!1}function WD(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=WD(r,t);if(n)return n}}return null}function fa(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=fa(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=fa(n,t);if(i)return i}}return null}function jD(e,t){return{...e,trueBranch:GD(e.trueBranch,t),falseBranch:GD(e.falseBranch,t)}}function GD(e,t){return e.filter(r=>r.id!==t).map(r=>r.kind==="condition"?jD(r,t):r)}function ni(e,t,r){return e.id===t?r(e):{...e,trueBranch:e.trueBranch.map(n=>n.kind==="condition"?ni(n,t,r):n),falseBranch:e.falseBranch.map(n=>n.kind==="condition"?ni(n,t,r):n)}}function Vf(e,t,r){return{...e,trueBranch:e.trueBranch.map(n=>n.kind==="action"&&n.id===t?r(n):n.kind==="condition"?Vf(n,t,r):n),falseBranch:e.falseBranch.map(n=>n.kind==="action"&&n.id===t?r(n):n.kind==="condition"?Vf(n,t,r):n)}}function m8(e,t,r,n){return ni(e,t,i=>({...i,trueBranch:r==="true"?[...i.trueBranch,n]:i.trueBranch,falseBranch:r==="false"?[...i.falseBranch,n]:i.falseBranch}))}function h8(e){return e.length===1&&e[0].kind==="condition"}function g8(e,t,r){return ni(e,t,n=>HD(n,r))}function HD(e,t){if(h8(e.falseBranch))return{...e,falseBranch:[HD(e.falseBranch[0],t)]};let r=QD(t);return r.falseBranch=e.falseBranch,{...e,falseBranch:[r]}}function v8(e,t){let r=fa(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 ni(e,r.node.id,a=>({...a,falseBranch:i}))}function b8(e,t,r){let n=fa(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 ni(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 y8(e,t){let r=fa(e,t);if(!r)return null;let n=r.branch==="true"?r.node.trueBranch:r.node.falseBranch;return{isFirst:r.index===0,isLast:r.index===n.length-1}}function QD(e){return{kind:"condition",id:dt(),displayName:e??"New Condition",clauses:[],logic:"AND",trueBranch:[],falseBranch:[],isCollapsed:!1}}function w8(e,t){let r={kind:"action",id:dt(),type:e,displayName:t??`New ${e}`};switch(e){case"Recommendation":return{...r,type:"Recommendation",field:"",recommendationTitle:"",messageText:"",applyActions:[{id:dt(),field:"",valueType:"Value",value:""}]};case"LockUnlock":return{...r,type:"LockUnlock",field:"",lock:!0};case"ShowErrorMessage":return{...r,type:"ShowErrorMessage",field:"",errorMessage:""};case"SetFieldValue":return{...r,type:"SetFieldValue",field:"",valueType:"Value",value:""};case"SetDefaultValue":return{...r,type:"SetDefaultValue",field:"",valueType:"Value",value:""};case"SetBusinessRequired":return{...r,type:"SetBusinessRequired",field:"",required:!0};case"SetVisibility":return{...r,type:"SetVisibility",field:"",visible:!0};default:return{...r,type:"SetFieldValue",field:"",valueType:"Value",value:""}}}function A8(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 C8(e,t=[]){if(!e)return[{nodeId:"root",kind:"NO_CONDITION",message:"A business rule must include at least one condition."}];let r=[],n=new Map(t.map(i=>[i.logicalName,i]));return XD(e,r,n),zf(e)||r.push({nodeId:"root",kind:"NO_ACTION",message:"A business rule must include at least one action step."}),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."}),e.clauses.forEach(n=>{if(!n.field)t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_FIELD",message:"Please select a field for this clause."});else if(pa(n.operator)&&n.valueType==="Value"&&!n.value)t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_VALUE",message:"Please enter a value for this clause."});else if(pa(n.operator)&&n.valueType==="Value"&&n.value){let i=r.get(n.field);i?.maxLength&&n.value.length>i.maxLength&&t.push({nodeId:e.id,kind:"CLAUSE_VALUE_TOO_LONG",message:`Value exceeds the field's maximum length of ${i.maxLength} characters.`})}else pa(n.operator)&&n.valueType==="Expression"&&!n.rawExpression&&!ru(n.expression)&&t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_VALUE",message:"Please complete the formula for this clause."});pa(n.operator)&&n.valueType==="Lookup"&&(!n.lookupValue?.entityType||!n.lookupValue.id||!n.lookupValue.label)&&t.push({nodeId:e.id,kind:"EMPTY_CLAUSE_VALUE",message:"Please select a lookup record for this clause."}),pa(n.operator)&&qf(e.id,"Condition",n.field,n.valueType,r,t)}),[...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.`});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.`})}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.`});else if(r.size>0){let i=r.get(n.field),a=r.get(n.valueField);i&&a&&!$D(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.`})}}else(n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&n.valueType==="Expression"?!n.rawExpression&&!ru(n.expression)&&t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:`${n.type}: please complete the formula.`}):(n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&n.valueType==="Lookup"&&(!n.lookupValue?.entityType||!n.lookupValue.id||!n.lookupValue.label)&&t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:`${n.type}: please complete the lookup record.`});if((n.type==="SetFieldValue"||n.type==="SetDefaultValue")&&n.field&&(qf(n.id,n.type,n.field,n.valueType,r,t),VD(n.id,n.type,n.type,n.field,n.valueType,r,t)),n.type==="Recommendation"){let i=n.applyActions??[];i.length===0&&t.push({nodeId:n.id,kind:"RECOMMENDATION_NO_APPLY_ACTION",message:"Recommendation: add at least one action to apply."}),i.forEach(a=>{a.field?a.valueType==="Field"?a.valueField||t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:"Recommendation: please select a field to copy from."}):a.valueType==="Expression"?!a.rawExpression&&!ru(a.expression)&&t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:"Recommendation: please complete the formula."}):a.valueType==="Lookup"?(!a.lookupValue?.entityType||!a.lookupValue.id||!a.lookupValue.label)&&t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:"Recommendation: please complete the lookup record."}):a.valueType==="Clear"||a.value||t.push({nodeId:n.id,kind:"EMPTY_ACTION_VALUE",message:"Recommendation: please enter a value for each action to apply."}):t.push({nodeId:n.id,kind:"EMPTY_ACTION_FIELD",message:"Recommendation: a target field is required for each action to apply."}),a.field&&(qf(n.id,"Recommendation",a.field,a.valueType,r,t),VD(n.id,"Recommendation","SetFieldValue",a.field,a.valueType,r,t))})}}})}function S8(e,t){let r=[];return Gf(e,t,r),r}function Gf(e,t,r){if(e.id===t)return r.push({conditionId:e.id,label:e.displayName}),!0;for(let n of e.trueBranch)if(n.kind==="condition"){if(r.push({conditionId:e.id,label:e.displayName}),Gf(n,t,r))return!0;r.pop()}for(let n of e.falseBranch)if(n.kind==="condition"){if(r.push({conditionId:e.id,label:e.displayName}),Gf(n,t,r))return!0;r.pop()}return!1}var p8,f8,YD=I(()=>{"use strict";Of();UD();qD();Lf();p8=new Set(["LockUnlock","ShowErrorMessage","SetFieldValue","SetDefaultValue","SetBusinessRequired","SetVisibility"]);f8=new Set(["Lookup","Customer","Owner"])});var Wf=g(au=>{"use strict";Object.defineProperty(au,"__esModule",{value:!0});au.cloneJson=void 0;function N8(e){return JSON.parse(JSON.stringify(e))}au.cloneJson=N8});var t2=g(ii=>{"use strict";Object.defineProperty(ii,"__esModule",{value:!0});ii.businessRuleApi=ii.WFOM_API_UNAVAILABLE_CODE=void 0;var Wr=jn(),E8=Jt(),ot=ge(),Cn=Z(),jf=ne();ii.WFOM_API_UNAVAILABLE_CODE="BUSINESS_RULE_API_UNAVAILABLE";async function ZD(e,t,r,n){let i=`/workflows(${_8})/Microsoft.Dynamics.CRM.${t}`;try{return(0,ot.ensureSuccess)(await e.post(i,{Entity:r.Entity,WfomJson:r.WfomJson},{headers:n}),e.apiUrl(i))}catch(a){throw a?.statusCode!==404?a:new jf.SdkError(ii.WFOM_API_UNAVAILABLE_CODE,`This environment does not expose 'Microsoft.Dynamics.CRM.${t}', so business rules cannot be authored here. That member is how the modern business-rule designer reads and writes rules; environments without it (18 of 20 measured 2026-08-28) have no supported authoring path. 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 D8(e,t){let r=`/workflows(${t})${(0,Cn.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,ot.readEtag)(n),statecode:typeof i?.statecode=="number"?i.statecode:null,statuscode:typeof i?.statuscode=="number"?i.statuscode:null}}catch{return null}}async function I8(e,t,r){let n=await D8(e,t);if(n===null||n.etag===null)throw new jf.SdkError(ot.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 jf.SdkError(ot.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 _8="00000000-0000-0000-0000-000000000000",ou={"Content-Type":"application/json",Accept:"application/json","OData-Version":"4.0","OData-MaxVersion":"4.0"},P8="workflowid,name,description,primaryentity,statecode,category,type",T8="category eq 2 and type eq 1";async function e2(e,t,r){var n;if(r==="Draft")return null;let i=(0,Cn.normalizeGuid)(t,"workflowid"),a=r==="Active",o={statecode:a?Wr.StateCode.Activated:Wr.StateCode.Draft,statuscode:a?Wr.StatusCode.Activated:Wr.StatusCode.Draft},s=`/workflows(${i})`,l=(0,ot.ensureSuccess)(await e.patch(s,o,{headers:ou}),e.apiUrl(s));return(n=(0,ot.readEtag)(l))!==null&&n!==void 0?n:await Ho(e,i)}async function Ho(e,t){let r=`/workflows(${t})${(0,Cn.odataQuery)([["$select","workflowid"]])}`;try{let n=await e.get(r);return n.status>=200&&n.status<300?(0,ot.readEtag)(n):null}catch{return null}}async function O8(e,t,r){let n=await Ho(e,t),i=await r(),a=(0,ot.readEtag)(i);if(a)return{response:i,etag:a};let o=await Ho(e,t);return{response:i,etag:n!==null&&n===o?o:null}}ii.businessRuleApi={async get(e,t){let r=(0,Cn.normalizeGuid)(t,"id"),n=`/workflows(${r})/Microsoft.Dynamics.CRM.RetrieveProcessWithWfomJson`,{response:i,etag:a}=await O8(e,r,async()=>(0,ot.ensureSuccess)(await e.get(n),e.apiUrl(n)));return{raw:i.body,etag:a}},async list(e,t){let r=[T8];t?.entityLogicalName&&r.push(`primaryentity eq '${(0,Cn.odataLiteral)(t.entityLogicalName)}'`);let n=`/workflows${(0,Cn.odataQuery)([["$select",P8],["$filter",r.join(" and ")]])}`;return(await(0,E8.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,Cn.normalizeGuid)(n.Entity.workflowid,"workflowid"),a=await ZD(e,"CreateProcessWithWfomJson",n,ou),o=(0,ot.resolveCreatedId)(a,"workflowid","business rule",i),s=null;try{s=await e2(e,o,n.status)}catch(l){try{await(0,ot.deleteRecord)(e,"workflows",o)}catch{}throw l}return{id:o,etag:(r=s??(0,ot.readEtag)(a))!==null&&r!==void 0?r:await Ho(e,o)}},async update(e,t,r,n){var i,a;let o=r,s=(0,Cn.normalizeGuid)(t,"id"),l=`/workflows(${s})`,u={...ou,"If-Match":(0,ot.requireEtag)(n,"business rule",s)},c=await I8(e,s,u["If-Match"]),d=c.statecode===Wr.StateCode.Activated;d&&(0,ot.ensureSuccess)(await e.patch(l,{statecode:Wr.StateCode.Draft,statuscode:Wr.StatusCode.Draft},{headers:u}),e.apiUrl(l));let p;try{p=await ZD(e,"UpdateProcessWithWfomJson",o,u)}catch(h){if(d)try{await e.patch(l,{statecode:Wr.StateCode.Activated,statuscode:(i=c.statuscode)!==null&&i!==void 0?i:Wr.StatusCode.Activated},{headers:ou})}catch{}throw h}let m=await e2(e,s,o.status);return{id:s,etag:(a=m??(0,ot.readEtag)(p))!==null&&a!==void 0?a:await Ho(e,s)}},delete(e,t){return(0,ot.deleteRecord)(e,"workflows",t)}}});var u2=g(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.BUSINESS_RULE_NULL_GUID=Nn.businessRuleRegistration=Nn.BusinessRuleAdapter=void 0;var r2=ws(),Hf=jn(),n2=(kD(),or(LD)),R8=(YD(),or(KD)),i2=Kt(),a2=ne(),x8=Wf(),Sn=br(),F8=t2(),L8=ht();function k8(e){return s2((0,x8.cloneJson)(e))}function s2(e){var t,r;let n=i=>(i??[]).map(a=>M8(a)?s2(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 M8(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 U8(e){var t;if(e===null||typeof e!="object"||Array.isArray(e))throw new a2.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 a2.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 B8="00000000-0000-0000-0000-000000000000";Nn.BUSINESS_RULE_NULL_GUID=B8;var $8=new Set(["Recommendation","LockUnlock","ShowErrorMessage","SetFieldValue","SetDefaultValue","SetBusinessRequired","SetVisibility"]),q8=["ruleId","name","description","entityLogicalName","scope","status","rootCondition"],V8=["kind","id","displayName","logic","clauses","trueBranch","falseBranch"],G8=["id","field","fieldDisplayName","operator","valueType","value","valueField","lookupValue","expression","rawExpression","valueWorkflowType"];function o2(e){var t;return(0,Sn.isJsonObject)(e)?{...e,label:(t=e.label)!==null&&t!==void 0?t:""}:e}function z8(e){return{...e,...e.lookupValue!==void 0?{lookupValue:o2(e.lookupValue)}:{},...Array.isArray(e.applyActions)?{applyActions:e.applyActions.map(t=>(0,Sn.isJsonObject)(t)&&t.lookupValue!==void 0?{...t,lookupValue:o2(t.lookupValue)}:t)}:{}}}var su=class{toArtifact(t){let r=this.residualBag(t,q8),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){var r;let n=t.rootCondition?this.conditionFromJson(t.rootCondition):null;return{...(r=t.bag)!==null&&r!==void 0?r:{},ruleId:t.id,name:t.name,description:t.description,entityLogicalName:t.entityLogicalName,scope:t.scope,status:t.status,rootCondition:n}}fromApiResponse(t){var r;let n=t??{},i={...(r=n.Entity)!==null&&r!==void 0?r:{},wfomJson:n.WfomJson},a=(0,n2.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,n2.serializeToWorkflowJson)(n),a=(r=n.ruleId)!==null&&r!==void 0?r:(0,r2.v4)();return{Entity:this.buildWorkflowEntity(n,a),WfomJson:i,status:t.status}}createDefault(t){var r,n,i,a,o,s;let l={ruleId:(r=t.id)!==null&&r!==void 0?r:null,name:(n=t.name)!==null&&n!==void 0?n:"New business rule",description:(i=t.description)!==null&&i!==void 0?i:"",entityLogicalName:(a=t.entityLogicalName)!==null&&a!==void 0?a:"",scope:(o=t.scope)!==null&&o!==void 0?o:"Entity",status:(s=t.status)!==null&&s!==void 0?s:"Draft",rootCondition:t.rootCondition===void 0?(0,R8.createEmptyCondition)():t.rootCondition===null?null:this.conditionFromJson(k8(U8(t.rootCondition)))},u=this.toArtifact(l);return u.id||(u.id=(0,r2.v4)()),u}assignMissingIds(t){return(0,L8.assignMissingIds)(t)}validate(t){let r=[],n=t.rootCondition;return n==null?r:(0,Sn.isJsonObject)(n)?(l2(n,"/rootCondition",r),r):(r.push((0,Sn.issue)("/rootCondition","condition-must-be-object",`rootCondition must be a JSON object or null, got ${typeof n}`)),r)}residualBag(t,r){let n=new Set(r),i={};for(let a of Object.keys(t)){if(n.has(a))continue;let o=t[a];o!==void 0&&(i[a]=o)}return Object.keys(i).length>0?i:void 0}buildWorkflowEntity(t,r){let n=t.scope!=="Entity"&&t.scope!=="AllForms";return{"@odata.type":"#Microsoft.Dynamics.CRM.workflow",name:t.name,description:t.description,workflowid:r,ondemand:!1,subprocess:!1,triggeroncreate:!1,triggerondelete:!1,category:Hf.WorkflowCategory.BusinessRule,type:Hf.WorkflowTypeCode.Definition,mode:1,scope:Hf.WorkflowScope.Organization,primaryentity:t.entityLogicalName,iscrmuiworkflow:!0,processtriggerscope:n?1:2,...n?{processtriggerformid:t.scope}:{}}}conditionToJson(t){let r=this.residualBag(t,V8),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,G8),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){return{...t}}conditionFromJson(t){var r;return{kind:"condition",isCollapsed:!1,...(r=t.bag)!==null&&r!==void 0?r:{},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,n,i;return{...(r=t.bag)!==null&&r!==void 0?r:{},id:t.id,field:t.field,fieldDisplayName:(n=t.fieldDisplayName)!==null&&n!==void 0?n:t.field,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,label:(i=t.lookupValue.label)!==null&&i!==void 0?i:""}}:{},...t.expression!==void 0?{expression:t.expression}:{},...t.rawExpression!==void 0?{rawExpression:t.rawExpression}:{},...t.valueWorkflowType!==void 0?{valueWorkflowType:t.valueWorkflowType}:{}}}branchItemFromJson(t){return this.isConditionJson(t)?this.conditionFromJson(t):this.actionFromJson(t)}actionFromJson(t){if(!$8.has(t.type))throw new Error(`Unsupported business-rule action type: ${t.type}`);return j8(t),{...z8(t),kind:"action",type:t.type}}isConditionJson(t){return Object.prototype.hasOwnProperty.call(t,"clauses")&&Object.prototype.hasOwnProperty.call(t,"logic")&&!Object.prototype.hasOwnProperty.call(t,"type")}};Nn.BusinessRuleAdapter=su;function l2(e,t,r){(0,Sn.optionalEnum)(e,"logic",["AND","OR"],t,"condition-logic-invalid",r),(0,Sn.childObjects)(e,"clauses",t,"clause",r);for(let n of["trueBranch","falseBranch"])(0,Sn.childObjects)(e,n,t,"branchItem",r).forEach(({node:a,index:o})=>{"clauses"in a||"trueBranch"in a||"falseBranch"in a?l2(a,`${t}/${n}/${o}`,r):W8(a,`${t}/${n}/${o}`,r)})}function W8(e,t,r){e.type==="SetDefaultValue"&&e.valueType==="Clear"&&r.push((0,Sn.issue)(`${t}/valueType`,"clear-only-set-field-value","Clear is only supported for SetFieldValue actions."))}function j8(e){if(e.type==="SetDefaultValue"&&e.valueType==="Clear")throw new Error("Clear is only supported for SetFieldValue actions.")}function H8(){return{adapter:new su,api:F8.businessRuleApi,publish:(e,t,r)=>(0,i2.publishBoundEntity)(e,r),publishScope:(e,t)=>(0,i2.boundEntityPublishScope)(t)}}Nn.businessRuleRegistration=H8});var w2=g(En=>{"use strict";Object.defineProperty(En,"__esModule",{value:!0});En.appRegistration=En.AppAdapter=En.HEADER_NAV_BOOLEAN_RULE=void 0;var jr=br(),je=on(),Jo=kn(),Q8=Kt(),J8=ks(),Qf=Os(),Jf=yn(),X8=ht(),K8=Z(),h2=pi(),Y8=ne(),g2=xs();Object.defineProperty(En,"HEADER_NAV_BOOLEAN_RULE",{enumerable:!0,get:function(){return g2.HEADER_NAV_BOOLEAN_RULE}});var cu="7.0.0.0",c2=`<SiteMap IntroducedVersion="${cu}"></SiteMap>`,Z8="/_imgs/imagestrips/transparent_spacer.gif",eV="/_imgs/TableIconsFluentV9/document_one_page_sparkle.svg",tV=["Entity","Url","DefaultDashboard","Page","GenPageId"],Qo="sitemapId",d2="sitemapName",rV="sitemapNameUnique";function p2(e,t,r){if(e===void 0)return r;if(typeof e!="boolean")throw new Y8.ValidationError("app",t,[v2(e)]);return e}function v2(e){return(0,jr.issue)("/headerAndNavigationRefresh",g2.HEADER_NAV_BOOLEAN_RULE,`headerAndNavigationRefresh must be a boolean, got ${typeof e}`)}function nV(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,K8.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=h2.DEFAULT_LCID){this.lcid=t}toArtifact(t){let{bag:r,modeledEls:n}=lu(t,"Area");return{id:"",name:"",uniqueName:"",description:"",siteMap:{areas:n.map(i=>this.areaToJson(i)),bag:r},bag:(0,je.emptyBag)()}}fromArtifact(t){(0,Jf.installDomShim)();let r=this.assignMissingIds(JSON.parse(JSON.stringify(t))),n=new DOMParser().parseFromString("<root/>","text/xml"),i=this.rootToRaw(r);return(0,je.rebuildRaw)(i,(0,Jo.domEngine)(n),null)}fromApiResponse(t){var r,n,i,a,o,s,l,u,c,d;(0,Jf.installDomShim)();let p=t??{},m=(r=p.$sitemap)!==null&&r!==void 0?r:p,h=(0,Jo.parseXmlRoot)((n=m.sitemapxml)!==null&&n!==void 0?n:c2,c2),w=this.toArtifact(h);return w.id=(i=p.appmoduleid)!==null&&i!==void 0?i:"",w.name=(a=p.name)!==null&&a!==void 0?a:"",w.uniqueName=(o=p.uniquename)!==null&&o!==void 0?o:"",w.description=(s=p.description)!==null&&s!==void 0?s:"",w.bag={a:[[Qo,(u=(l=m.sitemapid)!==null&&l!==void 0?l:p._sitemapid_value)!==null&&u!==void 0?u:""],[d2,(c=m.sitemapname)!==null&&c!==void 0?c:""],[rV,(d=m.sitemapnameunique)!==null&&d!==void 0?d:""]],c:[]},w}toApiPayload(t){var r,n,i,a,o,s,l,u,c,d,p,m,h,w,y;(0,Jf.installDomShim)();let N=(0,Jo.serializeNode)(this.fromArtifact(t)),D=[],x=[];for(let q of(n=(r=t.siteMap)===null||r===void 0?void 0:r.areas)!==null&&n!==void 0?n:[])for(let G of(i=q.groups)!==null&&i!==void 0?i:[])for(let M of(a=G.subAreas)!==null&&a!==void 0?a:[])M.type==="Entity"&&M.entity?D.push(M.entity):M.type==="DashBoard"&&M.dashboardId&&x.push(M.dashboardId);let F=(o=t.bag)!==null&&o!==void 0?o:(0,je.emptyBag)();return{sitemapId:(s=m2(F,Qo))!==null&&s!==void 0?s:"",sitemapxml:N,sitemapname:m2(F,d2)||t.name,appModuleId:t.id,appModuleName:t.name,appModuleDescription:t.description,appModuleUniqueName:t.uniqueName,...t.iconWebResourceId?{iconWebResourceId:t.iconWebResourceId}:{},...t.headerAndNavigationRefresh===void 0?{}:{appSettings:{[Qf.HEADER_AND_NAVIGATION_REFRESH]:p2(t.headerAndNavigationRefresh,(l=t.id)!==null&&l!==void 0?l:"(unknown)",!0)?Qf.APP_SETTING_ON:Qf.APP_SETTING_OFF}},...typeof t.published=="boolean"?{published:t.published}:{},entities:D,components:{forms:(c=(u=t.components)===null||u===void 0?void 0:u.forms)!==null&&c!==void 0?c:[],views:(p=(d=t.components)===null||d===void 0?void 0:d.views)!==null&&p!==void 0?p:[],charts:(h=(m=t.components)===null||m===void 0?void 0:m.charts)!==null&&h!==void 0?h:[],dashboards:[...(y=(w=t.components)===null||w===void 0?void 0:w.dashboards)!==null&&y!==void 0?y:[],...x]}}}createDefault(t){var r,n,i,a,o,s;let l=!((r=t.siteMap)===null||r===void 0)&&r.areas&&t.siteMap.areas.length>0?t.siteMap.areas:[{id:"",title:"Area",groups:[{id:"",title:"Group",subAreas:[]}]}];return{id:(n=t.id)!==null&&n!==void 0?n:(0,X8.newId)(),name:(i=t.name)!==null&&i!==void 0?i:"New App",uniqueName:(a=t.uniqueName)!==null&&a!==void 0?a:"",description:(o=t.description)!==null&&o!==void 0?o:"",siteMap:{areas:l},...t.iconWebResourceId?{iconWebResourceId:t.iconWebResourceId}:{},headerAndNavigationRefresh:p2(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(Yf):Array.isArray(r.areas)?r.areas.forEach(Yf):Array.isArray(r.groups)?Yf(r):Array.isArray(r.subAreas)?y2(r):"type"in r&&pu(r,"subarea"),t}validate(t){let r=[],n=t.published;n!==void 0&&typeof n!="boolean"&&r.push((0,jr.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(v2(a)),i==null)return r;if(!(0,jr.isJsonObject)(i))return r.push((0,jr.issue)("/siteMap","sitemap-must-be-object",`siteMap must be a JSON object, got ${typeof i}`)),r;let o=(0,jr.childObjects)(i,"areas","/siteMap","area",r),s=new Map;return o.forEach(({node:l,index:u})=>{let c=`/siteMap/areas/${u}`;(0,jr.childObjects)(l,"groups",c,"group",r).forEach(({node:p,index:m})=>{let h=`${c}/groups/${m}`;(0,jr.childObjects)(p,"subAreas",h,"subArea",r).forEach(({node:y,index:N})=>{let D=`${h}/subAreas/${N}`;(0,jr.optionalEnum)(y,"type",["Entity","URL","DashBoard","CustomPage","GenPage"],D,"subarea-type-invalid",r);let x=nV(y);if(!x)return;let F=s.get(x);if(F===void 0){s.set(x,D);return}r.push((0,jr.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[Qo];if(!n)return;t.bag||(t.bag=(0,je.emptyBag)());let i=t.bag.a.find(a=>a[0]===Qo);i?i[1]=n:t.bag.a.push([Qo,n])}areaToJson(t){var r;let{bag:n,modeledEls:i}=lu(t,"Group"),a={id:(r=t.getAttribute("Id"))!==null&&r!==void 0?r:"",title:Xf(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}=lu(t,"SubArea");return{id:(r=t.getAttribute("Id"))!==null&&r!==void 0?r:"",title:Xf(t,this.lcid),subAreas:i.map(a=>this.subAreaToJson(a)),bag:n}}subAreaToJson(t){var r;let{bag:n}=lu(t,null),i=iV(t),a={id:(r=t.getAttribute("Id"))!==null&&r!==void 0?r:"",type:i,title:Xf(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!==Z8&&(a.icon=o);let s=t.getAttribute("VectorIcon");return s&&(a.vectorIcon=s),a}rootToRaw(t){var r,n,i,a;let o=(n=(r=t.siteMap)===null||r===void 0?void 0:r.bag)!==null&&n!==void 0?n:(0,je.emptyBag)(),l=uu(o)?[["IntroducedVersion",cu]]:[],u=((a=(i=t.siteMap)===null||i===void 0?void 0:i.areas)!==null&&a!==void 0?a:[]).map(c=>this.areaToRaw(c));return{n:"SiteMap",a:(0,je.mergeAttrs)(o.a,l),c:(0,je.spliceChildren)(o.c,u)}}areaToRaw(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:(0,je.emptyBag)(),i=uu(n),a=[];t.id&&a.push(["Id",t.id]),i&&a.push(["ShowGroups","true"],["ResourceId","SitemapDesigner.NewTitle"],["DescriptionResourceId","SitemapDesigner.NewTitle"],["IntroducedVersion",cu]),t.icon!==void 0&&a.push(["Icon",t.icon]),t.vectorIcon!==void 0&&a.push(["VectorIcon",t.vectorIcon]);let o=t.groups.map(l=>this.groupToRaw(l)),s=Kf((0,je.spliceChildren)(n.c,o),t.title,i,this.lcid);return{n:"Area",a:(0,je.mergeAttrs)(n.a,a),c:s}}groupToRaw(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:(0,je.emptyBag)(),i=uu(n),a=[];t.id&&a.push(["Id",t.id]),i&&a.push(["ResourceId","SitemapDesigner.NewGroup"],["DescriptionResourceId","SitemapDesigner.NewGroup"],["ToolTipResourseId","SitemapDesigner.Unknown"],["IntroducedVersion",cu],["IsProfile","false"]);let o=t.subAreas.map(l=>this.subAreaToRaw(l)),s=Kf((0,je.spliceChildren)(n.c,o),t.title,i,this.lcid);return{n:"Group",a:(0,je.mergeAttrs)(n.a,a),c:s}}subAreaToRaw(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:(0,je.emptyBag)(),i=uu(n),a=oV(n.a,t.type),o=[];t.id&&o.push(["Id",t.id]),lV(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]),t.vectorIcon!==void 0?o.push(["VectorIcon",t.vectorIcon]):t.type==="GenPage"&&!aV(a,"VectorIcon")&&o.push(["VectorIcon",eV]);let s=Kf((0,je.spliceChildren)(n.c,[]),t.title,i,this.lcid);return{n:"SubArea",a:(0,je.mergeAttrs)(a,o),c:s}}};En.AppAdapter=du;function lu(e,t){let r=(0,Jo.nodeLikeFromDom)(e).getAllProperties().map(s=>[s.key,s.value]),n=[],i=[],a=e.childNodes,o=0;for(let s=0;s<a.length;s+=1){let l=a[s];l.nodeType!==1&&l.nodeType!==3||(l.nodeType===1&&t!==null&&l.tagName===t?i.push(l):n.push({i:o,node:(0,je.rawFromNode)((0,Jo.nodeLikeFromDom)(l))}),o+=1)}return{bag:{a:r,c:n},modeledEls:i}}function f2(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 Xf(e,t){var r;let n=f2(e,"Titles")[0];if(!n)return"";let a=f2(n,"Title").find(o=>o.getAttribute("LCID")===String(t));return a&&(r=a.getAttribute("Title"))!==null&&r!==void 0?r:""}function iV(e){return e.getAttribute("GenPageId")?"GenPage":e.getAttribute("Entity")?"Entity":e.getAttribute("Page")?"CustomPage":e.getAttribute("DefaultDashboard")?"DashBoard":"URL"}function uu(e){return e.a.length===0&&e.c.length===0}function aV(e,t){return e.some(([r])=>r===t)}function m2(e,t){let r=e.a.find(([n])=>n===t);return r?r[1]:void 0}function oV(e,t){let r=sV(t);return e.filter(([n])=>!tV.includes(n)||r.has(n)).map(n=>[n[0],n[1]])}function sV(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 lV(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 Kf(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]=uV(e[i],t,n),a}return r?[cV(t,n),...e]:e}function uV(e,t,r){let n=!1,i=e.c.map(a=>!n&&a.n==="Title"&&dV(a,"LCID")===String(r)?(n=!0,{n:a.n,a:(0,je.mergeAttrs)(a.a,[["Title",t]]),c:a.c}):a);return n||i.unshift(b2(t,r)),{n:e.n,a:e.a.map(a=>[a[0],a[1]]),c:i}}function cV(e,t){return{n:"Titles",a:[],c:[b2(e,t)]}}function b2(e,t){return{n:"Title",a:[["LCID",String(t)],["Title",e]],c:[]}}function dV(e,t){let r=e.a.find(([n])=>n===t);return r?r[1]:void 0}function pV(e){let t="0123456789abcdef",r="";for(let n=0;n<e;n+=1)r+=t[Math.floor(Math.random()*t.length)];return r}function pu(e,t){e&&(typeof e.id!="string"||e.id.length===0)&&(e.id=`${t}_${pV(8)}`)}function Yf(e){var t;pu(e,"area");for(let r of(t=e.groups)!==null&&t!==void 0?t:[])y2(r)}function y2(e){var t;pu(e,"group");for(let r of(t=e.subAreas)!==null&&t!==void 0?t:[])pu(r,"subarea")}function fV(e=h2.DEFAULT_LCID){return{adapter:new du(e),api:J8.appApi,languageSensitive:!0,publish:(t,r)=>(0,Q8.publishAppModule)(t,r),publishScope:t=>({envelope:"appmodule",targetIds:[t]})}}En.appRegistration=fV});var A2={};ar(A2,{ActionType:()=>em,AppActionOrigin:()=>lm,AppActionVisibilityType:()=>sm,ButtonType:()=>rm,CannotUpdateAppActionColumns:()=>mV,Context:()=>im,IconType:()=>tm,Location:()=>nm,OnClickEventType:()=>om,Scope:()=>am,VisibilityType:()=>Zf});var Zf,em,tm,rm,nm,im,am,om,sm,lm,mV,C2=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"})(Zf||(Zf={}));(function(e){e[e.NotSupported=0]="NotSupported",e[e.None=1]="None",e[e.JavaScript=2]="JavaScript",e[e.Expression=3]="Expression"})(em||(em={}));(function(e){e[e.NoIcon=0]="NoIcon",e[e.UseIcon=1]="UseIcon",e[e.UseWebResource=2]="UseWebResource"})(tm||(tm={}));(function(e){e[e.Standard=0]="Standard",e[e.Dropdown=1]="Dropdown",e[e.Split=2]="Split",e[e.Group=3]="Group"})(rm||(rm={}));(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"})(nm||(nm={}));(function(e){e[e.All=0]="All",e[e.Entity=1]="Entity"})(im||(im={}));(function(e){e[e.App=0]="App",e[e.Entity=1]="Entity",e[e.Global=2]="Global"})(am||(am={}));(function(e){e[e.None=0]="None",e[e.Formula=1]="Formula",e[e.JavaScript=2]="JavaScript"})(om||(om={}));(function(e){e[e.None=0]="None",e[e.Formula=1]="Formula",e[e.ClassicRules=2]="ClassicRules"})(sm||(sm={}));(function(e){e[e.Default=0]="Default",e[e.Migrated=1]="Migrated",e[e.MigratedClone=2]="MigratedClone"})(lm||(lm={}));mV=["appactionid","appmoduleid","context","contextvalue","location","name","type","uniquename","isdisabled","origin"]});var N2=g(fu=>{"use strict";Object.defineProperty(fu,"__esModule",{value:!0});fu.commandApi=void 0;var Tt=ge(),hV=ne(),Vt=Z(),gV="OnClickEventJavaScriptWebResourceId($select=name,webresourceid),IconWebResourceId($select=name,webresourceid)";async function um(e,t){let r=`/EntityDefinitions(LogicalName='${(0,Vt.odataLiteral)(t)}')${(0,Vt.odataQuery)([["$select","MetadataId"]])}`,i=(0,Tt.ensureSuccess)(await e.get(r),e.apiUrl(r)).body,a=i?.MetadataId;return a?(0,Vt.normalizeGuid)(a,"entityMetadataId"):""}fu.commandApi={async get(e,t){var r;let n=t,i=await um(e,n),a=i?`_contextentity_value eq ${i}`:`contextvalue eq '${(0,Vt.odataLiteral)(n)}'`,o=`/appactions${(0,Vt.odataQuery)([["$expand",gV],["$filter",a]])}`,s=(0,Tt.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 m=typeof p.appactionid=="string"?p.appactionid:void 0;if(m){let h=p["@odata.etag"];d[(0,Vt.normalizeGuid)(m,"appactionid")]=typeof h=="string"?h:null}}return{raw:c,etag:(0,Tt.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 um(e,r.entityLogicalName);return S2(e,{...r,entityMetadataId:n},!1)},async update(e,t,r,n,i){return S2(e,r,!0,i)},async delete(e,t){var r,n;let i=await um(e,t),a=i?`_contextentity_value eq ${i}`:`contextvalue eq '${(0,Vt.odataLiteral)(t)}'`,o=`/appactions${(0,Vt.odataQuery)([["$select","appactionid"],["$filter",a]])}`,l=(n=(r=(0,Tt.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,Tt.deleteRecord)(e,"appactions",u.appactionid)}};async function S2(e,t,r,n){let i=t.entityMetadataId?(0,Vt.normalizeGuid)(t.entityMetadataId,"entityMetadataId"):"",a=bV(t.rows),o={};try{await vV(e,t,a,i,r,n,o)}catch(s){throw(0,hV.withPartialTokens)(s,{memberEtags:o})}return{id:t.entityLogicalName,etag:null,memberEtags:o}}async function vV(e,t,r,n,i,a,o){var s,l,u;for(let c of r)if(i&&c.exists){let d=(0,Vt.normalizeGuid)(c.appactionid,"id"),p=(s=a?.[d])!==null&&s!==void 0?s:c.etag,m=(0,Tt.echoWrite)("appactionid",p?{"If-Match":p}:void 0),h=`/appactions(${d})${m.query}`,w=(0,Tt.ensureSuccess)(await e.patch(h,c.body,m.options),e.apiUrl(h));o[d]=(0,Tt.readEtag)(w)}else{let d=(0,Tt.echoWrite)("appactionid"),p=`/appactions${d.query}`,m={...c.body};n&&m["[email protected]"]===void 0&&(m["[email protected]"]=`/entities(${n})`);let h=(0,Tt.ensureSuccess)(await e.post(p,m,d.options),e.apiUrl(p)),w=(0,Tt.readCreatedId)(h,"appactionid");w&&(o[(0,Vt.normalizeGuid)(w,"appactionid")]=(0,Tt.readEtag)(h))}for(let c of[...(l=t.deletedRowIds)!==null&&l!==void 0?l:[]].reverse()){let d=(0,Vt.normalizeGuid)(c,"id");await(0,Tt.deleteRecord)(e,"appactions",d,(u=a?.[d])!==null&&u!==void 0?u:void 0),delete o[d]}}function bV(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 B2=g(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});ma.commandRegistration=ma.CommandAdapter=void 0;var Be=(C2(),or(A2)),E2=Kt(),Gt=br(),yV=N2(),I2=ht(),ha=Z(),dm="$ClientSvg:",pm=".svg",wV=2,AV=1,CV=1,_2="entityMetadataId",SV=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"]),mu=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 m of l){let h=typeof m._parentappactionid_value=="string"&&m._parentappactionid_value?m._parentappactionid_value:"",w=(i=c.get(h))!==null&&i!==void 0?i:[];w.push(m),c.set(h,w)}let d=new Map;for(let m of(a=c.get(""))!==null&&a!==void 0?a:[]){let h=_V(m.location),w=(o=d.get(h))!==null&&o!==void 0?o:[];w.push(m),d.set(h,w)}let p=[];for(let[m,h]of d)p.push({location:m,groups:EV(h,c,x2(m),u)});return{id:u,entityLogicalName:u,commandBars:IV(p),bag:{a:[[_2,(s=t.entityMetadataId)!==null&&s!==void 0?s:""]]}}}fromArtifact(t){return{entityLogicalName:t.entityLogicalName,entityMetadataId:mm(t),appActions:cm(t).map(r=>r.row)}}fromApiResponse(t){return this.toArtifact(t??{})}toApiPayload(t,r){let n=new Set(r?cm(r).map(l=>l.appactionid):[]),i=cm(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?$V(l.row):U2(l.row)}}),s=[...n].filter(l=>!a.has(l));return{entityLogicalName:t.entityLogicalName,entityMetadataId:mm(t),rows:o,...s.length>0?{deletedRowIds:s}:{}}}createDefault(t){var r,n,i,a;let o=(n=(r=t.entityLogicalName)!==null&&r!==void 0?r:t.id)!==null&&n!==void 0?n:"";return{id:(i=t.id)!==null&&i!==void 0?i:o,entityLogicalName:o,commandBars:(a=t.commandBars)!==null&&a!==void 0?a:[]}}assignMissingIds(t){return(0,I2.assignMissingIds)(t)}validate(t){let r=[];return(0,Gt.childObjects)(t,"commandBars","","commandBar",r).forEach(({node:i,index:a})=>{let o=`/commandBars/${a}`;(0,Gt.optionalEnum)(i,"location",["MainTab","ContextualTab","HomeTab"],o,"bar-location-invalid",r),(0,Gt.childObjects)(i,"groups",o,"group",r).forEach(({node:l,index:u})=>{let c=`${o}/groups/${u}`;(0,Gt.optionalGuidId)(l,"id",c,"group-id-invalid",r),P2((0,Gt.childObjects)(l,"controls",c,"control",r),`${c}/controls`,r)})}),r}};ma.CommandAdapter=mu;function P2(e,t,r){e.forEach(({node:n,index:i})=>{let a=`${t}/${i}`;(0,Gt.optionalGuidId)(n,"id",a,"control-id-invalid",r),(0,Gt.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,Gt.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,Gt.isJsonObject)(n.action)?(0,Gt.optionalEnum)(n.action,"type",["javascript"],`${a}/action`,"action-type-invalid",r):r.push((0,Gt.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,Gt.childObjects)(n,"children",a,"control",r);s.length>0&&P2(s,`${a}/children`,r)})}function T2(e){return{a:Object.entries(e)}}function NV(e){return Object.fromEntries(e.a)}function fm(e,t){if(e){for(let[r,n]of e.a)if(r===t)return n}}function mm(e){let t=fm(e.bag,_2);return typeof t=="string"?t:""}function EV(e,t,r,n){var i,a;let o=[],s=[];for(let l of gu(e))l.type===Be.ButtonType.Group?o.push({id:R2(l.name,n),title:typeof l.grouptitle=="string"?l.grouptitle:"",controls:gu((a=t.get((i=l.appactionid)!==null&&i!==void 0?i:""))!==null&&a!==void 0?a:[]).map(u=>hu(u,t,r,n)),bag:T2(l)}):s.push(hu(l,t,r,n));return s.length>0&&o.unshift({id:(0,I2.newId)(),title:"",controls:s}),o}function hu(e,t,r,n){var i,a,o,s;let l=R2(e.name,n),u={id:l,type:PV(e.type),label:typeof e.buttonlabeltext=="string"?e.buttonlabeltext:"",command:typeof e.appactionid=="string"?e.appactionid:l,bag:T2(e)},c=O2(e);c&&(u.icon=c);let d=DV(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 m=[];for(let h of gu(p))if(h.type===Be.ButtonType.Group){u.flyoutGroupId=(a=h.appactionid)!==null&&a!==void 0?a:void 0;for(let w of gu((s=t.get((o=h.appactionid)!==null&&o!==void 0?o:""))!==null&&s!==void 0?s:[]))m.push(hu(w,t,r,n))}else m.push(hu(h,t,r,n));u.children=m}return u}function O2(e){var t;if(!((t=e.IconWebResourceId)===null||t===void 0)&&t.name)return e.IconWebResourceId.name;if(e.fonticon)return e.fonticon.startsWith(dm)?e.fonticon.slice(dm.length)+pm:e.fonticon}function DV(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 D2(e){return typeof e.sequence=="number"?e.sequence:typeof e.buttonsequencepriority=="number"?e.buttonsequencepriority:0}function gu(e){return[...e].sort((t,r)=>D2(t)-D2(r))}function IV(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 R2(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 _V(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 x2(e){switch(e){case"MainTab":return Be.Location.Form;case"HomeTab":return Be.Location.HomePageGrid;default:return Be.Location.SubGridStandard}}function PV(e){switch(e){case Be.ButtonType.Dropdown:return"FlyoutAnchor";case Be.ButtonType.Split:return"SplitButton";default:return"Button"}}function TV(e){switch(e){case"FlyoutAnchor":return Be.ButtonType.Dropdown;case"SplitButton":return Be.ButtonType.Split;default:return Be.ButtonType.Standard}}function OV(e){var t;return e.bag&&e.bag.a.length>0?!0:((t=e.title)!==null&&t!==void 0?t:"").length>0}function F2(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 cm(e,t=new Set){var r,n,i,a;let o=[],s=mm(e);for(let l of(r=e.commandBars)!==null&&r!==void 0?r:[]){let u=x2(l.location),c=((n=l.groups)!==null&&n!==void 0?n:[]).flatMap(m=>{var h;return(h=m.controls)!==null&&h!==void 0?h:[]}),d=c.length>0&&c.every(m=>!F2(m,t)),p=0;for(let m of(i=l.groups)!==null&&i!==void 0?i:[]){let h;if(OV(m)){let w=xV(m,u,void 0,e,s);o.push(w),h=w.appactionid}for(let w of(a=m.controls)!==null&&a!==void 0?a:[])L2(w,u,h,e,s,o,d?p:void 0,t),p+=1}}return o}function L2(e,t,r,n,i,a,o,s=new Set){var l;let u=RV(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||BV(u.appactionid);a.push(FV(d,t,u.appactionid,n,i));let p=c.every(m=>!F2(m,s));for(let[m,h]of c.entries())L2(h,t,d,n,i,a,p?m:void 0,s)}function RV(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=O2(s);return e.location!==void 0&&(s.location=e.location),s.type=TV(e.type),s.buttonlabeltext=e.label,LV(s,e.icon,l),MV(s,e.action),kV(s),e.hidden!==void 0&&(s.hidden=e.hidden),e.disabled!==void 0&&(s.isdisabled=e.disabled),{...o,row:s}}function xV(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 FV(e,t,r,n,i){let a=M2(e,t,n,i);return a["[email protected]"]=`/appactions(${(0,ha.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=NV(e.bag),o=!0;let u=fm(e.bag,"@odata.etag");s=typeof u=="string"?u:null;let c=fm(e.bag,"appactionid");l=typeof c=="string"&&c?c:e.id}else l=e.id,a=M2(l,t,n,i),o=!1,s=null;return r&&(a["[email protected]"]=`/appactions(${(0,ha.normalizeGuid)(r,"Command parent appaction id")})`),{appactionid:l,exists:o,etag:s,row:a}}function M2(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,ha.normalizeGuid)(n,"Command context entity metadata id")})`),i}function LV(e,t,r){if(t===r){let n=e._iconwebresourceid_value;typeof n=="string"&&n&&!e.fonticon&&(e["[email protected]"]=`/webresourceset(${(0,ha.normalizeGuid)(n,"Command icon web resource id")})`);return}if(t===void 0){e.fonticon="",e.IconWebResourceId=null;return}e.fonticon=t.toLowerCase().endsWith(pm)?dm+t.slice(0,t.length-pm.length):t,e.IconWebResourceId=null}function kV(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,ha.normalizeGuid)(a,`Command ${i}`);e[`${i}@odata.bind`]=`/canvasapps(${o})`};e.onclickeventtype===AV&&t("_onclickeventformulacomponentlibraryid_value","OnClickEventFormulaComponentLibraryId");let r=e.visibilitytype;(!r||r===CV)&&t("_visibilityformulacomponentlibraryid_value","VisibilityFormulaComponentLibraryId")}function MV(e,t){if(!(!t||t.type!=="javascript")){if(e.onclickeventtype=wV,t.webResourceId){let r=(0,ha.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 UV(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 BV(e){let t="";for(let r=0;r<4;r+=1)t+=UV(`${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 U2(e){let t={...e};for(let r of SV)delete t[r];return t}function $V(e){let t=U2(e);for(let r of Be.CannotUpdateAppActionColumns)delete t[r];return t}function qV(){return{adapter:new mu,api:yV.commandApi,publish:(e,t,r)=>(0,E2.publishBoundEntity)(e,r),publishScope:(e,t)=>(0,E2.boundEntityPublishScope)(t)}}ma.commandRegistration=qV});var $2=g(vu=>{"use strict";Object.defineProperty(vu,"__esModule",{value:!0});vu.chartApi=void 0;var VV=Jt(),zt=ge(),Xo=Z(),GV="savedqueryvisualizationid,name,description,primaryentitytypecode,datadescription,presentationdescription,charttype,type,isdefault",zV="savedqueryvisualizationid,name,primaryentitytypecode,charttype,isdefault";vu.chartApi={async get(e,t){let n=`/savedqueryvisualizations(${(0,Xo.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Xo.odataQuery)([["$select",GV]]),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=`/savedqueryvisualizations${(0,Xo.odataQuery)([["$select",zV],["$filter",t?.entityLogicalName?`primaryentitytypecode eq '${(0,Xo.odataLiteral)(t.entityLogicalName)}'`:void 0]])}`;return(await(0,VV.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,zt.echoWrite)("savedqueryvisualizationid"),a=`/savedqueryvisualizations${i.query}`,o=(0,zt.ensureSuccess)(await e.post(a,(0,zt.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,zt.resolveCreatedId)(o,"savedqueryvisualizationid","chart",r),etag:(0,zt.readEtag)(o)}},async update(e,t,r,n){let i=r,a=(0,Xo.normalizeGuid)(t,"id"),o=(0,zt.echoWrite)("savedqueryvisualizationid",{"If-Match":(0,zt.requireEtag)(n,"chart",a)}),s=`/savedqueryvisualizations(${a})${o.query}`,l=(0,zt.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,zt.readEtag)(l)}},delete(e,t){return(0,zt.deleteRecord)(e,"savedqueryvisualizations",t)}}});var rI=g(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});ga.chartRegistration=ga.ChartAdapter=void 0;var hm=on(),q2=br(),Hr=kn(),V2=Kt(),WV=$2(),gm=yn(),jV=ht(),HV=["Column","StackedColumn","StackedColumn100","Bar","StackedBar","StackedBar100","Area","StackedArea","StackedArea100","Line","Pie","Doughnut","Funnel","Tag"],QV=new Map(HV.map(e=>[e.toLowerCase(),e]));function j2(e){var t;return e&&(t=QV.get(e.toLowerCase()))!==null&&t!==void 0?t:"Column"}function JV(){return'<Chart Palette="BrightPastel"><Series><Series ChartType="Column" ChartArea="Default" /></Series><ChartAreas><ChartArea Name="Default" /></ChartAreas><Legends><Legend Name="Default" /></Legends></Chart>'}function XV(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="${Ko(u.series.attribute)}" aggregate="${Ko(u.series.aggregate)}" />`).join("")+a.map(u=>`<attribute alias="${u.alias}" name="${Ko(u.category.attribute)}" groupby="true"${u.category.dateGrouping?` dategrouping="${Ko(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="${Ko(n)}">${o}</entity></fetch></fetchcollection><categorycollection><category alias="${l}"><measurecollection>${s}</measurecollection></category></categorycollection></datadefinition>`}var bu=class{toArtifact(t){var r,n,i,a,o,s,l;(0,gm.installDomShim)();let u=(r=t.datadescription)!==null&&r!==void 0?r:"",c=(n=t.presentationdescription)!==null&&n!==void 0?n:"",d=(0,Hr.parseXmlRoot)(u,"<datadefinition/>"),p=(0,Hr.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:H2(p),isDefault:(l=t.isdefault)!==null&&l!==void 0?l:!1,series:X2(d),categories:K2(d),presentation:Q2(p),dataBag:u?(0,Hr.projectElementBag)(d):void 0,presentationBag:c?(0,Hr.projectElementBag)(p):void 0,rowBag:KV(t.charttype,t.type)}}fromArtifact(t){(0,gm.installDomShim)();let{datadescription:r,presentationdescription:n}=YV(t);return{savedqueryvisualizationid:t.id,name:t.name,description:t.description,primaryentitytypecode:t.entityLogicalName,datadescription:r,presentationdescription:n,charttype:G2(t.rowBag,"charttype"),type:G2(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,gm.installDomShim)();let u=(r=t.entityLogicalName)!==null&&r!==void 0?r:"";return{id:(n=t.id)!==null&&n!==void 0?n:(0,jV.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}};ga.ChartAdapter=bu;function KV(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 G2(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 H2(e){let t=e.getElementsByTagName("Series");for(let r=0;r<t.length;r+=1)if(t[r].getAttribute("ChartType"))return j2(t[r].getAttribute("ChartType"));return"Column"}function Q2(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 yu(e){return e.getElementsByTagName("fetch")[0]}function J2(e){var t;let r=new Map;if(!e)return r;let n=e.getElementsByTagName("link-entity");for(let i=0;i<n.length;i+=1){let a=n[i],o=a.getAttribute("name");if(!o)continue;let s=a.getElementsByTagName("attribute");for(let l=0;l<s.length;l+=1){let u=s[l],c=(t=u.getAttribute("alias"))!==null&&t!==void 0?t:u.getAttribute("name");c&&r.set(c,o)}}return r}function X2(e){let t=yu(e);if(!t)return[];let r=J2(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=j2(c));let d=o.getAttribute("alias");d&&(u.alias=d);let p=d??l,m=r.get(p);m&&(u.relatedEntity=m),i.push(u)}return i}function K2(e){var t;let r=yu(e);if(!r)return[];let n=J2(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,m=n.get(p);m&&(u.relatedEntity=m),a.push(u)}return a}function YV(e){if(!z2(e.dataBag)||!z2(e.presentationBag))return{datadescription:XV(e),presentationdescription:b6(e)};let t=new DOMParser().parseFromString("<root/>","text/xml"),r=W2(e.dataBag,"datadefinition",t),n=W2(e.presentationBag,"Chart",t);return vm(e.series,X2(r))||(e6(t,r,e.series),ZV(t,n,e.series.length,e.chartType)),vm(e.categories,K2(r))||t6(t,r,e.categories),e.chartType!==H2(n)&&eI(n,e.chartType),vm(e.presentation,Q2(n))||tI(n,e.presentation),{datadescription:(0,Hr.serializeNode)(r),presentationdescription:(0,Hr.serializeNode)(n)}}function z2(e){return!!e&&(e.c.length>0||e.a.length>0)}function ZV(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 W2(e,t,r){let n={n:t,a:(0,hm.mergeAttrs)(e.a,[]),c:(0,hm.spliceChildren)(e.c,[])};return(0,hm.rebuildRaw)(n,(0,Hr.domEngine)(r),null)}function e6(e,t,r){let n=yu(t),i=n?.getElementsByTagName("entity")[0];!n||!i||Y2(e,t,i,l6(n),r,c6,{aliasPrefix:"aggregate_column",addRef:i6,removeRef:s6})}function t6(e,t,r){let n=yu(t),i=n?.getElementsByTagName("entity")[0];!n||!i||Y2(e,t,i,u6(n),r,d6,{aliasPrefix:"groupby_column",addRef:a6,removeRef:o6})}function Y2(e,t,r,n,i,a,o){let s=new Map;for(let p of n){let m=p.getAttribute("alias");m&&s.set(m,p)}let l=new Set,u=[];for(let p of i){let m=p.alias?s.get(p.alias):void 0;m&&!l.has(m)?(a(m,p),l.add(m)):u.push(p)}let c=n.filter(p=>!l.has(p)),d=0;for(let p of u)if(d<c.length){let m=c[d];a(m,p),l.add(m),d+=1}else{let m=e.createElement("attribute"),h=p.alias||n6(t,o.aliasPrefix);m.setAttribute("alias",h),a(m,p),p6(e,r,m,p.relatedEntity),o.addRef(e,t,h)}for(let p of n)if(!l.has(p)){let m=p.getAttribute("alias");m&&o.removeRef(t,m),m6(p)}}function r6(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 n6(e,t){let r=r6(e);if(!r.has(t))return t;for(let n=2;;n+=1){let i=`${t}_${n}`;if(!r.has(i))return i}}function Z2(e,t){let r=t.getElementsByTagName("categorycollection")[0];if(r)return r;let n=e.createElement("categorycollection");return t.appendChild(n),n}function i6(e,t,r){let n=Z2(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 a6(e,t,r){let n=Z2(e,t),i=e.createElement("category");i.setAttribute("alias",r),n.appendChild(i)}function o6(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 s6(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"&&!g6(o)&&((r=o.parentNode)===null||r===void 0||r.removeChild(o))}}function l6(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 u6(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 c6(e,t){e.setAttribute("name",t.attribute),e.setAttribute("aggregate",t.aggregate),t.seriesType&&e.setAttribute("charttype",t.seriesType)}function d6(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 p6(e,t,r,n){n?f6(e,t,n).appendChild(r):t.appendChild(r)}function f6(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 m6(e){let t=e.parentNode;if(t&&(t.removeChild(e),t.tagName==="link-entity"&&!h6(t))){let r=t.parentNode;r&&r.removeChild(t)}}function h6(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 g6(e){let t=e.childNodes;for(let r=0;r<t.length;r+=1)if(t[r].nodeType===1)return!0;return!1}function eI(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(!v6(r[i])){r[i].setAttribute("ChartType",t);return}}}function v6(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 tI(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 b6(e){let t=(0,Hr.parseXmlRoot)(JV(),"<Chart/>");return eI(t,e.chartType),tI(t,e.presentation),(0,Hr.serializeNode)(t)}function vm(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Ko(e){return String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function y6(){return{adapter:new bu,api:WV.chartApi,publish:(e,t,r)=>(0,V2.publishBoundEntity)(e,r),publishScope:(e,t)=>(0,V2.boundEntityPublishScope)(t)}}ga.chartRegistration=y6});var nI=g(wu=>{"use strict";Object.defineProperty(wu,"__esModule",{value:!0});wu.dashboardApi=void 0;var w6=Jt(),Wt=ge(),Yo=Z(),A6="formid,name,description,formxml,type,objecttypecode,istabletenabled,iscustomizable,componentstate,versionnumber",C6="formid,name,type,objecttypecode",S6=0,N6=10;wu.dashboardApi={async get(e,t){let n=`/systemforms(${(0,Yo.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Yo.odataQuery)([["$select",A6]]),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=[`(type eq ${S6} or type eq ${N6})`];t?.entityLogicalName&&r.push(`objecttypecode eq '${(0,Yo.odataLiteral)(t.entityLogicalName)}'`);let n=`/systemforms${(0,Yo.odataQuery)([["$select",C6],["$filter",r.join(" and ")]])}`;return(await(0,w6.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,Wt.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,Wt.ensureSuccess)(await e.post(a,(0,Wt.withClientMintedId)(o,"formid",r),i.options),e.apiUrl(a));return{id:(0,Wt.resolveCreatedId)(s,"formid","dashboard",r),etag:(0,Wt.readEtag)(s)}},async update(e,t,r,n){let i=r,a=(0,Yo.normalizeGuid)(t,"id"),o=(0,Wt.echoWrite)("formid",{"If-Match":(0,Wt.requireEtag)(n,"dashboard",a)}),s=`/systemforms(${a})${o.query}`,l=(0,Wt.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,Wt.readEtag)(l)}},delete(e,t){return(0,Wt.deleteRecord)(e,"systemforms",t)}}});var hI=g(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});wr.dashboardRegistration=wr.TILE_CLASS_ID=wr.DashboardAdapter=void 0;var es=on(),jt=kn(),bm=Kt(),Zo=br(),E6=nI(),ym=yn(),ai=ht(),uI=Z(),cI=pi(),iI="0",wm="10",D6=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"]]),I6="{3FF9A528-DD50-4ACA-8F10-2E5ED73513AD}",Cu=class{constructor(t=cI.DEFAULT_LCID){this.lcid=t}toArtifact(t){var r,n,i,a;(0,ym.installDomShim)();let o=(r=t.formxml)!==null&&r!==void 0?r:"",s=(0,jt.parseXmlRoot)(o,"<form/>");return{id:(n=t.formid)!==null&&n!==void 0?n:"",name:(i=t.name)!==null&&i!==void 0?i:"",description:(a=t.description)!==null&&a!==void 0?a:"",dashboardType:_6(t.type),entityLogicalName:t.objecttypecode?t.objecttypecode:null,enabledForMobile:!!t.istabletenabled,layoutType:P6(s),components:aI(s,this.lcid),bag:(0,jt.projectElementBag)(s)}}fromArtifact(t){var r;return(0,ym.installDomShim)(),{formid:t.id,name:t.name,description:t.description,type:t.dashboardType==="Interactive"?wm:iI,objecttypecode:(r=t.entityLogicalName)!==null&&r!==void 0?r:"",istabletenabled:t.enabledForMobile,formxml:oI(t,this.lcid)}}fromApiResponse(t){return this.toArtifact(t??{})}toApiPayload(t){return{name:t.name,description:t.description,formxml:oI(t,this.lcid),istabletenabled:t.enabledForMobile,type:t.dashboardType==="Interactive"?wm:iI,objecttypecode:t.entityLogicalName}}createDefault(t){var r,n,i,a,o,s,l,u;(0,ym.installDomShim)();let c=(0,jt.parseXmlRoot)(V6(),"<form/>");return{id:(r=t.id)!==null&&r!==void 0?r:(0,ai.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:aI(c,this.lcid),bag:(0,jt.projectElementBag)(c)}}assignMissingIds(t){if(t&&typeof t=="object"&&!Array.isArray(t)&&"position"in t&&!("components"in t)){let r=t;(typeof r.id!="string"||r.id.length===0)&&(r.id=(0,ai.newId)())}return t}validate(t){let r=[],n=(0,Zo.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,Zo.isJsonObject)(u)&&r.push((0,Zo.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,Zo.isJsonObject)(a.position)){let l=ts(a.position);i.has(l)?r.push((0,Zo.issue)(`${s}/position`,"component-position-collision",`two components occupy the same dashboard position (${l}); move one to a free cell`)):i.add(l)}}),r}};wr.DashboardAdapter=Cu;function _6(e){return String(e??"")===wm?"Interactive":"Standard"}function P6(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 Q(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 aI(e,t){let r=[];return Q(e,"tabs").flatMap(i=>Q(i,"tab")).forEach((i,a)=>{Q(i,"columns").flatMap(s=>Q(s,"column")).forEach((s,l)=>{Q(s,"sections").flatMap(c=>Q(c,"section")).forEach((c,d)=>{T6(c,{tabIndex:a,columnIndex:l,sectionIndex:d},r,t)})})}),r}function T6(e,t,r,n){Q(e,"rows").flatMap(a=>Q(a,"row")).forEach((a,o)=>{Q(a,"cell").forEach((s,l)=>{let u=O6(s,{...t,rowIndex:o,cellIndex:l},n);u&&r.push(u)})})}function O6(e,t,r){var n,i,a;let o=fI((n=e.getAttribute("id"))!==null&&n!==void 0?n:"");if(o.toLowerCase().startsWith("spacer"))return null;let s=Q(e,"control")[0];if(!s)return null;let l=(i=s.getAttribute("classid"))!==null&&i!==void 0?i:"",u=F6(s),c=L6(l,u,s),d=R6(s);return{id:(a=s.getAttribute("id"))!==null&&a!==void 0?a:o,type:c,name:pI(e,r),classId:l,position:t,colspan:Am(e,"colspan",1),rowspan:Am(e,"rowspan",1),parameters:u,bag:(0,jt.projectElementBag)(e),...d?{icProperties:d}:{}}}function dI(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 R6(e){let t=dI(e);return t?(0,jt.serializeNode)(t):void 0}function x6(e,t,r){let n=dI(t);if(!r){n&&t.removeChild(n);return}let i=new DOMParser().parseFromString(r,"text/xml").documentElement,a=(0,es.rebuildRaw)((0,es.rawFromNode)((0,jt.nodeLikeFromDom)(i)),(0,jt.domEngine)(e),null);n&&(0,jt.serializeNode)(n)===(0,jt.serializeNode)(a)||(n?t.replaceChild(a,n):t.appendChild(a))}function pI(e,t){var r,n;let i=Q(e,"labels")[0];if(!i)return"";let a=Q(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 F6(e){var t;let r={},n=Q(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 L6(e,t,r){var n;let i=D6.get(e.toUpperCase());return i?i==="chart"?t.ChartGridMode==="Chart"?"chart":"list":i==="assistant"&&((n=r.getAttribute("uniqueid"))!==null&&n!==void 0?n:"").toUpperCase()===I6?"assistant":i:"unknown"}function Am(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 fI(e){return e.replace(/^\{/,"").replace(/\}$/,"")}function k6(e,t){let r={n:"form",a:(0,es.mergeAttrs)(e.bag.a,[]),c:(0,es.spliceChildren)(e.bag.c,[])};return(0,es.rebuildRaw)(r,(0,jt.domEngine)(t),null)}function oI(e,t){let r=new DOMParser().parseFromString("<root/>","text/xml"),n=k6(e,r);return B6(r,n,e.components,t),M6(r,n,e.components,t),(0,jt.serializeNode)(n)}function M6(e,t,r,n){let i=mI(t);for(let a of r)i.has(ts(a.position))||U6(e,t,a,n)}function U6(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=G6(t,e,l);for(let W of Q(u,"row"))Q(W,"cell").some($=>Q($,"control").length>0)||u.removeChild(W);let c=r.classId||wr.TILE_CLASS_ID[r.type]||wr.TILE_CLASS_ID.iframe,d=r.rowspan&&r.rowspan>0?r.rowspan:4,p=r.bag&&sI(r.bag,"id")?String(sI(r.bag,"id")):Au((0,ai.newId)()),m=r.id?Au(r.id):Au((0,ai.newId)()),h=u.parentNode,w=Math.max(1,parseInt(h&&h.getAttribute&&h.getAttribute("columns")||"1",10)||1),y=Math.min(Math.max(1,r.colspan&&r.colspan>0?r.colspan:1),w),N=Q(u,"row"),D=N[N.length-1],x=D?Q(D,"cell").reduce((W,$)=>W+Am($,"colspan",1),0):0;(!D||x+y>w)&&(D=e.createElement("row"),u.appendChild(D));let F=e.createElement("cell");F.setAttribute("id",p),F.setAttribute("colspan",String(y)),F.setAttribute("rowspan",String(d)),F.setAttribute("showlabel","true");let q=e.createElement("labels"),G=e.createElement("label");G.setAttribute("description",(o=r.name)!==null&&o!==void 0?o:""),G.setAttribute("languagecode",String(n)),q.appendChild(G),F.appendChild(q);let M=e.createElement("control");M.setAttribute("id",m),M.setAttribute("classid",Au(c));let U=e.createElement("parameters"),B=(s=r.parameters)!==null&&s!==void 0?s:{};for(let W of Object.keys(B)){let $=(0,uI.createSafeXmlElement)(e,W,"dashboard tile parameter");$.textContent=B[W],U.appendChild($)}M.appendChild(U),F.appendChild(M),D.appendChild(F)}function sI(e,t){if(!e)return;let r=e.a.find(n=>n[0]===t);return r?r[1]:void 0}function B6(e,t,r,n){var i;let a=mI(t),o=new Set(r.map(s=>ts(s.position)));for(let s of r){let l=a.get(ts(s.position));if(!l)continue;let u=Q(l,"control")[0];u&&($6(e,l,s.name,n),q6(e,u,s.parameters),lI(l,"colspan",s.colspan),lI(l,"rowspan",s.rowspan),s.icProperties!==void 0&&x6(e,u,s.icProperties))}for(let[s,l]of a)o.has(s)||(i=l.parentNode)===null||i===void 0||i.removeChild(l)}function mI(e){let t=new Map;return Q(e,"tabs").flatMap(n=>Q(n,"tab")).forEach((n,i)=>{Q(n,"columns").flatMap(o=>Q(o,"column")).forEach((o,s)=>{Q(o,"sections").flatMap(u=>Q(u,"section")).forEach((u,c)=>{Q(u,"rows").flatMap(p=>Q(p,"row")).forEach((p,m)=>{Q(p,"cell").forEach((h,w)=>{var y;fI((y=h.getAttribute("id"))!==null&&y!==void 0?y:"").toLowerCase().startsWith("spacer")||Q(h,"control")[0]&&t.set(ts({tabIndex:i,columnIndex:s,sectionIndex:c,rowIndex:m,cellIndex:w}),h)})})})})}),t}function ts(e){let t=e??{};return`${t.tabIndex}.${t.columnIndex}.${t.sectionIndex}.${t.rowIndex}.${t.cellIndex}`}function $6(e,t,r,n){if(r===pI(t,n))return;let i=Q(t,"labels")[0];i||(i=e.createElement("labels"),t.appendChild(i));let a=Q(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 q6(e,t,r){var n;if(!r)return;let i=Object.keys(r);if(i.length===0)return;let a=Q(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,uI.createSafeXmlElement)(e,l,"dashboard component parameter");d.textContent=u,a.appendChild(d)}}}function lI(e,t,r){var n;((n=e.getAttribute(t))!==null&&n!==void 0?n:"")!==String(r)&&e.setAttribute(t,String(r))}function V6(e=2){let t=`{${(0,ai.newId)()}}`,r=`{${(0,ai.newId)()}}`,n=`{${(0,ai.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>`}wr.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 Au(e){return`{${e.replace(/[{}]/g,"")}}`}function G6(e,t,r){var n;let i=Q(e,"tabs").flatMap(u=>Q(u,"tab"))[0];if(!i)throw new Error("addDashboardTile: dashboard formxml has no <tab>");let a=Q(i,"columns").flatMap(u=>Q(u,"column"))[0];if(!a)throw new Error("addDashboardTile: dashboard formxml has no <column>");let o=Q(a,"sections").flatMap(u=>Q(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=Q(s,"rows")[0];return l||(l=t.createElement("rows"),s.appendChild(l)),l}function z6(e=cI.DEFAULT_LCID){return{adapter:new Cu(e),api:E6.dashboardApi,languageSensitive:!0,publish:(t,r,n)=>n?.entityLogicalName?(0,bm.publishBoundEntity)(t,n):(0,bm.publishDashboardById)(t,r),publishScope:(t,r)=>r?.entityLogicalName?(0,bm.boundEntityPublishScope)(r):{envelope:"dashboard",targetIds:[t]}}}wr.dashboardRegistration=z6});var AI=g(Nu=>{"use strict";Object.defineProperty(Nu,"__esModule",{value:!0});Nu.genPageApi=void 0;var wI=Jt(),Ne=ge(),Dt=Z(),Ar=ne(),Dn="uxagentprojects",ba="uxagentprojectfiles",va="uxagentprojectid",Cr="uxagentprojectfileid",Su=`${va},name`,W6=`${Cr},filename,filetype`;async function Cm(e,t,r,n){var i;let a=`/${t}(${r})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Dt.odataQuery)([["$select",n]]),o=(0,Ne.ensureSuccess)(await e.get(a),e.apiUrl(a));return{row:(i=o.body)!==null&&i!==void 0?i:{},etag:(0,Ne.readEtag)(o)}}async function j6(e,t){let r=`/${ba}(${t})/filecontent/$value`,n=await e.get(r);if(n.status===404)return{status:"unavailable",reason:"unpublished"};(0,Ne.ensureSuccess)(n,e.apiUrl(r));let i=n.body;if(i instanceof Uint8Array||Buffer.isBuffer(i))return{status:"available",data:Buffer.from(i).toString("base64")};if(i instanceof ArrayBuffer)return{status:"available",data:Buffer.from(new Uint8Array(i)).toString("base64")};if(typeof i=="string")return{status:"available",data:Buffer.from(i,"utf8").toString("base64")};throw new Ar.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 H6(e,t,r,n){if(!e.supportsBinaryPatch)throw new Ar.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=`/${ba}(${t})/filecontent`,a=new Uint8Array(Buffer.from(n,"base64"));(0,Dt.assertNoControlChars)(r,"generative-page file name"),(0,Ne.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 Sm(e,t){let r=`/${ba}/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()`+(0,Dt.odataQuery)([["$select",W6],["$filter",`_${va}_value eq ${t}`]]);return(await(0,wI.collectPages)(e,r,"fetchArtifact('genPage')")).map(i=>({row:i,etag:typeof i["@odata.etag"]=="string"?i["@odata.etag"]:null}))}async function gI(e,t,r){var n;let{etag:i}=await Cm(e,Dn,t,Su),a={};for(let{row:l,etag:u}of await Sm(e,t))a[(0,Dt.normalizeGuid)(String((n=l[Cr])!==null&&n!==void 0?n:""),Cr)]=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 vI(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}}Nu.genPageApi={async get(e,t){var r;let n=(0,Dt.normalizeGuid)(t,"id"),{row:i,etag:a}=await Cm(e,Dn,n,Su),o=await Sm(e,n),s={},l=[];for(let{row:u,etag:c}of o){let d=(0,Dt.normalizeGuid)(String((r=u[Cr])!==null&&r!==void 0?r:""),Cr);s[d]=c;let p=await j6(e,d);l.push({...u,content:p})}return{raw:{project:i,files:l},etag:a,memberEtags:s}},async list(e,t){let r=`/${Dn}/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()`+(0,Dt.odataQuery)([["$select",Su]]);return(await(0,wI.collectPages)(e,r,"listArtifacts('genPage')")).map(i=>{var a,o;return{type:"genPage",id:String((a=i[va])!==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;bI(e,n);let i=`/${Dn}`,a=(0,Ne.ensureSuccess)(await e.post(i,(0,Ne.withClientMintedId)({name:n.name},va,r)),e.apiUrl(i)),o=(0,Ne.resolveCreatedId)(a,va,"generative page",r),s=new Set;for(let l of n.files){let u=await yI(e,o,l,!0);s.add((0,Dt.normalizeGuid)(u.id,"file id"))}try{return{id:o,...vI(o,await gI(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,Dt.normalizeGuid)(t,"id");bI(e,a);let s=await Sm(e,o),{etag:l}=await Cm(e,Dn,o,Su);if(n&&l&&n!==l)throw new Ar.SdkError(Ne.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 Ar.SdkError(Ne.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:m})=>{var h;return(0,Dt.normalizeGuid)(String((h=m[Cr])!==null&&h!==void 0?h:""),Cr)})),c=new Set(a.files.map(m=>(0,Dt.normalizeGuid)(m.id,"file id")));if(!i)throw new Ar.SdkError(Ne.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(m=>m.toLowerCase()));{for(let h of c)if(!u.has(h)&&d.has(h))throw new Ar.SdkError(Ne.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 Ar.SdkError(Ne.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 m=new Map(s.map(({row:h,etag:w})=>{var y;return[(0,Dt.normalizeGuid)(String((y=h[Cr])!==null&&y!==void 0?y:""),Cr),w]}));for(let[h,w]of Object.entries(i??{})){let y=h.toLowerCase();if(!u.has(y))continue;let N=m.get(y);if(!w||!N)throw new Ar.SdkError(Ne.VERSION_CONFLICT_CODE,`Cannot verify generative-page file '${y}' before writing: ${w?"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(w!==N)throw new Ar.SdkError(Ne.VERSION_CONFLICT_CODE,`Generative-page file '${y}' changed on the server after this page was fetched (baseline ${w}, server ${N}) \u2014 another writer edited it. A file row accepts no If-Match validator, so this push would silently overwrite that change. Re-fetch the page and re-apply the edit.`)}}let p=`/${Dn}(${o})`;(0,Ne.ensureSuccess)(await e.patch(p,{name:a.name},{headers:{"If-Match":"*"}}),e.apiUrl(p));for(let m of a.files){let h=(0,Dt.normalizeGuid)(m.id,"file id");await yI(e,o,m,!u.has(h))}for(let m of u)c.has(m)||await(0,Ne.deleteRecord)(e,ba,m);try{return{id:o,...vI(o,await gI(e,o,c))}}catch(m){return{id:o,etag:null,memberEtags:{},warnings:[`The generative page was written, but re-reading its concurrency tokens failed (${m instanceof Error?m.message:String(m)}). 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,Ne.deleteRecord)(e,Dn,t)}};function bI(e,t){var r;if(((r=t.files)!==null&&r!==void 0?r:[]).some(i=>i.content.status==="available")&&!e.supportsBinaryPatch)throw new Ar.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 yI(e,t,r,n){let i=(0,Dt.normalizeGuid)(r.id,"file id"),a;if(n){let o=`/${ba}`,s=(0,Ne.ensureSuccess)(await e.post(o,(0,Ne.withClientMintedId)({filename:r.name,filetype:r.fileType,[`${va}@odata.bind`]:`/${Dn}(${t})`},Cr,i)),e.apiUrl(o));a=(0,Ne.readEtag)(s)}else{let o=`/${ba}(${i})`,s=(0,Ne.ensureSuccess)(await e.patch(o,{filename:r.name,filetype:r.fileType},{headers:{"If-Match":"*"}}),e.apiUrl(o));a=(0,Ne.readEtag)(s)}return r.content.status==="available"&&await H6(e,i,r.name,r.content.data),{id:i,etag:a}}});var EI=g(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});wa.genPageRegistration=wa.GenPageAdapter=void 0;var Q6=AI(),J6=Kt(),In=br(),NI=ht(),CI=2e8;function SI(e){return typeof e=="string"&&e.trim()!==""?e:(0,NI.newId)()}function ya(e){return(0,In.isJsonObject)(e)?e:{}}function X6(e){let t=ya(e);return t.status==="available"&&typeof t.data=="string"?{status:"available",data:t.data}:{status:"unavailable",reason:"unpublished"}}var Eu=class{toArtifact(t){return t}fromArtifact(t){return t}fromApiResponse(t){var r,n;let i=t,a=ya(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=ya(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:CI),content:X6(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:SI(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:SI(i.id),name:(a=i.name)!==null&&a!==void 0?a:"index.tsx",fileType:(o=i.fileType)!==null&&o!==void 0?o:CI,content:(s=i.content)!==null&&s!==void 0?s:{status:"available",data:""}}})}}assignMissingIds(t){let r=ya(t);return(typeof r.id!="string"||r.id.trim()==="")&&(r.id=(0,NI.newId)()),r}validate(t){let r=[],n=t.files;if(n!==void 0&&!Array.isArray(n))return r.push((0,In.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=ya(a),u=typeof l.id=="string"?l.id.trim().toLowerCase():"";if(u==="")r.push((0,In.issue)(s,"file-id-required","a generative-page file needs an id"));else{let m=i.get(u);m!==void 0?r.push((0,In.issue)(s,"file-id-duplicate",`two files share the id '${l.id}' (also at /files/${m}); 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,In.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,In.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=ya(d);p.status==="available"?typeof p.data!="string"&&r.push((0,In.issue)(s+"/content/data","file-content-data-invalid","available content needs base64 `data`")):p.status!=="unavailable"&&r.push((0,In.issue)(s+"/content/status","file-content-status-invalid",`content.status must be 'available' or 'unavailable', got ${String(p.status)}`))}),r}};wa.GenPageAdapter=Eu;function K6(){return{adapter:new Eu,api:Q6.genPageApi,publish:(e,t)=>(0,J6.publishGenPageById)(e,t),publishScope:e=>({envelope:"uxagentproject",targetIds:[e]})}}wa.genPageRegistration=K6});var II=g(Iu=>{"use strict";Object.defineProperty(Iu,"__esModule",{value:!0});Iu.reconcileBpfSecurityRoles=void 0;var Du=ge(),Nm=Z(),Y6="Global",DI={create:"Create",read:"Read",write:"Write",delete:"Delete"};async function Z6(e,t){var r,n;let i=`/EntityDefinitions(LogicalName='${t}')?$select=LogicalName,Privileges`,o=(n=(r=(0,Du.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(DI).forEach(u=>{let c=o.find(d=>d.PrivilegeType===DI[u]);if(c){let d=(0,Nm.normalizeGuid)(c.PrivilegeId,"PrivilegeId");s[u]=d,l.add(d)}}),{byAccess:s,all:l}}async function eG(e,t){var r,n;let i=`/RetrieveRolePrivilegesRole(RoleId=${t})`,o=(n=(r=(0,Du.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,Nm.normalizeGuid)(s.PrivilegeId,"PrivilegeId")))}async function tG(e,t,r){if(r.length===0)return;let n={Privileges:r.map(a=>({Depth:Y6,PrivilegeId:a}))},i=`/roles(${t})/Microsoft.Dynamics.CRM.AddPrivilegesRole`;(0,Du.ensureSuccess)(await e.post(i,n),e.apiUrl(i))}async function rG(e,t,r){let n={Privilege:{"@odata.type":"Microsoft.Dynamics.CRM.privilege",privilegeid:r}},i=`/roles(${t})/Microsoft.Dynamics.CRM.RemovePrivilegeRole`;(0,Du.ensureSuccess)(await e.post(i,n),e.apiUrl(i))}async function nG(e,t,r){var n;if(!r||r.length===0)return;let i=await Z6(e,t.toLowerCase());for(let a of r){let o=(0,Nm.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 eG(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 tG(e,o,c);for(let p of d)await rG(e,o,p)}}Iu.reconcileBpfSecurityRoles=nG});var RI=g(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});Pu.bpfApi=void 0;var _n=jn(),iG=Jt(),Ht=ge(),Sr=Z(),aG=II(),_u={"Content-Type":"application/json",Accept:"application/json"},oG=`category eq ${_n.WorkflowCategory.BusinessProcessFlow} and type eq ${_n.WorkflowTypeCode.Definition} and businessprocesstype eq ${_n.BusinessProcessType.BusinessFlow}`,sG="workflowid,name,description,primaryentity,statecode,category,type,businessprocesstype,processorder",lG="workflowid,name,uniquename,description,primaryentity,statecode,statuscode,category,type,businessprocesstype,processorder,xaml,clientdata",uG=["xaml","name","description","processorder"];async function _I(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,aG.reconcileBpfSecurityRoles)(e,n,t.securityRoles)}async function Em(e,t,r){var n;if(r==="Draft")return null;let i=(0,Sr.normalizeGuid)(t,"workflowid"),a={statecode:_n.StateCode.Activated,statuscode:_n.StatusCode.Activated},o=`/workflows(${i})`,s=(0,Ht.ensureSuccess)(await e.patch(o,a,{headers:_u}),e.apiUrl(o));return(n=(0,Ht.readEtag)(s))!==null&&n!==void 0?n:await OI(e,i)}async function OI(e,t){let r=`/workflows(${t})${(0,Sr.odataQuery)([["$select","workflowid"]])}`,n=await e.get(r);return n.status>=200&&n.status<300?(0,Ht.readEtag)(n):null}async function cG(e,t){var r;let n=`/workflows(${t})${(0,Sr.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 PI(e,t,r){if(await cG(e,t)!==_n.StateCode.Activated)return!1;let n={statecode:_n.StateCode.Draft,statuscode:_n.StatusCode.Draft},i=`/workflows(${t})`,a={..._u};return r&&(a["If-Match"]=r),(0,Ht.ensureSuccess)(await e.patch(i,n,{headers:a}),e.apiUrl(i)),!0}async function TI(e,t){try{await Em(e,t,"Active")}catch{}}function dG(e){let t={};for(let r of uG)e[r]!==void 0&&(t[r]=e[r]);return t}Pu.bpfApi={async get(e,t){let n=`/workflows(${(0,Sr.normalizeGuid)(t,"id")})${(0,Sr.odataQuery)([["$select",lG]])}`,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=[oG];t?.entityLogicalName&&r.push(`primaryentity eq '${(0,Sr.odataLiteral)(t.entityLogicalName)}'`);let n=`/workflows${(0,Sr.odataQuery)([["$select",sG],["$filter",r.join(" and ")]])}`;return(await(0,iG.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,Sr.normalizeGuid)(r.record.workflowid,"workflowid"),i="/workflows",a=(0,Ht.ensureSuccess)(await e.post(i,r.record,{headers:_u}),e.apiUrl(i)),o=null;try{o=await Em(e,n,r.status),await _I(e,r)}catch(s){try{await(0,Ht.deleteRecord)(e,"workflows",n)}catch{}throw s}return{id:n,etag:o??(0,Ht.readEtag)(a)}},async update(e,t,r,n){var i;let a=r,o=(0,Sr.normalizeGuid)(t,"id"),s=await PI(e,o,n);try{let l=`/workflows(${o})`,u={..._u};n&&!s&&(u["If-Match"]=n);let c=(0,Ht.ensureSuccess)(await e.patch(l,dG(a.record),{headers:u}),e.apiUrl(l)),d=await Em(e,o,a.status);return await _I(e,a),{id:o,etag:(i=d??(0,Ht.readEtag)(c))!==null&&i!==void 0?i:await OI(e,o)}}catch(l){throw s&&await TI(e,o),l}},async delete(e,t){let r=(0,Sr.normalizeGuid)(t,"id"),n=await PI(e,r,null);try{await(0,Ht.deleteRecord)(e,"workflows",r)}catch(i){throw n&&await TI(e,r),i}}}});var h_=g(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});Sa.bpfRegistration=Sa.BpfAdapter=void 0;var Aa=ws(),pG=Js(),Tu=jn(),fG=RI(),Dm=on(),oi=kn(),WI=yn(),Ot=br(),Pn=ht(),Nr=ne(),mG=100,_m='<?xml version="1.0" encoding="utf-16"?>',xI=1033,jI="mxswa:Workflow",hG="mxswa:ActivityReference.Properties",gG="mcwo:StepLabel",vG="mcwb:Control",FI="mcwb:Control.ControlDisplayName",HI="mcwb:Control.DataFieldName",QI="DataFieldName",LI="ControlDisplayName",JI="Literal",Ou="x:Null",kI="x:String",Pm="x:Key",Tm="DisplayName",xu="Activities",bG="StepLabels",XI="StageId",KI="StageCategory",YI="NextStageId",ZI="ProcessStepId",Om="IsProcessRequired",e_="EntityComposite",t_="StageComposite",r_="StepComposite";function Im(e){return(0,Ot.isJsonObject)(e)?e:{}}function Er(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 si(e,t){var r;return(r=Er(e).find(n=>n.tagName===t))!==null&&r!==void 0?r:null}function Dr(e){return si(e,hG)}function pt(e,t){var r;return(r=Er(e).find(n=>n.getAttribute(Pm)===t))!==null&&r!==void 0?r:null}function Ca(e,t){var r;return((r=e.getAttribute("AssemblyQualifiedName"))!==null&&r!==void 0?r:"").includes(t)}function Jr(e){var t;return!e||!e.firstChild?"":(t=e.firstChild.nodeValue)!==null&&t!==void 0?t:""}function n_(e,t,r){e.firstChild?e.firstChild.nodeValue=r:e.appendChild(t.createTextNode(r))}function rs(e){var t;let r=(t=e.getAttribute(Tm))!==null&&t!==void 0?t:"",n=r.indexOf(": ");return n>=0?r.slice(n+2):r}function i_(e,t){var r;let n=(r=e.getAttribute(Tm))!==null&&r!==void 0?r:"",i=n.indexOf(": ");e.setAttribute(Tm,i>=0?n.slice(0,i+2)+t:t)}function a_(e,t){let r=pt(e,bG),n=si(r,gG);n&&n.setAttribute("Description",t)}function yG(e){let t=pt(e,KI);if(!t||t.tagName===Ou)return;let r=Jr(t).trim();return r===""?void 0:Number(r)}function wG(e){let t=pt(e,YI);if(!t||t.tagName===Ou)return;let r=Jr(t).trim();return r===""?void 0:r}function o_(e){let t=s_(e);if(!t)return;let r=u_(t,QI,HI);return r===""?void 0:r}function Rm(e,t){let r=Er(e);for(;r.length>0;){let n=r.pop();if(n.tagName===t)return n;for(let i of Er(n))r.push(i)}return null}function s_(e){let t=pt(Dr(e),xu);return t?Rm(t,vG):null}function l_(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 u_(e,t,r){var n;return l_(e,t)?(n=e.getAttribute(t))!==null&&n!==void 0?n:"":EG(e,r)}function MI(e,t,r,n){if(l_(e,t)){e.setAttribute(t,n);return}if(si(e,r)){AG(e,r,n);return}throw new Nr.InvalidArgumentError(`BPF step control exposes neither a '${t}' attribute nor a <${r}> wrapper to bind a column`)}function AG(e,t,r){let n=si(e,t),i=n?Rm(n,JI):null;i&&i.setAttribute("Value",r)}function c_(e){return rs(e)}function Fu(e){let t=si(e,jI),r=[];for(let n of Er(t).filter(i=>Ca(i,e_))){let i=pt(Dr(n),xu);for(let a of Er(i).filter(o=>Ca(o,t_)))r.push({el:a,entity:c_(n)})}return r}function xm(e){let t=pt(Dr(e),xu);return Er(t).filter(r=>Ca(r,r_))}function CG(e){let t=Dr(e),r=Jr(pt(t,Om)).trim().toLowerCase(),n=o_(e),i={id:Jr(pt(t,ZI)),name:rs(e)};return n!==void 0&&(i.fieldName=n),r==="true"&&(i.required=!0),i}function SG(e,t){let r=Dr(e),n=yG(r),i=wG(r),a={id:Jr(pt(r,XI)),name:rs(e),entityLogicalName:t,steps:xm(e).map(CG)};return n!==void 0&&(a.category=n),i!==void 0&&(a.nextStageId=i),a}function NG(e){return Fu(e).map(({el:t,entity:r})=>SG(t,r))}function Qr(e){return new Nr.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 EG(e,t){var r;let n=si(e,t),i=n?Rm(n,JI):null;return(r=i?.getAttribute("Value"))!==null&&r!==void 0?r:""}function Fm(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(Fm(e,s)):s.nodeType===3&&n.appendChild(e.createTextNode((r=s.nodeValue)!==null&&r!==void 0?r:""))}return n}function d_(e){return pt(Dr(e),xu)}function DG(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,Pn.newId)(),{body:o}=Lu(Lm(i,(0,Aa.v4)(),t.id,a));return Fm(e,Fu((0,oi.parseXmlRoot)(o,"<Activity/>"))[0].el)}function IG(e,t){let{body:r}=Lu(Lm("account",(0,Aa.v4)(),(0,Aa.v4)(),t.id));return Fm(e,xm(Fu((0,oi.parseXmlRoot)(r,"<Activity/>"))[0].el)[0])}function p_(e,t){for(;e.firstChild;)e.removeChild(e.firstChild);for(let r of t)e.appendChild(r)}function f_(e,t,r,n){let i=pt(e,r);if(!i||!i.parentNode){if(n!==void 0&&n!=="")throw Qr(`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!==Ou){let s=t.createElement(Ou);s.setAttribute(Pm,r),a.replaceChild(s,i)}return}if(i.tagName===kI){Jr(i)!==n&&n_(i,t,n);return}let o=t.createElement(kI);o.setAttribute(Pm,r),o.appendChild(t.createTextNode(n)),a.replaceChild(o,i)}function _G(e,t,r){f_(e,t,KI,r===void 0?void 0:String(r))}function PG(e,t,r){f_(e,t,YI,r)}function m_(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 UI(e){return Jr(pt(Dr(e),XI))}function BI(e){return Jr(pt(Dr(e),ZI))}function $I(e,t,r){var n,i,a,o;let s=Dr(e);r.name!==rs(e)&&(i_(e,r.name),a_(s,r.name));let l=Jr(pt(s,Om)).trim().toLowerCase()==="true";if(((n=r.required)!==null&&n!==void 0?n:!1)!==l){let u=pt(s,Om);u&&n_(u,t,r.required?"True":"False")}if(((i=r.fieldName)!==null&&i!==void 0?i:"")!==((a=o_(e))!==null&&a!==void 0?a:"")){let u=s_(e);if(!u)throw new Nr.InvalidArgumentError("BPF step has no <mcwb:Control> element to bind a column to");let c=(o=r.fieldName)!==null&&o!==void 0?o:"";MI(u,QI,HI,c),c!==""&&u_(u,LI,FI)===""&&MI(u,LI,FI,c)}}function qI(e,t,r,n){var i;let a=Dr(e);if(!a)throw new Nr.InvalidArgumentError("BPF stage composite has no <\u2026ActivityReference.Properties>");if(r.name!==rs(e)&&(i_(e,r.name),a_(a,r.name)),_G(a,t,r.category),PG(a,t,n),r.relationshipName&&r.relationshipName.trim()!=="")throw Qr("a stage relationship / table change (multi-table authoring)");if(r.actions&&r.actions.length>0||r.branch)throw Qr("stage actions or conditional branching");let o=d_(e);if(!o)throw new Nr.InvalidArgumentError("BPF stage has no [Activities] collection");let s=(i=r.steps)!==null&&i!==void 0?i:[];if(s.length===0)throw new Nr.InvalidArgumentError(`BPF stage '${r.name}' must have at least one step`);let l=xm(e);if(m_(l,s.map(d=>d.id),BI)){l.forEach((d,p)=>$I(d,t,s[p]));return}let u=new Map(l.map(d=>[BI(d),d]));if(Er(o).some(d=>!Ca(d,r_)))throw Qr("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:IG(t,d)});p_(o,c),c.forEach((d,p)=>$I(d,t,s[p]))}function TG(e,t,r){let n=si(e,jI);if(!n)throw new Nr.InvalidArgumentError("BPF xaml has no <mxswa:Workflow> root activity");if(r.globalActions&&r.globalActions.length>0)throw Qr("global (process-completed/abandoned) actions");if(!r.stages||r.stages.length===0)throw new Nr.InvalidArgumentError("a BPF must have at least one stage");let i=Fu(e),a=i.map(p=>p.el);if(m_(a,r.stages.map(p=>p.id),UI)){i.forEach(({el:p,entity:m},h)=>{let w=r.stages[h];if(w.entityLogicalName&&w.entityLogicalName.trim()!==""&&w.entityLogicalName!==m)throw Qr(`changing a stage's table ('${w.entityLogicalName}' vs the process's '${m}')`);qI(p,t,w,w.nextStageId)});return}let o=Er(n).filter(p=>Ca(p,e_));if(o.length!==1)throw Qr("adding, removing or reordering stages on a multi-table process");let s=o[0],l=c_(s),u=d_(s);if(!u)throw new Nr.InvalidArgumentError("BPF primary entity composite has no [Activities] collection");if(Er(u).some(p=>!Ca(p,t_)))throw Qr("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 Qr(`a stage on a different table ('${p.entityLogicalName}') than the process primary ('${l}')`);let c=new Map(a.map(p=>[UI(p),p])),d=r.stages.map(p=>{var m;return(m=c.get(p.id))!==null&&m!==void 0?m:DG(t,p,l)});p_(u,d),d.forEach((p,m)=>{let h=m<d.length-1?r.stages[m+1].id:void 0;qI(p,t,r.stages[m],h)})}function Lu(e){let t=e.match(/^<\?xml[^>]*\?>\s*/),r=t?t[0]:"";return{prolog:r,body:e.slice(r.length)}}function OG(e){var t,r,n,i,a,o;(0,WI.installDomShim)();let s=(t=e.bag)===null||t===void 0?void 0:t.xaml;if(s){let p=new pG.DOMParser().parseFromString("<root/>","text/xml"),m={n:"Activity",a:(0,Dm.mergeAttrs)(s.a,[]),c:(0,Dm.spliceChildren)(s.c,[])};return{root:(0,Dm.rebuildRaw)(m,(0,oi.domEngine)(p),null),prolog:(n=(r=e.bag)===null||r===void 0?void 0:r.xamlProlog)!==null&&n!==void 0?n:_m,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=Lm(e.entityLogicalName,(0,Aa.v4)(),l?.id&&l.id.trim()!==""?l.id:(0,Aa.v4)(),u?.id&&u.id.trim()!==""?u.id:(0,Aa.v4)()),{body:d}=Lu(c);return{root:(0,oi.parseXmlRoot)(d,"<Activity/>"),prolog:_m,eol:"lf"}}function RG(e){let{root:t,prolog:r,eol:n}=OG(e);TG(t,t.ownerDocument,e);let i=(0,oi.serializeNode)(t);return n==="crlf"&&(i=i.replace(/\n/g,`\r
-`)),r+i}function xG(e){return e.uniqueName&&e.uniqueName.trim()!==""?e.uniqueName:`new_${(e.name||"businessprocessflow").toLowerCase().replace(/[^a-z0-9]/g,"")||"businessprocessflow"}`}var Ru=class{toArtifact(t){return t}fromArtifact(t){return t}fromApiResponse(t){var r,n;(0,WI.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}=Lu(a),u=(0,oi.parseXmlRoot)(l,"<Activity/>");o.stages=NG(u),o.bag={xaml:(0,oi.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,Pn.newId)(),name:t.name,uniquename:xG(t),primaryentity:t.entityLogicalName,xaml:RG(t),category:Tu.WorkflowCategory.BusinessProcessFlow,type:Tu.WorkflowTypeCode.Definition,businessprocesstype:Tu.BusinessProcessType.BusinessFlow,scope:Tu.WorkflowScope.Organization,processorder:(r=t.order)!==null&&r!==void 0?r:mG};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 Nr.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(GI):[GI({id:(0,Pn.newId)(),name:"New Stage",steps:[]})],o={id:t.id&&t.id.trim()!==""?t.id:(0,Pn.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=Im(t);(typeof r.id!="string"||r.id.trim()==="")&&(r.id=(0,Pn.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,Ot.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,Ot.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=Im(l),p=typeof d.id=="string"?d.id.trim():"";p===""?r.push((0,Ot.issue)(`${c}/id`,"stage-id-required","a stage needs an id")):o.has(p.toLowerCase())?r.push((0,Ot.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 m=Array.isArray(l.steps)?l.steps:[];m.length===0&&r.push((0,Ot.issue)(`${c}/steps`,"stage-needs-step","a BPF stage must have at least one step")),m.length>30&&r.push((0,Ot.issue)(`${c}/steps`,"too-many-steps",`a stage allows at most 30 steps, got ${m.length}`));let h=new Map;m.forEach((w,y)=>{let N=`${c}/steps/${y}`,D=typeof Im(w).id=="string"?w.id.trim():"";D===""?r.push((0,Ot.issue)(`${N}/id`,"step-id-required","a step needs an id")):h.has(D.toLowerCase())?r.push((0,Ot.issue)(`${N}/id`,"step-id-duplicate",`two steps in this stage share the id '${w.id}'`)):h.set(D.toLowerCase(),y)}),l.branch&&!VI(i,l.branch.nextStageId)&&r.push((0,Ot.issue)(`${c}/branch/nextStageId`,"branch-target-unknown",`branch nextStageId '${l.branch.nextStageId}' does not match any stage id`)),typeof l.nextStageId=="string"&&l.nextStageId!==""&&!VI(i,l.nextStageId)&&r.push((0,Ot.issue)(`${c}/nextStageId`,"next-stage-unknown",`nextStageId '${l.nextStageId}' does not match any stage id`))}),a.size>5&&r.push((0,Ot.issue)("/stages","too-many-tables",`a BPF spans at most 5 tables, got ${a.size}`));let s=FG(i);return s>=0&&r.push((0,Ot.issue)(`/stages/${s}/nextStageId`,"next-stage-cycle","the stage nextStageId links form a cycle; the flow must be acyclic")),r}};Sa.BpfAdapter=Ru;function FG(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 VI(e,t){return e.some(r=>r.id===t)}function GI(e){var t,r;let n=e.steps&&e.steps.length>0?e.steps.map(zI):[zI({id:(0,Pn.newId)(),name:"New Step"})],i={id:e.id&&e.id.trim()!==""?e.id:(0,Pn.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 zI(e){var t;let r={id:e.id&&e.id.trim()!==""?e.id:(0,Pn.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 Lm(e,t,r,n){return`${_m}<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="${xI}" /></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="${xI}" /></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 LG(){return{adapter:new Ru,api:fG.bpfApi,languageSensitive:!0}}Sa.bpfRegistration=LG});var g_=g(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.buildRegistrations=void 0;var kG=VE(),MG=nD(),UG=u2(),BG=w2(),$G=B2(),qG=rI(),VG=hI(),GG=EI(),zG=h_();function WG(e){let t=new Map;return t.set("form",(0,kG.formRegistration)(e)),t.set("view",(0,MG.viewRegistration)()),t.set("businessRule",(0,UG.businessRuleRegistration)()),t.set("app",(0,BG.appRegistration)(e)),t.set("command",(0,$G.commandRegistration)()),t.set("chart",(0,qG.chartRegistration)()),t.set("dashboard",(0,VG.dashboardRegistration)(e)),t.set("genPage",(0,GG.genPageRegistration)()),t.set("bpf",(0,zG.bpfRegistration)()),t}ku.buildRegistrations=WG});var E_=g(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.removeRowSummary=Fe.configureRowSummary=Fe.buildGptDynamicPrompt=Fe.setAppAiFeatures=Fe.getAiReadiness=Fe.saveSettingValue=Fe.retrieveSetting=Fe.AI_GATE=void 0;var ir=ge(),He=Z(),v_=ht(),Xr=ne();Fe.AI_GATE={formFill:"FormFillBarUXEnabled",formFillSuggestions:"FormPredictEnabled",formFillSmartPaste:"FormPredictSmartPasteEnabled",formFillFiles:"FormFillFileUploadEnabled",nlSearch:"EnableNLGridSearch",nlChart:"NLChartVisualizationSetting",summaries:"EnableFormInsights",m365:"m365copilotmodelappenabled"};var jG={formFill:"FormFillBarUXEnabled",formFillSuggestions:"FormPredictEnabled",formFillSmartPaste:"FormPredictSmartPasteEnabledOnByDefault",formFillFiles:"FormFillFileUploadEnabled",nlSearch:"NLGridSearchSetting",nlChart:"NLChartDataVisualizationSetting",m365:"m365copilotmodelappenabled"},HG={formFill:{enabled:"2",disabled:"1"},formFillSuggestions:{enabled:"2",disabled:"1"},formFillSmartPaste:{enabled:"2",disabled:"1"},formFillFiles:{enabled:"2",disabled:"1"}};function A_(e){return HG[e]}var Mu=1e6;function QG(e,t){let r=A_(t),n=()=>{throw new Xr.InvalidArgumentError(`setAppAiFeatures: '${t}' must be a boolean or an integer between 0 and ${Mu} (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>Mu?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(Mu).length||Number(s)>Mu?n():s}}return n()}function JG(e,t){let r=A_(t);return r?e===r.enabled:e!=="0"}async function XG(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 KG(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 Xr.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 Xr.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 Xr.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 Xr.InvalidArgumentError(`setAppAiFeatures: cannot confirm that the supplied appModuleId belongs to app '${t}' \u2014 the lookup returned a row with no appmoduleid.`);return s}var b_=new WeakMap;async function YG(e,t){var r,n,i;let a=b_.get(e);if(a||(a=new Map,b_.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 ZG(e,t,r){var n,i;let a=await YG(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 e7=4,t7=500,y_=20,w_=3e4;function r7(e){if(e===void 0)return e7;if(!Number.isFinite(e))throw new Xr.InvalidArgumentError(`setAppAiFeatures: verifyAttempts must be a finite integer between 1 and ${y_}; got ${e}.`);return Math.min(y_,Math.max(1,Math.floor(e)))}function n7(e){if(e===void 0)return t7;if(!Number.isFinite(e))throw new Xr.InvalidArgumentError(`setAppAiFeatures: verifyDelayMs must be a finite number between 0 and ${w_}; got ${e}.`);return Math.min(w_,Math.max(0,Math.floor(e)))}function i7(e){return e>0?new Promise(t=>setTimeout(t,e)):Promise.resolve()}async function a7(e,t,r,n,i,a,o){let s,l,u,c=!1;for(let d=0;d<a;d+=1){d>0&&await i7(o*d);let p;try{let m=await t();m?(p=await ZG(e,m,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(m){p=void 0,u=m.message}c=p!==void 0,l=p?.exists;try{s=(await Uu(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 C_(e,t){return t===2?String(e).toLowerCase()==="true":e!=null&&e!=="0"&&e!==""}async function Uu(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,ir.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}}Fe.retrieveSetting=Uu;async function S_(e,t,r,n={}){let i={SettingName:t,Value:r};n.appUniqueName&&(i.AppUniqueName=n.appUniqueName),n.solutionUniqueName&&(i.SolutionUniqueName=n.solutionUniqueName),(0,ir.ensureSuccess)(await e.post("/SaveSettingValue",i),e.apiUrl("/SaveSettingValue"))}Fe.saveSettingValue=S_;async function o7(e,t={}){let r={};for(let[n,i]of Object.entries(Fe.AI_GATE)){let{value:a,dataType:o}=await Uu(e,i,t);r[n]={enabled:C_(a,o),setting:i,value:a}}return r}Fe.getAiReadiness=o7;async function s7(e,t,r,n={}){var i,a,o;if(!t||!t.trim())throw new Xr.InvalidArgumentError("setAppAiFeatures: a non-empty appUniqueName is required (an empty value would write the setting at organization scope, affecting every app).");let s=r7(n.verifyAttempts),l=n7(n.verifyDelayMs),u=[];for(let[y,N]of Object.entries(r)){if(N===void 0)continue;let D=jG[y];D&&u.push({feature:y,setting:D,requestedValue:QG(N,y)})}let c=[],d=n.appModuleId?(0,He.normalizeGuid)(n.appModuleId,"appModuleId"):void 0;if(d){let y=await KG(e,t);if(y&&(0,He.normalizeGuid)(y,"appModuleId")!==d)throw new Xr.InvalidArgumentError(`setAppAiFeatures: appModuleId '${d}' does not belong to app '${t}' (which resolves to '${y}'). Settings are written by unique name, so verifying against a different app would report success for a write that never landed.`)}let p,m=async()=>d||(p||(p=await XG(e,t)),p),h=new Map,w=async y=>{let N=Fe.AI_GATE[y];if(N){if(!h.has(N)){let{value:D,dataType:x}=await Uu(e,N);h.set(N,{enabled:C_(D,x),setting:N,value:D})}return h.get(N)}};for(let{feature:y,setting:N,requestedValue:D}of u)try{if(JG(D,y)){let q=await w(y);if(!q?.enabled){c.push({feature:y,setting:N,requestedValue:D,status:"skipped",reason:`the org readiness gate '${(i=q?.setting)!==null&&i!==void 0?i:y}' is off, so the feature cannot be enabled for this app`});continue}}await S_(e,N,D,{appUniqueName:t,solutionUniqueName:n.solutionUniqueName});let x=await a7(e,m,t,N,D,s,l),F={feature:y,setting:N,requestedValue:D,effectiveValue:x.effectiveValue,appOverrideExists:x.appOverrideExists};x.result==="proven"?c.push({...F,status:"applied"}):x.result==="absent"?c.push({...F,status:"notPersisted",reason:`the write reported success but no app-scope override holding '${D}' was observed for '${N}' after ${s} attempt(s) \u2014 it reads '${(a=x.effectiveValue)!==null&&a!==void 0?a:""}' for this app (Dataverse can accept an app-scope write without storing it)`}):c.push({...F,status:"unverified",reason:`the write was issued but could not be confirmed: ${(o=x.reason)!==null&&o!==void 0?o:"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(x){c.push({feature:y,setting:N,requestedValue:D,status:"failed",reason:x.message})}return{applied:c.filter(y=>y.status==="applied").map(y=>y.feature),skipped:c.filter(y=>y.status==="skipped").map(y=>y.feature),notPersisted:c.filter(y=>y.status==="notPersisted").map(y=>y.feature),unverified:c.filter(y=>y.status==="unverified").map(y=>y.feature),failed:c.filter(y=>y.status==="failed").map(y=>y.feature),outcomes:c}}Fe.setAppAiFeatures=s7;var l7="GptPowerPrompt",u7='{ "consumptionSource": "Api", "partnerSource": "AIBuilder", "consumptionSourceVersion": "GptApiClient"}';function N_(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:""}}Fe.buildGptDynamicPrompt=N_;async function c7(e,t){var r,n;let i=`/EntityDefinitions(LogicalName='${(0,He.odataPathLiteral)(t)}')${(0,He.odataQuery)([["$select","MetadataId"]])}`;return(n=(r=(0,ir.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)===null||r===void 0?void 0:r.MetadataId)!==null&&n!==void 0?n:""}async function d7(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,ir.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 '${l7}'`],["$top",1]])}`,p=((s=(o=(a=(0,ir.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,m=(0,v_.newId)(),h=(0,v_.newId)(),w=JSON.stringify(N_(t)),y={ModelId:m,RunConfigurationId:h,ModelName:`${t.entityLogicalName} row summary`,TemplateId:p,CustomConfiguration:w,Source:u7,RunConfiguration:""};(0,ir.ensureSuccess)(await e.post("/AIModelPublish",y),e.apiUrl("/AIModelPublish"));try{let N=await c7(e,t.entityLogicalName),D={uniquename:l,description:`${t.entityLogicalName} row summary`,"[email protected]":`/entities(${N})`,"[email protected]":`/msdyn_aimodels(${m})`,aiskill:"RowSummary"},x=(0,ir.ensureSuccess)(await e.post("/aiskillconfigs",D),e.apiUrl("/aiskillconfigs")),F=(0,ir.requireCreatedId)(x,"aiskillconfigid","row-summary skill");return{modelId:m,aiSkillConfigId:F}}catch(N){try{await e.delete(`/msdyn_aimodels(${m})`)}catch{}throw N}}Fe.configureRowSummary=d7;async function p7(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,ir.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,ir.ensureSuccess)(await e.delete(s),e.apiUrl(s)),o._aimodel_value){let l=`/msdyn_aimodels(${o._aimodel_value})`;(0,ir.ensureSuccess)(await e.delete(l),e.apiUrl(l))}}Fe.removeRowSummary=p7});var D_=g(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});Na.findArtifact=Na.resolveArtifact=void 0;var ft=Z(),Kr=Ps(),f7=ks(),m7=ge(),h7=ne();async function g7(e,t,r){var n,i,a,o,s,l,u,c,d,p,m,h;switch(t){case"app":{let w=(0,f7.unpublishedAppModulesQuery)("appmoduleid,name,appmoduleidunique",`uniquename eq '${(0,ft.odataLiteral)((n=r.uniqueName)!==null&&n!==void 0?n:"")}'`,1),N=(i=(0,m7.ensureSuccess)(await e.get(w),e.apiUrl(w)).body)===null||i===void 0?void 0:i.value,D=N&&N[0];return D?[{id:String(D.appmoduleid),name:String(D.name),appModuleIdUnique:String(D.appmoduleidunique)}]:[]}case"dashboard":return(await(0,Kr.queryRecords)(e,"systemform",{select:["formid","name"],filter:`name eq '${(0,ft.odataLiteral)((a=r.name)!==null&&a!==void 0?a:"")}' and type eq 0`,top:10})||[]).map(y=>({id:String(y.formid),name:String(y.name)}));case"command":{let w=await(0,Kr.queryRecords)(e,"appaction",{select:["appactionid","buttonlabeltext"],filter:`contextvalue eq '${(0,ft.odataLiteral)((o=r.entity)!==null&&o!==void 0?o:"")}'`,top:1});return w&&w.length?[{id:String(r.entity),entity:String(r.entity)}]:[]}case"form":return(await(0,Kr.queryRecords)(e,"systemform",{select:["formid","name"],filter:`name eq '${(0,ft.odataLiteral)((s=r.name)!==null&&s!==void 0?s:"")}' and objecttypecode eq '${(0,ft.odataLiteral)((l=r.entity)!==null&&l!==void 0?l:"")}'`,top:10})||[]).map(y=>({id:String(y.formid),name:String(y.name)}));case"chart":return(await(0,Kr.queryRecords)(e,"savedqueryvisualization",{select:["savedqueryvisualizationid","name"],filter:`name eq '${(0,ft.odataLiteral)((u=r.name)!==null&&u!==void 0?u:"")}' and primaryentitytypecode eq '${(0,ft.odataLiteral)((c=r.entity)!==null&&c!==void 0?c:"")}'`,top:10})||[]).map(y=>({id:String(y.savedqueryvisualizationid),name:String(y.name)}));case"view":return(await(0,Kr.queryRecords)(e,"savedquery",{select:["savedqueryid","name"],filter:`name eq '${(0,ft.odataLiteral)((d=r.name)!==null&&d!==void 0?d:"")}' and returnedtypecode eq '${(0,ft.odataLiteral)((p=r.entity)!==null&&p!==void 0?p:"")}'`,top:10})||[]).map(y=>({id:String(y.savedqueryid),name:String(y.name)}));case"webResource":return(await(0,Kr.queryRecords)(e,"webresource",{select:["webresourceid","name"],filter:`name eq '${(0,ft.odataLiteral)((m=r.name)!==null&&m!==void 0?m:"")}'`,top:1})||[]).map(y=>({id:String(y.webresourceid),name:String(y.name)}));case"solution":return(await(0,Kr.queryRecords)(e,"solution",{select:["solutionid","uniquename"],filter:`uniquename eq '${(0,ft.odataLiteral)((h=r.uniqueName)!==null&&h!==void 0?h:"")}'`,top:1})||[]).map(y=>({id:String(y.solutionid),name:String(y.uniquename)}));default:return[]}}Na.resolveArtifact=g7;async function v7(e,t,r){var n,i,a,o,s;let l=(0,ft.odataLiteral)((n=r.name)!==null&&n!==void 0?n:""),u=(0,ft.odataLiteral)((i=r.entity)!==null&&i!==void 0?i:"");if(t==="command"){let h=await(0,Kr.queryRecords)(e,"appaction",{select:["appactionid"],filter:`contextvalue eq '${(0,ft.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,Kr.queryRecords)(e,c.set,{select:[c.idField],filter:c.filter,top:d?2:1});if(d&&p&&p.length>1)throw new h7.AmbiguousArtifactError(t,(s=(o=r.name)!==null&&o!==void 0?o:r.uniqueName)!==null&&s!==void 0?s:"",p.length);let m=p&&p[0]&&p[0][c.idField];return m!=null?String(m):null}Na.findArtifact=v7;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,ft.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 __=g($u=>{"use strict";Object.defineProperty($u,"__esModule",{value:!0});$u.seedRecordGraph=void 0;var I_=Ps(),y7=Cs(),Bu=Z(),w7=ne();async function A7(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,y7.resolveEntitySetName)(e,p)),c={},d=p=>{var m;return(m=c[p])!==null&&m!==void 0?m:l[p]};for(let p of t){let m=p.entityLogical.toLowerCase(),h=(a=p.matchOn)===null||a===void 0?void 0:a.toLowerCase(),w=[];for(let G of p.records){let M={...G.body};for(let U of(o=G.binds)!==null&&o!==void 0?o:[]){let B=U.parentEntity.toLowerCase(),W=(s=d(B))===null||s===void 0?void 0:s[U.parentIndex];if(!W)throw new w7.InvalidArgumentError(`Cannot resolve bind '${U.navProperty}' on a '${m}' record: parent '${U.parentEntity}'[${U.parentIndex}] has no created id. Seed the parent group before the child, or supply it via options.createdIds.`);let $=(0,Bu.assertODataName)(await u(B),`entity set for parent '${U.parentEntity}'`),Ae=(0,Bu.normalizeGuid)(W,`parent id for bind '${U.navProperty}'`);M[`${U.navProperty}@odata.bind`]=`/${$}(${Ae})`}w.push(M)}let y=h?w.map(G=>{let M=G[h];return M!=null&&M!==""?String(M):null}):w.map(()=>null),N=new Map;if(h){let G=(0,Bu.assertODataName)(h,"RecordGraph matchOn key"),M=[...new Set(y.filter(U=>U!==null))];if(M.length){let U=M.map(W=>`${G} eq '${(0,Bu.odataLiteral)(W)}'`).join(" or "),B=await(0,I_.queryRecords)(e,m,{select:[G,`${m}id`],filter:U,top:5e3});for(let W of B??[]){let $=W[G];$!=null&&N.set(String($).toLowerCase(),String(W[`${m}id`]))}}}let D=[],x=new Map,F=w.map((G,M)=>{let U=y[M];if(U&&N.has(U.toLowerCase()))return null;if(U){let B=U.toLowerCase(),W=x.get(B);if(W!==void 0)return W;let $=D.push(G)-1;return x.set(B,$),$}return D.push(G)-1}),q=D.length?await(0,I_.createRecordsBulk)(e,m,D):[];c[m]=w.map((G,M)=>{let U=y[M];return U&&N.has(U.toLowerCase())?N.get(U.toLowerCase()):q[F[M]]})}return{createdIds:c}}$u.seedRecordGraph=A7});var M_=g(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.getEntityPrivileges=It.deleteSecurityRole=It.createPersonaRole=It.createSecurityRole=It.SDK_ROLE_MARKER=void 0;var Ir=ge(),et=Z(),Qt=ne(),qu={read:"Read",create:"Create",write:"Write",delete:"Delete",append:"Append",appendTo:"AppendTo",assign:"Assign",share:"Share"},F_={user:"Basic",businessUnit:"Local",parentChild:"Deep",organization:"Global"},P_={user:1,businessUnit:2,parentChild:3,organization:4},km={user:"CanBeBasic",businessUnit:"CanBeLocal",parentChild:"CanBeDeep",organization:"CanBeGlobal"};It.SDK_ROLE_MARKER="Authored by @maker-studio/cds-maker-sdk (persona/security role).";function C7(e){return Object.prototype.hasOwnProperty.call(qu,e)?qu[e]:void 0}function S7(e){return Object.prototype.hasOwnProperty.call(F_,e)}var T_=new WeakMap,O_=new WeakMap;async function L_(e,t){var r,n;(0,et.assertODataName)(t,"entity logical name");let i=T_.get(e);i||(i=new Map,T_.set(e,i));let a=i.get(t);if(a)return a;let o=`/EntityDefinitions(LogicalName='${(0,et.odataPathLiteral)(t)}')${(0,et.odataQuery)([["$select","LogicalName,Privileges"]])}`,l=(n=(r=(0,Ir.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 Qt.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=O_.get(e);if(i)return i;let a=`/businessunits${(0,et.odataQuery)([["$select","businessunitid"],["$filter","_parentbusinessunitid_value eq null"],["$top",1]])}`,l=(n=((r=(t=(0,Ir.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 Qt.InvalidArgumentError("Could not resolve the root business unit.");let u=(0,et.normalizeGuid)(l,"businessUnitId");return O_.set(e,u),u}async function E7(e,t){var r;let n=new Map;for(let i of t){if(!i.access||i.access.length===0)throw new Qt.InvalidArgumentError(`Entity '${i.entity}' privilege request has no access levels.`);let a=(r=i.scope)!==null&&r!==void 0?r:"user";if(!S7(a))throw new Qt.InvalidArgumentError(`Unknown privilege scope '${a}' for entity '${i.entity}'.`);let o=await L_(e,i.entity);for(let s of i.access){let l=C7(s);if(!l)throw new Qt.InvalidArgumentError(`Unknown access level '${s}' for entity '${i.entity}'.`);let u=o.find(h=>h.PrivilegeType===l);if(!u)throw new Qt.InvalidArgumentError(`Entity '${i.entity}' does not support '${s}' access.`);let c=km[a];if(u[c]===!1)throw new Qt.InvalidArgumentError(`Privilege '${u.Name}' on '${i.entity}' does not support the '${a}' scope.`);let d=(0,et.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 Qt.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=P_[a]>P_[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:F_[o.scope],PrivilegeId:o.privilegeId}))},a=`/roles(${t})/Microsoft.Dynamics.CRM.ReplacePrivilegesRole`;(0,Ir.ensureSuccess)(await e.post(a,i),e.apiUrl(a))}async function R_(e,t,r,n,i){var a,o;let s=`/${t}(${r})/${n}${(0,et.odataQuery)([["$select","roleid"],["$filter",`roleid eq ${i}`]])}`;return((o=(a=(0,Ir.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,et.normalizeGuid)(l,"teamId");if(!await R_(e,"teams",u,"teamroles_association",t)){let c=`/teams(${u})/teamroles_association/$ref`;(0,Ir.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,et.normalizeGuid)(l,"userId");if(!await R_(e,"systemusers",u,"systemuserroles_association",t)){let c=`/systemusers(${u})/systemuserroles_association/$ref`;(0,Ir.ensureSuccess)(await e.post(c,s),e.apiUrl(c))}o.push(u)}return{teams:a,users:o}}async function x_(e,t,r){var n,i;let a=`/roles${(0,et.odataQuery)([["$select","roleid,description,ismanaged"],["$filter",`name eq '${(0,et.odataLiteral)(t)}' and _businessunitid_value eq ${r}`]])}`,l=((i=(n=(0,Ir.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:"")===It.SDK_ROLE_MARKER};if(l.some(d=>!u(d)))throw new Qt.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 Qt.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,et.normalizeGuid)(c,"roleId"):void 0}function _7(e){var t,r;return{teams:((t=e?.teams)!==null&&t!==void 0?t:[]).map(n=>(0,et.normalizeGuid)(n,"teamId")),users:((r=e?.users)!==null&&r!==void 0?r:[]).map(n=>(0,et.normalizeGuid)(n,"userId"))}}function P7(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 Qt.InvalidArgumentError("createSecurityRole: a non-empty role name is required.");let a=t.businessUnitId?(0,et.normalizeGuid)(t.businessUnitId,"businessUnitId"):await N7(e),o=await E7(e,(n=t.privileges)!==null&&n!==void 0?n:[]),s=_7(t.assignTo),l=await x_(e,i,a),u=l!==void 0;if(!l){let d="/roles",p={name:i,description:It.SDK_ROLE_MARKER,"[email protected]":`/businessunits(${a})`};try{let m=(0,Ir.ensureSuccess)(await e.post(d,p),e.apiUrl(d));l=(0,et.normalizeGuid)((0,Ir.requireCreatedId)(m,"roleid","role"),"roleId")}catch(m){let h;try{h=await x_(e,i,a)}catch{h=void 0}if(!h)throw m;l=h}}await D7(e,l,o,u);let c=await I7(e,l,s);return{roleId:l,name:i,reused:u,appliedPrivileges:P7(o),assignedTeams:c.teams,assignedUsers:c.users}}It.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 Qt.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})}It.createPersonaRole=T7;async function O7(e,t){let n=`/roles(${(0,et.normalizeGuid)(t,"roleId")})`;(0,Ir.ensureSuccess)(await e.delete(n),e.apiUrl(n))}It.deleteSecurityRole=O7;var R7=new Map(Object.keys(qu).map(e=>[qu[e],e]));async function x7(e,t){return(await L_(e,t)).map(n=>{let i=Object.keys(km).filter(o=>n[km[o]]!==!1),a=R7.get(n.PrivilegeType);return{name:n.Name,privilegeId:n.PrivilegeId,privilegeType:n.PrivilegeType,...a?{access:a}:{},scopes:i}})}It.getEntityPrivileges=x7});var V_=g(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.createMakerSdk=Pr.MakerSdk=Pr.ALREADY_EXISTS_CODE=void 0;var ue=ne(),Yr=os(),F7=qm(),U_=zm(),L7=Xm(),k7=hh(),Mm=yh(),Qe=Cs(),B_=Zc(),Zr=Ps(),Vu=Cg(),Ea=Os(),M7=xs(),st=Pg(),U7=ld(),B7=g_(),$7=yn(),q7=ht(),V7=pi(),Tn=Wf(),$_=pc(),G7=3e5,_r=ge(),On=Z(),Da=E_(),q_=D_(),z7=__(),W7=Nf(),Gu=M_();Pr.ALREADY_EXISTS_CODE="ARTIFACT_ALREADY_EXISTS";var Wu=class{constructor(t){var r,n;this.artifactLocks=new Map,(0,$7.installDomShim)(),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=new U_.WorkspaceManager(t.workspacePath,t.instanceUrl),this.versions=new L7.VersionManager(this.workspace),this.dataverse=new k7.DataverseClient(t.instanceUrl,t.httpClient,t.solutionUniqueName),this.registrations=(0,B7.buildRegistrations)(this.languageCode)}initWorkspace(){this.workspace.init()}getManifest(){return this.workspace.getManifest()}cleanWorkspace(){this.workspace.clean()}withArtifactLock(t,r,n){var i;let a=`${t}\0${(0,U_.canonicalArtifactId)(r)}`,s=((i=this.artifactLocks.get(a))!==null&&i!==void 0?i:Promise.resolve()).then(n,n),l=s.then(()=>{},()=>{});return this.artifactLocks.set(a,l),l.then(()=>{this.artifactLocks.get(a)===l&&this.artifactLocks.delete(a)}),s}async fetchArtifact(t,r,n){return this.withArtifactLock(t,r,()=>this.fetchArtifactUnlocked(t,r,n))}async fetchArtifactUnlocked(t,r,n){var i,a;let o=this.requireRegistration(t,"fetchArtifact"),{raw:s,etag:l,memberEtags:u,siblingEtags:c}=await o.api.get(this.dataverse,r),d=o.adapter.fromApiResponse(s);if(!n?.overwrite&&this.versions.isDirty(t,r)){let p=(a=(i=this.versions.getMeta(t,r))===null||i===void 0?void 0:i.etag)!==null&&a!==void 0?a:null;if(p&&l&&p!==l)throw new ue.LocalEditsWouldBeLostError(t,r,p,l);let m=this.workspace.readArtifact(t,r);if(m){let h=this.versions.getMeta(t,r);if(h&&!h.etag&&l){if(!(0,$_.deepEqual)(h.snapshot,d))throw new ue.LocalEditsWouldBeLostError(t,r,p,l);this.versions.storeMeta(t,r,{...h,etag:l,fetchedAt:(0,_r.nowIso)()})}return(0,Tn.cloneJson)(m)}}return this.workspace.writeArtifact(t,r,d),this.versions.storeMeta(t,r,{etag:l,languageCode:this.languageCode,fetchedAt:(0,_r.nowIso)(),snapshot:(0,Tn.cloneJson)(d),...u?{memberEtags:u}:{},...c?{siblingEtags:c}:{}}),(0,Tn.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,st.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,_r.nowIso)(),isDirty:!1})}catch(s){a.push({componentId:o.objectId,componentType:o.componentType,workflowCategory:o.workflowCategory,reason:"failed",error:zu(s)})}return this.workspace.updateManifest({lastSyncAt:(0,_r.nowIso)()}),{summaries:i,skipped:a}}async fetchEntityMetadata(t){let r=await(0,Mm.fetchEntityMetadataFromApi)(this.dataverse,t);return this.workspace.writeEntityMetadata(t,r),r}findTables(t,r){return(0,Mm.findTables)(this.dataverse,t,r)}findColumns(t,r,n){return(0,Mm.findColumns)(this.dataverse,t,r,n)}createTable(t){return(0,Qe.createTable)(this.dataverse,t)}createColumn(t,r){return(0,Qe.createColumn)(this.dataverse,t,r)}createColumns(t,r){return(0,Qe.createColumns)(this.dataverse,t,r)}updateColumn(t,r,n){return(0,Qe.updateColumn)(this.dataverse,t,r,n)}deleteColumn(t,r){return(0,Qe.deleteColumn)(this.dataverse,t,r)}setFormSecurityRoles(t,r){return(0,B_.setFormSecurityRoles)(this.dataverse,t,r)}getFormSecurityRoles(t){return(0,B_.getFormSecurityRoles)(this.dataverse,t)}setColumnVisualization(t,r,n){return(0,Qe.setColumnVisualization)(this.dataverse,t,r,n)}getColumnVisualization(t,r){return(0,Qe.getColumnVisualization)(this.dataverse,t,r)}createCustomerColumn(t,r){return(0,Qe.createCustomerColumn)(this.dataverse,t,r)}insertStatusValue(t,r){return(0,Qe.insertStatusValue)(this.dataverse,t,r)}updateTable(t,r){return(0,Qe.updateTable)(this.dataverse,t,r)}async setEntityIcon(t,r){if(await(0,Qe.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,On.xmlText)(t)}</entity></entities></importexportxml>`;(0,_r.ensureSuccess)(await this.dataverse.post("/PublishXml",{ParameterXml:n}),this.dataverse.apiUrl("/PublishXml"))}}createAlternateKey(t,r){return(0,Qe.createAlternateKey)(this.dataverse,t,r)}deleteAlternateKey(t,r){return(0,Qe.deleteAlternateKey)(this.dataverse,t,r)}createRelationship(t){return(0,Qe.createRelationship)(this.dataverse,t)}deleteRelationship(t){return(0,Qe.deleteRelationship)(this.dataverse,t)}createGlobalOptionSet(t){return(0,Qe.createGlobalOptionSet)(this.dataverse,t)}deleteGlobalOptionSet(t){return(0,Qe.deleteGlobalOptionSet)(this.dataverse,t)}deleteTable(t){return(0,Qe.deleteTable)(this.dataverse,t)}createSecurityRole(t){return(0,Gu.createSecurityRole)(this.dataverse,t)}createPersonaRole(t){return(0,Gu.createPersonaRole)(this.dataverse,t)}deleteSecurityRole(t){return(0,Gu.deleteSecurityRole)(this.dataverse,t)}getEntityPrivileges(t){return(0,Gu.getEntityPrivileges)(this.dataverse,t)}createRecord(t,r){return(0,Zr.createRecord)(this.dataverse,t,r)}createRecordsBulk(t,r){return(0,Zr.createRecordsBulk)(this.dataverse,t,r)}updateRecord(t,r,n){return(0,Zr.updateRecord)(this.dataverse,t,r,n)}upsertRecord(t,r,n){return(0,Zr.upsertRecord)(this.dataverse,t,r,n)}deleteRecord(t,r){return(0,Zr.deleteRecord)(this.dataverse,t,r)}getRecord(t,r,n){return(0,Zr.getRecord)(this.dataverse,t,r,n)}queryRecords(t,r){return(0,Zr.queryRecords)(this.dataverse,t,r)}seedRecordGraph(t,r){return(0,z7.seedRecordGraph)(this.dataverse,t,r)}resolveArtifact(t,r){return(0,q_.resolveArtifact)(this.dataverse,t,r)}findArtifact(t,r){return(0,q_.findArtifact)(this.dataverse,t,r)}async deleteAppCascade(t,r){let n=await(0,U7.deleteAppCascade)(this.dataverse,t,r),i=(0,On.normalizeGuid)(t,"appModuleId");return this.workspace.readArtifact("app",i)&&this.workspace.deleteArtifact("app",i),n}associateRecords(t,r,n){return(0,Zr.associateRecords)(this.dataverse,t,r,n)}disassociateRecords(t,r,n,i){return(0,Zr.disassociateRecords)(this.dataverse,t,r,n,i)}createWebResource(t){return(0,Vu.createWebResource)(this.dataverse,t)}updateWebResource(t,r){return(0,Vu.updateWebResource)(this.dataverse,t,r)}getWebResource(t){return(0,Vu.getWebResource)(this.dataverse,t)}deleteWebResource(t){return(0,Vu.deleteWebResource)(this.dataverse,t)}getAppSettings(t){return(0,Ea.readAppSettings)(this.dataverse,t)}setAppSetting(t,r,n){return(0,Ea.setAppSetting)(this.dataverse,t,r,n)}setHeaderAndNavigationRefresh(t,r){if(typeof r!="boolean")throw new ue.ValidationError("app",t,[{pointer:"/headerAndNavigationRefresh",rule:M7.HEADER_NAV_BOOLEAN_RULE,message:`enabled must be a boolean, got ${typeof r}`}]);return(0,Ea.setAppSetting)(this.dataverse,t,Ea.HEADER_AND_NAVIGATION_REFRESH,r?Ea.APP_SETTING_ON:Ea.APP_SETTING_OFF)}getSolution(t){return(0,st.getSolution)(this.dataverse,t)}createPublisher(t){return(0,st.createPublisher)(this.dataverse,t)}createSolution(t){return(0,st.createSolution)(this.dataverse,t)}setSolutionVersion(t,r){return(0,st.setSolutionVersion)(this.dataverse,t,r)}addSolutionComponent(t){return(0,st.addSolutionComponent)(this.dataverse,t)}removeSolutionComponent(t,r,n){return(0,st.removeSolutionComponent)(this.dataverse,t,r,n)}exportSolution(t){return(0,st.exportSolution)(this.dataverse,t)}importSolution(t){return(0,st.importSolution)(this.dataverse,t)}deleteSolution(t){return(0,st.deleteSolution)(this.dataverse,t)}async getArtifact(t,r){return this.withArtifactLock(t,r,()=>this.getArtifactUnlocked(t,r))}async getArtifactUnlocked(t,r){return(0,Tn.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 ue.StaleArtifactError(t,r,n);return this.readLocal(t,r)}readLocal(t,r){let n=this.workspace.readArtifact(t,r);if(!n)throw new ue.ArtifactNotFoundError(t,r);return n}async revalidateIfStale(t,r){let n=this.versions.getMeta(t,r);if(!n)return"skipped";let i=n.fetchedAt?Date.parse(n.fetchedAt):NaN,a=Date.now()-i;if(!Number.isNaN(i)&&this.cacheStalenessMs>0&&a<=this.cacheStalenessMs)return"fresh";if(this.versions.isDirty(t,r))return"skipped";let o=this.workspace.readArtifact(t,r);await this.fetchArtifactUnlocked(t,r);let s=this.workspace.readArtifact(t,r);return(0,$_.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=Yr.JsonPointer.resolve(i,n);if(a===void 0)throw new ue.PathNotFoundError(t,r,n);return a})}async findElements(t,r,n){return this.withArtifactLock(t,r,async()=>(0,F7.findElements)(await this.getArtifactUnlocked(t,r),n))}listArtifacts(t,r){return this.workspace.listArtifacts(t,r).map(n=>({...n,isDirty:this.versions.isDirty(n.type,n.id)}))}getEntityMetadata(t){let r=this.workspace.readEntityMetadata(t);if(!r)throw new ue.ArtifactNotFoundError("entityMetadata",t);return r}getFieldMetadata(t,r){let i=this.getEntityMetadata(t).attributes.find(a=>a.logicalName===r);if(!i)throw new ue.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=Yr.JsonPointer.resolve(a,n);if(o===void 0)throw new ue.PathNotFoundError(t,r,n);let s=ju(o)&&ju(i)?{...o,...i}:i;return Yr.JsonPointer.set(a,n,(0,Tn.cloneJson)(s)),this.assertStructurallyValid(t,r,a,n),this.workspace.writeArtifact(t,r,a),this.getArtifactUnlocked(t,r)})}async addElement(t,r,n,i,a){return this.withArtifactLock(t,r,async()=>{let o=await this.readForMutation(t,r,n),s=Yr.JsonPointer.resolve(o,n);if(s===void 0)throw new ue.PathNotFoundError(t,r,n);if(!Array.isArray(s))throw new ue.ValidationError(t,r,n,"parent must be an array");let l=this.assignMissingIds(t,(0,Tn.cloneJson)(i)),u=Q7(s,a?.position);return s.splice(u,0,l),this.assertStructurallyValid(t,r,o,n),this.workspace.writeArtifact(t,r,o),this.getArtifactUnlocked(t,r)})}async moveElement(t,r,n,i,a){return this.withArtifactLock(t,r,async()=>{var o;let s=await this.readForMutation(t,r,n),l=Yr.JsonPointer.resolve(s,n);if(l===void 0)throw new ue.PathNotFoundError(t,r,n);let u=Yr.JsonPointer.resolve(s,i);if(u===void 0)throw new ue.PathNotFoundError(t,r,i);if(!Array.isArray(u))throw new ue.ValidationError(t,r,i,"move target must be an array");if(i===n||i.startsWith(`${n}/`))throw new ue.ValidationError(t,r,i,"cannot move an element into its own subtree");Yr.JsonPointer.remove(s,n);let c=(o=a?.index)!==null&&o!==void 0?o:u.length;return u.splice(Math.max(0,Math.min(c,u.length)),0,l),this.assertStructurallyValid(t,r,s,i),this.workspace.writeArtifact(t,r,s),this.getArtifactUnlocked(t,r)})}async removeElement(t,r,n){return this.withArtifactLock(t,r,async()=>{let i=await this.readForMutation(t,r,n);if(Yr.JsonPointer.resolve(i,n)===void 0)throw new ue.PathNotFoundError(t,r,n);return Yr.JsonPointer.remove(i,n),this.assertStructurallyValid(t,r,i,H7(n)),this.workspace.writeArtifact(t,r,i),this.getArtifactUnlocked(t,r)})}assertStructurallyValid(t,r,n,i){var a,o,s;let l=this.registrations.get(t),u=(s=(o=l==null?void 0:(a=l.adapter).validate)===null||o===void 0?void 0:o.call(a,n,i))!==null&&s!==void 0?s:[];if(u.length>0)throw new ue.ValidationError(t,r,u)}retrieveSetting(t,r){return(0,Da.retrieveSetting)(this.dataverse,t,r)}saveSettingValue(t,r,n){return(0,Da.saveSettingValue)(this.dataverse,t,r,n)}getAiReadiness(t){return(0,Da.getAiReadiness)(this.dataverse,t)}setAppAiFeatures(t,r,n){return(0,Da.setAppAiFeatures)(this.dataverse,t,r,n)}configureRowSummary(t,r){return(0,Da.configureRowSummary)(this.dataverse,t,r)}removeRowSummary(t){return(0,Da.removeRowSummary)(this.dataverse,t)}async enrichDefaultViews(t,r,n={}){let i=await(0,W7.findDefaultViews)(this.dataverse,t,n);for(let a of i)await this.fetchArtifact("view",a.id),await this.updateElement("view",a.id,"/columns",r),await this.pushArtifact("view",a.id);return i.length&&await this.publishArtifact("view",i[0].id),{updated:i.map(a=>a.id)}}createArtifact(t,r){let n=this.requireRegistration(t,"createArtifact"),i=n.adapter.assignMissingIds(n.adapter.createDefault(r)),a=i.id;if(!a)throw new ue.ValidationError(t,"(new)","/id","created artifact must have an id");return this.workspace.writeArtifact(t,a,i),(0,Tn.cloneJson)(i)}deleteArtifact(t,r){this.workspace.deleteArtifact(t,r)}async deleteRemoteArtifact(t,r){return this.withArtifactLock(t,r,async()=>{await this.requireRegistration(t,"deleteRemoteArtifact").api.delete(this.dataverse,r),this.workspace.readArtifact(t,r)&&this.workspace.deleteArtifact(t,r)})}async publishArtifact(t,r,n){return this.withArtifactLock(t,r,()=>this.publishArtifactUnlocked(t,r,n))}async publishArtifactUnlocked(t,r,n){var i;let a=await this.readRaw(t,r),o=this.registrations.get(t);if(!o?.publish)return{type:t,id:r,shipped:!1,publish:{kind:"notApplicable"}};let s=(i=o.publishScope)===null||i===void 0?void 0:i.call(o,r,a);try{await o.publish(this.dataverse,r,a)}catch(u){return{type:t,id:r,shipped:!1,publish:{kind:"failed",error:zu(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,On.normalizeGuid)(r,"id")})${(0,On.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:zu(n).message}}}async pushArtifact(t,r){return this.withArtifactLock(t,r,()=>this.pushArtifactUnlocked(t,r))}async pushArtifactUnlocked(t,r){var n,i,a,o,s,l;let u=this.requireRegistration(t,"pushArtifact"),c=this.readLocal(t,r),d=this.versions.getMeta(t,r);this.assertLanguageMatches(t,r,d,u);let p=await this.buildMetadataContext(u.adapter,c),m=u.adapter.toApiPayload(c,d?.snapshot,p);try{let h=d?await u.api.update(this.dataverse,r,m,d.etag,d.memberEtags,d.siblingEtags):await this.createWithMintedId(u,t,r,m),w=r;return d||(h.serverIdentity&&u.adapter.applyServerIdentity&&u.adapter.applyServerIdentity(c,h.serverIdentity),h.id&&h.id!==r&&(c.id=h.id,this.workspace.deleteArtifact(t,r),w=h.id),this.workspace.writeArtifact(t,w,c)),this.versions.storeMeta(t,w,{etag:h.etag,languageCode:this.languageCode,fetchedAt:(0,_r.nowIso)(),snapshot:(0,Tn.cloneJson)(c),...h.memberEtags?{memberEtags:h.memberEtags}:{},...h.siblingEtags?{siblingEtags:h.siblingEtags}:{}}),{type:t,id:w,saved:!0,shipped:!1,publish:(n=h.publish)!==null&&n!==void 0?n:{kind:"notRequested"},...h.publish&&h.publish.kind!=="notRequested"?(()=>{var y;let N=(y=u.publishScope)===null||y===void 0?void 0:y.call(u,w,c);return N?{publishScope:N}:{}})():{},...h.warnings&&h.warnings.length>0?{warnings:h.warnings}:{}}}catch(h){let w=(0,ue.readPartialTokens)(h);if(w&&d){let y={...(i=d.memberEtags)!==null&&i!==void 0?i:{},...(a=w.memberEtags)!==null&&a!==void 0?a:{}},N={...(o=d.siblingEtags)!==null&&o!==void 0?o:{},...(s=w.siblingEtags)!==null&&s!==void 0?s:{}};this.versions.storeMeta(t,r,{...d,...Object.keys(y).length>0?{memberEtags:y}:{},...Object.keys(N).length>0?{siblingEtags:N}:{}})}if(h instanceof ue.SdkError&&h.code===Pr.ALREADY_EXISTS_CODE)return{type:t,id:r,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:h};if(h instanceof ue.SdkError&&h.code===_r.VERSION_CONFLICT_CODE)return{type:t,id:r,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:new ue.VersionConflictError(t,r,(l=d?.etag)!==null&&l!==void 0?l:null,null,h.message)};throw h}}assertLanguageMatches(t,r,n,i){if(i?.languageSensitive&&!(n?.languageCode===void 0||n.languageCode===this.languageCode))throw new ue.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 ue.SdkError)||a.code!==_r.VERSION_CONFLICT_CODE?a:new ue.SdkError(Pr.ALREADY_EXISTS_CODE,`Cannot create ${r} '${n}': a record already exists at that id, so an earlier push of this artifact committed before its local version metadata was saved. No duplicate was created. Run fetchArtifact('${r}', '${n}') to adopt the existing record's identity, etag and snapshot, then push again \u2014 that push will be a conditional update. This is not done automatically because the only recovery available here would be an UNCONDITIONAL overwrite, which would destroy any edit made to the record in the meantime.`)}}async buildMetadataContext(t,r){var n,i;let a=(i=(n=t.metadataNeeds)===null||n===void 0?void 0:n.call(t,r))!==null&&i!==void 0?i:[];if(a.length===0)return;let o=new Set(a.map(s=>s.entityLogicalName).filter(s=>!!s));for(let s of o)if(!this.workspace.readEntityMetadata(s))try{await this.fetchEntityMetadata(s)}catch{}return{resolveField:(s,l)=>{let u=this.workspace.readEntityMetadata(s),c=u?.attributes.find(d=>d.logicalName===l);return c?{displayName:c.displayName,attributeType:c.attributeType}:void 0}}}async pushAll(){let t=this.getDirtyArtifacts(),r=[];for(let n of t)try{r.push(await this.pushArtifact(n.type,n.id))}catch(i){r.push({type:n.type,id:n.id,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:zu(i)})}return r}getDirtyArtifacts(){return this.workspace.listArtifacts().filter(t=>this.versions.isDirty(t.type,t.id)).map(t=>({...t,isDirty:!0}))}diffArtifact(t,r){return this.versions.diff(t,r)}assignMissingIds(t,r){let n=this.registrations.get(t);return n?n.adapter.assignMissingIds(r):(0,q7.assignMissingIds)(r)}async resolveComponentType(t){switch(t.componentType){case st.SolutionComponentType.SavedQuery:return"view";case st.SolutionComponentType.SavedQueryVisualization:return"chart";case st.SolutionComponentType.AppModule:return"app";case st.SolutionComponentType.UxAgentProject:return"genPage";case st.SolutionComponentType.Workflow:return t.workflowCategory===2?"businessRule":t.workflowCategory===4&&await this.isBusinessFlowWorkflow(t.objectId)?"bpf":void 0;case st.SolutionComponentType.SystemForm:return await this.isDashboardForm(t.objectId)?"dashboard":"form";default:return}}async isDashboardForm(t){let n=`/systemforms(${(0,On.normalizeGuid)(t,"formId")})${(0,On.odataQuery)([["$select","type"]])}`,i=(0,_r.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,On.normalizeGuid)(t,"workflowId")})${(0,On.odataQuery)([["$select","businessprocesstype"]])}`,i=(0,_r.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 ue.NotImplementedError(r,`no adapter registered for artifact type '${t}'`);return n}};Pr.MakerSdk=Wu;function j7(e){return new Wu(e)}Pr.createMakerSdk=j7;function zu(e){return e instanceof Error?e:new Error(String(e))}function ju(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function H7(e){let t=e.lastIndexOf("/");return t<=0?"":e.slice(0,t)}function Q7(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=>ju(i)&&i.id===t.before);return n<0?e.length:n}let r=e.findIndex(n=>ju(n)&&n.id===t.after);return r<0?e.length:r+1}});var G_=g(Hu=>{"use strict";Object.defineProperty(Hu,"__esModule",{value:!0});Hu.ARTIFACT_TYPES=void 0;Hu.ARTIFACT_TYPES=["form","view","businessRule","app","command","chart","dashboard","genPage","bpf"]});var W_=g(z_=>{"use strict";Object.defineProperty(z_,"__esModule",{value:!0})});var H_=g(j_=>{"use strict";Object.defineProperty(j_,"__esModule",{value:!0})});var J_=g(Q_=>{"use strict";Object.defineProperty(Q_,"__esModule",{value:!0})});var K_=g(X_=>{"use strict";Object.defineProperty(X_,"__esModule",{value:!0})});var Z_=g(Y_=>{"use strict";Object.defineProperty(Y_,"__esModule",{value:!0})});var t1=g(e1=>{"use strict";Object.defineProperty(e1,"__esModule",{value:!0})});var n1=g(r1=>{"use strict";Object.defineProperty(r1,"__esModule",{value:!0})});var a1=g(i1=>{"use strict";Object.defineProperty(i1,"__esModule",{value:!0})});var s1=g(o1=>{"use strict";Object.defineProperty(o1,"__esModule",{value:!0})});var u1=g(l1=>{"use strict";Object.defineProperty(l1,"__esModule",{value:!0})});var d1=g(c1=>{"use strict";Object.defineProperty(c1,"__esModule",{value:!0})});var f1=g(p1=>{"use strict";Object.defineProperty(p1,"__esModule",{value:!0})});var h1=g(m1=>{"use strict";Object.defineProperty(m1,"__esModule",{value:!0})});var v1=g(g1=>{"use strict";Object.defineProperty(g1,"__esModule",{value:!0})});var y1=g(b1=>{"use strict";Object.defineProperty(b1,"__esModule",{value:!0})});var A1=g(w1=>{"use strict";Object.defineProperty(w1,"__esModule",{value:!0})});var S1=g(C1=>{"use strict";Object.defineProperty(C1,"__esModule",{value:!0})});var E1=g(N1=>{"use strict";Object.defineProperty(N1,"__esModule",{value:!0})});var I1=g(D1=>{"use strict";Object.defineProperty(D1,"__esModule",{value:!0})});var J7=exports&&exports.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),Ee=exports&&exports.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&J7(t,e,r)};Object.defineProperty(exports,"__esModule",{value:!0});exports.createMakerSdk=void 0;var X7=V_();Object.defineProperty(exports,"createMakerSdk",{enumerable:!0,get:function(){return X7.createMakerSdk}});Ee(G_(),exports);Ee(W_(),exports);Ee(H_(),exports);Ee(J_(),exports);Ee(K_(),exports);Ee(Z_(),exports);Ee(t1(),exports);Ee(n1(),exports);Ee(a1(),exports);Ee(s1(),exports);Ee(u1(),exports);Ee(d1(),exports);Ee(f1(),exports);Ee(xs(),exports);Ee(h1(),exports);Ee(v1(),exports);Ee(y1(),exports);Ee(A1(),exports);Ee(S1(),exports);Ee(E1(),exports);Ee(I1(),exports);Ee(ne(),exports);
+`)}function Sb(e){this.options=e||{locator:{}}}Sb.prototype.parseFromString=function(e,t){var r=this.options,n=new Tk,i=r.domBuilder||new go,a=r.errorHandler,o=r.locator,s=r.xmlns||{},l=/\/x?html?$/.test(t),u=l?yb.HTML_ENTITIES:yb.XML_ENTITIES;o&&i.setDocumentLocator(o),n.errorHandler=Ok(a,i,o),n.domBuilder=r.domBuilder||i,l&&(s[""]=bb.HTML),s.xml=s.xml||bb.XML;var c=r.normalizeLineEndings||Cb;return e&&typeof e=="string"?n.parse(c(e),s,u):n.errorHandler.error("invalid doc source"),i.doc};function Ok(e,t,r){if(!e){if(t instanceof go)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+up(r))}||function(){}}return a("warning"),a("error"),a("fatalError"),n}function go(){this.cdata=!1}function Mi(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}go.prototype={startDocument:function(){this.doc=new _k().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;hl(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),hl(this,r)},ignorableWhitespace:function(e,t,r){},characters:function(e,t,r){if(e=wb.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=wb.apply(this,arguments);var n=this.doc.createComment(e);this.locator&&Mi(this.locator,n),hl(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),hl(this,i),this.doc.doctype=i}},warning:function(e){console.warn("[xmldom warning] "+e,up(this.locator))},error:function(e){console.error("[xmldom error] "+e,up(this.locator))},fatalError:function(e){throw new Pk(e,this.locator)}};function up(e){if(e)return`
+@`+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function wb(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){go.prototype[e]=function(){return null}});function hl(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}gl.__DOMHandler=go;gl.normalizeLineEndings=Cb;gl.DOMParser=Sb});var yl=g(vl=>{var Nb=op();vl.DOMImplementation=Nb.DOMImplementation;vl.XMLSerializer=Nb.XMLSerializer;vl.DOMParser=Eb().DOMParser});var Hd=g(Ui=>{"use strict";Object.defineProperty(Ui,"__esModule",{value:!0});Ui.deleteAppCascade=Ui.collectGenPageIds=void 0;var Rk=al(),Fk=ie(),cp=ee(),xk=yl();function Db(e){let t=[],r=s=>l=>t.push(`${s}: ${l}`),i=new xk.DOMParser({errorHandler:{warning:r("warning"),error:r("error"),fatalError:r("fatalError")}}).parseFromString(e,"text/xml").documentElement;if(!i||t.length>0)throw new Fk.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,cp.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}Ui.collectGenPageIds=Db;async function Lk(e,t,r){let n=(0,cp.normalizeGuid)(t,"appModuleId");(0,cp.normalizeGuid)(r,"appModuleIdUnique");let i=[],a=[],o=[];await(0,Rk.deleteAppResolvingOnce)(e,n,l=>{l!==void 0&&o.push(...Db(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}}Ui.deleteAppCascade=Lk});var Ib={};Rr(Ib,{Guid:()=>P});var P,Me=I(()=>{"use strict";P=class e{guidString;guid;static get EmptyGuid(){return new e("00000000-0000-0000-0000-000000000000")}static NewGuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var r=Math.random()*16|0,n=t=="x"?r:r&3|8;return n.toString(16)})}constructor(t,r=!1){this.guidString=t;let n=new RegExp("[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$");(r||n.test(t))&&(this.guid=t)}ToString(){return this.guid}}});var T,ot=I(()=>{"use strict";xe();T=class e{static get EmptyString(){return""}static IsTrue(t){let r=!1;return r=t&&(this.IsStrictTrue(t)||this.IsYes(t)),r}static IsStrictTrue(t){let r=!1;return t&&(r=t.toLowerCase()==="true"),r}static IsYes(t){return t.toLowerCase()==="yes"||t.toLowerCase()==="y"}static get WhiteSpace(){return/ /g}static get EnglishAndNumericCharacters(){return/([a-z0-9A-Z]+)/g}static get ValidIdExpression(){return/([a-z0-9A-Z_]+)/g}static IsNullOrEmpty(t){return t==null||t==null||t==""}static Format(t,r){return e.IsNullOrEmpty(t)?t:t.replace(/\{\{|\}\}|\{(\d+)\}/g,function(n,i){return n=="{{"?"{":n=="}}"?"}":r[i]})}static EndsWithString(t,r){return t.indexOf(r,t.length-r.length)!==-1}static IsBlankString(t){return t.replace(/\s/g,"").length==0}static EscapeXml(t,r){let n=t;return this.IsNullOrEmpty(n)||(n=n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),r&&(n=n.replace(/"/g,"&quot;").replace(/'/g,"&apos;"))),n}static EscapeDomId(t){return t.replace(".","\\.")}static ToSnakeCase(t){let r=e.EmptyString;for(let n=0;n<t.length;n++)n!==0&&t[n]==t[n].toUpperCase()&&(r+="-"),r+=t[n].toLowerCase();return r}static GetSnakeCaseMarkup(t,r){let n="<"+this.ToSnakeCase(t);if(!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 _b={};Rr(_b,{ScriptUtilities:()=>N});var N,xe=I(()=>{"use strict";Me();ot();N=class e{static IsNullOrUndefined(t){return t==null||t===void 0}static IsMacMachine(){return navigator.platform.indexOf("Mac")!==-1}static IsNullOrEmptyGuid(t){return T.IsNullOrEmpty(t.ToString())?!0:P.EmptyGuid.ToString()===t.ToString()}static IsNullOrUndefinedNested(t,r){return r.split(".").every(i=>typeof t!="object"||t==null||!(i in t)||t[i]==null?!1:(t=t[i],!0))}static ParseXml(t){return new DOMParser().parseFromString(t,"text/xml")}static IsWellFormedXml(t){return!e.ParseXml(t).querySelector("parsererror")}static getNamedItemValue(t,r){let n=t.getNamedItem(r);return e.IsNullOrUndefined(n)?null:n.value}static getBooleanValue(t,r){let n=e.getNamedItemValue(t,r);return e.IsNullOrUndefined(n)?null:T.IsTrue(n)}static getNumericValue(t){return e.IsNullOrUndefined(t)?null:parseInt(t)}static getAllUniqueTagNames(t){let r=new Set;return e.getAllUniqueTagNamesHelper(t,r),r}static getAllUniqueTagNamesHelper(t,r){if(t.nodeType===Node.ELEMENT_NODE&&(r.add(t.tagName),t.hasChildNodes()))for(let n=0;n<t.children.length;n++)this.getAllUniqueTagNamesHelper(t.children.item(n),r)}}});var bl,wl,jn,Al,dp,Cl,pp=I(()=>{"use strict";(function(e){e[e.FormElementNodeChange=0]="FormElementNodeChange",e[e.FormElementAttributeChange=1]="FormElementAttributeChange"})(bl||(bl={}));wl=class{type;targetNode;constructor(t,r){this.type=t,this.targetNode=r}},jn=class extends wl{key;oldValue;newValue;constructor(t,r,n,i){super(bl.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)}},Al=class extends wl{property;oldValue;newValue;constructor(t,r,n,i){super(bl.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)}},dp=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()})}},Cl=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 dp(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 Pb={};Rr(Pb,{ChartGridMode:()=>Ut,ColumnLayoutWidths:()=>$k,ComponentCategory:()=>El,ComponentType:()=>fp,ControlLayoutTypes:()=>wp,DisplayConditionsInfo:()=>Uk,ElementNames:()=>v,ElementProperties:()=>f,ElementType:()=>hp,EntityAttributeProperty:()=>gp,EventType:()=>vo,FormActivationState:()=>bp,FormCanvasServiceScope:()=>Yk,FormDesignerSideBarTab:()=>mp,FormPresentation:()=>vp,FormState:()=>Sl,FormType:()=>Ue,HeaderDensityType:()=>yn,LookUpTable:()=>vr,MORE_TAB_PREFIX:()=>Vk,NavBarChildElementType:()=>yp,PREVIEW_ID_HEADER_FLYOUT:()=>jk,PREVIEW_ID_HEADER_OVERFLOW_BUTTON:()=>Jk,PREVIEW_ID_NAVIGATION_AREA:()=>zk,PREVIEW_ID_QUICKCREATE_ROOT:()=>Xk,PREVIEW_ID_TAB:()=>Qk,PREVIEW_ID_TAB_LIST:()=>Hk,PREVIEW_ID_TAB_PANEL:()=>Wk,PropertyModelKeys:()=>Sp,PropertyModelSectionKeys:()=>qk,RELATED_TAB_ID:()=>Ep,RELATED_TAB_PREFIX:()=>Gk,SectionDefaultProperties:()=>Bk,SectionLayoutTypes:()=>Ce,TabContentType:()=>Ap,TabDefaultProperties:()=>bn,TabLayoutTypes:()=>Ae,TelemetryPropertyNames:()=>Kk,UnboundControlPropertyKeys:()=>Cp,compositeAddressFields:()=>Mk,compositeFieldNames:()=>Ot,compositeFields:()=>kk});var Ue,fp,mp,v,f,hp,Ot,kk,Mk,gp,vr,Sl,yn,vp,Uk,yp,bp,Ae,Bk,bn,Ce,wp,Ap,$k,Cp,Sp,qk,vo,Ut,Ep,Vk,Gk,zk,Wk,jk,Hk,Jk,Qk,Xk,Kk,El,Yk,K=I(()=>{"use strict";(function(e){e[e.Dashboard=0]="Dashboard",e[e.AppointmentBook=1]="AppointmentBook",e[e.Main=2]="Main",e[e.MiniCampaignBO=3]="MiniCampaignBO",e[e.Preview=4]="Preview",e[e.MobileExpress=5]="MobileExpress",e[e.QuickViewForm=6]="QuickViewForm",e[e.QuickCreate=7]="QuickCreate",e[e.Dialog=8]="Dialog",e[e.TaskFlowForm=9]="TaskFlowForm",e[e.InteractionCentricDashboard=10]="InteractionCentricDashboard",e[e.Card=11]="Card",e[e.MainInteractiveExperience=12]="MainInteractiveExperience",e[e.Other=100]="Other",e[e.MainBackup=101]="MainBackup",e[e.AppointmentBookBackup=102]="AppointmentBookBackup",e[e.PowerBIDashboard=103]="PowerBIDashboard"})(Ue||(Ue={}));(function(e){e[e.Form=0]="Form",e[e.Dialog=1]="Dialog"})(fp||(fp={}));(function(e){e[e.Components=0]="Components",e[e.Properties=1]="Properties",e[e.Relationship=2]="Relationship",e[e.BusinessRules=3]="BusinessRules"})(mp||(mp={}));(function(e){e.form="form",e.formTab="tab",e.formColumn="column",e.formSection="section",e.formRow="row",e.formCell="cell",e.formLabel="label",e.formControl="control",e.formEvent="event",e.dependency="dependency",e.queryStringParameter="querystringparameter",e.controlDescriptions="controlDescriptions",e.controlDescription="controlDescription",e.customControl="customControl",e.dataset="data-set",e.formFooter="footer",e.formHeader="header",e.formNavigation="Navigation",e.formTabs="tabs",e.formColumns="columns",e.formSections="sections",e.formRows="rows",e.formEvents="events",e.quickFormDependencies="externaldependencies",e.controlParameters="parameters",e.formDependencies="dependencies",e.formNavBarAreas="NavBarAreas",e.formNavBarArea="NavBarArea",e.formNavBar="NavBar",e.spacerControl="SpacerControl",e.formField="Field",e.formNavBarByRelationshipItem="NavBarByRelationshipItem",e.formNavBarItem="NavBarItem",e.Title="Title",e.Titles="Titles",e.NavigationLink="Navigation Link",e.Relationship="Relationship",e.NavigationLinkIconClass="mscrm-glyph-NavLinkIcon",e.formDisplayConditions="DisplayConditions",e.formLibraries="formLibraries",e.internalLibraries="internaljscriptfile",e.eventHandlers="Handlers",e.handler="Handler",e.library="Library",e.formRoles="Role",e.formEveryOne="Everyone",e.Handler="Handler",e.EventHandlers="Handlers",e.InternalEventHandlers="InternalHandlers",e.HiddenControl="hiddencontrols",e.EventDependencies="dependencies",e.EventDependency="dependency",e.isvisibleinmocaonly="msinternal.isvisibleinmocaonly"})(v||(v={}));f={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"})(hp||(hp={}));Ot={fullname:"fullname",yomifullname:"yomifullname",address1_composite:"address1_composite",address2_composite:"address2_composite",address3_composite:"address3_composite",billto:"billto_composite",shipto:"shipto_composite"},kk=[Ot.fullname,Ot.yomifullname,Ot.address1_composite,Ot.address2_composite,Ot.address3_composite,Ot.billto,Ot.shipto],Mk=[Ot.address1_composite,Ot.address2_composite,Ot.address3_composite,Ot.billto,Ot.shipto];(function(e){e[e.IsValidForForm=0]="IsValidForForm",e[e.IsValidForCreate=1]="IsValidForCreate"})(gp||(gp={}));(function(e){e[e.DependencyFieldTable=0]="DependencyFieldTable",e[e.LockedFieldTable=1]="LockedFieldTable"})(vr||(vr={}));(function(e){e[e.Published=0]="Published",e[e.Draft=1]="Draft",e[e.New=2]="New",e[e.SaveAs=3]="SaveAs"})(Sl||(Sl={}));(function(e){e.Low="Low",e.HighReadOnlyValues="HighReadOnlyValues",e.HighWithControls="HighWithControls"})(yn||(yn={}));(function(e){e[e.ClassicForm=0]="ClassicForm",e[e.AirForm=1]="AirForm",e[e.ConvertedICForm=2]="ConvertedICForm"})(vp||(vp={}));Uk={TopOrderFormId:"topOrderFormId",NextDisplayOrder:"nextDisplayOrder"};(function(e){e[e.NavBarRelationShipItem=0]="NavBarRelationShipItem",e[e.NavBarItem=1]="NavBarItem"})(yp||(yp={}));(function(e){e[e.InActive=0]="InActive",e[e.Active=1]="Active"})(bp||(bp={}));(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"})(Ae||(Ae={}));Bk={ShowLabel:"false",LockLevel:"0",IsUserDefined:"0",LabelWidth:"115",columns:"1",ShowBar:"false",Layout:"varwidth",namePrefix:"_section_"},bn={namePrefix:"tab_",ShowLabel:"true",LockLevel:"0",IsUserDefined:"0"};(function(e){e[e.ONE_COLUMN=0]="ONE_COLUMN",e[e.TWO_COLUMN=1]="TWO_COLUMN",e[e.THREE_COLUMN=2]="THREE_COLUMN",e[e.FOUR_COLUMN=3]="FOUR_COLUMN",e[e.REFERENCE_PANEL=4]="REFERENCE_PANEL"})(Ce||(Ce={}));(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"})(wp||(wp={}));(function(e){e.cardSections="cardSections",e.singleComponent="singleComponent",e.default="default",e.expandAvailableSpace="expandAvailableSpace"})(Ap||(Ap={}));$k={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"})(Cp||(Cp={}));(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"})(Sp||(Sp={}));qk={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"})(vo||(vo={}));(function(e){e.All="All",e.Chart="Chart",e.Grid="Grid"})(Ut||(Ut={}));Ep="tab_related3b554255-7717-4d17-bb7f-9936fb1e75ca",Vk="more_tab_",Gk="related_tab_",zk="preview_id_navigation_area",Wk="tab-section",jk="headerFieldsFlyout",Hk="tablist",Jk="header_overflowButton",Qk="tab",Xk="quickCreateRoot",Kk={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"})(El||(El={}));Yk="CellCanvasServiceScope"});var Tb={};Rr(Tb,{Attribute:()=>Nl,FormElementNode:()=>H});var Nl,H,He=I(()=>{"use strict";xe();ot();pp();K();Me();Nl=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-${P.NewGuid()}`}getProperty(t){for(let r of this.properties)if(r.key===t)return r.value;return null}getNodeId(){return this.nodeId}getNodeName(){return this.nodeName}setNodeName(t){this.trackObjectPropertyChange("nodeName",t)}get NodeName(){return this.getNodeName()}getAllProperties(){return this.properties}replaceAttributeValue(t,r){this.properties.find(n=>n===t)&&(t.value=r)}replaceObjectPropertyValue(t,r){this[t]=r}getAllChildren(){return this.childrenNodes}getParentNode(){return this.parentNode}visit(t){let r=!1;if(t){r=!!t(this);let n=this.childrenNodes;if(!r&&n)for(let i=0;!r&&i<n.length;i++)r=n[i].visit(t)}return r}findAll(t){let r=[];return t&&this.visit(n=>{t(n)&&r.push(n)}),r}findFirst(t){let r=null;return t&&this.visit(n=>{if(t(n))return r=n,!0}),r}raiseMetadataChange(t){let r=this.getAncestor(v.form);r&&r.raiseMetadataChange(t)}trackPropertyAddition(t,r){this.trackPropertyCollectionChange(()=>{this.properties.push(new Nl(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 Al(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:T.EmptyString}updateChild(t,r){let n=this.childrenNodes.indexOf(t);return n>-1?(r.trackParentNodeChange(()=>{r.parentNode=this}),this.trackChildrenCollectionChange(()=>{this.childrenNodes.splice(n,1,r)}),!0):!1}getAncestor(t){let r=this.getParent(),n=this.getParentType();for(;r;){if(n===t)return r;n=r.getParentType(),r=r.getParent()}return null}deleteFirstGrandChildOfName(t,r){return this.getChildren(t)[0].deleteChild(r)}deleteChildren(t,r){r=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 v.formCell:let t=this.getAncestor(v.formSection);return t||(t=this.getAncestor(v.formHeader),t)||(t=this.getAncestor(v.formFooter),t)?t:null;case v.formSection:return this.getAncestor(v.formTab);case v.formTab:return this.getAncestor(v.form);default:return null}}isDirty(){return this.visit(t=>t.isInChangeSet())}isInChangeSet(){return this.changeTracker().getChangeSets().some(r=>r.changeSet.some(n=>n.targetNode.getNodeId()===this.getNodeId()))}changeTracker(){let t=this.getAncestor(v.form);return t?t.changeTracker():null}}});var Ob={};Rr(Ob,{ControlClassId:()=>S,ControlNamePrefixes:()=>Dl,getControlDisplayNames:()=>Zk});function Zk(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,Dl,Hn=I(()=>{"use strict";(function(e){e.AccessPrivilegeControl="F93A31B2-99AC-4084-8EC2-D4027C31369A",e.AccessTeamTablePickerControl="3f4e2a56-f102-4b4d-ab9c-f1574ca5bfda",e.ACIControl="C8BFBBEF-6851-4401-A0CC-7450062FE085",e.ActivitiesContainerControl="C72511AB-84E5-4FB7-A543-25B4FC01E83E",e.ActivitiesWallControl="6636847D-B74D-4994-B55A-A6FAF97ECEA2",e.AppliedFiltersControl="9C310A73-A360-42C5-8943-47A06F1B51EA",e.ArticleContentControl="F02EF977-2564-4B9A-B2F0-DF083D8A019B",e.BooleanControl="67FAC785-CD58-4F9F-ABB3-4B7DDC6ED5ED",e.ButtonControl="00AD73DA-BD4D-49C6-88A8-2F4F4CAD4A20",e.CheckboxControl="B0C6723A-8503-4FD7-BB28-C8A06AC933C2",e.CompositionLinkControl="DB1284EF-9FFC-4E99-B382-0CC082FE2364",e.ConnectionControl="3246F906-1F71-45F7-B11F-D7BE0F9D04C9",e.ConnectionRoleObjectTypeListControl="821ACF1A-7E46-4A0C-965D-FE14A57D78C7",e.CoverageChoiceControl="4168A05C-D857-46AF-8457-5BB47EB04EA1",e.DashboardControl="D2561F53-B292-42D9-B222-478E40FFE29F",e.DynamicPropertyListControl="6896F004-B17A-4202-861E-8B7EA2080E0B",e.EditFilterControl="1479835F-F852-4679-B864-C6892A2844C9",e.ErrorStatusControl="F4C16ECA-CA81-4E39-9448-834B8378721E",e.GlobalFilterControl="FFF0E632-9D7B-4F21-BBC1-05D1567AD144",e.HiddenInputControl="5546E6CD-394C-4BEE-94A8-4425E17EF6C6",e.KBViewerControl="A62B6FA9-169E-406C-B1AA-EAB828CB6026",e.LabelControl="39354E4A-5015-4D74-8031-EA9EB73A1322",e.MailMergeLanguagePickerControl="B634828E-C390-444A-AFE6-E07315D9D970",e.MapLinkControl="91DC0675-C8B9-4421-B1E0-261CEBF02BAC",e.OrgInsightsControl="76b9e25e-695e-4fef-ac69-f05cfa96739c",e.ChoiceLookupControl="2305e33a-bad3-4022-9e15-1856cf218333",e.PowerBIControl="8C54228C-1B25-4909-A12A-F2B968BB0D62",e.ProcessControl="06E9F7AF-1F54-4681-8EEC-1E21A1CEB465",e.RelatedInformationControl="163B90A6-EB64-49D2-9DF8-3C84A4F0A0F8",e.RelationshipRoleChoiceControl="5F986642-5961-4D9F-AB5E-643D71E231E9",e.ReportControl="A28F441B-916C-4865-87FD-0C5D53BD59C9",e.StreamsControl="EE9078C8-6946-4E2C-B8F8-35E65F4BE6A8",e.WebResourceSilverlightControl="080677DB-86EC-4544-AC42-F927E74B491F",e.CurrencyControl="533B9E00-756B-4312-95A0-DC888637AC78",e.CustomControl="F9A8A302-114E-466A-B582-6771B2AE0D92",e.DateTimeControl="5B773807-9FB2-42DB-97C3-7A91EFF8ADFF",e.DecimalControl="C3EFE0C3-0EC6-42BE-8349-CBD9079DFD8E",e.DurationControl="AA987274-CE4E-4271-A803-66164311A958",e.EmailAddressControl="ADA2203E-B4CD-49BE-9DDF-234642B43B52",e.EmailBodyControl="6F3FB987-393B-4D2D-859F-9D0F0349B6AD",e.EmailEngagementActionsControl="F454228D-1D25-4319-E12F-D27968BC0234",e.EmailRecipientActivityControl="26E9760F-7454-40DE-BB07-F6DCCCB82040",e.FileControl="0A7FF475-B016-4687-9CE5-042BFDBD6519",e.FloatingNumberControl="0D2C745A-E5A8-4C8F-BA63-C6D3BB604660",e.IframeControl="FD2A7985-3187-444E-908D-6624B21F69C0",e.ImageControl="7E548B0D-209C-477B-9DCD-F0F44472381D",e.LanguageControl="671A9387-CA5A-4D1E-8AB7-06E39DDCF6B5",e.LookupControl="270BD3DB-D9AF-4782-9025-509E298DEC0A",e.MapsControl="62B0DF79-0464-470F-8AF7-4483CFEA0C7D",e.ChoicesControl="4AA28AB7-9C13-4F57-A73D-AD894D048B5F",e.IntegerControl="C6D124CA-7EDA-4A60-AEA9-7FB8D318B68F",e.PartyListControl="CBFB742C-14E7-4A17-96BB-1A13F7F64AA2",e.PhoneNumberControl="8C10015A-B339-4982-9474-A95FE05631A5",e.ChoiceControl="3EF39988-22BB-4F0B-BBBE-64B5A3748AEE",e.ChoiceStatusControl="5D68B988-0661-4DB2-BC3E-17598AD3BE6C",e.QuickViewControl="5C5600E0-1D6E-4205-A272-BE80DA87FD42",e.QuickFormControl="69AF7DCA-2E3B-4EE7-9201-0DA731DD2413",e.RegardingControl="F3015350-44A2-4AA0-97B5-00166532B5E9",e.SearchWidgetControl="E616A57F-20E0-4534-8662-A101B5DDF4E0",e.SocialInsightsControl="86B9E25E-695E-4FEF-AC69-F05CFA96739C",e.SubgridControl="E7A81278-8635-4D9E-8D4D-59480B391C5B",e.TextAreaControl="E0DECE4B-6FC8-4A8F-A065-082708572369",e.TextboxControl="4273EDBD-AC1D-40D3-9FB2-095C621B552D",e.TickerControl="1E1FC551-F7A8-43AF-AC34-A8DC35C7B6D4",e.TimerControl="9C5CA0A1-AB4D-4781-BE7E-8DFBE867B87E",e.TimelineControl="06375649-C143-495E-A496-C962E5B4488E",e.TimezoneControl="7C624A0B-F59E-493D-9583-638D34759266",e.UrlControl="71716B6C-711E-476C-8AB8-5D11542BFB47",e.WebResourceHTMLControl="9FDF5F91-88B1-47F4-AD53-C11EFC01A01D",e.WebResourceImageControl="587CDF98-C1D5-4BDE-8473-14A0BC7644A7",e.ReferencePanelSearchWidgetControl="7CCD1494-1F7A-4E3A-8BDE-F32069DAEB9F",e.ReferencePanelSubgridControl="02D4264B-47E2-4B4C-AA95-F439F3F4D458",e.ReferencePanelQuickViewControl="B68B05F0-A46D-43F8-843B-917920AF806A",e.KBEditorControl="F94DB24F-263D-44A7-B38E-A35E9854812B",e.LinkControl="DFDF1CDE-837B-4AC9-98CF-AC74361FD89D"})(S||(S={}));Dl={[S.WebResourceHTMLControl]:"WebResource",[S.WebResourceImageControl]:"WebResource",[S.IframeControl]:"IFRAME",[S.SearchWidgetControl]:"Search widget",[S.SubgridControl]:"Subgrid",[S.TimelineControl]:"Timeline",[S.QuickViewControl]:"QuickviewControl"}});var Jn=g((Oj,Fb)=>{var yo=new Proxy(function(){return yo},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:yo},apply:function(){return yo},construct:function(){return{}}}),Rb=function(){return yo};Object.setPrototypeOf(Rb,yo);Fb.exports=Rb});var dt,zr,xb,Lb,Bi=I(()=>{"use strict";dt="cds-designer-models",zr="FormCustomControl",xb="FormCell",Lb="Form"});var $i,pt,bo=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 Qn,Np=I(()=>{"use strict";bo();K();Qn=class e{static lockedFieldCount=new pt;static dependencyFieldCount=new pt;static getNecessaryLookUpTable(t){switch(t){case vr.DependencyFieldTable:return e.dependencyFieldCount;case vr.LockedFieldTable:return e.lockedFieldCount}}static initCanvasLockedFieldLookUp(t){switch(t){case vr.DependencyFieldTable:e.dependencyFieldCount=new pt;case vr.LockedFieldTable:e.lockedFieldCount=new pt}}}});var Il,kb=I(()=>{"use strict";Me();xe();K();He();Il=class extends H{constructor(t){super(v.controlDescription,t)}get forControl(){let t=this.getProperty(f.ForControl);return N.IsNullOrUndefined(t)?null:(t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"&&(t=t.substr(1,t.length-2)),new P(t))}set forControl(t){this.setProperty(f.ForControl,`{${t.ToString()}}`)}get customControls(){return this.getChildren(v.customControl)}set customControls(t){this.deleteAllChildren();for(let r of t)this.addChild(r)}get DefaultControlClassId(){for(let t of this.customControls)if(!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 Ub,Bb,ft,_,Mb,wn,Xn,qi,Dp,Ip,Vi=I(()=>{"use strict";Ub={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"},Bb={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"})(Mb||(Mb={}));(function(e){e.ArcKnobControl="MscrmControls.Knob.ArcKnobControl",e.CardFeedNameControl="MscrmControls.CardFeedContainer.CardFeedContainer",e.CheckboxControl="MscrmControls.FieldControls.CheckboxControl",e.DateTimeControl="MscrmControls.FieldControls.DateTimeControl",e.DurationControl="MscrmControls.FieldControls.DurationControl",e.EditableGridControl="MscrmControls.Grid.GridControl",e.EmailEngagementActionsControl="MscrmControls.EmailEngagement.EmailEngagementActionsControl",e.FormComponent="MscrmControls.ModelForm.ModelFormControl",e.LanguageCodeControl="MscrmControls.FieldControls.LanguagePickerControl",e.LinearSliderControl="MscrmControls.Slider.LinearSliderControl",e.MultiSelectOptionSetControl="MscrmControls.MultiSelectPicklist.UpdMSPicklistControl",e.OptionSetControl="MscrmControls.OptionSet.OptionSetControl",e.PowerBIPCFControl="MscrmControls.PowerBIPCFControl",e.PredictiveScoringWidget="MscrmControls.Sales.PredictiveScoringWidget.PredictiveScoringWidget",e.ReadonlyGrid="MscrmControls.Grid.ReadOnlyGrid",e.SimilarCasesGrid="MscrmControls.Containers.SimilarCasesGridControl",e.StarRatingControl="MscrmControls.Rating.StarRatingControl",e.TimeZoneControl="MscrmControls.FieldControls.TimeZonePickListControl",e.ModelFormControl="MscrmControls.ModelForm.ModelFormControl",e.AutoCompleteControl="MscrmControls.AutoComplete.AutoCompleteControl",e.CanvasAppControl="MscrmControls.Canvas.CanvasControl",e.PowerAppsOneGrid="Microsoft.PowerApps.PowerAppsOneGrid"})(wn||(wn={}));(function(e){e[e.Read=0]="Read",e[e.Edit=1]="Edit",e[e.Both=2]="Both",e[e.Container=3]="Container",e[e.Unknown=4]="Unknown"})(Xn||(Xn={}));(function(e){e[e.Bound=0]="Bound",e[e.Input=1]="Input",e[e.Output=2]="Output"})(qi||(qi={}));Dp=[_.LookupCustomer,_.LookupOwner,_.LookupPartyList,_.LookupRegarding,_.LookupSimple],Ip=[_.WholeNone,_.WholeDuration,_.WholeLanguage,_.WholeTimeZone,_.FP,_.Decimal]});function Wr(){return yr||(yr=window._makerConfig,yr&&window?.location?.search?.indexOf("useProductionConfig")>-1&&(yr={...yr,region:"prod",graphQLEndpoint:"https://graph.make.powerapps.com/"}),yr?.region==="prod"&&(yr={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/"}}},...yr}),yr||{aadClientId:"a8f7a65c-f5ba-4859-b2d6-df772c264e9d",location:"cus",region:"test",publicPath:"/",graphQLEndpoint:"https://graph.make.test.powerapps.com/"})}var yr,_l=I(()=>{"use strict";});function $b(e,t,r){if(!e)return Pl.has(e)||(window._ppux?.log?.("PPUX/Geo/NonExistent",{eventType:"Trace",team:"Shell",severity:"Error",errorCode:"GeoIsEmpty"}),Pl.add("")),!1;if(e){if(e=e.toLowerCase(),Pl.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}}),Pl.add(e),!1}return!0}function eM(e){return $b(e,_p,"Location dictionary")?_p[e.toLowerCase()]:"us"}function tM(){let e=Wr().location.toLowerCase();return $b(e,_p,"Current location dictionary")?e:"us"}var Pl,_p,jj,qb=I(()=>{"use strict";_l();Pl=new Set,_p={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"};jj=eM(tM())});var L,Jj,Vb=I(()=>{"use strict";L={USWest:"westus",USWest2:"westus2",USCentral:"centralus",USEast:"eastus",USEast2:"eastus2",USNorthCentral:"northcentralus",USSouthCentral:"southcentralus",USWestCentral:"westcentralus",CanadaCentral:"canadacentral",CanadaEast:"canadaeast",BrazilSouth:"brazilsouth",EuropeNorth:"northeurope",EuropeWest:"westeurope",UKSouth:"uksouth",UKWest:"ukwest",FranceCentral:"francecentral",FranceSouth:"francesouth",SwitzerlandNorth:"switzerlandnorth",SwitzerlandWest:"switzerlandwest",GermanyNorth:"germanynorth",GermanyWestCentral:"germanywestcentral",NorwayWest:"norwaywest",NorwayEast:"norwayeast",SwedenCentral:"swedencentral",ItalyNorth:"italynorth",PolandCentral:"polandcentral",AsiaEast:"eastasia",AsiaSouthEast:"southeastasia",JapanEast:"japaneast",JapanWest:"japanwest",AustraliaEast:"australiaeast",AustraliaSouthEast:"australiasoutheast",AustraliaCentral:"australiacentral",AustraliaCentral2:"australiacentral2",IndiaCentral:"centralindia",IndiaSouth:"southindia",IndiaWest:"westindia",KoreaSouth:"koreasouth",KoreaCentral:"koreacentral",NewZealandNorth:"newzealandnorth",UAECentral:"uaecentral",UAENorth:"uaenorth",SouthAfricaNorth:"southafricanorth",SouthAfricaWest:"southafricawest",QatarCentral:"qatarcentral",GermanyCentral:"germanycentral",GermanyNorthEast:"germanynortheast",SingaporeSouthEast:"southeastasia",GovernmentUSVirginia:"usgovvirginia",GovernmentUSIowa:"usgoviowa",GovernmentUSArizona:"usgovarizona",GovernmentUSTexas:"usgovtexas",GovernmentUSDodEast:"usdodeast",GovernmentUSDodCentral:"usdodcentral",ChinaNorth:"chinanorth",ChinaNorth2:"chinanorth2",ChinaNorth3:"chinanorth3",ChinaEast:"chinaeast",ChinaEast2:"chinaeast2",ChinaEast3:"chinaeast3",UssecEast:"usseceast",UssecWest:"ussecwest",UsnatEast:"usnateast",UsnatWest:"usnatwest"},Jj={[L.USWest]:{geoName:"us",regionShortName:"wus"},[L.USCentral]:{geoName:"us",regionShortName:"cus"},[L.USEast]:{geoName:"us",regionShortName:"eus"},[L.USEast2]:{geoName:"us",regionShortName:"eus2"},[L.USWestCentral]:{geoName:"us",regionShortName:"wcus"},[L.USWest2]:{geoName:"us",regionShortName:"wus2"},[L.USSouthCentral]:{geoName:"br",regionShortName:"scus"},[L.BrazilSouth]:{geoName:"br",regionShortName:"sbr"},[L.UKSouth]:{geoName:"uk",regionShortName:"suk"},[L.UKWest]:{geoName:"uk",regionShortName:"wuk"},[L.JapanEast]:{geoName:"jp",regionShortName:"ejp"},[L.JapanWest]:{geoName:"jp",regionShortName:"wjp"},[L.IndiaCentral]:{geoName:"in",regionShortName:"cin"},[L.IndiaSouth]:{geoName:"in",regionShortName:"sin"},[L.ItalyNorth]:{geoName:"it",regionShortName:"nit"},[L.GermanyWestCentral]:{geoName:"de",regionShortName:"wcde"},[L.GermanyNorth]:{geoName:"de",regionShortName:"nde"},[L.EuropeNorth]:{geoName:"eu",regionShortName:"neu"},[L.EuropeWest]:{geoName:"eu",regionShortName:"weu"},[L.AustraliaEast]:{geoName:"au",regionShortName:"eau"},[L.AustraliaSouthEast]:{geoName:"au",regionShortName:"seau"},[L.AsiaSouthEast]:{geoName:"as",regionShortName:"seas"},[L.AsiaEast]:{geoName:"as",regionShortName:"eas"},[L.CanadaCentral]:{geoName:"ca",regionShortName:"cca"},[L.CanadaEast]:{geoName:"ca",regionShortName:"eca"},[L.SouthAfricaNorth]:{geoName:"za",regionShortName:"nza"},[L.SouthAfricaWest]:{geoName:"za",regionShortName:"wza"},[L.FranceCentral]:{geoName:"fr",regionShortName:"cfr"},[L.FranceSouth]:{geoName:"fr",regionShortName:"sfr"},[L.UAENorth]:{geoName:"ae",regionShortName:"nae"},[L.UAECentral]:{geoName:"ae",regionShortName:"cae"},[L.SwedenCentral]:{geoName:"se",regionShortName:"cse"},[L.SwitzerlandNorth]:{geoName:"ch",regionShortName:"nch"},[L.SwitzerlandWest]:{geoName:"ch",regionShortName:"wch"},[L.NorwayEast]:{geoName:"no",regionShortName:"eno"},[L.NorwayWest]:{geoName:"no",regionShortName:"wno"},[L.KoreaCentral]:{geoName:"kr",regionShortName:"ckr"},[L.KoreaSouth]:{geoName:"kr",regionShortName:"skr"},[L.SingaporeSouthEast]:{geoName:"sg",regionShortName:"seas"},[L.PolandCentral]:{geoName:"pl",regionShortName:"cpl"},[L.QatarCentral]:{geoName:"qa",regionShortName:"cqa"},[L.NewZealandNorth]:{geoName:"nz",regionShortName:"nnz"},[L.GovernmentUSTexas]:{geoName:"us",regionShortName:"ugtx"},[L.GovernmentUSVirginia]:{geoName:"us",regionShortName:"ugva"},[L.GovernmentUSDodCentral]:{regionShortName:"udc"},[L.GovernmentUSDodEast]:{regionShortName:"ude"},[L.ChinaEast]:{regionShortName:"cne"},[L.ChinaEast2]:{regionShortName:"cne2"},[L.ChinaEast3]:{regionShortName:"cne3"},[L.ChinaNorth]:{regionShortName:"cnn"},[L.ChinaNorth2]:{regionShortName:"cnn2"},[L.ChinaNorth3]:{regionShortName:"cnn3"},[L.UssecEast]:{geoName:"us",regionShortName:"erx"},[L.UssecWest]:{geoName:"us",regionShortName:"wrx"},[L.UsnatEast]:{geoName:"us",regionShortName:"eex"},[L.UsnatWest]:{geoName:"us",regionShortName:"wex"}}});var Gb=I(()=>{"use strict";_l();});var wo=I(()=>{"use strict";_l();qb();Vb();Gb();});function Ao(e,t){return zb?zb.isOverridden(e,t):{overridden:!1}}var zb,Co=I(()=>{"use strict";});var Pp=I(()=>{"use strict";wo();Co();});function rM(e,t){let{region:r}=Wr();return()=>{let n=e.settings[t];if(n.allowOverrides){let s=Ao(e.packageName,t);if(s.overridden)return typeof s.value=="string"?nM(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 nM(e){return isNaN(Number(e))?e==="true"?!0:e==="false"?!1:e:Number(e)}function iM(e){let t=e.packageName;if(Tl.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=>Op(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=>!Rl(i))){let i=`error parsing settings config for package ${t}, setting ${r} has invalid region`;throw console.error(i),new Error(i)}})}function So(e){iM(e);let t={};return Object.keys(e.settings).forEach(r=>{t[r]={enumerable:!0,get:rM(e,r)}}),Tl.set(e.packageName,e),Object.defineProperties({},t)}function Tp(e,t){return Tl.has(e)?!!Tl.get(e).settings[t]:!1}var Tl,Ol=I(()=>{"use strict";wo();Co();Rp();Eo();Tl=new Map});function Wb(e,t){let{region:r}=Wr();return()=>{let n=Ao(e.packageName,t);if(n.overridden)return n.value.toString()==="true";let i=e.features[t].enabledFor,a=process.env.SETTINGS_FALLBACK_REGION?.[r];return i[r]!==void 0?!!i[r]:a&&i[a]!==void 0?!!i[a]:!1}}function aM(e){let t=e.packageName;if(Fl.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=>Tp(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=>!Rl(i))){let i=`error parsing feature gates config for package ${t}, feature ${r} has invalid region`;throw console.error(i),new Error(i)}})}function Fp(e){aM(e);let t={};Object.keys(e.features).forEach(i=>{t[i]={enumerable:!0,configurable:!0,get:Wb(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:Wb(e,a.toString())}}),Object.defineProperties(r,i),n.clear()}},Fl.set(e.packageName,e),Object.defineProperties(r,t)}function Op(e,t){return Fl.has(e)?!!Fl.get(e).features[t]:!1}var Fl,Rp=I(()=>{"use strict";wo();Eo();Co();Ol();Fl=new Map});var Hb=g((bH,jb)=>{"use strict";jb.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 Xb=g(xp=>{"use strict";var oM=Object.prototype.hasOwnProperty,sM;function Jb(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return null}}function Qb(e){try{return encodeURIComponent(e)}catch{return null}}function lM(e){for(var t=/([^=?#&]+)=?([^&]*)/g,r={},n;n=t.exec(e);){var i=Jb(n[1]),a=Jb(n[2]);i===null||a===null||i in r||(r[i]=a)}return r}function uM(e,t){t=t||"";var r=[],n,i;typeof t!="string"&&(t="?");for(i in e)if(oM.call(e,i)){if(n=e[i],!n&&(n===null||n===sM||isNaN(n))&&(n=""),i=Qb(i),n=Qb(n),i===null||n===null)continue;r.push(i+"="+n)}return r.length?t+r.join("&"):""}xp.stringify=uM;xp.parse=lM});var Mp=g((AH,rw)=>{"use strict";var Yb=Hb(),xl=Xb(),Zb=/[\n\r\t]/g,cM=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,dM=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,pM=/^[a-zA-Z]:/,fM=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/;function kp(e){return(e||"").toString().replace(fM,"")}var Lp=[["#","hash"],["?","query"],function(t,r){return br(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]],Kb={hash:1,query:1};function ew(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 wr(unescape(e.pathname),{});else if(i==="string"){n=new wr(e,{});for(a in Kb)delete n[a]}else if(i==="object"){for(a in e)a in Kb||(n[a]=e[a]);n.slashes===void 0&&(n.slashes=cM.test(e.href))}return n}function br(e){return e==="file:"||e==="ftp:"||e==="http:"||e==="https:"||e==="ws:"||e==="wss:"}function tw(e,t){e=kp(e),e=e.replace(Zb,""),t=t||{};var r=dM.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)):br(n)?s=r[4]:n?i&&(s=s.slice(2)):o>=2&&br(t.protocol)&&(s=r[4]),{protocol:n,slashes:i||br(n),slashesCount:o,rest:s}}function mM(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 wr(e,t,r){if(e=kp(e),e=e.replace(Zb,""),!(this instanceof wr))return new wr(e,t,r);var n,i,a,o,s,l,u=Lp.slice(),c=typeof t,d=this,p=0;for(c!=="object"&&c!=="string"&&(r=t,t=null),r&&typeof r!="function"&&(r=xl.parse),t=ew(t),i=tw(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||pM.test(e))||!i.slashes&&(i.protocol||i.slashesCount<2||!br(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=mM(d.pathname,t.pathname)),d.pathname.charAt(0)!=="/"&&br(d.protocol)&&(d.pathname="/"+d.pathname),Yb(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:"&&br(d.protocol)&&d.host?d.protocol+"//"+d.host:"null",d.href=d.toString()}function hM(e,t,r){var n=this;switch(e){case"query":typeof t=="string"&&t.length&&(t=(r||xl.parse)(t)),n[e]=t;break;case"port":n[e]=t,Yb(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<Lp.length;o++){var s=Lp[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:"&&br(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function gM(e){(!e||typeof e!="function")&&(e=xl.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||br(r.protocol)?"//":"");return r.username?(a+=r.username,r.password&&(a+=":"+r.password),a+="@"):r.password?(a+=":"+r.password,a+="@"):r.protocol!=="file:"&&br(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}wr.prototype={set:hM,toString:gM};wr.extractProtocol=tw;wr.location=ew;wr.trimLeft=kp;wr.qs=xl;rw.exports=wr});var vM,nw=I(()=>{"use strict";vM=se(Mp());});function Up(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 Ll=I(()=>{"use strict";});var Bp,$p,qp=I(()=>{"use strict";Ll();Bp=class{features=new Map;register(t,r){let n=Up(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()}},$p=new Bp});var Vp=I(()=>{"use strict";});function Rl(e){return yM.has(e)}var yM,Eo=I(()=>{"use strict";Pp();Rp();Ol();Co();Pp();nw();qp();Ll();Vp();yM=new Set(["tie","test","prod","preview","preprod","gov","high","dod","mooncake","ex","rx"])});var bM,iw=I(()=>{"use strict";Eo();bM=So({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 kl,O,k,Kn,Gi,Ml,aw,ow,Gp,No=I(()=>{"use strict";bo();kl=class{name;constructor(t){this.name=t}toString(){return this.name}getName(){return this.name}getDisplayNameResourceKey(){return Gp.getDisplayNameResourceKey(this.name)}};(function(e){e.BigInt="BigIntType",e.CalendarRulesType="CalendarRulesType",e.Currency="MoneyType",e.Customer="Customer",e.CustomerType="CustomerType",e.DateTime="DateTimeType",e.DecimalNumber="DecimalType",e.EntityNameType="EntityNameType",e.FloatingPointNumber="DoubleType",e.Image="ImageType",e.File="FileType",e.Lookup="Lookup",e.LookupType="LookupType",e.ManagedPropertyType="ManagedPropertyType",e.MultipleLineofText="MemoType",e.MultiSelectOptionSet="MultiSelectPicklistType",e.OptionSet="PicklistType",e.Owner="Owner",e.OwnerType="OwnerType",e.PartyList="PartyList",e.PartyListType="PartyListType",e.PrimaryNameAttributeType="String",e.SingleLineofText="StringType",e.State="StateType",e.Status="StatusType",e.Subject="Subject",e.TimeStamp="TimeStampType",e.TwoOptions="BooleanType",e.UniqueIdentifier="Uniqueidentifier",e.UniqueIdentifierType="UniqueidentifierType",e.VirtualType="VirtualType",e.WholeNumber="IntegerType"})(O||(O={}));(function(e){e.Email="Email",e.Text="Text",e.TextArea="TextArea",e.Url="Url",e.TickerSymbol="TickerSymbol",e.PhoneticGuide="PhoneticGuide",e.VersionNumber="VersionNumber",e.Phone="Phone",e.None="None",e.Duration="Duration",e.TimeZone="TimeZone",e.Language="Language",e.Locale="Locale",e.DateOnly="DateOnly",e.DateAndTime="DateAndTime",e.Picklist="Picklist",e.State="State",e.Status="Status",e.Boolean="Boolean",e.Regarding="Regarding"})(k||(k={}));Kn=class extends kl{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 kl{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?Ml.Persistent:parseInt(Ml[this.name])}};(function(e){e[e.Persistent=0]="Persistent",e[e.Calculated=1]="Calculated",e[e.Rollup=2]="Rollup"})(Ml||(Ml={}));(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"})(aw||(aw={}));(function(e){e[e.Attribute=0]="Attribute",e[e.Organization=1]="Organization",e[e.Currency=2]="Currency"})(ow||(ow={}));Gp=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(k.Email,"SystemCustomization.String.Format.email"),t.add(k.Text,"SystemCustomization.String.Format.text"),t.add(k.TextArea,"SystemCustomization.String.Format.textarea"),t.add(k.Url,"SystemCustomization.String.Format.url"),t.add(k.TickerSymbol,"SystemCustomization.String.Format.tickersymbol"),t.add(k.PhoneticGuide,"SystemCustomization.String.Format.phoneticguide"),t.add(k.VersionNumber,"SystemCustomization.String.Format.versionnumber"),t.add(k.Phone,"SystemCustomization.String.Format.phone"),t.add(k.None,"SystemCustomization.Integer.Format."),t.add(k.Duration,"SystemCustomization.Integer.Format.duration"),t.add(k.TimeZone,"SystemCustomization.Integer.Format.timezone"),t.add(k.Language,"SystemCustomization.Integer.Format.language"),t.add(k.Locale,"SystemCustomization.Integer.Format.language"),t.add(k.DateOnly,"SystemCustomization.DateTime.Format.date"),t.add(k.DateAndTime,"SystemCustomization.DateTime.Format.datetime"),t.add(k.Regarding,"SystemCustomization.Lookup.Format.regarding"),t.add(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 cw,Wp,zi,Yn,zp,Ul,Wi,jr,be,sw,lw,uw,rr=I(()=>{"use strict";cw={ThreeEqColumn_FirstColumn:34,ThreeEqColumn_SecondColumn:33,ThreeEqColumn_ThirdColumn:33,FiveEqColumn:20},Wp={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"})(Yn||(Yn={}));(function(e){e[e.Mobile=0]="Mobile",e[e.Tablet=1]="Tablet",e[e.Web=2]="Web"})(zp||(zp={}));Ul=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="<"},be={ShowLabel:"true",LockLevel:"0",IsUserDefined:"0",LabelWidth:"115",columns:"1",ShowBar:"false",Layout:"varwidth",namePrefix:"_section_",labelAlignment:Yn.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"})(sw||(sw={}));(function(e){e.TabWithLockedFieldRemoval="TabWithLockedFieldRemoval",e.SectionWithLockedFieldRemoval="SectionWithLockedFieldRemoval",e.LockedSectionRemoval="LockedSectionRemoval",e.LockedFieldRemoval="LockedFieldRemoval",e.RequiredFieldRemoval="RequiredFieldRemoval",e.LastRemainingTab="LastRemainingTab",e.UnknownRemoval="UnknownRemoval"})(lw||(lw={}));(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"})(uw||(uw={}))});var jp,dw=I(()=>{"use strict";(function(e){e.DefaultValue="defaultValue",e.Loaded="loaded"})(jp||(jp={}))});var mw,wM,pw,bJ,wJ,Do,fw,AJ,CJ,hw=I(()=>{"use strict";mw=se(Jn());xe();Bi();iw();No();rr();Vi();K();wM=se(Mn());dw();(function(e){e.Model="Model",e.Canvas="Canvas",e.CustomPages="CustomPages"})(pw||(pw={}));bJ={Read:Xn.Read,Edit:Xn.Edit,Both:Xn.Both,Container:Xn.Container},wJ={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"})(Do||(Do={}));(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"})(fw||(fw={}));AJ=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]),CJ={numbers:[_.WholeNone,_.FP,_.Decimal,_.Currency],text:[_.SingleLineText,_.SingleLineTextArea,_.Multiple],lookup:[_.LookupSimple,_.LookupCustomer,_.LookupOwner,_.LookupPartyList,_.LookupRegarding],dates:[_.DateAndTimeDateOnly,_.DateAndTimeDateAndTime],allFields:[_.TwoOptions,_.DateAndTimeDateOnly,_.DateAndTimeDateAndTime,_.FP,_.Decimal,_.WholeNone,_.WholeDuration,_.WholeTimeZone,_.WholeLanguage,_.LookupSimple,_.LookupCustomer,_.LookupOwner,_.LookupPartyList,_.LookupRegarding,_.Multiple,_.OptionSet,_.SingleLineText,_.SingleLineTextArea,_.SingleLineEmail,_.SingleLineURL,_.SingleLineTickerSymbol,_.SingleLinePhone]}});var nr,Bl,gw=I(()=>{"use strict";nr=se(Jn());Me();xe();ot();Bi();Vi();hw();No();K();He();rr();Bl=class extends H{constructor(t){super(v.customControl,t)}customControlId;get id(){let t=this.getProperty(f.id);return N.IsNullOrUndefined(t)?null:t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?new P(t.substr(1,t.length-2)):new P(t)}getParameters(){let t=new Map,r=this.getAllChildren();if(r&&r.length!==0&&r[0]){let n=r[0].getAllChildren();if(n!=null){for(let i of n)if(i&&i.getAllChildren().length>0){let a=i.getNodeName();t.get(a)?t.get(a).push(i):t.set(a,[i])}}}return t}getFormComponentValueByParameterName(t){let r=this.getParameters()?.get(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===f.static&&a.value==="true"){r=!0;break}}return r}get name(){return this.getProperty(f.Name)}get formFactor(){return this.getProperty(f.formFactor)}set formFactor(t){this.setProperty(f.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:Bb.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===Do.dataset?a.get(ft.dataset)?.some(m=>this.getDatasetName(m)===d)||r.push({Name:d,Value:{Name:d,Columns:[],Type:_.Grid}}):c.propertyType===Do.property&&(a.has(d)||r.push({Name:d,Value:{Usage:c.usage}}))})});else{let l=s[0].getAllProperties(),u=i.get(o),c=await this.parameterJSON(o,l,u,t);if(c)r.push({Name:o,Value:c});else{(0,nr.trackInfoTrace)(dt,{eventName:`${zr}/parametersToJSON`,eventData:{message:`Configuration metadata for custom control parameter ${o} is not available for custom control : ${this.name}.`}}),r=[];break}}}else(0,nr.trackErrorTrace)(dt,{eventName:`${zr}/parametersToJSON`,eventData:{message:"Custom Control Manifest Property Info not available"}},new Error(`Custom Control Manifest Property Info not available for custom control : ${this.name}.`));else(0,nr.trackErrorTrace)(dt,{eventName:`${zr}/parametersToJSON`,eventData:{message:"Custom Control Manifest not found"}},new Error(`No custom control manifest found for ${this.name}`))}catch(n){(0,nr.trackErrorTrace)(dt,{eventName:`${zr}/parametersToJSON`,eventData:{message:"parameters to json failed"}},n)}return r}async parameterJSON(t,r,n,i){if(this.isDataSet(t)){let a=n,o=r.find(s=>s.key===ft.name)?.value;if(a)return this.getParameterChildrenValues(t,r);{let s=new Error(`No dataset manifest info for ${o}`);(0,nr.trackErrorTrace)(dt,{eventName:`${zr}/parameterJSON`,eventData:{message:"Missing custom control manifest dataset info"}},s)}}else{let a=n,o=r&&r.find(l=>l.key===f.Type),s=a&&!a.ofTypeGroup.every(l=>!Dp.includes(l));if(this.isLookupType(o?.value)||this.isLookupType(a?.ofType)||s)if(a){let l=a.usage,u=this.getParameterIsStatic(t),c=a.isPrimary;if(this.name===wn.FormComponent){let d=this.getFormComponentValueByParameterName(f.bindAttribute),p=await i.formModelService.loadLookupModel(d),m=p.lookupColumn,h=this.getLookupDataTypeFromAttributeMetadata(m);return{Name:t,Type:h,Usage:l,Static:u,Primary:c,EntityName:p.primaryTableName,Value:d,ViewId:this.getFormComponentValueByParameterName(Ub.DefaultViewId),TargetEntityType:m.targets[0],FilterRelationshipName:this.getFormComponentValueByParameterName(f.FilterRelationshipName),AvailableViewIds:this.getFormComponentValueByParameterName(f.AvailableViewIds),DependentAttributeName:this.getFormComponentValueByParameterName(f.DependentAttributeName),DependentAttributeType:this.getFormComponentValueByParameterName(f.DependentAttributeType),AllowFilterOff:T.IsStrictTrue(this.getFormComponentValueByParameterName(f.AllowFilterOff)),DisableQuickFind:T.IsStrictTrue(this.getFormComponentValueByParameterName(f.DisableQuickFind)),EnableViewPicker:!T.IsStrictTrue(this.getFormComponentValueByParameterName(f.DisableViewPicker))}}return{Name:t,Usage:l,Static:u,Primary:c,Value:this.getParameterValue(t)}}else{let l=new Error(`No lookup manifest info for ${t}`);(0,nr.trackErrorTrace)(dt,{eventName:`${zr}/parameterJSON`,eventData:{message:"Missing custom control manifest lookup property info"}},l)}if(a){let l=a.usage,u=this.getParameterIsStatic(t),c=this.getParameterValue(t),d=a.isPrimary;if(o){let m=o.value;return{Type:m,Static:u,Usage:l,Value:this.isNumberTypeProperty(a,m)&&Number(c)?Number(c):c,Primary:d}}if(a.ofType)return{Type:a.ofType,Static:u,Usage:l,Value:c,Primary:!0};if(a.ofTypeGroup)return{Static:u,Usage:l,Value:c,Primary:!0};let p=new Error(`No property type info for ${t}`);(0,nr.trackErrorTrace)(dt,{eventName:`${zr}/parameterJSON`,eventData:{message:"Missing property type info"}},p)}else{let l=new Error(`No property manifest info for ${t}`);(0,nr.trackWarningTrace)(dt,{eventName:`${zr}/parameterJSON`,eventData:{message:"Missing custom control manifest property info"}},l)}}return null}getLookupDataTypeFromAttributeMetadata(t){let{attributeType:r,format:n}=t;switch(r){case O.Customer:return _.LookupCustomer;case O.Owner:return _.LookupOwner;case O.PartyList:return _.LookupPartyList;default:return n===k.Regarding?_.LookupRegarding:_.LookupSimple}}isLookupType(t){return Dp.includes(t)}isNumberTypeProperty(t,r){return Ip.includes(r)||t.ofTypeGroup.some(n=>Ip.includes(n))}isDataSet(t){return ft.dataset===t}isGroups(t){return!!t[0].getAllProperties().find(n=>n.key==="isGroup"&&n.value==="true")}}});var V,Hp=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,Be,$l=I(()=>{"use strict";Me();bo();xe();ot();No();Hn();Hp();rr();R=class{static get TextBoxControl(){return"4273EDBD-AC1D-40d3-9FB2-095C621B552D"}static get TickerControl(){return"1E1FC551-F7A8-43af-AC34-A8DC35C7B6D4"}static get UrlControl(){return"71716B6C-711E-476c-8AB8-5D11542BFB47"}static get PhoneNumberControl(){return"8C10015A-B339-4982-9474-A95FE05631A5"}static get EmailAddressControl(){return"ADA2203E-B4CD-49be-9DDF-234642B43B52"}static get RadioControl(){return"67FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED"}static get LookupControl(){return"270BD3DB-D9AF-4782-9025-509E298DEC0A"}static get DateTimeControl(){return"5B773807-9FB2-42db-97C3-7A91EFF8ADFF"}static get IntegerControl(){return"C6D124CA-7EDA-4a60-AEA9-7FB8D318B68F"}static get MoneyControl(){return"533B9E00-756B-4312-95A0-DC888637AC78"}static get FloatControl(){return"0D2C745A-E5A8-4c8f-BA63-C6D3BB604660"}static get DecimalControl(){return"C3EFE0C3-0EC6-42be-8349-CBD9079DFD8E"}static get TextAreaControl(){return"E0DECE4B-6FC8-4a8f-A065-082708572369"}static get PicklistControl(){return"3EF39988-22BB-4f0b-BBBE-64B5A3748AEE"}static get HiddenInputControl(){return"5546E6CD-394C-4BEE-94A8-4425E17EF6C6"}static get GridControl(){return"E7A81278-8635-4D9E-8D4D-59480B391C5B"}static get CheckBoxControl(){return"B0C6723A-8503-4fd7-BB28-C8A06AC933C2"}static get IframeControl(){return"FD2A7985-3187-444e-908D-6624B21F69C0"}static get SocialInsightControl(){return"86B9E25E-695E-4FEF-AC69-F05CFA96739C"}static get OrgInsightsControl(){return"76B9E25E-695E-4FEF-AC69-F05CFA96739C"}static get DurationControl(){return"AA987274-CE4E-4271-A803-66164311A958"}static get RegardingControl(){return"F3015350-44A2-4aa0-97B5-00166532B5E9"}static get PartyListControl(){return"CBFB742C-14E7-4a17-96BB-1A13F7F64AA2"}static get TimeLineControl(){return"06375649-c143-495e-a496-c962e5b4488e"}static get TimeLineControlUC(){return"06375649-C143-495E-A496-C962E5B4488E"}static get TimeZonePicklistControl(){return"7C624A0B-F59E-493d-9583-638D34759266"}static get LanguagePickerControl(){return"671A9387-CA5A-4d1e-8AB7-06E39DDCF6B5"}static get AccessTeamTablePickerControl(){return"3F4E2A56-F102-4B4D-AB9C-F1574CA5BFDA"}static get KBViewerControl(){return"A62B6FA9-169E-406C-B1AA-EAB828CB6026"}static get PicklistStatusControl(){return"5D68B988-0661-4db2-BC3E-17598AD3BE6C"}static get EmailBodyControl(){return"6F3FB987-393B-4d2d-859F-9D0F0349B6AD"}static get PicklistLookupControl(){return"2305E33A-BAD3-4022-9E15-1856CF218333"}static get RelationshipRolePicklistControl(){return"5F986642-5961-4D9F-AB5E-643D71E231E9"}static get RelatedInformationControl(){return"163B90A6-EB64-49D2-9DF8-3C84A4F0A0F8"}static get CoverPagePicklistControl(){return"4168A05C-D857-46AF-8457-5BB47EB04EA1"}static get MailMergeLanguagePickerControl(){return"B634828E-C390-444A-AFE6-E07315D9D970"}static get ConnectionControl(){return"3246F906-1F71-45F7-B11F-D7BE0F9D04C9"}static get ConnectionRoleObjectTypeListControl(){return"821ACF1A-7E46-4A0C-965D-FE14A57D78C7"}static get MapsControl(){return"62B0DF79-0464-470F-8AF7-4483CFEA0C7D"}static get MapLinkControl(){return"91DC0675-C8B9-4421-B1E0-261CEBF02BAC"}static get WebResourceHtmlControl(){return"9FDF5F91-88B1-47F4-AD53-C11EFC01A01D"}static get WebResourceImageControl(){return"587CDF98-C1D5-4BDE-8473-14A0BC7644A7"}static get WebResourceSilverlightControl(){return"080677DB-86EC-4544-AC42-F927E74B491F"}static get ReportControl(){return"A28F441B-916C-4865-87FD-0C5D53BD59C9"}static get ArticleContentControl(){return"F02EF977-2564-4B9A-B2F0-DF083D8A019B"}static get ProcessControl(){return"06E9F7AF-1F54-4681-8EEC-1E21A1CEB465"}static get ActivitiesWallControl(){return"6636847D-B74D-4994-B55A-A6FAF97ECEA2"}static get QuickFormControl(){return"69AF7DCA-2E3B-4EE7-9201-0DA731DD2413"}static get QuickFormCollectionControl(){return"5C5600E0-1D6E-4205-A272-BE80DA87FD42"}static get LinkControl(){return"DFDF1CDE-837B-4AC9-98CF-AC74361FD89D"}static get CompositionLinkControl(){return"DB1284EF-9FFC-4E99-B382-0CC082FE2364"}static get ErrorStatusControl(){return"F4C16ECA-CA81-4E39-9448-834B8378721E"}static get ActivitiesContainerControl(){return"C72511AB-84E5-4FB7-A543-25B4FC01E83E"}static get AccessPrivilegeControl(){return"F93A31B2-99AC-4084-8EC2-D4027C31369A"}static get TimerControl(){return"9C5CA0A1-AB4D-4781-BE7E-8DFBE867B87E"}static get DynamicPropertyListControl(){return"6896F004-B17A-4202-861E-8B7EA2080E0B"}static get ButtonControl(){return"00AD73DA-BD4D-49C6-88A8-2F4F4CAD4A20"}static get SearchWidgetControl(){return"E616A57F-20E0-4534-8662-A101B5DDF4E0"}static get EmailRecipientActivityControl(){return"26E9760F-7454-40DE-BB07-F6DCCCB82040"}static get LabelControl(){return"39354E4A-5015-4D74-8031-EA9EB73A1322"}static get CustomControl(){return"F9A8A302-114E-466A-B582-6771B2AE0D92"}static get EditFilterControl(){return"1479835F-F852-4679-B864-C6892A2844C9"}static get RichEditorControl(){return"F94DB24F-263D-44A7-B38E-A35E9854812B"}static get PowerBIControl(){return"8C54228C-1B25-4909-A12A-F2B968BB0D62"}static get EmailEngagementActionsControl(){return"F454228D-1D25-4319-E12F-D27968BC0234"}static get ACIControl(){return"C8BFBBEF-6851-4401-A0CC-7450062FE085"}static get ChoicesControl(){return"4AA28AB7-9C13-4F57-A73D-AD894D048B5F"}static get ReferencePanelSubgridControl(){return"02D4264B-47E2-4B4C-AA95-F439F3F4D458"}static get ReferencePanelSearchWidget(){return"7CCD1494-1F7A-4E3A-8BDE-F32069DAEB9F"}static get ReferencePanelQuickFormCollectionControl(){return"B68B05F0-A46D-43F8-843B-917920AF806A"}static get SpacerControl(){return"E4BAB03A-A9A5-4C23-CC3B-54AA680150E2"}},ji=class{static get RelationshipAssistant(){return"3ff9a528-dd50-4aca-8f10-2e5ed73513ad"}static get PredictiveLeadScoring(){return"6f503f2a-d033-4106-b62c-f8f2e5f01a57"}},Be=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,k.Phone);t.add(r,new P(R.PhoneNumberControl));let n=e.getControlName(O.SingleLineofText,k.TextArea);t.add(n,new P(R.TextAreaControl));let i=e.getControlName(O.SingleLineofText,k.Text);t.add(i,new P(R.TextBoxControl));let a=e.getControlName(O.SingleLineofText,k.Email);t.add(a,new P(R.EmailAddressControl));let o=e.getControlName(O.SingleLineofText,k.Url);t.add(o,new P(R.UrlControl));let s=e.getControlName(O.SingleLineofText,k.TickerSymbol);t.add(s,new P(R.TickerControl));let l=e.getControlName(O.SingleLineofText,k.PhoneticGuide);t.add(l,new P(R.TextBoxControl));let u=e.getControlName(O.WholeNumber,k.Duration);t.add(u,new P(R.DurationControl));let c=e.getControlName(O.WholeNumber,k.Language);t.add(c,new P(R.LanguagePickerControl));let d=e.getControlName(O.WholeNumber,k.TimeZone);t.add(d,new P(R.TimeZonePicklistControl));let p=e.getControlName(O.WholeNumber,k.None);t.add(p,new P(R.IntegerControl));let m=e.getControlName(O.DateTime,k.DateOnly);t.add(m,new P(R.DateTimeControl));let h=e.getControlName(O.DateTime,k.DateAndTime);t.add(h,new P(R.DateTimeControl));let w=e.getControlName(O.LookupType,k.None);t.add(w,new P(R.LookupControl));let b=e.getControlName(O.CustomerType,k.None);t.add(b,new P(R.LookupControl));let E=e.getControlName(O.FloatingPointNumber,k.None);t.add(E,new P(R.FloatControl));let D=e.getControlName(O.DecimalNumber,k.None);t.add(D,new P(R.DecimalControl));let F=e.getControlName(O.Currency,k.None);t.add(F,new P(R.MoneyControl));let x=e.getControlName(O.MultipleLineofText,k.None);t.add(x,new P(R.TextAreaControl));let q=e.getControlName(O.MultipleLineofText,k.Text);t.add(q,new P(R.TextAreaControl));let G=e.getControlName(O.MultipleLineofText,k.TextArea);t.add(G,new P(R.TextAreaControl));let M=e.getControlName(O.MultipleLineofText,k.Email);t.add(M,new P(R.EmailBodyControl));let U=e.getControlName(O.OptionSet,k.None);t.add(U,new P(R.PicklistControl));let B=e.getControlName(O.TwoOptions,k.None);t.add(B,new P(R.RadioControl));let W=e.getControlName(O.Image,k.None);t.add(W,new P(R.WebResourceImageControl));let $=e.getControlName(O.Image,k.None);t.add($,new P(R.WebResourceHtmlControl));let Se=e.getControlName(O.TwoOptions,"Radio");t.add(Se,new P(R.RadioControl));let ve=e.getControlName(O.TwoOptions,"CheckBox");t.add(ve,new P(R.CheckBoxControl));let Ve=e.getControlName(O.TwoOptions,"List");t.add(Ve,new P(R.PicklistControl));let Ke=e.getControlName(O.State,k.None);t.add(Ke,new P(R.PicklistControl));let de=e.getControlName(O.Status,k.None);t.add(de,new P(R.PicklistStatusControl));let gt=e.getControlName(O.OwnerType,k.None);t.add(gt,new P(R.LookupControl));let oc=e.getControlName(O.PartyListType,k.None);t.add(oc,new P(R.PartyListControl));let nP=e.getControlName(O.LookupType,k.Regarding);t.add(nP,new P(R.RegardingControl));let iP=e.getControlName(O.MultiSelectOptionSet,k.None);return t.add(iP,new P(R.ChoicesControl)),t}static getControlName(t,r){return t+"_"+r}static getControlIdByTypeAndFormat(t,r){let n=e.getControlName(t.toString(),r.toString());return e.FieldControlIds.containsKey(n)?e.FieldControlIds.getValue(n):null}static getTypeAndFormatByControlOrUniqueId(t){for(let r in e.FieldControlIds.getKeys())if(e.FieldControlIds.getValue(e.FieldControlIds.getKeys()[r]).guidString.toLowerCase()===t)return e.FieldControlIds.getKeys()[r]}static getControlDataTypeByControlOrUniqueId(t){if(!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 $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(be.referencePanelNamePrefix)===0}static isUnboundFormControlByIdentifier(t){return N.IsNullOrUndefined(t)||N.IsNullOrUndefined(t.guidString)?!1:e.UnboundControlIds.containsKey(t.guidString)}static getUnboundFormControlName(t){let r=T.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)?T.EmptyString:e.UnboundControlIds.getValue(t.guidString).toString()}static isSpacerControl(t){return t===R.SpacerControl}static GetRowSpan(t){let r=t.ClassId;if(e.isRelationshipAssistantControl(t))r=t.UniqueId;else if(r.guidString===R.CustomControl&&!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 ql,vw=I(()=>{"use strict";ql=class{listeners=[];listenersOncer=[];on(t){return this.listeners.push(t),{dispose:()=>this.off(t)}}once(t){this.listenersOncer.push(t)}off(t){let r=this.listeners.indexOf(t);r>-1&&this.listeners.splice(r,1)}emit(t){this.listeners.forEach(r=>r(t)),this.listenersOncer.forEach(r=>r(t)),this.listenersOncer=[]}pipe(t){return this.on(r=>t.emit(r))}}});var Zn,Hi,yw,bw,An,ww,Aw,Jp=I(()=>{"use strict";(function(e){e[e.Center=0]="Center",e[e.Left=1]="Left",e[e.Right=2]="Right"})(Zn||(Zn={}));(function(e){e[e.Left=0]="Left",e[e.Top=1]="Top"})(Hi||(Hi={}));(function(e){e[e.Top=0]="Top",e[e.Middle=1]="Middle"})(yw||(yw={}));(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"})(bw||(bw={}));(function(e){e[e.None=-1]="None",e[e.AppointmentBook=0]="AppointmentBook",e[e.Hardcoded=1]="Hardcoded",e[e.Main=2]="Main",e[e.MiniCampaignBO=3]="MiniCampaignBO",e[e.Preview=4]="Preview",e[e.Dashboard=5]="Dashboard",e[e.Quick=6]="Quick",e[e.Mobile=7]="Mobile",e[e.Read=8]="Read",e[e.QuickCreate=9]="QuickCreate",e[e.Dialog=10]="Dialog",e[e.Card=11]="Card",e[e.TaskBasedForm=12]="TaskBasedForm",e[e.InteractionCentricDashboard=13]="InteractionCentricDashboard"})(An||(An={}));(function(e){e[e.None=0]="None",e[e.SystemRequired=1]="SystemRequired",e[e.ApplicationRequired=2]="ApplicationRequired",e[e.Recommended=3]="Recommended"})(ww||(ww={}));(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"})(Aw||(Aw={}))});var Ji,Cw=I(()=>{"use strict";Eo();Ji=Fp({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 Sw(e){return{...e,extractConfig:t=>AM(t,Object.keys(e.fallback))}}function AM(e,t){let r={};for(let n of t)typeof e[n]<"u"&&(r[n]=e[n]);return r}var Qp=I(()=>{"use strict";});var Xp=g((XJ,Nw)=>{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{}}}),Ew=function(){return Io};Object.setPrototypeOf(Ew,Io);Nw.exports=Ew});var _w=g((KJ,Iw)=>{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{}}}),Dw=function(){return _o};Object.setPrototypeOf(Dw,_o);Iw.exports=Dw});var Kp=g((YJ,Tw)=>{var Po=new Proxy(function(){return Po},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:Po},apply:function(){return Po},construct:function(){return{}}}),Pw=function(){return Po};Object.setPrototypeOf(Pw,Po);Tw.exports=Pw});var Rw=g((ZJ,Ow)=>{function CM(){this.__data__=[],this.size=0}Ow.exports=CM});var Qi=g((eQ,Fw)=>{function SM(e,t){return e===t||e!==e&&t!==t}Fw.exports=SM});var To=g((tQ,xw)=>{var EM=Qi();function NM(e,t){for(var r=e.length;r--;)if(EM(e[r][0],t))return r;return-1}xw.exports=NM});var kw=g((rQ,Lw)=>{var DM=To(),IM=Array.prototype,_M=IM.splice;function PM(e){var t=this.__data__,r=DM(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():_M.call(t,r,1),--this.size,!0}Lw.exports=PM});var Uw=g((nQ,Mw)=>{var TM=To();function OM(e){var t=this.__data__,r=TM(t,e);return r<0?void 0:t[r][1]}Mw.exports=OM});var $w=g((iQ,Bw)=>{var RM=To();function FM(e){return RM(this.__data__,e)>-1}Bw.exports=FM});var Vw=g((aQ,qw)=>{var xM=To();function LM(e,t){var r=this.__data__,n=xM(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}qw.exports=LM});var Oo=g((oQ,Gw)=>{var kM=Rw(),MM=kw(),UM=Uw(),BM=$w(),$M=Vw();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=kM;Xi.prototype.delete=MM;Xi.prototype.get=UM;Xi.prototype.has=BM;Xi.prototype.set=$M;Gw.exports=Xi});var Ww=g((sQ,zw)=>{var qM=Oo();function VM(){this.__data__=new qM,this.size=0}zw.exports=VM});var Hw=g((lQ,jw)=>{function GM(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}jw.exports=GM});var Qw=g((uQ,Jw)=>{function zM(e){return this.__data__.get(e)}Jw.exports=zM});var Kw=g((cQ,Xw)=>{function WM(e){return this.__data__.has(e)}Xw.exports=WM});var Yp=g((dQ,Yw)=>{var jM=typeof global=="object"&&global&&global.Object===Object&&global;Yw.exports=jM});var ir=g((pQ,Zw)=>{var HM=Yp(),JM=typeof self=="object"&&self&&self.Object===Object&&self,QM=HM||JM||Function("return this")();Zw.exports=QM});var Ro=g((fQ,eA)=>{var XM=ir(),KM=XM.Symbol;eA.exports=KM});var iA=g((mQ,nA)=>{var tA=Ro(),rA=Object.prototype,YM=rA.hasOwnProperty,ZM=rA.toString,Fo=tA?tA.toStringTag:void 0;function eU(e){var t=YM.call(e,Fo),r=e[Fo];try{e[Fo]=void 0;var n=!0}catch{}var i=ZM.call(e);return n&&(t?e[Fo]=r:delete e[Fo]),i}nA.exports=eU});var oA=g((hQ,aA)=>{var tU=Object.prototype,rU=tU.toString;function nU(e){return rU.call(e)}aA.exports=nU});var ei=g((gQ,uA)=>{var sA=Ro(),iU=iA(),aU=oA(),oU="[object Null]",sU="[object Undefined]",lA=sA?sA.toStringTag:void 0;function lU(e){return e==null?e===void 0?sU:oU:lA&&lA in Object(e)?iU(e):aU(e)}uA.exports=lU});var Hr=g((vQ,cA)=>{function uU(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}cA.exports=uU});var Vl=g((yQ,dA)=>{var cU=ei(),dU=Hr(),pU="[object AsyncFunction]",fU="[object Function]",mU="[object GeneratorFunction]",hU="[object Proxy]";function gU(e){if(!dU(e))return!1;var t=cU(e);return t==fU||t==mU||t==pU||t==hU}dA.exports=gU});var fA=g((bQ,pA)=>{var vU=ir(),yU=vU["__core-js_shared__"];pA.exports=yU});var gA=g((wQ,hA)=>{var Zp=fA(),mA=(function(){var e=/[^.]+$/.exec(Zp&&Zp.keys&&Zp.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function bU(e){return!!mA&&mA in e}hA.exports=bU});var ef=g((AQ,vA)=>{var wU=Function.prototype,AU=wU.toString;function CU(e){if(e!=null){try{return AU.call(e)}catch{}try{return e+""}catch{}}return""}vA.exports=CU});var bA=g((CQ,yA)=>{var SU=Vl(),EU=gA(),NU=Hr(),DU=ef(),IU=/[\\^$.*+?()[\]{}|]/g,_U=/^\[object .+?Constructor\]$/,PU=Function.prototype,TU=Object.prototype,OU=PU.toString,RU=TU.hasOwnProperty,FU=RegExp("^"+OU.call(RU).replace(IU,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function xU(e){if(!NU(e)||EU(e))return!1;var t=SU(e)?FU:_U;return t.test(DU(e))}yA.exports=xU});var AA=g((SQ,wA)=>{function LU(e,t){return e?.[t]}wA.exports=LU});var Cn=g((EQ,CA)=>{var kU=bA(),MU=AA();function UU(e,t){var r=MU(e,t);return kU(r)?r:void 0}CA.exports=UU});var Gl=g((NQ,SA)=>{var BU=Cn(),$U=ir(),qU=BU($U,"Map");SA.exports=qU});var xo=g((DQ,EA)=>{var VU=Cn(),GU=VU(Object,"create");EA.exports=GU});var IA=g((IQ,DA)=>{var NA=xo();function zU(){this.__data__=NA?NA(null):{},this.size=0}DA.exports=zU});var PA=g((_Q,_A)=>{function WU(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}_A.exports=WU});var OA=g((PQ,TA)=>{var jU=xo(),HU="__lodash_hash_undefined__",JU=Object.prototype,QU=JU.hasOwnProperty;function XU(e){var t=this.__data__;if(jU){var r=t[e];return r===HU?void 0:r}return QU.call(t,e)?t[e]:void 0}TA.exports=XU});var FA=g((TQ,RA)=>{var KU=xo(),YU=Object.prototype,ZU=YU.hasOwnProperty;function eB(e){var t=this.__data__;return KU?t[e]!==void 0:ZU.call(t,e)}RA.exports=eB});var LA=g((OQ,xA)=>{var tB=xo(),rB="__lodash_hash_undefined__";function nB(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=tB&&t===void 0?rB:t,this}xA.exports=nB});var MA=g((RQ,kA)=>{var iB=IA(),aB=PA(),oB=OA(),sB=FA(),lB=LA();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=iB;Ki.prototype.delete=aB;Ki.prototype.get=oB;Ki.prototype.has=sB;Ki.prototype.set=lB;kA.exports=Ki});var $A=g((FQ,BA)=>{var UA=MA(),uB=Oo(),cB=Gl();function dB(){this.size=0,this.__data__={hash:new UA,map:new(cB||uB),string:new UA}}BA.exports=dB});var VA=g((xQ,qA)=>{function pB(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}qA.exports=pB});var Lo=g((LQ,GA)=>{var fB=VA();function mB(e,t){var r=e.__data__;return fB(t)?r[typeof t=="string"?"string":"hash"]:r.map}GA.exports=mB});var WA=g((kQ,zA)=>{var hB=Lo();function gB(e){var t=hB(this,e).delete(e);return this.size-=t?1:0,t}zA.exports=gB});var HA=g((MQ,jA)=>{var vB=Lo();function yB(e){return vB(this,e).get(e)}jA.exports=yB});var QA=g((UQ,JA)=>{var bB=Lo();function wB(e){return bB(this,e).has(e)}JA.exports=wB});var KA=g((BQ,XA)=>{var AB=Lo();function CB(e,t){var r=AB(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}XA.exports=CB});var zl=g(($Q,YA)=>{var SB=$A(),EB=WA(),NB=HA(),DB=QA(),IB=KA();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=SB;Yi.prototype.delete=EB;Yi.prototype.get=NB;Yi.prototype.has=DB;Yi.prototype.set=IB;YA.exports=Yi});var eC=g((qQ,ZA)=>{var _B=Oo(),PB=Gl(),TB=zl(),OB=200;function RB(e,t){var r=this.__data__;if(r instanceof _B){var n=r.__data__;if(!PB||n.length<OB-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new TB(n)}return r.set(e,t),this.size=r.size,this}ZA.exports=RB});var tf=g((VQ,tC)=>{var FB=Oo(),xB=Ww(),LB=Hw(),kB=Qw(),MB=Kw(),UB=eC();function Zi(e){var t=this.__data__=new FB(e);this.size=t.size}Zi.prototype.clear=xB;Zi.prototype.delete=LB;Zi.prototype.get=kB;Zi.prototype.has=MB;Zi.prototype.set=UB;tC.exports=Zi});var nC=g((GQ,rC)=>{var BB="__lodash_hash_undefined__";function $B(e){return this.__data__.set(e,BB),this}rC.exports=$B});var aC=g((zQ,iC)=>{function qB(e){return this.__data__.has(e)}iC.exports=qB});var sC=g((WQ,oC)=>{var VB=zl(),GB=nC(),zB=aC();function Wl(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new VB;++t<r;)this.add(e[t])}Wl.prototype.add=Wl.prototype.push=GB;Wl.prototype.has=zB;oC.exports=Wl});var uC=g((jQ,lC)=>{function WB(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}lC.exports=WB});var dC=g((HQ,cC)=>{function jB(e,t){return e.has(t)}cC.exports=jB});var rf=g((JQ,pC)=>{var HB=sC(),JB=uC(),QB=dC(),XB=1,KB=2;function YB(e,t,r,n,i,a){var o=r&XB,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,m=r&KB?new HB:void 0;for(a.set(e,t),a.set(t,e);++d<s;){var h=e[d],w=t[d];if(n)var b=o?n(w,h,d,t,e,a):n(h,w,d,e,t,a);if(b!==void 0){if(b)continue;p=!1;break}if(m){if(!JB(t,function(E,D){if(!QB(m,D)&&(h===E||i(h,E,r,n,a)))return m.push(D)})){p=!1;break}}else if(!(h===w||i(h,w,r,n,a))){p=!1;break}}return a.delete(e),a.delete(t),p}pC.exports=YB});var nf=g((QQ,fC)=>{var ZB=ir(),e$=ZB.Uint8Array;fC.exports=e$});var hC=g((XQ,mC)=>{function t$(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}mC.exports=t$});var vC=g((KQ,gC)=>{function r$(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}gC.exports=r$});var CC=g((YQ,AC)=>{var yC=Ro(),bC=nf(),n$=Qi(),i$=rf(),a$=hC(),o$=vC(),s$=1,l$=2,u$="[object Boolean]",c$="[object Date]",d$="[object Error]",p$="[object Map]",f$="[object Number]",m$="[object RegExp]",h$="[object Set]",g$="[object String]",v$="[object Symbol]",y$="[object ArrayBuffer]",b$="[object DataView]",wC=yC?yC.prototype:void 0,af=wC?wC.valueOf:void 0;function w$(e,t,r,n,i,a,o){switch(r){case b$:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case y$:return!(e.byteLength!=t.byteLength||!a(new bC(e),new bC(t)));case u$:case c$:case f$:return n$(+e,+t);case d$:return e.name==t.name&&e.message==t.message;case m$:case g$:return e==t+"";case p$:var s=a$;case h$:var l=n&s$;if(s||(s=o$),e.size!=t.size&&!l)return!1;var u=o.get(e);if(u)return u==t;n|=l$,o.set(e,t);var c=i$(s(e),s(t),n,i,a,o);return o.delete(e),c;case v$:if(af)return af.call(e)==af.call(t)}return!1}AC.exports=w$});var EC=g((ZQ,SC)=>{function A$(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}SC.exports=A$});var Sn=g((eX,NC)=>{var C$=Array.isArray;NC.exports=C$});var IC=g((tX,DC)=>{var S$=EC(),E$=Sn();function N$(e,t,r){var n=t(e);return E$(e)?n:S$(n,r(e))}DC.exports=N$});var PC=g((rX,_C)=>{function D$(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}_C.exports=D$});var OC=g((nX,TC)=>{function I$(){return[]}TC.exports=I$});var xC=g((iX,FC)=>{var _$=PC(),P$=OC(),T$=Object.prototype,O$=T$.propertyIsEnumerable,RC=Object.getOwnPropertySymbols,R$=RC?function(e){return e==null?[]:(e=Object(e),_$(RC(e),function(t){return O$.call(e,t)}))}:P$;FC.exports=R$});var kC=g((aX,LC)=>{function F$(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}LC.exports=F$});var En=g((oX,MC)=>{function x$(e){return e!=null&&typeof e=="object"}MC.exports=x$});var BC=g((sX,UC)=>{var L$=ei(),k$=En(),M$="[object Arguments]";function U$(e){return k$(e)&&L$(e)==M$}UC.exports=U$});var of=g((lX,VC)=>{var $C=BC(),B$=En(),qC=Object.prototype,$$=qC.hasOwnProperty,q$=qC.propertyIsEnumerable,V$=$C((function(){return arguments})())?$C:function(e){return B$(e)&&$$.call(e,"callee")&&!q$.call(e,"callee")};VC.exports=V$});var zC=g((uX,GC)=>{function G$(){return!1}GC.exports=G$});var jl=g((ko,ea)=>{var z$=ir(),W$=zC(),HC=typeof ko=="object"&&ko&&!ko.nodeType&&ko,WC=HC&&typeof ea=="object"&&ea&&!ea.nodeType&&ea,j$=WC&&WC.exports===HC,jC=j$?z$.Buffer:void 0,H$=jC?jC.isBuffer:void 0,J$=H$||W$;ea.exports=J$});var Hl=g((cX,JC)=>{var Q$=9007199254740991,X$=/^(?:0|[1-9]\d*)$/;function K$(e,t){var r=typeof e;return t=t??Q$,!!t&&(r=="number"||r!="symbol"&&X$.test(e))&&e>-1&&e%1==0&&e<t}JC.exports=K$});var sf=g((dX,QC)=>{var Y$=9007199254740991;function Z$(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Y$}QC.exports=Z$});var KC=g((pX,XC)=>{var eq=ei(),tq=sf(),rq=En(),nq="[object Arguments]",iq="[object Array]",aq="[object Boolean]",oq="[object Date]",sq="[object Error]",lq="[object Function]",uq="[object Map]",cq="[object Number]",dq="[object Object]",pq="[object RegExp]",fq="[object Set]",mq="[object String]",hq="[object WeakMap]",gq="[object ArrayBuffer]",vq="[object DataView]",yq="[object Float32Array]",bq="[object Float64Array]",wq="[object Int8Array]",Aq="[object Int16Array]",Cq="[object Int32Array]",Sq="[object Uint8Array]",Eq="[object Uint8ClampedArray]",Nq="[object Uint16Array]",Dq="[object Uint32Array]",he={};he[yq]=he[bq]=he[wq]=he[Aq]=he[Cq]=he[Sq]=he[Eq]=he[Nq]=he[Dq]=!0;he[nq]=he[iq]=he[gq]=he[aq]=he[vq]=he[oq]=he[sq]=he[lq]=he[uq]=he[cq]=he[dq]=he[pq]=he[fq]=he[mq]=he[hq]=!1;function Iq(e){return rq(e)&&tq(e.length)&&!!he[eq(e)]}XC.exports=Iq});var ZC=g((fX,YC)=>{function _q(e){return function(t){return e(t)}}YC.exports=_q});var tS=g((Mo,ta)=>{var Pq=Yp(),eS=typeof Mo=="object"&&Mo&&!Mo.nodeType&&Mo,Uo=eS&&typeof ta=="object"&&ta&&!ta.nodeType&&ta,Tq=Uo&&Uo.exports===eS,lf=Tq&&Pq.process,Oq=(function(){try{var e=Uo&&Uo.require&&Uo.require("util").types;return e||lf&&lf.binding&&lf.binding("util")}catch{}})();ta.exports=Oq});var Jl=g((mX,iS)=>{var Rq=KC(),Fq=ZC(),rS=tS(),nS=rS&&rS.isTypedArray,xq=nS?Fq(nS):Rq;iS.exports=xq});var uf=g((hX,aS)=>{var Lq=kC(),kq=of(),Mq=Sn(),Uq=jl(),Bq=Hl(),$q=Jl(),qq=Object.prototype,Vq=qq.hasOwnProperty;function Gq(e,t){var r=Mq(e),n=!r&&kq(e),i=!r&&!n&&Uq(e),a=!r&&!n&&!i&&$q(e),o=r||n||i||a,s=o?Lq(e.length,String):[],l=s.length;for(var u in e)(t||Vq.call(e,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Bq(u,l)))&&s.push(u);return s}aS.exports=Gq});var Ql=g((gX,oS)=>{var zq=Object.prototype;function Wq(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||zq;return e===r}oS.exports=Wq});var cf=g((vX,sS)=>{function jq(e,t){return function(r){return e(t(r))}}sS.exports=jq});var uS=g((yX,lS)=>{var Hq=cf(),Jq=Hq(Object.keys,Object);lS.exports=Jq});var dS=g((bX,cS)=>{var Qq=Ql(),Xq=uS(),Kq=Object.prototype,Yq=Kq.hasOwnProperty;function Zq(e){if(!Qq(e))return Xq(e);var t=[];for(var r in Object(e))Yq.call(e,r)&&r!="constructor"&&t.push(r);return t}cS.exports=Zq});var Bo=g((wX,pS)=>{var e3=Vl(),t3=sf();function r3(e){return e!=null&&t3(e.length)&&!e3(e)}pS.exports=r3});var mS=g((AX,fS)=>{var n3=uf(),i3=dS(),a3=Bo();function o3(e){return a3(e)?n3(e):i3(e)}fS.exports=o3});var gS=g((CX,hS)=>{var s3=IC(),l3=xC(),u3=mS();function c3(e){return s3(e,u3,l3)}hS.exports=c3});var bS=g((SX,yS)=>{var vS=gS(),d3=1,p3=Object.prototype,f3=p3.hasOwnProperty;function m3(e,t,r,n,i,a){var o=r&d3,s=vS(e),l=s.length,u=vS(t),c=u.length;if(l!=c&&!o)return!1;for(var d=l;d--;){var p=s[d];if(!(o?p in t:f3.call(t,p)))return!1}var m=a.get(e),h=a.get(t);if(m&&h)return m==t&&h==e;var w=!0;a.set(e,t),a.set(t,e);for(var b=o;++d<l;){p=s[d];var E=e[p],D=t[p];if(n)var F=o?n(D,E,p,t,e,a):n(E,D,p,e,t,a);if(!(F===void 0?E===D||i(E,D,r,n,a):F)){w=!1;break}b||(b=p=="constructor")}if(w&&!b){var x=e.constructor,q=t.constructor;x!=q&&"constructor"in e&&"constructor"in t&&!(typeof x=="function"&&x instanceof x&&typeof q=="function"&&q instanceof q)&&(w=!1)}return a.delete(e),a.delete(t),w}yS.exports=m3});var AS=g((EX,wS)=>{var h3=Cn(),g3=ir(),v3=h3(g3,"DataView");wS.exports=v3});var SS=g((NX,CS)=>{var y3=Cn(),b3=ir(),w3=y3(b3,"Promise");CS.exports=w3});var NS=g((DX,ES)=>{var A3=Cn(),C3=ir(),S3=A3(C3,"Set");ES.exports=S3});var IS=g((IX,DS)=>{var E3=Cn(),N3=ir(),D3=E3(N3,"WeakMap");DS.exports=D3});var LS=g((_X,xS)=>{var df=AS(),pf=Gl(),ff=SS(),mf=NS(),hf=IS(),FS=ei(),ra=ef(),_S="[object Map]",I3="[object Object]",PS="[object Promise]",TS="[object Set]",OS="[object WeakMap]",RS="[object DataView]",_3=ra(df),P3=ra(pf),T3=ra(ff),O3=ra(mf),R3=ra(hf),ti=FS;(df&&ti(new df(new ArrayBuffer(1)))!=RS||pf&&ti(new pf)!=_S||ff&&ti(ff.resolve())!=PS||mf&&ti(new mf)!=TS||hf&&ti(new hf)!=OS)&&(ti=function(e){var t=FS(e),r=t==I3?e.constructor:void 0,n=r?ra(r):"";if(n)switch(n){case _3:return RS;case P3:return _S;case T3:return PS;case O3:return TS;case R3:return OS}return t});xS.exports=ti});var GS=g((PX,VS)=>{var gf=tf(),F3=rf(),x3=CC(),L3=bS(),kS=LS(),MS=Sn(),US=jl(),k3=Jl(),M3=1,BS="[object Arguments]",$S="[object Array]",Xl="[object Object]",U3=Object.prototype,qS=U3.hasOwnProperty;function B3(e,t,r,n,i,a){var o=MS(e),s=MS(t),l=o?$S:kS(e),u=s?$S:kS(t);l=l==BS?Xl:l,u=u==BS?Xl:u;var c=l==Xl,d=u==Xl,p=l==u;if(p&&US(e)){if(!US(t))return!1;o=!0,c=!1}if(p&&!c)return a||(a=new gf),o||k3(e)?F3(e,t,r,n,i,a):x3(e,t,l,r,n,i,a);if(!(r&M3)){var m=c&&qS.call(e,"__wrapped__"),h=d&&qS.call(t,"__wrapped__");if(m||h){var w=m?e.value():e,b=h?t.value():t;return a||(a=new gf),i(w,b,r,n,a)}}return p?(a||(a=new gf),L3(e,t,r,n,i,a)):!1}VS.exports=B3});var HS=g((TX,jS)=>{var $3=GS(),zS=En();function WS(e,t,r,n,i){return e===t?!0:e==null||t==null||!zS(e)&&!zS(t)?e!==e&&t!==t:$3(e,t,r,n,WS,i)}jS.exports=WS});var QS=g((OX,JS)=>{var q3=HS();function V3(e,t){return q3(e,t)}JS.exports=V3});var vf=g((RX,XS)=>{var G3=Cn(),z3=(function(){try{var e=G3(Object,"defineProperty");return e({},"",{}),e}catch{}})();XS.exports=z3});var Kl=g((FX,YS)=>{var KS=vf();function W3(e,t,r){t=="__proto__"&&KS?KS(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}YS.exports=W3});var yf=g((xX,ZS)=>{var j3=Kl(),H3=Qi();function J3(e,t,r){(r!==void 0&&!H3(e[t],r)||r===void 0&&!(t in e))&&j3(e,t,r)}ZS.exports=J3});var tE=g((LX,eE)=>{function Q3(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}}eE.exports=Q3});var nE=g((kX,rE)=>{var X3=tE(),K3=X3();rE.exports=K3});var lE=g(($o,na)=>{var Y3=ir(),sE=typeof $o=="object"&&$o&&!$o.nodeType&&$o,iE=sE&&typeof na=="object"&&na&&!na.nodeType&&na,Z3=iE&&iE.exports===sE,aE=Z3?Y3.Buffer:void 0,oE=aE?aE.allocUnsafe:void 0;function e4(e,t){if(t)return e.slice();var r=e.length,n=oE?oE(r):new e.constructor(r);return e.copy(n),n}na.exports=e4});var dE=g((MX,cE)=>{var uE=nf();function t4(e){var t=new e.constructor(e.byteLength);return new uE(t).set(new uE(e)),t}cE.exports=t4});var fE=g((UX,pE)=>{var r4=dE();function n4(e,t){var r=t?r4(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}pE.exports=n4});var hE=g((BX,mE)=>{function i4(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}mE.exports=i4});var yE=g(($X,vE)=>{var a4=Hr(),gE=Object.create,o4=(function(){function e(){}return function(t){if(!a4(t))return{};if(gE)return gE(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}})();vE.exports=o4});var bf=g((qX,bE)=>{var s4=cf(),l4=s4(Object.getPrototypeOf,Object);bE.exports=l4});var AE=g((VX,wE)=>{var u4=yE(),c4=bf(),d4=Ql();function p4(e){return typeof e.constructor=="function"&&!d4(e)?u4(c4(e)):{}}wE.exports=p4});var SE=g((GX,CE)=>{var f4=Bo(),m4=En();function h4(e){return m4(e)&&f4(e)}CE.exports=h4});var DE=g((zX,NE)=>{var g4=ei(),v4=bf(),y4=En(),b4="[object Object]",w4=Function.prototype,A4=Object.prototype,EE=w4.toString,C4=A4.hasOwnProperty,S4=EE.call(Object);function E4(e){if(!y4(e)||g4(e)!=b4)return!1;var t=v4(e);if(t===null)return!0;var r=C4.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&EE.call(r)==S4}NE.exports=E4});var wf=g((WX,IE)=>{function N4(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}IE.exports=N4});var Af=g((jX,_E)=>{var D4=Kl(),I4=Qi(),_4=Object.prototype,P4=_4.hasOwnProperty;function T4(e,t,r){var n=e[t];(!(P4.call(e,t)&&I4(n,r))||r===void 0&&!(t in e))&&D4(e,t,r)}_E.exports=T4});var TE=g((HX,PE)=>{var O4=Af(),R4=Kl();function F4(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?R4(r,s,l):O4(r,s,l)}return r}PE.exports=F4});var RE=g((JX,OE)=>{function x4(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}OE.exports=x4});var xE=g((QX,FE)=>{var L4=Hr(),k4=Ql(),M4=RE(),U4=Object.prototype,B4=U4.hasOwnProperty;function $4(e){if(!L4(e))return M4(e);var t=k4(e),r=[];for(var n in e)n=="constructor"&&(t||!B4.call(e,n))||r.push(n);return r}FE.exports=$4});var Cf=g((XX,LE)=>{var q4=uf(),V4=xE(),G4=Bo();function z4(e){return G4(e)?q4(e,!0):V4(e)}LE.exports=z4});var ME=g((KX,kE)=>{var W4=TE(),j4=Cf();function H4(e){return W4(e,j4(e))}kE.exports=H4});var GE=g((YX,VE)=>{var UE=yf(),J4=lE(),Q4=fE(),X4=hE(),K4=AE(),BE=of(),$E=Sn(),Y4=SE(),Z4=jl(),e5=Vl(),t5=Hr(),r5=DE(),n5=Jl(),qE=wf(),i5=ME();function a5(e,t,r,n,i,a,o){var s=qE(e,r),l=qE(t,r),u=o.get(l);if(u){UE(e,r,u);return}var c=a?a(s,l,r+"",e,t,o):void 0,d=c===void 0;if(d){var p=$E(l),m=!p&&Z4(l),h=!p&&!m&&n5(l);c=l,p||m||h?$E(s)?c=s:Y4(s)?c=X4(s):m?(d=!1,c=J4(l,!0)):h?(d=!1,c=Q4(l,!0)):c=[]:r5(l)||BE(l)?(c=s,BE(s)?c=i5(s):(!t5(s)||e5(s))&&(c=K4(l))):d=!1}d&&(o.set(l,c),i(c,l,n,a,o),o.delete(l)),UE(e,r,c)}VE.exports=a5});var Sf=g((ZX,WE)=>{var o5=tf(),s5=yf(),l5=nE(),u5=GE(),c5=Hr(),d5=Cf(),p5=wf();function zE(e,t,r,n,i){e!==t&&l5(t,function(a,o){if(i||(i=new o5),c5(a))u5(e,t,o,r,zE,n,i);else{var s=n?n(p5(e,o),a,o+"",e,t,i):void 0;s===void 0&&(s=a),s5(e,o,s)}},d5)}WE.exports=zE});var Ef=g((eK,jE)=>{function f5(e){return e}jE.exports=f5});var JE=g((tK,HE)=>{function m5(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)}HE.exports=m5});var KE=g((rK,XE)=>{var h5=JE(),QE=Math.max;function g5(e,t,r){return t=QE(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,a=QE(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),h5(e,this,s)}}XE.exports=g5});var ZE=g((nK,YE)=>{function v5(e){return function(){return e}}YE.exports=v5});var rN=g((iK,tN)=>{var y5=ZE(),eN=vf(),b5=Ef(),w5=eN?function(e,t){return eN(e,"toString",{configurable:!0,enumerable:!1,value:y5(t),writable:!0})}:b5;tN.exports=w5});var iN=g((aK,nN)=>{var A5=800,C5=16,S5=Date.now;function E5(e){var t=0,r=0;return function(){var n=S5(),i=C5-(n-r);if(r=n,i>0){if(++t>=A5)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}nN.exports=E5});var oN=g((oK,aN)=>{var N5=rN(),D5=iN(),I5=D5(N5);aN.exports=I5});var lN=g((sK,sN)=>{var _5=Ef(),P5=KE(),T5=oN();function O5(e,t){return T5(P5(e,t,_5),e+"")}sN.exports=O5});var cN=g((lK,uN)=>{var R5=Qi(),F5=Bo(),x5=Hl(),L5=Hr();function k5(e,t,r){if(!L5(r))return!1;var n=typeof t;return(n=="number"?F5(r)&&x5(t,r.length):n=="string"&&t in r)?R5(r[t],e):!1}uN.exports=k5});var Nf=g((uK,dN)=>{var M5=lN(),U5=cN();function B5(e){return M5(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&&U5(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})}dN.exports=B5});var fN=g((cK,pN)=>{var $5=Sf(),q5=Nf(),V5=q5(function(e,t,r,n){$5(e,t,r,n)});pN.exports=V5});var Bt,qo=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"})(Bt||(Bt={}))});function hN(e,t,r="PROD"){let n=i=>`ShellSettings_ECS_ClientCache_${e}_${mN.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 mN,G5,gN=I(()=>{"use strict";mN=se(Kp()),G5=se(Xp());});var Df,vN=I(()=>{"use strict";Ol();Df=So({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 bN,wN,AN,CN,If,z5,Yl,yN,_f=I(()=>{"use strict";bN=se(Xp()),wN=se(_w()),AN=se(Kp()),CN=se(QS()),If=se(fN());qo();gN();vN();z5=60*1e3,Yl=class{clientName;logger;ecsEndpoint;resolveLoadingPromise;loadingPromise=new Promise(t=>this.resolveLoadingPromise=t);_status=Bt.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"?Df.prodEcsEndpoint:Df.integrationEcsEndpoint}client=new wN.default;init=async({clientVersion:t,getFilters:r,cacheStorage:n=bN.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:[AN.EcsConfigType.Default],hosts:[this.ecsEndpoint],initialAppActiveState:!0,getEcsParameters:o,databaseInterface:hN(this.clientName,n,this.endpointType),...a}),this.client.requestUpdate(),this._status===Bt.NotLoaded&&(this._status=Bt.Initialized)}catch(s){this._status=Bt.Error,this.resolveLoadingPromise(),this.logEvent("FeaturesClient/initializationFailed",{ecsClientName:this.clientName,error:s},"Error")}i&&window.setInterval(()=>this.client.requestUpdate(),i*z5)};getConfig=t=>{let r=this.getMergedClientConfigByTeamName(t.teamName),n=r?t.extractConfig(r):{};return(0,If.default)({},t.fallback,n,t.override,yN)};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,CN.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,If.default)({},this.client.getConfig()?.config,this.clientConfigOverride,yN);getMergedClientConfigByTeamName=t=>this.getMergedClientConfig()?.[t];handleConfigUpdated=()=>{let t=this.client.getConfig();if(t===void 0)return;this.resolveLoadingPromise(),this._status=Bt.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})}},yN=(e,t)=>{if(Array.isArray(t))return t}});var EN=g((bK,SN)=>{"use strict";var W5=()=>{let e={};return e.promise=new Promise((t,r)=>{e.resolve=t,e.reject=r}),e};SN.exports=W5});var Pf=g((wK,DN)=>{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{}}}),NN=function(){return Vo};Object.setPrototypeOf(NN,Vo);DN.exports=NN});var PN=g((AK,_N)=>{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{}}}),IN=function(){return Go};Object.setPrototypeOf(IN,Go);_N.exports=IN});var kN=g((CK,LN)=>{"use strict";var Tf=PN(),j5={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},H5={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},J5={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},FN={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Of={};Of[Tf.ForwardRef]=J5;Of[Tf.Memo]=FN;function TN(e){return Tf.isMemo(e)?FN:Of[e.$$typeof]||j5}var Q5=Object.defineProperty,X5=Object.getOwnPropertyNames,ON=Object.getOwnPropertySymbols,K5=Object.getOwnPropertyDescriptor,Y5=Object.getPrototypeOf,RN=Object.prototype;function xN(e,t,r){if(typeof t!="string"){if(RN){var n=Y5(t);n&&n!==RN&&xN(e,n,r)}var i=X5(t);ON&&(i=i.concat(ON(t)));for(var a=TN(e),o=TN(t),s=0;s<i.length;++s){var l=i[s];if(!H5[l]&&!(r&&r[l])&&!(o&&o[l])&&!(a&&a[l])){var u=K5(t,l);try{Q5(e,l,u)}catch{}}}}return e}LN.exports=xN});function UN(e,t,r){let[n,i]=(0,ia.useState)(e.getConfig(t));return(0,ia.useEffect)(()=>{if(!r?.subscribe&&e.status===Bt.ConfigsLoaded)return;let a=e.subscribe(t,o=>{i(o),r?.subscribe||a.unsubscribe()});return a?.unsubscribe},[]),n}function BN(e){return function(t,r){return UN(e,t,r)}}function $N(e,t,r,n){let i=a=>{let o=UN(e,t,n),s={...a,...o};return ia.default.createElement(r,{...s})};return(0,MN.default)(i,r),i.displayName=`WithFeature(${r.name})`,i}function qN(e,t,r,n){return t.reduce((i,a)=>$N(e,a,i,n),r)}function VN(e){return function(t,r,n){return $N(e,t,r,n)}}var MN,ia,Rf=I(()=>{"use strict";MN=se(kN()),ia=se(Pf());qo();});var zN=g((NK,GN)=>{var Z5=Sf(),eV=Nf(),tV=eV(function(e,t,r){Z5(e,t,r)});GN.exports=tV});var Zl=g((DK,WN)=>{var rV=ei(),nV=En(),iV="[object Symbol]";function aV(e){return typeof e=="symbol"||nV(e)&&rV(e)==iV}WN.exports=aV});var HN=g((IK,jN)=>{var oV=Sn(),sV=Zl(),lV=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,uV=/^\w*$/;function cV(e,t){if(oV(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||sV(e)?!0:uV.test(e)||!lV.test(e)||t!=null&&e in Object(t)}jN.exports=cV});var XN=g((_K,QN)=>{var JN=zl(),dV="Expected a function";function Ff(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(dV);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(Ff.Cache||JN),r}Ff.Cache=JN;QN.exports=Ff});var YN=g((PK,KN)=>{var pV=XN(),fV=500;function mV(e){var t=pV(e,function(n){return r.size===fV&&r.clear(),n}),r=t.cache;return t}KN.exports=mV});var eD=g((TK,ZN)=>{var hV=YN(),gV=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vV=/\\(\\)?/g,yV=hV(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(gV,function(r,n,i,a){t.push(i?a.replace(vV,"$1"):n||r)}),t});ZN.exports=yV});var rD=g((OK,tD)=>{function bV(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}tD.exports=bV});var lD=g((RK,sD)=>{var nD=Ro(),wV=rD(),AV=Sn(),CV=Zl(),SV=1/0,iD=nD?nD.prototype:void 0,aD=iD?iD.toString:void 0;function oD(e){if(typeof e=="string")return e;if(AV(e))return wV(e,oD)+"";if(CV(e))return aD?aD.call(e):"";var t=e+"";return t=="0"&&1/e==-SV?"-0":t}sD.exports=oD});var cD=g((FK,uD)=>{var EV=lD();function NV(e){return e==null?"":EV(e)}uD.exports=NV});var pD=g((xK,dD)=>{var DV=Sn(),IV=HN(),_V=eD(),PV=cD();function TV(e,t){return DV(e)?e:IV(e,t)?[e]:_V(PV(e))}dD.exports=TV});var mD=g((LK,fD)=>{var OV=Zl(),RV=1/0;function FV(e){if(typeof e=="string"||OV(e))return e;var t=e+"";return t=="0"&&1/e==-RV?"-0":t}fD.exports=FV});var vD=g((kK,gD)=>{var xV=Af(),LV=pD(),kV=Hl(),hD=Hr(),MV=mD();function UV(e,t,r,n){if(!hD(e))return e;t=LV(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var l=MV(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=hD(c)?c:kV(t[i+1])?[]:{})}xV(s,l,u),s=s[l]}return e}gD.exports=UV});var bD=g((MK,yD)=>{var BV=vD();function $V(e,t,r){return e==null?e:BV(e,t,r)}yD.exports=$V});function SD(e){let{query:t}=(0,CD.default)(window.location.href,!0);return VV(e,t),e}function VV(e,t){let r=qV+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+ED,u={};if(a===r)u=s;else if(a.startsWith(l)){let c=a.substring(l.length);(0,AD.default)(u,c,s)}(0,wD.default)(i,u)}catch{}}),Object.keys(i).length>0&&e.overrideClientConfig(i)}var wD,AD,CD,ED,qV,ND=I(()=>{"use strict";wD=se(zN()),AD=se(bD()),CD=se(Mp());ED=".",qV="ecs"+ED});function tu(e,t,r){let n=SD(new Yl(e,t,r));function i(a){(0,eu.useEffect)(()=>{n.init(a)},[])}return{featuresClient:n,createFeature:zV(n),useFeaturesClientInitParams:i,withFeatures:(a,o,s)=>qN(n,a,o,s)}}function zV(e){let t=BN(e),r=VN(e);return function(i){let a=Sw(i);return a.getConfig=()=>e.getConfig(a),a.isLoaded=()=>e.status===Bt.ConfigsLoaded,$p.register(a,e.clientName),{useFeature:o=>t(a,o),withFeature:(o,s)=>r(a,o,s),feature:a}}}var GV,eu,xf=I(()=>{"use strict";GV=se(EN()),eu=se(Pf());Qp();_f();qo();Rf();ND();qp();});var DD=I(()=>{"use strict";Qp();_f();xf();qo();Rf();Ll();Vp();});function ru(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,Lf=I(()=>{"use strict";aa=se(Jn());});var nY,iY,aY,ID=I(()=>{"use strict";DD();Lf();({featuresClient:nY,createFeature:iY,useFeaturesClientInitParams:aY}=tu("PowerApps-Shell-Test",ru("shell-features")))});var TD=g((sY,PD)=>{var zo=new Proxy(function(){return zo},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:zo},apply:function(){return zo},construct:function(){return{}}}),_D=function(){return zo};Object.setPrototypeOf(_D,zo);PD.exports=_D});var WV,jV,OD=I(()=>{"use strict";wo();WV=se(TD()),jV=se(Jn());});var RD=I(()=>{"use strict";ID();Lf();OD();});var gY,oa,vY,FD=I(()=>{"use strict";RD();xf();({featuresClient:gY,createFeature:oa,useFeaturesClientInitParams:vY}=tu("PowerApps-MakerPortal",ru("powerapps-features")))});var xD,LD,AY,CY,SY,EY,kf=I(()=>{"use strict";Cw();FD();({feature:xD}=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:Ji.enableAutoInsertionOfCellInRow}})),{feature:LD}=oa({teamName:"MakerPortal",owners:["aansu"],description:"Enable the one grid events for form designer",createdOn:"08/21/2024",fallback:{enableOneGridEventsForFormDesigner:Ji.enableOneGridEvents}}),{feature:AY}=oa({teamName:"MakerPortal",owners:["adekulkarni"],description:"Disables PBI components and cleans them up from the form",createdOn:"01/03/2023",fallback:{enableFallbackFormTemplate:Ji.disablePBIComponents}}),{feature:CY}=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:Ji.enableAgentResponse}}),{feature:SY,useFeature:EY}=oa({teamName:"MakerPortal",owners:["aansu"],description:"Enables delayed localization of custom control",createdOn:"06/08/2025",fallback:{enableDelayedLocalizationForCustomControls:Ji.enableDelayedLocalizationForCustomControls}})});var UD=g((DY,MD)=>{var Wo=new Proxy(function(){return Wo},{get:function(e,t){return t==="__esModule"?!1:t===Symbol.toPrimitive?function(){return""}:Wo},apply:function(){return Wo},construct:function(){return{}}}),kD=function(){return Wo};Object.setPrototypeOf(kD,Wo);MD.exports=kD});var st,Nn=I(()=>{"use strict";Me();xe();ot();$l();K();He();st=class extends H{static HighestUsedIndexByClass=new Map;get colspan(){let t=this.getProperty(f.colspan);return N.IsNullOrUndefined(t)?null:parseInt(t,10)}set colspan(t){N.IsNullOrUndefined(t)||this.setProperty(f.colspan,String(t))}constructor(t,r){super(t,r)}get id(){let t=this.getProperty(f.id);return t==null?null:t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?new P(t.substr(1,t.length-2)):new P(t)}set id(t){this.setProperty(f.id,`{${t.ToString()}}`)}set labelId(t){this.setProperty(f.labelId,`{${t.ToString()}}`)}get labelId(){let t=this.getProperty(f.labelId);return t&&t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"?new P(t.substr(1,t.length-2)):new P(t)}get Name(){return this.getProperty(f.Name)}set Name(t){this.setProperty(f.Name,t)}setDisplayName(t,r){for(let i of this.getAllLabels())if(+i.getProperty(f.languagecode)===r){i.setProperty(f.description,t);return}let n=new H(v.formLabel,null);n.setProperty(f.description,t),n.setProperty(f.languagecode,String(r)),this.addGrandChild("labels",n)}getDisplayName(t){for(let r of this.getAllLabels())if(+r.getProperty(f.languagecode)===t)return r.getProperty(f.description)}getAllLabels(){let t=this.getChildren("labels");return t.length!==1?[]:t[0].getChildren("label")}get isLocked(){return+this.getProperty(f.locklevel)==1}set isLocked(t){!this.IsUnboundControl&&this.setProperty(f.locklevel,t?"1":"0")}get availableforphone(){return this.getProcessedValue(f.availableforphone)}set availableforphone(t){N.IsNullOrUndefined(t)||!this.IsAllowedUBCForAvailableOnPhone()||this.setProperty(f.availableforphone,String(t))}get visible(){return this.getProcessedValue(f.visible)}set visible(t){N.IsNullOrUndefined(t)||!this.IsAllowedUBCForVisibleByDefault()||this.setProperty(f.visible,String(t))}isLockLevelSettable(){return!this.IsUnboundControl}get showlabel(){return this.getProcessedValue(f.showlabel)}set showlabel(t){N.IsNullOrUndefined(t)||this.setProperty(f.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(v.formControl);return t?t.disabled:!1}set readonly(t){let r=this.getFirstChild(v.formControl);r&&(r.disabled=t)}get allowfilteroff(){let t=this.getFirstChild(v.formControl);if(t)return t.getParam(f.AllowFilterOff)==="true"}set allowfilteroff(t){let r=this.getFirstChild(v.formControl);r&&!this.IsUnboundControl&&r.setParameter(f.AllowFilterOff,t)}get autoresolve(){let t=this.getFirstChild(v.formControl);if(t)return t.getParam(f.AutoResolve)==="true"}set autoresolve(t){let r=this.getFirstChild(v.formControl);r&&!this.IsUnboundControl&&r.setParameter(f.AutoResolve,t)}get defaultviewid(){let t=this.getFirstChild(v.formControl);return t?t.getParam(f.DefaultViewId):T.EmptyString}set defaultviewid(t){let r=this.getFirstChild(v.formControl);r&&!this.IsUnboundControl&&r.setParameter(f.DefaultViewId,t)}get dependentattributename(){let t=this.getFirstChild(v.formControl);return t?t.getParam(f.DependentAttributeName):T.EmptyString}set dependentattributename(t){let r=this.getFirstChild(v.formControl);r&&!this.IsUnboundControl&&r.setParameter(f.DependentAttributeName,t)}get dependentattributetype(){let t=this.getFirstChild(v.formControl);return t?t.getParam(f.DependentAttributeType):T.EmptyString}set dependentattributetype(t){let r=this.getFirstChild(v.formControl);r&&!this.IsUnboundControl&&r.setParameter(f.DependentAttributeType,t)}get disablequickfind(){let t=this.getFirstChild(v.formControl);if(t)return t.getParam(f.DisableQuickFind)==="true"}set disablequickfind(t){let r=this.getFirstChild(v.formControl);r&&!this.IsUnboundControl&&r.setParameter(f.DisableQuickFind,t)}get disableviewpicker(){let t=this.getFirstChild(v.formControl);if(t)return t.getParam(f.DisableViewPicker)==="true"}set disableviewpicker(t){let r=this.getFirstChild(v.formControl);r&&!this.IsUnboundControl&&r.setParameter(f.DisableViewPicker,t)}get filterrelationshipname(){let t=this.getFirstChild(v.formControl);return t?t.getParam(f.FilterRelationshipName):T.EmptyString}set filterrelationshipname(t){let r=this.getFirstChild(v.formControl);r&&!this.IsUnboundControl&&r.setParameter(f.FilterRelationshipName,t)}get availableviewids(){let t=this.getFirstChild(v.formControl);return t?t.getParam(f.AvailableViewIds):T.EmptyString}set availableviewids(t){let r=this.getFirstChild(v.formControl);r&&!this.IsUnboundControl&&r.setParameter(f.AvailableViewIds,t)}get IsUnboundControl(){let t=this.getFirstChild(v.formControl);if(t&&t.ClassId){let r=Be.getUniqueIdentifierForControl(t);return!N.IsNullOrUndefined(r)&&Be.isUnboundFormControlByIdentifier(r)}else return!1}IsAllowedUBCForAvailableOnPhone(){let t=this.getFirstChild(v.formControl);if(t){let n=Be.getUniqueIdentifierForControl(t).guidString,i=n===R.GridControl||n===R.TimeLineControl||n===R.TimeLineControlUC;return this.IsUnboundControl?i:!0}return this.NodeName===v.formSection||this.NodeName===v.formTab}IsAllowedUBCForVisibleByDefault(){let t=this.getFirstChild(v.formControl);if(t){let n=Be.getUniqueIdentifierForControl(t).guidString,i=n===R.MapsControl||n===R.WebResourceHtmlControl||n===R.WebResourceImageControl||n===R.IframeControl||n===R.SocialInsightControl;return this.IsUnboundControl?i:!0}else return!0}get events(){let t=this.getChildren(v.formEvents);return t.length===1?t[0].getAllChildren():[]}addEvent(t){this.addGrandChild(v.formEvents,t)}getUsedNodeNameSet(t){return null}getHighestIndexById(t,r){return null}}});var sa,Mf=I(()=>{"use strict";ot();K();He();sa=class extends H{constructor(t,r){super(v.dependency,t),T.IsNullOrEmpty(r)||this.setDefaultProperties(r)}set id(t){this.setProperty(f.id,t)}get id(){return this.getProperty(f.id)}setDefaultProperties(t){this.id=t}}});var BD,la,Uf=I(()=>{"use strict";xe();Mf();K();He();Nn();(function(e){e[e.Form=0]="Form",e[e.Cell=1]="Cell",e[e.Tab=2]="Tab",e[e.Control=3]="Control"})(BD||(BD={}));la=class extends st{constructor(t,r){super(v.formEvent,t),r&&(this.eventName=r,this.application="false",this.active="false")}set eventName(t){this.setProperty(f.Name,t)}get eventName(){return this.getProperty(f.Name)}set application(t){this.setProperty(f.application,t)}get application(){return this.getProperty(f.application)}set attribute(t){this.setProperty(f.EventAttribute,t)}get attribute(){return this.getProperty(f.EventAttribute)}set relationship(t){this.setProperty(f.Relationship,t)}get relationship(){return this.getProperty(f.Relationship)}set control(t){this.setProperty(f.Control,t)}get control(){return this.getProperty(f.Control)}set active(t){this.setProperty(f.EventActive,t)}get active(){return this.getProperty(f.EventActive)}getAllHandlers(){let t=this.getChildren(v.EventHandlers);return t&&t.length?t[0].getChildren(v.handler):[]}getAllDependencies(){let t=this.getChildren(v.formDependencies);return t.length===0?[]:t[0].getAllChildren()}setDependencies(t){let r=this.getFirstChild(v.formDependencies);if(N.IsNullOrUndefined(r)){if(t.length===0)return;this.addChild(new H(v.formDependencies,this)),r=this.getFirstChild(v.formDependencies)}if(t.length===0)r.getParentNode().deleteChild(r);else{r.deleteAllChildren();for(let n of t)r.addChild(new sa(r,n.toString()))}}}});var ar,jo=I(()=>{"use strict";Me();bo();xe();Hn();K();He();rr();ar=class extends H{previewVersion;constructor(t){super(v.formControl,t)}updatePreview(){this.previewVersion=Date.now()}get ClassId(){let t=this.getProperty(f.classid);return t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"&&(t=t.substr(1,t.length-2)),new P(t)}set ClassId(t){this.setProperty(f.classid,`{${t.ToString()}}`)}get dataFieldName(){return this.getProperty(f.datafieldname)}set dataFieldName(t){this.setProperty(f.datafieldname,t)}set id(t){this.setProperty(f.id,t)}get id(){return this.getProperty(f.id)}get UniqueId(){let t=this.getProperty(f.uniqueid);return N.IsNullOrUndefined(t)?null:(t.charAt(0)==="{"&&t.charAt(t.length-1)==="}"&&(t=t.substr(1,t.length-2)),new P(t))}set UniqueId(t){this.setProperty(f.uniqueid,`{${t.ToString()}}`)}get isRequired(){return this.getProperty(f.isRequired)==="true"}set isRequired(t){N.IsNullOrUndefined(t)||this.setProperty(f.isRequired,String(t))}get disableMru(){return this.getParam(f.DisableMru)==="true"}set disableMru(t){N.IsNullOrUndefined(t)||this.setParameter(f.DisableMru,t)}get useMFDForCreate(){return this.getParam(f.UseMFDForCreate)==="true"}set useMFDForCreate(t){N.IsNullOrUndefined(t)||this.setParameter(f.UseMFDForCreate,t)}get useMFDForEdit(){return this.getParam(f.UseMFDForEdit)==="true"}set useMFDForEdit(t){N.IsNullOrUndefined(t)||this.setParameter(f.UseMFDForEdit,t)}get disabled(){return this.getProperty(f.disabled)==="true"}set disabled(t){N.IsNullOrUndefined(t)||this.setProperty(f.disabled,String(t))}get indicationOfSubgrid(){return this.getProperty(f.indicationOfSubgrid)==="true"}set indicationOfSubgrid(t){this.setProperty(f.indicationOfSubgrid,String(t))}getAllParameters(){let t=new pt,r=this.getFirstChild(f.parameters);return r&&r.getAllChildren().forEach(n=>{if(n){let i=n.getAllChildren(),a=i&&i.length>0&&i[0];a&&t.add(n.getNodeName(),a.getNodeName())}}),t}setParameter(t,r){let n=!1;r===null&&(n=!0);let i=(jr.StartTag+r).toString(),a=this.parametersNode;if(a){let o=a.findFirst(s=>s&&s.getNodeName()===t);if(o)if(n){this.deleteFirstGrandChildOfName(v.controlParameters,o);return}else{let s=o.getAllChildren();s&&s.length>0&&s[0]?s[0].setNodeName(i):o.addChild(new 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)===jr.StartTag?a.substring(1):a}}}return null}get parametersNode(){let t=this.getChildren(f.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(f.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()===Ue.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,Bf=I(()=>{"use strict";ot();Vi();jo();K();He();ua=class extends ar{constructor(t){super(t)}get targetEntityType(){return this.getParam(f.targetEntityType)||T.EmptyString}set targetEntityType(t){this.setParameter(f.targetEntityType,t)}get viewId(){return T.StripBraces(this.getParam(f.viewId))||T.EmptyString}set viewId(t){this.setParameter(f.viewId,T.AddBraces(t))}get viewIds(){return this.getParam(f.viewIds)||T.EmptyString}set viewIds(t){this.setParameter(f.viewIds,t)}get relationshipName(){return this.getParam(f.RelationshipName)||T.EmptyString}set relationshipName(t){this.setParameter(f.RelationshipName,t)}get isUserView(){return T.IsStrictTrue(this.getParam(f.isUserView))}set isUserView(t){this.setParameter(f.isUserView,t.toString())}get enableViewPicker(){return T.IsStrictTrue(this.getParam(f.enableViewPicker))}set enableViewPicker(t){this.setParameter(f.enableViewPicker,t)}get autoExpand(){return this.getParent().autoexpand&&this.getParam(f.autoExpand)===f.Auto}set autoExpand(t){let r=this.getParent();this.setParameter(f.autoExpand,t?f.Auto:f.Fixed),r.autoexpand=t}get recordsPerPage(){return this.getParam(f.recordsPerPage)?Number(this.getParam(f.recordsPerPage)):Number(f.RecordsPerPageRAControlDefault)}set recordsPerPage(t){this.setParameter(f.recordsPerPage,String(t))}get enableQuickFind(){return T.IsStrictTrue(this.getParam(f.enableQuickFind))}set enableQuickFind(t){this.setParameter(f.enableQuickFind,t)}get teamTemplateId(){return T.StripBraces(this.getParam(f.teamTemplateId))||T.EmptyString}set teamTemplateId(t){this.setParameter(f.teamTemplateId,T.AddBraces(t))}get chartId(){return this.getParam(f.visualizationId)||T.EmptyString}set chartId(t){this.setParameter(f.visualizationId,t)}get enableChartPicker(){return T.IsStrictTrue(this.getParam(f.enableChartPicker))}set enableChartPicker(t){this.setParameter(f.enableChartPicker,t)}get chartGridMode(){switch(this.getParam(f.chartGridMode)){case Ut.Chart:return Ut.Chart;case Ut.Grid:return Ut.Grid;default:return Ut.All}}set chartGridMode(t){this.setParameter(f.chartGridMode,t)}updateChartGridMode(t){t?this.chartGridMode=Ut.Chart:this.chartGridMode=this.enableChartPicker?Ut.All:Ut.Grid}updateDefaultProperties(t,r){for(let n of t)switch(n.getNodeName()){case f.targetEntityType:n.getAllChildren()[0].setNodeName("<"+r.targetEntityType);break;case f.viewId:n.getAllChildren()[0].setNodeName("<"+T.AddBraces(r.viewId));break;case f.isUserView:n.getAllChildren()[0].setNodeName("<"+r.isUserView);break;case f.enableViewPicker:n.getAllChildren()[0].setNodeName("<"+r.enableViewPicker);break;case f.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 ca,$f=I(()=>{"use strict";ot();Vi();jo();K();ca=class extends ar{constructor(t){super(t)}get defaultViewId(){return T.StripBraces(this.getParam(f.DefaultViewId))||T.EmptyString}set defaultViewId(t){this.setParameter(f.DefaultViewId,T.AddBraces(t))}get autoResolve(){return T.IsStrictTrue(this.getParam(f.AutoResolve))}set autoResolve(t){this.setParameter(f.AutoResolve,t)}get disableQuickFind(){return T.IsStrictTrue(this.getParam(f.DisableQuickFind))}set disableQuickFind(t){this.setParameter(f.DisableQuickFind,t)}get disableViewPicker(){return T.IsStrictTrue(this.getParam(f.DisableViewPicker))}set disableViewPicker(t){this.setParameter(f.DisableViewPicker,t)}get allowFilterOff(){return T.IsStrictTrue(this.getParam(f.AllowFilterOff))}set allowFilterOff(t){this.setParameter(f.AllowFilterOff,t)}get disableMru(){return T.IsStrictTrue(this.getParam(f.DisableMru))}set disableMru(t){this.setParameter(f.DisableMru,t)}get dependentAttributeName(){return this.getParam(f.DependentAttributeName)||T.EmptyString}set dependentAttributeName(t){this.setParameter(f.DependentAttributeName,t)}get dependentAttributeType(){return this.getParam(f.DependentAttributeType)||T.EmptyString}set dependentAttributeType(t){this.setParameter(f.DependentAttributeType,t)}get filterRelationshipName(){return this.getParam(f.FilterRelationshipName)||T.EmptyString}set filterRelationshipName(t){this.setParameter(f.FilterRelationshipName,t)}get availableViewIds(){return this.getParam(f.AvailableViewIds)||T.EmptyString}set availableViewIds(t){this.setParameter(f.AvailableViewIds,t)}updateDefaultProperties(t,r){for(let n of t)switch(n.getNodeName()){case f.datafieldname:case f.bindAttribute:n.getAllChildren()[0].setNodeName("<"+r.dataFieldName);break;case f.DefaultViewId:n.getAllChildren()[0].setNodeName("<"+T.AddBraces(r.defaultViewId));break;case f.AllowFilterOff:n.getAllChildren()[0].setNodeName("<"+r.allowFilterOff);break;case f.DisableQuickFind:n.getAllChildren()[0].setNodeName("<"+r.disableQuickFind);break;case f.DisableViewPicker:n.getAllChildren()[0].setNodeName("<"+r.disableViewPicker);break;case f.FilterRelationshipName:n.getAllChildren()[0].setNodeName("<"+r.filterRelationshipName);break;case f.DependentAttributeName:n.getAllChildren()[0].setNodeName("<"+r.dependentAttributeName);break;case f.DependentAttributeType:n.getAllChildren()[0].setNodeName("<"+r.dependentAttributeType);break;case f.AvailableViewIds:n.getAllChildren()[0].setNodeName("<"+r.availableViewIds);break;case f.DisableMru:n.getAllChildren()[0].setNodeName("<"+r.disableMru);break;case f.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 $D,qf,Et,Ho=I(()=>{"use strict";$D=se(UD());Nn();K();xe();Me();Uf();jo();$l();Hp();Np();rr();Hn();Bi();Bf();$f();Vf();No();qf="_",Et=class e extends st{fieldPlaceholder;fieldRequiredLevel;isNewField;cellColType;dependentFields=[];constructor(t){super(v.formCell,t),this.isNewField=!1}get cellType(){return this.cellColType}set cellType(t){this.cellColType=t}setDefaultProperties(t){this.showlabel=t,this.isLocked=!1,N.IsNullOrUndefined(this.getProperty(f.id))&&(this.id=new P(P.NewGuid()))}addControl(t,r,n,i,a,o,s){n instanceof ar?this.addChild(n):n instanceof P&&this.addChild(this.getControlWithControlSpecificProperties(t,r,n,i,a,o,s))}removeControl(){return this.deleteChild(this.control)>=0}get isIndependent(){if(!N.IsNullOrUndefined(this.control))return N.IsNullOrUndefined(this.control.dataFieldName)?N.IsNullOrUndefined(this.control.id)?!0:!Qn.dependencyFieldCount.containsKey(this.control.id):!Qn.dependencyFieldCount.containsKey(this.control.dataFieldName)}createOnLoadEvent(){this.addEvent(new la(this,vo.onLoad))}get dependencies(){let t=this.getChildren(v.formEvents);for(let r of t){let n=r.getChildren(v.formEvent);for(let i of n)this.buildDependencyList(i,this.dependentFields)}return this.dependentFields}getNextAvailableControlName(t,r,n,i){let a;if(i&&Dl[i])a=Dl[i].replace(/ /g,qf)+qf;else{a="Control_";let u=new Error("Control class id does not exist or is undefined");(0,$D.trackErrorTrace)(dt,{eventName:`${xb}/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,f.isUnbound,"true"),e.prototype.setProperty.call(t,f.isRequired,"false")}getControlWithControlSpecificProperties(t,r,n,i,a,o,s){let l;a===$t.Grid?(l=new ua(this),l.indicationOfSubgrid=!0):a===$t.Lookup?l=new ca(this):l=new ar(this);let u=n.guidString,c=o||this.getNextAvailableControlName(t,i,this.getUsedNodeNameSet(t),u);if(e.prototype.setProperty.call(l,f.id,c),l.ClassId=n,!N.IsNullOrUndefined(s)&&(l.UniqueId=s),!o&&r)this.getUnboundControlProperties(l);else{let d=Be.getUniqueIdentifierForControl(l);N.IsNullOrUndefined(d)||(Be.getControlDataTypeByControlOrUniqueId(d)===V.QuickFormCollectionControl||!Be.isUnboundFormControlByIdentifier(d)?a!==$t.Grid&&o&&u!==S.IframeControl&&u!==S.SubgridControl&&u!==S.ReferencePanelSubgridControl&&(l.dataFieldName=o,e.prototype.setProperty.call(l,f.disabled,"false")):(this.rowspan=Be.GetRowSpan(l),(Be.getControlDataTypeByControlOrUniqueId(d)===V.NotesControl||Be.getControlDataTypeByControlOrUniqueId(d)===V.TimeLineControl)&&(e.prototype.setProperty.call(l,f.disabled,"false"),l.id=V.NotesControl)),(Be.getUnboundControlNameFromIdentifier(n)===V.SubGridControl||Be.getUnboundControlNameFromIdentifier(n)===V.NotesControl||Be.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(f.id);o.getNodeName()===v.dependency&&s?r.push(s):this.buildDependencyList(o,r)}}}get control(){return this.getFirstChild(v.formControl)}set rowspan(t){this.setProperty(f.rowspan,String(t))}get rowspan(){let t=this.getProperty(f.rowspan);return N.IsNullOrUndefined(t)?1:parseInt(t,10)}set autoexpand(t){this.setProperty(f.auto,String(t))}get autoexpand(){return this.getProperty(f.auto)==="true"}set colspan(t){let r=Number(Wp.ONE_COLUMN),n=Number(Wp.FOUR_COLUMN);N.IsNullOrUndefined(t)||t>n||t<r||this.setProperty(f.colspan,String(t))}get colspan(){let t=this.getProperty(f.colspan);return N.IsNullOrUndefined(t)?1:parseInt(t,10)}getParentRow(){return this.getAncestor(v.formRow)}getParentSection(){return this.getAncestor(v.formSection)}getParentTab(){return this.getAncestor(v.formTab)}getParentForm(){return this.getAncestor(v.form)}isInHeader(){let t=this.getAncestor(v.formHeader);return!N.IsNullOrUndefined(t)}isInFooter(){let t=this.getAncestor(v.formFooter);return!N.IsNullOrUndefined(t)}isEmpty(){return N.IsNullOrUndefined(this.control)&&!this.IsUserSpacer}getHeaderFooter(){return this.isInHeader()?this.getAncestor(v.formHeader):this.isInFooter()?this.getAncestor(v.formFooter):null}get FieldRequiredLevel(){return this.fieldRequiredLevel}set FieldRequiredLevel(t){this.fieldRequiredLevel=t}get FieldPlaceholder(){return this.fieldPlaceholder}set FieldPlaceholder(t){this.fieldPlaceholder=t}get IsNewField(){return this.isNewField}set IsNewField(t){this.isNewField=t}get IsUserSpacer(){let t=this.getProperty(f.userspacer);return N.IsNullOrUndefined(t)?!1:t==="true"}SetUserSpacer(){this.setProperty(f.userspacer,"true")}ClearUserSpacer(){this.setProperty(f.userspacer,"false")}get columns(){let t=this.getProperty(f.columnName);return N.IsNullOrUndefined(t)?null:parseInt(t,10)}getColumnLayoutValue(t){let r;switch(t){case Ce.TWO_COLUMN:r="11";break;case Ce.THREE_COLUMN:r="111";break;case Ce.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===Kn.ApplicationRequired||o===Kn.SystemRequired)&&!a||this.isCellLockedByExternal(t)&&!a)return!0}}return!1}getRequiredLevel(t){return!this.control?.dataFieldName||!this.control?.id||this.IsNewField||!this.control?.ClassId?Kn.None:t.getEntityAttributeByName(this.control.dataFieldName)?.requiredLevel?.toString()??Kn.None}isCellLockedByExternal(t){return this.control||this.IsUnboundControl?!1:t.getEntityAttributeByName(this.control.dataFieldName).isRequiredForForm||!this.isIndependent}async toJSON(t){return{Id:this.id&&this.id.guidString,Name:this.Name,Label:this.getDisplayName(t.langCode),ShowLabel:this.showlabel,Visible:this.visible||t.formModelService.showHiddenElements,LabelId:this.labelId.guidString,PreviewId:this.id&&this.id.guidString,ColSpan:this.colspan,RowSpan:this.rowspan,AutoExpand:this.autoexpand,IsInFirstColumnOfSection:!1,IsInLastColumnOfSection:!1,AvailableForPhone:this.availableforphone,UserSpacer:this.IsUserSpacer,IsPreviewCell:!1,IsStreamCell:!1,IsChartCell:!1,IsTileCell:!1,Control:this.control&&await this.control.toJSON(t)}}getUsedNodeNameSet(t){let r=new Set;return t&&t.visit(n=>{if(n.getNodeName()===v.formCell){let i=n;i.control&&i!==this&&r.add(n.control.id)}return!1}),r}getHighestIndexById(t,r){let n=t.findAll(a=>a.getNodeName()===v.formCell&&a.control&&a.control.ClassId.guidString===r),i=0;return n.forEach(a=>{i=Math.max(this.parseControlNameIndex(a.control.id),i)}),i}parseControlNameIndex(t){let r=t.length-1,n=0;for(;r>0&&parseInt(t.charAt(r),10);)r--;return r>0&&r!==t.length-1&&t.charAt(r)===qf&&(r++,n=parseInt(t.substr(r,t.length-r),10)),n}}});var da,Gf=I(()=>{"use strict";ot();K();He();da=class extends H{isInternal;constructor(t,r,n,i){super(v.library,t),this.isInternal=!!i,T.IsNullOrEmpty(n)||(this.name=r,this.libraryUniqueId=n)}get libraryUniqueId(){let t=this.getProperty(f.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(f.libraryUniqueId,t)}get name(){return this.getProperty(f.libraryName)}set name(t){this.setProperty(f.libraryName,t)}get displayName(){return this.getProperty(f.displayName)}set displayName(t){this.setProperty(f.displayName,t)}get description(){return this.getProperty(f.description)}set description(t){this.setProperty(f.description,t)}}});var ri,zf=I(()=>{"use strict";xe();Ho();K();He();ri=class extends H{isRowAddedOnDragOver;constructor(t){super(v.formRow,t)}addCell(t){this.addChild(t)}appendCells(t){for(let r of t)this.addChild(r)}updateCell(t,r){return this.updateChild(t,r)}removeCell(t){return 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(v.formSection)}insertPaddingCellAtIndex(t){let r=new Et(this);r.setDefaultProperties(),this.insertCellAtIndex(r,t)}get firstCell(){let t=this.cells;return t.length>0?t[0]:null}get cells(){return this.getChildren(v.formCell)}get rowColspan(){return this.cells.reduce((t,r)=>t+r.colspan,0)}set IsRowAddedOnDragOver(t){this.isRowAddedOnDragOver=t}get IsRowAddedOnDragOver(){return this.isRowAddedOnDragOver}async getCellsJSON(t){let r=[],n=[];if(this.cells){for(let i of this.cells)n.push(i.toJSON(t));for(let i of n)r.push(await i)}return r}async toJSON(t){return{Cells:await this.getCellsJSON(t),Visible:!0,Height:"0"}}}});function HV(e){switch(e){case Yn.Left:return Zn.Left;case Yn.Right:return Zn.Right;case Yn.Center:return Zn.Center;default:return Zn.Left}}function JV(e){switch(e){case Wi.Left:return Hi.Left;case Wi.Top:return Hi.Top;default:return Hi.Left}}function qD(e){switch(e){case 1:return 1;case 2:return 11;case 3:return 111;case 4:return 1111;default:return 1}}var QV,Ar,Jo=I(()=>{"use strict";Jp();Me();xe();ot();kf();Ho();K();rr();Nn();zf();QV=115,Ar=class e extends st{colSpan=1;constructor(t,r){super(t,r)}getSectionType(){let t;switch(this.columns){case 1:t=Ce.ONE_COLUMN;break;case 11:t=Ce.TWO_COLUMN;break;case 111:t=Ce.THREE_COLUMN;break;case 1111:t=Ce.FOUR_COLUMN;break;default:t=this.colSpan-1}return t}setUniqueName(){let t=this.getParentTab(),r=be.namePrefix;if(t){let n=t.Name,i=t.TotalSectionsCount+1;r=n+be.namePrefix+i.toString()}else r+=Math.floor(Math.random()*1e3);this.setProperty(f.Name,r)}initializeDefaultProperties(t,r,n){if(n===Ce.REFERENCE_PANEL){this.addProperty(f.rowheight,"25");let i=`${be.referencePanelNamePrefix}${P.NewGuid()}${be.namePrefix}`;this.addProperty(f.Name,i)}else this.setUniqueName();if(this.addProperty(f.id,new P(P.NewGuid()).guidString),this.addProperty(f.IsUserDefined,be.IsUserDefined),this.addProperty(f.locklevel,be.LockLevel),this.addProperty(f.showlabel,be.ShowLabel),this.addProperty(f.showbar,be.ShowBar),this.addProperty(f.layout,be.Layout),this.addProperty(f.Fieldlabelalignment,be.labelAlignment),this.addProperty(f.Fieldlabelposition,be.labelPosition),N.IsNullOrUndefined(n))this.addProperty(f.columnName,be.columns);else{let i=this.getColumnLayoutValue(n);this.addProperty(f.columnName,i)}this.addProperty(f.LabelWidth,be.LabelWidth),this.setDisplayName(r,t)}getColumnLayoutValue(t){let r;switch(t){case Ce.TWO_COLUMN:r="11";break;case Ce.THREE_COLUMN:r="111";break;case Ce.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(T.EmptyString).forEach(r=>{t+=parseInt(r,10)}),t}get ColSpan(){return this.colSpan}initializeRow(t){if(t>0&&t<5){let r=new ri(null);if(this.addGrandChild(v.formRows,r),xD.getConfig().enableAutoInsertionOfCellInRow)for(let n=0;n<t;n++){let i=new Et(r);i.setDefaultProperties(!1),r.addCell(i)}}}initialize(t,r,n){this.initializeDefaultProperties(t,r,n),n===Ce.REFERENCE_PANEL&&(n=Ce.ONE_COLUMN),this.initializeRow(n+1)}setColSpan(t){this.colSpan=t}appendRow(t){this.addGrandChild(v.formRows,t)}insertRowAtIndex(t,r){this.addGrandChildAtIndex(v.formRows,t,r)}insertRowsAtIndex(t,r){if(t&&t.length>0)for(let n=0;n<t.length;n++)this.addGrandChildAtIndex(v.formRows,t[n],r+n)}indexOfRow(t){return this.rows.indexOf(t)}deleteRow(t){return this.deleteFirstGrandChildOfName(v.formRows,t)}deleteRows(t,r){this.deleteGrandChildren(v.formRows,t,r)}get rows(){return this.getRows()}getRows(){let t=this.getChildren(v.formRows);return t.length===0?[]:t[0].getChildren(v.formRow)}get columns(){let t=this.getProperty(f.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 qD(n)}return r}set columns(t){N.IsNullOrUndefined(t)||this.setProperty(f.columnName,String(t))}get rowHeight(){let t=this.getProperty(f.rowheight);return N.IsNullOrUndefined(t)?null:parseInt(t,10)}set rowHeight(t){this.setProperty(f.rowheight,String(t))}set autoexpand(t){this.setProperty(f.autoExpand.toLowerCase(),String(t))}get autoexpand(){return this.getProperty(f.autoExpand.toLowerCase())==="true"}get isUserDefined(){return+this.getProperty(f.IsUserDefined)!=0}set isUserDefined(t){t?this.setProperty(f.IsUserDefined,"1"):this.setProperty(f.IsUserDefined,"0")}getParentColumn(){return this.getAncestor(v.formColumn)}getParentTab(){return this.getAncestor(v.formTab)}get hasMultiColumnRow(){return this.getColumnCountValue()>1}get showlabel(){return this.getProperty(f.showlabel)==="true"}set showlabel(t){N.IsNullOrUndefined(t)||this.setProperty(f.showlabel,String(t))}get fieldLabelAlignment(){let t=be.labelAlignment,r=this.getProperty(f.Fieldlabelalignment);return N.IsNullOrUndefined(r)?t:r}set fieldLabelAlignment(t){N.IsNullOrUndefined(t)||this.setProperty(f.Fieldlabelalignment,t)}get fieldLabelPosition(){let t=this.getProperty(f.Fieldlabelposition);return N.IsNullOrUndefined(t)?be.labelPosition:t}set fieldLabelPosition(t){N.IsNullOrUndefined(t)||this.setProperty(f.Fieldlabelposition,String(t))}get showbar(){return this.getProperty(f.showbar)==="true"}set showbar(t){N.IsNullOrUndefined(t)||this.setProperty(f.showbar,String(t))}get labelwidth(){let t=+this.getProperty(f.LabelWidth);return t===0?QV:t}set labelwidth(t){N.IsNullOrUndefined(t)||t>283&&t<57||this.setProperty(f.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:HV(this.fieldLabelAlignment),Position:JV(this.fieldLabelPosition)},Columns:qD(this.getColumnCountValue()),AvailableForPhone:this.availableforphone,Height:this.rowHeight&&this.rowHeight.toString()}}getUsedNodeNameSet(t){let r=new Set;return t&&t.visit(n=>{if(n.getNodeName()===v.formSection){let i=n;i.Name&&!T.GuidStringEquals(i.id.guidString,this.id.guidString)&&r.add(n.Name)}return!1}),r}isReferencePanelSection(){return!N.IsNullOrUndefined(this)&&!N.IsNullOrUndefined(this.Name)&&this.Name.indexOf(be.referencePanelNamePrefix)===0}getAllMultiRowCells(){return this.findAll(t=>{if(t.getNodeName()===v.formCell){let r=t;return!r.isEmpty()&&r.rowspan>1}return!1})}isHeaderOrFooterSection(){return this.NodeName===v.formFooter||this.NodeName===v.formHeader}}});var Dn,nu=I(()=>{"use strict";K();He();Jo();Dn=class e extends H{constructor(t){super(v.formColumn,t)}initializeDefaultProperties(t){this.addProperty(f.width,t.toString()+"%")}insertSectionAtIndex(t,r){this.addGrandChildAtIndex(v.formSections,t,r)}static createAndInitNewSection(t,r,n){let i=new Ar(v.formSection,null);return i.initialize(t,r,n),i}addSectionAtIndex(t,r){this.addGrandChildAtIndex(v.formSections,t,r)}initialize(t,r,n,i=Ce.ONE_COLUMN){this.initializeDefaultProperties(t);let a=e.createAndInitNewSection(r,n,i);this.addSectionAtIndex(a,this.sections.length),a.setUniqueName()}get parentTab(){return this.getAncestor(v.formTab)}get sections(){let t=this.getChildren("sections");return t.length!==1?[]:t[0].getChildren(v.formSection)}get width(){return this.getProperty(f.width)}set width(t){this.setProperty(f.width,t)}deleteSection(t){return this.deleteFirstGrandChildOfName(v.formSections,t)}async getSectionsJSON(t){let r=[];if(this.sections)for(let n of this.sections)r.push(await n.toJSON(t));return r}async toJSON(t){return{Name:this.getProperty(f.Name),Id:this.getProperty(f.id),Label:null,ShowLabel:!1,Visible:!0,LabelId:null,PreviewId:this.getProperty(f.id),Sections:await this.getSectionsJSON(t),Width:this.width}}}});var iu,VD=I(()=>{"use strict";Me();K();rr();Jo();iu=class extends Ar{initializeNavArea(t,r,n){this.initializeNavAreaProps(t,r,n)}get AreaName(){return this.Name}initializeNavAreaProps(t,r,n){this.addProperty(f.Name,n),this.addProperty(f.id,new P(P.NewGuid()).guidString),this.addProperty(f.columnName,be.columns),this.setDisplayName(r,t)}}});var au,GD=I(()=>{"use strict";nu();K();VD();au=class extends Dn{addAndIntializeNavBarSection(t,r,n,i){let a=new iu(v.formSection,null);return a.initializeNavArea(t,r,i),this.addGrandChildAtIndex(v.formSections,a,n),a}}});var Jr,ou=I(()=>{"use strict";Me();xe();ot();nu();K();He();Nn();Jr=class extends st{tabContainsAutoExpandControl;autoExpandCell;constructor(t,r){super(v.formTab,t),this.tabContainsAutoExpandControl=!1}getParentForm(){return this.getAncestor(v.form)}getTabLayoutType(){let t;switch(this.columns.length){case 1:t=Ae.ONE_COLUMN;break;case 2:if(parseInt(this.columns[0].width,10)===50&&parseInt(this.columns[1].width,10)===50){t=Ae.TWO_COLUMN_EQUAL;break}if(parseInt(this.columns[0].width,10)===67&&parseInt(this.columns[1].width,10)===33){t=Ae.TWO_COLUMN_WIDER_LEFT;break}if(parseInt(this.columns[0].width,10)===34&&parseInt(this.columns[1].width,10)===66){t=Ae.TWO_COLUMN_WIDER_RIGHT;break}t=Ae.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=Ae.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=Ae.THREE_COLUMN_WIDER_MID;break}t=Ae.THREE_COLUMN_CUSTOM_LAYOUT;break;default:}return t}initializeProperties(t,r,n){this.addProperty(f.Name,bn.namePrefix+t.toString()),this.addProperty(f.id,new P(P.NewGuid()).guidString),this.addProperty(f.IsUserDefined,bn.IsUserDefined),this.addProperty(f.locklevel,bn.LockLevel),this.addProperty(f.showlabel,bn.ShowLabel),this.setDisplayName(n,r)}get TotalSectionsCount(){let t=0;for(let r of this.columns)t+=r.sections.length;return t}initializeColumns(t,r,n,i=Ce.ONE_COLUMN,a=!0,o){let s=this.getChildren(v.formColumns)[0],l=[];switch(t){case Ae.ONE_COLUMN:l.push(100);break;case Ae.TWO_COLUMN_EQUAL:l.push(50),l.push(50);break;case Ae.TWO_COLUMN_WIDER_LEFT:l.push(67),l.push(33);break;case Ae.TWO_COLUMN_WIDER_RIGHT:l.push(34),l.push(66);break;case Ae.THREE_COLUMN_EQUAL:l.push(34),l.push(33),l.push(33);break;case Ae.THREE_COLUMN_WIDER_MID:l.push(28),l.push(44),l.push(28);break;default:}for(let u of l){let c=new Dn(s);c.initialize(u,r,n,i),this.addGrandChild(v.formColumns,c)}}initialize(t,r,n,i,a,o=Ce.ONE_COLUMN,s=!0,l){this.addChild(new H(v.formColumns,this)),this.initializeProperties(r,n,i),this.initializeColumns(t,n,a,o,s,l)}get columns(){let t=this.getChildren(v.formColumns);return t.length!==1?[]:t[0].getChildren(v.formColumn)}get expanded(){return this.getProcessedValue(f.expanded)}set expanded(t){N.IsNullOrUndefined(t)||this.setProperty(f.expanded,String(t))}get groupName(){return this.getProperty(f.groupName)}get contentType(){return this.getProperty(f.contentType)}set contentType(t){this.setProperty(f.contentType,t)}insertNewColumnAtIndex(t,r,n,i,a){t.initialize(n,i,a),this.addGrandChildAtIndex(v.formColumns,t,r)}insertColumnAtIndex(t,r){this.addGrandChildAtIndex(v.formColumns,t,r)}deleteColumn(t){return this.deleteFirstGrandChildOfName(v.formColumns,t)}async getColumnsJSON(t){let r=[],n=[];if(this.columns){for(let i of this.columns)n.push(i.toJSON(t));for(let i of n)r.push(await i)}return r}async toJSON(t){return{Name:this.Name,Id:this.id&&this.id.guidString,Label:this.getDisplayName(t.langCode)+(!this.visible&&t.formModelService.showHiddenElements?"\u3000\u3000":""),ShowLabel:this.showlabel,Visible:this.visible||t.formModelService.showHiddenElements,LabelId:this.labelId&&this.labelId.guidString,UniqueId:this.id&&this.id.guidString,PreviewId:this.id&&this.id.guidString,Columns:await this.getColumnsJSON(t),EventHandlers:[],Expanded:this.expanded,ContentType:this.contentType,AvailableForPhone:this.availableforphone,Header:void 0,Footer:void 0}}getUsedNodeNameSet(t){let r=new Set;return t&&t.visit(n=>{if(n.getNodeName()===v.formTab){let i=n;i.Name&&!T.GuidStringEquals(i.id.guidString,this.id.guidString)&&r.add(n.Name)}return!1}),r}}});var ni,Wf=I(()=>{"use strict";Me();K();He();rr();GD();ou();ni=class extends Jr{constructor(t,r,n){super(t,Ae.THREE_COLUMN_EQUAL),this.setDisplayName(r,n),this.id=new P(P.NewGuid())}initializeDefaultProps(){this.addChild(new H(v.formColumns,this)),this.initializeFiveColumns()}get columns(){let t=this.getChildren("columns");return t.length!==1?[]:t[0].getChildren(v.formColumn)}getNavSectionForArea(t){for(let r of this.columns)for(let n of r.sections)if(n.AreaName===t)return n;return null}getNavCellFromNavId(t){for(let r of this.columns)for(let n of r.sections)for(let i of n.rows)for(let a of i.cells)if(a.NavId===t)return a;return null}initializeFiveColumns(){for(let t=0;t<Ul.FIVE_COLUMN;t++){let r=new au(this.getChildren(v.formColumns)[0]);r.initializeDefaultProperties(cw.FiveEqColumn),this.addGrandChild(v.formColumns,r)}}}});function KV(e){switch(e){case Ue.Main:return An.Main;case Ue.QuickCreate:return An.QuickCreate;case Ue.QuickViewForm:return An.Quick;case Ue.Dialog:return An.Dialog;default:return An.None}}function YV(e,t){if(t===Ue.Main){if(e)switch(e.toLowerCase()){case"low":return yn.Low;case"highreadonlyvalues":return yn.HighReadOnlyValues;default:return yn.HighWithControls}return yn.Low}}var lu,XV,su,zD=I(()=>{"use strict";vw();lu=se(Jn());Jp();xe();ot();Bi();kf();K();Vi();pp();Hn();Ho();K();Nn();Gf();Wf();ou();XV="1920";su=class e extends st{_formUniqueName;isHeaderDefaulted;consistencyStrong=!1;_formId;_rawFormXml;_entityName;_entityDisplayName;_status;_formName;_langCode;_description;_formType;_formPresentation;parameters=[];_formactivationstate;_changeTracker;_metadataChangeEvent;_etag;constructor(t,r,n,i,a,o,s,l,u){super(v.form,null),this._formUniqueName=a,this._formId=t,this._entityName=r,this._status=n,this._formName=i,this._description=l,this._formType=o,this._formPresentation=s,this._formactivationstate=u,this._changeTracker=new Cl,this._metadataChangeEvent=new ql}get FormLibraries(){let t=this.getFirstChild(v.formLibraries),r=t?t.getAllChildren():[],n=this._getInternalLibraries();return r.concat(n)}getAllEvents(){let t=[],r=this.events;r&&(t=t.concat(r));for(let n of this.tabs){let i=n.events;i&&(t=t.concat(i)),n.findAll(a=>a instanceof Et).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 Et){if(t.control?.dataFieldName){let r=this.events;return r?r.filter(n=>n.attribute&&t.control.dataFieldName===n.attribute):null}else if(this.isCellEditableGridControl(t)){let r=this.events;return r?r.filter(n=>n.control&&t.control.id===n.control):null}}return t?.events}_getInternalLibraries(){let t=this.findAll(i=>i.getNodeName()===v.internalLibraries),r=[],n="src";return t.length>0&&(r=t.map(i=>{let a=i.GetPropertyByParameter(n).replace("$webresource:",""),o=new 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,lu.trackErrorTrace)(Lb,{eventName:"GetDependentFields_MissingDependencies",eventData:{Message:`Failed get dependencies for form event in form ${this.formId.guidString}.`,Attribute:n.attribute,EventName:n.eventName}}),i}}),r}get Parameters(){return this.parameters}set Parameters(t){this.parameters=t}get ShowImagecheck(){return T.IsNullOrEmpty(this.getProperty(f.ShowImage))?!0:this.getProperty(f.ShowImage)!=="false"}set ShowImagecheck(t){t?this.setProperty(f.ShowImage,String(t)):this.setProperty(f.ShowImage,"false")}get ShowNavigation(){return T.IsNullOrEmpty(this.getProperty(f.ShowNavigationbar))?!0:this.getProperty(f.ShowNavigationbar)!=="false"}set ShowNavigation(t){t?this.setProperty(f.ShowNavigationbar,String(t)):this.setProperty(f.ShowNavigationbar,"false")}get MaxWidth(){return T.IsNullOrEmpty(this.getProperty(f.MaxWidth))?XV:this.getProperty(f.MaxWidth)}set MaxWidth(t){this.setProperty(f.MaxWidth,t)}get headerDensityType(){return this.getProperty(f.HeaderDensityType)}set headerDensityType(t){t&&this.formType===Ue.Main?this.setProperty(f.HeaderDensityType,t):this.formType!==Ue.Main&&this.headerDensityType&&this.removeProperty(f.HeaderDensityType)}IsMainOrQuickCreateForm(){return this.formType===Ue.Main||this.formType===Ue.QuickCreate}get FormPresentation(){return this._formPresentation}get LanguageCode(){return this._langCode}set LanguageCode(t){this._langCode=t}get header(){let t=this.getChildren(v.formHeader);return t.length!==1?null:t[0]}set header(t){N.IsNullOrUndefined(t)||(this.deleteChild(this.header),this.addChild(t))}getAllDependencies(){return this.getChildren(v.quickFormDependencies).length===0?[]:this.ConvertModelToArray(this.getChildren(v.quickFormDependencies)[0].getAllChildren())}ConvertModelToArray(t){let r=[];return N.IsNullOrUndefined(t)||t.forEach(n=>{r.push(n.id)}),r}get footer(){let t=this.getChildren(v.formFooter);return t.length!==1?null:t[0]}set footer(t){N.IsNullOrUndefined(t)||(this.deleteChild(this.footer),this.addChild(t))}createAndInitNewTab(t,r,n){let i=new Jr(null,t),a=this.getNextTabCounter(this.tabs.length+1);return i.initialize(t,a,this.LanguageCode,r,n),i}addTabAtIndex(t,r){this.addGrandChildAtIndex(v.formTabs,t,r)}createAndInitNewTabWithMarginalControl(t,r,n,i,a){let o=new Jr(null,Ae.ONE_COLUMN),s=this.getNextTabCounter(this.tabs.length+1);o.initialize(Ae.ONE_COLUMN,s,this.LanguageCode,r,n,a,!1),this.addGrandChildAtIndex(v.formTabs,o,i);let l=o.columns[0].sections[0];for(let u=0;u<t.rows.length;u++)l.appendRow(t.rows[u])}getNextTabCounter(t){for(let r=0;r<this.tabs.length;r++)if(this.tabs[r].Name===bn.namePrefix+t.toString())return this.getNextTabCounter(t+1);return t}get allTabs(){let t=this.getChildren(v.formTabs);return t.length!==1?[]:t[0].getChildren(v.formTab)}get CanvasNavigationTab(){if(this.tabs.length>0){let t=this.tabs[this.tabs.length-1];if(t instanceof ni)return t}return null}get NavigationNode(){let t=this.getChildren(v.formNavigation);return t.length!==1?null:t[0]}set NavigationNode(t){let n=this.getAllChildren().indexOf(this.NavigationNode);n>=0&&(this.deleteChild(this.NavigationNode),this.insertChildAtIndex(t,n))}addNavigatioNode(t){this.addChild(t)}get tabs(){return this.allTabs}deleteTab(t){return this.deleteFirstGrandChildOfName(v.formTabs,t)}insertTabAtIndex(t,r){this.addGrandChildAtIndex(v.formTabs,t,r)}insertRelatedTab(t){let r=this.getAllGrandChildren(v.formTabs);if(!N.IsNullOrUndefined(r)){let n=r.length;this.insertTabAtIndex(t,n)}}get isfooterPresent(){return this.getChildren(v.formFooter).length>0}get displayCondition(){let t=this.getChildren(v.formDisplayConditions);return t.length>0?t[0]:null}set displayCondition(t){this.deleteChild(this.displayCondition),this.addChild(t)}get entityName(){return this._entityName}get formId(){return this._formId}set formId(t){this._formId=t}get rawFormXml(){return this._rawFormXml}set rawFormXml(t){this._rawFormXml=t}get status(){return this._status}set status(t){this._status=t}get formName(){return this._formName}set formName(t){this.trackObjectPropertyChange("_formName",t)}get formUniqueName(){return this._formUniqueName}set formUniqueName(t){this.trackObjectPropertyChange("_formUniqueName",t)}get formType(){return this._formType}get tabCount(){return this.allTabs.length}get description(){return this._description}set description(t){this.trackObjectPropertyChange("_description",t)}get formactivationstate(){return this._formactivationstate}set formactivationstate(t){this.trackObjectPropertyChange("_formactivationstate",t)}get entityDisplayName(){return this._entityDisplayName}set entityDisplayName(t){this._entityDisplayName=t}get etag(){return this._etag}set etag(t){this._etag=t}indexOfTab(t){return this.getAllGrandChildren(v.formTabs).indexOf(t)}get ControlDescriptions(){return this.getAllGrandChildren(v.controlDescriptions)}addControlDescriptionNode(t){this.addGrandChild(v.controlDescriptions,t)}deleteControlDescByForControlId(t){let r=this.getControlDescriptionByForControl(t);N.IsNullOrUndefined(r)||this.deleteFirstGrandChildOfName(v.controlDescriptions,r)}getControlDescriptionByForControl(t){if(!t)return null;for(let r of this.ControlDescriptions)if(r.forControl.guidString===t.guidString)return r;return null}cellHasCustomControlWithName(t,r){if(!t?.control||!r)return!1;let n=this.getControlDescriptionByForControl(t.control.UniqueId);return n?!!n.customControls.find(i=>i.name===r):!1}isDuplicateCell(t,r){return!!this.findFirst(i=>{if(!(i instanceof Et))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 Et&&i.control&&t.control&&a&&i.control.dataFieldName===t.control.dataFieldName})}isCellEditableGridControl(t){return!t?.control?.indicationOfSubgrid||t.control.ClassId.guidString.toUpperCase()!==S.CustomControl?!1:this.cellHasCustomControlWithName(t,wn.EditableGridControl)||LD.getConfig()?.enableOneGridEventsForFormDesigner&&this.cellHasCustomControlWithName(t,wn.PowerAppsOneGrid)}isCellCanvasAppControl(t){return t?.control?.ClassId.guidString.toUpperCase()===S.CustomControl&&this.cellHasCustomControlWithName(t,wn.CanvasAppControl)}findFormNodeById(t,r=this){return r===null?null:r.findFirst(n=>{if(n===this&&t===this.formId.ToString()||n.id?.ToString?.()===t)return!0})}findFormCellByClassId(t,r=this){return r?r.findFirst(n=>{if(n.getNodeName()===v.formCell){let i=n;return i&&i.control&&i.control.ClassId.guidString===t}return!1}):null}async getTabsJSON(t){let r=this.tabs,n=[],i=[];if(r){for(let a of r)if(!(a instanceof ni)){let o=a.toJSON(t);n.push(o)}for(let a of n)i.push(await a)}return i}async getControlDescriptionsToJSON(t){let r=[];for(let n of this.ControlDescriptions){let i=await n.toJSON(t);i&&r.push(i)}return r}async toJSON(t){let r=[];r=await this.getControlDescriptionsToJSON(t);let n=this.NavigationNode&&await this.NavigationNode.toJSON(t);return{Id:this._formId.guidString,Name:this.formName,Label:this.getDisplayName(t.langCode),ShowLabel:this.showlabel,Visible:this.visible,LabelId:this.labelId&&this.labelId.guidString,PreviewId:this._formId.guidString,PreviewSessionId:(0,lu.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===Ue.Main?{HeaderDensity:YV(this.headerDensityType,this.formType)}:{},InlineEditGridRow:[],InlineQuickForms:[],QuickFormEntities:[],EventHandlers:[],LinkControlSections:[],FormType:KV(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 uu,jf,WD=I(()=>{"use strict";Me();xe();K();He();Nn();uu=class extends st{constructor(t){super(v.formDisplayConditions,t)}get Order(){let t=this.getProperty(f.Order);return N.IsNullOrUndefined(t)?null:parseInt(t,10)}set Order(t){this.setProperty(f.Order,t.toString())}get FallbackForm(){return this.getProperty(f.FallbackForm)==="true"}set FallbackForm(t){this.setProperty(f.FallbackForm,t.toString())}addRoles(t){this.deleteAllChildren();for(let r=0;r<t.length;r++)this.addChild(t[r])}isRoleEveryone(){return!!(this.getChildren(v.formEveryOne)&&this.getChildren(v.formEveryOne)[0])}setRoleEveryone(){this.deleteAllChildren(),this.addChild(new jf(this))}},jf=class extends H{constructor(t){super(v.formEveryOne,t)}}});var cu,jD=I(()=>{"use strict";K();He();cu=class extends H{constructor(t,r){super(v.Handler,r),t.length>0&&this.setDefaultProperties(t)}setDefaultProperties(t){this.FunctionName=t[0],this.LibraryName=t[1],this.HandlerUniqueID=t[2],this.Enabled=t[3],this.Parameters=t[4],this.PassExecutionContext=t[5]}get HandlerUniqueID(){return this.getProperty(f.HandlerUniqueId)}set HandlerUniqueID(t){this.setProperty(f.HandlerUniqueId,t)}get FunctionName(){return this.getProperty(f.functionName)}set FunctionName(t){this.setProperty(f.functionName,t)}get LibraryName(){return this.getProperty(f.libraryNameEventHandler)}set LibraryName(t){this.setProperty(f.libraryNameEventHandler,t)}get Enabled(){return this.getProperty(f.enabledForField)}set Enabled(t){this.setProperty(f.enabledForField,t)}get PassExecutionContext(){return this.getProperty(f.passExecutionContext)}set PassExecutionContext(t){this.setProperty(f.passExecutionContext,t)}get Parameters(){return this.getProperty(f.parameters)}set Parameters(t){this.setProperty(f.parameters,t)}}});var pa,Hf=I(()=>{"use strict";K();Jo();pa=class extends Ar{constructor(t,r){super(t,r)}get cells(){let t=this.getRows(),r=[];if(this.rows&&t.length){for(let n of this.rows)if(n.cells){let i=n.getChildren(v.formCell);for(let a of i)r.push(a)}}return r}get occupiedCells(){return this.cells.filter(t=>!t.isEmpty())}get maxColumns(){return super.getColumnCountValue()}}});var Qo,HD=I(()=>{"use strict";K();Hf();Qo=class extends pa{_customFooter;constructor(t,r){super(v.formFooter,t),this._customFooter=r}get customFooter(){return this._customFooter}set customFooter(t){this._customFooter=t}async getControls(t){let r=[];if(this.rows){for(let n of this.rows)if(n.cells)for(let i of n.cells)i.control&&r.push(await i.control.toJSON(t))}return r}async toJSON(t){return{AvailableForPhone:this.availableforphone,Controls:await this.getControls(t),UniqueId:this.id&&this.id.guidString,PreviewId:this.id&&this.id.guidString}}isEmpty(){return!this.cells.find(t=>!!t.control)}}});var Xo,JD=I(()=>{"use strict";K();Hf();Xo=class extends pa{_customHeader;constructor(t,r){super(v.formHeader,t),this._customHeader=r}get customHeader(){return this._customHeader}set customHeader(t){this._customHeader=t}get showCommandBar(){return this.getProcessedValue(f.showCommandBar)}set showCommandBar(t){t!=null&&this.setProperty(f.showCommandBar,String(t))}get showBody(){return this.getProcessedValue(f.showBody)}set showBody(t){t!=null&&this.setProperty(f.showBody,String(t))}get showTabNavigator(){return this.getProcessedValue(f.showTabNavigator)}set showTabNavigator(t){t!=null&&this.setProperty(f.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 Nt,ii=I(()=>{"use strict";Me();ot();K();Nn();Nt=class e extends st{constructor(t,r){super(t,r)}getTitle(t){for(let r of this.getAllTitles())if(+r.getProperty(f.LCID)===t)return r.getProperty(f.text);return null}getAllTitles(){let t=this.getChildren(v.Titles);return t.length===0?[]:t[0].getChildren(v.Title)}setTitle(t,r){for(let i of this.getAllTitles())if(+i.getProperty(f.LCID)===r){i.setProperty(f.text,t);return}let n=new e(v.Title,null);n.setProperty(f.text,t),n.setProperty(f.LCID,String(r)),this.addGrandChild(v.Titles,n)}get Sequence(){return+this.getProperty(f.Sequence)}set Sequence(t){this.setProperty(f.Sequence,t.toString())}get Area(){return this.getProperty(f.Area)}set Area(t){this.setProperty(f.Area,t)}set Id(t){this.setProperty(f.Id,t)}get Id(){return this.getProperty(f.Id)}get id(){return new P(this.Id??"",!0)}set id(t){this.Id=t.guidString}get Show(){return!0}get Icon(){return this.getProperty(f.icon)}set Icon(t){t=t||T.EmptyString,this.setProperty(f.icon,t)}updateCommonProperties(t,r){this.Area=t.Area,this.Sequence=t.Sequence,this.setTitle(t.getDisplayName(r),r)}}});var Ko,QD=I(()=>{"use strict";(function(e){e[e.NavLinkNotAvailable=-1]="NavLinkNotAvailable",e[e.NavLinkIdConflict=-2]="NavLinkIdConflict",e[e.NavBarNotAvailable=-3]="NavBarNotAvailable"})(Ko||(Ko={}))});var du,XD=I(()=>{"use strict";xe();K();ii();QD();du=class extends Nt{constructor(t){super(v.formNavBar,t)}addChildElement(t){this.addChild(t)}getAllActiveNavBarChildren(){return this.getAllChildren().filter(n=>n.Show)}getAllInActiveActiveNavBarChildren(){return this.getAllChildren().filter(n=>!n.Show)}get AllRelationShipItems(){return this.getChildren("NavBarByRelationshipItem")}get AllNavLinkItems(){return this.getChildren("NavBarItem")}removeNavLink(t){let r=this.getNavBarLinkItemById(t);return N.IsNullOrUndefined(r)?Ko.NavLinkNotAvailable:r.length===1?this.deleteChild(r[0]):Ko.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 ge,ZV,KD,hte,fa,Jf=I(()=>{"use strict";Me();K();ii();(function(e){e.Info="_NA_Info",e.Sales="_NA_SFA",e.Service="_NA_CS",e.Marketing="_NA_MA",e.InternetMarketing="_NA_IMA",e.ProcessCenter="_NA_PROC",e.Async="_NA_AO"})(ge||(ge={}));ZV=new Map([[ge.Info,"Info"],[ge.Sales,"Sales"],[ge.Service,"Service"],[ge.Marketing,"Marketing"],[ge.ProcessCenter,"ProcessCenter"]]),KD=new Map([["Info",ge.Info],["Sales",ge.Sales],["Service",ge.Service],["Marketing",ge.Marketing],["ProcessCenter",ge.ProcessCenter]]),hte=new Map([[ge.Info,9e3],[ge.Sales,9200],[ge.Service,9400],[ge.Marketing,9600],[ge.ProcessCenter,9800],[ge.InternetMarketing,1e4],[ge.Async,10200]]),fa=class extends Nt{constructor(t,r){super(v.formNavBarArea,r)}setDefaultPropertiesByType(t,r,n){this.AreaId=ZV.get(t);let i=n?.(`navBarArea.title.${this.AreaId}`)??this.AreaId;this.setTitle(i,r)}get ParentNavigation(){return this.getAncestor(v.formNavigation)}get AreaId(){return this.getProperty(f.Id)}set AreaId(t){this.setProperty(f.Id,t)}get id(){return new P(this.AreaId??"",!0)}set id(t){this.AreaId=t.guidString}async toJSON(t){return{Id:this.AreaId,Titles:[{LCID:t.langCode,Text:this.getTitle(t.langCode)}],PreviewId:this.AreaId}}}});var ma,Qf=I(()=>{"use strict";K();ii();ma=class extends Nt{constructor(t,r){super(v.formNavBarAreas,r)}get AllNavBarAreaItems(){return this.getChildren(v.formNavBarArea)}get ParentNavigation(){return this.getAncestor(v.formNavigation)}addNavBarArea(t){this.addChild(t)}}});var pu,YD=I(()=>{"use strict";xe();K();ii();pu=class extends Nt{RelationshipNameUCIRuntime;constructor(t){super(v.formNavBarByRelationshipItem,t)}get RelationshipName(){return this.getProperty(f.RelationshipName)}set RelationshipName(t){this.setProperty(f.RelationshipName,t)}set Show(t){this.setProperty(f.Show,String(t))}get Show(){let t=this.getProperty(f.Show);return N.IsNullOrUndefined(t)||t==="true"}get TitleResourceId(){return this.getProperty(f.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 fu,ZD=I(()=>{"use strict";K();ii();fu=class extends Nt{constructor(t){super(v.formNavBarItem,t)}get Url(){return this.getProperty(f.url)}set Url(t){this.setProperty(f.url,t)}}});var mu,e2=I(()=>{"use strict";Me();K();Jf();Qf();ii();mu=class extends Nt{constructor(t,r){super(t,r)}getNavBarAreaByAreaName(t){let r=this.navBarAreas.AllNavBarAreaItems.filter(n=>n.AreaId===t);return r.length===0?null:r[0]}get navBarAreas(){return this.getFirstChild(v.formNavBarAreas)}setDefaultNavBarAreas(t,r){let n=[ge.Info,ge.Sales,ge.Service,ge.Marketing,ge.ProcessCenter];if(this.navBarAreas){let i=this.navBarAreas?.AllNavBarAreaItems;if(i&&i.length>0){let a=new Set(i.map(o=>KD.get(o.AreaId)));n=n.filter(o=>!a.has(o))}}else{let i=new ma(v.formNavBarAreas,this);i.isTransient=!0,this.addChild(i)}return n.length>0?(n.forEach(i=>{let a=new fa(v.formNavBarArea,this.navBarAreas);a.setDefaultPropertiesByType(i,t,r),this.navBarAreas.addNavBarArea(a)}),!0):!1}get navBar(){return this.getFirstChild(v.formNavBar)}get id(){return new P(Ep,!0)}replaceNavAreaToGivenIndex(t,r){this.navBarAreas?.AllNavBarAreaItems.indexOf(r)!==-1&&(this.deleteFirstGrandChildOfName(v.formNavBarAreas,r),this.addGrandChildAtIndex(v.formNavBarAreas,r,t))}async getNavBarAreasJSON(t){let r=[],n=[];if(this.navBarAreas?.AllNavBarAreaItems){for(let a of this.navBarAreas.AllNavBarAreaItems)n.push(a.toJSON(t));r=await Promise.all(n)}return r}async getNavBarRelationshipItemsJSON(t){let r=[],n=[];if(this.navBar?.AllRelationShipItems){for(let i of this.navBar.AllRelationShipItems)n.push(i.toJSON(t));r=await Promise.all(n)}return r}async toJSON(t){let r=await this.getNavBarAreasJSON(t),n=await this.getNavBarRelationshipItemsJSON(t);return{NavBarAreas:{NavBarAreas:r},NavBarByRelationshipItems:n,NavBarItems:[],NavPaneIsvItems:{NavBarIsvItems:[]},ShowEmptyNavBarAreas:t.formModelService.showHiddenElements}}}});var t2={};Rr(t2,{ControlType:()=>$t,DeserializationService:()=>Yf,DeserializationServiceScope:()=>Kf,DeserializedFormElementNode:()=>Dt});var Xf,Dt,Kf,$t,Yf,Vf=I(()=>{"use strict";Xf=se(Jn());Me();xe();ot();Bi();Np();Hn();kb();gw();$l();zD();Ho();nu();jo();Mf();K();K();WD();He();rr();Uf();jD();HD();Bf();$f();JD();Gf();zf();Jo();ou();XD();Jf();Qf();YD();ZD();e2();Dt=class extends H{constructor(t,r){super(t,r)}insertProperty(t,r){this.addProperty(t,r)}insertChild(t){this.addChild(t)}},Kf="DeserializationService";(function(e){e.Grid="Grid",e.Lookup="Lookup",e.Base="Base"})($t||($t={}));Yf=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 m="";throw d.length===0?m="FormXml has no form node.":m="FormXml has multiple form nodes.",(0,Xf.trackErrorTrace)(dt,{eventName:Kf,eventData:{error:m}}),new Error(m)}let p=this.createFormModel(d.item(0),r,n,i,a,o,s,l,u,c);return N.IsNullOrUndefined(p.displayCondition)&&s!==Ue.Dialog&&this.appendDefaultDisplayCondition(p),p}upsertFieldCount(t,r){let n=Qn.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 su(r,n,i,a,o,s,l,u,c);return this.populateElementProperties(d,t.attributes),this.populateElementChildren(d,t.childNodes),s===Ue.Main&&(this.insertHeaderFooterElementProperties(v.formHeader,d,d.header),this.insertHeaderFooterElementProperties(v.formFooter,d,d.footer)),d}insertHeaderFooterElementProperties(t,r,n){if(N.IsNullOrUndefined(n)){let i=t===v.formHeader?new Xo(r,!0):new Qo(r,!0);Dt.prototype.insertProperty.call(i,f.id,"{"+P.NewGuid()+"}"),Dt.prototype.insertProperty.call(i,f.Fieldlabelposition,"Top"),Dt.prototype.insertProperty.call(i,f.columnName,be.MarginalControlColumns),Dt.prototype.insertProperty.call(i,f.LabelWidth,be.LabelWidth),Dt.prototype.insertProperty.call(i,f.Fieldlabelalignment,"Left");let a=null,o=new ri(a);for(let s=0;s<i.maxColumns;s++){let l=new Et(o);Dt.prototype.insertProperty.call(l,f.id,"{"+P.NewGuid()+"}"),l.setDisplayName(T.EmptyString,this.lcid),Dt.prototype.insertProperty.call(l,f.showlabel,"false"),o.addCell(l)}i.appendRow(o),t===v.formHeader?r.header=i:r.footer=i}}deSerializeFormXmlNode(t,r){if(t&&t.nodeValue&&(t.nodeType===Node.TEXT_NODE||t.nodeType===Node.CDATA_SECTION_NODE))return new Dt(`<${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,Xf.trackErrorTrace)(dt,{eventName:Kf,eventData:{error:n}}),new Error(n)}for(let n=0;n<r.length;n++){let i=r.item(n);i&&(Dt.prototype.insertProperty.call(t,i.name,i.value),t.getNodeName()===v.formCell&&i.name===f.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&&Dt.prototype.insertChild.call(t,a)}}createModelNode(t,r){switch(t.nodeName){case v.form:throw new Error("Form node shouldn't be created using this method");case v.formTab:return new Jr(r);case v.formColumn:return new Dn(r);case v.formHeader:return new Xo(r,!1);case v.formFooter:return new Qo(r,!1);case v.formSection:return new Ar(v.formSection,r);case v.formRow:return new ri(r);case v.formCell:return new Et(r);case v.formControl:let n=t.attributes,i=t.childNodes.length>0?t.childNodes[0].childNodes:null,a;for(let s=0;s<n.length;s++){let l=n.item(s);if(l.name===f.indicationOfSubgrid&&l.value==="true"||l.name===f.classid&&(l.value?.toLocaleUpperCase()===`{${S.SubgridControl}}`||l.value?.toLocaleUpperCase()===`{${S.ReferencePanelSubgridControl}}`))a=$t.Grid;else if(l.name===f.classid&&l.value?.toLocaleUpperCase()===`{${S.LookupControl}}`)a=$t.Lookup;else if(l.name===f.classid&&l.value?.toLocaleUpperCase()===`{${S.CustomControl}}`)for(let u=0;u<i?.length;u++)i[u].nodeName===f.DefaultViewId&&(a=$t.Lookup)}return a===$t.Grid?new ua(r):a===$t.Lookup?new ca(r):new ar(r);case v.formEvent:return new la(r,T.EmptyString);case v.dependency:return this.populateDependencyTable(t),new sa(r,T.EmptyString);case v.Handler:let o=[];return new cu(o,r);case v.formNavigation:return new mu(t.nodeName,r);case v.formNavBarArea:return new fa(t.nodeName,r);case v.formNavBarAreas:return new ma(t.nodeName,r);case v.formNavBar:return new du(r);case v.formNavBarByRelationshipItem:return new pu(r);case v.formNavBarItem:return new fu(r);case v.formDisplayConditions:return new uu(r);case v.library:return new da(r,T.EmptyString,T.EmptyString);case v.controlDescription:return new Il(r);case v.customControl:return this.populateCustomControlConfigurationId(t),new Bl(r);default:return new Dt(t.nodeName,r)}}populateDependencyTable(t){let r=t.attributes;for(let n=0;n<r.length;n++){let i=r.item(n);i.name===f.id&&this.upsertFieldCount(i.value,vr.DependencyFieldTable)}}populateCustomControlConfigurationId(t){let r=t.attributes;for(let n=0;n<r.length;n++){let i=r.item(n);if(i.name===f.id){let a=new P(i.value.substr(1,i.value.length-2));for(let o=0;o<t.parentNode.attributes.length;o++){let s=t.parentNode.attributes.item(o);if(s.name===f.ForControl){let l=s.value.substr(1,i.value.length-2);Be.CustomControlIdMap.upsert(l,a);break}}break}}}}});var r2={};Rr(r2,{SerializationService:()=>Zf,SerializationServiceScope:()=>e9,SerializedFormElementNode:()=>ha});var e9,ha,Zf,n2=I(()=>{"use strict";ot();He();rr();Wf();e9="SerializationService",ha=class extends H{fetchNodeName(){return this.getNodeName()}enumerateProperties(){return this.getAllProperties()}enumerateChildren(){return this.getAllChildren()}},Zf=class{langCode;constructor(t){this.langCode=t}serializeFormXmlNode(t){let r=ha.prototype.fetchNodeName.call(t);if(r.charAt(0)===jr.StartTag)return T.EscapeXml(r.substr(1),!1);if(t.isTransient&&!t.isDirty())return T.EmptyString;let n=ha.prototype.enumerateProperties.call(t),i=ha.prototype.enumerateChildren.call(t);if(!(t instanceof ni)){let a=`<${r}`;if(n.length!==0&&(a+=` ${this.getPropertiesString(n)}`),i.length===0)a+=" />";else{let o=T.EmptyString;for(let s of i)o+=this.serializeFormXmlNode(s);a+=`>${o}</${r}>`}return a}return T.EmptyString}getPropertiesString(t){let r=T.EmptyString;return t.forEach((n,i)=>{i!==0&&(r+=" "),r+=`${n.key}="${T.EscapeXml(n.value,!0)}"`}),r}}});var In=g(hu=>{"use strict";Object.defineProperty(hu,"__esModule",{value:!0});hu.installDomShim=void 0;var i2=yl(),a2=!1,t9={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 r9(){if(a2)return;let e=globalThis;typeof e.DOMParser>"u"&&(e.DOMParser=i2.DOMParser),typeof e.XMLSerializer>"u"&&(e.XMLSerializer=i2.XMLSerializer),typeof e.Node>"u"&&(e.Node=t9),a2=!0}hu.installDomShim=r9});var C2=g(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.classIdForAttributeType=It.QUICK_VIEW_CLASS_ID=It.NOTES_CLASS_ID=It.SUBGRID_CLASS_ID=It.formRegistration=It.FormAdapter=void 0;var qt=(Me(),Fr(Ib)),n9=(xe(),Fr(_b)),i9=(He(),Fr(Tb)),lt=(K(),Fr(Pb)),Le=(Hn(),Fr(Ob)),a9=(Vf(),Fr(t2)),o9=(n2(),Fr(r2)),$e=mn(),o2=Yt(),ai=ur(),s9=Ud(),d2=yt(),nm=ee(),p2=In(),f2=Ei(),l9={[lt.FormType.Main]:"Main",[lt.FormType.QuickCreate]:"QuickCreate",[lt.FormType.QuickViewForm]:"QuickView",[lt.FormType.Card]:"Card"},em={Main:lt.FormType.Main,QuickCreate:lt.FormType.QuickCreate,QuickView:lt.FormType.QuickViewForm,Card:lt.FormType.Card},u9=new Map(Object.entries(Le.ControlClassId).map(([e,t])=>[String(t).toUpperCase(),e]));function m2(e){var t;return e&&(t=u9.get(e.toUpperCase()))!==null&&t!==void 0?t:"Unknown"}function Yo(e){return e.getAllProperties().map(t=>[t.key,t.value])}function oi(e){let t=new Map;for(let r of e.getAllProperties())t.has(r.key)||t.set(r.key,r.value);return t}function h2(e,t){return e.getAllChildren().find(r=>r.getNodeName()===t)}function im(e,t){var r,n;let i=h2(e,"labels");if(!i)return"";let a=i.getAllChildren().filter(s=>s.getNodeName()==="label"),o=(r=a.find(s=>oi(s).get("languagecode")===String(t)))!==null&&r!==void 0?r:a[0];return o&&(n=oi(o).get("description"))!==null&&n!==void 0?n:""}function c9(e){let t=h2(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 g2(e){return/^1+$/.test(e)&&e.length>=1&&e.length<=4?e.length:1}function tm(e){let t=Math.min(Math.max(Math.trunc(e),1),4);return"1".repeat(t)}function Zo(e){return String(e??"").replace(/[{}]/g,"")}function rm(e){return`{${Zo(e)}}`}function s2(e,t){if(e===void 0||e==="")return t;let r=Number(e);return Number.isNaN(r)?t:r}function vu(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,$e.rawFromNode)(u)})}),i<0)return{modeled:[],bag:{a:Yo(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,$e.rawFromNode)(u)})}),{modeled:s,bag:{a:Yo(e),c:a,w:{n:o.getNodeName(),a:Yo(o),c:l}}}}function v2(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,$e.rawFromNode)(a)})}),{modeled:n,bag:{a:Yo(e),c:i}}}function d9(e,t){let{modeled:r,bag:n}=vu(e,"tabs","tab");return{tabs:r.map(i=>p9(i,t)),bag:n}}function p9(e,t){var r,n;let i=oi(e),{modeled:a,bag:o}=vu(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:im(e,t),expanded:i.get("expanded")==="true",visible:i.has("visible")?i.get("visible")==="true":!0,columns:a.map(s=>f9(s,t)),bag:o}}function f9(e,t){let r=oi(e),{modeled:n,bag:i}=vu(e,"sections","section");return{width:r.get("width"),sections:n.map(a=>m9(a,t)),bag:i}}function m9(e,t){var r,n,i;let a=oi(e),{modeled:o,bag:s}=vu(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:im(e,t),visible:a.has("visible")?a.get("visible")==="true":!0,showLabel:a.get("showlabel")==="true",columns:g2((i=a.get("columns"))!==null&&i!==void 0?i:"1"),rows:o.map(l=>h9(l,t)),bag:s}}function h9(e,t){let{modeled:r,bag:n}=v2(e,"cell",!1);return{cells:r.map(i=>g9(i,t)),bag:n}}function g9(e,t){var r;let n=oi(e),{modeled:i,bag:a}=v2(e,"control",!0),o=im(e,t),s=n.get("showlabel")==="true",l=i[0]?v9(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:s2(n.get("colspan"),1),rowspan:s2(n.get("rowspan"),1),control:l,bag:a}}function v9(e,t,r){var n,i;let a=oi(e),o=Zo((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:m2(o),isRequired:a.get("isrequired")==="true",isReadOnly:a.get("disabled")==="true",label:t,showLabel:r,parameters:c9(e),bag:{a:Yo(e),c:e.getAllChildren().map((l,u)=>({i:u,node:(0,$e.rawFromNode)(l)}))}}}function ga(e){return e.a.length===0&&e.c.length===0&&!e.w}function y2(e,t){let r=e.a.find(n=>n[0]===t);return r?r[1]:void 0}function si(e,t){var r;let n=new Set(e.a.map(o=>o[0])),i=ga(e),a=[];for(let o of t)if(n.has(o.key)){let s=(r=y2(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,$e.mergeAttrs)(e.a,a)}var _n=(e,t)=>({key:e,matches:r=>r===t,render:()=>t,absentDefault:""}),Pn=(e,t,r=!1)=>({key:e,matches:n=>n==="true"===t,render:()=>String(t),absentDefault:String(r)}),l2=(e,t,r=1)=>({key:e,matches:n=>Number(n)===t,render:()=>String(t),absentDefault:String(r)});function am(e,t){return{n:"labels",a:[],c:[{n:"label",a:[["description",e],["languagecode",String(t)]],c:[]}]}}function b2(e){return{n:"parameters",a:[],c:Object.keys(e).map(t=>({n:(0,nm.assertXmlName)(t,"Form control parameter name"),a:[],c:[{n:`<${e[t]}`,a:[],c:[]}]}))}}function y9(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 b9(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 om(e,t,r){let n=e.c.findIndex(a=>a.node.n==="labels");if(n<0||y9(e.c[n].node,r)===t)return e;let i=b9(e.c[n].node,t,r);return{...e,c:e.c.map((a,o)=>o===n?{...a,node:i}:a)}}function w9(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 A9(e,t){let r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every(i=>e[i]===t[i])}function C9(e,t){return e.a.some(r=>r[0]===t)?{...e,a:e.a.filter(r=>r[0]!==t)}:e}function S9(e,t){let r=e.c.findIndex(i=>i.node.n==="parameters");if(r<0||A9(w9(e.c[r].node),t))return e;let n=b2(t);return{...e,c:e.c.map((i,a)=>a===r?{...i,node:n}:i)}}function yu(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,$e.spliceChildren)(e.w.c,r)};return(0,$e.spliceChildren)(e.c,[o])}let i=n(),a={n:t,a:[],c:r};return e.c.length===0?[...i,a]:(0,$e.spliceChildren)(e.c,[...i,a])}function E9(e,t){let r=e.tabs.map(n=>N9(n,t));return{n:"form",a:si(e.bag,[]),c:e.tabs.length===0&&ga(e.bag)?[]:yu(e.bag,"tabs",r,()=>[])}}function N9(e,t){let r=[_n("id",e.id),_n("name",e.name),Pn("expanded",e.expanded),Pn("visible",e.visible,!0)],n=e.columns.map(a=>D9(a,t)),i=om(e.bag,e.label,t);return{n:"tab",a:si(i,r),c:yu(i,"columns",n,()=>e.label?[am(e.label,t)]:[])}}function D9(e,t){let r=e.width!==void 0?[_n("width",e.width)]:[],n=e.sections.map(i=>I9(i,t));return{n:"column",a:si(e.bag,r),c:yu(e.bag,"sections",n,()=>[])}}function I9(e,t){let r=[_n("id",e.id),_n("name",e.name),Pn("showlabel",e.showLabel),Pn("visible",e.visible,!0),{key:"columns",matches:a=>g2(a)===e.columns,render:()=>tm(e.columns),absentDefault:tm(1)}],n=e.rows.map(a=>_9(a,t)),i=om(e.bag,e.label,t);return{n:"section",a:si(i,r),c:yu(i,"rows",n,()=>e.label?[am(e.label,t)]:[])}}function _9(e,t){let r=e.cells.map(n=>P9(n,t));return{n:"row",a:si(e.bag,[]),c:ga(e.bag)?r:(0,$e.assembleChildren)(e.bag,r)}}function P9(e,t){let r=e.control?e.control.showLabel:y2(e.bag,"showlabel")==="true",n=[_n("id",e.id),Pn("showlabel",r),Pn("visible",e.visible,!0),l2("colspan",e.colspan),l2("rowspan",e.rowspan)],i=e.control?[T9(e.control)]:[],a;if(ga(e.bag))a=[...e.control&&e.control.label?[am(e.control.label,t)]:[],...i];else{let o=e.control?om(e.bag,e.control.label,t):e.bag;a=(0,$e.assembleChildren)(o,i)}return{n:"cell",a:si(e.bag,n),c:a}}function T9(e){let t=[_n("id",e.id),{key:"classid",matches:i=>Zo(i)===e.classId,render:()=>rm(e.classId),absentDefault:""}];e.fieldName!==null&&t.push(_n("datafieldname",e.fieldName)),t.push(Pn("disabled",e.isReadOnly)),t.push(Pn("isrequired",e.isRequired));let r=e.fieldName===null?C9(e.bag,"datafieldname"):e.bag,n;return ga(r)?n=Object.keys(e.parameters).length>0?[b2(e.parameters)]:[]:n=(0,$e.assembleChildren)(S9(r,e.parameters),[]),{n:"control",a:si(r,t),c:n}}var O9={make:(e,t)=>new i9.FormElementNode(e,t),setProp:(e,t,r)=>e.setProperty(t,r),addChild:(e,t)=>e.addChild(t)};function u2(e,t,r){(0,p2.installDomShim)();let n=F9(e,r),i=(0,$e.rebuildRaw)(E9(n,t),O9,null);return new o9.SerializationService(t).serializeFormXmlNode(i)}function R9(e){return JSON.parse(JSON.stringify(e))}function F9(e,t){var r;let n=R9(e);n.bag||(n.bag=(0,$e.emptyBag)()),q9(n.bag),t&&x9(n,t);for(let i of(r=n.tabs)!==null&&r!==void 0?r:[])L9(i);return n}function x9(e,t){var r;let n=(r=e.entityLogicalName)!==null&&r!==void 0?r:"";w2(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=A2(s.attributeType)))})}function w2(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 L9(e){e.id||(e.id=qt.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)k9(t);e.bag||(e.bag=(0,$e.emptyBag)())}function k9(e){e.sections||(e.sections=[]);for(let t of e.sections)M9(t);e.bag||(e.bag=(0,$e.emptyBag)()),e.width===void 0&&ga(e.bag)&&(e.width="100%")}function M9(e){e.id||(e.id=qt.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)U9(t);e.bag||(e.bag=(0,$e.emptyBag)())}function U9(e){e.cells||(e.cells=[]);for(let t of e.cells)B9(t);e.bag||(e.bag=(0,$e.emptyBag)())}function B9(e){e.id||(e.id=qt.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&&$9(e.control),e.bag||(e.bag=(0,$e.emptyBag)())}function $9(e){var t;e.id||(e.id=qt.Guid.NewGuid()),e.classId===void 0&&(e.classId=String(Le.ControlClassId.TextboxControl)),e.fieldName===void 0&&(e.fieldName=null),e.type===void 0&&(e.type=e.fieldName?"Field":m2(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,nm.assertXmlName)(r,"Form control parameter name");e.bag||(e.bag=(0,$e.emptyBag)())}function q9(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"&&!c2(a,"handlerUniqueId")&&a.a.push(["handlerUniqueId",rm(qt.Guid.NewGuid())])}}else if(r.n==="formLibraries")for(let n of r.c)n.n==="Library"&&!c2(n,"libraryUniqueId")&&n.a.push(["libraryUniqueId",rm(qt.Guid.NewGuid())])}}var gu=class{constructor(t=f2.DEFAULT_LCID){this.lcid=t}toArtifact(t,r){var n,i,a;let{tabs:o,bag:s}=d9(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=l9[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:u2(t,this.lcid),formid:t.id||qt.Guid.NewGuid(),objecttypecode:t.entityLogicalName,type:em[t.formType],name:t.name,uniquename:t.name,description:(r=t.description)!==null&&r!==void 0?r:"",formpresentation:lt.FormPresentation.AirForm,formactivationstate:t.status==="Active"?lt.FormActivationState.Active:lt.FormActivationState.InActive})}fromApiResponse(t){var r,n,i,a,o,s,l;let u=t,c=this.deserialize({formxml:(r=u.formxml)!==null&&r!==void 0?r:"",formid:(n=u.formid)!==null&&n!==void 0?n:qt.Guid.NewGuid(),objecttypecode:(i=u.objecttypecode)!==null&&i!==void 0?i:"",type:u.type,name:(a=u.name)!==null&&a!==void 0?a:"",uniquename:(o=u.uniquename)!==null&&o!==void 0?o:"",description:(s=u.description)!==null&&s!==void 0?s:"",formpresentation:u.formpresentation,formactivationstate:u.formactivationstate});return this.toArtifact(c,(l=u.description)!==null&&l!==void 0?l:void 0)}toApiPayload(t,r,n){return{formxml:u2(t,this.lcid,n),name:t.name,type:em[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 w2(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 m=t.tabs&&t.tabs.length>0?void 0:X9(this.lcid),h=m!==void 0?m:t.tabs.map(E=>V9(E,this.lcid)).join(""),w=this.deserialize({formxml:`<form><tabs>${h}</tabs></form>`,formid:t.id||qt.Guid.NewGuid(),objecttypecode:(r=t.entityLogicalName)!==null&&r!==void 0?r:"",type:em[(n=t.formType)!==null&&n!==void 0?n:"Main"],name:(i=t.name)!==null&&i!==void 0?i:"New Form",uniquename:(a=t.name)!==null&&a!==void 0?a:"New Form",description:(o=t.description)!==null&&o!==void 0?o:"",formpresentation:lt.FormPresentation.AirForm,formactivationstate:((s=t.status)!==null&&s!==void 0?s:"Active")==="Active"?lt.FormActivationState.Active:lt.FormActivationState.InActive}),b=this.toArtifact(w,t.description);return{id:(l=t.id)!==null&&l!==void 0?l:b.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:b.tabs,bag:b.bag}}assignMissingIds(t){return(0,d2.assignMissingIds)(t)}validate(t){return Y9(t)}deserialize(t){(0,p2.installDomShim)();let r=n9.ScriptUtilities.ParseXml(t.formxml),n=new a9.DeserializationService(this.lcid).deSerializeFormXml(r,new qt.Guid(t.formid),t.objecttypecode,lt.FormState.Draft,t.name,t.uniquename,t.type,t.formpresentation,t.description,t.formactivationstate);if(!n)throw new Error("FormXml could not be deserialized into a Form model.");return n}readActivationStatus(t){return t.formactivationstate===lt.FormActivationState.InActive?"Inactive":"Active"}};It.FormAdapter=gu;function or(e){return String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function sm(e,t){return e?`<labels><label description="${or(e)}" languagecode="${t}" /></labels>`:""}function lm(e){return e&&e.length>0?Zo(e):(0,d2.newId)()}function V9(e,t){var r,n,i,a;let o=(r=e.columns)!==null&&r!==void 0?r:[],s=(o.length>0?o:[Q9()]).map(l=>G9(l,t)).join("");return`<tab id="{${or(lm(e.id))}}" name="${or((n=e.name)!==null&&n!==void 0?n:"")}" expanded="${(i=e.expanded)!==null&&i!==void 0?i:!0}" visible="${(a=e.visible)!==null&&a!==void 0?a:!0}">${sm(e.label,t)}<columns>${s}</columns></tab>`}function G9(e,t){var r,n;let i=((r=e.sections)!==null&&r!==void 0?r:[]).map(a=>z9(a,t)).join("");return`<column width="${or((n=e.width)!==null&&n!==void 0?n:"100%")}"><sections>${i}</sections></column>`}function z9(e,t){var r,n,i,a,o;let s=((r=e.rows)!==null&&r!==void 0?r:[]).map(l=>W9(l,t)).join("");return`<section id="{${or(lm(e.id))}}" name="${or((n=e.name)!==null&&n!==void 0?n:"")}" showlabel="${(i=e.showLabel)!==null&&i!==void 0?i:!1}" visible="${(a=e.visible)!==null&&a!==void 0?a:!0}" columns="${tm((o=e.columns)!==null&&o!==void 0?o:1)}">${sm(e.label,t)}<rows>${s}</rows></section>`}function W9(e,t){var r;return`<row>${((r=e.cells)!==null&&r!==void 0?r:[]).map(n=>j9(n,t)).join("")}</row>`}function j9(e,t){var r,n,i,a,o,s;let l=e.control,u=l?sm((n=(r=l.label)!==null&&r!==void 0?r:l.fieldName)!==null&&n!==void 0?n:"",t):"",c=l?H9(l):"";return`<cell id="{${or(lm(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 H9(e){var t,r,n;let i=e.fieldName?` datafieldname="${or(e.fieldName)}"`:"",a=J9(e.parameters),o=e.classId?Zo(e.classId):String(Le.ControlClassId.TextboxControl);return`<control id="${or((t=e.id)!==null&&t!==void 0?t:"")}" classid="{${or(o)}}"${i} disabled="${(r=e.isReadOnly)!==null&&r!==void 0?r:!1}" isrequired="${(n=e.isRequired)!==null&&n!==void 0?n:!1}">${a}</control>`}function J9(e){let t=Object.keys(e??{});return t.length===0?"":(t.forEach(n=>(0,nm.assertXmlName)(n,"Form control parameter name")),`<parameters>${t.map(n=>`<${n}>${or(e[n])}</${n}>`).join("")}</parameters>`)}function Q9(){return{width:"100%",sections:[],bag:{a:[],c:[]}}}function X9(e){return`<tab id="{${qt.Guid.NewGuid()}}" name="tab_general" expanded="true" visible="true"><labels><label description="General" languagecode="${e}" /></labels><columns><column width="100%"><sections><section id="{${qt.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 K9(e=f2.DEFAULT_LCID){return{adapter:new gu(e),api:s9.formApi,languageSensitive:!0,publish:(t,r,n)=>(0,o2.publishBoundEntity)(t,n),publishScope:(t,r)=>(0,o2.boundEntityPublishScope)(r)}}It.formRegistration=K9;function Y9(e){let t=[];return(0,ai.childObjects)(e,"tabs","","tab",t).forEach(({node:n,index:i})=>{(0,ai.childObjects)(n,"columns",`/tabs/${i}`,"column",t).forEach(({node:o,index:s})=>{let l=`/tabs/${i}/columns/${s}`;(0,ai.childObjects)(o,"sections",l,"section",t).forEach(({node:c,index:d})=>{let p=`${l}/sections/${d}`;(0,ai.childObjects)(c,"rows",p,"row",t).forEach(({node:h,index:w})=>{let b=`${p}/rows/${w}`;(0,ai.childObjects)(h,"cells",b,"cell",t).forEach(({node:D,index:F})=>{let x=D.control;x!=null&&!(0,ai.isJsonObject)(x)&&t.push((0,ai.issue)(`${b}/cells/${F}/control`,"control-must-be-object-or-null",`a cell control must be a JSON object or null, got ${typeof x}`))})})})})}),t}It.SUBGRID_CLASS_ID=Le.ControlClassId.SubgridControl;It.NOTES_CLASS_ID=Le.ControlClassId.TimelineControl;It.QUICK_VIEW_CLASS_ID=Le.ControlClassId.QuickViewControl;var Z9={Lookup:String(Le.ControlClassId.LookupControl),Customer:String(Le.ControlClassId.LookupControl),Owner:String(Le.ControlClassId.LookupControl),PartyList:String(Le.ControlClassId.PartyListControl),Boolean:String(Le.ControlClassId.BooleanControl),DateTime:String(Le.ControlClassId.DateTimeControl),Decimal:String(Le.ControlClassId.DecimalControl),Double:String(Le.ControlClassId.FloatingNumberControl),Money:String(Le.ControlClassId.CurrencyControl),Integer:String(Le.ControlClassId.IntegerControl),BigInt:String(Le.ControlClassId.IntegerControl),Memo:String(Le.ControlClassId.TextAreaControl),String:String(Le.ControlClassId.TextboxControl)},e8="3EF39988-22BB-4F0B-BBBE-64B5A3748AEE";function A2(e){return e==="Picklist"||e==="State"||e==="Status"?e8:e&&Z9[e]||String(Le.ControlClassId.TextboxControl)}It.classIdForAttributeType=A2;function c2(e,t){let r=e.a.find(n=>n[0]===t);return r?r[1]:void 0}});var um=g(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});va.viewApi=va.findDefaultViews=void 0;var E2=Kt(),Vt=ye(),Qr=ee(),t8="savedqueryid,name,description,fetchxml,layoutxml,querytype,returnedtypecode,isdefault",r8="savedqueryid,name,returnedtypecode,querytype,isdefault";async function n8(e,t,r={}){var n;let i=new Set(((n=r.excludeViewIds)!==null&&n!==void 0?n:[]).filter(Boolean)),a=`returnedtypecode eq '${(0,Qr.odataLiteral)(t)}' and querytype eq 0`,o=`/savedqueries${(0,Qr.odataQuery)([["$select","savedqueryid,name,isdefault"],["$filter",a]])}`;return(await(0,E2.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:"")}})}va.findDefaultViews=n8;async function i8(e,t){var r;let n=`/EntityDefinitions(LogicalName='${(0,Qr.odataLiteral)(t)}')${(0,Qr.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 S2(e,t,r){if(!r||!/<grid\b/.test(t)||/<grid[^>]*\bobject=/.test(t))return t;let n=await i8(e,r);return n===void 0?t:t.replace(/<grid\b/,`<grid object="${n}"`)}va.viewApi={async get(e,t){let n=`/savedqueries(${(0,Qr.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,Qr.odataQuery)([["$select",t8]]),i=(0,Vt.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,Vt.readEtag)(i)}},async list(e,t){let r=`/savedqueries${(0,Qr.odataQuery)([["$select",r8],["$filter",t?.entityLogicalName?`returnedtypecode eq '${(0,Qr.odataLiteral)(t.entityLogicalName)}'`:void 0]])}`;return(await(0,E2.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,Vt.echoWrite)("savedqueryid"),a=`/savedqueries${i.query}`,o=await S2(e,n.layoutxml,n.returnedtypecode),s=(0,Vt.ensureSuccess)(await e.post(a,(0,Vt.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,Vt.resolveCreatedId)(s,"savedqueryid","view",r),etag:(0,Vt.readEtag)(s)}},async update(e,t,r,n){let i=r,a=(0,Qr.normalizeGuid)(t,"id"),o=(0,Vt.echoWrite)("savedqueryid",{"If-Match":(0,Vt.requireEtag)(n,"view",a)}),s=`/savedqueries(${a})${o.query}`,l=await S2(e,i.layoutxml,i.returnedtypecode),u=(0,Vt.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,Vt.readEtag)(u)}},delete(e,t){return(0,Vt.deleteRecord)(e,"savedqueries",t)}}});var M2=g(ba=>{"use strict";Object.defineProperty(ba,"__esModule",{value:!0});ba.viewRegistration=ba.ViewAdapter=void 0;var ya=ur(),cm=mn(),li=Gn(),N2=Yt(),a8=um(),dm=In(),o8=yt(),P2=100,bu=class{toArtifact(t){var r,n,i,a,o,s,l,u;(0,dm.installDomShim)();let c=(r=t.fetchxml)!==null&&r!==void 0?r:"",d=(n=t.layoutxml)!==null&&n!==void 0?n:"",p=(0,li.parseXmlRoot)(c,"<fetch/>"),m=(0,li.parseXmlRoot)(d,"<grid/>");return{id:(i=t.savedqueryid)!==null&&i!==void 0?i:"",name:(a=t.name)!==null&&a!==void 0?a:"",description:(o=t.description)!==null&&o!==void 0?o:"",entityLogicalName:(s=t.returnedtypecode)!==null&&s!==void 0?s:s8(p),queryType:(l=t.querytype)!==null&&l!==void 0?l:0,isDefault:(u=t.isdefault)!==null&&u!==void 0?u:!1,columns:O2(m,p),filters:x2(p),sort:F2(p),fetchBag:c?(0,li.projectElementBag)(p):void 0,layoutBag:d?(0,li.projectElementBag)(m):void 0}}fromArtifact(t){(0,dm.installDomShim)();let{fetchxml:r,layoutxml:n}=D2(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,dm.installDomShim)();let{fetchxml:s,layoutxml:l}=D2(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,o8.newId)(),name:(i=t.name)!==null&&i!==void 0?i:"New View",description:(a=t.description)!==null&&a!==void 0?a:"",entityLogicalName:c,queryType:(o=t.queryType)!==null&&o!==void 0?o:0,isDefault:(s=t.isDefault)!==null&&s!==void 0?s:!1,columns:t.columns&&t.columns.length>0?t.columns:[{name:`${c}id`,width:300,order:0}],filters:(l=t.filters)!==null&&l!==void 0?l:{type:"and",conditions:[],groups:[]},sort:(u=t.sort)!==null&&u!==void 0?u:[]}}assignMissingIds(t){return t}validate(t){let r=[],n=t;(0,ya.childObjects)(n,"columns","","column",r),(0,ya.childObjects)(n,"sort","","sort",r);let i=n.filters;return i!=null&&((0,ya.isJsonObject)(i)?T2(i,"/filters",r):r.push((0,ya.issue)("/filters","filters-must-be-object",`filters must be a JSON object, got ${typeof i}`))),r}};ba.ViewAdapter=bu;function T2(e,t,r){(0,ya.childObjects)(e,"conditions",t,"condition",r),(0,ya.childObjects)(e,"groups",t,"filterGroup",r).forEach(({node:i,index:a})=>T2(i,`${t}/groups/${a}`,r))}function s8(e){var t;let r=e.getElementsByTagName("entity")[0];return(t=r?.getAttribute("name"))!==null&&t!==void 0?t:""}function O2(e,t){var r;let n=R2(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)?P2:c,order:o},p=n.get(u);p&&(d.relatedEntity=p),o+=1,a.push(d)}return a}function R2(e){var t;let r=new Map,n=e.getElementsByTagName("link-entity");for(let i=0;i<n.length;i+=1){let a=n[i],o=a.getAttribute("name");if(!o)continue;let s=a.getElementsByTagName("attribute");for(let l=0;l<s.length;l+=1){let u=s[l],c=(t=u.getAttribute("alias"))!==null&&t!==void 0?t:u.getAttribute("name");c&&r.set(c,o)}}return r}function F2(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 x2(e){let t=e.getElementsByTagName("entity")[0],r={type:"and",conditions:[],groups:[]};if(!t)return r;let n=Gt(t,"filter").filter(i=>!L2(i)).map(k2);return n.length===0?r:n.length===1?n[0]:{type:"and",conditions:[],groups:n}}function L2(e){if(Gt(e,"filter").length>0)return!1;let t=Gt(e,"condition");return t.length===0?!1:t.some(r=>r.getAttribute("isquickfindfields")==="1"||Gt(r,"value").length>0)}function k2(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(k2(l))}return{type:n,conditions:i,groups:a}}function Gt(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 D2(e){let t=l8(e.columns);if(!I2(e.fetchBag)||!I2(e.layoutBag))return{fetchxml:y8({...e,columns:t}),layoutxml:b8({...e,columns:t},`${e.entityLogicalName}id`)};let r=new DOMParser().parseFromString("<root/>","text/xml"),n=_2(e.fetchBag,"fetch",r),i=_2(e.layoutBag,"grid",r),a=O2(i,n),o=!pm(t,a),s=!pm(e.sort,F2(n)),l=!pm(e.filters,x2(n));return o&&(u8(r,n,t,a),f8(r,i,t)),s&&g8(r,n,e.sort),l&&v8(r,n,e.filters),{fetchxml:(0,li.serializeNode)(n),layoutxml:(0,li.serializeNode)(i)}}function l8(e){return(e??[]).map((t,r)=>{var n,i;return{name:String(t.name).toLowerCase(),width:(n=t.width)!==null&&n!==void 0?n:P2,order:(i=t.order)!==null&&i!==void 0?i:r,...t.relatedEntity?{relatedEntity:t.relatedEntity}:{}}})}function I2(e){return!!e&&(e.c.length>0||e.a.length>0)}function _2(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,li.domEngine)(r),null)}function u8(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}`)||c8(a,u);let s=R2(t),l=new Set(Gt(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=d8(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),p8(a,c),l.add(u.name)}}function c8(e,t){var r;if(t.relatedEntity){for(let n of Gt(e,"link-entity"))if(n.getAttribute("name")===t.relatedEntity){for(let i of Gt(n,"attribute"))if(((r=i.getAttribute("alias"))!==null&&r!==void 0?r:i.getAttribute("name"))===t.name){n.removeChild(i);return}}return}for(let n of Gt(e,"attribute"))if(n.getAttribute("name")===t.name){e.removeChild(n);return}}function d8(e,t,r){for(let i of Gt(t,"link-entity"))if(i.getAttribute("name")===r)return i;let n=e.createElement("link-entity");return n.setAttribute("name",r),t.appendChild(n),n}function p8(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 f8(e,t,r){let n=t.getElementsByTagName("row")[0];if(!n)return;let i=[...r].sort((s,l)=>s.order-l.order),a=m8(n);if(h8(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 m8(e){return Gt(e,"cell").filter(t=>!!t.getAttribute("name")&&t.getAttribute("ishidden")!=="1")}function h8(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 g8(e,t,r){let n=t.getElementsByTagName("entity")[0];if(n){for(let i of Gt(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 v8(e,t,r){let n=t.getElementsByTagName("entity")[0];if(n){for(let i of Gt(n,"filter"))L2(i)||n.removeChild(i);(r.conditions.length>0||r.groups.length>0)&&n.appendChild(fm(e,r))}}function pm(e,t){return JSON.stringify(e)===JSON.stringify(t)}function y8(e){let t=new DOMParser().parseFromString("<fetch/>","text/xml"),r=t.documentElement;r.setAttribute("version","1.0"),r.setAttribute("mapping","logical");let n=t.createElement("entity");n.setAttribute("name",e.entityLogicalName),r.appendChild(n);let i=new Map;for(let a of[...e.columns].sort((o,s)=>o.order-s.order)){let o=t.createElement("attribute");if(o.setAttribute("name",a.name),a.relatedEntity){let s=i.get(a.relatedEntity);s||(s=t.createElement("link-entity"),s.setAttribute("name",a.relatedEntity),n.appendChild(s),i.set(a.relatedEntity,s)),s.appendChild(o)}else n.appendChild(o)}for(let a of e.sort){let o=t.createElement("order");o.setAttribute("attribute",a.attribute),o.setAttribute("descending",String(a.descending)),n.appendChild(o)}return(e.filters.conditions.length>0||e.filters.groups.length>0)&&n.appendChild(fm(t,e.filters)),new XMLSerializer().serializeToString(t)}function fm(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(fm(e,n));return r}function b8(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 w8(){return{adapter:new bu,api:a8.viewApi,publish:(e,t,r)=>(0,N2.publishBoundEntity)(e,r),publishScope:(e,t)=>(0,N2.boundEntityPublishScope)(t)}}ba.viewRegistration=w8});var J2=g(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.appRegistration=Tn.AppAdapter=Tn.HEADER_NAV_BOOLEAN_RULE=void 0;var Xr=ur(),Je=mn(),ts=Gn(),A8=Yt(),C8=al(),mm=el(),hm=In(),S8=yt(),E8=ee(),G2=Ei(),N8=ie(),z2=rl();Object.defineProperty(Tn,"HEADER_NAV_BOOLEAN_RULE",{enumerable:!0,get:function(){return z2.HEADER_NAV_BOOLEAN_RULE}});var Cu="7.0.0.0",U2=`<SiteMap IntroducedVersion="${Cu}"></SiteMap>`,D8="/_imgs/imagestrips/transparent_spacer.gif",I8="/_imgs/TableIconsFluentV9/document_one_page_sparkle.svg",_8=["Entity","Url","DefaultDashboard","Page","GenPageId"],es="sitemapId",B2="sitemapName",P8="sitemapNameUnique";function $2(e,t,r){if(e===void 0)return r;if(typeof e!="boolean")throw new N8.ValidationError("app",t,[W2(e)]);return e}function W2(e){return(0,Xr.issue)("/headerAndNavigationRefresh",z2.HEADER_NAV_BOOLEAN_RULE,`headerAndNavigationRefresh must be a boolean, got ${typeof e}`)}function T8(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,E8.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 Su=class{constructor(t=G2.DEFAULT_LCID){this.lcid=t}toArtifact(t){let{bag:r,modeledEls:n}=wu(t,"Area");return{id:"",name:"",uniqueName:"",description:"",siteMap:{areas:n.map(i=>this.areaToJson(i)),bag:r},bag:(0,Je.emptyBag)()}}fromArtifact(t){(0,hm.installDomShim)();let r=this.assignMissingIds(JSON.parse(JSON.stringify(t))),n=new DOMParser().parseFromString("<root/>","text/xml"),i=this.rootToRaw(r);return(0,Je.rebuildRaw)(i,(0,ts.domEngine)(n),null)}fromApiResponse(t){var r,n,i,a,o,s,l,u,c,d;(0,hm.installDomShim)();let p=t??{},m=(r=p.$sitemap)!==null&&r!==void 0?r:p,h=(0,ts.parseXmlRoot)((n=m.sitemapxml)!==null&&n!==void 0?n:U2,U2),w=this.toArtifact(h);return w.id=(i=p.appmoduleid)!==null&&i!==void 0?i:"",w.name=(a=p.name)!==null&&a!==void 0?a:"",w.uniqueName=(o=p.uniquename)!==null&&o!==void 0?o:"",w.description=(s=p.description)!==null&&s!==void 0?s:"",w.bag={a:[[es,(u=(l=m.sitemapid)!==null&&l!==void 0?l:p._sitemapid_value)!==null&&u!==void 0?u:""],[B2,(c=m.sitemapname)!==null&&c!==void 0?c:""],[P8,(d=m.sitemapnameunique)!==null&&d!==void 0?d:""]],c:[]},w}toApiPayload(t){var r,n,i,a,o,s,l,u,c,d,p,m,h,w,b;(0,hm.installDomShim)();let E=(0,ts.serializeNode)(this.fromArtifact(t)),D=[],F=[];for(let q of(n=(r=t.siteMap)===null||r===void 0?void 0:r.areas)!==null&&n!==void 0?n:[])for(let G of(i=q.groups)!==null&&i!==void 0?i:[])for(let M of(a=G.subAreas)!==null&&a!==void 0?a:[])M.type==="Entity"&&M.entity?D.push(M.entity):M.type==="DashBoard"&&M.dashboardId&&F.push(M.dashboardId);let x=(o=t.bag)!==null&&o!==void 0?o:(0,Je.emptyBag)();return{sitemapId:(s=V2(x,es))!==null&&s!==void 0?s:"",sitemapxml:E,sitemapname:V2(x,B2)||t.name,appModuleId:t.id,appModuleName:t.name,appModuleDescription:t.description,appModuleUniqueName:t.uniqueName,...t.iconWebResourceId?{iconWebResourceId:t.iconWebResourceId}:{},...t.headerAndNavigationRefresh===void 0?{}:{appSettings:{[mm.HEADER_AND_NAVIGATION_REFRESH]:$2(t.headerAndNavigationRefresh,(l=t.id)!==null&&l!==void 0?l:"(unknown)",!0)?mm.APP_SETTING_ON:mm.APP_SETTING_OFF}},...typeof t.published=="boolean"?{published:t.published}:{},entities:D,components:{forms:(c=(u=t.components)===null||u===void 0?void 0:u.forms)!==null&&c!==void 0?c:[],views:(p=(d=t.components)===null||d===void 0?void 0:d.views)!==null&&p!==void 0?p:[],charts:(h=(m=t.components)===null||m===void 0?void 0:m.charts)!==null&&h!==void 0?h:[],dashboards:[...(b=(w=t.components)===null||w===void 0?void 0:w.dashboards)!==null&&b!==void 0?b:[],...F]}}}createDefault(t){var r,n,i,a,o,s;let l=!((r=t.siteMap)===null||r===void 0)&&r.areas&&t.siteMap.areas.length>0?t.siteMap.areas:[{id:"",title:"Area",groups:[{id:"",title:"Group",subAreas:[]}]}];return{id:(n=t.id)!==null&&n!==void 0?n:(0,S8.newId)(),name:(i=t.name)!==null&&i!==void 0?i:"New App",uniqueName:(a=t.uniqueName)!==null&&a!==void 0?a:"",description:(o=t.description)!==null&&o!==void 0?o:"",siteMap:{areas:l},...t.iconWebResourceId?{iconWebResourceId:t.iconWebResourceId}:{},headerAndNavigationRefresh:$2(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(ym):Array.isArray(r.areas)?r.areas.forEach(ym):Array.isArray(r.groups)?ym(r):Array.isArray(r.subAreas)?H2(r):"type"in r&&Eu(r,"subarea"),t}validate(t){let r=[],n=t.published;n!==void 0&&typeof n!="boolean"&&r.push((0,Xr.issue)("/published","published-must-be-boolean",`published must be a boolean, got ${typeof n}`));let i=t.siteMap,a=t.headerAndNavigationRefresh;if(a!==void 0&&typeof a!="boolean"&&r.push(W2(a)),i==null)return r;if(!(0,Xr.isJsonObject)(i))return r.push((0,Xr.issue)("/siteMap","sitemap-must-be-object",`siteMap must be a JSON object, got ${typeof i}`)),r;let o=(0,Xr.childObjects)(i,"areas","/siteMap","area",r),s=new Map;return o.forEach(({node:l,index:u})=>{let c=`/siteMap/areas/${u}`;(0,Xr.childObjects)(l,"groups",c,"group",r).forEach(({node:p,index:m})=>{let h=`${c}/groups/${m}`;(0,Xr.childObjects)(p,"subAreas",h,"subArea",r).forEach(({node:b,index:E})=>{let D=`${h}/subAreas/${E}`;(0,Xr.optionalEnum)(b,"type",["Entity","URL","DashBoard","CustomPage","GenPage"],D,"subarea-type-invalid",r);let F=T8(b);if(!F)return;let x=s.get(F);if(x===void 0){s.set(F,D);return}r.push((0,Xr.issue)(D,"subarea-duplicate-target",`the sitemap already navigates to this target at ${x}; a duplicate SubArea would pin it twice and a single removeElement would leave one behind`))})})}),r}applyServerIdentity(t,r){let n=r[es];if(!n)return;t.bag||(t.bag=(0,Je.emptyBag)());let i=t.bag.a.find(a=>a[0]===es);i?i[1]=n:t.bag.a.push([es,n])}areaToJson(t){var r;let{bag:n,modeledEls:i}=wu(t,"Group"),a={id:(r=t.getAttribute("Id"))!==null&&r!==void 0?r:"",title:gm(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}=wu(t,"SubArea");return{id:(r=t.getAttribute("Id"))!==null&&r!==void 0?r:"",title:gm(t,this.lcid),subAreas:i.map(a=>this.subAreaToJson(a)),bag:n}}subAreaToJson(t){var r;let{bag:n}=wu(t,null),i=O8(t),a={id:(r=t.getAttribute("Id"))!==null&&r!==void 0?r:"",type:i,title:gm(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!==D8&&(a.icon=o);let s=t.getAttribute("VectorIcon");return s&&(a.vectorIcon=s),a}rootToRaw(t){var r,n,i,a;let o=(n=(r=t.siteMap)===null||r===void 0?void 0:r.bag)!==null&&n!==void 0?n:(0,Je.emptyBag)(),l=Au(o)?[["IntroducedVersion",Cu]]:[],u=((a=(i=t.siteMap)===null||i===void 0?void 0:i.areas)!==null&&a!==void 0?a:[]).map(c=>this.areaToRaw(c));return{n:"SiteMap",a:(0,Je.mergeAttrs)(o.a,l),c:(0,Je.spliceChildren)(o.c,u)}}areaToRaw(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:(0,Je.emptyBag)(),i=Au(n),a=[];t.id&&a.push(["Id",t.id]),i&&a.push(["ShowGroups","true"],["ResourceId","SitemapDesigner.NewTitle"],["DescriptionResourceId","SitemapDesigner.NewTitle"],["IntroducedVersion",Cu]),t.icon!==void 0&&a.push(["Icon",t.icon]),t.vectorIcon!==void 0&&a.push(["VectorIcon",t.vectorIcon]);let o=t.groups.map(l=>this.groupToRaw(l)),s=vm((0,Je.spliceChildren)(n.c,o),t.title,i,this.lcid);return{n:"Area",a:(0,Je.mergeAttrs)(n.a,a),c:s}}groupToRaw(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:(0,Je.emptyBag)(),i=Au(n),a=[];t.id&&a.push(["Id",t.id]),i&&a.push(["ResourceId","SitemapDesigner.NewGroup"],["DescriptionResourceId","SitemapDesigner.NewGroup"],["ToolTipResourseId","SitemapDesigner.Unknown"],["IntroducedVersion",Cu],["IsProfile","false"]);let o=t.subAreas.map(l=>this.subAreaToRaw(l)),s=vm((0,Je.spliceChildren)(n.c,o),t.title,i,this.lcid);return{n:"Group",a:(0,Je.mergeAttrs)(n.a,a),c:s}}subAreaToRaw(t){var r;let n=(r=t.bag)!==null&&r!==void 0?r:(0,Je.emptyBag)(),i=Au(n),a=F8(n.a,t.type),o=[];t.id&&o.push(["Id",t.id]),L8(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]),t.vectorIcon!==void 0?o.push(["VectorIcon",t.vectorIcon]):t.type==="GenPage"&&!R8(a,"VectorIcon")&&o.push(["VectorIcon",I8]);let s=vm((0,Je.spliceChildren)(n.c,[]),t.title,i,this.lcid);return{n:"SubArea",a:(0,Je.mergeAttrs)(a,o),c:s}}};Tn.AppAdapter=Su;function wu(e,t){let r=(0,ts.nodeLikeFromDom)(e).getAllProperties().map(s=>[s.key,s.value]),n=[],i=[],a=e.childNodes,o=0;for(let s=0;s<a.length;s+=1){let l=a[s];l.nodeType!==1&&l.nodeType!==3||(l.nodeType===1&&t!==null&&l.tagName===t?i.push(l):n.push({i:o,node:(0,Je.rawFromNode)((0,ts.nodeLikeFromDom)(l))}),o+=1)}return{bag:{a:r,c:n},modeledEls:i}}function q2(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 gm(e,t){var r;let n=q2(e,"Titles")[0];if(!n)return"";let a=q2(n,"Title").find(o=>o.getAttribute("LCID")===String(t));return a&&(r=a.getAttribute("Title"))!==null&&r!==void 0?r:""}function O8(e){return e.getAttribute("GenPageId")?"GenPage":e.getAttribute("Entity")?"Entity":e.getAttribute("Page")?"CustomPage":e.getAttribute("DefaultDashboard")?"DashBoard":"URL"}function Au(e){return e.a.length===0&&e.c.length===0}function R8(e,t){return e.some(([r])=>r===t)}function V2(e,t){let r=e.a.find(([n])=>n===t);return r?r[1]:void 0}function F8(e,t){let r=x8(t);return e.filter(([n])=>!_8.includes(n)||r.has(n)).map(n=>[n[0],n[1]])}function x8(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 L8(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 vm(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]=k8(e[i],t,n),a}return r?[M8(t,n),...e]:e}function k8(e,t,r){let n=!1,i=e.c.map(a=>!n&&a.n==="Title"&&U8(a,"LCID")===String(r)?(n=!0,{n:a.n,a:(0,Je.mergeAttrs)(a.a,[["Title",t]]),c:a.c}):a);return n||i.unshift(j2(t,r)),{n:e.n,a:e.a.map(a=>[a[0],a[1]]),c:i}}function M8(e,t){return{n:"Titles",a:[],c:[j2(e,t)]}}function j2(e,t){return{n:"Title",a:[["LCID",String(t)],["Title",e]],c:[]}}function U8(e,t){let r=e.a.find(([n])=>n===t);return r?r[1]:void 0}function B8(e){let t="0123456789abcdef",r="";for(let n=0;n<e;n+=1)r+=t[Math.floor(Math.random()*t.length)];return r}function Eu(e,t){e&&(typeof e.id!="string"||e.id.length===0)&&(e.id=`${t}_${B8(8)}`)}function ym(e){var t;Eu(e,"area");for(let r of(t=e.groups)!==null&&t!==void 0?t:[])H2(r)}function H2(e){var t;Eu(e,"group");for(let r of(t=e.subAreas)!==null&&t!==void 0?t:[])Eu(r,"subarea")}function $8(e=G2.DEFAULT_LCID){return{adapter:new Su(e),api:C8.appApi,languageSensitive:!0,publish:(t,r)=>(0,A8.publishAppModule)(t,r),publishScope:t=>({envelope:"appmodule",targetIds:[t]})}}Tn.appRegistration=$8});var Q2={};Rr(Q2,{ActionType:()=>wm,AppActionOrigin:()=>_m,AppActionVisibilityType:()=>Im,ButtonType:()=>Cm,CannotUpdateAppActionColumns:()=>q8,Context:()=>Em,IconType:()=>Am,Location:()=>Sm,OnClickEventType:()=>Dm,Scope:()=>Nm,VisibilityType:()=>bm});var bm,wm,Am,Cm,Sm,Em,Nm,Dm,Im,_m,q8,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"})(bm||(bm={}));(function(e){e[e.NotSupported=0]="NotSupported",e[e.None=1]="None",e[e.JavaScript=2]="JavaScript",e[e.Expression=3]="Expression"})(wm||(wm={}));(function(e){e[e.NoIcon=0]="NoIcon",e[e.UseIcon=1]="UseIcon",e[e.UseWebResource=2]="UseWebResource"})(Am||(Am={}));(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"})(Sm||(Sm={}));(function(e){e[e.All=0]="All",e[e.Entity=1]="Entity"})(Em||(Em={}));(function(e){e[e.App=0]="App",e[e.Entity=1]="Entity",e[e.Global=2]="Global"})(Nm||(Nm={}));(function(e){e[e.None=0]="None",e[e.Formula=1]="Formula",e[e.JavaScript=2]="JavaScript"})(Dm||(Dm={}));(function(e){e[e.None=0]="None",e[e.Formula=1]="Formula",e[e.ClassicRules=2]="ClassicRules"})(Im||(Im={}));(function(e){e[e.Default=0]="Default",e[e.Migrated=1]="Migrated",e[e.MigratedClone=2]="MigratedClone"})(_m||(_m={}));q8=["appactionid","appmoduleid","context","contextvalue","location","name","type","uniquename","isdisabled","origin"]});var Y2=g(Nu=>{"use strict";Object.defineProperty(Nu,"__esModule",{value:!0});Nu.commandApi=void 0;var Rt=ye(),V8=ie(),zt=ee(),G8="OnClickEventJavaScriptWebResourceId($select=name,webresourceid),IconWebResourceId($select=name,webresourceid)";async function Pm(e,t){let r=`/EntityDefinitions(LogicalName='${(0,zt.odataLiteral)(t)}')${(0,zt.odataQuery)([["$select","MetadataId"]])}`,i=(0,Rt.ensureSuccess)(await e.get(r),e.apiUrl(r)).body,a=i?.MetadataId;return a?(0,zt.normalizeGuid)(a,"entityMetadataId"):""}Nu.commandApi={async get(e,t){var r;let n=t,i=await Pm(e,n),a=i?`_contextentity_value eq ${i}`:`contextvalue eq '${(0,zt.odataLiteral)(n)}'`,o=`/appactions${(0,zt.odataQuery)([["$expand",G8],["$filter",a]])}`,s=(0,Rt.ensureSuccess)(await e.get(o),e.apiUrl(o)),l=s.body,u=(r=l?.value)!==null&&r!==void 0?r:[],c={entityLogicalName:n,entityMetadataId:i,appActions:u},d={};for(let p of u){let m=typeof p.appactionid=="string"?p.appactionid:void 0;if(m){let h=p["@odata.etag"];d[(0,zt.normalizeGuid)(m,"appactionid")]=typeof h=="string"?h:null}}return{raw:c,etag:(0,Rt.readEtag)(s),memberEtags:d}},async list(e,t){let r=t?.entityLogicalName;return r?[{type:"command",id:r,name:`${r} commands`,entityLogicalName:r,isDirty:!1}]:[]},async create(e,t){let r=t,n=r.entityMetadataId||await Pm(e,r.entityLogicalName);return K2(e,{...r,entityMetadataId:n},!1)},async update(e,t,r,n,i){return K2(e,r,!0,i)},async delete(e,t){var r,n;let i=await Pm(e,t),a=i?`_contextentity_value eq ${i}`:`contextvalue eq '${(0,zt.odataLiteral)(t)}'`,o=`/appactions${(0,zt.odataQuery)([["$select","appactionid"],["$filter",a]])}`,l=(n=(r=(0,Rt.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[];for(let u of l)u.appactionid&&await(0,Rt.deleteRecord)(e,"appactions",u.appactionid)}};async function K2(e,t,r,n){let i=t.entityMetadataId?(0,zt.normalizeGuid)(t.entityMetadataId,"entityMetadataId"):"",a=W8(t.rows),o={};try{await z8(e,t,a,i,r,n,o)}catch(s){throw(0,V8.withPartialTokens)(s,{memberEtags:o})}return{id:t.entityLogicalName,etag:null,memberEtags:o}}async function z8(e,t,r,n,i,a,o){var s,l,u;for(let c of r)if(i&&c.exists){let d=(0,zt.normalizeGuid)(c.appactionid,"id"),p=(s=a?.[d])!==null&&s!==void 0?s:c.etag,m=(0,Rt.echoWrite)("appactionid",p?{"If-Match":p}:void 0),h=`/appactions(${d})${m.query}`,w=(0,Rt.ensureSuccess)(await e.patch(h,c.body,m.options),e.apiUrl(h));o[d]=(0,Rt.readEtag)(w)}else{let d=(0,Rt.echoWrite)("appactionid"),p=`/appactions${d.query}`,m={...c.body};n&&m["[email protected]"]===void 0&&(m["[email protected]"]=`/entities(${n})`);let h=(0,Rt.ensureSuccess)(await e.post(p,m,d.options),e.apiUrl(p)),w=(0,Rt.readCreatedId)(h,"appactionid");w&&(o[(0,zt.normalizeGuid)(w,"appactionid")]=(0,Rt.readEtag)(h))}for(let c of[...(l=t.deletedRowIds)!==null&&l!==void 0?l:[]].reverse()){let d=(0,zt.normalizeGuid)(c,"id");await(0,Rt.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 fI=g(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});wa.commandRegistration=wa.CommandAdapter=void 0;var qe=(X2(),Fr(Q2)),Z2=Yt(),Wt=ur(),j8=Y2(),tI=yt(),Aa=ee(),Om="$ClientSvg:",Rm=".svg",H8=2,J8=1,Q8=1,rI="entityMetadataId",X8=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"]),Du=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 m of l){let h=typeof m._parentappactionid_value=="string"&&m._parentappactionid_value?m._parentappactionid_value:"",w=(i=c.get(h))!==null&&i!==void 0?i:[];w.push(m),c.set(h,w)}let d=new Map;for(let m of(a=c.get(""))!==null&&a!==void 0?a:[]){let h=t6(m.location),w=(o=d.get(h))!==null&&o!==void 0?o:[];w.push(m),d.set(h,w)}let p=[];for(let[m,h]of d)p.push({location:m,groups:Y8(h,c,sI(m),u)});return{id:u,entityLogicalName:u,commandBars:e6(p),bag:{a:[[rI,(s=t.entityMetadataId)!==null&&s!==void 0?s:""]]}}}fromArtifact(t){return{entityLogicalName:t.entityLogicalName,entityMetadataId:xm(t),appActions:Tm(t).map(r=>r.row)}}fromApiResponse(t){return this.toArtifact(t??{})}toApiPayload(t,r){let n=new Set(r?Tm(r).map(l=>l.appactionid):[]),i=Tm(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?f6(l.row):pI(l.row)}}),s=[...n].filter(l=>!a.has(l));return{entityLogicalName:t.entityLogicalName,entityMetadataId:xm(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,tI.assignMissingIds)(t)}validate(t){let r=[];return(0,Wt.childObjects)(t,"commandBars","","commandBar",r).forEach(({node:i,index:a})=>{let o=`/commandBars/${a}`;(0,Wt.optionalEnum)(i,"location",["MainTab","ContextualTab","HomeTab"],o,"bar-location-invalid",r),(0,Wt.childObjects)(i,"groups",o,"group",r).forEach(({node:l,index:u})=>{let c=`${o}/groups/${u}`;(0,Wt.optionalGuidId)(l,"id",c,"group-id-invalid",r),nI((0,Wt.childObjects)(l,"controls",c,"control",r),`${c}/controls`,r)})}),r}};wa.CommandAdapter=Du;function nI(e,t,r){e.forEach(({node:n,index:i})=>{let a=`${t}/${i}`;(0,Wt.optionalGuidId)(n,"id",a,"control-id-invalid",r),(0,Wt.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,Wt.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,Wt.isJsonObject)(n.action)?(0,Wt.optionalEnum)(n.action,"type",["javascript"],`${a}/action`,"action-type-invalid",r):r.push((0,Wt.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,Wt.childObjects)(n,"children",a,"control",r);s.length>0&&nI(s,`${a}/children`,r)})}function iI(e){return{a:Object.entries(e)}}function K8(e){return Object.fromEntries(e.a)}function Fm(e,t){if(e){for(let[r,n]of e.a)if(r===t)return n}}function xm(e){let t=Fm(e.bag,rI);return typeof t=="string"?t:""}function Y8(e,t,r,n){var i,a;let o=[],s=[];for(let l of _u(e))l.type===qe.ButtonType.Group?o.push({id:oI(l.name,n),title:typeof l.grouptitle=="string"?l.grouptitle:"",controls:_u((a=t.get((i=l.appactionid)!==null&&i!==void 0?i:""))!==null&&a!==void 0?a:[]).map(u=>Iu(u,t,r,n)),bag:iI(l)}):s.push(Iu(l,t,r,n));return s.length>0&&o.unshift({id:(0,tI.newId)(),title:"",controls:s}),o}function Iu(e,t,r,n){var i,a,o,s;let l=oI(e.name,n),u={id:l,type:r6(e.type),label:typeof e.buttonlabeltext=="string"?e.buttonlabeltext:"",command:typeof e.appactionid=="string"?e.appactionid:l,bag:iI(e)},c=aI(e);c&&(u.icon=c);let d=Z8(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 m=[];for(let h of _u(p))if(h.type===qe.ButtonType.Group){u.flyoutGroupId=(a=h.appactionid)!==null&&a!==void 0?a:void 0;for(let w of _u((s=t.get((o=h.appactionid)!==null&&o!==void 0?o:""))!==null&&s!==void 0?s:[]))m.push(Iu(w,t,r,n))}else m.push(Iu(h,t,r,n));u.children=m}return u}function aI(e){var t;if(!((t=e.IconWebResourceId)===null||t===void 0)&&t.name)return e.IconWebResourceId.name;if(e.fonticon)return e.fonticon.startsWith(Om)?e.fonticon.slice(Om.length)+Rm:e.fonticon}function Z8(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 eI(e){return typeof e.sequence=="number"?e.sequence:typeof e.buttonsequencepriority=="number"?e.buttonsequencepriority:0}function _u(e){return[...e].sort((t,r)=>eI(t)-eI(r))}function e6(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 oI(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 t6(e){switch(e){case qe.Location.Form:case qe.Location.QuickForm:return"MainTab";case qe.Location.HomePageGrid:case qe.Location.Dashboard:return"HomeTab";default:return"ContextualTab"}}function sI(e){switch(e){case"MainTab":return qe.Location.Form;case"HomeTab":return qe.Location.HomePageGrid;default:return qe.Location.SubGridStandard}}function r6(e){switch(e){case qe.ButtonType.Dropdown:return"FlyoutAnchor";case qe.ButtonType.Split:return"SplitButton";default:return"Button"}}function n6(e){switch(e){case"FlyoutAnchor":return qe.ButtonType.Dropdown;case"SplitButton":return qe.ButtonType.Split;default:return qe.ButtonType.Standard}}function i6(e){var t;return e.bag&&e.bag.a.length>0?!0:((t=e.title)!==null&&t!==void 0?t:"").length>0}function lI(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 Tm(e,t=new Set){var r,n,i,a;let o=[],s=xm(e);for(let l of(r=e.commandBars)!==null&&r!==void 0?r:[]){let u=sI(l.location),c=((n=l.groups)!==null&&n!==void 0?n:[]).flatMap(m=>{var h;return(h=m.controls)!==null&&h!==void 0?h:[]}),d=c.length>0&&c.every(m=>!lI(m,t)),p=0;for(let m of(i=l.groups)!==null&&i!==void 0?i:[]){let h;if(i6(m)){let w=o6(m,u,void 0,e,s);o.push(w),h=w.appactionid}for(let w of(a=m.controls)!==null&&a!==void 0?a:[])uI(w,u,h,e,s,o,d?p:void 0,t),p+=1}}return o}function uI(e,t,r,n,i,a,o,s=new Set){var l;let u=a6(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||p6(u.appactionid);a.push(s6(d,t,u.appactionid,n,i));let p=c.every(m=>!lI(m,s));for(let[m,h]of c.entries())uI(h,t,d,n,i,a,p?m:void 0,s)}function a6(e,t,r,n,i,a){let o=cI(e,t,r,n,i),s=o.row;a!==void 0&&typeof s.sequence!="number"&&(s.sequence=a);let l=aI(s);return e.location!==void 0&&(s.location=e.location),s.type=n6(e.type),s.buttonlabeltext=e.label,l6(s,e.icon,l),c6(s,e.action),u6(s),e.hidden!==void 0&&(s.hidden=e.hidden),e.disabled!==void 0&&(s.isdisabled=e.disabled),{...o,row:s}}function o6(e,t,r,n,i){let a=cI(e,t,r,n,i);return a.row.type=qe.ButtonType.Group,a.row.grouptitle=e.title,a}function s6(e,t,r,n,i){let a=dI(e,t,n,i);return a["[email protected]"]=`/appactions(${(0,Aa.normalizeGuid)(r,"Command flyout group id")})`,a.type=qe.ButtonType.Group,a.grouptitle===void 0&&(a.grouptitle=""),a.isgrouptitlehidden=!0,{appactionid:e,exists:!1,etag:null,row:a}}function cI(e,t,r,n,i){let a,o,s,l;if(e.bag&&e.bag.a.length>0){a=K8(e.bag),o=!0;let u=Fm(e.bag,"@odata.etag");s=typeof u=="string"?u:null;let c=Fm(e.bag,"appactionid");l=typeof c=="string"&&c?c:e.id}else l=e.id,a=dI(l,t,n,i),o=!1,s=null;return r&&(a["[email protected]"]=`/appactions(${(0,Aa.normalizeGuid)(r,"Command parent appaction id")})`),{appactionid:l,exists:o,etag:s,row:a}}function dI(e,t,r,n){let i={appactionid:e,name:`${e}!${e.replace(/-/g,"").slice(0,32)}`,uniquename:"",location:t,context:qe.Context.Entity,contextvalue:r.entityLogicalName,scope:qe.Scope.Entity};return n&&(i["[email protected]"]=`/entities(${(0,Aa.normalizeGuid)(n,"Command context entity metadata id")})`),i}function l6(e,t,r){if(t===r){let n=e._iconwebresourceid_value;typeof n=="string"&&n&&!e.fonticon&&(e["[email protected]"]=`/webresourceset(${(0,Aa.normalizeGuid)(n,"Command icon web resource id")})`);return}if(t===void 0){e.fonticon="",e.IconWebResourceId=null;return}e.fonticon=t.toLowerCase().endsWith(Rm)?Om+t.slice(0,t.length-Rm.length):t,e.IconWebResourceId=null}function u6(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,Aa.normalizeGuid)(a,`Command ${i}`);e[`${i}@odata.bind`]=`/canvasapps(${o})`};e.onclickeventtype===J8&&t("_onclickeventformulacomponentlibraryid_value","OnClickEventFormulaComponentLibraryId");let r=e.visibilitytype;(!r||r===Q8)&&t("_visibilityformulacomponentlibraryid_value","VisibilityFormulaComponentLibraryId")}function c6(e,t){if(!(!t||t.type!=="javascript")){if(e.onclickeventtype=H8,t.webResourceId){let r=(0,Aa.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 d6(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 p6(e){let t="";for(let r=0;r<4;r+=1)t+=d6(`${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 pI(e){let t={...e};for(let r of X8)delete t[r];return t}function f6(e){let t=pI(e);for(let r of qe.CannotUpdateAppActionColumns)delete t[r];return t}function m6(){return{adapter:new Du,api:j8.commandApi,publish:(e,t,r)=>(0,Z2.publishBoundEntity)(e,r),publishScope:(e,t)=>(0,Z2.boundEntityPublishScope)(t)}}wa.commandRegistration=m6});var mI=g(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});Pu.chartApi=void 0;var h6=Kt(),jt=ye(),rs=ee(),g6="savedqueryvisualizationid,name,description,primaryentitytypecode,datadescription,presentationdescription,charttype,type,isdefault",v6="savedqueryvisualizationid,name,primaryentitytypecode,charttype,isdefault";Pu.chartApi={async get(e,t){let n=`/savedqueryvisualizations(${(0,rs.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,rs.odataQuery)([["$select",g6]]),i=(0,jt.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,jt.readEtag)(i)}},async list(e,t){let r=`/savedqueryvisualizations${(0,rs.odataQuery)([["$select",v6],["$filter",t?.entityLogicalName?`primaryentitytypecode eq '${(0,rs.odataLiteral)(t.entityLogicalName)}'`:void 0]])}`;return(await(0,h6.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,jt.echoWrite)("savedqueryvisualizationid"),a=`/savedqueryvisualizations${i.query}`,o=(0,jt.ensureSuccess)(await e.post(a,(0,jt.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,jt.resolveCreatedId)(o,"savedqueryvisualizationid","chart",r),etag:(0,jt.readEtag)(o)}},async update(e,t,r,n){let i=r,a=(0,rs.normalizeGuid)(t,"id"),o=(0,jt.echoWrite)("savedqueryvisualizationid",{"If-Match":(0,jt.requireEtag)(n,"chart",a)}),s=`/savedqueryvisualizations(${a})${o.query}`,l=(0,jt.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,jt.readEtag)(l)}},delete(e,t){return(0,jt.deleteRecord)(e,"savedqueryvisualizations",t)}}});var TI=g(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});Ca.chartRegistration=Ca.ChartAdapter=void 0;var Lm=mn(),hI=ur(),Kr=Gn(),gI=Yt(),y6=mI(),km=In(),b6=yt(),w6=["Column","StackedColumn","StackedColumn100","Bar","StackedBar","StackedBar100","Area","StackedArea","StackedArea100","Line","Pie","Doughnut","Funnel","Tag"],A6=new Map(w6.map(e=>[e.toLowerCase(),e]));function wI(e){var t;return e&&(t=A6.get(e.toLowerCase()))!==null&&t!==void 0?t:"Column"}function C6(){return'<Chart Palette="BrightPastel"><Series><Series ChartType="Column" ChartArea="Default" /></Series><ChartAreas><ChartArea Name="Default" /></ChartAreas><Legends><Legend Name="Default" /></Legends></Chart>'}function S6(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="${ns(u.series.attribute)}" aggregate="${ns(u.series.aggregate)}" />`).join("")+a.map(u=>`<attribute alias="${u.alias}" name="${ns(u.category.attribute)}" groupby="true"${u.category.dateGrouping?` dategrouping="${ns(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="${ns(n)}">${o}</entity></fetch></fetchcollection><categorycollection><category alias="${l}"><measurecollection>${s}</measurecollection></category></categorycollection></datadefinition>`}var Tu=class{toArtifact(t){var r,n,i,a,o,s,l;(0,km.installDomShim)();let u=(r=t.datadescription)!==null&&r!==void 0?r:"",c=(n=t.presentationdescription)!==null&&n!==void 0?n:"",d=(0,Kr.parseXmlRoot)(u,"<datadefinition/>"),p=(0,Kr.parseXmlRoot)(c,"<Chart/>");return{id:(i=t.savedqueryvisualizationid)!==null&&i!==void 0?i:"",name:(a=t.name)!==null&&a!==void 0?a:"",description:(o=t.description)!==null&&o!==void 0?o:"",entityLogicalName:(s=t.primaryentitytypecode)!==null&&s!==void 0?s:"",chartType:AI(p),isDefault:(l=t.isdefault)!==null&&l!==void 0?l:!1,series:EI(d),categories:NI(d),presentation:CI(p),dataBag:u?(0,Kr.projectElementBag)(d):void 0,presentationBag:c?(0,Kr.projectElementBag)(p):void 0,rowBag:E6(t.charttype,t.type)}}fromArtifact(t){(0,km.installDomShim)();let{datadescription:r,presentationdescription:n}=N6(t);return{savedqueryvisualizationid:t.id,name:t.name,description:t.description,primaryentitytypecode:t.entityLogicalName,datadescription:r,presentationdescription:n,charttype:vI(t.rowBag,"charttype"),type:vI(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,km.installDomShim)();let u=(r=t.entityLogicalName)!==null&&r!==void 0?r:"";return{id:(n=t.id)!==null&&n!==void 0?n:(0,b6.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,hI.childObjects)(n,"series","","series",r),(0,hI.childObjects)(n,"categories","","category",r),r}};Ca.ChartAdapter=Tu;function E6(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 vI(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 AI(e){let t=e.getElementsByTagName("Series");for(let r=0;r<t.length;r+=1)if(t[r].getAttribute("ChartType"))return wI(t[r].getAttribute("ChartType"));return"Column"}function CI(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 Ou(e){return e.getElementsByTagName("fetch")[0]}function SI(e){var t;let r=new Map;if(!e)return r;let n=e.getElementsByTagName("link-entity");for(let i=0;i<n.length;i+=1){let a=n[i],o=a.getAttribute("name");if(!o)continue;let s=a.getElementsByTagName("attribute");for(let l=0;l<s.length;l+=1){let u=s[l],c=(t=u.getAttribute("alias"))!==null&&t!==void 0?t:u.getAttribute("name");c&&r.set(c,o)}}return r}function EI(e){let t=Ou(e);if(!t)return[];let r=SI(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=wI(c));let d=o.getAttribute("alias");d&&(u.alias=d);let p=d??l,m=r.get(p);m&&(u.relatedEntity=m),i.push(u)}return i}function NI(e){var t;let r=Ou(e);if(!r)return[];let n=SI(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,m=n.get(p);m&&(u.relatedEntity=m),a.push(u)}return a}function N6(e){if(!yI(e.dataBag)||!yI(e.presentationBag))return{datadescription:S6(e),presentationdescription:W6(e)};let t=new DOMParser().parseFromString("<root/>","text/xml"),r=bI(e.dataBag,"datadefinition",t),n=bI(e.presentationBag,"Chart",t);return Mm(e.series,EI(r))||(I6(t,r,e.series),D6(t,n,e.series.length,e.chartType)),Mm(e.categories,NI(r))||_6(t,r,e.categories),e.chartType!==AI(n)&&_I(n,e.chartType),Mm(e.presentation,CI(n))||PI(n,e.presentation),{datadescription:(0,Kr.serializeNode)(r),presentationdescription:(0,Kr.serializeNode)(n)}}function yI(e){return!!e&&(e.c.length>0||e.a.length>0)}function D6(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 bI(e,t,r){let n={n:t,a:(0,Lm.mergeAttrs)(e.a,[]),c:(0,Lm.spliceChildren)(e.c,[])};return(0,Lm.rebuildRaw)(n,(0,Kr.domEngine)(r),null)}function I6(e,t,r){let n=Ou(t),i=n?.getElementsByTagName("entity")[0];!n||!i||DI(e,t,i,L6(n),r,M6,{aliasPrefix:"aggregate_column",addRef:O6,removeRef:x6})}function _6(e,t,r){let n=Ou(t),i=n?.getElementsByTagName("entity")[0];!n||!i||DI(e,t,i,k6(n),r,U6,{aliasPrefix:"groupby_column",addRef:R6,removeRef:F6})}function DI(e,t,r,n,i,a,o){let s=new Map;for(let p of n){let m=p.getAttribute("alias");m&&s.set(m,p)}let l=new Set,u=[];for(let p of i){let m=p.alias?s.get(p.alias):void 0;m&&!l.has(m)?(a(m,p),l.add(m)):u.push(p)}let c=n.filter(p=>!l.has(p)),d=0;for(let p of u)if(d<c.length){let m=c[d];a(m,p),l.add(m),d+=1}else{let m=e.createElement("attribute"),h=p.alias||T6(t,o.aliasPrefix);m.setAttribute("alias",h),a(m,p),B6(e,r,m,p.relatedEntity),o.addRef(e,t,h)}for(let p of n)if(!l.has(p)){let m=p.getAttribute("alias");m&&o.removeRef(t,m),q6(p)}}function P6(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 T6(e,t){let r=P6(e);if(!r.has(t))return t;for(let n=2;;n+=1){let i=`${t}_${n}`;if(!r.has(i))return i}}function II(e,t){let r=t.getElementsByTagName("categorycollection")[0];if(r)return r;let n=e.createElement("categorycollection");return t.appendChild(n),n}function O6(e,t,r){let n=II(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 R6(e,t,r){let n=II(e,t),i=e.createElement("category");i.setAttribute("alias",r),n.appendChild(i)}function F6(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 x6(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"&&!G6(o)&&((r=o.parentNode)===null||r===void 0||r.removeChild(o))}}function L6(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 k6(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 M6(e,t){e.setAttribute("name",t.attribute),e.setAttribute("aggregate",t.aggregate),t.seriesType&&e.setAttribute("charttype",t.seriesType)}function U6(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 B6(e,t,r,n){n?$6(e,t,n).appendChild(r):t.appendChild(r)}function $6(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 q6(e){let t=e.parentNode;if(t&&(t.removeChild(e),t.tagName==="link-entity"&&!V6(t))){let r=t.parentNode;r&&r.removeChild(t)}}function V6(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 G6(e){let t=e.childNodes;for(let r=0;r<t.length;r+=1)if(t[r].nodeType===1)return!0;return!1}function _I(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(!z6(r[i])){r[i].setAttribute("ChartType",t);return}}}function z6(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 PI(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 W6(e){let t=(0,Kr.parseXmlRoot)(C6(),"<Chart/>");return _I(t,e.chartType),PI(t,e.presentation),(0,Kr.serializeNode)(t)}function Mm(e,t){return JSON.stringify(e)===JSON.stringify(t)}function ns(e){return String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function j6(){return{adapter:new Tu,api:y6.chartApi,publish:(e,t,r)=>(0,gI.publishBoundEntity)(e,r),publishScope:(e,t)=>(0,gI.boundEntityPublishScope)(t)}}Ca.chartRegistration=j6});var OI=g(Ru=>{"use strict";Object.defineProperty(Ru,"__esModule",{value:!0});Ru.dashboardApi=void 0;var H6=Kt(),Ht=ye(),is=ee(),J6="formid,name,description,formxml,type,objecttypecode,istabletenabled,iscustomizable,componentstate,versionnumber",Q6="formid,name,type,objecttypecode",X6=0,K6=10;Ru.dashboardApi={async get(e,t){let n=`/systemforms(${(0,is.normalizeGuid)(t,"id")})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,is.odataQuery)([["$select",J6]]),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=[`(type eq ${X6} or type eq ${K6})`];t?.entityLogicalName&&r.push(`objecttypecode eq '${(0,is.odataLiteral)(t.entityLogicalName)}'`);let n=`/systemforms${(0,is.odataQuery)([["$select",Q6],["$filter",r.join(" and ")]])}`;return(await(0,H6.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,Ht.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,Ht.ensureSuccess)(await e.post(a,(0,Ht.withClientMintedId)(o,"formid",r),i.options),e.apiUrl(a));return{id:(0,Ht.resolveCreatedId)(s,"formid","dashboard",r),etag:(0,Ht.readEtag)(s)}},async update(e,t,r,n){let i=r,a=(0,is.normalizeGuid)(t,"id"),o=(0,Ht.echoWrite)("formid",{"If-Match":(0,Ht.requireEtag)(n,"dashboard",a)}),s=`/systemforms(${a})${o.query}`,l=(0,Ht.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,Ht.readEtag)(l)}},delete(e,t){return(0,Ht.deleteRecord)(e,"systemforms",t)}}});var GI=g(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.dashboardRegistration=Cr.TILE_CLASS_ID=Cr.DashboardAdapter=void 0;var os=mn(),Jt=Gn(),Um=Yt(),as=ur(),Y6=OI(),Bm=In(),ui=yt(),MI=ee(),UI=Ei(),RI="0",$m="10",Z6=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"]]),eG="{3FF9A528-DD50-4ACA-8F10-2E5ED73513AD}",xu=class{constructor(t=UI.DEFAULT_LCID){this.lcid=t}toArtifact(t){var r,n,i,a;(0,Bm.installDomShim)();let o=(r=t.formxml)!==null&&r!==void 0?r:"",s=(0,Jt.parseXmlRoot)(o,"<form/>");return{id:(n=t.formid)!==null&&n!==void 0?n:"",name:(i=t.name)!==null&&i!==void 0?i:"",description:(a=t.description)!==null&&a!==void 0?a:"",dashboardType:tG(t.type),entityLogicalName:t.objecttypecode?t.objecttypecode:null,enabledForMobile:!!t.istabletenabled,layoutType:rG(s),components:FI(s,this.lcid),bag:(0,Jt.projectElementBag)(s)}}fromArtifact(t){var r;return(0,Bm.installDomShim)(),{formid:t.id,name:t.name,description:t.description,type:t.dashboardType==="Interactive"?$m:RI,objecttypecode:(r=t.entityLogicalName)!==null&&r!==void 0?r:"",istabletenabled:t.enabledForMobile,formxml:xI(t,this.lcid)}}fromApiResponse(t){return this.toArtifact(t??{})}toApiPayload(t){return{name:t.name,description:t.description,formxml:xI(t,this.lcid),istabletenabled:t.enabledForMobile,type:t.dashboardType==="Interactive"?$m:RI,objecttypecode:t.entityLogicalName}}createDefault(t){var r,n,i,a,o,s,l,u;(0,Bm.installDomShim)();let c=(0,Jt.parseXmlRoot)(hG(),"<form/>");return{id:(r=t.id)!==null&&r!==void 0?r:(0,ui.newId)(),name:(n=t.name)!==null&&n!==void 0?n:"New Dashboard",description:(i=t.description)!==null&&i!==void 0?i:"",dashboardType:(a=t.dashboardType)!==null&&a!==void 0?a:"Standard",entityLogicalName:(o=t.entityLogicalName)!==null&&o!==void 0?o:null,enabledForMobile:(s=t.enabledForMobile)!==null&&s!==void 0?s:!1,layoutType:(l=t.layoutType)!==null&&l!==void 0?l:0,components:(u=t.components)!==null&&u!==void 0?u:FI(c,this.lcid),bag:(0,Jt.projectElementBag)(c)}}assignMissingIds(t){if(t&&typeof t=="object"&&!Array.isArray(t)&&"position"in t&&!("components"in t)){let r=t;(typeof r.id!="string"||r.id.length===0)&&(r.id=(0,ui.newId)())}return t}validate(t){let r=[],n=(0,as.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,as.isJsonObject)(u)&&r.push((0,as.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,as.isJsonObject)(a.position)){let l=ss(a.position);i.has(l)?r.push((0,as.issue)(`${s}/position`,"component-position-collision",`two components occupy the same dashboard position (${l}); move one to a free cell`)):i.add(l)}}),r}};Cr.DashboardAdapter=xu;function tG(e){return String(e??"")===$m?"Interactive":"Standard"}function rG(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 Q(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 FI(e,t){let r=[];return Q(e,"tabs").flatMap(i=>Q(i,"tab")).forEach((i,a)=>{Q(i,"columns").flatMap(s=>Q(s,"column")).forEach((s,l)=>{Q(s,"sections").flatMap(c=>Q(c,"section")).forEach((c,d)=>{nG(c,{tabIndex:a,columnIndex:l,sectionIndex:d},r,t)})})}),r}function nG(e,t,r,n){Q(e,"rows").flatMap(a=>Q(a,"row")).forEach((a,o)=>{Q(a,"cell").forEach((s,l)=>{let u=iG(s,{...t,rowIndex:o,cellIndex:l},n);u&&r.push(u)})})}function iG(e,t,r){var n,i,a;let o=qI((n=e.getAttribute("id"))!==null&&n!==void 0?n:"");if(o.toLowerCase().startsWith("spacer"))return null;let s=Q(e,"control")[0];if(!s)return null;let l=(i=s.getAttribute("classid"))!==null&&i!==void 0?i:"",u=sG(s),c=lG(l,u,s),d=aG(s);return{id:(a=s.getAttribute("id"))!==null&&a!==void 0?a:o,type:c,name:$I(e,r),classId:l,position:t,colspan:qm(e,"colspan",1),rowspan:qm(e,"rowspan",1),parameters:u,bag:(0,Jt.projectElementBag)(e),...d?{icProperties:d}:{}}}function BI(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 aG(e){let t=BI(e);return t?(0,Jt.serializeNode)(t):void 0}function oG(e,t,r){let n=BI(t);if(!r){n&&t.removeChild(n);return}let i=new DOMParser().parseFromString(r,"text/xml").documentElement,a=(0,os.rebuildRaw)((0,os.rawFromNode)((0,Jt.nodeLikeFromDom)(i)),(0,Jt.domEngine)(e),null);n&&(0,Jt.serializeNode)(n)===(0,Jt.serializeNode)(a)||(n?t.replaceChild(a,n):t.appendChild(a))}function $I(e,t){var r,n;let i=Q(e,"labels")[0];if(!i)return"";let a=Q(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 sG(e){var t;let r={},n=Q(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 lG(e,t,r){var n;let i=Z6.get(e.toUpperCase());return i?i==="chart"?t.ChartGridMode==="Chart"?"chart":"list":i==="assistant"&&((n=r.getAttribute("uniqueid"))!==null&&n!==void 0?n:"").toUpperCase()===eG?"assistant":i:"unknown"}function qm(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 qI(e){return e.replace(/^\{/,"").replace(/\}$/,"")}function uG(e,t){let r={n:"form",a:(0,os.mergeAttrs)(e.bag.a,[]),c:(0,os.spliceChildren)(e.bag.c,[])};return(0,os.rebuildRaw)(r,(0,Jt.domEngine)(t),null)}function xI(e,t){let r=new DOMParser().parseFromString("<root/>","text/xml"),n=uG(e,r);return pG(r,n,e.components,t),cG(r,n,e.components,t),(0,Jt.serializeNode)(n)}function cG(e,t,r,n){let i=VI(t);for(let a of r)i.has(ss(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=gG(t,e,l);for(let W of Q(u,"row"))Q(W,"cell").some($=>Q($,"control").length>0)||u.removeChild(W);let c=r.classId||Cr.TILE_CLASS_ID[r.type]||Cr.TILE_CLASS_ID.iframe,d=r.rowspan&&r.rowspan>0?r.rowspan:4,p=r.bag&&LI(r.bag,"id")?String(LI(r.bag,"id")):Fu((0,ui.newId)()),m=r.id?Fu(r.id):Fu((0,ui.newId)()),h=u.parentNode,w=Math.max(1,parseInt(h&&h.getAttribute&&h.getAttribute("columns")||"1",10)||1),b=Math.min(Math.max(1,r.colspan&&r.colspan>0?r.colspan:1),w),E=Q(u,"row"),D=E[E.length-1],F=D?Q(D,"cell").reduce((W,$)=>W+qm($,"colspan",1),0):0;(!D||F+b>w)&&(D=e.createElement("row"),u.appendChild(D));let x=e.createElement("cell");x.setAttribute("id",p),x.setAttribute("colspan",String(b)),x.setAttribute("rowspan",String(d)),x.setAttribute("showlabel","true");let q=e.createElement("labels"),G=e.createElement("label");G.setAttribute("description",(o=r.name)!==null&&o!==void 0?o:""),G.setAttribute("languagecode",String(n)),q.appendChild(G),x.appendChild(q);let M=e.createElement("control");M.setAttribute("id",m),M.setAttribute("classid",Fu(c));let U=e.createElement("parameters"),B=(s=r.parameters)!==null&&s!==void 0?s:{};for(let W of Object.keys(B)){let $=(0,MI.createSafeXmlElement)(e,W,"dashboard tile parameter");$.textContent=B[W],U.appendChild($)}M.appendChild(U),x.appendChild(M),D.appendChild(x)}function LI(e,t){if(!e)return;let r=e.a.find(n=>n[0]===t);return r?r[1]:void 0}function pG(e,t,r,n){var i;let a=VI(t),o=new Set(r.map(s=>ss(s.position)));for(let s of r){let l=a.get(ss(s.position));if(!l)continue;let u=Q(l,"control")[0];u&&(fG(e,l,s.name,n),mG(e,u,s.parameters),kI(l,"colspan",s.colspan),kI(l,"rowspan",s.rowspan),s.icProperties!==void 0&&oG(e,u,s.icProperties))}for(let[s,l]of a)o.has(s)||(i=l.parentNode)===null||i===void 0||i.removeChild(l)}function VI(e){let t=new Map;return Q(e,"tabs").flatMap(n=>Q(n,"tab")).forEach((n,i)=>{Q(n,"columns").flatMap(o=>Q(o,"column")).forEach((o,s)=>{Q(o,"sections").flatMap(u=>Q(u,"section")).forEach((u,c)=>{Q(u,"rows").flatMap(p=>Q(p,"row")).forEach((p,m)=>{Q(p,"cell").forEach((h,w)=>{var b;qI((b=h.getAttribute("id"))!==null&&b!==void 0?b:"").toLowerCase().startsWith("spacer")||Q(h,"control")[0]&&t.set(ss({tabIndex:i,columnIndex:s,sectionIndex:c,rowIndex:m,cellIndex:w}),h)})})})})}),t}function ss(e){let t=e??{};return`${t.tabIndex}.${t.columnIndex}.${t.sectionIndex}.${t.rowIndex}.${t.cellIndex}`}function fG(e,t,r,n){if(r===$I(t,n))return;let i=Q(t,"labels")[0];i||(i=e.createElement("labels"),t.appendChild(i));let a=Q(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 mG(e,t,r){var n;if(!r)return;let i=Object.keys(r);if(i.length===0)return;let a=Q(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,MI.createSafeXmlElement)(e,l,"dashboard component parameter");d.textContent=u,a.appendChild(d)}}}function kI(e,t,r){var n;((n=e.getAttribute(t))!==null&&n!==void 0?n:"")!==String(r)&&e.setAttribute(t,String(r))}function hG(e=2){let t=`{${(0,ui.newId)()}}`,r=`{${(0,ui.newId)()}}`,n=`{${(0,ui.newId)()}}`,i=Math.max(1,Math.floor(e));return`<form><tabs><tab id="${t}" name="General" showlabel="true" expanded="true" verticallayout="true"><columns><column width="100%"><sections><section id="${r}" name="Section 1" showlabel="false" columns="${i}"><rows><row><cell id="${n}" rowspan="12" colspan="${i}" showlabel="true" /></row></rows></section></sections></column></columns></tab></tabs></form>`}Cr.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 Fu(e){return`{${e.replace(/[{}]/g,"")}}`}function gG(e,t,r){var n;let i=Q(e,"tabs").flatMap(u=>Q(u,"tab"))[0];if(!i)throw new Error("addDashboardTile: dashboard formxml has no <tab>");let a=Q(i,"columns").flatMap(u=>Q(u,"column"))[0];if(!a)throw new Error("addDashboardTile: dashboard formxml has no <column>");let o=Q(a,"sections").flatMap(u=>Q(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=Q(s,"rows")[0];return l||(l=t.createElement("rows"),s.appendChild(l)),l}function vG(e=UI.DEFAULT_LCID){return{adapter:new xu(e),api:Y6.dashboardApi,languageSensitive:!0,publish:(t,r,n)=>n?.entityLogicalName?(0,Um.publishBoundEntity)(t,n):(0,Um.publishDashboardById)(t,r),publishScope:(t,r)=>r?.entityLogicalName?(0,Um.boundEntityPublishScope)(r):{envelope:"dashboard",targetIds:[t]}}}Cr.dashboardRegistration=vG});var QI=g(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.genPageApi=void 0;var JI=Kt(),De=ye(),_t=ee(),Sr=ie(),On="uxagentprojects",Ea="uxagentprojectfiles",Sa="uxagentprojectid",Er="uxagentprojectfileid",Lu=`${Sa},name`,yG=`${Er},filename,filetype`;async function Vm(e,t,r,n){var i;let a=`/${t}(${r})/Microsoft.Dynamics.CRM.RetrieveUnpublished()`+(0,_t.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 bG(e,t){let r=`/${Ea}(${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||Buffer.isBuffer(i))return{status:"available",data:Buffer.from(i).toString("base64")};if(i instanceof ArrayBuffer)return{status:"available",data:Buffer.from(new Uint8Array(i)).toString("base64")};if(typeof i=="string")return{status:"available",data:Buffer.from(i,"utf8").toString("base64")};throw new Sr.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 wG(e,t,r,n){if(!e.supportsBinaryPatch)throw new Sr.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=`/${Ea}(${t})/filecontent`,a=new Uint8Array(Buffer.from(n,"base64"));(0,_t.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 Gm(e,t){let r=`/${Ea}/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()`+(0,_t.odataQuery)([["$select",yG],["$filter",`_${Sa}_value eq ${t}`]]);return(await(0,JI.collectPages)(e,r,"fetchArtifact('genPage')")).map(i=>({row:i,etag:typeof i["@odata.etag"]=="string"?i["@odata.etag"]:null}))}async function zI(e,t,r){var n;let{etag:i}=await Vm(e,On,t,Lu),a={};for(let{row:l,etag:u}of await Gm(e,t))a[(0,_t.normalizeGuid)(String((n=l[Er])!==null&&n!==void 0?n:""),Er)]=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 WI(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}}ku.genPageApi={async get(e,t){var r;let n=(0,_t.normalizeGuid)(t,"id"),{row:i,etag:a}=await Vm(e,On,n,Lu),o=await Gm(e,n),s={},l=[];for(let{row:u,etag:c}of o){let d=(0,_t.normalizeGuid)(String((r=u[Er])!==null&&r!==void 0?r:""),Er);s[d]=c;let p=await bG(e,d);l.push({...u,content:p})}return{raw:{project:i,files:l},etag:a,memberEtags:s}},async list(e,t){let r=`/${On}/Microsoft.Dynamics.CRM.RetrieveUnpublishedMultiple()`+(0,_t.odataQuery)([["$select",Lu]]);return(await(0,JI.collectPages)(e,r,"listArtifacts('genPage')")).map(i=>{var a,o;return{type:"genPage",id:String((a=i[Sa])!==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;jI(e,n);let i=`/${On}`,a=(0,De.ensureSuccess)(await e.post(i,(0,De.withClientMintedId)({name:n.name},Sa,r)),e.apiUrl(i)),o=(0,De.resolveCreatedId)(a,Sa,"generative page",r),s=new Set;for(let l of n.files){let u=await HI(e,o,l,!0);s.add((0,_t.normalizeGuid)(u.id,"file id"))}try{return{id:o,...WI(o,await zI(e,o,s))}}catch(l){return{id:o,etag:null,memberEtags:{},warnings:[`The generative page was created, but re-reading its concurrency tokens failed (${l instanceof Error?l.message:String(l)}). The local baseline is unusable: re-fetch the page before editing it \u2014 the next push will refuse rather than overwrite blind.`]}}},async update(e,t,r,n,i){let a=r,o=(0,_t.normalizeGuid)(t,"id");jI(e,a);let s=await Gm(e,o),{etag:l}=await Vm(e,On,o,Lu);if(n&&l&&n!==l)throw new Sr.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 Sr.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:m})=>{var h;return(0,_t.normalizeGuid)(String((h=m[Er])!==null&&h!==void 0?h:""),Er)})),c=new Set(a.files.map(m=>(0,_t.normalizeGuid)(m.id,"file id")));if(!i)throw new Sr.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(m=>m.toLowerCase()));{for(let h of c)if(!u.has(h)&&d.has(h))throw new Sr.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 Sr.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 m=new Map(s.map(({row:h,etag:w})=>{var b;return[(0,_t.normalizeGuid)(String((b=h[Er])!==null&&b!==void 0?b:""),Er),w]}));for(let[h,w]of Object.entries(i??{})){let b=h.toLowerCase();if(!u.has(b))continue;let E=m.get(b);if(!w||!E)throw new Sr.SdkError(De.VERSION_CONFLICT_CODE,`Cannot verify generative-page file '${b}' before writing: ${w?"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(w!==E)throw new Sr.SdkError(De.VERSION_CONFLICT_CODE,`Generative-page file '${b}' changed on the server after this page was fetched (baseline ${w}, 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=`/${On}(${o})`;(0,De.ensureSuccess)(await e.patch(p,{name:a.name},{headers:{"If-Match":"*"}}),e.apiUrl(p));for(let m of a.files){let h=(0,_t.normalizeGuid)(m.id,"file id");await HI(e,o,m,!u.has(h))}for(let m of u)c.has(m)||await(0,De.deleteRecord)(e,Ea,m);try{return{id:o,...WI(o,await zI(e,o,c))}}catch(m){return{id:o,etag:null,memberEtags:{},warnings:[`The generative page was written, but re-reading its concurrency tokens failed (${m instanceof Error?m.message:String(m)}). 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,On,t)}};function jI(e,t){var r;if(((r=t.files)!==null&&r!==void 0?r:[]).some(i=>i.content.status==="available")&&!e.supportsBinaryPatch)throw new Sr.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 HI(e,t,r,n){let i=(0,_t.normalizeGuid)(r.id,"file id"),a;if(n){let o=`/${Ea}`,s=(0,De.ensureSuccess)(await e.post(o,(0,De.withClientMintedId)({filename:r.name,filetype:r.fileType,[`${Sa}@odata.bind`]:`/${On}(${t})`},Er,i)),e.apiUrl(o));a=(0,De.readEtag)(s)}else{let o=`/${Ea}(${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 wG(e,i,r.name,r.content.data),{id:i,etag:a}}});var ZI=g(Da=>{"use strict";Object.defineProperty(Da,"__esModule",{value:!0});Da.genPageRegistration=Da.GenPageAdapter=void 0;var AG=QI(),CG=Yt(),Rn=ur(),YI=yt(),XI=2e8;function KI(e){return typeof e=="string"&&e.trim()!==""?e:(0,YI.newId)()}function Na(e){return(0,Rn.isJsonObject)(e)?e:{}}function SG(e){let t=Na(e);return t.status==="available"&&typeof t.data=="string"?{status:"available",data:t.data}:{status:"unavailable",reason:"unpublished"}}var Mu=class{toArtifact(t){return t}fromArtifact(t){return t}fromApiResponse(t){var r,n;let i=t,a=Na(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=Na(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:XI),content:SG(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:KI(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:KI(i.id),name:(a=i.name)!==null&&a!==void 0?a:"index.tsx",fileType:(o=i.fileType)!==null&&o!==void 0?o:XI,content:(s=i.content)!==null&&s!==void 0?s:{status:"available",data:""}}})}}assignMissingIds(t){let r=Na(t);return(typeof r.id!="string"||r.id.trim()==="")&&(r.id=(0,YI.newId)()),r}validate(t){let r=[],n=t.files;if(n!==void 0&&!Array.isArray(n))return r.push((0,Rn.issue)("/files","files-must-be-array",`files must be an array, got ${typeof n}`)),r;let i=new Map;return(Array.isArray(n)?n:[]).forEach((a,o)=>{let s=`/files/${o}`,l=Na(a),u=typeof l.id=="string"?l.id.trim().toLowerCase():"";if(u==="")r.push((0,Rn.issue)(s,"file-id-required","a generative-page file needs an id"));else{let m=i.get(u);m!==void 0?r.push((0,Rn.issue)(s,"file-id-duplicate",`two files share the id '${l.id}' (also at /files/${m}); a file's id is its identity, so a duplicate makes an edit ambiguous`)):i.set(u,o)}let c=typeof l.name=="string"?l.name:"";(c===""||/[\u0000-\u001F\u007F]/.test(c)||/[\\/]/.test(c))&&r.push((0,Rn.issue)(s+"/name","file-name-invalid",`a file name must be a non-empty single path segment with no control characters or path separators (it is sent as an HTTP header on upload); got '${c}'`));let d=l.content;if(d===void 0){r.push((0,Rn.issue)(s+"/content","file-content-required","content is required: omitting it is indistinguishable from an empty file, and the two have opposite effects on the next push"));return}let p=Na(d);p.status==="available"?typeof p.data!="string"&&r.push((0,Rn.issue)(s+"/content/data","file-content-data-invalid","available content needs base64 `data`")):p.status!=="unavailable"&&r.push((0,Rn.issue)(s+"/content/status","file-content-status-invalid",`content.status must be 'available' or 'unavailable', got ${String(p.status)}`))}),r}};Da.GenPageAdapter=Mu;function EG(){return{adapter:new Mu,api:AG.genPageApi,publish:(e,t)=>(0,CG.publishGenPageById)(e,t),publishScope:e=>({envelope:"uxagentproject",targetIds:[e]})}}Da.genPageRegistration=EG});var t_=g(Bu=>{"use strict";Object.defineProperty(Bu,"__esModule",{value:!0});Bu.reconcileBpfSecurityRoles=void 0;var Uu=ye(),zm=ee(),NG="Global",e_={create:"Create",read:"Read",write:"Write",delete:"Delete"};async function DG(e,t){var r,n;let i=`/EntityDefinitions(LogicalName='${t}')?$select=LogicalName,Privileges`,o=(n=(r=(0,Uu.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(e_).forEach(u=>{let c=o.find(d=>d.PrivilegeType===e_[u]);if(c){let d=(0,zm.normalizeGuid)(c.PrivilegeId,"PrivilegeId");s[u]=d,l.add(d)}}),{byAccess:s,all:l}}async function IG(e,t){var r,n;let i=`/RetrieveRolePrivilegesRole(RoleId=${t})`,o=(n=(r=(0,Uu.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,zm.normalizeGuid)(s.PrivilegeId,"PrivilegeId")))}async function _G(e,t,r){if(r.length===0)return;let n={Privileges:r.map(a=>({Depth:NG,PrivilegeId:a}))},i=`/roles(${t})/Microsoft.Dynamics.CRM.AddPrivilegesRole`;(0,Uu.ensureSuccess)(await e.post(i,n),e.apiUrl(i))}async function PG(e,t,r){let n={Privilege:{"@odata.type":"Microsoft.Dynamics.CRM.privilege",privilegeid:r}},i=`/roles(${t})/Microsoft.Dynamics.CRM.RemovePrivilegeRole`;(0,Uu.ensureSuccess)(await e.post(i,n),e.apiUrl(i))}async function TG(e,t,r){var n;if(!r||r.length===0)return;let i=await DG(e,t.toLowerCase());for(let a of r){let o=(0,zm.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 IG(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 _G(e,o,c);for(let p of d)await PG(e,o,p)}}Bu.reconcileBpfSecurityRoles=TG});var o_=g(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});qu.bpfApi=void 0;var Fn=Mn(),OG=Kt(),Qt=ye(),Nr=ee(),RG=t_(),$u={"Content-Type":"application/json",Accept:"application/json"},FG=`category eq ${Fn.WorkflowCategory.BusinessProcessFlow} and type eq ${Fn.WorkflowTypeCode.Definition} and businessprocesstype eq ${Fn.BusinessProcessType.BusinessFlow}`,xG="workflowid,name,description,primaryentity,statecode,category,type,businessprocesstype,processorder",LG="workflowid,name,uniquename,description,primaryentity,statecode,statuscode,category,type,businessprocesstype,processorder,xaml,clientdata",kG=["xaml","name","description","processorder"];async function r_(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,RG.reconcileBpfSecurityRoles)(e,n,t.securityRoles)}async function Wm(e,t,r){var n;if(r==="Draft")return null;let i=(0,Nr.normalizeGuid)(t,"workflowid"),a={statecode:Fn.StateCode.Activated,statuscode:Fn.StatusCode.Activated},o=`/workflows(${i})`,s=(0,Qt.ensureSuccess)(await e.patch(o,a,{headers:$u}),e.apiUrl(o));return(n=(0,Qt.readEtag)(s))!==null&&n!==void 0?n:await a_(e,i)}async function a_(e,t){let r=`/workflows(${t})${(0,Nr.odataQuery)([["$select","workflowid"]])}`,n=await e.get(r);return n.status>=200&&n.status<300?(0,Qt.readEtag)(n):null}async function MG(e,t){var r;let n=`/workflows(${t})${(0,Nr.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 n_(e,t,r){if(await MG(e,t)!==Fn.StateCode.Activated)return!1;let n={statecode:Fn.StateCode.Draft,statuscode:Fn.StatusCode.Draft},i=`/workflows(${t})`,a={...$u};return r&&(a["If-Match"]=r),(0,Qt.ensureSuccess)(await e.patch(i,n,{headers:a}),e.apiUrl(i)),!0}async function i_(e,t){try{await Wm(e,t,"Active")}catch{}}function UG(e){let t={};for(let r of kG)e[r]!==void 0&&(t[r]=e[r]);return t}qu.bpfApi={async get(e,t){let n=`/workflows(${(0,Nr.normalizeGuid)(t,"id")})${(0,Nr.odataQuery)([["$select",LG]])}`,i=(0,Qt.ensureSuccess)(await e.get(n),e.apiUrl(n));return{raw:i.body,etag:(0,Qt.readEtag)(i)}},async list(e,t){let r=[FG];t?.entityLogicalName&&r.push(`primaryentity eq '${(0,Nr.odataLiteral)(t.entityLogicalName)}'`);let n=`/workflows${(0,Nr.odataQuery)([["$select",xG],["$filter",r.join(" and ")]])}`;return(await(0,OG.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,Nr.normalizeGuid)(r.record.workflowid,"workflowid"),i="/workflows",a=(0,Qt.ensureSuccess)(await e.post(i,r.record,{headers:$u}),e.apiUrl(i)),o=null;try{o=await Wm(e,n,r.status),await r_(e,r)}catch(s){try{await(0,Qt.deleteRecord)(e,"workflows",n)}catch{}throw s}return{id:n,etag:o??(0,Qt.readEtag)(a)}},async update(e,t,r,n){var i;let a=r,o=(0,Nr.normalizeGuid)(t,"id"),s=await n_(e,o,n);try{let l=`/workflows(${o})`,u={...$u};n&&!s&&(u["If-Match"]=n);let c=(0,Qt.ensureSuccess)(await e.patch(l,UG(a.record),{headers:u}),e.apiUrl(l)),d=await Wm(e,o,a.status);return await r_(e,a),{id:o,etag:(i=d??(0,Qt.readEtag)(c))!==null&&i!==void 0?i:await a_(e,o)}}catch(l){throw s&&await i_(e,o),l}},async delete(e,t){let r=(0,Nr.normalizeGuid)(t,"id"),n=await n_(e,r,null);try{await(0,Qt.deleteRecord)(e,"workflows",r)}catch(i){throw n&&await i_(e,r),i}}}});var G_=g(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});Pa.bpfRegistration=Pa.BpfAdapter=void 0;var Ia=ys(),BG=yl(),Vu=Mn(),$G=o_(),jm=mn(),ci=Gn(),b_=In(),Ft=ur(),xn=yt(),Dr=ie(),qG=100,Jm='<?xml version="1.0" encoding="utf-16"?>',s_=1033,w_="mxswa:Workflow",VG="mxswa:ActivityReference.Properties",GG="mcwo:StepLabel",zG="mcwb:Control",l_="mcwb:Control.ControlDisplayName",A_="mcwb:Control.DataFieldName",C_="DataFieldName",u_="ControlDisplayName",S_="Literal",Gu="x:Null",c_="x:String",Qm="x:Key",Xm="DisplayName",Wu="Activities",WG="StepLabels",E_="StageId",N_="StageCategory",D_="NextStageId",I_="ProcessStepId",Km="IsProcessRequired",__="EntityComposite",P_="StageComposite",T_="StepComposite";function Hm(e){return(0,Ft.isJsonObject)(e)?e:{}}function Ir(e){if(!e)return[];let t=[],r=e.childNodes;for(let n=0;n<r.length;n+=1){let i=r[n];i.nodeType===1&&t.push(i)}return t}function di(e,t){var r;return(r=Ir(e).find(n=>n.tagName===t))!==null&&r!==void 0?r:null}function _r(e){return di(e,VG)}function mt(e,t){var r;return(r=Ir(e).find(n=>n.getAttribute(Qm)===t))!==null&&r!==void 0?r:null}function _a(e,t){var r;return((r=e.getAttribute("AssemblyQualifiedName"))!==null&&r!==void 0?r:"").includes(t)}function Zr(e){var t;return!e||!e.firstChild?"":(t=e.firstChild.nodeValue)!==null&&t!==void 0?t:""}function O_(e,t,r){e.firstChild?e.firstChild.nodeValue=r:e.appendChild(t.createTextNode(r))}function ls(e){var t;let r=(t=e.getAttribute(Xm))!==null&&t!==void 0?t:"",n=r.indexOf(": ");return n>=0?r.slice(n+2):r}function R_(e,t){var r;let n=(r=e.getAttribute(Xm))!==null&&r!==void 0?r:"",i=n.indexOf(": ");e.setAttribute(Xm,i>=0?n.slice(0,i+2)+t:t)}function F_(e,t){let r=mt(e,WG),n=di(r,GG);n&&n.setAttribute("Description",t)}function jG(e){let t=mt(e,N_);if(!t||t.tagName===Gu)return;let r=Zr(t).trim();return r===""?void 0:Number(r)}function HG(e){let t=mt(e,D_);if(!t||t.tagName===Gu)return;let r=Zr(t).trim();return r===""?void 0:r}function x_(e){let t=L_(e);if(!t)return;let r=M_(t,C_,A_);return r===""?void 0:r}function Ym(e,t){let r=Ir(e);for(;r.length>0;){let n=r.pop();if(n.tagName===t)return n;for(let i of Ir(n))r.push(i)}return null}function L_(e){let t=mt(_r(e),Wu);return t?Ym(t,zG):null}function k_(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 M_(e,t,r){var n;return k_(e,t)?(n=e.getAttribute(t))!==null&&n!==void 0?n:"":YG(e,r)}function d_(e,t,r,n){if(k_(e,t)){e.setAttribute(t,n);return}if(di(e,r)){JG(e,r,n);return}throw new Dr.InvalidArgumentError(`BPF step control exposes neither a '${t}' attribute nor a <${r}> wrapper to bind a column`)}function JG(e,t,r){let n=di(e,t),i=n?Ym(n,S_):null;i&&i.setAttribute("Value",r)}function U_(e){return ls(e)}function ju(e){let t=di(e,w_),r=[];for(let n of Ir(t).filter(i=>_a(i,__))){let i=mt(_r(n),Wu);for(let a of Ir(i).filter(o=>_a(o,P_)))r.push({el:a,entity:U_(n)})}return r}function Zm(e){let t=mt(_r(e),Wu);return Ir(t).filter(r=>_a(r,T_))}function QG(e){let t=_r(e),r=Zr(mt(t,Km)).trim().toLowerCase(),n=x_(e),i={id:Zr(mt(t,I_)),name:ls(e)};return n!==void 0&&(i.fieldName=n),r==="true"&&(i.required=!0),i}function XG(e,t){let r=_r(e),n=jG(r),i=HG(r),a={id:Zr(mt(r,E_)),name:ls(e),entityLogicalName:t,steps:Zm(e).map(QG)};return n!==void 0&&(a.category=n),i!==void 0&&(a.nextStageId=i),a}function KG(e){return ju(e).map(({el:t,entity:r})=>XG(t,r))}function Yr(e){return new Dr.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 YG(e,t){var r;let n=di(e,t),i=n?Ym(n,S_):null;return(r=i?.getAttribute("Value"))!==null&&r!==void 0?r:""}function eh(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(eh(e,s)):s.nodeType===3&&n.appendChild(e.createTextNode((r=s.nodeValue)!==null&&r!==void 0?r:""))}return n}function B_(e){return mt(_r(e),Wu)}function ZG(e,t,r){var n;let i=t.entityLogicalName&&t.entityLogicalName.trim()!==""?t.entityLogicalName:r,a=!((n=t.steps[0])===null||n===void 0)&&n.id&&t.steps[0].id.trim()!==""?t.steps[0].id:(0,xn.newId)(),{body:o}=Hu(th(i,(0,Ia.v4)(),t.id,a));return eh(e,ju((0,ci.parseXmlRoot)(o,"<Activity/>"))[0].el)}function e7(e,t){let{body:r}=Hu(th("account",(0,Ia.v4)(),(0,Ia.v4)(),t.id));return eh(e,Zm(ju((0,ci.parseXmlRoot)(r,"<Activity/>"))[0].el)[0])}function $_(e,t){for(;e.firstChild;)e.removeChild(e.firstChild);for(let r of t)e.appendChild(r)}function q_(e,t,r,n){let i=mt(e,r);if(!i||!i.parentNode){if(n!==void 0&&n!=="")throw Yr(`setting '${r}' on a stage whose xaml does not expose that slot`);return}let a=i.parentNode;if(n===void 0||n===""){if(i.tagName!==Gu){let s=t.createElement(Gu);s.setAttribute(Qm,r),a.replaceChild(s,i)}return}if(i.tagName===c_){Zr(i)!==n&&O_(i,t,n);return}let o=t.createElement(c_);o.setAttribute(Qm,r),o.appendChild(t.createTextNode(n)),a.replaceChild(o,i)}function t7(e,t,r){q_(e,t,N_,r===void 0?void 0:String(r))}function r7(e,t,r){q_(e,t,D_,r)}function V_(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 p_(e){return Zr(mt(_r(e),E_))}function f_(e){return Zr(mt(_r(e),I_))}function m_(e,t,r){var n,i,a,o;let s=_r(e);r.name!==ls(e)&&(R_(e,r.name),F_(s,r.name));let l=Zr(mt(s,Km)).trim().toLowerCase()==="true";if(((n=r.required)!==null&&n!==void 0?n:!1)!==l){let u=mt(s,Km);u&&O_(u,t,r.required?"True":"False")}if(((i=r.fieldName)!==null&&i!==void 0?i:"")!==((a=x_(e))!==null&&a!==void 0?a:"")){let u=L_(e);if(!u)throw new Dr.InvalidArgumentError("BPF step has no <mcwb:Control> element to bind a column to");let c=(o=r.fieldName)!==null&&o!==void 0?o:"";d_(u,C_,A_,c),c!==""&&M_(u,u_,l_)===""&&d_(u,u_,l_,c)}}function h_(e,t,r,n){var i;let a=_r(e);if(!a)throw new Dr.InvalidArgumentError("BPF stage composite has no <\u2026ActivityReference.Properties>");if(r.name!==ls(e)&&(R_(e,r.name),F_(a,r.name)),t7(a,t,r.category),r7(a,t,n),r.relationshipName&&r.relationshipName.trim()!=="")throw Yr("a stage relationship / table change (multi-table authoring)");if(r.actions&&r.actions.length>0||r.branch)throw Yr("stage actions or conditional branching");let o=B_(e);if(!o)throw new Dr.InvalidArgumentError("BPF stage has no [Activities] collection");let s=(i=r.steps)!==null&&i!==void 0?i:[];if(s.length===0)throw new Dr.InvalidArgumentError(`BPF stage '${r.name}' must have at least one step`);let l=Zm(e);if(V_(l,s.map(d=>d.id),f_)){l.forEach((d,p)=>m_(d,t,s[p]));return}let u=new Map(l.map(d=>[f_(d),d]));if(Ir(o).some(d=>!_a(d,T_)))throw Yr("adding, removing or reordering steps on a stage that also contains branching or actions");let c=s.map(d=>{var p;return(p=u.get(d.id))!==null&&p!==void 0?p:e7(t,d)});$_(o,c),c.forEach((d,p)=>m_(d,t,s[p]))}function n7(e,t,r){let n=di(e,w_);if(!n)throw new Dr.InvalidArgumentError("BPF xaml has no <mxswa:Workflow> root activity");if(r.globalActions&&r.globalActions.length>0)throw Yr("global (process-completed/abandoned) actions");if(!r.stages||r.stages.length===0)throw new Dr.InvalidArgumentError("a BPF must have at least one stage");let i=ju(e),a=i.map(p=>p.el);if(V_(a,r.stages.map(p=>p.id),p_)){i.forEach(({el:p,entity:m},h)=>{let w=r.stages[h];if(w.entityLogicalName&&w.entityLogicalName.trim()!==""&&w.entityLogicalName!==m)throw Yr(`changing a stage's table ('${w.entityLogicalName}' vs the process's '${m}')`);h_(p,t,w,w.nextStageId)});return}let o=Ir(n).filter(p=>_a(p,__));if(o.length!==1)throw Yr("adding, removing or reordering stages on a multi-table process");let s=o[0],l=U_(s),u=B_(s);if(!u)throw new Dr.InvalidArgumentError("BPF primary entity composite has no [Activities] collection");if(Ir(u).some(p=>!_a(p,P_)))throw Yr("adding, removing or reordering stages on a process whose primary composite holds non-stage activities (multi-table nesting or advanced constructs)");for(let p of r.stages)if(p.entityLogicalName&&p.entityLogicalName.trim()!==""&&p.entityLogicalName!==l)throw Yr(`a stage on a different table ('${p.entityLogicalName}') than the process primary ('${l}')`);let c=new Map(a.map(p=>[p_(p),p])),d=r.stages.map(p=>{var m;return(m=c.get(p.id))!==null&&m!==void 0?m:ZG(t,p,l)});$_(u,d),d.forEach((p,m)=>{let h=m<d.length-1?r.stages[m+1].id:void 0;h_(p,t,r.stages[m],h)})}function Hu(e){let t=e.match(/^<\?xml[^>]*\?>\s*/),r=t?t[0]:"";return{prolog:r,body:e.slice(r.length)}}function i7(e){var t,r,n,i,a,o;(0,b_.installDomShim)();let s=(t=e.bag)===null||t===void 0?void 0:t.xaml;if(s){let p=new BG.DOMParser().parseFromString("<root/>","text/xml"),m={n:"Activity",a:(0,jm.mergeAttrs)(s.a,[]),c:(0,jm.spliceChildren)(s.c,[])};return{root:(0,jm.rebuildRaw)(m,(0,ci.domEngine)(p),null),prolog:(n=(r=e.bag)===null||r===void 0?void 0:r.xamlProlog)!==null&&n!==void 0?n:Jm,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=th(e.entityLogicalName,(0,Ia.v4)(),l?.id&&l.id.trim()!==""?l.id:(0,Ia.v4)(),u?.id&&u.id.trim()!==""?u.id:(0,Ia.v4)()),{body:d}=Hu(c);return{root:(0,ci.parseXmlRoot)(d,"<Activity/>"),prolog:Jm,eol:"lf"}}function a7(e){let{root:t,prolog:r,eol:n}=i7(e);n7(t,t.ownerDocument,e);let i=(0,ci.serializeNode)(t);return n==="crlf"&&(i=i.replace(/\n/g,`\r
+`)),r+i}function o7(e){return e.uniqueName&&e.uniqueName.trim()!==""?e.uniqueName:`new_${(e.name||"businessprocessflow").toLowerCase().replace(/[^a-z0-9]/g,"")||"businessprocessflow"}`}var zu=class{toArtifact(t){return t}fromArtifact(t){return t}fromApiResponse(t){var r,n;(0,b_.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}=Hu(a),u=(0,ci.parseXmlRoot)(l,"<Activity/>");o.stages=KG(u),o.bag={xaml:(0,ci.projectElementBag)(u),xamlProlog:s,xamlEol:/\r\n/.test(a)?"crlf":"lf"}}return o}toApiPayload(t){var r;let n={workflowid:t.id&&t.id.trim()!==""?t.id:(0,xn.newId)(),name:t.name,uniquename:o7(t),primaryentity:t.entityLogicalName,xaml:a7(t),category:Vu.WorkflowCategory.BusinessProcessFlow,type:Vu.WorkflowTypeCode.Definition,businessprocesstype:Vu.BusinessProcessType.BusinessFlow,scope:Vu.WorkflowScope.Organization,processorder:(r=t.order)!==null&&r!==void 0?r:qG};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 Dr.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(v_):[v_({id:(0,xn.newId)(),name:"New Stage",steps:[]})],o={id:t.id&&t.id.trim()!==""?t.id:(0,xn.newId)(),name:(r=t.name)!==null&&r!==void 0?r:"New business process flow",entityLogicalName:(n=t.entityLogicalName)!==null&&n!==void 0?n:"",status:(i=t.status)!==null&&i!==void 0?i:"Draft",stages:a};return t.uniqueName&&(o.uniqueName=t.uniqueName),t.description!==void 0&&(o.description=t.description),t.order!==void 0&&(o.order=t.order),t.globalActions!==void 0&&(o.globalActions=t.globalActions),t.securityRoles!==void 0&&(o.securityRoles=t.securityRoles),o}assignMissingIds(t){let r=Hm(t);(typeof r.id!="string"||r.id.trim()==="")&&(r.id=(0,xn.newId)());for(let n of["stages","steps","actions","globalActions"]){let i=r[n];Array.isArray(i)&&i.forEach(a=>this.assignMissingIds(a))}return r}validate(t){let r=[],n=t.stages;if(n!==void 0&&!Array.isArray(n))return r.push((0,Ft.issue)("/stages","stages-must-be-array",`stages must be an array, got ${typeof n}`)),r;let i=Array.isArray(n)?n:[];i.length>30&&r.push((0,Ft.issue)("/stages","too-many-stages",`a BPF allows at most 30 stages, got ${i.length}`));let a=new Set,o=new Map;i.forEach((l,u)=>{let c=`/stages/${u}`,d=Hm(l),p=typeof d.id=="string"?d.id.trim():"";p===""?r.push((0,Ft.issue)(`${c}/id`,"stage-id-required","a stage needs an id")):o.has(p.toLowerCase())?r.push((0,Ft.issue)(`${c}/id`,"stage-id-duplicate",`two stages share the id '${l.id}' (also at /stages/${o.get(p.toLowerCase())})`)):o.set(p.toLowerCase(),u),typeof l.entityLogicalName=="string"&&l.entityLogicalName!==""&&a.add(l.entityLogicalName);let m=Array.isArray(l.steps)?l.steps:[];m.length===0&&r.push((0,Ft.issue)(`${c}/steps`,"stage-needs-step","a BPF stage must have at least one step")),m.length>30&&r.push((0,Ft.issue)(`${c}/steps`,"too-many-steps",`a stage allows at most 30 steps, got ${m.length}`));let h=new Map;m.forEach((w,b)=>{let E=`${c}/steps/${b}`,D=typeof Hm(w).id=="string"?w.id.trim():"";D===""?r.push((0,Ft.issue)(`${E}/id`,"step-id-required","a step needs an id")):h.has(D.toLowerCase())?r.push((0,Ft.issue)(`${E}/id`,"step-id-duplicate",`two steps in this stage share the id '${w.id}'`)):h.set(D.toLowerCase(),b)}),l.branch&&!g_(i,l.branch.nextStageId)&&r.push((0,Ft.issue)(`${c}/branch/nextStageId`,"branch-target-unknown",`branch nextStageId '${l.branch.nextStageId}' does not match any stage id`)),typeof l.nextStageId=="string"&&l.nextStageId!==""&&!g_(i,l.nextStageId)&&r.push((0,Ft.issue)(`${c}/nextStageId`,"next-stage-unknown",`nextStageId '${l.nextStageId}' does not match any stage id`))}),a.size>5&&r.push((0,Ft.issue)("/stages","too-many-tables",`a BPF spans at most 5 tables, got ${a.size}`));let s=s7(i);return s>=0&&r.push((0,Ft.issue)(`/stages/${s}/nextStageId`,"next-stage-cycle","the stage nextStageId links form a cycle; the flow must be acyclic")),r}};Pa.BpfAdapter=zu;function s7(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 g_(e,t){return e.some(r=>r.id===t)}function v_(e){var t,r;let n=e.steps&&e.steps.length>0?e.steps.map(y_):[y_({id:(0,xn.newId)(),name:"New Step"})],i={id:e.id&&e.id.trim()!==""?e.id:(0,xn.newId)(),name:(t=e.name)!==null&&t!==void 0?t:"New Stage",entityLogicalName:(r=e.entityLogicalName)!==null&&r!==void 0?r:"",steps:n};return e.category!==void 0&&(i.category=e.category),e.nextStageId!==void 0&&(i.nextStageId=e.nextStageId),e.relationshipName!==void 0&&(i.relationshipName=e.relationshipName),e.actions!==void 0&&(i.actions=e.actions),e.branch!==void 0&&(i.branch=e.branch),i}function y_(e){var t;let r={id:e.id&&e.id.trim()!==""?e.id:(0,xn.newId)(),name:(t=e.name)!==null&&t!==void 0?t:"New Step"};return e.fieldName!==void 0&&(r.fieldName=e.fieldName),e.required!==void 0&&(r.required=e.required),r}function th(e,t,r,n){return`${Jm}<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="${s_}" /></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="${s_}" /></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 l7(){return{adapter:new zu,api:$G.bpfApi,languageSensitive:!0}}Pa.bpfRegistration=l7});var z_=g(Ju=>{"use strict";Object.defineProperty(Ju,"__esModule",{value:!0});Ju.buildRegistrations=void 0;var u7=C2(),c7=M2(),d7=yd(),p7=J2(),f7=fI(),m7=TI(),h7=GI(),g7=ZI(),v7=G_();function y7(e){let t=new Map;return t.set("form",(0,u7.formRegistration)(e)),t.set("view",(0,c7.viewRegistration)()),t.set("businessRule",(0,d7.businessRuleRegistration)()),t.set("app",(0,p7.appRegistration)(e)),t.set("command",(0,f7.commandRegistration)()),t.set("chart",(0,m7.chartRegistration)()),t.set("dashboard",(0,h7.dashboardRegistration)(e)),t.set("genPage",(0,g7.genPageRegistration)()),t.set("bpf",(0,v7.bpfRegistration)()),t}Ju.buildRegistrations=y7});var Z_=g(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.removeRowSummary=ke.configureRowSummary=ke.buildGptDynamicPrompt=ke.setAppAiFeatures=ke.getAiReadiness=ke.saveSettingValue=ke.retrieveSetting=ke.AI_GATE=void 0;var sr=ye(),Qe=ee(),W_=yt(),en=ie();ke.AI_GATE={formFill:"FormFillBarUXEnabled",formFillSuggestions:"FormPredictEnabled",formFillSmartPaste:"FormPredictSmartPasteEnabled",formFillFiles:"FormFillFileUploadEnabled",nlSearch:"EnableNLGridSearch",nlChart:"NLChartVisualizationSetting",summaries:"EnableFormInsights",m365:"m365copilotmodelappenabled"};var b7={formFill:"FormFillBarUXEnabled",formFillSuggestions:"FormPredictEnabled",formFillSmartPaste:"FormPredictSmartPasteEnabledOnByDefault",formFillFiles:"FormFillFileUploadEnabled",nlSearch:"NLGridSearchSetting",nlChart:"NLChartDataVisualizationSetting",m365:"m365copilotmodelappenabled"},w7={formFill:{enabled:"2",disabled:"1"},formFillSuggestions:{enabled:"2",disabled:"1"},formFillSmartPaste:{enabled:"2",disabled:"1"},formFillFiles:{enabled:"2",disabled:"1"}};function Q_(e){return w7[e]}var Qu=1e6;function A7(e,t){let r=Q_(t),n=()=>{throw new en.InvalidArgumentError(`setAppAiFeatures: '${t}' must be a boolean or an integer between 0 and ${Qu} (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>Qu?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(Qu).length||Number(s)>Qu?n():s}}return n()}function C7(e,t){let r=Q_(t);return r?e===r.enabled:e!=="0"}async function S7(e,t){var r,n,i;let a=`/appmodules${(0,Qe.odataQuery)([["$select","appmoduleid"],["$filter",`uniquename eq '${(0,Qe.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 E7(e,t){var r,n;let i=`/appmodules${(0,Qe.odataQuery)([["$select","appmoduleid"],["$filter",`uniquename eq '${(0,Qe.odataLiteral)(t)}'`]])}`,a;try{a=await e.get(i)}catch(l){throw new en.InvalidArgumentError(`setAppAiFeatures: cannot confirm that the supplied appModuleId belongs to app '${t}' \u2014 the lookup failed (${l.message}). Retry, or omit appModuleId to verify by name.`)}if(a.status<200||a.status>=300)throw new en.InvalidArgumentError(`setAppAiFeatures: cannot confirm that the supplied appModuleId belongs to app '${t}' \u2014 the lookup returned HTTP ${a.status}. Retry, or omit appModuleId to verify by name.`);let o=(r=a.body)===null||r===void 0?void 0:r.value;if(!Array.isArray(o))throw new en.InvalidArgumentError(`setAppAiFeatures: cannot confirm that the supplied appModuleId belongs to app '${t}' \u2014 the lookup returned a malformed body.`);if(o.length===0)return;let s=(n=o[0])===null||n===void 0?void 0:n.appmoduleid;if(!s)throw new en.InvalidArgumentError(`setAppAiFeatures: cannot confirm that the supplied appModuleId belongs to app '${t}' \u2014 the lookup returned a row with no appmoduleid.`);return s}var j_=new WeakMap;async function N7(e,t){var r,n,i;let a=j_.get(e);if(a||(a=new Map,j_.set(e,a)),a.has(t))return a.get(t);let o=`/settingdefinitions${(0,Qe.odataQuery)([["$select","settingdefinitionid"],["$filter",`uniquename eq '${(0,Qe.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 D7(e,t,r){var n,i;let a=await N7(e,r);if(!t||!a)return;let o=`/appsettings${(0,Qe.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 I7=4,_7=500,H_=20,J_=3e4;function P7(e){if(e===void 0)return I7;if(!Number.isFinite(e))throw new en.InvalidArgumentError(`setAppAiFeatures: verifyAttempts must be a finite integer between 1 and ${H_}; got ${e}.`);return Math.min(H_,Math.max(1,Math.floor(e)))}function T7(e){if(e===void 0)return _7;if(!Number.isFinite(e))throw new en.InvalidArgumentError(`setAppAiFeatures: verifyDelayMs must be a finite number between 0 and ${J_}; got ${e}.`);return Math.min(J_,Math.max(0,Math.floor(e)))}function O7(e){return e>0?new Promise(t=>setTimeout(t,e)):Promise.resolve()}async function R7(e,t,r,n,i,a,o){let s,l,u,c=!1;for(let d=0;d<a;d+=1){d>0&&await O7(o*d);let p;try{let m=await t();m?(p=await D7(e,m,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(m){p=void 0,u=m.message}c=p!==void 0,l=p?.exists;try{s=(await Xu(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 X_(e,t){return t===2?String(e).toLowerCase()==="true":e!=null&&e!=="0"&&e!==""}async function Xu(e,t,r={}){var n,i;let a=[`SettingName='${(0,Qe.odataPathLiteral)(t)}'`];r.appUniqueName&&a.push(`AppUniqueName='${(0,Qe.odataPathLiteral)(r.appUniqueName)}'`);let o=`/RetrieveSetting(${a.join(",")})`,l=(i=(n=(0,sr.ensureSuccess)(await e.get(o),e.apiUrl(o)).body)===null||n===void 0?void 0:n.SettingDetail)!==null&&i!==void 0?i:{};return{value:l.Value,dataType:l.DataType}}ke.retrieveSetting=Xu;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,sr.ensureSuccess)(await e.post("/SaveSettingValue",i),e.apiUrl("/SaveSettingValue"))}ke.saveSettingValue=K_;async function F7(e,t={}){let r={};for(let[n,i]of Object.entries(ke.AI_GATE)){let{value:a,dataType:o}=await Xu(e,i,t);r[n]={enabled:X_(a,o),setting:i,value:a}}return r}ke.getAiReadiness=F7;async function x7(e,t,r,n={}){var i,a,o;if(!t||!t.trim())throw new en.InvalidArgumentError("setAppAiFeatures: a non-empty appUniqueName is required (an empty value would write the setting at organization scope, affecting every app).");let s=P7(n.verifyAttempts),l=T7(n.verifyDelayMs),u=[];for(let[b,E]of Object.entries(r)){if(E===void 0)continue;let D=b7[b];D&&u.push({feature:b,setting:D,requestedValue:A7(E,b)})}let c=[],d=n.appModuleId?(0,Qe.normalizeGuid)(n.appModuleId,"appModuleId"):void 0;if(d){let b=await E7(e,t);if(b&&(0,Qe.normalizeGuid)(b,"appModuleId")!==d)throw new en.InvalidArgumentError(`setAppAiFeatures: appModuleId '${d}' does not belong to app '${t}' (which resolves to '${b}'). Settings are written by unique name, so verifying against a different app would report success for a write that never landed.`)}let p,m=async()=>d||(p||(p=await S7(e,t)),p),h=new Map,w=async b=>{let E=ke.AI_GATE[b];if(E){if(!h.has(E)){let{value:D,dataType:F}=await Xu(e,E);h.set(E,{enabled:X_(D,F),setting:E,value:D})}return h.get(E)}};for(let{feature:b,setting:E,requestedValue:D}of u)try{if(C7(D,b)){let q=await w(b);if(!q?.enabled){c.push({feature:b,setting:E,requestedValue:D,status:"skipped",reason:`the org readiness gate '${(i=q?.setting)!==null&&i!==void 0?i:b}' is off, so the feature cannot be enabled for this app`});continue}}await K_(e,E,D,{appUniqueName:t,solutionUniqueName:n.solutionUniqueName});let F=await R7(e,m,t,E,D,s,l),x={feature:b,setting:E,requestedValue:D,effectiveValue:F.effectiveValue,appOverrideExists:F.appOverrideExists};F.result==="proven"?c.push({...x,status:"applied"}):F.result==="absent"?c.push({...x,status:"notPersisted",reason:`the write reported success but no app-scope override holding '${D}' was observed for '${E}' after ${s} attempt(s) \u2014 it reads '${(a=F.effectiveValue)!==null&&a!==void 0?a:""}' for this app (Dataverse can accept an app-scope write without storing it)`}):c.push({...x,status:"unverified",reason:`the write was issued but could not be confirmed: ${(o=F.reason)!==null&&o!==void 0?o:"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(F){c.push({feature:b,setting:E,requestedValue:D,status:"failed",reason:F.message})}return{applied:c.filter(b=>b.status==="applied").map(b=>b.feature),skipped:c.filter(b=>b.status==="skipped").map(b=>b.feature),notPersisted:c.filter(b=>b.status==="notPersisted").map(b=>b.feature),unverified:c.filter(b=>b.status==="unverified").map(b=>b.feature),failed:c.filter(b=>b.status==="failed").map(b=>b.feature),outcomes:c}}ke.setAppAiFeatures=x7;var L7="GptPowerPrompt",k7='{ "consumptionSource": "Api", "partnerSource": "AIBuilder", "consumptionSourceVersion": "GptApiClient"}';function Y_(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:""}}ke.buildGptDynamicPrompt=Y_;async function M7(e,t){var r,n;let i=`/EntityDefinitions(LogicalName='${(0,Qe.odataPathLiteral)(t)}')${(0,Qe.odataQuery)([["$select","MetadataId"]])}`;return(n=(r=(0,sr.ensureSuccess)(await e.get(i),e.apiUrl(i)).body)===null||r===void 0?void 0:r.MetadataId)!==null&&n!==void 0?n:""}async function U7(e,t,r={}){var n,i,a,o,s;let l=`ais_RowSummary_${t.entityLogicalName}`,u=`/aiskillconfigs${(0,Qe.odataQuery)([["$select","aiskillconfigid,_aimodel_value"],["$filter",`uniquename eq '${(0,Qe.odataLiteral)(l)}'`],["$top",1]])}`,c=((i=(n=(0,sr.ensureSuccess)(await e.get(u),e.apiUrl(u)).body)===null||n===void 0?void 0:n.value)!==null&&i!==void 0?i:[])[0];if(c)return{modelId:c._aimodel_value,aiSkillConfigId:c.aiskillconfigid};let d=`/msdyn_aitemplates${(0,Qe.odataQuery)([["$select","msdyn_aitemplateid"],["$filter",`msdyn_uniquename eq '${L7}'`],["$top",1]])}`,p=((s=(o=(a=(0,sr.ensureSuccess)(await e.get(d),e.apiUrl(d)).body)===null||a===void 0?void 0:a.value)===null||o===void 0?void 0:o[0])!==null&&s!==void 0?s:{}).msdyn_aitemplateid,m=(0,W_.newId)(),h=(0,W_.newId)(),w=JSON.stringify(Y_(t)),b={ModelId:m,RunConfigurationId:h,ModelName:`${t.entityLogicalName} row summary`,TemplateId:p,CustomConfiguration:w,Source:k7,RunConfiguration:""};(0,sr.ensureSuccess)(await e.post("/AIModelPublish",b),e.apiUrl("/AIModelPublish"));try{let E=await M7(e,t.entityLogicalName),D={uniquename:l,description:`${t.entityLogicalName} row summary`,"[email protected]":`/entities(${E})`,"[email protected]":`/msdyn_aimodels(${m})`,aiskill:"RowSummary"},F=(0,sr.ensureSuccess)(await e.post("/aiskillconfigs",D),e.apiUrl("/aiskillconfigs")),x=(0,sr.requireCreatedId)(F,"aiskillconfigid","row-summary skill");return{modelId:m,aiSkillConfigId:x}}catch(E){try{await e.delete(`/msdyn_aimodels(${m})`)}catch{}throw E}}ke.configureRowSummary=U7;async function B7(e,t){var r,n;let i=`ais_RowSummary_${t.entityLogicalName}`,a=`/aiskillconfigs${(0,Qe.odataQuery)([["$select","aiskillconfigid,_aimodel_value"],["$filter",`uniquename eq '${(0,Qe.odataLiteral)(i)}'`],["$top",1]])}`,o=((n=(r=(0,sr.ensureSuccess)(await e.get(a),e.apiUrl(a)).body)===null||r===void 0?void 0:r.value)!==null&&n!==void 0?n:[])[0];if(!o)return;let s=`/aiskillconfigs(${o.aiskillconfigid})`;if((0,sr.ensureSuccess)(await e.delete(s),e.apiUrl(s)),o._aimodel_value){let l=`/msdyn_aimodels(${o._aimodel_value})`;(0,sr.ensureSuccess)(await e.delete(l),e.apiUrl(l))}}ke.removeRowSummary=B7});var e1=g(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});Ta.findArtifact=Ta.resolveArtifact=void 0;var ht=ee(),tn=Ys(),$7=al(),q7=ye(),V7=ie();async function G7(e,t,r){var n,i,a,o,s,l,u,c,d,p,m,h;switch(t){case"app":{let w=(0,$7.unpublishedAppModulesQuery)("appmoduleid,name,appmoduleidunique",`uniquename eq '${(0,ht.odataLiteral)((n=r.uniqueName)!==null&&n!==void 0?n:"")}'`,1),E=(i=(0,q7.ensureSuccess)(await e.get(w),e.apiUrl(w)).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,tn.queryRecords)(e,"systemform",{select:["formid","name"],filter:`name eq '${(0,ht.odataLiteral)((a=r.name)!==null&&a!==void 0?a:"")}' and type eq 0`,top:10})||[]).map(b=>({id:String(b.formid),name:String(b.name)}));case"command":{let w=await(0,tn.queryRecords)(e,"appaction",{select:["appactionid","buttonlabeltext"],filter:`contextvalue eq '${(0,ht.odataLiteral)((o=r.entity)!==null&&o!==void 0?o:"")}'`,top:1});return w&&w.length?[{id:String(r.entity),entity:String(r.entity)}]:[]}case"form":return(await(0,tn.queryRecords)(e,"systemform",{select:["formid","name"],filter:`name eq '${(0,ht.odataLiteral)((s=r.name)!==null&&s!==void 0?s:"")}' and objecttypecode eq '${(0,ht.odataLiteral)((l=r.entity)!==null&&l!==void 0?l:"")}'`,top:10})||[]).map(b=>({id:String(b.formid),name:String(b.name)}));case"chart":return(await(0,tn.queryRecords)(e,"savedqueryvisualization",{select:["savedqueryvisualizationid","name"],filter:`name eq '${(0,ht.odataLiteral)((u=r.name)!==null&&u!==void 0?u:"")}' and primaryentitytypecode eq '${(0,ht.odataLiteral)((c=r.entity)!==null&&c!==void 0?c:"")}'`,top:10})||[]).map(b=>({id:String(b.savedqueryvisualizationid),name:String(b.name)}));case"view":return(await(0,tn.queryRecords)(e,"savedquery",{select:["savedqueryid","name"],filter:`name eq '${(0,ht.odataLiteral)((d=r.name)!==null&&d!==void 0?d:"")}' and returnedtypecode eq '${(0,ht.odataLiteral)((p=r.entity)!==null&&p!==void 0?p:"")}'`,top:10})||[]).map(b=>({id:String(b.savedqueryid),name:String(b.name)}));case"webResource":return(await(0,tn.queryRecords)(e,"webresource",{select:["webresourceid","name"],filter:`name eq '${(0,ht.odataLiteral)((m=r.name)!==null&&m!==void 0?m:"")}'`,top:1})||[]).map(b=>({id:String(b.webresourceid),name:String(b.name)}));case"solution":return(await(0,tn.queryRecords)(e,"solution",{select:["solutionid","uniquename"],filter:`uniquename eq '${(0,ht.odataLiteral)((h=r.uniqueName)!==null&&h!==void 0?h:"")}'`,top:1})||[]).map(b=>({id:String(b.solutionid),name:String(b.uniquename)}));default:return[]}}Ta.resolveArtifact=G7;async function z7(e,t,r){var n,i,a,o,s;let l=(0,ht.odataLiteral)((n=r.name)!==null&&n!==void 0?n:""),u=(0,ht.odataLiteral)((i=r.entity)!==null&&i!==void 0?i:"");if(t==="command"){let h=await(0,tn.queryRecords)(e,"appaction",{select:["appactionid"],filter:`contextvalue eq '${(0,ht.odataLiteral)((a=r.entity)!==null&&a!==void 0?a:"")}'`,top:1});return h&&h.length?String(r.entity):null}let c=W7(t,l,u,r),d=t!=="app",p=await(0,tn.queryRecords)(e,c.set,{select:[c.idField],filter:c.filter,top:d?2:1});if(d&&p&&p.length>1)throw new V7.AmbiguousArtifactError(t,(s=(o=r.name)!==null&&o!==void 0?o:r.uniqueName)!==null&&s!==void 0?s:"",p.length);let m=p&&p[0]&&p[0][c.idField];return m!=null?String(m):null}Ta.findArtifact=z7;function W7(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,ht.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 r1=g(Yu=>{"use strict";Object.defineProperty(Yu,"__esModule",{value:!0});Yu.seedRecordGraph=void 0;var t1=Ys(),j7=Ws(),Ku=ee(),H7=ie();async function J7(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,j7.resolveEntitySetName)(e,p)),c={},d=p=>{var m;return(m=c[p])!==null&&m!==void 0?m:l[p]};for(let p of t){let m=p.entityLogical.toLowerCase(),h=(a=p.matchOn)===null||a===void 0?void 0:a.toLowerCase(),w=[];for(let G of p.records){let M={...G.body};for(let U of(o=G.binds)!==null&&o!==void 0?o:[]){let B=U.parentEntity.toLowerCase(),W=(s=d(B))===null||s===void 0?void 0:s[U.parentIndex];if(!W)throw new H7.InvalidArgumentError(`Cannot resolve bind '${U.navProperty}' on a '${m}' record: parent '${U.parentEntity}'[${U.parentIndex}] has no created id. Seed the parent group before the child, or supply it via options.createdIds.`);let $=(0,Ku.assertODataName)(await u(B),`entity set for parent '${U.parentEntity}'`),Se=(0,Ku.normalizeGuid)(W,`parent id for bind '${U.navProperty}'`);M[`${U.navProperty}@odata.bind`]=`/${$}(${Se})`}w.push(M)}let b=h?w.map(G=>{let M=G[h];return M!=null&&M!==""?String(M):null}):w.map(()=>null),E=new Map;if(h){let G=(0,Ku.assertODataName)(h,"RecordGraph matchOn key"),M=[...new Set(b.filter(U=>U!==null))];if(M.length){let U=M.map(W=>`${G} eq '${(0,Ku.odataLiteral)(W)}'`).join(" or "),B=await(0,t1.queryRecords)(e,m,{select:[G,`${m}id`],filter:U,top:5e3});for(let W of B??[]){let $=W[G];$!=null&&E.set(String($).toLowerCase(),String(W[`${m}id`]))}}}let D=[],F=new Map,x=w.map((G,M)=>{let U=b[M];if(U&&E.has(U.toLowerCase()))return null;if(U){let B=U.toLowerCase(),W=F.get(B);if(W!==void 0)return W;let $=D.push(G)-1;return F.set(B,$),$}return D.push(G)-1}),q=D.length?await(0,t1.createRecordsBulk)(e,m,D):[];c[m]=w.map((G,M)=>{let U=b[M];return U&&E.has(U.toLowerCase())?E.get(U.toLowerCase()):q[x[M]]})}return{createdIds:c}}Yu.seedRecordGraph=J7});var d1=g(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.getEntityPrivileges=Pt.deleteSecurityRole=Pt.createPersonaRole=Pt.createSecurityRole=Pt.SDK_ROLE_MARKER=void 0;var Pr=ye(),nt=ee(),Xt=ie(),Zu={read:"Read",create:"Create",write:"Write",delete:"Delete",append:"Append",appendTo:"AppendTo",assign:"Assign",share:"Share"},l1={user:"Basic",businessUnit:"Local",parentChild:"Deep",organization:"Global"},n1={user:1,businessUnit:2,parentChild:3,organization:4},rh={user:"CanBeBasic",businessUnit:"CanBeLocal",parentChild:"CanBeDeep",organization:"CanBeGlobal"};Pt.SDK_ROLE_MARKER="Authored by @maker-studio/cds-maker-sdk (persona/security role).";function Q7(e){return Object.prototype.hasOwnProperty.call(Zu,e)?Zu[e]:void 0}function X7(e){return Object.prototype.hasOwnProperty.call(l1,e)}var i1=new WeakMap,a1=new WeakMap;async function u1(e,t){var r,n;(0,nt.assertODataName)(t,"entity logical name");let i=i1.get(e);i||(i=new Map,i1.set(e,i));let a=i.get(t);if(a)return a;let o=`/EntityDefinitions(LogicalName='${(0,nt.odataPathLiteral)(t)}')${(0,nt.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 Xt.InvalidArgumentError(`Entity '${t}' exposes no privileges (unknown or non-securable entity).`);return i.set(t,l),l}async function K7(e){var t,r,n;let i=a1.get(e);if(i)return i;let a=`/businessunits${(0,nt.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 Xt.InvalidArgumentError("Could not resolve the root business unit.");let u=(0,nt.normalizeGuid)(l,"businessUnitId");return a1.set(e,u),u}async function Y7(e,t){var r;let n=new Map;for(let i of t){if(!i.access||i.access.length===0)throw new Xt.InvalidArgumentError(`Entity '${i.entity}' privilege request has no access levels.`);let a=(r=i.scope)!==null&&r!==void 0?r:"user";if(!X7(a))throw new Xt.InvalidArgumentError(`Unknown privilege scope '${a}' for entity '${i.entity}'.`);let o=await u1(e,i.entity);for(let s of i.access){let l=Q7(s);if(!l)throw new Xt.InvalidArgumentError(`Unknown access level '${s}' for entity '${i.entity}'.`);let u=o.find(h=>h.PrivilegeType===l);if(!u)throw new Xt.InvalidArgumentError(`Entity '${i.entity}' does not support '${s}' access.`);let c=rh[a];if(u[c]===!1)throw new Xt.InvalidArgumentError(`Privilege '${u.Name}' on '${i.entity}' does not support the '${a}' scope.`);let d=(0,nt.normalizeGuid)(u.PrivilegeId,"PrivilegeId"),p=n.get(d);if(!p){n.set(d,{privilegeName:u.Name,privilegeType:l,scope:a,entities:new Set([i.entity])});continue}if(p.scope===a){p.entities.add(i.entity);continue}if(!(p.entities.size===1&&p.entities.has(i.entity))){let h=[...p.entities].sort().join(", ");throw new Xt.InvalidArgumentError(`Entities '${h}' and '${i.entity}' share the Dataverse privilege '${u.Name}' but request different scopes; a role holds one depth per privilege. Use the same scope for all entities that share this privilege, or split them.`)}p.scope=n1[a]>n1[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 Z7(e,t,r,n){if(r.length===0&&!n)return;let i={Privileges:r.map(o=>({Depth:l1[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 o1(e,t,r,n,i){var a,o;let s=`/${t}(${r})/${n}${(0,nt.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 ez(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,nt.normalizeGuid)(l,"teamId");if(!await o1(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,nt.normalizeGuid)(l,"userId");if(!await o1(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 s1(e,t,r){var n,i;let a=`/roles${(0,nt.odataQuery)([["$select","roleid,description,ismanaged"],["$filter",`name eq '${(0,nt.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:"")===Pt.SDK_ROLE_MARKER};if(l.some(d=>!u(d)))throw new Xt.InvalidArgumentError(`A role named '${t}' already exists in this business unit and was not created by the SDK; refusing to modify or assign it. Choose a different persona/role name.`);if(l.length>1)throw new Xt.InvalidArgumentError(`Multiple (${l.length}) SDK-owned roles named '${t}' exist in this business unit; refusing to reuse one arbitrarily. Remove the duplicate role(s) and retry.`);let c=l[0].roleid;return c?(0,nt.normalizeGuid)(c,"roleId"):void 0}function tz(e){var t,r;return{teams:((t=e?.teams)!==null&&t!==void 0?t:[]).map(n=>(0,nt.normalizeGuid)(n,"teamId")),users:((r=e?.users)!==null&&r!==void 0?r:[]).map(n=>(0,nt.normalizeGuid)(n,"userId"))}}function rz(e){return e.map(t=>({entity:t.entity,privilegeName:t.privilegeName,privilegeType:t.privilegeType,scope:t.scope}))}async function c1(e,t){var r,n;let i=(r=t.name)===null||r===void 0?void 0:r.trim();if(!i)throw new Xt.InvalidArgumentError("createSecurityRole: a non-empty role name is required.");let a=t.businessUnitId?(0,nt.normalizeGuid)(t.businessUnitId,"businessUnitId"):await K7(e),o=await Y7(e,(n=t.privileges)!==null&&n!==void 0?n:[]),s=tz(t.assignTo),l=await s1(e,i,a),u=l!==void 0;if(!l){let d="/roles",p={name:i,description:Pt.SDK_ROLE_MARKER,"[email protected]":`/businessunits(${a})`};try{let m=(0,Pr.ensureSuccess)(await e.post(d,p),e.apiUrl(d));l=(0,nt.normalizeGuid)((0,Pr.requireCreatedId)(m,"roleid","role"),"roleId")}catch(m){let h;try{h=await s1(e,i,a)}catch{h=void 0}if(!h)throw m;l=h}}await Z7(e,l,o,u);let c=await ez(e,l,s);return{roleId:l,name:i,reused:u,appliedPrivileges:rz(o),assignedTeams:c.teams,assignedUsers:c.users}}Pt.createSecurityRole=c1;async function nz(e,t){var r,n;let i=(r=t.persona)===null||r===void 0?void 0:r.trim();if(!i)throw new Xt.InvalidArgumentError("createPersonaRole: a non-empty persona name is required.");let a=[...t.jobs.flatMap(o=>{var s;return(s=o.privileges)!==null&&s!==void 0?s:[]}),...(n=t.additionalPrivileges)!==null&&n!==void 0?n:[]];return c1(e,{name:i,businessUnitId:t.businessUnitId,privileges:a,assignTo:t.assignTo})}Pt.createPersonaRole=nz;async function iz(e,t){let n=`/roles(${(0,nt.normalizeGuid)(t,"roleId")})`;(0,Pr.ensureSuccess)(await e.delete(n),e.apiUrl(n))}Pt.deleteSecurityRole=iz;var az=new Map(Object.keys(Zu).map(e=>[Zu[e],e]));async function oz(e,t){return(await u1(e,t)).map(n=>{let i=Object.keys(rh).filter(o=>n[rh[o]]!==!1),a=az.get(n.PrivilegeType);return{name:n.Name,privilegeId:n.PrivilegeId,privilegeType:n.PrivilegeType,...a?{access:a}:{},scopes:i}})}Pt.getEntityPrivileges=oz});var v1=g(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.createMakerSdk=Or.MakerSdk=Or.ALREADY_EXISTS_CODE=void 0;var p1=Ec(),sz=yd(),ce=ie(),rn=xs(),lz=pv(),f1=hv(),uz=Av(),cz=$v(),nh=qv(),Xe=Ws(),m1=Ud(),nn=Ys(),ec=hy(),Oa=el(),dz=rl(),ut=Cy(),pz=Hd(),fz=z_(),mz=In(),hz=yt(),gz=Ei(),Ln=hd(),h1=Cd(),vz=3e5,Tr=ye(),kn=ee(),Ra=Z_(),g1=e1(),yz=r1(),bz=um(),tc=d1();Or.ALREADY_EXISTS_CODE="ARTIFACT_ALREADY_EXISTS";var nc=class{constructor(t){var r,n;this.artifactLocks=new Map,(0,mz.installDomShim)(),this.languageCode=(r=t.languageCode)!==null&&r!==void 0?r:gz.DEFAULT_LCID,this.cacheStalenessMs=(n=t.cacheStalenessMs)!==null&&n!==void 0?n:vz,this.workspace=new f1.WorkspaceManager(t.workspacePath,t.instanceUrl),this.versions=new uz.VersionManager(this.workspace),this.dataverse=new cz.DataverseClient(t.instanceUrl,t.httpClient,t.solutionUniqueName),this.registrations=(0,fz.buildRegistrations)(this.languageCode)}initWorkspace(){this.workspace.init()}getManifest(){return this.workspace.getManifest()}cleanWorkspace(){this.workspace.clean()}withArtifactLock(t,r,n){var i;let a=`${t}\0${(0,f1.canonicalArtifactId)(r)}`,s=((i=this.artifactLocks.get(a))!==null&&i!==void 0?i:Promise.resolve()).then(n,n),l=s.then(()=>{},()=>{});return this.artifactLocks.set(a,l),l.then(()=>{this.artifactLocks.get(a)===l&&this.artifactLocks.delete(a)}),s}async fetchArtifact(t,r,n){return this.withArtifactLock(t,r,()=>this.fetchArtifactUnlocked(t,r,n))}async fetchArtifactUnlocked(t,r,n){var i,a;let o=this.requireRegistration(t,"fetchArtifact"),{raw:s,etag:l,memberEtags:u,siblingEtags:c}=await o.api.get(this.dataverse,r),d=o.adapter.fromApiResponse(s);if(!n?.overwrite&&this.versions.isDirty(t,r)){let p=(a=(i=this.versions.getMeta(t,r))===null||i===void 0?void 0:i.etag)!==null&&a!==void 0?a:null;if(p&&l&&p!==l)throw new ce.LocalEditsWouldBeLostError(t,r,p,l);let m=this.workspace.readArtifact(t,r);if(m){let h=this.versions.getMeta(t,r);if(h&&!h.etag&&l){if(!(0,h1.deepEqual)(h.snapshot,d))throw new ce.LocalEditsWouldBeLostError(t,r,p,l);this.versions.storeMeta(t,r,{...h,etag:l,fetchedAt:(0,Tr.nowIso)()})}return(0,Ln.cloneJson)(m)}}return this.workspace.writeArtifact(t,r,d),this.versions.storeMeta(t,r,{etag:l,languageCode:this.languageCode,fetchedAt:(0,Tr.nowIso)(),snapshot:(0,Ln.cloneJson)(d),...u?{memberEtags:u}:{},...c?{siblingEtags:c}:{}}),(0,Ln.cloneJson)(d)}async fetchArtifactList(t,r){return this.requireRegistration(t,"fetchArtifactList").api.list(this.dataverse,r)}async fetchSolution(t){var r;let n=await(0,ut.fetchSolutionComponents)(this.dataverse,t),i=[],a=[];for(let o of n)try{let s=await this.resolveComponentType(o);if(!s){a.push({componentId:o.objectId,componentType:o.componentType,workflowCategory:o.workflowCategory,reason:"unsupported"});continue}let l=await this.fetchArtifact(s,o.objectId);i.push({type:s,id:o.objectId,name:typeof l.name=="string"?l.name:(r=o.displayName)!==null&&r!==void 0?r:o.objectId,entityLogicalName:typeof l.entityLogicalName=="string"?l.entityLogicalName:void 0,lastFetched:(0,Tr.nowIso)(),isDirty:!1})}catch(s){a.push({componentId:o.objectId,componentType:o.componentType,workflowCategory:o.workflowCategory,reason:"failed",error:rc(s)})}return this.workspace.updateManifest({lastSyncAt:(0,Tr.nowIso)()}),{summaries:i,skipped:a}}async fetchEntityMetadata(t){let r=await(0,nh.fetchEntityMetadataFromApi)(this.dataverse,t);return this.workspace.writeEntityMetadata(t,r),r}findTables(t,r){return(0,nh.findTables)(this.dataverse,t,r)}findColumns(t,r,n){return(0,nh.findColumns)(this.dataverse,t,r,n)}createTable(t){return(0,Xe.createTable)(this.dataverse,t)}createColumn(t,r){return(0,Xe.createColumn)(this.dataverse,t,r)}createColumns(t,r){return(0,Xe.createColumns)(this.dataverse,t,r)}updateColumn(t,r,n){return(0,Xe.updateColumn)(this.dataverse,t,r,n)}deleteColumn(t,r){return(0,Xe.deleteColumn)(this.dataverse,t,r)}setFormSecurityRoles(t,r){return(0,m1.setFormSecurityRoles)(this.dataverse,t,r)}getFormSecurityRoles(t){return(0,m1.getFormSecurityRoles)(this.dataverse,t)}validateBusinessRule(t,r){return new sz.BusinessRuleAdapter().semanticIssues(t,r)}setColumnVisualization(t,r,n){return(0,Xe.setColumnVisualization)(this.dataverse,t,r,n)}getColumnVisualization(t,r){return(0,Xe.getColumnVisualization)(this.dataverse,t,r)}createCustomerColumn(t,r){return(0,Xe.createCustomerColumn)(this.dataverse,t,r)}insertStatusValue(t,r){return(0,Xe.insertStatusValue)(this.dataverse,t,r)}updateTable(t,r){return(0,Xe.updateTable)(this.dataverse,t,r)}async setEntityIcon(t,r){if(await(0,Xe.updateTable)(this.dataverse,t,{iconVectorName:r.vector,iconSmallName:r.small,iconMediumName:r.medium,iconLargeName:r.large}),r.publish!==!1){let n=`<importexportxml><entities><entity>${(0,kn.xmlText)(t)}</entity></entities></importexportxml>`;(0,Tr.ensureSuccess)(await this.dataverse.post("/PublishXml",{ParameterXml:n}),this.dataverse.apiUrl("/PublishXml"))}}createAlternateKey(t,r){return(0,Xe.createAlternateKey)(this.dataverse,t,r)}deleteAlternateKey(t,r){return(0,Xe.deleteAlternateKey)(this.dataverse,t,r)}createRelationship(t){return(0,Xe.createRelationship)(this.dataverse,t)}deleteRelationship(t){return(0,Xe.deleteRelationship)(this.dataverse,t)}createGlobalOptionSet(t){return(0,Xe.createGlobalOptionSet)(this.dataverse,t)}deleteGlobalOptionSet(t){return(0,Xe.deleteGlobalOptionSet)(this.dataverse,t)}deleteTable(t){return(0,Xe.deleteTable)(this.dataverse,t)}createSecurityRole(t){return(0,tc.createSecurityRole)(this.dataverse,t)}createPersonaRole(t){return(0,tc.createPersonaRole)(this.dataverse,t)}deleteSecurityRole(t){return(0,tc.deleteSecurityRole)(this.dataverse,t)}getEntityPrivileges(t){return(0,tc.getEntityPrivileges)(this.dataverse,t)}createRecord(t,r){return(0,nn.createRecord)(this.dataverse,t,r)}createRecordsBulk(t,r){return(0,nn.createRecordsBulk)(this.dataverse,t,r)}updateRecord(t,r,n){return(0,nn.updateRecord)(this.dataverse,t,r,n)}upsertRecord(t,r,n){return(0,nn.upsertRecord)(this.dataverse,t,r,n)}deleteRecord(t,r){return(0,nn.deleteRecord)(this.dataverse,t,r)}getRecord(t,r,n){return(0,nn.getRecord)(this.dataverse,t,r,n)}queryRecords(t,r){return(0,nn.queryRecords)(this.dataverse,t,r)}seedRecordGraph(t,r){return(0,yz.seedRecordGraph)(this.dataverse,t,r)}resolveArtifact(t,r){return(0,g1.resolveArtifact)(this.dataverse,t,r)}findArtifact(t,r){return(0,g1.findArtifact)(this.dataverse,t,r)}async deleteAppCascade(t,r){let n=await(0,pz.deleteAppCascade)(this.dataverse,t,r),i=(0,kn.normalizeGuid)(t,"appModuleId");return this.workspace.readArtifact("app",i)&&this.workspace.deleteArtifact("app",i),n}associateRecords(t,r,n){return(0,nn.associateRecords)(this.dataverse,t,r,n)}disassociateRecords(t,r,n,i){return(0,nn.disassociateRecords)(this.dataverse,t,r,n,i)}createWebResource(t){return(0,ec.createWebResource)(this.dataverse,t)}updateWebResource(t,r){return(0,ec.updateWebResource)(this.dataverse,t,r)}getWebResource(t){return(0,ec.getWebResource)(this.dataverse,t)}deleteWebResource(t){return(0,ec.deleteWebResource)(this.dataverse,t)}getAppSettings(t){return(0,Oa.readAppSettings)(this.dataverse,t)}setAppSetting(t,r,n){return(0,Oa.setAppSetting)(this.dataverse,t,r,n)}setHeaderAndNavigationRefresh(t,r){if(typeof r!="boolean")throw new ce.ValidationError("app",t,[{pointer:"/headerAndNavigationRefresh",rule:dz.HEADER_NAV_BOOLEAN_RULE,message:`enabled must be a boolean, got ${typeof r}`}]);return(0,Oa.setAppSetting)(this.dataverse,t,Oa.HEADER_AND_NAVIGATION_REFRESH,r?Oa.APP_SETTING_ON:Oa.APP_SETTING_OFF)}getSolution(t){return(0,ut.getSolution)(this.dataverse,t)}createPublisher(t){return(0,ut.createPublisher)(this.dataverse,t)}createSolution(t){return(0,ut.createSolution)(this.dataverse,t)}setSolutionVersion(t,r){return(0,ut.setSolutionVersion)(this.dataverse,t,r)}addSolutionComponent(t){return(0,ut.addSolutionComponent)(this.dataverse,t)}removeSolutionComponent(t,r,n){return(0,ut.removeSolutionComponent)(this.dataverse,t,r,n)}exportSolution(t){return(0,ut.exportSolution)(this.dataverse,t)}importSolution(t){return(0,ut.importSolution)(this.dataverse,t)}deleteSolution(t){return(0,ut.deleteSolution)(this.dataverse,t)}async getArtifact(t,r){return this.withArtifactLock(t,r,()=>this.getArtifactUnlocked(t,r))}async getArtifactUnlocked(t,r){return(0,Ln.cloneJson)(await this.readRaw(t,r))}async readRaw(t,r){return await this.revalidateIfStale(t,r),this.readLocal(t,r)}async readForMutation(t,r,n){if(await this.revalidateIfStale(t,r)==="refreshed-changed")throw new ce.StaleArtifactError(t,r,n);return this.readLocal(t,r)}readLocal(t,r){let n=this.workspace.readArtifact(t,r);if(!n)throw new ce.ArtifactNotFoundError(t,r);return n}async revalidateIfStale(t,r){let n=this.versions.getMeta(t,r);if(!n)return"skipped";let i=n.fetchedAt?Date.parse(n.fetchedAt):NaN,a=Date.now()-i;if(!Number.isNaN(i)&&this.cacheStalenessMs>0&&a<=this.cacheStalenessMs)return"fresh";if(this.versions.isDirty(t,r))return"skipped";let o=this.workspace.readArtifact(t,r);await this.fetchArtifactUnlocked(t,r);let s=this.workspace.readArtifact(t,r);return(0,h1.deepEqual)(o,s)?"refreshed-unchanged":"refreshed-changed"}async queryTree(t,r,n){return this.withArtifactLock(t,r,async()=>{let i=await this.getArtifactUnlocked(t,r),a=rn.JsonPointer.resolve(i,n);if(a===void 0)throw new ce.PathNotFoundError(t,r,n);return a})}async findElements(t,r,n){return this.withArtifactLock(t,r,async()=>(0,lz.findElements)(await this.getArtifactUnlocked(t,r),n))}listArtifacts(t,r){return this.workspace.listArtifacts(t,r).map(n=>({...n,isDirty:this.versions.isDirty(n.type,n.id)}))}getEntityMetadata(t){let r=this.workspace.readEntityMetadata(t);if(!r)throw new ce.ArtifactNotFoundError("entityMetadata",t);return r}getFieldMetadata(t,r){let i=this.getEntityMetadata(t).attributes.find(a=>a.logicalName===r);if(!i)throw new ce.PathNotFoundError("entityMetadata",t,r);return i}async updateElement(t,r,n,i){return this.withArtifactLock(t,r,async()=>{let a=await this.readForMutation(t,r,n),o=rn.JsonPointer.resolve(a,n);if(o===void 0)throw new ce.PathNotFoundError(t,r,n);let s=ic(o)&&ic(i)?{...o,...i}:i;return rn.JsonPointer.set(a,n,(0,Ln.cloneJson)(s)),this.assertStructurallyValid(t,r,a,n),this.workspace.writeArtifact(t,r,a),this.getArtifactUnlocked(t,r)})}async addElement(t,r,n,i,a){return this.withArtifactLock(t,r,async()=>{let o=await this.readForMutation(t,r,n),s=rn.JsonPointer.resolve(o,n);if(s===void 0)throw new ce.PathNotFoundError(t,r,n);if(!Array.isArray(s))throw new ce.ValidationError(t,r,n,"parent must be an array");let l=this.assignMissingIds(t,(0,Ln.cloneJson)(i)),u=Cz(s,a?.position);return s.splice(u,0,l),this.assertStructurallyValid(t,r,o,n),this.workspace.writeArtifact(t,r,o),this.getArtifactUnlocked(t,r)})}async moveElement(t,r,n,i,a){return this.withArtifactLock(t,r,async()=>{var o;let s=await this.readForMutation(t,r,n),l=rn.JsonPointer.resolve(s,n);if(l===void 0)throw new ce.PathNotFoundError(t,r,n);let u=rn.JsonPointer.resolve(s,i);if(u===void 0)throw new ce.PathNotFoundError(t,r,i);if(!Array.isArray(u))throw new ce.ValidationError(t,r,i,"move target must be an array");if(i===n||i.startsWith(`${n}/`))throw new ce.ValidationError(t,r,i,"cannot move an element into its own subtree");rn.JsonPointer.remove(s,n);let c=(o=a?.index)!==null&&o!==void 0?o:u.length;return u.splice(Math.max(0,Math.min(c,u.length)),0,l),this.assertStructurallyValid(t,r,s,i),this.workspace.writeArtifact(t,r,s),this.getArtifactUnlocked(t,r)})}async removeElement(t,r,n){return this.withArtifactLock(t,r,async()=>{let i=await this.readForMutation(t,r,n);if(rn.JsonPointer.resolve(i,n)===void 0)throw new ce.PathNotFoundError(t,r,n);return rn.JsonPointer.remove(i,n),this.assertStructurallyValid(t,r,i,Az(n)),this.workspace.writeArtifact(t,r,i),this.getArtifactUnlocked(t,r)})}assertStructurallyValid(t,r,n,i){var a,o,s;let l=this.registrations.get(t),u=(s=(o=l==null?void 0:(a=l.adapter).validate)===null||o===void 0?void 0:o.call(a,n,i))!==null&&s!==void 0?s:[];if(u.length>0)throw new ce.ValidationError(t,r,u)}retrieveSetting(t,r){return(0,Ra.retrieveSetting)(this.dataverse,t,r)}saveSettingValue(t,r,n){return(0,Ra.saveSettingValue)(this.dataverse,t,r,n)}getAiReadiness(t){return(0,Ra.getAiReadiness)(this.dataverse,t)}setAppAiFeatures(t,r,n){return(0,Ra.setAppAiFeatures)(this.dataverse,t,r,n)}configureRowSummary(t,r){return(0,Ra.configureRowSummary)(this.dataverse,t,r)}removeRowSummary(t){return(0,Ra.removeRowSummary)(this.dataverse,t)}async enrichDefaultViews(t,r,n={}){let i=await(0,bz.findDefaultViews)(this.dataverse,t,n);for(let a of i)await this.fetchArtifact("view",a.id),await this.updateElement("view",a.id,"/columns",r),await this.pushArtifact("view",a.id);return i.length&&await this.publishArtifact("view",i[0].id),{updated:i.map(a=>a.id)}}createArtifact(t,r){let n=this.requireRegistration(t,"createArtifact"),i=n.adapter.assignMissingIds(n.adapter.createDefault(r)),a=i.id;if(!a)throw new ce.ValidationError(t,"(new)","/id","created artifact must have an id");return this.workspace.writeArtifact(t,a,i),(0,Ln.cloneJson)(i)}deleteArtifact(t,r){this.workspace.deleteArtifact(t,r)}async deleteRemoteArtifact(t,r){return this.withArtifactLock(t,r,async()=>{await this.requireRegistration(t,"deleteRemoteArtifact").api.delete(this.dataverse,r),this.workspace.readArtifact(t,r)&&this.workspace.deleteArtifact(t,r)})}async publishArtifact(t,r,n){return this.withArtifactLock(t,r,()=>this.publishArtifactUnlocked(t,r,n))}async publishArtifactUnlocked(t,r,n){var i;let a=await this.readRaw(t,r),o=this.registrations.get(t);if(!o?.publish)return{type:t,id:r,shipped:!1,publish:{kind:"notApplicable"}};let s=(i=o.publishScope)===null||i===void 0?void 0:i.call(o,r,a);try{await o.publish(this.dataverse,r,a)}catch(u){return{type:t,id:r,shipped:!1,publish:{kind:"failed",error:rc(u)},...s?{publishScope:s}:{}}}if(!n?.verify)return{type:t,id:r,shipped:!1,publish:{kind:"submitted"},...s?{publishScope:s}:{}};let l=await this.verifyPublished(t,r);return{type:t,id:r,shipped:l.kind==="verified",publish:l,...s?{publishScope:s}:{}}}async verifyPublished(t,r){if(t!=="app")return{kind:"unverifiable",reason:`published-projection verification is not characterised for '${t}'; the publish was submitted`};try{let n=`/appmodules(${(0,kn.normalizeGuid)(r,"id")})${(0,kn.odataQuery)([["$select","appmoduleid"]])}`,i=await this.dataverse.get(n);return i.status>=200&&i.status<300?{kind:"verified"}:{kind:"unverifiable",reason:`the published projection answered HTTP ${i.status}`}}catch(n){return{kind:"unverifiable",reason:rc(n).message}}}async pushArtifact(t,r){return this.withArtifactLock(t,r,()=>this.pushArtifactUnlocked(t,r))}async pushArtifactUnlocked(t,r){var n,i,a,o,s,l;let u=this.requireRegistration(t,"pushArtifact"),c=this.readLocal(t,r),d=this.versions.getMeta(t,r);this.assertLanguageMatches(t,r,d,u);let p=await this.buildMetadataContext(u.adapter,c),m=u.adapter.toApiPayload(c,d?.snapshot,p);try{let h=d?await u.api.update(this.dataverse,r,m,d.etag,d.memberEtags,d.siblingEtags):await this.createWithMintedId(u,t,r,m),w=r;return d||(h.serverIdentity&&u.adapter.applyServerIdentity&&u.adapter.applyServerIdentity(c,h.serverIdentity),h.id&&h.id!==r&&(c.id=h.id,this.workspace.deleteArtifact(t,r),w=h.id),this.workspace.writeArtifact(t,w,c)),this.versions.storeMeta(t,w,{etag:h.etag,languageCode:this.languageCode,fetchedAt:(0,Tr.nowIso)(),snapshot:(0,Ln.cloneJson)(c),...h.memberEtags?{memberEtags:h.memberEtags}:{},...h.siblingEtags?{siblingEtags:h.siblingEtags}:{}}),{type:t,id:w,saved:!0,shipped:!1,publish:(n=h.publish)!==null&&n!==void 0?n:{kind:"notRequested"},...h.publish&&h.publish.kind!=="notRequested"?(()=>{var b;let E=(b=u.publishScope)===null||b===void 0?void 0:b.call(u,w,c);return E?{publishScope:E}:{}})():{},...h.warnings&&h.warnings.length>0?{warnings:h.warnings}:{}}}catch(h){let w=(0,ce.readPartialTokens)(h);if(w&&d){let b={...(i=d.memberEtags)!==null&&i!==void 0?i:{},...(a=w.memberEtags)!==null&&a!==void 0?a:{}},E={...(o=d.siblingEtags)!==null&&o!==void 0?o:{},...(s=w.siblingEtags)!==null&&s!==void 0?s:{}};this.versions.storeMeta(t,r,{...d,...Object.keys(b).length>0?{memberEtags:b}:{},...Object.keys(E).length>0?{siblingEtags:E}:{}})}if(h instanceof ce.SdkError&&h.code===Or.ALREADY_EXISTS_CODE)return{type:t,id:r,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:h};if(h instanceof ce.SdkError&&h.code===p1.WFOM_API_UNAVAILABLE_CODE)return{type:t,id:r,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:h};if(h instanceof ce.SdkError&&h.code===p1.BUSINESS_RULE_LEFT_DEACTIVATED_CODE)return{type:t,id:r,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:h};if(h instanceof ce.SdkError&&h.code===Tr.VERSION_CONFLICT_CODE)return{type:t,id:r,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:new ce.VersionConflictError(t,r,(l=d?.etag)!==null&&l!==void 0?l:null,null,h.message)};throw h}}assertLanguageMatches(t,r,n,i){if(i?.languageSensitive&&!(n?.languageCode===void 0||n.languageCode===this.languageCode))throw new ce.SdkError("ARTIFACT_LANGUAGE_MISMATCH",`Refusing to push ${t} '${r}': it was fetched with languageCode ${n.languageCode} but this SDK is configured with ${this.languageCode}. Pushing would rewrite labels read in one language as labels in another. Re-fetch with languageCode ${this.languageCode}, or create the SDK with languageCode ${n.languageCode}.`)}async createWithMintedId(t,r,n,i){try{return await t.api.create(this.dataverse,i,n)}catch(a){throw!(a instanceof ce.SdkError)||a.code!==Tr.VERSION_CONFLICT_CODE?a:new ce.SdkError(Or.ALREADY_EXISTS_CODE,`Cannot create ${r} '${n}': a record already exists at that id, so an earlier push of this artifact committed before its local version metadata was saved. No duplicate was created. Run fetchArtifact('${r}', '${n}') to adopt the existing record's identity, etag and snapshot, then push again \u2014 that push will be a conditional update. This is not done automatically because the only recovery available here would be an UNCONDITIONAL overwrite, which would destroy any edit made to the record in the meantime.`)}}async buildMetadataContext(t,r){var n,i;let a=(i=(n=t.metadataNeeds)===null||n===void 0?void 0:n.call(t,r))!==null&&i!==void 0?i:[];if(a.length===0)return;let o=new Set(a.map(s=>s.entityLogicalName).filter(s=>!!s));for(let s of o)if(!this.workspace.readEntityMetadata(s))try{await this.fetchEntityMetadata(s)}catch{}return{resolveField:(s,l)=>{let u=this.workspace.readEntityMetadata(s),c=u?.attributes.find(d=>d.logicalName===l);return c?{displayName:c.displayName,attributeType:c.attributeType}:void 0}}}async pushAll(){let t=this.getDirtyArtifacts(),r=[];for(let n of t)try{r.push(await this.pushArtifact(n.type,n.id))}catch(i){r.push({type:n.type,id:n.id,saved:!1,shipped:!1,publish:{kind:"notRequested"},error:rc(i)})}return r}getDirtyArtifacts(){return this.workspace.listArtifacts().filter(t=>this.versions.isDirty(t.type,t.id)).map(t=>({...t,isDirty:!0}))}diffArtifact(t,r){return this.versions.diff(t,r)}assignMissingIds(t,r){let n=this.registrations.get(t);return n?n.adapter.assignMissingIds(r):(0,hz.assignMissingIds)(r)}async resolveComponentType(t){switch(t.componentType){case ut.SolutionComponentType.SavedQuery:return"view";case ut.SolutionComponentType.SavedQueryVisualization:return"chart";case ut.SolutionComponentType.AppModule:return"app";case ut.SolutionComponentType.UxAgentProject:return"genPage";case ut.SolutionComponentType.Workflow:return t.workflowCategory===2?"businessRule":t.workflowCategory===4&&await this.isBusinessFlowWorkflow(t.objectId)?"bpf":void 0;case ut.SolutionComponentType.SystemForm:return await this.isDashboardForm(t.objectId)?"dashboard":"form";default:return}}async isDashboardForm(t){let n=`/systemforms(${(0,kn.normalizeGuid)(t,"formId")})${(0,kn.odataQuery)([["$select","type"]])}`,i=(0,Tr.ensureSuccess)(await this.dataverse.get(n),this.dataverse.apiUrl(n)),a=Number(i.body.type);return a===0||a===10}async isBusinessFlowWorkflow(t){let n=`/workflows(${(0,kn.normalizeGuid)(t,"workflowId")})${(0,kn.odataQuery)([["$select","businessprocesstype"]])}`,i=(0,Tr.ensureSuccess)(await this.dataverse.get(n),this.dataverse.apiUrl(n));return Number(i.body.businessprocesstype)===0}requireRegistration(t,r){let n=this.registrations.get(t);if(!n)throw new ce.NotImplementedError(r,`no adapter registered for artifact type '${t}'`);return n}};Or.MakerSdk=nc;function wz(e){return new nc(e)}Or.createMakerSdk=wz;function rc(e){return e instanceof Error?e:new Error(String(e))}function ic(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Az(e){let t=e.lastIndexOf("/");return t<=0?"":e.slice(0,t)}function Cz(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=>ic(i)&&i.id===t.before);return n<0?e.length:n}let r=e.findIndex(n=>ic(n)&&n.id===t.after);return r<0?e.length:r+1}});var y1=g(ac=>{"use strict";Object.defineProperty(ac,"__esModule",{value:!0});ac.ARTIFACT_TYPES=void 0;ac.ARTIFACT_TYPES=["form","view","businessRule","app","command","chart","dashboard","genPage","bpf"]});var w1=g(b1=>{"use strict";Object.defineProperty(b1,"__esModule",{value:!0})});var C1=g(A1=>{"use strict";Object.defineProperty(A1,"__esModule",{value:!0})});var E1=g(S1=>{"use strict";Object.defineProperty(S1,"__esModule",{value:!0})});var D1=g(N1=>{"use strict";Object.defineProperty(N1,"__esModule",{value:!0})});var _1=g(I1=>{"use strict";Object.defineProperty(I1,"__esModule",{value:!0})});var T1=g(P1=>{"use strict";Object.defineProperty(P1,"__esModule",{value:!0})});var R1=g(O1=>{"use strict";Object.defineProperty(O1,"__esModule",{value:!0})});var x1=g(F1=>{"use strict";Object.defineProperty(F1,"__esModule",{value:!0})});var k1=g(L1=>{"use strict";Object.defineProperty(L1,"__esModule",{value:!0})});var U1=g(M1=>{"use strict";Object.defineProperty(M1,"__esModule",{value:!0})});var $1=g(B1=>{"use strict";Object.defineProperty(B1,"__esModule",{value:!0})});var V1=g(q1=>{"use strict";Object.defineProperty(q1,"__esModule",{value:!0})});var z1=g(G1=>{"use strict";Object.defineProperty(G1,"__esModule",{value:!0})});var j1=g(W1=>{"use strict";Object.defineProperty(W1,"__esModule",{value:!0})});var J1=g(H1=>{"use strict";Object.defineProperty(H1,"__esModule",{value:!0})});var X1=g(Q1=>{"use strict";Object.defineProperty(Q1,"__esModule",{value:!0})});var Y1=g(K1=>{"use strict";Object.defineProperty(K1,"__esModule",{value:!0})});var eP=g(Z1=>{"use strict";Object.defineProperty(Z1,"__esModule",{value:!0})});var rP=g(tP=>{"use strict";Object.defineProperty(tP,"__esModule",{value:!0})});var Sz=exports&&exports.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),Ie=exports&&exports.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Sz(t,e,r)};Object.defineProperty(exports,"__esModule",{value:!0});exports.createMakerSdk=void 0;var Ez=v1();Object.defineProperty(exports,"createMakerSdk",{enumerable:!0,get:function(){return Ez.createMakerSdk}});Ie(y1(),exports);Ie(w1(),exports);Ie(C1(),exports);Ie(E1(),exports);Ie(D1(),exports);Ie(_1(),exports);Ie(T1(),exports);Ie(R1(),exports);Ie(x1(),exports);Ie(k1(),exports);Ie(U1(),exports);Ie($1(),exports);Ie(V1(),exports);Ie(rl(),exports);Ie(z1(),exports);Ie(j1(),exports);Ie(J1(),exports);Ie(X1(),exports);Ie(Y1(),exports);Ie(eP(),exports);Ie(rP(),exports);Ie(ie(),exports);
diff --git a/plugins/model-apps/skills/app-builder/SKILL.md b/plugins/model-apps/skills/app-builder/SKILL.md
index aa7a1d7ac..072d2da83 100644
--- a/plugins/model-apps/skills/app-builder/SKILL.md
+++ b/plugins/model-apps/skills/app-builder/SKILL.md
@@ -1,7 +1,7 @@
---
name: app-builder
version: 0.8.1
-description: (Preview) Builds and edits a model-driven Power Apps app from a natural-language intent — tables, columns, relationships, adaptive forms with sub-grids, views, Choice-column charts, generative page intents for overview/dashboard surfaces (page `.tsx` generated in generate-pages after plan approval), and an app module + sitemap — via the headless cds-maker-sdk. Runs an interactive, multi-turn authoring flow (env selection, jobs-to-be-done first, then design-only App Spec authoring across confirmed levels, guardrail lint, plan-mode approval, generate-pages, full build) and a narrated build, and can download a deployed app back into an editable spec to change it. Use when the user says "build an app for X", "create a model-driven app", "make me an app to manage Y", or "edit/add to my app". This skill stands alone and does not require /genpage — but for a standalone generative page added to an app that already exists, use /genpage instead.
+description: (Preview) Builds and edits a model-driven Power Apps app from a natural-language intent — tables, columns, relationships, adaptive forms with sub-grids, views, Choice-column charts, business rules, business process flows, generative page intents for overview/dashboard surfaces (page `.tsx` generated in generate-pages after plan approval), and an app module + sitemap — via the headless cds-maker-sdk. Runs an interactive, multi-turn authoring flow (env selection, jobs-to-be-done first, then design-only App Spec authoring across confirmed levels, guardrail lint, plan-mode approval, generate-pages, full build) and a narrated build, and can download a deployed app back into an editable spec to change it. Use when the user says "build an app for X", "create a model-driven app", "make me an app to manage Y", "add a business process flow", or "edit/add to my app". This skill stands alone and does not require /genpage — but for a standalone generative page added to an app that already exists, use /genpage instead.
author: Microsoft Corporation
argument-hint: "<app description>"
user-invocable: true
@@ -72,6 +72,14 @@ prod-ready** app; don't under-build (a bare table list) or over-build (surfaces
the requirement is field-level and declarative — it is visible in the maker, survives solution
export, and needs no web resource. Use form JS when the logic needs a real API call, cross-record
work, or anything beyond the four supported actions.
+- **Guided processes** — `businessProcessFlows[]`: the staged bar across the top of a record
+ (ordered stages, each with steps bound to that table's columns — **every step must bind a `field`**;
+ the platform rejects one without, so use a Boolean flag for a manual check-off). Reach for one when
+ the user describes work moving through **phases** — "triage →
+ investigate → resolve", "lead → qualify → close". Author it `Active` (the default) or the stage bar
+ does not appear at all. v1 is single-entity and linear: cross-entity stages, branching, stage
+ actions and security-role grants are **rejected** by the spec gate, so offer Maker for those rather
+ than writing them into the spec.
- **Surfaces** — **generative pages** (modern dashboards / overviews / analytics / landing — the default),
classic dashboards (opt-in), external URLs
- **App shell** — the app module + sitemap, with per-subarea icons. Turn on the **modern shell** with
@@ -519,6 +527,9 @@ canonical control cells / the `/bag/c` events region via the SDK's generic `addE
→ **business rules** (`businessRules[]` — authored as the workflow object model through the bound
`CreateProcessWithWfomJson` member and activated; **skipped with a warning** on an environment that
does not declare that member) →
+**business process flows** (`businessProcessFlows[]`; a category-4 process compiled from the
+authored stages and activated — this goes through the SDK's generic artifact surface, a plain
+`workflows` row, so it is NOT subject to the bound-member gate above) →
**command bar** (`commands[]`) → **classic dashboards** (opt-in)
→ **app module + sitemap** → **generative pages** (each page's `.tsx` was generated in Phase 1.5;
the build uploads each `pages[]` page via `pac model genpage upload`, no `--add-to-sitemap`; then
@@ -558,7 +569,8 @@ child view id. Each step emits `[n/total]`.
command groups** (from-scratch — needs an SDK-synthesized parent row), lookup/associated views,
multi-area sitemaps, **column-level (field) security**, and **access teams / hierarchy security**
(both tracked SDK follow-ups). The security surface today is role-per-persona plus per-form role
- assignment, and both of those ship.
+ assignment, and both of those ship. Also out of scope: the BPF knobs the spec gate rejects
+ (cross-entity stages, branching, stage actions, security-role grants).
- **Environment-gated (may not work where you are running):**
- **Business rules** (`businessRules[]`). The SDK writes a rule through the bound
`CreateProcessWithWfomJson` member — the same one the modern business-rule designer uses — and
@@ -569,6 +581,8 @@ child view id. Each step emits `[n/total]`.
edge case. The build **skips** the rules, warns once naming the
member, and builds everything else normally, so an app is never left half-created. If rules are
essential, verify the environment first.
+ **Business process flows are NOT affected by this gate** — a BPF is written as an ordinary
+ `workflows` row through the SDK's generic artifact surface, with no bound member involved.
- Supported: the full data model — all column types, **AutoNumber primary**, global choices, status
reasons, alternate keys, **N:N + junction-with-payload**; **`required` reconciled on existing
columns** (an explicit `required` converges on rebuild; an omitted one never demotes);