import { s as stringify } from './index2-CzosXNJA.js';
import 'js-yaml';
import { P as Panel } from './Panel-D5AI50iS.js';
import { o as onDestroy } from './Tab-Bkjowzww.js';

function ContextEditor($$renderer, $$props) {
  $$renderer.component(($$renderer2) => {
    let editor = null;
    let {
      context,
      onContextChanged,
      class: className,
      suppressErrors = false,
      defaultFormat = "yaml",
      hideHeader = false
    } = $$props;
    onDestroy(() => {
      try {
        editor?.dispose();
      } finally {
        editor = null;
      }
    });
    Panel($$renderer2, {
      class: `min-h-0 overflow-hidden ${stringify(
        // Keep model language in sync without recreating the editor
        // Update value only when actual text differs to avoid caret jumps
        // If the next canonical text equals the last user-emitted serialization,
        // skip setting the value to preserve caret/selection.
        className
      )}`,
      children: ($$renderer3) => {
        if (!hideHeader) {
          $$renderer3.push("<!--[-->");
          $$renderer3.push(`<div class="flex items-center justify-between p-3"><h2 class="text-xl font-semibold">AI Context</h2></div>`);
        } else {
          $$renderer3.push("<!--[!-->");
        }
        $$renderer3.push(`<!--]--> <div class="h-full min-h-0 w-full"></div>`);
      }
    });
  });
}

export { ContextEditor as C };
//# sourceMappingURL=ContextEditor-BUTyqJ-R.js.map
