"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ObjectSchema=void 0;const jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),jotai_1=require("jotai"),common_1=require("../common"),Discriminator_1=require("../Discriminator"),store_1=require("../../jotai/store"),PropertyDetails_1=require("../PropertyDetails"),SubSchema_1=require("./SubSchema"),helpers_1=require("./helpers");function ObjectSchemaComponent({schema:e,showTitle:r,discriminator:i,level:t,skipWriteOnly:n,skipReadOnly:a,fieldParentsName:s,expandable:o,deepLink:l,required:m,disableDeepLinks:c,oneOfLevel:p}){const{fields:u=[],title:d}=e,{schemasExpansionLevel:_}=(0,jotai_1.useAtomValue)(store_1.globalOptionsAtom),h=a||n?u.filter((e=>!(a&&e.schema.readOnly||n&&e.schema.writeOnly))):u,x=(0,helpers_1.getExpandByDefault)({required:m,level:t,schemasExpansionLevel:_});return(0,jsx_runtime_1.jsx)(SubSchema_1.SubSchema,{expandable:o,expandByDefault:x,level:t,propertyLength:h.length,deepLink:l,operationPointer:e.operationPointer,children:(0,jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment,{children:[r&&(0,jsx_runtime_1.jsx)(common_1.PropertiesTableCaption,{children:d}),h.map(((e,o)=>(0,jsx_runtime_1.jsx)(PropertyDetails_1.PropertyDetails,{isFirst:0===o,field:e,fieldParentsName:Number(t)>1?s:[],renderDiscriminatorSwitch:(null==i?void 0:i.fieldName)===e.name&&(null==i?void 0:i.parentSchema)?()=>(0,jsx_runtime_1.jsx)(Discriminator_1.Discriminator,{parent:i.parentSchema,onChange:null==i?void 0:i.onChange,activeOneOfIdx:i.activeOneOfIdx}):void 0,skipReadOnly:a,skipWriteOnly:n,showTitle:r,level:t,disableDeepLinks:c,oneOfLevel:p},e.name)))]})})}exports.ObjectSchema=(0,react_1.memo)(ObjectSchemaComponent);
//# sourceMappingURL=ObjectSchema.js.map