{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "model-selector-web",
  "title": "Model Selector (Web Components)",
  "description": "A button that opens a searchable list of models grouped by provider, with their logos, costs and footer actions.",
  "dependencies": [
    "@kind-ui/agent-ui@0.9.0",
    "@ui-sdk/core@0.1.0-beta.17",
    "@ui-sdk/web@0.1.0-beta.17"
  ],
  "registryDependencies": [
    "@kind-ui/agent-ui-setup",
    "@kind-ui/picker-web"
  ],
  "files": [
    {
      "path": "packages/agent-ui/src/web/model-selector.ts",
      "content": "import {\n  type ModelSelectorApi,\n  type ModelSelectorOptions,\n  type ModelSelectorValueChangeReason,\n  modelSelectorPrimitive,\n  type PickerOpenChangeReason,\n  type PickerOptions,\n} from \"@kind-ui/agent-ui/core\";\nimport { createParts } from \"@ui-sdk/web\";\nimport type { AttributeProperties, UiChangeEvent, UiElement } from \"@ui-sdk/web/events\";\nimport { defineInternalCommand } from \"./internal/command\";\nimport { pickerElements } from \"./picker\";\n\ntype ModelIcon = string | Element;\n\n/**\n * `<kind-model-selector>` fills in its trigger and list when it has no children. Set `models`, `actions` and `value`\n * as properties; choosing a model fires `modelchange` with its id as `detail.value`, and with `can-run`, an action\n * fires `modelaction` with its `id`.\n */\nexport function defineModelSelector(): void {\n  if (customElements.get(\"kind-model-selector\")) return;\n  defineInternalCommand();\n  createParts(\n    modelSelectorPrimitive,\n    pickerElements<typeof modelSelectorPrimitive>(\"kind-model-selector\", {\n      onValueChange: \"modelchange\",\n      onAction: \"modelaction\",\n    }),\n  );\n}\n\nexport type KindModelSelectorEvents = {\n  modelchange: UiChangeEvent<string, ModelSelectorValueChangeReason>;\n  modelaction: UiChangeEvent<string, ModelSelectorValueChangeReason>;\n  openchange: UiChangeEvent<boolean, PickerOpenChangeReason>;\n};\n\nexport interface KindModelSelectorElement\n  extends UiElement<KindModelSelectorEvents>,\n    AttributeProperties<\n      typeof modelSelectorPrimitive,\n      \"api\" | \"models\" | \"actions\" | \"value\" | \"defaultValue\" | \"open\"\n    > {\n  /**\n   * A model's `icon` is an image URL, or an element (such as an `svg`) copied into its row and the trigger. A copy\n   * keeps the element's ids, so pass a logo that uses `defs` (gradients, masks) as an image URL.\n   */\n  models?: (Omit<NonNullable<ModelSelectorOptions[\"models\"]>[number], \"icon\"> & { icon?: ModelIcon })[];\n  actions?: (Omit<NonNullable<PickerOptions[\"actions\"]>[number], \"icon\"> & { icon?: ModelIcon })[];\n  get value(): string | null;\n  set value(id: string);\n  defaultValue?: string | null;\n  open: boolean;\n  /** Whether a person can run the `actions`, which fires `modelaction`. */\n  canRun: boolean;\n  api: Pick<ModelSelectorApi, \"isOpen\" | \"setOpen\" | \"getValue\">;\n}\n\ndeclare global {\n  interface HTMLElementTagNameMap {\n    \"kind-model-selector\": KindModelSelectorElement;\n    \"kind-model-selector-trigger\": HTMLElement;\n    \"kind-model-selector-content\": HTMLElement;\n    \"kind-model-selector-viewport\": HTMLElement;\n    \"kind-model-selector-command\": HTMLElement;\n    \"kind-model-selector-item\": HTMLElement;\n    \"kind-model-selector-note\": HTMLElement;\n  }\n}\n",
      "type": "registry:ui",
      "target": "@ui/web/model-selector.ts"
    }
  ],
  "meta": {
    "layer": "web"
  },
  "type": "registry:ui"
}
