/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import { c as ie } from "../../chunks/runtime.js";
import { css as oe, html as d } from "lit";
import { nothing as q, safeClassMap as ae, LitElement as se } from "@arcgis/lumina";
import { ref as ne, createRef as re } from "lit/directives/ref.js";
import ce from "@arcgis/core/identity/IdentityManager.js";
import { u as le } from "../../chunks/useT9n.js";
import { b as D } from "../../chunks/arcade-defaults.js";
import N from "@arcgis/core/request.js";
import { e as de, a as pe } from "../../chunks/utilities.js";
import { repeat as X } from "lit/directives/repeat.js";
import "@arcgis/toolkit/function";
import { generateGuid as ue } from "@arcgis/toolkit/string";
import { unsafeHTML as A } from "lit/directives/unsafe-html.js";
import he from "@arcgis/core/layers/FeatureLayer.js";
import U from "@arcgis/core/config.js";
import L from "@arcgis/core/Graphic.js";
import { log as w } from "@arcgis/toolkit/log";
import { getDeclaredVoxelMembers as me, getDeclaredPixelMembers as fe } from "@arcgis/core/applications/Components/arcadeEditorUtils.js";
import { s as be } from "../../chunks/fields.js";
import { h as Z, j as ge } from "../../chunks/language-defaults-base.js";
import ve from "@arcgis/core/core/Accessor.js";
import { property as f, subclass as ye } from "@arcgis/core/core/accessorSupport/decorators.js";
const we = oe`:host(:not([closed])){container-type:size;--calcite-block-border-color: var(--calcite-color-transparent);box-sizing:border-box;.submission-actions-wrapper{display:flex;flex-direction:column;width:100%;gap:.75rem}.submission-actions{display:flex;flex-direction:row;gap:.5rem;justify-content:space-between}@container (max-width: 380px){.hidden-below-380{display:none}}@container (min-width: 380px){.hidden-above-380{display:none}}.gaps{display:flex;gap:.25rem}.align-inline-end{margin-inline-start:auto}.context-popover p{padding:0 .5rem;font-size:var(--calcite-font-size-sm)}.feedback-content{padding:var(--calcite-spacing-sm);display:flex;flex-direction:column;max-height:75cqb;overflow-y:auto;>*{margin-block-end:.5rem}>*:last-child,.terms-label{margin-block-end:0}calcite-text-area{--calcite-text-area-min-height: 4rem}calcite-notice{margin-block-start:0}}.feedback-sheet{--calcite-sheet-height: auto;--calcite-sheet-max-height: 100%;--calcite-sheet-min-height: auto}.feedback-footer{display:flex;justify-content:flex-end;gap:.5rem;width:100%}calcite-chip[slot=header-actions-end]{align-self:center;margin-inline-end:.5rem}calcite-flow-item calcite-shell{background:transparent}calcite-block{width:100%;max-width:100%;align-self:flex-end;background-color:transparent;margin-block:0}calcite-sheet{--calcite-sheet-scrim-background: rgba(200, 200, 200, .5)}calcite-list-item calcite-button{margin-inline-end:.25rem}calcite-flow-item calcite-shell calcite-notice{margin-block:1rem}calcite-block[open]:last-of-type{border-block-end:0}.text-area-wrapper{display:flex;border-radius:var(--calcite-corner-radius-round);margin:.75rem;overflow:hidden;--calcite-color-border-input: transparent;position:sticky;box-shadow:var(--calcite-shadow-sm);flex:none;flex-direction:column}calcite-text-area{height:auto;overflow:hidden;--calcite-font-weight-normal: 500;font-weight:500;line-height:1.2}calcite-flow{height:100%}calcite-popover calcite-list{--calcite-list-background-color: transparent;--calcite-input-border-color: transparent}calcite-popover calcite-list calcite-filter{--calcite-spacing-sm: 0}.contained-popover-or-tooltip{--calcite-popover-max-size-x: 100%;--calcite-tooltip-max-size-x: 100%}.info-heading{font-size:var(--calcite-font-size-0);color:var(--calcite-color-text-1);margin:0}.info-heading-row{display:flex;align-items:center;gap:var(--calcite-spacing-sm);flex-wrap:wrap}.unstyled-h3{margin:unset;font-size:var(--calcite-font-size-md)}.unstyled-shell{position:unset;inset:unset;display:unset;block-size:unset;inline-size:unset}.suggestion-button{font-weight:var(--calcite-font-weight-medium)}.suggestions{display:flex;flex-direction:row;gap:var(--calcite-spacing-xs);flex-wrap:wrap}.info-block{max-width:450px}#result-block{calcite-card-group{--calcite-card-group-gap: 1.25rem}calcite-card{--calcite-card-corner-radius: var(--calcite-corner-radius-round);--calcite-card-border-color: transparent;width:100%}.positioned-code-content{display:flex;flex-direction:row;gap:.5rem;padding:.5rem}calcite-card [slot=heading] calcite-chip{margin-block-start:.25rem}.code-response-wrapper{position:relative;background:var(--calcite-color-foreground-2);border-radius:var(--calcite-corner-radius-round);margin-top:-1.5rem}.prior-prompt{display:flex;flex-direction:row;padding:0;overflow-y:hidden;overflow-x:auto;margin:.25rem 0 .75rem;align-items:center;max-width:100%;span{overflow-x:auto;overflow-y:hidden}}.copy-feedback{display:none}.copy-prompt-button{align-self:flex-start;margin-inline-start:auto}.response-secondary-action-button[data-copied]+.copy-feedback,.copy-prompt-button[data-copied]+.copy-feedback{display:block;span{padding:.75rem 1rem;font-size:var(--calcite-font-size--2);line-height:1.375;color:var(--calcite-color-text--2);font-weight:var(--calcite-font-weight-medium)}}.copy-prompt-button[data-copied]~.copy-tooltip,.response-secondary-action-button[data-copied]~.copy-tooltip{display:none}code{white-space:pre;font-size:12px;margin:0;overflow-x:auto;font-family:Fira Mono,Consolas,Menlo,monospace;display:block;max-height:12rem;position:relative;padding:.5rem}.response-secondary-action-button{margin-left:.5rem}.add-to-editor-button{--calcite-internal-button-border-color: unset}}.collapsible-code{padding:.5rem}.collapsible-code summary{cursor:pointer;font-weight:500;color:var(--calcite-color-brand);outline:none;padding:.25rem 0}.collapsible-code[open] summary{color:var(--calcite-color-text-2)}.response-error-container{padding:.5rem;background:color-mix(in srgb,var(--calcite-color-status-warning) 10%,transparent);border-radius:var(--calcite-corner-radius-round);margin:1rem 0;font-size:var(--calcite-font-size--2);--calcite-input-message-icon-color: var(--calcite-color-status-warning)}.response-error-chip{--calcite-internal-chip-background-color: var(--calcite-color-status-warning);--calcite-chip-icon-color: var(--calcite-color-foreground-1);--calcite-chip-border-color: var(--calcite-color-transparent)}.feedback-actions{gap:unset}.contained{max-width:100%;max-height:100%;max-width:100cqi;max-height:75cqb;overflow-y:auto}.submission-notice{--calcite-notice-border-color: transparent;margin-block:0;width:100%;--calcite-font-size-relative-base: var(--calcite-font-size--2)}.border-block-end{border-block-end:1px solid var(--calcite-color-border-3)}.round-top{border-radius:var(--calcite-corner-radius-round) var(--calcite-corner-radius-round) 0 0}}:host([closed]){display:none}`;
class C extends Error {
  constructor({
    message: e,
    code: t,
    subCode: o,
    details: a,
    source: n
  }) {
    super(e), this.name = "ArcadeAssistantError", this.code = t, this.subCode = o, this.details = a, this.source = n;
  }
}
function O(i) {
  if (!i)
    return;
  const e = i.indexOf('{"error":');
  if (e !== -1)
    try {
      const t = i.slice(e), o = JSON.parse(t);
      if (o && typeof o == "object" && o.error)
        return o.error;
    } catch {
      return;
    }
}
async function $e(i) {
  const { baseUrl: e, skillId: t, message: o, authToken: a, previousConversationId: n, context: c } = i, p = t ? `${e}/skills/${t}/chat` : `${e}/chat`, r = [], s = {
    message: o,
    context: c
  };
  n && (s.conversation_id = n);
  let u;
  try {
    u = await N(p, {
      method: "post",
      headers: {
        "Content-Type": "application/json",
        token: a
      },
      body: JSON.stringify(s),
      responseType: "json"
    });
  } catch (b) {
    const g = b, x = g.details?.rawResponse || g.message || String(b), k = O(x);
    throw k ? new C(k) : b;
  }
  const l = u.data;
  r.push(l);
  const v = l.conversationId, P = l.inquiryId;
  let $ = l.sequenceNumber;
  async function T() {
    let b = 0;
    const g = 100;
    for (; b < g; ) {
      await new Promise((S) => setTimeout(S, 1e3));
      const x = xe(v, $, P);
      let k;
      try {
        k = await N(p, {
          method: "post",
          headers: {
            "Content-Type": "application/json",
            token: a
          },
          body: JSON.stringify(x),
          responseType: "json"
        });
      } catch (S) {
        const V = S, te = V.details?.rawResponse || V.message || String(S), _ = O(te);
        throw _ ? new C(_) : S;
      }
      const y = k.data;
      if (y.context?.kind === "ArcgisErrorAsContext" && y.context.error)
        throw new C({
          message: y.context.error.message || "ArcGIS Assistant error",
          code: y.context.error.code,
          subCode: y.context.error.subCode,
          details: y.context.error.details,
          source: "polling-response"
        });
      if (r.push(y), $ = y.sequenceNumber, b++, !y.hasMore)
        break;
    }
    if (b === g)
      throw new C({
        message: "Request timed out",
        code: "TIMEOUT",
        source: "polling"
      });
  }
  const I = 120 * 1e3;
  return await Promise.race([
    T(),
    new Promise(
      (b, g) => setTimeout(
        () => g(
          new C({
            message: "Request timed out",
            code: "TIMEOUT",
            source: "hard-timeout"
          })
        ),
        I
      )
    )
  ]), r;
}
function xe(i, e, t) {
  return {
    conversationId: i,
    inquiryId: t,
    ackSequenceNumber: e
  };
}
function ke(i) {
  return i.message.match(/Error in prompt shield/u) ? "I'm having trouble with this request. Try again by rephrasing the question." : i.code === "TIMEOUT" ? "Request timed out. Try again by re-asking the same question or rephrasing it." : i.message;
}
const Se = ({ notices: i }) => i.length ? d`<div class="border-block-end">${X(i, (e) => e.id ?? e.title, (e) => d`<calcite-notice class="submission-notice" .icon=${e.icon} .kind=${e.kind} scale=s open .closable=${e.closable} @calciteNoticeClose=${() => e.onClose?.()}><div slot=title>${e.title}</div>${e.message && d`<div slot=message>${e.message}</div>` || ""}${e.actionLinkMessage && e.onAction && d`<calcite-link slot=link @click=${() => e.onAction?.()}>${e.actionLinkMessage}</calcite-link>` || ""}</calcite-notice>`)}</div>` : null, Ce = (i) => {
  const e = i.value.length, t = 72, o = 180, a = i.offsetWidth, c = Math.max(1, Math.floor(a / 8)), p = Math.ceil(e / c), r = t + (p - 2) * 24;
  i.style.setProperty("--calcite-text-area-min-height", `${Math.min(r, o)}px`);
}, Ae = ({ promptValidationMessage: i, errorMessage: e, contextTooBig: t, contextReducedNoticeDismissed: o, setContextReducedNoticeDismissed: a, setErrorMessage: n, messages: c }) => {
  const p = [];
  if (i && p.push({
    id: "prompt-validation",
    kind: "danger",
    icon: "exclamation-mark-triangle",
    title: i,
    closable: !0
  }), e && p.push({
    id: "assistant-error",
    kind: "danger",
    icon: "exclamation-mark-triangle",
    title: e,
    closable: !0,
    onClose: () => n(void 0)
  }), t && !o) {
    const r = c.contextreduced ?? "Context reduced", s = c.contextreducedmessage ?? "The editor profile is too large for the assistant. It has been reduced in the assistant in order to ensure a successful request.";
    p.push({
      id: "context-reduced",
      kind: "warning",
      icon: "exclamation-mark-triangle",
      title: r,
      message: s,
      closable: !0,
      onClose: () => a(!0)
    });
  }
  return p;
};
function Te({ messages: i }) {
  return d`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${i.beta ?? "Beta"}>${i.beta ?? "Beta"}</calcite-chip>`;
}
function Ie({ popoverContent: i, messages: e }) {
  return d`<calcite-action icon=information slot=header-actions-end id=legal-disclaimer text></calcite-action><calcite-popover reference-element=legal-disclaimer .label=${e.legaldisclaimer ?? "Legal disclaimer"} placement=bottom auto-close focus-trap-disabled><div class="contained">${i}</div></calcite-popover>`;
}
function Ee({ errorMessage: i, slot: e }) {
  return d`<div class="error-display"><calcite-input-message id=error-message status=invalid icon=exclamation-mark-triangle scale=m slot=${e ?? q}>${i}</calcite-input-message></div>`;
}
function Re({ active: i, setActive: e, messages: t }) {
  return d`<calcite-alert slot=alerts .open=${i} placement=bottom kind=success icon=check-circle-f auto-close @calciteAlertClose=${() => e(!1)} .label=${t.expressionapplied ?? "Expression applied"}><div slot=message>${t.expressionapplied ?? "Expression applied to editor."}</div></calcite-alert>`;
}
function Fe({ context: i, messages: e }) {
  return i ? d`<div class="gaps">${i.profileId && d`<calcite-popover auto-close placement=top .label=${(e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", i.profileId)} reference-element=profile-context-button class="context-popover contained-popover-or-tooltip"><p>${(e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", i.profileId)}</p></calcite-popover><calcite-button round kind=neutral icon-start=map-information id=profile-context-button scale=s></calcite-button>` || ""}</div>` : null;
}
function Me({ isDisabled: i, isReadOnly: e, setQuestion: t, setIsViewingResult: o, textAreaRef: a, question: n, errorMessage: c, setErrorMessage: p, promptValidationMessage: r, setPromptValidationMessage: s, submitQuestion: u, messages: l, mode: v, assistantRef: P, context: $, contextReducedNoticeDismissed: T, setContextReducedNoticeDismissed: I }) {
  const b = $?.contextTooLarge ?? !1, g = Ae({
    promptValidationMessage: r,
    errorMessage: c,
    contextTooBig: b,
    contextReducedNoticeDismissed: T,
    setContextReducedNoticeDismissed: I,
    setErrorMessage: p,
    messages: l
  });
  return d`<div class="text-area-wrapper">${Se({ notices: g })}<calcite-text-area scale=s resize=vertical .readOnly=${i || e} class=${ae(g.length ? "submission-text-area" : "submission-text-area round-top")} .placeholder=${l.askaquestion ?? `Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${n} @calciteTextAreaInput=${(x) => {
    Ce(x.target), t(x.target.value);
  }} ${ne(a)}><div class="submission-actions-wrapper" slot=footer-start><div class="submission-actions">${$ && Fe({ context: $, messages: l }) || ""}<div class="align-inline-end gaps"><calcite-button round kind=neutral .hidden=${v !== "refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid scale=s .disabled=${i} @click=${async () => {
    o(!1), t("");
  }} .label=${l.startover ?? "Start Over"} class="hidden-above-380" id=small-start-over-button></calcite-button><calcite-tooltip reference-element=small-start-over-button placement=top-start class="hidden-above-380">${l.startover ?? "Start Over"}</calcite-tooltip><calcite-button round kind=neutral .hidden=${v !== "refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid .disabled=${i} @click=${async () => {
    o(!1), t("");
  }} class="hidden-below-380" scale=s>${l.startover ?? "Start Over"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${i} .disabled=${i} @click=${async () => {
    if (p(""), !n) {
      s(l.enteraprompt ?? "Please enter a prompt");
      return;
    }
    s(void 0), await u();
  }} class="hidden-below-380">${v === "prompt" ? l.ask ?? "Generate" : l.refine ?? "Refine"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${i} .disabled=${i} id=small-submit-button @click=${async () => {
    if (p(""), !n) {
      s(l.enteraprompt ?? "Please enter a prompt");
      return;
    }
    s(void 0), await u();
  }} class="hidden-above-380" .label=${v === "prompt" ? l.ask ?? "Generate" : l.refine ?? "Refine"}></calcite-button><calcite-tooltip reference-element=small-submit-button placement=top-start class="hidden-above-380">${v === "prompt" ? l.ask ?? "Generate" : l.refine ?? "Refine"}</calcite-tooltip></div></div></div></calcite-text-area></div>`;
}
const qe = "https://www.esri.com/en-us/privacy/privacy-statements/privacy-supplement", Pe = "https://www.esri.com/en-us/privacy/privacy-statements";
function Ve({ setOpen: i, messages: e, feedback: t, learnMoreUrl: o, setFeedback: a, onSubmit: n }) {
  return t.active ? d`<calcite-sheet class="feedback-sheet" .label=${e.feedback ?? "Feedback"} slot=sheets display-mode=float position=block-end .open=${t.active} @calciteSheetClose=${() => i(!1)}><calcite-panel .heading=${e.submitfeedback ?? "Submit feedback to Esri"} scale=s><div class="feedback-content"><calcite-text-area scale=s resize=vertical .value=${t.text} @calciteTextAreaInput=${(c) => a({ ...t, text: c.target.value })} .disabled=${t.submitting} .placeholder=${e.donotincludepersonalinfo ?? "Do not include personal or sensitive information"} rows=3></calcite-text-area><calcite-label layout=inline scale=s class="terms-label"><calcite-checkbox scale=l .checked=${t.termsAccepted} @calciteCheckboxChange=${(c) => {
    a({ ...t, termsAccepted: c.target.checked });
  }} .disabled=${t.submitting}></calcite-checkbox><span>${A((e.agreement ?? "I agree to the {EsriPrivacyStatement} (and {Supplement}).").replace("{EsriPrivacyStatement}", `<calcite-link href=${Pe} target="_blank">${e.esriprivacystatement ?? "Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}", `<calcite-link href=${qe} target="_blank">${e.supplement ?? "Supplement"}</calcite-link>`))}</span></calcite-label><calcite-notice scale=s open closable><span slot=message>${A((e.feedbackhelps ?? "Your feedback will be used to improve Esri products and services. {LearnMore} about how this data is used.").replace("{LearnMore}", `<calcite-link href=${o} target="_blank">${e.learnmore ?? "Learn more"}</calcite-link>`))}</span></calcite-notice></div><div slot=footer class="feedback-footer"><calcite-button kind=neutral appearance=outline @click=${() => i(!1)} .disabled=${t.submitting}>${e.cancel ?? "Cancel"}</calcite-button><calcite-button @click=${n} .disabled=${!t.termsAccepted || t.submitting} .loading=${t.submitting} data-testid=submit-feedback-button>${e.submit ?? "Submit"}</calcite-button></div></calcite-panel></calcite-sheet>` : null;
}
function z({ assistantsEnabled: i, messages: e, slot: t, helpTopicUrl: o }) {
  return d`<calcite-block .label=${e.assistantinformation ?? "Assistant information"} slot=${t ?? q} expanded class="info-block" scale=s><div class="info-heading-row"><h1 class="info-heading">${e.introducing ?? "Introducing Arcade Assistant (beta)"}</h1><calcite-chip .label=${e.new ?? "New"} kind=brand scale=s>${e.new ?? "New"}</calcite-chip></div>${i ? d`<p>${e.capabilities ?? "The assistant uses artificial intelligence to generate Arcade expressions."}</p><p>${e.keepinmind ?? "Keep in mind the following:"}<ul><li>${e.beconsise ?? "Be concise, but also clear in your request"}</li><li>${e.avoidambiguity ?? "Avoid ambiguity and vagueness"}</li><li>${e.moredetails ?? "you do not need to use exact field names in your instructions, but more detail is generally better"}</li></ul>${A((e.seedocumentation ?? "Please see the {documentation} for more information, including limitations and additional resources.").replace("{documentation}", `<calcite-link href=${o} target="_blank">${e.documentation ?? "documentation"}</calcite-link>`))}</p>` : d`<p>${e.useofassistant ?? "The assistant uses artificial intelligence to generate Arcade expressions. To enable Arcade Assistant (beta), the following must be true:"}</p><ul><li>${e.enabledinorg ?? "AI assistants are enabled in the organization settings"}</li><li>${e.enabledbetaapps ?? "Beta apps and capabilities are not blocked"}</li><li>${e.enabledroleprivilege ?? "Your role privilege allows you to use AI assistants"}</li></ul>`}</calcite-block>`;
}
function _e({ messages: i, onProceed: e, onExit: t, helpTopicUrl: o }) {
  return d`<calcite-dialog close-disabled placement=top .heading=${i.welcome ?? "Welcome to the new assistant experience"} slot=dialogs open width-scale=m id=welcome-dialog><h3 class="unstyled-h3">${i.beforeyougetstarted ?? "Before you get started be aware:"}</h3><ul><li>${i.maybeincorrect ?? "AI generated code may occasionally be incorrect or biased. Review carefully."}</li><li>${A((i.pleasereadhelp ?? "Read the Arcade Assistant (beta) {helpTopic} to get started and learn details on security, privacy and limitations.").replace("{helpTopic}", `<calcite-link href=${o} target="_blank">${i.helptopic ?? "help topic"}</calcite-link>`))}</li></ul><calcite-button id=welcome-proceed slot=footer-end @click=${e}>${i.proceed ?? "Proceed"}</calcite-button><calcite-button id=welcome-decline slot=footer-start @click=${t} kind=neutral>${i.exit ?? "Exit"}</calcite-button></calcite-dialog>`;
}
function De({ messages: i, suggestions: e, onSuggestionClick: t }) {
  return d`<calcite-block .heading=${i.promptsuggestions} expanded collapsible id=suggestion-block scale=s><div class="suggestions">${e.map((o) => d`<calcite-button round scale=s appearance=outline-fill kind=neutral .label=${i.promptsuggestion} class="suggestion-button" @click=${() => t?.(o)}>${o}</calcite-button>`)}</div></calcite-block>`;
}
const j = 200;
function B({ hidden: i = !1, expanded: e = !1, messages: t, cards: o, heading: a, collapsible: n = !1, showEffectsIcon: c = !1, onCopyCode: p, standalone: r }) {
  return d`<calcite-block .hidden=${i} id=result-block .heading=${a ?? t.besteffort ?? "Here is the assistant's best effort"} .expanded=${e} .collapsible=${n}>${c && d`<calcite-chip .label=${t.assistantresponses ?? "Assistant responses"} slot=content-start icon=effects scale=m class="suggestion-chips"></calcite-chip>` || ""}<calcite-card-group .label=${t.assistantresponses ?? "Assistant responses"}>${X(o, (s) => s.conversationId, (s) => d`<calcite-card><div slot=heading><div class="prior-prompt"><span>${s.priorPrompt.length > j ? `${s.priorPrompt.slice(0, j)}...` : s.priorPrompt}</span><calcite-action icon=duplicate scale=s slot=actions-end class="copy-prompt-button" text .id=${`copy-prompt-${s.conversationId}-${r ? "standalone" : "list"}`} @click=${(u) => {
    const l = u.currentTarget;
    navigator.clipboard.writeText(s.priorPrompt).then(() => {
      l.setAttribute("data-copied", "true"), setTimeout(() => l.removeAttribute("data-copied"), 1500);
    });
  }}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${s.conversationId}-${r ? "standalone" : "list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully ?? "copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully ?? "copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-prompt-${s.conversationId}-${r ? "standalone" : "list"}`} placement=top-start class="copy-tooltip">${t.copyprompttoclipboard ?? "Copy prompt to clipboard"}</calcite-tooltip></div>${s.message && r && d`<div class="response-error-container">${Ee({ errorMessage: s.message })}</div>` || ""}</div><div><div class="code-response-wrapper"><div class="positioned-code-content"><calcite-chip-group .label=${t.responsecontext ?? "Response Context"} scale=s>${s.message && !r && d`<calcite-tooltip .referenceElement=${`response-chip-${s.conversationId}-error`} placement=top-start>${s.message}</calcite-tooltip><calcite-chip .id=${`response-chip-${s.conversationId}-error`} .label=${t.error ?? "Error"} scale=s appearance=outline icon=exclamation-mark-triangle-f class="response-error-chip"></calcite-chip>` || ""}${Ne({ card: s, messages: t })}</calcite-chip-group></div><details class="collapsible-code" open><summary>Code response</summary><arcgis-code-viewer language=arcade round>${s.code}</arcgis-code-viewer></details></div></div><div slot=footer-start class="feedback-actions"><calcite-button class="add-to-editor-button hidden-above-380" @click=${() => s.onAddToEditor("add")} scale=s icon-start=plus round .label=${t.addtoeditor ?? "Add to editor"} .id=${`add-to-editor-button-${s.conversationId}-${r ? "standalone" : "list"}`}></calcite-button><calcite-tooltip class="hidden-above-380" .referenceElement=${`add-to-editor-button-${s.conversationId}-${r ? "standalone" : "list"}`} placement=top-start>${t.addtoeditor ?? "Add to editor"}</calcite-tooltip><calcite-button class="add-to-editor-button hidden-below-380" @click=${() => s.onAddToEditor("add")} scale=s icon-start=plus round>${t.addtoeditor ?? "Add to editor"}</calcite-button><calcite-button round icon-start=file-code kind=neutral scale=s @click=${() => s.onAddToEditor("replace")} class="response-secondary-action-button" .id=${`replace-${s.conversationId}-${r ? "standalone" : "list"}`}></calcite-button><calcite-tooltip .referenceElement=${`replace-${s.conversationId}-${r ? "standalone" : "list"}`} placement=top-start><span>${t.replaceineditor ?? "Replace all code in editor"}</span></calcite-tooltip><calcite-button round icon-start=copy-to-clipboard kind=neutral scale=s @click=${(u) => {
    const l = u.currentTarget;
    p(s.code).then(() => {
      l.setAttribute("data-copied", "true"), setTimeout(() => l.removeAttribute("data-copied"), 1500);
    });
  }} class="response-secondary-action-button" .id=${`copy-response-${s.conversationId}-${r ? "standalone" : "list"}`}></calcite-button><calcite-popover .referenceElement=${`copy-response-${s.conversationId}-${r ? "standalone" : "list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully ?? "copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully ?? "copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-response-${s.conversationId}-${r ? "standalone" : "list"}`} placement=top-start class="copy-tooltip">${t.copytoclipboard ?? "Copy code to clipboard"}</calcite-tooltip></div><div slot=footer-end class="feedback-actions"><calcite-action .text=${t.thumbsup ?? "Thumbs up"} scale=s icon=thumbs-up @click=${s.onThumbsUp} .id=${`thumbs-up-${s.conversationId}-${r ? "standalone" : "list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-up-${s.conversationId}-${r ? "standalone" : "list"}`} placement=top-start><span>${t.helpful ?? "Helpful"}</span></calcite-tooltip><calcite-action .text=${t.thumbsdown ?? "Thumbs down"} scale=s icon=thumbs-down @click=${s.onThumbsDown} .id=${`thumbs-down-${s.conversationId}-${r ? "standalone" : "list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-down-${s.conversationId}-${r ? "standalone" : "list"}`} placement=top-start><span>${t.unhelpful ?? "Unhelpful"}</span></calcite-tooltip></div></calcite-card>`)}</calcite-card-group></calcite-block>`;
}
const Ne = ({ card: i, messages: e }) => {
  const t = ue(), o = `response-chip-profile-${i.conversationId}-${t}`, a = (e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", i.profileId);
  return d`<calcite-tooltip .referenceElement=${o} placement=top-start class="contained-popover-or-tooltip">${a}</calcite-tooltip><calcite-chip .label=${i.profileId} scale=s appearance=outline icon=map-information id=${o ?? q}>${i.profileId}</calcite-chip>`;
}, H = (i) => i.type === "featureSet", E = (i) => {
  if (!ge(i))
    return [];
  const e = [];
  return i.relationships?.forEach((t) => {
    e.push(t.toJSON());
  }), e;
}, R = (i) => i.length > 0 ? { relationships: i } : {}, Ue = (i) => be(i).map((e) => ({
  alias: e.alias,
  name: e.name,
  type: e.type,
  ...e.domain ? { domain: e.domain } : {}
})), F = (i) => i ? { fields: Ue(i) } : { fields: [] };
async function G(i) {
  const e = await i.loadSource(), t = Z(e) && e.isTable, o = E(e);
  return {
    name: i.name,
    type: "featureSet",
    isTable: t,
    ...F(e?.fields),
    ...R(o)
  };
}
async function ee(i) {
  switch (i.type) {
    case "feature": {
      const e = await i.loadSource(), t = E(e);
      return {
        name: i.name,
        type: i.type,
        ...F(e?.fields),
        ...R(t)
      };
    }
    case "featureSet": {
      const e = await i.loadSource(), t = Z(e) && e.isTable;
      return {
        name: i.name,
        type: "featureSet",
        ...t ? { isTable: t } : {},
        ...F(e?.fields),
        ...R(E(e))
      };
    }
    case "featureSetCollection": {
      const e = await i.loadSource(), t = e?.layers.filter(H) ?? [], o = e?.tables.filter(H) ?? [], a = await Promise.all(t.map(G)), n = await Promise.all(o.map(G));
      return {
        name: i.name,
        type: "featureSetCollection",
        layers: a,
        tables: n
      };
    }
    case "dictionary": {
      const e = await Promise.all(i.dictionaryVariables.map(ee));
      return {
        name: i.name,
        type: "dictionary",
        attributes: e
      };
    }
    case "pixel": {
      const e = await i.loadSource();
      if (!e)
        return {
          name: i.name,
          type: "pixel"
        };
      const t = await fe(e);
      return {
        name: i.name,
        type: "pixel",
        members: t.map(J)
      };
    }
    case "voxel": {
      const e = await i.loadSource();
      if (!e)
        return {
          name: i.name,
          type: "voxel"
        };
      const t = await me(e);
      return {
        name: i.name,
        type: "voxel",
        members: t.map(J)
      };
    }
    case "array":
      return {
        name: i.name,
        type: "array",
        elementType: i.elementType.type
      };
    case "number":
    case "text":
    case "boolean":
    case "date":
    case "knowledgeGraph":
    case "dateOnly":
    case "geometry":
    case "time":
      return {
        name: i.name,
        type: i.type
      };
  }
}
function J(i) {
  return i.type === "array" ? {
    name: i.name,
    type: "array",
    elementType: i.elementType.type
  } : {
    name: i.name,
    type: i.type
    // casting bc member types shouldn't be feature, featureset, etc.
  };
}
async function Le(i) {
  return {
    variables: await Promise.all(i.variables.map(ee))
  };
}
const Oe = 1e5;
function ze(i) {
  const e = new TextEncoder().encode(i).length;
  return Math.ceil(e / 3.5);
}
function M(i) {
  return ze(JSON.stringify(i));
}
function je(i) {
  const e = (o) => ({
    name: o.name,
    type: o.type,
    ...o.isTable ? { isTable: o.isTable } : {},
    ...o.relationships ? { relationships: o.relationships } : {}
  }), t = (o) => {
    switch (o.type) {
      case "feature":
      case "featureSet":
      case "knowledgeGraph":
        return {
          name: o.name,
          type: o.type,
          ..."isTable" in o && o.isTable ? { isTable: o.isTable } : {},
          ..."relationships" in o ? { relationships: o.relationships } : {}
        };
      case "featureSetCollection":
        return {
          name: o.name,
          type: "featureSetCollection",
          layers: o.layers.map(e),
          tables: o.tables.map(e)
        };
      case "dictionary":
        return {
          name: o.name,
          type: "dictionary",
          attributes: o.attributes.map(t)
        };
      case "pixel":
      case "voxel":
        return {
          name: o.name,
          type: o.type
        };
      case "array":
        return {
          name: o.name,
          type: "array",
          ...o.elementType ? { elementType: o.elementType } : {}
        };
      default:
        return o;
    }
  };
  return {
    variables: i.variables.map(t)
  };
}
function Be(i) {
  const e = i.variables, t = e.length, o = e.find((n) => n.name === "$feature") ?? e.find((n) => n.type === "feature") ?? e[0], a = o ? [o] : [];
  return {
    context: { variables: a },
    wasReduced: t !== a.length,
    reducedToVariableName: o?.name
  };
}
function He(i) {
  return M(i) > Oe;
}
var Ge = Object.defineProperty, Je = Object.getOwnPropertyDescriptor, m = (i, e, t, o) => {
  for (var a = o > 1 ? void 0 : o ? Je(e, t) : e, n = i.length - 1, c; n >= 0; n--)
    (c = i[n]) && (a = (o ? c(e, t, a) : c(a)) || a);
  return o && a && Ge(e, t, a), a;
};
let h = class extends ve {
  constructor(i) {
    super(i), this.viewMode = "prompt", this.confirmationActive = !1, this.contextReducedNoticeDismissed = !1, this.splashActive = !0, this.isSubmitting = !1, this.question = "", this.history = [], this.feedback = { active: !1 };
  }
};
m([
  f()
], h.prototype, "viewMode", 2);
m([
  f()
], h.prototype, "confirmationActive", 2);
m([
  f()
], h.prototype, "contextReducedNoticeDismissed", 2);
m([
  f()
], h.prototype, "splashActive", 2);
m([
  f()
], h.prototype, "isSubmitting", 2);
m([
  f()
], h.prototype, "errorMessage", 2);
m([
  f()
], h.prototype, "promptValidationMessage", 2);
m([
  f()
], h.prototype, "question", 2);
m([
  f()
], h.prototype, "history", 2);
m([
  f()
], h.prototype, "feedback", 2);
m([
  f()
], h.prototype, "context", 2);
h = m([
  ye("ArcadeAssistantViewState")
], h);
const Qe = "arcade_generation", We = "ArcadeCodeRequest", Q = "visualization", W = "ArcadeAssistant", Ye = [
  "your_comments",
  "user_evaluation",
  "question",
  "answer",
  "useragent",
  "_source",
  "version",
  "context",
  "extras",
  "conversation_id",
  "privacy_statement"
];
let Y = [], K = !0;
class Ke extends se {
  constructor() {
    super(...arguments), this.textAreaRef = re(), this.messages = le(), this._feedbackService = void 0, this.viewState = new h(), this.handleFeedbackButton = (e, t) => {
      this.updateViewState({
        feedback: { active: !0, value: e, item: t, termsAccepted: !1, text: "", submitting: !1 }
      });
    }, this.handleFeedbackSheetClose = () => {
      this.updateViewState({ feedback: { active: !1 } });
    }, this.handleFeedbackSubmit = async () => {
      if (!this.viewState.feedback.active)
        return;
      this.updateViewState({ feedback: { ...this.viewState.feedback, submitting: !0 } });
      const e = await this.ensureFeedbackService();
      if (!e) {
        this.handleFeedbackSheetClose();
        return;
      }
      let t = !1, o;
      this.viewState.feedback.item.conversationId === this.viewState.history[0]?.conversationId && this.viewState.viewMode === "result" ? (o = this.viewState.context, t = !0) : o = this.viewState.feedback.item.contextSnapshot;
      const a = U.applicationName;
      !a && !this.appVersion && w("warn", this, "esriConfig.applicationName is not set. Consider setting it to help identify the application version in feedback.");
      const { value: n, text: c, termsAccepted: p, item: { question: r, formattedScript: s, conversationId: u } } = this.viewState.feedback, l = {
        user_evaluation: n,
        your_comments: c || void 0,
        question: r ?? "",
        answer: this.encodeAnswerForFeedback(s),
        useragent: navigator.userAgent,
        _source: W,
        version: this.appVersion || a || "NOT_SET",
        context: o ? JSON.stringify({
          ...o,
          /** Indicates whether the context is a snapshot or the full context */
          isSnapshot: !t
        }) : "",
        extras: o?.profileId ?? "",
        conversation_id: u ?? "",
        privacy_statement: p ? "I_agree" : ""
      };
      try {
        await e.applyEdits({ addFeatures: [new L({ attributes: l })] });
      } catch (v) {
        w("error", this, "Error submitting feedback.", { detail: { error: v } });
      }
      this.handleFeedbackSheetClose();
    }, this.handleClose = (e) => {
      this.closed = !0, this.closePanel?.(e);
    }, this.setQuestionState = (e) => {
      this.updateViewState({ question: e, promptValidationMessage: void 0 });
    }, this.setFeedbackState = (e) => {
      this.updateViewState({ feedback: e });
    }, this.onSuggestionClick = (e) => {
      this.textAreaRef.value && (this.textAreaRef.value.value = e, this.textAreaRef.value.setFocus(), this.setQuestionState(e));
    }, this.helpBase = "", this.assistantsEnabled = !1, this.closed = !1, this.disableQuestionAnswerLogging = !1;
  }
  static {
    this.properties = { closePanel: 0, insertText: 0, helpBase: 1, assistantsEnabled: 5, portalUrl: 1, serviceUrl: 1, closed: 7, editorRef: 0, feedbackServiceUrl: 1, appVersion: 1, disableQuestionAnswerLogging: 5 };
  }
  static {
    this.styles = we;
  }
  get disclaimerComment() {
    return `// ${this.messages.disclaimercomment}
// ${this.messages.disclaimerpt2 ?? "AI-generated content may be inaccurate. Review before using."}`;
  }
  get assistantOverviewDocUrl() {
    return `${this.helpBase ?? "https://doc.arcgis.com/en/arcgis-online/"}create-maps/understand-arcade-assistant.htm`;
  }
  get usingTheAssitantDocUrl() {
    return `${this.helpBase ?? "https://doc.arcgis.com/en/arcgis-online/"}create-maps/understand-arcade-assistant.htm`;
  }
  async destroy() {
  }
  connectedCallback() {
    super.connectedCallback(), this.updateViewState({ history: Y, splashActive: K });
  }
  load() {
    const e = async () => {
      const t = this.getModel();
      if (!t) {
        this.updateViewState({ context: void 0 });
        return;
      }
      const o = await this.getProfileAndMetadata(t.uri);
      this.updateViewState({
        context: o,
        contextReducedNoticeDismissed: o.contextTooLarge ? !1 : this.viewState.contextReducedNoticeDismissed
      });
    };
    e().catch((t) => {
      w("error", this, "Error setting initial context.", { detail: { error: t } });
    }), this.manager.onLifecycle(() => {
      const t = D.onModelContextDidChange(async () => {
        e().catch((a) => {
          w("error", this, "Error setting context.", { detail: { error: a } });
        });
      });
      return { remove: () => {
        t.dispose();
      } };
    });
  }
  disconnectedCallback() {
    super.disconnectedCallback(), Y = this.viewState.history, K = this.viewState.splashActive, this.copySuccessTimer && (clearTimeout(this.copySuccessTimer), this.copySuccessTimer = void 0);
  }
  createFeedbackContextSnapshot(e) {
    const t = je(e.metadata);
    return {
      ...e,
      metadata: t,
      estimatedTokens: M(t)
    };
  }
  encodeAnswerForFeedback(e) {
    return encodeURIComponent(e ?? "");
  }
  updateViewState(e) {
    this.viewState.set(e);
  }
  getHistoryCards() {
    return this.viewState.history.reduce((e, t) => (!t.script || (e.push({
      priorPrompt: t.question,
      code: t.formattedScript || t.error || "",
      profileId: t.profile ?? Q,
      onAddToEditor: (o) => {
        de(this.editorRef.editorInstance, t.formattedScript ?? "", o, this.disclaimerComment);
      },
      onThumbsUp: () => this.handleFeedbackButton("good", t),
      onThumbsDown: () => this.handleFeedbackButton("bad", t),
      conversationId: t.conversationId ?? "",
      message: t.message
    }), this.viewState.viewMode === "result"), e), []);
  }
  async ensureFeedbackService() {
    if (this._feedbackService)
      return this._feedbackService;
    if (!this.feedbackServiceUrl)
      return;
    const e = new he({ url: this.feedbackServiceUrl });
    await e.load();
    const t = Ye.filter((o) => !e.fields.some((a) => a.name === o));
    if (t.length > 0) {
      w("error", this, `Missing the following fields in feedback service: ${t.join(", ")}. Feedback will not be logged.`);
      return;
    }
    return this._feedbackService = e, e;
  }
  async logInteractionToFeedbackService(e) {
    if (this.disableQuestionAnswerLogging || !e.question)
      return;
    let t;
    try {
      t = await this.ensureFeedbackService();
    } catch (c) {
      w("error", this, "Error initializing feedback service for interaction logging.", { detail: { error: c } });
      return;
    }
    if (!t)
      return;
    const o = U.applicationName, a = e.contextSnapshot, n = {
      question: e.question,
      answer: this.encodeAnswerForFeedback(e.answer),
      useragent: navigator.userAgent,
      _source: W,
      version: this.appVersion || o || "NOT_SET",
      // we send the snapshotted context in the automatic logging, rather than the full context, to avoid accidentally logging sensitive information that may be in the full context.
      context: a ? JSON.stringify({ ...a, isSnapshot: !0 }) : "",
      extras: a?.profileId ?? "",
      conversation_id: e.conversationId ?? "",
      privacy_statement: ""
    };
    try {
      await t.applyEdits({ addFeatures: [new L({ attributes: n })] });
    } catch (c) {
      w("error", this, "Error logging arcade assistant question/answer interaction.", { detail: { error: c } });
    }
  }
  getModel() {
    return this.editorRef.editorInstance?.getModel();
  }
  async submitQuestion() {
    if (!this.viewState.question)
      return;
    const e = this.viewState.question;
    this.updateViewState({ isSubmitting: !0, errorMessage: void 0 });
    let t, o;
    try {
      const a = this.getModel();
      if (!a || !this.serviceUrl)
        return;
      const n = this.viewState.context ?? await this.getProfileAndMetadata(a.uri);
      t = this.createFeedbackContextSnapshot(n);
      const c = await this.getToken(), p = await $e({
        baseUrl: this.serviceUrl,
        skillId: Qe,
        message: e,
        authToken: c,
        context: {
          kind: We,
          context: {
            profile_id: n.profileId,
            metadata: [n.metadata]
          }
        }
      });
      o = p?.[0]?.conversationId;
      const r = p.find((s) => s.context?.kind === "ArcadeCodeResponse");
      if (!r) {
        await this.logInteractionToFeedbackService({
          question: e,
          answer: "No ArcadeCodeResponse returned.",
          contextSnapshot: t,
          conversationId: o
        });
        return;
      }
      if (r.context?.kind === "ArcadeCodeResponse") {
        const s = this.createFeedbackContextSnapshot(n), u = pe(r?.context?.arcadeCode?.code ?? "");
        this.updateViewState({
          history: [
            {
              script: r?.context?.arcadeCode?.code,
              formattedScript: u,
              error: void 0,
              question: e,
              profile: n.profileId,
              conversationId: r.conversationId,
              contextSnapshot: s,
              ...r.message ? { message: r.message } : {}
            },
            ...this.viewState.history
          ],
          viewMode: "result",
          errorMessage: void 0
        }), await this.logInteractionToFeedbackService({
          question: e,
          answer: u,
          contextSnapshot: t,
          conversationId: r.conversationId
        });
      }
    } catch (a) {
      const n = a instanceof Error && a.name === "ArcadeAssistantError" ? ke(a) || this.messages.erroroccurred || "An error occurred." : this.messages.erroroccurred || "An error occurred.";
      this.updateViewState({ errorMessage: n }), await this.logInteractionToFeedbackService({
        question: e,
        answer: n,
        contextSnapshot: t,
        conversationId: o
      }), w("error", this, "Error submitting question", { detail: { error: a } });
    } finally {
      this.updateViewState({ isSubmitting: !1 });
    }
  }
  async getToken() {
    const { token: e } = await ce.getCredential(this.portalUrl);
    return e;
  }
  async getProfileAndMetadata(e) {
    let t = Q;
    const o = D.getEditorProfileForModel(e);
    o?.loaded || await o?.loadSource();
    const a = this.editorRef.profile;
    a && "id" in a && (t = a.id);
    const n = o ? await Le(o) : { variables: [] }, c = He(n), p = c ? Be(n) : void 0, s = p ? p.context : n, u = M(s);
    return {
      profileId: t,
      metadata: s,
      contextTooLarge: c,
      reducedToVariableName: p?.reducedToVariableName,
      estimatedTokens: u
    };
  }
  onCopyCode(e) {
    const t = e ? `${this.disclaimerComment}
${e}` : "";
    return navigator.clipboard.writeText(t);
  }
  render() {
    if (this.closed)
      return null;
    const e = this.viewState.viewMode === "result", t = this.getHistoryCards();
    return this.assistantsEnabled ? d`<calcite-flow><calcite-flow-item closable heading-level=2 .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${this.viewState.splashActive && d`<calcite-scrim></calcite-scrim>` || ""}${Te({ messages: this.messages })}${Ie({ messages: this.messages, popoverContent: z({ assistantsEnabled: this.assistantsEnabled, messages: this.messages, helpTopicUrl: this.usingTheAssitantDocUrl }) })}<calcite-shell class="unstyled-shell">${this.viewState.splashActive && _e({ messages: this.messages, onProceed: () => {
      this.updateViewState({ splashActive: !1 });
    }, helpTopicUrl: this.assistantOverviewDocUrl, onExit: (o) => this.closePanel?.(o) }) || ""}${Re({ active: this.viewState.confirmationActive, setActive: (o) => this.updateViewState({ confirmationActive: o }), messages: this.messages })}${Me({ isDisabled: this.viewState.isSubmitting, isReadOnly: !1, setQuestion: this.setQuestionState, setIsViewingResult: (o) => this.updateViewState({ viewMode: o ? "result" : "prompt" }), mode: e ? "refine" : "prompt", textAreaRef: this.textAreaRef, question: this.viewState.question, errorMessage: this.viewState.errorMessage, setErrorMessage: (o) => this.updateViewState({ errorMessage: o }), promptValidationMessage: this.viewState.promptValidationMessage, setPromptValidationMessage: (o) => this.updateViewState({ promptValidationMessage: o }), submitQuestion: this.submitQuestion.bind(this), assistantRef: this.el, messages: this.messages, context: this.viewState.context, contextReducedNoticeDismissed: this.viewState.contextReducedNoticeDismissed, setContextReducedNoticeDismissed: (o) => this.updateViewState({ contextReducedNoticeDismissed: o }) })}<calcite-block-group .label=${this.messages.interactiveblocks ?? "interactive blocks"}>${!e && !this.viewState.isSubmitting && De({ messages: this.messages, suggestions: [this.messages.prompsuggestion1 ?? "", this.messages.prompsuggestion2 ?? ""], onSuggestionClick: this.onSuggestionClick }) || ""}<calcite-block .hidden=${!this.viewState.isSubmitting} .heading=${this.messages.generatingresponse ?? "Generating response..."}></calcite-block>${B({
      expanded: e,
      messages: this.messages,
      collapsible: !0,
      showEffectsIcon: !0,
      /** Only show the latest history card */
      cards: t.length ? [t[0]] : [],
      heading: this.messages.besteffort ?? "Here's the assistant's best effort",
      hidden: this.viewState.isSubmitting || !e,
      onCopyCode: this.onCopyCode.bind(this),
      standalone: !0
    })}${B({
      expanded: !e,
      messages: this.messages,
      collapsible: !0,
      /**
       * When the user is viewing the latest result, we display the first history card
       * (historyCards[0]) separately at the top in "standalone" mode.
       * To avoid showing the same card twice, we remove (slice out) the first card
       * from the list of recent prompts below.
       */
      cards: e ? t.slice(1) : t,
      heading: this.messages.recentprompts ?? "Recent prompts",
      hidden: this.viewState.isSubmitting || this.viewState.history.length === 0,
      onCopyCode: this.onCopyCode.bind(this)
    })}</calcite-block-group>${this.viewState.feedback.active ? Ve({ setOpen: this.handleFeedbackSheetClose, messages: this.messages, onSubmit: this.handleFeedbackSubmit, feedback: this.viewState.feedback, setFeedback: this.setFeedbackState, learnMoreUrl: this.assistantOverviewDocUrl }) : null}</calcite-shell></calcite-flow-item></calcite-flow>` : d`<calcite-flow><calcite-flow-item .selected=${!e} closable heading-level=2 .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${z({ slot: "content-top", messages: this.messages, assistantsEnabled: this.assistantsEnabled, helpTopicUrl: this.usingTheAssitantDocUrl })}</calcite-flow-item></calcite-flow>`;
  }
}
ie("arcgis-arcade-coding-assistant", Ke);
export {
  Ke as ArcgisArcadeCodingAssistant
};
