@strapi/admin 4.2.0-beta.1 → 4.2.0-beta.4

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.
Files changed (166) hide show
  1. package/admin/src/assets/images/homepage-logo.png +0 -0
  2. package/admin/src/components/AutoReloadOverlayBlockerProvider/Blocker.js +2 -6
  3. package/admin/src/components/ConfigurationsProvider/index.js +51 -0
  4. package/admin/src/components/ConfigurationsProvider/reducer.js +28 -0
  5. package/admin/src/components/GuidedTour/Homepage/index.js +1 -2
  6. package/admin/src/components/GuidedTour/Modal/components/Stepper.js +1 -2
  7. package/admin/src/components/LeftMenu/index.js +19 -7
  8. package/admin/src/components/Notifications/Notification/index.js +2 -2
  9. package/admin/src/components/Providers/index.js +8 -4
  10. package/admin/src/components/UnauthenticatedLogo/index.js +4 -2
  11. package/admin/src/components/UpgradePlanModal/index.js +6 -2
  12. package/admin/src/content-manager/components/DynamicZone/components/ComponentPicker/Category/ComponentCard/index.js +1 -1
  13. package/admin/src/content-manager/components/SelectMany/ListItem.js +1 -2
  14. package/admin/src/content-manager/components/SelectWrapper/index.js +8 -7
  15. package/admin/src/content-manager/components/SelectWrapper/utils/getSelectStyles.js +1 -1
  16. package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +2 -2
  17. package/admin/src/content-manager/components/Wysiwyg/Editor.js +2 -0
  18. package/admin/src/content-manager/pages/App/LeftMenu/index.js +8 -7
  19. package/admin/src/content-manager/pages/EditSettingsView/components/ComponentFieldList.js +1 -1
  20. package/admin/src/content-manager/pages/EditSettingsView/components/LinkToCTB.js +1 -2
  21. package/admin/src/content-manager/pages/EditSettingsView/index.js +1 -2
  22. package/admin/src/content-manager/pages/EditView/Header/index.js +3 -3
  23. package/admin/src/content-manager/pages/EditView/index.js +1 -4
  24. package/admin/src/content-manager/pages/ListSettingsView/index.js +1 -2
  25. package/admin/src/content-manager/pages/ListView/index.js +1 -1
  26. package/admin/src/content-manager/pages/NoContentType/index.js +1 -2
  27. package/admin/src/pages/App/index.js +7 -2
  28. package/admin/src/pages/AuthPage/components/ForgotPassword/index.js +1 -2
  29. package/admin/src/pages/AuthPage/components/ForgotPasswordSuccess/index.js +1 -1
  30. package/admin/src/pages/AuthPage/components/Login/BaseLogin.js +1 -2
  31. package/admin/src/pages/AuthPage/components/Oops/index.js +1 -2
  32. package/admin/src/pages/AuthPage/components/Register/index.js +12 -12
  33. package/admin/src/pages/AuthPage/components/ResetPassword/index.js +3 -4
  34. package/admin/src/pages/HomePage/ContentBlocks.js +15 -2
  35. package/admin/src/pages/HomePage/HomeHeader.js +2 -2
  36. package/admin/src/pages/HomePage/SocialLinks.js +4 -3
  37. package/admin/src/pages/InternalErrorPage/index.js +1 -2
  38. package/admin/src/pages/MarketplacePage/components/PageHeader/index.js +2 -1
  39. package/admin/src/pages/MarketplacePage/components/PluginCard/index.js +4 -3
  40. package/admin/src/pages/NotFoundPage/index.js +1 -2
  41. package/admin/src/pages/SettingsPage/components/SettingsNav/index.js +5 -4
  42. package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +1 -1
  43. package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/DynamicTable/UpdateButton/index.js +1 -1
  44. package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/index.js +1 -1
  45. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/index.js +85 -0
  46. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/init.js +13 -0
  47. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/reducer.js +43 -0
  48. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/index.js +118 -0
  49. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/reducer.js +28 -0
  50. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/stepper.js +25 -0
  51. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/AddLogoDialog.js +67 -0
  52. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/FromComputerForm.js +176 -0
  53. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/FromUrlForm.js +82 -0
  54. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/ImageCardAsset.js +51 -0
  55. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/PendingLogoDialog.js +97 -0
  56. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/index.js +85 -0
  57. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/reducer.js +28 -0
  58. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +155 -87
  59. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/api.js +16 -0
  60. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/constants.js +3 -0
  61. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/getFormData.js +17 -0
  62. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/parseFileMetadatas.js +76 -0
  63. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/prefixAllUrls.js +17 -0
  64. package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/urlToFile.js +21 -0
  65. package/admin/src/pages/SettingsPage/pages/Roles/EditPage/index.js +1 -1
  66. package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +1 -1
  67. package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/WebhookForm/index.js +1 -2
  68. package/admin/src/pages/SettingsPage/pages/Webhooks/ListView/index.js +1 -1
  69. package/admin/src/translations/ca.json +699 -0
  70. package/admin/src/translations/en.json +26 -0
  71. package/admin/src/translations/languageNativeNames.js +1 -0
  72. package/admin/src/translations/ru.json +34 -0
  73. package/build/1541.6c1c96f9.chunk.js +307 -0
  74. package/build/1856.521a99fd.chunk.js +172 -0
  75. package/build/2077.51485bfb.chunk.js +194 -0
  76. package/build/2912.79c2b3c8.chunk.js +253 -0
  77. package/build/3214.9196aeff.chunk.js +235 -0
  78. package/build/3865.21cec9de.chunk.js +310 -0
  79. package/build/4073.e144a91a.chunk.js +1 -0
  80. package/build/4715.77e04177.chunk.js +385 -0
  81. package/build/{272.d442e5ca.chunk.js → 472.0350a5bd.chunk.js} +91 -102
  82. package/build/4982.f53b78a4.chunk.js +308 -0
  83. package/build/6229.a5cca9f2.chunk.js +194 -0
  84. package/build/7351.b95e65ae.chunk.js +428 -0
  85. package/build/7418.6db737ce.chunk.js +112 -0
  86. package/build/7841.f0e7d629.chunk.js +253 -0
  87. package/build/8826.58e236d4.chunk.js +1057 -0
  88. package/build/9066.118ecccd.chunk.js +101 -0
  89. package/build/{9298.dab64a1b.chunk.js → 9298.aff28744.chunk.js} +80 -91
  90. package/build/9420.cb0b75e8.chunk.js +508 -0
  91. package/build/{9988.9b6e1d79.chunk.js → 9988.f84412d9.chunk.js} +15 -14
  92. package/build/Admin-authenticatedApp.162a5805.chunk.js +80 -0
  93. package/build/Admin_homePage.0ac648e8.chunk.js +71 -0
  94. package/build/Admin_marketplace.0bb91ec8.chunk.js +11 -0
  95. package/build/Admin_settingsPage.23e873f0.chunk.js +178 -0
  96. package/build/admin-edit-roles-page.fb374555.chunk.js +1 -0
  97. package/build/admin-edit-users.a360deaf.chunk.js +10 -0
  98. package/build/api-tokens-create-page.698f132d.chunk.js +1 -0
  99. package/build/api-tokens-edit-page.afece2fe.chunk.js +1 -0
  100. package/build/api-tokens-list-page.46d96dee.chunk.js +15 -0
  101. package/build/ca-json.0097e443.chunk.js +1 -0
  102. package/build/content-manager.7cd28f84.chunk.js +1204 -0
  103. package/build/content-type-builder.7456cabe.chunk.js +141 -0
  104. package/build/{email-settings-page.d807edfd.chunk.js → email-settings-page.f67d13b2.chunk.js} +5 -5
  105. package/build/en-json.40ee00aa.chunk.js +1 -0
  106. package/build/fb376b132d18bf4522ca.png +0 -0
  107. package/build/{i18n-settings-page.c8f3b78b.chunk.js → i18n-settings-page.6b67cb75.chunk.js} +5 -5
  108. package/build/index.html +1 -1
  109. package/build/main.b632a0d6.js +11625 -0
  110. package/build/ru-json.28147733.chunk.js +1 -0
  111. package/build/runtime~main.38d418e9.js +2 -0
  112. package/build/{upload-settings.17202e3b.chunk.js → upload-settings.3db55de0.chunk.js} +5 -5
  113. package/build/upload-translation-ca-json.79159984.chunk.js +1 -0
  114. package/build/{upload.d647d59d.chunk.js → upload.070c189b.chunk.js} +5 -5
  115. package/build/{users-advanced-settings-page.22690469.chunk.js → users-advanced-settings-page.a23cda17.chunk.js} +5 -5
  116. package/build/users-roles-settings-page.988ebc3b.chunk.js +30 -0
  117. package/build/{webhook-edit-page.043fe03f.chunk.js → webhook-edit-page.a7ae6e3b.chunk.js} +3 -3
  118. package/build/webhook-list-page.83297d98.chunk.js +133 -0
  119. package/ee/admin/pages/AuthPage/components/Providers/index.js +1 -1
  120. package/ee/admin/pages/SettingsPage/pages/Roles/CreatePage/index.js +1 -1
  121. package/ee/server/controllers/user.js +4 -0
  122. package/package.json +9 -9
  123. package/server/config/admin-actions.js +14 -0
  124. package/server/controllers/admin.js +33 -1
  125. package/server/controllers/user.js +4 -0
  126. package/server/routes/admin.js +28 -0
  127. package/server/services/index.js +1 -0
  128. package/server/services/permission/permissions-manager/sanitize.js +22 -0
  129. package/server/services/project-settings.js +173 -0
  130. package/server/services/user.js +1 -1
  131. package/server/utils/index.d.ts +2 -0
  132. package/server/validation/project-settings.js +39 -0
  133. package/utils/create-cache-dir.js +2 -5
  134. package/webpack.config.js +2 -2
  135. package/admin/src/content-manager/components/DynamicComponentCard/index.js +0 -43
  136. package/build/1856.e2bce2e8.chunk.js +0 -171
  137. package/build/2481.5fe150c7.chunk.js +0 -184
  138. package/build/2912.5a7b0406.chunk.js +0 -252
  139. package/build/2a9e9ef5c4c775bb7c7b.png +0 -0
  140. package/build/306.28d21ab8.chunk.js +0 -896
  141. package/build/4073.4765687b.chunk.js +0 -1
  142. package/build/4715.7f616cf6.chunk.js +0 -387
  143. package/build/497.2ba35e90.chunk.js +0 -284
  144. package/build/4982.91235074.chunk.js +0 -310
  145. package/build/6229.f558fd19.chunk.js +0 -194
  146. package/build/6404.25d0f0d8.chunk.js +0 -508
  147. package/build/7841.0d73dde1.chunk.js +0 -252
  148. package/build/7863.996e70df.chunk.js +0 -112
  149. package/build/9853.6cc1043a.chunk.js +0 -354
  150. package/build/Admin-authenticatedApp.d26b3032.chunk.js +0 -80
  151. package/build/Admin_homePage.fc4a8408.chunk.js +0 -71
  152. package/build/Admin_marketplace.c406a140.chunk.js +0 -11
  153. package/build/Admin_settingsPage.c40fdef1.chunk.js +0 -170
  154. package/build/admin-edit-roles-page.c69fe8ab.chunk.js +0 -1
  155. package/build/admin-edit-users.be232f6b.chunk.js +0 -10
  156. package/build/api-tokens-create-page.9774f0fe.chunk.js +0 -1
  157. package/build/api-tokens-edit-page.8f03c9a1.chunk.js +0 -1
  158. package/build/api-tokens-list-page.126fbca6.chunk.js +0 -15
  159. package/build/content-manager.ca66b566.chunk.js +0 -1204
  160. package/build/content-type-builder.d12fd5cd.chunk.js +0 -141
  161. package/build/en-json.3e1a222e.chunk.js +0 -1
  162. package/build/main.36da7eeb.js +0 -7918
  163. package/build/ru-json.4560906c.chunk.js +0 -1
  164. package/build/runtime~main.251e9cca.js +0 -2
  165. package/build/users-roles-settings-page.487f3346.chunk.js +0 -30
  166. package/build/webhook-list-page.2d2d71a1.chunk.js +0 -132
@@ -1,1204 +0,0 @@
1
- (self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[994],{52153:(Rc,lt)=>{var p=function(){var r={trace:function(){},yy:{},symbols_:{error:2,JSONString:3,STRING:4,JSONNumber:5,NUMBER:6,JSONNullLiteral:7,NULL:8,JSONBooleanLiteral:9,TRUE:10,FALSE:11,JSONText:12,JSONValue:13,EOF:14,JSONObject:15,JSONArray:16,"{":17,"}":18,JSONMemberList:19,JSONMember:20,":":21,",":22,"[":23,"]":24,JSONElementList:25,$accept:0,$end:1},terminals_:{2:"error",4:"STRING",6:"NUMBER",8:"NULL",10:"TRUE",11:"FALSE",14:"EOF",17:"{",18:"}",21:":",22:",",23:"[",24:"]"},productions_:[0,[3,1],[5,1],[7,1],[9,1],[9,1],[12,2],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[15,2],[15,3],[20,3],[19,1],[19,3],[16,2],[16,3],[25,1],[25,3]],performAction:function(y,X,oe,A,Ee,se,De){var pe=se.length-1;switch(Ee){case 1:this.$=y.replace(/\\(\\|")/g,"$1").replace(/\\n/g,`
2
- `).replace(/\\r/g,"\r").replace(/\\t/g," ").replace(/\\v/g,"\v").replace(/\\f/g,"\f").replace(/\\b/g,"\b");break;case 2:this.$=Number(y);break;case 3:this.$=null;break;case 4:this.$=!0;break;case 5:this.$=!1;break;case 6:return this.$=se[pe-1];case 13:this.$={};break;case 14:this.$=se[pe-1];break;case 15:this.$=[se[pe-2],se[pe]];break;case 16:this.$={},this.$[se[pe][0]]=se[pe][1];break;case 17:this.$=se[pe-2],se[pe-2][se[pe][0]]=se[pe][1];break;case 18:this.$=[];break;case 19:this.$=se[pe-1];break;case 20:this.$=[se[pe]];break;case 21:this.$=se[pe-2],se[pe-2].push(se[pe]);break}},table:[{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],12:1,13:2,15:7,16:8,17:[1,14],23:[1,15]},{1:[3]},{14:[1,16]},{14:[2,7],18:[2,7],22:[2,7],24:[2,7]},{14:[2,8],18:[2,8],22:[2,8],24:[2,8]},{14:[2,9],18:[2,9],22:[2,9],24:[2,9]},{14:[2,10],18:[2,10],22:[2,10],24:[2,10]},{14:[2,11],18:[2,11],22:[2,11],24:[2,11]},{14:[2,12],18:[2,12],22:[2,12],24:[2,12]},{14:[2,3],18:[2,3],22:[2,3],24:[2,3]},{14:[2,4],18:[2,4],22:[2,4],24:[2,4]},{14:[2,5],18:[2,5],22:[2,5],24:[2,5]},{14:[2,1],18:[2,1],21:[2,1],22:[2,1],24:[2,1]},{14:[2,2],18:[2,2],22:[2,2],24:[2,2]},{3:20,4:[1,12],18:[1,17],19:18,20:19},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:23,15:7,16:8,17:[1,14],23:[1,15],24:[1,21],25:22},{1:[2,6]},{14:[2,13],18:[2,13],22:[2,13],24:[2,13]},{18:[1,24],22:[1,25]},{18:[2,16],22:[2,16]},{21:[1,26]},{14:[2,18],18:[2,18],22:[2,18],24:[2,18]},{22:[1,28],24:[1,27]},{22:[2,20],24:[2,20]},{14:[2,14],18:[2,14],22:[2,14],24:[2,14]},{3:20,4:[1,12],20:29},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:30,15:7,16:8,17:[1,14],23:[1,15]},{14:[2,19],18:[2,19],22:[2,19],24:[2,19]},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:31,15:7,16:8,17:[1,14],23:[1,15]},{18:[2,17],22:[2,17]},{18:[2,15],22:[2,15]},{22:[2,21],24:[2,21]}],defaultActions:{16:[2,6]},parseError:function(y,X){throw new Error(y)},parse:function(y){var X=this,oe=[0],A=[null],Ee=[],se=this.table,De="",pe=0,v=0,Te=0,xe=2,o=1;this.lexer.setInput(y),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,typeof this.lexer.yylloc=="undefined"&&(this.lexer.yylloc={});var Pt=this.lexer.yylloc;Ee.push(Pt),typeof this.yy.parseError=="function"&&(this.parseError=this.yy.parseError);function Vt(L){oe.length=oe.length-2*L,A.length=A.length-L,Ee.length=Ee.length-L}function qt(){var L;return L=X.lexer.lex()||1,typeof L!="number"&&(L=X.symbols_[L]||L),L}for(var Oe,tt,we,Ie,lo,Rt,ze={},nt,Pe,S,w;;){we=oe[oe.length-1],this.defaultActions[we]?Ie=this.defaultActions[we]:(Oe==null&&(Oe=qt()),Ie=se[we]&&se[we][Oe]);e:if(typeof Ie=="undefined"||!Ie.length||!Ie[0]){if(!Te){w=[];for(nt in se[we])this.terminals_[nt]&&nt>2&&w.push("'"+this.terminals_[nt]+"'");var j="";this.lexer.showPosition?j="Parse error on line "+(pe+1)+`:
3
- `+this.lexer.showPosition()+`
4
- Expecting `+w.join(", ")+", got '"+this.terminals_[Oe]+"'":j="Parse error on line "+(pe+1)+": Unexpected "+(Oe==1?"end of input":"'"+(this.terminals_[Oe]||Oe)+"'"),this.parseError(j,{text:this.lexer.match,token:this.terminals_[Oe]||Oe,line:this.lexer.yylineno,loc:Pt,expected:w})}if(Te==3){if(Oe==o)throw new Error(j||"Parsing halted.");v=this.lexer.yyleng,De=this.lexer.yytext,pe=this.lexer.yylineno,Pt=this.lexer.yylloc,Oe=qt()}for(;!(xe.toString()in se[we]);){if(we==0)throw new Error(j||"Parsing halted.");Vt(1),we=oe[oe.length-1]}tt=Oe,Oe=xe,we=oe[oe.length-1],Ie=se[we]&&se[we][xe],Te=3}if(Ie[0]instanceof Array&&Ie.length>1)throw new Error("Parse Error: multiple actions possible at state: "+we+", token: "+Oe);switch(Ie[0]){case 1:oe.push(Oe),A.push(this.lexer.yytext),Ee.push(this.lexer.yylloc),oe.push(Ie[1]),Oe=null,tt?(Oe=tt,tt=null):(v=this.lexer.yyleng,De=this.lexer.yytext,pe=this.lexer.yylineno,Pt=this.lexer.yylloc,Te>0&&Te--);break;case 2:if(Pe=this.productions_[Ie[1]][1],ze.$=A[A.length-Pe],ze._$={first_line:Ee[Ee.length-(Pe||1)].first_line,last_line:Ee[Ee.length-1].last_line,first_column:Ee[Ee.length-(Pe||1)].first_column,last_column:Ee[Ee.length-1].last_column},Rt=this.performAction.call(ze,De,v,pe,this.yy,Ie[1],A,Ee),typeof Rt!="undefined")return Rt;Pe&&(oe=oe.slice(0,-1*Pe*2),A=A.slice(0,-1*Pe),Ee=Ee.slice(0,-1*Pe)),oe.push(this.productions_[Ie[1]][0]),A.push(ze.$),Ee.push(ze._$),S=se[oe[oe.length-2]][oe[oe.length-1]],oe.push(S);break;case 3:return!0}}return!0}},ct=function(){var te={EOF:1,parseError:function(X,oe){if(this.yy.parseError)this.yy.parseError(X,oe);else throw new Error(X)},setInput:function(y){return this._input=y,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this},input:function(){var y=this._input[0];this.yytext+=y,this.yyleng++,this.match+=y,this.matched+=y;var X=y.match(/\n/);return X&&this.yylineno++,this._input=this._input.slice(1),y},unput:function(y){return this._input=y+this._input,this},more:function(){return this._more=!0,this},less:function(y){this._input=this.match.slice(y)+this._input},pastInput:function(){var y=this.matched.substr(0,this.matched.length-this.match.length);return(y.length>20?"...":"")+y.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var y=this.match;return y.length<20&&(y+=this._input.substr(0,20-y.length)),(y.substr(0,20)+(y.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var y=this.pastInput(),X=new Array(y.length+1).join("-");return y+this.upcomingInput()+`
5
- `+X+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var y,X,oe,A,Ee,se;this._more||(this.yytext="",this.match="");for(var De=this._currentRules(),pe=0;pe<De.length&&(oe=this._input.match(this.rules[De[pe]]),!(oe&&(!X||oe[0].length>X[0].length)&&(X=oe,A=pe,!this.options.flex)));pe++);if(X)return se=X[0].match(/\n.*/g),se&&(this.yylineno+=se.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:se?se[se.length-1].length-1:this.yylloc.last_column+X[0].length},this.yytext+=X[0],this.match+=X[0],this.yyleng=this.yytext.length,this._more=!1,this._input=this._input.slice(X[0].length),this.matched+=X[0],y=this.performAction.call(this,this.yy,this,De[A],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),y||void 0;if(this._input==="")return this.EOF;this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
6
- `+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var X=this.next();return typeof X!="undefined"?X:this.lex()},begin:function(X){this.conditionStack.push(X)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(X){this.begin(X)}};return te.options={},te.performAction=function(X,oe,A,Ee){var se=Ee;switch(A){case 0:break;case 1:return 6;case 2:return oe.yytext=oe.yytext.substr(1,oe.yyleng-2),4;break;case 3:return 17;case 4:return 18;case 5:return 23;case 6:return 24;case 7:return 22;case 8:return 21;case 9:return 10;case 10:return 11;case 11:return 8;case 12:return 14;case 13:return"INVALID"}},te.rules=[/^(?:\s+)/,/^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)?([eE][-+]?[0-9]+)?\b)/,/^(?:"(?:\\[\\"bfnrt/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/,/^(?:\{)/,/^(?:\})/,/^(?:\[)/,/^(?:\])/,/^(?:,)/,/^(?::)/,/^(?:true\b)/,/^(?:false\b)/,/^(?:null\b)/,/^(?:$)/,/^(?:.)/],te.conditions={INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13],inclusive:!0}},te}();return r.lexer=ct,r}();lt.parser=p,lt.parse=function(){return p.parse.apply(p,arguments)},lt.main=function(ct){if(!ct[1])throw new Error("Usage: "+ct[0]+" FILE")}},7659:(Rc,lt,p)=>{"use strict";p.r(lt),p.d(lt,{App:()=>Oc,default:()=>cO});var r=p(32735),ct=p(99357),te=p(5141),y=p(10938),X=p(11856),oe=p(16540),A=p(5636),Ee=p(98978),se=p.n(Ee),De=p(2805);const v=e=>`content-manager.${e}`;var Te=p(74506),xe=p(60216),o=p.n(xe);const Vt=(0,r.createContext)();var qt=Object.defineProperty,Oe=Object.getOwnPropertySymbols,tt=Object.prototype.hasOwnProperty,we=Object.prototype.propertyIsEnumerable,Ie=(e,t,n)=>t in e?qt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lo=(e,t)=>{for(var n in t||(t={}))tt.call(t,n)&&Ie(e,n,t[n]);if(Oe)for(var n of Oe(t))we.call(t,n)&&Ie(e,n,t[n]);return e},Rt=(e,t)=>{var n={};for(var a in e)tt.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&Oe)for(var a of Oe(e))t.indexOf(a)<0&&we.call(e,a)&&(n[a]=e[a]);return n};function ze(e){var t=e,{attributes:n,buttonData:a,children:s,goTo:i,layout:l,metadatas:u,moveItem:c,moveRow:d,onAddData:m,relationsLayout:f,removeField:g,selectedItemName:h,setEditFieldToSelect:b}=t,E=Rt(t,["attributes","buttonData","children","goTo","layout","metadatas","moveItem","moveRow","onAddData","relationsLayout","removeField","selectedItemName","setEditFieldToSelect"]);return r.createElement(Vt.Provider,{value:lo({attributes:n,buttonData:a,goTo:i,layout:l,metadatas:u,moveItem:c,moveRow:d,onAddData:m,relationsLayout:f,removeField:g,selectedItemName:h,setEditFieldToSelect:b},E)},s)}ze.defaultProps={attributes:{},buttonData:[],goTo:()=>{},layout:[],metadatas:{},moveItem:()=>{},moveRow:()=>{},onAddData:()=>{},relationsLayout:[],removeField:()=>{},selectedItemName:null,setEditFieldToSelect:()=>{}},ze.propTypes={attributes:o().object,buttonData:o().array,children:o().node.isRequired,goTo:o().func,layout:o().array,metadatas:o().object,moveItem:o().func,moveRow:o().func,onAddData:o().func,relationsLayout:o().array,removeField:o().func,selectedItemName:o().string,setEditFieldToSelect:o().func};const nt=ze,Pe={COMPONENT:"component",EDIT_FIELD:"editField",EDIT_RELATION:"editRelation",FIELD:"field",RELATION:"relation"};var S=p(19615),w=p(9808),j=p(19192),L=p(95602),Me=p(20763),Mc=p(76470),qe=p.n(Mc),Tc=p(64198),rt=p.n(Tc),wc=p(60672),En=p.n(wc);const Ic=(0,S.default)(w.Box)`
7
- border: 1px solid ${({theme:e})=>e.colors.neutral200};
8
- `,Dc=(0,S.default)(w.Box)`
9
- height: ${32/16}rem;
10
- width: ${32/16}rem;
11
- border-radius: 50%;
12
- display: flex;
13
- align-items: center;
14
- justify-content: center;
15
-
16
- svg {
17
- height: ${6/16}rem;
18
- width: ${11/16}rem;
19
- > path {
20
- fill: ${({theme:e})=>e.colors.neutral600};
21
- }
22
- }
23
- `,xc=S.default.button`
24
- border: none;
25
- background: transparent;
26
- display: block;
27
- width: 100%;
28
- text-align: unset;
29
- padding: 0;
30
- `,co=({displayedValue:e})=>r.createElement(Ic,{paddingLeft:3,paddingRight:3,paddingTop:3,paddingBottom:3,hasRadius:!0,background:"neutral0",width:(0,y.pxToRem)(300)},r.createElement(j.Flex,{justifyContent:"space-between"},r.createElement(xc,{type:"button"},r.createElement(j.Flex,null,r.createElement(Dc,{background:"neutral200"},r.createElement(En(),null)),r.createElement(w.Box,{paddingLeft:6,maxWidth:(0,y.pxToRem)(150)},r.createElement(L.Typography,{textColor:"neutral700",ellipsis:!0},e)))),r.createElement(w.Box,{paddingLeft:3},r.createElement(j.Flex,null,r.createElement(Me.IconButton,{icon:r.createElement(qe(),null)}),r.createElement(w.Box,{paddingLeft:2},r.createElement(Me.IconButton,{icon:r.createElement(rt(),null)}))))));co.propTypes={displayedValue:o().string.isRequired};const Sc=co;var ae=p(90662),Lc=p(95717),ut=p.n(Lc),Fc=p(94009),vn=p.n(Fc);const uo=e=>e.length>20?`${e.substring(0,20)}...`:e,Cn=(0,S.default)(j.Flex)`
31
- height: ${({theme:e})=>e.spaces[7]};
32
-
33
- &:last-child {
34
- padding: 0 ${({theme:e})=>e.spaces[3]};
35
- }
36
- `,po=(0,S.default)(Cn)`
37
- padding: 0 ${({theme:e})=>e.spaces[3]};
38
- border-right: 1px solid ${({theme:e})=>e.colors.neutral150};
39
- cursor: all-scroll;
40
-
41
- svg {
42
- width: ${12/16}rem;
43
- height: ${12/16}rem;
44
- }
45
- `,kc=(0,S.default)(j.Flex)`
46
- display: inline-flex;
47
- max-height: ${32/16}rem;
48
- opacity: ${({transparent:e})=>e?0:1};
49
- background-color: ${({theme:e,isSibling:t})=>t?e.colors.neutral100:e.colors.primary100};
50
- border: 1px solid
51
- ${({theme:e,isSibling:t})=>t?e.colors.neutral150:e.colors.primary200};
52
-
53
- svg {
54
- width: ${10/16}rem;
55
- height: ${10/16}rem;
56
-
57
- path {
58
- fill: ${({theme:e,isSibling:t})=>t?void 0:e.colors.primary600};
59
- }
60
- }
61
-
62
- ${L.Typography} {
63
- color: ${({theme:e,isSibling:t})=>t?void 0:e.colors.primary600};
64
- }
65
-
66
- ${po} {
67
- border-right: 1px solid
68
- ${({theme:e,isSibling:t})=>t?e.colors.neutral150:e.colors.primary200};
69
- }
70
- `,On=({labelField:e,transparent:t,isSibling:n})=>{const a=uo(e);return r.createElement(kc,{hasRadius:!0,justifyContent:"space-between",transparent:t,isSibling:n},r.createElement(ae.Stack,{horizontal:!0,spacing:3},r.createElement(po,{alignItems:"center"},r.createElement(rt(),null)),r.createElement(L.Typography,{fontWeight:"bold"},a)),r.createElement(j.Flex,{paddingLeft:3},r.createElement(Cn,{alignItems:"center"},r.createElement(ut(),null)),r.createElement(Cn,{alignItems:"center"},r.createElement(vn(),null))))};On.defaultProps={isSibling:!1,transparent:!1},On.propTypes={isSibling:o().bool,labelField:o().string.isRequired,transparent:o().bool};const Pn=On,Ac={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"};function jc(e,t,n){if(!e||!t)return{display:"none"};const{x:a,y:s}=n,i=`translate(${a}px, ${s}px)`;return{transform:i,WebkitTransform:i}}const $c=()=>{const{itemType:e,isDragging:t,item:n,initialOffset:a,currentOffset:s,mouseOffset:i}=(0,Te.useDragLayer)(l=>({item:l.getItem(),itemType:l.getItemType(),initialOffset:l.getInitialSourceClientOffset(),currentOffset:l.getSourceClientOffset(),isDragging:l.isDragging(),mouseOffset:l.getClientOffset()}));return t?r.createElement(nt,null,r.createElement("div",{style:Ac},r.createElement("div",{style:jc(a,s,i),className:"col-md-2"},[Pe.EDIT_RELATION,Pe.EDIT_FIELD,Pe.FIELD].includes(e)&&r.createElement(Pn,{labelField:n.labelField}),e===Pe.COMPONENT&&r.createElement(Sc,{displayedValue:n.displayedValue})))):null},mo=(0,r.createContext)();var Bc=p(18522),q=p(92891);const fo=(0,r.createContext)(),fO=(0,r.createContext)(),gO=null;var fe=p(4409);const go=e=>e["content-manager_editViewLayoutManager"].currentLayout;var Nc=Object.defineProperty,Vc=Object.defineProperties,qc=Object.getOwnPropertyDescriptors,yo=Object.getOwnPropertySymbols,Wc=Object.prototype.hasOwnProperty,zc=Object.prototype.propertyIsEnumerable,ho=(e,t,n)=>t in e?Nc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Uc=(e,t)=>{for(var n in t||(t={}))Wc.call(t,n)&&ho(e,n,t[n]);if(yo)for(var n of yo(t))zc.call(t,n)&&ho(e,n,t[n]);return e},Hc=(e,t)=>Vc(e,qc(t));const dt=()=>{const e=(0,fe.v9)(go),t=(0,r.useCallback)(n=>(0,q.get)(e,["components",n],{}),[e]);return Hc(Uc({},e),{getComponentLayout:t})};var _c=p(43653),Se=p.n(_c),ge=p(16558),Zc=p(99381),Ue=p.n(Zc);const Mt=(e,t,n)=>{if(Array.isArray(e)&&t>=0&&n>=0&&t<=e.length-1&&n<=e.length-1){const a=Ue()(e),s=a.splice(t,1);return a.splice(n,0,s[0]),a}return e},bo=e=>{const t=e.type;return t==="relation"?!(0,q.toLower)(e.relationType).includes("morph"):!["json","dynamiczone","richtext","password"].includes(t)&&!!t},Eo=(e,t)=>Object.keys(e).reduce((n,a)=>{const s=(0,q.get)(e,[a],{}),{default:i,component:l,type:u,required:c,min:d,repeatable:m}=s;if(u==="json"&&(n[a]=null),u==="json"&&c===!0&&(n[a]={}),i!==void 0&&(n[a]=i),u==="component"){const f=(0,q.get)(t,[l,"attributes"],{}),g=Eo(f,t);if(c===!0&&(n[a]=m===!0?[]:g),d&&m===!0&&c){n[a]=[];for(let h=0;h<d;h+=1)n[a].push(g)}}return u==="dynamiczone"&&c===!0&&(n[a]=[]),n},{}),Wt=Eo;var Gc=Object.defineProperty,Qc=Object.defineProperties,Kc=Object.getOwnPropertyDescriptors,zt=Object.getOwnPropertySymbols,vo=Object.prototype.hasOwnProperty,Co=Object.prototype.propertyIsEnumerable,Oo=(e,t,n)=>t in e?Gc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rn=(e,t)=>{for(var n in t||(t={}))vo.call(t,n)&&Oo(e,n,t[n]);if(zt)for(var n of zt(t))Co.call(t,n)&&Oo(e,n,t[n]);return e},Mn=(e,t)=>Qc(e,Kc(t)),Yc=(e,t)=>{var n={};for(var a in e)vo.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&zt)for(var a of zt(e))t.indexOf(a)<0&&Co.call(e,a)&&(n[a]=e[a]);return n};const Ut=e=>{var t=e,{layouts:n,metadatas:a}=t,s=Yc(t,["layouts","metadatas"]);const i=n.list.map(d=>d.name?d.name:d),l=n.editRelations.map(({name:d})=>d),u=Object.keys(a).reduce((d,m)=>{const f=(0,q.get)(a,[m],{});let g=f.edit;return g.mainField&&(g=Mn(Rn({},g),{mainField:f.edit.mainField.name})),Mn(Rn({},d),{[m]:{edit:g,list:(0,q.omit)(f.list,["mainField"])}})},{}),c=n.edit.map(d=>d.map(({name:m,size:f})=>({name:m,size:f})));return Mn(Rn({},s),{layouts:{edit:c,editRelations:l,list:i},metadatas:u})};var Jc=Object.defineProperty,Xc=Object.defineProperties,eu=Object.getOwnPropertyDescriptors,Po=Object.getOwnPropertySymbols,tu=Object.prototype.hasOwnProperty,nu=Object.prototype.propertyIsEnumerable,Ro=(e,t,n)=>t in e?Jc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ru=(e,t)=>{for(var n in t||(t={}))tu.call(t,n)&&Ro(e,n,t[n]);if(Po)for(var n of Po(t))nu.call(t,n)&&Ro(e,n,t[n]);return e},ou=(e,t)=>Xc(e,eu(t));const au=(e,t)=>e.map(n=>ou(ru({},n),{subject:t})),Mo=e=>{const t={create:[{action:"plugin::content-manager.explorer.create",subject:null}],delete:[{action:"plugin::content-manager.explorer.delete",subject:null}],publish:[{action:"plugin::content-manager.explorer.publish",subject:null}],read:[{action:"plugin::content-manager.explorer.read",subject:null}],update:[{action:"plugin::content-manager.explorer.update",subject:null}]};return Object.keys(t).reduce((n,a)=>(n[a]=au(t[a],e),n),{})},To=e=>e.split(".").filter(t=>(0,q.isNaN)(parseInt(t,10))),wo=e=>e.length===0?-1:Math.max.apply(Math,e.map(t=>t.__temp_key__)),ve=e=>`/content-manager/${e}`;var su=Object.defineProperty,Io=Object.getOwnPropertySymbols,iu=Object.prototype.hasOwnProperty,lu=Object.prototype.propertyIsEnumerable,Do=(e,t,n)=>t in e?su(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ht=(e,t)=>{for(var n in t||(t={}))iu.call(t,n)&&Do(e,n,t[n]);if(Io)for(var n of Io(t))lu.call(t,n)&&Do(e,n,t[n]);return e};const xo=(e,t,n)=>{const a=u=>t.find(c=>c.uid===u),s=Object.assign({},e),i=e[n].uid,l=a(i);return(0,q.set)(s,[n],Ht(Ht({},e[n]),l)),Object.keys(e.components).forEach(u=>{const c=a(u);(0,q.set)(s,["components",u],Ht(Ht({},e.components[u]),c))}),s};var cu=Object.defineProperty,uu=Object.defineProperties,du=Object.getOwnPropertyDescriptors,So=Object.getOwnPropertySymbols,pu=Object.prototype.hasOwnProperty,mu=Object.prototype.propertyIsEnumerable,Lo=(e,t,n)=>t in e?cu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Tn=(e,t)=>{for(var n in t||(t={}))pu.call(t,n)&&Lo(e,n,t[n]);if(So)for(var n of So(t))mu.call(t,n)&&Lo(e,n,t[n]);return e},wn=(e,t)=>uu(e,du(t));const Tt=(e,t)=>e&&Object.keys(e).reduce((n,a)=>{const s=n[a];return s===null?n:Array.isArray(s)?Array.isArray(n)?(n[a]=Tt(s,t),n):wn(Tn({},n),{[a]:s.map(i=>Tt(i,t))}):typeof s=="object"?s._isAMomentObject===!0?wn(Tn({},n),{[a]:s}):Array.isArray(n)?(n[a]=Tt(s,t),n):wn(Tn({},n),{[a]:Tt(s,t)}):(a===t&&delete n[a],n)},e),fu=Tt,Fo=(e,t,n)=>{const a=(s,i)=>Object.keys(s).reduce((l,u)=>{const c=(0,y.getType)(i,u),d=(0,q.get)(s,u),m=(0,y.getOtherInfos)(i,[u,"component"]),f=(0,y.getOtherInfos)(i,[u,"repeatable"]);return c==="dynamiczone"?(l[u]=d.map(g=>a(g,n[g.__component])),l):c==="component"?(f?l[u]=d&&d.map(g=>a(g,n[m])):l[u]=d&&a(d,n[m]),l):(c!=="password"&&(l[u]=d),l)},{});return a(e,t)};var gu=Object.defineProperty,yu=Object.defineProperties,hu=Object.getOwnPropertyDescriptors,ko=Object.getOwnPropertySymbols,bu=Object.prototype.hasOwnProperty,Eu=Object.prototype.propertyIsEnumerable,Ao=(e,t,n)=>t in e?gu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wt=(e,t)=>{for(var n in t||(t={}))bu.call(t,n)&&Ao(e,n,t[n]);if(ko)for(var n of ko(t))Eu.call(t,n)&&Ao(e,n,t[n]);return e},It=(e,t)=>yu(e,hu(t));const In=(e,t)=>t.find(n=>n.uid===e),vu=(e,t)=>e.layouts.editRelations.reduce((a,s)=>{const i=(0,q.get)(e,["attributes",s],{}),l=(0,q.get)(e,["attributes",s,"targetModel"],null),c=In(l,t).pluginOptions||{},d=(0,q.get)(e,["metadatas",s,"edit"],{}),m=6,f=$o(e,s,t);return a.push({name:s,size:m,fieldSchema:i,metadatas:d,queryInfos:f,targetModelPluginOptions:c}),a},[]),Cu=(e,t)=>{const n=Ou(e,t),a=jo(n.contentType,null,t),s=n.contentType.uid,i=vu(n.contentType,t),l=Pu(n.contentType,n.components);return(0,q.set)(n,["contentType","layouts","edit"],a),(0,q.set)(n,["contentType","layouts","editRelations"],i),(0,q.set)(n,["contentType","layouts","list"],l),Object.keys(n.components).forEach(u=>{const c=jo(n.components[u],s,t);(0,q.set)(n,["components",u,"layouts","edit"],c)}),n},Ou=(e,t)=>{const n=xo((0,q.cloneDeep)(e),t,"contentType"),{components:a,contentType:s}=n,i=l=>Object.keys(l.metadatas).reduce((u,c)=>{const d=(0,q.get)(l,["attributes",c],{});let m=l.metadatas[c];if(d.type==="relation"){const f=In(d.targetModel,t),g=m.edit.mainField,h={name:g,schema:(0,q.get)(f,["attributes",g])};m={list:It(wt({},m.list),{mainField:h}),edit:It(wt({},m.edit),{mainField:h})}}return u[c]=m,u},{});return(0,q.set)(n,["contentType","metadatas"],i(s)),Object.keys(a).forEach(l=>{const u=a[l],c=i(u);(0,q.set)(n,["components",l,"metadatas"],c)}),n},jo=(e,t,n)=>e.layouts.edit.reduce((s,i)=>{const l=i.map(u=>{const c=(0,q.get)(e,["attributes",u.name],{}),d=It(wt({},u),{fieldSchema:c,metadatas:(0,q.get)(e,["metadatas",u.name,"edit"],{})});if(c.type==="relation"){const m=c.targetModel,g=In(m,n).pluginOptions||{},h=t?Ru(e,u.name,t,n):$o(e,u.name,n);(0,q.set)(d,"targetModelPluginOptions",g),(0,q.set)(d,"queryInfos",h)}return d});return s.push(l),s},[]),Pu=(e,t)=>e.layouts.list.reduce((a,s)=>{const i=(0,q.get)(e,["attributes",s],{}),l=(0,q.get)(e,["metadatas",s,"list"],{}),u=i.type;if(u==="relation"){const c={endPoint:`collection-types/${e.uid}`,defaultParams:{}};return a.push({key:`__${s}_key__`,name:s,fieldSchema:i,metadatas:l,queryInfos:c}),a}if(u==="component"){const c=t[i.component],d=c.settings.mainField,m=c.attributes[d];return a.push({key:`__${s}_key__`,name:s,fieldSchema:i,metadatas:It(wt({},l),{mainField:It(wt({},m),{name:d})})}),a}return a.push({key:`__${s}_key__`,name:s,fieldSchema:i,metadatas:l}),a},[]),$o=(e,t,n)=>{const a=e.uid,s=ve(`relations/${a}/${t}`),i=(0,q.get)(e,["metadatas",t,"edit","mainField","name"],""),l=(0,q.get)(e,["attributes",t,"targetModel"],""),u=Bo(n).indexOf(l)!==-1;return{endPoint:s,containsKey:`${i}`,defaultParams:{},shouldDisplayRelationLink:u}},Ru=(e,t,n,a)=>{const s=ve(`relations/${n}/${t}`),i=(0,q.get)(e,["metadatas",t,"edit","mainField","name"],""),l=(0,q.get)(e,["attributes",t,"targetModel"],""),u=Bo(a).indexOf(l)!==-1;return{endPoint:s,containsKey:`${i}`,defaultParams:{_component:e.uid},shouldDisplayRelationLink:u}},Bo=e=>e.filter(t=>t.isDisplayed).map(({uid:t})=>t),No=Cu;var _t=p(49415),Mu=Object.defineProperty,Tu=Object.defineProperties,wu=Object.getOwnPropertyDescriptors,Vo=Object.getOwnPropertySymbols,Iu=Object.prototype.hasOwnProperty,Du=Object.prototype.propertyIsEnumerable,qo=(e,t,n)=>t in e?Mu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zt=(e,t)=>{for(var n in t||(t={}))Iu.call(t,n)&&qo(e,n,t[n]);if(Vo)for(var n of Vo(t))Du.call(t,n)&&qo(e,n,t[n]);return e},Wo=(e,t)=>Tu(e,wu(t));const xu={error:null,isLoading:!0,layout:{},layouts:{}},Su=(e,t)=>(0,_t.default)(e,n=>{switch(t.type){case"GET_DATA":{n.isLoading=!0,n.error=null,n.layout={};break}case"GET_DATA_SUCCEEDED":{const a=t.data.contentType.uid;n.layout=t.data,n.layouts[a]=t.data,n.isLoading=!1;break}case"GET_DATA_ERROR":{n.isLoading=!1,n.error=t.error;break}case"SET_LAYOUT_FROM_STATE":{n.error=null,n.layout=e.layouts[t.uid];break}case"UPDATE_LAYOUT":{const a=e.layout;n.layout=Wo(Zt({},a),{contentType:Zt({uid:a.contentType.uid},t.newLayout.contentType)}),n.layouts[a.contentType.uid]=Wo(Zt({},a),{contentType:Zt({uid:a.contentType.uid},t.newLayout.contentType)});break}default:return n}});var Dn=p(12463),Lu=p(6057);const Dt=()=>e=>e["content-manager_app"]||Lu.E,IO=()=>createSelector(Dt(),e=>e),DO=()=>createSelector(Dt(),e=>e.models),Fu=()=>(0,Dn.P1)(Dt(),e=>({collectionTypeLinks:e.collectionTypeLinks,singleTypeLinks:e.singleTypeLinks})),xn=()=>(0,Dn.P1)(Dt(),({components:e,models:t})=>({schemas:[...e,...t]})),xO=null;var ku=p(98399),Au=(e,t,n)=>new Promise((a,s)=>{var i=c=>{try{u(n.next(c))}catch(d){s(d)}},l=c=>{try{u(n.throw(c))}catch(d){s(d)}},u=c=>c.done?a(c.value):Promise.resolve(c.value).then(i,l);u((n=n.apply(e,t)).next())});const zo=e=>{const[{error:t,isLoading:n,layout:a,layouts:s},i]=(0,r.useReducer)(Su,xu),l=(0,r.useMemo)(xn,[]),{schemas:u}=(0,fe.v9)(f=>l(f),fe.wU),c=(0,r.useRef)(!0),d=(0,r.useCallback)((f,g)=>Au(void 0,null,function*(){if(s[f]){i({type:"SET_LAYOUT_FROM_STATE",uid:f});return}i({type:"GET_DATA"});try{const h=ve(`content-types/${f}/configuration`),{data:{data:b}}=yield ge.be.get(h,{cancelToken:g.token});i({type:"GET_DATA_SUCCEEDED",data:No(b,u)})}catch(h){if(Se().isCancel(h))return;c.current&&ku.error(h),c.current&&i({type:"GET_DATA_ERROR",error:h})}}),[s,u]);(0,r.useEffect)(()=>()=>{c.current=!1},[]),(0,r.useEffect)(()=>{const g=Se().CancelToken.source();return d(e,g),()=>{g.cancel("Operation canceled by the user.")}},[e,d]);const m=(0,r.useCallback)(f=>{i({type:"UPDATE_LAYOUT",newLayout:No({contentType:f,components:{}},u)})},[u]);return{error:t,isLoading:n,layout:a,updateLayout:m}},ju=e=>e["content-manager_app"].collectionTypeLinks;var We=p(16308),$u=p(33795),R=p.n($u),Bu=p(85973),Uo=p.n(Bu),Nu=Object.defineProperty,Vu=Object.defineProperties,qu=Object.getOwnPropertyDescriptors,Ho=Object.getOwnPropertySymbols,Wu=Object.prototype.hasOwnProperty,zu=Object.prototype.propertyIsEnumerable,_o=(e,t,n)=>t in e?Nu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Uu=(e,t)=>{for(var n in t||(t={}))Wu.call(t,n)&&_o(e,n,t[n]);if(Ho)for(var n of Ho(t))zu.call(t,n)&&_o(e,n,t[n]);return e},Hu=(e,t)=>Vu(e,qu(t));const Zo=(e,t)=>Object.keys(e).reduce((n,a)=>{const s=e[a],i=R()(t,[a],s);return Uo()(s)?Hu(Uu({},n),{[a]:Zo(s,i)}):(n[a]=i,n)},{}),_u=(e,t,n)=>{const a=e.find(({to:m})=>m.includes(t));if(!a)return"/";const{to:s,search:i}=a,l=(0,We.parse)(i),u=(0,We.parse)(n.substring(1)),c=Zo(l,u);return`${s}?${(0,We.stringify)(c,{encode:!1})}`},Go=e=>{const[{rawQuery:t}]=(0,y.useQueryParams)(),n=(0,fe.v9)(ju);return _u(n,e,t)},Qe=()=>(0,r.useContext)(Vt),Qo=()=>{const{search:e}=(0,te.useLocation)(),t=e?(0,We.parse)(e.substring(1)):{};return t.plugins?(0,We.stringify)({plugins:t.plugins},{encode:!1}):""};var Ko=p(50819);const Zu=(e,t,n)=>({type:Ko.m,permissions:e,__meta__:{plugins:t,containerName:n}}),Gu=()=>({type:Ko.Q}),Qu=e=>e["content-manager_rbacManager"].permissions,Ku=e=>e.rbacProvider.collectionTypesRelatedPermissions,Yo=(e,t,n="listView")=>{const a=(0,fe.v9)(Ku),s=(0,fe.v9)(Qu),i=(0,fe.I0)(),l=a[t];return(0,r.useEffect)(()=>l?(i(Zu(l,e?e.plugins:null,n)),()=>{i(Gu())}):()=>{},[l,i,e,n]),s},BO=()=>useContext(WysiwygContext),NO=null;var Gt=p(71630),Jo=p(84393);const Yu=()=>({type:Jo.c}),Ju=(e,t)=>({type:Jo.O,layout:e,query:t});var Xu=p(8266),He=p.n(Xu),Qt=p(27635),le=p(78330),Kt=p(74064),ed=p(70404),td=p.n(ed),nd=p(87951);const rd=()=>(0,r.useContext)(nd.ux),Xo=e=>{const{getAdminInjectedComponents:t}=rd(),[n,a,s]=e.split(".");return t(n,a,s)};var od=Object.defineProperty,Yt=Object.getOwnPropertySymbols,ea=Object.prototype.hasOwnProperty,ta=Object.prototype.propertyIsEnumerable,na=(e,t,n)=>t in e?od(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ad=(e,t)=>{for(var n in t||(t={}))ea.call(t,n)&&na(e,n,t[n]);if(Yt)for(var n of Yt(t))ta.call(t,n)&&na(e,n,t[n]);return e},sd=(e,t)=>{var n={};for(var a in e)ea.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&Yt)for(var a of Yt(e))t.indexOf(a)<0&&ta.call(e,a)&&(n[a]=e[a]);return n};const ra=e=>{var t=e,{area:n}=t,a=sd(t,["area"]);return Xo(n).map(i=>r.createElement(i.Component,ad({key:i.name},a)))};ra.propTypes={area:o().string.isRequired};const Jt=ra;var id=Object.defineProperty,oa=Object.getOwnPropertySymbols,ld=Object.prototype.hasOwnProperty,cd=Object.prototype.propertyIsEnumerable,aa=(e,t,n)=>t in e?id(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,sa=(e,t)=>{for(var n in t||(t={}))ld.call(t,n)&&aa(e,n,t[n]);if(oa)for(var n of oa(t))cd.call(t,n)&&aa(e,n,t[n]);return e};function ud(e,t){return function(n){const a=t(n.name);return r.createElement(e,sa(sa({},n),a))}}const dd=ud;function pd(e){const{addComponentToDynamicZone:t,createActionAllowedFields:n,isCreatingEntry:a,formErrors:s,modifiedData:i,moveComponentUp:l,moveComponentDown:u,removeComponentFromDynamicZone:c,readActionAllowedFields:d,updateActionAllowedFields:m}=(0,y.useCMEditViewDataManager)(),f=(0,r.useMemo)(()=>(0,q.get)(i,[e],[]).map(b=>b.__component),[i,e]),g=(0,r.useMemo)(()=>(a?n:m).includes(e),[e,a,n,m]),h=(0,r.useMemo)(()=>(a?[]:d).includes(e),[e,a,d]);return{addComponentToDynamicZone:t,formErrors:s,isCreatingEntry:a,isFieldAllowed:g,isFieldReadable:h,moveComponentUp:l,moveComponentDown:u,removeComponentFromDynamicZone:c,dynamicDisplayedComponents:f}}const md=pd;var fd=p(51542),ia=p.n(fd),Sn=p(98195);const Ln=(0,S.default)(ia())`
71
- transform: ${({$isOpen:e})=>e?"rotate(45deg)":"rotate(0deg)"};
72
- > circle {
73
- fill: ${({theme:e,$hasError:t})=>t?e.colors.danger200:e.colors.neutral150};
74
- }
75
- > path {
76
- fill: ${({theme:e,$hasError:t})=>t?e.colors.danger600:e.colors.neutral600};
77
- }
78
- `,gd=(0,S.default)(Sn.BaseButton)`
79
- border-radius: 26px;
80
- border-color: ${({theme:e})=>e.colors.neutral150};
81
- background: ${({theme:e})=>e.colors.neutral0};
82
- padding-top: ${({theme:e})=>e.spaces[3]};
83
- padding-right: ${({theme:e})=>e.spaces[4]};
84
- padding-bottom: ${({theme:e})=>e.spaces[3]};
85
- padding-left: ${({theme:e})=>e.spaces[4]};
86
-
87
- box-shadow: ${({theme:e})=>e.shadows.filterShadow};
88
-
89
- svg {
90
- height: ${({theme:e})=>e.spaces[6]};
91
- width: ${({theme:e})=>e.spaces[6]};
92
- > path {
93
- fill: ${({theme:e})=>e.colors.neutral600};
94
- }
95
- }
96
- &:hover {
97
- color: ${({theme:e})=>e.colors.primary600} !important;
98
- ${L.Typography} {
99
- color: ${({theme:e})=>e.colors.primary600} !important;
100
- }
101
-
102
- ${Ln} {
103
- > circle {
104
- fill: ${({theme:e})=>e.colors.primary600};
105
- }
106
- > path {
107
- fill: ${({theme:e})=>e.colors.neutral100};
108
- }
109
- }
110
- }
111
- &:active {
112
- ${L.Typography} {
113
- color: ${({theme:e})=>e.colors.primary600};
114
- }
115
- ${Ln} {
116
- > circle {
117
- fill: ${({theme:e})=>e.colors.primary600};
118
- }
119
- > path {
120
- fill: ${({theme:e})=>e.colors.neutral100};
121
- }
122
- }
123
- }
124
- `,yd=(0,S.default)(w.Box)`
125
- height: 100%;
126
- `,Fn=({hasError:e,hasMaxError:t,hasMinError:n,isDisabled:a,isOpen:s,label:i,missingComponentNumber:l,name:u,onClick:c})=>{const{formatMessage:d}=(0,A.useIntl)(),m=d({id:v("components.DynamicZone.add-component"),defaultMessage:"Add a component to {componentName}"},{componentName:i||u}),f=d({id:"app.utils.close-label",defaultMessage:"Close"});let g=s?f:m;return t&&!s&&(g=d({id:"components.Input.error.validation.max",defaultMessage:"The value is too high."})),n&&!s&&(g=d({id:v("components.DynamicZone.missing-components"),defaultMessage:"There {number, plural, =0 {are # missing components} one {is # missing component} other {are # missing components}}"},{number:l})),r.createElement(r.Fragment,null,r.createElement(j.Flex,{justifyContent:"center"},r.createElement(w.Box,{style:{cursor:a?"not-allowed":"pointer"}},r.createElement(gd,{type:"button",onClick:c,disabled:a,hasError:e},r.createElement(j.Flex,null,r.createElement(yd,{"aria-hidden":!0,paddingRight:2},r.createElement(Ln,{$isOpen:s,$hasError:e&&!s})),r.createElement(L.Typography,{variant:"pi",fontWeight:"bold",textColor:e&&!s?"danger600":"neutral500"},g))))))};Fn.defaultProps={label:"",missingComponentNumber:0},Fn.propTypes={label:o().string,hasError:o().bool.isRequired,hasMaxError:o().bool.isRequired,hasMinError:o().bool.isRequired,isDisabled:o().bool.isRequired,isOpen:o().bool.isRequired,missingComponentNumber:o().number,name:o().string.isRequired,onClick:o().func.isRequired};const hd=Fn,bd=(0,S.default)(w.Box)`
127
- border-radius: ${(0,y.pxToRem)(26)};
128
- `,kn=({label:e,labelAction:t,name:n,numberOfComponents:a,required:s,intlDescription:i})=>{const{formatMessage:l}=(0,A.useIntl)(),u=l({id:e||n,defaultMessage:e||n});return r.createElement(j.Flex,{justifyContent:"center"},r.createElement(w.Box,null,r.createElement(bd,{paddingTop:3,paddingBottom:3,paddingRight:4,paddingLeft:4,background:"neutral0",shadow:"filterShadow",color:"neutral500"},r.createElement(j.Flex,{direction:"column",justifyContent:"center"},r.createElement(j.Flex,{maxWidth:(0,y.pxToRem)(356)},r.createElement(L.Typography,{variant:"pi",textColor:"neutral600",fontWeight:"bold",ellipsis:!0},u,"\xA0"),r.createElement(L.Typography,{variant:"pi",textColor:"neutral600",fontWeight:"bold"},"(",a,")"),s&&r.createElement(L.Typography,{textColor:"danger600"},"*"),t&&r.createElement(w.Box,{paddingLeft:1},t)),i&&r.createElement(w.Box,{paddingTop:1,maxWidth:(0,y.pxToRem)(356)},r.createElement(L.Typography,{variant:"pi",textColor:"neutral600",ellipsis:!0},l(i)))))))};kn.defaultProps={intlDescription:void 0,label:"",labelAction:void 0,required:!1},kn.propTypes={intlDescription:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired}),label:o().string,labelAction:o().element,name:o().string.isRequired,numberOfComponents:o().number.isRequired,required:o().bool};const Ed=kn;var An=p(16925),_e=p(12001),jn=p(54742),vd=p(78325),Cd=p.n(vd),Od=p(30857),Pd=p.n(Od),Rd=p(61868),Md=p.n(Rd),Td=Object.defineProperty,la=Object.getOwnPropertySymbols,wd=Object.prototype.hasOwnProperty,Id=Object.prototype.propertyIsEnumerable,ca=(e,t,n)=>t in e?Td(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Dd=(e,t)=>{for(var n in t||(t={}))wd.call(t,n)&&ca(e,n,t[n]);if(la)for(var n of la(t))Id.call(t,n)&&ca(e,n,t[n]);return e};const xd=S.default.span`
129
- > svg {
130
- width: ${(0,y.pxToRem)(24)};
131
- height: ${(0,y.pxToRem)(24)};
132
- > circle {
133
- fill: ${({theme:e})=>e.colors.primary200};
134
- }
135
- > path {
136
- fill: ${({theme:e})=>e.colors.primary600};
137
- }
138
- }
139
- `,$n=({error:e,isReadOnly:t,onClick:n})=>{const{formatMessage:a}=(0,A.useIntl)();return r.createElement(r.Fragment,null,r.createElement(w.Box,{as:"button",background:"neutral100",borderColor:e?"danger600":"neutral200",disabled:t,hasRadius:!0,onClick:n,paddingTop:9,paddingBottom:9,type:"button"},r.createElement(ae.Stack,{spacing:2},r.createElement(j.Flex,{justifyContent:"center",style:{cursor:t?"not-allowed":"inherit"}},r.createElement(xd,null,r.createElement(ia(),null))),r.createElement(j.Flex,{justifyContent:"center"},r.createElement(L.Typography,{textColor:"primary600",variant:"pi",fontWeight:"bold"},a({id:v("components.empty-repeatable"),defaultMessage:"No entry yet. Click on the button below to add one."}))))),(e==null?void 0:e.id)&&r.createElement(L.Typography,{textColor:"danger600",variant:"pi"},a({id:e.id,defaultMessage:e.id},Dd({},e.values))))};$n.defaultProps={error:void 0,isReadOnly:!1},$n.propTypes={error:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),isReadOnly:o().bool,onClick:o().func.isRequired};const ua=$n;var Sd=p(9086),Ld=p.n(Sd),Fd=p(88708),Xt=p.n(Fd),kd=p(27509),en=p.n(kd),WO=p(40795),Ad=p(88591),jd=p.n(Ad),Bn=p(59845),$d=p(20871),Bd=p.n($d),Nd=p(48375),da=p.n(Nd),Vd=p(31089),qd=p.n(Vd),Wd=p(16043),zd=p.n(Wd),Ud=p(5109),Hd=p.n(Ud),_d=p(47955),Zd=p.n(_d),Gd=p(95706),Qd=p.n(Gd),Kd=p(6658),Yd=p.n(Kd),Jd=p(36407),Xd=p.n(Jd),ep=(e,t,n)=>new Promise((a,s)=>{var i=c=>{try{u(n.next(c))}catch(d){s(d)}},l=c=>{try{u(n.throw(c))}catch(d){s(d)}},u=c=>c.done?a(c.value):Promise.resolve(c.value).then(i,l);u((n=n.apply(e,t)).next())});(()=>ep(void 0,null,function*(){yield p.e(7347).then(p.bind(p,98362))}))();const pt=new(jd())({html:!0,xhtmlOut:!1,breaks:!0,langPrefix:"language-",linkify:!0,typographer:!0,highlight:(e,t)=>{if(t&&t!=="auto"&&(0,Bn.getLanguage)(t))return'<pre class="hljs language-'+pt.utils.escapeHtml(t.toLowerCase())+'"><code>'+(0,Bn.highlight)(t,e,!0).value+"</code></pre>";if(t==="auto"){const n=(0,Bn.highlightAuto)(e);return'<pre class="hljs language-'+pt.utils.escapeHtml(n.language)+'"><code>'+n.value+"</code></pre>"}return'<pre class="hljs"><code>'+pt.utils.escapeHtml(e)+"</code></pre>"}}).use(Bd()).use(da(),"warning").use(da(),"tip").use(qd()).use(zd()).use(Hd()).use(Zd()).use(Qd()).use(Yd()).use(Xd());pt.renderer.rules.footnote_ref=(e,t,n,a,s)=>{const i=s.rules.footnote_caption(e,t,n,a,s);return'<sup class="footnote-ref"><span>'+i+"</span></sup>"},pt.renderer.rules.footnote_anchor=()=>' <span class="footnote-backref">\u21A9\uFE0E</span>';const tp=pt;var np=p(13993),pa=p.n(np),rp=Object.defineProperty,op=Object.defineProperties,ap=Object.getOwnPropertyDescriptors,ma=Object.getOwnPropertySymbols,sp=Object.prototype.hasOwnProperty,ip=Object.prototype.propertyIsEnumerable,fa=(e,t,n)=>t in e?rp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lp=(e,t)=>{for(var n in t||(t={}))sp.call(t,n)&&fa(e,n,t[n]);if(ma)for(var n of ma(t))ip.call(t,n)&&fa(e,n,t[n]);return e},cp=(e,t)=>op(e,ap(t));const up=cp(lp({},pa().defaults),{allowedTags:!1,allowedAttributes:{"*":["href","align","alt","center","width","height","type","controls","target"],img:["src","alt"],source:["src","type"]}}),dp=e=>pa()(e,up),pp=S.default.div`
140
- position: absolute;
141
- top: 0;
142
- width: 100%;
143
- height: 100%;
144
- overflow: auto;
145
- padding: ${({theme:e})=>`${e.spaces[3]} ${e.spaces[4]}`};
146
- font-size: ${14/16}rem;
147
- background-color: ${({theme:e})=>e.colors.neutral0};
148
- z-index: 2;
149
- cursor: not-allowed;
150
- color: ${({theme:e})=>e.colors.neutral800};
151
-
152
- h1,
153
- h2,
154
- h3,
155
- h4,
156
- h5,
157
- h6 {
158
- margin-block-start: 10px;
159
- margin-block-end: 10px;
160
- }
161
-
162
- p {
163
- margin-bottom: 10px;
164
- }
165
-
166
- h1 {
167
- font-size: ${36/16}rem;
168
- font-weight: 600;
169
- }
170
-
171
- h2 {
172
- font-size: ${30/16}rem;
173
- font-weight: 500;
174
- }
175
-
176
- h3 {
177
- font-size: ${24/16}rem;
178
- font-weight: 500;
179
- }
180
-
181
- h4 {
182
- font-size: ${20/16}rem;
183
- font-weight: 500;
184
- }
185
-
186
- strong {
187
- font-weight: 800;
188
- }
189
-
190
- em {
191
- font-style: italic;
192
- }
193
-
194
- blockquote {
195
- margin-top: 41px;
196
- margin-bottom: 34px;
197
- font-size: ${14/16}rem;
198
- font-weight: 400;
199
- border-left: 5px solid #eee;
200
- font-style: italic;
201
- padding: 10px 20px;
202
- }
203
-
204
- img {
205
- max-width: 100%;
206
- }
207
-
208
- table {
209
- font-size: 13px;
210
- thead {
211
- background: rgb(243, 243, 243);
212
- tr {
213
- height: 43px;
214
- }
215
- }
216
- tr {
217
- border: 1px solid #c6cbd1;
218
- }
219
- th,
220
- td {
221
- padding: 0 25px;
222
- border: 1px solid #c6cbd1;
223
- border-bottom: 0;
224
- border-top: 0;
225
- }
226
-
227
- tbody {
228
- tr {
229
- height: 54px;
230
- }
231
- }
232
- }
233
-
234
- pre,
235
- code {
236
- font-size: 13px;
237
- border-radius: 3px;
238
- background-color: #002b36;
239
- }
240
-
241
- /* Inline code */
242
- p,
243
- pre,
244
- td {
245
- > code {
246
- color: #839496;
247
- }
248
- }
249
-
250
- .warning {
251
- background-color: #faa684;
252
- padding: 30px;
253
- border-radius: 3px;
254
- }
255
- .tip {
256
- padding: 30px;
257
- border-radius: 3px;
258
- }
259
-
260
- .footnote-ref,
261
- .footnote-backref {
262
- color: #007bff;
263
- }
264
-
265
- ol {
266
- list-style-type: decimal;
267
- margin-block-start: ${({theme:e})=>e.spaces[4]};
268
- margin-block-end: ${({theme:e})=>e.spaces[4]};
269
- margin-inline-start: 0px;
270
- margin-inline-end: 0px;
271
- padding-inline-start: ${({theme:e})=>e.spaces[4]};
272
- ol,
273
- ul {
274
- margin-block-start: 0px;
275
- margin-block-end: 0px;
276
- }
277
- }
278
-
279
- ul {
280
- list-style-type: disc;
281
- margin-block-start: ${({theme:e})=>e.spaces[4]};
282
- margin-block-end: ${({theme:e})=>e.spaces[4]};
283
- margin-inline-start: 0px;
284
- margin-inline-end: 0px;
285
- padding-inline-start: ${({theme:e})=>e.spaces[4]};
286
- ul,
287
- ol {
288
- margin-block-start: 0px;
289
- margin-block-end: 0px;
290
- }
291
- }
292
- `,Nn=({data:e})=>{const t=(0,r.useMemo)(()=>dp(tp.render(e||"")),[e]);return r.createElement(pp,null,r.createElement("div",{dangerouslySetInnerHTML:{__html:t}}))};Nn.defaultProps={data:""},Nn.propTypes={data:o().string};const ga=(0,r.memo)(Nn),mp=S.default.div`
293
- cursor: ${({disabled:e})=>e?"not-allowed !important":"auto"};
294
- height: 100%;
295
- /* BASICS */
296
- .CodeMirror-placeholder {
297
- color: ${({theme:e})=>e.colors.neutral600} !important;
298
- }
299
-
300
- .CodeMirror {
301
- /* Set height, width, borders, and global font properties here */
302
- font-size: ${14/16}rem;
303
- height: ${({isExpandMode:e})=>e?"100%":"290px"};
304
- color: ${({theme:e})=>e.colors.neutral800};
305
- direction: ltr;
306
- font-family: --apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
307
- 'Open Sans', 'Helvetica Neue', sans-serif;
308
- }
309
-
310
- /* PADDING */
311
-
312
- .CodeMirror-lines {
313
- padding: ${({theme:e})=>`${e.spaces[3]} ${e.spaces[4]}`};
314
- /* Vertical padding around content */
315
- }
316
-
317
- .CodeMirror-scrollbar-filler,
318
- .CodeMirror-gutter-filler {
319
- /* The little square between H and V scrollbars */
320
- background-color: ${({theme:e})=>`${e.colors.neutral0}`};
321
- }
322
-
323
- /* GUTTER */
324
-
325
- .CodeMirror-gutters {
326
- border-right: 1px solid #ddd;
327
- background-color: #f7f7f7;
328
- white-space: nowrap;
329
- }
330
- .CodeMirror-linenumbers {
331
- }
332
- .CodeMirror-linenumber {
333
- padding: 0 3px 0 5px;
334
- min-width: 20px;
335
- text-align: right;
336
- color: #999;
337
- white-space: nowrap;
338
- }
339
-
340
- .CodeMirror-guttermarker {
341
- color: black;
342
- }
343
- .CodeMirror-guttermarker-subtle {
344
- color: #999;
345
- }
346
-
347
- /* CURSOR */
348
-
349
- .CodeMirror-cursor {
350
- border-left: 1px solid black;
351
- border-right: none;
352
- width: 0;
353
- }
354
- /* Shown when moving in bi-directional text */
355
- .CodeMirror div.CodeMirror-secondarycursor {
356
- border-left: 1px solid silver;
357
- }
358
- .cm-fat-cursor .CodeMirror-cursor {
359
- width: auto;
360
- border: 0 !important;
361
- background: #7e7;
362
- }
363
- .cm-fat-cursor div.CodeMirror-cursors {
364
- /* z-index: 1; */
365
- }
366
-
367
- .cm-fat-cursor-mark {
368
- background-color: rgba(20, 255, 20, 0.5);
369
- -webkit-animation: blink 1.06s steps(1) infinite;
370
- -moz-animation: blink 1.06s steps(1) infinite;
371
- animation: blink 1.06s steps(1) infinite;
372
- }
373
- .cm-animate-fat-cursor {
374
- width: auto;
375
- border: 0;
376
- -webkit-animation: blink 1.06s steps(1) infinite;
377
- -moz-animation: blink 1.06s steps(1) infinite;
378
- animation: blink 1.06s steps(1) infinite;
379
- background-color: #7e7;
380
- }
381
-
382
- /* Can style cursor different in overwrite (non-insert) mode */
383
- .CodeMirror-overwrite .CodeMirror-cursor {
384
- }
385
-
386
- .cm-tab {
387
- display: inline-block;
388
- text-decoration: inherit;
389
- }
390
-
391
- .CodeMirror-rulers {
392
- position: absolute;
393
- left: 0;
394
- right: 0;
395
- top: -50px;
396
- bottom: 0;
397
- overflow: hidden;
398
- }
399
- .CodeMirror-ruler {
400
- border-left: 1px solid #ccc;
401
- top: 0;
402
- bottom: 0;
403
- position: absolute;
404
- }
405
-
406
- /* DEFAULT THEME */
407
-
408
- .cm-header,
409
- .cm-strong {
410
- font-weight: bold;
411
- }
412
- .cm-em {
413
- font-style: italic;
414
- }
415
- .cm-link {
416
- text-decoration: underline;
417
- }
418
- .cm-strikethrough {
419
- text-decoration: line-through;
420
- }
421
-
422
- .CodeMirror-composing {
423
- border-bottom: 2px solid;
424
- }
425
-
426
- /* Default styles for common addons */
427
-
428
- div.CodeMirror span.CodeMirror-matchingbracket {
429
- color: #0b0;
430
- }
431
- div.CodeMirror span.CodeMirror-nonmatchingbracket {
432
- color: #a22;
433
- }
434
- .CodeMirror-matchingtag {
435
- background: rgba(255, 150, 0, 0.3);
436
- }
437
- .CodeMirror-activeline-background {
438
- background: #e8f2ff;
439
- }
440
-
441
- /* STOP */
442
-
443
- /* The rest of this file contains styles related to the mechanics of
444
- the editor. You probably shouldn't touch them. */
445
-
446
- .CodeMirror {
447
- position: relative;
448
- overflow: hidden;
449
- background: ${({theme:e})=>`${e.colors.neutral0}`};
450
- }
451
-
452
- .CodeMirror-scroll {
453
- overflow: scroll !important; /* Things will break if this is overridden */
454
- /* 50px is the magic margin used to hide the element's real scrollbars */
455
- /* See overflow: hidden in .CodeMirror */
456
- margin-bottom: -50px;
457
- margin-right: -50px;
458
- padding-bottom: 50px;
459
- height: 100%;
460
- outline: none; /* Prevent dragging from highlighting the element */
461
- position: relative;
462
- }
463
- .CodeMirror-sizer {
464
- position: relative;
465
- border-right: 50px solid transparent;
466
- }
467
-
468
- /* The fake, visible scrollbars. Used to force redraw during scrolling
469
- before actual scrolling happens, thus preventing shaking and
470
- flickering artifacts. */
471
- .CodeMirror-vscrollbar,
472
- .CodeMirror-hscrollbar,
473
- .CodeMirror-scrollbar-filler,
474
- .CodeMirror-gutter-filler {
475
- position: absolute;
476
- z-index: 1;
477
- display: none;
478
- outline: none;
479
- }
480
-
481
- .CodeMirror-vscrollbar {
482
- right: 0;
483
- top: 0;
484
- overflow-x: hidden;
485
- overflow-y: scroll;
486
- }
487
- .CodeMirror-hscrollbar {
488
- bottom: 0;
489
- left: 0;
490
- overflow-y: hidden;
491
- overflow-x: scroll;
492
- }
493
- .CodeMirror-scrollbar-filler {
494
- right: 0;
495
- bottom: 0;
496
- }
497
-
498
- .CodeMirror-lines {
499
- cursor: text;
500
- min-height: 1px; /* prevents collapsing before first draw */
501
- }
502
- /* Reset some styles that the rest of the page might have set */
503
- .CodeMirror pre.CodeMirror-line,
504
- .CodeMirror pre.CodeMirror-line-like {
505
- -moz-border-radius: 0;
506
- -webkit-border-radius: 0;
507
- border-radius: 0;
508
- border-width: 0;
509
- background: transparent;
510
- font-family: inherit;
511
- font-size: inherit;
512
- margin: 0;
513
- white-space: pre;
514
- word-wrap: normal;
515
- line-height: 1.5;
516
- color: inherit;
517
- /* z-index: 2; */
518
- position: relative;
519
- overflow: visible;
520
- -webkit-tap-highlight-color: transparent;
521
- -webkit-font-variant-ligatures: contextual;
522
- font-variant-ligatures: contextual;
523
- }
524
-
525
- .CodeMirror pre.CodeMirror-line-like {
526
- z-index: 2;
527
- }
528
-
529
- .CodeMirror-wrap pre.CodeMirror-line,
530
- .CodeMirror-wrap pre.CodeMirror-line-like {
531
- word-wrap: break-word;
532
- white-space: pre-wrap;
533
- word-break: normal;
534
- }
535
-
536
- .CodeMirror-linebackground {
537
- position: absolute;
538
- left: 0;
539
- right: 0;
540
- top: 0;
541
- bottom: 0;
542
- z-index: 0;
543
- }
544
-
545
- .CodeMirror-linewidget {
546
- position: relative;
547
- /* z-index: 2; */
548
- padding: 0.1px; /* Force widget margins to stay inside of the container */
549
- }
550
-
551
- .CodeMirror-widget {
552
- }
553
-
554
- .CodeMirror-rtl pre {
555
- direction: rtl;
556
- }
557
-
558
- .CodeMirror-code {
559
- outline: none;
560
- }
561
-
562
- /* Force content-box sizing for the elements where we expect it */
563
- .CodeMirror-scroll,
564
- .CodeMirror-sizer,
565
- .CodeMirror-gutter,
566
- .CodeMirror-gutters,
567
- .CodeMirror-linenumber {
568
- -moz-box-sizing: content-box;
569
- box-sizing: content-box;
570
- }
571
-
572
- .CodeMirror-measure {
573
- position: absolute;
574
- width: 100%;
575
- height: 0;
576
- overflow: hidden;
577
- visibility: hidden;
578
- }
579
-
580
- .CodeMirror-cursor {
581
- position: absolute;
582
- pointer-events: none;
583
- border-color: ${({theme:e})=>`${e.colors.neutral800}`};
584
- }
585
- .CodeMirror-measure pre {
586
- position: static;
587
- }
588
-
589
- div.CodeMirror-cursors {
590
- visibility: hidden;
591
- position: relative;
592
- + div {
593
- z-index: 0 !important;
594
- }
595
- }
596
-
597
- div.CodeMirror-dragcursors {
598
- visibility: visible;
599
- }
600
-
601
- .CodeMirror-focused div.CodeMirror-cursors {
602
- visibility: visible;
603
- }
604
-
605
- .CodeMirror-selected {
606
- background: ${({theme:e})=>e.colors.neutral200};
607
- /* z-index: -10; */
608
- }
609
- .CodeMirror-crosshair {
610
- cursor: crosshair;
611
- }
612
-
613
- /* Used to force a border model for a node */
614
- .cm-force-border {
615
- padding-right: 0.1px;
616
- }
617
-
618
- /* See issue #2901 */
619
- .cm-tab-wrap-hack:after {
620
- content: '';
621
- }
622
-
623
- /* Help users use markselection to safely style text background */
624
- span.CodeMirror-selectedtext {
625
- background: none;
626
- }
627
-
628
- span {
629
- color: ${({theme:e})=>e.colors.neutral800} !important;
630
- }
631
- `,Le=(0,S.default)(Me.IconButton)`
632
- padding: ${({theme:e})=>e.spaces[2]};
633
- /* Trick to prevent the outline from overflowing because of the general outline-offset */
634
- outline-offset: -2px !important;
635
-
636
- svg {
637
- width: ${18/16}rem;
638
- height: ${18/16}rem;
639
- }
640
- `,fp=(0,S.default)(Le)`
641
- svg {
642
- width: ${8/16}rem;
643
- height: ${8/16}rem;
644
- }
645
- `,ya=(0,S.default)(Me.IconButtonGroup)`
646
- margin-left: ${({theme:e})=>e.spaces[4]};
647
- `,ha=(0,S.default)(Me.IconButton)`
648
- margin: ${({theme:e})=>`0 ${e.spaces[2]}`};
649
- padding: ${({theme:e})=>e.spaces[2]};
650
-
651
- svg {
652
- width: ${18/16}rem;
653
- height: ${18/16}rem;
654
- }
655
- `,gp=(0,S.default)(Me.IconButtonGroup)`
656
- margin-right: ${({theme:e})=>`${e.spaces[2]}`};
657
- `,yp=S.default.div`
658
- position: relative;
659
- height: calc(100% - 48px);
660
- `,hp=(0,S.default)(Sn.BaseButton)`
661
- background-color: transparent;
662
- border: none;
663
- align-items: center;
664
-
665
- svg {
666
- margin-left: ${({theme:e})=>`${e.spaces[2]}`};
667
- path {
668
- fill: ${({theme:e})=>e.colors.neutral700};
669
- width: ${12/16}rem;
670
- height: ${12/16}rem;
671
- }
672
- }
673
- `;var tn=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,bp=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,Ep=/[*+-]\s/;function vp(e){if(e.getOption("disableInput"))return en().Pass;for(var t=e.listSelections(),n=[],a=0;a<t.length;a++){var s=t[a].head,i=e.getStateAfter(s.line),l=i.list!==!1,u=i.quote!==0,c=e.getLine(s.line),d=tn.exec(c),m=/^\s*$/.test(c.slice(0,s.ch));if(!t[a].empty()||!l&&!u||!d||m){e.execCommand("newlineAndIndent");return}if(bp.test(c)){var f=u&&/>\s*$/.test(c),g=!/>\s*$/.test(c);(f||g)&&e.replaceRange("",{line:s.line,ch:0},{line:s.line,ch:s.ch+1}),n[a]=`
674
- `}else{var h=d[1],b=d[5],E=!(Ep.test(d[2])||d[2].indexOf(">")>=0),O=E?parseInt(d[3],10)+1+d[4]:d[2].replace("x"," ");n[a]=`
675
- `+h+O+b,E&&Cp(e,s)}}e.replaceSelections(n)}function Cp(e,t){var n=t.line,a=0,s=0,i=tn.exec(e.getLine(n)),l=i[1];do{a+=1;var u=n+a,c=e.getLine(u),d=tn.exec(c);if(d){var m=d[1],f=parseInt(i[3],10)+a-s,g=parseInt(d[3],10),h=g;if(l===m&&!isNaN(g))f===g&&(h=g+1),f>g&&(h=f+1),e.replaceRange(c.replace(tn,m+h+d[4]+d[5]),{line:u,ch:0},{line:u,ch:c.length});else{if(l.length>m.length||l.length<m.length&&a===1)return;s+=1}}}while(d)}const Op=vp,Vn=({disabled:e,editorRef:t,error:n,isPreviewMode:a,isExpandMode:s,name:i,onChange:l,placeholder:u,textareaRef:c,value:d})=>{const m=(0,r.useRef)(l);return(0,r.useEffect)(()=>{t.current=en().fromTextArea(c.current,{lineWrapping:!0,extraKeys:{Enter:"newlineAndIndentContinueMarkdownList",Tab:!1,"Shift-Tab":!1},readOnly:!1,smartIndent:!1,placeholder:u}),en().commands.newlineAndIndentContinueMarkdownList=Op,t.current.on("change",f=>{m.current({target:{name:i,value:f.getValue(),type:"wysiwyg"}})})},[t,c,i,u]),(0,r.useEffect)(()=>{d&&!t.current.state.focused&&t.current.setValue(d)},[t,d]),(0,r.useEffect)(()=>{a||e?t.current.setOption("readOnly","nocursor"):t.current.setOption("readOnly",!1)},[e,a,t]),(0,r.useEffect)(()=>{n?t.current.setOption("screenReaderLabel",n):t.current.setOption("screenReaderLabel","Editor")},[t,n]),r.createElement(yp,null,r.createElement(mp,{isExpandMode:s,disabled:e||a},r.createElement("textarea",{ref:c})),a&&r.createElement(ga,{data:d}))};Vn.defaultProps={disabled:!1,error:void 0,isPreviewMode:!1,isExpandMode:!1,placeholder:"",value:""},Vn.propTypes={disabled:o().bool,editorRef:o().shape({current:o().any}).isRequired,error:o().string,isPreviewMode:o().bool,isExpandMode:o().bool,name:o().string.isRequired,onChange:o().func.isRequired,placeholder:o().string,textareaRef:o().shape({current:o().any}).isRequired,value:o().string};const Pp=Vn;var ye=p(44526),ue=p(25716),Rp=p(37853),Mp=p(19882),ba=p.n(Mp),Tp=p(61980),Ea=p.n(Tp),wp=p(70052),va=p.n(wp),Ip=p(15053),Dp=p.n(Ip),xp=p(18767),Sp=p.n(xp),Lp=p(83358),Fp=p.n(Lp),kp=p(69822),Ap=p.n(kp),jp=p(88467),$p=p.n(jp),Bp=p(83262),Np=p.n(Bp),Vp=p(49157),qp=p.n(Vp),Wp=p(75400),Ca=p.n(Wp);const qn=({disabled:e,editorRef:t,isExpandMode:n,isPreviewMode:a,onActionClick:s,onToggleMediaLib:i,onTogglePreviewMode:l})=>{const[u,c]=(0,r.useState)(!1),{formatMessage:d}=(0,A.useIntl)(),m=d({id:"components.Wysiwyg.selectOptions.title",defaultMessage:"Add a title"}),f=(0,r.useRef)(),g=()=>{c(h=>!h)};return e||a?r.createElement(w.Box,{padding:2,background:"neutral100"},r.createElement(j.Flex,{justifyContent:"space-between"},r.createElement(j.Flex,null,r.createElement(ue.Select,{disabled:!0,id:"selectTitle",placeholder:m,size:"S","aria-label":m},r.createElement(ue.Option,{value:"h1"},"h1"),r.createElement(ue.Option,{value:"h2"},"h2"),r.createElement(ue.Option,{value:"h3"},"h3"),r.createElement(ue.Option,{value:"h4"},"h4"),r.createElement(ue.Option,{value:"h5"},"h5"),r.createElement(ue.Option,{value:"h6"},"h6")),r.createElement(ya,null,r.createElement(Le,{disabled:!0,id:"Bold",label:"Bold",name:"Bold",icon:r.createElement(ba(),null)}),r.createElement(Le,{disabled:!0,id:"Italic",label:"Italic",name:"Italic",icon:r.createElement(Ea(),null)}),r.createElement(Le,{disabled:!0,id:"Underline",label:"Underline",name:"Underline",icon:r.createElement(va(),null)})),r.createElement(ha,{disabled:!0,id:"more",label:"More",icon:r.createElement(Ca(),null)})),!n&&r.createElement(ye.Button,{onClick:l,variant:"tertiary",id:"preview"},d({id:"components.Wysiwyg.ToggleMode.markdown-mode",defaultMessage:"Markdown mode"})))):r.createElement(w.Box,{padding:2,background:"neutral100"},r.createElement(j.Flex,{justifyContent:"space-between"},r.createElement(j.Flex,null,r.createElement(ue.Select,{id:"selectTitle",placeholder:m,size:"S",onChange:h=>s(h,t)},r.createElement(ue.Option,{value:"h1"},"h1"),r.createElement(ue.Option,{value:"h2"},"h2"),r.createElement(ue.Option,{value:"h3"},"h3"),r.createElement(ue.Option,{value:"h4"},"h4"),r.createElement(ue.Option,{value:"h5"},"h5"),r.createElement(ue.Option,{value:"h6"},"h6")),r.createElement(ya,null,r.createElement(Le,{onClick:()=>s("Bold",t),id:"Bold",label:"Bold",name:"Bold",icon:r.createElement(ba(),null)}),r.createElement(Le,{onClick:()=>s("Italic",t),id:"Italic",label:"Italic",name:"Italic",icon:r.createElement(Ea(),null)}),r.createElement(Le,{onClick:()=>s("Underline",t),id:"Underline",label:"Underline",name:"Underline",icon:r.createElement(va(),null)})),r.createElement(ha,{ref:f,onClick:g,id:"more",label:"More",icon:r.createElement(Ca(),null)}),u&&r.createElement(Rp.Popover,{centered:!0,source:f,spacing:4,id:"popover"},r.createElement(jn.FocusTrap,{onEscape:g,restoreFocus:!1},r.createElement(j.Flex,null,r.createElement(gp,null,r.createElement(Le,{onClick:()=>s("Strikethrough",t,g),id:"Strikethrough",label:"Strikethrough",name:"Strikethrough",icon:r.createElement(Dp(),null)}),r.createElement(Le,{onClick:()=>s("BulletList",t,g),id:"BulletList",label:"BulletList",name:"BulletList",icon:r.createElement(Sp(),null)}),r.createElement(Le,{onClick:()=>s("NumberList",t,g),id:"NumberList",label:"NumberList",name:"NumberList",icon:r.createElement(Fp(),null)})),r.createElement(Me.IconButtonGroup,null,r.createElement(Le,{onClick:()=>s("Code",t,g),id:"Code",label:"Code",name:"Code",icon:r.createElement(Ap(),null)}),r.createElement(Le,{onClick:()=>{g(),i()},id:"Image",label:"Image",name:"Image",icon:r.createElement($p(),null)}),r.createElement(fp,{onClick:()=>s("Link",t,g),id:"Link",label:"Link",name:"Link",icon:r.createElement(Np(),null)}),r.createElement(Le,{onClick:()=>s("Quote",t,g),id:"Quote",label:"Quote",name:"Quote",icon:r.createElement(qp(),null)})))))),l&&r.createElement(ye.Button,{onClick:l,variant:"tertiary",id:"preview"},d({id:"components.Wysiwyg.ToggleMode.preview-mode",defaultMessage:"Preview mode"}))))};qn.defaultProps={isPreviewMode:!1,onActionClick:()=>{},onToggleMediaLib:()=>{},onTogglePreviewMode:void 0},qn.propTypes={disabled:o().bool.isRequired,editorRef:o().shape({current:o().any}).isRequired,isExpandMode:o().bool.isRequired,isPreviewMode:o().bool,onActionClick:o().func,onToggleMediaLib:o().func,onTogglePreviewMode:o().func};const zp=qn;var Up=p(39766),Hp=p.n(Up);const Wn=({onToggleExpand:e})=>{const{formatMessage:t}=(0,A.useIntl)();return r.createElement(w.Box,{padding:2,background:"neutral100",hasRadius:!0},r.createElement(j.Flex,{justifyContent:"flex-end",alignItems:"flex-end"},r.createElement(hp,{id:"expand",onClick:e},r.createElement(L.Typography,null,t({id:"components.WysiwygBottomControls.fullscreen",defaultMessage:"Expand"})),r.createElement(Hp(),null))))};Wn.defaultProps={onToggleExpand:()=>{}},Wn.propTypes={onToggleExpand:o().func};const _p=Wn;var Zp=Object.defineProperty,Oa=Object.getOwnPropertySymbols,Gp=Object.prototype.hasOwnProperty,Qp=Object.prototype.propertyIsEnumerable,Pa=(e,t,n)=>t in e?Zp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Kp=(e,t)=>{for(var n in t||(t={}))Gp.call(t,n)&&Pa(e,n,t[n]);if(Oa)for(var n of Oa(t))Qp.call(t,n)&&Pa(e,n,t[n]);return e};const zn=({id:e,error:t,name:n,description:a})=>{const{formatMessage:s}=(0,A.useIntl)(),i=a?s({id:a.id,defaultMessage:a.defaultMessage},Kp({},a.values)):"";return!i||t?null:r.createElement(L.Typography,{as:"p",variant:"pi",id:`${e||n}-hint`,textColor:"neutral600"},i)};zn.defaultProps={id:void 0,description:void 0,error:void 0},zn.propTypes={description:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),error:o().string,id:o().string,name:o().string.isRequired};const Yp=zn,Ra=(e,t)=>{let n;switch(e){case"Strikethrough":n=`~~${t}~~`;break;case"Bold":n=`**${t}**`;break;case"Italic":n=`_${t}_`;break;case"Underline":n=`<u>${t}</u>`;break;case"Code":n=`\`\`\`
676
- ${t}
677
- \`\`\``;break;case"Link":n=`[${t}](link)`;break;case"Quote":n=`>${t}`;break;default:n=t}return n},Ma=e=>{let t,n={start:e.length,end:0};switch(e){case"Strikethrough":t=`~~${e}~~`,n.end=2;break;case"Bold":t=`**${e}**`,n.end=2;break;case"Italic":t=`_${e}_`,n.end=1;break;case"alt":t=`[${e}]()`,n.end=3;break;case"Underline":t=`<u>${e}</u>`,n.end=4;break;case"Code":t=`\`\`\`
678
- ${e}
679
- \`\`\``,n.end=3;break;case"Link":t=`[${e}](link)`,n.end=7;break;case"Quote":t=`>${e}`,n.end=0;break;default:t=""}return{editedText:t,selection:n}},Ta=e=>{let t;switch(e){case"BulletList":t="- ";break;case"NumberList":t="1. ";break;case"h1":t="# ";break;case"h2":t="## ";break;case"h3":t="### ";break;case"h4":t="#### ";break;case"h5":t="##### ";break;case"h6":t="###### ";break;default:return""}return t},wa=(e,t)=>{const n=e.current.getSelection();let a;if(n){const s=Ra(t,n);e.current.replaceSelection(s),e.current.focus()}else{a=Ma(t),e.current.replaceSelection(a.editedText),e.current.focus();const{line:s,ch:i}=e.current.getCursor(),l=i-a.selection.end,u=i-a.selection.end-a.selection.start;e.current.setSelection({line:s,ch:u},{line:s,ch:l})}},Jp=(e,t)=>{const n=e.current.getDoc(),a=t==="BulletList"?"- ":"1. ";if(n.somethingSelected()){const s=n.listSelections();let i=null;e.current.operation(function(){s.forEach(function(l){const u=[l.head.line,l.anchor.line].sort();i==null&&(i=n.getLine(u[0]).startsWith(a));for(let c=u[0];c<=u[1];c++)if(i)n.getLine(c).startsWith(a)&&n.replaceRange("",{line:c,ch:0},{line:c,ch:a.length});else{const d=t==="BulletList"?"- ":`${c+1}. `;n.replaceRange(d,{line:c,ch:0})}})})}else{let{line:s}=n.getCursor();const i=Ta(t),l=e.current.getLine(s),u=i+l;e.current.setSelection({line:s,ch:0},{line:s,ch:l.length}),e.current.replaceSelection(u)}e.current.focus()},Xp=(e,t)=>{let{line:n}=e.current.getCursor();const a=Ta(t),s=e.current.getLine(n),i=s.replace(/#{1,6}\s/g,"").trim(),l=a+i;e.current.setSelection({line:n,ch:0},{line:n,ch:s.length}),e.current.replaceSelection(l),setTimeout(()=>{const u=e.current.getLine(n).length;e.current.focus(),e.current.setCursor({line:n,ch:u})},0)},em=(e,t)=>{let{line:n,ch:a}=e.current.getCursor();t.forEach((s,i)=>{let l=e.current.getLine(n).length;e.current.setCursor({line:n,ch:l}),(i>0||i===0&&a!==0)&&(l=e.current.getLine(n).length,e.current.setCursor({line:n,ch:l}),n++,e.current.replaceSelection(`
680
- `)),s.mime.includes("image")?e.current.replaceSelection(`![${s.alt}](${s.url})`):e.current.replaceSelection(`[${s.alt}](${s.url})`)}),setTimeout(()=>e.current.focus(),0)},tm=(e,t,n,a,s)=>{const i=Ra(t,s),l=e.current.getRange({line:n+1,ch:0},{line:1/0,ch:1/0});if(e.current.replaceRange("",{line:n+1,ch:0},{line:1/0,ch:1/0}),e.current.replaceSelection(""),e.current.setCursor({line:n,ch:a}),e.current.replaceSelection(`
681
- `),e.current.replaceSelection(i),t==="Code"){let{line:u}=e.current.getCursor();e.current.setCursor({line:u-1,ch:s.length})}e.current.replaceRange(l,{line:n+4,ch:0},{line:1/0,ch:1/0}),e.current.focus()},nm=(e,t,n,a)=>{const s=Ma(t),i=e.current.getRange({line:n+1,ch:0},{line:1/0,ch:1/0});if(e.current.replaceRange("",{line:n+1,ch:0},{line:1/0,ch:1/0}),e.current.setCursor({line:n,ch:a}),e.current.replaceSelection(`
682
- `),e.current.replaceSelection(s.editedText),t==="Code")n+=2,e.current.setSelection({line:n,ch:0},{line:n,ch:4});else{n+=1;let{ch:l}=e.current.getCursor(),u=l-s.selection.end,c=l-s.selection.end-s.selection.start;e.current.setSelection({line:n,ch:c},{line:n,ch:u})}e.current.replaceRange(i,{line:n+2,ch:0},{line:1/0,ch:1/0}),e.current.focus()},rm=(e,t)=>{const n=e.current.getSelection();let{line:a}=e.current.getCursor(),s=e.current.getLine(a).length;n?tm(e,t,a,s,n):nm(e,t,a,s)};var om=p(64410),am=p(43768),sm=p.n(am);const im=(e,t)=>`${e}${Math.floor(t*255).toString(16).padStart(2,0)}`,lm=(0,S.default)(j.Flex)`
683
- background: ${({theme:e})=>im(e.colors.neutral800,.2)};
684
- `,cm=(0,S.default)(w.Box)`
685
- border-right: 1px solid ${({theme:e})=>e.colors.neutral200};
686
- `,um=(0,S.default)(Sn.BaseButton)`
687
- background-color: transparent;
688
- border: none;
689
- align-items: center;
690
-
691
- svg {
692
- margin-left: ${({theme:e})=>`${e.spaces[2]}`};
693
- path {
694
- fill: ${({theme:e})=>e.colors.neutral700};
695
- width: ${12/16}rem;
696
- height: ${12/16}rem;
697
- }
698
- }
699
- `,Un=({children:e,isExpandMode:t,error:n,previewContent:a,onCollapse:s})=>{const{formatMessage:i}=(0,A.useIntl)();return(0,r.useEffect)(()=>{const l=document.body;return t&&l.classList.add("lock-body-scroll"),()=>{t&&l.classList.remove("lock-body-scroll")}},[t]),t?r.createElement(om.Portal,{role:"dialog","aria-modal":!1},r.createElement(jn.FocusTrap,{onEscape:s},r.createElement(lm,{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:4,justifyContent:"center",onClick:s},r.createElement(w.Box,{id:"wysiwyg-expand",background:"neutral0",hasRadius:!0,shadow:"popupShadow",overflow:"hidden",width:"70%",height:"70%",onClick:l=>l.stopPropagation()},r.createElement(j.Flex,{height:"100%",alignItems:"flex-start"},r.createElement(cm,{flex:"1",height:"100%"},e),r.createElement(w.Box,{flex:"1",height:"100%"},r.createElement(j.Flex,{height:(0,y.pxToRem)(48),background:"neutral100",justifyContent:"flex-end"},r.createElement(um,{id:"collapse",onClick:s},r.createElement(L.Typography,null,i({id:"components.Wysiwyg.collapse",defaultMessage:"Collapse"})),r.createElement(sm(),null))),r.createElement(w.Box,{position:"relative",height:"100%"},r.createElement(ga,{data:a})))))))):r.createElement(w.Box,{borderColor:n?"danger600":"neutral200",borderStyle:"solid",borderWidth:"1px",hasRadius:!0},e)};Un.defaultProps={error:void 0,previewContent:""},Un.propTypes={children:o().node.isRequired,error:o().string,isExpandMode:o().bool.isRequired,previewContent:o().string,onCollapse:o().func.isRequired};var dm=Object.defineProperty,Ia=Object.getOwnPropertySymbols,pm=Object.prototype.hasOwnProperty,mm=Object.prototype.propertyIsEnumerable,Da=(e,t,n)=>t in e?dm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xa=(e,t)=>{for(var n in t||(t={}))pm.call(t,n)&&Da(e,n,t[n]);if(Ia)for(var n of Ia(t))mm.call(t,n)&&Da(e,n,t[n]);return e};const fm=(0,S.default)(w.Box)`
700
- svg path {
701
- fill: ${({theme:e})=>e.colors.neutral500};
702
- }
703
- `,gm=(0,S.default)(L.Typography)`
704
- line-height: 0;
705
- `,Hn=({description:e,disabled:t,error:n,intlLabel:a,labelAction:s,name:i,onChange:l,placeholder:u,value:c,required:d})=>{const{formatMessage:m}=(0,A.useIntl)(),f=(0,r.useRef)(null),g=(0,r.useRef)(null),[h,b]=(0,r.useState)(!1),[E,O]=(0,r.useState)(!1),[I,C]=(0,r.useState)(!1),{components:x}=(0,y.useLibrary)(),D=x["media-library"],W=()=>O(k=>!k),F=()=>b(k=>!k),$=()=>{b(!1),C(k=>!k)},N=(k,Z,B)=>{switch(k){case"Link":case"Strikethrough":{wa(Z,k),B();break}case"Code":case"Quote":{rm(Z,k),B();break}case"Bold":case"Italic":case"Underline":{wa(Z,k);break}case"BulletList":case"NumberList":{Jp(Z,k),B();break}case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{Xp(Z,k);break}default:}},G=k=>{const Z=k.map(B=>({alt:B.alternativeText||B.name,url:(0,y.prefixFileUrlWithBackendUrl)(B.url),mime:B.mime}));em(g,Z),O(!1)},V=u?m({id:u.id,defaultMessage:u.defaultMessage},xa({},u.values)):"",_=a.id?m({id:a.id,defaultMessage:a.defaultMessage},xa({},a.values)):i;return r.createElement(r.Fragment,null,r.createElement(ae.Stack,{spacing:1},r.createElement(ae.Stack,{horizontal:!0,spacing:1},r.createElement(L.Typography,{variant:"pi",fontWeight:"bold",textColor:"neutral800"},_,d&&r.createElement(gm,{textColor:"danger600"},"*")),s&&r.createElement(fm,{paddingLeft:1},s)),r.createElement(Un,{isExpandMode:I,error:n,previewContent:c,onCollapse:$},r.createElement(zp,{isExpandMode:I,editorRef:g,isPreviewMode:h,onActionClick:N,onToggleMediaLib:W,onTogglePreviewMode:I?void 0:F,disabled:t}),r.createElement(Pp,{disabled:t,isExpandMode:I,editorRef:g,error:n,isPreviewMode:h,name:i,onChange:l,placeholder:V,textareaRef:f,value:c}),!I&&r.createElement(_p,{onToggleExpand:$})),r.createElement(Yp,{description:e,name:i,error:n})),n&&r.createElement(w.Box,{paddingTop:1},r.createElement(L.Typography,{variant:"pi",textColor:"danger600","data-strapi-field-error":!0},n)),E&&r.createElement(D,{onClose:W,onSelectAssets:G}))};Hn.defaultProps={description:null,disabled:!1,error:"",labelAction:void 0,placeholder:null,required:!1,value:""},Hn.propTypes={description:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),disabled:o().bool,error:o().string,intlLabel:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}).isRequired,labelAction:o().element,name:o().string.isRequired,onChange:o().func.isRequired,placeholder:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),required:o().bool,value:o().string};const ym=Hn;var hm=p(16285),bm=p.n(hm),xt=p(20001),Em=p(52153);const vm=S.default.div`
706
- cursor: ${({disabled:e})=>e?"not-allowed !important":"auto"};
707
- /* BASICS */
708
-
709
- .colored {
710
- background-color: yellow;
711
- color: black !important;
712
- }
713
-
714
- > div {
715
- border-radius: 3px;
716
- > div:last-of-type {
717
- min-height: 253px;
718
- max-height: 506px;
719
- }
720
- }
721
-
722
- .CodeMirror {
723
- /* Set height, width, borders, and global font properties here */
724
- font-size: ${14/16}rem;
725
- direction: ltr;
726
- z-index: 0;
727
- }
728
- `,Cm=(0,S.default)(w.Box)`
729
- border-radius: ${({theme:e})=>e.borderRadius};
730
- border: 1px solid ${({theme:e,error:t})=>t?e.colors.danger600:"transparent"};
731
- `;var Om=Object.defineProperty,Sa=Object.getOwnPropertySymbols,Pm=Object.prototype.hasOwnProperty,Rm=Object.prototype.propertyIsEnumerable,La=(e,t,n)=>t in e?Om(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mm=(e,t)=>{for(var n in t||(t={}))Pm.call(t,n)&&La(e,n,t[n]);if(Sa)for(var n of Sa(t))Rm.call(t,n)&&La(e,n,t[n]);return e};const Tm=(0,S.default)(w.Box)`
732
- svg path {
733
- fill: ${({theme:e})=>e.colors.neutral500};
734
- }
735
- `,_n=({intlLabel:e,labelAction:t,name:n,required:a})=>{const{formatMessage:s}=(0,A.useIntl)(),i=e!=null&&e.id?s({id:e.id,defaultMessage:e.defaultMessage},Mm({},e.values)):n;return r.createElement(j.Flex,null,r.createElement(xt.FieldLabel,{required:a},i),t&&r.createElement(Tm,{paddingLeft:1},t))};_n.defaultProps={id:void 0,intlLabel:void 0,labelAction:void 0,required:!1},_n.propTypes={id:o().string,intlLabel:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),labelAction:o().element,name:o().string.isRequired,required:o().bool};const wm=_n,Zn=({name:e,hint:t,error:n,children:a})=>{const{formatMessage:s}=(0,A.useIntl)(),i=n?s({id:n,defaultMessage:n}):"";return r.createElement(xt.Field,{name:e,hint:t&&s(t),error:i,id:e},a)};Zn.defaultProps={hint:void 0,error:""},Zn.propTypes={name:o().string.isRequired,hint:o().shape({id:o().string,defaultMessage:o().string}),error:o().string,children:o().node.isRequired};const Im=Zn;var Dm=Object.defineProperty,xm=(e,t,n)=>t in e?Dm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ze=(e,t,n)=>(xm(e,typeof t!="symbol"?t+"":t,n),n),Sm=(e,t,n)=>new Promise((a,s)=>{var i=c=>{try{u(n.next(c))}catch(d){s(d)}},l=c=>{try{u(n.throw(c))}catch(d){s(d)}},u=c=>c.done?a(c.value):Promise.resolve(c.value).then(i,l);u((n=n.apply(e,t)).next())});const Lm=600,Fm="blackboard";(()=>Sm(void 0,null,function*(){yield p.e(3860).then(p.t.bind(p,87541,23)),yield p.e(2781).then(p.t.bind(p,80249,23)),yield p.e(953).then(p.t.bind(p,54745,23)),yield p.e(5178).then(p.t.bind(p,3903,23)),yield p.e(5509).then(p.t.bind(p,59577,23)),yield p.e(3973).then(p.bind(p,65701)),yield p.e(2218).then(p.bind(p,88333))}))();class Gn extends r.Component{constructor(t){super(t),Ze(this,"timer",null),Ze(this,"setInitValue",()=>{const{value:n}=this.props;try{return n===null?this.codeMirror.setValue(""):this.codeMirror.setValue(n)}catch(a){return this.setState({error:!0})}}),Ze(this,"setSize",()=>this.codeMirror.setSize("100%","auto")),Ze(this,"getContentAtLine",n=>this.codeMirror.getLine(n)),Ze(this,"getEditorOption",n=>this.codeMirror.getOption(n)),Ze(this,"getValue",()=>this.codeMirror.getValue()),Ze(this,"markSelection",({message:n})=>{let a=parseInt(n.split(":")[0].split("line ")[1],10)-1,s=this.getContentAtLine(a);s==="{"&&(a+=1,s=this.getContentAtLine(a));const i=s.length,l=i-bm()(s," ").length,u=this.codeMirror.markText({line:a,ch:l},{line:a,ch:i},{className:"colored"});this.setState({markedText:u})}),Ze(this,"handleChange",(n,a)=>{if(a.origin==="setValue")return;const{name:s,onChange:i}=this.props;let l=n.getValue();l===""&&(l=null),i({target:{name:s,value:l,type:"json"}}),this.state.markedText&&(this.state.markedText.clear(),this.setState({markedText:null,error:null})),clearTimeout(this.timer),this.timer=setTimeout(()=>this.testJSON(n.getValue()),Lm)}),Ze(this,"testJSON",n=>{try{Em.parse(n)}catch(a){this.markSelection(a)}}),this.editor=r.createRef(),this.state={error:!1,markedText:null}}componentDidMount(){this.codeMirror=en().fromTextArea(this.editor.current,{autoCloseBrackets:!0,lineNumbers:!0,matchBrackets:!0,mode:"application/json",readOnly:this.props.disabled,smartIndent:!0,styleSelectedText:!0,tabSize:2,theme:Fm,fontSize:"13px"}),this.codeMirror.on("change",this.handleChange),this.setSize(),this.setInitValue()}componentDidUpdate(t){t.value!==this.props.value&&!this.codeMirror.state.focused&&this.setInitValue()}render(){return this.state.error?r.createElement("div",null,"error json"):r.createElement(Im,{name:this.props.name,hint:this.props.description,error:this.props.error},r.createElement(ae.Stack,{spacing:1},r.createElement(wm,{intlLabel:this.props.intlLabel,labelAction:this.props.labelAction,name:this.props.name,required:this.props.required}),r.createElement(Cm,{error:this.props.error},r.createElement(vm,{disabled:this.props.disabled},r.createElement("textarea",{ref:this.editor,autoComplete:"off",id:this.props.id||this.props.name,defaultValue:""}))),r.createElement(xt.FieldHint,null),r.createElement(xt.FieldError,null)))}}Gn.defaultProps={description:null,disabled:!1,id:void 0,error:void 0,intlLabel:void 0,labelAction:void 0,onChange:()=>{},value:null,required:!1},Gn.propTypes={description:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),disabled:o().bool,error:o().string,id:o().string,intlLabel:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),labelAction:o().element,name:o().string.isRequired,onChange:o().func,value:o().any,required:o().bool};const km=Gn;var Qn=p(37178),Am=p(23101),jm=p.n(Am),$m=p(14356),Bm=p.n($m),Nm=p(50678),St=p.n(Nm),Vm=p(103),qm=p.n(Vm);const Fa=(e,t)=>{const[n,a]=(0,r.useState)(e);return(0,r.useEffect)(()=>{const s=setTimeout(()=>{a(e)},t);return()=>{clearTimeout(s)}},[e,t]),n},Wm=new RegExp(/^[A-Za-z0-9-_.~]*$/),zm=(0,S.default)(w.Box)`
736
- position: relative;
737
- `,Um=(0,S.default)(xt.FieldAction)`
738
- svg {
739
- height: 1rem;
740
- width: 1rem;
741
- path {
742
- fill: ${({theme:e})=>e.colors.neutral400};
743
- }
744
- }
745
-
746
- svg:hover {
747
- path {
748
- fill: ${({theme:e})=>e.colors.primary600};
749
- }
750
- }
751
- `,Kn=(0,S.default)(j.Flex)`
752
- position: absolute;
753
- right: ${({theme:e})=>e.spaces[6]};
754
- width: 100px;
755
- pointer-events: none;
756
-
757
- svg {
758
- margin-right: ${({theme:e})=>e.spaces[1]};
759
- height: ${12/16}rem;
760
- width: ${12/16}rem;
761
- path {
762
- fill: ${({theme:e,notAvailable:t})=>t?e.colors.danger600:e.colors.success600};
763
- }
764
- }
765
- `,Hm=S.keyframes`
766
- from {
767
- transform: rotate(0deg);
768
- }
769
- to {
770
- transform: rotate(359deg);
771
- }
772
- `,_m=(0,S.default)(j.Flex)`
773
- animation: ${Hm} 2s infinite linear;
774
- `;var Zm=Object.defineProperty,ka=Object.getOwnPropertySymbols,Gm=Object.prototype.hasOwnProperty,Qm=Object.prototype.propertyIsEnumerable,Aa=(e,t,n)=>t in e?Zm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yn=(e,t)=>{for(var n in t||(t={}))Gm.call(t,n)&&Aa(e,n,t[n]);if(ka)for(var n of ka(t))Qm.call(t,n)&&Aa(e,n,t[n]);return e},ja=(e,t,n)=>new Promise((a,s)=>{var i=c=>{try{u(n.next(c))}catch(d){s(d)}},l=c=>{try{u(n.throw(c))}catch(d){s(d)}},u=c=>c.done?a(c.value):Promise.resolve(c.value).then(i,l);u((n=n.apply(e,t)).next())});const Jn=({attribute:e,contentTypeUID:t,description:n,disabled:a,error:s,intlLabel:i,labelAction:l,name:u,onChange:c,value:d,placeholder:m,required:f})=>{const{modifiedData:g,initialData:h,layout:b}=(0,y.useCMEditViewDataManager)(),[E,O]=(0,r.useState)(!1),[I,C]=(0,r.useState)(null),x=Fa(d,300),D=(0,r.useRef)(),W=h[u],{formatMessage:F}=(0,A.useIntl)(),$=R()(b,["options","timestamps",0]),N=!h[$],G=Fa(g[e.targetField],300),[V,_]=(0,r.useState)(!1),[k,Z]=(0,r.useState)(null),B=i.id?F({id:i.id,defaultMessage:i.defaultMessage},Yn({},i.values)):u,Y=n?F({id:n.id,defaultMessage:n.defaultMessage},Yn({},n.values)):"",T=m?F({id:m.id,defaultMessage:m.defaultMessage},Yn({},m.values)):"";D.current=(M=!1)=>ja(void 0,null,function*(){O(!0);const H=ve("uid/generate");try{const{data:{data:re}}=yield ge.be.post(H,{contentTypeUID:t,field:u,data:g});c({target:{name:u,value:re,type:"text"}},M),O(!1)}catch(re){O(!1)}});const z=()=>ja(void 0,null,function*(){O(!0);const M=ve("uid/check-availability");if(!!d)try{const{data:H}=yield ge.be.post(M,{contentTypeUID:t,field:u,value:d?d.trim():""});C(H),O(!1)}catch(H){O(!1)}});(0,r.useEffect)(()=>{!d&&e.required&&D.current(!0)},[]),(0,r.useEffect)(()=>{x&&x.trim().match(Wm)&&x!==W&&z(),x||C(null)},[x,W]),(0,r.useEffect)(()=>{let M;return I&&I.isAvailable&&(M=setTimeout(()=>{C(null)},4e3)),()=>{M&&clearTimeout(M)}},[I]),(0,r.useEffect)(()=>{!V&&N&&G&&g[e.targetField]&&!d&&D.current(!0)},[G,V,N]);const Q=()=>{Z(F({id:"content-manager.components.uid.regenerate",defaultMessage:"Regenerate"}))},K=()=>{Z(null)},P=M=>{M.target.value&&N&&_(!0),c(M)};return r.createElement(Qn.TextInput,{disabled:a,error:s,endAction:r.createElement(zm,null,I&&I.isAvailable&&!k&&r.createElement(Kn,{alignItems:"center",justifyContent:"flex-end"},r.createElement(Bm(),null),r.createElement(L.Typography,{textColor:"success600",variant:"pi"},F({id:"content-manager.components.uid.available",defaultMessage:"Available"}))),I&&!I.isAvailable&&!k&&r.createElement(Kn,{notAvailable:!0,alignItems:"center",justifyContent:"flex-end"},r.createElement(St(),null),r.createElement(L.Typography,{textColor:"danger600",variant:"pi"},F({id:"content-manager.components.uid.unavailable",defaultMessage:"Unavailable"}))),k&&r.createElement(Kn,{alignItems:"center",justifyContent:"flex-end"},r.createElement(L.Typography,{textColor:"primary600",variant:"pi"},k)),r.createElement(Um,{onClick:()=>D.current(),label:"regenerate",onMouseEnter:Q,onMouseLeave:K},E?r.createElement(_m,null,r.createElement(qm(),null)):r.createElement(jm(),null))),hint:Y,label:B,labelAction:l,name:u,onChange:P,placeholder:T,value:d||"",required:f})};Jn.propTypes={attribute:o().shape({targetField:o().string,required:o().bool}).isRequired,contentTypeUID:o().string.isRequired,description:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),disabled:o().bool,error:o().string,intlLabel:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}).isRequired,labelAction:o().element,name:o().string.isRequired,onChange:o().func.isRequired,value:o().string,placeholder:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),required:o().bool},Jn.defaultProps={description:void 0,disabled:!1,error:void 0,labelAction:void 0,placeholder:void 0,value:"",required:!1};const Km=Jn;var ot=p(58434),Ym=p(28611),Jm=p.n(Ym),Xm=p(77236),$a=p.n(Xm),ef=p(86834),Re=p.n(ef),tf=p(3040),ne=p.n(tf);const nf=(0,S.default)(w.Box)`
775
- svg path {
776
- fill: ${({theme:e})=>e.colors.neutral500};
777
- }
778
- `,Xn=({intlLabel:e,id:t,labelAction:n,link:a,name:s,numberOfEntries:i,isSingle:l})=>{const{formatMessage:u}=(0,A.useIntl)(),c=e!=null&&e.id?u(e):s;return r.createElement(j.Flex,{justifyContent:"space-between"},r.createElement(j.Flex,null,r.createElement(L.Typography,{textColor:"neutral800",htmlFor:t||s,variant:"pi",fontWeight:"bold",as:"label"},c,!l&&r.createElement(r.Fragment,null,"\xA0(",i,")")),n&&r.createElement(nf,{paddingLeft:1},n)),a)};Xn.defaultProps={id:void 0,labelAction:void 0,link:null,numberOfEntries:0},Xn.propTypes={id:o().string,intlLabel:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}).isRequired,isSingle:o().bool.isRequired,labelAction:o().element,link:o().element,name:o().string.isRequired,numberOfEntries:o().number};const rf=Xn;var of=p(7787),af=p.n(of),mt=p(65384),sf=p(23973),Ba=p.n(sf),lf=Object.defineProperty,Na=Object.getOwnPropertySymbols,cf=Object.prototype.hasOwnProperty,uf=Object.prototype.propertyIsEnumerable,Va=(e,t,n)=>t in e?lf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,qa=(e,t)=>{for(var n in t||(t={}))cf.call(t,n)&&Va(e,n,t[n]);if(Na)for(var n of Na(t))uf.call(t,n)&&Va(e,n,t[n]);return e};const df=S.default.div`
779
- width: ${(0,y.pxToRem)(6)};
780
- height: ${(0,y.pxToRem)(6)};
781
- margin-right: ${({theme:e})=>e.spaces[2]};
782
- background: ${({theme:e,isDraft:t})=>e.colors[t?"secondary700":"success200"]};
783
- border-radius: 50%;
784
- cursor: pointer;
785
- `,Wa=e=>{const{formatMessage:t}=(0,A.useIntl)(),n=mt.wx.SingleValue,a=Ba()(R()(e,"data.value"),"publishedAt"),s=Re()(R()(e,"data.value.publishedAt"));if(a){const i={id:v("components.Select.draft-info-title"),defaultMessage:"State: Draft"},l={id:v("components.Select.publish-info-title"),defaultMessage:"State: Published"},u=t(s?i:l);return r.createElement(n,qa({},e),r.createElement(j.Flex,null,r.createElement(df,{title:u,isDraft:s}),r.createElement(L.Typography,{ellipsis:!0},e.data.label||"-")))}return r.createElement(n,qa({},e),e.data.label||"-")};Wa.propTypes={data:o().object.isRequired,selectProps:o().shape({mainField:o().shape({name:o().string.isRequired,schema:o().shape({type:o().string.isRequired}).isRequired}).isRequired}).isRequired};const pf=Wa;var mf=Object.defineProperty,ff=Object.defineProperties,gf=Object.getOwnPropertyDescriptors,za=Object.getOwnPropertySymbols,yf=Object.prototype.hasOwnProperty,hf=Object.prototype.propertyIsEnumerable,Ua=(e,t,n)=>t in e?mf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bf=(e,t)=>{for(var n in t||(t={}))yf.call(t,n)&&Ua(e,n,t[n]);if(za)for(var n of za(t))hf.call(t,n)&&Ua(e,n,t[n]);return e},Ef=(e,t)=>ff(e,gf(t));function er({components:e,mainField:t,name:n,isDisabled:a,isLoading:s,onChange:i,onInputChange:l,onMenuClose:u,onMenuOpen:c,onMenuScrollToBottom:d,options:m,placeholder:f,styles:g,value:h,description:b}){const{formatMessage:E}=(0,A.useIntl)();return r.createElement(ae.Stack,{spacing:1},r.createElement(mt.ZP,{components:Ef(bf({},e),{SingleValue:pf}),id:n,isClearable:!0,isDisabled:a,isLoading:s,mainField:t,options:m,onChange:i,onInputChange:l,onMenuClose:u,onMenuOpen:c,onMenuScrollToBottom:d,placeholder:E(f||{id:"global.select",defaultMessage:"Select..."}),styles:g,value:af()(h)?null:{label:R()(h,[t.name],""),value:h}}),b&&r.createElement(L.Typography,{variant:"pi",textColor:"neutral600"},b))}er.defaultProps={description:"",components:{},placeholder:null,value:null},er.propTypes={components:o().object,isDisabled:o().bool.isRequired,isLoading:o().bool.isRequired,mainField:o().shape({name:o().string.isRequired,schema:o().shape({type:o().string.isRequired}).isRequired}).isRequired,name:o().string.isRequired,onChange:o().func.isRequired,onInputChange:o().func.isRequired,onMenuClose:o().func.isRequired,onMenuOpen:o().func.isRequired,onMenuScrollToBottom:o().func.isRequired,options:o().array.isRequired,placeholder:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired}),styles:o().object.isRequired,value:o().object,description:o().string};const vf=(0,r.memo)(er),Cf=S.default.div`
786
- width: ${(0,y.pxToRem)(6)};
787
- height: ${(0,y.pxToRem)(6)};
788
- background: ${({theme:e,isDraft:t})=>e.colors[t?"secondary600":"success600"]};
789
- border-radius: 50%;
790
- cursor: pointer;
791
- `;function tr({data:e,displayNavigationLink:t,isDisabled:n,mainField:a,onRemove:s,searchToPersist:i,targetModel:l}){const{formatMessage:u}=(0,A.useIntl)(),c=`/content-manager/collectionType/${l}/${e.id}`;let d="pointer";n&&(d="not-allowed"),t||(d="default");const m=Ba()(e,"publishedAt"),f=Re()(e.publishedAt),g=e[a.name],h={id:v("components.Select.draft-info-title"),defaultMessage:"State: Draft"},b={id:v("components.Select.publish-info-title"),defaultMessage:"State: Published"},E=u(f?h:b),{pathname:O}=(0,te.useLocation)();return r.createElement(j.Flex,{as:"li",alignItems:"center"},r.createElement(j.Flex,{style:{flex:1},alignItems:"center"},m&&r.createElement(w.Box,{paddingRight:2},r.createElement(Cf,{isDraft:f,title:E})),t?r.createElement(ot.Link,{to:{pathname:c,state:{from:O},search:i},style:{textTransform:"none"}},g||e.id):r.createElement(L.Typography,{variant:"pi"},g||e.id)),r.createElement(y.RemoveRoundedButton,{onClick:s,label:"Remove",style:{cursor:d}}))}tr.defaultProps={onRemove:()=>{},searchToPersist:null,targetModel:""},tr.propTypes={data:o().object.isRequired,displayNavigationLink:o().bool.isRequired,isDisabled:o().bool.isRequired,mainField:o().shape({name:o().string.isRequired,schema:o().shape({type:o().string.isRequired}).isRequired}).isRequired,onRemove:o().func,searchToPersist:o().string,targetModel:o().string};const Of=(0,r.memo)(tr);function nr({addRelation:e,components:t,displayNavigationLink:n,mainField:a,name:s,isDisabled:i,isLoading:l,onInputChange:u,onMenuClose:c,onMenuOpen:d,onMenuScrollToBottom:m,onRemove:f,options:g,placeholder:h,searchToPersist:b,styles:E,targetModel:O,value:I,description:C}){const{formatMessage:x}=(0,A.useIntl)(),D={ignoreCase:!0,ignoreAccents:!0,trim:!1,matchFrom:"any"};return r.createElement(ae.Stack,{spacing:1},r.createElement(mt.ZP,{components:t,isDisabled:i,id:s,filterOption:(W,F)=>!Re()(I)&&I.findIndex(N=>N.id===W.value.id)!==-1?!1:F?(0,mt.cj)(D)(W,F):!0,mainField:a,isLoading:l,isMulti:!0,isSearchable:!0,options:g,onChange:e,onInputChange:u,onMenuClose:c,onMenuOpen:d,onMenuScrollToBottom:m,placeholder:x(h||{id:"global.select",defaultMessage:"Select..."}),styles:E,value:[]}),r.createElement(w.Box,{paddingTop:3,style:{overflow:"auto"}},r.createElement(ae.Stack,{as:"ul",spacing:4,style:{maxHeight:"128px",overflowX:"hidden"}},I==null?void 0:I.map((W,F)=>r.createElement(Of,{key:W.id,data:W,displayNavigationLink:n,isDisabled:i,mainField:a,onRemove:()=>{i||f(`${s}.${F}`)},searchToPersist:b,targetModel:O})))),C&&r.createElement(L.Typography,{variant:"pi",textColor:"neutral600"},C))}nr.defaultProps={description:"",components:{},placeholder:null,searchToPersist:null,value:null},nr.propTypes={addRelation:o().func.isRequired,components:o().object,displayNavigationLink:o().bool.isRequired,isDisabled:o().bool.isRequired,isLoading:o().bool.isRequired,mainField:o().shape({name:o().string.isRequired,schema:o().shape({type:o().string.isRequired}).isRequired}).isRequired,name:o().string.isRequired,onInputChange:o().func.isRequired,onMenuClose:o().func.isRequired,onMenuOpen:o().func.isRequired,onMenuScrollToBottom:o().func.isRequired,onRemove:o().func.isRequired,options:o().array.isRequired,placeholder:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired}),searchToPersist:o().string,styles:o().object.isRequired,targetModel:o().string.isRequired,value:o().array,description:o().string};const Pf=(0,r.memo)(nr),Ha=(0,S.default)(w.Box)`
792
- background: transparent;
793
- border: none;
794
- position: relative;
795
- z-index: 1;
796
-
797
- svg {
798
- height: ${11/16}rem;
799
- width: ${11/16}rem;
800
- }
801
-
802
- svg path {
803
- fill: ${({theme:e})=>e.colors.neutral600};
804
- }
805
- `;var Rf=Object.defineProperty,_a=Object.getOwnPropertySymbols,Mf=Object.prototype.hasOwnProperty,Tf=Object.prototype.propertyIsEnumerable,Za=(e,t,n)=>t in e?Rf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wf=(e,t)=>{for(var n in t||(t={}))Mf.call(t,n)&&Za(e,n,t[n]);if(_a)for(var n of _a(t))Tf.call(t,n)&&Za(e,n,t[n]);return e};const If=e=>{const t=mt.wx.ClearIndicator;return r.createElement(t,wf({},e),r.createElement(Ha,{as:"button",type:"button"},r.createElement(vn(),null)))},Df=(0,S.default)(Ha)`
806
- display: flex;
807
- background: none;
808
- border: none;
809
-
810
- svg {
811
- width: ${6/16}rem;
812
- }
813
- `,xf=()=>r.createElement(Df,{as:"button",type:"button",paddingRight:3},r.createElement(En(),null)),Sf=()=>null;var Lf=Object.defineProperty,Ga=Object.getOwnPropertySymbols,Ff=Object.prototype.hasOwnProperty,kf=Object.prototype.propertyIsEnumerable,Qa=(e,t,n)=>t in e?Lf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ka=(e,t)=>{for(var n in t||(t={}))Ff.call(t,n)&&Qa(e,n,t[n]);if(Ga)for(var n of Ga(t))kf.call(t,n)&&Qa(e,n,t[n]);return e};const Af=S.default.div`
814
- width: ${(0,y.pxToRem)(6)};
815
- height: ${(0,y.pxToRem)(6)};
816
- margin-right: ${({theme:e})=>e.spaces[2]};
817
- background: ${({theme:e,isDraft:t})=>e.colors[t?"secondary600":"success600"]};
818
- border-radius: 50%;
819
- cursor: pointer;
820
- `,rr=e=>{const{formatMessage:t}=(0,A.useIntl)(),n=mt.wx.Option,a=(0,q.has)((0,q.get)(e,"data.value"),"publishedAt"),s=(0,q.isEmpty)((0,q.get)(e,"data.value.publishedAt"));if(a&&a){const i={id:v("components.Select.draft-info-title"),defaultMessage:"State: Draft"},l={id:v("components.Select.publish-info-title"),defaultMessage:"State: Published"},u=t(s?i:l);return r.createElement(n,Ka({},e),r.createElement(j.Flex,null,r.createElement(Af,{title:u,isDraft:s}),r.createElement(L.Typography,{ellipsis:!0},e.label||"-")))}return r.createElement(n,Ka({},e),e.label||"-")};rr.defaultProps={label:""},rr.propTypes={label:o().oneOfType([o().string,o().number]),isFocused:o().bool.isRequired,selectProps:o().shape({hasDraftAndPublish:o().bool,mainField:o().shape({name:o().string.isRequired,schema:o().shape({type:o().string.isRequired}).isRequired}).isRequired}).isRequired};const jf=rr;var $f=Object.defineProperty,Ya=Object.getOwnPropertySymbols,Bf=Object.prototype.hasOwnProperty,Nf=Object.prototype.propertyIsEnumerable,Ja=(e,t,n)=>t in e?$f(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xa=(e,t)=>{for(var n in t||(t={}))Bf.call(t,n)&&Ja(e,n,t[n]);if(Ya)for(var n of Ya(t))Nf.call(t,n)&&Ja(e,n,t[n]);return e};function Vf(e,t){return function(n){const a=t(n);return r.createElement(e,Xa(Xa({},n),a))}}const qf=Vf;function Wf({isUserAllowedToEditField:e,isUserAllowedToReadField:t,name:n}){const{isCreatingEntry:a,createActionAllowedFields:s,readActionAllowedFields:i,updateActionAllowedFields:l}=(0,y.useCMEditViewDataManager)(),u=(0,r.useMemo)(()=>e===!0?!0:(a?s:l).includes(n),[a,s,n,e,l]),c=(0,r.useMemo)(()=>t?!0:(a?[]:i).includes(n),[a,t,n,i]);return{isCreatingEntry:a,isFieldAllowed:u,isFieldReadable:c}}const zf=Wf;var Uf=Object.defineProperty,Hf=Object.defineProperties,_f=Object.getOwnPropertyDescriptors,es=Object.getOwnPropertySymbols,Zf=Object.prototype.hasOwnProperty,Gf=Object.prototype.propertyIsEnumerable,ts=(e,t,n)=>t in e?Uf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,je=(e,t)=>{for(var n in t||(t={}))Zf.call(t,n)&&ts(e,n,t[n]);if(es)for(var n of es(t))Gf.call(t,n)&&ts(e,n,t[n]);return e},$e=(e,t)=>Hf(e,_f(t));const Qf=e=>({clearIndicator:t=>$e(je({},t),{padding:0,paddingRight:e.spaces[3]}),container:t=>$e(je({},t),{background:e.colors.neutral0,fontFamily:"Arial",lineHeight:"normal"}),control:(t,n)=>{let a,s,i;return n.isFocused?a=`1px solid ${e.colors.primary600} !important`:a=`1px solid ${e.colors.neutral200} !important`,n.menuIsOpen===!0&&(s=`1px solid ${e.colors.primary600} !important`),n.isDisabled&&(i="#fafafb !important"),$e(je({},t),{fontSize:14,height:40,border:a,outline:0,boxShadow:0,borderRadius:"2px !important",borderBottom:s,backgroundColor:i,borderTopLeftRadius:"4px !important",borderTopRightRadius:"4px !important",borderBottomLeftRadius:"4px !important",borderBottomRightRadius:"4px !important"})},indicatorContainer:t=>$e(je({},t),{padding:0,paddingRight:e.spaces[3]}),input:t=>$e(je({},t),{margin:0,padding:0}),menu:t=>$e(je({},t),{width:"100%",marginTop:e.spaces[1],backgroundColor:e.colors.neutral0,color:e.colors.neutral800,borderRadius:"4px !important",borderTopLeftRadius:"4px !important",borderTopRightRadius:"4px !important",border:`1px solid ${e.colors.neutral200} !important`,boxShadow:0,fontSize:"14px",fontFamily:"Arial",zIndex:2}),menuList:t=>$e(je({},t),{paddingLeft:e.spaces[1],paddingTop:e.spaces[1],paddingRight:e.spaces[1],paddingBottom:e.spaces[1]}),option:(t,n)=>{let a=t.backgroundColor;return n.isFocused&&(a=e.colors.primary100),$e(je({},t),{lineHeight:e.spaces[5],backgroundColor:a,borderRadius:4})},placeholder:t=>$e(je({},t),{marginLeft:0}),singleValue:t=>$e(je({},t),{marginLeft:0,color:e.colors.neutral800}),valueContainer:t=>$e(je({},t),{padding:0,paddingLeft:e.spaces[4],marginLeft:0,marginRight:0})});var Kf=Object.defineProperty,Yf=Object.defineProperties,Jf=Object.getOwnPropertyDescriptors,ns=Object.getOwnPropertySymbols,Xf=Object.prototype.hasOwnProperty,eg=Object.prototype.propertyIsEnumerable,rs=(e,t,n)=>t in e?Kf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,or=(e,t)=>{for(var n in t||(t={}))Xf.call(t,n)&&rs(e,n,t[n]);if(ns)for(var n of ns(t))eg.call(t,n)&&rs(e,n,t[n]);return e},ar=(e,t)=>Yf(e,Jf(t)),tg=(e,t,n)=>new Promise((a,s)=>{var i=c=>{try{u(n.next(c))}catch(d){s(d)}},l=c=>{try{u(n.throw(c))}catch(d){s(d)}},u=c=>c.done?a(c.value):Promise.resolve(c.value).then(i,l);u((n=n.apply(e,t)).next())});const os={contains:"",limit:20,start:0},ng=(e,t)=>t?t.reduce((n,a)=>{const s=R()(e,a,null);return s&&ne()(n,a,s),n},{}):{};function sr({description:e,editable:t,labelAction:n,intlLabel:a,isCreatingEntry:s,isFieldAllowed:i,isFieldReadable:l,mainField:u,name:c,relationType:d,targetModel:m,placeholder:f,queryInfos:g}){const{formatMessage:h}=(0,A.useIntl)(),[{query:b}]=(0,y.useQueryParams)(),E=(0,r.useMemo)(()=>d.toLowerCase().includes("morph"),[d]),{addRelation:O,modifiedData:I,moveRelation:C,onChange:x,onRemoveRelation:D}=(0,y.useCMEditViewDataManager)(),{pathname:W}=(0,te.useLocation)(),F=(0,S.useTheme)(),$=R()(I,c,null),[N,G]=(0,r.useState)(os),[V,_]=(0,r.useState)([]),[k,Z]=(0,r.useState)(!1),[B,Y]=(0,r.useState)(!1),T=(0,r.useMemo)(()=>V.filter(Ce=>Re()($)?!0:Array.isArray($)?Jm()($,Ne=>Ne.id===Ce.value.id)===-1:R()($,"id","")!==Ce.value.id),[V,$]),{endPoint:z,containsKey:Q,defaultParams:K,shouldDisplayRelationLink:P,paramsToKeep:M}=g,H=["oneWay","oneToOne","manyToOne","oneToManyMorph","oneToOneMorph"].includes(d),re=(0,r.useMemo)(()=>$?H?[$.id]:$.map(Ce=>Ce.id):[],[H,$]),ce=(0,r.useCallback)(Ce=>tg(this,null,function*(){if(E){Z(!1);return}if(!i){Z(!1);return}Z(!0);const Ne=ar(or({limit:N.limit},K),{start:N.start});N.contains&&(Ne[`filters[${Q}][$contains]`]=N.contains);try{const{data:Xe}=yield ge.be.post(z,{idsToOmit:re},{params:Ne,cancelToken:Ce.token}),so=Xe.map(et=>({value:et,label:et[u.name]}));_(et=>et.concat(so).filter((ee,J)=>et.findIndex(Ve=>Ve.value.id===ee.value.id)===-1?!0:et.findIndex(Ve=>Ve.value.id===ee.value.id)===J)),Z(!1)}catch(Xe){Z(!1)}}),[Q,K,z,re,i,E,u.name,N.contains,N.limit,N.start]);(0,r.useEffect)(()=>{const Ne=Se().CancelToken.source();return B&&ce(Ne),()=>Ne.cancel("Operation canceled by the user.")},[ce,B]);const me=(Ce,{action:Ne})=>(Ne==="input-change"&&G(Xe=>Xe.contains===Ce?Xe:ar(or({},Xe),{contains:Ce,start:0})),Ce),Fe=()=>{G(Ce=>ar(or({},Ce),{start:Ce.start+20}))},it=()=>{G(os),Y(!1)},U=Ce=>{x({target:{name:c,value:Ce&&Ce.value}})},de=Ce=>{Re()(Ce)||O({target:{name:c,value:Ce}})},Be=()=>{Y(!0)},Je=`/content-manager/collectionType/${m}/${$?$.id:null}`,Ct=(0,We.stringify)(ng(b,M),{encode:!1});let Ge=null;H&&$&&P&&(Ge=r.createElement(ot.Link,{to:{pathname:Je,state:{from:W},search:Ct}},h({id:v("containers.Edit.seeDetails"),defaultMessage:"Details"})));const no=H?vf:Pf,ro=$a()($)?$.length:0,oo=(0,r.useMemo)(()=>E?!0:s?!t:!i&&l||!t,[E,s,t,i,l]);if(!i&&s)return r.createElement(y.NotAllowedInput,{intlLabel:a,labelAction:n});if(!s&&!i&&!l)return r.createElement(y.NotAllowedInput,{intlLabel:a,labelAction:n});const ao=Qf(F);return r.createElement(ae.Stack,{spacing:1},r.createElement(rf,{intlLabel:a,isSingle:H,labelAction:n,link:Ge,name:c,numberOfEntries:ro}),r.createElement(no,{addRelation:de,components:{ClearIndicator:If,DropdownIndicator:xf,IndicatorSeparator:Sf,Option:jf},displayNavigationLink:P,id:c,isDisabled:oo,isLoading:k,isClearable:!0,mainField:u,move:C,name:c,options:T,onChange:U,onInputChange:me,onMenuClose:it,onMenuOpen:Be,onMenuScrollToBottom:Fe,onRemove:D,placeholder:f,searchToPersist:Ct,styles:ao,targetModel:m,value:$,description:e}))}sr.defaultProps={editable:!0,description:"",labelAction:null,isFieldAllowed:!0,placeholder:null},sr.propTypes={editable:o().bool,description:o().string,intlLabel:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}).isRequired,labelAction:o().element,isCreatingEntry:o().bool.isRequired,isFieldAllowed:o().bool,isFieldReadable:o().bool.isRequired,mainField:o().shape({name:o().string.isRequired,schema:o().shape({type:o().string.isRequired}).isRequired}).isRequired,name:o().string.isRequired,placeholder:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),relationType:o().string.isRequired,targetModel:o().string.isRequired,queryInfos:o().shape({containsKey:o().string.isRequired,defaultParams:o().object,endPoint:o().string.isRequired,shouldDisplayRelationLink:o().bool.isRequired,paramsToKeep:o().array}).isRequired};const rg=(0,r.memo)(sr),as=qf(rg,zf);var og=Object.defineProperty,ss=Object.getOwnPropertySymbols,ag=Object.prototype.hasOwnProperty,sg=Object.prototype.propertyIsEnumerable,is=(e,t,n)=>t in e?og(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ls=(e,t)=>{for(var n in t||(t={}))ag.call(t,n)&&is(e,n,t[n]);if(ss)for(var n of ss(t))sg.call(t,n)&&is(e,n,t[n]);return e};function ig(e,t){return function(n){const a=t(n.keys);return r.createElement(e,ls(ls({},n),a))}}const lg=ig,cg=(e,t=!1)=>[{metadatas:{intlLabel:{id:"components.InputSelect.option.placeholder",defaultMessage:"Choose here"},disabled:t,hidden:t},key:"__enum_option_null",value:""},...e.map(n=>({metadatas:{intlLabel:{id:n,defaultMessage:n},hidden:!1,disabled:!1},key:n,value:n}))],ug=(e="")=>{switch((0,q.toLower)(e)){case"boolean":return"bool";case"biginteger":return"text";case"decimal":case"float":case"integer":return"number";case"date":case"datetime":case"time":return e;case"email":return"email";case"enumeration":return"select";case"password":return"password";case"string":return"text";case"text":return"textarea";case"media":case"file":case"files":return"media";case"json":return"json";case"wysiwyg":case"WYSIWYG":case"richtext":return"wysiwyg";case"uid":return"uid";default:return e||"text"}},dg=e=>{let t;return e==="float"||e==="decimal"?t=.01:t=1,t};function pg(e){const{createActionAllowedFields:t,formErrors:n,isCreatingEntry:a,modifiedData:s,onChange:i,readActionAllowedFields:l,shouldNotRunValidations:u,updateActionAllowedFields:c}=(0,y.useCMEditViewDataManager)(),d=(0,r.useMemo)(()=>a?t:c,[a,t,c]),m=(0,r.useMemo)(()=>a?[]:l,[a,l]),f=(0,q.get)(s,e,null);return{allowedFields:d,formErrors:n,isCreatingEntry:a,onChange:i,readableFields:m,shouldNotRunValidations:u,value:f}}const mg=pg,cs=["type","model","via","collection","default","plugin","enum","regex","pluginOptions"];var fg=Object.defineProperty,gg=Object.defineProperties,yg=Object.getOwnPropertyDescriptors,us=Object.getOwnPropertySymbols,hg=Object.prototype.hasOwnProperty,bg=Object.prototype.propertyIsEnumerable,ds=(e,t,n)=>t in e?fg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ir=(e,t)=>{for(var n in t||(t={}))hg.call(t,n)&&ds(e,n,t[n]);if(us)for(var n of us(t))bg.call(t,n)&&ds(e,n,t[n]);return e},Eg=(e,t)=>gg(e,yg(t));function lr({allowedFields:e,fieldSchema:t,formErrors:n,isCreatingEntry:a,keys:s,labelAction:i,metadatas:l,onChange:u,readableFields:c,shouldNotRunValidations:d,queryInfos:m,value:f}){const{fields:g}=(0,y.useLibrary)(),{formatMessage:h}=(0,A.useIntl)(),{contentType:b}=dt(),E=(0,r.useMemo)(()=>!R()(l,"editable",!0),[l]),O=t.type,I=R()(n,[s],null),C=(0,r.useMemo)(()=>To(s),[s]),x=(0,r.useMemo)(()=>{const Q=Ld()(t,d?[...cs,"required","minLength"]:cs),K=t.regex||null;if(K){const P=new RegExp(K);P&&(Q.regex=P)}return Q},[t,d]),D=(0,r.useMemo)(()=>R()(x,["required"],!1),[x]),W=(0,r.useMemo)(()=>{const Q=R()(b,["attributes"],{});return R()(Q,[C[0],"type"],null)==="dynamiczone"},[b,C]),F=(0,r.useMemo)(()=>ug(O),[O]),$=(0,r.useMemo)(()=>O==="media"&&!f?[]:f,[O,f]),N=(0,r.useMemo)(()=>dg(O),[O]),G=(0,r.useMemo)(()=>{const Q=C.join(".");if(e.includes(Q))return!0;if(W)return e.includes(C[0]);if(C.length>1){const P=Xt()(C,C.length-1).join(".");return e.includes(P)}return!1},[e,C,W]),V=(0,r.useMemo)(()=>{const Q=C.join(".");if(c.includes(Q))return!0;if(W)return c.includes(C[0]);if(C.length>1){const P=Xt()(C,C.length-1).join(".");return c.includes(P)}return!1},[c,C,W]),_=(0,r.useMemo)(()=>V||G,[G,V]),k=(0,r.useMemo)(()=>a?E:V&&!G?!0:E,[E,a,G,V]),Z=(0,r.useMemo)(()=>cg(t.enum||[],D),[t,D]),{label:B,description:Y,placeholder:T,visible:z}=l;return z===!1?null:_?O==="relation"?r.createElement(as,Eg(ir(ir({},l),t),{description:l.description?h({id:l.description,defaultMessage:l.description}):void 0,intlLabel:{id:l.label,defaultMessage:l.label},labelAction:i,isUserAllowedToEditField:G,isUserAllowedToReadField:V,name:s,placeholder:l.placeholder?{id:l.placeholder,defaultMessage:l.placeholder}:null,queryInfos:m,value:f,error:I&&h(I)})):r.createElement(y.GenericInput,{attribute:t,autoComplete:"new-password",intlLabel:{id:B,defaultMessage:B},isNullable:F==="bool"&&[null,void 0].includes(t.default),description:Y?{id:Y,defaultMessage:Y}:null,disabled:k,error:I,labelAction:i,contentTypeUID:b.uid,customInputs:ir({json:km,uid:Km,media:g.media,wysiwyg:ym},g),multiple:t.multiple||!1,name:s,onChange:u,options:Z,placeholder:T?{id:T,defaultMessage:T}:null,required:t.required||!1,step:N,type:F,value:$,withDefaultValue:!1}):r.createElement(y.NotAllowedInput,{description:Y?{id:Y,defaultMessage:Y}:null,intlLabel:{id:B,defaultMessage:B},labelAction:i,error:I&&h(I),name:s,required:D})}lr.defaultProps={formErrors:{},labelAction:void 0,queryInfos:{},value:null},lr.propTypes={allowedFields:o().array.isRequired,fieldSchema:o().object.isRequired,formErrors:o().object,keys:o().string.isRequired,isCreatingEntry:o().bool.isRequired,labelAction:o().element,metadatas:o().object.isRequired,onChange:o().func.isRequired,readableFields:o().array.isRequired,shouldNotRunValidations:o().bool.isRequired,queryInfos:o().shape({containsKey:o().string,defaultParams:o().object,endPoint:o().string}),value:o().any};const vg=(0,r.memo)(lr,He()),cr=lg(vg,mg),ur=({componentUid:e,isFromDynamicZone:t,isNested:n,name:a})=>{const{getComponentLayout:s}=dt(),l=(0,r.useMemo)(()=>s(e),[e,s]).layouts.edit;return r.createElement(w.Box,{background:t?"":"neutral100",paddingLeft:6,paddingRight:6,paddingTop:6,paddingBottom:6,hasRadius:n,borderColor:n?"neutral200":""},r.createElement(ae.Stack,{spacing:6},l.map((u,c)=>r.createElement(le.Grid,{gap:4,key:c},u.map(({name:d,size:m,metadatas:f,fieldSchema:g,queryInfos:h})=>{const b=g.type==="component",E=`${a}.${d}`;if(b){const O=g.component;return r.createElement(le.GridItem,{col:m,s:12,xs:12,key:d},r.createElement(rn,{componentUid:O,intlLabel:{id:f.label,defaultMessage:f.label},isNested:!0,isRepeatable:g.repeatable,max:g.max,min:g.min,name:E,required:g.required||!1}))}return r.createElement(le.GridItem,{col:m,key:d,s:12,xs:12},r.createElement(cr,{keys:E,fieldSchema:g,metadatas:f,queryInfos:h}))})))))};ur.defaultProps={isFromDynamicZone:!1,isNested:!1},ur.propTypes={componentUid:o().string.isRequired,isFromDynamicZone:o().bool,isNested:o().bool,name:o().string.isRequired};const Cg=ur;var ps=p(74201),Og=p(59290),ft=p.n(Og),Pg=Object.defineProperty,ms=Object.getOwnPropertySymbols,Rg=Object.prototype.hasOwnProperty,Mg=Object.prototype.propertyIsEnumerable,fs=(e,t,n)=>t in e?Pg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gs=(e,t)=>{for(var n in t||(t={}))Rg.call(t,n)&&fs(e,n,t[n]);if(ms)for(var n of ms(t))Mg.call(t,n)&&fs(e,n,t[n]);return e};function Tg(e,t){return function(n){const a=t(n);return r.createElement(e,gs(gs({},n),a))}}const wg=Tg;function Ig(){const{addRepeatableComponentToField:e,formErrors:t}=(0,y.useCMEditViewDataManager)();return{addRepeatableComponentToField:e,formErrors:t}}const Dg=Ig;function xg(e,t){return Object.keys(t).filter(n=>n.startsWith(e)).map(n=>n.split(".").slice(0,e.split(".").length+1).join("."))}var nn=p(51968),Sg=p(41119),ys=p.n(Sg),dr=p(44826);const Lg=S.default.span`
821
- display: block;
822
- background-color: ${({theme:e})=>e.colors.primary100};
823
- outline: 1px dashed ${({theme:e})=>e.colors.primary500};
824
- outline-offset: -1px;
825
- padding: ${({theme:e})=>e.spaces[6]};
826
- `,Fg=()=>r.createElement(Lg,{padding:6,background:"primary100"});var kg=p(78752);const Ag=(0,S.default)(Me.IconButton)`
827
- background-color: transparent;
828
-
829
- svg {
830
- path {
831
- fill: ${({theme:e,expanded:t})=>t?e.colors.primary600:e.colors.neutral600};
832
- }
833
- }
834
-
835
- &:hover {
836
- svg {
837
- path {
838
- fill: ${({theme:e})=>e.colors.primary600};
839
- }
840
- }
841
- }
842
- `,hs=(0,S.default)(Me.IconButton)`
843
- background-color: transparent;
844
-
845
- svg {
846
- path {
847
- fill: ${({theme:e,expanded:t})=>t?e.colors.primary600:e.colors.neutral600};
848
- }
849
- }
850
- `,jg=S.default.span`
851
- display: flex;
852
- justify-content: space-between;
853
- padding-left: ${({theme:e})=>e.spaces[4]};
854
- padding-right: ${({theme:e})=>e.spaces[4]};
855
- background-color: ${({theme:e})=>e.colors.neutral0};
856
- height: ${50/16}rem;
857
- `,$g=(0,S.default)(ps.TextButton)`
858
- text-align: left;
859
-
860
- svg {
861
- width: ${14/16}rem;
862
- height: ${14/16}rem;
863
-
864
- path {
865
- fill: ${({theme:e,expanded:t})=>t?e.colors.primary600:e.colors.neutral500};
866
- }
867
- }
868
- `,bs=({displayedValue:e})=>r.createElement(jg,null,r.createElement(ae.Stack,{horizontal:!0,spacing:3,flex:1},r.createElement(j.Flex,{justifyContent:"center",borderRadius:"50%",height:`${24/16}rem}`,width:`${24/16}rem}`,"aria-hidden":!0,as:"span",background:"neutral200"},r.createElement(kg.Icon,{as:En(),width:`${8/16}rem}`,color:"neutral600"})),r.createElement($g,{onClick:()=>{},flex:1},r.createElement(L.Typography,{fontWeight:"bold",textColor:"neutral700"},e))),r.createElement(ae.Stack,{horizontal:!0,spacing:0},r.createElement(hs,{noBorder:!0,onClick:()=>{},icon:r.createElement(qe(),null)}),r.createElement(hs,{icon:r.createElement(rt(),null),noBorder:!0})));bs.propTypes={displayedValue:o().string.isRequired};const Bg=bs;var Ng=Object.defineProperty,Es=Object.getOwnPropertySymbols,Vg=Object.prototype.hasOwnProperty,qg=Object.prototype.propertyIsEnumerable,vs=(e,t,n)=>t in e?Ng(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Cs=(e,t)=>{for(var n in t||(t={}))Vg.call(t,n)&&vs(e,n,t[n]);if(Es)for(var n of Es(t))qg.call(t,n)&&vs(e,n,t[n]);return e};function Wg(e,t){return function(n){const a=t(n);return r.createElement(e,Cs(Cs({},n),a))}}const zg=Wg;function Ug({schema:e,componentFieldName:t}){const{checkFormErrors:n,modifiedData:a,moveComponentField:s,removeRepeatableField:i,triggerFormValidation:l}=(0,y.useCMEditViewDataManager)(),u=(0,r.useMemo)(()=>(0,q.get)(e,["settings","mainField"],"id"),[e]);return{displayedValue:(0,q.toString)((0,q.get)(a,[...t.split("."),u],"")),mainField:u,checkFormErrors:n,moveComponentField:s,removeRepeatableField:i,schema:e,triggerFormValidation:l}}const Hg=Ug,_g=S.default.span`
869
- display: flex;
870
- align-items: center;
871
- height: ${({theme:e})=>e.spaces[7]};
872
-
873
- padding: 0 ${({theme:e})=>e.spaces[3]};
874
- cursor: all-scroll;
875
-
876
- svg {
877
- width: ${12/16}rem;
878
- height: ${12/16}rem;
879
- }
880
- `,pr=({componentFieldName:e,hasErrorMessage:t,hasErrors:n,isDraggingSibling:a,isOpen:s,isReadOnly:i,onClickToggle:l,schema:u,toggleCollapses:c,moveComponentField:d,removeRepeatableField:m,setIsDraggingSibling:f,triggerFormValidation:g,displayedValue:h})=>{const b=(0,r.useRef)(null),E=(0,r.useRef)(null),[,O]=(0,r.useState)(!1),{formatMessage:I}=(0,A.useIntl)(),C=u.layouts.edit,[,x]=(0,Te.useDrop)({accept:Pe.COMPONENT,canDrop(){return!1},hover(V,_){if(!E.current)return;const k=V.originalPath,Z=e,B=k.split("."),Y=B.slice().splice(-1).join(""),T=Z.split(".").splice(-1).join(""),z=B.slice(0,B.length-1),Q=parseInt(Y,10),K=parseInt(T,10);if(Q===K)return;const P=E.current.getBoundingClientRect(),M=(P.bottom-P.top)/2,re=_.getClientOffset().y-P.top;Q<K&&re<M||Q>K&&re>M||k.split(".").length===Z.split(".").length&&(d(z,Q,K),V.originalPath=Z)}}),[{isDragging:D},W,F]=(0,Te.useDrag)({type:Pe.COMPONENT,item:()=>(c(-1),{displayedValue:h,originalPath:e}),end:()=>{g(),f(!1)},collect:V=>({isDragging:V.isDragging()})});(0,r.useEffect)(()=>{F((0,nn.rX)(),{captureDraggingState:!1})},[F]),(0,r.useEffect)(()=>{D&&f(!0)},[D,f]),(0,r.useEffect)(()=>{a||O(V=>!V)},[a]);const $={dragRef:W(b),dropRef:x(E)},N=ys()(h),G=n?"error":void 0;return r.createElement(w.Box,{ref:$?$.dropRef:null},D&&r.createElement(Fg,null),!D&&a&&r.createElement(Bg,{displayedValue:N,componentFieldName:e}),!D&&!a&&r.createElement(_e.Accordion,{error:G,hasErrorMessage:t,expanded:s,onToggle:l,id:e,size:"S"},r.createElement(_e.AccordionToggle,{action:i?null:r.createElement(ae.Stack,{horizontal:!0,spacing:0},r.createElement(Ag,{expanded:s,noBorder:!0,onClick:()=>{m(e),c()},label:I({id:v("containers.Edit.delete"),defaultMessage:"Delete"}),icon:r.createElement(qe(),null)}),r.createElement(dr.Tooltip,{description:I({id:v("components.DragHandle-label"),defaultMessage:"Drag"})},r.createElement(_g,{role:"button",tabIndex:-1,ref:$.dragRef,onClick:V=>V.stopPropagation()},r.createElement(rt(),null)))),title:N,togglePosition:"left"}),r.createElement(_e.AccordionContent,null,r.createElement(ae.Stack,{background:"neutral100",padding:6,spacing:6},C.map((V,_)=>r.createElement(le.Grid,{gap:4,key:_},V.map(({name:k,fieldSchema:Z,metadatas:B,queryInfos:Y,size:T})=>{const z=Z.type==="component",Q=`${e}.${k}`;if(z){const K=Z.component;return r.createElement(le.GridItem,{col:T,s:12,xs:12,key:k},r.createElement(rn,{componentUid:K,intlLabel:{id:B.label,defaultMessage:B.label},isRepeatable:Z.repeatable,isNested:!0,name:Q,max:Z.max,min:Z.min,required:Z.required}))}return r.createElement(le.GridItem,{key:Q,col:T,s:12,xs:12},r.createElement(cr,{fieldSchema:Z,keys:Q,metadatas:B,queryInfos:Y}))})))))))};pr.defaultProps={isDraggingSibling:!1,isOpen:!1,setIsDraggingSibling:()=>{},toggleCollapses:()=>{}},pr.propTypes={componentFieldName:o().string.isRequired,hasErrorMessage:o().bool.isRequired,hasErrors:o().bool.isRequired,isDraggingSibling:o().bool,isOpen:o().bool,isReadOnly:o().bool.isRequired,onClickToggle:o().func.isRequired,schema:o().object.isRequired,toggleCollapses:o().func,moveComponentField:o().func.isRequired,removeRepeatableField:o().func.isRequired,setIsDraggingSibling:o().func,triggerFormValidation:o().func.isRequired,displayedValue:o().string.isRequired};const Zg=(0,r.memo)(pr),Gg=zg(Zg,Hg);var Os=p(87910),Qg=Object.defineProperty,Ps=Object.getOwnPropertySymbols,Kg=Object.prototype.hasOwnProperty,Yg=Object.prototype.propertyIsEnumerable,Rs=(e,t,n)=>t in e?Qg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Jg=(e,t)=>{for(var n in t||(t={}))Kg.call(t,n)&&Rs(e,n,t[n]);if(Ps)for(var n of Ps(t))Yg.call(t,n)&&Rs(e,n,t[n]);return e};const Xg=(0,S.default)(w.Box)`
881
- overflow: hidden;
882
- border-bottom: 1px solid ${({theme:e})=>e.colors.neutral200};
883
- border-right: 1px solid ${({theme:e})=>e.colors.neutral200};
884
- border-left: 1px solid ${({theme:e})=>e.colors.neutral200};
885
- border-radius: 0 0 ${({theme:e})=>e.borderRadius} ${({theme:e})=>e.borderRadius};
886
- `,ey=(0,S.default)(w.Box)`
887
- > div {
888
- & > * {
889
- border-radius: unset;
890
- border-right: 1px solid ${({theme:e})=>e.colors.neutral200};
891
- border-left: 1px solid ${({theme:e})=>e.colors.neutral200};
892
- border-bottom: 1px solid ${({theme:e})=>e.colors.neutral200};
893
- }
894
- > div {
895
- > div:first-of-type {
896
- border-radius: unset;
897
- }
898
- }
899
- }
900
-
901
- > div:first-of-type {
902
- > div {
903
- border-radius: ${({theme:e})=>e.borderRadius} ${({theme:e})=>e.borderRadius} 0 0;
904
- > div:first-of-type {
905
- border-radius: ${({theme:e})=>e.borderRadius} ${({theme:e})=>e.borderRadius} 0 0;
906
- }
907
- }
908
-
909
- > div:not([data-strapi-expanded='true']) {
910
- border-top: 1px solid ${({theme:e})=>e.colors.neutral200};
911
-
912
- &:hover {
913
- border-top: 1px solid ${({theme:e})=>e.colors.primary600};
914
- }
915
- }
916
-
917
- > span {
918
- border-radius: ${({theme:e})=>e.borderRadius} ${({theme:e})=>e.borderRadius} 0 0;
919
- border-top: 1px solid ${({theme:e})=>e.colors.neutral200};
920
- }
921
- }
922
-
923
- & [data-strapi-expanded='true'] {
924
- border: 1px solid ${({theme:e})=>e.colors.primary600};
925
- }
926
-
927
- ${({theme:e,footer:t})=>`
928
- &:not(${t}) {
929
- & > *:last-of-type {
930
- border-radius: 0 0 ${e.borderRadius} ${e.borderRadius};
931
- }
932
- }
933
- `}
934
- `,ty=(0,S.default)(w.Box)`
935
- svg path {
936
- fill: ${({theme:e})=>e.colors.neutral500};
937
- }
938
- `,mr=({children:e,footer:t,label:n,labelAction:a,error:s})=>{const{formatMessage:i}=(0,A.useIntl)(),l=r.Children.toArray(e).map(u=>(0,r.cloneElement)(u,{hasErrorMessage:!1}));return r.createElement(Os.KeyboardNavigable,{attributeName:"data-strapi-accordion-toggle"},n&&r.createElement(j.Flex,{paddingBottom:1},r.createElement(L.Typography,{as:"label",textColor:"neutral800",variant:"pi",fontWeight:"bold"},n),a&&r.createElement(ty,{paddingLeft:1},a)),r.createElement(ey,{footer:t},l),t&&r.createElement(Xg,null,t),s&&r.createElement(w.Box,{paddingTop:1},r.createElement(L.Typography,{variant:"pi",textColor:"danger600"},i({id:s.id,defaultMessage:s.id},Jg({},s.values)))))};mr.defaultProps={error:void 0,footer:null,label:null,labelAction:void 0},mr.propTypes={children:o().node.isRequired,error:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),footer:o().node,label:o().string,labelAction:o().node};const ny=mr,ry=(0,S.default)(ps.TextButton)`
939
- height: 100%;
940
- width: 100%;
941
- border-radius: 0 0 4px 4px;
942
- display: flex;
943
- justify-content: center;
944
- span {
945
- font-weight: 600;
946
- font-size: 14px;
947
- }
948
- `,fr=({addRepeatableComponentToField:e,formErrors:t,componentUid:n,componentValue:a,componentValueLength:s,isReadOnly:i,max:l,min:u,name:c})=>{const d=(0,y.useNotification)(),{formatMessage:m}=(0,A.useIntl)(),[f,g]=(0,r.useState)(""),[h,b]=(0,r.useState)(!1),[,E]=(0,Te.useDrop)({accept:Pe.COMPONENT}),{getComponentLayout:O}=dt(),I=(0,r.useMemo)(()=>O(n),[n,O]),C=(0,r.useMemo)(()=>wo(a||[])+1,[a]),x=xg(c,t),D=()=>{g("")},W=u-s,F=R()(t,c,{id:""}).id.includes("min"),$=(0,r.useCallback)(()=>{i||(s<l?(e(c,n,F),g(C)):s>=l&&d({type:"info",message:{id:v("components.notification.info.maximum-requirement")}}))},[e,n,s,F,i,l,c,C,d]);let N=t[c];return F&&(N={id:v("components.DynamicZone.missing-components"),defaultMessage:"There {number, plural, =0 {are # missing components} one {is # missing component} other {are # missing components}}",values:{number:W}}),s===0?r.createElement(ua,{error:N,isReadOnly:i,onClick:$}):(x.some(V=>V.split(".").length>1)&&!F&&(N={id:v("components.RepeatableComponent.error-message"),defaultMessage:"The component(s) contain error(s)"}),r.createElement(w.Box,{hasRadius:!0,ref:E},r.createElement(ny,{error:N,footer:r.createElement(j.Flex,{justifyContent:"center",height:"48px",background:"neutral0"},r.createElement(ry,{disabled:i,onClick:$,startIcon:r.createElement(ft(),null)},m({id:v("containers.EditView.add.new-entry"),defaultMessage:"Add an entry"})))},a.map((V,_)=>{const k=V.__temp_key__,Z=f===k,B=`${c}.${_}`,Y=x.includes(B);return r.createElement(Gg,{componentFieldName:B,componentUid:n,hasErrors:Y,hasMinError:F,isDraggingSibling:h,isOpen:Z,isReadOnly:i,key:k,onClickToggle:()=>{g(Z?"":k)},parentName:c,schema:I,setIsDraggingSibling:b,toggleCollapses:D})}))))};fr.defaultProps={componentValue:null,componentValueLength:0,formErrors:{},max:1/0,min:0},fr.propTypes={addRepeatableComponentToField:o().func.isRequired,componentUid:o().string.isRequired,componentValue:o().oneOfType([o().array,o().object]),componentValueLength:o().number,formErrors:o().object,isReadOnly:o().bool.isRequired,max:o().number,min:o().number,name:o().string.isRequired};const oy=(0,r.memo)(fr),ay=wg(oy,Dg);var sy=Object.defineProperty,Ms=Object.getOwnPropertySymbols,iy=Object.prototype.hasOwnProperty,ly=Object.prototype.propertyIsEnumerable,Ts=(e,t,n)=>t in e?sy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ws=(e,t)=>{for(var n in t||(t={}))iy.call(t,n)&&Ts(e,n,t[n]);if(Ms)for(var n of Ms(t))ly.call(t,n)&&Ts(e,n,t[n]);return e};function cy(e,t){return function(n){const a=t(n);return r.createElement(e,ws(ws({},n),a))}}const uy=cy;function dy({isFromDynamicZone:e,name:t}){const{addNonRepeatableComponentToField:n,createActionAllowedFields:a,isCreatingEntry:s,modifiedData:i,removeComponentFromField:l,readActionAllowedFields:u,updateActionAllowedFields:c,formErrors:d}=(0,y.useCMEditViewDataManager)(),{contentType:m}=dt(),f=(0,r.useMemo)(()=>{const C=(0,q.get)(m,["attributes"],{});return Object.keys(C).filter(D=>(0,q.get)(C,[D,"type"],"")==="dynamiczone")},[m]),g=(0,r.useMemo)(()=>s?a:c,[s,a,c]),h=(0,q.get)(i,t,null),b=(0,r.useMemo)(()=>To(t),[t]),E=(0,r.useMemo)(()=>e&&s||g.filter(D=>D===b[0]).length>0?!0:g.map(D=>D.split(".")).filter(D=>D.length<b.length?!1:(0,q.take)(D,b.length).join(".")===b.join(".")).length>0,[e,s,g,b]),O=(0,r.useMemo)(()=>e||f.includes(b[0])?!0:(s?[]:u).map(D=>D.split(".")).filter(D=>D.length<b.length?!1:(0,q.take)(D,b.length).join(".")===b.join(".")).length>0,[e,f,b,s,u]),I=(0,r.useMemo)(()=>s||E?!1:O,[E,O,s]);return{addNonRepeatableComponentToField:n,formErrors:d,hasChildrenAllowedFields:E,hasChildrenReadableFields:O,isCreatingEntry:s,isReadOnly:I,removeComponentFromField:l,componentValue:h}}const py=dy,my=(0,S.default)(w.Box)`
949
- svg path {
950
- fill: ${({theme:e})=>e.colors.neutral500};
951
- }
952
- `,gr=({intlLabel:e,id:t,labelAction:n,name:a,numberOfEntries:s,showNumberOfEntries:i,required:l})=>{const{formatMessage:u}=(0,A.useIntl)(),c=e!=null&&e.id?u(e):a;return r.createElement(w.Box,{paddingBottom:1},r.createElement(j.Flex,null,r.createElement(L.Typography,{textColor:"neutral800",htmlFor:t||a,variant:"pi",fontWeight:"bold",as:"label"},c,i&&r.createElement(r.Fragment,null,"\xA0(",s,")"),l&&r.createElement(L.Typography,{textColor:"danger600"},"*")),n&&r.createElement(my,{paddingLeft:1},n)))};gr.defaultProps={id:void 0,labelAction:void 0,numberOfEntries:0,required:!1,showNumberOfEntries:!1},gr.propTypes={id:o().string,intlLabel:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}).isRequired,labelAction:o().element,name:o().string.isRequired,numberOfEntries:o().number,required:o().bool,showNumberOfEntries:o().bool};const fy=gr,yr=({addNonRepeatableComponentToField:e,componentUid:t,intlLabel:n,isCreatingEntry:a,isFromDynamicZone:s,isRepeatable:i,isNested:l,labelAction:u,max:c,min:d,name:m,hasChildrenAllowedFields:f,hasChildrenReadableFields:g,isReadOnly:h,componentValue:b,removeComponentFromField:E,required:O})=>{const{formatMessage:I}=(0,A.useIntl)(),C=Md()(b),x=b!==null||s,D=!i&&x&&!s&&f;if(!f&&a)return r.createElement(y.NotAllowedInput,{labelAction:u,intlLabel:n,name:m});if(!f&&!a&&!g)return r.createElement(y.NotAllowedInput,{labelAction:u,intlLabel:n,name:m});const W=()=>{e(m,t)};return r.createElement(w.Box,null,r.createElement(j.Flex,{justifyContent:"space-between"},n&&r.createElement(fy,{intlLabel:n,labelAction:u,name:m,numberOfEntries:C,showNumberOfEntries:i,required:O}),D&&r.createElement(Me.IconButton,{label:I({id:v("components.reset-entry"),defaultMessage:"Reset Entry"}),icon:r.createElement(qe(),null),noBorder:!0,onClick:()=>{E(m,t)}})),r.createElement(ae.Stack,{spacing:1},!i&&!x&&r.createElement(ua,{isReadOnly:h,onClick:W}),!i&&x&&r.createElement(Cg,{componentUid:t,isFromDynamicZone:s,isNested:l,name:m}),i&&r.createElement(ay,{componentValue:b,componentValueLength:C,componentUid:t,isReadOnly:h,max:c,min:d,name:m})))};yr.defaultProps={componentValue:null,hasChildrenAllowedFields:!1,hasChildrenReadableFields:!1,intlLabel:void 0,isFromDynamicZone:!1,isReadOnly:!1,isRepeatable:!1,isNested:!1,labelAction:void 0,max:1/0,min:-1/0,required:!1},yr.propTypes={addNonRepeatableComponentToField:o().func.isRequired,componentUid:o().string.isRequired,componentValue:o().oneOfType([o().object,o().array]),hasChildrenAllowedFields:o().bool,hasChildrenReadableFields:o().bool,isCreatingEntry:o().bool.isRequired,isFromDynamicZone:o().bool,isReadOnly:o().bool,isRepeatable:o().bool,isNested:o().bool,intlLabel:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),labelAction:o().element,max:o().number,min:o().number,name:o().string.isRequired,removeComponentFromField:o().func.isRequired,required:o().bool};const gy=(0,r.memo)(yr,He()),rn=uy(gy,py),yy=(0,S.default)(w.Box)`
953
- width: ${({theme:e})=>e.spaces[2]};
954
- height: ${({theme:e})=>e.spaces[4]};
955
- `,hy=()=>r.createElement(j.Flex,{justifyContent:"center"},r.createElement(yy,{background:"neutral200"})),by=(0,S.default)(ae.Stack)`
956
- svg {
957
- path {
958
- fill: ${({theme:e,expanded:t})=>t?e.colors.primary600:e.colors.neutral600};
959
- }
960
- }
961
- `,hr=(0,S.default)(Me.IconButton)`
962
- background-color: transparent;
963
- `,Ey=(0,S.default)(w.Box)`
964
- > div:first-child {
965
- box-shadow: ${({theme:e})=>e.shadows.tableShadow};
966
- }
967
- `,vy=(0,S.default)(w.Box)`
968
- border-radius: 0 0 ${({theme:e})=>e.spaces[1]} ${({theme:e})=>e.spaces[1]};
969
- `,Is=({componentUid:e,formErrors:t,index:n,isOpen:a,isFieldAllowed:s,moveComponentDown:i,moveComponentUp:l,name:u,onToggle:c,removeComponentFromDynamicZone:d,showDownIcon:m,showUpIcon:f})=>{const{formatMessage:g}=(0,A.useIntl)(),{getComponentLayout:h}=dt(),{icon:b,friendlyName:E}=(0,r.useMemo)(()=>{const{info:{icon:G,displayName:V}}=h(e);return{friendlyName:V,icon:G}},[e,h]),O=()=>i(u,n),I=()=>l(u,n),C=()=>d(u,n),x=g({id:v("components.DynamicZone.move-down-label"),defaultMessage:"Move component down"}),D=g({id:v("components.DynamicZone.move-up-label"),defaultMessage:"Move component down"}),W=g({id:v("components.DynamicZone.delete-label"),defaultMessage:"Delete {name}"},{name:E}),$=Object.keys(t).filter(G=>{const V=G.split(".");return`${V[0]}.${V[1]}`==`${u}.${n}`});let N;return $.length>0&&(N=g({id:v("components.DynamicZone.error-message"),defaultMessage:"The component contains error(s)"})),r.createElement(w.Box,null,r.createElement(hy,null),r.createElement(Ey,{hasRadius:!0},r.createElement(_e.Accordion,{expanded:a,onToggle:()=>c(n),size:"S",error:N},r.createElement(_e.AccordionToggle,{startIcon:r.createElement(An.G,{icon:b}),action:r.createElement(by,{horizontal:!0,spacing:0,expanded:a},m&&r.createElement(hr,{noBorder:!0,label:x,onClick:O,icon:r.createElement(Cd(),null)}),f&&r.createElement(hr,{noBorder:!0,label:D,onClick:I,icon:r.createElement(Pd(),null)}),s&&r.createElement(hr,{noBorder:!0,label:W,onClick:C,icon:r.createElement(qe(),null)})),title:E,togglePosition:"left"}),r.createElement(_e.AccordionContent,null,r.createElement(vy,{background:"neutral0"},r.createElement(jn.FocusTrap,{onEscape:()=>c(n)},r.createElement(rn,{componentUid:e,icon:b,name:`${u}.${n}`,isFromDynamicZone:!0})))))))};Is.propTypes={componentUid:o().string.isRequired,formErrors:o().object.isRequired,index:o().number.isRequired,isFieldAllowed:o().bool.isRequired,isOpen:o().bool.isRequired,moveComponentDown:o().func.isRequired,moveComponentUp:o().func.isRequired,name:o().string.isRequired,onToggle:o().func.isRequired,removeComponentFromDynamicZone:o().func.isRequired,showDownIcon:o().bool.isRequired,showUpIcon:o().bool.isRequired};const Cy=(0,r.memo)(Is,He());var Oy=p(81346),Py=p.n(Oy);const Ds=(0,S.default)(An.G)`
970
- width: ${(0,y.pxToRem)(32)} !important;
971
- height: ${(0,y.pxToRem)(32)} !important;
972
- padding: ${(0,y.pxToRem)(9)};
973
- border-radius: ${(0,y.pxToRem)(64)};
974
- background: ${({theme:e})=>e.colors.neutral150};
975
- path {
976
- fill: ${({theme:e})=>e.colors.neutral500};
977
- }
978
- `,Ry=(0,S.default)(w.Box)`
979
- flex-shrink: 0;
980
- height: ${(0,y.pxToRem)(84)};
981
- border: 1px solid ${({theme:e})=>e.colors.neutral200};
982
- background: ${({theme:e})=>e.colors.neutral100};
983
- border-radius: ${({theme:e})=>e.borderRadius};
984
- display: flex;
985
- justify-content: center;
986
- align-items: center;
987
-
988
- &.active,
989
- &:hover {
990
- border: 1px solid ${({theme:e})=>e.colors.primary200};
991
- background: ${({theme:e})=>e.colors.primary100};
992
-
993
- ${Ds} {
994
- background: ${({theme:e})=>e.colors.primary200};
995
- path {
996
- fill: ${({theme:e})=>e.colors.primary600};
997
- }
998
- }
999
-
1000
- ${L.Typography} {
1001
- color: ${({theme:e})=>e.colors.primary600};
1002
- }
1003
- }
1004
- `;function br({componentUid:e,intlLabel:t,icon:n,onClick:a}){const{formatMessage:s}=(0,A.useIntl)(),i=()=>{a(e)};return r.createElement("button",{type:"button",onClick:i},r.createElement(Ry,{borderRadius:"borderRadius"},r.createElement(ae.Stack,{spacing:1,style:{justifyContent:"center",alignItems:"center"}},r.createElement(Ds,{icon:n}),r.createElement(L.Typography,{variant:"pi",fontWeight:"bold",textColor:"neutral600"},s(t)))))}br.defaultProps={icon:"smile",onClick:()=>{}},br.propTypes={componentUid:o().string.isRequired,intlLabel:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired}).isRequired,icon:o().string,onClick:o().func};const My=br,Ty=S.default.div`
1005
- display: grid;
1006
- grid-template-columns: repeat(auto-fit, ${140/16}rem);
1007
- grid-gap: ${({theme:e})=>e.spaces[1]};
1008
- `,xs=({category:e,components:t,isOdd:n,isOpen:a,onAddComponent:s,onToggle:i})=>{const{formatMessage:l}=(0,A.useIntl)(),u=()=>{i(e)};return r.createElement(_e.Accordion,{expanded:a,onToggle:u,size:"S"},r.createElement(_e.AccordionToggle,{variant:n?"primary":"secondary",title:l({id:e,defaultMessage:e}),togglePosition:"left"}),r.createElement(_e.AccordionContent,null,r.createElement(w.Box,{paddingTop:4,paddingBottom:4,paddingLeft:3,paddingRight:3},r.createElement(Ty,null,t.map(({componentUid:c,info:{displayName:d,icon:m}})=>r.createElement(My,{key:c,componentUid:c,intlLabel:{id:d,defaultMessage:d},icon:m,onClick:s}))))))};xs.propTypes={category:o().string.isRequired,components:o().array.isRequired,isOdd:o().bool.isRequired,isOpen:o().bool.isRequired,onAddComponent:o().func.isRequired,onToggle:o().func.isRequired};const wy=xs,Ss=({components:e,isOpen:t,onClickAddComponent:n})=>{const{formatMessage:a}=(0,A.useIntl)(),{getComponentLayout:s}=dt(),[i,l]=(0,r.useState)(""),u=(0,r.useMemo)(()=>{const m=e.map(g=>{const{category:h,info:b}=s(g);return{componentUid:g,category:h,info:b}}),f=Py()(m,"category");return Object.keys(f).reduce((g,h)=>(g.push({category:h,components:f[h]}),g),[])},[e,s]);(0,r.useEffect)(()=>{t&&u.length&&l(u[0].category)},[t,u]);const c=(0,r.useCallback)(m=>{n(m),l("")},[n]),d=(0,r.useCallback)(m=>{l(i===m?"":m)},[i]);return t?r.createElement(w.Box,{paddingBottom:6},r.createElement(w.Box,{paddingTop:6,paddingBottom:6,paddingLeft:5,paddingRight:5,background:"neutral0",shadow:"tableShadow",borderColor:"neutral150",hasRadius:!0},r.createElement(j.Flex,{justifyContent:"center"},r.createElement(L.Typography,{fontWeight:"bold",textColor:"neutral600"},a({id:v("components.DynamicZone.ComponentPicker-label"),defaultMessage:"Pick one component"}))),r.createElement(w.Box,{paddingTop:2},r.createElement(Os.KeyboardNavigable,{attributeName:"data-strapi-accordion-toggle"},u.map(({category:m,components:f},g)=>r.createElement(wy,{key:m,category:m,components:f,isOdd:g%2===1,isOpen:m===i,onAddComponent:c,onToggle:d})))))):null};Ss.propTypes={components:o().array.isRequired,isOpen:o().bool.isRequired,onClickAddComponent:o().func.isRequired};const Iy=(0,r.memo)(Ss);var Dy=Object.defineProperty,xy=Object.defineProperties,Sy=Object.getOwnPropertyDescriptors,Ls=Object.getOwnPropertySymbols,Ly=Object.prototype.hasOwnProperty,Fy=Object.prototype.propertyIsEnumerable,Fs=(e,t,n)=>t in e?Dy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ky=(e,t)=>{for(var n in t||(t={}))Ly.call(t,n)&&Fs(e,n,t[n]);if(Ls)for(var n of Ls(t))Fy.call(t,n)&&Fs(e,n,t[n]);return e},Ay=(e,t)=>xy(e,Sy(t));const ks=e=>Array.from({length:e}).map(()=>({isOpen:!1})),Er=({name:e,addComponentToDynamicZone:t,formErrors:n,isCreatingEntry:a,isFieldAllowed:s,isFieldReadable:i,labelAction:l,moveComponentUp:u,moveComponentDown:c,removeComponentFromDynamicZone:d,dynamicDisplayedComponents:m,fieldSchema:f,metadatas:g})=>{const h=(0,y.useNotification)(),[b,E]=(0,r.useState)(!1),[O,I]=(0,r.useState)(!1),C=m.length,x=g.description?{id:g.description,defaultMessage:g.description}:null,[D,W]=(0,r.useState)(ks(C));(0,r.useEffect)(()=>{W(ks(C))},[C]),(0,r.useEffect)(()=>{O&&(W(P=>P.map((M,H)=>H===P.length-1?Ay(ky({},M),{isOpen:!0}):M)),I(!1))},[O]);const{max:F=1/0,min:$=-1/0}=f,N=(0,r.useMemo)(()=>Object.keys(n).filter(P=>P===e).map(P=>n[P]),[n,e]),G=(0,r.useMemo)(()=>f.components||[],[f]),V=$-C,_=N.length>0,k=N.length>0&&R()(N,[0,"id"],"").includes("min"),Z=_&&R()(N,[0,"id"],"")==="components.Input.error.validation.max",B=(0,r.useCallback)(P=>{E(!1),t(e,P,_),I(!0)},[t,_,e]),Y=()=>{C<F?E(P=>!P):h({type:"info",message:{id:v("components.notification.info.maximum-requirement")}})},T=P=>{W(M=>M.map(({isOpen:H},re)=>re===P?{isOpen:!H}:{isOpen:H}))},z=(P,M)=>{c(P,M),W(H=>H.map(({isOpen:re},ce,me)=>ce===M+1?{isOpen:me[M].isOpen}:ce===M?{isOpen:me[ce+1].isOpen}:{isOpen:re}))},Q=(P,M)=>{u(P,M),W(H=>H.map(({isOpen:re},ce,me)=>ce===M-1?{isOpen:me[M].isOpen}:ce===M?{isOpen:me[ce-1].isOpen}:{isOpen:re}))},K=(P,M)=>{d(P,M)};return!s&&a?r.createElement(y.NotAllowedInput,{description:x,intlLabel:{id:g.label,defaultMessage:g.label},labelAction:l,name:e}):!s&&!i&&!a?r.createElement(y.NotAllowedInput,{description:x,intlLabel:{id:g.label,defaultMessage:g.label},labelAction:l,name:e}):r.createElement(ae.Stack,{spacing:6},C>0&&r.createElement(w.Box,null,r.createElement(Ed,{intlDescription:x,label:g.label,labelAction:l,name:e,numberOfComponents:C,required:f.required||!1}),m.map((P,M)=>{var H;const re=s&&C>0&&M<C-1,ce=s&&C>0&&M>0,me=((H=D[M])==null?void 0:H.isOpen)||!1;return r.createElement(Cy,{componentUid:P,formErrors:n,key:M,index:M,isOpen:me,isFieldAllowed:s,moveComponentDown:z,moveComponentUp:Q,onToggle:T,name:e,removeComponentFromDynamicZone:K,showDownIcon:re,showUpIcon:ce})})),r.createElement(hd,{hasError:_,hasMaxError:Z,hasMinError:k,isDisabled:!s,label:g.label,missingComponentNumber:V,isOpen:b,name:e,onClick:Y}),r.createElement(Iy,{isOpen:b,components:G,onClickAddComponent:B}))};Er.defaultProps={dynamicDisplayedComponents:[],fieldSchema:{max:1/0,min:-1/0},labelAction:null},Er.propTypes={addComponentToDynamicZone:o().func.isRequired,dynamicDisplayedComponents:o().array,fieldSchema:o().shape({components:o().array.isRequired,max:o().number,min:o().number,required:o().bool}),formErrors:o().object.isRequired,isCreatingEntry:o().bool.isRequired,isFieldAllowed:o().bool.isRequired,isFieldReadable:o().bool.isRequired,labelAction:o().element,metadatas:o().shape({description:o().string,label:o().string}).isRequired,moveComponentUp:o().func.isRequired,moveComponentDown:o().func.isRequired,name:o().string.isRequired,removeComponentFromDynamicZone:o().func.isRequired};const jy=(0,r.memo)(Er,He()),$y=dd(jy,md);var at=p(24522);const on=()=>({type:at.ZA}),vr=e=>({type:at.Id,data:e}),Cr=(e,t=!1)=>({type:at.TP,rawQuery:e,isSingleType:t}),As=()=>({type:at.c2}),js=(e,t)=>({type:at.w7,componentsDataStructure:e,contentTypeDataStructure:t}),he=e=>({type:at.d0,status:e}),Ke=e=>({type:at.t9,data:e}),$s=e=>e["content-manager_editViewCrudReducer"];var By=p(98399),Ny=Object.defineProperty,Bs=Object.getOwnPropertySymbols,Vy=Object.prototype.hasOwnProperty,qy=Object.prototype.propertyIsEnumerable,Ns=(e,t,n)=>t in e?Ny(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Wy=(e,t)=>{for(var n in t||(t={}))Vy.call(t,n)&&Ns(e,n,t[n]);if(Bs)for(var n of Bs(t))qy.call(t,n)&&Ns(e,n,t[n]);return e},st=(e,t,n)=>new Promise((a,s)=>{var i=c=>{try{u(n.next(c))}catch(d){s(d)}},l=c=>{try{u(n.throw(c))}catch(d){s(d)}},u=c=>c.done?a(c.value):Promise.resolve(c.value).then(i,l);u((n=n.apply(e,t)).next())});const Or=({allLayoutData:e,children:t,slug:n,id:a,origin:s})=>{const i=(0,y.useNotification)(),{setCurrentStep:l}=(0,y.useGuidedTour)(),{trackUsage:u}=(0,y.useTracking)(),{push:c,replace:d}=(0,te.useHistory)(),[{rawQuery:m}]=(0,y.useQueryParams)(),f=(0,fe.I0)(),{componentsDataStructure:g,contentTypeDataStructure:h,data:b,isLoading:E,status:O}=(0,fe.v9)($s),I=Go(n),C=(0,r.useRef)(!0),x=(0,r.useRef)(u),D=(0,r.useRef)(e),W=a===null,F=(0,r.useMemo)(()=>W&&!s?null:ve(`collection-types/${n}/${s||a}`),[n,a,W,s]),$=(0,r.useCallback)(T=>s?(0,y.contentManagementUtilRemoveFieldsFromData)(T,D.current.contentType,D.current.components):T,[s]),N=(0,r.useCallback)(T=>{const z=Fo(T,D.current.contentType,D.current.components);return(0,y.formatContentTypeData)(z,D.current.contentType,D.current.components)},[]);(0,r.useEffect)(()=>{const T=Object.keys(e.components).reduce((K,P)=>{const M=Wt(R()(e,["components",P,"attributes"],{}),e.components);return K[P]=(0,y.formatContentTypeData)(M,e.components[P],e.components),K},{}),z=Wt(e.contentType.attributes,e.components),Q=(0,y.formatContentTypeData)(z,e.contentType,e.components);f(js(T,Q))},[e,f]),(0,r.useEffect)(()=>()=>{f(As())},[f]),(0,r.useEffect)(()=>{const z=Se().CancelToken.source(),Q=P=>st(void 0,null,function*(){f(on());try{const{data:M}=yield ge.be.get(F,{cancelToken:P.token});f(vr(N($(M))))}catch(M){if(Se().isCancel(M))return;By.error(M);const H=R()(M,"response.status",null);if(H===404){c(I);return}H===403&&(i({type:"info",message:{id:v("permissions.not-allowed.update")}}),c(I))}}),K=()=>st(void 0,null,function*(){yield f(on()),yield f(Cr(m))});return C.current?(F?Q(z):K(),()=>{z.cancel("Operation canceled by the user.")}):()=>{}},[$,N,c,F,f,m,I,i]);const G=(0,r.useCallback)(T=>{const z=T.response.data;let Q=R()(z,["error","message"],"Bad Request");Array.isArray(Q)&&(Q=R()(Q,["0","messages","0","id"])),typeof Q=="string"&&i({type:"warning",message:Q})},[i]),V=(0,r.useCallback)(T=>st(void 0,null,function*(){try{x.current("willDeleteEntry",T);const{data:z}=yield ge.be.delete(ve(`collection-types/${n}/${a}`));return i({type:"success",message:{id:v("success.record.delete")}}),x.current("didDeleteEntry",T),Promise.resolve(z)}catch(z){return x.current("didNotDeleteEntry",Wy({error:z},T)),Promise.reject(z)}}),[a,n,i]),_=(0,r.useCallback)(()=>{d(I)},[I,d]),k=(0,r.useCallback)((T,z)=>st(void 0,null,function*(){const Q=`${ve(`collection-types/${n}`)}${m}`;try{f(he("submit-pending"));const{data:K}=yield ge.be.post(Q,T);return x.current("didCreateEntry",z),i({type:"success",message:{id:v("success.record.save")}}),l("contentManager.success"),f(Ke(N(K))),f(he("resolved")),d(`/content-manager/collectionType/${n}/${K.id}${m}`),Promise.resolve(K)}catch(K){return G(K),x.current("didNotCreateEntry",{error:K,trackerProperty:z}),f(he("resolved")),Promise.reject(K)}}),[N,G,d,n,f,m,i,l]),Z=(0,r.useCallback)(()=>st(void 0,null,function*(){try{x.current("willPublishEntry");const T=ve(`collection-types/${n}/${a}/actions/publish`);f(he("publish-pending"));const{data:z}=yield ge.be.post(T);return x.current("didPublishEntry"),f(Ke(N(z))),f(he("resolved")),i({type:"success",message:{id:v("success.record.publish")}}),Promise.resolve(z)}catch(T){return G(T),f(he("resolved")),Promise.reject(T)}}),[N,G,a,n,f,i]),B=(0,r.useCallback)((T,z)=>st(void 0,null,function*(){const Q=ve(`collection-types/${n}/${a}`);try{x.current("willEditEntry",z),f(he("submit-pending"));const{data:K}=yield ge.be.put(Q,T);return x.current("didEditEntry",{trackerProperty:z}),i({type:"success",message:{id:v("success.record.save")}}),f(Ke(N(K))),f(he("resolved")),Promise.resolve(K)}catch(K){return x.current("didNotEditEntry",{error:K,trackerProperty:z}),G(K),f(he("resolved")),Promise.reject(K)}}),[N,G,n,a,f,i]),Y=(0,r.useCallback)(()=>st(void 0,null,function*(){const T=ve(`collection-types/${n}/${a}/actions/unpublish`);f(he("unpublish-pending"));try{x.current("willUnpublishEntry");const{data:z}=yield ge.be.post(T);return x.current("didUnpublishEntry"),i({type:"success",message:{id:v("success.record.unpublish")}}),f(Ke(N(z))),f(he("resolved")),Promise.resolve(z)}catch(z){return f(he("resolved")),G(z),Promise.reject(z)}}),[N,G,a,n,f,i]);return t({componentsDataStructure:g,contentTypeDataStructure:h,data:b,isCreatingEntry:W,isLoadingForData:E,onDelete:V,onDeleteSucceeded:_,onPost:k,onPublish:Z,onPut:B,onUnpublish:Y,status:O,redirectionLink:I})};Or.defaultProps={id:null,origin:null},Or.propTypes={allLayoutData:o().exact({components:o().object.isRequired,contentType:o().shape({apiID:o().string.isRequired,attributes:o().object.isRequired,info:o().object.isRequired,isDisplayed:o().bool.isRequired,kind:o().string.isRequired,layouts:o().object.isRequired,metadatas:o().object.isRequired,options:o().object.isRequired,pluginOptions:o().object,settings:o().object.isRequired,uid:o().string.isRequired}).isRequired}).isRequired,children:o().func.isRequired,id:o().string,origin:o().string,slug:o().string.isRequired};const zy=(0,r.memo)(Or,He());var Uy=p(89793),an=p.n(Uy),Hy=p(56236),_y=p.n(Hy);const Pr=(e,t,n,a)=>{const s=e.slice();return s.splice(t,1),s.splice(n,0,a),s},Zy=(e,t,n)=>{const a=(l,u)=>R()(l,["attributes",u,"type"],""),s=(l,u)=>R()(l,["attributes",...u],""),i=(l,u)=>Object.keys(l).reduce((c,d)=>{const m=a(u,d),f=R()(l,d),g=s(u,[d,"component"]),h=s(u,[d,"repeatable"]);let b;switch(m){case"json":b=JSON.parse(f);break;case"time":{b=f,f&&f.split(":").length<3&&(b=`${f}:00`);break}case"media":s(u,[d,"multiple"])===!0?b=f?f.filter(E=>!(E instanceof File)):null:b=R()(f,0)instanceof File?null:R()(f,"id",null);break;case"component":h?b=f&&f.map(E=>i(E,n[g])):b=f&&i(f,n[g]);break;case"dynamiczone":b=f.map(E=>i(E,n[E.__component]));break;default:b=Gy(f,"id")}return c[d]=b,c},{});return i(e,t)},Gy=(e,t)=>$a()(e)?e.map(n=>n[t]?n[t]:n):Uo()(e)?e[t]:e,Qy=Zy;var Ky=p(51355),Yy=p.n(Ky),Jy=p(95919),Xy=p.n(Jy),eh=p(78746),gt=p.n(eh),be=p(5173);function Lt(e){return["integer","biginteger","decimal","float","number"].includes(e)}var th=Object.defineProperty,nh=Object.defineProperties,rh=Object.getOwnPropertyDescriptors,Vs=Object.getOwnPropertySymbols,oh=Object.prototype.hasOwnProperty,ah=Object.prototype.propertyIsEnumerable,qs=(e,t,n)=>t in e?th(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ws=(e,t)=>{for(var n in t||(t={}))oh.call(t,n)&&qs(e,n,t[n]);if(Vs)for(var n of Vs(t))ah.call(t,n)&&qs(e,n,t[n]);return e},zs=(e,t)=>nh(e,rh(t));be.kM(be.nK,"defined",function(){return this.test("defined",y.translatedErrors.required,e=>e!==void 0)}),be.kM(be.IX,"notEmptyMin",function(e){return this.test("notEmptyMin",y.translatedErrors.min,t=>Re()(t)?!0:t.length>=e)}),be.kM(be.Z_,"isInferior",function(e,t){return this.test("isInferior",e,function(n){return!n||Number.isNaN(gt()(n))?!0:gt()(t)>=gt()(n)})}),be.kM(be.Z_,"isSuperior",function(e,t){return this.test("isSuperior",e,function(n){return!n||Number.isNaN(gt()(n))?!0:gt()(n)>=gt()(t)})});const sh=e=>R()(e,["attributes"],{}),Rr=(e,{components:t},n={isCreatingEntry:!0,isDraft:!0,isFromComponent:!1})=>{const a=sh(e);return be.Ry().shape(Object.keys(a).reduce((s,i)=>{const l=a[i];if(l.type!=="relation"&&l.type!=="component"&&l.type!=="dynamiczone"){const u=ih(l.type,l,n);s[i]=u}if(l.type==="relation"&&(s[i]=["oneWay","oneToOne","manyToOne","oneToManyMorph","oneToOneMorph"].includes(l.relationType)?be.Ry().nullable():be.IX().nullable()),l.type==="component"){const u=Rr(t[l.component],{components:t},zs(Ws({},n),{isFromComponent:!0}));if(l.repeatable===!0){const{min:d,max:m,required:f}=l;let g=be.Vo(h=>{let b=be.IX().of(u);return d?f?b=b.min(d,y.translatedErrors.min):f!==!0&&Re()(h)?b=b.nullable():b=b.min(d,y.translatedErrors.min):f&&!n.isDraft&&(b=b.min(1,y.translatedErrors.required)),m&&(b=b.max(m,y.translatedErrors.max)),b});return s[i]=g,s}const c=be.Vo(d=>d!==void 0?l.required===!0&&!n.isDraft?u.defined():u.nullable():l.required===!0?be.Ry().defined():be.Ry().nullable());return s[i]=c,s}if(l.type==="dynamiczone"){let u=be.IX().of(be.Vo(({__component:m})=>Rr(t[m],{components:t},zs(Ws({},n),{isFromComponent:!0}))));const{max:c,min:d}=l;d?l.required?u=u.test("min",y.translatedErrors.min,m=>n.isCreatingEntry?m&&m.length>=d:m===void 0?!0:m!==null&&m.length>=d).test("required",y.translatedErrors.required,m=>n.isCreatingEntry?m!==null||m!==void 0:m===void 0?!0:m!==null):u=u.notEmptyMin(d):l.required&&!n.isDraft&&(u=u.test("required",y.translatedErrors.required,m=>n.isCreatingEntry?m!==null||m!==void 0:m===void 0?!0:m!==null)),c&&(u=u.max(c,y.translatedErrors.max)),s[i]=u}return s},{}))},ih=(e,t,n)=>{let a=be.nK();return["string","uid","text","richtext","email","password","enumeration"].includes(e)&&(a=be.Z_()),e==="json"&&(a=be.nK(y.translatedErrors.json).test("isJSON",y.translatedErrors.json,s=>{if(s===void 0)return!0;try{return JSON.parse(s),!0}catch(i){return!1}}).nullable()),e==="email"&&(a=a.email(y.translatedErrors.email)),["number","integer","float","decimal"].includes(e)&&(a=be.Rx().transform(s=>Xy()(s)?void 0:s).typeError()),e==="biginteger"&&(a=be.Z_().matches(/^-?\d*$/)),["date","datetime"].includes(e)&&(a=be.hT()),Object.keys(t).forEach(s=>{const i=t[s];if(!!i||!Yy()(i)&&Number.isInteger(Math.floor(i))||i===0)switch(s){case"required":{n.isDraft||(e==="password"&&n.isCreatingEntry&&(a=a.required(y.translatedErrors.required)),e!=="password"&&(n.isCreatingEntry?a=a.required(y.translatedErrors.required):a=a.test("required",y.translatedErrors.required,l=>l===void 0&&!n.isFromComponent?!0:Lt(e)?l===0?!0:!!l:e==="boolean"?l!==null:e==="date"||e==="datetime"?typeof l=="string"?!Re()(l):!Re()(l==null?void 0:l.toString()):!Re()(l))));break}case"max":{e==="biginteger"?a=a.isInferior(y.translatedErrors.max,i):a=a.max(i,y.translatedErrors.max);break}case"maxLength":a=a.max(i,y.translatedErrors.maxLength);break;case"min":{e==="biginteger"?a=a.isSuperior(y.translatedErrors.min,i):a=a.min(i,y.translatedErrors.min);break}case"minLength":{n.isDraft||(a=a.min(i,y.translatedErrors.minLength));break}case"regex":a=a.matches(new RegExp(i),{message:y.translatedErrors.regex,excludeEmptyString:!t.required});break;case"lowercase":["text","textarea","email","string"].includes(e)&&(a=a.strict().lowercase());break;case"uppercase":["text","textarea","email","string"].includes(e)&&(a=a.strict().uppercase());break;case"positive":Lt(e)&&(a=a.positive());break;case"negative":Lt(e)&&(a=a.negative());break;default:a=a.nullable()}}),a},Us=Rr;var lh=Object.defineProperty,ch=Object.defineProperties,uh=Object.getOwnPropertyDescriptors,Hs=Object.getOwnPropertySymbols,dh=Object.prototype.hasOwnProperty,ph=Object.prototype.propertyIsEnumerable,_s=(e,t,n)=>t in e?lh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zs=(e,t)=>{for(var n in t||(t={}))dh.call(t,n)&&_s(e,n,t[n]);if(Hs)for(var n of Hs(t))ph.call(t,n)&&_s(e,n,t[n]);return e},Gs=(e,t)=>ch(e,uh(t));const mh={componentsDataStructure:{},contentTypeDataStructure:{},formErrors:{},initialData:{},modifiedData:null,shouldCheckErrors:!1,modifiedDZName:null},fh=(e,t)=>(0,_t.default)(e,n=>{switch(t.type){case"ADD_NON_REPEATABLE_COMPONENT_TO_FIELD":{ne()(n,["modifiedData",...t.keys],e.componentsDataStructure[t.componentUid]);break}case"ADD_REPEATABLE_COMPONENT_TO_FIELD":{let a=R()(e,["modifiedData",...t.keys],[]).slice();const s=Gs(Zs({},e.componentsDataStructure[t.componentUid]),{__temp_key__:wo(a)+1});Array.isArray(a)?a.push(s):a=[s],ne()(n,["modifiedData",...t.keys],a),t.shouldCheckErrors&&(n.shouldCheckErrors=!e.shouldCheckErrors);break}case"ADD_COMPONENT_TO_DYNAMIC_ZONE":{n.modifiedDZName=t.keys[0],t.shouldCheckErrors&&(n.shouldCheckErrors=!e.shouldCheckErrors);const a=Gs(Zs({},e.componentsDataStructure[t.componentUid]),{__component:t.componentUid}),s=R()(e,["modifiedData",...t.keys],null),i=s?[...s,a]:[a];ne()(n,["modifiedData",...t.keys],i);break}case"ADD_RELATION":{if(!Array.isArray(t.value)||!t.value.length)break;const a=t.value[0].value,s=R()(e,["modifiedData",...t.keys],null);if(!s){ne()(n,["modifiedData",...t.keys],[a]);break}ne()(n,["modifiedData",...t.keys],[...s,a]);break}case"INIT_FORM":{n.formErrors={},n.initialData=t.initialValues,n.modifiedData=t.initialValues,n.modifiedDZName=null,n.shouldCheckErrors=!1;break}case"MOVE_COMPONENT_FIELD":{const a=R()(e,["modifiedData",...t.pathToComponent]),s=R()(e,["modifiedData",...t.pathToComponent,t.dragIndex]),i=Pr(a,t.dragIndex,t.hoverIndex,s);ne()(n,["modifiedData",...t.pathToComponent],i);break}case"MOVE_COMPONENT_UP":case"MOVE_COMPONENT_DOWN":{const{currentIndex:a,dynamicZoneName:s,shouldCheckErrors:i}=t;i&&(n.shouldCheckErrors=!e.shouldCheckErrors);const l=e.modifiedData[s],u=t.type==="MOVE_COMPONENT_UP"?a-1:a+1,c=e.modifiedData[s][a],d=Pr(l,a,u,c);ne()(n,["modifiedData",t.dynamicZoneName],d);break}case"MOVE_FIELD":{const a=R()(e,["modifiedData",...t.keys],[]).slice(),s=R()(e,["modifiedData",...t.keys,t.dragIndex]),i=Pr(a,t.dragIndex,t.overIndex,s);ne()(n,["modifiedData",...t.keys],i);break}case"ON_CHANGE":{const[a]=t.keys;if(t.shouldSetInitialValue&&ne()(n,["initialData",...t.keys],t.value),t.keys.length===2&&R()(e,["modifiedData",a])===null){ne()(n,["modifiedData",a],{[t.keys[1]]:t.value});break}ne()(n,["modifiedData",...t.keys],t.value);break}case"REMOVE_COMPONENT_FROM_DYNAMIC_ZONE":{t.shouldCheckErrors&&(n.shouldCheckErrors=!e.shouldCheckErrors),n.modifiedData[t.dynamicZoneName].splice(t.index,1);break}case"REMOVE_COMPONENT_FROM_FIELD":{const a=["modifiedData",...t.keys];ne()(n,a,null);break}case"REMOVE_PASSWORD_FIELD":{_y()(n,["modifiedData",...t.keys]);break}case"REMOVE_REPEATABLE_FIELD":{const a=t.keys.length-1,s=["modifiedData",...Xt()(t.keys,a)];Object.keys(e.formErrors).length>0&&(n.shouldCheckErrors=!e.shouldCheckErrors);const l=R()(e,s).slice();l.splice(parseInt(t.keys[a],10),1),ne()(n,s,l);break}case"REMOVE_RELATION":{const a=t.keys.split("."),s=a.length-1,i=["modifiedData",...Xt()(a,s)],l=R()(e,i).slice(),u=parseInt(a[s],10);l.splice(u,1),ne()(n,i,l);break}case"SET_DEFAULT_DATA_STRUCTURES":{n.componentsDataStructure=t.componentsDataStructure,n.contentTypeDataStructure=t.contentTypeDataStructure;break}case"SET_FORM_ERRORS":{n.modifiedDZName=null,n.formErrors=t.errors;break}case"TRIGGER_FORM_VALIDATION":{Object.keys(e.formErrors).length>0&&(n.shouldCheckErrors=!e.shouldCheckErrors);break}default:return n}});function Qs(e){return e.response.data.error.details.errors.reduce((a,s)=>(a[s.path.join(".")]={id:v(`apiError.${s.message}`),defaultMessage:s.message,values:{field:s.path[s.path.length-1]}},a),{})}var gh=Object.defineProperty,Ks=Object.getOwnPropertySymbols,yh=Object.prototype.hasOwnProperty,hh=Object.prototype.propertyIsEnumerable,Ys=(e,t,n)=>t in e?gh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,sn=(e,t)=>{for(var n in t||(t={}))yh.call(t,n)&&Ys(e,n,t[n]);if(Ks)for(var n of Ks(t))hh.call(t,n)&&Ys(e,n,t[n]);return e},Mr=(e,t,n)=>new Promise((a,s)=>{var i=c=>{try{u(n.next(c))}catch(d){s(d)}},l=c=>{try{u(n.throw(c))}catch(d){s(d)}},u=c=>c.done?a(c.value):Promise.resolve(c.value).then(i,l);u((n=n.apply(e,t)).next())});const Tr=({allLayoutData:e,allowedActions:{canRead:t,canUpdate:n},children:a,componentsDataStructure:s,contentTypeDataStructure:i,createActionAllowedFields:l,from:u,initialValues:c,isCreatingEntry:d,isLoadingForData:m,isSingleType:f,onPost:g,onPublish:h,onPut:b,onUnpublish:E,readActionAllowedFields:O,redirectToPreviousPage:I,slug:C,status:x,updateActionAllowedFields:D})=>{const[W,F]=(0,r.useReducer)(fh,mh),{formErrors:$,initialData:N,modifiedData:G,modifiedDZName:V,shouldCheckErrors:_}=W,k=(0,y.useNotification)(),{lockApp:Z,unlockApp:B}=(0,y.useOverlayBlocker)(),Y=R()(e,["contentType"],{}),T=(0,r.useMemo)(()=>R()(Y,["options","draftAndPublish"],!1),[Y]),z=(0,r.useMemo)(()=>T&&!N.publishedAt,[T,N.publishedAt]),{trackUsage:Q}=(0,y.useTracking)(),{formatMessage:K}=(0,A.useIntl)(),P=(0,r.useRef)(Q),M=(0,r.useMemo)(()=>m||d?!1:t===!1&&n===!1,[m,d,t,n]);(0,r.useEffect)(()=>{x==="resolved"?B():Z()},[Z,B,x]),(0,r.useEffect)(()=>{m||it()},[_]),(0,r.useEffect)(()=>{const ee=Object.keys($);if(ee.length>0){const J=ee[0],ie=document.getElementById(J);ie&&ie.focus()}},[$]),(0,r.useEffect)(()=>{M&&k({type:"info",message:{id:v("permissions.not-allowed.update")}})},[M,k]),(0,r.useEffect)(()=>{F({type:"SET_DEFAULT_DATA_STRUCTURES",componentsDataStructure:s,contentTypeDataStructure:i})},[s,i]),(0,r.useEffect)(()=>{c&&F({type:"INIT_FORM",initialValues:c})},[c]);const H=(0,r.useCallback)((ee,J,ie=!1)=>{P.current("didAddComponentToDynamicZone"),F({type:"ADD_COMPONENT_TO_DYNAMIC_ZONE",keys:ee.split("."),componentUid:J,shouldCheckErrors:ie})},[]),re=(0,r.useCallback)((ee,J)=>{F({type:"ADD_NON_REPEATABLE_COMPONENT_TO_FIELD",keys:ee.split("."),componentUid:J})},[]),ce=(0,r.useCallback)(({target:{name:ee,value:J}})=>{F({type:"ADD_RELATION",keys:ee.split("."),value:J})},[]),me=(0,r.useCallback)((ee,J,ie=!1)=>{F({type:"ADD_REPEATABLE_COMPONENT_TO_FIELD",keys:ee.split("."),componentUid:J,shouldCheckErrors:ie})},[]),Fe=(0,r.useMemo)(()=>{const ee={isCreatingEntry:d,isDraft:z,isFromComponent:!1};return Us(Y,{components:e.components||{}},ee)},[e.components,Y,d,z]),it=(0,r.useCallback)((...ee)=>Mr(void 0,[...ee],function*(J={}){let ie={};const Ve=Ue()(G);Re()(Ve)||ne()(Ve,J.path,J.value);try{yield Fe.validate(Ve,{abortEarly:!1})}catch(Ot){ie=(0,y.getYupInnerErrors)(Ot),V&&(ie=Object.keys(ie).reduce((Pc,io)=>(io.split(".")[0]!==V&&(Pc[io]=ie[io]),Pc),{}))}F({type:"SET_FORM_ERRORS",errors:ie})}),[V,G,Fe]),U=(0,r.useCallback)(({target:{name:ee,value:J,type:ie}},Ve=!1)=>{let Ot=J;if(ie==="date"&&J===""&&(Ot=null),ie==="password"&&!J){F({type:"REMOVE_PASSWORD_FIELD",keys:ee.split(".")});return}ie==="select-one"&&J===""&&(Ot=null),ie==="number"&&J===""&&(Ot=null),F({type:"ON_CHANGE",keys:ee.split("."),value:Ot,shouldSetInitialValue:Ve})},[]),de=(0,r.useCallback)(ee=>{const J=fu(Ue()(ee),"__temp_key__");return Qy(J,Y,e.components)},[e.components,Y]),Be=(0,r.useMemo)(()=>T?z?{status:"draft"}:{}:{},[T,z]),Je=(0,r.useCallback)(ee=>Mr(void 0,null,function*(){ee.preventDefault();let J={};try{yield Fe.validate(G,{abortEarly:!1})}catch(ie){J=(0,y.getYupInnerErrors)(ie)}try{if(Re()(J)){const ie=de(G);d?yield g(ie,Be):yield b(ie,Be)}}catch(ie){J=sn(sn({},J),Qs(ie))}F({type:"SET_FORM_ERRORS",errors:J})}),[de,d,G,g,b,Be,Fe]),Ct=(0,r.useCallback)(()=>Mr(void 0,null,function*(){const ee=Us(Y,{components:R()(e,"components",{})},{isCreatingEntry:d,isDraft:!1,isFromComponent:!1});let J={};try{yield ee.validate(G,{abortEarly:!1})}catch(ie){J=(0,y.getYupInnerErrors)(ie)}try{Re()(J)&&(yield h())}catch(ie){J=sn(sn({},J),Qs(ie))}F({type:"SET_FORM_ERRORS",errors:J})}),[e,Y,d,G,h]),Ge=(0,r.useCallback)(ee=>{const J=Object.keys($).some(Ve=>Ve.split(".")[0]===ee);return!Re()($)&&J},[$]),no=(0,r.useCallback)((ee,J)=>{P.current("changeComponentsOrder"),F({type:"MOVE_COMPONENT_DOWN",dynamicZoneName:ee,currentIndex:J,shouldCheckErrors:Ge(ee)})},[Ge]),ro=(0,r.useCallback)((ee,J)=>{P.current("changeComponentsOrder"),F({type:"MOVE_COMPONENT_UP",dynamicZoneName:ee,currentIndex:J,shouldCheckErrors:Ge(ee)})},[Ge]),oo=(0,r.useCallback)((ee,J,ie)=>{F({type:"MOVE_COMPONENT_FIELD",pathToComponent:ee,dragIndex:J,hoverIndex:ie})},[]),ao=(0,r.useCallback)((ee,J,ie)=>{F({type:"MOVE_FIELD",dragIndex:ee,overIndex:J,keys:ie.split(".")})},[]),Ce=(0,r.useCallback)(ee=>{F({type:"REMOVE_RELATION",keys:ee})},[]),Ne=(0,r.useCallback)((ee,J)=>{P.current("removeComponentFromDynamicZone"),F({type:"REMOVE_COMPONENT_FROM_DYNAMIC_ZONE",dynamicZoneName:ee,index:J,shouldCheckErrors:Ge(ee)})},[Ge]),Xe=(0,r.useCallback)((ee,J)=>{F({type:"REMOVE_COMPONENT_FROM_FIELD",keys:ee.split("."),componentUid:J})},[]),so=(0,r.useCallback)((ee,J)=>{F({type:"REMOVE_REPEATABLE_FIELD",keys:ee.split("."),componentUid:J})},[]),et=(0,r.useCallback)(()=>{F({type:"TRIGGER_FORM_VALIDATION"})},[]);return M?r.createElement(te.Redirect,{to:u}):G?r.createElement(y.ContentManagerEditViewDataManagerContext.Provider,{value:{addComponentToDynamicZone:H,addNonRepeatableComponentToField:re,addRelation:ce,addRepeatableComponentToField:me,allLayoutData:e,checkFormErrors:it,createActionAllowedFields:l,formErrors:$,hasDraftAndPublish:T,initialData:N,isCreatingEntry:d,isSingleType:f,shouldNotRunValidations:z,status:x,layout:Y,modifiedData:G,moveComponentDown:no,moveComponentField:oo,moveComponentUp:ro,moveRelation:ao,onChange:U,onPublish:Ct,onUnpublish:E,onRemoveRelation:Ce,readActionAllowedFields:O,redirectToPreviousPage:I,removeComponentFromDynamicZone:Ne,removeComponentFromField:Xe,removeRepeatableField:so,slug:C,triggerFormValidation:et,updateActionAllowedFields:D}},r.createElement(r.Fragment,null,m||!d&&!N.id?r.createElement(oe.Main,{"aria-busy":"true"},r.createElement(y.LoadingIndicatorPage,null)):r.createElement(r.Fragment,null,r.createElement(te.Prompt,{when:!an()(G,N),message:K({id:"global.prompt.unsaved"})}),r.createElement("form",{noValidate:!0,onSubmit:Je},a)))):null};Tr.defaultProps={from:"/",initialValues:null,redirectToPreviousPage:()=>{}},Tr.propTypes={allLayoutData:o().object.isRequired,allowedActions:o().object.isRequired,children:o().node.isRequired,componentsDataStructure:o().object.isRequired,contentTypeDataStructure:o().object.isRequired,createActionAllowedFields:o().array.isRequired,from:o().string,initialValues:o().object,isCreatingEntry:o().bool.isRequired,isLoadingForData:o().bool.isRequired,isSingleType:o().bool.isRequired,onPost:o().func.isRequired,onPublish:o().func.isRequired,onPut:o().func.isRequired,onUnpublish:o().func.isRequired,readActionAllowedFields:o().array.isRequired,redirectToPreviousPage:o().func,slug:o().string.isRequired,status:o().string.isRequired,updateActionAllowedFields:o().array.isRequired};const bh=Tr,yt=e=>ve(`single-types/${e}`),Eh=e=>Object.values(e||{}).reduce((t,n)=>Object.assign(t,n),{});var vh=Object.defineProperty,ln=Object.getOwnPropertySymbols,Js=Object.prototype.hasOwnProperty,Xs=Object.prototype.propertyIsEnumerable,ei=(e,t,n)=>t in e?vh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ti=(e,t)=>{for(var n in t||(t={}))Js.call(t,n)&&ei(e,n,t[n]);if(ln)for(var n of ln(t))Xs.call(t,n)&&ei(e,n,t[n]);return e},Ch=(e,t)=>{var n={};for(var a in e)Js.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&ln)for(var a of ln(e))t.indexOf(a)<0&&Xs.call(e,a)&&(n[a]=e[a]);return n};const ni=(e={})=>{const t=ti(ti({},e),Eh(e.plugins)),{plugins:n}=t,a=Ch(t,["plugins"]);return`?${(0,We.stringify)(a,{encode:!1})}`};var Oh=Object.defineProperty,ri=Object.getOwnPropertySymbols,Ph=Object.prototype.hasOwnProperty,Rh=Object.prototype.propertyIsEnumerable,oi=(e,t,n)=>t in e?Oh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mh=(e,t)=>{for(var n in t||(t={}))Ph.call(t,n)&&oi(e,n,t[n]);if(ri)for(var n of ri(t))Rh.call(t,n)&&oi(e,n,t[n]);return e},ht=(e,t,n)=>new Promise((a,s)=>{var i=c=>{try{u(n.next(c))}catch(d){s(d)}},l=c=>{try{u(n.throw(c))}catch(d){s(d)}},u=c=>c.done?a(c.value):Promise.resolve(c.value).then(i,l);u((n=n.apply(e,t)).next())});const ai=({allLayoutData:e,children:t,slug:n})=>{const{trackUsage:a}=(0,y.useTracking)(),{push:s}=(0,te.useHistory)(),{setCurrentStep:i}=(0,y.useGuidedTour)(),l=(0,r.useRef)(a),[u,c]=(0,r.useState)(!0),[{query:d,rawQuery:m}]=(0,y.useQueryParams)(),f=ni(d),g=(0,y.useNotification)(),h=(0,fe.I0)(),{componentsDataStructure:b,contentTypeDataStructure:E,data:O,isLoading:I,status:C}=(0,fe.v9)($s),x=(0,r.useCallback)(_=>{const k=Fo(_,e.contentType,e.components);return(0,y.formatContentTypeData)(k,e.contentType,e.components)},[e]);(0,r.useEffect)(()=>()=>{h(As())},[h]),(0,r.useEffect)(()=>{const _=Object.keys(e.components).reduce((B,Y)=>{const T=Wt(R()(e,["components",Y,"attributes"],{}),e.components);return B[Y]=(0,y.formatContentTypeData)(T,e.components[Y],e.components),B},{}),k=Wt(e.contentType.attributes,e.components),Z=(0,y.formatContentTypeData)(k,e.contentType,e.components);h(js(_,Z))},[e,h]),(0,r.useEffect)(()=>{const k=Se().CancelToken.source();return(B=>ht(void 0,null,function*(){h(on()),c(!0);try{const{data:Y}=yield(0,ge.be)(yt(`${n}${f}`),{cancelToken:B.token});h(vr(x(Y))),c(!1)}catch(Y){if(Se().isCancel(Y))return;const T=R()(Y,"response.status",null);T===404&&h(Cr(m,!0)),T===403&&(g({type:"info",message:{id:v("permissions.not-allowed.update")}}),s("/"))}}))(k),()=>k.cancel("Operation canceled by the user.")},[x,s,n,h,f,m,g]);const D=(0,r.useCallback)(_=>{const k=_.response.payload;let Z=R()(k,["message"],"Bad Request");Array.isArray(Z)&&(Z=R()(Z,["0","messages","0","id"])),typeof Z=="string"&&g({type:"warning",message:Z})},[g]),W=(0,r.useCallback)(_=>ht(void 0,null,function*(){try{l.current("willDeleteEntry",_);const{data:k}=yield ge.be.delete(yt(`${n}${f}`));return g({type:"success",message:{id:v("success.record.delete")}}),l.current("didDeleteEntry",_),Promise.resolve(k)}catch(k){return l.current("didNotDeleteEntry",Mh({error:k},_)),D(k),Promise.reject(k)}}),[n,D,g,f]),F=(0,r.useCallback)(()=>{c(!0),h(Cr(m,!0))},[h,m]),$=(0,r.useCallback)((_,k)=>ht(void 0,null,function*(){const Z=yt(`${n}${m}`);try{h(he("submit-pending"));const{data:B}=yield ge.be.put(Z,_);return l.current("didCreateEntry",k),g({type:"success",message:{id:v("success.record.save")}}),i("contentManager.success"),h(Ke(x(B))),c(!1),h(he("resolved")),Promise.resolve(B)}catch(B){return l.current("didNotCreateEntry",{error:B,trackerProperty:k}),D(B),h(he("resolved")),Promise.reject(B)}}),[x,D,n,h,m,g,i]),N=(0,r.useCallback)(()=>ht(void 0,null,function*(){try{l.current("willPublishEntry");const _=yt(`${n}/actions/publish${f}`);h(he("publish-pending"));const{data:k}=yield ge.be.post(_);return l.current("didPublishEntry"),g({type:"success",message:{id:v("success.record.publish")}}),h(Ke(x(k))),h(he("resolved")),Promise.resolve(k)}catch(_){return D(_),h(he("resolved")),Promise.reject(_)}}),[x,D,n,f,h,g]),G=(0,r.useCallback)((_,k)=>ht(void 0,null,function*(){const Z=yt(`${n}${m}`);try{l.current("willEditEntry",k),h(he("submit-pending"));const{data:B}=yield ge.be.put(Z,_);return g({type:"success",message:{id:v("success.record.save")}}),l.current("didEditEntry",{trackerProperty:k}),h(Ke(x(B))),h(he("resolved")),Promise.resolve(B)}catch(B){return D(B),l.current("didNotEditEntry",{error:B,trackerProperty:k}),h(he("resolved")),Promise.reject(B)}}),[x,D,n,h,m,g]),V=(0,r.useCallback)(()=>ht(void 0,null,function*(){const _=yt(`${n}/actions/unpublish${f}`);h(he("unpublish-pending"));try{l.current("willUnpublishEntry");const{data:k}=yield ge.be.post(_);l.current("didUnpublishEntry"),g({type:"success",message:{id:v("success.record.unpublish")}}),h(Ke(x(k))),h(he("resolved"))}catch(k){h(he("resolved")),D(k)}}),[x,g,D,n,h,f]);return t({componentsDataStructure:b,contentTypeDataStructure:E,data:O,isCreatingEntry:u,isLoadingForData:I,onDelete:W,onDeleteSucceeded:F,onPost:$,onPublish:N,onPut:G,onUnpublish:V,redirectionLink:"/",status:C})};ai.propTypes={allLayoutData:o().shape({components:o().object.isRequired,contentType:o().object.isRequired}).isRequired,children:o().func.isRequired,slug:o().string.isRequired};const Th=(0,r.memo)(ai);var wh=p(57235),Ih=p.n(wh),Dh=Object.defineProperty,si=Object.getOwnPropertySymbols,xh=Object.prototype.hasOwnProperty,Sh=Object.prototype.propertyIsEnumerable,ii=(e,t,n)=>t in e?Dh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,li=(e,t)=>{for(var n in t||(t={}))xh.call(t,n)&&ii(e,n,t[n]);if(si)for(var n of si(t))Sh.call(t,n)&&ii(e,n,t[n]);return e};function Lh(e,t){return function(n){const a=t();return r.createElement(e,li(li({},n),a))}}const Fh=Lh;function kh(){const{initialData:e,hasDraftAndPublish:t}=(0,y.useCMEditViewDataManager)(),n=e.publishedAt!==void 0&&e.publishedAt!==null;return{hasDraftAndPublish:t,isPublished:n}}const Ah=kh;var jh=Object.defineProperty,ci=Object.getOwnPropertySymbols,$h=Object.prototype.hasOwnProperty,Bh=Object.prototype.propertyIsEnumerable,ui=(e,t,n)=>t in e?jh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Nh=(e,t)=>{for(var n in t||(t={}))$h.call(t,n)&&ui(e,n,t[n]);if(ci)for(var n of ci(t))Bh.call(t,n)&&ui(e,n,t[n]);return e};const Vh=(0,S.default)(Ih())`
1009
- width: ${(0,y.pxToRem)(6)};
1010
- height: ${(0,y.pxToRem)(6)};
1011
- * {
1012
- fill: ${({theme:e,$bulletColor:t})=>e.colors[t]};
1013
- }
1014
- `,di=({hasDraftAndPublish:e,isPublished:t})=>{const{formatMessage:n}=(0,A.useIntl)();if(!e)return null;const a={draft:{textColor:"secondary700",bulletColor:"secondary600",box:{background:"secondary100",borderColor:"secondary200"}},published:{textColor:"success700",bulletColor:"success600",box:{background:"success100",borderColor:"success200"}}},s=t?a.published:a.draft;return r.createElement(w.Box,Nh({hasRadius:!0,as:"aside",paddingTop:4,paddingBottom:4,paddingLeft:5,paddingRight:5},s.box),r.createElement(w.Box,{as:j.Flex},r.createElement(Vh,{$bulletColor:s.bulletColor}),r.createElement(w.Box,{paddingLeft:3},r.createElement(L.Typography,{textColor:s.textColor},n({id:v("containers.Edit.information.editing"),defaultMessage:"Editing"}),"\xA0"),r.createElement(L.Typography,{fontWeight:"bold",textColor:s.textColor},t&&n({id:v("containers.Edit.information.publishedVersion"),defaultMessage:"published version"}),!t&&n({id:v("containers.Edit.information.draftVersion"),defaultMessage:"draft version"})))))};di.propTypes={hasDraftAndPublish:o().bool.isRequired,isPublished:o().bool.isRequired};const qh=Fh(di,Ah),wr=60*1e3,Ir=wr*60,cn=Ir*24,pi=cn*30,mi=cn*365,Wh=e=>e<wr?{unit:"second",value:-Math.round(e/1e3)}:e<Ir?{unit:"minute",value:-Math.round(e/wr)}:e<cn?{unit:"hour",value:-Math.round(e/Ir)}:e<pi?{unit:"day",value:-Math.round(e/cn)}:e<mi?{unit:"month",value:-Math.round(e/pi)}:{unit:"year",value:-Math.round(e/mi)};var fi=p(13271);const zh=()=>{const{formatMessage:e,formatRelativeTime:t}=(0,A.useIntl)(),{initialData:n,isCreatingEntry:a}=(0,y.useCMEditViewDataManager)(),s=(0,r.useRef)(Date.now()),i=(c,d)=>{var m,f,g;const h=((m=n[d])==null?void 0:m.firstname)||"",b=((f=n[d])==null?void 0:f.lastname)||"",O=((g=n[d])==null?void 0:g.username)||(0,fi.Pp)(h,b),C=(n[c]?new Date(n[c]).getTime():Date.now())-s.current,{unit:x,value:D}=Wh(-C);return{at:t(D,x,{numeric:"auto"}),by:a?"-":O}},l=i("updatedAt","updatedBy"),u=i("createdAt","createdBy");return r.createElement(w.Box,null,r.createElement(L.Typography,{variant:"sigma",textColor:"neutral600",id:"additional-informations"},e({id:v("containers.Edit.information"),defaultMessage:"Information"})),r.createElement(w.Box,{paddingTop:2,paddingBottom:6},r.createElement(Qt.Divider,null)),r.createElement(ae.Stack,{spacing:4},r.createElement(j.Flex,{justifyContent:"space-between"},r.createElement(L.Typography,{fontWeight:"bold"},e({id:v("containers.Edit.information.created"),defaultMessage:"Created"})),r.createElement(L.Typography,null,u.at)),r.createElement(j.Flex,{justifyContent:"space-between"},r.createElement(L.Typography,{fontWeight:"bold"},e({id:v("containers.Edit.information.by"),defaultMessage:"By"})),r.createElement(L.Typography,null,u.by)),r.createElement(j.Flex,{justifyContent:"space-between"},r.createElement(L.Typography,{fontWeight:"bold"},e({id:v("containers.Edit.information.lastUpdate"),defaultMessage:"Last update"})),r.createElement(L.Typography,null,l.at)),r.createElement(j.Flex,{justifyContent:"space-between"},r.createElement(L.Typography,{fontWeight:"bold"},e({id:v("containers.Edit.information.by"),defaultMessage:"By"})),r.createElement(L.Typography,null,l.by))))};var Uh=p(98599),un=p.n(Uh),ke=p(49137),Hh=p(88677),bt=p.n(Hh),_h=Object.defineProperty,gi=Object.getOwnPropertySymbols,Zh=Object.prototype.hasOwnProperty,Gh=Object.prototype.propertyIsEnumerable,yi=(e,t,n)=>t in e?_h(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hi=(e,t)=>{for(var n in t||(t={}))Zh.call(t,n)&&yi(e,n,t[n]);if(gi)for(var n of gi(t))Gh.call(t,n)&&yi(e,n,t[n]);return e};function Qh(e,t){return function(n){const a=t();return r.createElement(e,hi(hi({},n),a))}}const Kh=Qh,Yh=(e,t,n)=>{const a=(i,l)=>Object.keys(i).reduce((u,c)=>{const d=(0,q.get)(l,["attributes",c,"type"],"string"),m=(0,q.get)(l,["attributes",c,"relationType"],""),f=m.toLowerCase().includes("morph"),g=["oneWay","oneToOne","manyToOne"],h=i[c];if((0,q.isNil)(h))return u;if(d==="dynamiczone"&&h.forEach(b=>{const E=(0,q.get)(n,b.__component,{});u+=a(b,E)}),d==="component"){const b=(0,q.get)(l,["attributes",c,"repeatable"],!1),E=(0,q.get)(l,["attributes",c,"component"],""),O=(0,q.get)(n,E,{});b?h.forEach(I=>{u+=a(I,O)}):u+=a(h,O)}return d==="relation"&&!f&&(g.includes(m)?(0,q.has)(h,"publishedAt")&&(0,q.isEmpty)(h.publishedAt)&&(u+=1):h.forEach(b=>{(0,q.has)(b,"publishedAt")&&(0,q.isEmpty)(b.publishedAt)&&(u+=1)})),u},0);return a(e,t,n)};function Jh(){const{allLayoutData:e,initialData:t,isCreatingEntry:n,isSingleType:a,status:s,layout:i,hasDraftAndPublish:l,modifiedData:u,onPublish:c,onUnpublish:d}=(0,y.useCMEditViewDataManager)();return{componentLayouts:e.components,initialData:t,isCreatingEntry:n,isSingleType:a,status:s,layout:i,hasDraftAndPublish:l,modifiedData:u,onPublish:c,onUnpublish:d}}const Xh=Jh,bi=({allowedActions:{canUpdate:e,canCreate:t,canPublish:n},componentLayouts:a,initialData:s,isCreatingEntry:i,isSingleType:l,hasDraftAndPublish:u,layout:c,modifiedData:d,onPublish:m,onUnpublish:f,status:g})=>{const{goBack:h}=(0,te.useHistory)(),[b,E]=(0,r.useState)(!1),[O,I]=(0,r.useState)(!1),{formatMessage:C}=(0,A.useIntl)(),x=(0,r.useRef)(0),D=R()(c,["settings","mainField"],"id"),W=R()(c,["info","displayName"],"NOT FOUND"),F=!an()(s,d)||i&&!Re()(d);let N=C({id:v("containers.Edit.pluginHeader.title.new"),defaultMessage:"Create an entry"});!i&&!l&&(N=s[D]||W),l&&(N=W);const G=()=>{const T=Yh(d,c,a);return x.current=T,T};let V=null;if(i&&t&&(V=r.createElement(ae.Stack,{horizontal:!0,spacing:2},u&&r.createElement(ye.Button,{disabled:!0,startIcon:r.createElement(bt(),null),variant:"secondary"},C({id:"app.utils.publish",defaultMessage:"Publish"})),r.createElement(ye.Button,{disabled:!F,isLoading:g==="submit-pending",type:"submit"},C({id:v("containers.Edit.submit"),defaultMessage:"Save"})))),!i&&e){const T=u&&n,z=!Re()(s.publishedAt),Q=z?g==="unpublish-pending":g==="publish-pending",K=z?{id:"app.utils.unpublish",defaultMessage:"Unpublish"}:{id:"app.utils.publish",defaultMessage:"Publish"},P=z?()=>E(!0):()=>{G()===0?m():I(!0)};V=r.createElement(j.Flex,null,T&&r.createElement(ye.Button,{disabled:F,loading:Q,onClick:P,startIcon:r.createElement(bt(),null),variant:"secondary"},C(K)),r.createElement(w.Box,{paddingLeft:T?2:0},r.createElement(ye.Button,{disabled:!F,loading:g==="submit-pending",type:"submit"},C({id:v("containers.Edit.submit"),defaultMessage:"Save"}))))}const _=()=>E(T=>!T),k=()=>I(T=>!T),Z=()=>{k(),x.current=0,m()},B=()=>{_(),f()},Y=`${C({id:v("api.id"),defaultMessage:"API ID "})} : ${c.apiID}`;return r.createElement(r.Fragment,null,r.createElement(X.HeaderLayout,{title:N.toString(),primaryAction:V,subtitle:Y,navigationAction:r.createElement(ot.Link,{startIcon:r.createElement(un(),null),onClick:T=>{T.preventDefault(),h()},to:"/"},C({id:"global.back",defaultMessage:"Back"}))}),b&&r.createElement(ke.Dialog,{onClose:_,title:"Confirmation",labelledBy:"confirmation",describedBy:"confirm-description",isOpen:b},r.createElement(ke.DialogBody,{icon:r.createElement(St(),null)},r.createElement(ae.Stack,{spacing:2},r.createElement(j.Flex,{justifyContent:"center",style:{textAlign:"center"}},r.createElement(L.Typography,{id:"confirm-description"},C({id:v("popUpWarning.warning.unpublish"),defaultMessage:"Unpublish this content will automatically change it to a draft."},{br:()=>r.createElement("br",null)}))),r.createElement(j.Flex,{justifyContent:"center",style:{textAlign:"center"}},r.createElement(L.Typography,{id:"confirm-description"},C({id:v("popUpWarning.warning.unpublish-question"),defaultMessage:"Are you sure you want to unpublish it?"}))))),r.createElement(ke.DialogFooter,{startAction:r.createElement(ye.Button,{onClick:_,variant:"tertiary"},C({id:"components.popUpWarning.button.cancel",defaultMessage:"No, cancel"})),endAction:r.createElement(ye.Button,{variant:"danger-light",onClick:B},C({id:"components.popUpWarning.button.confirm",defaultMessage:"Yes, confirm"}))})),O&&r.createElement(ke.Dialog,{onClose:k,title:"Confirmation",labelledBy:"confirmation",describedBy:"confirm-description",isOpen:O},r.createElement(ke.DialogBody,{icon:r.createElement(St(),null)},r.createElement(ae.Stack,{spacing:2},r.createElement(j.Flex,{justifyContent:"center",style:{textAlign:"center"}},r.createElement(L.Typography,{id:"confirm-description"},x.current,C({id:v("popUpwarning.warning.has-draft-relations.message"),defaultMessage:"<b>{count, plural, =0 { of your content relations is} one { of your content relations is} other { of your content relations are}}</b> not published yet.<br></br>It might engender broken links and errors on your project."},{br:()=>r.createElement("br",null),b:T=>r.createElement(L.Typography,{fontWeight:"bold"},T),count:x.current}))),r.createElement(j.Flex,{justifyContent:"center",style:{textAlign:"center"}},r.createElement(L.Typography,{id:"confirm-description"},C({id:v("popUpWarning.warning.publish-question"),defaultMessage:"Do you still want to publish it?"}))))),r.createElement(ke.DialogFooter,{startAction:r.createElement(ye.Button,{onClick:k,variant:"tertiary"},C({id:"components.popUpWarning.button.cancel",defaultMessage:"No, cancel"})),endAction:r.createElement(ye.Button,{variant:"success",onClick:Z},C({id:v("popUpwarning.warning.has-draft-relations.button-confirm"),defaultMessage:"Yes, publish"}))})))};bi.propTypes={allowedActions:o().shape({canUpdate:o().bool.isRequired,canCreate:o().bool.isRequired,canPublish:o().bool.isRequired}).isRequired,componentLayouts:o().object.isRequired,initialData:o().object.isRequired,isCreatingEntry:o().bool.isRequired,isSingleType:o().bool.isRequired,status:o().string.isRequired,layout:o().object.isRequired,hasDraftAndPublish:o().bool.isRequired,modifiedData:o().object.isRequired,onPublish:o().func.isRequired,onUnpublish:o().func.isRequired};const eb=(0,r.memo)(bi,He()),tb=Kh(eb,Xh),nb=(e,t)=>{const n=i=>(0,q.get)(t,[i,"type"],"");let a=0;const s=[];for(let i of e){const l=i.some(({name:u})=>n(u)==="dynamiczone");s[a]||(s[a]=[]),l?(a=a===0&&(0,q.isEmpty)(s[0])?0:a+1,s[a]||(s[a]=[]),s[a].push(i),a+=1):s[a].push(i)}return s.filter(i=>i.length>0)},rb=(e,t)=>{const n=a=>{const s=(0,y.findMatchingPermissions)(e,[{action:`plugin::content-manager.explorer.${a}`,subject:t}]);return(0,q.uniq)((0,q.flatMap)(s,"properties.fields"))};return{createActionAllowedFields:n("create"),readActionAllowedFields:n("read"),updateActionAllowedFields:n("update")}};var ob=Object.defineProperty,Ei=Object.getOwnPropertySymbols,ab=Object.prototype.hasOwnProperty,sb=Object.prototype.propertyIsEnumerable,vi=(e,t,n)=>t in e?ob(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ci=(e,t)=>{for(var n in t||(t={}))ab.call(t,n)&&vi(e,n,t[n]);if(Ei)for(var n of Ei(t))sb.call(t,n)&&vi(e,n,t[n]);return e};function ib(e,t){return function(n){const a=t();return r.createElement(e,Ci(Ci({},n),a))}}const lb=ib;function cb(){const{hasDraftAndPublish:e,modifiedData:t}=(0,y.useCMEditViewDataManager)();let n={};return e&&(n=(0,q.isEmpty)(t.publishedAt)?{status:"draft"}:{status:"published"}),{hasDraftAndPublish:e,trackerProperty:n}}const ub=cb;var db=(e,t,n)=>new Promise((a,s)=>{var i=c=>{try{u(n.next(c))}catch(d){s(d)}},l=c=>{try{u(n.throw(c))}catch(d){s(d)}},u=c=>c.done?a(c.value):Promise.resolve(c.value).then(i,l);u((n=n.apply(e,t)).next())});const Oi=({isCreatingEntry:e,onDelete:t,onDeleteSucceeded:n,trackerProperty:a})=>{const[s,i]=(0,r.useState)(!1),[l,u]=(0,r.useState)(!1),{formatMessage:c}=(0,A.useIntl)(),d=(0,y.useNotification)(),m=()=>i(g=>!g),f=()=>db(void 0,null,function*(){try{u(!0),yield t(a),u(!1),m(),n()}catch(g){const h=R()(g,"response.payload.message",c({id:v("error.record.delete")}));u(!1),m(),d({type:"warning",message:h})}});return e?null:r.createElement(r.Fragment,null,r.createElement(ye.Button,{onClick:m,size:"S",startIcon:r.createElement(qe(),null),variant:"danger-light"},c({id:v("containers.Edit.delete-entry"),defaultMessage:"Delete this entry"})),r.createElement(y.ConfirmDialog,{isConfirmButtonLoading:l,isOpen:s,onConfirm:f,onToggleDialog:m}))};Oi.propTypes={isCreatingEntry:o().bool.isRequired,onDelete:o().func.isRequired,onDeleteSucceeded:o().func.isRequired,trackerProperty:o().object.isRequired};const pb=(0,r.memo)(Oi,He()),mb=lb(pb,ub);var fb=Object.defineProperty,gb=Object.defineProperties,yb=Object.getOwnPropertyDescriptors,Pi=Object.getOwnPropertySymbols,hb=Object.prototype.hasOwnProperty,bb=Object.prototype.propertyIsEnumerable,Ri=(e,t,n)=>t in e?fb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mi=(e,t)=>{for(var n in t||(t={}))hb.call(t,n)&&Ri(e,n,t[n]);if(Pi)for(var n of Pi(t))bb.call(t,n)&&Ri(e,n,t[n]);return e},Eb=(e,t)=>gb(e,yb(t));const Ti=De.Z.contentManager,vb=[{action:"plugin::content-type-builder.read",subject:null}],Dr=({allowedActions:e,isSingleType:t,goBack:n,layout:a,slug:s,id:i,origin:l,userPermissions:u})=>{const{trackUsage:c}=(0,y.useTracking)(),{formatMessage:d}=(0,A.useIntl)(),{createActionAllowedFields:m,readActionAllowedFields:f,updateActionAllowedFields:g}=(0,r.useMemo)(()=>rb(u,s),[u,s]),h=(0,r.useMemo)(()=>t?Ti.singleTypesConfigurations:Ti.collectionTypesConfigurations,[t]),b=`/content-manager/${t?"singleType":"collectionType"}/${s}/configurations/edit`,E=R()(a,["contentType"],{}),O=(0,r.useMemo)(()=>t?Th:zy,[t]),I=(0,r.useCallback)(W=>W.every(F=>F.every($=>$.fieldSchema.type==="dynamiczone")),[]),C=(0,r.useMemo)(()=>E.layouts?nb(E.layouts.edit,E.attributes):[],[E]),x=E.layouts.editRelations,D=x.length;return r.createElement(O,{allLayoutData:a,slug:s,id:i,origin:l},({componentsDataStructure:W,contentTypeDataStructure:F,data:$,isCreatingEntry:N,isLoadingForData:G,onDelete:V,onDeleteSucceeded:_,onPost:k,onPublish:Z,onPut:B,onUnpublish:Y,redirectionLink:T,status:z})=>r.createElement(bh,{allowedActions:e,allLayoutData:a,createActionAllowedFields:m,componentsDataStructure:W,contentTypeDataStructure:F,from:T,initialValues:$,isCreatingEntry:N,isLoadingForData:G,isSingleType:t,onPost:k,onPublish:Z,onPut:B,onUnpublish:Y,readActionAllowedFields:f,redirectToPreviousPage:n,slug:s,status:z,updateActionAllowedFields:g},r.createElement(oe.Main,{"aria-busy":z!=="resolved"},r.createElement(tb,{allowedActions:e}),r.createElement(X.ContentLayout,null,r.createElement(le.Grid,{gap:4},r.createElement(le.GridItem,{col:9,s:12},r.createElement(ae.Stack,{spacing:6},C.map((Q,K)=>{if(I(Q)){const{0:{0:{name:P,fieldSchema:M,metadatas:H,labelAction:re}}}=Q;return r.createElement(w.Box,{key:K},r.createElement(le.Grid,{gap:4},r.createElement(le.GridItem,{col:12,s:12,xs:12},r.createElement($y,{name:P,fieldSchema:M,labelAction:re,metadatas:H}))))}return r.createElement(w.Box,{key:K,hasRadius:!0,background:"neutral0",shadow:"tableShadow",paddingLeft:6,paddingRight:6,paddingTop:6,paddingBottom:6,borderColor:"neutral150"},r.createElement(ae.Stack,{spacing:6},Q.map((P,M)=>r.createElement(le.Grid,{gap:4,key:M},P.map(({fieldSchema:H,labelAction:re,metadatas:ce,name:me,size:Fe})=>{if(H.type==="component"){const{component:U,max:de,min:Be,repeatable:Je=!1,required:Ct=!1}=H;return r.createElement(le.GridItem,{col:Fe,s:12,xs:12,key:U},r.createElement(rn,{componentUid:U,labelAction:re,isRepeatable:Je,intlLabel:{id:ce.label,defaultMessage:ce.label},max:de,min:Be,name:me,required:Ct}))}return r.createElement(le.GridItem,{col:Fe,key:me,s:12,xs:12},r.createElement(cr,{fieldSchema:H,keys:me,labelAction:re,metadatas:ce}))})))))}))),r.createElement(le.GridItem,{col:3,s:12},r.createElement(ae.Stack,{spacing:2},r.createElement(qh,null),r.createElement(w.Box,{as:"aside","aria-labelledby":"additional-informations",background:"neutral0",borderColor:"neutral150",hasRadius:!0,paddingBottom:4,paddingLeft:4,paddingRight:4,paddingTop:6,shadow:"tableShadow"},r.createElement(zh,null),r.createElement(Jt,{area:"contentManager.editView.informations"})),D>0&&r.createElement(w.Box,{as:"aside","aria-labelledby":"relations-title",background:"neutral0",borderColor:"neutral150",hasRadius:!0,paddingBottom:4,paddingLeft:4,paddingRight:4,paddingTop:6,shadow:"tableShadow"},r.createElement(L.Typography,{variant:"sigma",textColor:"neutral600",id:"relations-title"},d({id:v("containers.Edit.relations"),defaultMessage:"{number, plural, =0 {relations} one {relation} other {relations}}"},{number:D})),r.createElement(w.Box,{paddingTop:2,paddingBottom:6},r.createElement(Qt.Divider,null)),r.createElement(ae.Stack,{spacing:4},x.map(({name:Q,fieldSchema:K,labelAction:P,metadatas:M,queryInfos:H})=>r.createElement(as,Eb(Mi(Mi({},K),M),{key:Q,description:M.description,intlLabel:{id:M.label,defaultMessage:M.label},labelAction:P,name:Q,relationsType:K.relationType,queryInfos:H,placeholder:M.placeholder?{id:M.placeholder,defaultMessage:M.placeholder}:null}))))),r.createElement(w.Box,{as:"aside","aria-labelledby":"links"},r.createElement(ae.Stack,{spacing:2},r.createElement(Jt,{area:"contentManager.editView.right-links",slug:s}),s!=="strapi::administrator"&&r.createElement(y.CheckPermissions,{permissions:vb},r.createElement(Kt.LinkButton,{onClick:()=>{c("willEditEditLayout")},size:"S",startIcon:r.createElement(ut(),null),style:{width:"100%"},to:`/plugins/content-type-builder/content-types/${s}`,variant:"secondary"},d({id:v("link-to-ctb"),defaultMessage:"Edit the model"}))),r.createElement(y.CheckPermissions,{permissions:h},r.createElement(Kt.LinkButton,{size:"S",startIcon:r.createElement(td(),null),style:{width:"100%"},to:b,variant:"secondary"},d({id:"app.links.configure-view",defaultMessage:"Configure the view"}))),e.canDelete&&r.createElement(mb,{isCreatingEntry:N,onDelete:V,onDeleteSucceeded:_}))))))))))};Dr.defaultProps={id:null,isSingleType:!1,origin:null,userPermissions:[]},Dr.propTypes={allowedActions:o().shape({canRead:o().bool.isRequired,canUpdate:o().bool.isRequired,canCreate:o().bool.isRequired,canDelete:o().bool.isRequired}).isRequired,layout:o().shape({components:o().object.isRequired,contentType:o().shape({uid:o().string.isRequired,settings:o().object.isRequired,metadatas:o().object.isRequired,options:o().object.isRequired,attributes:o().object.isRequired}).isRequired}).isRequired,id:o().string,isSingleType:o().bool,goBack:o().func.isRequired,origin:o().string,slug:o().string.isRequired,userPermissions:o().array};const Cb=(0,r.memo)(Dr);var Ob=Object.defineProperty,Pb=Object.defineProperties,Rb=Object.getOwnPropertyDescriptors,wi=Object.getOwnPropertySymbols,Mb=Object.prototype.hasOwnProperty,Tb=Object.prototype.propertyIsEnumerable,Ii=(e,t,n)=>t in e?Ob(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wb=(e,t)=>{for(var n in t||(t={}))Mb.call(t,n)&&Ii(e,n,t[n]);if(wi)for(var n of wi(t))Tb.call(t,n)&&Ii(e,n,t[n]);return e},Ib=(e,t)=>Pb(e,Rb(t));const xr=e=>{const t=(0,r.useMemo)(()=>Mo(e.slug),[e.slug]),{isLoading:n,allowedActions:a}=(0,y.useRBAC)(t,e.userPermissions);return n?r.createElement(y.LoadingIndicatorPage,null):r.createElement(Cb,Ib(wb({},e),{allowedActions:a}))};xr.defaultProps={permissions:[]},xr.propTypes={permissions:o().array,slug:o().string.isRequired,userPermissions:o().array.isRequired};const Db=(0,r.memo)(xr,He());var xb=Object.defineProperty,Sb=Object.defineProperties,Lb=Object.getOwnPropertyDescriptors,dn=Object.getOwnPropertySymbols,Di=Object.prototype.hasOwnProperty,xi=Object.prototype.propertyIsEnumerable,Si=(e,t,n)=>t in e?xb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fb=(e,t)=>{for(var n in t||(t={}))Di.call(t,n)&&Si(e,n,t[n]);if(dn)for(var n of dn(t))xi.call(t,n)&&Si(e,n,t[n]);return e},kb=(e,t)=>Sb(e,Lb(t)),Ab=(e,t)=>{var n={};for(var a in e)Di.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&dn)for(var a of dn(e))t.indexOf(a)<0&&xi.call(e,a)&&(n[a]=e[a]);return n};const Li=e=>{var t=e,{layout:n}=t,a=Ab(t,["layout"]);const s=(0,fe.v9)(go),i=(0,fe.I0)(),[{query:l}]=(0,y.useQueryParams)(),{runHookWaterfall:u}=(0,y.useStrapiApp)(),c=Yo(l,a.slug,"editView");return(0,r.useEffect)(()=>{const d=u(Gt.Eo,{layout:n,query:l});return i(Ju(d.layout,l)),()=>{i(Yu())}},[n,i,l,u]),!s||!c?r.createElement(y.LoadingIndicatorPage,null):r.createElement(Db,kb(Fb({},a),{layout:s,userPermissions:c}))};Li.propTypes={layout:o().shape({components:o().object.isRequired,contentType:o().shape({uid:o().string.isRequired,settings:o().object.isRequired,metadatas:o().object.isRequired,options:o().object.isRequired,attributes:o().object.isRequired}).isRequired}).isRequired};const pn=Li;var Sr=p(84968),jb=p(23940),Ft=p.n(jb),$b=p(88423),Fi=p.n($b),Bb=p(3704),Nb=p.n(Bb),Vb=Object.defineProperty,qb=Object.defineProperties,Wb=Object.getOwnPropertyDescriptors,ki=Object.getOwnPropertySymbols,zb=Object.prototype.hasOwnProperty,Ub=Object.prototype.propertyIsEnumerable,Ai=(e,t,n)=>t in e?Vb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hb=(e,t)=>{for(var n in t||(t={}))zb.call(t,n)&&Ai(e,n,t[n]);if(ki)for(var n of ki(t))Ub.call(t,n)&&Ai(e,n,t[n]);return e},_b=(e,t)=>qb(e,Wb(t));const Lr=e=>e.reduce((t,n)=>t+n.size,0),Zb=e=>e.reduce((t,n,a)=>{const s={rowId:a,rowContent:n};return t.concat(s)},[]),Et=e=>e.reduce((t,n)=>{let a=[];const s=n.rowContent.reduce((u,c)=>{const d=Lr(u);return c.name==="_TEMP_"||(d+c.size<=12?u.push(c):a.push(c)),u},[]),i=t.length===0?0:Math.max.apply(Math,t.map(u=>u.rowId))+1,l=Lr(s);if(l<12&&s.push({name:"_TEMP_",size:12-l}),t.push({rowId:i,rowContent:s}),a.length>0){const u=Lr(a);u<12&&a.push({name:"_TEMP_",size:12-u}),t.push({rowId:i+1,rowContent:a}),a=[]}return t},[]).filter(t=>t.rowContent.length>0).filter(t=>t.rowContent.length===1?t.rowContent[0].name!=="_TEMP_":!0),Gb=e=>e.reduce((t,n)=>{const a=n.rowContent.filter(s=>s.name!=="_TEMP_");return t.concat([a])},[]),ji=e=>{switch(e){case"boolean":case"date":case"integer":case"float":case"biginteger":case"decimal":case"time":return 4;case"json":case"component":case"richtext":case"dynamiczone":return 12;default:return 6}},Qb=(e,t=[])=>t.reduce((n,{rowContent:a})=>{var s,i;const l=(i=(s=a.find(u=>u.name===e))==null?void 0:s.size)!=null?i:null;return l&&(n=l),n},null),Kb=(e,t,n=[])=>n.map(a=>(a.rowContent=a.rowContent.map(s=>s.name===e?_b(Hb({},s),{size:t}):s),a)),Fr={fieldForm:{},componentLayouts:{},metaToEdit:"",initialData:{},metaForm:{},modifiedData:{}},Yb=(e=Fr,t)=>(0,_t.default)(e,n=>{var a,s,i;const l=["modifiedData","layouts","edit"],u=["modifiedData","layouts","editRelations"];switch(t.type){case"ADD_RELATION":{const c=R()(e,u,[]);ne()(n,u,[...c,t.name]);break}case"MOVE_RELATION":{const c=R()(e,u,[]),{fromIndex:d,toIndex:m}=t;ne()(n,u,Mt(c,d,m));break}case"MOVE_ROW":{const c=R()(e,l,[]),{fromIndex:d,toIndex:m}=t;ne()(n,l,Mt(c,d,m));break}case"ON_ADD_FIELD":{const c=Ue()(e),d=ji(R()(c,["modifiedData","attributes",t.name,"type"],"")),m=R()(c,l,[]).length,f=[...l,m-1,"rowContent"],g=R()(c,f,[]);let h=R()(c,l,[]);Array.isArray(g)?ne()(h,[m>0?m-1:0,"rowContent"],[...g,{name:t.name,size:d}]):ne()(h,[m>0?m-1:0,"rowContent"],[{name:t.name,size:d}]);const b=Et(h);ne()(n,l,b);break}case"ON_CHANGE":{ne()(n,["modifiedData",...t.keys],t.value);break}case"ON_CHANGE_META":{ne()(n,["metaForm","metadata",...t.keys],t.value);break}case"ON_CHANGE_SIZE":{ne()(n,["metaForm","size"],t.value);break}case"ON_RESET":{n.modifiedData=e.initialData;break}case"REMOVE_FIELD":{const c=R()(e,[...l,t.rowIndex,"rowContent"],[]);let d=Ue()(e);if(c.length===1||c.length===2&&R()(c,[1,"name"],"")==="_TEMP_"){const f=R()(e,l,[]);ne()(d,l,f.filter((g,h)=>t.rowIndex!==h))}else ne()(d,[...l,t.rowIndex,"rowContent"],c.filter((f,g)=>g!==t.fieldIndex));const m=Et(R()(d,l,[]));ne()(n,l,m);break}case"REMOVE_RELATION":{const c=R()(e,u,[]);ne()(n,u,c.filter((d,m)=>t.index!==m));break}case"REORDER_DIFF_ROW":{const c=R()(e,[...l,t.dragRowIndex,"rowContent"],[]),d=R()(e,[...l,t.hoverRowIndex,"rowContent"],[]),m=R()(e,[...l,t.dragRowIndex,"rowContent",t.dragIndex],{}),f=[...d,m];let g=Ue()(e);ne()(g,[...l,t.dragRowIndex,"rowContent"],c.filter((b,E)=>t.dragIndex!==E)),ne()(g,[...l,t.hoverRowIndex,"rowContent"],Mt(f,f.length-1,t.hoverIndex));const h=Et(R()(g,l,[]));ne()(n,l,h);break}case"REORDER_ROW":{const c=Ue()(e),d=R()(c,[...l,t.dragRowIndex,"rowContent"],[]);ne()(c,[...l,t.dragRowIndex,"rowContent"],Mt(d,t.dragIndex,t.hoverIndex));const m=Et(R()(c,l,[]));ne()(n,l,m);break}case"SET_FIELD_TO_EDIT":{n.metaToEdit=t.name,n.metaForm={metadata:R()(e,["modifiedData","metadatas",t.name,"edit"],{}),size:(i=Qb(t.name,(s=(a=e.modifiedData)==null?void 0:a.layouts)==null?void 0:s.edit))!=null?i:ji()};break}case"SUBMIT_META_FORM":{ne()(n,["modifiedData","metadatas",e.metaToEdit,"edit"],e.metaForm.metadata);const c=Ue()(R()(e,l,[])),d=Kb(e.metaToEdit,e.metaForm.size,c);d.length>0&&ne()(n,l,Et(d));break}case"SUBMIT_SUCCEEDED":{n.initialData=e.modifiedData;break}case"UNSET_FIELD_TO_EDIT":{n.metaToEdit="",n.metaForm={};break}default:return n}});var Jb=Object.defineProperty,Xb=Object.defineProperties,eE=Object.getOwnPropertyDescriptors,$i=Object.getOwnPropertySymbols,tE=Object.prototype.hasOwnProperty,nE=Object.prototype.propertyIsEnumerable,Bi=(e,t,n)=>t in e?Jb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rE=(e,t)=>{for(var n in t||(t={}))tE.call(t,n)&&Bi(e,n,t[n]);if($i)for(var n of $i(t))nE.call(t,n)&&Bi(e,n,t[n]);return e},oE=(e,t)=>Xb(e,eE(t));const aE=(e,t,n)=>{let a=(0,q.cloneDeep)(t);return(0,q.set)(a,["layouts","edit"],Et(Zb(t.layouts.edit))),oE(rE({},e),{initialData:a,modifiedData:a,componentLayouts:n})};var Ae=p(12611),sE=p(42258),Ni=p.n(sE);const Vi=({componentUid:e})=>{const{componentLayouts:t}=Qe(),{formatMessage:n}=(0,A.useIntl)(),a=R()(t,[e],{}),s=R()(a,["layouts","edit"],[]);return r.createElement(w.Box,{padding:3},s.map((i,l)=>r.createElement(le.Grid,{gap:4,key:l},i.map(u=>r.createElement(le.GridItem,{key:u.name,col:u.size},r.createElement(w.Box,{paddingTop:2},r.createElement(j.Flex,{alignItems:"center",background:"neutral0",paddingLeft:3,paddingRight:3,height:`${32/16}rem`,hasRadius:!0,borderColor:"neutral200"},r.createElement(L.Typography,{textColor:"neutral800"},u.name))))))),r.createElement(w.Box,{paddingTop:2},r.createElement(ot.Link,{startIcon:r.createElement(Ni(),null),to:`/content-manager/components/${e}/configurations/edit`},n({id:v("components.FieldItem.linkToComponentLayout"),defaultMessage:"Set the component's layout"}))))};Vi.propTypes={componentUid:o().string.isRequired};const iE=Vi,qi=(0,S.default)(j.Flex)`
1015
- border-radius: 50%;
1016
- svg {
1017
- & > * {
1018
- fill: ${({theme:e})=>e.colors.neutral500};
1019
- }
1020
- width: 12px;
1021
- height: 12px;
1022
- }
1023
- `,lE=(0,S.default)(j.Flex)`
1024
- text-decoration: none;
1025
- &:hover {
1026
- ${({theme:e})=>`
1027
- background: ${e.colors.primary100};
1028
- svg {
1029
- & > * {
1030
- fill: ${e.colors.primary600};
1031
- }
1032
- }
1033
- ${L.Typography} {
1034
- color: ${e.colors.primary600};
1035
- }
1036
- ${qi} {
1037
- background: ${e.colors.primary200};
1038
- }
1039
- border-color: ${e.colors.primary200};
1040
- `}
1041
- }
1042
- `,Wi=({components:e})=>{const{componentLayouts:t}=Qe();return r.createElement(ae.Stack,{spacing:2,horizontal:!0,overflow:"scroll hidden",padding:3},e.map(n=>r.createElement(lE,{hasRadius:!0,background:"neutral0",justifyContent:"center",alignItems:"center",height:`${84/16}rem`,minWidth:`${140/16}rem`,key:n,padding:2,direction:"column",borderColor:"neutral200",as:te.Link,to:`/content-manager/components/${n}/configurations/edit`},r.createElement(qi,{width:`${32/16}rem`,height:`${32/16}rem`,background:"neutral150",justifyContent:"center",alignItems:"center",padding:2},r.createElement(An.G,{icon:R()(t,[n,"info","icon"],"")})),r.createElement(w.Box,{paddingTop:1},r.createElement(L.Typography,{fontSize:1,textColor:"neutral600",fontWeight:"bold"},R()(t,[n,"info","displayName"],""))))))};Wi.propTypes={components:o().arrayOf(o().string).isRequired};const cE=Wi,zi=(0,S.default)(Me.IconButton)`
1043
- background-color: transparent;
1044
- path {
1045
- fill: ${({theme:e})=>e.colors.neutral600};
1046
- }
1047
- `,kr=({attribute:e,onEditField:t,onDeleteField:n,children:a})=>{const{formatMessage:s}=(0,A.useIntl)();return r.createElement(w.Box,{overflow:"hidden",width:"100%"},r.createElement(j.Flex,{paddingLeft:3,alignItems:"center",justifyContent:"space-between"},r.createElement(L.Typography,{fontWeight:"semiBold",textColor:"neutral800",ellipsis:!0},a),r.createElement(j.Flex,null,r.createElement(zi,{label:s({id:v("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:a}),onClick:t,icon:r.createElement(ut(),null),noBorder:!0}),r.createElement(zi,{label:s({id:"global.delete-target",defaultMessage:"Delete {target}"},{target:a}),"data-testid":"delete-field",onClick:n,icon:r.createElement(qe(),null),noBorder:!0}))),(e==null?void 0:e.type)==="component"&&r.createElement(iE,{componentUid:e.component}),(e==null?void 0:e.type)==="dynamiczone"&&r.createElement(cE,{components:e.components}))};kr.defaultProps={attribute:void 0},kr.propTypes={attribute:o().shape({components:o().array,component:o().string,type:o().string}),onEditField:o().func.isRequired,onDeleteField:o().func.isRequired,children:o().string.isRequired};const Ui=kr,uE=(0,S.default)(j.Flex)`
1048
- position: relative;
1049
- ${({isFirst:e,isLast:t,hasHorizontalPadding:n})=>e?`
1050
- padding-right: 4px;
1051
- `:t?`
1052
- padding-left: 4px;
1053
- `:n?`
1054
- padding: 0 4px;
1055
- `:""}
1056
- ${({showRightCarret:e,showLeftCarret:t,theme:n})=>e?`
1057
- &:after {
1058
- content: '';
1059
- position: absolute;
1060
- right: -1px;
1061
- background-color: ${n.colors.primary600};
1062
- width: 2px;
1063
- height: 100%;
1064
- align-self: stretch;
1065
- z-index: 1;
1066
- }
1067
- `:t?`
1068
- &:before {
1069
- content: '';
1070
- position: absolute;
1071
- left: -1px;
1072
- background-color: ${n.colors.primary600};
1073
- width: 2px;
1074
- height: 100%;
1075
- align-self: stretch;
1076
- z-index: 1;
1077
- }
1078
- `:""};
1079
- `,dE=(0,S.default)(rt())`
1080
- height: ${12/16}rem;
1081
- width: ${12/16}rem;
1082
- path {
1083
- fill: ${({theme:e})=>e.colors.neutral600};
1084
- }
1085
- `,pE=(0,S.default)(j.Flex)`
1086
- display: ${({dragStart:e})=>e?"none":"flex"};
1087
- opacity: ${({isDragging:e,isFullSize:t,isHidden:n})=>e&&!t?.2:e&&t||n?0:1};
1088
- `,mE=(0,S.default)(j.Flex)`
1089
- cursor: all-scroll;
1090
- border-right: 1px solid ${({theme:e})=>e.colors.neutral200};
1091
- `,Ar=({attribute:e,children:t,index:n,lastIndex:a,moveItem:s,moveRow:i,name:l,onDeleteField:u,onEditField:c,rowIndex:d,size:m})=>{const[f,g]=(0,r.useState)(!1),h=l==="_TEMP_",{setIsDraggingSibling:b}=Qe(),E=m===12,O=(0,r.useRef)(null),I=(0,r.useRef)(null),[{clientOffset:C,isOver:x},D]=(0,Te.useDrop)({accept:Pe.EDIT_FIELD,hover(T,z){if(!I.current||T.size!==12)return;const Q=z.getItem().index,K=n,P=z.getItem().rowIndex,M=d;if(Q===K&&P===M)return;const H=I.current.getBoundingClientRect(),re=(H.bottom-H.top)/2,me=z.getClientOffset().y-H.top;P<M&&me<re||P>M&&me>re||(i(P,M),T.rowIndex=M,T.itemIndex=K)},drop(T,z){if(!I.current)return;const Q=z.getItem().index,K=n,P=z.getItem().rowIndex,M=d;if(T.size===12||Q===K&&P===M)return;const H=I.current.getBoundingClientRect();if(Math.abs(z.getClientOffset().x-H.left)>H.width/1.8){s(Q,K+1,P,M),T.itemIndex=K+1,T.rowIndex=M;return}s(Q,K,P,M),T.itemIndex=K,T.rowIndex=M},collect:T=>({canDrop:T.canDrop(),clientOffset:T.getClientOffset(),isOver:T.isOver(),isOverCurrent:T.isOver({shallow:!0}),itemType:T.getItemType()})}),[{isDragging:W,getItem:F},$,N]=(0,Te.useDrag)({type:Pe.EDIT_FIELD,item:()=>(b(!0),{index:n,labelField:t,rowIndex:d,name:l,size:m}),canDrag(){return l!=="_TEMP_"},collect:T=>({isDragging:T.isDragging(),getItem:T.getItem()}),end:()=>{b(!1)}});(0,r.useEffect)(()=>{N((0,nn.rX)(),{captureDraggingState:!0})},[N]);const G={dragRef:$(O),dropRef:D(I)};let V=!1,_=!1;if(I.current&&C){const T=I.current.getBoundingClientRect();V=x&&F.size!==12&&Math.abs(C.x-T.left)<T.width/2,_=x&&F.size!==12&&Math.abs(C.x-T.left)>T.width/2,l==="_TEMP_"&&(V=x&&F.size!==12,_=!1)}const k=()=>e&&E?`${74/16}rem`:`${32/16}rem`,Z=n===0&&!E,B=n===a&&!E,Y=n!==0&&!E;return r.createElement(le.GridItem,{col:m},r.createElement(uE,{ref:G.dropRef,showLeftCarret:V,showRightCarret:_,isFirst:Z,isLast:B,hasHorizontalPadding:Y,onDrag:()=>{E&&!f&&g(!0)},onDragEnd:()=>{E&&g(!1)}},f&&E&&r.createElement(w.Box,{width:"100%",height:"2px",background:"primary600"}),r.createElement(pE,{width:E&&f?0:"100%",borderColor:"neutral150",hasRadius:!0,background:"neutral100",minHeight:k(),alignItems:"stretch",isDragging:W,dragStart:f,isFullSize:E,isHidden:h},r.createElement(mE,{as:"span",type:"button",ref:G.dragRef,onClick:T=>T.stopPropagation(),alignItems:"center",paddingLeft:3,paddingRight:3,tabIndex:-1},r.createElement(dE,null)),!h&&r.createElement(Ui,{attribute:e,onEditField:c,onDeleteField:u},t))))};Ar.defaultProps={attribute:void 0},Ar.propTypes={attribute:o().shape({components:o().array,component:o().string,type:o().string}),children:o().string.isRequired,index:o().number.isRequired,moveItem:o().func.isRequired,moveRow:o().func.isRequired,name:o().string.isRequired,onDeleteField:o().func.isRequired,onEditField:o().func.isRequired,rowIndex:o().number.isRequired,lastIndex:o().number.isRequired,size:o().number.isRequired};const fE=Ar,Hi=({rowItem:e,onRemoveField:t,rowId:n,rowIndex:a,index:s,lastIndex:i})=>{const{setEditFieldToSelect:l,attributes:u,modifiedData:c,moveRow:d,moveItem:m}=Qe(),f=R()(u,[e.name],{}),g=R()(c,["metadatas",e.name,"edit","label"],"");return r.createElement(fE,{onEditField:()=>l(e.name),onDeleteField:()=>t(n,s),attribute:f,index:s,lastIndex:i,rowIndex:a,name:e.name,size:e.size,moveRow:d,moveItem:m},g||e.name)};Hi.propTypes={index:o().number.isRequired,lastIndex:o().number.isRequired,onRemoveField:o().func.isRequired,rowId:o().number.isRequired,rowIndex:o().number.isRequired,rowItem:o().object.isRequired};const gE=Hi,_i=({row:e,onRemoveField:t,rowIndex:n})=>r.createElement(le.Grid,null,e.rowContent.map((a,s)=>r.createElement(gE,{key:a.name,rowItem:a,index:s,rowId:e.rowId,onRemoveField:t,rowIndex:n,lastIndex:e.rowContent.length-1})));_i.propTypes={onRemoveField:o().func.isRequired,row:o().object.isRequired,rowIndex:o().number.isRequired};const yE=_i,hE=[{action:"plugin::content-type-builder.read",subject:null}],bE=()=>{const{trackUsage:e}=(0,y.useTracking)(),{formatMessage:t}=(0,A.useIntl)(),{slug:n,modifiedData:a,isContentTypeView:s}=Qe(),i=s?"content-types":"components",l=`/plugins/content-type-builder/${i==="content-types"?i:"component-categories"}`,u=R()(a,"category",""),c=i==="content-types"?n:`${u}/${n}`,d=()=>{e("willEditEditLayout")};return n==="strapi::administrator"?null:r.createElement(y.CheckPermissions,{permissions:hE},r.createElement(Kt.LinkButton,{to:`${l}/${c}`,onClick:d,size:"S",startIcon:r.createElement(ut(),null),variant:"secondary"},t({id:v(`edit-settings-view.link-to-ctb.${i}`),defaultMessage:"Edit the content type"})))},Zi=({editLayout:e,editLayoutRemainingFields:t,onRemoveField:n,onAddField:a})=>{const{formatMessage:s}=(0,A.useIntl)();return r.createElement(ae.Stack,{spacing:4},r.createElement(j.Flex,{justifyContent:"space-between"},r.createElement("div",null,r.createElement(w.Box,null,r.createElement(L.Typography,{fontWeight:"bold"},s({id:v("containers.ListPage.displayedFields"),defaultMessage:"Displayed fields"}))),r.createElement(w.Box,null,r.createElement(L.Typography,{variant:"pi",textColor:"neutral600"},s({id:"containers.SettingPage.editSettings.description",defaultMessage:"Drag & drop the fields to build the layout"})))),r.createElement(bE,null)),r.createElement(w.Box,{padding:4,hasRadius:!0,borderStyle:"dashed",borderWidth:"1px",borderColor:"neutral300"},r.createElement(ae.Stack,{spacing:2},e.map((i,l)=>r.createElement(yE,{key:i.rowId,row:i,rowIndex:l,onRemoveField:n})),r.createElement(Ae.SimpleMenu,{id:"label",label:s({id:v("containers.SettingPage.add.field"),defaultMessage:"Insert another field"}),as:ye.Button,"data-testid":"add-field",fullWidth:!0,startIcon:r.createElement(ft(),null),endIcon:null,variant:"secondary",disabled:t.length===0},t.map(i=>r.createElement(Ae.MenuItem,{key:i,onClick:()=>a(i)},i))))))};Zi.propTypes={editLayout:o().array.isRequired,editLayoutRemainingFields:o().array.isRequired,onAddField:o().func.isRequired,onRemoveField:o().func.isRequired};const EE=Zi,vE=(0,S.default)(rt())`
1092
- height: ${12/16}rem;
1093
- width: ${12/16}rem;
1094
- path {
1095
- fill: ${({theme:e})=>e.colors.neutral600};
1096
- }
1097
- `,CE=(0,S.default)(j.Flex)`
1098
- opacity: ${({isDragging:e})=>e?0:1};
1099
- `,OE=(0,S.default)(j.Flex)`
1100
- cursor: all-scroll;
1101
- border-right: 1px solid ${({theme:e})=>e.colors.neutral200};
1102
- `,jr=({attribute:e,onEditField:t,onDeleteField:n,children:a,index:s,name:i,onMoveField:l})=>{const u=(0,r.useRef)(),[,c]=(0,Te.useDrop)({accept:Pe.EDIT_RELATION,hover(h){if(!u.current)return;const b=h.index,E=s;b!==E&&(l(b,E),h.index=E)}}),[{isDragging:d},m,f]=(0,Te.useDrag)({type:Pe.EDIT_RELATION,item:()=>({index:s,labelField:a,name:i}),collect:h=>({isDragging:h.isDragging()})});(0,r.useEffect)(()=>{f((0,nn.rX)(),{captureDraggingState:!0})},[f]),m(c(u));const g=()=>e&&["json","text","file","media","component","richtext","dynamiczone"].includes(e.type)?`${74/16}rem`:`${32/16}rem`;return r.createElement(CE,{width:"100%",borderColor:"neutral150",hasRadius:!0,background:"neutral100",minHeight:g(),alignItems:"stretch",isDragging:d},r.createElement(OE,{as:"span",type:"button",ref:u,onClick:h=>h.stopPropagation(),alignItems:"center",paddingLeft:3,paddingRight:3,tabIndex:-1},r.createElement(vE,null)),r.createElement(Ui,{attribute:e,onEditField:t,onDeleteField:n},a))};jr.defaultProps={attribute:void 0},jr.propTypes={attribute:o().shape({components:o().array,component:o().string,type:o().string}),onEditField:o().func.isRequired,onDeleteField:o().func.isRequired,children:o().string.isRequired,index:o().number.isRequired,name:o().string.isRequired,onMoveField:o().func.isRequired};const PE=jr,Gi=({relationsLayout:e,editRelationsLayoutRemainingFields:t,onRemoveField:n,onAddField:a})=>{const{formatMessage:s}=(0,A.useIntl)(),{setEditFieldToSelect:i,modifiedData:l,onMoveRelation:u}=Qe();return r.createElement(ae.Stack,{spacing:4},r.createElement("div",null,r.createElement(w.Box,null,r.createElement(L.Typography,{fontWeight:"bold"},s({id:v("containers.SettingPage.relations"),defaultMessage:"Relational fields"}))),r.createElement(w.Box,null,r.createElement(L.Typography,{variant:"pi",textColor:"neutral600"},s({id:"containers.SettingPage.editSettings.description",defaultMessage:"Drag & drop the fields to build the layout"})))),r.createElement(w.Box,{padding:4,hasRadius:!0,borderStyle:"dashed",borderWidth:"1px",borderColor:"neutral300"},r.createElement(ae.Stack,{spacing:2},e.map((c,d)=>{const m=R()(l,["metadatas",c,"edit","label"],"");return r.createElement(PE,{onEditField:()=>i(c),onDeleteField:()=>n(d),key:c,index:d,name:c,onMoveField:u},m||c)}),r.createElement(Ae.SimpleMenu,{id:"label",label:s({id:"containers.SettingPage.add.relational-field",defaultMessage:"Insert another relational field"}),"data-testid":"add-relation",as:ye.Button,fullWidth:!0,startIcon:r.createElement(ft(),null),endIcon:null,variant:"secondary",disabled:t.length===0},t.map(c=>r.createElement(Ae.MenuItem,{id:`menuItem-${c}`,key:`menuItem-${c}`,onClick:()=>a(c)},c))))))};Gi.propTypes={relationsLayout:o().array.isRequired,editRelationsLayoutRemainingFields:o().array.isRequired,onRemoveField:o().func.isRequired,onAddField:o().func.isRequired};const RE=Gi;var Ye=p(4122),ME=p(61714),mn=p.n(ME),TE=p(9895),wE=p.n(TE),IE=p(34103),DE=p.n(IE),xE=p(57290),Qi=p.n(xE),SE=p(55788),$r=p.n(SE),LE=p(81208),FE=p.n(LE),kE=p(65232),Br=p.n(kE),AE=p(80268),jE=p.n(AE),$E=p(42122),kt=p.n($E),BE=p(57955),NE=p.n(BE),VE=p(10822),qE=p.n(VE),WE=p(80466),zE=p.n(WE);const UE={biginteger:r.createElement(kt(),null),boolean:r.createElement(wE(),null),date:r.createElement(mn(),null),datetime:r.createElement(mn(),null),decimal:r.createElement(kt(),null),email:r.createElement(DE(),null),enum:r.createElement(Qi(),null),enumeration:r.createElement(Qi(),null),file:r.createElement($r(),null),files:r.createElement($r(),null),float:r.createElement(kt(),null),integer:r.createElement(kt(),null),media:r.createElement($r(),null),number:r.createElement(kt(),null),relation:r.createElement(FE(),null),string:r.createElement(Br(),null),text:r.createElement(Br(),null),richtext:r.createElement(Br(),null),time:r.createElement(mn(),null),timestamp:r.createElement(mn(),null),json:r.createElement(NE(),null),uid:r.createElement(jE(),null),component:r.createElement(qE(),null),dynamiczone:r.createElement(zE(),null)},Ki=({type:e})=>UE[e]||null;Ki.propTypes={type:o().string.isRequired};const Yi=Ki,HE=e=>e.reduce((t,n)=>{const a=(0,q.get)(n,["attributes"],{}),s=Object.keys(a).filter(i=>!["boolean","component","dynamiczone","json","media","password","relation","text","richtext"].includes((0,q.get)(a,[i,"type"],"")));return t[n.uid]=s,t},{}),Ji=e=>{let t;switch(e){case"description":case"label":case"placeholder":t="text";break;case"mainField":t="select";break;case"editable":t="bool";break;default:t=""}const n=v(e==="mainField"?"containers.SettingPage.editSettings.entry.title":`form.Input.${e}`);return{type:t,label:{id:n}}};var At=p(63865),_E=Object.defineProperty,fn=Object.getOwnPropertySymbols,Xi=Object.prototype.hasOwnProperty,el=Object.prototype.propertyIsEnumerable,tl=(e,t,n)=>t in e?_E(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Nr=(e,t)=>{for(var n in t||(t={}))Xi.call(t,n)&&tl(e,n,t[n]);if(fn)for(var n of fn(t))el.call(t,n)&&tl(e,n,t[n]);return e},ZE=(e,t)=>{var n={};for(var a in e)Xi.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&fn)for(var a of fn(e))t.indexOf(a)<0&&el.call(e,a)&&(n[a]=e[a]);return n};const Vr=e=>{var t=e,{type:n,options:a,onChange:s,value:i,name:l}=t,u=ZE(t,["type","options","onChange","value","name"]);const{formatMessage:c}=(0,A.useIntl)();switch(n){case"text":return r.createElement(Qn.TextInput,Nr({onChange:s,value:i,name:l},u));case"bool":return r.createElement(At.ToggleInput,Nr({onChange:d=>{s({target:{name:l,value:d.target.checked}})},checked:i,name:l,onLabel:c({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"On"}),offLabel:c({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"Off"})},u));case"select":return r.createElement(ue.Select,Nr({value:i,name:l,onChange:d=>s({target:{name:l,value:d}})},u),a.map(d=>r.createElement(ue.Option,{key:d,value:d},d)));default:return null}};Vr.defaultProps={options:void 0},Vr.propTypes={type:o().string.isRequired,options:o().arrayOf(o().string),onChange:o().func.isRequired,value:o().oneOfType([o().string,o().bool]).isRequired,name:o().string.isRequired};const GE=Vr,QE=[[4,"33%"],[6,"50%"],[8,"66%"],[12,"100%"]],KE=["dynamiczone","component","json","richtext"],nl=({onMetaChange:e,onSizeChange:t})=>{const{formatMessage:n}=(0,A.useIntl)(),{modifiedData:a,selectedField:s,attributes:i,fieldForm:l}=Qe(),u=(0,r.useMemo)(xn,[]),{schemas:c}=(0,fe.v9)(E=>u(E),fe.wU),d=(0,r.useMemo)(()=>{if(!s)return[];const E=R()(a,["metadatas",s,"edit"],{});return Object.keys(E).filter(O=>O!=="visible")},[s,a]),m=(0,r.useMemo)(()=>HE(c),[c]),f=(0,r.useCallback)(E=>{if(E!=="relation"&&E!=="component")return[];const O=E==="component"?"component":"targetModel",I=R()(a,["attributes",s,O],"");return R()(m,[I],[])},[s,m,a]),g=d.map(E=>{const O=R()(i,[s,"type"]);return O==="dynamiczone"||O==="component"&&!["label","description"].includes(E)||O==="component"&&E!=="label"||["media","json","boolean"].includes(O)&&E==="placeholder"?null:r.createElement(le.GridItem,{col:6,key:E},r.createElement(GE,{type:Ji(E).type,hint:E==="mainField"?n({id:v("containers.SettingPage.editSettings.relation-field.description")}):"",label:n({id:R()(Ji(E),"label.id","app.utils.defaultMessage")}),name:E,onChange:e,value:R()(l,["metadata",E],""),options:f(O)}))}),h=!KE.includes(i[s].type),b=r.createElement(le.GridItem,{col:6,key:"size"},r.createElement(ue.Select,{value:l==null?void 0:l.size,name:"size",onChange:E=>{t({name:s,value:E})},label:n({id:v("containers.SettingPage.editSettings.size.label"),defaultMessage:"Size"})},QE.map(([E,O])=>r.createElement(ue.Option,{key:E,value:E},O))));return r.createElement(r.Fragment,null,g,h&&b)};nl.propTypes={onMetaChange:o().func.isRequired,onSizeChange:o().func.isRequired};const YE=nl,JE=(0,S.default)(j.Flex)`
1103
- svg {
1104
- width: ${32/16}rem;
1105
- height: ${24/16}rem;
1106
- margin-right: ${({theme:e})=>e.spaces[3]};
1107
- }
1108
- `,rl=({onToggle:e,onMetaChange:t,onSizeChange:n,onSubmit:a,type:s})=>{const{selectedField:i}=Qe(),{formatMessage:l}=(0,A.useIntl)(),u=()=>s==="timestamp"?"date":["decimal","float","integer","biginter"].includes(s)?"number":s;return r.createElement(Ye.ModalLayout,{onClose:e,labelledBy:"title"},r.createElement("form",{onSubmit:a},r.createElement(Ye.ModalHeader,null,r.createElement(JE,null,r.createElement(Yi,{type:u(s)}),r.createElement(L.Typography,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title"},l({id:v("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:Ft()(i)})))),r.createElement(Ye.ModalBody,null,r.createElement(le.Grid,{gap:4},r.createElement(YE,{onMetaChange:t,onSizeChange:n}))),r.createElement(Ye.ModalFooter,{startActions:r.createElement(ye.Button,{onClick:e,variant:"tertiary"},l({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:r.createElement(ye.Button,{type:"submit"},l({id:"global.finish",defaultMessage:"Finish"}))})))};rl.propTypes={onSubmit:o().func.isRequired,onToggle:o().func.isRequired,onMetaChange:o().func.isRequired,onSizeChange:o().func.isRequired,type:o().string.isRequired};const XE=rl,e0=(e,t,n)=>ge.be.put(ve(n?`content-types/${t}/configuration`:`components/${t}/configuration`),e),qr=({mainLayout:e,components:t,isContentTypeView:n,slug:a,updateLayout:s})=>{const[i,l]=(0,r.useReducer)(Yb,Fr,()=>aE(Fr,e,t)),[u,c]=(0,r.useState)(!1),{trackUsage:d}=(0,y.useTracking)(),m=(0,y.useNotification)(),{goBack:f}=(0,te.useHistory)(),[g,h]=(0,r.useState)(!1),[b,E]=(0,r.useState)(!1),{componentLayouts:O,initialData:I,modifiedData:C,metaToEdit:x,metaForm:D}=i,{formatMessage:W}=(0,A.useIntl)(),F=R()(e,["info","displayName"],""),$=R()(C,["attributes"],{}),N=Object.keys($).filter(U=>{const de=R()($,[U,"type"],"");return!["dynamiczone","json","text","relation","component","boolean","media","password","richtext","timestamp"].includes(de)&&!!de}),G=R()(C,["layouts","edit"],[]),V=Nb()(G,"rowContent"),_=Object.keys(C.attributes).filter(U=>n?R()(C,["attributes",U,"type"],"")!=="relation":!0).filter(U=>R()(C,["metadatas",U,"edit","visible"],!1)===!0).filter(U=>V.findIndex(de=>de.name===U)===-1).sort(),k=R()(C,["layouts","editRelations"],[]),Z=Object.keys($).filter(U=>$[U].type==="relation").filter(U=>k.indexOf(U)===-1),B=({target:{name:U,value:de}})=>{l({type:"ON_CHANGE",keys:U.split("."),value:de})},Y=()=>{h(U=>!U)},T=()=>{E(U=>!U)},z=({target:{name:U,value:de}})=>{l({type:"ON_CHANGE_META",keys:U.split("."),value:de})},Q=({name:U,value:de})=>{l({type:"ON_CHANGE_SIZE",name:U,value:de})},K=U=>{U.preventDefault(),l({type:"SUBMIT_META_FORM"}),Y()},P=U=>{U.preventDefault(),T()},M=(0,Sr.useMutation)(U=>e0(U,a,n),{onSuccess:({data:U})=>{s&&s(U.data),l({type:"SUBMIT_SUCCEEDED"}),T(),d("didEditEditSettings")},onError:()=>{m({type:"warning",message:{id:"notification.error"}})}}),{isLoading:H}=M,re=()=>{const U=Fi()(Ue()(C),["layouts","metadatas","settings"]);ne()(U,"layouts.edit",Gb(U.layouts.edit)),M.mutate(U)},ce=(U,de)=>{l({type:"MOVE_RELATION",fromIndex:U,toIndex:de})},me=(U,de)=>{l({type:"MOVE_FIELD",fromIndex:U,toIndex:de})},Fe=(U,de,Be,Je)=>{l(Be===Je?{type:"REORDER_ROW",dragRowIndex:Be,dragIndex:U,hoverIndex:de}:{type:"REORDER_DIFF_ROW",dragIndex:U,hoverIndex:de,dragRowIndex:Be,hoverRowIndex:Je})},it=(U,de)=>{l({type:"MOVE_ROW",fromIndex:U,toIndex:de})};return r.createElement(nt,{isContentTypeView:n,attributes:$,modifiedData:C,slug:a,componentLayouts:O,selectedField:x,fieldForm:D,onMoveRelation:ce,onMoveField:me,moveRow:it,moveItem:Fe,setEditFieldToSelect:U=>{l({type:"SET_FIELD_TO_EDIT",name:U}),Y()},isDraggingSibling:u,setIsDraggingSibling:c},r.createElement(oe.Main,null,r.createElement("form",{onSubmit:P},r.createElement(X.HeaderLayout,{title:W({id:v("components.SettingsViewWrapper.pluginHeader.title"),defaultMessage:`Configure the view - ${Ft()(F)}`},{name:Ft()(F)}),subtitle:W({id:v("components.SettingsViewWrapper.pluginHeader.description.edit-settings"),defaultMessage:"Customize how the edit view will look like."}),navigationAction:r.createElement(ot.Link,{startIcon:r.createElement(un(),null),onClick:U=>{U.preventDefault(),f()},to:"/"},W({id:"global.back",defaultMessage:"Back"})),primaryAction:r.createElement(ye.Button,{disabled:an()(I,C),startIcon:r.createElement(bt(),null),type:"submit"},W({id:"global.save",defaultMessage:"Save"}))}),r.createElement(X.ContentLayout,null,r.createElement(w.Box,{background:"neutral0",hasRadius:!0,shadow:"filterShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},r.createElement(ae.Stack,{spacing:4},r.createElement(L.Typography,{variant:"delta",as:"h2"},W({id:v("containers.SettingPage.settings"),defaultMessage:"Settings"})),r.createElement(le.Grid,null,r.createElement(le.GridItem,{col:6,s:12},r.createElement(ue.Select,{label:W({id:v("containers.SettingPage.editSettings.entry.title"),defaultMessage:"Entry title"}),hint:W({id:v("containers.SettingPage.editSettings.entry.title.description"),defaultMessage:"Set the display field of your entry"}),onChange:U=>{B({target:{name:"settings.mainField",value:U===""?null:U}})},value:C.settings.mainField},N.map(U=>r.createElement(ue.Option,{key:U,value:U},U))))),r.createElement(w.Box,{paddingTop:2,paddingBottom:2},r.createElement(Qt.Divider,null)),r.createElement(L.Typography,{variant:"delta",as:"h3"},W({id:v("containers.SettingPage.view"),defaultMessage:"View"})),r.createElement(le.Grid,{gap:4},r.createElement(le.GridItem,{col:n?8:12,s:12},r.createElement(EE,{attributes:$,editLayout:G,editLayoutRemainingFields:_,onAddField:U=>{l({type:"ON_ADD_FIELD",name:U})},onRemoveField:(U,de)=>{l({type:"REMOVE_FIELD",rowIndex:U,fieldIndex:de})}})),n&&r.createElement(le.GridItem,{col:4,s:12},r.createElement(RE,{editRelationsLayoutRemainingFields:Z,relationsLayout:k,onAddField:U=>l({type:"ADD_RELATION",name:U}),onRemoveField:U=>l({type:"REMOVE_RELATION",index:U})})))))),r.createElement(y.ConfirmDialog,{bodyText:{id:v("popUpWarning.warning.updateAllSettings"),defaultMessage:"This will modify all your settings"},iconRightButton:r.createElement(bt(),null),isConfirmButtonLoading:H,isOpen:b,onToggleDialog:T,onConfirm:re,variantRightButton:"success-light"})),g&&r.createElement(XE,{onSubmit:K,onToggle:Y,type:R()($,[x,"type"],""),onMetaChange:z,onSizeChange:Q})))};qr.defaultProps={isContentTypeView:!1,updateLayout:null},qr.propTypes={components:o().object.isRequired,isContentTypeView:o().bool,mainLayout:o().shape({attributes:o().object.isRequired,info:o().object.isRequired,layouts:o().shape({list:o().array.isRequired,editRelations:o().array.isRequired,edit:o().array.isRequired}).isRequired,metadatas:o().object.isRequired,options:o().object.isRequired}).isRequired,slug:o().string.isRequired,updateLayout:o().func};const Wr=qr;var vt=p(55816);const t0=()=>({type:vt.ZA}),n0=(e,t)=>({type:vt.Id,pagination:e,data:t}),r0=()=>({type:vt.MP});function o0(){return{type:vt.c2}}const a0=({components:e,contentType:t})=>{const{layouts:n}=t;return{contentType:t,components:e,displayedHeaders:n.list,type:vt.Zz}},zr=e=>({type:vt.Rp,target:e});var ol=p(13055),Ur=p(29270),s0=p(32293);const i0=()=>e=>e["content-manager_listView"]||s0.E,l0=()=>(0,Dn.P1)(i0(),e=>e),al=e=>{const{displayedHeaders:t}=e["content-manager_listView"];return t},c0=l0,sl=({isPublished:e})=>{const{formatMessage:t}=(0,A.useIntl)(),n=t({id:v(`containers.List.${e?"published":"draft"}`)}),a=e?"success100":"secondary100",s=e?"success700":"secondary700";return r.createElement(w.Box,{background:a,hasRadius:!0,paddingTop:1,paddingBottom:1,paddingLeft:2,paddingRight:2,style:{width:"fit-content"}},r.createElement(L.Typography,{fontWeight:"bold",textColor:s},n))};sl.propTypes={isPublished:o().bool.isRequired};const u0=sl;var d0=p(35980),jt=p(53214),p0=p(68192),m0=p.n(p0),il=p(9667),f0=Object.defineProperty,gn=Object.getOwnPropertySymbols,ll=Object.prototype.hasOwnProperty,cl=Object.prototype.propertyIsEnumerable,ul=(e,t,n)=>t in e?f0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,g0=(e,t)=>{for(var n in t||(t={}))ll.call(t,n)&&ul(e,n,t[n]);if(gn)for(var n of gn(t))cl.call(t,n)&&ul(e,n,t[n]);return e},y0=(e,t)=>{var n={};for(var a in e)ll.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&gn)for(var a of gn(e))t.indexOf(a)<0&&cl.call(e,a)&&(n[a]=e[a]);return n};const h0=(0,S.default)(j.Flex)`
1109
- position: relative;
1110
- border-radius: 50%;
1111
- width: 26px;
1112
- height: 26px;
1113
- border: 1px solid ${({theme:e})=>e.colors.neutral200};
1114
- background: ${({theme:e})=>e.colors.neutral150};
1115
- padding-left: 1px;
1116
-
1117
- span {
1118
- line-height: 0.6rem;
1119
- font-size: 0.6rem;
1120
- }
1121
- `,dl=e=>{var t=e,{children:n}=t,a=y0(t,["children"]);return r.createElement(h0,g0({justifyContent:"center",alignItems:"center",as:"span"},a),r.createElement(L.Typography,{variant:"sigma",textColor:"neutral600"},n))};dl.propTypes={children:o().string.isRequired};const pl=dl,Hr=({url:e,mime:t,alternativeText:n,name:a,ext:s,formats:i})=>{var l;const u=(0,y.prefixFileUrlWithBackendUrl)(e);if(t.includes("image")){const m=((l=i==null?void 0:i.thumbnail)==null?void 0:l.url)||null,f=(0,y.prefixFileUrlWithBackendUrl)(m)||u;return r.createElement(il.Avatar,{src:f,alt:n||a,preview:!0})}const c=(0,y.getFileExtension)(s),d=a.length>100?`${a.substring(0,100)}...`:a;return r.createElement(dr.Tooltip,{description:d},r.createElement(pl,null,c))};Hr.defaultProps={alternativeText:null,formats:null},Hr.propTypes={alternativeText:o().string,ext:o().string.isRequired,formats:o().object,mime:o().string.isRequired,name:o().string.isRequired,url:o().string.isRequired};const ml=Hr;var b0=Object.defineProperty,fl=Object.getOwnPropertySymbols,E0=Object.prototype.hasOwnProperty,v0=Object.prototype.propertyIsEnumerable,gl=(e,t,n)=>t in e?b0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,C0=(e,t)=>{for(var n in t||(t={}))E0.call(t,n)&&gl(e,n,t[n]);if(fl)for(var n of fl(t))v0.call(t,n)&&gl(e,n,t[n]);return e};const yl=({value:e})=>r.createElement(il.AvatarGroup,null,e.map((t,n)=>{const a=`${t.id}${n}`;if(n===3){const s=`+${e.length-3}`;return r.createElement(pl,{key:a,preview:!1},s)}return n>3?null:r.createElement(ml,C0({key:a},t))}));yl.propTypes={value:o().arrayOf(o().shape({alternativeText:o().string,ext:o().string.isRequired,formats:o().object,mime:o().string.isRequired,name:o().string.isRequired,url:o().string.isRequired})).isRequired};const O0=yl;var hl=p(89557),P0=p(82910),R0=p(51064),M0=p.n(R0);const T0=e=>e%1!==0?e.toString().split(".")[1].length:0,bl=({type:e,value:t})=>{const{formatDate:n,formatTime:a,formatNumber:s}=(0,A.useIntl)();let i=t;if(e==="date"&&(i=n(M0()(t),{dateStyle:"full"})),e==="datetime"&&(i=n(t,{dateStyle:"full",timeStyle:"short"})),e==="time"){const[l,u,c]=t.split(":"),d=new Date;d.setHours(l),d.setMinutes(u),d.setSeconds(c),i=a(d,{numeric:"auto",style:"short"})}if(["float","decimal"].includes(e)){const l=T0(t);i=s(t,{minimumFractionDigits:l,maximumFractionDigits:l})}return["integer","biginteger"].includes(e)&&(i=s(t,{maximumFractionDigits:0})),ys()(i)};bl.propTypes={type:o().string.isRequired,value:o().any.isRequired};const $t=bl;var w0=Object.defineProperty,El=Object.getOwnPropertySymbols,I0=Object.prototype.hasOwnProperty,D0=Object.prototype.propertyIsEnumerable,vl=(e,t,n)=>t in e?w0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,x0=(e,t)=>{for(var n in t||(t={}))I0.call(t,n)&&vl(e,n,t[n]);if(El)for(var n of El(t))D0.call(t,n)&&vl(e,n,t[n]);return e},S0=(e,t,n)=>new Promise((a,s)=>{var i=c=>{try{u(n.next(c))}catch(d){s(d)}},l=c=>{try{u(n.throw(c))}catch(d){s(d)}},u=c=>c.done?a(c.value):Promise.resolve(c.value).then(i,l);u((n=n.apply(e,t)).next())});const L0=(0,S.default)(L.Typography)`
1122
- max-width: 500px;
1123
- `,F0=(e,t)=>S0(void 0,null,function*(){const{data:{results:n,pagination:a}}=yield ge.be.get(e);return t(),{results:n,pagination:a}}),Cl=({fieldSchema:e,metadatas:t,queryInfos:n,name:a,rowId:s,value:i})=>{const{formatMessage:l}=(0,A.useIntl)(),{notifyStatus:u}=(0,Ur.useNotifyAT)(),c=ve(`${n.endPoint}/${s}/${a.split(".")[0]}`),[d,m]=(0,r.useState)(!1),f=r.createElement(r.Fragment,null,r.createElement(hl.Badge,null,i.count)," ",l({id:"content-manager.containers.ListPage.items",defaultMessage:"{number, plural, =0 {items} one {item} other {items}}"},{number:i.count})),g=()=>{const E=l({id:v("DynamicTable.relation-loaded"),defaultMessage:"Relations have been loaded"});u(E)},{data:h,status:b}=(0,Sr.useQuery)([e.targetModel,s],()=>F0(c,g),{enabled:d,staleTime:0});return r.createElement(w.Box,x0({},y.stopPropagation),r.createElement(Ae.SimpleMenu,{label:f,size:"S",onOpen:()=>m(!0),onClose:()=>m(!1)},b!=="success"&&r.createElement(Ae.MenuItem,{"aria-disabled":!0},r.createElement(P0.Loader,{small:!0},l({id:v("DynamicTable.relation-loading"),defaultMessage:"Relations are loading"}))),b==="success"&&r.createElement(r.Fragment,null,h==null?void 0:h.results.map(E=>r.createElement(Ae.MenuItem,{key:E.id,"aria-disabled":!0},r.createElement(L0,{ellipsis:!0},r.createElement($t,{type:t.mainField.schema.type,value:E[t.mainField.name]||E.id})))),(h==null?void 0:h.pagination.total)>10&&r.createElement(Ae.MenuItem,{"aria-disabled":!0,"aria-label":l({id:v("DynamicTable.relation-more"),defaultMessage:"This relation contains more entities than displayed"})},r.createElement(L.Typography,null,"...")))))};Cl.propTypes={fieldSchema:o().shape({relation:o().string,targetModel:o().string,type:o().string.isRequired}).isRequired,metadatas:o().shape({mainField:o().shape({name:o().string.isRequired,schema:o().shape({type:o().string.isRequired}).isRequired})}).isRequired,name:o().string.isRequired,rowId:o().oneOfType([o().string,o().number]).isRequired,queryInfos:o().shape({endPoint:o().string.isRequired}).isRequired,value:o().object.isRequired};const k0=Cl,A0=(0,S.default)(L.Typography)`
1124
- max-width: 500px;
1125
- `,Ol=({metadatas:e,value:t})=>r.createElement(A0,{textColor:"neutral800",ellipsis:!0},r.createElement($t,{type:e.mainField.schema.type,value:t[e.mainField.name]||t.id}));Ol.propTypes={metadatas:o().shape({mainField:o().shape({name:o().string.isRequired,schema:o().shape({type:o().string.isRequired}).isRequired})}).isRequired,value:o().object.isRequired};const j0=Ol;var $0=Object.defineProperty,Pl=Object.getOwnPropertySymbols,B0=Object.prototype.hasOwnProperty,N0=Object.prototype.propertyIsEnumerable,Rl=(e,t,n)=>t in e?$0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,V0=(e,t)=>{for(var n in t||(t={}))B0.call(t,n)&&Rl(e,n,t[n]);if(Pl)for(var n of Pl(t))N0.call(t,n)&&Rl(e,n,t[n]);return e};const q0=(0,S.default)(L.Typography)`
1126
- max-width: 500px;
1127
- `,Ml=({value:e,metadatas:t})=>{const{formatMessage:n}=(0,A.useIntl)(),{mainField:{type:a,name:s}}=t,i=r.createElement(r.Fragment,null,r.createElement(hl.Badge,null,e.length)," ",n({id:"content-manager.containers.ListPage.items",defaultMessage:"{number, plural, =0 {items} one {item} other {items}}"},{number:e.length}));return r.createElement(w.Box,V0({},y.stopPropagation),r.createElement(Ae.SimpleMenu,{label:i,size:"S"},e.map(l=>r.createElement(Ae.MenuItem,{key:l.id,"aria-disabled":!0},r.createElement(q0,{ellipsis:!0},r.createElement($t,{type:a,value:l[s]||l.id}))))))};Ml.propTypes={metadatas:o().shape({mainField:o().shape({name:o().string,type:o().string,value:o().string})}).isRequired,value:o().array.isRequired};const W0=Ml,z0=(0,S.default)(L.Typography)`
1128
- max-width: 250px;
1129
- `,Tl=({value:e,metadatas:t})=>{const{mainField:n}=t,a=e[n.name];return r.createElement(dr.Tooltip,{label:a},r.createElement(z0,{textColor:"neutral800",ellipsis:!0},r.createElement($t,{type:n.type,value:a})))};Tl.propTypes={metadatas:o().shape({mainField:o().shape({name:o().string,type:o().string,value:o().string})}).isRequired,value:o().object.isRequired};const U0=Tl;var H0=p(80022),wl=p.n(H0);function Il(e){return["oneToOne","manyToOne","oneToOneMorph"].includes(e)}function _0(e,t,n,a){if(e==="component"){const{mainField:{name:s,type:i}}=n;if(a!=null&&a.repeatable)return t.length>0;const l=t==null?void 0:t[s];return s==="id"&&![void 0,null].includes(l)?!0:Lt(i)&&i!=="biginteger"&&s!=="id"?wl()(l):!Re()(l)}return e==="relation"?Il(a.relation)?!Re()(t):t.count>0:Lt(e)&&e!=="biginteger"?wl()(t):e==="boolean"?t!==null:!Re()(t)}var Z0=Object.defineProperty,Dl=Object.getOwnPropertySymbols,G0=Object.prototype.hasOwnProperty,Q0=Object.prototype.propertyIsEnumerable,xl=(e,t,n)=>t in e?Z0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,K0=(e,t)=>{for(var n in t||(t={}))G0.call(t,n)&&xl(e,n,t[n]);if(Dl)for(var n of Dl(t))Q0.call(t,n)&&xl(e,n,t[n]);return e};const Y0=(0,S.default)(L.Typography)`
1130
- max-width: 300px;
1131
- `,_r=({content:e,fieldSchema:t,metadatas:n,name:a,queryInfos:s,rowId:i})=>{const{type:l}=t;if(!_0(l,e,n,t))return r.createElement(L.Typography,{textColor:"neutral800"},"-");switch(l){case"media":return t.multiple?r.createElement(O0,{value:e}):r.createElement(ml,K0({},e));case"relation":return Il(t.relation)?r.createElement(j0,{metadatas:n,value:e}):r.createElement(k0,{fieldSchema:t,queryInfos:s,metadatas:n,value:e,name:a,rowId:i});case"component":return t.repeatable===!0?r.createElement(W0,{value:e,metadatas:n}):r.createElement(U0,{value:e,metadatas:n});default:return r.createElement(Y0,{ellipsis:!0,textColor:"neutral800"},r.createElement($t,{type:l,value:e}))}};_r.defaultProps={content:void 0,queryInfos:void 0},_r.propTypes={content:o().any,fieldSchema:o().shape({component:o().string,multiple:o().bool,type:o().string.isRequired,repeatable:o().bool,relation:o().string}).isRequired,metadatas:o().object.isRequired,name:o().string.isRequired,rowId:o().oneOfType([o().string,o().number]).isRequired,queryInfos:o().shape({endPoint:o().string.isRequired})};const J0=_r;var X0=Object.defineProperty,ev=Object.defineProperties,tv=Object.getOwnPropertyDescriptors,yn=Object.getOwnPropertySymbols,Sl=Object.prototype.hasOwnProperty,Ll=Object.prototype.propertyIsEnumerable,Fl=(e,t,n)=>t in e?X0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Bt=(e,t)=>{for(var n in t||(t={}))Sl.call(t,n)&&Fl(e,n,t[n]);if(yn)for(var n of yn(t))Ll.call(t,n)&&Fl(e,n,t[n]);return e},nv=(e,t)=>ev(e,tv(t)),rv=(e,t)=>{var n={};for(var a in e)Sl.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&yn)for(var a of yn(e))t.indexOf(a)<0&&Ll.call(e,a)&&(n[a]=e[a]);return n};const Zr=({canCreate:e,canDelete:t,headers:n,entriesToDelete:a,onClickDelete:s,onSelectRow:i,withMainAction:l,withBulkActions:u,rows:c})=>{const{push:d,location:{pathname:m}}=(0,te.useHistory)(),{formatMessage:f}=(0,A.useIntl)(),{trackUsage:g}=(0,y.useTracking)(),h=Qo();return r.createElement(jt.Tbody,null,c.map((b,E)=>{const O=a.findIndex(C=>C===b.id)!==-1,I=f({id:"content-manager.components.DynamicTable.row-line",defaultMessage:"item line {number}"},{number:E});return r.createElement(jt.Tr,Bt({key:b.id},(0,y.onRowClick)({fn:()=>{g("willEditEntryFromList"),d({pathname:`${m}/${b.id}`,state:{from:m},search:h})},condition:u})),l&&r.createElement(jt.Td,Bt({},y.stopPropagation),r.createElement(d0.BaseCheckbox,{"aria-label":f({id:"app.component.table.select.one-entry",defaultMessage:"Select {target}"},{target:(0,fi.Pp)(b.firstname,b.lastname)}),checked:O,onChange:()=>{i({name:b.id,value:!O})}})),n.map(C=>{var x=C,{key:D,cellFormatter:W,name:F}=x,$=rv(x,["key","cellFormatter","name"]);return r.createElement(jt.Td,{key:D},typeof W=="function"?W(b,Bt({key:D,name:F},$)):r.createElement(J0,nv(Bt({content:b[F.split(".")[0]],name:F},$),{rowId:b.id})))}),u&&r.createElement(jt.Td,null,r.createElement(j.Flex,Bt({justifyContent:"end"},y.stopPropagation),r.createElement(Me.IconButton,{onClick:()=>{g("willEditEntryFromButton"),d({pathname:`${m}/${b.id}`,state:{from:m},search:h})},label:f({id:"app.component.table.edit",defaultMessage:"Edit {target}"},{target:I}),noBorder:!0,icon:r.createElement(ut(),null)}),e&&r.createElement(w.Box,{paddingLeft:1},r.createElement(Me.IconButton,{onClick:()=>{d({pathname:`${m}/create/clone/${b.id}`,state:{from:m},search:h})},label:f({id:"app.component.table.duplicate",defaultMessage:"Duplicate {target}"},{target:I}),noBorder:!0,icon:r.createElement(m0(),null)})),t&&r.createElement(w.Box,{paddingLeft:1},r.createElement(Me.IconButton,{onClick:()=>{g("willDeleteEntryFromList"),s(b.id)},label:f({id:"global.delete-target",defaultMessage:"Delete {target}"},{target:I}),noBorder:!0,icon:r.createElement(qe(),null)})))))}))};Zr.defaultProps={canCreate:!1,canDelete:!1,entriesToDelete:[],onClickDelete:()=>{},onSelectRow:()=>{},rows:[],withBulkActions:!1,withMainAction:!1},Zr.propTypes={canCreate:o().bool,canDelete:o().bool,entriesToDelete:o().array,headers:o().array.isRequired,onClickDelete:o().func,onSelectRow:o().func,rows:o().array,withBulkActions:o().bool,withMainAction:o().bool};const ov=Zr;var av=Object.defineProperty,hn=Object.getOwnPropertySymbols,kl=Object.prototype.hasOwnProperty,Al=Object.prototype.propertyIsEnumerable,jl=(e,t,n)=>t in e?av(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,sv=(e,t)=>{for(var n in t||(t={}))kl.call(t,n)&&jl(e,n,t[n]);if(hn)for(var n of hn(t))Al.call(t,n)&&jl(e,n,t[n]);return e},iv=(e,t)=>{var n={};for(var a in e)kl.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&hn)for(var a of hn(e))t.indexOf(a)<0&&Al.call(e,a)&&(n[a]=e[a]);return n};const $l=e=>{var t=e,{area:n}=t,a=iv(t,["area"]);const s=Xo(n);return s?r.createElement("ul",null,s.map(i=>i.Component(a)?r.createElement(w.Box,{key:i.name,padding:3,style:{textAlign:"center"}},r.createElement(i.Component,sv({},a))):null)):null};$l.propTypes={area:o().string.isRequired};const Bl=$l,Nl=({isConfirmButtonLoading:e,isOpen:t,onToggleDialog:n,onConfirm:a})=>{const{formatMessage:s}=(0,A.useIntl)();return r.createElement(ke.Dialog,{onClose:n,title:s({id:"app.components.ConfirmDialog.title",defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:t},r.createElement(ke.DialogBody,{icon:r.createElement(St(),null)},r.createElement(ae.Stack,{spacing:2},r.createElement(j.Flex,{justifyContent:"center"},r.createElement(L.Typography,{id:"confirm-description"},s({id:v("popUpWarning.bodyMessage.contentType.delete.all"),defaultMessage:"Are you sure you want to delete these entries?"}))),r.createElement(j.Flex,null,r.createElement(Bl,{area:"contentManager.listView.deleteModalAdditionalInfos"})))),r.createElement(ke.DialogFooter,{startAction:r.createElement(ye.Button,{onClick:n,variant:"tertiary"},s({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endAction:r.createElement(ye.Button,{onClick:a,variant:"danger-light",startIcon:r.createElement(qe(),null),id:"confirm-delete",loading:e},s({id:"app.components.Button.confirm",defaultMessage:"Confirm"}))}))};Nl.propTypes={isConfirmButtonLoading:o().bool.isRequired,isOpen:o().bool.isRequired,onConfirm:o().func.isRequired,onToggleDialog:o().func.isRequired};const lv=Nl,Vl=({isConfirmButtonLoading:e,isOpen:t,onToggleDialog:n,onConfirm:a})=>{const{formatMessage:s}=(0,A.useIntl)();return r.createElement(ke.Dialog,{onClose:n,title:s({id:"app.components.ConfirmDialog.title",defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:t},r.createElement(ke.DialogBody,{icon:r.createElement(St(),null)},r.createElement(ae.Stack,{spacing:2},r.createElement(j.Flex,{justifyContent:"center"},r.createElement(L.Typography,{id:"confirm-description"},s({id:"components.popUpWarning.message",defaultMessage:"Are you sure you want to delete this?"}))),r.createElement(j.Flex,null,r.createElement(Bl,{area:"contentManager.listView.deleteModalAdditionalInfos"})))),r.createElement(ke.DialogFooter,{startAction:r.createElement(ye.Button,{onClick:n,variant:"tertiary"},s({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endAction:r.createElement(ye.Button,{onClick:a,variant:"danger-light",startIcon:r.createElement(qe(),null),id:"confirm-delete",loading:e},s({id:"app.components.Button.confirm",defaultMessage:"Confirm"}))}))};Vl.propTypes={isConfirmButtonLoading:o().bool.isRequired,isOpen:o().bool.isRequired,onConfirm:o().func.isRequired,onToggleDialog:o().func.isRequired};const cv=Vl;var uv=Object.defineProperty,dv=Object.defineProperties,pv=Object.getOwnPropertyDescriptors,ql=Object.getOwnPropertySymbols,mv=Object.prototype.hasOwnProperty,fv=Object.prototype.propertyIsEnumerable,Wl=(e,t,n)=>t in e?uv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gv=(e,t)=>{for(var n in t||(t={}))mv.call(t,n)&&Wl(e,n,t[n]);if(ql)for(var n of ql(t))fv.call(t,n)&&Wl(e,n,t[n]);return e},yv=(e,t)=>dv(e,pv(t));const Gr=({canCreate:e,canDelete:t,contentTypeName:n,action:a,isBulkable:s,isLoading:i,onConfirmDelete:l,onConfirmDeleteAll:u,layout:c,rows:d})=>{const{runHookWaterfall:m}=(0,y.useStrapiApp)(),f=c.contentType.options.draftAndPublish||!1,{formatMessage:g}=(0,A.useIntl)(),h=(0,fe.v9)(al),b=(0,r.useMemo)(()=>{const O=m(Gt.No,{displayedHeaders:h,layout:c}).displayedHeaders.map(I=>{if(I.fieldSchema.type==="relation"){const C=`${I.name}.${I.metadatas.mainField.name}`;return yv(gv({},I),{name:C})}return I});return f?[...O,{key:"__published_at_temp_key__",name:"publishedAt",fieldSchema:{type:"custom"},metadatas:{label:g({id:v("containers.ListPage.table-headers.published_at")}),searchable:!1,sortable:!0},cellFormatter:I=>{const C=!Re()(I.publishedAt);return r.createElement(u0,{isPublished:C})}}]:O},[m,h,c,f,g]);return r.createElement(y.DynamicTable,{components:{ConfirmDialogDelete:cv,ConfirmDialogDeleteAll:lv},contentType:n,action:a,isLoading:i,headers:b,onConfirmDelete:l,onConfirmDeleteAll:u,onOpenDeleteAllModalTrackedEvent:"willBulkDeleteEntries",rows:d,withBulkActions:!0,withMainAction:t&&s},r.createElement(ov,{canCreate:e,canDelete:t,headers:b,rows:d,withBulkActions:!0,withMainAction:t&&s}))};Gr.defaultProps={action:void 0},Gr.propTypes={canCreate:o().bool.isRequired,canDelete:o().bool.isRequired,contentTypeName:o().string.isRequired,action:o().node,isBulkable:o().bool.isRequired,isLoading:o().bool.isRequired,layout:o().exact({components:o().object.isRequired,contentType:o().shape({attributes:o().object.isRequired,metadatas:o().object.isRequired,layouts:o().shape({list:o().array.isRequired,editRelations:o().array}).isRequired,options:o().object.isRequired,settings:o().object.isRequired}).isRequired}).isRequired,onConfirmDelete:o().func.isRequired,onConfirmDeleteAll:o().func.isRequired,rows:o().array.isRequired};const hv=Gr,bv=e=>Object.keys(e).reduce((n,a)=>{const s=e[a];return bo(s)&&n.push(a),n},[]).sort(),zl=({layout:e})=>{const t=(0,fe.I0)(),n=(0,fe.v9)(al),{trackUsage:a}=(0,y.useTracking)(),{formatMessage:s}=(0,A.useIntl)(),i=bv(e.contentType.attributes).map(c=>{const d=e.contentType.metadatas[c].list;return{name:c,intlLabel:{id:d.label,defaultMessage:d.label}}}),l=n.map(({name:c})=>c),u=c=>{if(a("didChangeDisplayedFields"),c.length<l.length){const d=l.filter(m=>c.indexOf(m)===-1);t(zr({name:d[0],value:!0}))}else{const d=c.filter(m=>l.indexOf(m)===-1);t(zr({name:d[0],value:!1}))}};return r.createElement(w.Box,{paddingTop:1,paddingBottom:1},r.createElement(ue.Select,{"aria-label":"change displayed fields",value:l,onChange:u,customizeContent:c=>`${c.length} currently selected`,multi:!0,size:"S"},i.map(c=>r.createElement(ue.Option,{key:c.name,value:c.name},s({id:c.intlLabel.id||c.name,defaultMessage:c.intlLabel.defaultMessage||c.name})))))};zl.propTypes={layout:o().shape({contentType:o().shape({attributes:o().object.isRequired,metadatas:o().object.isRequired,layouts:o().shape({list:o().array.isRequired,editRelations:o().array}).isRequired,options:o().object.isRequired,settings:o().object.isRequired}).isRequired}).isRequired};const Ev=(0,r.memo)(zl),Qr=({pagination:e})=>r.createElement(w.Box,{paddingTop:4},r.createElement(j.Flex,{alignItems:"flex-end",justifyContent:"space-between"},r.createElement(y.PageSizeURLQuery,{trackedEvent:"willChangeNumberOfEntriesPerPage"}),r.createElement(y.PaginationURLQuery,{pagination:e})));Qr.defaultProps={pagination:{pageCount:0,pageSize:10,total:0}},Qr.propTypes={pagination:o().shape({page:o().number,pageCount:o().number,pageSize:o().number,total:o().number})};const vv=Qr,Cv=["json","component","media","richtext","dynamiczone","password"],Ov=["createdAt","updatedAt"],Pv=(e,t)=>{const{allPermissions:n}=(0,y.useRBACProvider)(),a=(0,y.findMatchingPermissions)(n,[{action:"plugin::content-manager.explorer.read",subject:t}]),s=R()(a,["0","properties","fields"],[]);return Object.keys(R()(e,["attributes"]),{}).filter(u=>{const c=R()(e,["attributes",u],{});return!(!c.type||Cv.includes(c.type)||!s.includes(u)&&u!=="id"&&!Ov.includes(u))}).sort()};var Rv=p(23899),Mv=p.n(Rv);const Ul=({displayedFilters:e})=>{const[t,n]=(0,r.useState)(!1),{formatMessage:a}=(0,A.useIntl)(),s=(0,r.useRef)(),{trackUsage:i}=(0,y.useTracking)(),l=()=>{t||i("willFilterEntries"),n(u=>!u)};return r.createElement(r.Fragment,null,r.createElement(w.Box,{paddingTop:1,paddingBottom:1},r.createElement(ye.Button,{variant:"tertiary",ref:s,startIcon:r.createElement(Mv(),null),onClick:l,size:"S"},a({id:"app.utils.filters",defaultMessage:"Filters"})),t&&r.createElement(y.FilterPopoverURLQuery,{displayedFilters:e,isVisible:t,onToggle:l,source:s})),r.createElement(y.FilterListURLQuery,{filtersSchema:e}))};Ul.propTypes={displayedFilters:o().arrayOf(o().shape({name:o().string.isRequired,metadatas:o().shape({label:o().string}),fieldSchema:o().shape({type:o().string})})).isRequired};const Tv=Ul,Hl=({contentType:e,slug:t,metadatas:n})=>{const s=Pv(e,t).map(i=>{const l=e.attributes[i],{type:u,enum:c}=l,d={name:"didFilterEntries",properties:{useRelation:u==="relation"}},{mainField:m,label:f}=n[i].list;return{name:i,metadatas:{label:f},fieldSchema:{type:u,options:c,mainField:m},trackedEvent:d}});return r.createElement(Tv,{displayedFilters:s})};Hl.propTypes={contentType:o().object.isRequired,metadatas:o().object.isRequired,slug:o().string.isRequired};const wv=Hl;var Iv=p(98399),Dv=Object.defineProperty,xv=Object.defineProperties,Sv=Object.getOwnPropertyDescriptors,_l=Object.getOwnPropertySymbols,Lv=Object.prototype.hasOwnProperty,Fv=Object.prototype.propertyIsEnumerable,Zl=(e,t,n)=>t in e?Dv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kv=(e,t)=>{for(var n in t||(t={}))Lv.call(t,n)&&Zl(e,n,t[n]);if(_l)for(var n of _l(t))Fv.call(t,n)&&Zl(e,n,t[n]);return e},Av=(e,t)=>xv(e,Sv(t)),Kr=(e,t,n)=>new Promise((a,s)=>{var i=c=>{try{u(n.next(c))}catch(d){s(d)}},l=c=>{try{u(n.throw(c))}catch(d){s(d)}},u=c=>c.done?a(c.value):Promise.resolve(c.value).then(i,l);u((n=n.apply(e,t)).next())});const jv=De.Z.contentManager,$v=(0,S.default)(Me.IconButton)`
1132
- svg {
1133
- path {
1134
- fill: ${({theme:e})=>e.colors.neutral900};
1135
- }
1136
- }
1137
- `;function Gl({canCreate:e,canDelete:t,canRead:n,data:a,getData:s,getDataSucceeded:i,isLoading:l,layout:u,pagination:c,slug:d}){const{total:m}=c,{contentType:{metadatas:f,settings:{bulkable:g,filterable:h,searchable:b}}}=u,E=(0,y.useNotification)(),{trackUsage:O}=(0,y.useTracking)(),{refetchPermissions:I}=(0,y.useRBACProvider)(),C=(0,r.useRef)(O),x=(0,r.useRef)(I),{notifyStatus:D}=(0,Ur.useNotifyAT)();(0,y.useFocusWhenNavigate)();const[{query:W}]=(0,y.useQueryParams)(),F=ni(W),$=(0,We.stringify)({plugins:W.plugins},{encode:!1}),{pathname:N}=(0,te.useLocation)(),{push:G}=(0,te.useHistory)(),{formatMessage:V}=(0,A.useIntl)(),_=u.contentType,k=R()(_,"options.draftAndPublish",!1),Z=(0,r.useRef)(""),B=(0,r.useCallback)((M,H)=>Kr(this,null,function*(){s();try{const re=H?{cancelToken:H.token}:null,{data:{results:ce,pagination:me}}=yield ge.be.get(M,re);D(V({id:v("utils.data-loaded"),defaultMessage:"{number, plural, =1 {# entry has} other {# entries have}} successfully been loaded"},{number:me.count})),i(me,ce)}catch(re){if(Se().isCancel(re))return;if(R()(re,"response.status",null)===403){yield x.current(),E({type:"info",message:{id:v("permissions.not-allowed.update")}}),G("/");return}Iv.error(re),E({type:"warning",message:{id:v("error.model.fetch")}})}}),[V,s,i,D,G,E]),Y=(0,r.useCallback)(M=>Kr(this,null,function*(){try{yield ge.be.post(ve(`collection-types/${d}/actions/bulkDelete`),{ids:M});const H=ve(`collection-types/${d}${F}`);B(H),C.current("didBulkDeleteEntries")}catch(H){E({type:"warning",message:{id:v("error.record.delete")}})}}),[B,F,d,E]),T=(0,r.useCallback)(M=>Kr(this,null,function*(){try{yield ge.be.delete(ve(`collection-types/${d}/${M}`));const H=ve(`collection-types/${d}${F}`);B(H),E({type:"success",message:{id:v("success.record.delete")}})}catch(H){const re=R()(H,"response.payload.message",V({id:v("error.record.delete")}));E({type:"warning",message:re})}}),[d,F,B,E,V]);(0,r.useEffect)(()=>{const H=Se().CancelToken.source(),re=n,ce=ve(`collection-types/${d}${F}`);return re&&ce.includes(Z.current)&&B(ce,H),()=>{Z.current=d,H.cancel("Operation canceled by the user.")}},[n,s,d,F,i,B]);const z=V({id:v("header.name"),defaultMessage:"Content"}),Q=V({id:_.info.displayName,defaultMessage:_.info.displayName||z}),K=n?V({id:v("pages.ListView.header-subtitle"),defaultMessage:"{number, plural, =0 {# entries} one {# entry} other {# entries}} found"},{number:m}):null,P=M=>e?r.createElement(ye.Button,Av(kv({},M),{onClick:()=>{const H=k?{status:"draft"}:{};C.current("willCreateEntry",H),G({pathname:`${N}/create`,search:W.plugins?$:""})},startIcon:r.createElement(ft(),null)}),V({id:v("HeaderLayout.button.label-add-entry"),defaultMessage:"Create new entry"})):null;return r.createElement(oe.Main,{"aria-busy":l},r.createElement(X.HeaderLayout,{primaryAction:P(),subtitle:K,title:Q,navigationAction:r.createElement(ot.Link,{startIcon:r.createElement(un(),null),to:"/content-manager/"},V({id:"global.back",defaultMessage:"Back"}))}),!n&&r.createElement(X.ActionLayout,{endActions:r.createElement(Jt,{area:"contentManager.listView.actions"})}),n&&r.createElement(X.ActionLayout,{endActions:r.createElement(r.Fragment,null,r.createElement(Jt,{area:"contentManager.listView.actions"}),r.createElement(Ev,{layout:u}),r.createElement(y.CheckPermissions,{permissions:jv.collectionTypesConfigurations},r.createElement(w.Box,{paddingTop:1,paddingBottom:1},r.createElement($v,{onClick:()=>{O("willEditListLayout"),G({pathname:`${d}/configurations/list`,search:$})},icon:r.createElement(Ni(),null),label:V({id:"app.links.configure-view",defaultMessage:"Configure the view"})})))),startActions:r.createElement(r.Fragment,null,b&&r.createElement(y.SearchURLQuery,{label:V({id:"app.component.search.label",defaultMessage:"Search for {target}"},{target:Q}),placeholder:V({id:"app.component.search.placeholder",defaultMessage:"Search..."}),trackedEvent:"didSearch"}),h&&r.createElement(wv,{contentType:_,slug:d,metadatas:f}))}),r.createElement(X.ContentLayout,null,n?r.createElement(r.Fragment,null,r.createElement(hv,{canCreate:e,canDelete:t,contentTypeName:Q,onConfirmDeleteAll:Y,onConfirmDelete:T,isBulkable:g,isLoading:l,layout:u,rows:a,action:P({variant:"secondary"})}),r.createElement(vv,{pagination:{pageCount:(c==null?void 0:c.pageCount)||1}})):r.createElement(y.NoPermissions,null)))}Gl.propTypes={canCreate:o().bool.isRequired,canDelete:o().bool.isRequired,canRead:o().bool.isRequired,data:o().array.isRequired,layout:o().exact({components:o().object.isRequired,contentType:o().shape({attributes:o().object.isRequired,metadatas:o().object.isRequired,info:o().shape({displayName:o().string.isRequired}).isRequired,layouts:o().shape({list:o().array.isRequired,editRelations:o().array}).isRequired,options:o().object.isRequired,settings:o().object.isRequired}).isRequired}).isRequired,isLoading:o().bool.isRequired,getData:o().func.isRequired,getDataSucceeded:o().func.isRequired,pagination:o().shape({total:o().number.isRequired,pageCount:o().number}).isRequired,slug:o().string.isRequired};const Bv=c0();function Nv(e){return(0,ol.bindActionCreators)({getData:t0,getDataSucceeded:n0,onChangeListHeaders:zr,onResetListHeaders:r0},e)}const Vv=(0,fe.$j)(Bv,Nv),qv=(0,ol.compose)(Vv)((0,r.memo)(Gl,He()));var Wv=Object.defineProperty,Ql=Object.getOwnPropertySymbols,zv=Object.prototype.hasOwnProperty,Uv=Object.prototype.propertyIsEnumerable,Kl=(e,t,n)=>t in e?Wv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yl=(e,t)=>{for(var n in t||(t={}))zv.call(t,n)&&Kl(e,n,t[n]);if(Ql)for(var n of Ql(t))Uv.call(t,n)&&Kl(e,n,t[n]);return e};const Yr=e=>{const t=(0,r.useMemo)(()=>Mo(e.slug),[e.slug]),{isLoading:n,allowedActions:a}=(0,y.useRBAC)(t,e.permissions);return n?r.createElement(y.LoadingIndicatorPage,null):r.createElement(qv,Yl(Yl({},e),a))};Yr.defaultProps={permissions:[]},Yr.propTypes={permissions:o().array,slug:o().string.isRequired};const Hv=(0,r.memo)(Yr,(e,t)=>{const n=(0,y.difference)(e,t);return Object.keys(n).filter(s=>s!=="state").length>0});var _v=Object.defineProperty,Zv=Object.defineProperties,Gv=Object.getOwnPropertyDescriptors,bn=Object.getOwnPropertySymbols,Jl=Object.prototype.hasOwnProperty,Xl=Object.prototype.propertyIsEnumerable,ec=(e,t,n)=>t in e?_v(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qv=(e,t)=>{for(var n in t||(t={}))Jl.call(t,n)&&ec(e,n,t[n]);if(bn)for(var n of bn(t))Xl.call(t,n)&&ec(e,n,t[n]);return e},Kv=(e,t)=>Zv(e,Gv(t)),Yv=(e,t)=>{var n={};for(var a in e)Jl.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&bn)for(var a of bn(e))t.indexOf(a)<0&&Xl.call(e,a)&&(n[a]=e[a]);return n};const tc=e=>{var t=e,{layout:n}=t,a=Yv(t,["layout"]);const s=(0,fe.I0)(),{replace:i}=(0,te.useHistory)(),[{query:l,rawQuery:u}]=(0,y.useQueryParams)(),c=Yo(l,a.slug,"listView"),d=Go(a.slug);return(0,r.useEffect)(()=>{u||i(d)},[u,i,d]),(0,r.useEffect)(()=>{s(a0(n))},[s,n]),(0,r.useEffect)(()=>()=>{s(o0())},[s]),c?r.createElement(Hv,Kv(Qv({},a),{layout:n,permissions:c})):null};tc.propTypes={layout:o().exact({components:o().object.isRequired,contentType:o().shape({attributes:o().object.isRequired,metadatas:o().object.isRequired,layouts:o().shape({list:o().array.isRequired,editRelations:o().array}).isRequired,options:o().object.isRequired,settings:o().object.isRequired,pluginOptions:o().object}).isRequired}).isRequired,slug:o().string.isRequired};const Jv=tc,Xv=(e,t)=>ge.be.put(ve(`content-types/${t}/configuration`),e),eC=(0,S.default)(j.Flex)`
1138
- gap: ${({theme:e})=>e.spaces[4]};
1139
- `,Jr=({modifiedData:e,onChange:t,sortOptions:n})=>{const{formatMessage:a}=(0,A.useIntl)(),{settings:s}=e;return r.createElement(r.Fragment,null,r.createElement(w.Box,{paddingBottom:4},r.createElement(L.Typography,{variant:"delta",as:"h2"},a({id:v("containers.SettingPage.settings"),defaultMessage:"Settings"}))),r.createElement(eC,{justifyContent:"space-between",wrap:"wrap",paddingBottom:6},r.createElement(At.ToggleInput,{label:a({id:v("form.Input.search"),defaultMessage:"Enable search"}),onChange:i=>{t({target:{name:"settings.searchable",value:i.target.checked}})},onLabel:a({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:a({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.searchable",checked:s.searchable}),r.createElement(At.ToggleInput,{label:a({id:v("form.Input.filters"),defaultMessage:"Enable filters"}),onChange:i=>{t({target:{name:"settings.filterable",value:i.target.checked}})},onLabel:a({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:a({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.filterable",checked:s.filterable}),r.createElement(At.ToggleInput,{label:a({id:v("form.Input.bulkActions"),defaultMessage:"Enable bulk actions"}),onChange:i=>{t({target:{name:"settings.bulkable",value:i.target.checked}})},onLabel:a({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:a({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.bulkable",checked:s.bulkable})),r.createElement(le.Grid,{gap:4},r.createElement(le.GridItem,{s:12,col:6},r.createElement(ue.Select,{label:a({id:v("form.Input.pageEntries"),defaultMessage:"Entries per page"}),hint:a({id:v("form.Input.pageEntries.inputDescription"),defaultMessage:"Note: You can override this value in the Collection Type settings page."}),onChange:i=>t({target:{name:"settings.pageSize",value:i}}),name:"settings.pageSize",value:e.settings.pageSize||""},[10,20,50,100].map(i=>r.createElement(ue.Option,{key:i,value:i},i)))),r.createElement(le.GridItem,{s:12,col:3},r.createElement(ue.Select,{label:a({id:v("form.Input.defaultSort"),defaultMessage:"Default sort attribute"}),onChange:i=>t({target:{name:"settings.defaultSortBy",value:i}}),name:"settings.defaultSortBy",value:e.settings.defaultSortBy||""},n.map(i=>r.createElement(ue.Option,{key:i,value:i},i)))),r.createElement(le.GridItem,{s:12,col:3},r.createElement(ue.Select,{label:a({id:v("form.Input.sort.order"),defaultMessage:"Default sort order"}),onChange:i=>t({target:{name:"settings.defaultSortOrder",value:i}}),name:"settings.defaultSortOrder",value:e.settings.defaultSortOrder||""},["ASC","DESC"].map(i=>r.createElement(ue.Option,{key:i,value:i},i))))))};Jr.defaultProps={modifiedData:{},sortOptions:[]},Jr.propTypes={modifiedData:o().object,onChange:o().func.isRequired,sortOptions:o().array};const tC=Jr,Xr=S.default.button`
1140
- display: flex;
1141
- align-items: center;
1142
- height: ${({theme:e})=>e.spaces[7]};
1143
-
1144
- &:last-child {
1145
- padding: 0 ${({theme:e})=>e.spaces[3]};
1146
- }
1147
- `,nc=(0,S.default)(Xr)`
1148
- padding: 0 ${({theme:e})=>e.spaces[3]};
1149
- border-right: 1px solid ${({theme:e})=>e.colors.neutral150};
1150
- cursor: all-scroll;
1151
-
1152
- svg {
1153
- width: ${12/16}rem;
1154
- height: ${12/16}rem;
1155
- }
1156
- `,nC=(0,S.default)(j.Flex)`
1157
- max-height: ${32/16}rem;
1158
- cursor: pointer;
1159
-
1160
- svg {
1161
- width: ${10/16}rem;
1162
- height: ${10/16}rem;
1163
-
1164
- path {
1165
- fill: ${({theme:e})=>e.colors.neutral600};
1166
- }
1167
- }
1168
-
1169
- &:hover {
1170
- background-color: ${({theme:e})=>e.colors.primary100};
1171
- border-color: ${({theme:e})=>e.colors.primary200};
1172
-
1173
- svg {
1174
- path {
1175
- fill: ${({theme:e})=>e.colors.primary600};
1176
- }
1177
- }
1178
-
1179
- ${L.Typography} {
1180
- color: ${({theme:e})=>e.colors.primary600};
1181
- }
1182
-
1183
- ${nc} {
1184
- border-right: 1px solid ${({theme:e})=>e.colors.primary200};
1185
- }
1186
- }
1187
- `,rC=(0,S.default)(w.Box)`
1188
- &:last-child {
1189
- padding-right: ${({theme:e})=>e.spaces[3]};
1190
- }
1191
- `,rc=({index:e,isDraggingSibling:t,labelField:n,onClickEditField:a,onMoveField:s,onRemoveField:i,name:l,setIsDraggingSibling:u})=>{const{formatMessage:c}=(0,A.useIntl)(),d=(0,r.useRef)(null),m=(0,r.useRef)(null),[,f]=(0,r.useState)(!1),g=(0,r.useRef)(),h=uo(n),b=()=>{g.current&&g.current.click()},[,E]=(0,Te.useDrop)({accept:Pe.FIELD,hover(D,W){if(!m.current)return;const F=D.index,$=e;if(F===$)return;const N=m.current.getBoundingClientRect(),G=(N.right-N.left)/2,_=W.getClientOffset().x-N.left;F>$&&_>G||F<$&&_<G||(s(F,$),D.index=$)}}),[{isDragging:O},I,C]=(0,Te.useDrag)({type:Pe.FIELD,item:()=>({index:e,labelField:n,name:l}),collect:D=>({isDragging:D.isDragging()}),end:()=>{u(!1)}});(0,r.useEffect)(()=>{C((0,nn.rX)(),{captureDraggingState:!1})},[C]),(0,r.useEffect)(()=>{O&&u(!0)},[O,u]),(0,r.useEffect)(()=>{t||f(D=>!D)},[t]);const x={dragRef:I(d),dropRef:E(m)};return r.createElement(rC,{ref:x?x.dropRef:null},O&&r.createElement(Pn,{transparent:!0,labelField:h}),!O&&t&&r.createElement(Pn,{isSibling:!0,labelField:h}),!O&&!t&&r.createElement(nC,{borderColor:"neutral150",background:"neutral100",hasRadius:!0,justifyContent:"space-between",onClick:b,isDragging:O},r.createElement(ae.Stack,{horizontal:!0,spacing:3},r.createElement(nc,{as:"span","aria-label":c({id:v("components.DraggableCard.move.field"),defaultMessage:"Move {item}"},{item:l}),onClick:D=>D.stopPropagation(),ref:x.dragRef,type:"button"},r.createElement(rt(),null)),r.createElement(L.Typography,{fontWeight:"bold"},h)),r.createElement(j.Flex,{paddingLeft:3},r.createElement(Xr,{ref:g,onClick:D=>{D.stopPropagation(),a(l)},"aria-label":c({id:v("components.DraggableCard.edit.field"),defaultMessage:"Edit {item}"},{item:l}),type:"button"},r.createElement(ut(),null)),r.createElement(Xr,{onClick:i,"data-testid":`delete-${l}`,"aria-label":c({id:v("components.DraggableCard.delete.field"),defaultMessage:"Delete {item}"},{item:l}),type:"button"},r.createElement(vn(),null)))))};rc.propTypes={index:o().number.isRequired,isDraggingSibling:o().bool.isRequired,labelField:o().string.isRequired,name:o().string.isRequired,onClickEditField:o().func.isRequired,onMoveField:o().func.isRequired,onRemoveField:o().func.isRequired,setIsDraggingSibling:o().func.isRequired};const oC=rc,oc=(0,S.default)(w.Box)`
1192
- flex: ${({size:e})=>e};
1193
- `,aC=(0,S.default)(oc)`
1194
- overflow-x: scroll;
1195
- overflow-y: hidden;
1196
- `,sC=(0,S.default)(oc)`
1197
- max-width: ${32/16}rem;
1198
- `,ac=({displayedFields:e,listRemainingFields:t,metadatas:n,onAddField:a,onClickEditField:s,onMoveField:i,onRemoveField:l})=>{const{formatMessage:u}=(0,A.useIntl)(),[c,d]=(0,r.useState)(!1),[m,f]=(0,r.useState)(null),g=(0,r.useRef)();function h(...E){f("add"),a(...E)}function b(...E){f("remove"),l(...E)}return(0,r.useEffect)(()=>{m==="add"&&(g==null?void 0:g.current)&&(g.current.scrollLeft=g.current.scrollWidth)},[e,m]),r.createElement(r.Fragment,null,r.createElement(w.Box,{paddingBottom:4},r.createElement(L.Typography,{variant:"delta",as:"h2"},u({id:v("containers.SettingPage.view"),defaultMessage:"View"}))),r.createElement(j.Flex,{paddingTop:4,paddingLeft:4,paddingRight:4,borderColor:"neutral300",borderStyle:"dashed",borderWidth:"1px",hasRadius:!0},r.createElement(aC,{size:"1",paddingBottom:4,ref:g},r.createElement(ae.Stack,{horizontal:!0,spacing:3},e.map((E,O)=>r.createElement(oC,{key:E,index:O,isDraggingSibling:c,onMoveField:i,onClickEditField:s,onRemoveField:I=>b(I,O),name:E,labelField:n[E].list.label||E,setIsDraggingSibling:d})))),r.createElement(sC,{size:"auto",paddingBottom:4},r.createElement(Ae.SimpleMenu,{label:u({id:v("components.FieldSelect.label"),defaultMessage:"Add a field"}),as:Me.IconButton,icon:r.createElement(ft(),null),disabled:t.length<=0,"data-testid":"add-field"},t.map(E=>r.createElement(Ae.MenuItem,{key:E,onClick:()=>h(E)},E))))))};ac.propTypes={displayedFields:xe.PropTypes.array.isRequired,listRemainingFields:xe.PropTypes.array.isRequired,metadatas:xe.PropTypes.objectOf(xe.PropTypes.shape({list:xe.PropTypes.shape({label:xe.PropTypes.string})})).isRequired,onAddField:xe.PropTypes.func.isRequired,onClickEditField:xe.PropTypes.func.isRequired,onMoveField:xe.PropTypes.func.isRequired,onRemoveField:xe.PropTypes.func.isRequired};const iC=ac,lC=(0,S.default)(j.Flex)`
1199
- svg {
1200
- width: ${32/16}rem;
1201
- height: ${24/16}rem;
1202
- margin-right: ${({theme:e})=>e.spaces[3]};
1203
- }
1204
- `,sc=({attributes:e,fieldForm:t,fieldToEdit:n,onCloseModal:a,onChangeEditLabel:s,onSubmit:i,type:l})=>{const{formatMessage:u}=(0,A.useIntl)(),c=e[n].relationType;let d=!["media","relation"].includes(l);return["oneWay","oneToOne","manyToOne"].includes(c)&&(d=!0),r.createElement(Ye.ModalLayout,{onClose:a,labelledBy:"title"},r.createElement("form",{onSubmit:i},r.createElement(Ye.ModalHeader,null,r.createElement(lC,null,r.createElement(Yi,{type:l}),r.createElement(L.Typography,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title"},u({id:v("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:Ft()(n)})))),r.createElement(Ye.ModalBody,null,r.createElement(le.Grid,{gap:4},r.createElement(le.GridItem,{s:12,col:6},r.createElement(Qn.TextInput,{id:"label-input",label:u({id:v("form.Input.label"),defaultMessage:"Label"}),name:"label",onChange:m=>s(m),value:t.label,hint:u({id:v("form.Input.label.inputDescription"),defaultMessage:"This value overrides the label displayed in the table's head"})})),d&&r.createElement(le.GridItem,{s:12,col:6},r.createElement(At.ToggleInput,{"data-testid":"Enable sort on this field",checked:t.sortable,label:u({id:v("form.Input.sort.field"),defaultMessage:"Enable sort on this field"}),name:"sortable",onChange:m=>s({target:{name:"sortable",value:m.target.checked}}),onLabel:u({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:u({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"})})))),r.createElement(Ye.ModalFooter,{startActions:r.createElement(ye.Button,{onClick:a,variant:"tertiary"},u({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:r.createElement(ye.Button,{type:"submit"},u({id:"global.finish",defaultMessage:"Finish"}))})))};sc.propTypes={attributes:o().objectOf(o().shape({relationType:o().string})).isRequired,fieldForm:o().shape({label:o().string,sortable:o().bool}).isRequired,fieldToEdit:o().string.isRequired,onChangeEditLabel:o().func.isRequired,onCloseModal:o().func.isRequired,onSubmit:o().func.isRequired,type:o().string.isRequired};const cC=sc;var uC=Object.defineProperty,dC=Object.defineProperties,pC=Object.getOwnPropertyDescriptors,ic=Object.getOwnPropertySymbols,mC=Object.prototype.hasOwnProperty,fC=Object.prototype.propertyIsEnumerable,lc=(e,t,n)=>t in e?uC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gC=(e,t)=>{for(var n in t||(t={}))mC.call(t,n)&&lc(e,n,t[n]);if(ic)for(var n of ic(t))fC.call(t,n)&&lc(e,n,t[n]);return e},yC=(e,t)=>dC(e,pC(t));const hC=(e,t)=>yC(gC({},e),{initialData:t,modifiedData:t}),eo={fieldForm:{},fieldToEdit:"",initialData:{},modifiedData:{}},bC=(e=eo,t)=>(0,_t.default)(e,n=>{const a=["modifiedData","layouts","list"];switch(t.type){case"ADD_FIELD":{const s=R()(e,a,[]);ne()(n,a,[...s,t.item]);break}case"MOVE_FIELD":{const s=R()(e,a,[]),{originalIndex:i,atIndex:l}=t;ne()(n,a,Mt(s,i,l));break}case"ON_CHANGE":{ne()(n,["modifiedData",...t.keys.split(".")],t.value);break}case"ON_CHANGE_FIELD_METAS":{ne()(n,["fieldForm",t.name],t.value);break}case"REMOVE_FIELD":{const s=R()(e,a,[]);ne()(n,a,s.filter((i,l)=>t.index!==l));break}case"SET_FIELD_TO_EDIT":{const{fieldToEdit:s}=t;n.fieldToEdit=s,n.fieldForm.label=R()(n,["modifiedData","metadatas",s,"list","label"],""),n.fieldForm.sortable=R()(n,["modifiedData","metadatas",s,"list","sortable"],"");break}case"UNSET_FIELD_TO_EDIT":{n.fieldForm={},n.fieldToEdit="";break}case"SUBMIT_FIELD_FORM":{const s=["modifiedData","metadatas",e.fieldToEdit,"list"];ne()(n,[...s,"label"],e.fieldForm.label),ne()(n,[...s,"sortable"],e.fieldForm.sortable);break}default:return n}}),EC=["media","richtext","dynamiczone","relation","component","json"];var vC=(e,t,n)=>new Promise((a,s)=>{var i=c=>{try{u(n.next(c))}catch(d){s(d)}},l=c=>{try{u(n.throw(c))}catch(d){s(d)}},u=c=>c.done?a(c.value):Promise.resolve(c.value).then(i,l);u((n=n.apply(e,t)).next())});const cc=({layout:e,slug:t})=>{const{formatMessage:n}=(0,A.useIntl)(),{trackUsage:a}=(0,y.useTracking)(),s=Qo(),i=(0,y.useNotification)(),{refetchData:l}=(0,r.useContext)(mo),[u,c]=(0,r.useState)(!1),d=()=>c(P=>!P),[m,f]=(0,r.useState)(!1),g=()=>f(P=>!P),[h,b]=(0,r.useReducer)(bC,eo,()=>hC(eo,e)),{fieldToEdit:E,fieldForm:O,initialData:I,modifiedData:C}=h,{attributes:x}=e,D=C.layouts.list,W=()=>{const{settings:{pageSize:P,defaultSortBy:M,defaultSortOrder:H},kind:re,uid:ce}=I,me=`${M}:${H}`,Fe=`${(0,We.stringify)({page:1,pageSize:P,sort:me},{encode:!1})}${s?`&${s}`:""}`;return`/content-manager/${re}/${ce}?${Fe}`},F=({target:{name:P,value:M}})=>{b({type:"ON_CHANGE",keys:P,value:P==="settings.pageSize"?parseInt(M,10):M})},$=()=>vC(void 0,null,function*(){const P=Fi()(C,["layouts","settings","metadatas"]);B.mutate(P)}),N=P=>{b({type:"ADD_FIELD",item:P})},G=(P,M)=>{P.stopPropagation(),D.length===1?i({type:"info",message:{id:v("notification.info.minimumFields")}}):b({type:"REMOVE_FIELD",index:M})},V=P=>{P.preventDefault(),d(),a("willSaveContentTypeLayout")},_=P=>{b({type:"SET_FIELD_TO_EDIT",fieldToEdit:P}),g()},k=()=>{b({type:"UNSET_FIELD_TO_EDIT"}),g()},Z=P=>{P.preventDefault(),g(),b({type:"SUBMIT_FIELD_FORM"})},B=(0,Sr.useMutation)(P=>Xv(P,t),{onSuccess:()=>{a("didEditListSettings"),l()},onError:()=>{i({type:"warning",message:{id:"notification.error"}})}}),{isLoading:Y}=B,T=({target:{name:P,value:M}})=>{b({type:"ON_CHANGE_FIELD_METAS",name:P,value:M})},z=Object.entries(x).reduce((P,M)=>{const[H,re]=M,ce=bo(re),me=D.includes(H);return ce&&!me&&P.push(H),P},[]).sort(),Q=Object.entries(x).reduce((P,M)=>{const[H,{type:re}]=M;return EC.includes(re)||P.push(H),P},[]),K=(P,M)=>{b({type:"MOVE_FIELD",originalIndex:P,atIndex:M})};return r.createElement(X.Layout,null,r.createElement(oe.Main,{"aria-busy":Y},r.createElement("form",{onSubmit:V},r.createElement(X.HeaderLayout,{navigationAction:r.createElement(ot.Link,{startIcon:r.createElement(un(),null),to:W,id:"go-back"},n({id:"global.back",defaultMessage:"Back"})),primaryAction:r.createElement(ye.Button,{size:"L",startIcon:r.createElement(bt(),null),disabled:an()(C,I),type:"submit"},n({id:"global.save",defaultMessage:"Save"})),subtitle:n({id:v("components.SettingsViewWrapper.pluginHeader.description.list-settings"),defaultMessage:"Define the settings of the list view."}),title:n({id:v("components.SettingsViewWrapper.pluginHeader.title"),defaultMessage:"Configure the view - {name}"},{name:Ft()(C.info.displayName)})}),r.createElement(X.ContentLayout,null,r.createElement(w.Box,{background:"neutral0",hasRadius:!0,shadow:"tableShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},r.createElement(tC,{modifiedData:C,onChange:F,sortOptions:Q}),r.createElement(w.Box,{paddingTop:6,paddingBottom:6},r.createElement(Qt.Divider,null)),r.createElement(iC,{listRemainingFields:z,displayedFields:D,onAddField:N,onClickEditField:_,onMoveField:K,onRemoveField:G,metadatas:C.metadatas}))),r.createElement(y.ConfirmDialog,{bodyText:{id:v("popUpWarning.warning.updateAllSettings"),defaultMessage:"This will modify all your settings"},iconRightButton:r.createElement(bt(),null),isConfirmButtonLoading:Y,isOpen:u,onToggleDialog:d,onConfirm:$,variantRightButton:"success-light"})),m&&r.createElement(cC,{attributes:x,fieldForm:O,fieldToEdit:E,onChangeEditLabel:T,onCloseModal:k,onSubmit:Z,type:R()(x,[E,"type"],"text")})))};cc.propTypes={layout:o().shape({uid:o().string.isRequired,settings:o().shape({bulkable:o().bool,defaultSortBy:o().string,defaultSortOrder:o().string,filterable:o().bool,pageSize:o().number,searchable:o().bool}).isRequired,metadatas:o().object.isRequired,options:o().object.isRequired,attributes:o().objectOf(o().shape({type:o().string})).isRequired}).isRequired,slug:o().string.isRequired};const CC=(0,r.memo)(cc),uc=De.Z.contentManager,dc=({match:{params:{slug:e},url:t}})=>{const{isLoading:n,layout:a,updateLayout:s}=zo(e),{rawContentTypeLayout:i,rawComponentsLayouts:l}=(0,r.useMemo)(()=>{let m={},f={};return a.contentType&&(m=Ut(a.contentType)),a.components&&(f=Object.keys(a.components).reduce((g,h)=>(g[h]=Ut(a.components[h]),g),{})),{rawContentTypeLayout:m,rawComponentsLayouts:f}},[a]);if((0,q.get)(a,["contentType","uid"],null)!==e||n)return r.createElement(y.LoadingIndicatorPage,null);const c=({location:{state:m},history:{goBack:f},match:{params:{id:g,origin:h}}},b)=>r.createElement(b,{slug:e,layout:a,state:m,goBack:f,id:g,origin:h}),d=[{path:"create/clone/:origin",comp:pn},{path:"create",comp:pn},{path:":id",comp:pn},{path:"",comp:Jv}].map(({path:m,comp:f})=>r.createElement(te.Route,{key:m,path:`${t}/${m}`,render:g=>c(g,f)}));return r.createElement(Bc.SV,{FallbackComponent:y.ErrorFallback},r.createElement(fo.Provider,{value:a},r.createElement(te.Switch,null,r.createElement(te.Route,{path:`${t}/configurations/list`},r.createElement(y.CheckPagePermissions,{permissions:uc.collectionTypesConfigurations},r.createElement(CC,{layout:i,slug:e,updateLayout:s}))),r.createElement(te.Route,{path:`${t}/configurations/edit`},r.createElement(y.CheckPagePermissions,{permissions:uc.collectionTypesConfigurations},r.createElement(Wr,{components:l,isContentTypeView:!0,mainLayout:i,slug:e,updateLayout:s}))),d)))};dc.propTypes={match:o().shape({url:o().string.isRequired,params:o().shape({slug:o().string.isRequired}).isRequired}).isRequired};const OC=(0,r.memo)(dc);var pc=p(67578),PC=p(98399),RC=(e,t,n)=>new Promise((a,s)=>{var i=c=>{try{u(n.next(c))}catch(d){s(d)}},l=c=>{try{u(n.throw(c))}catch(d){s(d)}},u=c=>c.done?a(c.value):Promise.resolve(c.value).then(i,l);u((n=n.apply(e,t)).next())});const MC=De.Z.contentManager,TC=()=>{const[{isLoading:e,data:t},n]=(0,r.useReducer)(pc.Z,pc.q),a=(0,r.useMemo)(xn,[]),{schemas:s}=(0,fe.v9)(l=>a(l),fe.wU),{uid:i}=(0,te.useParams)();return(0,r.useEffect)(()=>{const u=Se().CancelToken.source();return(d=>RC(void 0,null,function*(){try{n(on());const{data:{data:m}}=yield ge.be.get(ve(`components/${i}/configuration`),{cancelToken:d.token});n(vr(xo(m,s,"component")))}catch(m){if(Se().isCancel(m))return;PC.error(m)}}))(u),()=>{u.cancel("Operation canceled by the user.")}},[i,s]),e?r.createElement(y.LoadingIndicatorPage,null):r.createElement(y.CheckPagePermissions,{permissions:MC.componentsConfigurations},r.createElement(Wr,{components:t.components,mainLayout:t.component,slug:i}))},wC=(0,r.memo)(TC);var IC=p(64354),DC=p(97042),xC=p.n(DC);const SC=()=>{const{formatMessage:e}=(0,A.useIntl)();return(0,y.useFocusWhenNavigate)(),r.createElement(oe.Main,null,r.createElement(X.HeaderLayout,{title:e({id:v("header.name"),defaultMessage:"Content"})}),r.createElement(X.ContentLayout,null,r.createElement(IC.EmptyStateLayout,{action:r.createElement(Kt.LinkButton,{variant:"secondary",startIcon:r.createElement(ft(),null),to:"/plugins/content-type-builder/content-types/create-content-type"},e({id:"app.components.HomePage.create",defaultMessage:"Create your first Content-type"})),content:e({id:"content-manager.pages.NoContentType.text",defaultMessage:"You don't have any content yet, we recommend you to create your first Content-Type."}),hasRadius:!0,icon:r.createElement(xC(),{width:"10rem"}),shadow:"tableShadow"})))},LC=()=>{const{formatMessage:e}=(0,A.useIntl)();return(0,y.useFocusWhenNavigate)(),r.createElement(oe.Main,null,r.createElement(X.HeaderLayout,{title:e({id:v("header.name"),defaultMessage:"Content"})}),r.createElement(X.ContentLayout,null,r.createElement(y.NoPermissions,null)))},FC=De.Z.contentManager,mc=({match:{params:{slug:e},url:t}})=>{const{isLoading:n,layout:a,updateLayout:s}=zo(e),{rawContentTypeLayout:i,rawComponentsLayouts:l}=(0,r.useMemo)(()=>{let u={},c={};return a.contentType&&(c=Ut(a.contentType)),a.components&&(u=Object.keys(a.components).reduce((d,m)=>(d[m]=Ut(a.components[m]),d),{})),{rawContentTypeLayout:c,rawComponentsLayouts:u}},[a]);return n?r.createElement(y.LoadingIndicatorPage,null):r.createElement(fo.Provider,{value:a},r.createElement(te.Switch,null,r.createElement(te.Route,{path:`${t}/configurations/edit`},r.createElement(y.CheckPagePermissions,{permissions:FC.singleTypesConfigurations},r.createElement(Wr,{components:l,isContentTypeView:!0,mainLayout:i,slug:e,updateLayout:s}))),r.createElement(te.Route,{path:t,render:({location:{state:u},history:{goBack:c}})=>r.createElement(pn,{layout:a,slug:e,isSingleType:!0,state:u,goBack:c})})))};mc.propTypes={match:o().shape({url:o().string.isRequired,params:o().shape({slug:o().string.isRequired}).isRequired}).isRequired};const kC=(0,r.memo)(mc);var Nt=p(6404),AC=p(58469),jC=p(59578),fc=p.n(jC),$C=Object.defineProperty,BC=Object.defineProperties,NC=Object.getOwnPropertyDescriptors,gc=Object.getOwnPropertySymbols,VC=Object.prototype.hasOwnProperty,qC=Object.prototype.propertyIsEnumerable,yc=(e,t,n)=>t in e?$C(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,WC=(e,t)=>{for(var n in t||(t={}))VC.call(t,n)&&yc(e,n,t[n]);if(gc)for(var n of gc(t))qC.call(t,n)&&yc(e,n,t[n]);return e},zC=(e,t)=>BC(e,NC(t));const hc=(e,t)=>(0,AC.ZP)(e,fc()(t),{keys:[n=>fc()(n.title)]}),UC=()=>{const[e,t]=(0,r.useState)(""),{formatMessage:n}=(0,A.useIntl)(),a=(0,r.useMemo)(Fu,[]),{collectionTypeLinks:s,singleTypeLinks:i}=(0,fe.v9)(h=>a(h),fe.wU),l=h=>h.map(b=>zC(WC({},b),{title:n({id:b.title,defaultMessage:b.title})})),u=l(s),c=l(i),d=[{id:"collectionTypes",title:{id:v("components.LeftMenu.collection-types"),defaultMessage:"Collection Types"},searchable:!0,links:se()(hc(u,e),h=>h.title.toLowerCase())},{id:"singleTypes",title:{id:v("components.LeftMenu.single-types"),defaultMessage:"Single Types"},searchable:!0,links:se()(hc(c,e),h=>h.title.toLowerCase())}],m=()=>{t("")},f=({target:{value:h}})=>{t(h)},g=n({id:v("header.name"),defaultMessage:"Content"});return r.createElement(Nt.SubNav,{ariaLabel:g},r.createElement(Nt.SubNavHeader,{label:g,searchable:!0,value:e,onChange:f,onClear:m,searchLabel:n({id:"content-manager.components.LeftMenu.Search.label",defaultMessage:"Search for a content type"})}),r.createElement(Nt.SubNavSections,null,d.map(h=>{const b=n({id:h.title.id,defaultMessage:h.title.defaultMessage},h.title.values);return r.createElement(Nt.SubNavSection,{key:h.id,label:b,badgeLabel:h.links.length.toString()},h.links.map(E=>{const O=E.search?`?${E.search}`:"";return r.createElement(Nt.SubNavLink,{key:E.uid,to:`${E.to}${O}`},E.title)}))})))};var to=p(14925);const HC=()=>({type:to.ZA}),_C=()=>({type:to.c2}),ZC=(e,t,n,a)=>({type:to.ix,data:{authorizedCtLinks:e,authorizedStLinks:t,components:a,contentTypeSchemas:n}}),bc=(e,t,n=[])=>e.filter(a=>a.isDisplayed).map(a=>{const s=[{action:"plugin::content-manager.explorer.create",subject:a.uid},{action:"plugin::content-manager.explorer.read",subject:a.uid}],i=[{action:"plugin::content-manager.explorer.read",subject:a.uid}],l=t==="collectionTypes"?s:i,u=n.find(({uid:d})=>d===a.uid);let c=null;if(u){const d={page:1,pageSize:u.settings.pageSize,sort:`${u.settings.defaultSortBy}:${u.settings.defaultSortOrder}`};c=(0,We.stringify)(d,{encode:!1})}return{permissions:l,search:c,kind:a.kind,title:a.info.displayName,to:`/content-manager/${a.kind}/${a.uid}`,uid:a.uid,name:a.uid,isDisplayed:a.isDisplayed}}),GC=(e,t)=>{const[n,a]=(0,q.chain)(e).groupBy("kind").map((s,i)=>({name:i,links:s})).sortBy("name").value();return{collectionTypesSectionLinks:bc((0,q.get)(n,"links",[]),"collectionTypes",t),singleTypesSectionLinks:bc((0,q.get)(a,"links",[]),"singleTypes")}},Ec=(e,t)=>t.map(({permissions:n})=>(0,y.hasPermissions)(e,n));var QC=p(98399),KC=(e,t,n)=>new Promise((a,s)=>{var i=c=>{try{u(n.next(c))}catch(d){s(d)}},l=c=>{try{u(n.throw(c))}catch(d){s(d)}},u=c=>c.done?a(c.value):Promise.resolve(c.value).then(i,l);u((n=n.apply(e,t)).next())});const YC=(e,t,n)=>KC(void 0,null,function*(){try{const{data:{data:a}}=yield ge.be.get(ve("content-types-settings")),{collectionTypesSectionLinks:s,singleTypesSectionLinks:i}=GC(e,a),l=Ec(t,s),u=yield Promise.all(l),c=s.filter((g,h)=>u[h]),d=Ec(t,i),m=yield Promise.all(d),f=i.filter((g,h)=>m[h]);return{authorizedCtLinks:c,authorizedStLinks:f}}catch(a){return QC.error(a),n({type:"warning",message:{id:"notification.error"}}),{authorizedCtLinks:[],authorizedStLinks:[],contentTypes:[]}}});var JC=p(98399),XC=Object.defineProperty,eO=Object.defineProperties,tO=Object.getOwnPropertyDescriptors,vc=Object.getOwnPropertySymbols,nO=Object.prototype.hasOwnProperty,rO=Object.prototype.propertyIsEnumerable,Cc=(e,t,n)=>t in e?XC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,oO=(e,t)=>{for(var n in t||(t={}))nO.call(t,n)&&Cc(e,n,t[n]);if(vc)for(var n of vc(t))rO.call(t,n)&&Cc(e,n,t[n]);return e},aO=(e,t)=>eO(e,tO(t)),sO=(e,t,n)=>new Promise((a,s)=>{var i=c=>{try{u(n.next(c))}catch(d){s(d)}},l=c=>{try{u(n.throw(c))}catch(d){s(d)}},u=c=>c.done?a(c.value):Promise.resolve(c.value).then(i,l);u((n=n.apply(e,t)).next())});const iO=()=>{const e=(0,fe.I0)(),t=(0,y.useNotification)(),n=(0,fe.v9)(Dt()),a=(0,r.useRef)(),{allPermissions:s}=(0,y.useRBACProvider)(),{runHookWaterfall:i}=(0,y.useStrapiApp)(),u=Se().CancelToken.source(),{notifyStatus:c}=(0,Ur.useNotifyAT)(),{formatMessage:d}=(0,A.useIntl)(),m=()=>sO(void 0,null,function*(){e(HC());try{const[{data:{data:f}},{data:{data:g}}]=yield Promise.all(["components","content-types"].map(C=>ge.be.get(ve(C),{cancelToken:u.token})));c(d({id:v("App.schemas.data-loaded"),defaultMessage:"The schemas have been successfully loaded."}));const{authorizedCtLinks:h,authorizedStLinks:b}=yield YC(g,s,t),{ctLinks:E}=i(Gt.LK,{ctLinks:h,models:g}),{stLinks:O}=i(Gt.dV,{stLinks:b,models:g}),I=ZC(E,O,g,f);e(I)}catch(f){if(Se().isCancel(f))return;JC.error(f),t({type:"warning",message:{id:"notification.error"}})}});return a.current=m,(0,r.useEffect)(()=>(a.current(),()=>{u.cancel("Operation canceled by the user."),e(_C())}),[e,t]),aO(oO({},n),{refetchData:a.current})},lO=De.Z.contentManager,Oc=()=>{const e=(0,te.useRouteMatch)("/content-manager/:kind/:uid"),{status:t,collectionTypeLinks:n,singleTypeLinks:a,models:s,refetchData:i}=iO(),l=se()([...n,...a],g=>g.title.toLowerCase()),{pathname:u}=(0,te.useLocation)(),{formatMessage:c}=(0,A.useIntl)(),{startSection:d}=(0,y.useGuidedTour)(),m=(0,r.useRef)(d);if((0,r.useEffect)(()=>{m.current&&m.current("contentManager")},[]),t==="loading")return r.createElement(oe.Main,{"aria-busy":"true"},r.createElement(X.HeaderLayout,{title:c({id:v("header.name"),defaultMessage:"Content"})}),r.createElement(y.LoadingIndicatorPage,null));const f=s.filter(({isDisplayed:g})=>g);return l.length===0&&f.length>0&&u!=="/content-manager/403"?r.createElement(te.Redirect,{to:"/content-manager/403"}):f.length===0&&u!=="/content-manager/no-content-types"?r.createElement(te.Redirect,{to:"/content-manager/no-content-types"}):!e&&l.length>0?r.createElement(te.Redirect,{to:`${l[0].to}${l[0].search?`?${l[0].search}`:""}`}):r.createElement(X.Layout,{sideNav:r.createElement(UC,null)},r.createElement($c,null),r.createElement(mo.Provider,{value:{refetchData:i}},r.createElement(te.Switch,null,r.createElement(te.Route,{path:"/content-manager/components/:uid/configurations/edit"},r.createElement(y.CheckPagePermissions,{permissions:lO.componentsConfigurations},r.createElement(wC,null))),r.createElement(te.Route,{path:"/content-manager/collectionType/:slug",component:OC}),r.createElement(te.Route,{path:"/content-manager/singleType/:slug",component:kC}),r.createElement(te.Route,{path:"/content-manager/403"},r.createElement(LC,null)),r.createElement(te.Route,{path:"/content-manager/no-content-types"},r.createElement(SC,null)),r.createElement(te.Route,{path:"",component:y.NotFound}))))},cO=()=>{const{formatMessage:e}=(0,A.useIntl)();return r.createElement(r.Fragment,null,r.createElement(ct.Helmet,{title:e({id:v("plugin.name"),defaultMessage:"Content Manager"})}),r.createElement(Oc,null))}},57544:()=>{},59599:()=>{},42310:()=>{},33842:()=>{},85695:()=>{}}]);