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