import{jsx as n,jsxs as s}from"react/jsx-runtime";import{memo as c,useMemo as d}from"react";import{strikethroughText as f}from"../../utils/index.js";import{SchemaSelection as g}from"../common/SchemaSelection/SchemaSelection.js";import{SelectionTitle as u}from"../common/index.js";import{styled as t}from"../../styled-components.js";import{DefaultMappingOption as x}from"./DefaultMappingOption.js";function D({activeOneOfIdx:a,parent:e,onChange:p,translate:i}){const m=d(()=>(e.oneOf||[]).map((o,r)=>{const l=o.schema.deprecated?`${f(o.title)} (${i("openapi.badges.deprecated","deprecated").toLowerCase()})`:o.title;return o.isDefaultMapping?{label:i("openapi.discriminator.defaultMapping","Default mapping"),value:r,element:n(x,{label:i("openapi.discriminator.defaultMapping","Default mapping")}),...e.oneOf&&e.oneOf.length>1?{divider:n(v,{})}:{}}:{label:l,value:r}}),[e.oneOf,i]);return e.oneOf===void 0?null:s(h,{children:[n(u,{children:i("openapi.discriminator","Discriminator")}),n(g,{options:m,pointer:e.operationPointer,onChange:p,schema:e,defaultOneOfIdx:a})]})}const C=c(D),h=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{C as Discriminator};
