@strapi/admin 4.3.0 → 4.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,142 +0,0 @@
1
- "use strict";(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[8880],{25747:(We,se,i)=>{i.d(se,{Z:()=>De});var r=i(32735),k=i(19615),ve=i(60216),F=i.n(ve),O=i(9808),Dn=i.n(O),Et=i(10822),J=i.n(Et),Mt=i(57746),a=i.n(Mt),D=i(61714),fe=i.n(D),Pt=i(9895),Ot=i.n(Pt),$e=i(80466),Rt=i.n($e),xt=i(34103),St=i.n(xt),Je=i(57290),we=i.n(Je),d=i(57955),Ae=i.n(d),At=i(90040),I=i.n(At),Dt=i(55788),Qe=i.n(Dt),Nt=i(94661),It=i.n(Nt),Zt=i(81208),qe=i.n(Zt),Ft=i(28565),Te=i.n(Ft),$=i(65232),_=i.n($),et=i(80268),Le=i.n(et),V=i(42122),de=i.n(V),K=i(88425),me=i.n(K),Ce=Object.defineProperty,oe=Object.getOwnPropertySymbols,ut=Object.prototype.hasOwnProperty,ze=Object.prototype.propertyIsEnumerable,dt=(Q,X,z)=>X in Q?Ce(Q,X,{enumerable:!0,configurable:!0,writable:!0,value:z}):Q[X]=z,ke=(Q,X)=>{for(var z in X||(X={}))ut.call(X,z)&&dt(Q,z,X[z]);if(oe)for(var z of oe(X))ze.call(X,z)&&dt(Q,z,X[z]);return Q},mt=(Q,X)=>{var z={};for(var pe in Q)ut.call(Q,pe)&&X.indexOf(pe)<0&&(z[pe]=Q[pe]);if(Q!=null&&oe)for(var pe of oe(Q))X.indexOf(pe)<0&&ze.call(Q,pe)&&(z[pe]=Q[pe]);return z};const wt={biginteger:de(),boolean:Ot(),collectionType:a(),component:J(),contentType:a(),date:fe(),datetime:fe(),decimal:de(),dynamiczone:Rt(),email:St(),enum:we(),enumeration:we(),file:Qe(),files:Qe(),float:de(),integer:de(),json:Ae(),JSON:Ae(),media:Qe(),number:de(),password:It(),relation:qe(),richtext:I(),singleType:Te(),string:_(),text:_(),time:fe(),timestamp:fe(),uid:Le()},pt=(0,k.default)(O.Box)`
2
- width: ${(0,K.pxToRem)(32)};
3
- height: ${(0,K.pxToRem)(24)};
4
- box-sizing: content-box;
5
- `,Ve=Q=>{var X=Q,{type:z}=X,pe=mt(X,["type"]);const gt=wt[z];return wt[z]?r.createElement(pt,ke({as:gt},pe)):null};Ve.propTypes={type:F().string.isRequired};const De=Ve},74753:(We,se,i)=>{i.d(se,{Z:()=>ve});var r=i(32735);const ve=(0,r.createContext)()},51216:(We,se,i)=>{i.d(se,{Z:()=>ve});var r=i(32735);const ve=(0,r.createContext)()},198:(We,se,i)=>{i.d(se,{Z:()=>F});var r=i(32735),k=i(74753);const F=()=>(0,r.useContext)(k.Z)},32237:(We,se,i)=>{i.d(se,{Z:()=>F});var r=i(32735),k=i(51216);const F=()=>(0,r.useContext)(k.Z)},89975:(We,se,i)=>{i.r(se),i.d(se,{default:()=>$i});var r=i(32735),k=i(5141),ve=i(99357),F=i(5636),O=i(88425),Dn=i(11856),Et=i(3633),J=i(25158),Mt=i(60216),a=i.n(Mt),D=i(92891),fe=i(4409),Pt=i(13055),Ot=i(74753),$e=i(32237),Rt=i(43653),xt=i.n(Rt),St=(e,t,n)=>new Promise((o,s)=>{var l=p=>{try{u(n.next(p))}catch(m){s(m)}},c=p=>{try{u(n.throw(p))}catch(m){s(m)}},u=p=>p.done?o(p.value):Promise.resolve(p.value).then(l,c);u((n=n.apply(e,t)).next())});const Je=xt().create({baseURL:`http://localhost:1337/${J.Z}`});Je.interceptors.request.use(e=>St(void 0,null,function*(){return e.headers={Authorization:`Bearer ${O.auth.getToken()}`,Accept:"application/json","Content-Type":"application/json"},e}),e=>{Promise.reject(e)}),Je.interceptors.response.use(e=>e,e=>{var t;throw((t=e.response)==null?void 0:t.status)===401&&(O.auth.clearAppStorage(),window.location.reload()),e});const we=Je;var d=i(92318),Ae=i(37087),At=i(33795),I=i.n(At),Dt=i(23973),Qe=i.n(Dt),Nt=i(3040),It=i.n(Nt),Zt=i(59578),qe=i.n(Zt),Ft=i(23940),Te=i.n(Ft),$=i(9808),_=i(44526),et=i(27635),Le=i(4122),V=i(95602),de=i(81700),K=i(19192),me=i(90662),Ce=i(198),oe=i(25716);const ut=[{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"}]}],ze=({intlLabel:e,name:t,onChange:n,value:o})=>{const{formatMessage:s}=(0,F.useIntl)(),l=o===null||o.length===0?s({id:"global.none",defaultMessage:"None"}):[...o].sort().map(u=>Te()(u)).join(", "),c=e.id?s({id:e.id,defaultMessage:e.defaultMessage}):t;return r.createElement(oe.MultiSelectNested,{id:"select1",label:c,customizeContent:()=>l,onChange:u=>{u.length>0?n({target:{name:t,value:u,type:"allowed-types-select"}}):n({target:{name:t,value:null,type:"allowed-types-select"}})},options:ut,value:o||[]})};ze.defaultProps={value:null},ze.propTypes={intlLabel:a().shape({id:a().string.isRequired,defaultMessage:a().string.isRequired,values:a().object}).isRequired,name:a().string.isRequired,onChange:a().func.isRequired,value:a().oneOfType([a().object,a().array])};const dt=ze;var ke=i(78330),mt=i(87910);const pt=e=>e.kind==="collectionType"&&(e.restrictRelationsTo===null||Array.isArray(e.restrictRelationsTo)&&e.restrictRelationsTo.length>0);var Ve=i(25747),De=i(19615);const X=(0,De.default)($.Box)`
6
- width: 100%;
7
- height: 100%;
8
- border: 1px solid ${({theme:e})=>e.colors.neutral200};
9
- text-align: left;
10
- &:hover {
11
- background: ${({theme:e})=>e.colors.primary100};
12
- border: 1px solid ${({theme:e})=>e.colors.primary200};
13
- }
14
- `,z=({type:e})=>{const{formatMessage:t}=(0,F.useIntl)(),{onClickSelectField:n}=(0,$e.Z)(),o=()=>{n({attributeType:e,step:e==="component"?"1":null})};return r.createElement(X,{padding:4,as:"button",hasRadius:!0,type:"button",onClick:o},r.createElement(K.Flex,null,r.createElement(Ve.Z,{type:e}),r.createElement($.Box,{paddingLeft:4},r.createElement(K.Flex,null,r.createElement(V.Typography,{fontWeight:"bold"},t({id:(0,d.Z)(`attribute.${e}`),defaultMessage:e}))),r.createElement(K.Flex,null,r.createElement(V.Typography,{variant:"pi",textColor:"neutral600"},t({id:(0,d.Z)(`attribute.${e}.description`)}))))))};z.defaultProps={type:"text"},z.propTypes={type:a().string};const pe=z,gt=({attributes:e,forTarget:t,kind:n})=>{const{formatMessage:o}=(0,F.useIntl)(),s=t.includes("component")?"component":n,l=(0,d.Z)(`modalForm.sub-header.chooseAttribute.${s}`);return r.createElement(Le.ModalBody,null,r.createElement(K.Flex,{paddingBottom:4},r.createElement(V.Typography,{variant:"beta",as:"h2"},o({id:l,defaultMessage:"Select a field"}))),r.createElement(et.Divider,null),r.createElement($.Box,{paddingTop:6,paddingBottom:4},r.createElement(mt.KeyboardNavigable,{tagName:"button"},r.createElement(me.Stack,{spacing:8},e.map((c,u)=>{const p=u;return r.createElement(ke.Grid,{key:p,gap:0},c.map((m,g)=>{const f=g%2===1,y=f?2:0,v=f?0:2;return r.createElement(ke.GridItem,{key:m,col:6,style:{height:"100%"}},r.createElement($.Box,{paddingLeft:y,paddingRight:v,paddingBottom:1,style:{height:"100%"}},r.createElement(pe,{type:m})))}))})))))};gt.propTypes={attributes:a().array.isRequired,forTarget:a().string.isRequired,kind:a().string.isRequired};const mr=gt;var Lt=i(49137),pr=i(63865),gr=i(50678),fr=i.n(gr),yr=Object.defineProperty,Nn=Object.getOwnPropertySymbols,hr=Object.prototype.hasOwnProperty,br=Object.prototype.propertyIsEnumerable,In=(e,t,n)=>t in e?yr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zn=(e,t)=>{for(var n in t||(t={}))hr.call(t,n)&&In(e,n,t[n]);if(Nn)for(var n of Nn(t))br.call(t,n)&&In(e,n,t[n]);return e};const vr=(0,De.default)(V.Typography)`
15
- text-align: center;
16
- `,Bt=({description:e,disabled:t,intlLabel:n,isCreating:o,name:s,onChange:l,value:c})=>{const{formatMessage:u}=(0,F.useIntl)(),[p,m]=(0,r.useState)(!1),g=n.id?u({id:n.id,defaultMessage:n.defaultMessage},Zn({},n.values)):s,f=e?u({id:e.id,defaultMessage:e.defaultMessage},Zn({},e.values)):"",y=()=>m(E=>!E),v=()=>{l({target:{name:s,value:!1}}),y()},C=({target:{checked:E}})=>{if(!E&&!o){y();return}l({target:{name:s,value:E}})};return r.createElement(r.Fragment,null,r.createElement(pr.ToggleInput,{checked:c||!1,disabled:t,hint:f,label:g,name:s,offLabel:u({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"Off"}),onLabel:u({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"On"}),onChange:C}),p&&r.createElement(Lt.Dialog,{onClose:y,title:"Confirmation",isOpen:p},r.createElement(Lt.DialogBody,{icon:r.createElement(fr(),null)},r.createElement(me.Stack,{spacing:2},r.createElement(K.Flex,{justifyContent:"center"},r.createElement(vr,{id:"confirm-description"},u({id:(0,d.Z)("popUpWarning.draft-publish.message"),defaultMessage:"If you disable the Draft/Publish system, your drafts will be deleted."}))),r.createElement(K.Flex,{justifyContent:"center"},r.createElement(V.Typography,{id:"confirm-description"},u({id:(0,d.Z)("popUpWarning.draft-publish.second-message"),defaultMessage:"Are you sure you want to disable it?"}))))),r.createElement(Lt.DialogFooter,{startAction:r.createElement(_.Button,{onClick:y,variant:"tertiary"},u({id:"components.popUpWarning.button.cancel",defaultMessage:"No, cancel"})),endAction:r.createElement(_.Button,{variant:"danger-light",onClick:v},u({id:(0,d.Z)("popUpWarning.draft-publish.button.confirm"),defaultMessage:"Yes, disable"}))})))};Bt.defaultProps={description:null,disabled:!1,value:!1},Bt.propTypes={description:a().shape({id:a().string.isRequired,defaultMessage:a().string.isRequired,values:a().object}),disabled:a().bool,intlLabel:a().shape({id:a().string.isRequired,defaultMessage:a().string.isRequired,values:a().object}).isRequired,isCreating:a().bool.isRequired,name:a().string.isRequired,onChange:a().func.isRequired,value:a().bool};const Tr=Bt;var qt=i(71657);const kt=({actionType:e,attributeName:t,attributeType:n,categoryName:o,contentTypeKind:s,dynamicZoneTarget:l,forTarget:c,modalType:u,targetUid:p})=>{var m;const{formatMessage:g}=(0,F.useIntl)(),{modifiedData:f}=(0,Ce.Z)();let y,v=[];const C=((m=f==null?void 0:f[c])==null?void 0:m[p])||(f==null?void 0:f[c])||null;let E=C==null?void 0:C.schema.displayName;if(u==="contentType"&&(y=s),["component","editCategory"].includes(u)&&(y="component"),["component","contentType"].includes(u)){let R=(0,d.Z)(`modalForm.component.header-${e}`);return u==="contentType"&&(R=(0,d.Z)(`modalForm.${s}.header-create`)),e==="edit"&&(R=(0,d.Z)("modalForm.header-edit")),r.createElement(Le.ModalHeader,null,r.createElement(K.Flex,null,r.createElement($.Box,null,r.createElement(Ve.Z,{type:y})),r.createElement($.Box,{paddingLeft:3},r.createElement(V.Typography,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title"},g({id:R},{name:E})))))}v=[{label:E,info:{category:(C==null?void 0:C.category)||null,name:C==null?void 0:C.schema.displayName}}],u==="chooseAttribute"&&(y=["component","components"].includes(c)?"component":C.schema.kind),u==="addComponentToDynamicZone"&&(y="dynamiczone",v.push({label:l})),u==="attribute"&&(y=n,v.push({label:t})),u==="editCategory"&&(v=[{label:g({id:(0,d.Z)("modalForm.header.categories"),defaultMessage:"Categories"})},{label:o}]);const P=v.map(({label:R})=>R).join(",");return r.createElement(Le.ModalHeader,null,r.createElement(me.Stack,{horizontal:!0,spacing:3},r.createElement(Ve.Z,{type:y}),r.createElement(qt.Breadcrumbs,{label:P},v.map((R,Z)=>{var U;const L=Te()(R.label);if(!L)return null;const G=`${R.label}.${Z}`;if((U=R.info)!=null&&U.category){const A=`${L} (${Te()(R.info.category)} - ${Te()(R.info.name)})`;return r.createElement(qt.Crumb,{key:G},A)}return r.createElement(qt.Crumb,{key:G},L)}))))};kt.defaultProps={actionType:null,attributeName:null,attributeType:null,categoryName:null,dynamicZoneTarget:null,forTarget:null,contentTypeKind:null,targetUid:null},kt.propTypes={actionType:a().string,attributeName:a().string,attributeType:a().string,categoryName:a().string,contentTypeKind:a().string,dynamicZoneTarget:a().string,forTarget:a().oneOf(["contentType","component","components"]),modalType:a().string.isRequired,targetUid:a().string};const Cr=kt;var Er=i(59290),tt=i.n(Er);const jt=({categoryName:e,deleteCategory:t,deleteComponent:n,deleteContentType:o,isAttributeModal:s,isComponentAttribute:l,isComponentToDzModal:c,isContentTypeModal:u,isCreatingComponent:p,isCreatingComponentAttribute:m,isCreatingComponentInDz:g,isCreatingComponentWhileAddingAField:f,isCreatingContentType:y,isCreatingDz:v,isComponentModal:C,isDzAttribute:E,isEditingAttribute:N,isEditingCategory:P,isInFirstComponentStep:R,onSubmitAddComponentAttribute:Z,onSubmitAddComponentToDz:U,onSubmitCreateContentType:L,onSubmitCreateComponent:G,onSubmitCreateDz:A,onSubmitEditAttribute:H,onSubmitEditCategory:q,onSubmitEditComponent:te,onSubmitEditContentType:Ie,onSubmitEditDz:ge})=>{const{formatMessage:j}=(0,F.useIntl)();return c?g?r.createElement(_.Button,{variant:"secondary",type:"submit",onClick:x=>{x.preventDefault(),U(x,!0)},startIcon:r.createElement(tt(),null)},j({id:(0,d.Z)("form.button.add-first-field-to-created-component"),defaultMessage:"Add first field to the component"})):r.createElement(_.Button,{variant:"default",type:"submit",onClick:x=>{x.preventDefault(),U(x,!1)}},j({id:"global.finish",defaultMessage:"Finish"})):s&&E&&!v?r.createElement(_.Button,{variant:"default",type:"submit",onClick:x=>{x.preventDefault(),ge(x,!1)}},j({id:"global.finish",defaultMessage:"Finish"})):s&&E&&v?r.createElement(r.Fragment,null,r.createElement(_.Button,{variant:"secondary",type:"submit",onClick:x=>{x.preventDefault(),A(x,!0)},startIcon:r.createElement(tt(),null)},j({id:(0,d.Z)("form.button.add-components-to-dynamiczone"),defaultMessage:"Add components to the zone"}))):s&&l?R?r.createElement(_.Button,{variant:"secondary",type:"submit",onClick:x=>{x.preventDefault(),Z(x,!0)}},j(m?{id:(0,d.Z)("form.button.configure-component"),defaultMessage:"Configure the component"}:{id:(0,d.Z)("form.button.select-component"),defaultMessage:"Configure the component"})):r.createElement(r.Fragment,null,r.createElement(_.Button,{variant:"secondary",type:"submit",onClick:x=>{x.preventDefault(),Z(x,!0)},startIcon:r.createElement(tt(),null)},j(f?{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"})),r.createElement(_.Button,{variant:"default",type:"button",onClick:x=>{x.preventDefault(),Z(x,!1)}},j({id:"global.finish",defaultMessage:"Finish"}))):s&&!l&&!E?r.createElement(r.Fragment,null,r.createElement(_.Button,{type:N?"button":"submit",variant:"secondary",onClick:x=>{x.preventDefault(),H(x,!0)},startIcon:r.createElement(tt(),null)},j({id:(0,d.Z)("form.button.add-field"),defaultMessage:"Add another field"})),r.createElement(_.Button,{type:N?"submit":"button",variant:"default",onClick:x=>{x.preventDefault(),H(x,!1)}},j({id:"global.finish",defaultMessage:"Finish"}))):u?r.createElement(r.Fragment,null,!y&&r.createElement(r.Fragment,null,r.createElement(_.Button,{type:"button",variant:"danger",onClick:x=>{x.preventDefault(),o()}},j({id:"global.delete",defaultMessage:"Delete"})),r.createElement(_.Button,{type:"submit",variant:"default",onClick:x=>{x.preventDefault(),Ie(x,!1)}},j({id:"global.finish",defaultMessage:"Finish"}))),y&&r.createElement(_.Button,{type:"submit",variant:"secondary",onClick:x=>{x.preventDefault(),L(x,!0)}},j({id:"global.continue",defaultMessage:"Continue"}))):C?r.createElement(r.Fragment,null,!p&&r.createElement(r.Fragment,null,r.createElement(_.Button,{type:"button",variant:"danger",onClick:x=>{x.preventDefault(),n()}},j({id:"global.delete",defaultMessage:"Delete"})),r.createElement(_.Button,{type:"submit",variant:"default",onClick:x=>{x.preventDefault(),te(x,!1)}},j({id:"global.finish",defaultMessage:"Finish"}))),p&&r.createElement(_.Button,{type:"submit",variant:"secondary",onClick:x=>{x.preventDefault(),G(x,!0)}},j({id:"global.continue",defaultMessage:"Continue"}))):P?r.createElement(r.Fragment,null,r.createElement(_.Button,{type:"button",variant:"danger",onClick:x=>{x.preventDefault(),t(e)}},j({id:"global.delete",defaultMessage:"Delete"})),r.createElement(_.Button,{type:"submit",variant:"default",onClick:x=>{x.preventDefault(),q(x)}},j({id:"global.finish",defaultMessage:"finish"}))):null};jt.defaultProps={categoryName:null},jt.propTypes={categoryName:a().string,deleteCategory:a().func.isRequired,deleteComponent:a().func.isRequired,deleteContentType:a().func.isRequired,isAttributeModal:a().bool.isRequired,isComponentAttribute:a().bool.isRequired,isComponentModal:a().bool.isRequired,isComponentToDzModal:a().bool.isRequired,isContentTypeModal:a().bool.isRequired,isCreatingComponent:a().bool.isRequired,isCreatingComponentAttribute:a().bool.isRequired,isCreatingComponentInDz:a().bool.isRequired,isCreatingComponentWhileAddingAField:a().bool.isRequired,isCreatingContentType:a().bool.isRequired,isCreatingDz:a().bool.isRequired,isDzAttribute:a().bool.isRequired,isEditingAttribute:a().bool.isRequired,isEditingCategory:a().bool.isRequired,isInFirstComponentStep:a().bool.isRequired,onSubmitAddComponentAttribute:a().func.isRequired,onSubmitAddComponentToDz:a().func.isRequired,onSubmitCreateContentType:a().func.isRequired,onSubmitCreateComponent:a().func.isRequired,onSubmitCreateDz:a().func.isRequired,onSubmitEditAttribute:a().func.isRequired,onSubmitEditCategory:a().func.isRequired,onSubmitEditComponent:a().func.isRequired,onSubmitEditContentType:a().func.isRequired,onSubmitEditDz:a().func.isRequired};const Mr=jt;var Pr=Object.defineProperty,Fn=Object.getOwnPropertySymbols,Or=Object.prototype.hasOwnProperty,Rr=Object.prototype.propertyIsEnumerable,wn=(e,t,n)=>t in e?Pr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xr=(e,t)=>{for(var n in t||(t={}))Or.call(t,n)&&wn(e,n,t[n]);if(Fn)for(var n of Fn(t))Rr.call(t,n)&&wn(e,n,t[n]);return e};const _t=({intlLabel:e,name:t,options:n,onChange:o,value:s})=>{const{formatMessage:l}=(0,F.useIntl)(),c=e.id?l({id:e.id,defaultMessage:e.defaultMessage},xr({},e.values)):t,u=p=>{let m="";p==="true"&&(m=!0),p==="false"&&(m=!1),o({target:{name:t,value:m,type:"select-default-boolean"}})};return r.createElement(oe.Select,{label:c,id:t,name:t,onChange:u,value:(s===null?"":s).toString()},n.map(({metadatas:{intlLabel:p,disabled:m,hidden:g},key:f,value:y})=>r.createElement(oe.Option,{key:f,value:y,disabled:m,hidden:g},p.defaultMessage)))};_t.defaultProps={value:null},_t.propTypes={intlLabel:a().shape({id:a().string.isRequired,defaultMessage:a().string.isRequired,values:a().object}).isRequired,name:a().string.isRequired,onChange:a().func.isRequired,options:a().arrayOf(a().shape({metadatas:a().shape({intlLabel:a().shape({id:a().string.isRequired,defaultMessage:a().string.isRequired}).isRequired,disabled:a().bool,hidden:a().bool}).isRequired,key:a().oneOfType([a().string,a().number]).isRequired,value:a().oneOfType([a().string,a().number]).isRequired}).isRequired).isRequired,value:a().any};const Sr=_t;var Ar=i(10345);const Dr=(0,De.default)(me.Stack)`
17
- position: relative;
18
- align-items: stretch;
19
-
20
- label {
21
- border-radius: 4px;
22
- max-width: 50%;
23
- cursor: pointer;
24
- user-select: none;
25
- flex: 1;
26
- ${(0,Ar.inputFocusStyle)()}
27
- }
28
-
29
- input {
30
- position: absolute;
31
- opacity: 0;
32
- }
33
-
34
- .option {
35
- height: 100%;
36
- border-radius: 4px;
37
- border: 1px solid ${({theme:e})=>e.colors.neutral200};
38
- will-change: transform, opacity;
39
- background: ${({theme:e})=>e.colors.neutral0};
40
-
41
- .checkmark {
42
- position: relative;
43
- display: block;
44
- will-change: transform;
45
- background: ${({theme:e})=>e.colors.neutral0};
46
- width: ${({theme:e})=>e.spaces[5]};
47
- height: ${({theme:e})=>e.spaces[5]};
48
- border: solid 1px ${({theme:e})=>e.colors.neutral300};
49
- border-radius: 50%;
50
-
51
- &:before,
52
- &:after {
53
- content: '';
54
- display: block;
55
- border-radius: 50%;
56
- width: ${({theme:e})=>e.spaces[3]};
57
- height: ${({theme:e})=>e.spaces[3]};
58
- position: absolute;
59
- top: 3px;
60
- left: 3px;
61
- }
62
-
63
- &:after {
64
- transform: scale(0);
65
- transition: inherit;
66
- will-change: transform;
67
- }
68
- }
69
- }
70
-
71
- .container input:checked ~ div {
72
- background: ${({theme:e})=>e.colors.primary100};
73
- ${V.Typography} {
74
- color: ${({theme:e})=>e.colors.primary600};
75
- }
76
- border: 1px solid ${({theme:e})=>e.colors.primary200};
77
- .checkmark {
78
- border: solid 1px ${({theme:e})=>e.colors.primary600};
79
- &::after {
80
- background: ${({theme:e})=>e.colors.primary600};
81
- transform: scale(1);
82
- }
83
- }
84
- }
85
- `,Ut=({intlLabel:e,name:t,onChange:n,radios:o,value:s})=>{const{formatMessage:l}=(0,F.useIntl)();return r.createElement(me.Stack,{spacing:2},r.createElement(V.Typography,{variant:"pi",fontWeight:"bold",textColor:"neutral800",htmlFor:t,as:"label"},l(e)),r.createElement(Dr,{horizontal:!0,spacing:4,style:{alignItems:"stretch"}},o.map(c=>r.createElement("label",{htmlFor:c.value.toString(),key:c.value,className:"container"},r.createElement("input",{id:c.value.toString(),name:t,className:"option-input",checked:c.value===s,value:c.value,key:c.value,onChange:n,type:"radio"}),r.createElement($.Box,{className:"option",padding:4},r.createElement(K.Flex,null,r.createElement($.Box,{paddingRight:4},r.createElement("span",{className:"checkmark"})),r.createElement(me.Stack,{spacing:2},r.createElement(V.Typography,{fontWeight:"bold"},l(c.title)),r.createElement(V.Typography,{variant:"pi",textColor:"neutral600"},l(c.description)))))))))};Ut.defaultProps={radios:[]},Ut.propTypes={intlLabel:a().shape({id:a().string.isRequired,defaultMessage:a().string.isRequired,values:a().object}).isRequired,name:a().string.isRequired,onChange:a().func.isRequired,radios:a().arrayOf(a().shape({title:a().shape({id:a().string.isRequired,defaultMessage:a().string.isRequired}),description:a().shape({id:a().string.isRequired,defaultMessage:a().string.isRequired}),value:a().any.isRequired})),value:a().oneOfType([a().string,a().bool]).isRequired};const Wt=Ut;var Nr=Object.defineProperty,Ir=Object.defineProperties,Zr=Object.getOwnPropertyDescriptors,ft=Object.getOwnPropertySymbols,Ln=Object.prototype.hasOwnProperty,Bn=Object.prototype.propertyIsEnumerable,qn=(e,t,n)=>t in e?Nr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fr=(e,t)=>{for(var n in t||(t={}))Ln.call(t,n)&&qn(e,n,t[n]);if(ft)for(var n of ft(t))Bn.call(t,n)&&qn(e,n,t[n]);return e},wr=(e,t)=>Ir(e,Zr(t)),Lr=(e,t)=>{var n={};for(var o in e)Ln.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&ft)for(var o of ft(e))t.indexOf(o)<0&&Bn.call(e,o)&&(n[o]=e[o]);return n};const kn=e=>{var t=e,{onChange:n,name:o}=t,s=Lr(t,["onChange","name"]);const l=c=>{const u=c.target.value!=="false";n({target:{name:o,value:u,type:"boolean-radio-group"}})};return r.createElement(Wt,wr(Fr({},s),{name:o,onChange:l}))};kn.propTypes={name:a().string.isRequired,onChange:a().func.isRequired};const Br=kn;var qr=i(52111),kr=i(93026),$t=i(37178),jr=Object.defineProperty,jn=Object.getOwnPropertySymbols,_r=Object.prototype.hasOwnProperty,Ur=Object.prototype.propertyIsEnumerable,_n=(e,t,n)=>t in e?jr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Wr=(e,t)=>{for(var n in t||(t={}))_r.call(t,n)&&_n(e,n,t[n]);if(jn)for(var n of jn(t))Ur.call(t,n)&&_n(e,n,t[n]);return e};const zt=({error:e,intlLabel:t,modifiedData:n,name:o,onChange:s,value:l})=>{const{formatMessage:c}=(0,F.useIntl)(),[u,p]=(0,r.useState)(!!l||l===0),m=t.id?c({id:t.id,defaultMessage:t.defaultMessage},Wr({},t.values)):o,g=n.type==="biginteger"?"text":"number",f=!n.type,y=e?c({id:e,defaultMessage:e}):"";return r.createElement(me.Stack,{spacing:2},r.createElement(qr.Checkbox,{id:o,name:o,onValueChange:v=>{s({target:{name:o,value:v?g==="text"?"0":0:null}}),p(N=>!N)},value:u},m),u&&r.createElement($.Box,{paddingLeft:6,style:{maxWidth:"200px"}},g==="text"?r.createElement($t.TextInput,{"aria-label":m,disabled:f,error:y,id:o,name:o,onChange:s,value:l===null?"":l}):r.createElement(kr.NumberInput,{"aria-label":m,disabled:f,error:y,id:o,name:o,onValueChange:v=>{s({target:{name:o,value:v,type:g}})},value:l||0})))};zt.defaultProps={error:null,value:null},zt.propTypes={error:a().string,intlLabel:a().shape({id:a().string.isRequired,defaultMessage:a().string.isRequired,values:a().object}).isRequired,modifiedData:a().object.isRequired,name:a().string.isRequired,onChange:a().func.isRequired,value:a().oneOfType([a().string,a().object,a().bool,a().number])};const $r=zt;var zr=Object.defineProperty,Vr=Object.defineProperties,Kr=Object.getOwnPropertyDescriptors,yt=Object.getOwnPropertySymbols,Un=Object.prototype.hasOwnProperty,Wn=Object.prototype.propertyIsEnumerable,$n=(e,t,n)=>t in e?zr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Gr=(e,t)=>{for(var n in t||(t={}))Un.call(t,n)&&$n(e,n,t[n]);if(yt)for(var n of yt(t))Wn.call(t,n)&&$n(e,n,t[n]);return e},Hr=(e,t)=>Vr(e,Kr(t)),Xr=(e,t)=>{var n={};for(var o in e)Un.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&yt)for(var o of yt(e))t.indexOf(o)<0&&Wn.call(e,o)&&(n[o]=e[o]);return n};const zn=e=>{var t=e,{onChange:n}=t,o=Xr(t,["onChange"]);const s=(0,O.useNotification)(),l=c=>{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)."}}),n(c)};return r.createElement(Wt,Hr(Gr({},o),{onChange:l}))};zn.propTypes={onChange:a().func.isRequired};const Yr=zn;var Vn=i(19744),Jr=i(89978),Qr=i(20763),eo=i(38938),to=i.n(eo),no=i(16925);const ao=(0,De.default)(K.Flex)`
86
- svg {
87
- z-index: 2;
88
- color: ${({isSelected:e,theme:t})=>e?t.colors.primary600:t.colors.neutral300};
89
- }
90
- ${({isSelected:e,theme:t})=>e?`
91
- &::after {
92
- content: '';
93
- position: absolute;
94
- top: 8px;
95
- left: 8px;
96
- border-radius: 50%;
97
- width: 28px;
98
- height: 28px;
99
- background-color: ${t.colors.primary200};
100
- z-index: 1;
101
- }
102
- `:""}
103
- `;var ro=Object.defineProperty,oo=Object.defineProperties,so=Object.getOwnPropertyDescriptors,Kn=Object.getOwnPropertySymbols,io=Object.prototype.hasOwnProperty,lo=Object.prototype.propertyIsEnumerable,Gn=(e,t,n)=>t in e?ro(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,co=(e,t)=>{for(var n in t||(t={}))io.call(t,n)&&Gn(e,n,t[n]);if(Kn)for(var n of Kn(t))lo.call(t,n)&&Gn(e,n,t[n]);return e},uo=(e,t)=>oo(e,so(t));const nt=44,Vt=({error:e,intlLabel:t,name:n,onChange:o,value:s})=>{const{allIcons:l}=(0,Ce.Z)(),{formatMessage:c}=(0,F.useIntl)(),u=(0,r.useRef)(),[p,m]=(0,r.useState)(!1),[g,f]=(0,r.useState)(""),[y,v]=(0,r.useState)(l),C=()=>m(Z=>!Z);(0,r.useEffect)(()=>{p&&u.current.querySelector("input").focus()},[p]);const E=({target:{value:Z}})=>{f(Z),v(()=>l.filter(U=>U.includes(Z)))},N=e?c({id:e,defaultMessage:e}):"",P=({index:Z})=>{const L=Z%16,G=nt,A=nt,H=L*(A+1),q=parseInt(Z/16,10)*nt;return{height:G,width:A,x:H,y:q}},R=y.length;return r.createElement($.Box,null,r.createElement(me.Stack,{spacing:1},r.createElement(K.Flex,{justifyContent:"space-between"},r.createElement(V.Typography,{variant:"pi",fontWeight:"bold",textColor:"neutral800",htmlFor:n,as:"label"},c(t)),p?r.createElement("div",{ref:u,style:{width:206}},r.createElement(Jr.Searchbar,{name:"searchbar",onBlur:()=>{g||C()},onClear:()=>{f(""),v(l),C()},value:g,onChange:E,clearLabel:"Clearing the icon search",placeholder:c({id:(0,d.Z)("ComponentIconPicker.search.placeholder"),defaultMessage:"Search for an icon"}),size:"S"},c({id:(0,d.Z)("ComponentIconPicker.search.placeholder"),defaultMessage:"Search for an icon"}))):r.createElement(Qr.IconButton,{onClick:C,"aria-label":"Edit",icon:r.createElement(to(),null),noBorder:!0})),r.createElement(me.Stack,{spacing:1},r.createElement($.Box,{background:"neutral100",borderColor:e?"danger600":"",hasRadius:!0},r.createElement($.Box,null,r.createElement(Vn.qj,{disableHeight:!0},({width:Z})=>r.createElement(Vn.FE,{cellCount:R,cellRenderer:({index:U,key:L,style:G})=>{const A=y[U],H=A===s,q=()=>{o({target:{name:n,value:A}})};return r.createElement("div",{style:uo(co({},G),{width:nt}),key:L},r.createElement(ao,{style:{width:"100%",height:nt},alignItems:"center",justifyContent:"center",onClick:q,isSelected:H,as:"button",type:"button"},r.createElement(no.G,{icon:A})))},cellSizeAndPositionGetter:P,height:132,width:Z})))),e&&r.createElement(V.Typography,{variant:"pi",id:`${n}-error`,textColor:"danger600","data-strapi-field-error":!0},N))))};Vt.defaultProps={error:null},Vt.propTypes={error:a().string,intlLabel:a().shape({id:a().string.isRequired,defaultMessage:a().string.isRequired,values:a().object}).isRequired,name:a().string.isRequired,onChange:a().func.isRequired,value:a().string.isRequired};const mo=Vt;var Kt=i(49561),Hn=i(12611),ee=i(91559);const Gt=({oneThatIsCreatingARelationWithAnother:e,target:t})=>{const{contentTypes:n,sortedContentTypesList:o}=(0,Ce.Z)(),s=(0,fe.useDispatch)(),l=o.filter(pt),c=I()(n,[t,"plugin"],null),u=I()(n,[t,"schema","displayName"],"error");return r.createElement(Hn.SimpleMenu,{id:"label",label:`${u}
104
- ${c?`(from: ${c})`:""}`},l.map(({uid:p,title:m,restrictRelationsTo:g,plugin:f})=>{const y=()=>{const v=f?`${f}_${m}`:m;s({type:ee.aG,target:{value:p,oneThatIsCreatingARelationWithAnother:e,selectedContentTypeFriendlyName:v,targetContentTypeAllowedRelations:g}})};return r.createElement(Hn.MenuItem,{key:p,onClick:y},m,"\xA0",f&&r.createElement(r.Fragment,null,"(from: ",f,")"))}))};Gt.defaultProps={target:null},Gt.propTypes={oneThatIsCreatingARelationWithAnother:a().string.isRequired,target:a().string};const po=Gt,Ht=({disabled:e,error:t,header:n,isMain:o,name:s,onChange:l,oneThatIsCreatingARelationWithAnother:c,target:u,value:p})=>r.createElement($.Box,{background:"neutral100",hasRadius:!0,borderColor:"neutral200"},r.createElement(K.Flex,{paddingTop:o?4:1,paddingBottom:o?3:1,justifyContent:"center"},o?r.createElement(V.Typography,{variant:"pi",fontWeight:"bold",textColor:"neutral800"},n):r.createElement(po,{target:u,oneThatIsCreatingARelationWithAnother:c})),r.createElement(et.Divider,{background:"neutral200"}),r.createElement($.Box,{padding:4},r.createElement(O.GenericInput,{disabled:e,error:(t==null?void 0:t.id)||null,intlLabel:{id:(0,d.Z)("form.attribute.item.defineRelation.fieldName"),defaultMessage:"Field name"},name:s,onChange:l,type:"text",value:p})));Ht.defaultProps={disabled:!1,error:null,header:null,isMain:!1,onChange:()=>{},oneThatIsCreatingARelationWithAnother:null,target:null,value:""},Ht.propTypes={disabled:a().bool,error:a().object,header:a().string,isMain:a().bool,name:a().string.isRequired,onChange:a().func,oneThatIsCreatingARelationWithAnother:a().string,target:a().string,value:a().string};const Xn=Ht;var go=i(51382),Yn=i.n(go),fo=i(24443),Xt=i.n(fo),yo=i(29158),ho=i.n(yo),bo=i(10883),vo=i.n(bo),To=i(36925),Co=i.n(To),Eo=i(23277),Mo=i.n(Eo),Po=i(55452),Oo=i.n(Po),Ro=i(82937),xo=i.n(Ro);const So=(0,De.default)($.Box)`
105
- position: relative;
106
- width: 100%;
107
- &::before {
108
- content: '';
109
- position: absolute;
110
- top: calc(50% - 0px);
111
- height: 2px;
112
- width: 100%;
113
- background-color: ${({theme:e})=>e.colors.primary600};
114
- z-index: 0;
115
- }
116
- `,Ao=(0,De.default)($.Box)`
117
- background: ${({theme:e,isSelected:t})=>e.colors[t?"primary100":"neutral0"]};
118
- border: 1px solid
119
- ${({theme:e,isSelected:t})=>e.colors[t?"primary700":"neutral200"]};
120
- border-radius: ${({theme:e})=>e.borderRadius};
121
- z-index: 1;
122
- svg {
123
- width: 1.5rem;
124
- height: 100%;
125
- path {
126
- fill: ${({theme:e,isSelected:t})=>e.colors[t?"primary700":"neutral500"]};
127
- }
128
- }
129
- &:disabled {
130
- cursor: not-allowed;
131
- }
132
- `,Do=(0,De.default)(K.Flex)`
133
- position: absolute;
134
- bottom: 0;
135
- left: 0;
136
- right: 0;
137
- `,No={oneWay:vo(),oneToOne:ho(),oneToMany:Mo(),manyToOne:Oo(),manyToMany:xo(),manyWay:Co()},Yt=({naturePickerType:e,oneThatIsCreatingARelationWithAnother:t,relationType:n,target:o})=>{const s=(0,fe.useDispatch)(),{formatMessage:l}=(0,F.useIntl)(),{contentTypes:c,modifiedData:u}=(0,Ce.Z)(),p=["oneWay","oneToOne","oneToMany","manyToOne","manyToMany","manyWay"],m=["oneWay","manyWay"],f=(e==="contentType"?I()(u,[e,"schema","kind"],""):e)==="collectionType"?p:m,y=n==="manyToOne",v=I()(c,[o,"schema","displayName"],"unknown"),C=y?v:t,E=y?t:v,N=Xt()(C,n==="manyToMany"?2:1),P=I()(c,[o,"schema","restrictRelationsTo"],null),R=Xt()(E,["manyToMany","oneToMany","manyToOne","manyWay"].includes(n)?2:1);return n?r.createElement(K.Flex,{style:{flex:1}},r.createElement(So,null,r.createElement(K.Flex,{paddingLeft:9,paddingRight:9,paddingTop:1,justifyContent:"center"},r.createElement(mt.KeyboardNavigable,{tagName:"button"},r.createElement(me.Stack,{spacing:3,horizontal:!0},f.map(Z=>{const U=No[Z],L=P===null||P.includes(Z);return r.createElement(Ao,{as:"button",isSelected:n===Z,disabled:!L,key:Z,onClick:()=>{L&&s({type:ee.QQ,target:{oneThatIsCreatingARelationWithAnother:t,targetContentType:o,value:Z}})},padding:2,type:"button"},r.createElement(U,{key:Z}))}))))),r.createElement(Do,{justifyContent:"center"},r.createElement(V.Typography,null,Yn()(N,{length:24}),"\xA0"),r.createElement(V.Typography,{textColor:"primary600"},l({id:(0,d.Z)(`relation.${n}`)}),"\xA0"),r.createElement(V.Typography,null,Yn()(R,{length:24})))):null};Yt.defaultProps={relationType:null,target:null},Yt.propTypes={naturePickerType:a().string.isRequired,oneThatIsCreatingARelationWithAnother:a().string.isRequired,relationType:a().string,target:a().string};const Io=Yt,Jn=({formErrors:e,mainBoxHeader:t,modifiedData:n,naturePickerType:o,onChange:s})=>{const l=(0,Kt.Z)(n.relation,n.targetAttribute);return r.createElement(K.Flex,{style:{position:"relative"}},r.createElement(Xn,{isMain:!0,header:t,error:(e==null?void 0:e.name)||null,name:"name",onChange:s,value:(n==null?void 0:n.name)||""}),r.createElement(Io,{naturePickerType:o,oneThatIsCreatingARelationWithAnother:t,relationType:l,target:n.target}),r.createElement(Xn,{disabled:["oneWay","manyWay"].includes(l),error:(e==null?void 0:e.targetAttribute)||null,name:"targetAttribute",onChange:s,oneThatIsCreatingARelationWithAnother:t,target:n.target,value:(n==null?void 0:n.targetAttribute)||""}))};Jn.propTypes={formErrors:a().object.isRequired,mainBoxHeader:a().string.isRequired,modifiedData:a().object.isRequired,naturePickerType:a().string.isRequired,onChange:a().func.isRequired};const Zo=Jn;var Qn=i(45251),Fo=Object.defineProperty,ea=Object.getOwnPropertySymbols,wo=Object.prototype.hasOwnProperty,Lo=Object.prototype.propertyIsEnumerable,ta=(e,t,n)=>t in e?Fo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Bo=(e,t)=>{for(var n in t||(t={}))wo.call(t,n)&&ta(e,n,t[n]);if(ea)for(var n of ea(t))Lo.call(t,n)&&ta(e,n,t[n]);return e};const Jt=({description:e,error:t,intlLabel:n,modifiedData:o,name:s,onChange:l,value:c})=>{const{formatMessage:u}=(0,F.useIntl)(),p=(0,r.useRef)(l),m=(o==null?void 0:o.displayName)||"";(0,r.useEffect)(()=>{if(m){const v=(0,Qn.Z)(m);try{const C=Xt()(v,2);p.current({target:{name:s,value:C}})}catch(C){p.current({target:{name:s,value:v}})}}else p.current({target:{name:s,value:""}})},[m,s]);const g=t?u({id:t,defaultMessage:t}):"",f=e?u({id:e.id,defaultMessage:e.defaultMessage},Bo({},e.values)):"",y=u(n);return r.createElement($t.TextInput,{error:g,label:y,id:s,hint:f,name:s,onChange:l,value:c||""})};Jt.defaultProps={description:null,error:null,value:null},Jt.propTypes={description:a().shape({id:a().string.isRequired,defaultMessage:a().string.isRequired,values:a().object}),error:a().string,intlLabel:a().shape({id:a().string.isRequired,defaultMessage:a().string.isRequired,values:a().object}).isRequired,modifiedData:a().object.isRequired,name:a().string.isRequired,onChange:a().func.isRequired,value:a().string};const qo=Jt;var na=i(14715);const Qt=({error:e,intlLabel:t,name:n,onChange:o,value:s})=>{const{formatMessage:l}=(0,F.useIntl)(),{allComponentsCategories:c}=(0,Ce.Z)(),[u,p]=(0,r.useState)(c),m=e?l({id:e,defaultMessage:e}):"",g=l(t),f=v=>{o({target:{name:n,value:v,type:"select-category"}})},y=v=>{p(C=>[...C,v]),f(v)};return r.createElement(na.CreatableCombobox,{error:m,id:n,label:g,name:n,onChange:f,onCreateOption:y,value:s},u.map(v=>r.createElement(na.ComboboxOption,{key:v,value:v},v)))};Qt.defaultProps={error:null,value:null},Qt.propTypes={error:a().string,intlLabel:a().shape({id:a().string.isRequired,defaultMessage:a().string.isRequired,values:a().object}).isRequired,name:a().string.isRequired,onChange:a().func.isRequired,value:a().string};const ko=Qt,en=({error:e,intlLabel:t,isAddingAComponentToAnotherComponent:n,isCreating:o,isCreatingComponentWhileAddingAField:s,componentToCreate:l,name:c,onChange:u,targetUid:p,forTarget:m,value:g})=>{const{formatMessage:f}=(0,F.useIntl)(),y=e?f({id:e,defaultMessage:e}):"",v=f(t),{componentsGroupedByCategory:C,componentsThatHaveOtherComponentInTheirAttributes:E}=(0,Ce.Z)(),N=["component","components"].includes(m);let P=Object.entries(C).reduce((R,Z)=>{const[U,L]=Z,G=L.map(A=>({uid:A.uid,label:A.schema.displayName,categoryName:U}));return[...R,...G]},[]);return n&&(P=P.filter(R=>!E.includes(R.uid))),N&&(P=P.filter(R=>R.uid!==p)),s&&(P=[{uid:g,label:l.displayName,categoryName:l.category}]),r.createElement(oe.Select,{disabled:s||!o,error:y,label:v,id:c,name:c,onChange:R=>{u({target:{name:c,value:R,type:"select-category"}})},value:g||""},P.map(R=>r.createElement(oe.Option,{key:R.uid,value:R.uid},`${R.categoryName} - ${R.label}`)))};en.defaultProps={componentToCreate:null,error:null},en.propTypes={componentToCreate:a().object,forTarget:a().string.isRequired,error:a().string,intlLabel:a().shape({id:a().string.isRequired,defaultMessage:a().string.isRequired,values:a().object}).isRequired,isAddingAComponentToAnotherComponent:a().bool.isRequired,isCreating:a().bool.isRequired,isCreatingComponentWhileAddingAField:a().bool.isRequired,name:a().string.isRequired,onChange:a().func.isRequired,targetUid:a().string.isRequired,value:a().string.isRequired};const jo=en,tn=(e,t)=>e.find(({name:n})=>n===t),aa=({dynamicZoneTarget:e,intlLabel:t,name:n,onChange:o,value:s})=>{const{formatMessage:l}=(0,F.useIntl)(),{componentsGroupedByCategory:c,modifiedData:u}=(0,Ce.Z)(),m=(tn(u.contentType.schema.attributes,e)||{}).components||[],g=Object.keys(c).reduce((v,C)=>{const E=c[C].filter(({uid:N})=>!m.includes(N));return E.length>0&&(v[C]=E),v},{}),f=Object.entries(g).reduce((v,C)=>{const[E,N]=C,P={label:E,children:N.map(({uid:R,schema:{displayName:Z}})=>({label:Z,value:R}))};return v.push(P),v},[]),y=l({id:(0,d.Z)("components.SelectComponents.displayed-value"),defaultMessage:"{number, plural, =0 {# components} one {# component} other {# components}} selected"},{number:s.length});return r.createElement(oe.MultiSelectNested,{id:"select1",label:l(t),customizeContent:()=>y,name:n,onChange:v=>{o({target:{name:n,value:v,type:"select-components"}})},options:f,value:s||[]})};aa.propTypes={intlLabel:a().shape({id:a().string.isRequired,defaultMessage:a().string.isRequired,values:a().object}).isRequired,dynamicZoneTarget:a().string.isRequired,name:a().string.isRequired,onChange:a().func.isRequired,value:a().array.isRequired};const _o=aa,nn=({intlLabel:e,error:t,modifiedData:n,name:o,onChange:s,options:l,value:c})=>{const{formatMessage:u}=(0,F.useIntl)(),p=u(e),m=t?u({id:t,defaultMessage:t}):"",g=f=>{s({target:{name:o,value:f,type:"select"}}),!!c&&n.default!==void 0&&n.default!==null&&s({target:{name:"default",value:null}})};return r.createElement(oe.Select,{error:m,label:p,id:o,name:o,onChange:g,value:c||""},l.map(({metadatas:{intlLabel:f,disabled:y,hidden:v},key:C,value:E})=>r.createElement(oe.Option,{key:C,value:E,disabled:y,hidden:v},u({id:f.id,defaultMessage:f.defaultMessage},f.values))))};nn.defaultProps={error:void 0,value:""},nn.propTypes={error:a().string,intlLabel:a().shape({id:a().string.isRequired,defaultMessage:a().string.isRequired,values:a().object}).isRequired,modifiedData:a().object.isRequired,name:a().string.isRequired,onChange:a().func.isRequired,options:a().arrayOf(a().shape({metadatas:a().shape({intlLabel:a().shape({id:a().string.isRequired,defaultMessage:a().string.isRequired}).isRequired,disabled:a().bool,hidden:a().bool}).isRequired,key:a().oneOfType([a().string,a().number]).isRequired,value:a().oneOfType([a().string,a().number]).isRequired}).isRequired).isRequired,value:a().string};const Uo=nn,an=({intlLabel:e,error:t,modifiedData:n,name:o,onChange:s,options:l,value:c})=>{const{formatMessage:u}=(0,F.useIntl)(),p=u(e),m=t?u({id:t,defaultMessage:t}):"",g=f=>{s({target:{name:o,value:f,type:"select"}}),c&&(f==="biginteger"&&c!=="biginteger"&&(n.default!==void 0&&n.default!==null&&s({target:{name:"default",value:null}}),n.max!==void 0&&n.max!==null&&s({target:{name:"max",value:null}}),n.min!==void 0&&n.min!==null&&s({target:{name:"min",value:null}})),["decimal","float","integer"].includes(f)&&c==="biginteger"&&(n.default!==void 0&&n.default!==null&&s({target:{name:"default",value:null}}),n.max!==void 0&&n.max!==null&&s({target:{name:"max",value:null}}),n.min!==void 0&&n.min!==null&&s({target:{name:"min",value:null}})))};return r.createElement(oe.Select,{error:m,label:p,id:o,name:o,onChange:g,value:c||""},l.map(({metadatas:{intlLabel:f,disabled:y,hidden:v},key:C,value:E})=>r.createElement(oe.Option,{key:C,value:E,disabled:y,hidden:v},u(f))))};an.defaultProps={error:void 0,value:""},an.propTypes={error:a().string,intlLabel:a().shape({id:a().string.isRequired,defaultMessage:a().string.isRequired,values:a().object}).isRequired,modifiedData:a().object.isRequired,name:a().string.isRequired,onChange:a().func.isRequired,options:a().arrayOf(a().shape({metadatas:a().shape({intlLabel:a().shape({id:a().string.isRequired,defaultMessage:a().string.isRequired}).isRequired,disabled:a().bool,hidden:a().bool}).isRequired,key:a().oneOfType([a().string,a().number]).isRequired,value:a().oneOfType([a().string,a().number]).isRequired}).isRequired).isRequired,value:a().string};const Wo=an;var $o=Object.defineProperty,ra=Object.getOwnPropertySymbols,zo=Object.prototype.hasOwnProperty,Vo=Object.prototype.propertyIsEnumerable,oa=(e,t,n)=>t in e?$o(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ko=(e,t)=>{for(var n in t||(t={}))zo.call(t,n)&&oa(e,n,t[n]);if(ra)for(var n of ra(t))Vo.call(t,n)&&oa(e,n,t[n]);return e};const rn=({description:e,error:t,intlLabel:n,modifiedData:o,name:s,onChange:l,value:c})=>{const{formatMessage:u}=(0,F.useIntl)(),p=(0,r.useRef)(l),m=(o==null?void 0:o.displayName)||"";(0,r.useEffect)(()=>{m?p.current({target:{name:s,value:(0,Qn.Z)(m)}}):p.current({target:{name:s,value:""}})},[m,s]);const g=t?u({id:t,defaultMessage:t}):"",f=e?u({id:e.id,defaultMessage:e.defaultMessage},Ko({},e.values)):"",y=u(n);return r.createElement($t.TextInput,{error:g,label:y,id:s,hint:f,name:s,onChange:l,value:c||""})};rn.defaultProps={description:null,error:null,value:null},rn.propTypes={description:a().shape({id:a().string.isRequired,defaultMessage:a().string.isRequired,values:a().object}),error:a().string,intlLabel:a().shape({id:a().string.isRequired,defaultMessage:a().string.isRequired,values:a().object}).isRequired,modifiedData:a().object.isRequired,name:a().string.isRequired,onChange:a().func.isRequired,value:a().string};const Go=rn;var Ho=Object.defineProperty,Xo=Object.defineProperties,Yo=Object.getOwnPropertyDescriptors,sa=Object.getOwnPropertySymbols,Jo=Object.prototype.hasOwnProperty,Qo=Object.prototype.propertyIsEnumerable,ia=(e,t,n)=>t in e?Ho(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,la=(e,t)=>{for(var n in t||(t={}))Jo.call(t,n)&&ia(e,n,t[n]);if(sa)for(var n of sa(t))Qo.call(t,n)&&ia(e,n,t[n]);return e},es=(e,t)=>Xo(e,Yo(t));const ca=({form:e,formErrors:t,genericInputProps:n,modifiedData:o,onChange:s})=>{const{formatMessage:l}=(0,F.useIntl)();return e.map((c,u)=>c.items.length===0?null:r.createElement($.Box,{key:u},c.sectionTitle&&r.createElement($.Box,{paddingBottom:4},r.createElement(V.Typography,{variant:"delta",as:"h3"},l(c.sectionTitle))),r.createElement(ke.Grid,{gap:4},c.items.map((p,m)=>{const g=`${u}.${m}`,f=I()(o,p.name,""),y=Object.keys(t).find(C=>C===p.name),v=y?t[y].id:I()(t,[...p.name.split(".").filter(C=>C!=="componentToCreate"),"id"],null);return p.type==="pushRight"?r.createElement(ke.GridItem,{col:p.size||6,key:p.name||g},r.createElement("div",null)):r.createElement(ke.GridItem,{col:p.size||6,key:p.name||g},r.createElement(O.GenericInput,es(la(la({},p),n),{error:v,onChange:s,value:f})))}))))};ca.propTypes={form:a().arrayOf(a().object).isRequired,formErrors:a().object.isRequired,genericInputProps:a().object.isRequired,modifiedData:a().object.isRequired,onChange:a().func.isRequired};const ua=ca;var ts=i(90353),ns=Object.defineProperty,da=Object.getOwnPropertySymbols,as=Object.prototype.hasOwnProperty,rs=Object.prototype.propertyIsEnumerable,ma=(e,t,n)=>t in e?ns(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pa=(e,t)=>{for(var n in t||(t={}))as.call(t,n)&&ma(e,n,t[n]);if(da)for(var n of da(t))rs.call(t,n)&&ma(e,n,t[n]);return e};const on=({description:e,disabled:t,error:n,intlLabel:o,labelAction:s,name:l,onChange:c,placeholder:u,value:p})=>{const{formatMessage:m}=(0,F.useIntl)(),g=n?m({id:n,defaultMessage:n}):"",f=e?m({id:e.id,defaultMessage:e.defaultMessage},pa({},e.values)):"",y=m(o),v=u?m({id:u.id,defaultMessage:u.defaultMessage},pa({},u.values)):"",C=Array.isArray(p)?p.join(`
138
- `):"",E=N=>{const P=N.target.value.split(`
139
- `);c({target:{name:l,value:P}})};return r.createElement(ts.Textarea,{disabled:t,error:g,label:y,labelAction:s,id:l,hint:f,name:l,onChange:E,placeholder:v,value:C},C)};on.defaultProps={description:null,disabled:!1,error:"",labelAction:void 0,placeholder:null,value:""},on.propTypes={description:a().shape({id:a().string.isRequired,defaultMessage:a().string.isRequired,values:a().object}),disabled:a().bool,error:a().string,intlLabel:a().shape({id:a().string.isRequired,defaultMessage:a().string.isRequired,values:a().object}).isRequired,labelAction:a().element,name:a().string.isRequired,onChange:a().func.isRequired,placeholder:a().shape({id:a().string.isRequired,defaultMessage:a().string.isRequired,values:a().object}),value:a().oneOfType([a().array,a().string])};const os=on,ss=(e,t)=>{const n=I()(e,["contentType","schema","kind"],"");return n==="singleType"||n===t.kind?!0:I()(e,["contentType","schema","attributes"],[]).filter(({relation:l,type:c,targetAttribute:u})=>{const p=(0,Kt.Z)(l,u);return c==="relation"&&!["oneWay","manyWay"].includes(p)}).length===0},is=(e="",t,n)=>{const o=["text","email","richtext","password","number","enumeration","date","media","boolean","json","relation"],s=e==="contentType",l=n.includes(t),c=!s&&!l;return s?[[...o,"uid"],["component","dynamiczone"]]:c?[o,["component"]]:[o]},ls=({modalType:e,forTarget:t,kind:n,actionType:o,step:s})=>{switch(e){case"chooseAttribute":return(0,d.Z)(`modalForm.sub-header.chooseAttribute.${t.includes("component")?"component":n||"collectionType"}`);case"attribute":return(0,d.Z)(`modalForm.sub-header.attribute.${o}${s!=="null"&&s!==null&&o!=="edit"?".step":""}`);case"addComponentToDynamicZone":return(0,d.Z)("modalForm.sub-header.addComponentToDynamicZone");default:return(0,d.Z)("configurations")}},ga=e=>e.reduce((t,n)=>{const o=n.items.reduce((s,l)=>(l.name&&s.push(l.name),s),[]);return[...t,...o]},[]);var T=i(5173),Ke=i(2158);const cs={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"}}]}]}},fa=new RegExp("^[A-Za-z][-_0-9A-Za-z]*$"),us=e=>{const t={name:T.Z_().matches(fa,O.translatedErrors.regex).test({name:"nameNotAllowed",message:O.translatedErrors.unique,test:n=>n?!e.includes((0,D.toLower)(n)):!1}).required(O.translatedErrors.required)};return T.Ry(t)},ds=(e,t,n)=>{const o={displayName:T.Z_().test({name:"nameAlreadyUsed",message:O.translatedErrors.unique,test:s=>{if(!s)return!1;const l=(0,Ke.N)(s,n);return!e.includes(l)}}).test({name:"nameNotAllowed",message:(0,d.Z)("error.contentTypeName.reserved-name"),test:s=>s?!t.includes((0,D.toLower)((0,D.trim)(s))):!1}).required(O.translatedErrors.required),category:T.Z_().matches(fa,O.translatedErrors.regex).required(O.translatedErrors.required),icon:T.Z_()};return T.Ry(o)},sn={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}]},Ge={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"}}]},{sectionTitle:null,items:[{name:`${e}icon`,type:"component-icon-picker",size:12,intlLabel:{id:(0,d.Z)("modalForm.components.icon.label"),defaultMessage:"Icon"}}]}]},advanced(){return[]}},M={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"}}};var ms=Object.defineProperty,ps=Object.defineProperties,gs=Object.getOwnPropertyDescriptors,ya=Object.getOwnPropertySymbols,fs=Object.prototype.hasOwnProperty,ys=Object.prototype.propertyIsEnumerable,ha=(e,t,n)=>t in e?ms(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ln=(e,t)=>{for(var n in t||(t={}))fs.call(t,n)&&ha(e,n,t[n]);if(ya)for(var n of ya(t))ys.call(t,n)&&ha(e,n,t[n]);return e},cn=(e,t)=>ps(e,gs(t));const hs={boolean:()=>({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:[M.required,M.private]}]}),component:({repeatable:e},t)=>t==="1"?{sections:Ge.advanced("componentToCreate")}:e?{sections:[{sectionTitle:{id:"global.settings",defaultMessage:"Settings"},items:[M.required,M.private,M.max,M.min]}]}:{sections:[{sectionTitle:{id:"global.settings",defaultMessage:"Settings"},items:[M.required,M.private]}]},date:({type:e})=>({sections:[{sectionTitle:null,items:[cn(ln({},M.default),{type:e||"date",value:null,withDefaultValue:!1,disabled:!e,autoFocus:!1})]},{sectionTitle:{id:"global.settings",defaultMessage:"Settings"},items:[M.required,M.unique,M.private]}]}),dynamiczone:()=>({sections:[{sectionTitle:{id:"global.settings",defaultMessage:"Settings"},items:[M.required,M.max,M.min]}]}),email:()=>({sections:[{sectionTitle:null,items:[cn(ln({},M.default),{type:"email"})]},{sectionTitle:{id:"global.settings",defaultMessage:"Settings"},items:[M.required,M.unique,M.maxLength,M.minLength,M.private]}]}),enumeration:e=>({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,n)=>e.enum.indexOf(t)===n&&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:[M.required,M.private]}]}),json:()=>({sections:[{sectionTitle:{id:"global.settings",defaultMessage:"Settings"},items:[M.required,M.private]}]}),media:()=>({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:[M.required,M.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:[M.required,M.unique,M.max,M.min,M.private]}]}},password:()=>({sections:[{sectionTitle:null,items:[M.default]},{sectionTitle:{id:"global.settings",defaultMessage:"Settings"},items:[M.required,M.maxLength,M.minLength,M.private]}]}),relation:()=>({sections:[{sectionTitle:{id:"global.settings",defaultMessage:"Settings"},items:[M.private]}]}),richtext:()=>({sections:[{sectionTitle:null,items:[M.default]},{sectionTitle:{id:"global.settings",defaultMessage:"Settings"},items:[M.required,M.maxLength,M.minLength,M.private]}]}),text:()=>({sections:[{sectionTitle:null,items:[M.default,M.regex]},{sectionTitle:{id:"global.settings",defaultMessage:"Settings"},items:[M.required,M.unique,M.maxLength,M.minLength,M.private]}]}),uid:e=>({sections:[{sectionTitle:null,items:[cn(ln({},M.default),{disabled:Boolean(e.targetField),type:"text"})]},{sectionTitle:{id:"global.settings",defaultMessage:"Settings"},items:[M.required,M.maxLength,M.minLength,M.private]}]})},Ne={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 bs=Object.defineProperty,vs=Object.defineProperties,Ts=Object.getOwnPropertyDescriptors,ba=Object.getOwnPropertySymbols,Cs=Object.prototype.hasOwnProperty,Es=Object.prototype.propertyIsEnumerable,va=(e,t,n)=>t in e?bs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ms=(e,t)=>{for(var n in t||(t={}))Cs.call(t,n)&&va(e,n,t[n]);if(ba)for(var n of ba(t))Es.call(t,n)&&va(e,n,t[n]);return e},Ps=(e,t)=>vs(e,Ts(t));const Ta={advanced:hs,base:{component:(e,t)=>{if(t==="1"){const n=e.createComponent===!0?Ge.base("componentToCreate."):[];return{sections:[{sectionTitle:null,items:[sn]},...n]}}return{sections:[{sectionTitle:null,items:[Ne,{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:()=>({sections:[{sectionTitle:null,items:[Ne,{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:()=>({sections:[{sectionTitle:null,items:[Ne]},{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:
140
- morning
141
- noon
142
- evening`},validations:{required:!0}}]}]}),media:()=>({sections:[{sectionTitle:null,items:[Ne]},{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:()=>({sections:[{sectionTitle:null,items:[Ne,{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:()=>({sections:[{sectionTitle:null,items:[{intlLabel:{id:"FIXME",defaultMessage:"FIXME"},name:"relation",size:12,type:"relation"}]}]}),string:()=>({sections:[{sectionTitle:null,items:[Ne]},{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:()=>({sections:[{sectionTitle:null,items:[Ne]},{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,n)=>{const o=n.filter(({type:s})=>["string","text"].includes(s)).map(({name:s})=>({key:s,value:s,metadatas:{intlLabel:{id:`${s}.no-override`,defaultMessage:s}}}));return{sections:[{sectionTitle:null,items:[Ps(Ms({},Ne),{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"}}},...o]}]}]}}}},Os={sections:[{sectionTitle:null,items:[Ne]}]};var Rs=i(91815),xs=i.n(Rs),Ss=i(40791),As=i.n(Ss);const un=e=>As()(e,{decamelize:!1,lowercase:!1,separator:"_"}),Ca=new RegExp("^[A-Za-z][_0-9A-Za-z]*$"),Ea=e=>({name:"attributeNameAlreadyUsed",message:O.translatedErrors.unique,test:t=>t?!e.includes(t):!1}),Cl=(e,t,n)=>{const o=get(e,["schema","attributes"],{});return Object.keys(o).filter(s=>t?s!==n:!0)},dn=e=>({name:"forbiddenAttributeName",message:(0,d.Z)("error.attributeName.reserved-name"),test:t=>t?!e.includes(t):!1}),h={default:()=>T.Z_().nullable(),max:()=>T.Rx().integer().nullable(),min:()=>T.Rx().integer().when("max",(e,t)=>e?t.max(e,(0,d.Z)("error.validation.minSupMax")):t).nullable(),maxLength:()=>T.Rx().integer().positive((0,d.Z)("error.validation.positive")).nullable(),minLength:()=>T.Rx().integer().min(0).when("maxLength",(e,t)=>e?t.max(e,(0,d.Z)("error.validation.minSupMax")):t).nullable(),name:(e,t)=>T.Z_().test(Ea(e)).test(dn(t)).matches(Ca,O.translatedErrors.regex).required(O.translatedErrors.required),required:()=>T.O7(),type:()=>T.Z_().required(O.translatedErrors.required),unique:()=>T.O7().nullable()},mn=(e,t)=>({name:h.name(e,t),type:h.type(),default:h.default(),unique:h.unique(),required:h.required(),maxLength:h.maxLength(),minLength:h.minLength(),regex:T.Z_().test({name:"isValidRegExpPattern",message:(0,d.Z)("error.validation.regex"),test:o=>new RegExp(o)!==null}).nullable()}),pn={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,D.toNumber)(e))?!0:(0,D.toNumber)(t)>=(0,D.toNumber)(e)}},Ma={date:(e,t)=>{const n={name:h.name(e,t),type:h.type()};return T.Ry(n)},datetime:(e,t)=>{const n={name:h.name(e,t),type:h.type()};return T.Ry(n)},time:(e,t)=>{const n={name:h.name(e,t),type:h.type()};return T.Ry(n)},default:(e,t)=>{const n={name:h.name(e,t),type:h.type()};return T.Ry(n)},biginteger:(e,t)=>{const n={name:h.name(e,t),type:h.type(),default:T.Z_().nullable().matches(/^-?\d*$/),unique:h.unique(),required:h.required(),max:T.Z_().nullable().matches(/^-?\d*$/,O.translatedErrors.regex),min:T.Z_().nullable().test(pn).matches(/^-?\d*$/,O.translatedErrors.regex)};return T.Ry(n)},boolean:(e,t)=>{const n={name:h.name(e,t),default:T.O7().nullable(),required:h.required(),unique:h.unique()};return T.Ry(n)},component:(e,t)=>{const n={name:h.name(e,t),type:h.type(),required:h.required(),max:h.max(),min:h.min(),component:T.Z_().required(O.translatedErrors.required)};return T.Ry(n)},decimal:(e,t)=>{const n={name:h.name(e,t),type:h.type(),default:T.Rx(),required:h.required(),max:T.Rx(),min:T.Rx().test(pn)};return T.Ry(n)},dynamiczone:(e,t)=>{const n={name:h.name(e,t),type:h.type(),required:h.required(),max:h.max(),min:h.min()};return T.Ry(n)},email:(e,t)=>{const n={name:h.name(e,t),type:h.type(),default:T.Z_().email().nullable(),unique:h.unique(),required:h.required(),maxLength:h.maxLength(),minLength:h.minLength()};return T.Ry(n)},enumeration:(e,t)=>{const n=new RegExp("^[_A-Za-z][_0-9A-Za-z]*$"),o={name:T.Z_().test(Ea(e)).test(dn(t)).matches(n,O.translatedErrors.regex).required(O.translatedErrors.required),type:h.type(),default:h.default(),unique:h.unique(),required:h.required(),enum:T.IX().of(T.Z_()).min(1,O.translatedErrors.min).test({name:"areEnumValuesUnique",message:(0,d.Z)("error.validation.enum-duplicate"),test(s){return!xs()(s.map(un).filter((c,u,p)=>p.indexOf(c)!==u)).length}}).test({name:"doesNotHaveEmptyValues",message:(0,d.Z)("error.validation.enum-empty-string"),test:s=>!s.map(un).some(l=>l==="")}).test({name:"doesMatchRegex",message:(0,d.Z)("error.validation.enum-regex"),test:s=>s.map(un).every(l=>n.test(l))}),enumName:T.Z_().nullable()};return T.Ry(o)},float:(e,t)=>{const n={name:h.name(e,t),type:h.type(),required:h.required(),default:T.Rx(),max:T.Rx(),min:T.Rx().test(pn)};return T.Ry(n)},integer:(e,t)=>{const n={name:h.name(e,t),type:h.type(),default:T.Rx().integer(),unique:h.unique(),required:h.required(),max:h.max(),min:h.min()};return T.Ry(n)},json:(e,t)=>{const n={name:h.name(e,t),type:h.type(),required:h.required(),unique:h.unique()};return T.Ry(n)},media:(e,t)=>{const n={name:h.name(e,t),type:h.type(),multiple:T.O7(),required:h.required(),allowedTypes:T.IX().of(T.Z_().oneOf(["images","videos","files","audios"])).min(1).nullable()};return T.Ry(n)},password:(e,t)=>{const n={name:h.name(e,t),type:h.type(),default:h.default(),unique:h.unique(),required:h.required(),maxLength:h.maxLength(),minLength:h.minLength()};return T.Ry(n)},relation:(e,t,n,{initialData:o,modifiedData:s})=>{const l={name:h.name(e,t),target:T.Z_().required(O.translatedErrors.required),relation:T.Z_().required(),type:T.Z_().required(),targetAttribute:T.Vo(()=>{const c=(0,Kt.Z)(s.relation,s.targetAttribute);if(c==="oneWay"||c==="manyWay")return T.Z_().nullable();let u=T.Z_().test(dn(t)),m=[...n.map(({name:g})=>g),s.name].filter(g=>g!==o.targetAttribute);return u.matches(Ca,O.translatedErrors.regex).test({name:"forbiddenTargetAttributeName",message:(0,d.Z)("error.validation.relation.targetAttribute-taken"),test:g=>g?!m.includes(g):!1}).required(O.translatedErrors.required)})};return T.Ry(l)},richtext:(e,t)=>{const n={name:h.name(e,t),type:h.type(),default:h.default(),unique:h.unique(),required:h.required(),maxLength:h.maxLength(),minLength:h.minLength()};return T.Ry(n)},string:(e,t)=>{const n=mn(e,t);return T.Ry(n)},text:(e,t)=>{const n=mn(e,t);return T.Ry(n)},uid:(e,t)=>{const n=mn(e,t);return T.Ry(n)}},Pa={name:"displayName",type:"text",intlLabel:{id:(0,d.Z)("contentType.displayName.label"),defaultMessage:"Display name"}},gn={advanced:{default:()=>({sections:[{sectionTitle:{id:(0,d.Z)("form.contentType.divider.draft-publish"),defaultMessage:"Draft/Publish"},items:[{intlLabel:{id:(0,d.Z)("contentType.draftAndPublish.label"),defaultMessage:"Draft/publish system"},description:{id:(0,d.Z)("contentType.draftAndPublish.description"),defaultMessage:"Write a draft version of each entry before publishing it"},name:"draftAndPublish",type:"toggle-draft-publish",validations:{}}]}]})},base:{create:()=>({sections:[{sectionTitle:null,items:[Pa,{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:()=>({sections:[{sectionTitle:null,items:[Pa,{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"}]}]}]})}},Ds=(e,t,n,o)=>{const s={displayName:T.Z_().test({name:"nameAlreadyUsed",message:O.translatedErrors.unique,test:l=>{if(!l)return!1;const c=(0,Ke.E)(l);return!e.includes(c)}}).test({name:"nameNotAllowed",message:(0,d.Z)("error.contentTypeName.reserved-name"),test:l=>l?!t.includes((0,D.toLower)((0,D.trim)(l))):!1}).required(O.translatedErrors.required),pluralName:T.Z_().test({name:"pluralNameAlreadyUsed",message:O.translatedErrors.unique,test:l=>l?!o.includes(l):!1}).test({name:"pluralAndSingularAreUnique",message:(0,d.Z)("error.contentType.pluralName-used"),test:(l,c)=>l?c.parent.singularName!==l:!1}).required(O.translatedErrors.required),singularName:T.Z_().test({name:"singularNameAlreadyUsed",message:O.translatedErrors.unique,test:l=>l?!n.includes(l):!1}).test({name:"pluralAndSingularAreUnique",message:(0,d.Z)("error.contentType.singularName-used"),test:(l,c)=>l?c.parent.pluralName!==l:!1}).required(O.translatedErrors.required),draftAndPublish:T.O7(),kind:T.Z_().oneOf(["singleType","collectionType"])};return T.Ry(s)},fn={advanced:{default:()=>({sections:Ge.advanced("componentToCreate.")})},base:{createComponent:()=>({sections:[{sectionTitle:null,items:[sn]},...Ge.base("componentToCreate.")]}),default:()=>({sections:[{sectionTitle:null,items:[sn]},{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}]}]})}};var Oa=i(98399),Ns=Object.defineProperty,Is=Object.defineProperties,Zs=Object.getOwnPropertyDescriptors,ht=Object.getOwnPropertySymbols,Ra=Object.prototype.hasOwnProperty,xa=Object.prototype.propertyIsEnumerable,Sa=(e,t,n)=>t in e?Ns(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Aa=(e,t)=>{for(var n in t||(t={}))Ra.call(t,n)&&Sa(e,n,t[n]);if(ht)for(var n of ht(t))xa.call(t,n)&&Sa(e,n,t[n]);return e},Fs=(e,t)=>Is(e,Zs(t)),Da=(e,t)=>{var n={};for(var o in e)Ra.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&ht)for(var o of ht(e))t.indexOf(o)<0&&xa.call(e,o)&&(n[o]=e[o]);return n};const je={attribute:{schema(e,t,n,o,s,l){const u=I()(e,["schema","attributes"],[]).filter(({name:p})=>p!==s.initialData.name).map(({name:p})=>p);try{let p=Ma[t](u,n.attributes,o,s);return l.makeValidator(["attribute",t],p,u,n.attributes,o,s)}catch(p){return Oa.error("Error yup build schema",p),Ma.default(u,n.attributes)}},form:{advanced(e){var t=e,{data:n,type:o,step:s,extensions:l}=t,c=Da(t,["data","type","step","extensions"]);try{const u=Ta.advanced[o](n,s).sections,p=l.getAdvancedForm(["attribute",o],Aa({data:n,type:o,step:s},c));return{sections:u.reduce((g,f)=>(f.sectionTitle===null?g.push(f):g.push(Fs(Aa({},f),{items:[...f.items,...p]})),g),[])}}catch(u){return Oa.error(u),{sections:[]}}},base({data:e,type:t,step:n,attributes:o}){try{return Ta.base[t](e,n,o)}catch(s){return Os}}}},contentType:{schema(e,t,n,o,s,l){const c=Object.values(l).map(y=>y.schema.singularName),u=Object.values(l).map(y=>y.schema.pluralNames),p=t?e.filter(y=>y!==n):e,m=t?c.filter(y=>I()(l,[n,"schema","singularName"],"")!==y):c,g=t?u.filter(y=>I()(l,[n,"schema","pluralName"],"")!==y):u,f=Ds(p,o.models,m,g);return s.makeValidator(["contentType"],f,p,o.models,m,g)},form:{base({actionType:e}){return e==="create"?gn.base.create():gn.base.edit()},advanced(e){var t=e,{extensions:n}=t,o=Da(t,["extensions"]);const s=gn.advanced.default(o).sections,l=n.getAdvancedForm(["contentType"]);return{sections:[...s,{sectionTitle:{id:"global.settings",defaultMessage:"Settings"},items:l}]}}}},component:{schema(e,t,n,o=!1,s=null){const l=o?e.filter(c=>c!==s):e;return ds(l,n.models,t)},form:{advanced(){return{sections:Ge.advanced()}},base(){return{sections:Ge.base()}}}},addComponentToDynamicZone:{form:{advanced(){return fn.advanced.default()},base({data:e}){return I()(e,"createComponent",!1)?fn.base.createComponent():fn.base.default()}}},editCategory:{schema(e,t){const n=e.filter(o=>o!==t.name).map(o=>qe()(o));return us(n)},form:{advanced:()=>({sections:[]}),base(){return cs.base}}}};var Na=i(12463),ws=i(25061);const Ls=()=>e=>e[`${J.Z}_formModal`]||ws.E,Bs=()=>(0,Na.P1)(Ls(),e=>e);var Ia=i(98399),qs=Object.defineProperty,ks=Object.defineProperties,js=Object.getOwnPropertyDescriptors,bt=Object.getOwnPropertySymbols,Za=Object.prototype.hasOwnProperty,Fa=Object.prototype.propertyIsEnumerable,wa=(e,t,n)=>t in e?qs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,at=(e,t)=>{for(var n in t||(t={}))Za.call(t,n)&&wa(e,n,t[n]);if(bt)for(var n of bt(t))Fa.call(t,n)&&wa(e,n,t[n]);return e},yn=(e,t)=>ks(e,js(t)),vt=(e,t)=>{var n={};for(var o in e)Za.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&bt)for(var o of bt(e))t.indexOf(o)<0&&Fa.call(e,o)&&(n[o]=e[o]);return n},La=(e,t,n)=>new Promise((o,s)=>{var l=p=>{try{u(n.next(p))}catch(m){s(m)}},c=p=>{try{u(n.throw(p))}catch(m){s(m)}},u=p=>p.done?o(p.value):Promise.resolve(p.value).then(l,c);u((n=n.apply(e,t)).next())});const _s=()=>{const{onCloseModal:e,onNavigateToChooseAttributeModal:t,onNavigateToAddCompoToDZModal:n,onNavigateToCreateComponentStep2:o,actionType:s,attributeName:l,attributeType:c,categoryName:u,dynamicZoneTarget:p,forTarget:m,modalType:g,isOpen:f,kind:y,step:v,targetUid:C}=(0,$e.Z)(),E=(0,r.useRef)(),N=(0,r.useMemo)(Bs,[]),P=(0,fe.useDispatch)(),R=(0,O.useNotification)(),Z=(0,fe.useSelector)(B=>N(B),fe.shallowEqual),{push:U}=(0,k.useHistory)(),{trackUsage:L}=(0,O.useTracking)(),{formatMessage:G}=(0,F.useIntl)(),{getPlugin:A}=(0,O.useStrapiApp)(),q=A(J.Z).apis.forms,te=q.components.inputs,{addAttribute:Ie,addCreatedComponentToDynamicZone:ge,allComponentsCategories:j,changeDynamicZoneComponents:x,contentTypes:Xe,components:st,createSchema:Ye,deleteCategory:Mn,deleteData:Tt,editCategory:Pn,submitData:On,modifiedData:le,nestedComponents:Rn,setModifiedData:xn,sortedContentTypesList:Sn,updateSchema:Ct,reservedNames:Ue}=(0,Ce.Z)(),{componentToCreate:it,formErrors:Ze,initialData:ce,isCreatingComponentWhileAddingAField:lt,modifiedData:b}=Z,S=m==="contentType"||m==="component"?[m]:[m,C];(0,r.useEffect)(()=>{if(f){const B=Sn.filter(pt);g==="editCategory"&&xn(),s==="edit"&&g==="attribute"&&m==="contentType"&&L("willEditFieldOfContentType");const Be=[...S,"schema","attributes"],Fe=tn(I()(le,Be,[]),p)||null;if(g==="editCategory"&&s==="edit"&&P({type:ee._H,modalType:g,actionType:s,data:{name:u}}),g==="contentType"&&s==="create"&&P({type:ee._H,modalType:g,actionType:s,data:{draftAndPublish:!0},pluginOptions:{}}),g==="contentType"&&s==="edit"){const{displayName:W,draftAndPublish:re,kind:ae,pluginOptions:ue,pluralName:Se,singularName:Oe}=I()(le,[...S,"schema"],{displayName:null,pluginOptions:{},singularName:null,pluralName:null});P({type:ee._H,actionType:s,modalType:g,data:{displayName:W,draftAndPublish:re,kind:ae,pluginOptions:ue,pluralName:Se,singularName:Oe}})}if(g==="component"&&s==="edit"){const W=I()(le,S,{});P({type:ee._H,actionType:s,modalType:g,data:{displayName:W.schema.displayName,category:W.category,icon:W.schema.icon}})}if(g==="addComponentToDynamicZone"&&s==="edit"){const W=yn(at({},Fe),{components:[],name:p,createComponent:!1,componentToCreate:{type:"component"}});P({type:ee.VZ,attributeToEdit:W})}if(c){const W=tn(I()(le,Be,[]),l),re=yn(at({},W),{name:l});c==="component"&&s==="edit"&&(re.repeatable||It()(re,"repeatable",!1)),P({type:ee.S0,attributeType:c,nameToSetForRelation:I()(B,["0","title"],"error"),targetUid:I()(B,["0","uid"],"error"),isEditing:s==="edit",modifiedDataToSetForEditing:re,step:v,forTarget:m})}}else P({type:ee.c2})},[s,l,c,u,p,m,f,g]);const w=g==="contentType",Y=g==="component",ne=g==="attribute",xe=c==="component"&&ne,he=s==="create",be=I()(b,"createComponent",!1)||lt,Me=v==="1",ct=g==="editCategory",rr=g==="chooseAttribute",An=(0,Ke.E)(b.displayName||""),or=I()(le,[...S,"schema","attributes"],null),zi=()=>La(void 0,null,function*(){let B;const Be=be&&v==="1"?I()(b,"componentToCreate",{}):b;if(w)B=je.contentType.schema(Object.keys(Xe),s==="edit",I()(le,[...S,"uid"],null),Ue,q,Xe);else if(Y)B=je.component.schema(Object.keys(st),b.category||"",Ue,s==="edit",I()(le,[...S,"uid"],null),q);else if(xe&&be&&Me)B=je.component.schema(Object.keys(st),I()(b,"componentToCreate.category",""),Ue,q);else if(ne&&!Me){const Fe=c==="relation"?"relation":b.type;let W=[];if(Fe==="relation"){const re=I()(b,["target"],null);W=I()(Xe,[re,"schema","attributes"],[]).filter(({name:ue})=>s!=="edit"?!0:ue!==ce.targetAttribute)}B=je.attribute.schema(I()(le,S,{}),Fe,Ue,W,{modifiedData:b,initialData:ce},q)}else if(ct)B=je.editCategory.schema(j,ce,q);else if(Me&&be)B=je.component.schema(Object.keys(st),I()(b,"componentToCreate.category",""),Ue,q);else return;yield B.validate(Be,{abortEarly:!1})}),sr=(0,r.useCallback)(B=>{var{target:Be}=B,Fe=Be,{name:W,value:re,type:ae}=Fe,ue=vt(Fe,["name","value","type"]);const Se=["enumName","max","min","maxLength","minLength","regex","default"];let Oe;Se.includes(W)&&re===""?Oe=null:Oe=re;const Re=Object.assign({},Ze);W==="max"&&delete Re.min,W==="maxLength"&&delete Re.minLength,delete Re[W],P({type:ee.Ey,errors:Re}),P(at({type:ee.P0,keys:W.split("."),value:Oe},ue))},[P,Ze]),Pe=(B,...Be)=>La(void 0,[B,...Be],function*(Fe,W=he){Fe.preventDefault();try{yield zi(),Ki(W);const re=m==="components"?C:An;if(w)if(he)Ye(yn(at({},b),{kind:y}),g,An),U({pathname:`/plugins/${J.Z}/content-types/${An}`}),t({forTarget:m,targetUid:re});else{ss(le,b)?(e(),On(b)):R({type:"warning",message:{id:"notification.contentType.relations.conflict"}});return}else if(g==="component")if(he){const ae=(0,Ke.N)(b.displayName,b.category),ue=b,{category:Se}=ue,Oe=vt(ue,["category"]);Ye(Oe,"component",ae,Se),U({pathname:`/plugins/${J.Z}/component-categories/${Se}/${ae}`}),t({forTarget:m,targetUid:ae})}else{Ct(b,g,C),e();return}else if(ct){if(qe()(ce.name)===qe()(b.name)){e();return}Pn(ce.name,b);return}else if(ne&&!be){if(c==="dynamiczone"){Ie(b,m,C,s==="edit",ce),he?(P({type:ee.I}),E.current._handlers.setSelectedTabIndex(0),n({dynamicZoneTarget:b.name})):e();return}if(!xe){Ie(b,m,C,s==="edit",ce),W?t({forTarget:m,targetUid:re}):e();return}if(Me){o(),P({type:ee.yC,forTarget:m});return}Ie(b,m,C,s==="edit",ce,!0),W?t({forTarget:m,targetUid:C}):e()}else if(ne&&be){if(Me){L("willCreateComponentFromAttributesModal"),P({type:ee.oF,forTarget:m}),o();return}const ae=it,{category:ue,type:Se}=ae,Oe=vt(ae,["category","type"]),Re=(0,Ke.N)(it.displayName,ue);Ye(Oe,Se,Re,ue,be),Ie(b,m,C,!1),P({type:ee.c2}),W?t({forTarget:"components",targetUid:Re}):e();return}else{if(Me)if(be){const ae=b.componentToCreate,{category:ue,type:Se}=ae,Oe=vt(ae,["category","type"]),Re=(0,Ke.N)(b.componentToCreate.displayName,ue);Ye(Oe,Se,Re,ue,be),ge(p,[Re]),t({forTarget:"components",targetUid:Re})}else x(p,b.components),e();else Ia.error("This case is not handled");return}P({type:ee.c2})}catch(re){const ae=(0,O.getYupInnerErrors)(re);Ia.log({err:re,errors:ae}),P({type:ee.Ey,errors:ae})}}),ir=()=>{e(),P({type:ee.c2})},Vi=B=>{if(B==="advanced"){if(w){L("didSelectContentTypeSettings");return}m==="contentType"&&L("didSelectContentTypeFieldSettings")}},Ki=B=>{g==="attribute"&&m==="contentType"&&c!=="dynamiczone"&&B&&L("willAddMoreFieldToContentType")},Gi=()=>!!(g==="editCategory"||g==="component"||Qe()(b,"createComponent")),Hi=is(m,C,Rn);if(!f||!g)return null;const lr=I()(je,[g,"form"],{advanced:()=>({sections:[]}),base:()=>({sections:[]})}),Xi=m==="components"||m==="component",cr={customInputs:at({"allowed-types-select":dt,"boolean-radio-group":Br,"checkbox-with-number-field":$r,"component-icon-picker":mo,"content-type-radio-group":Yr,"radio-group":Wt,relation:Zo,"select-category":ko,"select-component":jo,"select-components":_o,"select-default-boolean":Sr,"select-number":Wo,"select-date":Uo,"toggle-draft-publish":Tr,"text-plural":qo,"text-singular":Go,"textarea-enum":os},te),componentToCreate:it,dynamicZoneTarget:p,formErrors:Ze,isAddingAComponentToAnotherComponent:Xi,isCreatingComponentWhileAddingAField:lt,mainBoxHeader:I()(le,[...S,"schema","displayName"],""),modifiedData:b,naturePickerType:m,isCreating:he,targetUid:C,forTarget:m},ur=lr.advanced({data:b,type:c,step:v,actionType:s,attributes:or,extensions:q,forTarget:m,contentTypeSchema:le.contentType||{}}).sections,dr=lr.base({data:b,type:c,step:v,actionType:s,attributes:or,extensions:q,forTarget:m,contentTypeSchema:le.contentType||{}}).sections,Yi=ga(dr),Ji=ga(ur),Qi=Object.keys(Ze).some(B=>Yi.includes(B)),el=Object.keys(Ze).some(B=>Ji.includes(B)),tl=I()(Xe,[C,"schema","kind"]);return r.createElement(r.Fragment,null,r.createElement(Le.ModalLayout,{onClose:ir,labelledBy:"title"},r.createElement(Cr,{actionType:s,attributeName:l,categoryName:u,contentTypeKind:y,dynamicZoneTarget:p,modalType:g,forTarget:m,targetUid:C,attributeType:c}),rr&&r.createElement(mr,{attributes:Hi,forTarget:m,kind:tl||"collectionType"}),!rr&&r.createElement("form",{onSubmit:Pe},r.createElement(Le.ModalBody,null,r.createElement(de.TabGroup,{label:"todo",id:"tabs",variant:"simple",ref:E,onTabChange:B=>{B===1&&Vi("advanced")}},r.createElement(K.Flex,{justifyContent:"space-between"},r.createElement(V.Typography,{as:"h2",variant:"beta"},G({id:ls({actionType:s,forTarget:m,kind:y,step:v,modalType:g}),defaultMessage:"Add new field"},{type:Te()(G({id:(0,d.Z)(`attribute.${c}`)})),name:Te()(l),step:v})),r.createElement(de.Tabs,null,r.createElement(de.Tab,{hasError:Qi},G({id:(0,d.Z)("popUpForm.navContainer.base"),defaultMessage:"Basic settings"})),r.createElement(de.Tab,{hasError:el,disabled:Gi()},G({id:(0,d.Z)("popUpForm.navContainer.advanced"),defaultMessage:"Advanced settings"})))),r.createElement(et.Divider,null),r.createElement($.Box,{paddingTop:6},r.createElement(de.TabPanels,null,r.createElement(de.TabPanel,null,r.createElement(me.Stack,{spacing:6},r.createElement(ua,{form:dr,formErrors:Ze,genericInputProps:cr,modifiedData:b,onChange:sr}))),r.createElement(de.TabPanel,null,r.createElement(me.Stack,{spacing:6},r.createElement(ua,{form:ur,formErrors:Ze,genericInputProps:cr,modifiedData:b,onChange:sr}))))))),r.createElement(Le.ModalFooter,{endActions:r.createElement(Mr,{deleteCategory:Mn,deleteContentType:Tt,deleteComponent:Tt,categoryName:ce.name,isAttributeModal:g==="attribute",isComponentToDzModal:g==="addComponentToDynamicZone",isComponentAttribute:c==="component",isComponentModal:g==="component",isContentTypeModal:g==="contentType",isCreatingComponent:s==="create",isCreatingDz:s==="create",isCreatingComponentAttribute:b.createComponent||!1,isCreatingComponentInDz:b.createComponent||!1,isCreatingComponentWhileAddingAField:lt,isCreatingContentType:s==="create",isEditingAttribute:s==="edit",isDzAttribute:c==="dynamiczone",isEditingCategory:g==="editCategory",isInFirstComponentStep:v==="1",onSubmitAddComponentAttribute:Pe,onSubmitAddComponentToDz:Pe,onSubmitCreateComponent:Pe,onSubmitCreateContentType:Pe,onSubmitCreateDz:Pe,onSubmitEditAttribute:Pe,onSubmitEditCategory:Pe,onSubmitEditComponent:Pe,onSubmitEditContentType:Pe,onSubmitEditDz:Pe}),startActions:r.createElement(_.Button,{variant:"tertiary",onClick:ir},G({id:"app.components.Button.cancel",defaultMessage:"Cancel"}))}))))},Ba=e=>e.reduce((t,n)=>(t[n.uid]=n,t),{}),Us=(e,t,n,o)=>{const s=t.reduce((u,p)=>{const m=I()(n,p,{});return u[p]=m,u},{});return{[o?"contentType":"component"]:e,components:s}},Ws=(e,t)=>{const n=Object.keys(e).map(o=>(0,D.get)(e,[o,...t],""));return(0,Ae.Z)(n)};var $s=i(13339);const zs=e=>{const t=Object.keys(e).reduce((n,o)=>{const s=(0,D.get)(e,[o,"schema","attributes"],[]),l=Vs(s);return[...n,...l]},[]);return(0,Ae.Z)(t)},Vs=e=>e.reduce((t,n)=>{const{type:o,component:s}=n;return o==="component"&&t.push(s),t},[]),qa=zs,Ks=e=>{const t=Object.keys(e).reduce((n,o)=>{const s=I()(e,[o],{}),l=s.uid;return Gs(s)&&n.push(l),n},[]);return(0,Ae.Z)(t)},Gs=e=>I()(e,["schema","attributes"],[]).some(n=>{const{type:o}=n;return o==="component"});var ka=Object.getOwnPropertySymbols,Hs=Object.prototype.hasOwnProperty,Xs=Object.prototype.propertyIsEnumerable,Ys=(e,t)=>{var n={};for(var o in e)Hs.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&ka)for(var o of ka(e))t.indexOf(o)<0&&Xs.call(e,o)&&(n[o]=e[o]);return n};const Js=(e,t)=>{const n=Object.keys(e).filter(o=>{const s=(0,D.get)(e,o,{}),l=(0,D.get)(t,o,{}),c=(0,D.get)(s,["isTemporary"],!1),u=!(0,D.isEqual)(s,l);return c||u});return(0,Ae.Z)(n)},Qs=(e,t)=>{const n=_a((0,D.get)(e,"schema.attributes",[]),t),o=(0,D.get)(e,"isTemporary",!1)?{tmpUID:e.uid}:{uid:e.uid};return Object.assign({},o,{category:e.category},(0,D.omit)(e.schema,"attributes"),{attributes:n})},ja=(e,t=!1)=>{const n=(0,D.get)(e,"uid",null),o=_a((0,D.get)(e,"schema.attributes",[]),n),s=t?{category:(0,D.get)(e,"category","")}:{},l=Object.assign(s,(0,D.omit)(e.schema,"attributes"),{attributes:o});return delete l.uid,delete l.isTemporary,delete l.visible,delete l.restrictRelationsTo,l},_a=(e,t)=>e.reduce((n,o)=>{var s=o,{name:l}=s,c=Ys(s,["name"]);const u=c,p=u.target===t,m=u.type==="relation",g=(0,D.get)(u,"targetAttribute",null);if(!p)if(m){const f=Object.assign({},u,{targetAttribute:Ua(g)});n[l]=hn(f)}else n[l]=hn(u);if(p){const f=u.target,y=Object.assign({},u,{target:f,targetAttribute:Ua(g)});n[l]=hn(y)}return n},{}),Ua=e=>e==="-"?null:e,hn=e=>Object.keys(e).reduce((t,n)=>(e[n]!==null&&n!=="plugin"&&(t[n]=e[n]),t),{}),ei=(e,t,n,o=!1)=>Js(e,t).map(c=>{const u=(0,D.get)(e,c,{});return Qs(u,n,o)}),ti=e=>(0,D.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/${J.Z}/content-types/${t}`,kind:e[t].schema.kind,restrictRelationsTo:e[t].schema.restrictRelationsTo})).filter(t=>t!==null),t=>(0,D.camelCase)(t.title)),Wa="did-not-kill-server",ni="server is down";function rt(e,t){return new Promise(n=>{fetch(`${strapi.backendURL}/_health`,{method:"HEAD",mode:"no-cors",headers:{"Content-Type":"application/json","Keep-Alive":!1}}).then(o=>{if(o.status>=400)throw new Error(ni);if(!t)throw new Error(Wa);n(e)}).catch(o=>{setTimeout(()=>rt(e,o.message!==Wa).then(n),100)})})}const ai=e=>Object.values(e.attributes).filter(({type:n})=>n==="dynamiczone").every(({components:n})=>Array.isArray(n)&&n.length>0);var ie=i(31947),ri=i(54370);const oi=()=>e=>e[`${J.Z}_dataManagerProvider`]||ri.E,si=()=>(0,Na.P1)(oi(),e=>e);var ii=Object.defineProperty,li=Object.defineProperties,ci=Object.getOwnPropertyDescriptors,$a=Object.getOwnPropertySymbols,ui=Object.prototype.hasOwnProperty,di=Object.prototype.propertyIsEnumerable,za=(e,t,n)=>t in e?ii(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bn=(e,t)=>{for(var n in t||(t={}))ui.call(t,n)&&za(e,n,t[n]);if($a)for(var n of $a(t))di.call(t,n)&&za(e,n,t[n]);return e},vn=(e,t)=>li(e,ci(t));const mi=e=>Object.keys(e).reduce((t,n)=>{const o=e[n].schema;return t[n]=vn(bn({},e[n]),{schema:vn(bn({},o),{attributes:pi(o.attributes)})}),t},{}),pi=e=>Object.keys(e).reduce((t,n)=>(t.push(vn(bn({},e[n]),{name:n})),t),[]),Va=mi;var ot=i(98399),gi=Object.defineProperty,Ka=Object.getOwnPropertySymbols,fi=Object.prototype.hasOwnProperty,yi=Object.prototype.propertyIsEnumerable,Ga=(e,t,n)=>t in e?gi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ha=(e,t)=>{for(var n in t||(t={}))fi.call(t,n)&&Ga(e,n,t[n]);if(Ka)for(var n of Ka(t))yi.call(t,n)&&Ga(e,n,t[n]);return e},He=(e,t,n)=>new Promise((o,s)=>{var l=p=>{try{u(n.next(p))}catch(m){s(m)}},c=p=>{try{u(n.throw(p))}catch(m){s(m)}},u=p=>p.done?o(p.value):Promise.resolve(p.value).then(l,c);u((n=n.apply(e,t)).next())});const Tn=({allIcons:e,children:t,components:n,contentTypes:o,isLoading:s,isLoadingForDataToBeSet:l,initialData:c,modifiedData:u,reservedNames:p})=>{const m=(0,fe.useDispatch)(),g=(0,O.useNotification)(),{lockAppWithAutoreload:f,unlockAppWithAutoreload:y}=(0,O.useAutoReloadOverlayBlocker)(),{setCurrentStep:v}=(0,O.useGuidedTour)(),{getPlugin:C}=(0,O.useStrapiApp)(),{apis:E}=C(J.Z),{autoReload:N}=(0,O.useAppInfos)(),{formatMessage:P}=(0,F.useIntl)(),{trackUsage:R}=(0,O.useTracking)(),{refetchPermissions:Z}=(0,O.useRBACProvider)(),{pathname:U}=(0,k.useLocation)(),{onCloseModal:L}=(0,$e.Z)(),G=(0,k.useRouteMatch)(`/plugins/${J.Z}/content-types/:uid`),A=(0,k.useRouteMatch)(`/plugins/${J.Z}/component-categories/:categoryUid/:componentUid`),H=(0,r.useRef)();H.current=P;const q=N,te=G!==null,Ie=te?"contentType":"component",ge=te?(0,D.get)(G,"params.uid",null):(0,D.get)(A,"params.componentUid",null),j=(0,r.useRef)(),x=te?"content-types":"components";j.current=()=>He(void 0,null,function*(){try{const[{data:{data:b}},{data:{data:S}},{data:w}]=yield Promise.all(["components","content-types","reserved-names"].map(be=>we.get(be))),Y=Ba(b),ne=Va(Y),xe=Ba(S),he=Va(xe);m({type:ie.Id,components:ne,contentTypes:he,reservedNames:w})}catch(b){ot.error({err:b}),g({type:"warning",message:{id:"notification.error"}})}}),(0,r.useEffect)(()=>(j.current(),()=>{m({type:ie.Zl})}),[]),(0,r.useEffect)(()=>{!s&&ge&&Ct()},[s,U,ge]),(0,r.useEffect)(()=>{N||g({type:"info",message:{id:(0,d.Z)("notification.info.autoreaload-disable")}})},[N,g]);const Xe=(b,S,w,Y=!1,ne,xe=!1)=>{const he=Y?ie.JO:ie.gz;m({type:he,attributeToSet:b,forTarget:S,targetUid:w,initialAttribute:ne,shouldAddComponentToData:xe})},st=(b,S)=>{m({type:ie.Uu,dynamicZoneTarget:b,componentsToAdd:S})},Ye=(b,S,w,Y,ne=!1)=>{const xe=S==="contentType"?ie.Sh:ie.VR;m({type:xe,data:b,componentCategory:Y,schemaType:S,uid:w,shouldAddComponentToData:ne})},Mn=(b,S)=>{m({type:ie.o_,dynamicZoneTarget:b,newComponents:S})},Tt=(b,S,w="")=>{const Y=b==="components"?ie.lw:ie.ai;b==="contentType"&&R("willDeleteFieldOfContentType"),m({type:Y,mainDataKey:b,attributeToRemoveName:S,componentUid:w})},Pn=b=>He(void 0,null,function*(){try{const S=`/component-categories/${b}`,w=window.confirm(P({id:(0,d.Z)("popUpWarning.bodyMessage.category.delete")}));L(),w&&(f(),yield we.delete(S),yield rt(!0),yield y(),yield ce())}catch(S){ot.error({err:S}),g({type:"warning",message:{id:"notification.error"}})}finally{y()}}),On=()=>He(void 0,null,function*(){try{const b=`/${x}/${ge}`,S=(0,D.get)(u,[Ie,"isTemporary"],!1),w=window.confirm(P({id:(0,d.Z)(`popUpWarning.bodyMessage.${te?"contentType":"component"}.delete`)}));if(L(),w){if(S){m({type:ie.Ap});return}f(),yield we.delete(b),yield rt(!0),yield y(),yield ce()}}catch(b){ot.error({err:b}),g({type:"warning",message:{id:"notification.error"}})}finally{y()}}),le=(b,S)=>He(void 0,null,function*(){try{const w=`/component-categories/${b}`;L(),f(),yield we({url:w,method:"PUT",data:S}),yield rt(!0),yield y(),yield ce()}catch(w){ot.error({err:w}),g({type:"warning",message:{id:"notification.error"}})}finally{y()}}),Rn=()=>{const b=Object.assign({},n,u.components);if(!te){const w=(0,D.get)(u,"component",{});(0,D.set)(b,(0,D.get)(w,["uid"],""),w)}const S=Ks(b);return(0,Ae.Z)(S)},xn=()=>{const b=qa(n),S=qa(u.components||{});return(0,Ae.Z)([...S,...b])},Sn=(b,S)=>{m({type:ie.NG,dzName:b,componentToRemoveIndex:S})},Ct=()=>{const b=te?o:n,S=(0,D.get)(b,ge,{schema:{attributes:[]}}),w=(0,$s.Z)(S.schema.attributes,n),Y=Us(S,w,n,te),ne=(0,D.get)(S,"isTemporary",!1)&&(0,D.size)((0,D.get)(S,"schema.attributes",[]))===0;m({type:ie.xx,schemaToSet:Y,hasJustCreatedSchema:ne})},Ue=(0,r.useMemo)(()=>{const b=te?o:n;return ge==="create-content-type"?!1:!Object.keys(b).includes(ge)&&!s},[n,o,ge,te,s]),it=(0,r.useMemo)(()=>{const b=Object.keys(o).filter(S=>(0,D.get)(o,[S,"schema","visible"],!0)).sort();return(0,D.get)(b,"0","create-content-type")},[o]);if(Ue)return r.createElement(k.Redirect,{to:`/plugins/${J.Z}/content-types/${it}`});const Ze=b=>He(void 0,null,function*(){var S,w;try{const Y=(0,D.get)(u,[Ie,"isTemporary"],!1),ne={components:ei(u.components,n,ge,Y)};if(te){const Me=E.forms.mutateContentTypeSchema(Ha(Ha({},ja(u.contentType)),b),c.contentType);if(!ai(Me)){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}ne.contentType=Me,R("willSaveContentType")}else ne.component=ja(u.component,!0),R("willSaveComponent");const xe=Y?"POST":"PUT",he=`/${x}`,be=Y?he:`${he}/${ge}`;if(f(),yield we({url:be,method:xe,data:ne}),yield rt(!0),yield y(),Y&&(((S=c.contentType)==null?void 0:S.schema.kind)==="collectionType"||((w=c.contentType)==null?void 0:w.schema.kind)==="singleType")&&v("contentTypeBuilder.success"),te){R("didSaveContentType");const Me=(0,D.get)(ne,["contentType","schema","name"],""),ct=(0,D.get)(c,["contentType","schema","name"],"");!Y&&Me!==ct&&R("didEditNameOfContentType")}else R("didSaveComponent");yield ce()}catch(Y){te||R("didNotSaveComponent"),ot.error({err:Y.response}),g({type:"warning",message:{id:"notification.error"}})}finally{y()}}),ce=()=>He(void 0,null,function*(){yield Z()}),lt=(b,S,w)=>{m({type:ie.bi,data:b,schemaType:S,uid:w})};return r.createElement(Ot.Z.Provider,{value:{addAttribute:Xe,addCreatedComponentToDynamicZone:st,allComponentsCategories:Ws(n,["category"]),allIcons:e,changeDynamicZoneComponents:Mn,components:n,componentsGroupedByCategory:(0,D.groupBy)(n,"category"),componentsThatHaveOtherComponentInTheirAttributes:Rn(),contentTypes:o,createSchema:Ye,deleteCategory:Pn,deleteData:On,editCategory:le,isInDevelopmentMode:q,initialData:c,isInContentTypeView:te,modifiedData:u,nestedComponents:xn(),removeAttribute:Tt,removeComponentFromDynamicZone:Sn,reservedNames:p,setModifiedData:Ct,sortedContentTypesList:ti(o),submitData:Ze,updateSchema:lt}},r.createElement(r.Fragment,null,l?r.createElement(O.LoadingIndicatorPage,null):r.createElement(r.Fragment,null,t,q&&r.createElement(_s,null))))};Tn.defaultProps={components:{}},Tn.propTypes={allIcons:a().array.isRequired,children:a().node.isRequired,components:a().object,contentTypes:a().object.isRequired,isLoading:a().bool.isRequired,isLoadingForDataToBeSet:a().bool.isRequired,initialData:a().object.isRequired,modifiedData:a().object.isRequired,reservedNames:a().object.isRequired};const hi=si(),bi=(0,fe.connect)(hi,null),vi=(0,Pt.compose)(bi)((0,r.memo)(Tn));var Ti=i(51216);const Xa={actionType:null,attributeName:null,attributeType:null,categoryName:null,dynamicZoneTarget:null,forTarget:null,modalType:null,isOpen:!1,kind:null,step:null,targetUid:null};var Ci=Object.defineProperty,Ei=Object.defineProperties,Mi=Object.getOwnPropertyDescriptors,Ya=Object.getOwnPropertySymbols,Pi=Object.prototype.hasOwnProperty,Oi=Object.prototype.propertyIsEnumerable,Ja=(e,t,n)=>t in e?Ci(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ye=(e,t)=>{for(var n in t||(t={}))Pi.call(t,n)&&Ja(e,n,t[n]);if(Ya)for(var n of Ya(t))Oi.call(t,n)&&Ja(e,n,t[n]);return e},Ee=(e,t)=>Ei(e,Mi(t));const Qa=({children:e})=>{const[t,n]=(0,r.useState)(Xa),{trackUsage:o}=(0,O.useTracking)(),s=({attributeType:E,step:N})=>{t.forTarget==="contentType"&&o("didSelectContentTypeFieldType",{type:E}),n(P=>Ee(ye({},P),{actionType:"create",modalType:"attribute",step:N,attributeType:E}))},l=({dynamicZoneTarget:E,targetUid:N})=>{n(P=>Ee(ye({},P),{dynamicZoneTarget:E,targetUid:N,modalType:"addComponentToDynamicZone",forTarget:"contentType",step:"1",actionType:"edit",isOpen:!0}))},c=({forTarget:E,targetUid:N})=>{n(P=>Ee(ye({},P),{actionType:"create",forTarget:E,targetUid:N,modalType:"chooseAttribute",isOpen:!0}))},u=E=>{n(N=>Ee(ye(ye({},N),E),{isOpen:!0}))},p=E=>{n(N=>Ee(ye({},N),{categoryName:E,actionType:"edit",modalType:"editCategory",isOpen:!0}))},m=({forTarget:E,targetUid:N,attributeName:P,attributeType:R,step:Z})=>{n(U=>Ee(ye({},U),{modalType:"attribute",actionType:"edit",forTarget:E,targetUid:N,attributeName:P,attributeType:R,step:Z,isOpen:!0}))},g=({modalType:E,forTarget:N,targetUid:P,kind:R})=>{n(Z=>Ee(ye({},Z),{modalType:E,actionType:"edit",forTarget:N,targetUid:P,kind:R,isOpen:!0}))},f=()=>{n(Xa)},y=({forTarget:E,targetUid:N})=>{n(P=>Ee(ye({},P),{forTarget:E,targetUid:N,modalType:"chooseAttribute"}))},v=()=>{n(E=>Ee(ye({},E),{attributeType:"component",modalType:"attribute",step:"2"}))},C=({dynamicZoneTarget:E})=>{n(N=>Ee(ye({},N),{dynamicZoneTarget:E,modalType:"addComponentToDynamicZone",actionType:"create",step:"1",attributeType:null,attributeName:null}))};return r.createElement(Ti.Z.Provider,{value:Ee(ye({},t),{onClickSelectField:s,onCloseModal:f,onNavigateToChooseAttributeModal:y,onNavigateToAddCompoToDZModal:C,onOpenModalAddComponentsToDZ:l,onNavigateToCreateComponentStep2:v,onOpenModalAddField:c,onOpenModalCreateSchema:u,onOpenModalEditCategory:p,onOpenModalEditField:m,onOpenModalEditSchema:g,setFormModalNavigationState:n})},e)};Qa.propTypes={children:a().node.isRequired};const Ri=Qa,xi=(0,r.lazy)(()=>i.e(5905).then(i.bind(i,2863))),Si=()=>{const{url:e}=(0,k.useRouteMatch)(),{categoryUid:t}=(0,k.useParams)();return r.createElement(r.Suspense,{fallback:r.createElement(O.LoadingIndicatorPage,null)},r.createElement(k.Switch,null,r.createElement(k.Route,{path:`${e}/:componentUid`},r.createElement(xi,{categoryId:t}))))},Ai=JSON.parse('["ad","address-book","address-card","adjust","air-freshener","align-center","align-justify","align-left","align-right","allergies","ambulance","american-sign-language-interpreting","anchor","angle-double-down","angle-double-left","angle-double-right","angle-double-up","angle-down","angle-left","angle-right","angle-up","angry","ankh","apple-alt","archive","archway","arrow-alt-circle-down","arrow-alt-circle-left","arrow-alt-circle-right","arrow-alt-circle-up","arrow-circle-down","arrow-circle-left","arrow-circle-right","arrow-circle-up","arrow-down","arrow-left","arrow-right","arrow-up","arrows-alt","arrows-alt-h","arrows-alt-v","assistive-listening-systems","asterisk","at","atlas","atom","audio-description","award","baby","baby-carriage","backspace","backward","bacon","balance-scale","balance-scale-left","balance-scale-right","ban","band-aid","barcode","bars","baseball-ball","basketball-ball","bath","battery-empty","battery-full","battery-half","battery-quarter","battery-three-quarters","bed","beer","bell","bell-slash","bezier-curve","bible","bicycle","biking","binoculars","biohazard","birthday-cake","blender","blender-phone","blind","blog","bold","bolt","bomb","bone","bong","book","book-dead","book-medical","book-open","book-reader","bookmark","border-all","border-none","border-style","bowling-ball","box","box-open","boxes","braille","brain","bread-slice","briefcase","briefcase-medical","broadcast-tower","broom","brush","bug","building","bullhorn","bullseye","burn","bus","bus-alt","business-time","calculator","calendar","calendar-alt","calendar-check","calendar-day","calendar-minus","calendar-plus","calendar-times","calendar-week","camera","camera-retro","campground","candy-cane","cannabis","capsules","car","car-alt","car-battery","car-crash","car-side","caret-down","caret-left","caret-right","caret-square-down","caret-square-left","caret-square-right","caret-square-up","caret-up","carrot","cart-arrow-down","cart-plus","cash-register","cat","certificate","chair","chalkboard","chalkboard-teacher","charging-station","chart-area","chart-bar","chart-line","chart-pie","check","check-circle","check-double","check-square","cheese","chess","chess-bishop","chess-board","chess-king","chess-knight","chess-pawn","chess-queen","chess-rook","chevron-circle-down","chevron-circle-left","chevron-circle-right","chevron-circle-up","chevron-down","chevron-left","chevron-right","chevron-up","child","church","circle","circle-notch","city","clinic-medical","clipboard","clipboard-check","clipboard-list","clock","clone","closed-captioning","cloud","cloud-download-alt","cloud-meatball","cloud-moon","cloud-moon-rain","cloud-rain","cloud-showers-heavy","cloud-sun","cloud-sun-rain","cloud-upload-alt","cocktail","code","code-branch","coffee","cog","cogs","coins","columns","comment","comment-alt","comment-dollar","comment-dots","comment-medical","comment-slash","comments","comments-dollar","compact-disc","compass","compress","compress-arrows-alt","concierge-bell","cookie","cookie-bite","copy","copyright","couch","credit-card","crop","crop-alt","cross","crosshairs","crow","crown","crutch","cube","cubes","cut","database","deaf","democrat","desktop","dharmachakra","diagnoses","dice","dice-d20","dice-d6","dice-five","dice-four","dice-one","dice-six","dice-three","dice-two","digital-tachograph","directions","divide","dizzy","dna","dog","dollar-sign","dolly","dolly-flatbed","donate","door-closed","door-open","dot-circle","dove","download","drafting-compass","dragon","draw-polygon","drum","drum-steelpan","drumstick-bite","dumbbell","dumpster","dumpster-fire","dungeon","edit","egg","eject","ellipsis-h","ellipsis-v","envelope","envelope-open","envelope-open-text","envelope-square","equals","eraser","ethernet","euro-sign","exchange-alt","exclamation","exclamation-circle","exclamation-triangle","expand","expand-arrows-alt","external-link-alt","external-link-square-alt","eye","eye-dropper","eye-slash","fan","fast-backward","fast-forward","fax","feather","feather-alt","female","fighter-jet","file","file-alt","file-archive","file-audio","file-code","file-contract","file-csv","file-download","file-excel","file-export","file-image","file-import","file-invoice","file-invoice-dollar","file-medical","file-medical-alt","file-pdf","file-powerpoint","file-prescription","file-signature","file-upload","file-video","file-word","fill","fill-drip","film","filter","fingerprint","fire","fire-alt","fire-extinguisher","first-aid","fish","fist-raised","flag","flag-checkered","flag-usa","flask","flushed","folder","folder-minus","folder-open","folder-plus","font","football-ball","forward","frog","frown","frown-open","funnel-dollar","futbol","gamepad","gas-pump","gavel","gem","genderless","ghost","gift","gifts","glass-cheers","glass-martini","glass-martini-alt","glass-whiskey","glasses","globe","globe-africa","globe-americas","globe-asia","globe-europe","golf-ball","gopuram","graduation-cap","greater-than","greater-than-equal","grimace","grin","grin-alt","grin-beam","grin-beam-sweat","grin-hearts","grin-squint","grin-squint-tears","grin-stars","grin-tears","grin-tongue","grin-tongue-squint","grin-tongue-wink","grin-wink","grip-horizontal","grip-lines","grip-lines-vertical","grip-vertical","guitar","h-square","hamburger","hammer","hamsa","hand-holding","hand-holding-heart","hand-holding-usd","hand-lizard","hand-middle-finger","hand-paper","hand-peace","hand-point-down","hand-point-left","hand-point-right","hand-point-up","hand-pointer","hand-rock","hand-scissors","hand-spock","hands","hands-helping","handshake","hanukiah","hard-hat","hashtag","hat-cowboy","hat-cowboy-side","hat-wizard","haykal","hdd","heading","headphones","headphones-alt","headset","heart","heart-broken","heartbeat","helicopter","highlighter","hiking","hippo","history","hockey-puck","holly-berry","home","horse","horse-head","hospital","hospital-alt","hospital-symbol","hot-tub","hotdog","hotel","hourglass","hourglass-end","hourglass-half","hourglass-start","house-damage","hryvnia","i-cursor","ice-cream","icicles","icons","id-badge","id-card","id-card-alt","igloo","image","images","inbox","indent","industry","infinity","info","info-circle","italic","jedi","joint","journal-whills","kaaba","key","keyboard","khanda","kiss","kiss-beam","kiss-wink-heart","kiwi-bird","landmark","language","laptop","laptop-code","laptop-medical","laugh","laugh-beam","laugh-squint","laugh-wink","layer-group","leaf","lemon","less-than","less-than-equal","level-down-alt","level-up-alt","life-ring","lightbulb","link","lira-sign","list","list-alt","list-ol","list-ul","location-arrow","lock","lock-open","long-arrow-alt-down","long-arrow-alt-left","long-arrow-alt-right","long-arrow-alt-up","low-vision","luggage-cart","magic","magnet","mail-bulk","male","map","map-marked","map-marked-alt","map-marker","map-marker-alt","map-pin","map-signs","marker","mars","mars-double","mars-stroke","mars-stroke-h","mars-stroke-v","mask","medal","medkit","meh","meh-blank","meh-rolling-eyes","memory","menorah","mercury","meteor","microchip","microphone","microphone-alt","microphone-alt-slash","microphone-slash","microscope","minus","minus-circle","minus-square","mitten","mobile","mobile-alt","money-bill","money-bill-alt","money-bill-wave","money-bill-wave-alt","money-check","money-check-alt","monument","moon","mortar-pestle","mosque","motorcycle","mountain","mouse","mouse-pointer","mug-hot","music","network-wired","neuter","newspaper","not-equal","notes-medical","object-group","object-ungroup","oil-can","om","otter","outdent","pager","paint-brush","paint-roller","palette","pallet","paper-plane","paperclip","parachute-box","paragraph","parking","passport","pastafarianism","paste","pause","pause-circle","paw","peace","pen","pen-alt","pen-fancy","pen-nib","pen-square","pencil-alt","pencil-ruler","people-carry","pepper-hot","percent","percentage","person-booth","phone","phone-alt","phone-slash","phone-square","phone-square-alt","phone-volume","photo-video","piggy-bank","pills","pizza-slice","place-of-worship","plane","plane-arrival","plane-departure","play","play-circle","plug","plus","plus-circle","plus-square","podcast","poll","poll-h","poo","poo-storm","poop","portrait","pound-sign","power-off","pray","praying-hands","prescription","prescription-bottle","prescription-bottle-alt","print","procedures","project-diagram","puzzle-piece","qrcode","question","question-circle","quidditch","quote-left","quote-right","quran","radiation","radiation-alt","rainbow","random","receipt","record-vinyl","recycle","redo","redo-alt","registered","remove-format","reply","reply-all","republican","restroom","retweet","ribbon","ring","road","robot","rocket","route","rss","rss-square","ruble-sign","ruler","ruler-combined","ruler-horizontal","ruler-vertical","running","rupee-sign","sad-cry","sad-tear","satellite","satellite-dish","save","school","screwdriver","scroll","sd-card","search","search-dollar","search-location","search-minus","search-plus","seedling","server","shapes","share","share-alt","share-alt-square","share-square","shekel-sign","shield-alt","ship","shipping-fast","shoe-prints","shopping-bag","shopping-basket","shopping-cart","shower","shuttle-van","sign","sign-in-alt","sign-language","sign-out-alt","signal","signature","sim-card","sitemap","skating","skiing","skiing-nordic","skull","skull-crossbones","slash","sleigh","sliders-h","smile","smile-beam","smile-wink","smog","smoking","smoking-ban","sms","snowboarding","snowflake","snowman","snowplow","socks","solar-panel","sort","sort-alpha-down","sort-alpha-down-alt","sort-alpha-up","sort-alpha-up-alt","sort-amount-down","sort-amount-down-alt","sort-amount-up","sort-amount-up-alt","sort-down","sort-numeric-down","sort-numeric-down-alt","sort-numeric-up","sort-numeric-up-alt","sort-up","spa","space-shuttle","spell-check","spider","spinner","splotch","spray-can","square","square-full","square-root-alt","stamp","star","star-and-crescent","star-half","star-half-alt","star-of-david","star-of-life","step-backward","step-forward","stethoscope","sticky-note","stop","stop-circle","stopwatch","store","store-alt","stream","street-view","strikethrough","stroopwafel","subscript","subway","suitcase","suitcase-rolling","sun","superscript","surprise","swatchbook","swimmer","swimming-pool","synagogue","sync","sync-alt","syringe","table","table-tennis","tablet","tablet-alt","tablets","tachometer-alt","tag","tags","tape","tasks","taxi","teeth","teeth-open","temperature-high","temperature-low","tenge","terminal","text-height","text-width","th","th-large","th-list","theater-masks","thermometer","thermometer-empty","thermometer-full","thermometer-half","thermometer-quarter","thermometer-three-quarters","thumbs-down","thumbs-up","thumbtack","ticket-alt","times","times-circle","tint","tint-slash","tired","toggle-off","toggle-on","toilet","toilet-paper","toolbox","tools","tooth","torah","torii-gate","tractor","trademark","traffic-light","train","tram","transgender","transgender-alt","trash","trash-alt","trash-restore","trash-restore-alt","tree","trophy","truck","truck-loading","truck-monster","truck-moving","truck-pickup","tshirt","tty","tv","umbrella","umbrella-beach","underline","undo","undo-alt","universal-access","university","unlink","unlock","unlock-alt","upload","user","user-alt","user-alt-slash","user-astronaut","user-check","user-circle","user-clock","user-cog","user-edit","user-friends","user-graduate","user-injured","user-lock","user-md","user-minus","user-ninja","user-nurse","user-plus","user-secret","user-shield","user-slash","user-tag","user-tie","user-times","users","users-cog","utensil-spoon","utensils","vector-square","venus","venus-double","venus-mars","vial","vials","video","video-slash","vihara","voicemail","volleyball-ball","volume-down","volume-mute","volume-off","volume-up","vote-yea","vr-cardboard","walking","wallet","warehouse","water","wave-square","weight","weight-hanging","wheelchair","wifi","wind","window-close","window-maximize","window-minimize","window-restore","wine-bottle","wine-glass","wine-glass-alt","won-sign","wrench","x-ray","yen-sign","yin-yang"]');var _e=i(89420),Di=i(74201),Ni=i(86834),Ii=i.n(Ni),Zi=i(98978),er=i.n(Zi),Fi=i(89793),wi=i.n(Fi),Li=i(58469),Bi=Object.defineProperty,qi=Object.defineProperties,ki=Object.getOwnPropertyDescriptors,tr=Object.getOwnPropertySymbols,ji=Object.prototype.hasOwnProperty,_i=Object.prototype.propertyIsEnumerable,nr=(e,t,n)=>t in e?Bi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Cn=(e,t)=>{for(var n in t||(t={}))ji.call(t,n)&&nr(e,n,t[n]);if(tr)for(var n of tr(t))_i.call(t,n)&&nr(e,n,t[n]);return e},En=(e,t)=>qi(e,ki(t));const Ui=()=>{const{components:e,componentsGroupedByCategory:t,contentTypes:n,isInDevelopmentMode:o,sortedContentTypesList:s,modifiedData:l,initialData:c}=(0,Ce.Z)(),u=(0,O.useNotification)(),{trackUsage:p}=(0,O.useTracking)(),[m,g]=(0,r.useState)(""),{onOpenModalCreateSchema:f,onOpenModalEditCategory:y}=(0,$e.Z)(),v=er()(Object.keys(t).map(A=>({name:A,title:A,isEditable:o,onClickEdit:(H,q)=>{H.stopPropagation(),C?y(q.name):R()},links:er()(t[A].map(H=>({name:H.uid,to:`/plugins/${J.Z}/component-categories/${A}/${H.uid}`,title:H.schema.displayName})),H=>H.title)})),A=>A.title),C=!Object.keys(n).some(A=>n[A].isTemporary===!0)&&!Object.keys(e).some(A=>e[A].isTemporary===!0)&&wi()(l,c),E=()=>{C?(p("willCreateContentType"),f({modalType:"contentType",kind:"collectionType",actionType:"create",forTarget:"contentType"})):R()},N=()=>{C?(p("willCreateSingleType"),f({modalType:"contentType",kind:"singleType",actionType:"create",forTarget:"contentType"})):R()},P=()=>{C?(p("willCreateComponent"),f({modalType:"component",kind:null,actionType:"create",forTarget:"component"})):R()},R=()=>{u({type:"info",message:{id:`${(0,d.Z)("notification.info.creating.notSaved")}`,defaultMessage:"Please save your work before creating a new collection type or component"}})},Z=s.filter(A=>A.visible),U=[{name:"models",title:{id:`${(0,d.Z)("menu.section.models.name")}`,defaultMessage:"Collection Types"},customLink:o&&{id:`${(0,d.Z)("button.model.create")}`,defaultMessage:"Create new collection type",onClick:E},links:Z.filter(A=>A.kind==="collectionType")},{name:"singleTypes",title:{id:`${(0,d.Z)("menu.section.single-types.name")}`,defaultMessage:"Single Types"},customLink:o&&{id:`${(0,d.Z)("button.single-types.create")}`,defaultMessage:"Create new single type",onClick:N},links:Z.filter(A=>A.kind==="singleType")},{name:"components",title:{id:`${(0,d.Z)("menu.section.components.name")}`,defaultMessage:"Components"},customLink:o&&{id:`${(0,d.Z)("button.component.create")}`,defaultMessage:"Create a new component",onClick:P},links:v}],L=A=>(0,Li.ZP)(A,qe()(m),{keys:[H=>qe()(H.title)]});return{menu:(()=>U.map(A=>A.links.some(q=>!Ii()(q.links))?En(Cn({},A),{links:A.links.map(q=>En(Cn({},q),{links:L(q.links)}))}):En(Cn({},A),{links:L(A.links)})))(),searchValue:m,onSearchChange:g}},Wi=()=>{const{menu:e,searchValue:t,onSearchChange:n}=Ui(),{formatMessage:o}=(0,F.useIntl)();return r.createElement(_e.SubNav,{ariaLabel:o({id:`${(0,d.Z)("plugin.name")}`,defaultMessage:"Content-Types Builder"})},r.createElement(_e.SubNavHeader,{searchable:!0,value:t,onClear:()=>n(""),onChange:s=>n(s.target.value),label:o({id:`${(0,d.Z)("plugin.name")}`,defaultMessage:"Content-Types Builder"}),searchLabel:o({id:"global.search",defaultMessage:"Search"})}),r.createElement(_e.SubNavSections,null,e.map(s=>{const l=s.title.id;return r.createElement(r.Fragment,{key:s.name},r.createElement(_e.SubNavSection,{label:o({id:l,defaultMessage:l}),collapsable:!0,badgeLabel:s.links.length.toString()},s.links.map(c=>c.links?r.createElement(_e.SubNavLinkSection,{key:c.name,label:Te()(c.title)},c.links.map(u=>r.createElement(_e.SubNavLink,{as:k.NavLink,to:u.to,active:u.active,key:u.name},Te()(o({id:u.name,defaultMessage:u.title}))))):r.createElement(_e.SubNavLink,{as:k.NavLink,to:c.to,active:c.active,key:c.name},Te()(o({id:c.name,defaultMessage:c.title}))))),s.customLink&&r.createElement($.Box,{paddingLeft:7},r.createElement(Di.TextButton,{onClick:s.customLink.onClick,startIcon:r.createElement(tt(),null)},o({id:s.customLink.id,defaultMessage:s.customLink.defaultMessage}))))})))},ar=(0,r.lazy)(()=>i.e(5905).then(i.bind(i,2863))),$i=()=>{const{formatMessage:e}=(0,F.useIntl)(),t=e({id:`${J.Z}.plugin.name`,defaultMessage:"Content Types Builder"}),{startSection:n}=(0,O.useGuidedTour)(),o=(0,r.useRef)(n);return(0,r.useEffect)(()=>{o.current&&o.current("contentTypeBuilder")},[]),r.createElement(O.CheckPagePermissions,{permissions:Et.Z.main},r.createElement(ve.Helmet,{title:t}),r.createElement(Ri,null,r.createElement(vi,{allIcons:Ai},r.createElement(Dn.Layout,{sideNav:r.createElement(Wi,null)},r.createElement(r.Suspense,{fallback:r.createElement(O.LoadingIndicatorPage,null)},r.createElement(k.Switch,null,r.createElement(k.Route,{path:`/plugins/${J.Z}/content-types/create-content-type`,component:ar}),r.createElement(k.Route,{path:`/plugins/${J.Z}/content-types/:uid`,component:ar}),r.createElement(k.Route,{path:`/plugins/${J.Z}/component-categories/:categoryUid`,component:Si})))))))}},92318:(We,se,i)=>{i.d(se,{Z:()=>ve});var r=i(25158);const ve=F=>`${r.Z}.${F}`}}]);