import{jsx as n,jsxs as l}from"react/jsx-runtime";import{memo as s,useMemo as c}from"react";import{strikethroughText as d}from"../../utils/index.js";import{SchemaSelection as f}from"../common/SchemaSelection/SchemaSelection.js";import{SelectionTitle as g}from"../common/index.js";import{styled as t}from"../../styled-components.js";import{DefaultMappingOption as u}from"./DefaultMappingOption.js";function x({activeOneOfIdx:a,parent:e,translate:i}){const p=c(()=>(e.oneOf||[]).map((o,r)=>{const m=o.schema.deprecated?`${d(o.title)} (${i("openapi.badges.deprecated","deprecated").toLowerCase()})`:o.title;return o.isDefaultMapping?{label:i("openapi.discriminator.defaultMapping","Default mapping"),value:r,element:n(u,{label:i("openapi.discriminator.defaultMapping","Default mapping")}),...e.oneOf&&e.oneOf.length>1?{divider:n(v,{})}:{}}:{label:m,value:r}}),[e.oneOf,i]);return e.oneOf===void 0?null:l(D,{children:[n(g,{children:i("openapi.discriminator","Discriminator")}),n(f,{options:p,pointer:e.operationPointer,schema:e,defaultOneOfIdx:a})]})}const k=s(x),D=t.div`
  display: flex;
  flex-direction: column;
  align-items: flex-start;
`,v=t.span`
  background-color: var(--border-color-primary);
  display: block;
  align-self: stretch;

  [data-component-name='Dropdown/DropdownMenu'] & {
    height: 1px;
    margin: calc(var(--spacing-xxs) / 2) var(--spacing-xxs);
  }

  [data-component-name='Segmented/Segmented'] & {
    width: 1px;
    margin: var(--spacing-xxs) calc(var(--spacing-xxs) / 2);
  }
`;export{k as Discriminator};
