import { j as jsxRuntimeExports, h as useTranslation, e as useWidgetsCore, k as useWidgetsLogger, u as useQueryClient, L as Loader } from "./root-9-q2S5y9.js";
import { g as globals_exports, c as createStringInterpolator2, a as colors2, b as createHost, A as AnimatedObject, e as eachProp, d as is, F as FluidValue, f as each, h as getFluidValue, j as hasFluidValue, k as addFluidObserver, r as removeFluidObserver, l as callFluidObservers, t as toArray, $ as $b1b2314f5f9a1d84$export$25bec8c6f54ee79a, m as $6ed0406888f73fc4$export$c7b2cbe3552a0d05, n as $8927f6f2acc4f386$export$250ffa63cdc0d034, _ as _extends, o as $c512c27ab02ef895$export$50c7b4e9d9f19c1, p as $921a889cee6df7e8$export$99c2b779aa4e8b8b, q as $5cb92bef7577960e$export$177fb62ff3ec1f22, s as $1746a345f3d73bb7$export$f680877a34711e37, u as _baseUnset, v as useTransition, w as ms, x as adaptivecards, y as textToHtml, z as useQuery, B as distExports, C as createAnchor, D as name } from "./conversation-CE-oPt9i.js";
import { r as reactExports, U as reactDomExports, g as getDefaultExportFromCjs, ah as isExecuteAction, ai as isOpenUrlAction, aj as isShowCardAction, ak as isSubmitAction, o as objectType, s as stringType, aa as literalType, al as arrayType, a4 as adaptiveCardObjectSchema } from "./index-DR90vHXf.js";
import { q as tw, l as tx, k as css, p as keyframes } from "./core-zptsbVGz.js";
import { c as isArray_1, w as isPlainObject_1, x as _copyObject, m as merge } from "./merge-C2TSKpUQ.js";
import { c as _arrayMap, e as _castPath } from "./_baseEach-B4Xqxl22.js";
import { a as _getAllKeysIn, _ as _baseClone } from "./_baseClone-BJeVa6tG.js";
import { a as _flatRest } from "./_flatRest-DdnFwxbP.js";
function ChevronLeftIcon({
  title,
  titleId,
  ...props
}, svgRef) {
  return /* @__PURE__ */ reactExports.createElement("svg", Object.assign({
    xmlns: "http://www.w3.org/2000/svg",
    fill: "none",
    viewBox: "0 0 24 24",
    strokeWidth: 1.5,
    stroke: "currentColor",
    "aria-hidden": "true",
    "data-slot": "icon",
    ref: svgRef,
    "aria-labelledby": titleId
  }, props), title ? /* @__PURE__ */ reactExports.createElement("title", {
    id: titleId
  }, title) : null, /* @__PURE__ */ reactExports.createElement("path", {
    strokeLinecap: "round",
    strokeLinejoin: "round",
    d: "M15.75 19.5 8.25 12l7.5-7.5"
  }));
}
const ForwardRef = reactExports.forwardRef(ChevronLeftIcon);
const ChevronLeftIcon$1 = ForwardRef;
var isCustomPropRE = /^--/;
function dangerousStyleValue(name2, value) {
  if (value == null || typeof value === "boolean" || value === "")
    return "";
  if (typeof value === "number" && value !== 0 && !isCustomPropRE.test(name2) && !(isUnitlessNumber.hasOwnProperty(name2) && isUnitlessNumber[name2]))
    return value + "px";
  return ("" + value).trim();
}
var attributeCache = {};
function applyAnimatedValues(instance, props) {
  if (!instance.nodeType || !instance.setAttribute) {
    return false;
  }
  const isFilterElement = instance.nodeName === "filter" || instance.parentNode && instance.parentNode.nodeName === "filter";
  const { style, children, scrollTop, scrollLeft, viewBox, ...attributes } = props;
  const values = Object.values(attributes);
  const names = Object.keys(attributes).map(
    (name2) => isFilterElement || instance.hasAttribute(name2) ? name2 : attributeCache[name2] || (attributeCache[name2] = name2.replace(
      /([A-Z])/g,
      // Attributes are written in dash case
      (n) => "-" + n.toLowerCase()
    ))
  );
  if (children !== void 0) {
    instance.textContent = children;
  }
  for (const name2 in style) {
    if (style.hasOwnProperty(name2)) {
      const value = dangerousStyleValue(name2, style[name2]);
      if (isCustomPropRE.test(name2)) {
        instance.style.setProperty(name2, value);
      } else {
        instance.style[name2] = value;
      }
    }
  }
  names.forEach((name2, i) => {
    instance.setAttribute(name2, values[i]);
  });
  if (scrollTop !== void 0) {
    instance.scrollTop = scrollTop;
  }
  if (scrollLeft !== void 0) {
    instance.scrollLeft = scrollLeft;
  }
  if (viewBox !== void 0) {
    instance.setAttribute("viewBox", viewBox);
  }
}
var isUnitlessNumber = {
  animationIterationCount: true,
  borderImageOutset: true,
  borderImageSlice: true,
  borderImageWidth: true,
  boxFlex: true,
  boxFlexGroup: true,
  boxOrdinalGroup: true,
  columnCount: true,
  columns: true,
  flex: true,
  flexGrow: true,
  flexPositive: true,
  flexShrink: true,
  flexNegative: true,
  flexOrder: true,
  gridRow: true,
  gridRowEnd: true,
  gridRowSpan: true,
  gridRowStart: true,
  gridColumn: true,
  gridColumnEnd: true,
  gridColumnSpan: true,
  gridColumnStart: true,
  fontWeight: true,
  lineClamp: true,
  lineHeight: true,
  opacity: true,
  order: true,
  orphans: true,
  tabSize: true,
  widows: true,
  zIndex: true,
  zoom: true,
  // SVG-related properties
  fillOpacity: true,
  floodOpacity: true,
  stopOpacity: true,
  strokeDasharray: true,
  strokeDashoffset: true,
  strokeMiterlimit: true,
  strokeOpacity: true,
  strokeWidth: true
};
var prefixKey = (prefix, key) => prefix + key.charAt(0).toUpperCase() + key.substring(1);
var prefixes = ["Webkit", "Ms", "Moz", "O"];
isUnitlessNumber = Object.keys(isUnitlessNumber).reduce((acc, prop) => {
  prefixes.forEach((prefix) => acc[prefixKey(prefix, prop)] = acc[prop]);
  return acc;
}, isUnitlessNumber);
var domTransforms = /^(matrix|translate|scale|rotate|skew)/;
var pxTransforms = /^(translate)/;
var degTransforms = /^(rotate|skew)/;
var addUnit = (value, unit) => is.num(value) && value !== 0 ? value + unit : value;
var isValueIdentity = (value, id) => is.arr(value) ? value.every((v) => isValueIdentity(v, id)) : is.num(value) ? value === id : parseFloat(value) === id;
var AnimatedStyle = class extends AnimatedObject {
  constructor({ x, y, z, ...style }) {
    const inputs = [];
    const transforms = [];
    if (x || y || z) {
      inputs.push([x || 0, y || 0, z || 0]);
      transforms.push((xyz) => [
        `translate3d(${xyz.map((v) => addUnit(v, "px")).join(",")})`,
        // prettier-ignore
        isValueIdentity(xyz, 0)
      ]);
    }
    eachProp(style, (value, key) => {
      if (key === "transform") {
        inputs.push([value || ""]);
        transforms.push((transform) => [transform, transform === ""]);
      } else if (domTransforms.test(key)) {
        delete style[key];
        if (is.und(value))
          return;
        const unit = pxTransforms.test(key) ? "px" : degTransforms.test(key) ? "deg" : "";
        inputs.push(toArray(value));
        transforms.push(
          key === "rotate3d" ? ([x2, y2, z2, deg]) => [
            `rotate3d(${x2},${y2},${z2},${addUnit(deg, unit)})`,
            isValueIdentity(deg, 0)
          ] : (input) => [
            `${key}(${input.map((v) => addUnit(v, unit)).join(",")})`,
            isValueIdentity(input, key.startsWith("scale") ? 1 : 0)
          ]
        );
      }
    });
    if (inputs.length) {
      style.transform = new FluidTransform(inputs, transforms);
    }
    super(style);
  }
};
var FluidTransform = class extends FluidValue {
  constructor(inputs, transforms) {
    super();
    this.inputs = inputs;
    this.transforms = transforms;
    this._value = null;
  }
  get() {
    return this._value || (this._value = this._get());
  }
  _get() {
    let transform = "";
    let identity = true;
    each(this.inputs, (input, i) => {
      const arg1 = getFluidValue(input[0]);
      const [t, id] = this.transforms[i](
        is.arr(arg1) ? arg1 : input.map(getFluidValue)
      );
      transform += " " + t;
      identity = identity && id;
    });
    return identity ? "none" : transform;
  }
  // Start observing our inputs once we have an observer.
  observerAdded(count) {
    if (count == 1)
      each(
        this.inputs,
        (input) => each(
          input,
          (value) => hasFluidValue(value) && addFluidObserver(value, this)
        )
      );
  }
  // Stop observing our inputs once we have no observers.
  observerRemoved(count) {
    if (count == 0)
      each(
        this.inputs,
        (input) => each(
          input,
          (value) => hasFluidValue(value) && removeFluidObserver(value, this)
        )
      );
  }
  eventObserved(event) {
    if (event.type == "change") {
      this._value = null;
    }
    callFluidObservers(this, event);
  }
};
var primitives = [
  "a",
  "abbr",
  "address",
  "area",
  "article",
  "aside",
  "audio",
  "b",
  "base",
  "bdi",
  "bdo",
  "big",
  "blockquote",
  "body",
  "br",
  "button",
  "canvas",
  "caption",
  "cite",
  "code",
  "col",
  "colgroup",
  "data",
  "datalist",
  "dd",
  "del",
  "details",
  "dfn",
  "dialog",
  "div",
  "dl",
  "dt",
  "em",
  "embed",
  "fieldset",
  "figcaption",
  "figure",
  "footer",
  "form",
  "h1",
  "h2",
  "h3",
  "h4",
  "h5",
  "h6",
  "head",
  "header",
  "hgroup",
  "hr",
  "html",
  "i",
  "iframe",
  "img",
  "input",
  "ins",
  "kbd",
  "keygen",
  "label",
  "legend",
  "li",
  "link",
  "main",
  "map",
  "mark",
  "menu",
  "menuitem",
  "meta",
  "meter",
  "nav",
  "noscript",
  "object",
  "ol",
  "optgroup",
  "option",
  "output",
  "p",
  "param",
  "picture",
  "pre",
  "progress",
  "q",
  "rp",
  "rt",
  "ruby",
  "s",
  "samp",
  "script",
  "section",
  "select",
  "small",
  "source",
  "span",
  "strong",
  "style",
  "sub",
  "summary",
  "sup",
  "table",
  "tbody",
  "td",
  "textarea",
  "tfoot",
  "th",
  "thead",
  "time",
  "title",
  "tr",
  "track",
  "u",
  "ul",
  "var",
  "video",
  "wbr",
  // SVG
  "circle",
  "clipPath",
  "defs",
  "ellipse",
  "foreignObject",
  "g",
  "image",
  "line",
  "linearGradient",
  "mask",
  "path",
  "pattern",
  "polygon",
  "polyline",
  "radialGradient",
  "rect",
  "stop",
  "svg",
  "text",
  "tspan"
];
globals_exports.assign({
  batchedUpdates: reactDomExports.unstable_batchedUpdates,
  createStringInterpolator: createStringInterpolator2,
  colors: colors2
});
var host = createHost(primitives, {
  applyAnimatedValues,
  createAnimatedStyle: (style) => new AnimatedStyle(style),
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  getComponentProps: ({ scrollTop, scrollLeft, ...props }) => props
});
var animated = host.animated;
function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
  return function handleEvent(event) {
    originalEventHandler === null || originalEventHandler === void 0 || originalEventHandler(event);
    if (checkForDefaultPrevented === false || !event.defaultPrevented)
      return ourEventHandler === null || ourEventHandler === void 0 ? void 0 : ourEventHandler(event);
  };
}
function $71cd76cc60e0454e$export$6f32135080cb4c3({ prop, defaultProp, onChange = () => {
} }) {
  const [uncontrolledProp, setUncontrolledProp] = $71cd76cc60e0454e$var$useUncontrolledState({
    defaultProp,
    onChange
  });
  const isControlled = prop !== void 0;
  const value1 = isControlled ? prop : uncontrolledProp;
  const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange);
  const setValue = reactExports.useCallback((nextValue) => {
    if (isControlled) {
      const setter = nextValue;
      const value = typeof nextValue === "function" ? setter(prop) : nextValue;
      if (value !== prop)
        handleChange(value);
    } else
      setUncontrolledProp(nextValue);
  }, [
    isControlled,
    prop,
    setUncontrolledProp,
    handleChange
  ]);
  return [
    value1,
    setValue
  ];
}
function $71cd76cc60e0454e$var$useUncontrolledState({ defaultProp, onChange }) {
  const uncontrolledState = reactExports.useState(defaultProp);
  const [value] = uncontrolledState;
  const prevValueRef = reactExports.useRef(value);
  const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange);
  reactExports.useEffect(() => {
    if (prevValueRef.current !== value) {
      handleChange(value);
      prevValueRef.current = value;
    }
  }, [
    value,
    prevValueRef,
    handleChange
  ]);
  return uncontrolledState;
}
const $d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
const $d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
const $d3863c46a17e8a28$var$EVENT_OPTIONS = {
  bubbles: false,
  cancelable: true
};
const $d3863c46a17e8a28$export$20e40289641fbbb6 = /* @__PURE__ */ reactExports.forwardRef((props, forwardedRef) => {
  const { loop = false, trapped = false, onMountAutoFocus: onMountAutoFocusProp, onUnmountAutoFocus: onUnmountAutoFocusProp, ...scopeProps } = props;
  const [container1, setContainer] = reactExports.useState(null);
  const onMountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onMountAutoFocusProp);
  const onUnmountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onUnmountAutoFocusProp);
  const lastFocusedElementRef = reactExports.useRef(null);
  const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(
    forwardedRef,
    (node) => setContainer(node)
  );
  const focusScope = reactExports.useRef({
    paused: false,
    pause() {
      this.paused = true;
    },
    resume() {
      this.paused = false;
    }
  }).current;
  reactExports.useEffect(() => {
    if (trapped) {
      let handleFocusIn = function(event) {
        if (focusScope.paused || !container1)
          return;
        const target = event.target;
        if (container1.contains(target))
          lastFocusedElementRef.current = target;
        else
          $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {
            select: true
          });
      }, handleFocusOut = function(event) {
        if (focusScope.paused || !container1)
          return;
        const relatedTarget = event.relatedTarget;
        if (relatedTarget === null)
          return;
        if (!container1.contains(relatedTarget))
          $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {
            select: true
          });
      }, handleMutations = function(mutations) {
        const focusedElement = document.activeElement;
        if (focusedElement !== document.body)
          return;
        for (const mutation of mutations)
          if (mutation.removedNodes.length > 0)
            $d3863c46a17e8a28$var$focus(container1);
      };
      document.addEventListener("focusin", handleFocusIn);
      document.addEventListener("focusout", handleFocusOut);
      const mutationObserver = new MutationObserver(handleMutations);
      if (container1)
        mutationObserver.observe(container1, {
          childList: true,
          subtree: true
        });
      return () => {
        document.removeEventListener("focusin", handleFocusIn);
        document.removeEventListener("focusout", handleFocusOut);
        mutationObserver.disconnect();
      };
    }
  }, [
    trapped,
    container1,
    focusScope.paused
  ]);
  reactExports.useEffect(() => {
    if (container1) {
      $d3863c46a17e8a28$var$focusScopesStack.add(focusScope);
      const previouslyFocusedElement = document.activeElement;
      const hasFocusedCandidate = container1.contains(previouslyFocusedElement);
      if (!hasFocusedCandidate) {
        const mountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);
        container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
        container1.dispatchEvent(mountEvent);
        if (!mountEvent.defaultPrevented) {
          $d3863c46a17e8a28$var$focusFirst($d3863c46a17e8a28$var$removeLinks($d3863c46a17e8a28$var$getTabbableCandidates(container1)), {
            select: true
          });
          if (document.activeElement === previouslyFocusedElement)
            $d3863c46a17e8a28$var$focus(container1);
        }
      }
      return () => {
        container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
        setTimeout(() => {
          const unmountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);
          container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
          container1.dispatchEvent(unmountEvent);
          if (!unmountEvent.defaultPrevented)
            $d3863c46a17e8a28$var$focus(previouslyFocusedElement !== null && previouslyFocusedElement !== void 0 ? previouslyFocusedElement : document.body, {
              select: true
            });
          container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
          $d3863c46a17e8a28$var$focusScopesStack.remove(focusScope);
        }, 0);
      };
    }
  }, [
    container1,
    onMountAutoFocus,
    onUnmountAutoFocus,
    focusScope
  ]);
  const handleKeyDown = reactExports.useCallback((event) => {
    if (!loop && !trapped)
      return;
    if (focusScope.paused)
      return;
    const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
    const focusedElement = document.activeElement;
    if (isTabKey && focusedElement) {
      const container = event.currentTarget;
      const [first, last] = $d3863c46a17e8a28$var$getTabbableEdges(container);
      const hasTabbableElementsInside = first && last;
      if (!hasTabbableElementsInside) {
        if (focusedElement === container)
          event.preventDefault();
      } else {
        if (!event.shiftKey && focusedElement === last) {
          event.preventDefault();
          if (loop)
            $d3863c46a17e8a28$var$focus(first, {
              select: true
            });
        } else if (event.shiftKey && focusedElement === first) {
          event.preventDefault();
          if (loop)
            $d3863c46a17e8a28$var$focus(last, {
              select: true
            });
        }
      }
    }
  }, [
    loop,
    trapped,
    focusScope.paused
  ]);
  return /* @__PURE__ */ reactExports.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
    tabIndex: -1
  }, scopeProps, {
    ref: composedRefs,
    onKeyDown: handleKeyDown
  }));
});
function $d3863c46a17e8a28$var$focusFirst(candidates, { select = false } = {}) {
  const previouslyFocusedElement = document.activeElement;
  for (const candidate of candidates) {
    $d3863c46a17e8a28$var$focus(candidate, {
      select
    });
    if (document.activeElement !== previouslyFocusedElement)
      return;
  }
}
function $d3863c46a17e8a28$var$getTabbableEdges(container) {
  const candidates = $d3863c46a17e8a28$var$getTabbableCandidates(container);
  const first = $d3863c46a17e8a28$var$findVisible(candidates, container);
  const last = $d3863c46a17e8a28$var$findVisible(candidates.reverse(), container);
  return [
    first,
    last
  ];
}
function $d3863c46a17e8a28$var$getTabbableCandidates(container) {
  const nodes = [];
  const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
    acceptNode: (node) => {
      const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
      if (node.disabled || node.hidden || isHiddenInput)
        return NodeFilter.FILTER_SKIP;
      return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
    }
  });
  while (walker.nextNode())
    nodes.push(walker.currentNode);
  return nodes;
}
function $d3863c46a17e8a28$var$findVisible(elements, container) {
  for (const element of elements) {
    if (!$d3863c46a17e8a28$var$isHidden(element, {
      upTo: container
    }))
      return element;
  }
}
function $d3863c46a17e8a28$var$isHidden(node, { upTo }) {
  if (getComputedStyle(node).visibility === "hidden")
    return true;
  while (node) {
    if (upTo !== void 0 && node === upTo)
      return false;
    if (getComputedStyle(node).display === "none")
      return true;
    node = node.parentElement;
  }
  return false;
}
function $d3863c46a17e8a28$var$isSelectableInput(element) {
  return element instanceof HTMLInputElement && "select" in element;
}
function $d3863c46a17e8a28$var$focus(element, { select = false } = {}) {
  if (element && element.focus) {
    const previouslyFocusedElement = document.activeElement;
    element.focus({
      preventScroll: true
    });
    if (element !== previouslyFocusedElement && $d3863c46a17e8a28$var$isSelectableInput(element) && select)
      element.select();
  }
}
const $d3863c46a17e8a28$var$focusScopesStack = $d3863c46a17e8a28$var$createFocusScopesStack();
function $d3863c46a17e8a28$var$createFocusScopesStack() {
  let stack = [];
  return {
    add(focusScope) {
      const activeFocusScope = stack[0];
      if (focusScope !== activeFocusScope)
        activeFocusScope === null || activeFocusScope === void 0 || activeFocusScope.pause();
      stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);
      stack.unshift(focusScope);
    },
    remove(focusScope) {
      var _stack$;
      stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);
      (_stack$ = stack[0]) === null || _stack$ === void 0 || _stack$.resume();
    }
  };
}
function $d3863c46a17e8a28$var$arrayRemove(array, item) {
  const updatedArray = [
    ...array
  ];
  const index = updatedArray.indexOf(item);
  if (index !== -1)
    updatedArray.splice(index, 1);
  return updatedArray;
}
function $d3863c46a17e8a28$var$removeLinks(items) {
  return items.filter(
    (item) => item.tagName !== "A"
  );
}
let $3db38b7d1fb3fe6a$var$count = 0;
function $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c() {
  reactExports.useEffect(() => {
    var _edgeGuards$, _edgeGuards$2;
    const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
    document.body.insertAdjacentElement("afterbegin", (_edgeGuards$ = edgeGuards[0]) !== null && _edgeGuards$ !== void 0 ? _edgeGuards$ : $3db38b7d1fb3fe6a$var$createFocusGuard());
    document.body.insertAdjacentElement("beforeend", (_edgeGuards$2 = edgeGuards[1]) !== null && _edgeGuards$2 !== void 0 ? _edgeGuards$2 : $3db38b7d1fb3fe6a$var$createFocusGuard());
    $3db38b7d1fb3fe6a$var$count++;
    return () => {
      if ($3db38b7d1fb3fe6a$var$count === 1)
        document.querySelectorAll("[data-radix-focus-guard]").forEach(
          (node) => node.remove()
        );
      $3db38b7d1fb3fe6a$var$count--;
    };
  }, []);
}
function $3db38b7d1fb3fe6a$var$createFocusGuard() {
  const element = document.createElement("span");
  element.setAttribute("data-radix-focus-guard", "");
  element.tabIndex = 0;
  element.style.cssText = "outline: none; opacity: 0; position: fixed; pointer-events: none";
  return element;
}
var getDefaultParent = function(originalTarget) {
  if (typeof document === "undefined") {
    return null;
  }
  var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
  return sampleTarget.ownerDocument.body;
};
var counterMap = /* @__PURE__ */ new WeakMap();
var uncontrolledNodes = /* @__PURE__ */ new WeakMap();
var markerMap = {};
var lockCount = 0;
var unwrapHost = function(node) {
  return node && (node.host || unwrapHost(node.parentNode));
};
var correctTargets = function(parent, targets) {
  return targets.map(function(target) {
    if (parent.contains(target)) {
      return target;
    }
    var correctedTarget = unwrapHost(target);
    if (correctedTarget && parent.contains(correctedTarget)) {
      return correctedTarget;
    }
    console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing");
    return null;
  }).filter(function(x) {
    return Boolean(x);
  });
};
var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) {
  var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
  if (!markerMap[markerName]) {
    markerMap[markerName] = /* @__PURE__ */ new WeakMap();
  }
  var markerCounter = markerMap[markerName];
  var hiddenNodes = [];
  var elementsToKeep = /* @__PURE__ */ new Set();
  var elementsToStop = new Set(targets);
  var keep = function(el) {
    if (!el || elementsToKeep.has(el)) {
      return;
    }
    elementsToKeep.add(el);
    keep(el.parentNode);
  };
  targets.forEach(keep);
  var deep = function(parent) {
    if (!parent || elementsToStop.has(parent)) {
      return;
    }
    Array.prototype.forEach.call(parent.children, function(node) {
      if (elementsToKeep.has(node)) {
        deep(node);
      } else {
        try {
          var attr = node.getAttribute(controlAttribute);
          var alreadyHidden = attr !== null && attr !== "false";
          var counterValue = (counterMap.get(node) || 0) + 1;
          var markerValue = (markerCounter.get(node) || 0) + 1;
          counterMap.set(node, counterValue);
          markerCounter.set(node, markerValue);
          hiddenNodes.push(node);
          if (counterValue === 1 && alreadyHidden) {
            uncontrolledNodes.set(node, true);
          }
          if (markerValue === 1) {
            node.setAttribute(markerName, "true");
          }
          if (!alreadyHidden) {
            node.setAttribute(controlAttribute, "true");
          }
        } catch (e) {
          console.error("aria-hidden: cannot operate on ", node, e);
        }
      }
    });
  };
  deep(parentNode);
  elementsToKeep.clear();
  lockCount++;
  return function() {
    hiddenNodes.forEach(function(node) {
      var counterValue = counterMap.get(node) - 1;
      var markerValue = markerCounter.get(node) - 1;
      counterMap.set(node, counterValue);
      markerCounter.set(node, markerValue);
      if (!counterValue) {
        if (!uncontrolledNodes.has(node)) {
          node.removeAttribute(controlAttribute);
        }
        uncontrolledNodes.delete(node);
      }
      if (!markerValue) {
        node.removeAttribute(markerName);
      }
    });
    lockCount--;
    if (!lockCount) {
      counterMap = /* @__PURE__ */ new WeakMap();
      counterMap = /* @__PURE__ */ new WeakMap();
      uncontrolledNodes = /* @__PURE__ */ new WeakMap();
      markerMap = {};
    }
  };
};
var hideOthers = function(originalTarget, parentNode, markerName) {
  if (markerName === void 0) {
    markerName = "data-aria-hidden";
  }
  var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
  var activeParentNode = parentNode || getDefaultParent(originalTarget);
  if (!activeParentNode) {
    return function() {
      return null;
    };
  }
  targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live]")));
  return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
};
const $5d3850c4d0b4e6c7$var$DIALOG_NAME = "Dialog";
const [$5d3850c4d0b4e6c7$var$createDialogContext, $5d3850c4d0b4e6c7$export$cc702773b8ea3e41] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($5d3850c4d0b4e6c7$var$DIALOG_NAME);
const [$5d3850c4d0b4e6c7$var$DialogProvider, $5d3850c4d0b4e6c7$var$useDialogContext] = $5d3850c4d0b4e6c7$var$createDialogContext($5d3850c4d0b4e6c7$var$DIALOG_NAME);
const $5d3850c4d0b4e6c7$export$3ddf2d174ce01153 = (props) => {
  const { __scopeDialog, children, open: openProp, defaultOpen, onOpenChange, modal = true } = props;
  const triggerRef = reactExports.useRef(null);
  const contentRef = reactExports.useRef(null);
  const [open = false, setOpen] = $71cd76cc60e0454e$export$6f32135080cb4c3({
    prop: openProp,
    defaultProp: defaultOpen,
    onChange: onOpenChange
  });
  return /* @__PURE__ */ reactExports.createElement($5d3850c4d0b4e6c7$var$DialogProvider, {
    scope: __scopeDialog,
    triggerRef,
    contentRef,
    contentId: $1746a345f3d73bb7$export$f680877a34711e37(),
    titleId: $1746a345f3d73bb7$export$f680877a34711e37(),
    descriptionId: $1746a345f3d73bb7$export$f680877a34711e37(),
    open,
    onOpenChange: setOpen,
    onOpenToggle: reactExports.useCallback(
      () => setOpen(
        (prevOpen) => !prevOpen
      ),
      [
        setOpen
      ]
    ),
    modal
  }, children);
};
const $5d3850c4d0b4e6c7$var$PORTAL_NAME = "DialogPortal";
const [$5d3850c4d0b4e6c7$var$PortalProvider, $5d3850c4d0b4e6c7$var$usePortalContext] = $5d3850c4d0b4e6c7$var$createDialogContext($5d3850c4d0b4e6c7$var$PORTAL_NAME, {
  forceMount: void 0
});
const $5d3850c4d0b4e6c7$var$CONTENT_NAME = "DialogContent";
const $5d3850c4d0b4e6c7$export$b6d9565de1e068cf = /* @__PURE__ */ reactExports.forwardRef((props, forwardedRef) => {
  const portalContext = $5d3850c4d0b4e6c7$var$usePortalContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, props.__scopeDialog);
  const { forceMount = portalContext.forceMount, ...contentProps } = props;
  const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, props.__scopeDialog);
  return /* @__PURE__ */ reactExports.createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
    present: forceMount || context.open
  }, context.modal ? /* @__PURE__ */ reactExports.createElement($5d3850c4d0b4e6c7$var$DialogContentModal, _extends({}, contentProps, {
    ref: forwardedRef
  })) : /* @__PURE__ */ reactExports.createElement($5d3850c4d0b4e6c7$var$DialogContentNonModal, _extends({}, contentProps, {
    ref: forwardedRef
  })));
});
/* @__PURE__ */ Object.assign($5d3850c4d0b4e6c7$export$b6d9565de1e068cf, {
  displayName: $5d3850c4d0b4e6c7$var$CONTENT_NAME
});
const $5d3850c4d0b4e6c7$var$DialogContentModal = /* @__PURE__ */ reactExports.forwardRef((props, forwardedRef) => {
  const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, props.__scopeDialog);
  const contentRef = reactExports.useRef(null);
  const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.contentRef, contentRef);
  reactExports.useEffect(() => {
    const content = contentRef.current;
    if (content)
      return hideOthers(content);
  }, []);
  return /* @__PURE__ */ reactExports.createElement($5d3850c4d0b4e6c7$var$DialogContentImpl, _extends({}, props, {
    ref: composedRefs,
    trapFocus: context.open,
    disableOutsidePointerEvents: true,
    onCloseAutoFocus: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onCloseAutoFocus, (event) => {
      var _context$triggerRef$c;
      event.preventDefault();
      (_context$triggerRef$c = context.triggerRef.current) === null || _context$triggerRef$c === void 0 || _context$triggerRef$c.focus();
    }),
    onPointerDownOutside: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDownOutside, (event) => {
      const originalEvent = event.detail.originalEvent;
      const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
      const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
      if (isRightClick)
        event.preventDefault();
    }),
    onFocusOutside: $e42e1063c40fb3ef$export$b9ecd428b558ff10(
      props.onFocusOutside,
      (event) => event.preventDefault()
    )
  }));
});
const $5d3850c4d0b4e6c7$var$DialogContentNonModal = /* @__PURE__ */ reactExports.forwardRef((props, forwardedRef) => {
  const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, props.__scopeDialog);
  const hasInteractedOutsideRef = reactExports.useRef(false);
  const hasPointerDownOutsideRef = reactExports.useRef(false);
  return /* @__PURE__ */ reactExports.createElement($5d3850c4d0b4e6c7$var$DialogContentImpl, _extends({}, props, {
    ref: forwardedRef,
    trapFocus: false,
    disableOutsidePointerEvents: false,
    onCloseAutoFocus: (event) => {
      var _props$onCloseAutoFoc;
      (_props$onCloseAutoFoc = props.onCloseAutoFocus) === null || _props$onCloseAutoFoc === void 0 || _props$onCloseAutoFoc.call(props, event);
      if (!event.defaultPrevented) {
        var _context$triggerRef$c2;
        if (!hasInteractedOutsideRef.current)
          (_context$triggerRef$c2 = context.triggerRef.current) === null || _context$triggerRef$c2 === void 0 || _context$triggerRef$c2.focus();
        event.preventDefault();
      }
      hasInteractedOutsideRef.current = false;
      hasPointerDownOutsideRef.current = false;
    },
    onInteractOutside: (event) => {
      var _props$onInteractOuts, _context$triggerRef$c3;
      (_props$onInteractOuts = props.onInteractOutside) === null || _props$onInteractOuts === void 0 || _props$onInteractOuts.call(props, event);
      if (!event.defaultPrevented) {
        hasInteractedOutsideRef.current = true;
        if (event.detail.originalEvent.type === "pointerdown")
          hasPointerDownOutsideRef.current = true;
      }
      const target = event.target;
      const targetIsTrigger = (_context$triggerRef$c3 = context.triggerRef.current) === null || _context$triggerRef$c3 === void 0 ? void 0 : _context$triggerRef$c3.contains(target);
      if (targetIsTrigger)
        event.preventDefault();
      if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current)
        event.preventDefault();
    }
  }));
});
const $5d3850c4d0b4e6c7$var$DialogContentImpl = /* @__PURE__ */ reactExports.forwardRef((props, forwardedRef) => {
  const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
  const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, __scopeDialog);
  const contentRef = reactExports.useRef(null);
  const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, contentRef);
  $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c();
  return /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, /* @__PURE__ */ reactExports.createElement($d3863c46a17e8a28$export$20e40289641fbbb6, {
    asChild: true,
    loop: true,
    trapped: trapFocus,
    onMountAutoFocus: onOpenAutoFocus,
    onUnmountAutoFocus: onCloseAutoFocus
  }, /* @__PURE__ */ reactExports.createElement($5cb92bef7577960e$export$177fb62ff3ec1f22, _extends({
    role: "dialog",
    id: context.contentId,
    "aria-describedby": context.descriptionId,
    "aria-labelledby": context.titleId,
    "data-state": $5d3850c4d0b4e6c7$var$getState(context.open)
  }, contentProps, {
    ref: composedRefs,
    onDismiss: () => context.onOpenChange(false)
  }))), false);
});
const $5d3850c4d0b4e6c7$var$TITLE_NAME = "DialogTitle";
const $5d3850c4d0b4e6c7$export$16f7638e4a34b909 = /* @__PURE__ */ reactExports.forwardRef((props, forwardedRef) => {
  const { __scopeDialog, ...titleProps } = props;
  const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$TITLE_NAME, __scopeDialog);
  return /* @__PURE__ */ reactExports.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.h2, _extends({
    id: context.titleId
  }, titleProps, {
    ref: forwardedRef
  }));
});
/* @__PURE__ */ Object.assign($5d3850c4d0b4e6c7$export$16f7638e4a34b909, {
  displayName: $5d3850c4d0b4e6c7$var$TITLE_NAME
});
const $5d3850c4d0b4e6c7$var$DESCRIPTION_NAME = "DialogDescription";
const $5d3850c4d0b4e6c7$export$94e94c2ec2c954d5 = /* @__PURE__ */ reactExports.forwardRef((props, forwardedRef) => {
  const { __scopeDialog, ...descriptionProps } = props;
  const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$DESCRIPTION_NAME, __scopeDialog);
  return /* @__PURE__ */ reactExports.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.p, _extends({
    id: context.descriptionId
  }, descriptionProps, {
    ref: forwardedRef
  }));
});
/* @__PURE__ */ Object.assign($5d3850c4d0b4e6c7$export$94e94c2ec2c954d5, {
  displayName: $5d3850c4d0b4e6c7$var$DESCRIPTION_NAME
});
const $5d3850c4d0b4e6c7$var$CLOSE_NAME = "DialogClose";
const $5d3850c4d0b4e6c7$export$fba2fb7cd781b7ac = /* @__PURE__ */ reactExports.forwardRef((props, forwardedRef) => {
  const { __scopeDialog, ...closeProps } = props;
  const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CLOSE_NAME, __scopeDialog);
  return /* @__PURE__ */ reactExports.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends({
    type: "button"
  }, closeProps, {
    ref: forwardedRef,
    onClick: $e42e1063c40fb3ef$export$b9ecd428b558ff10(
      props.onClick,
      () => context.onOpenChange(false)
    )
  }));
});
/* @__PURE__ */ Object.assign($5d3850c4d0b4e6c7$export$fba2fb7cd781b7ac, {
  displayName: $5d3850c4d0b4e6c7$var$CLOSE_NAME
});
function $5d3850c4d0b4e6c7$var$getState(open) {
  return open ? "open" : "closed";
}
const $5d3850c4d0b4e6c7$export$be92b6f5f03c0fe9 = $5d3850c4d0b4e6c7$export$3ddf2d174ce01153;
const $5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2 = $5d3850c4d0b4e6c7$export$b6d9565de1e068cf;
const $5d3850c4d0b4e6c7$export$f39c2d165cd861fe = $5d3850c4d0b4e6c7$export$fba2fb7cd781b7ac;
var parseUnit$1 = function parseUnit(str, out) {
  if (!out)
    out = [0, ""];
  str = String(str);
  var num = parseFloat(str, 10);
  out[0] = num;
  out[1] = str.match(/[\d.\-\+]*\s*(.*)/)[1] || "";
  return out;
};
var parseUnit2 = parseUnit$1;
var browser = toPX;
var PIXELS_PER_INCH = getSizeBrutal("in", document.body);
function getPropertyInPX(element, prop) {
  var parts = parseUnit2(getComputedStyle(element).getPropertyValue(prop));
  return parts[0] * toPX(parts[1], element);
}
function getSizeBrutal(unit, element) {
  var testDIV = document.createElement("div");
  testDIV.style["height"] = "128" + unit;
  element.appendChild(testDIV);
  var size = getPropertyInPX(testDIV, "height") / 128;
  element.removeChild(testDIV);
  return size;
}
function toPX(str, element) {
  if (!str)
    return null;
  element = element || document.body;
  str = (str + "" || "px").trim().toLowerCase();
  if (element === window || element === document) {
    element = document.body;
  }
  switch (str) {
    case "%":
      return element.clientHeight / 100;
    case "ch":
    case "ex":
      return getSizeBrutal(str, element);
    case "em":
      return getPropertyInPX(element, "font-size");
    case "rem":
      return getPropertyInPX(document.body, "font-size");
    case "vw":
      return window.innerWidth / 100;
    case "vh":
      return window.innerHeight / 100;
    case "vmin":
      return Math.min(window.innerWidth, window.innerHeight) / 100;
    case "vmax":
      return Math.max(window.innerWidth, window.innerHeight) / 100;
    case "in":
      return PIXELS_PER_INCH;
    case "cm":
      return PIXELS_PER_INCH / 2.54;
    case "mm":
      return PIXELS_PER_INCH / 25.4;
    case "pt":
      return PIXELS_PER_INCH / 72;
    case "pc":
      return PIXELS_PER_INCH / 6;
    case "px":
      return 1;
  }
  var parts = parseUnit2(str);
  if (!isNaN(parts[0]) && parts[1]) {
    var px = toPX(parts[1], element);
    return typeof px === "number" ? parts[0] * px : null;
  }
  return null;
}
const toPx = /* @__PURE__ */ getDefaultExportFromCjs(browser);
var isArray = isArray_1;
function castArray() {
  if (!arguments.length) {
    return [];
  }
  var value = arguments[0];
  return isArray(value) ? value : [value];
}
var castArray_1 = castArray;
const castArray$1 = /* @__PURE__ */ getDefaultExportFromCjs(castArray_1);
var isPlainObject = isPlainObject_1;
function customOmitClone$1(value) {
  return isPlainObject(value) ? void 0 : value;
}
var _customOmitClone = customOmitClone$1;
var arrayMap = _arrayMap, baseClone = _baseClone, baseUnset = _baseUnset, castPath = _castPath, copyObject = _copyObject, customOmitClone = _customOmitClone, flatRest = _flatRest, getAllKeysIn = _getAllKeysIn;
var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
var omit = flatRest(function(object, paths) {
  var result = {};
  if (object == null) {
    return result;
  }
  var isDeep = false;
  paths = arrayMap(paths, function(path) {
    path = castPath(path, object);
    isDeep || (isDeep = path.length > 1);
    return path;
  });
  copyObject(object, getAllKeysIn(object), result);
  if (isDeep) {
    result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  }
  var length = paths.length;
  while (length--) {
    baseUnset(result, paths[length]);
  }
  return result;
});
var omit_1 = omit;
const omit$1 = /* @__PURE__ */ getDefaultExportFromCjs(omit_1);
const defaultProps = () => ({
  config: {
    duration: ms(String(tw.theme("transitionDuration.DEFAULT")))
  }
});
function useSimpleTransition(data, props) {
  const options = merge({}, defaultProps(), omit$1(props, "from", "to"), {
    from: merge({}, ...castArray$1(props.from)),
    enter: props.to,
    leave: props.from
  });
  return useTransition(data, options);
}
if (!adaptivecards.AdaptiveCard.onProcessMarkdown) {
  adaptivecards.AdaptiveCard.onProcessMarkdown = (text, result) => {
    result.outputHtml = `
      <div class="prose prose-sm prose-p:m-0 prose-p:overflow-hidden prose-p:text-ellipsis prose-a:text-brand-900 max-w-none [color:inherit] [font-size:inherit] [line-height:inherit]">
        ${textToHtml(text)}
      </div>
    `;
    result.didProcess = true;
  };
}
function getHostConfig(hostConfig) {
  if (hostConfig instanceof adaptivecards.HostConfig)
    return hostConfig;
  return new adaptivecards.HostConfig(hostConfig ?? {});
}
function AdaptiveCard(props) {
  var _a, _b, _c, _d, _e, _f;
  const [error, setError] = reactExports.useState();
  if (error)
    throw error;
  const ref = reactExports.useRef(null);
  const adaptiveCard = reactExports.useRef(new adaptivecards.AdaptiveCard());
  const hostConfig = adaptiveCard.current.hostConfig = getHostConfig(props.hostConfig);
  adaptiveCard.current.onExecuteAction = (action) => {
    var _a2, _b2, _c2, _d2, _e2;
    if ("data" in action && typeof action.data === "object")
      action.data = { ...action.data };
    const event = new CustomEvent(action.getJsonTypeName(), {
      cancelable: true,
      detail: action
    });
    if (isExecuteAction(event.detail)) {
      (_a2 = props.onExecuteAction) == null ? void 0 : _a2.call(props, event);
    }
    if (isOpenUrlAction(event.detail)) {
      (_b2 = props.onOpenUrlAction) == null ? void 0 : _b2.call(props, event);
    }
    if (isShowCardAction(event.detail)) {
      (_c2 = props.onShowCardAction) == null ? void 0 : _c2.call(props, event);
    }
    if (isSubmitAction(event.detail)) {
      (_d2 = props.onSubmitAction) == null ? void 0 : _d2.call(props, event);
    }
    if (event.defaultPrevented)
      return;
    (_e2 = props.onAction) == null ? void 0 : _e2.call(props, event);
  };
  reactExports.useEffect(() => {
    if (!ref.current)
      return;
    try {
      adaptiveCard.current.parse(props.payload);
      const result = adaptiveCard.current.render();
      if (!result)
        throw new Error("Render returned undefined");
      ref.current.replaceChildren(result);
    } catch (error2) {
      setError(error2);
    }
  }, [props.payload, props.hostConfig]);
  reactExports.useEffect(() => {
    var _a2;
    if (!props.disabled)
      return;
    const nodes = (_a2 = ref.current) == null ? void 0 : _a2.querySelectorAll(".ac-selectable[tabindex]");
    if (!(nodes == null ? void 0 : nodes.length))
      return;
    for (const node of nodes) {
      node.setAttribute("tabindex", "-1");
    }
    return () => {
      for (const node of nodes) {
        node.setAttribute("tabindex", "0");
      }
    };
  }, [props.disabled]);
  return (
    // Use a fieldset so setting "disabled" will deactivate inputs
    // (It is valid for a `fieldset` to appear outside of a `form`)
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      "fieldset",
      {
        ref,
        disabled: props.disabled,
        className: tx(
          "min-w-0",
          // Browsers default fieldsets to `min-width: min-content`,
          "flex flex-1 flex-col",
          { "pointer-events-none opacity-60": props.disabled },
          css`
          .ac-adaptiveCard {
            flex: 1 !important;

            padding: ${tw.theme("padding.3")} !important;
            border-radius: ${tw.theme("borderRadius.lg")};
          }

          .ac-horizontal-separator {
            margin-block: ${tw.theme("margin[0.5]")};
          }

          .ac-selectable {
            /* [disabled] & {
              pointer-events: none;
              opacity: ${tw.theme("opacity.60")};
            } */

            cursor: pointer;
          }

          .ac-textBlock {
            overflow-wrap: normal !important;
          }

          .ac-textInput,
          .ac-multichoiceInput,
          .ac-dateInput,
          .ac-timeInput,
          .ac-numberInput {
            /* [disabled] & {
              pointer-events: none;
              opacity: ${tw.theme("opacity.60")};
            } */

            padding: ${tw.theme("padding.2")};
            background-color: ${hostConfig.containerStyles.default.backgroundColor};
            border: 1px solid ${hostConfig.containerStyles.default.foregroundColors.light.subtle};
            border-radius: ${tw.theme("borderRadius.DEFAULT")};
            font-family: ${(_a = hostConfig.fontTypes) == null ? void 0 : _a.default.fontFamily};
            font-size: ${(_b = hostConfig.fontTypes) == null ? void 0 : _b.default.fontSizes.default}px;
            line-height: ${(_c = hostConfig.lineHeights) == null ? void 0 : _c.default}px;
          }

          .ac-actionSet {
            flex-wrap: wrap;
            gap: 10px;

            & > div:empty {
              display: none;
            }
          }

          button.ac-pushButton,
          button.ac-pushButton-disabled {
            /* [disabled] & {
              pointer-events: none;
              opacity: ${tw.theme("opacity.60")};
            } */

            padding-inline: ${tw.theme("padding.4")};
            padding-block: ${tw.theme("padding.1")};
            border-radius: ${tw.theme("borderRadius.full")};
            font-family: ${(_d = hostConfig.fontTypes) == null ? void 0 : _d.default.fontFamily};
            font-size: ${(_e = hostConfig.fontTypes) == null ? void 0 : _e.default.fontSizes.default}px;
            line-height: ${(_f = hostConfig.lineHeights) == null ? void 0 : _f.default}px;
            overflow: hidden;

            &,
            &:hover,
            &:focus,
            &:active {
              box-shadow: none;
            }

            @media (prefers-reduced-motion: no-preference) {
              transition-property: ${tw.theme("transitionProperty.DEFAULT")};
              transition-timing-function: ${tw.theme("transitionTimingFunction.DEFAULT")};
              transition-duration: ${tw.theme("transitionDuration.DEFAULT")};
            }

            &.style-default {
              background-color: ${hostConfig.containerStyles.default.backgroundColor};
              border: 1px solid ${hostConfig.containerStyles.default.foregroundColors.accent.subtle};
              color: ${hostConfig.containerStyles.default.foregroundColors.accent.default};

              &:hover,
              &:focus {
                background-color: ${hostConfig.containerStyles.default.foregroundColors.accent.subtle};
                border: 1px solid ${hostConfig.containerStyles.default.foregroundColors.accent.default};
                color: ${hostConfig.containerStyles.default.backgroundColor};
              }

              &:active {
                background-color: ${hostConfig.containerStyles.emphasis.backgroundColor};
                border: 1px solid ${hostConfig.containerStyles.default.foregroundColors.light.subtle};
                color: ${hostConfig.containerStyles.default.foregroundColors.accent.subtle};
              }
            }

            &.style-positive {
              background-color: ${hostConfig.containerStyles.default.foregroundColors.accent.default};
              border: 1px solid ${hostConfig.containerStyles.default.foregroundColors.accent.subtle};
              color: ${hostConfig.containerStyles.default.backgroundColor};

              &:hover,
              &:focus {
                background-color: ${hostConfig.containerStyles.default.foregroundColors.accent.subtle};
                border: 1px solid ${hostConfig.containerStyles.default.foregroundColors.accent.default};
                color: ${hostConfig.containerStyles.default.backgroundColor};
              }

              &:active {
                background-color: ${hostConfig.containerStyles.default.foregroundColors.accent.default};
                border: 1px solid ${hostConfig.containerStyles.emphasis.backgroundColor};
                color: ${hostConfig.containerStyles.default.backgroundColor};
              }
            }

            &.style-destructive {
              background-color: ${hostConfig.containerStyles.default.backgroundColor};
              border: 1px solid ${hostConfig.containerStyles.default.foregroundColors.attention.default};
              color: ${hostConfig.containerStyles.default.foregroundColors.attention.default};

              &:hover,
              &:focus {
                background-color: ${hostConfig.containerStyles.default.foregroundColors.attention.default};
                border: 1px solid ${hostConfig.containerStyles.default.foregroundColors.attention.subtle};
                color: ${hostConfig.containerStyles.default.backgroundColor};
              }

              &:active {
                background-color: ${hostConfig.containerStyles.default.foregroundColors.attention.subtle};
                border: 1px solid ${hostConfig.containerStyles.default.foregroundColors.attention.default};
                color: ${hostConfig.containerStyles.default.foregroundColors.attention.default};
              }
            }
          }
        `
        )
      }
    )
  );
}
const RootStateContext = reactExports.createContext(null);
function useRootState(initialState) {
  const context = reactExports.useContext(RootStateContext);
  if (context)
    return [void 0, context[1]];
  return reactExports.useState(initialState);
}
function RootStateProvider(props) {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(RootStateContext.Provider, { value: props.state, children: props.children });
}
const loadingAnimation = keyframes`
  from {
    left: 0;
    transform: translateX(-100%);
  }
  to {
    left: 100%;
    transform: translateX(0);
  }
`;
function useIsControlled(test) {
  const logger = useWidgetsLogger();
  const [isControlled, setIsControlled] = reactExports.useState(test);
  if (test() && !isControlled) {
    logger.error("Component changed from uncontrolled to controlled.");
    setIsControlled(true);
  }
  return isControlled;
}
const getViewActionSchema = objectType({
  data: objectType({
    __internal__: objectType({
      spaceId: stringType()
    }),
    endpoint: stringType()
  }).passthrough().transform(({ __internal__: { spaceId }, endpoint, ...data }) => ({
    spaceId,
    endpoint,
    data
  }))
});
const actionNotificationActionSchema = objectType({
  data: objectType({
    __internal__: objectType({
      spaceId: stringType(),
      notificationId: stringType()
    }),
    data: objectType({}).passthrough(),
    analytics: objectType({}).passthrough().optional()
  }).passthrough().transform(({ __internal__: { spaceId, notificationId }, ...data }) => ({
    spaceId,
    notificationId,
    data
  }))
});
const deleteNotificationActionSchema = objectType({
  verb: literalType("deleteNotification"),
  data: objectType({
    __internal__: objectType({
      spaceId: stringType(),
      notificationId: stringType()
    })
  }).passthrough().transform(({ __internal__: { spaceId, notificationId } }) => ({
    spaceId,
    notificationId
  }))
});
const deleteNotificationActionedActionSchema = objectType({
  verb: literalType("deleteNotificationActioned"),
  data: objectType({
    spaceId: stringType(),
    notificationId: stringType()
  })
});
const deleteNotificationCancelledActionSchema = objectType({
  verb: literalType("deleteNotificationCancelled"),
  data: objectType({
    spaceId: stringType(),
    notificationId: stringType()
  })
});
const askFeedbackActionSchema = objectType({
  data: objectType({
    __internal__: objectType({
      spaceId: stringType()
    }),
    text: stringType(),
    id: literalType("feedback")
  }).passthrough().transform(({ __internal__: { spaceId }, text, id, ...data }) => ({
    spaceId,
    message: text,
    id,
    data
  }))
});
const askFeedbackResponseSchema = objectType({
  items: arrayType(
    objectType({
      view: adaptiveCardObjectSchema
    })
  ).length(1)
}).transform((response) => {
  return response.items[0].view;
});
function View(props) {
  const { t } = useTranslation();
  const [rootState, setRootState] = useRootState({});
  const core = useWidgetsCore();
  const logger = useWidgetsLogger();
  const queryClient = useQueryClient();
  let resolvedAction;
  let resolvedPayload;
  if ("endpoint" in props) {
    resolvedAction = {
      data: {
        __internal__: { spaceId: props.spaceId },
        endpoint: props.endpoint,
        ...props.data
      }
    };
  }
  if ("payload" in props && props.payload) {
    resolvedPayload = props.payload;
  }
  if ("initialEndpoint" in props) {
    resolvedAction = {
      data: {
        __internal__: { spaceId: props.spaceId },
        endpoint: props.initialEndpoint,
        ...props.initialData
      }
    };
  }
  if ("initialPayload" in props && props.initialPayload) {
    resolvedPayload = props.initialPayload;
  }
  const isControlled = useIsControlled(() => "payload" in props || "endpoint" in props);
  const [internalAction, setInternalAction] = reactExports.useState();
  const action = internalAction ?? resolvedAction;
  const payload = reactExports.useRef(resolvedPayload);
  const viewQuery = useQuery({
    queryKey: [action ?? { payload: resolvedPayload }],
    queryFn: async () => {
      if (!action)
        return payload.current;
      if (getViewActionSchema.safeParse(action).success) {
        const parsedAction = getViewActionSchema.parse(action);
        return core.getView(parsedAction.data);
      }
      if (actionNotificationActionSchema.safeParse(action).success) {
        const parsedAction = actionNotificationActionSchema.parse(action);
        await core.actionNotification(parsedAction.data);
        setRootState({ submitted: true });
        return {
          type: "AdaptiveCard",
          version: "1.6"
        };
      }
      if (deleteNotificationActionSchema.safeParse(action).success) {
        const parsedAction = deleteNotificationActionSchema.parse(action);
        return {
          type: "AdaptiveCard",
          version: "1.3",
          body: [
            {
              type: "Container",
              verticalContentAlignment: "center",
              items: [
                {
                  type: "ColumnSet",
                  separator: false,
                  columns: [
                    {
                      type: "Column",
                      width: "auto",
                      items: [
                        {
                          type: "Image",
                          size: "Small",
                          style: "Person",
                          // Currently always the production endpoint
                          url: `https://cdn.workgrid.com/ask/trash-can-red.png`,
                          horizontalAlignment: "Center"
                        }
                      ]
                    },
                    {
                      type: "Column",
                      width: "stretch",
                      items: [
                        {
                          type: "ColumnSet",
                          columns: [
                            {
                              type: "Column",
                              items: [
                                {
                                  type: "TextBlock",
                                  text: t("delete-notification.subject"),
                                  verticalContentAlignment: "Center"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              type: "TextBlock",
              text: t("delete-notification.warning"),
              wrap: true,
              weight: "bolder",
              size: "medium",
              spacing: "default",
              separator: false
            }
          ],
          actions: [
            {
              id: "delete-notification-actioned",
              type: "Action.Execute",
              verb: "deleteNotificationActioned",
              title: t("delete-notification.actions.confirm"),
              data: {
                ...parsedAction.data
              }
            },
            {
              id: "delete-notification-cancelled",
              type: "Action.Execute",
              verb: "deleteNotificationCancelled",
              title: t("delete-notification.actions.cancel"),
              data: {
                ...parsedAction.data
              }
            }
          ]
        };
      }
      if (deleteNotificationActionedActionSchema.safeParse(action).success) {
        const parsedAction = deleteNotificationActionedActionSchema.parse(action);
        const response = await core.getNotification(parsedAction.data);
        await core.deleteNotification(parsedAction.data);
        setRootState({ deleted: true });
        return response;
      }
      if (deleteNotificationCancelledActionSchema.safeParse(action).success) {
        const parsedAction = deleteNotificationCancelledActionSchema.parse(action);
        return core.getNotification(parsedAction.data);
      }
      if (askFeedbackActionSchema.safeParse(action).success) {
        const parsedAction = askFeedbackActionSchema.parse(action);
        const response = await core.ask(parsedAction.data);
        return askFeedbackResponseSchema.parse(response);
      }
      logger.error("Unexpected action", { action });
    },
    // Ensure payload is defined before rendering
    // @ts-expect-error useSuspenseQuery does not support overriding throwOnError
    suspense: true,
    // Don't bubble errors after the initial query
    throwOnError: !action,
    // Show previous payload white fetching
    // (`keepPreviousData` is cleared on error)
    placeholderData: payload.current
  });
  if (viewQuery.data)
    payload.current = viewQuery.data;
  const isFetching = viewQuery.isFetching;
  const isError = viewQuery.isError;
  const isSubmitted = (rootState == null ? void 0 : rootState.submitted) ?? false;
  const isDeleted = (rootState == null ? void 0 : rootState.deleted) ?? false;
  const isDisabled = isFetching || isSubmitted || isDeleted;
  const isRoot = !!rootState;
  const hostConfig = reactExports.useRef();
  hostConfig.current ?? (hostConfig.current = new adaptivecards.HostConfig(merge(getDefaultHostConfig(), props.hostConfig)));
  const [detail, setDetail] = reactExports.useState(null);
  const openTransitions = useSimpleTransition(detail, {
    from: [{ opacity: 0, scale: Number(tw.theme("scale.95")) }, { display: "none" }],
    to: [{ display: "" }, { opacity: 1, scale: Number(tw.theme("scale.100")) }]
  });
  const spinDelay = distExports.useSpinDelay(isFetching, { delay: 500, minDuration: 2e3, ssr: false });
  reactExports.useEffect(() => {
    if (rootState == null ? void 0 : rootState.submitted) {
      setDetail(null);
    }
  }, [rootState == null ? void 0 : rootState.submitted]);
  if (isFetching && !isRoot) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { label: t("loading") });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(RootStateProvider, { state: [rootState, setRootState], children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "div",
      {
        ...isRoot && createAnchor(name),
        className: tx(
          "relative bg-white",
          "flex flex-1 flex-col",
          { rounded: isRoot },
          {
            [css`
              &::before {
                content: '';
                position: absolute;
                top: -3px;
                left: 0;
                transform: translateX(-100%);
                width: 4rem;
                height: 5px;
                border-radius: 100%;
                background-image: linear-gradient(
                  135deg,
                  transparent 15%,
                  ${tw.theme("colors.white")} 50%,
                  transparent 85%
                );
                animation: ${loadingAnimation} 2s infinite alternate ease-in-out;
                opacity: 0.8;
              }
            `]: spinDelay
          },
          {
            [css`
              border-top: 3px solid ${hostConfig.current.containerStyles.default.foregroundColors.accent.subtle};
            `]: isRoot
          }
        ),
        children: [
          isError && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mx-2 mt-2 bg-rose-300 bg-opacity-20 px-2 py-1 text-xs text-rose-700", children: t("request-failed") }),
          isSubmitted && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mx-2 mt-2 bg-emerald-300 bg-opacity-20 px-2 py-1 text-xs text-emerald-700", children: t("response-submitted") }),
          isDeleted && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mx-2 mt-2 bg-zinc-300 bg-opacity-20 px-2 py-1 text-xs text-zinc-700", children: t("delete-notification.success") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            AdaptiveCard,
            {
              disabled: isDisabled,
              payload: payload.current,
              hostConfig: hostConfig.current,
              onAction: (event) => {
                var _a;
                (_a = props.onAction) == null ? void 0 : _a.call(props, event);
                if (event.defaultPrevented)
                  return;
                if (isExecuteAction(event.detail) || isSubmitAction(event.detail)) {
                  if (isControlled)
                    return;
                  const action2 = event.detail.toJSON();
                  queryClient.removeQueries({ queryKey: [action2] });
                  setInternalAction(action2);
                }
              },
              onExecuteAction: (event) => {
                var _a;
                (_a = props.onExecuteAction) == null ? void 0 : _a.call(props, event);
                if (event.defaultPrevented)
                  return;
              },
              onOpenUrlAction: (event) => {
                var _a;
                (_a = props.onOpenUrlAction) == null ? void 0 : _a.call(props, event);
                if (event.defaultPrevented)
                  return;
                window.open(event.detail.url, "_blank");
              },
              onShowCardAction: (event) => {
                var _a, _b;
                (_a = props.onShowCardAction) == null ? void 0 : _a.call(props, event);
                if (event.defaultPrevented)
                  return;
                setDetail((_b = event.detail.toJSON()) == null ? void 0 : _b.card);
              },
              onSubmitAction: (event) => {
                var _a;
                (_a = props.onSubmitAction) == null ? void 0 : _a.call(props, event);
                if (event.defaultPrevented)
                  return;
              }
            }
          )
        ]
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      $5d3850c4d0b4e6c7$export$be92b6f5f03c0fe9,
      {
        open: !!detail,
        onOpenChange: () => {
          setDetail(null);
        },
        modal: false,
        children: openTransitions((style, detail2) => {
          return detail2 && /* @__PURE__ */ jsxRuntimeExports.jsx(
            $5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2,
            {
              forceMount: true,
              onInteractOutside: (event) => {
                event.preventDefault();
              },
              onEscapeKeyDown: (event) => {
                event.preventDefault();
              },
              asChild: true,
              children: /* @__PURE__ */ jsxRuntimeExports.jsxs(animated.div, { className: "absolute inset-0 z-10 flex flex-col bg-white", style, hidden: !detail2, children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-start p-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx($5d3850c4d0b4e6c7$export$f39c2d165cd861fe, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "flex items-center justify-center gap-1 rounded px-2 py-1 text-zinc-600", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronLeftIcon$1, { className: "-mb-0.5 -ml-1 h-6 w-6" }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm font-light", children: t("close-detail") })
                ] }) }) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-1 flex-col overflow-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                  View,
                  {
                    spaceId: props.spaceId,
                    initialPayload: detail2,
                    hostConfig: props.hostConfig,
                    onAction: (event) => {
                      var _a;
                      (_a = props.onAction) == null ? void 0 : _a.call(props, event);
                      if (event.defaultPrevented)
                        return;
                    },
                    onExecuteAction: (event) => {
                      var _a;
                      (_a = props.onExecuteAction) == null ? void 0 : _a.call(props, event);
                      if (event.defaultPrevented)
                        return;
                    },
                    onOpenUrlAction: (event) => {
                      var _a;
                      (_a = props.onOpenUrlAction) == null ? void 0 : _a.call(props, event);
                      if (event.defaultPrevented)
                        return;
                    },
                    onShowCardAction: (event) => {
                      var _a;
                      (_a = props.onShowCardAction) == null ? void 0 : _a.call(props, event);
                      if (event.defaultPrevented)
                        return;
                    },
                    onSubmitAction: (event) => {
                      var _a;
                      (_a = props.onSubmitAction) == null ? void 0 : _a.call(props, event);
                      if (event.defaultPrevented)
                        return;
                    }
                  }
                ) })
              ] })
            }
          );
        })
      }
    )
  ] });
}
function getDefaultHostConfig() {
  const containerForegroundColors = {
    default: {
      default: String(tw.theme("colors.zinc.900")),
      subtle: String(tw.theme("colors.zinc.700"))
    },
    dark: {
      default: String(tw.theme("colors.zinc.900")),
      subtle: String(tw.theme("colors.zinc.700"))
    },
    light: {
      default: String(tw.theme("colors.zinc.600")),
      subtle: String(tw.theme("colors.zinc.500"))
    },
    accent: {
      default: String(tw.theme("colors.brand.900")),
      subtle: String(tw.theme("colors.brand.700"))
    },
    good: {
      default: String(tw.theme("colors.emerald.900")),
      subtle: String(tw.theme("colors.emerald.700"))
    },
    warning: {
      default: String(tw.theme("colors.amber.900")),
      subtle: String(tw.theme("colors.amber.700"))
    },
    attention: {
      default: String(tw.theme("colors.rose.900")),
      subtle: String(tw.theme("colors.rose.700"))
    }
  };
  return {
    fontTypes: {
      default: {
        fontFamily: String(tw.theme("fontFamily.sans")),
        fontSizes: {
          small: Number(toPx(String(tw.theme("fontSize.xs[0]")))),
          default: Number(toPx(String(tw.theme("fontSize.sm[0]")))),
          medium: Number(toPx(String(tw.theme("fontSize.base[0]")))),
          large: Number(toPx(String(tw.theme("fontSize.lg[0]")))),
          extraLarge: Number(toPx(String(tw.theme("fontSize.xl[0]"))))
        },
        fontWeights: {
          default: Number(tw.theme("fontWeight.normal")),
          lighter: Number(tw.theme("fontWeight.light")),
          bolder: Number(tw.theme("fontWeight.bold"))
        }
      },
      monospace: {
        fontFamily: String(tw.theme("fontFamily.mono")),
        fontSizes: {
          small: Number(toPx(String(tw.theme("fontSize.xs[0]")))),
          default: Number(toPx(String(tw.theme("fontSize.sm[0]")))),
          medium: Number(toPx(String(tw.theme("fontSize.base[0]")))),
          large: Number(toPx(String(tw.theme("fontSize.lg[0]")))),
          extraLarge: Number(toPx(String(tw.theme("fontSize.xl[0]"))))
        },
        fontWeights: {
          default: Number(tw.theme("fontWeight.normal")),
          lighter: Number(tw.theme("fontWeight.light")),
          bolder: Number(tw.theme("fontWeight.bold"))
        }
      }
    },
    lineHeights: {
      small: Number(toPx(String(tw.theme("fontSize.xs[1]")))),
      default: Number(toPx(String(tw.theme("fontSize.sm[1]")))),
      medium: Number(toPx(String(tw.theme("fontSize.base[1]")))),
      large: Number(toPx(String(tw.theme("fontSize.lg[1]")))),
      extraLarge: Number(toPx(String(tw.theme("fontSize.xl[1]"))))
    },
    containerStyles: {
      default: {
        backgroundColor: String(tw.theme("colors.white")),
        foregroundColors: containerForegroundColors
      },
      emphasis: {
        backgroundColor: String(tw.theme("colors.zinc.100")),
        foregroundColors: containerForegroundColors
      },
      accent: {
        backgroundColor: String(tw.theme("colors.brand.100")),
        foregroundColors: containerForegroundColors
      },
      good: {
        backgroundColor: String(tw.theme("colors.emerald.100")),
        foregroundColors: containerForegroundColors
      },
      warning: {
        backgroundColor: String(tw.theme("colors.amber.100")),
        foregroundColors: containerForegroundColors
      },
      attention: {
        backgroundColor: String(tw.theme("colors.rose.100")),
        foregroundColors: containerForegroundColors
      }
    },
    spacing: {
      small: Number(toPx(String(tw.theme("spacing.1")))),
      default: Number(toPx(String(tw.theme("spacing.2")))),
      padding: Number(toPx(String(tw.theme("spacing.3")))),
      medium: Number(toPx(String(tw.theme("spacing.4")))),
      large: Number(toPx(String(tw.theme("spacing.5")))),
      extraLarge: Number(toPx(String(tw.theme("spacing.6"))))
    },
    imageSizes: {
      small: Number(toPx(String(tw.theme("width.8")))),
      medium: Number(toPx(String(tw.theme("width.16")))),
      large: Number(toPx(String(tw.theme("width.32"))))
    },
    actions: {
      maxActions: 6
    }
  };
}
export {
  View as default
};
//# sourceMappingURL=view-ZAWyEyAM.js.map
