import{jsx as a,Fragment as C,jsxs as p}from"react/jsx-runtime";import{memo as P}from"react";import{useAtomValue as F}from"jotai";import{PropertiesTableCaption as N}from"../common/index.js";import{Discriminator as v}from"../Discriminator/index.js";import{globalOptionsAtom as A}from"../../jotai/store.js";import{PropertyDetails as B}from"../PropertyDetails/index.js";import{SubSchema as _}from"./SubSchema.js";import{getExpandByDefault as w}from"./helpers.js";import{useTranslate as E}from"../../hooks/index.js";import{ArrayClosingLabel as I,LabelValue as T}from"../common/styled.js";function V({schema:m,showTitle:s,discriminator:t,level:n,skipWriteOnly:r,skipReadOnly:o,fieldParentsName:c,expandable:f,deepLink:h,required:d,disableDeepLinks:u,shouldCloseArray:g,oneOfLevel:x,slug:b,onOneOfChange:O}){const{fields:i=[],title:y}=m,D=E(),{schemasExpansionLevel:L}=F(A),l=o||r?i.filter(e=>!(o&&e.schema.readOnly||r&&e.schema.writeOnly)):i,S=w({required:d,level:n,schemasExpansionLevel:L});return p(_,{expandable:f,expandByDefault:S,level:n,propertyLength:l.length,deepLink:h,operationPointer:m.operationPointer,children:[p(C,{children:[s&&a(N,{children:y}),l.map((e,j)=>a(B,{isFirst:j===0,field:e,fieldParentsName:Number(n)>1?c:[],renderDiscriminatorSwitch:t?.fieldName===e.name&&t?.parentSchema?()=>a(v,{parent:t.parentSchema,onChange:t?.onChange,activeOneOfIdx:t.activeOneOfIdx,translate:D}):void 0,skipReadOnly:o,skipWriteOnly:r,showTitle:s,level:n,disableDeepLinks:u,oneOfLevel:x,slug:b,onOneOfChange:O},e.name))]}),g&&a(I,{className:"array-closing-label",children:a(T,{children:"]"})})]})}const Y=P(V);export{Y as ObjectSchema};
