slice-machine-ui 2.3.1-beta.6 → 2.3.1-beta.8

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 (49) hide show
  1. package/out/404.html +1 -1
  2. package/out/_next/static/{BYX3lrf2WNCjipk8J_g8B → 4OywHdm4ktJ4KP6dpPtdt}/_buildManifest.js +1 -1
  3. package/out/_next/static/chunks/{18539003-059b491c0b76757a.js → 18539003-8429c4c48ccee432.js} +15 -15
  4. package/out/_next/static/chunks/448-04106caae9b8c06f.js +1 -0
  5. package/out/_next/static/chunks/574-05cd6a55733bfa63.js +1 -0
  6. package/out/_next/static/chunks/{802-72ceb03e414202ee.js → 802-0be9bb20fc0d40d4.js} +1 -1
  7. package/out/_next/static/chunks/pages/{_app-d1a873a080e65564.js → _app-917a74cd103f816b.js} +64 -64
  8. package/out/_next/static/chunks/pages/{changelog-cbafb05b25714889.js → changelog-40f8a853383eb4e7.js} +1 -1
  9. package/out/_next/static/chunks/pages/{changes-5b897a4267b76a20.js → changes-b8bf02c66be6ae1f.js} +1 -1
  10. package/out/_next/static/chunks/pages/{labs-445e30efa64531d0.js → labs-8c10ebf645f94206.js} +1 -1
  11. package/out/_next/static/chunks/pages/{settings-0c5d282867dc559a.js → settings-450b9f78216aa406.js} +1 -1
  12. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-ce1390f846a94d24.js +1 -0
  13. package/out/_next/static/chunks/pages/{slices-cc1865f601dca9df.js → slices-e13ad016b19446e7.js} +1 -1
  14. package/out/_next/static/css/df83243fff0d6412.css +1 -0
  15. package/out/changelog.html +1 -1
  16. package/out/changes.html +1 -1
  17. package/out/custom-types/[customTypeId].html +1 -1
  18. package/out/custom-types.html +1 -1
  19. package/out/index.html +1 -1
  20. package/out/labs.html +1 -1
  21. package/out/page-types/[pageTypeId].html +1 -1
  22. package/out/settings.html +1 -1
  23. package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
  24. package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
  25. package/out/slices.html +1 -1
  26. package/package.json +7 -6
  27. package/src/features/builder/AddFieldDropdown.tsx +5 -1
  28. package/src/features/onboarding/OnboardingGuide/OnboardingGuide.module.css +21 -0
  29. package/src/features/onboarding/OnboardingGuide/OnboardingGuide.module.css.d.ts +8 -0
  30. package/src/features/onboarding/OnboardingGuide/OnboardingGuide.tsx +90 -0
  31. package/src/features/onboarding/OnboardingGuide/index.ts +1 -0
  32. package/src/features/onboarding/OnboardingProgressStepper.tsx +3 -1
  33. package/src/features/onboarding/OnboardingProvider.tsx +10 -1
  34. package/src/features/onboarding/OnboardingStepDialog/OnboardingStepDialog.tsx +8 -5
  35. package/src/features/settings/git/GitRepositoryConnectDialog.tsx +19 -15
  36. package/src/features/settings/git/GitRepositoryDisconnectDialog.tsx +14 -12
  37. package/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewSliceDialog.tsx +13 -10
  38. package/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewVariationDialog.tsx +15 -10
  39. package/src/features/slices/convertLegacySlice/ConvertLegacySliceMergeWithIdenticalDialog.tsx +13 -10
  40. package/src/legacy/components/ChangesItems/DevCollaborationExperiment.tsx +12 -9
  41. package/src/legacy/components/DeleteVariationModal/index.tsx +14 -11
  42. package/src/legacy/components/Forms/RenameVariationModal/RenameVariationModal.tsx +13 -10
  43. package/src/legacy/lib/builders/SliceBuilder/FieldZones/index.tsx +8 -8
  44. package/out/_next/static/chunks/448-183e650f05037eef.js +0 -1
  45. package/out/_next/static/chunks/574-1a2168b3d4479624.js +0 -1
  46. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-628fd7717e5e7678.js +0 -1
  47. package/out/_next/static/css/fbc38696c23ee168.css +0 -1
  48. package/src/features/onboarding/OnboardingGuide.tsx +0 -55
  49. /package/out/_next/static/{BYX3lrf2WNCjipk8J_g8B → 4OywHdm4ktJ4KP6dpPtdt}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[448],{15448:function(e,n,t){"use strict";t.d(n,{H:function(){return nu}});var i=t(52322),r=t(37577),o=t(97729),l=t.n(o),a=t(5632),s=t(2784),c=t(56580),u=t(42770),d=t(65563),m=t(90104),f=t(99526),h=t(83981),p=t(22710),v=t(99267),x=t(74217),y=t(12189),b=t(35393),j=t(8794),g=t(7342),C=t(64837),S=(0,s.createContext)(void 0);function I(e){var n=e.children,t=e.initialCustomType,r=(0,s.useState)(t),o=r[0],l=r[1],a=(0,d.y6)(o),c=C.$[a],u=(0,j.c)({errorMessage:c.autoSaveFailed}),m=u.actionQueueStatus,f=u.setNextAction,h=(0,g.Z)().saveCustomTypeSuccess,I=(0,x.R9)(h),w=(0,b.g)().syncChanges,_=(0,s.useCallback)(function(e){l(e),f((0,p.Z)(function(){var n;return(0,v.__generator)(this,function(t){switch(t.label){case 0:return[4,(0,y.KA)(e)];case 1:if((n=t.sent().errors).length>0)throw n;return I(e),w(),[2]}})}))},[f,I,w]),T=(0,s.useMemo)(function(){return{actionQueueStatus:m,customType:o,setCustomType:_}},[m,o,_]);return(0,i.jsx)(S.Provider,{value:T,children:"function"==typeof n?n(T):n})}function w(){var e=(0,s.useContext)(S);if(!e)throw Error("CustomTypeProvider not found");return e}var _=t(33476),T=t(4995),Z=t(62230),k=t(98240),D=t(63397),N=t(75289),L=function(e){var n=e.name,t=e.label,r=e.placeholder,o=e.error,l=(0,k.Z)(e,["name","label","placeholder","error"]);return(0,i.jsxs)(N.xu,{mb:3,children:[(0,i.jsx)(N.__,{htmlFor:n,mb:2,children:t}),(0,i.jsx)(D.gN,(0,Z.Z)({name:n,type:"text",placeholder:r,as:N.II,autoComplete:"off"},l)),o?(0,i.jsx)(N.xv,{sx:{color:"error",mt:1},children:o}):null]})},M=function(e){var n=e.isOpen,t=e.onSubmit,r=e.close,o=e.tabIds;return(0,i.jsx)(T.Z,{isOpen:n,widthInPx:"530px",formId:"create-tab",close:r,onSubmit:function(e){t(e),r()},initialValues:{id:""},validate:function(e){var n=e.id;return n?o.includes(n.toLowerCase())?{id:"Tab exists already"}:void 0:{id:"Tab ID is required"}},content:{title:"Add Tab"},children:function(e){var n=e.errors;return(0,i.jsx)(L,{name:"id",label:"New Tab ID",placeholder:"A label for selecting the tab (i.e. not used in the API)",error:n.id})}})},V=function(e){var n=e.isOpen,t=e.onSubmit,r=e.close;return(0,i.jsx)(T.Z,{omitFooter:!0,isOpen:n,widthInPx:"530px",formId:"create-tab",close:r,cardProps:{bodySx:{p:0}},onSubmit:function(e){t(e),r()},initialValues:{},content:{title:"Remove Tab"},children:function(){return(0,i.jsxs)(N.xu,{sx:{px:4,py:4},children:[(0,i.jsx)(N.X6,{as:"h4",children:"Remove this tab?"}),(0,i.jsx)(N.xv,{as:"p",color:"textClear",sx:{mt:2},children:"This action cannot be undone."}),(0,i.jsx)(N.zx,{type:"button",variant:"buttons.actionDelete",sx:{mt:3},onClick:function(){t({}),r()},children:"Yes, remove tab"})]})}})},F=function(e){var n=e.isOpen,t=e.onSubmit,r=e.close,o=e.tabIds,l=e.initialTabKey;return(0,i.jsx)(T.Z,{omitFooter:!0,isOpen:n,widthInPx:"530px",formId:"create-tab",close:r,cardProps:{bodySx:{p:0}},onSubmit:function(e){t(e),r()},initialValues:{id:l},validate:function(e){var n=e.id;return n?o.includes(n.toLowerCase())?{id:"Tab exists already"}:void 0:{id:"Tab ID is required"}},content:{title:"Rename Tab"},children:function(e){var n=e.errors,o=e.values,l=e.setFieldValue,a=e.isValid;return(0,i.jsxs)(N.xu,{sx:{px:4,py:4},children:[(0,i.jsx)(L,{name:"id",label:"Rename Tab ID",placeholder:"A label for selecting the tab (i.e. not used in the API)",error:n.id,onBlur:function(e){o.id!==e.target.value&&l("id",e.target.value.trim())},onChange:function(e){l("id",e.target.value)}}),(0,i.jsx)(N.zx,{type:"button",sx:{mt:3,width:"100%"},disabled:!a,onClick:function(){o.id&&o.id.length&&t({id:o.id.trim()}),r()},children:"Save"})]})}})},E=t(81541),A=t(28316),P=t(85513),z=t(16991),H=t(58514),R=t(50535),B=t(55197),O=t(21112),K=t(1411),U=t(75843),X=t(85244),Q=t(88932),G=t(65077),W=t(9502),q=function(e){return(0,i.jsxs)("svg",(0,X.Z)((0,Z.Z)({width:"127",height:"98",viewBox:"0 0 127 98",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,i.jsx)("path",{d:"M73.5 44.5H85",stroke:"#17151F",strokeLinecap:"round"}),(0,i.jsx)("path",{d:"M35 68.5H40.5H92C93.1046 68.5 94 67.6046 94 66.5V39C94 37.8954 93.1046 37 92 37H35C33.8954 37 33 37.8954 33 39V66.5C33 67.6046 33.8954 68.5 35 68.5Z",fill:"#F4F2F4",stroke:"#17151F"}),(0,i.jsx)("path",{d:"M38 60.5H41.0381H89C89.5523 60.5 90 60.0523 90 59.5V52C90 51.4477 89.5523 51 89 51H38C37.4477 51 37 51.4477 37 52V59.5C37 60.0523 37.4477 60.5 38 60.5Z",fill:"#6E56CF",stroke:"#17151F"}),(0,i.jsx)("circle",{cx:"89.5",cy:"44.5",r:"0.5",fill:"#17151F"}),(0,i.jsx)("path",{d:"M40.5 97.5V56H86V97.5H40.5Z",fill:"#F9F8F9",stroke:"#17151F"}),(0,i.jsx)("rect",{x:"47",y:"75",width:"33",height:"16",fill:"#E4E2E4"}),(0,i.jsx)("path",{d:"M48 57H52V70C52 71.1046 51.1046 72 50 72V72C48.8954 72 48 71.1046 48 70V57Z",fill:"#E4E2E4"}),(0,i.jsx)("path",{d:"M55 57H59V70C59 71.1046 58.1046 72 57 72V72C55.8954 72 55 71.1046 55 70V57Z",fill:"#E4E2E4"}),(0,i.jsx)("path",{d:"M62 57H66V70C66 71.1046 65.1046 72 64 72V72C62.8954 72 62 71.1046 62 70V57Z",fill:"#E4E2E4"}),(0,i.jsx)("line",{x1:"0.353553",y1:"35.9856",x2:"15.5467",y2:"51.1787",stroke:"#C8C7CB"}),(0,i.jsx)("line",{x1:"42.1959",y1:"0.87059",x2:"47.7569",y2:"21.6248",stroke:"#C8C7CB"}),(0,i.jsx)("line",{x1:"99.5522",y1:"8.4091",x2:"87.2281",y2:"26.0097",stroke:"#C8C7CB"}),(0,i.jsx)("line",{x1:"126.408",y1:"41.0849",x2:"108.807",y2:"53.4089",stroke:"#C8C7CB"}),(0,i.jsx)("path",{d:"M39.8713 47C38.7657 47 38.0627 46.4554 38.0033 45.6337L38 45.5875H38.8251L38.8284 45.6205C38.868 46.0198 39.2937 46.2838 39.8977 46.2838C40.4719 46.2838 40.8746 46 40.8746 45.5908V45.5875C40.8746 45.2442 40.6271 45.0363 40.0132 44.9043L39.5017 44.7987C38.5281 44.5941 38.1056 44.1386 38.1056 43.429V43.4257C38.1056 42.5743 38.8383 42 39.868 42C40.9241 42 41.5809 42.5776 41.6403 43.3432L41.6436 43.3861H40.8284L40.8218 43.3465C40.7624 42.9769 40.4092 42.7129 39.8647 42.7162C39.3366 42.7162 38.9604 42.9637 38.9604 43.3696V43.3729C38.9604 43.7096 39.2013 43.9208 39.7954 44.0462L40.3069 44.1551C41.3102 44.3663 41.7294 44.769 41.7294 45.4884V45.4917C41.7294 46.4191 41.0132 47 39.8713 47Z",fill:"black"}),(0,i.jsx)("path",{d:"M42.6865 46.8812V42.1188H43.6634L45.0957 45.7822H45.1518L46.5809 42.1188H47.5578V46.8812H46.7921V43.495H46.7327L45.4125 46.8812H44.8317L43.5116 43.495H43.4554V46.8812H42.6865Z",fill:"black"})]}))},Y=function(e){var n=e.openCreateSliceModal,t=e.openUpdateSliceZoneModal,o=e.openSlicesTemplatesModal,l=e.projectHasAvailableSlices,a=e.isSlicesTemplatesSupported;return(0,i.jsx)(r.xu,{flexGrow:1,justifyContent:"center","data-testid":"slice-zone-blank-slate",children:(0,i.jsx)(W.R$,{backgroundImage:"/blank-slate-slice-zone.png",children:(0,i.jsxs)(W.T9,{children:[(0,i.jsx)(r.xu,{justifyContent:"center",padding:{bottom:16},children:(0,i.jsx)(q,{})}),(0,i.jsx)(W._T,{children:"Add slices"}),(0,i.jsx)(W.nf,{children:"Slices are website sections that you can reuse on different pages with different content. Each slice has its own component in your code."}),(0,i.jsx)(W.Qj,{children:(0,i.jsxs)(r.S0,{children:[(0,i.jsx)(r.F8,{startIcon:"add",onClick:n,description:"Start from scratch.",children:"Create new"}),a?(0,i.jsx)(r.F8,{startIcon:"contentCopy",onClick:o,description:"Select from premade examples.",endAdornment:(0,i.jsx)(r.Ct,{color:"purple",title:"New"}),children:"Use template"}):void 0,l?(0,i.jsx)(r.F8,{startIcon:"folder",onClick:t,description:"Select from your own slices.",children:"Select existing"}):void 0]})})]})})})};function $(e){var n=e.customType,t=e.tabId,i=e.slices,r=(0,Z.Z)({},n);return i.forEach(function(e){r=(0,X.Z)((0,Z.Z)({},r),{tabs:r.tabs.map(function(n){return n.key===t&&n.sliceZone?(0,X.Z)((0,Z.Z)({},n),{sliceZone:{key:n.sliceZone.key,value:[{key:e.id,value:e},].concat((0,E.Z)(n.sliceZone.value))}}):n})})}),y.Xe.track({event:"custom-type:slice-zone-updated",customTypeId:n.id}),r}var J=t(17064),ee=t(18566),en=t(7604);function et(){return ei.apply(this,arguments)}function ei(){return(ei=(0,p.Z)(function(){var e,n,t;return(0,v.__generator)(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,en.j.sliceTemplateLibrary.readLibrary({})];case 1:if(n=(e=i.sent()).templates,(t=e.errors).length>0)throw t;return[2,n.map(function(e){return{model:e.model,screenshots:Object.fromEntries(Object.entries(e.screenshots).map(function(e){var n=(0,J.Z)(e,2),t=n[0],i=n[1];return[t,URL.createObjectURL(i),]}))}})];case 2:return i.sent(),[2,[]];case 3:return[2]}})})).apply(this,arguments)}var er=t(13330),eo=t(84562),el=t(15933),ea=t(61107),es=t(2978),ec=t(28199),eu=function(e){var n=e.deleteSliceZone,t=e.closeDeleteSliceZoneModal;return(0,i.jsx)(ec.Z,{isOpen:!0,shouldCloseOnOverlayClick:!0,style:{content:{maxWidth:612}},onRequestClose:t,children:(0,i.jsx)(es.Z,{bodySx:{p:0,bg:"white",position:"relative",height:"100%",padding:16},footerSx:{position:"sticky",bottom:0,p:0},sx:{border:"none",overflow:"hidden"},borderFooter:!0,Header:function(){return(0,i.jsxs)(N.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",alignItems:"center",justifyContent:"space-between",borderBottom:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))}},children:[(0,i.jsx)(N.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:"Do you really want to delete Slice Zone?"}),(0,i.jsx)(N.x8,{type:"button",onClick:t})]})},Footer:function(){return(0,i.jsxs)(N.kC,{sx:{justifyContent:"flex-end",height:64,alignItems:"center",paddingRight:16,borderTop:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.darkBorders))},backgroundColor:"gray"},children:[(0,i.jsx)(ea.z,{label:"Cancel",variant:"secondary",onClick:t,sx:{mr:"10px",fontWeight:"bold",color:"grey12",borderRadius:6}}),(0,i.jsx)(ea.z,{label:"Delete",variant:"danger",onClick:n,sx:{minHeight:39,minWidth:78}})]})},children:(0,i.jsx)(N.nv,{children:"You're about to delete Slice Zone."})})})},ed=t(32713),em=t(93322),ef=t(74029),eh=t(41434),ep=t(24221),ev=t.n(ep),ex=function(e){var n,t=e.isOpen,o=e.close,l=e.onSubmit,a=e.isLoading,s=e.slice,u=e.libraries,d=(0,c.v9)(function(e){return{remoteSlices:(0,el.sT)(e)}}).remoteSlices;return(0,i.jsxs)(r.Vq,{open:t,onOpenChange:function(e){return!e&&o()},size:{width:448,height:"auto"},children:[(0,i.jsx)(r.fK,{title:"Upgrade slice"}),(0,i.jsx)(r.cZ,{children:(0,i.jsx)(D.J9,{validateOnMount:!0,initialValues:{from:null===(n=u[0])||void 0===n?void 0:n.name,sliceName:(0,B.MP)(s.key)},validate:function(e){return(0,eh.h)(e,u,d)},onSubmit:function(e){l({libraryID:e.from,sliceID:e.sliceName})},children:function(e){return(0,i.jsx)("form",{id:"convert-legacy-slice-as-new-slice-dialog",children:(0,i.jsxs)(r.xu,{flexDirection:"column",children:[(0,i.jsxs)(r.xr,{className:ev().scrollArea,style:{width:448},children:[(0,i.jsx)(r.xv,{variant:"normal",color:"grey11",children:"This will create a new slice with the same fields. The new slice will replace the legacy slice in all of your types, and the existing slice content will be re-mapped to the new slice."}),(0,i.jsx)(r.xv,{variant:"normal",color:"grey11",children:"This will not migrate your component. You will need to do that manually."}),(0,i.jsxs)(r.xu,{flexDirection:"column",gap:4,children:[(0,i.jsxs)("label",{className:ev().label,children:[(0,i.jsx)(r.xv,{variant:"bold",children:"Display name*"}),"string"==typeof e.errors.sliceName?(0,i.jsx)(r.xv,{variant:"small",color:"tomato10",children:e.errors.sliceName}):null]}),(0,i.jsx)(r.yt,{placeholder:"Pascalised Slice API ID (e.g. ".concat((0,B.MP)(s.key),")"),error:"string"==typeof e.errors.sliceName,value:e.values.sliceName,onValueChange:function(n){e.setFieldValue("sliceName",n.slice(0,30))},"data-testid":"slice-name-input"}),(0,i.jsx)(r.xv,{variant:"normal",color:"grey11",children:"A display name for the slice"})]}),(0,i.jsxs)(r.xu,{flexDirection:"column",gap:4,children:[(0,i.jsxs)("label",{className:ev().label,children:[(0,i.jsx)(r.xv,{variant:"bold",children:"Slice library*"}),"string"==typeof e.errors.from?(0,i.jsx)(r.xv,{variant:"small",color:"tomato10",children:e.errors.from}):null]}),(0,i.jsx)(r.Ph,{size:"medium",color:"grey",startIcon:"folder",flexContent:!0,value:e.values.from,onValueChange:function(n){return n?void e.setFieldValue("from",n):null},children:u.map(function(e){return(0,i.jsx)(r.Ql,{value:e.name,children:e.name},e.name)})}),(0,i.jsx)(r.xv,{variant:"normal",color:"grey11",children:"The library where we'll store your slice"})]})]}),(0,i.jsxs)(r.kX,{children:[(0,i.jsx)(r.PO,{size:"medium"}),(0,i.jsx)(r._d,{size:"medium",loading:a,disabled:!e.isValid,onClick:function(){e.submitForm()},children:"Upgrade"})]})]})})}})})]})},ey=t(76635),eb=function(e){var n,t,o=e.isOpen,l=e.close,a=e.onSubmit,c=e.isLoading,u=e.slice,d=e.sliceName,m=e.libraries,f=e.localSharedSlices,h=(0,s.useState)(!0),p=h[0],v=h[1];return(0,i.jsxs)(r.Vq,{open:o,onOpenChange:function(e){return!e&&l()},size:{width:448,height:"auto"},children:[(0,i.jsx)(r.fK,{title:"Convert to slice variation"}),(0,i.jsx)(r.cZ,{children:(0,i.jsx)(D.J9,{initialValues:{libraryID:null===(n=f[0])||void 0===n?void 0:n.from,sliceID:null===(t=f[0])||void 0===t?void 0:t.model.id,variationID:(0,ey.camelCase)(u.key),variationName:d},validate:function(e){return ej(e,m)},onSubmit:function(e){a(e)},children:function(e){return(0,i.jsx)("form",{id:"convert-legacy-slice-as-new-variation-dialog",children:(0,i.jsxs)(r.xu,{display:"flex",flexDirection:"column",children:[(0,i.jsxs)(r.xr,{className:ev().scrollArea,style:{width:448},children:[(0,i.jsx)(r.xv,{variant:"normal",color:"grey11",children:"If you have multiple slices that are similar, you can combine them as variations of the same slice."}),(0,i.jsxs)(r.xu,{display:"flex",flexDirection:"column",gap:4,children:[(0,i.jsxs)("label",{className:ev().label,children:[(0,i.jsx)(r.xv,{variant:"bold",children:"Target slice*"}),"string"==typeof e.errors.libraryID?(0,i.jsx)(r.xv,{variant:"small",color:"tomato10",children:e.errors.libraryID}):null,"string"==typeof e.errors.sliceID?(0,i.jsx)(r.xv,{variant:"small",color:"tomato10",children:e.errors.sliceID}):null]}),(0,i.jsx)(r.Ph,{size:"medium",color:"grey",startIcon:"viewDay",flexContent:!0,value:"".concat(e.values.libraryID,"::").concat(e.values.sliceID),onValueChange:function(n){if(n){var t=(0,J.Z)(n.split("::"),2),i=t[0],r=t[1];e.setFieldValue("libraryID",i),e.setFieldValue("sliceID",r)}},children:f.map(function(e){return(0,i.jsxs)(r.Ql,{value:"".concat(e.from,"::").concat(e.model.id),children:[e.from," ",">"," ",e.model.name," (",e.model.id,")"]},"".concat(e.from,"::").concat(e.model.id))})}),(0,i.jsx)(r.xv,{variant:"normal",color:"grey11",children:"Choose the slice to which you would like to add this variation."})]}),(0,i.jsxs)(r.xu,{display:"flex",flexDirection:"column",gap:4,children:[(0,i.jsxs)("label",{className:ev().label,children:[(0,i.jsx)(r.xv,{variant:"bold",children:"Variation name*"}),"string"==typeof e.errors.variationName?(0,i.jsx)(r.xv,{variant:"small",color:"tomato10",children:e.errors.variationName}):null]}),(0,i.jsx)(r.yt,{placeholder:d,error:"string"==typeof e.errors.variationName,value:e.values.variationName,onValueChange:function(n){var t=(0,X.Z)((0,Z.Z)({},e.values),{variationName:n.slice(0,30)});p&&(t.variationID=(0,ey.camelCase)(t.variationName)),e.setValues(t,!0)},"data-testid":"variation-name-input"})]}),(0,i.jsxs)(r.xu,{display:"flex",flexDirection:"column",gap:4,children:[(0,i.jsxs)("label",{className:ev().label,children:[(0,i.jsx)(r.xv,{variant:"bold",children:"ID*"}),"string"==typeof e.errors.variationID?(0,i.jsx)(r.xv,{variant:"small",color:"tomato10",children:e.errors.variationID}):null]}),(0,i.jsx)(r.yt,{placeholder:(0,ey.camelCase)(u.key),error:"string"==typeof e.errors.variationID,value:e.values.variationID,onValueChange:function(n){v(!1),e.setFieldValue("variationID",(0,ey.camelCase)(n.slice(0,30)))},"data-testid":"variation-id-input"})]})]}),(0,i.jsxs)(r.kX,{children:[(0,i.jsx)(r.PO,{size:"medium"}),(0,i.jsx)(r._d,{size:"medium",loading:c,onClick:function(){e.submitForm()},disabled:!e.isValid,children:"Convert"})]})]})})}})})]})},ej=function(e,n){var t,i={};e.libraryID||(i.libraryID="Cannot be empty.");var r=n.find(function(n){return n.path===e.libraryID});i.libraryID||r||(i.libraryID="Does not exist."),e.sliceID||(i.sliceID="Cannot be empty.");var o=null==r?void 0:r.components.find(function(n){return n.model.id===e.sliceID});return(i.sliceID||o||(i.sliceID="Does not exist."),e.variationName||(i.variationName="Cannot be empty."),e.variationID)?(null!==(t=null==o?void 0:o.model.variations.map(function(e){return e.id}))&&void 0!==t?t:[]).includes(e.variationID)&&(i.variationID="Slice variation ID is already taken."):i.variationID="Cannot be empty.",i},eg=function(e){var n,t,o=e.isOpen,l=e.close,a=e.onSubmit,s=e.isLoading,c=e.identicalSlices;return(0,i.jsxs)(r.Vq,{open:o,onOpenChange:function(e){return!e&&l()},size:{width:448,height:"auto"},children:[(0,i.jsx)(r.fK,{title:"Merge with an existing slice"}),(0,i.jsx)(r.cZ,{children:(0,i.jsx)(D.J9,{initialValues:{path:null!==(t=null===(n=c[0])||void 0===n?void 0:n.path)&&void 0!==t?t:""},validate:function(e){if(!e.path)return{path:"Cannot be empty."}},onSubmit:function(e){var n,t=(0,J.Z)(e.path.split("::"),3),i=t[0];a({libraryID:i,sliceID:t[1],variationID:t[2]})},children:function(e){return(0,i.jsx)("form",{id:"convert-legacy-slice-merge-with-identical-dialog",children:(0,i.jsxs)(r.xu,{display:"flex",flexDirection:"column",children:[(0,i.jsxs)(r.xr,{className:ev().scrollArea,children:[(0,i.jsx)(r.xv,{variant:"normal",color:"grey11",children:"If you have multiple identical slices, you can merge them. All of your content will be remapped to the target slice."}),(0,i.jsxs)(r.xu,{display:"flex",flexDirection:"column",gap:4,children:[(0,i.jsxs)("label",{className:ev().label,children:[(0,i.jsx)(r.xv,{variant:"bold",children:"Target slice*"}),"string"==typeof e.errors.path?(0,i.jsx)(r.xv,{variant:"small",color:"tomato10",children:e.errors.path}):null]}),(0,i.jsx)(r.Ph,{size:"medium",color:"grey",startIcon:"viewDay",flexContent:!0,value:e.values.path,onValueChange:function(n){n&&e.setFieldValue("path",n)},children:c.map(function(e){return(0,i.jsx)(r.Ql,{value:e.path,children:e.path.split("::").join(" > ")},e.path)})}),(0,i.jsx)(r.xv,{variant:"normal",color:"grey11",children:"Choose a slice that you would like to merge this into."})]})]}),(0,i.jsxs)(r.kX,{children:[(0,i.jsx)(r.PO,{size:"medium"}),(0,i.jsx)(r._d,{size:"medium",loading:s,disabled:!e.isValid,onClick:function(){e.submitForm()},children:"Merge"})]})]})})}})})]})},eC=function(e){var n,t,o=e.slice,l=e.path,a=(0,g.Z)().refreshState,u=(0,s.useState)(!1),d=u[0],m=u[1],f=(0,s.useState)(),h=f[0],x=f[1],b=w().setCustomType,j=(0,c.v9)(function(e){return{libraries:(0,el.Sd)(e)}}).libraries,C="Slice"===o.value.type&&null!==(n=o.value.fieldset)&&void 0!==n?n:o.key,S=j.filter(function(e){return e.isLocal}),I=S.map(function(e){return e.components}).flat(),_=eS(o,C,I),T=(t=(0,p.Z)(function(e){var n,t,i,r,s,c,u,d;return(0,v.__generator)(this,function(d){switch(d.label){case 0:if(!h)return[2];return m(!0),y.Xe.track({event:"legacy-slice:converted",id:e.sliceID,variation:null!==(n=e.variationID)&&void 0!==n?n:"default",library:e.libraryID,conversionType:h}),[4,en.j.slices.convertLegacySliceToSharedSlice({model:o.value,src:(0,X.Z)((0,Z.Z)({},l),{sliceID:o.key}),dest:{libraryID:e.libraryID,sliceID:e.sliceID,variationName:null!==(t=e.variationName)&&void 0!==t?t:"Default",variationID:null!==(i=e.variationID)&&void 0!==i?i:"default"}})];case 1:if((r=d.sent().errors).length)throw console.error("Could not convert slice `".concat(C,"`"),r),Q.Am.error("Could not convert slice `".concat(C,"`")),r;return[4,en.j.customTypes.readCustomType({id:l.customTypeID})];case 2:if(c=(s=d.sent()).model,(u=s.errors).length||!c)return console.error("Could not refresh custom type view `".concat(l.customTypeID,"`"),u),Q.Am.error("Could not refresh custom type view `".concat(l.customTypeID,"`")),[2];return[4,(0,y.y0)()];case 3:switch(a(d.sent()),m(!1),x(void 0),h){case"as_new_slice":Q.Am.success("".concat(C," has been upgraded to a new slice ").concat(e.libraryID," > ").concat(e.sliceID));break;case"as_new_variation":Q.Am.success("".concat(C," has been converted as a variation of ").concat(e.libraryID," > ").concat(e.sliceID));break;default:Q.Am.success("".concat(C," has been merged with ").concat(e.libraryID," > ").concat(e.sliceID))}return b(c),[2]}})}),function(e){return t.apply(this,arguments)}),k={path:l,slice:o,sliceName:C,libraries:S,localSharedSlices:I,identicalSlices:_,close:function(){return x(void 0)},onSubmit:T,isLoading:d};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(r.h_,{children:[(0,i.jsx)(r.$F,{children:(0,i.jsx)(r.zx,{"data-testid":"convert-legacy-slice",startIcon:"refresh",endIcon:"arrowDropDown",size:"medium",color:"grey",children:"Migrate legacy slice"})}),(0,i.jsxs)(r.AW,{align:"start",children:[(0,i.jsx)(r.Xi,{startIcon:(0,i.jsx)(r.I5,{name:"folder",size:"large"}),description:"Use it with new types",onSelect:function(){return x("as_new_slice")},children:"Upgrade slice"}),(0,i.jsx)(r.Xi,{startIcon:(0,i.jsx)(r.I5,{name:"viewDay",size:"large"}),description:"Add it to another slice",onSelect:function(){return x("as_new_variation")},disabled:!I.length,children:"Convert to slice variation"}),(0,i.jsx)(r.Xi,{startIcon:(0,i.jsx)(r.I5,{name:"driveFileMove",size:"large"}),description:"Combine identical slices",onSelect:function(){return x("merge_with_identical")},disabled:!_.length,children:"Merge with another slice"})]})]}),(0,i.jsx)(ex,(0,X.Z)((0,Z.Z)({},k),{isOpen:"as_new_slice"===h})),(0,i.jsx)(eb,(0,X.Z)((0,Z.Z)({},k),{isOpen:"as_new_variation"===h})),(0,i.jsx)(eg,(0,X.Z)((0,Z.Z)({},k),{isOpen:"merge_with_identical"===h}))]})},eS=function(e,n,t){return(0,s.useMemo)(function(){var i=[],r=(0,ef.ux)(e.value,n),o=!0,l=!1,a=void 0;try{for(var s,c=t[Symbol.iterator]();!(o=(s=c.next()).done);o=!0){var u=s.value,d=!0,m=!1,f=void 0;try{for(var h,p=u.model.variations[Symbol.iterator]();!(d=(h=p.next()).done);d=!0){var v=h.value,x=(0,ef.ux)(v,u.model.name);r.primary===x.primary&&r.items===x.items&&i.push({libraryID:u.from,sliceID:u.model.id,variationID:v.id,path:"".concat(u.from,"::").concat(u.model.id,"::").concat(v.id)})}}catch(y){m=!0,f=y}finally{try{d||null==p.return||p.return()}finally{if(m)throw f}}}}catch(b){l=!0,a=b}finally{try{o||null==c.return||c.return()}finally{if(l)throw a}}return i},[e,n,t])},eI=function(e){var n=e.slice,t=e.path,o=(0,J.Z)((0,ed.E)("legacySliceUpgrader"),1)[0],l=o.enabled?"This Slice was created with the Legacy Builder. It needs to be converted first to be used within Slice Machine.":"This Slice was created with the Legacy Builder, and is incompatible with Slice Machine. You cannot edit, push, or delete it in Slice Machine. In order to proceed, manually remove the Slice from your type model. Then create a new Slice with the same fields using Slice Machine.";return(0,i.jsxs)(em.Zb,{children:[(0,i.jsx)(em.ZB,{component:"div",children:(0,i.jsx)(r.xu,{alignItems:"center",justifyContent:"center",children:(0,i.jsx)(r.xv,{color:"grey11",component:"span",children:"No screenshot available"})})}),(0,i.jsxs)(em.T$,{children:[(0,i.jsx)(r.u,{content:l,side:"bottom",children:(0,i.jsx)(r.Ct,{color:"purple",title:"Legacy Slice"})}),o.enabled?(0,i.jsx)(eC,{slice:n,path:t}):null]}),(0,i.jsx)(em.eW,{subtitle:"1 variation",title:(0,ef.Dj)(n.value)})]})},ew=t(88201),e_=t(26574),eT=function(e){var n=e.slices,t=e.format,r=e.path,o=e.onRemoveSharedSlice,l=n.some(function(e){return"SharedSlice"!==e.type}),a=C.$[t],c=(0,J.Z)((0,ed.E)("legacySliceUpgrader"),1)[0];return(0,s.useEffect)(function(){l&&(c.enabled?Q.Am.info("This ".concat(a.name({start:!1,plural:!1})," contains legacy slices that can be upgraded.")):Q.Am.warning("This ".concat(a.name({start:!1,plural:!1})," contains slices that are incompatible.")))},[l]),(0,i.jsx)(e_.Z,{elems:n,defineElementKey:function(e){return"SharedSlice"!==e.type?e.payload.key:e.payload.model.name},renderElem:function(e){if("SharedSlice"!==e.type){var n=e.payload;return(0,i.jsx)(eI,{slice:n,path:r})}var t=e.payload;return(0,i.jsx)(ew.b,{action:{type:"remove",onRemove:function(){o(t.model.id)}},mode:"navigation",slice:t,variant:"solid"})},sx:{padding:"16px"}})},eZ=t(67557);function ek(){return(ek=(0,p.Z)(function(e){var n,t,i,r,o,l,a,s;return(0,v.__generator)(this,function(c){switch(c.label){case 0:return c.trys.push([0,3,,4]),n=e.templateIDs,t=e.localLibrariesNames,i=e.onSuccess,[4,en.j.sliceTemplateLibrary.createSlices({templateIDs:n})];case 1:if(o=(r=c.sent()).data,(l=r.errors).length>0||void 0===o)throw l;return o.sliceIDs.forEach(function(e,i){y.Xe.track({event:"slice:created",id:e,name:e,library:t[0],sliceTemplate:n[i]})}),[4,i(o.sliceIDs)];case 2:return c.sent(),[3,4];case 3:return a=c.sent(),s="Internal Error: Slice(s) not created",console.error(s,a),Q.Am.error(s),[3,4];case 4:return[2]}})})).apply(this,arguments)}var eD=t(37806),eN=[{extension:"",fileName:"",from:"",href:"",pathToSlice:"",model:{id:"video_highlights",name:"VideoHighlights",type:"SharedSlice",variations:[{description:"",docURL:"",id:"default",name:"Default",version:"sktwi1xtmkfgx8626"},]},screenshots:{default:{url:"/videoHighlights.png"}}},],eL=function(e){var n=e.availableSlices,t=e.values,r=e.placeholderSlices;return(0,i.jsx)(D.F2,{name:"sliceKeys",render:function(e){return(0,i.jsx)(e_.Z,{gridTemplateMinPx:"200px",elems:n,defineElementKey:function(e){return"".concat(e.from,"-").concat(e.model.name)},renderElem:function(n){var o,l=null!==(o=null==r?void 0:r.some(function(e){return e.model.id===n.model.id}))&&void 0!==o&&o,a=t.sliceKeys.includes(n.model.id);return(0,i.jsx)(ew.b,{action:{type:"checkbox"},isComingSoon:l,mode:"selection",onSelectedChange:function(i){i?e.push(n.model.id):e.remove(t.sliceKeys.indexOf(n.model.id))},selected:a,slice:n,variant:"outlined"})}})}})},eM=function(e){var n=e.formId,t=e.close,r=e.onSuccess,o=e.availableSlicesTemplates,l=e.localLibraries,a=(0,g.Z)().createSliceSuccess;return(0,i.jsx)(T.Z,{isOpen:!0,buttonLabel:"Add",formId:n,close:t,onSubmit:function(e){var n;!function(e){return ek.apply(this,arguments)}({templateIDs:e.sliceKeys,localLibrariesNames:l.map(function(e){return e.name}),onSuccess:(n=(0,p.Z)(function(e){var n,t;return(0,v.__generator)(this,function(n){switch(n.label){case 0:return[4,(0,y.y0)()];case 1:var t;return a(n.sent().libraries),[4,Promise.all(e.map((t=(0,p.Z)(function(e){var n;return(0,v.__generator)(this,function(n){switch(n.label){case 0:return[4,en.j.slices.readSlice({libraryID:l[0].name,sliceID:e})];case 1:return[2,n.sent().model]}})}),function(e){return t.apply(this,arguments)})).filter(function(e){return void 0!==e}))];case 2:return r(n.sent()),[2]}})}),function(e){return n.apply(this,arguments)})})},initialValues:{sliceKeys:[]},content:{title:"Use template slices"},validate:function(e){if(0===e.sliceKeys.length)return{sliceKeys:"Select at least one template to add"}},actionMessage:function(e){var n=e.errors;return void 0!==n.sliceKeys?(0,i.jsx)(N.xv,{sx:{color:"error"},children:n.sliceKeys}):void 0},children:function(e){var n=e.values;return(0,i.jsx)(eL,{values:n,placeholderSlices:eN,availableSlices:(0,E.Z)(o.map(function(e){return{extension:"",fileName:"",from:"",href:"",pathToSlice:"",model:eD.id.toSM(e.model),screenshots:Object.entries(e.screenshots).reduce(function(e,n){return(0,X.Z)((0,Z.Z)({},e),(0,eZ.Z)({},n[0],{url:n[1]}))},{})}})).concat((0,E.Z)(eN))})}})},eV=function(e){var n=e.formId,t=e.close,r=e.onSubmit,o=e.availableSlices;return(0,i.jsx)(T.Z,{isOpen:!0,buttonLabel:"Add",formId:n,close:t,onSubmit:function(e){r(e.sliceKeys.map(function(e){var n;return null===(n=o.find(function(n){return n.model.id===e}))||void 0===n?void 0:n.model}).filter(function(e){return void 0!==e}))},initialValues:{sliceKeys:[]},content:{title:"Select existing slices"},testId:"update-slices-modal",validate:function(e){if(0===e.sliceKeys.length)return{sliceKeys:"Select at least one slice to add"}},actionMessage:function(e){var n=e.errors;return void 0!==n.sliceKeys?(0,i.jsx)(N.xv,{sx:{color:"error"},children:n.sliceKeys}):void 0},children:function(e){var n=e.values;return(0,i.jsx)(eL,{values:n,availableSlices:o})}})},eF=function(e,n){var t,i=(n||[]).reduce(function(e,n){return(0,E.Z)(e).concat((0,E.Z)(n.components))},[]),r=e.value.reduce(function(e,n){var t=n.key,r=n.value;if("SharedSlice"===r.type){var o=i.find(function(e){return e.model.id===t});return o?(0,X.Z)((0,Z.Z)({},e),{slicesInSliceZone:(0,E.Z)(e.slicesInSliceZone).concat([{type:"SharedSlice",payload:o},])}):(0,X.Z)((0,Z.Z)({},e),{notFound:(0,E.Z)(e.notFound).concat([{key:t}])})}return(0,X.Z)((0,Z.Z)({},e),{slicesInSliceZone:(0,E.Z)(e.slicesInSliceZone).concat([{type:"Slice",payload:{key:t,value:r}},])})},{slicesInSliceZone:[],notFound:[]});return{availableSlices:i,slicesInSliceZone:r.slicesInSliceZone,notFound:r.notFound}},eE=function(e){var n,t=e.customType,o=e.onCreateSliceZone,l=e.onDeleteSliceZone,u=e.onRemoveSharedSlice,d=e.sliceZone,m=e.tabId,f=(0,a.useRouter)(),h=f.query,p=f.replace,v=f.pathname,x=(0,ee.QT)(et,[]),b=(0,s.useState)(!1),j=b[0],g=b[1],C=(0,s.useState)(!1),S=C[0],I=C[1],T=(0,s.useState)(!1),Z=T[0],k=T[1],D=(0,c.v9)(function(e){return{remoteSlices:(0,el.sT)(e),libraries:(0,el.Sd)(e),slices:(0,el.xC)(e)}}),N=D.remoteSlices,L=D.libraries,M=w().setCustomType,V=L.filter(function(e){return e.isLocal}),F=(0,s.useMemo)(function(){return d?eF(d,L):{availableSlices:[],slicesInSliceZone:[],notFound:[]}},[d,L]),E=F.availableSlices,A=F.slicesInSliceZone,z=F.notFound,H=(0,s.useState)(!1),R=H[0],B=H[1];(0,s.useEffect)(function(){(null==z?void 0:z.length)&&z.forEach(function(e){u(e.key)})},[z]);var O=A.filter(function(e){return"SharedSlice"===e.type}).map(function(e){return e.payload}),K=E.filter(function(e){return!O.some(function(n){return n.model.id===e.model.id})}),U=function(){I(!0)},X=function(){k(!0)},W=function(){g(!0),y.Xe.track({event:"custom-type:open-add-from-templates",customTypeId:t.id,customTypeFormat:t.format})},q=function(){"true"===h.newPageType&&p({pathname:v,query:{pageTypeId:h.pageTypeId}},void 0,{shallow:!0})},J=function(){I(!1)},en=function(){k(!1)},ei=function(){g(!1)};return(0,i.jsxs)(i.Fragment,{children:[void 0===h.newPageType?(0,i.jsx)(P.Bu,{actions:d?(0,i.jsxs)(r.h_,{children:[(0,i.jsx)(r.$F,{children:(0,i.jsx)(r.zx,{color:"grey",startIcon:"add",children:"Add slices"})}),(0,i.jsxs)(r.AW,{align:"end",children:[(0,i.jsx)(r.Xi,{startIcon:(0,i.jsx)(r.I5,{name:"add",size:"large"}),onSelect:X,description:"Start from scratch.",children:"Create new"}),x.length>0?(0,i.jsx)(r.Xi,{onSelect:W,startIcon:(0,i.jsx)(r.I5,{name:"contentCopy",size:"large"}),description:"Select from premade examples.",endAdornment:(0,i.jsx)(r.xv,{color:"inherit",component:"kbd",children:(0,i.jsx)(r.Ct,{color:"purple",title:"New"})}),children:"Use template"}):void 0,K.length>0?(0,i.jsx)(r.Xi,{onSelect:U,startIcon:(0,i.jsx)(r.I5,{name:"folder",size:"large"}),description:"Select from your own slices.",children:"Select existing"}):void 0]})]}):void 0,toggle:"page"!==t.format||"Main"!==m?(0,i.jsx)(r.rs,{checked:!!d,onCheckedChange:function(e){e?o():B(!0)},size:"small","data-testid":"slice-zone-switch"}):void 0,children:"Slice Zone"}):void 0,d?A.length>0?(0,i.jsx)(G.xR,{children:(0,i.jsx)(eT,{slices:A,format:t.format,path:{customTypeID:t.id,tabID:m,sliceZoneID:null!==(n=null==d?void 0:d.key)&&void 0!==n?n:""},onRemoveSharedSlice:u})}):(0,i.jsx)(Y,{openUpdateSliceZoneModal:U,openCreateSliceModal:X,openSlicesTemplatesModal:W,projectHasAvailableSlices:K.length>0,isSlicesTemplatesSupported:x.length>0}):void 0,S&&(0,i.jsx)(eV,{formId:"tab-slicezone-form-".concat(m),availableSlices:K,onSubmit:function(e){var n=$({customType:t,tabId:m,slices:e});M(_.Dc.fromSM(n)),J(),q(),Q.Am.success("Slice(s) added to slice zone")},close:J}),j&&(0,i.jsx)(eM,{formId:"tab-slicezone-form-".concat(m),availableSlicesTemplates:x,localLibraries:V,onSuccess:function(e){var n=$({customType:t,tabId:m,slices:e});M(_.Dc.fromSM(n)),ei(),q(),Q.Am.success((0,i.jsx)(eo.GX,{message:"Slice template(s) added to slice zone and created at: ",path:"".concat(V[0].name,"/")}))},close:ei}),R&&(0,i.jsx)(eu,{closeDeleteSliceZoneModal:function(){B(!1)},deleteSliceZone:function(){l(),B(!1)}}),(null==V?void 0:V.length)!==0&&Z&&(0,i.jsx)(er.c,{onSuccess:function(e){var n=$({customType:t,tabId:m,slices:[e]});M(_.Dc.fromSM(n)),en(),q(),Q.Am.success((0,i.jsx)(eo.GX,{message:"New slice added to slice zone and created at: ",path:"".concat(V[0].name,"/")}))},localLibraries:V,remoteSlices:N,onClose:en})]})},eA=[H.C.UID,H.C.Image,H.C.Text,H.C.StructuredText,H.C.Link,H.C.Select,H.C.Boolean,H.C.Number,H.C.Color,H.C.Date,H.C.Embed,H.C.Timestamp,H.C.GeoPoint,H.C.ContentRelationship,H.C.LinkToMedia,H.C.Group,H.C.NestedGroup,],eP=function(e){var n,t,o,l,c=e.tabId,u=w(),m=u.customType,f=u.setCustomType,h=_.Dc.toSM(m),p=null===(n=h.tabs.find(function(e){return e.key===c}))||void 0===n?void 0:n.sliceZone,v=null!==(o=null===(t=h.tabs.find(function(e){return e.key===c}))||void 0===t?void 0:t.value)&&void 0!==o?o:[],x=(0,a.useRouter)().query,b=h.tabs.reduce(function(e,n){return(0,E.Z)(e).concat((0,E.Z)(n.value))},[]),j=function(e){var n=(0,d.AK)({customType:m,fieldId:e,sectionId:c});f(n)},g=function(e){var n=e.id,t=e.label,i=e.widgetTypeName;if(!(0,R.Ss)(H.C,i)){var r=H.C[i].create(t);if("Range"===r.type||"IntegrationFields"===r.type||"Separator"===r.type)throw Error("Unsupported Field Type: ".concat(r.type));var o=H.C[r.type];try{o.schema.validateSync(r,{stripUnknown:!1})}catch(l){throw Error('Add field: Model is invalid for field "'.concat(r.type,'".'))}var a=_.L$.fromSM(r),s=(0,d.xS)({customType:m,newField:a,newFieldId:n,sectionId:c});f(s),y.Xe.track({event:"field:added",id:n,name:t,type:a.type,isInAGroup:!1,contentType:(0,O.T)(window.location.pathname)})}},C=function(e){if(!(0,R.uS)(e)){var n=e.source,t=e.destination;if(t){var i=(0,d.gR)({customType:m,sourceIndex:n.index,destinationIndex:t.index,sectionId:c});(0,A.flushSync)(function(){return f(i)})}}},S=function(e){var n=e.apiId,t=e.newKey,i=e.value;if(!(0,R.Ss)(H.C,i.type)){var r=_.L$.fromSM(i),o=(0,d.L4)({customType:m,previousFieldId:n,newFieldId:t,newField:r,sectionId:c});f(o)}},I=function(){var e=(0,d.Tr)(m,c);f(e)},T=function(){var e=(0,d.E3)(m,c);f(e)},Z=function(e){var n=(0,d.EN)({customType:m,sectionId:c,sliceId:e});f(n)};return(0,i.jsx)(z.S,{children:(0,i.jsx)(s.Suspense,{fallback:(0,i.jsx)(r.xu,{padding:32,children:(0,i.jsx)(r._3,{})}),children:(0,i.jsxs)(P.aV,{border:!1,style:{flexGrow:1},children:[void 0===x.newPageType?(0,i.jsx)(U.Z,{zoneType:"customType",zoneTypeFormat:null!==(l=m.format)&&void 0!==l?l:"custom",tabId:c,title:"Static Zone",dataTip:"",fields:v,poolOfFieldsToCheck:b,showHints:!0,EditModal:K.Z,widgetsArray:eA,onDeleteItem:j,onSave:S,onSaveNewField:g,onDragEnd:C,renderHintBase:function(e){var n=e.item;return"data".concat((0,B.Ti)(n.key))},renderFieldAccessor:function(e){return"data".concat((0,B.Ti)(e))},testId:"static-zone-content",isRepeatableCustomType:m.repeatable}):void 0,(0,i.jsx)(eE,{customType:h,tabId:c,sliceZone:p,onRemoveSharedSlice:Z,onCreateSliceZone:I,onDeleteSliceZone:T})]})})})},ez=function(){var e,n,t,o=w(),l=o.customType,c=o.setCustomType,u=_.Dc.toSM(l),m=(0,s.useState)(null===(e=u.tabs[0])||void 0===e?void 0:e.key),f=m[0],h=m[1],p=(0,s.useState)(),v=p[0],x=p[1],y=(0,a.useRouter)().query,b=(null===(n=u.tabs.find(function(e){return e.key===f}))||void 0===n?void 0:null===(t=n.sliceZone)||void 0===t?void 0:t.value.length)===0;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(r.Rz,{sx:b?{flexGrow:1}:void 0,children:["page"===l.format?(0,i.jsx)(r.py,{}):void 0,"true"===y.newPageType?(0,i.jsx)(eP,{tabId:u.tabs[0].key}):(0,i.jsxs)(r.KC,{onValueChange:h,value:f,children:[(0,i.jsx)(r.mY,{onAddNewTab:function(){x({type:"CREATE_CUSTOM_TYPE_TAB"})},children:u.tabs.map(function(e){return(0,i.jsx)(r.wf,{menu:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.Xi,{onSelect:function(){x({type:"UPDATE_CUSTOM_TYPE_TAB",tabKey:e.key})},startIcon:(0,i.jsx)(r.I5,{name:"edit"}),children:"Rename"}),(0,i.jsx)(r.Xi,{color:"tomato",disabled:u.tabs.length<=1,onSelect:function(){x({type:"DELETE_CUSTOM_TYPE_TAB",tabKey:e.key})},startIcon:(0,i.jsx)(r.I5,{name:"delete"}),children:"Remove"})]}),value:e.key,children:e.key},e.key)})}),u.tabs.map(function(e){return(0,i.jsx)(r.e$,{value:e.key,children:(0,i.jsx)(eP,{tabId:e.key})},e.key)})]})]}),(null==v?void 0:v.type)==="CREATE_CUSTOM_TYPE_TAB"?(0,i.jsx)(M,{close:function(){x(void 0)},isOpen:!0,onSubmit:function(e){var n=e.id;c((0,d.vB)(l,n)),h(n)},tabIds:u.tabs.map(function(e){return e.key.toLowerCase()})}):void 0,(null==v?void 0:v.type)==="UPDATE_CUSTOM_TYPE_TAB"?(0,i.jsx)(F,{close:function(){x(void 0)},initialTabKey:v.tabKey,isOpen:!0,onSubmit:function(e){var n=e.id;c((0,d.HO)(l,v.tabKey,n)),f===v.tabKey&&h(n)},tabIds:u.tabs.filter(function(e){return e.key!==v.tabKey}).map(function(e){return e.key.toLowerCase()})}):void 0,(null==v?void 0:v.type)==="DELETE_CUSTOM_TYPE_TAB"?(0,i.jsx)(V,{close:function(){x(void 0)},isOpen:!0,onSubmit:function(){if(c((0,d.F$)(l,v.tabKey)),f===v.tabKey){var e,n=null===(e=u.tabs.find(function(e){return e.key!==v.tabKey}))||void 0===e?void 0:e.key;void 0!==n&&h(n)}}}):void 0]})},eH=t(93290),eR=t(7781),eB=t(56471),eO=t(9968),eK=t(87808),eU=t.n(eK),eX=function(e){var n=e.tabs,t=(0,k.Z)(e,["tabs"]);return(0,i.jsxs)(eO.fC,(0,X.Z)((0,Z.Z)({},t),{className:eU().root,defaultValue:n[0].label,orientation:"vertical",children:[(0,i.jsx)(eO.aV,{className:eU().list,"aria-label":"content tabs",children:n.map(function(e,n){var t=e.label;return(0,i.jsx)(eO.xz,{className:eU().trigger,value:t,children:(0,i.jsx)(r.xv,{className:eU().triggerText,component:"span",color:"inherit",children:t})},"".concat(t,"-trig").concat(n+1))})}),n.map(function(e,n){var t=e.label,o=e.content;return(0,i.jsx)(eO.VY,{className:eU().content,value:t,children:(0,i.jsx)(r.xr,{className:eU().scrollArea,children:o})},"".concat(t,"-content").concat(n+1))})]}))},eQ=t(82205),eG=t(88241),eW=t(8857),eq=t(72757),eY=t(49109),e$=t(25145),eJ=function(){return(0,i.jsx)("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.1707 19.1237C17.9629 19.3056 17.9419 19.6214 18.1237 19.8293C18.3056 20.0371 18.6214 20.0581 18.8293 19.8763L22.8293 16.3763C22.9378 16.2814 23 16.1442 23 16C23 15.8558 22.9378 15.7187 22.8293 15.6237L18.8293 12.1237C18.6214 11.9419 18.3056 11.9629 18.1237 12.1708C17.9419 12.3786 17.9629 12.6945 18.1707 12.8763L21.7407 16L18.1707 19.1237ZM13.8293 12.8763C14.0371 12.6945 14.0581 12.3786 13.8763 12.1708C13.6944 11.9629 13.3786 11.9419 13.1707 12.1237L9.17075 15.6237C9.06224 15.7187 9 15.8558 9 16C9 16.1442 9.06224 16.2814 9.17075 16.3763L13.1707 19.8763C13.3786 20.0581 13.6944 20.0371 13.8763 19.8293C14.0581 19.6214 14.0371 19.3056 13.8293 19.1237L10.2593 16L13.8293 12.8763Z",fill:"#6F6E77"})})},e0=function(){return(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",children:(0,i.jsx)("path",{d:"M21.2388 10H10.7623C10.3415 10 10 10.3415 10 10.7623V21.2377C10 21.6585 10.3415 22 10.7623 22H21.2377C21.6585 22 22 21.6585 22 21.2388V10.7623C22 10.3415 21.6585 10 21.2388 10ZM16.5714 19.1953C16.5714 20.3371 15.9018 20.8571 14.9241 20.8571C14.0402 20.8571 13.4029 20.2645 13.1429 19.7143L14.0413 19.1708C14.2143 19.4777 14.4777 19.7143 14.8571 19.7143C15.2199 19.7143 15.4286 19.5725 15.4286 19.0212V15.4286H16.5714V19.1953ZM19.0502 20.8571C18.0379 20.8571 17.4632 20.3471 17.1429 19.7143L18 19.1429C18.2333 19.5246 18.4877 19.8895 19.0257 19.8895C19.4777 19.8895 19.7143 19.6641 19.7143 19.3516C19.7143 18.9788 19.4688 18.846 18.9721 18.6283L18.6998 18.5112C17.9129 18.1763 17.3895 17.7567 17.3895 16.8683C17.3895 16.0513 18.0134 15.4286 18.9866 15.4286C19.6797 15.4286 20.1775 15.6696 20.5368 16.3013L19.6886 16.8471C19.5011 16.5112 19.3002 16.3795 18.9866 16.3795C18.6674 16.3795 18.4654 16.5826 18.4654 16.8471C18.4654 17.1741 18.6674 17.3058 19.135 17.5089L19.4074 17.6261C20.3348 18.0223 20.8571 18.4275 20.8571 19.3382C20.8571 20.3192 20.0859 20.8571 19.0502 20.8571Z",fill:"#6F6E77"})})},e1=function(){return(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:32,height:32,children:(0,i.jsxs)("g",{fill:"none",fillRule:"evenodd",children:[(0,i.jsx)("path",{d:"M0 0h32v32H0z"}),(0,i.jsx)("path",{fill:"#6F6E77",fillRule:"nonzero",d:"M15.45 10.534c1.592-1.013 3.794-.542 4.908 1.054.533.747.742 1.679.585 2.584a3.2 3.2 0 0 1-.48 1.197c.35.664.466 1.427.333 2.167a3.205 3.205 0 0 1-1.449 2.148l-2.795 1.782c-1.593 1.013-3.792.542-4.908-1.054a3.413 3.413 0 0 1-.585-2.584c.075-.425.24-.834.48-1.197a3.374 3.374 0 0 1-.334-2.167 3.205 3.205 0 0 1 1.449-2.148Zm3.756 1.785a2.224 2.224 0 0 0-2.383-.883 2.053 2.053 0 0 0-.57.249l-2.794 1.782c-.46.29-.778.759-.873 1.292a2.06 2.06 0 0 0 .352 1.555 2.224 2.224 0 0 0 2.384.883c.203-.054.393-.138.569-.249l1.064-.68a.567.567 0 0 1 .171-.076.67.67 0 0 1 .718.266.613.613 0 0 1 .106.468.582.582 0 0 1-.263.39L14.89 19.1a.567.567 0 0 1-.17.076.67.67 0 0 1-.718-.266.612.612 0 0 1-.114-.414l.011-.103-.103-.033a3.608 3.608 0 0 1-1.094-.547l-.144-.106-.051.16c-.03.084-.052.17-.068.26a2.06 2.06 0 0 0 .352 1.555 2.224 2.224 0 0 0 2.384.883c.2-.054.393-.138.569-.249l2.795-1.782c.46-.29.777-.759.872-1.292a2.06 2.06 0 0 0-.352-1.555 2.224 2.224 0 0 0-2.384-.883 2.053 2.053 0 0 0-.568.249l-1.065.68a.567.567 0 0 1-.17.076.67.67 0 0 1-.718-.266.613.613 0 0 1-.106-.468.582.582 0 0 1 .263-.39l2.795-1.783a.567.567 0 0 1 .17-.076.67.67 0 0 1 .719.266c.086.119.127.268.113.414l-.01.103.102.033c.393.119.764.303 1.095.547l.143.106.052-.16c.03-.084.051-.17.068-.26a2.06 2.06 0 0 0-.353-1.555Z"})]})})},e2=function(){return(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",children:(0,i.jsx)("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.1719 10H20.8281C21.4753 10 22 10.5247 22 11.1719V20.8281C22 21.4753 21.4753 22 20.8281 22H11.1719C10.5247 22 10 21.4753 10 20.8281V11.1719C10 10.5247 10.5247 10 11.1719 10ZM17.4283 20.7223V19.549C17.641 19.7275 17.8721 19.8613 18.1215 19.9505C18.371 20.0397 18.6228 20.0843 18.8771 20.0843C19.0263 20.0843 19.1565 20.0709 19.2678 20.044C19.3791 20.0171 19.472 19.9798 19.5466 19.9322C19.6211 19.8845 19.6768 19.8283 19.7135 19.7635C19.7501 19.6987 19.7685 19.6285 19.7685 19.5527C19.7685 19.45 19.7391 19.3583 19.6805 19.2777C19.6217 19.197 19.5417 19.1225 19.4402 19.054C19.3387 18.9856 19.2183 18.9196 19.0789 18.856C18.9395 18.7925 18.7891 18.7277 18.6277 18.6617C18.2169 18.4906 17.9106 18.2816 17.7089 18.0347C17.5071 17.7878 17.4062 17.4896 17.4062 17.1401C17.4062 16.8663 17.4613 16.631 17.5713 16.4343C17.6814 16.2375 17.8311 16.0756 18.0206 15.9484C18.2102 15.8213 18.4296 15.7278 18.6791 15.668C18.9285 15.6081 19.1926 15.5781 19.4714 15.5781C19.7452 15.5781 19.988 15.5946 20.1995 15.6276C20.411 15.6606 20.606 15.7113 20.7845 15.7798V16.8761C20.6965 16.815 20.6005 16.7612 20.4966 16.7148C20.3927 16.6683 20.2857 16.6298 20.1756 16.5992C20.0656 16.5687 19.9562 16.5461 19.8473 16.5314C19.7385 16.5168 19.6352 16.5094 19.5374 16.5094C19.4029 16.5094 19.2806 16.5223 19.1706 16.5479C19.0605 16.5736 18.9676 16.6097 18.8918 16.6561C18.816 16.7025 18.7573 16.7581 18.7157 16.8229C18.6742 16.8877 18.6534 16.9604 18.6534 17.0411C18.6534 17.1291 18.6766 17.2079 18.7231 17.2776C18.7695 17.3472 18.8356 17.4132 18.9212 17.4756C19.0068 17.5379 19.1107 17.599 19.2329 17.6589C19.3552 17.7188 19.4934 17.7805 19.6474 17.8441C19.8577 17.932 20.0466 18.0255 20.2142 18.1245C20.3817 18.2235 20.5253 18.3354 20.6451 18.46C20.765 18.5847 20.8567 18.7271 20.9203 18.8872C20.9838 19.0473 21.0156 19.2337 21.0156 19.4463C21.0156 19.7397 20.96 19.9859 20.8487 20.1851C20.7375 20.3844 20.5865 20.5457 20.3957 20.6691C20.205 20.7926 19.9831 20.8812 19.73 20.935C19.4769 20.9887 19.2097 21.0156 18.9285 21.0156C18.6399 21.0156 18.3655 20.9912 18.105 20.9423C17.8446 20.8934 17.619 20.8201 17.4283 20.7223ZM16.9609 16.6582H15.4558V20.9453H14.2634V16.6582H12.7656V15.6953H16.9609V16.6582Z",fill:"#6F6E77"})})},e4=function(){return(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",children:(0,i.jsx)("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12.031 11L15.7584 17.8336L16.0831 18.4288L16.4077 17.8336L20.1352 11H22L16.0831 21.4347L10 11H12.031ZM19.2924 11.0006L16.0831 16.8843L12.8737 11.0005L14.2612 11.0001L14.727 11L15.2777 11.9497L16.1319 13.4226L16.9886 11.9512L17.542 11.0006H17.9881H19.2924Z",fill:"#6F6E77"})})},e7=t(19873),e6=t.n(e7);eW.Z.registerLanguage("tsx",eY.Z),eW.Z.registerLanguage("markup",eq.Z),eW.Z.alias("markup","vue"),eW.Z.alias("markup","svelte");var e8=function(e){var n,t=(null!==(n=e.fileName.match(/\.([^\.]*)$/))&&void 0!==n?n:[])[1];return function(){switch(t){case"ts":case"tsx":return(0,i.jsx)(e2,{});case"js":case"jsx":return(0,i.jsx)(e0,{});case"vue":return(0,i.jsx)(e4,{});case"svelte":return(0,i.jsx)(e1,{});default:return(0,i.jsx)(eJ,{})}}()},e3=function(e){var n=e.code,t=e.onCopy,o=(0,s.useState)(!1),l=o[0],a=o[1];(0,s.useEffect)(function(){if(l){var e=setTimeout(function(){a(!1)},1200);return function(){clearTimeout(e)}}},[l]);var c=function(){navigator.clipboard.writeText(n).then(function(){a(!0),void 0!==t&&t()})};return(0,i.jsx)(r.hU,{size:"small",onClick:c,icon:l?"check":"contentCopy",hiddenLabel:l?"Code successfully copied":"Copy code"})},e5=function(e){var n=e.fileInfo,t=e.className,o=e.copy,l=e.code,a=e.onCopy,s=/language-(\w+)/.exec(null!=t?t:"");return(0,i.jsxs)("div",{className:e6().root,children:[(0,i.jsxs)("div",{className:e6().header,children:[void 0!==n?(0,i.jsxs)("div",{className:e6().fileInfo,children:[(0,i.jsx)(e8,{fileName:n.fileName}),(0,i.jsx)(r.xv,{className:e6().fileName,color:"grey11",children:n.fileName})]}):(0,i.jsx)("span",{}),!0===o?(0,i.jsx)(e3,{onCopy:a,code:String(l)}):null]}),null!==s&&s[1]?(0,i.jsx)(eW.Z,{showLineNumbers:!0,customStyle:{margin:0,border:"none",fontSize:"12px",lineHeight:"18px",borderRadius:"none",backgroundColor:"#FFF",borderBottomLeftRadius:"4px",borderBottomRightRadius:"4px"},children:String(l).replace(/\n$/,""),style:e$.MS,language:s[1],PreTag:"div"}):l]})},e9=t(13733),ne=t(40545),nn=t.n(ne),nt=function(e){var n=(0,e9.p)();if(!0===e.inline)return(0,i.jsx)("code",(0,X.Z)((0,Z.Z)({},e),{className:nn().inlineCode}));var t=function(){var n,t;if((null===(n=e.node)||void 0===n?void 0:null===(t=n.data)||void 0===t?void 0:t.meta)!==void 0){var i,r,o,l=null===(i=e.node)||void 0===i?void 0:null===(r=i.data)||void 0===r?void 0:r.meta;return{fileName:l.substring(1,l.length-1),language:null===(o=e.className)||void 0===o?void 0:o.split("-")[1]}}return null}(),r=function(){y.Xe.track({event:"page-type:copy-snippet",framework:n})};return(0,i.jsx)(e5,(0,Z.Z)((0,X.Z)((0,Z.Z)({copy:!0},e),{onCopy:r,code:e.children}),null!==t?{fileInfo:t}:{}))},ni=function(e){var n=e.markdown;return(0,i.jsx)(eQ.D,{children:n,linkTarget:"_blank",remarkPlugins:[eG.Z],components:{code:function(e){return(0,i.jsx)(nt,(0,Z.Z)({},e))},h1:function(e){return(0,i.jsx)(r.xv,{children:e.children,component:"h1",variant:"h1"})},h2:function(e){return(0,i.jsx)(r.xv,{children:e.children,component:"h2",variant:"h2"})},h3:function(e){return(0,i.jsx)(r.xv,{children:e.children,component:"h3",variant:"h3"})},h4:function(e){return(0,i.jsx)(r.xv,{children:e.children,component:"h4",variant:"h4"})},h5:function(e){return(0,i.jsx)(r.xv,{children:e.children,component:"h4",variant:"h4"})},p:function(e){return(0,i.jsx)(r.xv,{className:nn().section,children:e.children,component:"p",variant:"normal"})},pre:function(e){return(0,i.jsx)(r.xv,{className:nn().section,children:e.children,component:"pre",variant:"normal"})}}})};function nr(e){return no.apply(this,arguments)}function no(){return(no=(0,p.Z)(function(e){var n,t,i,r;return(0,v.__generator)(this,function(o){switch(o.label){case 0:return n=JSON.parse(e),[4,en.j.documentation.read({kind:n.kind,data:n.data})];case 1:if(i=(t=o.sent()).errors,r=t.documentation,i.length>0)throw i;return[2,r]}})})).apply(this,arguments)}var nl=t(11680),na=t.n(nl),ns=function(e){var n,t=e.model,o=(0,e9.p)(),l=(0,ee.QT)(nr,[JSON.stringify({kind:"PageSnippet",data:{model:t}})]);if(0===l.length)return null;var a=function(){y.Xe.track({event:"page-type:open-snippet",framework:o})};return(0,i.jsxs)(r.Vq,{size:"small",trigger:(0,i.jsx)(r.zx,{color:"grey",onClick:a,startIcon:"code",children:"Page snippet"}),children:[(0,i.jsx)(r.fK,{icon:"code",title:"Page snippet"}),(0,i.jsx)("section",{className:na().content,children:l.length>1?(0,i.jsx)(eX,{style:{flex:1},tabs:l.map(function(e,n){var t=e.label,r=e.content;return{label:null!=t?t:"Tab ".concat(n+1),content:(0,i.jsx)(ni,{markdown:r})}})}):(0,i.jsx)(r.xr,{style:{flex:1,padding:16},children:(0,i.jsx)(ni,{markdown:l[0].content})})})]})},nc=function(e){var n=e.model;return(0,i.jsx)("div",{children:(0,i.jsx)(z.S,{children:(0,i.jsx)(s.Suspense,{fallback:(0,i.jsx)(r.zx,{color:"grey",startIcon:"code",children:"Page snippet"}),children:(0,i.jsx)(ns,{model:n})})})})},nu=function(){var e=(0,a.useRouter)(),n=(0,c.v9)(function(n){return{selectedCustomType:(0,eR.Jk)(n,(0,f.Ag)(e.query))}}).selectedCustomType;return((0,s.useEffect)(function(){n&&(0,eH.TG)(n)||e.replace("/")},[n,e]),n&&(0,eH.TG)(n))?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l(),{children:(0,i.jsxs)("title",{children:[n.local.label," - Slice Machine"]})}),(0,i.jsx)(nd,{customType:n.local})]}):(0,i.jsx)(h.LN,{})},nd=function(e){var n=e.customType;return null===n?(0,i.jsx)(h.LN,{}):(0,i.jsx)(h.LN,{children:(0,i.jsx)(I,{initialCustomType:_.Dc.fromSM(n),children:function(e){var t,o=e.actionQueueStatus,l=e.customType,a=e.setCustomType,s=(0,d.y6)(l),c=f.cd[n.format],p=C.$[n.format];return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(h.wd,{children:[(0,i.jsx)(h.Xq,{url:c.tablePagePathname}),(0,i.jsxs)(h.Cx,{children:[(0,i.jsx)(u.g,{children:p.name({start:!0,plural:!0})}),(0,i.jsx)(u.g,{active:!0,children:null!==(t=l.label)&&void 0!==t?t:l.id})]}),(0,i.jsxs)(h.K2,{children:[(0,i.jsx)(m.X,{status:o}),"page"===l.format?(0,i.jsx)(nc,{model:l}):void 0,(0,i.jsx)(eB._,{isChangesLocal:!0,format:s,customType:l,setLocalCustomType:a})]})]}),(0,i.jsx)(h.RN,{children:(0,i.jsx)(r.xu,{flexDirection:"column",minWidth:0,children:(0,i.jsx)(ez,{})})})]})}})})}},32713:function(e,n,t){"use strict";t.d(n,{E:function(){return c}});var i=t(22710),r=t(62230),o=t(85244),l=t(17064),a=t(99267),s=t(39374);function c(e){var n,t,c,u=(0,l.Z)((0,s.f)(),2),d=u[0],m=u[1],f=(c=(0,i.Z)(function(n){var t;return(0,a.__generator)(this,function(i){switch(i.label){case 0:return t=(0,o.Z)((0,r.Z)({},d),{labs:(0,r.Z)({},d.labs)}),n?t.labs[e]=n:e in t.labs&&delete t.labs[e],0===Object.keys(t.labs).length&&delete t.labs,[4,m(t)];case 1:return i.sent(),[2]}})}),function(e){return c.apply(this,arguments)});return[{enabled:null!==(t=null==d?void 0:null===(n=d.labs)||void 0===n?void 0:n[e])&&void 0!==t&&t},f]}},39374:function(e,n,t){"use strict";t.d(n,{f:function(){return a}});var i=t(22710),r=t(99267),o=t(18566),l=t(7604);function a(){var e,n=(0,o.QT)(s,[]),t=(e=(0,i.Z)(function(e){return(0,r.__generator)(this,function(n){switch(n.label){case 0:return[4,l.j.project.writeSliceMachineConfig({config:e})];case 1:return n.sent(),(0,o.VA)(s,[],e),[2]}})}),function(n){return e.apply(this,arguments)});return[n,t]}function s(){return c.apply(this,arguments)}function c(){return(c=(0,i.Z)(function(){return(0,r.__generator)(this,function(e){return[2,l.j.project.getSliceMachineConfig()]})})).apply(this,arguments)}},13330:function(e,n,t){"use strict";t.d(n,{c:function(){return C}});var i=t(22710),r=t(62230),o=t(85244),l=t(99267),a=t(52322),s=t(2784),c=t(36131),u=t(75289),d=t(12189),m=t(88932),f=t(74029),h=t(55197),p=t(7604);function v(){return(v=(0,i.Z)(function(e){var n,t,i,r,o,a,s;return(0,l.__generator)(this,function(l){switch(l.label){case 0:n=e.sliceName,t=e.libraryName,i=e.onSuccess,l.label=1;case 1:return l.trys.push([1,4,,5]),r=(0,f.fo)(n),[4,p.j.slices.createSlice({libraryID:t,model:r})];case 2:if((o=l.sent().errors).length>0)throw o;return d.Xe.track({event:"slice:created",id:(0,h.MP)(n),name:n,library:t}),[4,i(r)];case 3:return l.sent(),[3,5];case 4:return a=l.sent(),s="An unexpected error happened while creating slice ".concat(n,"."),console.error(s,a),m.Am.error(s),[3,5];case 5:return[2]}})})).apply(this,arguments)}var x=t(35393),y=t(4995),b=t(7342),j=t(44570),g=t(41434),C=function(e){var n,t=e.onClose,m=e.onSuccess,f=e.localLibraries,h=e.remoteSlices,p=(0,b.Z)().createSliceSuccess,C=(0,s.useState)(!1),S=C[0],I=C[1],w=(0,x.g)().syncChanges,_=(n=(0,i.Z)(function(e){var n,t;return(0,l.__generator)(this,function(r){switch(r.label){case 0:var o;return n=e.sliceName,t=e.from,I(!0),[4,function(e){return v.apply(this,arguments)}({sliceName:n,libraryName:t,onSuccess:(o=(0,i.Z)(function(e){var n;return(0,l.__generator)(this,function(n){switch(n.label){case 0:return[4,(0,d.y0)()];case 1:return p(n.sent().libraries),m(e,t),w(),[2]}})}),function(e){return o.apply(this,arguments)})})];case 1:return r.sent(),[2]}})}),function(e){return n.apply(this,arguments)});return(0,a.jsx)(y.Z,{testId:"create-slice-modal",isOpen:!0,widthInPx:"530px",isLoading:S,formId:"create-new-slice",close:t,buttonLabel:"Create",onSubmit:function(e){_(e)},initialValues:{sliceName:"",from:f[0].name},validate:function(e){return(0,g.h)(e,f,h)},content:{title:"Create a new slice"},children:function(e){var n=e.touched,t=e.values,i=e.setFieldValue,l=e.errors;return(0,a.jsxs)(u.xu,{children:[(0,a.jsx)(j.W,{name:"sliceName",label:"Slice Name",placeholder:"Pascalised Slice API ID (e.g. TextBlock)",error:n.sliceName?l.sliceName:void 0,testId:"slice-name-input"}),(0,a.jsx)(u.__,{htmlFor:"from",sx:{mb:2},children:"Target Library"}),(0,a.jsx)(c.ZP,{name:"from",options:f.map(function(e){return{value:e.name,label:e.name}}),onChange:function(e){return e?void i("from",e.value):null},defaultValue:{value:t.from,label:t.from},styles:{option:function(e){return(0,o.Z)((0,r.Z)({},e),{color:"#161618"})}},theme:function(e){return(0,o.Z)((0,r.Z)({},e),{colors:(0,o.Z)((0,r.Z)({},e.colors),{primary:"#E9E8EA"})})},menuPortalTarget:document.body})]})}})}},41434:function(e,n,t){"use strict";t.d(n,{h:function(){return c}});var i=t(81541),r=t(96009),o=t.n(r),l=t(74600),a=t.n(l),s=t(25978);function c(e,n,t){var r=e.sliceName;if(!r)return{sliceName:"Cannot be empty"};if(!s.xo.exec(r))return{sliceName:"No special characters allowed"};if(a()(o()(r)).replace(/\s/gm,"")!==r.trim())return{sliceName:"Value has to be PascalCased"};if(r.match(/^\d/))return{sliceName:"Value cannot start with a number"};if(s.lS.includes(r))return{sliceName:"".concat(r," is reserved for Slice Machine use")};var l=n.flatMap(function(e){return e.components.map(function(e){return e.model.name})}),c=t.map(function(e){return e.name});if((0,i.Z)(l).concat((0,i.Z)(c)).includes(r))return{sliceName:"Slice name is already taken."}}},26574:function(e,n,t){"use strict";var i=t(62230),r=t(52322),o=t(75289);n.Z=function(e){var n=e.elems,t=e.renderElem,l=e.defineElementKey,a=e.gridTemplateMinPx,s=e.gridGap,c=e.sx;return(0,r.jsx)(o.xu,{as:"section",sx:(0,i.Z)({display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(".concat(void 0===a?"320px":a,", 1fr))"),gridGap:void 0===s?"16px":s,pt:2},c),children:n.map(function(e,n){return e?(0,r.jsx)("span",{children:t(e,n)},"".concat(l(e),"-").concat(n+1)):null})})}},19873:function(e){e.exports={block:"CodeBlock_block__ljak4",blockWithDisplayRevert:"CodeBlock_blockWithDisplayRevert__zM3Ns CodeBlock_block__ljak4",root:"CodeBlock_root__3ZYFL CodeBlock_blockWithDisplayRevert__zM3Ns CodeBlock_block__ljak4",header:"CodeBlock_header__kLT1f CodeBlock_block__ljak4",fileInfo:"CodeBlock_fileInfo__ocLpL CodeBlock_block__ljak4",fileName:"CodeBlock_fileName__jmuEV CodeBlock_blockWithDisplayRevert__zM3Ns CodeBlock_block__ljak4"}},87808:function(e){e.exports={flex:"ContentTabs_flex__kAimf",column:"ContentTabs_column__x5QZL ContentTabs_flex__kAimf",root:"ContentTabs_root__GPtve ContentTabs_column__x5QZL ContentTabs_flex__kAimf",list:"ContentTabs_list__XarTi ContentTabs_flex__kAimf",trigger:"ContentTabs_trigger__8hs6H ContentTabs_column__x5QZL ContentTabs_flex__kAimf",triggerText:"ContentTabs_triggerText__ka3DD",content:"ContentTabs_content__mMr1s ContentTabs_column__x5QZL ContentTabs_flex__kAimf",scrollArea:"ContentTabs_scrollArea__ZBVHa"}},11680:function(e){e.exports={content:"PageSnippetDialog_content___SDjB"}},40545:function(e){e.exports={section:"MarkdownRenderer_section__4QTyU",inlineCode:"MarkdownRenderer_inlineCode__Oois6"}},24221:function(e){e.exports={scrollArea:"ConvertLegacySliceButton_scrollArea__gW7L4",label:"ConvertLegacySliceButton_label__yP2Pt"}}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[574],{85513:function(e,t,n){"use strict";n.d(t,{aV:function(){return u},Bu:function(){return p}});var i=n(62230),r=n(85244),o=n(98240),l=n(52322),a=n(37577),s=n(6277),c=n(41350),d=n.n(c),u=function(e){var t=e.border,n=(0,o.Z)(e,["border"]);return(0,l.jsx)("div",(0,r.Z)((0,i.Z)({},n),{className:(0,s.Z)(d().root,(void 0===t||t)&&d()["root-border"])}))},p=function(e){var t=e.actions,n=e.children,s=e.toggle,c=(0,o.Z)(e,["actions","children","toggle"]);return(0,l.jsxs)("div",(0,r.Z)((0,i.Z)({},c),{className:d().header,children:[(0,l.jsx)(a.xv,{color:"grey11",component:"span",noWrap:!0,variant:"bold",children:n}),s,Boolean(t)?(0,l.jsx)("div",{className:d().headerActions,children:t}):null]}))}},14866:function(e,t,n){"use strict";n.d(t,{J9:function(){return l},U:function(){return s},XU:function(){return d},fF:function(){return a}});var i=n(62230),r=n(85244),o=n(81541),l=[{name:"Image",description:"A responsive image.",icon:"image",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295520/DEV_TOOLS/SM_FIELDS/Type_Image_zyatxy.png",type:"Image"},{name:"Text",description:"A text string without formatting.",icon:"title",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295529/DEV_TOOLS/SM_FIELDS/Type_Key_Text_xrqf45.png",type:"Text"},{name:"Rich Text",description:"Text with formatting options.",icon:"textFields",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295530/DEV_TOOLS/SM_FIELDS/Type_Rich_Text_fxdyar.png",type:"StructuredText"},{name:"Boolean",description:"A true or false toggle.",icon:"toggleOff",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295526/DEV_TOOLS/SM_FIELDS/Type_Boolean_cbwg8k.png",type:"Boolean"},{name:"Number",description:"An integer or float.",icon:"pin",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295522/DEV_TOOLS/SM_FIELDS/Type_Number_o3olop.png",type:"Number"},{name:"Select",description:"A dropdown of options.",icon:"arrowDropDownCircle",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295527/DEV_TOOLS/SM_FIELDS/Type_Select_bedjei.png",type:"Select"},{name:"Link",description:"A link to a website, asset, or document.",icon:"link",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295528/DEV_TOOLS/SM_FIELDS/Type_Link_bgslgy.png",type:"Link"},{name:"Link To Media",description:"A link to a media asset.",icon:"attachFile",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295519/DEV_TOOLS/SM_FIELDS/Type_LinkToMedia_m2p0ce.png",type:"Link",variant:"LinkToMedia"},{name:"Color",description:"A color in hex format.",icon:"colorLens",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295521/DEV_TOOLS/SM_FIELDS/Type_Color_nyoeit.png",type:"Color"},{name:"Date",description:"A date without time.",icon:"dateRange",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295525/DEV_TOOLS/SM_FIELDS/Type_Date_dsuaeq.png",type:"Date"},{name:"Timestamp",description:"A date and time.",icon:"schedule",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295524/DEV_TOOLS/SM_FIELDS/Type_Timestamp_fkr5iw.png",type:"Timestamp"},{name:"Embed",description:"A video, song, or oEmbed link.",icon:"code",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295523/DEV_TOOLS/SM_FIELDS/Type_Embed_wwssvd.png",type:"Embed"},{name:"Geopoint",description:"A geographical coordinate.",icon:"place",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295522/DEV_TOOLS/SM_FIELDS/Type_GeoPoint_lpq0sm.png",type:"GeoPoint"},{name:"Content Relationship",description:"A reference to a Prismic document.",icon:"settingsEthernet",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295527/DEV_TOOLS/SM_FIELDS/Type_Content_RelationShip_s4z4nh.png",type:"Link",variant:"ContentRelationship"},],a={name:"UID",description:"Unique Identifier",icon:"tag",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295519/DEV_TOOLS/SM_FIELDS/Type_UID_hrwzug.png",type:"UID"},s={name:"Repeatable Group",description:"A set of fields that editors can repeat.",icon:"createNewFolder",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721314577/DEV_TOOLS/SM_FIELDS/Type_Group_uwwco0.png",type:"Group"},c=(0,r.Z)((0,i.Z)({},s),{variant:"NestedGroup"}),d=(0,o.Z)(l).concat([a],(0,o.Z)([s,c]))},90104:function(e,t,n){"use strict";n.d(t,{X:function(){return o}});var i=n(52322),r=n(37577),o=function(e){var t,n=e.status;switch(n){case"pending":t={icon:(0,i.jsx)(r._3,{color:"grey11"}),text:"Saving..."};break;case"failed":t={icon:(0,i.jsx)(r.I5,{name:"close",color:"tomato11",size:"medium"}),text:"Failed to save"};break;case"done":t={icon:(0,i.jsx)(r.I5,{name:"check",color:"green11",size:"medium"}),text:"Auto-saved"}}return(0,i.jsxs)(r.xu,{gap:8,alignItems:"center",children:[t.icon,(0,i.jsx)(r.xv,{color:"grey11",children:t.text})]})}},85905:function(e,t,n){"use strict";n.d(t,{S:function(){return l}});var i=n(52322),r=n(37577),o=n(14866);function l(e){var t=e.disabled,n=e.onSelectField,l=e.fields,s=e.triggerDataTestId,c=l.filter(function(e){return o.J9.some(function(t){return t.name===e.name})||e.name===o.fF.name}),d=l.find(function(e){return e.name===o.U.name});return(0,i.jsxs)(r.h_,{children:[(0,i.jsx)(r.$F,{disabled:t,children:(0,i.jsx)(r.zx,{startIcon:"add",color:"grey","data-testid":void 0===s?"add-field":s,children:"Add a field"})}),(0,i.jsxs)(r.AW,{align:"end",maxHeight:400,collisionPadding:8,children:[(0,i.jsx)(r.Ju,{children:"Single fields"}),c.map(function(e){return(0,i.jsx)(a,{field:e,onSelectField:n},e.name)}),d&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.Ju,{children:"Set of fields"}),(0,i.jsx)(a,{field:d,onSelectField:n})]})]})]})}function a(e){var t=e.field,n=e.onSelectField,o=t.type,l=t.variant,a=t.name,s=t.icon,c=t.description,d=t.thumbnail;return(0,i.jsx)(r.Xi,{startIcon:(0,i.jsx)(r.I5,{name:s,size:"large"}),description:c,onSelect:function(){return n(null!=l?l:o)},renderTooltip:function(e){return(0,i.jsx)(r.u,{visible:!0,variant:"custom",content:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.Ee,{src:d,sx:{height:170,width:278,borderRadius:4},animateOnLoad:!1}),(0,i.jsx)(r.xv,{color:"white",children:"How it will look for content editors."})]}),align:"start",side:"left",sideOffset:4,animation:"none",children:e})},children:a},"".concat(o).concat(l?"-".concat(l):""))}},51279:function(e,t,n){"use strict";n.d(t,{Z:function(){return d}});var i=n(62230),r=n(52322),o=n(61183);n(2784);var l=n(59326),a=n(75289),s=function(e){return{subLanguage:"xml",contains:[e.COMMENT("<!--","-->",{relevance:10}),{begin:/^(\s*)(<script(\s*context="module")?>)/gm,end:/^(\s*)(<\/script>)/gm,subLanguage:"javascript",excludeBegin:!0,excludeEnd:!0,contains:[{begin:/^(\s*)(\$:)/gm,end:/(\s*)/gm,className:"keyword"},]},{begin:/^(\s*)(<style.*>)/gm,end:/^(\s*)(<\/style>)/gm,subLanguage:"css",excludeBegin:!0,excludeEnd:!0},{begin:/\{/gm,end:/\}/gm,subLanguage:"javascript",contains:[{begin:/[\{]/,end:/[\}]/,skip:!0},{begin:/([#:\/@])(if|else|each|await|then|catch|debug|html)/gm,className:"keyword",relevance:10},]},]}};o.Z.registerLanguage("svelte",s);var c=["javascript","bash","xml","html","json"],d=function(e){var t,n=e.children,s=e.lang,d=e.sx,u=e.codeStyle,p=e.codeClass,f=e.Header,m=(0,l.B7)().theme,h=s?o.Z.highlight(n,{language:"vue"===s?"html":s}).value:o.Z.highlightAuto(n,c).value;return(0,r.jsxs)(a.kC,{as:"pre",sx:d,children:[f?(0,r.jsx)(f,{}):null,(0,r.jsx)("code",{className:"hljs".concat(p?" ".concat(p):""),style:(0,i.Z)({overflowX:"auto",padding:"3px 5px",borderRadius:"6px",border:"1px solid",borderColor:String(null===(t=m.colors)||void 0===t?void 0:t.textClear)},u),dangerouslySetInnerHTML:{__html:h}})]})}},26950:function(e,t,n){"use strict";n.d(t,{J:function(){return c},k:function(){return s}});var i=n(62230),r=n(85244),o=n(98240),l=n(52322);n(2784);var a=n(75289),s=function(e){var t=e.children,n=e.sx,s=(0,o.Z)(e,["children","sx"]);return(0,l.jsx)(a.xu,(0,r.Z)((0,i.Z)({sx:(0,i.Z)({display:["block","block","flex"],flexWrap:"wrap",justifyContent:"space-between"},n)},s),{children:t}))},c=function(e){var t=e.children,n=e.cols;return(0,l.jsx)(a.xu,{sx:{flex:"0 ".concat(100/(void 0===n?2:n)-1,"%"),mb:1},children:t})}},35549:function(e,t,n){"use strict";n.d(t,{$w:function(){return i},Hq:function(){return u},tM:function(){return d}});var i,r=n(62230),o=n(85244),l=n(52322),a=n(63397);n(2784);var s,c=n(75289);(s=i||(i={}))[s.ERROR=0]="ERROR",s[s.DISABLED=1]="DISABLED",s[s.WARNING=2]="WARNING";var d=function(e){var t={"&::placeholder":{color:"#C9D0D8"}};switch(e){case i.DISABLED:return(0,o.Z)((0,r.Z)({},t),{border:"1px solid #E6E6EA",backgroundColor:"#F3F5F7"});case i.ERROR:return(0,o.Z)((0,r.Z)({},t),{border:"1px solid #E26049","&:focus":{outline:"none",borderColor:"#E26049",boxShadow:"0 0 0 3px rgba(226, 96, 73, 0.2), inset 0 1px 2px rgba(226, 96, 73, 0.2)"}});case i.WARNING:return(0,o.Z)((0,r.Z)({},t),{border:"1px solid orange","&:focus":{outline:"none",borderColor:"orange",boxShadow:"0 0 0 3px rgba(255, 165, 0, 0.2), inset 0 1px 2px rgba(255, 165, 0, 0.2)"}});default:return t}},u=function(e){var t=e.sx,n=e.field,s=e.meta,u=e.formField,p=e.fieldName,f=e.fields,m=e.initialValues,h=e.isDisabled,x=s.error?i.ERROR:h||u.disabled?i.DISABLED:void 0;return(0,l.jsxs)(c.xu,{sx:void 0===t?{}:t,children:[(0,l.jsxs)(c.__,{variant:"label.primary",htmlFor:p,children:[u.label||p,s.touched&&s.error?(0,l.jsx)(c.xv,{as:"span",variant:"text.labelError",children:s.error}):null]}),(0,l.jsx)(a.gN,(0,o.Z)((0,r.Z)({id:p,name:p,type:"text",placeholder:u.placeholder||u.label||p},u.fieldLevelValidation&&m?{validate:function(e){return u.fieldLevelValidation&&u.fieldLevelValidation({value:e,fields:f,initialId:m.id})}}:null,n),{as:c.II,sx:d(x),disabled:h||u.disabled}))]})}},20180:function(e,t,n){"use strict";n.d(t,{kp:function(){return c},sP:function(){return u},w8:function(){return p},Hq:function(){return f.Hq}});var i=n(62230),r=n(85244),o=n(52322),l=n(63397),a=n(2784),s=n(75289),c=function(e){var t=e.field,n=e.meta,c=e.fieldName,d=e.label,u=e.focusOnNewEntry,p=void 0===u||u,f=e.inputPlaceholder,m=e.buttonLabel,h=(0,a.useState)(n.value.length),x=h[0],g=h[1],v=(0,a.useRef)(Array(n.value.length));return(0,a.useEffect)(function(){v.current=v.current.slice(0,n.value.length)},[n.value.length]),(0,a.useEffect)(function(){var e=v.current.length;p&&e>x&&v.current[e-1].focus(),g(e)},[v.current.length,p,x]),(0,o.jsxs)(a.Fragment,{children:[(0,o.jsxs)(s.__,{variant:"label.primary",htmlFor:c,children:[d,n.touched&&n.error?(0,o.jsx)(s.xv,{as:"span",variant:"text.labelError",children:n.error}):null]}),(0,o.jsx)(l.F2,(0,r.Z)((0,i.Z)({name:c,id:c},t),{render:function(e){return(0,o.jsxs)("div",{children:[t.value&&t.value.length>0?t.value.map(function(t,n){return(0,o.jsxs)(s.kC,{my:2,children:[(0,o.jsx)(s.II,{placeholder:f,name:"".concat(c,".").concat(n),value:t,ref:function(e){return v.current[n]=e},onChange:function(t){var i=t.target.value;return e.replace(n,i)}}),(0,o.jsx)(s.zx,{ml:2,type:"button",variant:"secondary",onClick:function(){return e.remove(n)},children:"-"})]},"".concat(c,"-").concat(+n+1))}):null,(0,o.jsx)(s.zx,{type:"button",onClick:function(){return e.insert(t.value.length,"")},children:m})]})}}))]})},d=n(98240),u=function(e){e.initialValues;var t=e.meta,n=e.label,a=e.fieldName,c=e.onChange,u=(0,d.Z)(e,["initialValues","meta","label","fieldName","onChange"]);return(0,o.jsxs)(s.__,(0,r.Z)((0,i.Z)({variant:"label.border"},u),{children:[(0,o.jsx)(l.gN,{as:s.XZ,type:"checkbox",name:a,onChange:function(){return c(!t.value)},checked:t.value}),n]}))},p=function(e){var t=e.field,n=e.label,i=e.defaultValue,r=e.onChange,l=e.controlledValue,s=e.setControlledValue,c=e.buildControlledValue,d=(0,a.useState)(i||t.defaultValue||!1),p=d[0],f=d[1];return(0,a.useEffect)(function(){c?s(c(l,p)):s(c)},[p,l,c]),(0,o.jsx)(u,{meta:{value:p},fieldName:t.name,onChange:function(e){return f(e)&&r&&r(e)},label:"function"==typeof n?n(l,p):n})},f=n(35549)},82004:function(e,t,n){"use strict";var i=n(62230),r=n(85244),o=n(98240),l=n(52322),a=n(2784),s=n(75289),c=(0,a.forwardRef)(function(e,t){var n=e.children,a=e.Component,c=void 0===a?s.kC:a,d=e.sx,u=(0,o.Z)(e,["children","Component","sx"]);return(0,l.jsx)(c,(0,r.Z)((0,i.Z)({as:"li",sx:(0,i.Z)({p:3,mx:3,alignItems:"center",variant:"styles.listItem"},void 0===d?{}:d),ref:t},u),{children:n}))});t.Z=c},1225:function(e,t,n){"use strict";n.d(t,{Z:function(){return j}});var i=n(62230),r=n(85244),o=n(52322),l=n(5446),a=n(2784),s=n(40023),c=n(951),d=n(8799),u=n(18978),p=n(59326),f=n(75289),m=n(82004),h=n(26474),x=n(98240),g=n(33710),v=n(79401),b=function(e){var t=e.text,n=e.as,l=e.sx,s=(0,x.Z)(e,["text","as","sx"]),c=(0,a.useRef)(null),d=(0,a.useState)(null),u=d[0],p=d[1],m=function(){p(c.current&&c.current.offsetWidth<c.current.scrollWidth)};return(0,a.useEffect)(function(){return m(),window.addEventListener("resize",m),function(){window.removeEventListener("resize",m)}},[]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(f.xv,(0,r.Z)((0,i.Z)({"data-for":t,"data-tip":!0,sx:(0,i.Z)({flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},void 0===l?{}:l),as:n,ref:c},s),{children:t})),u&&(0,o.jsx)(v.X,{children:(0,o.jsx)(g.Z,{id:t,type:"dark",multiline:!0,border:!0,borderColor:"black",place:"bottom",effect:"solid",children:t})})]})},y=function(e){var t,n,i=e.text,r=e.sliceFieldName,l=e.theme,a=e.WidgetIcon;return(0,o.jsxs)(f.kC,{sx:{alignItems:"center",position:"relative"},children:[(0,o.jsx)(a,{size:28,style:{color:null===(t=l.colors)||void 0===t?void 0:t.primary,marginRight:"8px",borderRadius:"4px",padding:"4px",border:"2px solid",borderColor:null===(n=l.colors)||void 0===n?void 0:n.primary}}),(0,o.jsx)(b,{text:i,as:"p",sx:{py:0,px:1,fontWeight:"label",fontSize:"15px"},"data-testid":"field-name"}),(0,o.jsx)(f.xv,{as:"p",sx:{display:["none","none","initial"],fontSize:"14px",ml:1,color:"textClear"},"data-testid":"field-id",children:r})]})},j=function(e){var t=e.item,n=e.index,x=e.deleteItem,g=e.enterEditMode,v=e.modelFieldName,b=e.renderFieldAccessor,j=e.HintElement,Z=e.CustomEditElement,S=e.CustomEditElements,I=e.widget,_=e.draggableId,E=e.testId,F=e.isRepeatableCustomType,T=e.children,k=(0,p.B7)().theme,C=t.key,w=t.value,N=w.config,M=w.type;return(0,o.jsx)(a.Fragment,{children:(0,o.jsx)(s._l,{draggableId:_,index:n,children:function(e){var s,p,_,w,L;return(0,o.jsx)(a.Fragment,{children:(0,o.jsxs)(m.Z,(0,r.Z)((0,i.Z)({"data-testid":E,ref:e.innerRef},e.draggableProps),{Component:f.xu,sx:{p:0,mx:0,my:3},children:[(0,o.jsxs)(f.kC,{sx:{width:"100%"},children:[(0,o.jsx)(h.Z,(0,i.Z)({label:"Reorder slice field (drag and drop)",Icon:u.Fm7,color:null===(s=k.colors)||void 0===s?void 0:s.icons,mr:1,mt:3},e.dragHandleProps)),(0,o.jsxs)(f.xu,{sx:{bg:"headSection",width:"100%",borderRadius:"3px",border:function(e){var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))}},children:[(0,o.jsxs)(f.kC,{sx:{p:3,alignItems:"center",justifyContent:"space-between",width:"100%"},children:[(0,o.jsx)(y,{theme:k,text:(null==N?void 0:N.label)||C,sliceFieldName:b&&b(C),WidgetIcon:I.Meta.icon}),(0,o.jsxs)(f.kC,{children:[S||null,Z||(0,o.jsx)(h.Z,{size:22,Icon:c.$iz,label:"Edit field",sx:{cursor:"pointer",color:null===(p=k.colors)||void 0===p?void 0:p.icons},onClick:function(){return g([C,t.value],v,n)}}),!(!0===F&&"UID"==M)&&(0,o.jsxs)(l.v2,{children:[(0,o.jsx)(l.j2,{className:"sliceMenuButton","data-testid":"field-menu-button",style:{padding:"0",cursor:"pointer",width:"32px",height:"32px",border:"none",background:"transparent",outline:"0"},children:(0,o.jsx)(d.FQA,{size:20,color:null===(_=k.colors)||void 0===_?void 0:_.icons,style:{pointerEvents:"none"}})}),(0,o.jsx)(l.qy,{style:{background:null===(w=k.colors)||void 0===w?void 0:w.gray,border:"1px solid",borderRadius:"3px",borderColor:null===(L=k.colors)||void 0===L?void 0:L.borders,outline:"0"},children:(0,o.jsx)(l.sN,{style:{padding:"6px",cursor:"pointer"},onSelect:function(){return x(C)},children:"Delete field"})})]})]})]}),j||null]})]}),T]}))})}})})}},26474:function(e,t,n){"use strict";var i=n(62230),r=n(85244),o=n(98240),l=n(52322),a=n(75289),s=function(e,t){return t?{border:function(e){var t=e.colors;return"1px solid ".concat(t.error)}}:e?{border:function(e){var t=e.colors;return"1px solid ".concat(t.primary)}}:{border:function(e){var t=e.colors;return"1px solid ".concat(t.borders)}}},c=function(e){var t=e.sx,n=e.onClick,c=e.label,d=e.Icon,u=e.error,p=e.size,f=void 0===p?16:p,m=e.fitButton,h=e.active,x=e.useActive,g=e.activeSx,v=(0,o.Z)(e,["sx","onClick","label","Icon","error","size","fitButton","active","useActive","activeSx"]);return(0,l.jsx)(a.hU,(0,r.Z)((0,i.Z)({onClick:void 0===n?function(){return null}:n,"aria-label":c,type:"button",sx:(0,i.Z)({},void 0!==m&&m?{width:f,height:f}:null,void 0!==x&&x&&(void 0===g?s:g)(void 0!==h&&h,void 0===u?null:u),void 0===t?null:t)},v),{children:(0,l.jsx)(d,{size:f})}))};t.Z=c},79474:function(e,t,n){"use strict";var i=n(62230),r=n(17064),o=n(52322),l=n(63397),a=n(2784),s=n(75289),c=n(20180),d=n(33413),u=function(e){var t=e.fieldName,n=e.formField,u=e.fields,p=e.initialValues,f=(0,r.Z)((0,l.U$)(t),3),m=f[0],h=f[1],x=f[2],g=n.component;return(0,o.jsx)(s.xu,{sx:(0,i.Z)({mt:2,alignItems:"center"},n.type===d.h.CHECKBOX?{display:"flex",height:"130%"}:null),children:g?(0,o.jsx)(g,{meta:h,field:m,helpers:x,fieldName:t,formField:n,initialValues:p}):(0,o.jsxs)(a.Fragment,{children:[n.type===d.h.INPUT?(0,o.jsx)(c.Hq,{meta:h,field:m,fields:u,formField:n,fieldName:t,initialValues:p}):null,n.type===d.h.CHECKBOX&&(0,o.jsx)(c.sP,{meta:h,label:n.label,fieldName:t,initialValues:p,onChange:function(e){return x.setValue(e)}})]})})};t.Z=u},1411:function(e,t,n){"use strict";n.d(t,{Z:function(){return R}});var i=n(62230),r=n(85244),o=n(17064),l=n(52322),a=n(37149),s=n.n(a),c=n(59326),d=n(75289),u=n(65413),p=n(2784),f=n(92928),m=n(2978),h=n(98240),x=function(e){var t=e.children,n=(0,h.Z)(e,["children"]);return(0,l.jsx)(d.xu,(0,r.Z)((0,i.Z)({as:"ul",sx:{p:0,m:0,px:function(e){return"calc(".concat(e.space[3],"px + 8px)")},borderBottom:"1px solid #DFE1E5",position:"relative"}},n),{children:t}))};x.tabsRole="TabList";var g=function(e){var t=e.children,n=(0,h.Z)(e,["children"]),o=(0,c.B7)().theme;return(0,l.jsx)(f.OK,(0,r.Z)((0,i.Z)({},n),{style:(0,i.Z)({margin:"0 32px 0 0",top:"0",padding:"8px 0px",border:"none",bottom:"-1px",opacity:"0.8",transition:"all 150ms cubic-bezier(0.215,0.60,0.355,1)",borderRadius:"0"},n.selected?{borderBottom:"3px solid ".concat(o.colors.primary),color:o.colors.text,fontWeight:"500",opacity:"1",backgroundColor:"transparent"}:{borderBottom:"3px solid transparent"}),children:t}))};g.tabsRole="Tab";var v=function(e){var t=e.children,n=e.Footer,r=e.Header,o=e.tabs,a=e.bodySx,s=e.footerSx,c=e.defaultIndex,u=void 0===c?0:c,h=(0,p.useState)(u),v=h[0],b=h[1];return(0,l.jsx)(m.Z,{borderFooter:!0,footerSx:(0,i.Z)({p:0},s),bodySx:(0,i.Z)({p:0},a),sx:{border:"none"},Header:r,Footer:n,children:(0,l.jsxs)(f.mQ,{defaultIndex:u,onSelect:function(e){return b(e)},children:[(0,l.jsx)(x,{children:(o||[]).map(function(e){return(0,l.jsx)(g,{children:e},e)})}),p.Children.map(t,function(e,t){return(0,l.jsx)(d.xu,{sx:{p:function(e){return"calc(".concat(e.space[3],"px + 8px)")},display:t===v?"block":"none"},children:(0,l.jsx)(f.x4,{children:e})})})]})})},b=(0,p.memo)(v),y=n(26950),j=function(e){var t,n,i=e.text,r=e.sliceFieldName,o=e.theme,a=e.WidgetIcon;return(0,l.jsxs)(d.kC,{sx:{alignItems:"center"},children:[(0,l.jsx)(a,{size:28,style:{color:null===(t=o.colors)||void 0===t?void 0:t.primary,marginRight:"8px",borderRadius:"4px",padding:"4px",border:"2px solid",borderColor:null===(n=o.colors)||void 0===n?void 0:n.primary}}),(0,l.jsx)(d.xv,{as:"p","data-testid":"item-header-text",sx:{py:0,px:1,fontWeight:"label",fontSize:"15px"},children:i}),(0,l.jsx)(d.xv,{as:"p",sx:{display:["none","none","initial"],fontSize:"14px",ml:1,color:"textClear"},children:r})]})},Z=n(28199),S=n(86163),I=n(5632),_=n(65186),E=n(25978),F=function(){var e=(0,I.useRouter)();return(0,l.jsxs)(d.xu,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",padding:"60px"},children:[(0,l.jsx)(_.wr$,{size:48,color:"#C9D0D8"}),(0,l.jsx)(d.xu,{sx:{height:"12px"}}),(0,l.jsx)(d.xv,{color:"text",sx:{fontWeight:600,fontSize:"24px",lineHeight:"32px",textAlign:"center"},children:"Your mock data has moved"}),(0,l.jsx)(d.xu,{sx:{height:"8px"}}),(0,l.jsx)(d.xv,{color:"text",sx:{fontWeight:400,fontSize:"14px",lineHeight:"24px",textAlign:"center"},children:"You can now edit directly your mock data in the new Slice Simulator."}),(0,l.jsx)(d.xu,{sx:{height:"24px"}}),(0,l.jsx)(d.zx,{onClick:function(t){t.preventDefault(),window.open("".concat(e.asPath,"/simulator"),E.pq)},children:"Go to the Slice Simulator"})]})},T=n(58514),k=n(50535),C=n(69114),w=n(79474),N=n(67557),M=n(77033),L=n(63397),A=function(e){var t=e.formId,n=e.initialValues,a=e.validationSchema,s=e.onSave,c=e.FormFields,u=e.children;return(0,l.jsx)(d.xu,{children:(0,l.jsx)(L.J9,{initialValues:n,validationSchema:a,onSubmit:function(e,t){var n;s({newKey:e.id,value:Object.entries((0,h.Z)(e,["id"])).reduce(function(e,t){var n=(0,o.Z)(t,2),l=n[0],a=n[1];if((void 0===a?"undefined":(0,M.Z)(a))!==Boolean&&!a){var s,d=null===(s=c[l])||void 0===s?void 0:s.defaultValue;if(void 0!==d)return(0,r.Z)((0,i.Z)({},e),(0,N.Z)({},l,d))}return(0,r.Z)((0,i.Z)({},e),(0,N.Z)({},l,a))},{})})},children:function(e){return(0,l.jsx)(L.l0,{id:t,children:u((0,r.Z)((0,i.Z)({},e),{initialValues:n}))})}})})},D=(0,p.memo)(A);s().setAppElement("#__next");var R=function(e){var t=e.close,n=e.data,a=e.fields,s=e.onSave,p=e.zoneType,f=(0,c.B7)().theme;if(!n.isOpen)return null;var m=(0,o.Z)(n.field,2),h=m[0],x=m[1],g=(0,C.t)(T.C,x.config,x.type);if(!g)return(0,l.jsxs)("div",{children:[x.type," not found"]});var v=g.Meta.icon,I=g.FormFields,_=g.Form,E=g.schema,N=(0,i.Z)({},(0,S.f7)((0,k.B9)(I,"id")),g.prepareInitialValues?g.prepareInitialValues(x.config):x.config),M=function(){try{return{res:E.validateSync({type:x.type,config:N},{stripUnknown:!0})}}catch(e){return{err:e}}}(),L=M.res,A=M.err;A&&(console.error("[EditModal] Failed to validate field of type ".concat(x.type,".\n Please update model.json accordingly.")),console.error(A));var R={id:h,config:L?L.config:N},O=(0,o.Z)(I.id.validate.matches,2),V=O[0],q=O[1],B=u.object().shape({id:u.string().matches(V,q).min(3).max(35).required(),config:E.fields.config}),z="".concat("edit-modal-form","-").concat(Math.random().toString());return(0,l.jsx)(Z.Z,{isOpen:!0,shouldCloseOnOverlayClick:!0,onRequestClose:t,contentLabel:"Widget Form Modal",children:(0,l.jsx)(D,{apiId:h,formId:z,initialValues:R,validationSchema:B,FormFields:I,onSave:function(e){var n=e.newKey,r=e.value;s({apiId:h,newKey:n,value:(0,i.Z)({},x,r)}),t()},children:function(e){var n=e.values,s=n.id,c=n.config.label,u=e.isValid,m=e.isSubmitting,h=e.initialValues,x=_?(0,l.jsx)(_,(0,r.Z)((0,i.Z)({},e),{fields:a}),"field-model-tab-content"):(0,l.jsx)(y.k,{children:Object.entries(I).map(function(e){var t=(0,o.Z)(e,2),n=t[0],i=t[1];return(0,l.jsx)(y.J,{children:(0,l.jsx)(w.Z,{fieldName:(0,S.lm)(n),formField:i,fields:a,initialValues:h})},n)})},"field-model-tab-content"),g=["Field Model"],Z=[x];if("slice"===p){var E=(0,l.jsx)(d.xu,{children:(0,l.jsx)(F,{})},"mock-data-tab-content");g.push("Mock Data"),Z.push(E)}return(0,l.jsx)(b,{borderFooter:!0,footerSx:{position:"sticky",bottom:0,p:0},tabs:g,Header:function(e){var n=e.radius;return(0,l.jsxs)(d.kC,{sx:{position:"sticky",zIndex:1,top:0,p:3,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n},children:[(0,l.jsx)(j,{theme:f,text:c||s,WidgetIcon:v}),(0,l.jsx)(d.x8,{onClick:t,type:"button"})]})},Footer:(0,l.jsxs)(d.kC,{sx:{position:"sticky",bottom:0,alignItems:"space-between",bg:"headSection",p:3},children:[(0,l.jsx)(d.xu,{sx:{ml:"auto"}}),(0,l.jsx)(d.zx,{mr:2,type:"button",onClick:t,variant:"secondary",children:"Cancel"}),(0,l.jsx)(d.zx,{form:z,type:"submit",disabled:!u&&m,sx:{fontWeight:"400",paddingBlock:"8px",paddingInline:"16px",fontSize:"14px",borderRadius:"4px"},children:"Done"})]}),children:Z})}})})}},63928:function(e,t,n){"use strict";n.d(t,{Z:function(){return g}});var i=n(22710),r=n(99267),o=n(52322),l=n(2784),a=n(49857),s=n(7604),c=n(77245),d=n(8799),u=n(65186),p=n(59326),f=n(75289),m=n(51279),h={position:"relative",top:"3px"},x=function(e){var t,n,i,r=e.code,a=e.lang,s=(0,p.B7)().theme,x=(0,l.useState)(!1),g=x[0],v=x[1],b=function(){r&&navigator.clipboard.writeText(r).then(function(){v(!0),setTimeout(function(){v(!1)},1200)})};return r?(0,o.jsxs)(f.kC,{sx:{p:2,px:3,alignItems:"center",borderTop:"1px solid",borderColor:"borders",justifyContent:"space-between"},children:[(0,o.jsxs)(f.kC,{sx:{alignItems:"center",display:["none","none","flex"],maxWidth:"80%"},children:[(0,o.jsx)(d.vcz,{size:26,color:null==s?void 0:null===(t=s.colors)||void 0===t?void 0:t.icons,style:{border:"1px solid",borderColor:null==s?void 0:null===(n=s.colors)||void 0===n?void 0:n.borders,borderRadius:"3px",padding:"4px",marginRight:"2px"}}),(0,o.jsx)(m.Z,{sx:{margin:"0px 8px",border:"none",borderRadius:"3px",fontSize:"13px"},lang:a,children:r})]}),(0,o.jsx)(f.xu,{children:(0,o.jsxs)(f.zx,{"aria-label":g?"Code snippet copied":"Copy code snippet",onClick:b,variant:"textButton",children:[g?(0,o.jsx)(u.HhX,{size:16,color:null==s?void 0:null===(i=s.colors)||void 0===i?void 0:i.success,style:h}):(0,o.jsx)(c.LhG,{size:16,style:h}),(0,o.jsx)(f.xv,{as:"span",sx:{display:["none","inline","none","inline"]},children:"\xa0Copy"})]})})]}):null},g=function(e){var t=e.show,n=e.renderHintBase,l=e.item,c=e.hintItemName,d=n({item:l}),u=(0,a.ZP)(d,(0,i.Z)(function(){return(0,r.__generator)(this,function(e){switch(e.label){case 0:return[4,s.j.snippets.readSnippets({fieldPath:d.split("."),model:l.value,itemName:c})];case 1:return[2,e.sent()]}})})),p=u.data,f=u.error;if(f&&console.error(f),!p||f)return null;var m=p.snippets||[];return m[0]?(0,o.jsx)("div",{style:{display:t?"initial":"none"},children:(0,o.jsx)(x,{code:m[0].code,lang:m[0].language})}):null}},8033:function(e,t,n){"use strict";n.d(t,{Z:function(){return Z}});var i=n(62230),r=n(85244),o=n(98240),l=n(52322),a=n(37577),s=n(63397),c=n(2784),d=n(75289),u=n(59326),p=n(35549),f=n(86163),m=n(58428),h=n(58514),x=n(55197),g=n(18978),v=n(33710),b=n(79401),y=function(e){var t=e.error;return t?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(b.X,{children:(0,l.jsx)(v.Z,{type:"light",multiline:!0,border:!0,borderColor:"tomato"})}),(0,l.jsx)(g.Zlu,{color:"tomato","data-tip":t,style:{position:"absolute",right:"8px"},size:16})]}):null},j=function(e){var t=e.innerRef,n=(0,o.Z)(e,["innerRef"]);return(0,l.jsx)(d.II,(0,r.Z)((0,i.Z)({},n),{ref:t}))},Z=function(e){var t=e.widgetTypeName,n=e.fields,o=e.onSave,g=e.onCancelNewField,v=(0,c.useRef)(null),b=(0,u.B7)().theme,Z=(0,c.useState)(!0),S=Z[0],I=Z[1];(0,c.useEffect)(function(){v.current&&v.current.focus()},[v]);var _=h.C[t];if(!_)return console.error('Widget of type "'.concat(t,'" not found. This is a problem on our side!')),(0,l.jsx)("div",{children:"Unexpected error. Contact us for more info."});var E=_.FormFields,F=_.Meta.icon,T={id:E.id,label:E.label},k=(0,r.Z)((0,i.Z)({},(0,f.f7)(T),"UID"===t?{id:"uid"}:{}),{widgetTypeName:t}),C=(0,f.gc)(T),w=function(e,t,n){n(S&&!T.id.disabled?(0,r.Z)((0,i.Z)({},t),{label:e.target.value,id:(0,x.lV)(e.target.value)}):(0,r.Z)((0,i.Z)({},t),{label:e.target.value}))},N=function(e,t){t("id",e.target.value),I(!1)};return(0,l.jsx)(s.J9,{onSubmit:o,validationSchema:C,initialValues:k,children:function(e){var t,o,c=e.errors,u=e.values,f=e.setValues,h=e.setFieldValue,x=e.submitForm;return(0,l.jsx)(s.l0,{"data-testid":"new-field-form",children:(0,l.jsxs)(d.kC,{as:"li",sx:{bg:"white",p:3,px:3,mx:0,ml:"34px",alignItems:"center",variant:"styles.listItem",border:function(e){var t,n;return"1px solid ".concat((null===(t=e.colors)||void 0===t?void 0:null===(n=t.borders)||void 0===n?void 0:n.toString())||"")},flexWrap:"wrap",gap:"12px",justifyContent:"flex-start"},children:[(0,l.jsx)(F,{style:{color:null===(t=b.colors)||void 0===t?void 0:t.primary,borderRadius:"4px",padding:"4px",border:"2px solid",borderColor:null===(o=b.colors)||void 0===o?void 0:o.primary},size:28}),(0,l.jsxs)(d.kC,{sx:{alignItems:"center",flexGrow:1,gap:2,position:"relative"},children:[(0,l.jsx)(d.xv,{as:"p",sx:{fontWeight:500,whiteSpace:"nowrap"},children:"Field Name"}),(0,l.jsx)(s.gN,{onChange:function(e){return w(e,u,f)},onKeyDown:function(e){"Enter"===e.key&&x()},name:"label",placeholder:"Field Name",type:"text",validate:function(e){if(!e.length)return"This field is required"},as:j,innerRef:v,sx:(0,r.Z)((0,i.Z)({},(0,p.tM)(T.label.disabled?p.$w.DISABLED:c.label?p.$w.ERROR:void 0)),{flexGrow:1,minWidth:"128px",width:"initial"}),"aria-label":"label-input","data-testid":"new-field-name-input"}),(0,l.jsx)(y,{error:c.label})]}),(0,l.jsxs)(d.kC,{sx:{alignItems:"center",flexGrow:1,gap:2,position:"relative"},children:[(0,l.jsx)(d.xv,{as:"p",sx:{fontWeight:500,whiteSpace:"nowrap"},children:"Field ID"}),(0,l.jsx)(s.gN,{onChange:function(e){return N(e,h)},onKeyDown:function(e){"Enter"===e.key&&x()},name:"id",placeholder:"e.g. buttonLink",type:"text",disabled:T.id.disabled,validate:function(e){return(0,m.u)({value:e,fields:n,initialId:null})},as:j,sx:(0,r.Z)((0,i.Z)({},(0,p.tM)(T.id.disabled?p.$w.DISABLED:c.id?p.$w.ERROR:void 0)),{flexGrow:1,minWidth:"128px",width:"initial"}),"data-testid":"new-field-id-input"}),(0,l.jsx)(y,{error:c.id})]}),(0,l.jsxs)(d.kC,{sx:{gap:2},children:[(0,l.jsx)(a.zx,{onClick:g,color:"grey",children:"Cancel"}),(0,l.jsx)(a.zx,{onClick:function(){x()},children:"Add"})]})]})})}})}},75843:function(e,t,n){"use strict";n.d(t,{Z:function(){return C}});var i=n(62230),r=n(85244),o=n(17064),l=n(81541),a=n(52322),s=n(37577),c=n(13980),d=n(2784),u=n(65077),p=n(12189),f=n(85513),m=n(14866),h=n(85905),x=n(21112),g=n(40023),v=n(75289),b=n(82004),y=n(1225),j=n(58514),Z=n(69114),S=n(63928),I=function(e){var t=e.fields,n=e.title,o=e.tabId,l=e.enterEditMode,s=e.enterSelectMode,c=e.onDragEnd,d=e.renderFieldAccessor,u=e.onDeleteItem,p=e.onSave,f=e.showHints,m=e.newField,h=e.renderHintBase,x=e.isRepeatable,I=e.testId,_=e.isRepeatableCustomType;return(0,a.jsx)(g.Z5,{onDragEnd:c,children:(0,a.jsx)(g.bK,{droppableId:n,children:function(e,n){return(0,a.jsxs)(v.xu,(0,r.Z)((0,i.Z)({as:"ul",ref:e.innerRef},e.droppableProps),{"data-testid":I,sx:{paddingInline:"16px !important"},children:[t.map(function(e,t){var c=e.value,m=c.config,g=c.type,I=(0,Z.t)(j.C,m,g);if(!I)return(0,a.jsx)(b.Z,{children:(0,a.jsxs)(v.xv,{children:['Field type "',g,'" not supported']})});var E={item:e,index:t,tabId:o,widget:I,showHints:f,key:e.key,enterSelectMode:s,renderFieldAccessor:d,enterEditMode:l,parentSnapshot:n,deleteItem:u,saveItem:p,draggableId:"list-item-".concat(e.key),isRepeatableCustomType:_,testId:"list-item-".concat(e.key)},F=(0,a.jsx)(S.Z,{item:e,show:f,isRepeatable:x,renderHintBase:h,hintItemName:I.hintItemName,Widgets:j.C,typeName:I.CUSTOM_NAME||I.TYPE_NAME});if(I.CustomListItem){var T=I.CustomListItem;return(0,a.jsx)(T,(0,r.Z)((0,i.Z)({},E),{HintElement:F}))}return(0,a.jsx)(y.Z,(0,r.Z)((0,i.Z)({},E),{HintElement:F}))}),e.placeholder,m]}))}})})},_=n(8033),E=n(73539),F=n.n(E),T=function(e){var t=e.zoneType,n=e.heading,i=void 0===n?"Your ".concat(t," has no fields yet"):n,r=e.action;return(0,a.jsxs)("div",{className:F().root,children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(s.xv,{variant:"bold",children:i}),(0,a.jsx)(s.xv,{color:"grey11",children:"A field is an input for content (e.g. text, images, links)."})]}),r]})},k=function(e){var t,n,c=e.zoneType,g=e.zoneTypeFormat,v=e.tabId,b=e.title,y=e.fields,j=e.poolOfFieldsToCheck,Z=e.widgetsArray,S=e.isRepeatable,E=e.onDeleteItem,F=e.onSaveNewField,k=e.onDragEnd,C=e.EditModal,w=e.onSave,N=e.dataTip,M=e.renderHintBase,L=e.renderFieldAccessor,A=e.testId,D=e.isRepeatableCustomType,R=e.emptyStateHeading,O=Object.entries(j).find(function(e){return"UID"===(0,o.Z)(e,2)[1].value.type})?Z.filter(function(e){return"UID"!==e.TYPE_NAME}):Z,V=(0,d.useState)(!1),q=V[0],B=V[1],z=(0,d.useState)({isOpen:!1}),P=z[0],H=z[1],J=(0,d.useState)(null),U=J[0],G=J[1],W=function(e){H({isOpen:!0,field:e});var t=(0,o.Z)(e,2),n=t[0],i=t[1];p.Xe.track({event:"field:settings-opened",id:n,name:i.config.label,type:i.type,isInAGroup:!1,contentType:(0,x.T)(window.location.pathname)})},$=function(){H({isOpen:!1})},Y=function(e){G({widgetTypeName:e,fields:y})},K=function(){return G(null)},X=(0,a.jsx)(h.S,{disabled:null!==U,onSelectField:Y,fields:O.filter(Boolean).map(function(e){var t=e.TYPE_NAME,n=e.CUSTOM_NAME;return m.XU.find(function(e){return e.type===t&&(void 0===n||e.variant===n)})}),triggerDataTestId:Boolean(S)?"add-field-in-items":void 0});return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(f.Bu,{actions:y.length>0?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(s.xv,{color:"grey11",component:"span",noWrap:!0,children:"Show code snippets?"}),(0,a.jsx)(s.rs,{checked:q,onCheckedChange:B,size:"small",style:{flexShrink:0},"data-testid":"code-snippets-switch"}),X]}):void 0,children:b}),0!==y.length||U?y.length>0||U?(0,a.jsx)(u.xR,{children:(0,a.jsx)(I,{tabId:v,isRepeatable:S,fields:y,showHints:q,dataTip:N,title:b,renderFieldAccessor:L,renderHintBase:M,enterEditMode:W,onDragEnd:k,onDeleteItem:E,onSave:w,testId:A,isRepeatableCustomType:D,newField:U&&(0,a.jsx)(_.Z,(0,r.Z)((0,i.Z)({},U),{fields:j||y,onSave:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];F.apply(void 0,(0,l.Z)(t)),G(null)},onCancelNewField:K}))})}):void 0:(0,a.jsx)(T,{zoneType:(t=c,n=g,"customType"===t?"page"===n?"page type":"custom type":t),heading:R,action:X}),(0,a.jsx)(C,{data:P,close:$,onSave:w,fields:j,zoneType:c})]})};k.propTypes={isRepeatable:c.bool,title:c.string.isRequired,dataTip:c.string.isRequired,onSave:c.func.isRequired,onSaveNewField:c.func.isRequired,onDragEnd:c.func.isRequired,onDeleteItem:c.func.isRequired,poolOfFieldsToCheck:(0,c.arrayOf)((0,c.shape)({key:c.string,value:c.object})),renderHintBase:c.func.isRequired,renderFieldAccessor:c.func.isRequired,widgetsArray:c.array.isRequired,fields:(0,c.arrayOf)((0,c.shape)({key:c.string.isRequired,value:(0,c.shape)({config:c.object,fields:c.array,type:c.string.isRequired})}))};var C=k},69114:function(e,t,n){"use strict";n.d(t,{t:function(){return r}});var i=n(59050),r=function(e,t,n){if("Link"===n)switch(null==t?void 0:t.select){case"document":return e.ContentRelationship;case"media":return e.LinkToMedia;default:return e.Link}if(n===i.GroupFieldType){var r;return null!==(r=e.Group)&&void 0!==r?r:e.NestedGroup}return e[n]}},58428:function(e,t,n){"use strict";n.d(t,{J:function(){return l},u:function(){return o}});var i=n(25978),r=n(77362),o=function(e){var t=e.value,n=e.fields,i=e.initialId;return t?n.find(function(e){return e.key===t})&&t!==i?'Field "'.concat(t,'" already exists.'):void 0:"Field is required"},l={label:(0,r.II)("Label",{required:"This field is required",max:!0},void 0,void 0,"Label for content creators (defaults to field type)"),id:(0,r.II)("API ID*",{min:!0,max:!0,required:"This field is required",matches:[i.xo,"No special characters allowed (except _)"]},o,void 0,"A unique identifier for the field (e.g. buttonLink)"),placeholder:(0,r.II)("Placeholder",{required:"This field is required",max:[100,"String is too long. Max: 100"]},void 0,void 0,"Placeholder text for content creators")}},77362:function(e,t,n){"use strict";n.d(t,{II:function(){return c},Jg:function(){return o}});var i=n(86163),r=n(33413),o=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=!(arguments.length>2)||void 0===arguments[2]||arguments[2];return{type:r.h.CHECKBOX,validate:{required:(0,i.MJ)(t,s)},required:t,label:e,defaultValue:n,yupType:"boolean"}},l=[3,"String is too short. Min: 3"],a=[35,"String is too long. Max: 35"],s=["Field is required"],c=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{min:l,max:a,required:s},n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,c=arguments.length>4?arguments[4]:void 0,d=t||{},u=d.min,p=d.max,f=d.required,m=d.matches;return{type:r.h.INPUT,label:e,validate:{required:(0,i.MJ)(f,s),min:(0,i.MJ)(u,l),max:(0,i.MJ)(p,a),matches:m},defaultValue:o,fieldLevelValidation:n,yupType:"string",placeholder:c}}},86163:function(e,t,n){"use strict";n.d(t,{MJ:function(){return u},f7:function(){return p},gc:function(){return f},lm:function(){return d}});var i=n(67557),r=n(62230),o=n(85244),l=n(17064),a=n(81541),s=n(65413),c=n(33413),d=function(e){return"id"===e?"id":"config.".concat(e)},u=function(e,t){return Array.isArray(e)?e:"boolean"==typeof e&&e?t:null},p=function(e){return Object.entries(e).reduce(function(e,t){var n,a=(0,l.Z)(t,2),s=a[0],d=null===(n=a[1]).defaultValue?void 0:void 0!==n.defaultValue?n.defaultValue:n.type===c.h.CHECKBOX||(n.type===c.h.INPUT?"":n.type===c.h.SELECT?[]:void 0);return void 0!==d?(0,o.Z)((0,r.Z)({},e),(0,i.Z)({},s,d)):e},{})},f=function(e){return s.object().shape(Object.entries(e).filter(function(e){return e}).reduce(function(e,t){var n=(0,l.Z)(t,2),c=n[0],d=n[1],u=d.validate,p=d.yupType;if(!u)return e;if("function"==typeof u)return(0,o.Z)((0,r.Z)({},e),(0,i.Z)({},c,u(c,d)));var f=s[p]();return Object.entries(u).filter(function(e){return e&&e[1]}).forEach(function(e){var t,n=(0,l.Z)(e,2),i=n[0],r=n[1];if(r&&f[i]){f=(t=f)[i].apply(t,(0,a.Z)(Array.isArray(r)?r:[r]));return}console.warn('Invalid Yup validator for field "'.concat(c,'"'))}),(0,o.Z)((0,r.Z)({},e),(0,i.Z)({},c,f))},{})).required().default(void 0).noUnknown(!0)}},33413:function(e,t,n){"use strict";var i,r;n.d(t,{h:function(){return i}}),(r=i||(i={})).CHECKBOX="checkbox",r.INPUT="input",r.SELECT="select"},58514:function(e,t,n){"use strict";n.d(t,{C:function(){return tb}});var i,r,o=n(62230),l=n(52322),a=n(13002),s=n(85244),c=n(65186),d=n(65413),u=n(17064),p=n(75289),f=n(26950),m=n(79474),h=n(86163),x=n(58428),g=n(77362),v=(0,s.Z)((0,o.Z)({},x.J),{repeat:(0,g.Jg)("Repeatable",!1,!0)}),b=function(e){var t=e.initialValues,n=e.fields,i=e.values,r=e.setFieldValue,o=i.config.repeat;return(0,l.jsxs)(f.k,{children:[Object.entries(v).filter(function(e){return"repeat"!==(0,u.Z)(e,1)[0]}).map(function(e){var i=(0,u.Z)(e,2),r=i[0],o=i[1];return(0,l.jsx)(f.J,{children:(0,l.jsx)(m.Z,{fieldName:(0,h.lm)(r),formField:o,fields:n,initialValues:t})},r)}),(0,l.jsx)(f.J,{children:(0,l.jsx)(p.xu,{sx:{mt:2,alignItems:"center",display:"flex",height:"130%"},children:(0,l.jsxs)(p.__,{variant:"label.border",sx:{mb:0},children:[(0,l.jsx)(p.XZ,{checked:o,onChange:function(){return r("config.repeat",!o)}}),"Repeatable"]})})})]})},y={icon:c.iy3};function j(e){var t,n=e.schemaTypeRegex,i=e.customListItem,r=e.customName,o=e.hintItemName;return{Meta:y,Form:b,FormFields:v,schema:d.object().shape({type:d.string().matches(n,{excludeEmptyString:!0}).required(),config:d.object().shape({fields:d.array(),label:d.string(),placeholder:d.string(),repeat:d.boolean().optional()})}),create:function(e){return{type:"Group",config:{label:e,repeat:!0,fields:[]}}},CustomListItem:i,TYPE_NAME:"Group",CUSTOM_NAME:r,hintItemName:o}}var Z=n(98240),S=n(81541),I=n(59050),_=n(2784),E=n(40023),F=n(28316),T=n(12189),k=n(14866),C=n(85905),w=n(1225),N=n(1411),M=n(63928),L=n(8033),A=n(69114),D=n(63987),R=n(50535),O=n(55197),V=n(21112),q=function(e){var t=e.tabId,n=e.widget,a=e.Widgets,c=e.widgetsArray,d=e.hintBase,f=(e.parentSnapshot,e.showHints),m=e.isRepeatable,h=e.item,x=e.draggableId,g=e.saveItem,v=e.HintElement,b=(0,Z.Z)(e,["tabId","widget","Widgets","widgetsArray","hintBase","parentSnapshot","showHints","isRepeatable","item","draggableId","saveItem","HintElement"]),y=(0,_.useState)(null),j=y[0],q=y[1],B=(0,_.useState)({isOpen:!1}),z=B[0],P=B[1],H=function(e){q({widgetTypeName:e})},J=function(){q(null)},U=function(){P({isOpen:!1})},G=function(e){var t,n,o,l,s=e.id,c=e.label,d=a[e.widgetTypeName].create(c),u=(t={group:D.Fl.fromSM(h.value),fieldId:s,field:d},null!==(n=(i=l=structuredClone(t.group)).config)&&void 0!==n||(i.config={}),null!==(o=(r=l.config).fields)&&void 0!==o||(r.fields={}),l.config.fields[t.fieldId]=t.field,l);g({apiId:h.key,newKey:h.key,value:D.Fl.toSM(u)}),T.Xe.track({event:"field:added",id:s,name:c,type:d.type,isInAGroup:!0,contentType:(0,V.T)(window.location.pathname)})},W=function(e){var t=e.apiId,n=e.newKey,i=e.value,r=function(e){var t,n,i=structuredClone(e.group);if(!(null===(t=i.config)||void 0===t?void 0:t.fields)||!(null===(n=e.group.config)||void 0===n?void 0:n.fields))return i;for(var r in i.config.fields={},e.group.config.fields)r===e.previousFieldId?i.config.fields[e.newFieldId]=e.field:i.config.fields[r]=e.group.config.fields[r];return i}({group:D.Fl.fromSM(h.value),previousFieldId:t,newFieldId:n,field:i.type===I.GroupFieldType?D.Fl.fromSM(i):i});g({apiId:h.key,newKey:h.key,value:D.Fl.toSM(r)})},$=function(e){if(!(0,R.uS)(e)){var t=e.source,n=e.destination;if(n){var i=t.index,r=n.index,o=function(e){var t,n=structuredClone(e.group);if(!(null===(t=n.config)||void 0===t?void 0:t.fields))return n;var i=Object.entries(n.config.fields),r=(0,u.Z)(i.splice(e.sourceIndex,1),1)[0];return i.splice(e.destinationIndex,0,r),n.config.fields=Object.fromEntries(i),n}({group:D.Fl.fromSM(h.value),sourceIndex:i,destinationIndex:r});(0,F.flushSync)(function(){g({apiId:h.key,newKey:h.key,value:D.Fl.toSM(o)})})}}},Y=function(e){var t,n,i,r,o=(t={group:D.Fl.fromSM(h.value),fieldId:e},null===(n=(r=structuredClone(t.group)).config)||void 0===n||null===(i=n.fields)||void 0===i||delete i[t.fieldId],r);g({apiId:h.key,newKey:h.key,value:D.Fl.toSM(o)})},K=function(e){P({isOpen:!0,field:e});var t=(0,u.Z)(e,2),n=t[0],i=t[1];T.Xe.track({event:"field:settings-opened",id:n,name:i.config.label,type:i.type,isInAGroup:!0,contentType:(0,V.T)(window.location.pathname)})};return(0,l.jsxs)(_.Fragment,{children:[(0,l.jsx)(w.Z,(0,s.Z)((0,o.Z)({item:h,widget:n,draggableId:x},b),{HintElement:v,CustomEditElements:[(0,l.jsx)(C.S,{disabled:null!==j,onSelectField:H,fields:c.filter(Boolean).map(function(e){var t=e.TYPE_NAME,n=e.CUSTOM_NAME,i=k.XU.find(function(e){return e.type===t&&(void 0===n||e.variant===n)});if(!i)throw Error("Field not found for widget: ".concat(t," - ").concat(n));return i})},"add-field-dropdown"),],children:(0,l.jsx)(p.xu,{sx:{ml:4},children:(0,l.jsx)(E.Z5,{onDragEnd:$,children:(0,l.jsx)(E.bK,{droppableId:"".concat(t,"-").concat(h.key,"-zone"),children:function(e){return(0,l.jsxs)("ul",(0,s.Z)((0,o.Z)({ref:e.innerRef},e.droppableProps),{children:[h.value.config.fields.map(function(e,t){var n=e.value,i=n.config,r=n.type,c=(0,A.t)(a,i,r);if(!c)return null;var u={item:e,index:t,widget:c,key:e.key,enterEditMode:K,deleteItem:Y,saveItem:W,showHints:f,renderFieldAccessor:function(t){return"item".concat((0,O.Ti)(e.key))},draggableId:"group-".concat(h.key,"-").concat(e.key,"-").concat(t),testId:"list-item-group-".concat(h.key,"-").concat(e.key)},p=(0,l.jsx)(M.Z,{item:e,show:f,isRepeatable:m,renderHintBase:function(e){var t=e.item;return"".concat(d).concat((0,O.Ti)(t.key))},hintItemName:c.hintItemName,Widgets:a,typeName:c.CUSTOM_NAME||c.TYPE_NAME});if(c.CustomListItem){var x=c.CustomListItem;return(0,l.jsx)(x,(0,s.Z)((0,o.Z)({},u),{HintElement:p}))}return(0,l.jsx)(w.Z,(0,s.Z)((0,o.Z)({},u),{HintElement:p}))}),e.placeholder,j&&(0,l.jsx)(L.Z,(0,s.Z)((0,o.Z)({},j),{fields:h.value.config.fields||[],onSave:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];G.apply(void 0,(0,S.Z)(t)),q(null)},onCancelNewField:J}))]}))}})})})})),(0,l.jsx)(N.Z,{data:z,close:U,onSave:W,fields:h.value.config.fields})]})},B={icon:c.hs8},z={label:x.J.label,id:x.J.id,placeholder_false:(0,g.II)("False Placeholder",{required:!1},null,"false","Value the content creator sees (Output as 'false' in the API)."),placeholder_true:(0,g.II)("True Placeholder",{required:!1},null,"true","Value the content creator sees (Output as 'true' in the API)"),default_value:(0,g.Jg)("Default to true")},P=d.object().shape({type:d.string().matches(/^Boolean$/,{excludeEmptyString:!0}).required(),config:(0,h.gc)((0,R.B9)(z,"id"))}),H={icon:c.U8L},J=(0,R.zg)("Color"),U=J.TYPE_NAME,G=J.FormFields,W=J.schema,$=n(56580),Y=n(93290),K=n(7781),X=(0,s.Z)((0,o.Z)({},x.J),{allowTargetBlank:(0,g.Jg)("Allow target blank",!1,!1)}),Q=function(e){var t=e.initialValues,n=e.fields;return(0,l.jsx)(f.k,{children:Object.entries(X).map(function(e){var i=(0,u.Z)(e,2),r=i[0],o=i[1];return(0,l.jsx)(f.J,{children:(0,l.jsx)(m.Z,{fieldName:(0,h.lm)(r),formField:o,fields:n,initialValues:t})},r)})})},ee={icon:c.$l_},et=d.object().shape({label:d.string().optional(),useAsTitle:d.boolean().optional(),placeholder:d.string().optional(),select:d.string().optional().oneOf(["media","document","web",null]).nullable(),customtypes:d.array(d.string()).strict().optional(),masks:d.array(d.string()).optional(),tags:d.array(d.string()).optional(),allowTargetBlank:d.boolean().strict().optional()}).required().default(void 0).noUnknown(!0),en=d.object().shape({type:d.string().matches(/^Link$/,{excludeEmptyString:!0}).required(),config:et.optional()}),ei=n(36131),er={label:x.J.label,id:x.J.id,customtypes:{validate:function(){return d.array().of(d.string())}}},eo=function(e){var t=e.initialValues,n=e.values,i=e.fields,r=e.setFieldValue,a=(0,$.v9)(K.Ch).filter(Y.TG),c=a.map(function(e){return{value:e.local.id,label:e.local.label}}),d=n.config.customtypes?n.config.customtypes.map(function(e){var t=a.find(function(t){return t.local.id===e});return{value:null==t?void 0:t.local.id,label:null==t?void 0:t.local.label}}):null;return(0,l.jsxs)(f.k,{children:[Object.entries(er).filter(function(e){return"customtypes"!==e[0]}).map(function(e){var n=(0,u.Z)(e,2),r=n[0],o=n[1];return(0,l.jsx)(f.J,{children:(0,l.jsx)(m.Z,{fieldName:(0,h.lm)(r),formField:o,fields:i,initialValues:t})},r)}),(0,l.jsx)(f.J,{children:(0,l.jsxs)(p.xu,{sx:{mt:2,alignItems:"center"},children:[(0,l.jsx)(p.__,{htmlFor:"origin",mb:"1",children:"Types"}),(0,l.jsx)(ei.ZP,{isMulti:!0,name:"origin",options:c,onChange:function(e){e&&r("config.customtypes",e.map(function(e){return e.value}))},value:d,theme:function(e){return(0,s.Z)((0,o.Z)({},e),{colors:(0,s.Z)((0,o.Z)({},e.colors),{text:"text",primary:"background"})})}})]})})]})},el={icon:c.I2R},ea=et.shape({label:d.string().max(35,"String is too long. Max: 35"),select:d.string().required().matches(/^document$/,{excludeEmptyString:!0}),customtypes:d.array(d.string()).strict().optional()}),es=d.object().shape({type:d.string().matches(/^Link$/,{excludeEmptyString:!0}).required(),config:ea}),ec=(0,R.zg)("Date"),ed=ec.FormFields,eu=ec.schema,ep={icon:c.f$3},ef=(0,R.zg)("Embed"),em=ef.FormFields,eh=ef.schema,ex={icon:c.xoN},eg={label:x.J.label,id:x.J.id},ev=d.object().shape({type:d.string().matches(/^GeoPoint$/,{excludeEmptyString:!0}).required(),config:d.object().shape({label:d.string()}).required().default(void 0).noUnknown(!0)}),eb={icon:c.lPv},ey=n(63397),ej=n(8799),eZ=n(20180),eS=n(26474),eI=function(e){var t=e.onClick,n=e.error,i=e.onDelete,r=e.active,a=e.text,s=e.sx;return(0,l.jsx)(eS.Z,{useActive:!0,fitButton:!0,error:n,onClick:t,active:r,sx:(0,o.Z)({position:"relative",width:"64px",height:"64px"},s),Icon:function(){return(0,l.jsxs)(_.Fragment,{children:[(0,l.jsxs)(p.kC,{sx:{flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[(0,l.jsx)(ej.jnY,{size:22}),(0,l.jsx)(p.xv,{mt:1,children:a})]}),i?(0,l.jsx)(p.Ct,{onClick:i,variant:"circle-right",children:(0,l.jsx)(c.B4e,{})}):null]})}})},e_=function(e){var t=e.onClick;return(0,l.jsx)(eS.Z,{fitButton:!0,onClick:t,sx:{width:"64px",height:"64px",border:function(e){var t=e.colors;return"1px solid ".concat(String(null==t?void 0:t.borders))}},Icon:function(){return(0,l.jsx)(p.kC,{sx:{flexDirection:"column",justifyContent:"center",alignItems:"center"},children:(0,l.jsx)(ej.iTs,{size:34,color:"#5263BA","aria-label":"Add a thumbnail"})})}})},eE=function(e){var t=e.prefix,n=e.required,i=e.display,r=(0,u.Z)((0,ey.U$)(t),2),o=(r[0],r[1]),a=void 0!==n&&n?"*":"";return i?(0,l.jsxs)(_.Fragment,{children:[(0,l.jsx)(eF,{name:"".concat(t,".name"),label:"Name".concat(a),placeholder:"main",sx:{mb:3},isConstraint:"config.constraint"===t,meta:o}),(0,l.jsx)(eT,{name:"".concat(t,".width"),label:"Width (px)".concat(a),placeholder:" ",sx:{mb:3}}),(0,l.jsx)(eT,{name:"".concat(t,".height"),label:"Height (px)".concat(a),placeholder:" "})]}):null},eF=function(e){var t=e.name,n=e.label,i=e.placeholder,r=e.meta,a=e.isConstraint,c=(0,Z.Z)(e,["name","label","placeholder","meta","isConstraint"]),d=(0,u.Z)((0,ey.U$)(t),1)[0];return(0,l.jsx)(eZ.Hq,(0,s.Z)((0,o.Z)({},c),{fieldName:t,meta:r,formField:{label:n,placeholder:i},field:a?{value:"main",readOnly:!0}:{value:d.value},variant:a?"disabled":"primary"}))},eT=function(e){var t=e.name,n=e.label,i=e.placeholder,r=(0,Z.Z)(e,["name","label","placeholder"]),a=(0,u.Z)((0,ey.U$)(t),2),c=a[0],d=a[1];return(0,l.jsx)(eZ.Hq,(0,s.Z)((0,o.Z)({},r),{fieldName:t,formField:{label:n,placeholder:i},meta:d,field:{min:0,type:"number",value:c.value||"",onKeyDown:function(e){("e"===e.key||"-"===e.key||"+"===e.key)&&e.preventDefault()}}}))},ek=function(){return d.number().nullable().transform(function(e,t){return""===t?null:e})},eC={label:x.J.label,id:x.J.id,constraint:{validate:function(){return d.object().defined().shape({width:ek(),height:ek()})}},thumbnails:{validate:function(){return d.array().defined().of(d.object().test({name:"Thumbnails",message:"Must set name and width or height at minimum",test:function(e){if(!e.name)return!1;var t="number"==typeof e.width&&e.width,n="number"==typeof e.height&&e.height;return e.name&&(t||n)}}))}}},ew={name:"",width:"",height:""},eN=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.width,n=e.height,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!i||t||n?t||n?"".concat(t||"auto","x").concat(n||"auto"):"...":"auto"},eM=function(e){var t=e.initialValues,n=e.values,i=e.errors,r=e.fields,a=e.touched,c=(0,_.useState)(0),d=c[0],x=c[1],g=n.config,v=g.thumbnails,b=g.constraint;return(0,_.useEffect)(function(){x(v.length)},[v.length]),(0,l.jsxs)(f.k,{children:[Object.entries(eC).map(function(e){var n=(0,u.Z)(e,2),i=n[0],o=n[1];return(0,l.jsx)(f.J,{children:(0,l.jsx)(m.Z,{fieldName:(0,h.lm)(i),formField:o,fields:r,initialValues:t})},i)}),(0,l.jsxs)(f.J,{children:[(0,l.jsx)(p.__,{htmlFor:"thumbnails",variant:"label.primary",sx:{mt:1,display:"flex",alignItems:"center"},children:"Responsive views*"}),(0,l.jsx)(p.Zb,{p:3,children:(0,l.jsx)(ey.F2,{name:"config.thumbnails",render:function(t){var n=t.push,r=t.remove;return(0,l.jsxs)(_.Fragment,{children:[(0,l.jsxs)(p.kC,{mb:3,children:[(0,l.jsx)(eI,{active:0===d,text:eN(b,!0),sx:{mr:2},onClick:function(){return x(0)}}),v.map(function(e,t){return(0,l.jsx)(eI,{sx:{mr:3},active:d===+t+1,text:eN(e),error:!!i.thumbnails&&!!a.thumbnails&&!!a.thumbnails[t]&&!!i.thumbnails&&!!i.thumbnails[t],onDelete:function(){return r(t)},onClick:function(){return x(+t+1)}},"thumbnail-button-".concat(+t+1))}),(0,l.jsx)(e_,{onClick:function(){n(ew)}})]}),(0,l.jsx)(eE,(0,s.Z)((0,o.Z)({},e),{display:0===d,prefix:"config.constraint"})),v.map(function(t,n){return(0,_.createElement)(eE,(0,s.Z)((0,o.Z)({},e),{required:!0,key:"thumbnail-".concat(+n+1),display:d===+n+1,prefix:"config.thumbnails[".concat(n,"]")}))})]})}})})]})]})},eL=d.object().shape({type:d.string().matches(/^Image$/,{excludeEmptyString:!0}).required(),config:(0,h.gc)((0,R.B9)(eC,"id"))}),eA={icon:c.Fwj},eD=(0,o.Z)({},x.J),eR=function(e){var t=e.initialValues,n=e.fields;return(0,l.jsx)(f.k,{children:Object.entries(eD).map(function(e){var i=(0,u.Z)(e,2),r=i[0],o=i[1];return(0,l.jsx)(f.J,{children:(0,l.jsx)(m.Z,{fieldName:(0,h.lm)(r),formField:o,fields:n,initialValues:t})},r)})})},eO={icon:c._b$},eV=et.shape({select:d.string().required().matches(/^media$/,{excludeEmptyString:!0})}),eq=d.object().shape({type:d.string().matches(/^Link$/,{excludeEmptyString:!0}).required(),config:eV.optional()}),eB=(0,R.zg)("Number"),ez=eB.FormFields,eP=eB.schema,eH={icon:c.KZU},eJ=n(33413),eU=function(e){return"use first value as default ".concat(e?'("'.concat(e,'")'):"")},eG=function(e,t){return t?e:void 0},eW=(0,s.Z)((0,o.Z)({},x.J),{default_value:{type:eJ.h.CHECKBOX,yupType:"string",defaultValue:null,validate:function(){return d.string().test({name:"default_value",message:'Default value is not part of field "options" in Select',test:function(e){return void 0===e||this.parent&&this.parent.options&&this.parent.options.find(function(t){return t===e})}})},component:function(e){var t,n=null===(t=(0,ey.u6)().values.config)||void 0===t?void 0:t.options[0];return(0,l.jsx)(eZ.w8,(0,s.Z)((0,o.Z)({},e),{defaultValue:e.field.value,controlledValue:n,setControlledValue:e.helpers.setValue,buildControlledValue:eG,label:eU}))}},options:{yupType:"array",defaultValue:["1","2"],validate:{required:["Select requires a minimum of 2 options"],min:[2,"Choose at least 2 options"],test:{name:"non-empty values",message:"Values cannot be empty",test:function(e){return!e.some(function(e){return!e||!e.length})}}},component:function(e){return(0,l.jsx)(eZ.kp,(0,o.Z)({label:"Options",inputPlaceholder:"Select option output in API (e.g. 'blueTheme')",buttonLabel:"Add option"},e))}}}),e$={icon:c.nwY},eY=d.object().shape({type:d.string().matches(/^Select$/,{excludeEmptyString:!0}).required(),config:(0,h.gc)((0,R.B9)(eW,"id"))}),eK=n(47927),eX=n(76635),eQ=n(34543),e0=function(e){return function(t){var n=t.size;return(0,l.jsx)("span",{style:{fontSize:n},children:e})}},e2=[{value:"paragraph",label:"P",icon:e0("p")},{value:"preformatted",label:"PRE",icon:e0("pre")},{value:"heading1",label:"H1",icon:e0("h1")},{value:"heading2",label:"H2",icon:e0("h2")},{value:"heading3",label:"H3",icon:e0("h3")},{value:"heading4",label:"H4",icon:e0("h4")},{value:"heading5",label:"H5",icon:e0("h5")},{value:"heading6",label:"H6",icon:e0("h6")},{value:"strong",label:"Strong",icon:e0((0,l.jsx)("b",{children:"b"}))},{value:"em",label:"em",icon:e0((0,l.jsx)("em",{style:{fontFamily:"serif"},children:"I"}))},{value:"hyperlink",label:"hyperlink",icon:e0((0,l.jsx)(eQ.eR7,{}))},{value:"image",label:"image",icon:e0((0,l.jsx)(eQ.LFN,{}))},{value:"embed",label:"embed",icon:e0((0,l.jsx)(eQ.xqv,{}))},{value:"list-item",label:"list",icon:e0((0,l.jsx)(eQ.SnF,{}))},{value:"o-list-item",label:"o",icon:e0((0,l.jsx)(ej.KyO,{}))},{value:"rtl",label:"rtl",icon:e0("rtl")},],e1=e2.map(function(e){return e.value}),e5=function(e){return!e1.find(function(t){return!e.includes(t)})},e3=function(e){var t=e.split(",");return e2.reduce(function(e,n){var i=n.value;return t.includes(i)?(0,S.Z)(e).concat([i]):e},[])};function e4(e,t){return(0,eK.has)("parent",e)&&(0,eX.isObject)(e.parent)&&(0,eK.has)(t,e.parent)&&(0,eX.isString)(e.parent[t])?e.parent[t]:null}function e7(e){return function(){return d.string().test({name:e,message:"Options cannot be empty",test:function(t,n){var i=e4(n,e),r=e4(n,"single"===e?"multi":"single");return!!r&&"string"==typeof r||"string"==typeof i&&(!!i&&!!i.length||!!r&&!!r.length)&&!i.split(",").find(function(e){return!e1.includes(e)})}})}}var e8,e9=(0,s.Z)((0,o.Z)({},x.J),{allowTargetBlank:(0,g.Jg)("Allow target blank for links"),single:{validate:e7("single")},multi:{validate:e7("multi")}}),e6=["config.single","config.multi"],te=function(e){var t,n=e.initialValues,i=e.values,r=e.errors,o=e.fields,a=e.setFieldValue,s=i.config,c=s.single,d=s.multi,x=c?e3(c):d?e3(d):e1,g=(0,_.useState)(!c),v=g[0],b=g[1],y=(0,_.useState)(x),j=y[0],Z=y[1];return(0,_.useEffect)(function(){var e=v?1:0;a(e6[e],j.join(",")),setTimeout(function(){a(e6[1-e],void 0)},100)},[v,j]),(0,l.jsxs)(f.k,{children:[Object.entries(e9).map(function(e){var t=(0,u.Z)(e,2),i=t[0],r=t[1];return(0,l.jsx)(f.J,{children:(0,l.jsx)(m.Z,{fieldName:(0,h.lm)(i),formField:r,fields:o,initialValues:n})},i)}),(0,l.jsxs)(f.J,{children:[(0,l.jsxs)(p.__,{htmlFor:"accept",variant:"label.primary",sx:{mt:1,display:"flex",alignItems:"center"},children:["Accept*",(0,l.jsx)(p.zx,{type:"button",variant:"buttons.textButton",onClick:function(){if(e5(j))return Z([]);Z(e1)},children:e5(j)?"Unselect All":"Select all"})]}),e2.map(function(e){return(0,l.jsx)(eS.Z,{fitButton:!0,useActive:!0,label:e.label,size:14,Icon:e.icon,sx:{p:"16px",mb:2,mr:2,variant:"buttons.selectIcon"},active:j.includes(e.value),onClick:function(){if(j.find(function(t){return t===e.value}))return Z(j.filter(function(t){return t!==e.value}));Z((0,S.Z)(j).concat([e.value]))}},e.value)}),(null===(t=r.config)||void 0===t?void 0:t[v?"multi":"single"])?(0,l.jsx)(p.xu,{sx:{position:"absolute"},children:(0,l.jsx)(p.xv,{as:"span",variant:"text.labelError",pl:0,children:r.config[v?"multi":"single"]})}):null]}),(0,l.jsx)(f.J,{children:(0,l.jsx)(p.kC,{sx:{mt:2,alignItems:"center",height:"100%"},children:(0,l.jsxs)(p.__,{variant:"label.border",children:[(0,l.jsx)(p.XZ,{checked:v,onChange:function(){return b(!v)}}),"Allow multiple paragraphs"]})})})]})},tt={icon:c.BAW},tn=d.object().shape({type:d.string().matches(/^StructuredText$/,{excludeEmptyString:!0}).required(),config:(0,h.gc)((0,R.B9)((0,o.Z)({},e9,{labels:{yupType:"array",validate:{}}}),"id"))}),ti=x.J,tr=d.object().shape({type:d.string().matches(/^Text$/,{excludeEmptyString:!0}).required(),config:(0,h.gc)((0,R.B9)(ti,"id"))}),to={icon:c.SQS},tl=x.J,ta=d.object().shape({type:d.string().matches(/^Timestamp$/,{excludeEmptyString:!0}).required(),config:(0,h.gc)((0,R.B9)(tl,"id"))}),ts={icon:c.k71},tc={label:x.J.label,id:(0,s.Z)((0,o.Z)({},x.J.id),{validate:{required:"This field is required",matches:[/^uid$/,"Api ID must be 'uid' for this field."]},disabled:!0}),placeholder:x.J.placeholder},td=d.object().shape({type:d.string().matches(/^UID$/,{excludeEmptyString:!0}).required(),config:(0,h.gc)((0,R.B9)(tc,"id"))}),tu={Boolean:{TYPE_NAME:"Boolean",create:function(e){return{type:"Boolean",config:{label:e,default_value:!1,placeholder_true:"true",placeholder_false:"false"}}},Meta:B,schema:P,FormFields:z},Color:{create:function(e){return{type:"Color",config:{label:e,placeholder:""}}},FormFields:G,TYPE_NAME:U,schema:W,Meta:H},ContentRelationship:{create:function(e){return{type:"Link",config:{label:e,select:"document"}}},Meta:el,schema:es,TYPE_NAME:"Link",FormFields:er,CUSTOM_NAME:"ContentRelationship",Form:eo,prepareInitialValues:function(e){var t=(0,$.v9)(K.Ch).filter(Y.TG);return(null==e?void 0:e.customtypes)?(0,s.Z)((0,o.Z)({},e),{customtypes:e.customtypes.filter(function(e){return t.find(function(t){return t.local.id===e})})}):e}},Date:{create:function(e){return{type:"Date",config:{label:e,placeholder:""}}},FormFields:ed,TYPE_NAME:"Date",schema:eu,Meta:ep},Embed:{create:function(e){return{type:"Embed",config:{label:e,placeholder:""}}},FormFields:em,TYPE_NAME:"Embed",schema:eh,Meta:ex},GeoPoint:{create:function(e){return{type:"GeoPoint",config:{label:e}}},FormFields:eg,TYPE_NAME:"GeoPoint",schema:ev,Meta:eb},Image:{Meta:eA,Form:eM,schema:eL,create:function(e){return{type:"Image",config:{label:e,constraint:{},thumbnails:[]}}},FormFields:eC,TYPE_NAME:"Image"},Link:{Meta:ee,FormFields:X,schema:en,Form:Q,create:function(e){return{type:"Link",config:{label:e,placeholder:"",select:null}}},TYPE_NAME:"Link"},LinkToMedia:{Meta:eO,FormFields:eD,schema:eq,Form:eR,create:function(e){return{type:"Link",config:{label:e,placeholder:"",select:"media"}}},TYPE_NAME:"Link",CUSTOM_NAME:"LinkToMedia"},Number:{create:function(e){return{type:"Number",config:{label:e,placeholder:""}}},FormFields:ez,TYPE_NAME:"Number",schema:eP,Meta:eH},Select:{FormFields:eW,create:function(e){return{type:"Select",config:{label:e,placeholder:"",options:["1","2"]}}},schema:eY,Meta:e$,TYPE_NAME:"Select"},StructuredText:{create:function(e){return{type:"StructuredText",config:{label:e,placeholder:"",allowTargetBlank:!0,multi:e1.join(",")}}},FormFields:e9,Meta:tt,schema:tn,TYPE_NAME:"StructuredText",Form:te},Text:{create:function(e){return{type:"Text",config:{label:e,placeholder:""}}},Meta:to,schema:tr,TYPE_NAME:"Text",FormFields:ti},Timestamp:{create:function(e){return{type:"Timestamp",config:{label:e,placeholder:""}}},schema:ta,FormFields:tl,TYPE_NAME:"Timestamp",Meta:ts},UID:{create:function(e){return{type:"UID",config:{label:e,placeholder:""}}},Meta:{icon:c.XN7},schema:td,TYPE_NAME:"UID",FormFields:tc}},tp=[tu.Image,tu.Text,tu.StructuredText,tu.Link,tu.Select,tu.Boolean,tu.Number,tu.Color,tu.Date,tu.Embed,tu.Timestamp,tu.GeoPoint,tu.ContentRelationship,tu.LinkToMedia,],tf="subItem",tm=j({schemaTypeRegex:/^NestedGroup$/,customListItem:function(e){return(0,l.jsx)(q,(0,o.Z)({Widgets:tu,widgetsArray:tp,hintBase:tf},e))},customName:"NestedGroup",hintItemName:tf}),th=(0,s.Z)((0,o.Z)({},tu),{NestedGroup:tm}),tx=[th.Image,th.Text,th.StructuredText,th.Link,th.Select,th.Boolean,th.Number,th.Color,th.Date,th.Embed,th.Timestamp,th.GeoPoint,th.ContentRelationship,th.LinkToMedia,th.NestedGroup,],tg="item",tv=j({schemaTypeRegex:/^Group$/,customListItem:function(e){var t,n={eligible:(null==(t=(0,a.L)("slicemachine-nested-groups"))?void 0:t.value)==="on"}.eligible?tx:tx.filter(function(e){return"NestedGroup"!==e.CUSTOM_NAME});return(0,l.jsx)(q,(0,o.Z)({Widgets:th,widgetsArray:n,hintBase:tg},e))},hintItemName:tg}),tb=(0,o.Z)({Group:tv,NestedGroup:tm},tu)},50535:function(e,t,n){"use strict";n.d(t,{B9:function(){return s},Ss:function(){return d},uS:function(){return c},zg:function(){return u}});var i=n(98240),r=n(9849),o=n(65413),l=n(86163),a=n(58428),s=function(e,t){return e[t],(0,i.Z)(e,[t].map(r.Z))},c=function(e){return!e.destination||e.source.index===e.destination.index||e.source.droppableId!==e.destination.droppableId},d=function(e,t){return!e[t]&&(console.log('Could not find widget with type name "'.concat(t,'".')),!0)},u=function(e){return{TYPE_NAME:e,FormFields:a.J,schema:o.object().shape({type:o.string().test({name:"type",test:function(t){return t===e}}),config:(0,l.gc)(s(a.J,"id"))}),create:function(){return{type:e,config:(0,l.f7)(s(a.J,"id"))}}}}},21112:function(e,t,n){"use strict";function i(e){if(e.startsWith("/slices/"))return"slice";if(e.startsWith("/custom-types/"))return"custom type";if(e.startsWith("/page-types/"))return"page type";throw Error("Did not detect a content type from: ".concat(e))}n.d(t,{T:function(){return i}})},41350:function(e){e.exports={flex:"List_flex__v0QQS",row:"List_row__sBVx1 List_flex__v0QQS",root:"List_root__f9klF List_flex__v0QQS","root-border":"List_root-border__2nh4p",child:"List_child__O_eM9 List_row__sBVx1 List_flex__v0QQS",header:"List_header__J5e8m List_child__O_eM9 List_row__sBVx1 List_flex__v0QQS",headerActions:"List_headerActions__FqUvW List_row__sBVx1 List_flex__v0QQS",item:"List_item__t5SQz List_child__O_eM9 List_row__sBVx1 List_flex__v0QQS"}},73539:function(e){e.exports={root:"ZoneEmptyState_root__K6dwt"}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[802],{26137:function(e,n,r){r.d(n,{F:function(){return Y}});var t=r(52322),a=r(37577),l=r(97729),s=r.n(l),i=r(2784),c=r(42770),o=r(16991),u=r(64837),d=r(59078),h=r(22710),x=r(62230),p=r(85244),f=r(99267),m=r(5632),j=r(56580),g=r(75289),v=r(65563),b=r(88932),y=r(12189),C=r(84562);function S(){return(S=(0,h.Z)(function(e){var n,r,t,a,l,s,i,c,o,d;return(0,f.__generator)(this,function(h){switch(h.label){case 0:n=e.id,r=e.label,t=e.repeatable,a=e.format,l=e.onSuccess,s=u.$[a],i=(0,v.Ue)({id:n,label:r,repeatable:t,format:a}),h.label=1;case 1:return h.trys.push([1,4,,5]),[4,(0,y.KA)(i)];case 2:if((c=h.sent().errors).length>0)throw c;return y.Xe.track({event:"custom-type:created",id:i.id,name:r,format:a,type:t?"repeatable":"single",origin:"table"}),[4,l(i)];case 3:return h.sent(),b.Am.success((0,C.GX)({message:"".concat(s.name({start:!0,plural:!1})," saved successfully at "),path:"./customtypes/".concat(i.id,"/index.json")})),[3,5];case 4:return o=h.sent(),d="Internal Error: ".concat(s.name({start:!0,plural:!1})," not saved"),console.error(d,o),b.Am.error(d),[3,5];case 5:return[2]}})})).apply(this,arguments)}var w=r(99526),k=r(35393),Z=r(4995),T=r(25978),I=r(55197),_=r(7781),R=r(7342),z=r(44570),L=r(17064),N=r(63397),A=r(98240),D=function(e){var n=e.selected,r=(0,A.Z)(e,["selected"]);return(0,t.jsx)(g.kC,(0,x.Z)({sx:{p:"24px",mb:3,alignItems:"top",cursor:"pointer",borderRadius:"6px",backgroundColor:"grayLight",boxShadow:n?function(e){var n;return"0 0 0 2px ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.primary))}:"none","&:hover":{boxShadow:function(e){var n;return"0 0 0 2px ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.primary))}}}},r))},O=function(e){var n=e.format,r=(0,L.Z)((0,N.U$)("repeatable"),3),a=r[0],l=r[2],s=u.$[n];return(0,t.jsxs)(g.xu,{mb:2,children:[(0,t.jsxs)(D,{selected:a.value,onClick:function(){return l.setValue(!0)},children:[(0,t.jsx)(g.Y8,{checked:a.value,onChange:function(){},"data-testid":"repeatable-type-radio-btn"}),(0,t.jsxs)(g.xu,{sx:{marginLeft:2},children:["Reusable type",(0,t.jsx)(g.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:s.hintRepeatable})]})]}),(0,t.jsxs)(D,{selected:!a.value,onClick:function(){return l.setValue(!1)},children:[(0,t.jsx)(g.Y8,{checked:!a.value,onChange:function(){},"data-testid":"single-type-radio-btn"}),(0,t.jsxs)(g.xu,{sx:{marginLeft:2},children:["Single type",(0,t.jsx)(g.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:s.hintSingle})]})]})]})},P=function(e){var n,r=e.format,a=e.isCreating,l=e.isOpen,s=e.origin,c=void 0===s?"table":s,o=e.onCreateChange,d=e.onOpenChange,b=(0,R.Z)().createCustomTypeSuccess,y=(0,j.v9)(function(e){return{customTypeIds:(0,_.W6)(e),customTypeLabels:(0,_.YS)(e)}}),C=y.customTypeIds,L=y.customTypeLabels,N=u.$[r],A=(0,i.useState)(!0),D=A[0],P=A[1],B=(0,k.g)().syncChanges,E=(0,m.useRouter)(),V=(n=(0,h.Z)(function(e){var n,t,a;return(0,f.__generator)(this,function(l){switch(l.label){case 0:var s;return n=e.id,t=e.label,a=e.repeatable,o(!0),[4,function(e){return S.apply(this,arguments)}({format:r,id:n,label:t,origin:c,repeatable:a,onSuccess:(s=(0,h.Z)(function(e){var r,t;return(0,f.__generator)(this,function(a){switch(a.label){case 0:return b(e),r=(0,v.y6)(e),t=w.cd[r],P(!0),[4,E.push({pathname:t.getBuilderPagePathname(n),query:"page"===e.format?{newPageType:!0}:void 0})];case 1:return a.sent(),B(),[2]}})}),function(e){return s.apply(this,arguments)})})];case 1:return l.sent(),o(!1),d(!1),[2]}})}),function(e){return n.apply(this,arguments)}),$=function(e,n,r){r(D?(0,p.Z)((0,x.Z)({},n),{label:e.target.value,id:(0,I.lV)(e.target.value)}):(0,p.Z)((0,x.Z)({},n),{label:e.target.value}))},F=function(e,n){n("id",e.target.value),P(!1)};return(0,t.jsx)(Z.Z,{testId:"create-ct-modal",isOpen:l,widthInPx:"530px",formId:"create-custom-type",buttonLabel:"Create",close:function(){d(!1),P(!0)},onSubmit:function(e){V(e)},isLoading:a,initialValues:{repeatable:!0,id:"",label:""},validate:function(e){var n=e.id,r=e.label,t={};return r&&r.length||(t.label="Cannot be empty."),!t.label&&L.includes(r)&&(t.label="".concat(N.name({start:!0,plural:!1})," name is already taken.")),n&&n.length||(t.id="ID cannot be empty."),t.id||!n||T.xo.exec(n)||(t.id="Invalid id: No special characters allowed."),!t.id&&n&&C.map(function(e){return e.toLowerCase()}).includes(n)&&(t.id='ID "'.concat(n,'" exists already.')),Object.keys(t).length>0?t:void 0},content:{title:"Create a new ".concat(N.name({start:!1,plural:!1}))},children:function(e){var n=e.errors,a=e.setValues,l=e.setFieldValue,s=e.values,i=e.touched;return(0,t.jsxs)(g.xu,{children:[(0,t.jsx)(O,{format:r}),(0,t.jsx)(z.W,{name:"label",label:"".concat(N.name({start:!0,plural:!1})," Name"),testId:"ct-name-input",placeholder:"A display name for the ".concat(N.name({start:!1,plural:!1})),error:i.label?n.label:void 0,onChange:function(e){return $(e,s,a)}}),(0,t.jsx)(z.W,{name:"id",testId:"ct-id-input",label:"".concat(N.name({start:!0,plural:!1})," ID"),placeholder:N.inputPlaceholder,error:i.id?n.id:void 0,onChange:function(e){return F(e,l)}})]})}})},B=r(9502),E=function(e){return(0,t.jsxs)("svg",(0,p.Z)((0,x.Z)({viewBox:"0 0 20 24",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,t.jsx)("path",{d:"m2 24h16c1.1046 0 2-.8954 2-2v-17l-5-5h-13c-1.10457 0-2 .89543-2 2v20c0 1.1046.89543 2 2 2z",fill:"#6e56cf"}),(0,t.jsx)("path",{d:"m17 5h3l-5-5v3c0 1.10457.8954 2 2 2z",fill:"#9e8cfc"}),(0,t.jsx)("path",{d:"m10.0912 8c-2.8118 0-5.0912 2.2794-5.0912 5.0912s2.2794 5.0912 5.0912 5.0912c1.8851 0 3.5303-1.0247 4.4098-2.5452.1553-.2684.2868-.5523.3916-.8489.092-.2604-.0444-.5461-.3048-.6381-.2603-.092-.546.0445-.638.3048-.0841.238-.1897.4659-.3144.6815-.7081 1.2241-2.0305 2.0459-3.5442 2.0459-2.2595 0-4.0912-1.8317-4.0912-4.0912s1.8317-4.0912 4.0912-4.0912c1.3566 0 2.5595.66 3.3043 1.6782h-1.7739c-.2761 0-.5.2239-.5.5 0 .2762.2239.5.5.5h2.6782c.2762 0 .5-.2238.5-.5v-2.6782c0-.2761-.2238-.5-.5-.5-.2761 0-.5.2239-.5.5v1.1032c-.9281-.9865-2.2462-1.6032-3.7086-1.6032z",fill:"#fff"})]}))},V=function(e){return(0,t.jsxs)("svg",(0,p.Z)((0,x.Z)({viewBox:"0 0 20 24",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,t.jsx)("path",{d:"m2 24h16c1.1046 0 2-.8954 2-2v-17l-5-5h-13c-1.10457 0-2 .89543-2 2v20c0 1.1046.89543 2 2 2z",fill:"#6e56cf",fillRule:"nonzero"}),(0,t.jsx)("path",{d:"m17 5h3l-5-5v3c0 1.10457.8954 2 2 2z",fill:"#9e8cfc",fillRule:"nonzero"}),(0,t.jsx)("path",{d:"m8.0869 10.6818.5758-2.3031c.0556-.2226.2556-.3787.485-.3787.3253 0 .564.3057.4851.6213l-.5151 2.0605h2.6055l.5758-2.3031c.0557-.2226.2557-.3787.4851-.3787.3253 0 .564.3057.4851.6213l-.5152 2.0605h2.246c.2761 0 .5.2239.5.5 0 .2762-.2239.5-.5.5h-2.496l-.6591 2.6364h2.1551c.2761 0 .5.2238.5.5 0 .2761-.2239.5-.5.5h-2.4051l-.5757 2.3031c-.0557.2226-.2557.3787-.4851.3787-.3253 0-.564-.3057-.4851-.6213l.5152-2.0605h-2.6056l-.5758 2.3031c-.0556.2226-.2556.3787-.4851.3787-.3253 0-.5639-.3057-.485-.6213l.5151-2.0605h-1.9278c-.2761 0-.5-.2239-.5-.5 0-.2762.2239-.5.5-.5h2.1778l.6591-2.6364h-1.8369c-.2761 0-.5-.2238-.5-.5 0-.2761.2239-.5.5-.5zm2.7273 3.6364.659-2.6364h-2.6055l-.6591 2.6364z",fill:"#fff"})]}))},$=r(56471),F=r(18566),M=r(33476),W=r(93290),H=r(7604);function q(e){return G.apply(this,arguments)}function G(){return(G=(0,h.Z)(function(e){var n,r,t;return(0,f.__generator)(this,function(a){switch(a.label){case 0:return[4,H.j.customTypes.readAllCustomTypes({format:e})];case 1:if(r=(n=a.sent()).errors,t=n.models,r.length>0)throw r;return[2,t.map(function(e){return e.model})]}})})).apply(this,arguments)}var K=function(e){var n,r,l,s,c,o,d=e.format,h=e.isCreatingCustomType,x=e.openCreateCustomTypeModal,p=(0,m.useRouter)(),f=(r=(0,i.useCallback)(function(e){return(0,F.VA)(q,[d],e)},[d]),{customTypes:(0,F.QT)(q,[d]),updateCustomTypes:r}),g=f.customTypes,v=f.updateCustomTypes,b=g.sort(function(e,n){return e.id.localeCompare(n.id)}),y=w.cd[d],C=u.$[d];return(o=(0,j.v9)(function(e){return{storeCustomTypes:(0,_.Ch)(e).filter(W.TG)}}).storeCustomTypes,(0,i.useEffect)(function(){var e=o.filter(function(e){return e.local.format===d});(e.length!==g.length||e.some(function(e){var n=g.find(function(n){return n.id===e.local.id});return!n||JSON.stringify(M.Dc.fromSM(e.local))!==JSON.stringify(n)}))&&v(e.map(function(e){var n=e.local;return M.Dc.fromSM(n)}))},[d,v,g,o]),0===b.length)?(0,t.jsxs)(B.R$,{"data-testid":"blank-slate",style:{alignSelf:"center",marginTop:a.rS.space[72]},children:[(0,t.jsx)(B.u2,{children:(0,t.jsx)(a.Ee,{src:y.blankSlateImage,sizing:"cover"})}),(0,t.jsxs)(B.T9,{children:[(0,t.jsx)(B._T,{children:C.name({start:!0,plural:!0})}),(0,t.jsx)(B.nf,{children:C.blankSlateDescription}),(0,t.jsx)(B.Qj,{children:(0,t.jsx)(a.zx,{onClick:x,loading:h,children:"Create"})})]})]}):(0,t.jsx)("div",{children:(0,t.jsxs)(a.iA,{columnLayout:"28px 1fr 1fr 1fr 42px",children:[(0,t.jsx)(a.ss,{children:(0,t.jsxs)(a.SC,{children:[(0,t.jsx)(a.pj,{children:(0,t.jsx)(a.I5,{name:"notes",size:"medium"})}),(0,t.jsx)(a.pj,{children:(0,t.jsx)(a.xv,{color:"grey11",variant:"small",children:"Label"})}),(0,t.jsx)(a.pj,{children:(0,t.jsx)(a.xv,{color:"grey11",variant:"small",children:"API ID"})}),(0,t.jsx)(a.pj,{children:(0,t.jsx)(a.xv,{color:"grey11",variant:"small",children:"Limit"})}),(0,t.jsx)(a.pj,{})]})}),(0,t.jsx)(a.RM,{children:b.map(function(e){var n=e.repeatable,r=e.label,l=e.id;return(0,t.jsxs)(a.SC,{onClick:function(){p.push(w.cd[d].getBuilderPagePathname(l))},children:[(0,t.jsx)(a.pj,{children:n?(0,t.jsx)(E,{width:a.rS.space[20]}):(0,t.jsx)(V,{width:a.rS.space[20]})}),(0,t.jsx)(a.pj,{children:(0,t.jsx)(a.xv,{variant:"bold",noWrap:!0,children:r})}),(0,t.jsx)(a.pj,{children:(0,t.jsx)(a.xv,{color:"grey11",noWrap:!0,children:l})}),(0,t.jsx)(a.pj,{children:(0,t.jsx)(a.xv,{color:"grey11",noWrap:!0,children:n?"Reusable":"Single"})}),(0,t.jsx)(a.pj,{children:(0,t.jsx)($._,{isChangesLocal:!1,format:d,customType:e})})]},l)})})]})})},Y=function(e){var n=e.format,r=u.$[n],l=(0,i.useState)(!1),h=l[0],x=l[1],p=(0,i.useState)(!1),f=p[0],m=p[1];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s(),{children:(0,t.jsxs)("title",{children:[r.name({start:!0,plural:!0})," - Slice Machine"]})}),(0,t.jsx)(o.S,{renderError:function(){return(0,t.jsx)(d.LN,{children:(0,t.jsx)(d.RN,{children:(0,t.jsx)(a.xu,{alignItems:"center",justifyContent:"center",children:(0,t.jsx)(a.Iq,{title:"Request failed",description:"An error occurred while fetching your ".concat(r.name({start:!1,plural:!0}),".")})})})})},children:(0,t.jsx)(i.Suspense,{fallback:(0,t.jsxs)(d.LN,{children:[(0,t.jsxs)(d.wd,{children:[(0,t.jsx)(d.Cx,{children:(0,t.jsx)(c.g,{children:r.name({start:!0,plural:!0})})}),(0,t.jsx)(d.K2,{children:(0,t.jsx)(a.zx,{disabled:!0,startIcon:"add",children:"Create"})})]}),(0,t.jsx)(d.RN,{children:(0,t.jsx)(a._3,{})})]}),children:(0,t.jsxs)(d.LN,{children:[(0,t.jsxs)(d.wd,{children:[(0,t.jsx)(d.Cx,{children:(0,t.jsx)(c.g,{children:r.name({start:!0,plural:!0})})}),(0,t.jsx)(d.K2,{children:(0,t.jsx)(a.zx,{"data-testid":"create-ct",loading:h,onClick:function(){m(!0)},startIcon:"add",children:"Create"})})]}),(0,t.jsx)(d.RN,{children:(0,t.jsxs)(a.xu,{flexDirection:"column",children:[(0,t.jsx)(K,{format:n,isCreatingCustomType:h,openCreateCustomTypeModal:function(){m(!0)}}),(0,t.jsx)(P,{format:n,isCreating:h,isOpen:f,onCreateChange:x,onOpenChange:m})]})})]})})})]})}},2978:function(e,n,r){r.d(n,{Z:function(){return o}});var t=r(62230),a=r(85244),l=r(98240),s=r(52322);r(2784);var i=r(75289),c=function(e){var n=e.bg,r=e.background,a=e.sx,l=e.withRadius,c=e.radius,o=e.children;return(0,s.jsx)(i.xu,{sx:(0,t.Z)({p:4,bg:n||r},l?{borderBottomLeftRadius:c,borderBottomRightRadius:c}:null,a),children:o})},o=function(e){var n=e.Header,r=void 0===n?null:n,o=e.SubHeader,u=void 0===o?null:o,d=e.Body,h=void 0===d?null:d,x=e.Footer,p=void 0===x?null:x,f=e.borderFooter,m=e.radius,j=void 0===m?"6px":m,g=e.bodySx,v=e.footerSx,b=e.sx,y=e.bg,C=e.background,S=e.children,w=(0,l.Z)(e,["Header","SubHeader","Body","Footer","borderFooter","radius","bodySx","footerSx","sx","bg","background","children"]);return(0,s.jsxs)(i.Zb,(0,a.Z)((0,t.Z)({sx:(0,t.Z)({border:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))},borderRadius:j},void 0===b?null:b)},w),{children:[r?(0,s.jsx)(r,{radius:j}):null,u?(0,s.jsx)(u,{radius:j}):null,(0,s.jsxs)(c,{bg:y,background:C,sx:void 0===g?{}:g,withRadius:!p,children:[h?(0,s.jsx)(h,{}):null,S||null]}),p?(0,s.jsx)(c,{bg:y,background:C,sx:(0,t.Z)({},void 0!==f&&f?{borderTop:function(e){var n=e.colors;return"1px solid ".concat(String(null==n?void 0:n.borders))}}:null,void 0===v?{}:v),radius:j,withRadius:!0,children:"object"==typeof p?p:(0,s.jsx)(p,{})}):null]}))}},25978:function(e,n,r){r.d(n,{Sn:function(){return i},lS:function(){return t},nG:function(){return a},pq:function(){return c},rd:function(){return s},xo:function(){return l}});var t=["components"],a=["png","jpg","jpeg"],l=/^[A-Za-z0-9]+(?:_[A-Za-z0-9]+)*$/,s="placeholders/What_are_Slices_mrvome",i="SM_HELP_VIDEOS/mock_data",c="slice-machine-simulator"}}]);
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[802],{26137:function(e,n,r){r.d(n,{F:function(){return Y}});var t=r(52322),a=r(37577),l=r(97729),s=r.n(l),i=r(2784),c=r(42770),o=r(16991),u=r(64837),d=r(83981),h=r(22710),x=r(62230),p=r(85244),f=r(99267),m=r(5632),j=r(56580),g=r(75289),v=r(65563),b=r(88932),y=r(12189),C=r(84562);function S(){return(S=(0,h.Z)(function(e){var n,r,t,a,l,s,i,c,o,d;return(0,f.__generator)(this,function(h){switch(h.label){case 0:n=e.id,r=e.label,t=e.repeatable,a=e.format,l=e.onSuccess,s=u.$[a],i=(0,v.Ue)({id:n,label:r,repeatable:t,format:a}),h.label=1;case 1:return h.trys.push([1,4,,5]),[4,(0,y.KA)(i)];case 2:if((c=h.sent().errors).length>0)throw c;return y.Xe.track({event:"custom-type:created",id:i.id,name:r,format:a,type:t?"repeatable":"single",origin:"table"}),[4,l(i)];case 3:return h.sent(),b.Am.success((0,C.GX)({message:"".concat(s.name({start:!0,plural:!1})," saved successfully at "),path:"./customtypes/".concat(i.id,"/index.json")})),[3,5];case 4:return o=h.sent(),d="Internal Error: ".concat(s.name({start:!0,plural:!1})," not saved"),console.error(d,o),b.Am.error(d),[3,5];case 5:return[2]}})})).apply(this,arguments)}var w=r(99526),k=r(35393),Z=r(4995),T=r(25978),I=r(55197),_=r(7781),R=r(7342),z=r(44570),L=r(17064),N=r(63397),A=r(98240),D=function(e){var n=e.selected,r=(0,A.Z)(e,["selected"]);return(0,t.jsx)(g.kC,(0,x.Z)({sx:{p:"24px",mb:3,alignItems:"top",cursor:"pointer",borderRadius:"6px",backgroundColor:"grayLight",boxShadow:n?function(e){var n;return"0 0 0 2px ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.primary))}:"none","&:hover":{boxShadow:function(e){var n;return"0 0 0 2px ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.primary))}}}},r))},O=function(e){var n=e.format,r=(0,L.Z)((0,N.U$)("repeatable"),3),a=r[0],l=r[2],s=u.$[n];return(0,t.jsxs)(g.xu,{mb:2,children:[(0,t.jsxs)(D,{selected:a.value,onClick:function(){return l.setValue(!0)},children:[(0,t.jsx)(g.Y8,{checked:a.value,onChange:function(){},"data-testid":"repeatable-type-radio-btn"}),(0,t.jsxs)(g.xu,{sx:{marginLeft:2},children:["Reusable type",(0,t.jsx)(g.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:s.hintRepeatable})]})]}),(0,t.jsxs)(D,{selected:!a.value,onClick:function(){return l.setValue(!1)},children:[(0,t.jsx)(g.Y8,{checked:!a.value,onChange:function(){},"data-testid":"single-type-radio-btn"}),(0,t.jsxs)(g.xu,{sx:{marginLeft:2},children:["Single type",(0,t.jsx)(g.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:s.hintSingle})]})]})]})},P=function(e){var n,r=e.format,a=e.isCreating,l=e.isOpen,s=e.origin,c=void 0===s?"table":s,o=e.onCreateChange,d=e.onOpenChange,b=(0,R.Z)().createCustomTypeSuccess,y=(0,j.v9)(function(e){return{customTypeIds:(0,_.W6)(e),customTypeLabels:(0,_.YS)(e)}}),C=y.customTypeIds,L=y.customTypeLabels,N=u.$[r],A=(0,i.useState)(!0),D=A[0],P=A[1],B=(0,k.g)().syncChanges,E=(0,m.useRouter)(),V=(n=(0,h.Z)(function(e){var n,t,a;return(0,f.__generator)(this,function(l){switch(l.label){case 0:var s;return n=e.id,t=e.label,a=e.repeatable,o(!0),[4,function(e){return S.apply(this,arguments)}({format:r,id:n,label:t,origin:c,repeatable:a,onSuccess:(s=(0,h.Z)(function(e){var r,t;return(0,f.__generator)(this,function(a){switch(a.label){case 0:return b(e),r=(0,v.y6)(e),t=w.cd[r],P(!0),[4,E.push({pathname:t.getBuilderPagePathname(n),query:"page"===e.format?{newPageType:!0}:void 0})];case 1:return a.sent(),B(),[2]}})}),function(e){return s.apply(this,arguments)})})];case 1:return l.sent(),o(!1),d(!1),[2]}})}),function(e){return n.apply(this,arguments)}),$=function(e,n,r){r(D?(0,p.Z)((0,x.Z)({},n),{label:e.target.value,id:(0,I.lV)(e.target.value)}):(0,p.Z)((0,x.Z)({},n),{label:e.target.value}))},F=function(e,n){n("id",e.target.value),P(!1)};return(0,t.jsx)(Z.Z,{testId:"create-ct-modal",isOpen:l,widthInPx:"530px",formId:"create-custom-type",buttonLabel:"Create",close:function(){d(!1),P(!0)},onSubmit:function(e){V(e)},isLoading:a,initialValues:{repeatable:!0,id:"",label:""},validate:function(e){var n=e.id,r=e.label,t={};return r&&r.length||(t.label="Cannot be empty."),!t.label&&L.includes(r)&&(t.label="".concat(N.name({start:!0,plural:!1})," name is already taken.")),n&&n.length||(t.id="ID cannot be empty."),t.id||!n||T.xo.exec(n)||(t.id="Invalid id: No special characters allowed."),!t.id&&n&&C.map(function(e){return e.toLowerCase()}).includes(n)&&(t.id='ID "'.concat(n,'" exists already.')),Object.keys(t).length>0?t:void 0},content:{title:"Create a new ".concat(N.name({start:!1,plural:!1}))},children:function(e){var n=e.errors,a=e.setValues,l=e.setFieldValue,s=e.values,i=e.touched;return(0,t.jsxs)(g.xu,{children:[(0,t.jsx)(O,{format:r}),(0,t.jsx)(z.W,{name:"label",label:"".concat(N.name({start:!0,plural:!1})," Name"),testId:"ct-name-input",placeholder:"A display name for the ".concat(N.name({start:!1,plural:!1})),error:i.label?n.label:void 0,onChange:function(e){return $(e,s,a)}}),(0,t.jsx)(z.W,{name:"id",testId:"ct-id-input",label:"".concat(N.name({start:!0,plural:!1})," ID"),placeholder:N.inputPlaceholder,error:i.id?n.id:void 0,onChange:function(e){return F(e,l)}})]})}})},B=r(9502),E=function(e){return(0,t.jsxs)("svg",(0,p.Z)((0,x.Z)({viewBox:"0 0 20 24",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,t.jsx)("path",{d:"m2 24h16c1.1046 0 2-.8954 2-2v-17l-5-5h-13c-1.10457 0-2 .89543-2 2v20c0 1.1046.89543 2 2 2z",fill:"#6e56cf"}),(0,t.jsx)("path",{d:"m17 5h3l-5-5v3c0 1.10457.8954 2 2 2z",fill:"#9e8cfc"}),(0,t.jsx)("path",{d:"m10.0912 8c-2.8118 0-5.0912 2.2794-5.0912 5.0912s2.2794 5.0912 5.0912 5.0912c1.8851 0 3.5303-1.0247 4.4098-2.5452.1553-.2684.2868-.5523.3916-.8489.092-.2604-.0444-.5461-.3048-.6381-.2603-.092-.546.0445-.638.3048-.0841.238-.1897.4659-.3144.6815-.7081 1.2241-2.0305 2.0459-3.5442 2.0459-2.2595 0-4.0912-1.8317-4.0912-4.0912s1.8317-4.0912 4.0912-4.0912c1.3566 0 2.5595.66 3.3043 1.6782h-1.7739c-.2761 0-.5.2239-.5.5 0 .2762.2239.5.5.5h2.6782c.2762 0 .5-.2238.5-.5v-2.6782c0-.2761-.2238-.5-.5-.5-.2761 0-.5.2239-.5.5v1.1032c-.9281-.9865-2.2462-1.6032-3.7086-1.6032z",fill:"#fff"})]}))},V=function(e){return(0,t.jsxs)("svg",(0,p.Z)((0,x.Z)({viewBox:"0 0 20 24",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,t.jsx)("path",{d:"m2 24h16c1.1046 0 2-.8954 2-2v-17l-5-5h-13c-1.10457 0-2 .89543-2 2v20c0 1.1046.89543 2 2 2z",fill:"#6e56cf",fillRule:"nonzero"}),(0,t.jsx)("path",{d:"m17 5h3l-5-5v3c0 1.10457.8954 2 2 2z",fill:"#9e8cfc",fillRule:"nonzero"}),(0,t.jsx)("path",{d:"m8.0869 10.6818.5758-2.3031c.0556-.2226.2556-.3787.485-.3787.3253 0 .564.3057.4851.6213l-.5151 2.0605h2.6055l.5758-2.3031c.0557-.2226.2557-.3787.4851-.3787.3253 0 .564.3057.4851.6213l-.5152 2.0605h2.246c.2761 0 .5.2239.5.5 0 .2762-.2239.5-.5.5h-2.496l-.6591 2.6364h2.1551c.2761 0 .5.2238.5.5 0 .2761-.2239.5-.5.5h-2.4051l-.5757 2.3031c-.0557.2226-.2557.3787-.4851.3787-.3253 0-.564-.3057-.4851-.6213l.5152-2.0605h-2.6056l-.5758 2.3031c-.0556.2226-.2556.3787-.4851.3787-.3253 0-.5639-.3057-.485-.6213l.5151-2.0605h-1.9278c-.2761 0-.5-.2239-.5-.5 0-.2762.2239-.5.5-.5h2.1778l.6591-2.6364h-1.8369c-.2761 0-.5-.2238-.5-.5 0-.2761.2239-.5.5-.5zm2.7273 3.6364.659-2.6364h-2.6055l-.6591 2.6364z",fill:"#fff"})]}))},$=r(56471),F=r(18566),M=r(33476),W=r(93290),H=r(7604);function q(e){return G.apply(this,arguments)}function G(){return(G=(0,h.Z)(function(e){var n,r,t;return(0,f.__generator)(this,function(a){switch(a.label){case 0:return[4,H.j.customTypes.readAllCustomTypes({format:e})];case 1:if(r=(n=a.sent()).errors,t=n.models,r.length>0)throw r;return[2,t.map(function(e){return e.model})]}})})).apply(this,arguments)}var K=function(e){var n,r,l,s,c,o,d=e.format,h=e.isCreatingCustomType,x=e.openCreateCustomTypeModal,p=(0,m.useRouter)(),f=(r=(0,i.useCallback)(function(e){return(0,F.VA)(q,[d],e)},[d]),{customTypes:(0,F.QT)(q,[d]),updateCustomTypes:r}),g=f.customTypes,v=f.updateCustomTypes,b=g.sort(function(e,n){return e.id.localeCompare(n.id)}),y=w.cd[d],C=u.$[d];return(o=(0,j.v9)(function(e){return{storeCustomTypes:(0,_.Ch)(e).filter(W.TG)}}).storeCustomTypes,(0,i.useEffect)(function(){var e=o.filter(function(e){return e.local.format===d});(e.length!==g.length||e.some(function(e){var n=g.find(function(n){return n.id===e.local.id});return!n||JSON.stringify(M.Dc.fromSM(e.local))!==JSON.stringify(n)}))&&v(e.map(function(e){var n=e.local;return M.Dc.fromSM(n)}))},[d,v,g,o]),0===b.length)?(0,t.jsxs)(B.R$,{"data-testid":"blank-slate",style:{alignSelf:"center",marginTop:a.rS.space[72]},children:[(0,t.jsx)(B.u2,{children:(0,t.jsx)(a.Ee,{src:y.blankSlateImage,sizing:"cover"})}),(0,t.jsxs)(B.T9,{children:[(0,t.jsx)(B._T,{children:C.name({start:!0,plural:!0})}),(0,t.jsx)(B.nf,{children:C.blankSlateDescription}),(0,t.jsx)(B.Qj,{children:(0,t.jsx)(a.zx,{onClick:x,loading:h,children:"Create"})})]})]}):(0,t.jsx)("div",{children:(0,t.jsxs)(a.iA,{columnLayout:"28px 1fr 1fr 1fr 42px",children:[(0,t.jsx)(a.ss,{children:(0,t.jsxs)(a.SC,{children:[(0,t.jsx)(a.pj,{children:(0,t.jsx)(a.I5,{name:"notes",size:"medium"})}),(0,t.jsx)(a.pj,{children:(0,t.jsx)(a.xv,{color:"grey11",variant:"small",children:"Label"})}),(0,t.jsx)(a.pj,{children:(0,t.jsx)(a.xv,{color:"grey11",variant:"small",children:"API ID"})}),(0,t.jsx)(a.pj,{children:(0,t.jsx)(a.xv,{color:"grey11",variant:"small",children:"Limit"})}),(0,t.jsx)(a.pj,{})]})}),(0,t.jsx)(a.RM,{children:b.map(function(e){var n=e.repeatable,r=e.label,l=e.id;return(0,t.jsxs)(a.SC,{onClick:function(){p.push(w.cd[d].getBuilderPagePathname(l))},children:[(0,t.jsx)(a.pj,{children:n?(0,t.jsx)(E,{width:a.rS.space[20]}):(0,t.jsx)(V,{width:a.rS.space[20]})}),(0,t.jsx)(a.pj,{children:(0,t.jsx)(a.xv,{variant:"bold",noWrap:!0,children:r})}),(0,t.jsx)(a.pj,{children:(0,t.jsx)(a.xv,{color:"grey11",noWrap:!0,children:l})}),(0,t.jsx)(a.pj,{children:(0,t.jsx)(a.xv,{color:"grey11",noWrap:!0,children:n?"Reusable":"Single"})}),(0,t.jsx)(a.pj,{children:(0,t.jsx)($._,{isChangesLocal:!1,format:d,customType:e})})]},l)})})]})})},Y=function(e){var n=e.format,r=u.$[n],l=(0,i.useState)(!1),h=l[0],x=l[1],p=(0,i.useState)(!1),f=p[0],m=p[1];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s(),{children:(0,t.jsxs)("title",{children:[r.name({start:!0,plural:!0})," - Slice Machine"]})}),(0,t.jsx)(o.S,{renderError:function(){return(0,t.jsx)(d.LN,{children:(0,t.jsx)(d.RN,{children:(0,t.jsx)(a.xu,{alignItems:"center",justifyContent:"center",children:(0,t.jsx)(a.Iq,{title:"Request failed",description:"An error occurred while fetching your ".concat(r.name({start:!1,plural:!0}),".")})})})})},children:(0,t.jsx)(i.Suspense,{fallback:(0,t.jsxs)(d.LN,{children:[(0,t.jsxs)(d.wd,{children:[(0,t.jsx)(d.Cx,{children:(0,t.jsx)(c.g,{children:r.name({start:!0,plural:!0})})}),(0,t.jsx)(d.K2,{children:(0,t.jsx)(a.zx,{disabled:!0,startIcon:"add",children:"Create"})})]}),(0,t.jsx)(d.RN,{children:(0,t.jsx)(a._3,{})})]}),children:(0,t.jsxs)(d.LN,{children:[(0,t.jsxs)(d.wd,{children:[(0,t.jsx)(d.Cx,{children:(0,t.jsx)(c.g,{children:r.name({start:!0,plural:!0})})}),(0,t.jsx)(d.K2,{children:(0,t.jsx)(a.zx,{"data-testid":"create-ct",loading:h,onClick:function(){m(!0)},startIcon:"add",children:"Create"})})]}),(0,t.jsx)(d.RN,{children:(0,t.jsxs)(a.xu,{flexDirection:"column",children:[(0,t.jsx)(K,{format:n,isCreatingCustomType:h,openCreateCustomTypeModal:function(){m(!0)}}),(0,t.jsx)(P,{format:n,isCreating:h,isOpen:f,onCreateChange:x,onOpenChange:m})]})})]})})})]})}},2978:function(e,n,r){r.d(n,{Z:function(){return o}});var t=r(62230),a=r(85244),l=r(98240),s=r(52322);r(2784);var i=r(75289),c=function(e){var n=e.bg,r=e.background,a=e.sx,l=e.withRadius,c=e.radius,o=e.children;return(0,s.jsx)(i.xu,{sx:(0,t.Z)({p:4,bg:n||r},l?{borderBottomLeftRadius:c,borderBottomRightRadius:c}:null,a),children:o})},o=function(e){var n=e.Header,r=void 0===n?null:n,o=e.SubHeader,u=void 0===o?null:o,d=e.Body,h=void 0===d?null:d,x=e.Footer,p=void 0===x?null:x,f=e.borderFooter,m=e.radius,j=void 0===m?"6px":m,g=e.bodySx,v=e.footerSx,b=e.sx,y=e.bg,C=e.background,S=e.children,w=(0,l.Z)(e,["Header","SubHeader","Body","Footer","borderFooter","radius","bodySx","footerSx","sx","bg","background","children"]);return(0,s.jsxs)(i.Zb,(0,a.Z)((0,t.Z)({sx:(0,t.Z)({border:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))},borderRadius:j},void 0===b?null:b)},w),{children:[r?(0,s.jsx)(r,{radius:j}):null,u?(0,s.jsx)(u,{radius:j}):null,(0,s.jsxs)(c,{bg:y,background:C,sx:void 0===g?{}:g,withRadius:!p,children:[h?(0,s.jsx)(h,{}):null,S||null]}),p?(0,s.jsx)(c,{bg:y,background:C,sx:(0,t.Z)({},void 0!==f&&f?{borderTop:function(e){var n=e.colors;return"1px solid ".concat(String(null==n?void 0:n.borders))}}:null,void 0===v?{}:v),radius:j,withRadius:!0,children:"object"==typeof p?p:(0,s.jsx)(p,{})}):null]}))}},25978:function(e,n,r){r.d(n,{Sn:function(){return i},lS:function(){return t},nG:function(){return a},pq:function(){return c},rd:function(){return s},xo:function(){return l}});var t=["components"],a=["png","jpg","jpeg"],l=/^[A-Za-z0-9]+(?:_[A-Za-z0-9]+)*$/,s="placeholders/What_are_Slices_mrvome",i="SM_HELP_VIDEOS/mock_data",c="slice-machine-simulator"}}]);