"use strict";(self.webpackChunk_digicms_admin=self.webpackChunk_digicms_admin||[]).push([[8880],{25747:function(Ae,se,l){var a=l(32735),U=l(83292),ye=l(60216),k=l.n(ye),R=l(72850),it=l(1176),Ye=l(35071),G=l(88675),lt=l(73779),n=l(15431),N=l(22348),pe=l(7184),Xe=l(872),ut=l(61642),be=l(43475),dt=l(89135),Be=l(82512),an=l(58656),he=l(83218),d=l(17757),ie=l(32031),Se=l(58521),D=l.n(Se);const Qe={biginteger:ie.Z,boolean:lt.Z,collectionType:Ye.Z,component:it.Z,contentType:Ye.Z,date:G.Z,datetime:G.Z,decimal:ie.Z,dynamiczone:n.Z,email:N.Z,enum:pe.Z,enumeration:pe.Z,file:be.Z,files:be.Z,float:ie.Z,integer:ie.Z,json:Xe.Z,JSON:Xe.Z,media:be.Z,number:ie.Z,password:dt.Z,relation:Be.Z,richtext:ut.Z,singleType:an.Z,string:he.Z,text:he.Z,time:G.Z,timestamp:G.Z,uid:d.Z},ct=(0,U.default)(R.x)`
  width: ${(0,Se.pxToRem)(32)};
  height: ${(0,Se.pxToRem)(24)};
  box-sizing: content-box;
`,je=({type:Je,customField:_e,...Ze})=>{const B=(0,Se.useCustomFields)();let V=Qe[Je];if(_e){const{icon:Fe}=B.get(_e);Fe&&(V=Fe)}return Qe[Je]?a.createElement(ct,{as:V,...Ze,"aria-hidden":!0}):null};je.defaultProps={customField:null},je.propTypes={type:k().string.isRequired,customField:k().string},se.Z=je},74753:function(Ae,se,l){var a=l(32735);const U=(0,a.createContext)();se.Z=U},51216:function(Ae,se,l){var a=l(32735);const U=(0,a.createContext)();se.Z=U},198:function(Ae,se,l){var a=l(32735),U=l(74753);const ye=()=>(0,a.useContext)(U.Z);se.Z=ye},32237:function(Ae,se,l){var a=l(32735),U=l(51216);const ye=()=>(0,a.useContext)(U.Z);se.Z=ye},92706:function(Ae,se,l){l.r(se),l.d(se,{default:function(){return uo}});var a=l(32735),U=l(5141),ye=l(99357),k=l(5636),R=l(58521),it=l(96709),Ye=l(3633),G=l(25158),lt=l(60216),n=l.n(lt),N=l(92891),pe=l(4409),Xe=l(13055),ut=l(74753),be=l(32237),dt=l(55721);const Be=dt.Z.create({baseURL:`http://localhost:1337/${G.Z}`});Be.interceptors.request.use(async e=>(e.headers={Authorization:`Bearer ${R.auth.getToken()}`,Accept:"application/json","Content-Type":"application/json"},e),e=>{Promise.reject(e)}),Be.interceptors.response.use(e=>e,e=>{throw e.response?.status===401&&(R.auth.clearAppStorage(),window.location.reload()),e});var he=(0,R.wrapAxiosInstance)(Be),d=l(92318),ie=l(37087),Se=l(33795),D=l.n(Se),Qe=l(23973),ct=l.n(Qe),je=l(3040),Je=l.n(je),_e=l(59578),Ze=l.n(_e),B=l(72850),V=l(41415),Fe=l(9026),sa=l(85025),sn=l(31600),oa=l(11406),on=l(35540),Ne=l(39291),Le=l(3653),J=l(87933),ce=l(27677),Te=l(198),rn=l(27799),ra=l(23940),ve=l.n(ra);const ia=[{label:"All",children:[{label:"images (JPEG, PNG, GIF, SVG, TIFF, ICO, DVU)",value:"images"},{label:"videos (MPEG, MP4, Quicktime, WMV, AVI, FLV)",value:"videos"},{label:"audios (MP3, WAV, OGG)",value:"audios"},{label:"files (CSV, ZIP, PDF, Excel, JSON, ...)",value:"files"}]}],mt=({intlLabel:e,name:t,onChange:s,value:r})=>{const{formatMessage:o}=(0,k.useIntl)(),i=r===null||r.length===0?o({id:"global.none",defaultMessage:"None"}):[...r].sort().map(c=>ve()(c)).join(", "),u=e.id?o({id:e.id,defaultMessage:e.defaultMessage}):t;return a.createElement(rn.Q,{id:"select1",label:u,customizeContent:()=>i,onChange:c=>{c.length>0?s({target:{name:t,value:c,type:"allowed-types-select"}}):s({target:{name:t,value:null,type:"allowed-types-select"}})},options:ia,value:r||[]})};mt.defaultProps={value:null},mt.propTypes={intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,name:n().string.isRequired,onChange:n().func.isRequired,value:n().oneOfType([n().object,n().array])};var la=mt,Q=l(49372),ln=e=>e.kind==="collectionType"&&(e.restrictRelationsTo===null||Array.isArray(e.restrictRelationsTo)&&e.restrictRelationsTo.length>0),pt=l(15335),et=l(5803),gt=l(861),tt=l(25747),Oe=l(83292),un=(0,Oe.default)(B.x)`
  width: 100%;
  height: 100%;
  border: 1px solid ${({theme:e})=>e.colors.neutral200};
  text-align: left;
  &:hover {
    background: ${({theme:e})=>e.colors.primary100};
    border: 1px solid ${({theme:e})=>e.colors.primary200};
  }
`;const ft=({type:e})=>{const{formatMessage:t}=(0,k.useIntl)(),{onClickSelectField:s}=(0,be.Z)(),r=()=>{s({attributeType:e,step:e==="component"?"1":null})};return a.createElement(un,{padding:4,as:"button",hasRadius:!0,type:"button",onClick:r},a.createElement(J.k,null,a.createElement(tt.Z,{type:e}),a.createElement(B.x,{paddingLeft:4},a.createElement(J.k,null,a.createElement(Q.Z,{fontWeight:"bold"},t({id:(0,d.Z)(`attribute.${e}`),defaultMessage:e}))),a.createElement(J.k,null,a.createElement(Q.Z,{variant:"pi",textColor:"neutral600"},t({id:(0,d.Z)(`attribute.${e}.description`),defaultMessage:"A type for modeling data"}))))))};ft.defaultProps={type:"text"},ft.propTypes={type:n().string};var ua=ft,dn=e=>{const t=e%2===1;return{paddingLeft:t?2:0,paddingRight:t?0:2}};const cn=({attributes:e})=>a.createElement(gt.k,{tagName:"button"},a.createElement(ce.K,{spacing:8},e.map((t,s)=>a.createElement(pt.r,{key:s,gap:0},t.map((r,o)=>{const{paddingLeft:i,paddingRight:u}=dn(o);return a.createElement(et.P,{key:r,col:6,style:{height:"100%"}},a.createElement(B.x,{paddingLeft:i,paddingRight:u,paddingBottom:1,style:{height:"100%"}},a.createElement(ua,{type:r})))})))));cn.propTypes={attributes:n().array.isRequired};var da=cn,ca=l(50428),ma=l(25148),pa=l(99140),xe=l(19406),ga=l(54725);const fa=(0,Oe.default)(B.x)`
  background: ${({theme:e})=>`linear-gradient(180deg, rgba(234, 234, 239, 0) 0%, ${e.colors.neutral150} 100%)`};
  opacity: 0.33;
`,ya=()=>a.createElement(J.k,{wrap:"wrap",gap:4},[...Array(4)].map((e,t)=>a.createElement(fa,{key:`empty-card-${t}`,height:"138px",width:"375px",hasRadius:!0})));var ba=()=>{const{formatMessage:e}=(0,k.useIntl)();return a.createElement(B.x,{position:"relative"},a.createElement(ya,null),a.createElement(B.x,{position:"absolute",top:6,width:"100%"},a.createElement(J.k,{alignItems:"center",justifyContent:"center",direction:"column"},a.createElement(pa.J,{as:ga.default,color:"",width:"160px",height:"88px"}),a.createElement(B.x,{paddingTop:6,paddingBottom:4},a.createElement(B.x,{textAlign:"center"},a.createElement(Q.Z,{variant:"delta",as:"p",textColor:"neutral600"},e({id:(0,d.Z)("modalForm.empty.heading"),defaultMessage:"Nothing in here yet."})),a.createElement(B.x,{paddingTop:4},a.createElement(Q.Z,{variant:"delta",as:"p",textColor:"neutral600"},e({id:(0,d.Z)("modalForm.empty.sub-heading"),defaultMessage:"Find what you are looking for through a wide range of extensions."}))))),a.createElement(ma.Q,{to:"/marketplace",variant:"secondary",startIcon:a.createElement(xe.default,null)},e({id:(0,d.Z)("modalForm.empty.button"),defaultMessage:"Add custom fields"})))))};const mn=({customFieldUid:e,customField:t})=>{const{type:s,intlLabel:r,intlDescription:o}=t,{formatMessage:i}=(0,k.useIntl)(),{onClickSelectCustomField:u}=(0,be.Z)(),c=()=>{u({attributeType:s,customFieldUid:e})};return a.createElement(un,{padding:4,as:"button",hasRadius:!0,type:"button",onClick:c},a.createElement(J.k,null,a.createElement(tt.Z,{type:s,customField:e}),a.createElement(B.x,{paddingLeft:4},a.createElement(J.k,null,a.createElement(Q.Z,{fontWeight:"bold"},i(r))),a.createElement(J.k,null,a.createElement(Q.Z,{variant:"pi",textColor:"neutral600"},i(o))))))};mn.propTypes={customFieldUid:n().string.isRequired,customField:n().shape({type:n().string.isRequired,icon:n().func,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired}).isRequired,intlDescription:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired}).isRequired}).isRequired};var ha=mn,va=()=>{const{formatMessage:e}=(0,k.useIntl)(),t=(0,R.useCustomFields)(),s=Object.entries(t.getAll());if(!s.length)return a.createElement(ba,null);const r=s.sort((o,i)=>o[1].name>i[1].name?1:-1);return a.createElement(gt.k,{tagName:"button"},a.createElement(ce.K,{spacing:3},a.createElement(pt.r,{gap:0},r.map(([o,i],u)=>{const{paddingLeft:c,paddingRight:m}=dn(u);return a.createElement(et.P,{key:o,col:6,style:{height:"100%"}},a.createElement(B.x,{paddingLeft:c,paddingRight:m,paddingBottom:1,style:{height:"100%"}},a.createElement(ha,{key:o,customFieldUid:o,customField:i})))})),a.createElement(ca.r,{href:"https://docs.strapi.io/developer-docs/latest/development/custom-fields.html",isExternal:!0},e({id:(0,d.Z)("modalForm.tabs.custom.howToLink"),defaultMessage:"How to add custom fields"}))))};const pn=({attributes:e,forTarget:t,kind:s})=>{const{formatMessage:r}=(0,k.useIntl)(),o=(0,d.Z)("modalForm.tabs.default"),i=(0,d.Z)("modalForm.tabs.custom"),u=t.includes("component")?"component":s,c=(0,d.Z)(`modalForm.sub-header.chooseAttribute.${u}`);return a.createElement(sn.f,{padding:6},a.createElement(on.v,{label:r({id:(0,d.Z)("modalForm.tabs.label"),defaultMessage:"Default and Custom types tabs"}),id:"attribute-type-tabs",variant:"simple"},a.createElement(J.k,{justifyContent:"space-between"},a.createElement(Q.Z,{variant:"beta",as:"h2"},r({id:c,defaultMessage:"Select a field"})),a.createElement(Ne.m,null,a.createElement(Ne.O,null,r({id:o,defaultMessage:"Default"})),a.createElement(Ne.O,null,r({id:i,defaultMessage:"Custom"})))),a.createElement(B.x,{paddingBottom:6},a.createElement(Fe.i,null)),a.createElement(Le.n,null,a.createElement(Le.x,null,a.createElement(da,{attributes:e})),a.createElement(Le.x,null,a.createElement(va,null)))))};pn.propTypes={attributes:n().array.isRequired,forTarget:n().string.isRequired,kind:n().string.isRequired};var Ta=pn,Ca=l(39161);const yt=({description:e,disabled:t,intlLabel:s,isCreating:r,name:o,onChange:i,value:u})=>{const{formatMessage:c}=(0,k.useIntl)(),[m,g]=(0,a.useState)(!1),f=s.id?c({id:s.id,defaultMessage:s.defaultMessage},{...s.values}):o,p=e?c({id:e.id,defaultMessage:e.defaultMessage},{...e.values}):"",h=()=>g(L=>!L),v=()=>{i({target:{name:o,value:!1}}),h()},S=({target:{checked:L}})=>{if(!L&&!r){h();return}i({target:{name:o,value:L}})};return a.createElement(a.Fragment,null,a.createElement(Ca.Checkbox,{checked:u,disabled:t,hint:p,name:o,onChange:S},f),a.createElement(R.ConfirmDialog,{isOpen:m,onToggleDialog:h,onConfirm:v,bodyText:{id:(0,d.Z)("popUpWarning.draft-publish.message"),defaultMessage:"If you disable the draft & publish, your drafts will be deleted."},leftButtonText:{id:"components.popUpWarning.button.cancel",defaultMessage:"No, cancel"},rightButtonText:{id:(0,d.Z)("popUpWarning.draft-publish.button.confirm"),defaultMessage:"Yes, disable"}}))};yt.defaultProps={description:null,disabled:!1,value:!1},yt.propTypes={description:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),disabled:n().bool,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,isCreating:n().bool.isRequired,name:n().string.isRequired,onChange:n().func.isRequired,value:n().bool};var Ea=yt,bt=l(11299),gn=l(55225);const ht=({actionType:e,attributeName:t,attributeType:s,categoryName:r,contentTypeKind:o,dynamicZoneTarget:i,forTarget:u,modalType:c,targetUid:m,customFieldUid:g})=>{const{formatMessage:f}=(0,k.useIntl)(),{modifiedData:p}=(0,Te.Z)();let h,v=[];const S=p?.[u]?.[m]||p?.[u]||null;let L=S?.schema.displayName;if(c==="contentType"&&(h=o),["component","editCategory"].includes(c)&&(h="component"),["component","contentType"].includes(c)){let T=(0,d.Z)(`modalForm.component.header-${e}`);return c==="contentType"&&(T=(0,d.Z)(`modalForm.${o}.header-create`)),e==="edit"&&(T=(0,d.Z)("modalForm.header-edit")),a.createElement(gn.x,null,a.createElement(J.k,null,a.createElement(B.x,null,a.createElement(tt.Z,{type:h})),a.createElement(B.x,{paddingLeft:3},a.createElement(Q.Z,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title"},f({id:T},{name:L})))))}v=[{label:L,info:{category:S?.category||null,name:S?.schema.displayName}}],c==="chooseAttribute"&&(h=["component","components"].includes(u)?"component":S.schema.kind),c==="addComponentToDynamicZone"&&(h="dynamiczone",v.push({label:i})),(c==="attribute"||c==="customField")&&(h=s,v.push({label:t})),c==="editCategory"&&(v=[{label:f({id:(0,d.Z)("modalForm.header.categories"),defaultMessage:"Categories"})},{label:r}]);const E=v.map(({label:T})=>T).join(",");return a.createElement(gn.x,null,a.createElement(ce.K,{horizontal:!0,spacing:3},a.createElement(tt.Z,{type:h,customField:g}),a.createElement(bt.O,{label:E},v.map((T,A)=>{const j=ve()(T.label);if(!j)return null;const K=`${T.label}.${A}`;if(T.info?.category){const te=`${j} (${ve()(T.info.category)} - ${ve()(T.info.name)})`;return a.createElement(bt.$,{key:K},te)}return a.createElement(bt.$,{key:K},j)}))))};ht.defaultProps={actionType:null,attributeName:null,attributeType:null,categoryName:null,dynamicZoneTarget:null,forTarget:null,contentTypeKind:null,targetUid:null,customFieldUid:null},ht.propTypes={actionType:n().string,attributeName:n().string,attributeType:n().string,categoryName:n().string,contentTypeKind:n().string,dynamicZoneTarget:n().string,forTarget:n().oneOf(["contentType","component","components"]),modalType:n().string.isRequired,targetUid:n().string,customFieldUid:n().string};var Ma=ht;const vt=({categoryName:e,deleteCategory:t,deleteComponent:s,deleteContentType:r,isAttributeModal:o,isCustomFieldModal:i,isComponentAttribute:u,isComponentToDzModal:c,isContentTypeModal:m,isCreatingComponent:g,isCreatingComponentAttribute:f,isCreatingComponentInDz:p,isCreatingComponentWhileAddingAField:h,isCreatingContentType:v,isCreatingDz:S,isComponentModal:L,isDzAttribute:q,isEditingAttribute:E,isEditingCategory:T,isInFirstComponentStep:A,onSubmitAddComponentAttribute:j,onSubmitAddComponentToDz:K,onSubmitCreateContentType:te,onSubmitCreateComponent:O,onSubmitCreateDz:Y,onSubmitEditAttribute:W,onSubmitEditCategory:Ke,onSubmitEditComponent:w,onSubmitEditContentType:Ie,onSubmitEditCustomFieldAttribute:fe,onSubmitEditDz:Ve,onClickFinish:Ee})=>{const{formatMessage:z}=(0,k.useIntl)();return c?p?a.createElement(V.z,{variant:"secondary",type:"submit",onClick:M=>{M.preventDefault(),K(M,!0)},startIcon:a.createElement(xe.default,null)},z({id:(0,d.Z)("form.button.add-first-field-to-created-component"),defaultMessage:"Add first field to the component"})):a.createElement(V.z,{variant:"default",type:"submit",onClick:M=>{M.preventDefault(),K(M,!1)}},z({id:"global.finish",defaultMessage:"Finish"})):o&&q&&!S?a.createElement(V.z,{variant:"default",type:"submit",onClick:M=>{M.preventDefault(),Ee(),Ve(M,!1)}},z({id:"global.finish",defaultMessage:"Finish"})):o&&q&&S?a.createElement(a.Fragment,null,a.createElement(V.z,{variant:"secondary",type:"submit",onClick:M=>{M.preventDefault(),Y(M,!0)},startIcon:a.createElement(xe.default,null)},z({id:(0,d.Z)("form.button.add-components-to-dynamiczone"),defaultMessage:"Add components to the zone"}))):o&&u?A?a.createElement(V.z,{variant:"secondary",type:"submit",onClick:M=>{M.preventDefault(),j(M,!0)}},z(f?{id:(0,d.Z)("form.button.configure-component"),defaultMessage:"Configure the component"}:{id:(0,d.Z)("form.button.select-component"),defaultMessage:"Configure the component"})):a.createElement(a.Fragment,null,a.createElement(V.z,{variant:"secondary",type:"submit",onClick:M=>{M.preventDefault(),j(M,!0)},startIcon:a.createElement(xe.default,null)},z(h?{id:(0,d.Z)("form.button.add-first-field-to-created-component"),defaultMessage:"Add first field to the component"}:{id:(0,d.Z)("form.button.add-field"),defaultMessage:"Add another field"})),a.createElement(V.z,{variant:"default",type:"button",onClick:M=>{M.preventDefault(),Ee(),j(M,!1)}},z({id:"global.finish",defaultMessage:"Finish"}))):o&&!u&&!q?a.createElement(a.Fragment,null,a.createElement(V.z,{type:E?"button":"submit",variant:"secondary",onClick:M=>{M.preventDefault(),W(M,!0)},startIcon:a.createElement(xe.default,null)},z({id:(0,d.Z)("form.button.add-field"),defaultMessage:"Add another field"})),a.createElement(V.z,{type:E?"submit":"button",variant:"default",onClick:M=>{M.preventDefault(),Ee(),W(M,!1)}},z({id:"global.finish",defaultMessage:"Finish"}))):m?a.createElement(a.Fragment,null,!v&&a.createElement(a.Fragment,null,a.createElement(V.z,{type:"button",variant:"danger",onClick:M=>{M.preventDefault(),r()}},z({id:"global.delete",defaultMessage:"Delete"})),a.createElement(V.z,{type:"submit",variant:"default",onClick:M=>{M.preventDefault(),Ie(M,!1)}},z({id:"global.finish",defaultMessage:"Finish"}))),v&&a.createElement(V.z,{type:"submit",variant:"secondary",onClick:M=>{M.preventDefault(),te(M,!0)}},z({id:"global.continue",defaultMessage:"Continue"}))):L?a.createElement(a.Fragment,null,!g&&a.createElement(a.Fragment,null,a.createElement(V.z,{type:"button",variant:"danger",onClick:M=>{M.preventDefault(),s()}},z({id:"global.delete",defaultMessage:"Delete"})),a.createElement(V.z,{type:"submit",variant:"default",onClick:M=>{M.preventDefault(),w(M,!1)}},z({id:"global.finish",defaultMessage:"Finish"}))),g&&a.createElement(V.z,{type:"submit",variant:"secondary",onClick:M=>{M.preventDefault(),O(M,!0)}},z({id:"global.continue",defaultMessage:"Continue"}))):T?a.createElement(a.Fragment,null,a.createElement(V.z,{type:"button",variant:"danger",onClick:M=>{M.preventDefault(),t(e)}},z({id:"global.delete",defaultMessage:"Delete"})),a.createElement(V.z,{type:"submit",variant:"default",onClick:M=>{M.preventDefault(),Ke(M)}},z({id:"global.finish",defaultMessage:"finish"}))):i?a.createElement(a.Fragment,null,a.createElement(V.z,{type:E?"button":"submit",variant:"secondary",onClick:M=>{M.preventDefault(),fe(M,!0)},startIcon:a.createElement(xe.default,null)},z({id:(0,d.Z)("form.button.add-field"),defaultMessage:"Add another field"})),a.createElement(V.z,{type:E?"submit":"button",variant:"default",onClick:M=>{M.preventDefault(),Ee(),fe(M,!1)}},z({id:"global.finish",defaultMessage:"Finish"}))):null};vt.defaultProps={categoryName:null,onClickFinish(){}},vt.propTypes={categoryName:n().string,deleteCategory:n().func.isRequired,deleteComponent:n().func.isRequired,deleteContentType:n().func.isRequired,isAttributeModal:n().bool.isRequired,isCustomFieldModal:n().bool.isRequired,isComponentAttribute:n().bool.isRequired,isComponentModal:n().bool.isRequired,isComponentToDzModal:n().bool.isRequired,isContentTypeModal:n().bool.isRequired,isCreatingComponent:n().bool.isRequired,isCreatingComponentAttribute:n().bool.isRequired,isCreatingComponentInDz:n().bool.isRequired,isCreatingComponentWhileAddingAField:n().bool.isRequired,isCreatingContentType:n().bool.isRequired,isCreatingDz:n().bool.isRequired,isDzAttribute:n().bool.isRequired,isEditingAttribute:n().bool.isRequired,isEditingCategory:n().bool.isRequired,isInFirstComponentStep:n().bool.isRequired,onSubmitAddComponentAttribute:n().func.isRequired,onSubmitAddComponentToDz:n().func.isRequired,onSubmitCreateContentType:n().func.isRequired,onSubmitCreateComponent:n().func.isRequired,onSubmitCreateDz:n().func.isRequired,onSubmitEditAttribute:n().func.isRequired,onSubmitEditCategory:n().func.isRequired,onSubmitEditComponent:n().func.isRequired,onSubmitEditContentType:n().func.isRequired,onSubmitEditCustomFieldAttribute:n().func.isRequired,onSubmitEditDz:n().func.isRequired,onClickFinish:n().func};var Ra=vt,Za=({modalType:e,forTarget:t,kind:s,actionType:r,step:o})=>{switch(e){case"chooseAttribute":return(0,d.Z)(`modalForm.sub-header.chooseAttribute.${t.includes("component")?"component":s||"collectionType"}`);case"attribute":return(0,d.Z)(`modalForm.sub-header.attribute.${r}${o!=="null"&&o!==null&&r!=="edit"?".step":""}`);case"customField":return(0,d.Z)(`modalForm.sub-header.attribute.${r}`);case"addComponentToDynamicZone":return(0,d.Z)("modalForm.sub-header.addComponentToDynamicZone");default:return(0,d.Z)("configurations")}};const Tt=({actionType:e,modalType:t,forTarget:s,kind:r,step:o,attributeType:i,attributeName:u,customField:c})=>{const{formatMessage:m}=(0,k.useIntl)(),g=t==="customField"?c.intlLabel:{id:(0,d.Z)(`attribute.${i}`)};return a.createElement(ce.K,{direction:"column",alignItems:"flex-start",paddingBottom:2,gap:1},a.createElement(Q.Z,{as:"h2",variant:"beta"},m({id:Za({actionType:e,forTarget:s,kind:r,step:o,modalType:t}),defaultMessage:"Add new field"},{type:ve()(m(g)),name:ve()(u),step:o})),a.createElement(Q.Z,{variant:"pi",textColor:"neutral600"},m({id:(0,d.Z)(`attribute.${i}.description`),defaultMessage:"A type for modeling data"})))};Tt.defaultProps={actionType:null,modalType:null,forTarget:null,kind:null,step:null,attributeType:null,attributeName:null,customField:null},Tt.propTypes={actionType:n().string,modalType:n().string,forTarget:n().string,kind:n().string,step:n().string,attributeType:n().string,attributeName:n().string,customField:n().object};var xa=Tt,nt=l(70218),at=l(84967);const Ct=({intlLabel:e,name:t,options:s,onChange:r,value:o})=>{const{formatMessage:i}=(0,k.useIntl)(),u=e.id?i({id:e.id,defaultMessage:e.defaultMessage},{...e.values}):t,c=m=>{let g="";m==="true"&&(g=!0),m==="false"&&(g=!1),r({target:{name:t,value:g,type:"select-default-boolean"}})};return a.createElement(nt.P,{label:u,id:t,name:t,onChange:c,value:(o===null?"":o).toString()},s.map(({metadatas:{intlLabel:m,disabled:g,hidden:f},key:p,value:h})=>a.createElement(at.W,{key:p,value:h,disabled:g,hidden:f},m.defaultMessage)))};Ct.defaultProps={value:null},Ct.propTypes={intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,name:n().string.isRequired,onChange:n().func.isRequired,options:n().arrayOf(n().shape({metadatas:n().shape({intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired}).isRequired,disabled:n().bool,hidden:n().bool}).isRequired,key:n().oneOfType([n().string,n().number]).isRequired,value:n().oneOfType([n().string,n().number]).isRequired}).isRequired).isRequired,value:n().any};var Aa=Ct,Sa=l(30350);const Fa=(0,Oe.default)(ce.K)`
  position: relative;
  align-items: stretch;

  label {
    border-radius: 4px;
    max-width: 50%;
    cursor: pointer;
    user-select: none;
    flex: 1;
    ${(0,Sa.k3)()}
  }

  input {
    position: absolute;
    opacity: 0;
  }

  .option {
    height: 100%;
    border-radius: 4px;
    border: 1px solid ${({theme:e})=>e.colors.neutral200};
    will-change: transform, opacity;
    background: ${({theme:e})=>e.colors.neutral0};

    .checkmark {
      position: relative;
      display: block;
      will-change: transform;
      background: ${({theme:e})=>e.colors.neutral0};
      width: ${({theme:e})=>e.spaces[5]};
      height: ${({theme:e})=>e.spaces[5]};
      border: solid 1px ${({theme:e})=>e.colors.neutral300};
      border-radius: 50%;

      &:before,
      &:after {
        content: '';
        display: block;
        border-radius: 50%;
        width: ${({theme:e})=>e.spaces[3]};
        height: ${({theme:e})=>e.spaces[3]};
        position: absolute;
        top: 3px;
        left: 3px;
      }

      &:after {
        transform: scale(0);
        transition: inherit;
        will-change: transform;
      }
    }
  }

  .container input:checked ~ div {
    background: ${({theme:e})=>e.colors.primary100};
    ${Q.Z} {
      color: ${({theme:e})=>e.colors.primary600};
    }
    border: 1px solid ${({theme:e})=>e.colors.primary200};
    .checkmark {
      border: solid 1px ${({theme:e})=>e.colors.primary600};
      &::after {
        background: ${({theme:e})=>e.colors.primary600};
        transform: scale(1);
      }
    }
  }
`,Et=({intlLabel:e,name:t,onChange:s,radios:r,value:o})=>{const{formatMessage:i}=(0,k.useIntl)();return a.createElement(ce.K,{spacing:2},a.createElement(Q.Z,{variant:"pi",fontWeight:"bold",textColor:"neutral800",htmlFor:t,as:"label"},i(e)),a.createElement(Fa,{horizontal:!0,spacing:4,style:{alignItems:"stretch"}},r.map(u=>a.createElement("label",{htmlFor:u.value.toString(),key:u.value,className:"container"},a.createElement("input",{id:u.value.toString(),name:t,className:"option-input",checked:u.value===o,value:u.value,key:u.value,onChange:s,type:"radio"}),a.createElement(B.x,{className:"option",padding:4},a.createElement(J.k,null,a.createElement(B.x,{paddingRight:4},a.createElement("span",{className:"checkmark"})),a.createElement(ce.K,{spacing:2},a.createElement(Q.Z,{fontWeight:"bold"},i(u.title)),a.createElement(Q.Z,{variant:"pi",textColor:"neutral600"},i(u.description)))))))))};Et.defaultProps={radios:[]},Et.propTypes={intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,name:n().string.isRequired,onChange:n().func.isRequired,radios:n().arrayOf(n().shape({title:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired}),description:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired}),value:n().any.isRequired})),value:n().oneOfType([n().string,n().bool]).isRequired};var Mt=Et;const fn=({onChange:e,name:t,...s})=>{const r=o=>{const i=o.target.value!=="false";e({target:{name:t,value:i,type:"boolean-radio-group"}})};return a.createElement(Mt,{...s,name:t,onChange:r})};fn.propTypes={name:n().string.isRequired,onChange:n().func.isRequired};var Na=fn,La=l(8284),Oa=l(81595),Rt=l(10369);const Zt=({error:e,intlLabel:t,modifiedData:s,name:r,onChange:o,value:i})=>{const{formatMessage:u}=(0,k.useIntl)(),[c,m]=(0,a.useState)(!!i||i===0),g=t.id?u({id:t.id,defaultMessage:t.defaultMessage},{...t.values}):r,f=s.type==="biginteger"?"text":"number",p=!s.type,h=e?u({id:e,defaultMessage:e}):"";return a.createElement(ce.K,{spacing:2},a.createElement(La.X,{id:r,name:r,onValueChange:v=>{o({target:{name:r,value:v?f==="text"?"0":0:null}}),m(q=>!q)},value:c},g),c&&a.createElement(B.x,{paddingLeft:6,style:{maxWidth:"200px"}},f==="text"?a.createElement(Rt.o,{"aria-label":g,disabled:p,error:h,id:r,name:r,onChange:o,value:i===null?"":i}):a.createElement(Oa.Y,{"aria-label":g,disabled:p,error:h,id:r,name:r,onValueChange:v=>{o({target:{name:r,value:v,type:f}})},value:i||0})))};Zt.defaultProps={error:null,value:null},Zt.propTypes={error:n().string,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,modifiedData:n().object.isRequired,name:n().string.isRequired,onChange:n().func.isRequired,value:n().oneOfType([n().string,n().object,n().bool,n().number])};var Da=Zt;const yn=({onChange:e,...t})=>{const s=(0,R.useNotification)(),r=o=>{s({type:"info",message:{id:(0,d.Z)("contentType.kind.change.warning"),defaultMessage:"You just changed the kind of a content type: API will be reset (routes, controllers, and services will be overwritten)."}}),e(o)};return a.createElement(Mt,{...t,onChange:r})};yn.propTypes={onChange:n().func.isRequired};var Pa=yn,xt=l(49561),bn=l(46788),H=l(91559);const At=({oneThatIsCreatingARelationWithAnother:e,target:t})=>{const{contentTypes:s,sortedContentTypesList:r}=(0,Te.Z)(),o=(0,pe.useDispatch)(),i=r.filter(ln),u=D()(s,[t,"plugin"],null),c=D()(s,[t,"schema","displayName"],"error");return a.createElement(bn.O,{id:"label",label:`${c}
    ${u?`(from: ${u})`:""}`},i.map(({uid:m,title:g,restrictRelationsTo:f,plugin:p})=>{const h=()=>{const v=p?`${p}_${g}`:g;o({type:H.aG,target:{value:m,oneThatIsCreatingARelationWithAnother:e,selectedContentTypeFriendlyName:v,targetContentTypeAllowedRelations:f}})};return a.createElement(bn.s,{key:m,onClick:h},g,"\xA0",p&&a.createElement(a.Fragment,null,"(from: ",p,")"))}))};At.defaultProps={target:null},At.propTypes={oneThatIsCreatingARelationWithAnother:n().string.isRequired,target:n().string};var Ia=At;const St=({disabled:e,error:t,header:s,isMain:r,name:o,onChange:i,oneThatIsCreatingARelationWithAnother:u,target:c,value:m})=>a.createElement(B.x,{background:"neutral100",hasRadius:!0,borderColor:"neutral200"},a.createElement(J.k,{paddingTop:r?4:1,paddingBottom:r?3:1,justifyContent:"center"},r?a.createElement(Q.Z,{variant:"pi",fontWeight:"bold",textColor:"neutral800"},s):a.createElement(Ia,{target:c,oneThatIsCreatingARelationWithAnother:u})),a.createElement(Fe.i,{background:"neutral200"}),a.createElement(B.x,{padding:4},a.createElement(R.GenericInput,{disabled:e,error:t?.id||null,intlLabel:{id:(0,d.Z)("form.attribute.item.defineRelation.fieldName"),defaultMessage:"Field name"},name:o,onChange:i,type:"text",value:m})));St.defaultProps={disabled:!1,error:null,header:null,isMain:!1,onChange(){},oneThatIsCreatingARelationWithAnother:null,target:null,value:""},St.propTypes={disabled:n().bool,error:n().object,header:n().string,isMain:n().bool,name:n().string.isRequired,onChange:n().func,oneThatIsCreatingARelationWithAnother:n().string,target:n().string,value:n().string};var hn=St,qa=l(51382),vn=l.n(qa),ka=l(24443),Ft=l.n(ka),$a=l(10168),Ua=l(25449),Ba=l(32548),ja=l(7733),Wa=l(79634),za=l(26253);const Ka=(0,Oe.default)(B.x)`
  position: relative;
  width: 100%;
  &::before {
    content: '';
    position: absolute;
    top: calc(50% - 0px);
    height: 2px;
    width: 100%;
    background-color: ${({theme:e})=>e.colors.primary600};
    z-index: 0;
  }
`,Va=(0,Oe.default)(B.x)`
  background: ${({theme:e,isSelected:t})=>e.colors[t?"primary100":"neutral0"]};
  border: 1px solid
    ${({theme:e,isSelected:t})=>e.colors[t?"primary700":"neutral200"]};
  border-radius: ${({theme:e})=>e.borderRadius};
  z-index: 1;
  svg {
    width: 1.5rem;
    height: 100%;
    path {
      fill: ${({theme:e,isSelected:t})=>e.colors[t?"primary700":"neutral500"]};
    }
  }
  &:disabled {
    cursor: not-allowed;
  }
`,wa=(0,Oe.default)(J.k)`
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
`,Ga={oneWay:Ua.Z,oneToOne:$a.Z,oneToMany:ja.Z,manyToOne:Wa.Z,manyToMany:za.Z,manyWay:Ba.Z},Nt=({naturePickerType:e,oneThatIsCreatingARelationWithAnother:t,relationType:s,target:r})=>{const o=(0,pe.useDispatch)(),{formatMessage:i}=(0,k.useIntl)(),{contentTypes:u,modifiedData:c}=(0,Te.Z)(),m=["oneWay","oneToOne","oneToMany","manyToOne","manyToMany","manyWay"],g=["oneWay","manyWay"],p=(e==="contentType"?D()(c,[e,"schema","kind"],""):e)==="collectionType"?m:g,h=s==="manyToOne",v=D()(u,[r,"schema","displayName"],"unknown"),S=h?v:t,L=h?t:v,q=Ft()(S,s==="manyToMany"?2:1),E=D()(u,[r,"schema","restrictRelationsTo"],null),T=Ft()(L,["manyToMany","oneToMany","manyToOne","manyWay"].includes(s)?2:1);return s?a.createElement(J.k,{style:{flex:1}},a.createElement(Ka,null,a.createElement(J.k,{paddingLeft:9,paddingRight:9,paddingTop:1,justifyContent:"center"},a.createElement(gt.k,{tagName:"button"},a.createElement(ce.K,{spacing:3,horizontal:!0},p.map(A=>{const j=Ga[A],K=E===null||E.includes(A);return a.createElement(Va,{as:"button",isSelected:s===A,disabled:!K,key:A,onClick:()=>{K&&o({type:H.QQ,target:{oneThatIsCreatingARelationWithAnother:t,targetContentType:r,value:A}})},padding:2,type:"button"},a.createElement(j,{key:A}))}))))),a.createElement(wa,{justifyContent:"center"},a.createElement(Q.Z,null,vn()(q,{length:24}),"\xA0"),a.createElement(Q.Z,{textColor:"primary600"},i({id:(0,d.Z)(`relation.${s}`)}),"\xA0"),a.createElement(Q.Z,null,vn()(T,{length:24})))):null};Nt.defaultProps={relationType:null,target:null},Nt.propTypes={naturePickerType:n().string.isRequired,oneThatIsCreatingARelationWithAnother:n().string.isRequired,relationType:n().string,target:n().string};var Ha=Nt;const Tn=({formErrors:e,mainBoxHeader:t,modifiedData:s,naturePickerType:r,onChange:o})=>{const i=(0,xt.Z)(s.relation,s.targetAttribute);return a.createElement(J.k,{style:{position:"relative"}},a.createElement(hn,{isMain:!0,header:t,error:e?.name||null,name:"name",onChange:o,value:s?.name||""}),a.createElement(Ha,{naturePickerType:r,oneThatIsCreatingARelationWithAnother:t,relationType:i,target:s.target}),a.createElement(hn,{disabled:["oneWay","manyWay"].includes(i),error:e?.targetAttribute||null,name:"targetAttribute",onChange:o,oneThatIsCreatingARelationWithAnother:t,target:s.target,value:s?.targetAttribute||""}))};Tn.propTypes={formErrors:n().object.isRequired,mainBoxHeader:n().string.isRequired,modifiedData:n().object.isRequired,naturePickerType:n().string.isRequired,onChange:n().func.isRequired};var Ya=Tn,Cn=l(45251);const Lt=({description:e,error:t,intlLabel:s,modifiedData:r,name:o,onChange:i,value:u})=>{const{formatMessage:c}=(0,k.useIntl)(),m=(0,a.useRef)(i),g=r?.displayName||"";(0,a.useEffect)(()=>{if(g){const v=(0,Cn.Z)(g);try{const S=Ft()(v,2);m.current({target:{name:o,value:S}})}catch{m.current({target:{name:o,value:v}})}}else m.current({target:{name:o,value:""}})},[g,o]);const f=t?c({id:t,defaultMessage:t}):"",p=e?c({id:e.id,defaultMessage:e.defaultMessage},{...e.values}):"",h=c(s);return a.createElement(Rt.o,{error:f,label:h,id:o,hint:p,name:o,onChange:i,value:u||""})};Lt.defaultProps={description:null,error:null,value:null},Lt.propTypes={description:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),error:n().string,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,modifiedData:n().object.isRequired,name:n().string.isRequired,onChange:n().func.isRequired,value:n().string};var Xa=Lt,Qa=l(21590),Ja=l(90333);const Ot=({error:e,intlLabel:t,name:s,onChange:r,value:o})=>{const{formatMessage:i}=(0,k.useIntl)(),{allComponentsCategories:u}=(0,Te.Z)(),[c,m]=(0,a.useState)(u),g=e?i({id:e,defaultMessage:e}):"",f=i(t),p=v=>{r({target:{name:s,value:v,type:"select-category"}})},h=v=>{m(S=>[...S,v]),p(v)};return a.createElement(Qa.X,{error:g,id:s,label:f,name:s,onChange:p,onCreateOption:h,value:o},c.map(v=>a.createElement(Ja.O,{key:v,value:v},v)))};Ot.defaultProps={error:null,value:null},Ot.propTypes={error:n().string,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,name:n().string.isRequired,onChange:n().func.isRequired,value:n().string};var _a=Ot;const Dt=({error:e,intlLabel:t,isAddingAComponentToAnotherComponent:s,isCreating:r,isCreatingComponentWhileAddingAField:o,componentToCreate:i,name:u,onChange:c,targetUid:m,forTarget:g,value:f})=>{const{formatMessage:p}=(0,k.useIntl)(),h=e?p({id:e,defaultMessage:e}):"",v=p(t),{componentsGroupedByCategory:S,componentsThatHaveOtherComponentInTheirAttributes:L}=(0,Te.Z)(),q=["component","components"].includes(g);let E=Object.entries(S).reduce((T,A)=>{const[j,K]=A,te=K.map(O=>({uid:O.uid,label:O.schema.displayName,categoryName:j}));return[...T,...te]},[]);return s&&(E=E.filter(T=>!L.includes(T.uid))),q&&(E=E.filter(T=>T.uid!==m)),o&&(E=[{uid:f,label:i.displayName,categoryName:i.category}]),a.createElement(nt.P,{disabled:o||!r,error:h,label:v,id:u,name:u,onChange:T=>{c({target:{name:u,value:T,type:"select-category"}})},value:f||""},E.map(T=>a.createElement(at.W,{key:T.uid,value:T.uid},`${T.categoryName} - ${T.label}`)))};Dt.defaultProps={componentToCreate:null,error:null},Dt.propTypes={componentToCreate:n().object,forTarget:n().string.isRequired,error:n().string,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,isAddingAComponentToAnotherComponent:n().bool.isRequired,isCreating:n().bool.isRequired,isCreatingComponentWhileAddingAField:n().bool.isRequired,name:n().string.isRequired,onChange:n().func.isRequired,targetUid:n().string.isRequired,value:n().string.isRequired};var es=Dt,Pt=(e,t)=>e.find(({name:s})=>s===t);const En=({dynamicZoneTarget:e,intlLabel:t,name:s,onChange:r,value:o})=>{const{formatMessage:i}=(0,k.useIntl)(),{componentsGroupedByCategory:u,modifiedData:c}=(0,Te.Z)(),g=(Pt(c.contentType.schema.attributes,e)||{}).components||[],f=Object.keys(u).reduce((v,S)=>{const L=u[S].filter(({uid:q})=>!g.includes(q));return L.length>0&&(v[S]=L),v},{}),p=Object.entries(f).reduce((v,S)=>{const[L,q]=S,E={label:L,children:q.map(({uid:T,schema:{displayName:A}})=>({label:A,value:T}))};return v.push(E),v},[]),h=i({id:(0,d.Z)("components.SelectComponents.displayed-value"),defaultMessage:"{number, plural, =0 {# components} one {# component} other {# components}} selected"},{number:o.length});return a.createElement(rn.Q,{id:"select1",label:i(t),customizeContent:()=>h,name:s,onChange:v=>{r({target:{name:s,value:v,type:"select-components"}})},options:p,value:o||[]})};En.propTypes={intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,dynamicZoneTarget:n().string.isRequired,name:n().string.isRequired,onChange:n().func.isRequired,value:n().array.isRequired};var ts=En;const It=({intlLabel:e,error:t,modifiedData:s,name:r,onChange:o,options:i,value:u})=>{const{formatMessage:c}=(0,k.useIntl)(),m=c(e),g=t?c({id:t,defaultMessage:t}):"",f=p=>{o({target:{name:r,value:p,type:"select"}}),!!u&&s.default!==void 0&&s.default!==null&&o({target:{name:"default",value:null}})};return a.createElement(nt.P,{error:g,label:m,id:r,name:r,onChange:f,value:u||""},i.map(({metadatas:{intlLabel:p,disabled:h,hidden:v},key:S,value:L})=>a.createElement(at.W,{key:S,value:L,disabled:h,hidden:v},c({id:p.id,defaultMessage:p.defaultMessage},p.values))))};It.defaultProps={error:void 0,value:""},It.propTypes={error:n().string,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,modifiedData:n().object.isRequired,name:n().string.isRequired,onChange:n().func.isRequired,options:n().arrayOf(n().shape({metadatas:n().shape({intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired}).isRequired,disabled:n().bool,hidden:n().bool}).isRequired,key:n().oneOfType([n().string,n().number]).isRequired,value:n().oneOfType([n().string,n().number]).isRequired}).isRequired).isRequired,value:n().string};var ns=It;const qt=({intlLabel:e,error:t,modifiedData:s,name:r,onChange:o,options:i,value:u})=>{const{formatMessage:c}=(0,k.useIntl)(),m=c(e),g=t?c({id:t,defaultMessage:t}):"",f=p=>{o({target:{name:r,value:p,type:"select"}}),u&&(p==="biginteger"&&u!=="biginteger"&&(s.default!==void 0&&s.default!==null&&o({target:{name:"default",value:null}}),s.max!==void 0&&s.max!==null&&o({target:{name:"max",value:null}}),s.min!==void 0&&s.min!==null&&o({target:{name:"min",value:null}})),["decimal","float","integer"].includes(p)&&u==="biginteger"&&(s.default!==void 0&&s.default!==null&&o({target:{name:"default",value:null}}),s.max!==void 0&&s.max!==null&&o({target:{name:"max",value:null}}),s.min!==void 0&&s.min!==null&&o({target:{name:"min",value:null}})))};return a.createElement(nt.P,{error:g,label:m,id:r,name:r,onChange:f,value:u||""},i.map(({metadatas:{intlLabel:p,disabled:h,hidden:v},key:S,value:L})=>a.createElement(at.W,{key:S,value:L,disabled:h,hidden:v},c(p))))};qt.defaultProps={error:void 0,value:""},qt.propTypes={error:n().string,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,modifiedData:n().object.isRequired,name:n().string.isRequired,onChange:n().func.isRequired,options:n().arrayOf(n().shape({metadatas:n().shape({intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired}).isRequired,disabled:n().bool,hidden:n().bool}).isRequired,key:n().oneOfType([n().string,n().number]).isRequired,value:n().oneOfType([n().string,n().number]).isRequired}).isRequired).isRequired,value:n().string};var as=qt;const kt=({description:e,error:t,intlLabel:s,modifiedData:r,name:o,onChange:i,value:u})=>{const{formatMessage:c}=(0,k.useIntl)(),m=(0,a.useRef)(i),g=r?.displayName||"";(0,a.useEffect)(()=>{g?m.current({target:{name:o,value:(0,Cn.Z)(g)}}):m.current({target:{name:o,value:""}})},[g,o]);const f=t?c({id:t,defaultMessage:t}):"",p=e?c({id:e.id,defaultMessage:e.defaultMessage},{...e.values}):"",h=c(s);return a.createElement(Rt.o,{error:f,label:h,id:o,hint:p,name:o,onChange:i,value:u||""})};kt.defaultProps={description:null,error:null,value:null},kt.propTypes={description:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),error:n().string,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,modifiedData:n().object.isRequired,name:n().string.isRequired,onChange:n().func.isRequired,value:n().string};var ss=kt;const Mn=({form:e,formErrors:t,genericInputProps:s,modifiedData:r,onChange:o})=>{const{formatMessage:i}=(0,k.useIntl)();return e.map((u,c)=>u.items.length===0?null:a.createElement(B.x,{key:c},u.sectionTitle&&a.createElement(B.x,{paddingBottom:4},a.createElement(Q.Z,{variant:"delta",as:"h3"},i(u.sectionTitle))),a.createElement(pt.r,{gap:4},u.items.map((m,g)=>{const f=`${c}.${g}`,p=D()(r,m.name,""),h=Object.keys(t).find(S=>S===m.name),v=h?t[h].id:D()(t,[...m.name.split(".").filter(S=>S!=="componentToCreate"),"id"],null);return m.type==="pushRight"?a.createElement(et.P,{col:m.size||6,key:m.name||f},a.createElement("div",null)):a.createElement(et.P,{col:m.size||6,key:m.name||f},a.createElement(R.GenericInput,{...m,...s,error:v,onChange:o,value:p}))}))))};Mn.propTypes={form:n().arrayOf(n().object).isRequired,formErrors:n().object.isRequired,genericInputProps:n().object.isRequired,modifiedData:n().object.isRequired,onChange:n().func.isRequired};var Rn=Mn,os=l(10508);const $t=({description:e,disabled:t,error:s,intlLabel:r,labelAction:o,name:i,onChange:u,placeholder:c,value:m})=>{const{formatMessage:g}=(0,k.useIntl)(),f=s?g({id:s,defaultMessage:s}):"",p=e?g({id:e.id,defaultMessage:e.defaultMessage},{...e.values}):"",h=g(r),v=c?g({id:c.id,defaultMessage:c.defaultMessage},{...c.values}):"",S=Array.isArray(m)?m.join(`
`):"",L=q=>{const E=q.target.value.split(`
`);u({target:{name:i,value:E}})};return a.createElement(os.g,{disabled:t,error:f,label:h,labelAction:o,id:i,hint:p,name:i,onChange:L,placeholder:v,value:S},S)};$t.defaultProps={description:null,disabled:!1,error:"",labelAction:void 0,placeholder:null,value:""},$t.propTypes={description:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),disabled:n().bool,error:n().string,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,labelAction:n().element,name:n().string.isRequired,onChange:n().func.isRequired,placeholder:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),value:n().oneOfType([n().array,n().string])};var rs=$t,is=(e,t)=>{const s=D()(e,["contentType","schema","kind"],"");return s==="singleType"||s===t.kind?!0:D()(e,["contentType","schema","attributes"],[]).filter(({relation:i,type:u,targetAttribute:c})=>{const m=(0,xt.Z)(i,c);return u==="relation"&&!["oneWay","manyWay"].includes(m)}).length===0},ls=(e="",t,s)=>{const r=["text","email","richtext","password","number","enumeration","date","media","boolean","json","relation"],o=e==="contentType",i=s.includes(t),u=!o&&!i;return o?[[...r,"uid"],["component","dynamiczone"]]:u?[r,["component"]]:[r]},Zn=e=>e.reduce((t,s)=>{const r=s.items.reduce((o,i)=>(i.name&&o.push(i.name),o),[]);return[...t,...r]},[]),b=l(5173),De=l(2158),us={base:{sections:[{sectionTitle:null,items:[{autoFocus:!0,name:"name",type:"text",intlLabel:{id:"global.name",defaultMessage:"Name"},description:{id:(0,d.Z)("modalForm.editCategory.base.name.description"),defaultMessage:"No space is allowed for the name of the category"}}]}]}},xn=/^[A-Za-z][-_0-9A-Za-z]*$/,ds=e=>{const t={name:b.Z_().matches(xn,R.translatedErrors.regex).test({name:"nameNotAllowed",message:R.translatedErrors.unique,test(s){return s?!e.includes((0,N.toLower)(s)):!1}}).required(R.translatedErrors.required)};return b.Ry(t)},cs=(e,t,s)=>{const r={displayName:b.Z_().test({name:"nameAlreadyUsed",message:R.translatedErrors.unique,test(o){if(!o)return!1;const i=(0,De.N)(o,s);return!e.includes(i)}}).test({name:"nameNotAllowed",message:(0,d.Z)("error.contentTypeName.reserved-name"),test(o){return o?!t.includes((0,N.toLower)((0,N.trim)(o))):!1}}).required(R.translatedErrors.required),category:b.Z_().matches(xn,R.translatedErrors.regex).required(R.translatedErrors.required),icon:b.Z_()};return b.Ry(r)},Ut={intlLabel:{id:"global.type",defaultMessage:"Type"},name:"createComponent",type:"boolean-radio-group",size:12,radios:[{title:{id:(0,d.Z)("form.attribute.component.option.create"),defaultMessage:"Create a new component"},description:{id:(0,d.Z)("form.attribute.component.option.create.description"),defaultMessage:"A component is shared across types and components, it will be available and accessible everywhere."},value:!0},{title:{id:(0,d.Z)("form.attribute.component.option.reuse-existing"),defaultMessage:"Use an existing component"},description:{id:(0,d.Z)("form.attribute.component.option.reuse-existing.description"),defaultMessage:"Reuse a component already created to keep your data consistent across content-types."},value:!1}]},Pe={base(e=""){return[{sectionTitle:null,items:[{name:`${e}displayName`,type:"text",intlLabel:{id:(0,d.Z)("contentType.displayName.label"),defaultMessage:"Display Name"}},{name:`${e}category`,type:"select-category",intlLabel:{id:(0,d.Z)("modalForm.components.create-component.category.label"),defaultMessage:"Select a category or enter a name to create a new one"}}]}]},advanced(){return[]}},x={default:{name:"default",type:"text",intlLabel:{id:(0,d.Z)("form.attribute.settings.default"),defaultMessage:"Default value"}},max:{name:"max",type:"checkbox-with-number-field",intlLabel:{id:(0,d.Z)("form.attribute.item.maximum"),defaultMessage:"Maximum value"}},maxLength:{name:"maxLength",type:"checkbox-with-number-field",intlLabel:{id:(0,d.Z)("form.attribute.item.maximumLength"),defaultMessage:"Maximum length"}},min:{name:"min",type:"checkbox-with-number-field",intlLabel:{id:(0,d.Z)("form.attribute.item.minimum"),defaultMessage:"Minimum value"}},minLength:{name:"minLength",type:"checkbox-with-number-field",intlLabel:{id:(0,d.Z)("form.attribute.item.minimumLength"),defaultMessage:"Minimum length"}},private:{name:"private",type:"checkbox",intlLabel:{id:(0,d.Z)("form.attribute.item.privateField"),defaultMessage:"Private field"},description:{id:(0,d.Z)("form.attribute.item.privateField.description"),defaultMessage:"This field will not show up in the API response"}},regex:{intlLabel:{id:(0,d.Z)("form.attribute.item.text.regex"),defaultMessage:"RegExp pattern"},name:"regex",type:"text",description:{id:(0,d.Z)("form.attribute.item.text.regex.description"),defaultMessage:"The text of the regular expression"}},required:{name:"required",type:"checkbox",intlLabel:{id:(0,d.Z)("form.attribute.item.requiredField"),defaultMessage:"Required field"},description:{id:(0,d.Z)("form.attribute.item.requiredField.description"),defaultMessage:"You won't be able to create an entry if this field is empty"}},unique:{name:"unique",type:"checkbox",intlLabel:{id:(0,d.Z)("form.attribute.item.uniqueField"),defaultMessage:"Unique field"},description:{id:(0,d.Z)("form.attribute.item.uniqueField.description"),defaultMessage:"You won't be able to create an entry if there is an existing entry with identical content"}}},ms={boolean(){return{sections:[{sectionTitle:null,items:[{autoFocus:!0,type:"select-default-boolean",intlLabel:{id:(0,d.Z)("form.attribute.settings.default"),defaultMessage:"Default value"},name:"default",options:[{value:"true",key:"true",metadatas:{intlLabel:{id:"true",defaultMessage:"true"}}},{value:"",key:"null",metadatas:{intlLabel:{id:"null",defaultMessage:"null"}}},{value:"false",key:"false",metadatas:{intlLabel:{id:"false",defaultMessage:"false"}}}]}]},{sectionTitle:{id:"global.settings",defaultMessage:"Settings"},items:[x.required,x.private]}]}},component({repeatable:e},t){return t==="1"?{sections:Pe.advanced("componentToCreate")}:e?{sections:[{sectionTitle:{id:"global.settings",defaultMessage:"Settings"},items:[x.required,x.private,x.max,x.min]}]}:{sections:[{sectionTitle:{id:"global.settings",defaultMessage:"Settings"},items:[x.required,x.private]}]}},date({type:e}){return{sections:[{sectionTitle:null,items:[{...x.default,type:e||"date",value:null,withDefaultValue:!1,disabled:!e,autoFocus:!1}]},{sectionTitle:{id:"global.settings",defaultMessage:"Settings"},items:[x.required,x.unique,x.private]}]}},dynamiczone(){return{sections:[{sectionTitle:{id:"global.settings",defaultMessage:"Settings"},items:[x.required,x.max,x.min]}]}},email(){return{sections:[{sectionTitle:null,items:[{...x.default,type:"email"}]},{sectionTitle:{id:"global.settings",defaultMessage:"Settings"},items:[x.required,x.unique,x.maxLength,x.minLength,x.private]}]}},enumeration(e){return{sections:[{sectionTitle:null,items:[{name:"default",type:"select",intlLabel:{id:(0,d.Z)("form.attribute.settings.default"),defaultMessage:"Default value"},validations:{},options:[{key:"__null_reset_value__",value:"",metadatas:{intlLabel:{id:"components.InputSelect.option.placeholder",defaultMessage:"Choose here"}}},...(e.enum||[]).filter((t,s)=>e.enum.indexOf(t)===s&&t).map(t=>({key:t,value:t,metadatas:{intlLabel:{id:`${t}.no-override`,defaultMessage:t}}}))]},{intlLabel:{id:(0,d.Z)("form.attribute.item.enumeration.graphql"),defaultMessage:"Name override for GraphQL"},name:"enumName",type:"text",validations:{},description:{id:(0,d.Z)("form.attribute.item.enumeration.graphql.description"),defaultMessage:"Allows you to override the default generated name for GraphQL"}}]},{sectionTitle:{id:"global.settings",defaultMessage:"Settings"},items:[x.required,x.private]}]}},json(){return{sections:[{sectionTitle:{id:"global.settings",defaultMessage:"Settings"},items:[x.required,x.private]}]}},media(){return{sections:[{sectionTitle:null,items:[{intlLabel:{id:(0,d.Z)("form.attribute.media.allowed-types"),defaultMessage:"Select allowed types of media"},name:"allowedTypes",type:"allowed-types-select",size:7,value:"",validations:{}}]},{sectionTitle:{id:"global.settings",defaultMessage:"Settings"},items:[x.required,x.private]}]}},number(e){const t=e.type==="decimal"||e.type==="float"?"any":1;return{sections:[{sectionTitle:null,items:[{autoFocus:!0,name:"default",type:e.type==="biginteger"?"text":"number",step:t,intlLabel:{id:(0,d.Z)("form.attribute.settings.default"),defaultMessage:"Default value"},validations:{}}]},{sectionTitle:{id:"global.settings",defaultMessage:"Settings"},items:[x.required,x.unique,x.max,x.min,x.private]}]}},password(){return{sections:[{sectionTitle:null,items:[x.default]},{sectionTitle:{id:"global.settings",defaultMessage:"Settings"},items:[x.required,x.maxLength,x.minLength,x.private]}]}},relation(){return{sections:[{sectionTitle:{id:"global.settings",defaultMessage:"Settings"},items:[x.private]}]}},richtext(){return{sections:[{sectionTitle:null,items:[x.default]},{sectionTitle:{id:"global.settings",defaultMessage:"Settings"},items:[x.required,x.maxLength,x.minLength,x.private]}]}},text(){return{sections:[{sectionTitle:null,items:[x.default,x.regex]},{sectionTitle:{id:"global.settings",defaultMessage:"Settings"},items:[x.required,x.unique,x.maxLength,x.minLength,x.private]}]}},uid(e){return{sections:[{sectionTitle:null,items:[{...x.default,disabled:Boolean(e.targetField),type:"text"}]},{sectionTitle:{id:"global.settings",defaultMessage:"Settings"},items:[x.required,x.maxLength,x.minLength,x.private]}]}}};const ge={name:"name",type:"text",intlLabel:{id:"global.name",defaultMessage:"Name"},description:{id:(0,d.Z)("modalForm.attribute.form.base.name.description"),defaultMessage:"No space is allowed for the name of the attribute"}};var ps={component(e,t){if(t==="1"){const s=e.createComponent===!0?Pe.base("componentToCreate."):[];return{sections:[{sectionTitle:null,items:[Ut]},...s]}}return{sections:[{sectionTitle:null,items:[ge,{name:"component",type:"select-component",intlLabel:{id:(0,d.Z)("modalForm.attributes.select-component"),defaultMessage:"Select a component"},isMultiple:!1}]},{sectionTitle:null,items:[{intlLabel:{id:"global.type",defaultMessage:"Type"},name:"repeatable",type:"boolean-radio-group",size:12,radios:[{title:{id:(0,d.Z)("form.attribute.component.option.repeatable"),defaultMessage:"Repeatable component"},description:{id:(0,d.Z)("form.attribute.component.option.repeatable.description"),defaultMessage:"Best for multiple instances (array) of ingredients, meta tags, etc.."},value:!0},{title:{id:(0,d.Z)("form.attribute.component.option.single"),defaultMessage:"Single component"},description:{id:(0,d.Z)("form.attribute.component.option.single.description"),defaultMessage:"Best for grouping fields like full address, main information, etc..."},value:!1}]}]}]}},date(){return{sections:[{sectionTitle:null,items:[ge,{intlLabel:{id:"global.type",defaultMessage:"Type"},name:"type",type:"select-date",options:[{key:"__null_reset_value__",value:"",metadatas:{intlLabel:{id:"components.InputSelect.option.placeholder",defaultMessage:"Choose here"},hidden:!0}},{key:"date",value:"date",metadatas:{intlLabel:{id:(0,d.Z)("form.attribute.item.date.type.date"),defaultMessage:"date (ex: 01/01/{currentYear})",values:{currentYear:new Date().getFullYear()}}}},{key:"datetime",value:"datetime",metadatas:{intlLabel:{id:(0,d.Z)("form.attribute.item.date.type.datetime"),defaultMessage:"datetime (ex: 01/01/{currentYear} 00:00 AM)",values:{currentYear:new Date().getFullYear()}}}},{key:"time",value:"time",metadatas:{intlLabel:{id:(0,d.Z)("form.attribute.item.date.type.time"),defaultMessage:"time (ex: 00:00 AM)"}}}]}]}]}},enumeration(){return{sections:[{sectionTitle:null,items:[ge]},{sectionTitle:null,items:[{name:"enum",type:"textarea-enum",size:6,intlLabel:{id:(0,d.Z)("form.attribute.item.enumeration.rules"),defaultMessage:"Values (one line per value)"},placeholder:{id:(0,d.Z)("form.attribute.item.enumeration.placeholder"),defaultMessage:`Ex:
morning
noon
evening`},validations:{required:!0}}]}]}},media(){return{sections:[{sectionTitle:null,items:[ge]},{sectionTitle:null,items:[{intlLabel:{id:"global.type",defaultMessage:"Type"},name:"multiple",size:12,type:"boolean-radio-group",radios:[{title:{id:(0,d.Z)("form.attribute.media.option.multiple"),defaultMessage:"Multiple media"},description:{id:(0,d.Z)("form.attribute.media.option.multiple.description"),defaultMessage:"Best for sliders, carousels or multiple files download"},value:!0},{title:{id:(0,d.Z)("form.attribute.media.option.single"),defaultMessage:"Single media"},description:{id:(0,d.Z)("form.attribute.media.option.single.description"),defaultMessage:"Best for avatar, profile picture or cover"},value:!1}]}]}]}},number(){return{sections:[{sectionTitle:null,items:[ge,{intlLabel:{id:(0,d.Z)("form.attribute.item.number.type"),defaultMessage:"Number format"},name:"type",type:"select-number",options:[{key:"__null_reset_value__",value:"",metadatas:{intlLabel:{id:"components.InputSelect.option.placeholder",defaultMessage:"Choose here"},hidden:!0}},{key:"integer",value:"integer",metadatas:{intlLabel:{id:(0,d.Z)("form.attribute.item.number.type.integer"),defaultMessage:"integer (ex: 10)"}}},{key:"biginteger",value:"biginteger",metadatas:{intlLabel:{id:(0,d.Z)("form.attribute.item.number.type.biginteger"),defaultMessage:"biginteger (ex: 123456789)"}}},{key:"decimal",value:"decimal",metadatas:{intlLabel:{id:(0,d.Z)("form.attribute.item.number.type.decimal"),defaultMessage:"decimal (ex: 2.22)"}}},{key:"float",value:"float",metadatas:{intlLabel:{id:(0,d.Z)("form.attribute.item.number.type.float"),defaultMessage:"decimal (ex: 3.3333333)"}}}]}]}]}},relation(){return{sections:[{sectionTitle:null,items:[{intlLabel:{id:"FIXME",defaultMessage:"FIXME"},name:"relation",size:12,type:"relation"}]}]}},string(){return{sections:[{sectionTitle:null,items:[ge]},{sectionTitle:null,items:[{intlLabel:{id:"global.type",defaultMessage:"Type"},name:"type",size:12,type:"radio-group",radios:[{title:{id:(0,d.Z)("form.attribute.text.option.short-text"),defaultMessage:"Sort text"},description:{id:(0,d.Z)("form.attribute.text.option.short-text.description"),defaultMessage:"Best for titles, names, links (URL). It also enables exact search on the field."},value:"string"},{title:{id:(0,d.Z)("form.attribute.text.option.long-text"),defaultMessage:"Long text"},description:{id:(0,d.Z)("form.attribute.text.option.long-text.description"),defaultMessage:"Best for descriptions, biography. Exact search is disabled."},value:"text"}]}]}]}},text(){return{sections:[{sectionTitle:null,items:[ge]},{sectionTitle:null,items:[{intlLabel:{id:"global.type",defaultMessage:"Type"},name:"type",size:12,type:"radio-group",radios:[{title:{id:(0,d.Z)("form.attribute.text.option.short-text"),defaultMessage:"Sort text"},description:{id:(0,d.Z)("form.attribute.text.option.short-text.description"),defaultMessage:"Best for titles, names, links (URL). It also enables exact search on the field."},value:"string"},{title:{id:(0,d.Z)("form.attribute.text.option.long-text"),defaultMessage:"Long text"},description:{id:(0,d.Z)("form.attribute.text.option.long-text.description"),defaultMessage:"Best for descriptions, biography. Exact search is disabled."},value:"text"}]}]}]}},uid(e,t,s){const r=s.filter(({type:o})=>["string","text"].includes(o)).map(({name:o})=>({key:o,value:o,metadatas:{intlLabel:{id:`${o}.no-override`,defaultMessage:o}}}));return{sections:[{sectionTitle:null,items:[{...ge,placeholder:{id:(0,d.Z)("modalForm.attribute.form.base.name.placeholder"),defaultMessage:"e.g. Slug, SEO URL, Canonical URL"}},{intlLabel:{id:(0,d.Z)("modalForm.attribute.target-field"),defaultMessage:"Attached field"},name:"targetField",type:"select",options:[{key:"__null_reset_value__",value:"",metadatas:{intlLabel:{id:"global.none",defaultMessage:"None"}}},...r]}]}]}}},An={advanced:ms,base:ps},gs={sections:[{sectionTitle:null,items:[ge]}]},fs=l(91815),ys=l.n(fs),bs=l(40791),hs=l.n(bs),Bt=e=>hs()(e,{decamelize:!1,lowercase:!1,separator:"_"});const Sn=/^[A-Za-z][_0-9A-Za-z]*$/,Fn=e=>({name:"attributeNameAlreadyUsed",message:R.translatedErrors.unique,test(t){return t?!e.includes(t):!1}}),Yo=(e,t,s)=>{const r=get(e,["schema","attributes"],{});return Object.keys(r).filter(o=>t?o!==s:!0)},jt=e=>({name:"forbiddenAttributeName",message:(0,d.Z)("error.attributeName.reserved-name"),test(t){return t?!e.includes(t):!1}}),y={default:()=>b.Z_().nullable(),max:()=>b.Rx().integer().nullable(),min:()=>b.Rx().integer().when("max",(e,t)=>e?t.max(e,(0,d.Z)("error.validation.minSupMax")):t).nullable(),maxLength:()=>b.Rx().integer().positive((0,d.Z)("error.validation.positive")).nullable(),minLength:()=>b.Rx().integer().min(0).when("maxLength",(e,t)=>e?t.max(e,(0,d.Z)("error.validation.minSupMax")):t).nullable(),name(e,t){return b.Z_().test(Fn(e)).test(jt(t)).matches(Sn,R.translatedErrors.regex).required(R.translatedErrors.required)},required:()=>b.O7(),type:()=>b.Z_().required(R.translatedErrors.required),unique:()=>b.O7().nullable()},Wt=(e,t)=>({name:y.name(e,t),type:y.type(),default:y.default(),unique:y.unique(),required:y.required(),maxLength:y.maxLength(),minLength:y.minLength(),regex:b.Z_().test({name:"isValidRegExpPattern",message:(0,d.Z)("error.validation.regex"),test(r){return new RegExp(r)!==null}}).nullable()}),zt={name:"isMinSuperiorThanMax",message:(0,d.Z)("error.validation.minSupMax"),test(e){if(!e)return!0;const{max:t}=this.parent;return!t||Number.isNaN((0,N.toNumber)(e))?!0:(0,N.toNumber)(t)>=(0,N.toNumber)(e)}};var Kt={date(e,t){const s={name:y.name(e,t),type:y.type()};return b.Ry(s)},datetime(e,t){const s={name:y.name(e,t),type:y.type()};return b.Ry(s)},time(e,t){const s={name:y.name(e,t),type:y.type()};return b.Ry(s)},default(e,t){const s={name:y.name(e,t),type:y.type()};return b.Ry(s)},biginteger(e,t){const s={name:y.name(e,t),type:y.type(),default:b.Z_().nullable().matches(/^-?\d*$/),unique:y.unique(),required:y.required(),max:b.Z_().nullable().matches(/^-?\d*$/,R.translatedErrors.regex),min:b.Z_().nullable().test(zt).matches(/^-?\d*$/,R.translatedErrors.regex)};return b.Ry(s)},boolean(e,t){const s={name:y.name(e,t),default:b.O7().nullable(),required:y.required(),unique:y.unique()};return b.Ry(s)},component(e,t){const s={name:y.name(e,t),type:y.type(),required:y.required(),max:y.max(),min:y.min(),component:b.Z_().required(R.translatedErrors.required)};return b.Ry(s)},decimal(e,t){const s={name:y.name(e,t),type:y.type(),default:b.Rx(),required:y.required(),max:b.Rx(),min:b.Rx().test(zt)};return b.Ry(s)},dynamiczone(e,t){const s={name:y.name(e,t),type:y.type(),required:y.required(),max:y.max(),min:y.min()};return b.Ry(s)},email(e,t){const s={name:y.name(e,t),type:y.type(),default:b.Z_().email().nullable(),unique:y.unique(),required:y.required(),maxLength:y.maxLength(),minLength:y.minLength()};return b.Ry(s)},enumeration(e,t){const s=/^[_A-Za-z][_0-9A-Za-z]*$/,r={name:b.Z_().test(Fn(e)).test(jt(t)).matches(s,R.translatedErrors.regex).required(R.translatedErrors.required),type:y.type(),default:y.default(),unique:y.unique(),required:y.required(),enum:b.IX().of(b.Z_()).min(1,R.translatedErrors.min).test({name:"areEnumValuesUnique",message:(0,d.Z)("error.validation.enum-duplicate"),test(o){return!ys()(o.map(Bt).filter((u,c,m)=>m.indexOf(u)!==c)).length}}).test({name:"doesNotHaveEmptyValues",message:(0,d.Z)("error.validation.enum-empty-string"),test:o=>!o.map(Bt).some(i=>i==="")}).test({name:"doesMatchRegex",message:(0,d.Z)("error.validation.enum-regex"),test:o=>o.map(Bt).every(i=>s.test(i))}),enumName:b.Z_().nullable()};return b.Ry(r)},float(e,t){const s={name:y.name(e,t),type:y.type(),required:y.required(),default:b.Rx(),max:b.Rx(),min:b.Rx().test(zt)};return b.Ry(s)},integer(e,t){const s={name:y.name(e,t),type:y.type(),default:b.Rx().integer(),unique:y.unique(),required:y.required(),max:y.max(),min:y.min()};return b.Ry(s)},json(e,t){const s={name:y.name(e,t),type:y.type(),required:y.required(),unique:y.unique()};return b.Ry(s)},media(e,t){const s={name:y.name(e,t),type:y.type(),multiple:b.O7(),required:y.required(),allowedTypes:b.IX().of(b.Z_().oneOf(["images","videos","files","audios"])).min(1).nullable()};return b.Ry(s)},password(e,t){const s={name:y.name(e,t),type:y.type(),default:y.default(),unique:y.unique(),required:y.required(),maxLength:y.maxLength(),minLength:y.minLength()};return b.Ry(s)},relation(e,t,s,{initialData:r,modifiedData:o}){const i={name:y.name(e,t),target:b.Z_().required(R.translatedErrors.required),relation:b.Z_().required(),type:b.Z_().required(),targetAttribute:b.Vo(()=>{const u=(0,xt.Z)(o.relation,o.targetAttribute);if(u==="oneWay"||u==="manyWay")return b.Z_().nullable();let c=b.Z_().test(jt(t)),g=[...s.map(({name:f})=>f),o.name].filter(f=>f!==r.targetAttribute);return c.matches(Sn,R.translatedErrors.regex).test({name:"forbiddenTargetAttributeName",message:(0,d.Z)("error.validation.relation.targetAttribute-taken"),test(f){return f?!g.includes(f):!1}}).required(R.translatedErrors.required)})};return b.Ry(i)},richtext(e,t){const s={name:y.name(e,t),type:y.type(),default:y.default(),unique:y.unique(),required:y.required(),maxLength:y.maxLength(),minLength:y.minLength()};return b.Ry(s)},string(e,t){const s=Wt(e,t);return b.Ry(s)},text(e,t){const s=Wt(e,t);return b.Ry(s)},uid(e,t){const s=Wt(e,t);return b.Ry(s)}};const Nn={name:"displayName",type:"text",intlLabel:{id:(0,d.Z)("contentType.displayName.label"),defaultMessage:"Display name"}};var Vt={advanced:{default(){return{sections:[{items:[{intlLabel:{id:(0,d.Z)("contentType.draftAndPublish.label"),defaultMessage:"Draft & publish"},description:{id:(0,d.Z)("contentType.draftAndPublish.description"),defaultMessage:"Allows writing a draft version of an entry, before it is published"},name:"draftAndPublish",type:"toggle-draft-publish",validations:{}}]}]}}},base:{create(){return{sections:[{sectionTitle:null,items:[Nn,{description:{id:(0,d.Z)("contentType.apiId-singular.description"),defaultMessage:"Used to generate the API routes and databases tables/collections"},intlLabel:{id:(0,d.Z)("contentType.apiId-singular.label"),defaultMessage:"API ID (Singular)"},name:"singularName",type:"text-singular"},{type:"pushRight",size:6,intlLabel:{id:"",defaultMessage:""},name:"pushRight"},{description:{id:(0,d.Z)("contentType.apiId-plural.description"),defaultMessage:"Pluralized API ID"},intlLabel:{id:(0,d.Z)("contentType.apiId-plural.label"),defaultMessage:"API ID (Plural)"},name:"pluralName",type:"text-plural"}]}]}},edit(){return{sections:[{sectionTitle:null,items:[Nn,{disabled:!0,description:{id:(0,d.Z)("contentType.apiId-singular.description"),defaultMessage:"Used to generate the API routes and databases tables/collections"},intlLabel:{id:(0,d.Z)("contentType.apiId-singular.label"),defaultMessage:"API ID (Singular)"},name:"singularName",type:"text"},{type:"pushRight",size:6,intlLabel:{id:"",defaultMessage:""},name:"pushRight"},{disabled:!0,description:{id:(0,d.Z)("contentType.apiId-plural.description"),defaultMessage:"Pluralized API ID"},intlLabel:{id:(0,d.Z)("contentType.apiId-plural.label"),defaultMessage:"API ID (Plural)"},name:"pluralName",type:"text"},{intlLabel:{id:"global.type",defaultMessage:"Type"},name:"kind",type:"content-type-radio-group",size:12,radios:[{title:{id:(0,d.Z)("form.button.collection-type.name"),defaultMessage:"Collection Type"},description:{id:(0,d.Z)("form.button.collection-type.description"),defaultMessage:"Best for multiple instances like articles, products, comments, etc."},value:"collectionType"},{title:{id:(0,d.Z)("form.button.single-type.name"),defaultMessage:"Single Type"},description:{id:(0,d.Z)("form.button.single-type.description"),defaultMessage:"Best for single instance like about us, homepage, etc."},value:"singleType"}]}]}]}}}},vs=({usedContentTypeNames:e=[],reservedModels:t=[],singularNames:s=[],pluralNames:r=[]})=>{const o={displayName:b.Z_().test({name:"nameAlreadyUsed",message:R.translatedErrors.unique,test(i){if(!i)return!1;const u=(0,De.E)(i);return!e.includes(u)}}).test({name:"nameNotAllowed",message:(0,d.Z)("error.contentTypeName.reserved-name"),test(i){return i?!t.includes((0,N.toLower)((0,N.trim)(i))):!1}}).required(R.translatedErrors.required),pluralName:b.Z_().test({name:"pluralNameAlreadyUsed",message:R.translatedErrors.unique,test(i){return i?!r.includes(i):!1}}).test({name:"pluralAndSingularAreUnique",message:(0,d.Z)("error.contentType.pluralName-used"),test(i,u){return i?u.parent.singularName!==i:!1}}).test({name:"pluralNameNotAllowed",message:(0,d.Z)("error.contentTypeName.reserved-name"),test(i){return i?!t.includes((0,N.toLower)((0,N.trim)(i))):!1}}).required(R.translatedErrors.required),singularName:b.Z_().test({name:"singularNameAlreadyUsed",message:R.translatedErrors.unique,test(i){return i?!s.includes(i):!1}}).test({name:"pluralAndSingularAreUnique",message:(0,d.Z)("error.contentType.singularName-used"),test(i,u){return i?u.parent.pluralName!==i:!1}}).test({name:"singularNameNotAllowed",message:(0,d.Z)("error.contentTypeName.reserved-name"),test(i){return i?!t.includes((0,N.toLower)((0,N.trim)(i))):!1}}).required(R.translatedErrors.required),draftAndPublish:b.O7(),kind:b.Z_().oneOf(["singleType","collectionType"])};return b.Ry(o)},wt={advanced:{default(){return{sections:Pe.advanced("componentToCreate.")}}},base:{createComponent(){return{sections:[{sectionTitle:null,items:[Ut]},...Pe.base("componentToCreate.")]}},default(){return{sections:[{sectionTitle:null,items:[Ut]},{sectionTitle:null,items:[{type:"pushRight",size:6,intlLabel:{id:"",defaultMessage:""},name:"pushRight"},{name:"components",type:"select-components",intlLabel:{id:(0,d.Z)("modalForm.attributes.select-components"),defaultMessage:"Select the components"},isMultiple:!0}]}]}}}},Ln=(e,t)=>{e.forEach(s=>{if(!("sectionTitle"in s)){t[0].items.push(s);return}t.push(s)})},On=(e,t)=>e.filter(({name:s})=>s!==t.initialData.name).map(({name:s})=>s),Dn=l(98399),Ce={customField:{schema({schemaAttributes:e,attributeType:t,customFieldValidator:s,reservedNames:r,schemaData:o,ctbFormsAPI:i}){const u=On(e,o),c=Kt[t](u,r.attributes);return i.makeCustomFieldValidator(c,s,u,r.attributes,o)},form:{base({customField:e}){const t=[{sectionTitle:null,items:[ge]}];return e.options?.base&&Ln(e.options.base,t),{sections:t}},advanced({customField:e,data:t,step:s,extensions:r,...o}){const i=[{sectionTitle:null,items:[]}],u=r.getAdvancedForm(["attribute",e.type],{data:t,type:e.type,step:s,...o});if(e.options?.advanced&&Ln(e.options.advanced,i),u){const c={sectionTitle:{id:(0,d.Z)("modalForm.custom-fields.advanced.settings.extended"),defaultMessage:"Extended settings"},items:u};i.push(c)}return{sections:i}}}},attribute:{schema(e,t,s,r,o,i){const u=D()(e,["schema","attributes"],[]),c=On(u,o);try{let m=Kt[t](c,s.attributes,r,o);return i.makeValidator(["attribute",t],m,c,s.attributes,r,o)}catch(m){return Dn.error("Error yup build schema",m),Kt.default(c,s.attributes)}},form:{advanced({data:e,type:t,step:s,extensions:r,...o}){try{const i=An.advanced[t](e,s).sections,u=r.getAdvancedForm(["attribute",t],{data:e,type:t,step:s,...o});return{sections:i.reduce((m,g)=>(g.sectionTitle===null?m.push(g):m.push({...g,items:[...g.items,...u]}),m),[])}}catch(i){return Dn.error(i),{sections:[]}}},base({data:e,type:t,step:s,attributes:r}){try{return An.base[t](e,s,r)}catch{return gs}}}},contentType:{schema(e,t,s,r,o,i){const u=Object.values(i).map(h=>h.schema.singularName),c=Object.values(i).map(h=>D()(h,["schema","pluralName"],"")),m=t?e.filter(h=>h!==s):e,g=t?u.filter(h=>D()(i,[s,"schema","singularName"],"")!==h):u,f=t?c.filter(h=>D()(i,[s,"schema","pluralName"],"")!==h):c,p=vs({usedContentTypeNames:m,reservedModels:r.models,singularNames:g,pluralNames:f});return o.makeValidator(["contentType"],p,m,r.models,g,f)},form:{base({actionType:e}){return e==="create"?Vt.base.create():Vt.base.edit()},advanced({extensions:e}){const t=Vt.advanced.default().sections.map(r=>r.items).flat(),s=e.getAdvancedForm(["contentType"]);return{sections:[{items:[...t,...s]}]}}}},component:{schema(e,t,s,r=!1,o=null){const i=r?e.filter(u=>u!==o):e;return cs(i,s.models,t)},form:{advanced(){return{sections:Pe.advanced()}},base(){return{sections:Pe.base()}}}},addComponentToDynamicZone:{form:{advanced(){return wt.advanced.default()},base({data:e}){return D()(e,"createComponent",!1)?wt.base.createComponent():wt.base.default()}}},editCategory:{schema(e,t){const s=e.filter(r=>r!==t.name).map(r=>Ze()(r));return ds(s)},form:{advanced:()=>({sections:[]}),base(){return us.base}}}},Pn=l(98178),Ts=l(25061);const Cs=()=>e=>e[`${G.Z}_formModal`]||Ts.E;var Es=()=>(0,Pn.P1)(Cs(),e=>e),In=l(98399),Ms=()=>{const{onCloseModal:e,onNavigateToChooseAttributeModal:t,onNavigateToAddCompoToDZModal:s,onNavigateToCreateComponentStep2:r,actionType:o,attributeName:i,attributeType:u,customFieldUid:c,categoryName:m,dynamicZoneTarget:g,forTarget:f,modalType:p,isOpen:h,kind:v,step:S,targetUid:L}=(0,be.Z)(),q=(0,R.useCustomFields)().get(c),E=(0,a.useRef)(),T=(0,a.useMemo)(Es,[]),A=(0,pe.useDispatch)(),j=(0,R.useNotification)(),K=(0,pe.useSelector)(I=>T(I),pe.shallowEqual),{push:te}=(0,U.useHistory)(),{trackUsage:O}=(0,R.useTracking)(),{formatMessage:Y}=(0,k.useIntl)(),{getPlugin:W}=(0,R.useStrapiApp)(),w=W(G.Z).apis.forms,Ie=w.components.inputs,{addAttribute:fe,addCustomFieldAttribute:Ve,addCreatedComponentToDynamicZone:Ee,allComponentsCategories:z,changeDynamicZoneComponents:M,contentTypes:qe,components:we,createSchema:ke,deleteCategory:Ht,deleteData:ot,editCategory:Yt,editCustomFieldAttribute:Xt,submitData:Qt,modifiedData:ne,nestedComponents:rt,setModifiedData:Jt,sortedContentTypesList:_t,updateSchema:en,reservedNames:me}=(0,Te.Z)(),{componentToCreate:Ge,formErrors:F,initialData:C,isCreatingComponentWhileAddingAField:P,modifiedData:Z}=K,X=f==="contentType"||f==="component"?[f]:[f,L];(0,a.useEffect)(()=>{if(h){const I=_t.filter(ln);p==="editCategory"&&Jt(),o==="edit"&&p==="attribute"&&f==="contentType"&&O("willEditFieldOfContentType");const re=[...X,"schema","attributes"],ue=Pt(D()(ne,re,[]),g)||null;if(p==="editCategory"&&o==="edit"&&A({type:H._H,modalType:p,actionType:o,data:{name:m}}),p==="contentType"&&o==="create"&&A({type:H._H,modalType:p,actionType:o,data:{draftAndPublish:!0},pluginOptions:{}}),p==="contentType"&&o==="edit"){const{displayName:$,draftAndPublish:_,kind:de,pluginOptions:ae,pluralName:Zo,singularName:xo}=D()(ne,[...X,"schema"],{displayName:null,pluginOptions:{},singularName:null,pluralName:null});A({type:H._H,actionType:o,modalType:p,data:{displayName:$,draftAndPublish:_,kind:de,pluginOptions:ae,pluralName:Zo,singularName:xo}})}if(p==="component"&&o==="edit"){const $=D()(ne,X,{});A({type:H._H,actionType:o,modalType:p,data:{displayName:$.schema.displayName,category:$.category}})}if(p==="addComponentToDynamicZone"&&o==="edit"){const $={...ue,components:[],name:g,createComponent:!1,componentToCreate:{type:"component"}};A({type:H.VZ,attributeToEdit:$})}if(u){const _={...Pt(D()(ne,re,[]),i),name:i};u==="component"&&o==="edit"&&(_.repeatable||Je()(_,"repeatable",!1)),A(p==="customField"?{type:H.OY,customField:q,isEditing:o==="edit",modifiedDataToSetForEditing:_,forTarget:f}:{type:H.S0,attributeType:u,nameToSetForRelation:D()(I,["0","title"],"error"),targetUid:D()(I,["0","uid"],"error"),isEditing:o==="edit",modifiedDataToSetForEditing:_,step:S,forTarget:f})}}else A({type:H.c2})},[o,i,u,m,g,f,h,p]);const oe=p==="contentType",Me=p==="component",$e=p==="attribute",Hn=p==="customField",Yn=u==="component"&&$e,He=o==="create",Re=D()(Z,"createComponent",!1)||P,Ue=S==="1",Xn=p==="editCategory",Qn=p==="chooseAttribute",tn=(0,De.E)(Z.displayName||""),nn=D()(ne,[...X,"schema","attributes"],null),co=async()=>{let I;const re=Re&&S==="1"?D()(Z,"componentToCreate",{}):Z;if(oe)I=Ce.contentType.schema(Object.keys(qe),o==="edit",D()(ne,[...X,"uid"],null),me,w,qe);else if(Me)I=Ce.component.schema(Object.keys(we),Z.category||"",me,o==="edit",D()(ne,[...X,"uid"],null),w);else if(Hn)I=Ce.customField.schema({schemaAttributes:D()(ne,[...X,"schema","attributes"],[]),attributeType:q.type,reservedNames:me,schemaData:{modifiedData:Z,initialData:C},ctbFormsAPI:w,customFieldValidator:q.options?.validator});else if(Yn&&Re&&Ue)I=Ce.component.schema(Object.keys(we),D()(Z,"componentToCreate.category",""),me,w);else if($e&&!Ue){const ue=u==="relation"?"relation":Z.type;let $=[];if(ue==="relation"){const _=D()(Z,["target"],null);$=D()(qe,[_,"schema","attributes"],[]).filter(({name:ae})=>o!=="edit"?!0:ae!==C.targetAttribute)}I=Ce.attribute.schema(D()(ne,X,{}),ue,me,$,{modifiedData:Z,initialData:C},w)}else if(Xn)I=Ce.editCategory.schema(z,C,w);else if(Ue&&Re)I=Ce.component.schema(Object.keys(we),D()(Z,"componentToCreate.category",""),me,w);else return;await I.validate(re,{abortEarly:!1})},Jn=(0,a.useCallback)(({target:{name:I,value:re,type:ue,...$}})=>{const _=["enumName","max","min","maxLength","minLength","regex","default"];let de;_.includes(I)&&re===""?de=null:de=re;const ae=Object.assign({},F);I==="max"&&delete ae.min,I==="maxLength"&&delete ae.minLength,delete ae[I],A({type:H.Ey,errors:ae}),A({type:H.P0,keys:I.split("."),value:de,...$})},[A,F]),le=async(I,re=He)=>{I.preventDefault();try{await co(),go(re);const ue=f==="components"?L:tn;if(oe)if(He)ke({...Z,kind:v},p,tn),te({pathname:`/plugins/${G.Z}/content-types/${tn}`}),t({forTarget:f,targetUid:ue});else{is(ne,Z)?(e(),Qt(Z)):j({type:"warning",message:{id:"notification.contentType.relations.conflict"}});return}else if(p==="component")if(He){const $=(0,De.N)(Z.displayName,Z.category),{category:_,...de}=Z;ke(de,"component",$,_),te({pathname:`/plugins/${G.Z}/component-categories/${_}/${$}`}),t({forTarget:f,targetUid:$})}else{en(Z,p,L),e();return}else if(Xn){if(Ze()(C.name)===Ze()(Z.name)){e();return}Yt(C.name,Z);return}else if(Hn){const $={attributeToSet:{...Z,customField:c},forTarget:f,targetUid:L,initialAttribute:C};o==="edit"?Xt($):Ve($),re?t({forTarget:f,targetUid:ue}):e();return}else if($e&&!Re){if(u==="dynamiczone"){fe(Z,f,L,o==="edit",C),He?(A({type:H.I}),E.current._handlers.setSelectedTabIndex(0),s({dynamicZoneTarget:Z.name})):e();return}if(!Yn){fe(Z,f,L,o==="edit",C),re?t({forTarget:f,targetUid:ue}):e();return}if(Ue){r(),A({type:H.yC,forTarget:f});return}fe(Z,f,L,o==="edit",C,!0),re?t({forTarget:f,targetUid:L}):e()}else if($e&&Re){if(Ue){O("willCreateComponentFromAttributesModal"),A({type:H.oF,forTarget:f}),r();return}const{category:$,type:_,...de}=Ge,ae=(0,De.N)(Ge.displayName,$);ke(de,_,ae,$,Re),fe(Z,f,L,!1),A({type:H.c2}),re?t({forTarget:"components",targetUid:ae}):e();return}else{if(Ue)if(Re){const{category:$,type:_,...de}=Z.componentToCreate,ae=(0,De.N)(Z.componentToCreate.displayName,$);ke(de,_,ae,$,Re),Ee(g,[ae]),t({forTarget:"components",targetUid:ae})}else M(g,Z.components),e();else In.error("This case is not handled");return}A({type:H.c2})}catch(ue){const $=(0,R.getYupInnerErrors)(ue);In.log({err:ue,errors:$}),A({type:H.Ey,errors:$})}},mo=()=>{window.confirm(Y({id:"window.confirm.close-modal.file",defaultMessage:"Are you sure? Your changes will be lost."}))&&(e(),A({type:H.c2}))},_n=()=>{(0,N.isEqual)(Z,C)?(e(),A({type:H.c2})):mo()},po=I=>{if(I==="advanced"){if(oe){O("didSelectContentTypeSettings");return}f==="contentType"&&O("didSelectContentTypeFieldSettings")}},go=I=>{p==="attribute"&&f==="contentType"&&u!=="dynamiczone"&&I&&O("willAddMoreFieldToContentType")},fo=()=>!!(p==="editCategory"||p==="component"||ct()(Z,"createComponent")),yo=ls(f,L,rt);if(!h||!p)return null;const ea=D()(Ce,[p,"form"],{advanced:()=>({sections:[]}),base:()=>({sections:[]})}),bo=f==="components"||f==="component",ta={customInputs:{"allowed-types-select":la,"boolean-radio-group":Na,"checkbox-with-number-field":Da,"content-type-radio-group":Pa,"radio-group":Mt,relation:Ya,"select-category":_a,"select-component":es,"select-components":ts,"select-default-boolean":Aa,"select-number":as,"select-date":ns,"toggle-draft-publish":Ea,"text-plural":Xa,"text-singular":ss,"textarea-enum":rs,...Ie},componentToCreate:Ge,dynamicZoneTarget:g,formErrors:F,isAddingAComponentToAnotherComponent:bo,isCreatingComponentWhileAddingAField:P,mainBoxHeader:D()(ne,[...X,"schema","displayName"],""),modifiedData:Z,naturePickerType:f,isCreating:He,targetUid:L,forTarget:f},na=ea.advanced({data:Z,type:u,step:S,actionType:o,attributes:nn,extensions:w,forTarget:f,contentTypeSchema:ne.contentType||{},customField:q}).sections,aa=ea.base({data:Z,type:u,step:S,actionType:o,attributes:nn,extensions:w,forTarget:f,contentTypeSchema:ne.contentType||{},customField:q}).sections,ho=Zn(aa),vo=Zn(na),To=Object.keys(F).some(I=>ho.includes(I)),Co=Object.keys(F).some(I=>vo.includes(I)),Eo=D()(qe,[L,"schema","kind"]),Mo=()=>o==="edit"&&nn.every(({name:I})=>I!==Z?.name),Ro=()=>{Mo()&&O("didEditFieldNameOnContentType")};return a.createElement(sa.P,{onClose:_n,labelledBy:"title"},a.createElement(Ma,{actionType:o,attributeName:i,categoryName:m,contentTypeKind:v,dynamicZoneTarget:g,modalType:p,forTarget:f,targetUid:L,attributeType:u,customFieldUid:c}),Qn&&a.createElement(Ta,{attributes:yo,forTarget:f,kind:Eo||"collectionType"}),!Qn&&a.createElement("form",{onSubmit:le},a.createElement(sn.f,null,a.createElement(on.v,{label:"todo",id:"tabs",variant:"simple",ref:E,onTabChange:I=>{I===1&&po("advanced")}},a.createElement(J.k,{justifyContent:"space-between"},a.createElement(xa,{actionType:o,forTarget:f,kind:v,step:S,modalType:p,attributeType:u,attributeName:i,customField:q}),a.createElement(Ne.m,null,a.createElement(Ne.O,{hasError:To},Y({id:(0,d.Z)("popUpForm.navContainer.base"),defaultMessage:"Basic settings"})),a.createElement(Ne.O,{hasError:Co,disabled:fo()},Y({id:(0,d.Z)("popUpForm.navContainer.advanced"),defaultMessage:"Advanced settings"})))),a.createElement(Fe.i,null),a.createElement(B.x,{paddingTop:6},a.createElement(Le.n,null,a.createElement(Le.x,null,a.createElement(ce.K,{spacing:6},a.createElement(Rn,{form:aa,formErrors:F,genericInputProps:ta,modifiedData:Z,onChange:Jn}))),a.createElement(Le.x,null,a.createElement(ce.K,{spacing:6},a.createElement(Rn,{form:na,formErrors:F,genericInputProps:ta,modifiedData:Z,onChange:Jn}))))))),a.createElement(oa.m,{endActions:a.createElement(Ra,{deleteCategory:Ht,deleteContentType:ot,deleteComponent:ot,categoryName:C.name,isAttributeModal:p==="attribute",isCustomFieldModal:p==="customField",isComponentToDzModal:p==="addComponentToDynamicZone",isComponentAttribute:u==="component",isComponentModal:p==="component",isContentTypeModal:p==="contentType",isCreatingComponent:o==="create",isCreatingDz:o==="create",isCreatingComponentAttribute:Z.createComponent||!1,isCreatingComponentInDz:Z.createComponent||!1,isCreatingComponentWhileAddingAField:P,isCreatingContentType:o==="create",isEditingAttribute:o==="edit",isDzAttribute:u==="dynamiczone",isEditingCategory:p==="editCategory",isInFirstComponentStep:S==="1",onSubmitAddComponentAttribute:le,onSubmitAddComponentToDz:le,onSubmitCreateComponent:le,onSubmitCreateContentType:le,onSubmitCreateDz:le,onSubmitEditAttribute:le,onSubmitEditCategory:le,onSubmitEditComponent:le,onSubmitEditContentType:le,onSubmitEditCustomFieldAttribute:le,onSubmitEditDz:le,onClickFinish:Ro}),startActions:a.createElement(V.z,{variant:"tertiary",onClick:_n},Y({id:"app.components.Button.cancel",defaultMessage:"Cancel"}))})))},qn=e=>e.reduce((t,s)=>(t[s.uid]=s,t),{}),Rs=(e,t,s,r)=>{const o=t.reduce((c,m)=>{const g=D()(s,m,{});return c[m]=g,c},{});return{[r?"contentType":"component"]:e,components:o}},Zs=(e,t)=>{const s=Object.keys(e).map(r=>(0,N.get)(e,[r,...t],""));return(0,ie.Z)(s)},xs=l(13339);const As=e=>{const t=Object.keys(e).reduce((s,r)=>{const o=(0,N.get)(e,[r,"schema","attributes"],[]),i=Ss(o);return[...s,...i]},[]);return(0,ie.Z)(t)},Ss=e=>e.reduce((t,s)=>{const{type:r,component:o}=s;return r==="component"&&t.push(o),t},[]);var kn=As;const Fs=e=>{const t=Object.keys(e).reduce((s,r)=>{const o=D()(e,[r],{}),i=o.uid;return Ns(o)&&s.push(i),s},[]);return(0,ie.Z)(t)},Ns=e=>D()(e,["schema","attributes"],[]).some(s=>{const{type:r}=s;return r==="component"}),Ls=(e,t)=>{const s=Object.keys(e).filter(r=>{const o=(0,N.get)(e,r,{}),i=(0,N.get)(t,r,{}),u=(0,N.get)(o,["isTemporary"],!1),c=!(0,N.isEqual)(o,i);return u||c});return(0,ie.Z)(s)},Os=(e,t)=>{const s=Un((0,N.get)(e,"schema.attributes",[]),t),r=(0,N.get)(e,"isTemporary",!1)?{tmpUID:e.uid}:{uid:e.uid};return Object.assign({},r,{category:e.category},(0,N.omit)(e.schema,"attributes"),{attributes:s})},$n=(e,t=!1)=>{const s=(0,N.get)(e,"uid",null),r=Un((0,N.get)(e,"schema.attributes",[]),s),o=t?{category:(0,N.get)(e,"category","")}:{},i=Object.assign(o,(0,N.omit)(e.schema,"attributes"),{attributes:r});return delete i.uid,delete i.isTemporary,delete i.visible,delete i.restrictRelationsTo,i},Un=(e,t)=>e.reduce((s,{name:r,...o})=>{const i=o,u=i.target===t,c=i.type==="relation",m=(0,N.get)(i,"targetAttribute",null);if(!u)if(c){const g=Object.assign({},i,{targetAttribute:Bn(m)});s[r]=st(g)}else s[r]=st(i);if(u){const g=i.target,f=Object.assign({},i,{target:g,targetAttribute:Bn(m)});s[r]=st(f)}if(i.customField){const g={...i,type:"customField"};s[r]=st(g)}return s},{}),Bn=e=>e==="-"?null:e,st=e=>Object.keys(e).reduce((t,s)=>(e[s]!==null&&s!=="plugin"&&(t[s]=e[s]),t),{}),Ds=(e,t,s,r=!1)=>Ls(e,t).map(u=>{const c=(0,N.get)(e,u,{});return Os(c,s,r)}),Ps=e=>(0,N.sortBy)(Object.keys(e).map(t=>({visible:e[t].schema.visible,name:t,title:e[t].schema.displayName,plugin:e[t].plugin||null,uid:t,to:`/plugins/${G.Z}/content-types/${t}`,kind:e[t].schema.kind,restrictRelationsTo:e[t].schema.restrictRelationsTo})).filter(t=>t!==null),t=>(0,N.camelCase)(t.title)),jn="did-not-kill-server",Is="server is down";function We(e,t){return new Promise(s=>{fetch(`${strapi.backendURL}/_health`,{method:"HEAD",mode:"no-cors",headers:{"Content-Type":"application/json","Keep-Alive":!1}}).then(r=>{if(r.status>=400)throw new Error(Is);if(!t)throw new Error(jn);s(e)}).catch(r=>{setTimeout(()=>We(e,r.message!==jn).then(s),100)})})}var qs=e=>Object.values(e.attributes).filter(({type:s})=>s==="dynamiczone").every(({components:s})=>Array.isArray(s)&&s.length>0),ee=l(31947),ks=l(54370);const $s=()=>e=>e[`${G.Z}_dataManagerProvider`]||ks.E;var Us=()=>(0,Pn.P1)($s(),e=>e);const Bs=e=>Object.keys(e).reduce((t,s)=>{const r=e[s].schema;return t[s]={...e[s],schema:{...r,attributes:js(r.attributes)}},t},{}),js=e=>Object.keys(e).reduce((t,s)=>(t.push({...e[s],name:s}),t),[]);var Wn=Bs,ze=l(98399);const Gt=({children:e,components:t,contentTypes:s,isLoading:r,isLoadingForDataToBeSet:o,initialData:i,modifiedData:u,reservedNames:c})=>{const m=(0,pe.useDispatch)(),g=(0,R.useNotification)(),{lockAppWithAutoreload:f,unlockAppWithAutoreload:p}=(0,R.useAutoReloadOverlayBlocker)(),{setCurrentStep:h}=(0,R.useGuidedTour)(),{getPlugin:v}=(0,R.useStrapiApp)(),{apis:S}=v(G.Z),{autoReload:L}=(0,R.useAppInfos)(),{formatMessage:q}=(0,k.useIntl)(),{trackUsage:E}=(0,R.useTracking)(),{refetchPermissions:T}=(0,R.useRBACProvider)(),{pathname:A}=(0,U.useLocation)(),{onCloseModal:j}=(0,be.Z)(),K=(0,U.useRouteMatch)(`/plugins/${G.Z}/content-types/:uid`),te=(0,U.useRouteMatch)(`/plugins/${G.Z}/component-categories/:categoryUid/:componentUid`),O=(0,a.useRef)();O.current=q;const Y=L,W=K!==null,Ke=W?"contentType":"component",w=W?(0,N.get)(K,"params.uid",null):(0,N.get)(te,"params.componentUid",null),Ie=(0,a.useRef)(),fe=W?"content-types":"components";Ie.current=async()=>{try{const[{data:{data:F}},{data:{data:C}},{data:P}]=await Promise.all(["components","content-types","reserved-names"].map($e=>he.get($e))),Z=qn(F),X=Wn(Z),oe=qn(C),Me=Wn(oe);m({type:ee.Id,components:X,contentTypes:Me,reservedNames:P})}catch(F){ze.error({err:F}),g({type:"warning",message:{id:"notification.error"}})}},(0,a.useEffect)(()=>(Ie.current(),()=>{m({type:ee.Zl})}),[]),(0,a.useEffect)(()=>{!r&&w&&rt()},[r,A,w]),(0,a.useEffect)(()=>{L||g({type:"info",message:{id:(0,d.Z)("notification.info.autoreaload-disable")}})},[L,g]);const Ve=(F,C,P,Z=!1,X,oe=!1)=>{const Me=Z?ee.JO:ee.gz;m({type:Me,attributeToSet:F,forTarget:C,targetUid:P,initialAttribute:X,shouldAddComponentToData:oe})},Ee=({attributeToSet:F,forTarget:C,targetUid:P,initialAttribute:Z})=>{m({type:ee.Ir,attributeToSet:F,forTarget:C,targetUid:P,initialAttribute:Z})},z=({attributeToSet:F,forTarget:C,targetUid:P,initialAttribute:Z})=>{m({type:ee.Ly,attributeToSet:F,forTarget:C,targetUid:P,initialAttribute:Z})},M=(F,C)=>{m({type:ee.Uu,dynamicZoneTarget:F,componentsToAdd:C})},qe=(F,C,P,Z,X=!1)=>{const oe=C==="contentType"?ee.Sh:ee.VR;m({type:oe,data:F,componentCategory:Z,schemaType:C,uid:P,shouldAddComponentToData:X})},we=(F,C)=>{m({type:ee.o_,dynamicZoneTarget:F,newComponents:C})},ke=(F,C,P="")=>{const Z=F==="components"?ee.lw:ee.ai;F==="contentType"&&E("willDeleteFieldOfContentType"),m({type:Z,mainDataKey:F,attributeToRemoveName:C,componentUid:P})},Ht=async F=>{try{const C=`/component-categories/${F}`,P=window.confirm(q({id:(0,d.Z)("popUpWarning.bodyMessage.category.delete")}));j(),P&&(f(),await he.delete(C),await We(!0),await p(),await me())}catch(C){ze.error({err:C}),g({type:"warning",message:{id:"notification.error"}})}finally{p()}},ot=async()=>{try{const F=`/${fe}/${w}`,C=(0,N.get)(u,[Ke,"isTemporary"],!1),P=window.confirm(q({id:(0,d.Z)(`popUpWarning.bodyMessage.${W?"contentType":"component"}.delete`)}));if(j(),P){if(C){m({type:ee.Ap});return}f(),await he.delete(F),await We(!0),await p(),await me()}}catch(F){ze.error({err:F}),g({type:"warning",message:{id:"notification.error"}})}finally{p()}},Yt=async(F,C)=>{try{const P=`/component-categories/${F}`;j(),f(),await he.put(P,C),await We(!0),await p(),await me()}catch(P){ze.error({err:P}),g({type:"warning",message:{id:"notification.error"}})}finally{p()}},Xt=()=>{const F=Object.assign({},t,u.components);if(!W){const P=(0,N.get)(u,"component",{});(0,N.set)(F,(0,N.get)(P,["uid"],""),P)}const C=Fs(F);return(0,ie.Z)(C)},Qt=()=>{const F=kn(t),C=kn(u.components||{});return(0,ie.Z)([...C,...F])},ne=(F,C)=>{m({type:ee.NG,dzName:F,componentToRemoveIndex:C})},rt=()=>{const F=W?s:t,C=(0,N.get)(F,w,{schema:{attributes:[]}}),P=(0,xs.Z)(C.schema.attributes,t),Z=Rs(C,P,t,W),X=(0,N.get)(C,"isTemporary",!1)&&(0,N.size)((0,N.get)(C,"schema.attributes",[]))===0;m({type:ee.xx,schemaToSet:Z,hasJustCreatedSchema:X})},Jt=(0,a.useMemo)(()=>{const F=W?s:t;return w==="create-content-type"?!1:!Object.keys(F).includes(w)&&!r},[t,s,w,W,r]),_t=(0,a.useMemo)(()=>{const F=Object.keys(s).filter(C=>(0,N.get)(s,[C,"schema","visible"],!0)).sort();return(0,N.get)(F,"0","create-content-type")},[s]);if(Jt)return a.createElement(U.Redirect,{to:`/plugins/${G.Z}/content-types/${_t}`});const en=async F=>{try{const C=(0,N.get)(u,[Ke,"isTemporary"],!1),P={components:Ds(u.components,t,w,C)};if(W){const oe=S.forms.mutateContentTypeSchema({...$n(u.contentType),...F},i.contentType);if(!qs(oe)){g({type:"warning",message:{id:(0,d.Z)("notification.error.dynamiczone-min.validation"),defaultMessage:"At least one component is required in a dynamic zone to be able to save a content type"}});return}P.contentType=oe,E("willSaveContentType")}else P.component=$n(u.component,!0),E("willSaveComponent");f();const Z=`/${fe}`,X=C?Z:`${Z}/${w}`;if(C?await he.post(X,P):await he.put(X,P),await We(!0),await p(),C&&(i.contentType?.schema.kind==="collectionType"||i.contentType?.schema.kind==="singleType")&&h("contentTypeBuilder.success"),W){E("didSaveContentType");const oe=(0,N.get)(P,["contentType","schema","name"],""),Me=(0,N.get)(i,["contentType","schema","name"],"");!C&&oe!==Me&&E("didEditNameOfContentType")}else E("didSaveComponent");await me()}catch(C){W||E("didNotSaveComponent"),ze.error({err:C.response}),g({type:"warning",message:{id:"notification.error"}})}finally{p()}},me=async()=>{await T()},Ge=(F,C,P)=>{m({type:ee.bi,data:F,schemaType:C,uid:P})};return a.createElement(ut.Z.Provider,{value:{addAttribute:Ve,addCustomFieldAttribute:Ee,addCreatedComponentToDynamicZone:M,allComponentsCategories:Zs(t,["category"]),changeDynamicZoneComponents:we,components:t,componentsGroupedByCategory:(0,N.groupBy)(t,"category"),componentsThatHaveOtherComponentInTheirAttributes:Xt(),contentTypes:s,createSchema:qe,deleteCategory:Ht,deleteData:ot,editCategory:Yt,editCustomFieldAttribute:z,isInDevelopmentMode:Y,initialData:i,isInContentTypeView:W,modifiedData:u,nestedComponents:Qt(),removeAttribute:ke,removeComponentFromDynamicZone:ne,reservedNames:c,setModifiedData:rt,sortedContentTypesList:Ps(s),submitData:en,updateSchema:Ge}},o?a.createElement(R.LoadingIndicatorPage,null):a.createElement(a.Fragment,null,e,Y&&a.createElement(Ms,null)))};Gt.defaultProps={components:{}},Gt.propTypes={children:n().node.isRequired,components:n().object,contentTypes:n().object.isRequired,isLoading:n().bool.isRequired,isLoadingForDataToBeSet:n().bool.isRequired,initialData:n().object.isRequired,modifiedData:n().object.isRequired,reservedNames:n().object.isRequired};const Ws=Us(),zs=(0,pe.connect)(Ws,null);var Ks=(0,Xe.compose)(zs)((0,a.memo)(Gt)),Vs=l(51216);const zn={actionType:null,attributeName:null,attributeType:null,categoryName:null,dynamicZoneTarget:null,forTarget:null,modalType:null,isOpen:!1,kind:null,step:null,targetUid:null,customFieldUid:null},Kn=({children:e})=>{const[t,s]=(0,a.useState)(zn),{trackUsage:r}=(0,R.useTracking)(),o=({attributeType:E,customFieldUid:T})=>{s(A=>({...A,actionType:"create",modalType:"customField",attributeType:E,customFieldUid:T}))},i=({attributeType:E,step:T})=>{t.forTarget==="contentType"&&r("didSelectContentTypeFieldType",{type:E}),s(A=>({...A,actionType:"create",modalType:"attribute",step:T,attributeType:E}))},u=({dynamicZoneTarget:E,targetUid:T})=>{s(A=>({...A,dynamicZoneTarget:E,targetUid:T,modalType:"addComponentToDynamicZone",forTarget:"contentType",step:"1",actionType:"edit",isOpen:!0}))},c=({forTarget:E,targetUid:T})=>{s(A=>({...A,actionType:"create",forTarget:E,targetUid:T,modalType:"chooseAttribute",isOpen:!0}))},m=E=>{s(T=>({...T,...E,isOpen:!0}))},g=E=>{s(T=>({...T,categoryName:E,actionType:"edit",modalType:"editCategory",isOpen:!0}))},f=({forTarget:E,targetUid:T,attributeName:A,attributeType:j,customFieldUid:K})=>{s(te=>({...te,modalType:"customField",customFieldUid:K,actionType:"edit",forTarget:E,targetUid:T,attributeName:A,attributeType:j,isOpen:!0}))},p=({forTarget:E,targetUid:T,attributeName:A,attributeType:j,step:K})=>{s(te=>({...te,modalType:"attribute",actionType:"edit",forTarget:E,targetUid:T,attributeName:A,attributeType:j,step:K,isOpen:!0}))},h=({modalType:E,forTarget:T,targetUid:A,kind:j})=>{s(K=>({...K,modalType:E,actionType:"edit",forTarget:T,targetUid:A,kind:j,isOpen:!0}))},v=()=>{s(zn)},S=({forTarget:E,targetUid:T})=>{s(A=>({...A,forTarget:E,targetUid:T,modalType:"chooseAttribute"}))},L=()=>{s(E=>({...E,attributeType:"component",modalType:"attribute",step:"2"}))},q=({dynamicZoneTarget:E})=>{s(T=>({...T,dynamicZoneTarget:E,modalType:"addComponentToDynamicZone",actionType:"create",step:"1",attributeType:null,attributeName:null}))};return a.createElement(Vs.Z.Provider,{value:{...t,onClickSelectField:i,onClickSelectCustomField:o,onCloseModal:v,onNavigateToChooseAttributeModal:S,onNavigateToAddCompoToDZModal:q,onOpenModalAddComponentsToDZ:u,onNavigateToCreateComponentStep2:L,onOpenModalAddField:c,onOpenModalCreateSchema:m,onOpenModalEditCategory:g,onOpenModalEditField:p,onOpenModalEditCustomField:f,onOpenModalEditSchema:h,setFormModalNavigationState:s}},e)};Kn.propTypes={children:n().node.isRequired};var ws=Kn;const Gs=(0,a.lazy)(()=>l.e(5905).then(l.bind(l,69073)));var Hs=()=>{const{url:e}=(0,U.useRouteMatch)(),{categoryUid:t}=(0,U.useParams)();return a.createElement(a.Suspense,{fallback:a.createElement(R.LoadingIndicatorPage,null)},a.createElement(U.Switch,null,a.createElement(U.Route,{path:`${e}/:componentUid`},a.createElement(Gs,{categoryId:t}))))},Ys=l(90700),Xs=l(8598),Qs=l(77013),Js=l(79318),_s=l(28832),Vn=l(66618),eo=l(7563),to=l(86834),no=l.n(to),ao=l(98978),wn=l.n(ao),so=l(89793),oo=l.n(so),ro=l(58469),io=()=>{const{components:e,componentsGroupedByCategory:t,contentTypes:s,isInDevelopmentMode:r,sortedContentTypesList:o,modifiedData:i,initialData:u}=(0,Te.Z)(),c=(0,R.useNotification)(),{trackUsage:m}=(0,R.useTracking)(),[g,f]=(0,a.useState)(""),{onOpenModalCreateSchema:p,onOpenModalEditCategory:h}=(0,be.Z)(),v=wn()(Object.keys(t).map(O=>({name:O,title:O,isEditable:r,onClickEdit(Y,W){Y.stopPropagation(),S?h(W.name):T()},links:wn()(t[O].map(Y=>({name:Y.uid,to:`/plugins/${G.Z}/component-categories/${O}/${Y.uid}`,title:Y.schema.displayName})),Y=>Y.title)})),O=>O.title),S=!Object.keys(s).some(O=>s[O].isTemporary===!0)&&!Object.keys(e).some(O=>e[O].isTemporary===!0)&&oo()(i,u),L=()=>{S?(m("willCreateContentType"),p({modalType:"contentType",kind:"collectionType",actionType:"create",forTarget:"contentType"})):T()},q=()=>{S?(m("willCreateSingleType"),p({modalType:"contentType",kind:"singleType",actionType:"create",forTarget:"contentType"})):T()},E=()=>{S?(m("willCreateComponent"),p({modalType:"component",kind:null,actionType:"create",forTarget:"component"})):T()},T=()=>{c({type:"info",message:{id:`${(0,d.Z)("notification.info.creating.notSaved")}`,defaultMessage:"Please save your work before creating a new collection type or component"}})},A=o.filter(O=>O.visible),j=[{name:"models",title:{id:`${(0,d.Z)("menu.section.models.name")}`,defaultMessage:"Collection Types"},customLink:r&&{id:`${(0,d.Z)("button.model.create")}`,defaultMessage:"Create new collection type",onClick:L},links:A.filter(O=>O.kind==="collectionType")},{name:"singleTypes",title:{id:`${(0,d.Z)("menu.section.single-types.name")}`,defaultMessage:"Single Types"},customLink:r&&{id:`${(0,d.Z)("button.single-types.create")}`,defaultMessage:"Create new single type",onClick:q},links:A.filter(O=>O.kind==="singleType")},{name:"components",title:{id:`${(0,d.Z)("menu.section.components.name")}`,defaultMessage:"Components"},customLink:r&&{id:`${(0,d.Z)("button.component.create")}`,defaultMessage:"Create a new component",onClick:E},links:v}],K=O=>g?(0,ro.ZP)(O,Ze()(g),{keys:[Y=>Ze()(Y.title)]}):O;return{menu:(()=>j.map(O=>O.links.some(W=>!no()(W.links))?{...O,links:O.links.map(W=>({...W,links:K(W.links)}))}:{...O,links:K(O.links)}))(),searchValue:g,onSearchChange:f}},lo=()=>{const{menu:e,searchValue:t,onSearchChange:s}=io(),{formatMessage:r}=(0,k.useIntl)();return a.createElement(Ys.m,{ariaLabel:r({id:`${(0,d.Z)("plugin.name")}`,defaultMessage:"Content-Types Builder"})},a.createElement(Xs.p,{searchable:!0,value:t,onClear:()=>s(""),onChange:o=>s(o.target.value),label:r({id:`${(0,d.Z)("plugin.name")}`,defaultMessage:"Content-Types Builder"}),searchLabel:r({id:"global.search",defaultMessage:"Search"})}),a.createElement(Qs.Z,null,e.map(o=>a.createElement(a.Fragment,{key:o.name},a.createElement(Js.D,{label:r({id:o.title.id,defaultMessage:o.title.defaultMessage}),collapsable:!0,badgeLabel:o.links.length.toString()},o.links.map(i=>i.links?a.createElement(_s.z,{key:i.name,label:ve()(i.title)},i.links.map(u=>a.createElement(Vn.E,{as:U.NavLink,to:u.to,active:u.active,key:u.name,isSubSectionChild:!0},ve()(r({id:u.name,defaultMessage:u.title}))))):a.createElement(Vn.E,{as:U.NavLink,to:i.to,active:i.active,key:i.name},ve()(r({id:i.name,defaultMessage:i.title}))))),o.customLink&&a.createElement(B.x,{paddingLeft:7},a.createElement(eo.A,{onClick:o.customLink.onClick,startIcon:a.createElement(xe.default,null),marginTop:2},r({id:o.customLink.id,defaultMessage:o.customLink.defaultMessage})))))))};const Gn=(0,a.lazy)(()=>l.e(5905).then(l.bind(l,69073)));var uo=()=>{const{formatMessage:e}=(0,k.useIntl)(),t=e({id:`${G.Z}.plugin.name`,defaultMessage:"Content Types Builder"}),{startSection:s}=(0,R.useGuidedTour)(),r=(0,a.useRef)(s);return(0,a.useEffect)(()=>{r.current&&r.current("contentTypeBuilder")},[]),a.createElement(R.CheckPagePermissions,{permissions:Ye.Z.main},a.createElement(ye.Helmet,{title:t}),a.createElement(ws,null,a.createElement(Ks,null,a.createElement(it.A,{sideNav:a.createElement(lo,null)},a.createElement(a.Suspense,{fallback:a.createElement(R.LoadingIndicatorPage,null)},a.createElement(U.Switch,null,a.createElement(U.Route,{path:`/plugins/${G.Z}/content-types/create-content-type`,component:Gn}),a.createElement(U.Route,{path:`/plugins/${G.Z}/content-types/:uid`,component:Gn}),a.createElement(U.Route,{path:`/plugins/${G.Z}/component-categories/:categoryUid`,component:Hs})))))))}},92318:function(Ae,se,l){var a=l(25158);const U=ye=>`${a.Z}.${ye}`;se.Z=U}}]);
