slice-machine-ui 2.18.2-beta.1 → 2.18.2-beta.3

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 (38) hide show
  1. package/out/404.html +1 -1
  2. package/out/_next/static/{7OUQL9pGJiLbv-sShLrNY → RUbRToZTa-4RHTJnfrxnZ}/_buildManifest.js +1 -1
  3. package/out/_next/static/chunks/{248-a9c33f7fbe2da2f1.js → 248-84a5987f0499b074.js} +1 -1
  4. package/out/_next/static/chunks/{34-50c64778da33cff6.js → 34-28725deef8b874b1.js} +1 -1
  5. package/out/_next/static/chunks/489-ce3053e1d81ade83.js +1 -0
  6. package/out/_next/static/chunks/630-fb5945894ef58200.js +1 -0
  7. package/out/_next/static/chunks/{647-4379a741c8d85d9e.js → 647-aa094286bc248d52.js} +1 -1
  8. package/out/_next/static/chunks/{907-445266211c48b1a5.js → 907-180eb33eefccc237.js} +1 -1
  9. package/out/_next/static/chunks/a6495ab1.00190ac98e794d8f.js +28 -0
  10. package/out/_next/static/chunks/pages/{_app-4cae830590a43179.js → _app-42bd57416b6dacc9.js} +196 -196
  11. package/out/_next/static/chunks/pages/{changelog-3901f2fc937d9648.js → changelog-8514e0696e90a1b2.js} +1 -1
  12. package/out/_next/static/chunks/pages/changes-e04382aa2eef790f.js +1 -0
  13. package/out/_next/static/chunks/pages/{labs-dd04033db23a58f3.js → labs-56fd818a63553497.js} +1 -1
  14. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/{simulator-f237aaa755dc9a99.js → simulator-faeb6d2f77d97096.js} +1 -1
  15. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/{[variation]-c8c3e7ffb898261c.js → [variation]-e973a443d8b8a75d.js} +1 -1
  16. package/out/_next/static/chunks/pages/{slices-0aaae79dcc7b8c55.js → slices-887783a5a2142ed7.js} +1 -1
  17. package/out/_next/static/chunks/webpack-24ddb02bea621501.js +1 -0
  18. package/out/changelog.html +1 -1
  19. package/out/changes.html +1 -1
  20. package/out/custom-types/[customTypeId].html +1 -1
  21. package/out/custom-types.html +1 -1
  22. package/out/index.html +1 -1
  23. package/out/labs.html +1 -1
  24. package/out/page-types/[pageTypeId].html +1 -1
  25. package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
  26. package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
  27. package/out/slices.html +1 -1
  28. package/package.json +6 -6
  29. package/src/features/customTypes/customTypesBuilder/SliceZoneBlankSlate.tsx +3 -3
  30. package/src/features/onboarding/OnboardingGuide.tsx +2 -5
  31. package/src/features/onboarding/useOnboarding.ts +1 -14
  32. package/out/_next/static/chunks/04ad993f.d7f986af0f739cc9.js +0 -28
  33. package/out/_next/static/chunks/489-a046ae0fa4f74435.js +0 -1
  34. package/out/_next/static/chunks/630-eae75e90b30f201a.js +0 -1
  35. package/out/_next/static/chunks/pages/changes-c58a60af39167147.js +0 -1
  36. package/out/_next/static/chunks/webpack-e0c07a2fe4908d81.js +0 -1
  37. package/src/features/onboarding/useSharedOnboardingExperiment.ts +0 -6
  38. /package/out/_next/static/{7OUQL9pGJiLbv-sShLrNY → RUbRToZTa-4RHTJnfrxnZ}/_ssgManifest.js +0 -0
package/out/404.html CHANGED
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/bc89f2cd4e4781f5.css" as="style"/><link rel="stylesheet" href="/_next/static/css/bc89f2cd4e4781f5.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-e0c07a2fe4908d81.js" defer=""></script><script src="/_next/static/chunks/framework-ab7ddb551c23d05a.js" defer=""></script><script src="/_next/static/chunks/main-c46f4dcf6e3174bd.js" defer=""></script><script src="/_next/static/chunks/pages/_app-4cae830590a43179.js" defer=""></script><script src="/_next/static/chunks/pages/_error-fedd2c6ebd3d27b9.js" defer=""></script><script src="/_next/static/7OUQL9pGJiLbv-sShLrNY/_buildManifest.js" defer=""></script><script src="/_next/static/7OUQL9pGJiLbv-sShLrNY/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"7OUQL9pGJiLbv-sShLrNY","runtimeConfig":{"sentryEnvironment":"beta"},"nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/css/bc89f2cd4e4781f5.css" as="style"/><link rel="stylesheet" href="/_next/static/css/bc89f2cd4e4781f5.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-24ddb02bea621501.js" defer=""></script><script src="/_next/static/chunks/framework-ab7ddb551c23d05a.js" defer=""></script><script src="/_next/static/chunks/main-c46f4dcf6e3174bd.js" defer=""></script><script src="/_next/static/chunks/pages/_app-42bd57416b6dacc9.js" defer=""></script><script src="/_next/static/chunks/pages/_error-fedd2c6ebd3d27b9.js" defer=""></script><script src="/_next/static/RUbRToZTa-4RHTJnfrxnZ/_buildManifest.js" defer=""></script><script src="/_next/static/RUbRToZTa-4RHTJnfrxnZ/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"RUbRToZTa-4RHTJnfrxnZ","runtimeConfig":{"sentryEnvironment":"beta"},"nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
@@ -1 +1 @@
1
- self.__BUILD_MANIFEST=function(s,c,a,e,t,i,b,d,n,u,f,h,k,j,l,p,g,o,r,m,_,y){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":[s,e,p,g,"static/chunks/pages/index-0d8cb369de720a35.js"],"/_error":["static/chunks/pages/_error-fedd2c6ebd3d27b9.js"],"/changelog":[c,t,"static/chunks/870-a72b74312773efea.js","static/chunks/pages/changelog-3901f2fc937d9648.js"],"/changes":[c,i,"static/chunks/8eec4907-b712959d9f984b68.js","static/chunks/918-fa4f2563cb5fd014.js",a,d,"static/css/d98ebc475f8423a3.css","static/chunks/pages/changes-c58a60af39167147.js"],"/custom-types":[s,e,p,g,"static/chunks/pages/custom-types-5acd56959b60346f.js"],"/custom-types/[customTypeId]":[c,n,u,f,h,s,t,b,k,o,a,e,j,l,r,m,"static/chunks/pages/custom-types/[customTypeId]-af9376721beb489e.js"],"/labs":["static/chunks/pages/labs-dd04033db23a58f3.js"],"/page-types/[pageTypeId]":[c,n,u,f,h,s,t,b,k,o,a,e,j,l,r,m,"static/chunks/pages/page-types/[pageTypeId]-a24665e91b882169.js"],"/slices":[c,i,_,s,b,y,a,d,l,"static/css/efa5152b7c0f35c0.css","static/chunks/pages/slices-0aaae79dcc7b8c55.js"],"/slices/[lib]/[sliceName]/[variation]":[c,i,n,u,f,h,_,s,t,b,k,y,"static/chunks/484-3e011e79c41f0342.js",a,j,d,"static/css/e8e03c0d4003d1eb.css","static/chunks/pages/slices/[lib]/[sliceName]/[variation]-c8c3e7ffb898261c.js"],"/slices/[lib]/[sliceName]/[variation]/simulator":[i,"static/chunks/72585f70-28b4d7d5384b3703.js","static/chunks/429-aab52070cad2884b.js","static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-f237aaa755dc9a99.js"],sortedPages:["/","/_app","/_error","/changelog","/changes","/custom-types","/custom-types/[customTypeId]","/labs","/page-types/[pageTypeId]","/slices","/slices/[lib]/[sliceName]/[variation]","/slices/[lib]/[sliceName]/[variation]/simulator"]}}("static/chunks/397-e6c340070a3bcb41.js","static/chunks/59b4e022-ef680789f7cc9b11.js","static/chunks/34-50c64778da33cff6.js","static/chunks/647-4379a741c8d85d9e.js","static/chunks/183-4ea255b867ff171b.js","static/chunks/c8eae200-966ce352f7b5d2b9.js","static/chunks/344-fdb3008f4bb3b0c1.js","static/chunks/658-8231c0b729e0124a.js","static/chunks/f36c6662-1f3a854183168b10.js","static/chunks/4c744e84-480e426e4b1cfef3.js","static/chunks/065a3ddb-9a38ca0d60f0bf2f.js","static/chunks/1cc2734a-09fb3b997ad1eb70.js","static/chunks/256-07f768a2b19b0a0e.js","static/chunks/630-eae75e90b30f201a.js","static/chunks/907-445266211c48b1a5.js","static/chunks/248-a9c33f7fbe2da2f1.js","static/css/4e475d945cf8a890.css","static/chunks/422-c9192a1dbdd2ae0e.js","static/chunks/489-a046ae0fa4f74435.js","static/css/56f2a6684a524374.css","static/chunks/52d4c156-89c6ec6efca0a0bb.js","static/chunks/500-d3989390f5e8da53.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
1
+ self.__BUILD_MANIFEST=function(s,c,a,e,t,i,b,d,n,u,f,h,k,j,l,p,g,o,r,m,_,y){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":[s,e,p,g,"static/chunks/pages/index-0d8cb369de720a35.js"],"/_error":["static/chunks/pages/_error-fedd2c6ebd3d27b9.js"],"/changelog":[c,t,"static/chunks/870-a72b74312773efea.js","static/chunks/pages/changelog-8514e0696e90a1b2.js"],"/changes":[c,i,"static/chunks/8eec4907-b712959d9f984b68.js","static/chunks/918-fa4f2563cb5fd014.js",a,d,"static/css/d98ebc475f8423a3.css","static/chunks/pages/changes-e04382aa2eef790f.js"],"/custom-types":[s,e,p,g,"static/chunks/pages/custom-types-5acd56959b60346f.js"],"/custom-types/[customTypeId]":[c,n,u,f,h,s,t,b,k,o,a,e,j,l,r,m,"static/chunks/pages/custom-types/[customTypeId]-af9376721beb489e.js"],"/labs":["static/chunks/pages/labs-56fd818a63553497.js"],"/page-types/[pageTypeId]":[c,n,u,f,h,s,t,b,k,o,a,e,j,l,r,m,"static/chunks/pages/page-types/[pageTypeId]-a24665e91b882169.js"],"/slices":[c,i,_,s,b,y,a,d,l,"static/css/efa5152b7c0f35c0.css","static/chunks/pages/slices-887783a5a2142ed7.js"],"/slices/[lib]/[sliceName]/[variation]":[c,i,n,u,f,h,_,s,t,b,k,y,"static/chunks/484-3e011e79c41f0342.js",a,j,d,"static/css/e8e03c0d4003d1eb.css","static/chunks/pages/slices/[lib]/[sliceName]/[variation]-e973a443d8b8a75d.js"],"/slices/[lib]/[sliceName]/[variation]/simulator":[i,"static/chunks/72585f70-28b4d7d5384b3703.js","static/chunks/429-aab52070cad2884b.js","static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-faeb6d2f77d97096.js"],sortedPages:["/","/_app","/_error","/changelog","/changes","/custom-types","/custom-types/[customTypeId]","/labs","/page-types/[pageTypeId]","/slices","/slices/[lib]/[sliceName]/[variation]","/slices/[lib]/[sliceName]/[variation]/simulator"]}}("static/chunks/397-e6c340070a3bcb41.js","static/chunks/59b4e022-ef680789f7cc9b11.js","static/chunks/34-28725deef8b874b1.js","static/chunks/647-aa094286bc248d52.js","static/chunks/183-4ea255b867ff171b.js","static/chunks/c8eae200-966ce352f7b5d2b9.js","static/chunks/344-fdb3008f4bb3b0c1.js","static/chunks/658-8231c0b729e0124a.js","static/chunks/f36c6662-1f3a854183168b10.js","static/chunks/4c744e84-480e426e4b1cfef3.js","static/chunks/065a3ddb-9a38ca0d60f0bf2f.js","static/chunks/1cc2734a-09fb3b997ad1eb70.js","static/chunks/256-07f768a2b19b0a0e.js","static/chunks/630-fb5945894ef58200.js","static/chunks/907-180eb33eefccc237.js","static/chunks/248-84a5987f0499b074.js","static/css/4e475d945cf8a890.css","static/chunks/422-c9192a1dbdd2ae0e.js","static/chunks/489-ce3053e1d81ade83.js","static/css/56f2a6684a524374.css","static/chunks/52d4c156-89c6ec6efca0a0bb.js","static/chunks/500-d3989390f5e8da53.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[248],{72641:function(e,t,n){"use strict";n.d(t,{R$:function(){return i},Qj:function(){return x},T9:function(){return d},nf:function(){return h},u2:function(){return o},_T:function(){return u}});var l=n(52322),r=n(14226),a=n(6277),s=n(83478),c=n.n(s);let i=e=>{let{backgroundImage:t,style:n,...r}=e,s=void 0!==t;return(0,l.jsx)("article",{...r,className:(0,a.W)(c().root,{[c().withBackground]:s}),style:{backgroundImage:s?"url(".concat(t,")"):void 0,...n}})},o=e=>(0,l.jsx)("div",{...e,className:c().image}),d=e=>(0,l.jsx)("div",{...e,className:c().content}),u=e=>(0,l.jsx)(r.bL,{...e,variant:"h3"}),h=e=>(0,l.jsx)(r.bL,{...e,color:"grey11"}),x=e=>(0,l.jsx)("div",{...e,className:c().actions,color:"grey"})},38241:function(e,t,n){"use strict";n.d(t,{F:function(){return O}});var l=n(52322),r=n(14226),a=n(97729),s=n.n(a),c=n(2784),i=n(43388),o=n(98564),d=n(87446),u=n(58446),h=n(5632),x=n(56580),m=n(75289),p=n(77630),j=n(88932),g=n(94160),b=n(39204);async function f(e){let{id:t,label:n,repeatable:l,format:r,onSuccess:a}=e,s=o.$[r],c=(0,p.Ue)({id:t,label:n,repeatable:l,format:r});try{let{errors:e}=await (0,g.KA)({customType:c});if(e.length>0)throw e;g.Xe.track({event:"custom-type:created",id:c.id,name:n,format:r,type:l?"repeatable":"single",origin:"table"}),await a(c),j.Am.success((0,b.GX)({message:"".concat(s.name({start:!0,plural:!1})," saved successfully at "),path:"./customtypes/".concat(c.id,"/index.json")}))}catch(t){let e="Internal Error: ".concat(s.name({start:!0,plural:!1})," not saved");console.error(e,t),j.Am.error(e)}}var v=n(59294),_=n(98250),y=n(68968),S=n(59532),C=n(7974),k=n(358),w=n(78254),L=n(54597),I=n(46999),R=n(63397);let B=e=>{let{selected:t,...n}=e;return(0,l.jsx)(m.kC,{sx:{p:"24px",mb:3,alignItems:"top",cursor:"pointer",borderRadius:"6px",backgroundColor:"grayLight",boxShadow:t?e=>{var t;return"0 0 0 2px ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.primary))}:"none","&:hover":{boxShadow:e=>{var t;return"0 0 0 2px ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.primary))}}},...n})},N=e=>{let{format:t}=e,[n,,r]=(0,R.U$)("repeatable"),a=o.$[t];return(0,l.jsxs)(m.xu,{mb:2,children:[(0,l.jsxs)(B,{selected:n.value,onClick:()=>r.setValue(!0),children:[(0,l.jsx)(m.Y8,{checked:n.value,onChange:()=>{},"data-testid":"repeatable-type-radio-btn"}),(0,l.jsxs)(m.xu,{sx:{marginLeft:2},children:["Reusable type",(0,l.jsx)(m.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:a.hintRepeatable})]})]}),(0,l.jsxs)(B,{selected:!n.value,onClick:()=>r.setValue(!1),children:[(0,l.jsx)(m.Y8,{checked:!n.value,onChange:()=>{},"data-testid":"single-type-radio-btn"}),(0,l.jsxs)(m.xu,{sx:{marginLeft:2},children:["Single type",(0,l.jsx)(m.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:a.hintSingle})]})]})]})},z=e=>{let{format:t,isCreating:n,isOpen:r,origin:a="table",onCreateChange:s,onOpenChange:i}=e,{createCustomTypeSuccess:d}=(0,L.Z)(),{completeStep:u}=(0,_.k)(),{customTypeIds:j,customTypeLabels:g}=(0,x.v9)(e=>({customTypeIds:(0,w.W6)(e),customTypeLabels:(0,w.YS)(e)})),b=o.$[t],[R,B]=(0,c.useState)(!0),{syncChanges:z}=(0,y.g)(),E=(0,h.useRouter)(),T=async e=>{let{id:n,label:l,repeatable:r}=e;s(!0),await f({format:t,id:n,label:l,origin:a,repeatable:r,onSuccess:async e=>{d(e);let t=(0,p.y6)(e),l=v.cd[t];B(!0),await E.push({pathname:l.getBuilderPagePathname(n)}),z(),"page"===t&&u("createPageType")}}),s(!1),i(!1)},G=(e,t,n)=>{n(R?{...t,label:e.target.value,id:(0,k.lV)(e.target.value)}:{...t,label:e.target.value})},D=(e,t)=>{t("id",e.target.value),B(!1)};return(0,l.jsx)(S.Z,{testId:"create-ct-modal",isOpen:r,widthInPx:"530px",formId:"create-custom-type",buttonLabel:"Create",close:()=>{i(!1),B(!0)},onSubmit:e=>{T(e)},isLoading:n,initialValues:{repeatable:!0,id:"",label:""},validate:e=>{let{id:t,label:n}=e,l={};return n&&n.length||(l.label="Cannot be empty."),!l.label&&g.includes(n)&&(l.label="".concat(b.name({start:!0,plural:!1})," name is already taken.")),["update","insert"].includes(n.toLowerCase())&&(l.label='Name "'.concat(n,'" is reserved for Slice Machine use.')),t&&t.length||(l.id="ID cannot be empty."),["update","insert"].includes(t.toLowerCase())&&(l.id='Id "'.concat(t,'" is reserved for Slice Machine use.')),l.id||!t||C.xo.exec(t)||(l.id="Invalid id: No special characters allowed."),!l.id&&t&&j.map(e=>e.toLowerCase()).includes(t)&&(l.id='ID "'.concat(t,'" exists already.')),Object.keys(l).length>0?l:void 0},content:{title:"Create a new ".concat(b.name({start:!1,plural:!1}))},children:e=>{let{errors:n,setValues:r,setFieldValue:a,values:s,touched:c}=e;return(0,l.jsxs)(m.xu,{children:[(0,l.jsx)(N,{format:t}),(0,l.jsx)(I.W,{name:"label",label:"".concat(b.name({start:!0,plural:!1})," Name"),testId:"ct-name-input",placeholder:"A display name for the ".concat(b.name({start:!1,plural:!1})),error:c.label?n.label:void 0,onChange:e=>G(e,s,r)}),(0,l.jsx)(I.W,{name:"id",testId:"ct-id-input",label:"".concat(b.name({start:!0,plural:!1})," ID"),placeholder:b.inputPlaceholder,error:c.id?n.id:void 0,onChange:e=>D(e,a)})]})}})};var E=n(72641);let T=e=>(0,l.jsxs)("svg",{viewBox:"0 0 20 24",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,l.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,l.jsx)("path",{d:"m17 5h3l-5-5v3c0 1.10457.8954 2 2 2z",fill:"#9e8cfc"}),(0,l.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"})]}),G=e=>(0,l.jsxs)("svg",{viewBox:"0 0 20 24",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,l.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,l.jsx)("path",{d:"m17 5h3l-5-5v3c0 1.10457.8954 2 2 2z",fill:"#9e8cfc",fillRule:"nonzero"}),(0,l.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"})]});var D=n(60867),P=n(50477),W=n(94840),A=n(16442);let $=e=>{let{format:t,isCreatingCustomType:n,openCreateCustomTypeModal:a}=e,s=(0,h.useRouter)(),{customTypes:i,updateCustomTypes:d}=(0,P.xU)(t),u=i.sort((e,t)=>e.id.localeCompare(t.id)),m=v.cd[t],p=o.$[t];return(!function(e,t,n){let{storeCustomTypes:l}=(0,x.v9)(e=>({storeCustomTypes:(0,w.Ch)(e).filter(A.TG)}));(0,c.useEffect)(()=>{let r=l.filter(e=>{let{local:n}=e;return n.format===t});(r.length!==e.length||r.some(t=>{let n=e.find(e=>e.id===t.local.id);return!n||JSON.stringify(W.Dc.fromSM(t.local))!==JSON.stringify(n)}))&&n(r.map(e=>{let{local:t}=e;return W.Dc.fromSM(t)}))},[t,n,e,l])}(i,t,d),0===u.length)?(0,l.jsxs)(E.R$,{"data-testid":"blank-slate",style:{alignSelf:"center",marginTop:r.t.space[72]},children:[(0,l.jsx)(E.u2,{children:(0,l.jsx)(r.a_,{src:m.blankSlateImage,sizing:"cover"})}),(0,l.jsxs)(E.T9,{children:[(0,l.jsx)(E._T,{children:p.name({start:!0,plural:!0})}),(0,l.jsx)(E.nf,{children:p.blankSlateDescription}),(0,l.jsx)(E.Qj,{children:(0,l.jsx)(r.E,{onClick:a,loading:n,children:"Create"})})]})]}):(0,l.jsx)("div",{children:(0,l.jsxs)(r.bE,{columnLayout:"28px 1fr 1fr 1fr 42px",children:[(0,l.jsx)(r.bH,{children:(0,l.jsxs)(r.bI,{children:[(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.aX,{name:"notes",size:"medium"})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",variant:"small",children:"Label"})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",variant:"small",children:"API ID"})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",variant:"small",children:"Limit"})}),(0,l.jsx)(r.bG,{})]})}),(0,l.jsx)(r.bF,{children:u.map(e=>{let{repeatable:n,label:a,id:c}=e;return(0,l.jsxs)(r.bI,{onClick:()=>{s.push(v.cd[t].getBuilderPagePathname(c))},children:[(0,l.jsx)(r.bG,{children:n?(0,l.jsx)(T,{width:r.t.space[20]}):(0,l.jsx)(G,{width:r.t.space[20]})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{variant:"bold",noWrap:!0,children:a})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",noWrap:!0,children:c})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",noWrap:!0,children:n?"Reusable":"Single"})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(D._,{isChangesLocal:!1,format:t,customType:e})})]},c)})})]})})},O=e=>{let{format:t}=e,n=o.$[t],[a,h]=(0,c.useState)(!1),[x,m]=(0,c.useState)(!1);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(s(),{children:(0,l.jsxs)("title",{children:[n.name({start:!0,plural:!0})," - Slice Machine"]})}),(0,l.jsx)(d.h,{renderError:()=>(0,l.jsx)(u.LN,{children:(0,l.jsx)(u.RN,{children:(0,l.jsx)(r.D,{alignItems:"center",justifyContent:"center",children:(0,l.jsx)(r.ax,{title:"Request failed",description:"An error occurred while fetching your ".concat(n.name({start:!1,plural:!0}),".")})})})}),children:(0,l.jsx)(c.Suspense,{fallback:(0,l.jsxs)(u.LN,{children:[(0,l.jsxs)(u.wd,{children:[(0,l.jsx)(u.Cx,{children:(0,l.jsx)(i.g,{children:n.name({start:!0,plural:!0})})}),(0,l.jsx)(u.K2,{children:(0,l.jsx)(r.E,{disabled:!0,startIcon:"add",children:"Create"})})]}),(0,l.jsx)(u.RN,{children:(0,l.jsx)(r.bg,{})})]}),children:(0,l.jsxs)(u.LN,{children:[(0,l.jsxs)(u.wd,{children:[(0,l.jsx)(u.Cx,{children:(0,l.jsx)(i.g,{children:n.name({start:!0,plural:!0})})}),(0,l.jsx)(u.K2,{children:(0,l.jsx)(r.E,{"data-testid":"create-ct",loading:a,onClick:()=>{m(!0)},startIcon:"add",children:"Create"})})]}),(0,l.jsx)(u.RN,{children:(0,l.jsxs)(r.D,{flexDirection:"column",children:[(0,l.jsx)($,{format:t,isCreatingCustomType:a,openCreateCustomTypeModal:()=>{m(!0)}}),(0,l.jsx)(z,{format:t,isCreating:a,isOpen:x,onCreateChange:h,onOpenChange:m})]})})]})})})]})}},30527:function(e,t,n){"use strict";n.d(t,{Z:function(){return o},W:function(){return i}});var l=n(52322),r=n(2784),a=n(75289);let s=e=>{let{bg:t,background:n,sx:r,withRadius:s,radius:c,children:i}=e;return(0,l.jsx)(a.xu,{sx:{p:4,bg:t||n,...s?{borderBottomLeftRadius:c,borderBottomRightRadius:c}:null,...r},children:i})},c=(0,r.createContext)("6px"),i=()=>(0,r.useContext)(c),o=e=>{let{Header:t=null,SubHeader:n=null,Body:r=null,Footer:i=null,borderFooter:o=!1,radius:d="6px",bodySx:u={},footerSx:h={},sx:x=null,bg:m,background:p,children:j,...g}=e;return(0,l.jsx)(c.Provider,{value:d,children:(0,l.jsxs)(a.Zb,{sx:{border:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))},borderRadius:d,...x},...g,children:[t||null,n||null,(0,l.jsxs)(s,{bg:m,background:p,sx:u,withRadius:!i,children:[r?(0,l.jsx)(r,{}):null,j||null]}),i?(0,l.jsx)(s,{bg:m,background:p,sx:{...o?{borderTop:e=>{let{colors:t}=e;return"1px solid ".concat(String(null==t?void 0:t.borders))}}:null,...h},radius:d,withRadius:!0,children:"object"==typeof i?i:(0,l.jsx)(i,{})}):null]})})}},7974:function(e,t,n){"use strict";n.d(t,{Sn:function(){return c},lS:function(){return l},nG:function(){return r},pq:function(){return i},rd:function(){return s},xo:function(){return a}});let l=["components","update","insert"],r=["png","jpg","jpeg"],a=/^[A-Za-z0-9]+(?:_[A-Za-z0-9]+)*$/,s="placeholders/What_are_Slices_mrvome",c="SM_HELP_VIDEOS/mock_data",i="slice-machine-simulator"},83478:function(e){e.exports={column:"BlankSlate_column__genEe",root:"BlankSlate_root__CmSqW BlankSlate_column__genEe",fadeIn:"BlankSlate_fadeIn__mAfi5",withBackground:"BlankSlate_withBackground__mLYij",image:"BlankSlate_image__Jn90S BlankSlate_column__genEe",content:"BlankSlate_content__0Yt2d BlankSlate_column__genEe",desc:"BlankSlate_desc___Dl7e",actions:"BlankSlate_actions__OYRj4"}}}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[248],{72641:function(e,t,n){"use strict";n.d(t,{R$:function(){return i},Qj:function(){return x},T9:function(){return d},nf:function(){return h},u2:function(){return o},_T:function(){return u}});var l=n(52322),r=n(11699),a=n(6277),s=n(83478),c=n.n(s);let i=e=>{let{backgroundImage:t,style:n,...r}=e,s=void 0!==t;return(0,l.jsx)("article",{...r,className:(0,a.W)(c().root,{[c().withBackground]:s}),style:{backgroundImage:s?"url(".concat(t,")"):void 0,...n}})},o=e=>(0,l.jsx)("div",{...e,className:c().image}),d=e=>(0,l.jsx)("div",{...e,className:c().content}),u=e=>(0,l.jsx)(r.bL,{...e,variant:"h3"}),h=e=>(0,l.jsx)(r.bL,{...e,color:"grey11"}),x=e=>(0,l.jsx)("div",{...e,className:c().actions,color:"grey"})},38241:function(e,t,n){"use strict";n.d(t,{F:function(){return O}});var l=n(52322),r=n(11699),a=n(97729),s=n.n(a),c=n(2784),i=n(43388),o=n(98564),d=n(87446),u=n(58446),h=n(5632),x=n(56580),m=n(75289),p=n(77630),j=n(88932),g=n(94160),b=n(39204);async function f(e){let{id:t,label:n,repeatable:l,format:r,onSuccess:a}=e,s=o.$[r],c=(0,p.Ue)({id:t,label:n,repeatable:l,format:r});try{let{errors:e}=await (0,g.KA)({customType:c});if(e.length>0)throw e;g.Xe.track({event:"custom-type:created",id:c.id,name:n,format:r,type:l?"repeatable":"single",origin:"table"}),await a(c),j.Am.success((0,b.GX)({message:"".concat(s.name({start:!0,plural:!1})," saved successfully at "),path:"./customtypes/".concat(c.id,"/index.json")}))}catch(t){let e="Internal Error: ".concat(s.name({start:!0,plural:!1})," not saved");console.error(e,t),j.Am.error(e)}}var v=n(59294),_=n(98250),y=n(68968),S=n(59532),C=n(7974),k=n(358),w=n(78254),L=n(54597),I=n(46999),R=n(63397);let B=e=>{let{selected:t,...n}=e;return(0,l.jsx)(m.kC,{sx:{p:"24px",mb:3,alignItems:"top",cursor:"pointer",borderRadius:"6px",backgroundColor:"grayLight",boxShadow:t?e=>{var t;return"0 0 0 2px ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.primary))}:"none","&:hover":{boxShadow:e=>{var t;return"0 0 0 2px ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.primary))}}},...n})},N=e=>{let{format:t}=e,[n,,r]=(0,R.U$)("repeatable"),a=o.$[t];return(0,l.jsxs)(m.xu,{mb:2,children:[(0,l.jsxs)(B,{selected:n.value,onClick:()=>r.setValue(!0),children:[(0,l.jsx)(m.Y8,{checked:n.value,onChange:()=>{},"data-testid":"repeatable-type-radio-btn"}),(0,l.jsxs)(m.xu,{sx:{marginLeft:2},children:["Reusable type",(0,l.jsx)(m.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:a.hintRepeatable})]})]}),(0,l.jsxs)(B,{selected:!n.value,onClick:()=>r.setValue(!1),children:[(0,l.jsx)(m.Y8,{checked:!n.value,onChange:()=>{},"data-testid":"single-type-radio-btn"}),(0,l.jsxs)(m.xu,{sx:{marginLeft:2},children:["Single type",(0,l.jsx)(m.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:a.hintSingle})]})]})]})},z=e=>{let{format:t,isCreating:n,isOpen:r,origin:a="table",onCreateChange:s,onOpenChange:i}=e,{createCustomTypeSuccess:d}=(0,L.Z)(),{completeStep:u}=(0,_.k)(),{customTypeIds:j,customTypeLabels:g}=(0,x.v9)(e=>({customTypeIds:(0,w.W6)(e),customTypeLabels:(0,w.YS)(e)})),b=o.$[t],[R,B]=(0,c.useState)(!0),{syncChanges:z}=(0,y.g)(),E=(0,h.useRouter)(),T=async e=>{let{id:n,label:l,repeatable:r}=e;s(!0),await f({format:t,id:n,label:l,origin:a,repeatable:r,onSuccess:async e=>{d(e);let t=(0,p.y6)(e),l=v.cd[t];B(!0),await E.push({pathname:l.getBuilderPagePathname(n)}),z(),"page"===t&&u("createPageType")}}),s(!1),i(!1)},G=(e,t,n)=>{n(R?{...t,label:e.target.value,id:(0,k.lV)(e.target.value)}:{...t,label:e.target.value})},D=(e,t)=>{t("id",e.target.value),B(!1)};return(0,l.jsx)(S.Z,{testId:"create-ct-modal",isOpen:r,widthInPx:"530px",formId:"create-custom-type",buttonLabel:"Create",close:()=>{i(!1),B(!0)},onSubmit:e=>{T(e)},isLoading:n,initialValues:{repeatable:!0,id:"",label:""},validate:e=>{let{id:t,label:n}=e,l={};return n&&n.length||(l.label="Cannot be empty."),!l.label&&g.includes(n)&&(l.label="".concat(b.name({start:!0,plural:!1})," name is already taken.")),["update","insert"].includes(n.toLowerCase())&&(l.label='Name "'.concat(n,'" is reserved for Slice Machine use.')),t&&t.length||(l.id="ID cannot be empty."),["update","insert"].includes(t.toLowerCase())&&(l.id='Id "'.concat(t,'" is reserved for Slice Machine use.')),l.id||!t||C.xo.exec(t)||(l.id="Invalid id: No special characters allowed."),!l.id&&t&&j.map(e=>e.toLowerCase()).includes(t)&&(l.id='ID "'.concat(t,'" exists already.')),Object.keys(l).length>0?l:void 0},content:{title:"Create a new ".concat(b.name({start:!1,plural:!1}))},children:e=>{let{errors:n,setValues:r,setFieldValue:a,values:s,touched:c}=e;return(0,l.jsxs)(m.xu,{children:[(0,l.jsx)(N,{format:t}),(0,l.jsx)(I.W,{name:"label",label:"".concat(b.name({start:!0,plural:!1})," Name"),testId:"ct-name-input",placeholder:"A display name for the ".concat(b.name({start:!1,plural:!1})),error:c.label?n.label:void 0,onChange:e=>G(e,s,r)}),(0,l.jsx)(I.W,{name:"id",testId:"ct-id-input",label:"".concat(b.name({start:!0,plural:!1})," ID"),placeholder:b.inputPlaceholder,error:c.id?n.id:void 0,onChange:e=>D(e,a)})]})}})};var E=n(72641);let T=e=>(0,l.jsxs)("svg",{viewBox:"0 0 20 24",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,l.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,l.jsx)("path",{d:"m17 5h3l-5-5v3c0 1.10457.8954 2 2 2z",fill:"#9e8cfc"}),(0,l.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"})]}),G=e=>(0,l.jsxs)("svg",{viewBox:"0 0 20 24",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,l.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,l.jsx)("path",{d:"m17 5h3l-5-5v3c0 1.10457.8954 2 2 2z",fill:"#9e8cfc",fillRule:"nonzero"}),(0,l.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"})]});var D=n(60867),P=n(50477),W=n(94840),A=n(16442);let $=e=>{let{format:t,isCreatingCustomType:n,openCreateCustomTypeModal:a}=e,s=(0,h.useRouter)(),{customTypes:i,updateCustomTypes:d}=(0,P.xU)(t),u=i.sort((e,t)=>e.id.localeCompare(t.id)),m=v.cd[t],p=o.$[t];return(!function(e,t,n){let{storeCustomTypes:l}=(0,x.v9)(e=>({storeCustomTypes:(0,w.Ch)(e).filter(A.TG)}));(0,c.useEffect)(()=>{let r=l.filter(e=>{let{local:n}=e;return n.format===t});(r.length!==e.length||r.some(t=>{let n=e.find(e=>e.id===t.local.id);return!n||JSON.stringify(W.Dc.fromSM(t.local))!==JSON.stringify(n)}))&&n(r.map(e=>{let{local:t}=e;return W.Dc.fromSM(t)}))},[t,n,e,l])}(i,t,d),0===u.length)?(0,l.jsxs)(E.R$,{"data-testid":"blank-slate",style:{alignSelf:"center",marginTop:r.t.space[72]},children:[(0,l.jsx)(E.u2,{children:(0,l.jsx)(r.a_,{src:m.blankSlateImage,sizing:"cover"})}),(0,l.jsxs)(E.T9,{children:[(0,l.jsx)(E._T,{children:p.name({start:!0,plural:!0})}),(0,l.jsx)(E.nf,{children:p.blankSlateDescription}),(0,l.jsx)(E.Qj,{children:(0,l.jsx)(r.E,{onClick:a,loading:n,children:"Create"})})]})]}):(0,l.jsx)("div",{children:(0,l.jsxs)(r.bE,{columnLayout:"28px 1fr 1fr 1fr 42px",children:[(0,l.jsx)(r.bH,{children:(0,l.jsxs)(r.bI,{children:[(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.aX,{name:"notes",size:"medium"})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",variant:"small",children:"Label"})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",variant:"small",children:"API ID"})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",variant:"small",children:"Limit"})}),(0,l.jsx)(r.bG,{})]})}),(0,l.jsx)(r.bF,{children:u.map(e=>{let{repeatable:n,label:a,id:c}=e;return(0,l.jsxs)(r.bI,{onClick:()=>{s.push(v.cd[t].getBuilderPagePathname(c))},children:[(0,l.jsx)(r.bG,{children:n?(0,l.jsx)(T,{width:r.t.space[20]}):(0,l.jsx)(G,{width:r.t.space[20]})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{variant:"bold",noWrap:!0,children:a})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",noWrap:!0,children:c})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(r.bL,{color:"grey11",noWrap:!0,children:n?"Reusable":"Single"})}),(0,l.jsx)(r.bG,{children:(0,l.jsx)(D._,{isChangesLocal:!1,format:t,customType:e})})]},c)})})]})})},O=e=>{let{format:t}=e,n=o.$[t],[a,h]=(0,c.useState)(!1),[x,m]=(0,c.useState)(!1);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(s(),{children:(0,l.jsxs)("title",{children:[n.name({start:!0,plural:!0})," - Slice Machine"]})}),(0,l.jsx)(d.h,{renderError:()=>(0,l.jsx)(u.LN,{children:(0,l.jsx)(u.RN,{children:(0,l.jsx)(r.D,{alignItems:"center",justifyContent:"center",children:(0,l.jsx)(r.ax,{title:"Request failed",description:"An error occurred while fetching your ".concat(n.name({start:!1,plural:!0}),".")})})})}),children:(0,l.jsx)(c.Suspense,{fallback:(0,l.jsxs)(u.LN,{children:[(0,l.jsxs)(u.wd,{children:[(0,l.jsx)(u.Cx,{children:(0,l.jsx)(i.g,{children:n.name({start:!0,plural:!0})})}),(0,l.jsx)(u.K2,{children:(0,l.jsx)(r.E,{disabled:!0,startIcon:"add",children:"Create"})})]}),(0,l.jsx)(u.RN,{children:(0,l.jsx)(r.bg,{})})]}),children:(0,l.jsxs)(u.LN,{children:[(0,l.jsxs)(u.wd,{children:[(0,l.jsx)(u.Cx,{children:(0,l.jsx)(i.g,{children:n.name({start:!0,plural:!0})})}),(0,l.jsx)(u.K2,{children:(0,l.jsx)(r.E,{"data-testid":"create-ct",loading:a,onClick:()=>{m(!0)},startIcon:"add",children:"Create"})})]}),(0,l.jsx)(u.RN,{children:(0,l.jsxs)(r.D,{flexDirection:"column",children:[(0,l.jsx)($,{format:t,isCreatingCustomType:a,openCreateCustomTypeModal:()=>{m(!0)}}),(0,l.jsx)(z,{format:t,isCreating:a,isOpen:x,onCreateChange:h,onOpenChange:m})]})})]})})})]})}},30527:function(e,t,n){"use strict";n.d(t,{Z:function(){return o},W:function(){return i}});var l=n(52322),r=n(2784),a=n(75289);let s=e=>{let{bg:t,background:n,sx:r,withRadius:s,radius:c,children:i}=e;return(0,l.jsx)(a.xu,{sx:{p:4,bg:t||n,...s?{borderBottomLeftRadius:c,borderBottomRightRadius:c}:null,...r},children:i})},c=(0,r.createContext)("6px"),i=()=>(0,r.useContext)(c),o=e=>{let{Header:t=null,SubHeader:n=null,Body:r=null,Footer:i=null,borderFooter:o=!1,radius:d="6px",bodySx:u={},footerSx:h={},sx:x=null,bg:m,background:p,children:j,...g}=e;return(0,l.jsx)(c.Provider,{value:d,children:(0,l.jsxs)(a.Zb,{sx:{border:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))},borderRadius:d,...x},...g,children:[t||null,n||null,(0,l.jsxs)(s,{bg:m,background:p,sx:u,withRadius:!i,children:[r?(0,l.jsx)(r,{}):null,j||null]}),i?(0,l.jsx)(s,{bg:m,background:p,sx:{...o?{borderTop:e=>{let{colors:t}=e;return"1px solid ".concat(String(null==t?void 0:t.borders))}}:null,...h},radius:d,withRadius:!0,children:"object"==typeof i?i:(0,l.jsx)(i,{})}):null]})})}},7974:function(e,t,n){"use strict";n.d(t,{Sn:function(){return c},lS:function(){return l},nG:function(){return r},pq:function(){return i},rd:function(){return s},xo:function(){return a}});let l=["components","update","insert"],r=["png","jpg","jpeg"],a=/^[A-Za-z0-9]+(?:_[A-Za-z0-9]+)*$/,s="placeholders/What_are_Slices_mrvome",c="SM_HELP_VIDEOS/mock_data",i="slice-machine-simulator"},83478:function(e){e.exports={column:"BlankSlate_column__genEe",root:"BlankSlate_root__CmSqW BlankSlate_column__genEe",fadeIn:"BlankSlate_fadeIn__mAfi5",withBackground:"BlankSlate_withBackground__mLYij",image:"BlankSlate_image__Jn90S BlankSlate_column__genEe",content:"BlankSlate_content__0Yt2d BlankSlate_column__genEe",desc:"BlankSlate_desc___Dl7e",actions:"BlankSlate_actions__OYRj4"}}}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[34],{62434:function(e,t,n){"use strict";n.d(t,{Zb:function(){return c},T$:function(){return m},eW:function(){return _},ZB:function(){return u},Lm:function(){return C}});var o=n(52322),r=n(50002),i=n(14226),a=n(6277),l=n(2784),d=n(67968),s=n.n(d);let c=e=>{let{checked:t=!1,size:n="medium",variant:i="solid",interactive:d,disabled:c,onClick:u,href:m,component:_="a",replace:C,...h}=e,x={...h,className:(0,a.W)(s().root,s()["size-".concat(n)],s()[i],{[s().interactive]:e.interactive}),"data-state":!0===t?"checked":void 0,"data-disabled":!0===e.disabled?"":void 0};return!0===e.interactive&&void 0===e.href?(0,o.jsx)("div",{...x,onClick:t=>{if(!0===e.disabled||void 0===e.onClick)return;let n=t.target;(0,r.JY)(n)===t.currentTarget&&e.onClick(t)},tabIndex:!0===e.disabled?void 0:0}):!0===e.interactive?(0,l.createElement)(_,{...x,href:e.href,onClick:e=>{let t=e.target;(0,r.JY)(t)!==e.currentTarget&&e.preventDefault()},..."a"===_?{}:{replace:e.replace}}):(0,o.jsx)("div",{...x})},u=e=>{let{className:t,component:n="img",overlay:r,...i}=e;return(0,o.jsxs)("div",{className:s().media,children:[(0,l.createElement)(n,{...i,className:(0,a.W)(s()["mediaComponent-".concat(n)],t)}),r?(0,o.jsx)("div",{className:s().mediaOverlay,children:r}):void 0]})},m=e=>(0,o.jsx)("div",{...e,className:s().actions}),_=e=>{let{action:t,loading:n=!1,startIcon:r,subtitle:a,title:l,error:d=!1,...c}=e,u=d?"tomato11":"grey11";return(0,o.jsxs)("div",{...c,className:s().footer,children:[(r||n)&&(0,o.jsxs)("div",{className:s().startIconBox,children:[n&&(0,o.jsx)(i.bg,{color:"grey11"}),!n&&r&&(0,o.jsx)(i.aX,{name:r,size:"small",color:u})]}),(0,o.jsxs)("div",{className:s().footerTexts,children:[(0,o.jsx)(i.bL,{component:"span",noWrap:!0,variant:"bold",children:l}),(0,o.jsx)(i.bL,{color:u,component:"span",noWrap:!0,variant:"small",children:a})]}),t]})},C=e=>{let{children:t,...n}=e;return(0,o.jsx)("div",{...n,className:s().status,children:(0,o.jsx)(i.bL,{align:"center",color:"inherit",component:"span",noWrap:!0,variant:"smallBold",children:t})})}},99195:function(e,t,n){"use strict";n.d(t,{O:function(){return l}});var o=n(52322),r=n(14226),i=n(56448),a=n(93671);let l=e=>{let{badgeColor:t,badgeTitle:n,tooltipContent:l}=function(e){let t=d[e.modelType];switch(e.modelStatus){case i.GJ.New:return{badgeColor:"green",badgeTitle:"New",tooltipContent:"This ".concat(t," exists only locally. Upon sync, it will be pushed to your remote repository.")};case i.GJ.Modified:return{badgeColor:"amber",badgeTitle:"Modified",tooltipContent:"This ".concat(t," has been modified locally. Upon sync, changes will be pushed to your remote repository.")};case i.GJ.Synced:return{badgeColor:"purple",badgeTitle:"Synced",tooltipContent:"This ".concat(t," is in sync with the remote repository.")};case i.GJ.Deleted:return{badgeColor:"tomato",badgeTitle:"Deleted",tooltipContent:"This ".concat(t," has been deleted locally.")};case i.GJ.Unknown:if(!e.isOnline)return{badgeColor:"grey",badgeTitle:"Unknown",tooltipContent:"Data from the remote repository could not be fetched (no internet connection)."};if(e.authStatus===a.t.UNAUTHENTICATED)return{badgeColor:"grey",badgeTitle:"Unknown",tooltipContent:"Data from the remote repository could not be fetched (not connected to Prismic)."};default:return{badgeColor:"grey",badgeTitle:"Unknown",tooltipContent:"Data from the remote repository could not be fetched (unknown error)."}}}(e);return(0,o.jsx)(r.c3,{content:l,side:"bottom",children:(0,o.jsx)(r.m,{color:t,title:n})})},d={CustomType:"type",Slice:"slice"}},51507:function(e,t,n){"use strict";n.d(t,{b:function(){return h}});var o=n(52322),r=n(14226),i=n(39097),a=n.n(i),l=n(62434),d=n(63908),s=n(99195),c=n(27763);let u=e=>(0,o.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,o.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 5.5C4 4.67157 4.67157 4 5.5 4H18.5C19.3284 4 20 4.67157 20 5.5V12.4413C20 12.4512 19.9997 12.461 19.9991 12.4707C20.0072 12.6083 19.9586 12.7485 19.8536 12.8536C19.6583 13.0488 19.3417 13.0488 19.1464 12.8536L16.3536 10.0607C16.1583 9.8654 15.8417 9.8654 15.6464 10.0607L11.8536 13.8536C11.6583 14.0488 11.3417 14.0488 11.1464 13.8536L9.35355 12.0607C9.15829 11.8654 8.84171 11.8654 8.64645 12.0607L5 15.7071V18.5C5 18.7761 5.22386 19 5.5 19H12.5C12.7761 19 13 19.2239 13 19.5C13 19.7761 12.7761 20 12.5 20H5.5C4.67157 20 4 19.3284 4 18.5V15.5003V15.4997V5.5ZM11.5 12.7929L14.9393 9.35355C15.5251 8.76777 16.4749 8.76777 17.0607 9.35355L19 11.2929V5.5C19 5.22386 18.7761 5 18.5 5H5.5C5.22386 5 5 5.22386 5 5.5V14.2929L7.93934 11.3536C8.52513 10.7678 9.47487 10.7678 10.0607 11.3536L11.5 12.7929ZM16.5 13C16.7761 13 17 13.2239 17 13.5V16H19.5C19.7761 16 20 16.2239 20 16.5C20 16.7761 19.7761 17 19.5 17H17V19.5C17 19.7761 16.7761 20 16.5 20C16.2239 20 16 19.7761 16 19.5V17H13.5C13.2239 17 13 16.7761 13 16.5C13 16.2239 13.2239 16 13.5 16H16V13.5C16 13.2239 16.2239 13 16.5 13Z",fill:"currentColor"})}),m=e=>({hash:e.hash}),_=e=>e?Object.entries(e).reduce((e,t)=>{let[n,o]=t;return o.hash?{...e,[n]:{...o,...m(o)}}:e},{}):{},C={build:e=>({...e,screenshots:_(e.screenshots)}),variation(e,t){if(e.model.variations.length)return t?e.model.variations.find(e=>e.id===t):e.model.variations[0]}},h=e=>{let t;let{action:n,isDeleted:i=!1,onUpdateScreenshot:m,selected:_=!1,slice:h,variant:p,variationId:b}=e,f=C.variation(h,b);if(!f)return null;let g=(0,d.d7)(h,f),j=!i&&!!m,y="outlined"===p,k=void 0!==b;return t="selection"===e.mode?{disabled:i,interactive:!0,onClick:()=>{e.onSelectedChange(!_)}}:i?{interactive:!1}:{component:a(),href:c.Y.getBuilderPagePathname({libraryName:h.href,sliceName:h.model.name,variationId:f.id}),interactive:!0,replace:e.replace},(0,o.jsxs)(l.Zb,{"aria-label":"".concat(h.model.name," ").concat(f.name," slice card"),checked:_,"data-testid":"shared-slice-card",...t,..."outlined"===p?{size:"small",variant:"outlined"}:{},children:[void 0!==g?(0,o.jsx)(l.ZB,{alt:"Preview image",overlay:j&&!y?(0,o.jsx)(r.D,{alignItems:"center",justifyContent:"center",children:(0,o.jsx)(x,{onClick:m})}):void 0,src:g}):(0,o.jsx)(l.ZB,{component:"div",children:(0,o.jsxs)(r.D,{alignItems:"center",flexDirection:"column",gap:8,justifyContent:"center",children:[(0,o.jsx)(r.bL,{color:"grey11",component:"span",children:"No screenshot available"}),j&&!y?(0,o.jsx)(x,{onClick:m}):void 0]})}),(0,o.jsx)(l.eW,{action:"checkbox"===n.type&&"selection"===e.mode?(0,o.jsx)("div",{onClick:e=>e.stopPropagation(),children:(0,o.jsx)(r.U,{checked:_,disabled:i,onCheckedChange:e.onSelectedChange})}):"menu"===n.type?(0,o.jsxs)(r.ar,{modal:!0,children:[(0,o.jsx)(r.av,{disabled:i,children:(0,o.jsx)(r.aZ,{hiddenLabel:"Slice actions",icon:"moreVert"})}),(0,o.jsxs)(r.as,{align:"end","data-testid":"slice-action-icon-dropdown",children:[j&&y?(0,o.jsx)(r.at,{onSelect:m,startIcon:(0,o.jsx)(u,{}),children:"Update screenshot"}):void 0,(0,o.jsx)(r.at,{onSelect:n.onRename,startIcon:(0,o.jsx)(r.aX,{name:"edit"}),children:"Rename"}),!0===n.removeDisabled&&k?(0,o.jsx)(r.c3,{content:"The slice needs to have at least one variation.",side:"bottom",stableMount:!0,children:(0,o.jsx)(v,{disabled:!0,onSelect:n.onRemove})}):(0,o.jsx)(v,{disabled:!0===n.removeDisabled,onSelect:n.onRemove})]})]}):"remove"===n.type?(0,o.jsx)(r.aZ,{icon:"close",onClick:()=>!i&&n.onRemove(),hiddenLabel:"Remove slice"}):"status"===n.type?(0,o.jsx)(s.O,{authStatus:n.authStatus,isOnline:n.isOnline,modelStatus:n.modelStatus,modelType:"Slice"}):void 0,subtitle:(0,o.jsx)(o.Fragment,{children:k?f.id:"".concat(h.model.variations.length," variation").concat(h.model.variations.length>1?"s":"")}),title:k?f.name:h.model.name}),j&&!k&&(0,d.cx)(h)>0?(0,o.jsx)(l.Lm,{children:"Missing screenshot"}):void 0]})},x=e=>(0,o.jsx)(r.E,{onClick:e.onClick,renderStartIcon:()=>(0,o.jsx)(u,{color:r.t.color.grey11}),color:"grey",children:"Update screenshot"}),v=e=>(0,o.jsx)(r.at,{...e,color:"tomato",startIcon:(0,o.jsx)(r.aX,{name:"delete"}),children:"Delete"})},27763:function(e,t,n){"use strict";n.d(t,{Y:function(){return o}});let o={getBuilderPagePathname:e=>"/slices/".concat(e.libraryName.replaceAll("/","--"),"/").concat(e.sliceName,"/").concat(e.variationId)}},30527:function(e,t,n){"use strict";n.d(t,{Z:function(){return s},W:function(){return d}});var o=n(52322),r=n(2784),i=n(75289);let a=e=>{let{bg:t,background:n,sx:r,withRadius:a,radius:l,children:d}=e;return(0,o.jsx)(i.xu,{sx:{p:4,bg:t||n,...a?{borderBottomLeftRadius:l,borderBottomRightRadius:l}:null,...r},children:d})},l=(0,r.createContext)("6px"),d=()=>(0,r.useContext)(l),s=e=>{let{Header:t=null,SubHeader:n=null,Body:r=null,Footer:d=null,borderFooter:s=!1,radius:c="6px",bodySx:u={},footerSx:m={},sx:_=null,bg:C,background:h,children:x,...v}=e;return(0,o.jsx)(l.Provider,{value:c,children:(0,o.jsxs)(i.Zb,{sx:{border:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))},borderRadius:c,..._},...v,children:[t||null,n||null,(0,o.jsxs)(a,{bg:C,background:h,sx:u,withRadius:!d,children:[r?(0,o.jsx)(r,{}):null,x||null]}),d?(0,o.jsx)(a,{bg:C,background:h,sx:{...s?{borderTop:e=>{let{colors:t}=e;return"1px solid ".concat(String(null==t?void 0:t.borders))}}:null,...m},radius:c,withRadius:!0,children:"object"==typeof d?d:(0,o.jsx)(d,{})}):null]})})}},7974:function(e,t,n){"use strict";n.d(t,{Sn:function(){return l},lS:function(){return o},nG:function(){return r},pq:function(){return d},rd:function(){return a},xo:function(){return i}});let o=["components","update","insert"],r=["png","jpg","jpeg"],i=/^[A-Za-z0-9]+(?:_[A-Za-z0-9]+)*$/,a="placeholders/What_are_Slices_mrvome",l="SM_HELP_VIDEOS/mock_data",d="slice-machine-simulator"},67968:function(e){e.exports={flex:"Card_flex__opby1",grid:"Card_grid__VAvIS",column:"Card_column__W4ACG Card_flex__opby1",root:"Card_root__YVuvU Card_column__W4ACG Card_flex__opby1","size-small":"Card_size-small__aIlxd","size-medium":"Card_size-medium__xegz0",solid:"Card_solid__GNGar",outlined:"Card_outlined__W_dxI",interactive:"Card_interactive__rXw5L",media:"Card_media__l0kHL Card_column__W4ACG Card_flex__opby1","mediaComponent-div":"Card_mediaComponent-div__Y2_PZ Card_grid__VAvIS","mediaComponent-img":"Card_mediaComponent-img__ezOTu",mediaOverlay:"Card_mediaOverlay__Aa__Q Card_grid__VAvIS",nonMedia:"Card_nonMedia__Fv3Mz Card_flex__opby1",actions:"Card_actions__XdhOt Card_nonMedia__Fv3Mz Card_flex__opby1",footer:"Card_footer__U0HS1 Card_nonMedia__Fv3Mz Card_flex__opby1",footerTexts:"Card_footerTexts__rTXup Card_column__W4ACG Card_flex__opby1",status:"Card_status__PNN2a Card_column__W4ACG Card_flex__opby1",startIconBox:"Card_startIconBox__1_L4u"}}}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[34],{62434:function(e,t,n){"use strict";n.d(t,{Zb:function(){return c},T$:function(){return m},eW:function(){return _},ZB:function(){return u},Lm:function(){return C}});var o=n(52322),r=n(50002),i=n(11699),a=n(6277),l=n(2784),d=n(67968),s=n.n(d);let c=e=>{let{checked:t=!1,size:n="medium",variant:i="solid",interactive:d,disabled:c,onClick:u,href:m,component:_="a",replace:C,...h}=e,x={...h,className:(0,a.W)(s().root,s()["size-".concat(n)],s()[i],{[s().interactive]:e.interactive}),"data-state":!0===t?"checked":void 0,"data-disabled":!0===e.disabled?"":void 0};return!0===e.interactive&&void 0===e.href?(0,o.jsx)("div",{...x,onClick:t=>{if(!0===e.disabled||void 0===e.onClick)return;let n=t.target;(0,r.JY)(n)===t.currentTarget&&e.onClick(t)},tabIndex:!0===e.disabled?void 0:0}):!0===e.interactive?(0,l.createElement)(_,{...x,href:e.href,onClick:e=>{let t=e.target;(0,r.JY)(t)!==e.currentTarget&&e.preventDefault()},..."a"===_?{}:{replace:e.replace}}):(0,o.jsx)("div",{...x})},u=e=>{let{className:t,component:n="img",overlay:r,...i}=e;return(0,o.jsxs)("div",{className:s().media,children:[(0,l.createElement)(n,{...i,className:(0,a.W)(s()["mediaComponent-".concat(n)],t)}),r?(0,o.jsx)("div",{className:s().mediaOverlay,children:r}):void 0]})},m=e=>(0,o.jsx)("div",{...e,className:s().actions}),_=e=>{let{action:t,loading:n=!1,startIcon:r,subtitle:a,title:l,error:d=!1,...c}=e,u=d?"tomato11":"grey11";return(0,o.jsxs)("div",{...c,className:s().footer,children:[(r||n)&&(0,o.jsxs)("div",{className:s().startIconBox,children:[n&&(0,o.jsx)(i.bg,{color:"grey11"}),!n&&r&&(0,o.jsx)(i.aX,{name:r,size:"small",color:u})]}),(0,o.jsxs)("div",{className:s().footerTexts,children:[(0,o.jsx)(i.bL,{component:"span",noWrap:!0,variant:"bold",children:l}),(0,o.jsx)(i.bL,{color:u,component:"span",noWrap:!0,variant:"small",children:a})]}),t]})},C=e=>{let{children:t,...n}=e;return(0,o.jsx)("div",{...n,className:s().status,children:(0,o.jsx)(i.bL,{align:"center",color:"inherit",component:"span",noWrap:!0,variant:"smallBold",children:t})})}},99195:function(e,t,n){"use strict";n.d(t,{O:function(){return l}});var o=n(52322),r=n(11699),i=n(56448),a=n(93671);let l=e=>{let{badgeColor:t,badgeTitle:n,tooltipContent:l}=function(e){let t=d[e.modelType];switch(e.modelStatus){case i.GJ.New:return{badgeColor:"green",badgeTitle:"New",tooltipContent:"This ".concat(t," exists only locally. Upon sync, it will be pushed to your remote repository.")};case i.GJ.Modified:return{badgeColor:"amber",badgeTitle:"Modified",tooltipContent:"This ".concat(t," has been modified locally. Upon sync, changes will be pushed to your remote repository.")};case i.GJ.Synced:return{badgeColor:"purple",badgeTitle:"Synced",tooltipContent:"This ".concat(t," is in sync with the remote repository.")};case i.GJ.Deleted:return{badgeColor:"tomato",badgeTitle:"Deleted",tooltipContent:"This ".concat(t," has been deleted locally.")};case i.GJ.Unknown:if(!e.isOnline)return{badgeColor:"grey",badgeTitle:"Unknown",tooltipContent:"Data from the remote repository could not be fetched (no internet connection)."};if(e.authStatus===a.t.UNAUTHENTICATED)return{badgeColor:"grey",badgeTitle:"Unknown",tooltipContent:"Data from the remote repository could not be fetched (not connected to Prismic)."};default:return{badgeColor:"grey",badgeTitle:"Unknown",tooltipContent:"Data from the remote repository could not be fetched (unknown error)."}}}(e);return(0,o.jsx)(r.c3,{content:l,side:"bottom",children:(0,o.jsx)(r.m,{color:t,title:n})})},d={CustomType:"type",Slice:"slice"}},51507:function(e,t,n){"use strict";n.d(t,{b:function(){return h}});var o=n(52322),r=n(11699),i=n(39097),a=n.n(i),l=n(62434),d=n(63908),s=n(99195),c=n(27763);let u=e=>(0,o.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,o.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 5.5C4 4.67157 4.67157 4 5.5 4H18.5C19.3284 4 20 4.67157 20 5.5V12.4413C20 12.4512 19.9997 12.461 19.9991 12.4707C20.0072 12.6083 19.9586 12.7485 19.8536 12.8536C19.6583 13.0488 19.3417 13.0488 19.1464 12.8536L16.3536 10.0607C16.1583 9.8654 15.8417 9.8654 15.6464 10.0607L11.8536 13.8536C11.6583 14.0488 11.3417 14.0488 11.1464 13.8536L9.35355 12.0607C9.15829 11.8654 8.84171 11.8654 8.64645 12.0607L5 15.7071V18.5C5 18.7761 5.22386 19 5.5 19H12.5C12.7761 19 13 19.2239 13 19.5C13 19.7761 12.7761 20 12.5 20H5.5C4.67157 20 4 19.3284 4 18.5V15.5003V15.4997V5.5ZM11.5 12.7929L14.9393 9.35355C15.5251 8.76777 16.4749 8.76777 17.0607 9.35355L19 11.2929V5.5C19 5.22386 18.7761 5 18.5 5H5.5C5.22386 5 5 5.22386 5 5.5V14.2929L7.93934 11.3536C8.52513 10.7678 9.47487 10.7678 10.0607 11.3536L11.5 12.7929ZM16.5 13C16.7761 13 17 13.2239 17 13.5V16H19.5C19.7761 16 20 16.2239 20 16.5C20 16.7761 19.7761 17 19.5 17H17V19.5C17 19.7761 16.7761 20 16.5 20C16.2239 20 16 19.7761 16 19.5V17H13.5C13.2239 17 13 16.7761 13 16.5C13 16.2239 13.2239 16 13.5 16H16V13.5C16 13.2239 16.2239 13 16.5 13Z",fill:"currentColor"})}),m=e=>({hash:e.hash}),_=e=>e?Object.entries(e).reduce((e,t)=>{let[n,o]=t;return o.hash?{...e,[n]:{...o,...m(o)}}:e},{}):{},C={build:e=>({...e,screenshots:_(e.screenshots)}),variation(e,t){if(e.model.variations.length)return t?e.model.variations.find(e=>e.id===t):e.model.variations[0]}},h=e=>{let t;let{action:n,isDeleted:i=!1,onUpdateScreenshot:m,selected:_=!1,slice:h,variant:p,variationId:b}=e,f=C.variation(h,b);if(!f)return null;let g=(0,d.d7)(h,f),j=!i&&!!m,y="outlined"===p,k=void 0!==b;return t="selection"===e.mode?{disabled:i,interactive:!0,onClick:()=>{e.onSelectedChange(!_)}}:i?{interactive:!1}:{component:a(),href:c.Y.getBuilderPagePathname({libraryName:h.href,sliceName:h.model.name,variationId:f.id}),interactive:!0,replace:e.replace},(0,o.jsxs)(l.Zb,{"aria-label":"".concat(h.model.name," ").concat(f.name," slice card"),checked:_,"data-testid":"shared-slice-card",...t,..."outlined"===p?{size:"small",variant:"outlined"}:{},children:[void 0!==g?(0,o.jsx)(l.ZB,{alt:"Preview image",overlay:j&&!y?(0,o.jsx)(r.D,{alignItems:"center",justifyContent:"center",children:(0,o.jsx)(x,{onClick:m})}):void 0,src:g}):(0,o.jsx)(l.ZB,{component:"div",children:(0,o.jsxs)(r.D,{alignItems:"center",flexDirection:"column",gap:8,justifyContent:"center",children:[(0,o.jsx)(r.bL,{color:"grey11",component:"span",children:"No screenshot available"}),j&&!y?(0,o.jsx)(x,{onClick:m}):void 0]})}),(0,o.jsx)(l.eW,{action:"checkbox"===n.type&&"selection"===e.mode?(0,o.jsx)("div",{onClick:e=>e.stopPropagation(),children:(0,o.jsx)(r.U,{checked:_,disabled:i,onCheckedChange:e.onSelectedChange})}):"menu"===n.type?(0,o.jsxs)(r.ar,{modal:!0,children:[(0,o.jsx)(r.av,{disabled:i,children:(0,o.jsx)(r.aZ,{hiddenLabel:"Slice actions",icon:"moreVert"})}),(0,o.jsxs)(r.as,{align:"end","data-testid":"slice-action-icon-dropdown",children:[j&&y?(0,o.jsx)(r.at,{onSelect:m,startIcon:(0,o.jsx)(u,{}),children:"Update screenshot"}):void 0,(0,o.jsx)(r.at,{onSelect:n.onRename,startIcon:(0,o.jsx)(r.aX,{name:"edit"}),children:"Rename"}),!0===n.removeDisabled&&k?(0,o.jsx)(r.c3,{content:"The slice needs to have at least one variation.",side:"bottom",stableMount:!0,children:(0,o.jsx)(v,{disabled:!0,onSelect:n.onRemove})}):(0,o.jsx)(v,{disabled:!0===n.removeDisabled,onSelect:n.onRemove})]})]}):"remove"===n.type?(0,o.jsx)(r.aZ,{icon:"close",onClick:()=>!i&&n.onRemove(),hiddenLabel:"Remove slice"}):"status"===n.type?(0,o.jsx)(s.O,{authStatus:n.authStatus,isOnline:n.isOnline,modelStatus:n.modelStatus,modelType:"Slice"}):void 0,subtitle:(0,o.jsx)(o.Fragment,{children:k?f.id:"".concat(h.model.variations.length," variation").concat(h.model.variations.length>1?"s":"")}),title:k?f.name:h.model.name}),j&&!k&&(0,d.cx)(h)>0?(0,o.jsx)(l.Lm,{children:"Missing screenshot"}):void 0]})},x=e=>(0,o.jsx)(r.E,{onClick:e.onClick,renderStartIcon:()=>(0,o.jsx)(u,{color:r.t.color.grey11}),color:"grey",children:"Update screenshot"}),v=e=>(0,o.jsx)(r.at,{...e,color:"tomato",startIcon:(0,o.jsx)(r.aX,{name:"delete"}),children:"Delete"})},27763:function(e,t,n){"use strict";n.d(t,{Y:function(){return o}});let o={getBuilderPagePathname:e=>"/slices/".concat(e.libraryName.replaceAll("/","--"),"/").concat(e.sliceName,"/").concat(e.variationId)}},30527:function(e,t,n){"use strict";n.d(t,{Z:function(){return s},W:function(){return d}});var o=n(52322),r=n(2784),i=n(75289);let a=e=>{let{bg:t,background:n,sx:r,withRadius:a,radius:l,children:d}=e;return(0,o.jsx)(i.xu,{sx:{p:4,bg:t||n,...a?{borderBottomLeftRadius:l,borderBottomRightRadius:l}:null,...r},children:d})},l=(0,r.createContext)("6px"),d=()=>(0,r.useContext)(l),s=e=>{let{Header:t=null,SubHeader:n=null,Body:r=null,Footer:d=null,borderFooter:s=!1,radius:c="6px",bodySx:u={},footerSx:m={},sx:_=null,bg:C,background:h,children:x,...v}=e;return(0,o.jsx)(l.Provider,{value:c,children:(0,o.jsxs)(i.Zb,{sx:{border:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))},borderRadius:c,..._},...v,children:[t||null,n||null,(0,o.jsxs)(a,{bg:C,background:h,sx:u,withRadius:!d,children:[r?(0,o.jsx)(r,{}):null,x||null]}),d?(0,o.jsx)(a,{bg:C,background:h,sx:{...s?{borderTop:e=>{let{colors:t}=e;return"1px solid ".concat(String(null==t?void 0:t.borders))}}:null,...m},radius:c,withRadius:!0,children:"object"==typeof d?d:(0,o.jsx)(d,{})}):null]})})}},7974:function(e,t,n){"use strict";n.d(t,{Sn:function(){return l},lS:function(){return o},nG:function(){return r},pq:function(){return d},rd:function(){return a},xo:function(){return i}});let o=["components","update","insert"],r=["png","jpg","jpeg"],i=/^[A-Za-z0-9]+(?:_[A-Za-z0-9]+)*$/,a="placeholders/What_are_Slices_mrvome",l="SM_HELP_VIDEOS/mock_data",d="slice-machine-simulator"},67968:function(e){e.exports={flex:"Card_flex__opby1",grid:"Card_grid__VAvIS",column:"Card_column__W4ACG Card_flex__opby1",root:"Card_root__YVuvU Card_column__W4ACG Card_flex__opby1","size-small":"Card_size-small__aIlxd","size-medium":"Card_size-medium__xegz0",solid:"Card_solid__GNGar",outlined:"Card_outlined__W_dxI",interactive:"Card_interactive__rXw5L",media:"Card_media__l0kHL Card_column__W4ACG Card_flex__opby1","mediaComponent-div":"Card_mediaComponent-div__Y2_PZ Card_grid__VAvIS","mediaComponent-img":"Card_mediaComponent-img__ezOTu",mediaOverlay:"Card_mediaOverlay__Aa__Q Card_grid__VAvIS",nonMedia:"Card_nonMedia__Fv3Mz Card_flex__opby1",actions:"Card_actions__XdhOt Card_nonMedia__Fv3Mz Card_flex__opby1",footer:"Card_footer__U0HS1 Card_nonMedia__Fv3Mz Card_flex__opby1",footerTexts:"Card_footerTexts__rTXup Card_column__W4ACG Card_flex__opby1",status:"Card_status__PNN2a Card_column__W4ACG Card_flex__opby1",startIconBox:"Card_startIconBox__1_L4u"}}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[489],{19489:function(e,t,l){"use strict";l.d(t,{H:function(){return e4}});var n=l(52322),i=l(11699),a=l(97729),o=l.n(a),r=l(5632),s=l(2784),c=l(56580),d=l(43388),m=l(77630),u=l(23094),h=l(59294),p=l(58446),x=l(74217),v=l(94160),b=l(68968),y=l(23710),g=l(54597),f=l(98564);let j=(0,s.createContext)(void 0);function S(e){let{children:t,initialCustomType:l}=e,[i,a]=(0,s.useState)(l),o=(0,m.y6)(i),r=f.$[o],{actionQueueStatus:c,setNextAction:d}=(0,y.c)({errorMessage:r.autoSaveFailed}),{refreshState:u}=(0,g.Z)(),h=(0,x.R9)(u),{syncChanges:p}=(0,b.g)(),S=(0,s.useCallback)(e=>{let{customType:t,onSaveCallback:l,updateMeta:n}=e;a(t),d(async()=>{let{errors:e}=await (0,v.KA)({customType:t,updateMeta:n});if(e.length>0)throw e;h(await (0,v.y0)()),p(),null==l||l()})},[d,h,p]),I=(0,s.useMemo)(()=>({actionQueueStatus:c,customType:i,setCustomType:S}),[c,i,S]);return(0,n.jsx)(j.Provider,{value:I,children:"function"==typeof t?t(I):t})}function I(){let e=(0,s.useContext)(j);if(!e)throw Error("CustomTypeProvider not found");return e}var C=l(30195);function T(){var e;let[t,l]=(0,s.useState)(!1),{customType:a,setCustomType:o}=I(),[r,c]=null!==(e=(0,m.j5)(a))&&void 0!==e?e:[],d=c?(0,m.N3)(c):"",[u,h]=(0,s.useState)(null!=d?d:""),[p,v]=(0,s.useState)();(0,x.pQ)(t,()=>{t||(h(null!=d?d:""),v(void 0))});let b=(0,s.useCallback)(()=>(0,n.jsx)(i.aX,{name:c?"language":"add",size:"small",color:"grey11"}),[c]);return(0,n.jsxs)(i.ae,{open:t,onOpenChange:l,size:"small",trigger:(0,n.jsx)(i.E,{color:"grey",textColor:"placeholder",textWeight:"normal",renderStartIcon:b,sx:{marginInline:"auto"},children:c?d:"Add an UID"}),children:[(0,n.jsx)(i.al,{title:"Edit the UID label"}),(0,n.jsx)(i.aj,{children:(0,n.jsxs)(i.aJ,{onSubmit:function(){p||(o({customType:c?(0,m.eK)(u,a):(0,m.H8)(u,a)}),l(!1))},children:[(0,n.jsx)(i.D,{flexDirection:"column",padding:16,gap:4,children:(0,n.jsx)(i.aM,{type:"text",label:"Label *",placeholder:"UID",value:u,onValueChange:function(e){h(e),v(function(e){let t=D.safeParse(e,{errorMap:w});if(t.error)return t.error.errors[0].message}(e))},error:p,description:"A label for the UID"})}),(0,n.jsxs)(i.ah,{children:[(0,n.jsx)(i.ai,{size:"medium"}),(0,n.jsx)(i.af,{type:"submit",size:"medium",disabled:!!p,children:"Save"})]})]})})]})}let D=C.z.string().max(35).min(1),w=e=>{switch(e.code){case C.z.ZodIssueCode.too_big:return{message:"The label can't be longer than ".concat(e.maximum," characters")};case C.z.ZodIssueCode.too_small:return{message:"This field is required"};default:return{message:"Invalid value"}}};var k=l(94840),_=l(59532),L=l(63397),A=l(75289);let E=e=>{let{name:t,label:l,placeholder:i,error:a,...o}=e;return(0,n.jsxs)(A.xu,{mb:3,children:[(0,n.jsx)(A.__,{htmlFor:t,mb:2,children:l}),(0,n.jsx)(L.gN,{name:t,type:"text",placeholder:i,as:A.II,autoComplete:"off",...o}),a?(0,n.jsx)(A.xv,{sx:{color:"error",mt:1},children:a}):null]})};var N=e=>{let{isOpen:t,onSubmit:l,close:i,tabIds:a}=e;return(0,n.jsx)(_.Z,{isOpen:t,widthInPx:"530px",formId:"create-tab",close:i,onSubmit:e=>{l(e),i()},initialValues:{id:""},validate:e=>{let{id:t}=e;return t?a.includes(t.toLowerCase())?{id:"Tab exists already"}:void 0:{id:"Tab ID is required"}},content:{title:"Add Tab"},children:e=>{let{errors:t}=e;return(0,n.jsx)(E,{name:"id",label:"New Tab ID",placeholder:"A label for selecting the tab (i.e. not used in the API)",error:t.id})}})},M=e=>{let{isOpen:t,onSubmit:l,close:i}=e;return(0,n.jsx)(_.Z,{omitFooter:!0,isOpen:t,widthInPx:"530px",formId:"create-tab",close:i,cardProps:{bodySx:{p:0}},onSubmit:e=>{l(e),i()},initialValues:{},content:{title:"Remove Tab"},children:()=>(0,n.jsxs)(A.xu,{sx:{px:4,py:4},children:[(0,n.jsx)(A.X6,{as:"h4",children:"Remove this tab?"}),(0,n.jsx)(A.xv,{as:"p",color:"textClear",sx:{mt:2},children:"This action cannot be undone."}),(0,n.jsx)(A.zx,{type:"button",variant:"buttons.actionDelete",sx:{mt:3},onClick:()=>{l({}),i()},children:"Yes, remove tab"})]})})},z=e=>{let{isOpen:t,onSubmit:l,close:i,tabIds:a,initialTabKey:o}=e;return(0,n.jsx)(_.Z,{omitFooter:!0,isOpen:t,widthInPx:"530px",formId:"create-tab",close:i,cardProps:{bodySx:{p:0}},onSubmit:e=>{l(e),i()},initialValues:{id:o},validate:e=>{let{id:t}=e;return t?a.includes(t.toLowerCase())?{id:"Tab exists already"}:void 0:{id:"Tab ID is required"}},content:{title:"Rename Tab"},children:e=>{let{errors:t,values:a,setFieldValue:o,isValid:r}=e;return(0,n.jsxs)(A.xu,{sx:{px:4,py:4},children:[(0,n.jsx)(E,{name:"id",label:"Rename Tab ID",placeholder:"A label for selecting the tab (i.e. not used in the API)",error:t.id,onBlur:e=>{a.id!==e.target.value&&o("id",e.target.value.trim())},onChange:e=>{o("id",e.target.value)}}),(0,n.jsx)(A.zx,{type:"button",sx:{mt:3,width:"100%"},disabled:!r,onClick:()=>{a.id&&a.id.length&&l({id:a.id.trim()}),i()},children:"Save"})]})}})},Z=l(28316),O=l(88932),P=l(35289),F=l(87446),K=l(45440),B=l(16086),R=l(358),U=l(5495),V=l(39302),X=l(3285),G=l(40141),Y=l(65077),q=l(91589),H=l(27213);let Q=e=>{let{openCreateSliceModal:t,openCreateSliceFromImageModal:l,openUpdateSliceZoneModal:a,openSlicesTemplatesModal:o,projectHasAvailableSlices:r,isSlicesTemplatesSupported:s}=e,c=(0,H.F)({menuType:"ActionList"});return(0,n.jsxs)(i.s,{"data-testid":"slice-zone-blank-slate",sx:{width:648},children:[(0,n.jsx)(i.x,{lineColor:"purple9",backgroundColor:"purple5",name:"add",size:"large"}),(0,n.jsx)(i.z,{size:"big",children:"Add slices"}),(0,n.jsx)(i.w,{children:"Slices are reusable website sections. You can use them on different pages and write unique content for each. Each slice has its own component in your code."}),(0,n.jsx)(i.v,{children:(0,n.jsxs)(i.A,{children:[(0,n.jsx)(i.b,{renderStartIcon:()=>c.fromImage.BackgroundIcon,onClick:l,description:c.fromImage.description,children:c.fromImage.title}),(0,n.jsx)(i.b,{renderStartIcon:()=>c.fromScratch.BackgroundIcon,onClick:t,description:c.fromScratch.description,children:c.fromScratch.title}),s&&(0,n.jsx)(i.b,{renderStartIcon:()=>c.fromTemplate.BackgroundIcon,onClick:o,description:c.fromTemplate.description,children:c.fromTemplate.title}),r&&(0,n.jsx)(i.b,{renderStartIcon:()=>c.fromExisting.BackgroundIcon,onClick:a,description:c.fromExisting.description,children:c.fromExisting.title})]})})]})};var W=l(98250);function $(e){let{customType:t,tabId:l,slices:n}=e,i={...t};return n.forEach(e=>{i={...i,tabs:i.tabs.map(t=>t.key===l&&t.sliceZone?{...t,sliceZone:{key:t.sliceZone.key,value:[{key:e.id,value:e},...t.sliceZone.value]}}:t)}}),v.Xe.track({event:"custom-type:slice-zone-updated",customTypeId:t.id}),i}var J=l(18566),ee=l(80148);async function et(){try{let{templates:e,errors:t}=await ee.managerClient.sliceTemplateLibrary.readLibrary({});if(t.length>0)throw t;return e.map(e=>({model:e.model,screenshots:Object.fromEntries(Object.entries(e.screenshots).map(e=>{let[t,l]=e;return[t,URL.createObjectURL(l)]}))}))}catch(e){return[]}}var el=l(6256),en=l(39204),ei=l(7723),ea=l(33986),eo=l(30527),er=l(55862);let es=e=>{let{deleteSliceZone:t,closeDeleteSliceZoneModal:l}=e;return(0,n.jsx)(er.Z,{isOpen:!0,shouldCloseOnOverlayClick:!0,style:{content:{maxWidth:612}},onRequestClose:l,children:(0,n.jsx)(eo.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:(0,n.jsxs)(A.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",alignItems:"center",justifyContent:"space-between",borderBottom:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))}},children:[(0,n.jsx)(A.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:"Do you really want to delete Slice Zone?"}),(0,n.jsx)(A.x8,{type:"button",onClick:l})]}),Footer:()=>(0,n.jsxs)(A.kC,{sx:{justifyContent:"flex-end",height:64,alignItems:"center",paddingRight:16,borderTop:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.darkBorders))},backgroundColor:"gray"},children:[(0,n.jsx)(ea.z,{label:"Cancel",variant:"secondary",onClick:l,sx:{mr:"10px",fontWeight:"bold",color:"grey12",borderRadius:6}}),(0,n.jsx)(ea.z,{label:"Delete",variant:"danger",onClick:t,sx:{minHeight:39,minWidth:78}})]}),children:(0,n.jsx)(A.nv,{children:"You're about to delete Slice Zone."})})})};var ec=l(84879),ed=l(62434),em=l(63908),eu=l(63019),eh=l(65375),ep=l.n(eh);let ex=e=>{var t;let{isOpen:l,close:a,onSubmit:o,isLoading:r,slice:d,libraries:m}=e,{remoteSlices:u}=(0,c.v9)(e=>({remoteSlices:(0,ei.sT)(e)})),h={from:null===(t=m[0])||void 0===t?void 0:t.name,sliceName:(0,R.MP)(d.key)},[p,v]=(0,s.useState)(h),[b,y]=(0,s.useState)();function g(e){v(e),y((0,eu.h)(e,m,u))}return(0,x.pQ)(l,()=>{l||(v(h),y(void 0))}),(0,n.jsxs)(i.ae,{open:l,onOpenChange:e=>!e&&a(),size:{width:448,height:"auto"},children:[(0,n.jsx)(i.al,{title:"Upgrade slice"}),(0,n.jsx)(i.aj,{children:(0,n.jsx)(i.aJ,{onSubmit:function(){b&&Object.keys(b).length>0||o({libraryID:p.from,sliceID:p.sliceName})},children:(0,n.jsxs)(i.D,{flexDirection:"column",children:[(0,n.jsxs)(i.bn,{className:ep().scrollArea,children:[(0,n.jsx)(i.bL,{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,n.jsx)(i.bL,{variant:"normal",color:"grey11",children:"This will not migrate your component. You will need to do that manually."}),(0,n.jsxs)(i.D,{flexDirection:"column",gap:4,children:[(0,n.jsx)(i.aM,{label:"Slice name *",placeholder:"Pascalised Slice API ID (e.g. ".concat((0,R.MP)(d.key),")"),error:null==b?void 0:b.sliceName,value:p.sliceName,onValueChange:e=>g({...p,sliceName:e.slice(0,30)}),"data-testid":"slice-name-input"}),(0,n.jsx)(i.bL,{variant:"normal",color:"grey11",children:"A display name for the slice"})]}),(0,n.jsxs)(i.D,{flexDirection:"column",gap:4,children:[(0,n.jsx)("label",{className:ep().label,children:(0,n.jsx)(i.bL,{variant:"bold",children:"Slice library *"})}),(0,n.jsx)(i.bq,{size:"medium",color:"grey",startIcon:"folder",flexContent:!0,value:p.from,onValueChange:e=>{e&&g({...p,from:e})},children:m.map(e=>(0,n.jsx)(i.bt,{value:e.name,children:e.name},e.name))}),(0,n.jsx)(i.bL,{variant:"normal",color:"grey11",children:"The library where we'll store your slice"})]})]}),(0,n.jsxs)(i.ah,{children:[(0,n.jsx)(i.ai,{size:"medium"}),(0,n.jsx)(i.af,{type:"submit",size:"medium",loading:r,disabled:b&&Object.keys(b).length>0,children:"Upgrade"})]})]})})})]})};var ev=l(96009),eb=l.n(ev);let ey=e=>{var t,l;let{isOpen:a,close:o,onSubmit:r,isLoading:c,slice:d,sliceName:m,libraries:u,localSharedSlices:h}=e,p={libraryID:null===(t=h[0])||void 0===t?void 0:t.from,sliceID:null===(l=h[0])||void 0===l?void 0:l.model.id,variationID:eb()(d.key),variationName:m},[v,b]=(0,s.useState)(!0),[y,g]=(0,s.useState)(p),[f,j]=(0,s.useState)({});function S(e){g(e),j(eg(e,u))}return(0,x.pQ)(a,()=>{a||(g(p),j({}))}),(0,n.jsxs)(i.ae,{open:a,onOpenChange:e=>!e&&o(),size:{width:448,height:"auto"},children:[(0,n.jsx)(i.al,{title:"Convert to slice variation"}),(0,n.jsx)(i.aj,{children:(0,n.jsx)(i.aJ,{onSubmit:function(){Object.keys(f).length>0||r(y)},children:(0,n.jsxs)(i.D,{display:"flex",flexDirection:"column",children:[(0,n.jsxs)(i.bn,{className:ep().scrollArea,children:[(0,n.jsx)(i.bL,{variant:"normal",color:"grey11",children:"If you have multiple slices that are similar, you can combine them as variations of the same slice."}),(0,n.jsxs)(i.D,{display:"flex",flexDirection:"column",gap:4,children:[(0,n.jsxs)("label",{className:ep().label,children:[(0,n.jsx)(i.bL,{variant:"bold",children:"Target slice *"}),"string"==typeof f.libraryID?(0,n.jsx)(i.bL,{variant:"small",color:"tomato10",children:f.libraryID}):null,"string"==typeof f.sliceID?(0,n.jsx)(i.bL,{variant:"small",color:"tomato10",children:f.sliceID}):null]}),(0,n.jsx)(i.bq,{size:"medium",color:"grey",startIcon:"viewDay",flexContent:!0,value:"".concat(y.libraryID,"::").concat(y.sliceID),onValueChange:e=>{if(e){let[t,l]=e.split("::");S({...y,libraryID:t,sliceID:l})}},children:h.map(e=>(0,n.jsxs)(i.bt,{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,n.jsx)(i.bL,{variant:"normal",color:"grey11",children:"Choose the slice to which you would like to add this variation."})]}),(0,n.jsx)(i.D,{display:"flex",flexDirection:"column",gap:4,children:(0,n.jsx)(i.aM,{label:"Variation name *",placeholder:m,error:f.variationName,value:y.variationName,onValueChange:e=>{let t={...y,variationName:e.slice(0,30)};v&&(t.variationID=eb()(t.variationName)),S(t)},"data-testid":"variation-name-input"})}),(0,n.jsx)(i.D,{display:"flex",flexDirection:"column",gap:4,children:(0,n.jsx)(i.aM,{label:"ID *",placeholder:eb()(d.key),error:f.variationID,value:y.variationID,onValueChange:e=>{b(!1),S({...y,variationID:e.slice(0,30)})},"data-testid":"variation-id-input"})})]}),(0,n.jsxs)(i.ah,{children:[(0,n.jsx)(i.ai,{size:"medium"}),(0,n.jsx)(i.af,{type:"submit",size:"medium",loading:c,disabled:Object.keys(f).length>0,children:"Convert"})]})]})})})]})},eg=(e,t)=>{let l={};e.libraryID||(l.libraryID="Cannot be empty.");let n=t.find(t=>t.path===e.libraryID);l.libraryID||n||(l.libraryID="Does not exist."),e.sliceID||(l.sliceID="Cannot be empty.");let i=null==n?void 0:n.components.find(t=>t.model.id===e.sliceID);if(l.sliceID||i||(l.sliceID="Does not exist."),e.variationName||(l.variationName="Cannot be empty."),e.variationID){var a;(null!==(a=null==i?void 0:i.model.variations.map(e=>e.id))&&void 0!==a?a:[]).includes(e.variationID)&&(l.variationID="Slice variation ID is already taken.")}else l.variationID="Cannot be empty.";return l},ef=e=>{var t,l;let{isOpen:a,close:o,onSubmit:r,isLoading:c,identicalSlices:d}=e,m=null!==(l=null===(t=d[0])||void 0===t?void 0:t.path)&&void 0!==l?l:"",[u,h]=(0,s.useState)(m),[p,v]=(0,s.useState)();return(0,x.pQ)(a,()=>{a||(h(m),v(void 0))}),(0,n.jsxs)(i.ae,{open:a,onOpenChange:e=>!e&&o(),size:{width:448,height:"auto"},children:[(0,n.jsx)(i.al,{title:"Merge with an existing slice"}),(0,n.jsx)(i.aj,{children:(0,n.jsx)(i.aJ,{onSubmit:function(){if(p)return;let[e,t,l]=u.split("::");r({libraryID:e,sliceID:t,variationID:l})},children:(0,n.jsxs)(i.D,{display:"flex",flexDirection:"column",children:[(0,n.jsxs)(i.bn,{className:ep().scrollArea,children:[(0,n.jsx)(i.bL,{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,n.jsxs)(i.D,{display:"flex",flexDirection:"column",gap:4,children:[(0,n.jsxs)("label",{className:ep().label,children:[(0,n.jsx)(i.bL,{variant:"bold",children:"Target slice*"}),"string"==typeof p?(0,n.jsx)(i.bL,{variant:"small",color:"tomato10",children:p}):null]}),(0,n.jsx)(i.bq,{size:"medium",color:"grey",startIcon:"viewDay",flexContent:!0,value:u,onValueChange:function(e){h(e),e||v("Cannot be empty.")},children:d.map(e=>(0,n.jsx)(i.bt,{value:e.path,children:e.path.split("::").join(" > ")},e.path))}),(0,n.jsx)(i.bL,{variant:"normal",color:"grey11",children:"Choose a slice that you would like to merge this into."})]})]}),(0,n.jsxs)(i.ah,{children:[(0,n.jsx)(i.ai,{size:"medium"}),(0,n.jsx)(i.af,{type:"submit",size:"medium",loading:c,disabled:!!p,children:"Merge"})]})]})})})]})},ej=e=>{var t;let{slice:l,path:a}=e,{refreshState:o}=(0,g.Z)(),[r,d]=(0,s.useState)(!1),[m,u]=(0,s.useState)(),{setCustomType:h}=I(),{libraries:p}=(0,c.v9)(e=>({libraries:(0,ei.Sd)(e)})),x="Slice"===l.value.type&&null!==(t=l.value.fieldset)&&void 0!==t?t:l.key,b=p.filter(e=>e.isLocal),y=b.map(e=>e.components).flat(),f=eS(l,x,y),j=async e=>{var t,n,i;if(!m)return;d(!0),v.Xe.track({event:"legacy-slice:converted",id:e.sliceID,variation:null!==(t=e.variationID)&&void 0!==t?t:"default",library:e.libraryID,conversionType:m});let{errors:r}=await ee.managerClient.slices.convertLegacySliceToSharedSlice({model:l.value,src:{...a,sliceID:l.key},dest:{libraryID:e.libraryID,sliceID:e.sliceID,variationName:null!==(n=e.variationName)&&void 0!==n?n:"Default",variationID:null!==(i=e.variationID)&&void 0!==i?i:"default"}});if(r.length)throw console.error("Could not convert slice `".concat(x,"`"),r),O.Am.error("Could not convert slice `".concat(x,"`")),r;let{model:s,errors:c}=await ee.managerClient.customTypes.readCustomType({id:a.customTypeID});if(c.length||!s){console.error("Could not refresh custom type view `".concat(a.customTypeID,"`"),c),O.Am.error("Could not refresh custom type view `".concat(a.customTypeID,"`"));return}switch(o(await (0,v.y0)()),d(!1),u(void 0),m){case"as_new_slice":O.Am.success("".concat(x," has been upgraded to a new slice ").concat(e.libraryID," > ").concat(e.sliceID));break;case"as_new_variation":O.Am.success("".concat(x," has been converted as a variation of ").concat(e.libraryID," > ").concat(e.sliceID));break;default:O.Am.success("".concat(x," has been merged with ").concat(e.libraryID," > ").concat(e.sliceID))}h({customType:s})},S={path:a,slice:l,sliceName:x,libraries:b,localSharedSlices:y,identicalSlices:f,close:()=>u(void 0),onSubmit:j,isLoading:r};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(i.ar,{children:[(0,n.jsx)(i.av,{children:(0,n.jsx)(i.E,{"data-testid":"convert-legacy-slice",startIcon:"refresh",endIcon:"arrowDropDown",size:"medium",color:"grey",children:"Migrate legacy slice"})}),(0,n.jsxs)(i.as,{align:"start",children:[(0,n.jsx)(i.at,{startIcon:(0,n.jsx)(i.aX,{name:"folder",size:"large"}),description:"Use it with new types",onSelect:()=>u("as_new_slice"),children:"Upgrade slice"}),(0,n.jsx)(i.at,{startIcon:(0,n.jsx)(i.aX,{name:"viewDay",size:"large"}),description:"Add it to another slice",onSelect:()=>u("as_new_variation"),disabled:!y.length,children:"Convert to slice variation"}),(0,n.jsx)(i.at,{startIcon:(0,n.jsx)(i.aX,{name:"driveFileMove",size:"large"}),description:"Combine identical slices",onSelect:()=>u("merge_with_identical"),disabled:!f.length,children:"Merge with another slice"})]})]}),(0,n.jsx)(ex,{...S,isOpen:"as_new_slice"===m}),(0,n.jsx)(ey,{...S,isOpen:"as_new_variation"===m}),(0,n.jsx)(ef,{...S,isOpen:"merge_with_identical"===m})]})},eS=(e,t,l)=>(0,s.useMemo)(()=>{let n=[],i=(0,em.ux)(e.value,t);for(let e of l)for(let t of e.model.variations){let l=(0,em.ux)(t,e.model.name);i.primary===l.primary&&i.items===l.items&&n.push({libraryID:e.from,sliceID:e.model.id,variationID:t.id,path:"".concat(e.from,"::").concat(e.model.id,"::").concat(t.id)})}return n},[e,t,l]),eI=e=>{let{slice:t,path:l}=e,[a]=(0,ec.E)("legacySliceUpgrader"),o=a.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,n.jsxs)(ed.Zb,{children:[(0,n.jsx)(ed.ZB,{component:"div",children:(0,n.jsx)(i.D,{alignItems:"center",justifyContent:"center",children:(0,n.jsx)(i.bL,{color:"grey11",component:"span",children:"No screenshot available"})})}),(0,n.jsxs)(ed.T$,{children:[(0,n.jsx)(i.c3,{content:o,side:"bottom",children:(0,n.jsx)(i.m,{color:"purple",title:"Legacy Slice"})}),a.enabled?(0,n.jsx)(ej,{slice:t,path:l}):null]}),(0,n.jsx)(ed.eW,{subtitle:"1 variation",title:(0,em.Dj)(t.value)})]})};var eC=l(51507),eT=l(21151);let eD=e=>{let{slices:t,format:l,path:i,onRemoveSharedSlice:a}=e,o=t.some(e=>"SharedSlice"!==e.type),r=f.$[l],[c]=(0,ec.E)("legacySliceUpgrader");return(0,s.useEffect)(()=>{o&&(c.enabled?O.Am.info("This ".concat(r.name({start:!1,plural:!1})," contains legacy slices that can be upgraded.")):O.Am.warning("This ".concat(r.name({start:!1,plural:!1})," contains slices that are incompatible.")))},[o]),(0,n.jsx)(eT.Z,{elems:t,defineElementKey:e=>"SharedSlice"!==e.type?e.payload.key:e.payload.model.name,renderElem:e=>{if("SharedSlice"!==e.type){let t=e.payload;return(0,n.jsx)(eI,{slice:t,path:i})}{let t=e.payload;return(0,n.jsx)(eC.b,{action:{type:"remove",onRemove:()=>{a(t.model.id)}},mode:"navigation",slice:t,variant:"solid"})}},sx:{padding:"16px"}})};async function ew(e){try{let{templateIDs:t,localLibrariesNames:l,location:n,onSuccess:i}=e,{data:a,errors:o}=await ee.managerClient.sliceTemplateLibrary.createSlices({templateIDs:t});if(o.length>0||void 0===a)throw o;a.sliceIDs.forEach((e,i)=>{v.Xe.track({event:"slice:created",id:e,name:e,library:l[0],location:n,mode:"template",sliceTemplate:t[i]})}),await i(a.sliceIDs)}catch(t){let e="Internal Error: Slice(s) not created";console.error(e,t),O.Am.error(e)}}var ek=l(26109),e_=e=>{let{availableSlices:t,values:l}=e;return(0,n.jsx)(L.F2,{name:"sliceKeys",render:e=>(0,n.jsx)(eT.Z,{gridTemplateMinPx:"200px",elems:t,defineElementKey:e=>"".concat(e.from,"-").concat(e.model.name),renderElem:t=>{let i=l.sliceKeys.includes(t.model.id);return(0,n.jsx)(eC.b,{action:{type:"checkbox"},mode:"selection",onSelectedChange:n=>{n?e.push(t.model.id):e.remove(l.sliceKeys.indexOf(t.model.id))},selected:i,slice:t,variant:"outlined"})}})})};let eL=e=>{let{formId:t,close:l,onSuccess:i,availableSlicesTemplates:a,localLibraries:o,location:r}=e,{createSliceSuccess:s}=(0,g.Z)();return(0,n.jsx)(_.Z,{isOpen:!0,buttonLabel:"Add",formId:t,close:l,onSubmit:e=>{let{sliceKeys:t}=e;ew({templateIDs:t,localLibrariesNames:o.map(e=>e.name),location:r,onSuccess:async e=>{s((await (0,v.y0)()).libraries),i(await Promise.all(e.map(async e=>(await ee.managerClient.slices.readSlice({libraryID:o[0].name,sliceID:e})).model).filter(e=>void 0!==e)))}})},initialValues:{sliceKeys:[]},content:{title:"Use template slices"},validate:e=>{if(0===e.sliceKeys.length)return{sliceKeys:"Select at least one template to add"}},actionMessage:e=>{let{errors:t}=e;return void 0!==t.sliceKeys?(0,n.jsx)(A.xv,{sx:{color:"error"},children:t.sliceKeys}):void 0},children:e=>{let{values:t}=e;return(0,n.jsx)(e_,{values:t,availableSlices:a.map(e=>({extension:"",fileName:"",from:"",href:"",pathToSlice:"",model:ek.id.toSM(e.model),screenshots:Object.entries(e.screenshots).reduce((e,t)=>({...e,[t[0]]:{url:t[1]}}),{})}))})}})};var eA=e=>{let{formId:t,close:l,onSubmit:i,availableSlices:a}=e;return(0,n.jsx)(_.Z,{isOpen:!0,buttonLabel:"Add",formId:t,close:l,onSubmit:e=>{let{sliceKeys:t}=e;i(t.map(e=>{var t;return null===(t=a.find(t=>t.model.id===e))||void 0===t?void 0:t.model}).filter(e=>void 0!==e))},initialValues:{sliceKeys:[]},content:{title:"Select existing slices"},testId:"update-slices-modal",validate:e=>{if(0===e.sliceKeys.length)return{sliceKeys:"Select at least one slice to add"}},actionMessage:e=>{let{errors:t}=e;return void 0!==t.sliceKeys?(0,n.jsx)(A.xv,{sx:{color:"error"},children:t.sliceKeys}):void 0},children:e=>{let{values:t}=e;return(0,n.jsx)(e_,{values:t,availableSlices:a})}})};let eE=(e,t)=>{let l=(t||[]).reduce((e,t)=>[...e,...t.components],[]),{slicesInSliceZone:n,notFound:i}=e.value.reduce((e,t)=>{let{key:n,value:i}=t;if("SharedSlice"===i.type){let t=l.find(e=>e.model.id===n);return t?{...e,slicesInSliceZone:[...e.slicesInSliceZone,{type:"SharedSlice",payload:t}]}:{...e,notFound:[...e.notFound,{key:n}]}}return{...e,slicesInSliceZone:[...e.slicesInSliceZone,{type:"Slice",payload:{key:n,value:i}}]}},{slicesInSliceZone:[],notFound:[]});return{availableSlices:l,slicesInSliceZone:n,notFound:i}};var eN=e=>{var t;let{customType:l,onCreateSliceZone:a,onDeleteSliceZone:o,onRemoveSharedSlice:r,sliceZone:d,tabId:m}=e,u=(0,J.QT)(et,[]),[h,p]=(0,s.useState)(!1),[x,b]=(0,s.useState)(!1),[y,f]=(0,s.useState)(!1),[j,S]=(0,s.useState)(!1),{remoteSlices:C,libraries:T}=(0,c.v9)(e=>({remoteSlices:(0,ei.sT)(e),libraries:(0,ei.Sd)(e),slices:(0,ei.xC)(e)})),{setCustomType:D}=I(),{completeStep:w}=(0,W.k)(),{openLoginModal:_}=(0,g.Z)(),L=(0,H.F)({menuType:"Dropdown"}),A=T.filter(e=>e.isLocal),{availableSlices:E,slicesInSliceZone:N,notFound:M}=(0,s.useMemo)(()=>d?eE(d,T):{availableSlices:[],slicesInSliceZone:[],notFound:[]},[d,T]),[z,Z]=(0,s.useState)(!1);(0,s.useEffect)(()=>{(null==M?void 0:M.length)&&M.forEach(e=>{let{key:t}=e;r(t)})},[M]);let F=N.filter(e=>"SharedSlice"===e.type).map(e=>e.payload),K=E.filter(e=>!F.some(t=>t.model.id===e.model.id)),B=()=>{b(!0)},R=()=>{f(!0)},U=async()=>{await ee.managerClient.user.checkIsLoggedIn()?S(!0):_()},V=()=>{p(!0),v.Xe.track({event:"custom-type:open-add-from-templates",customTypeId:l.id,customTypeFormat:l.format})},X=()=>{b(!1)},G=()=>{f(!1)},ea=()=>{S(!1)},eo=()=>{p(!1)};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(P.Bu,{actions:d?(0,n.jsxs)(i.ar,{children:[(0,n.jsx)(i.av,{children:(0,n.jsx)(i.E,{color:"purple",startIcon:"add","data-testid":"add-new-slice-dropdown",children:"Add"})}),(0,n.jsxs)(i.as,{align:"end",children:[(0,n.jsx)(i.at,{renderStartIcon:()=>L.fromImage.BackgroundIcon,onSelect:()=>void U(),description:L.fromImage.description,children:L.fromImage.title}),(0,n.jsx)(i.at,{renderStartIcon:()=>L.fromScratch.BackgroundIcon,onSelect:R,description:L.fromScratch.description,children:L.fromScratch.title}),u.length>0?(0,n.jsx)(i.at,{onSelect:V,renderStartIcon:()=>L.fromTemplate.BackgroundIcon,description:L.fromTemplate.description,children:L.fromTemplate.title}):void 0,K.length>0?(0,n.jsx)(i.at,{onSelect:B,renderStartIcon:()=>L.fromExisting.BackgroundIcon,description:L.fromExisting.description,children:L.fromExisting.title}):void 0]})]}):void 0,toggle:"page"!==l.format||"Main"!==m?(0,n.jsx)(i.bC,{checked:!!d,onCheckedChange:e=>{e?a():Z(!0)},size:"small","data-testid":"slice-zone-switch"}):void 0,children:"Slices"}),d?N.length>0?(0,n.jsx)(Y.xR,{children:(0,n.jsx)(eD,{slices:N,format:l.format,path:{customTypeID:l.id,tabID:m,sliceZoneID:null!==(t=null==d?void 0:d.key)&&void 0!==t?t:""},onRemoveSharedSlice:r})}):(0,n.jsx)(i.D,{flexDirection:"column",flexGrow:1,justifyContent:"center",alignItems:"center",padding:{block:32},children:(0,n.jsx)(Q,{openUpdateSliceZoneModal:B,openCreateSliceModal:R,openCreateSliceFromImageModal:()=>void U(),openSlicesTemplatesModal:V,projectHasAvailableSlices:K.length>0,isSlicesTemplatesSupported:u.length>0})}):void 0,x&&(0,n.jsx)(eA,{formId:"tab-slicezone-form-".concat(m),availableSlices:K,onSubmit:e=>{let t=$({customType:l,tabId:m,slices:e});D({customType:k.Dc.fromSM(t),onSaveCallback:()=>{O.Am.success("Slice(s) added to slice zone")}}),w("createSlice"),X()},close:X}),h&&(0,n.jsx)(eL,{formId:"tab-slicezone-form-".concat(m),availableSlicesTemplates:u,localLibraries:A,location:"".concat(l.format,"_type"),onSuccess:e=>{let t=$({customType:l,tabId:m,slices:e});D({customType:k.Dc.fromSM(t),onSaveCallback:()=>{O.Am.success((0,n.jsx)(en.GX,{message:"Slice template(s) added to slice zone and created at: ",path:"".concat(A[0].name,"/")}))}}),w("createSlice"),eo()},close:eo}),z&&(0,n.jsx)(es,{closeDeleteSliceZoneModal:()=>{Z(!1)},deleteSliceZone:()=>{o(),Z(!1)}}),(null==A?void 0:A.length)!==0&&y&&(0,n.jsx)(el.c,{onSuccess:e=>{let t=$({customType:l,tabId:m,slices:[e]});D({customType:k.Dc.fromSM(t),onSaveCallback:()=>{O.Am.success((0,n.jsx)(en.GX,{message:"New slice added to slice zone and created at: ",path:"".concat(A[0].name,"/")}))}}),G()},localLibraries:A,location:"".concat(l.format,"_type"),remoteSlices:C,onClose:G}),(0,n.jsx)(q.S,{open:j,location:"".concat(l.format,"_type"),onSuccess:e=>{let{slices:t,library:i}=e,a=$({customType:l,tabId:m,slices:t.map(e=>e.model)});D({customType:k.Dc.fromSM(a),onSaveCallback:()=>{O.Am.success((0,n.jsx)(en.GX,{message:"Slice(s) added to slice zone and created at: ",path:i}))}}),ea()},onClose:ea})]})};let eM=[K.C.UID,K.C.Image,K.C.Text,K.C.StructuredText,K.C.Link,K.C.Select,K.C.Boolean,K.C.Number,K.C.Color,K.C.Date,K.C.Table,K.C.Embed,K.C.Timestamp,K.C.GeoPoint,K.C.ContentRelationship,K.C.LinkToMedia,K.C.Group,K.C.NestedGroup];var ez=e=>{var t,l,a,o;let{tabId:r}=e,{customType:c,setCustomType:d}=I(),u=k.Dc.toSM(c),h=null===(t=u.tabs.find(e=>e.key===r))||void 0===t?void 0:t.sliceZone,p=null!==(a=null===(l=u.tabs.find(e=>e.key===r))||void 0===l?void 0:l.value)&&void 0!==a?a:[],x="page"===u.format&&u.repeatable?p.filter(e=>"uid"!==e.key):p,v=u.tabs.reduce((e,t)=>[...e,...t.value],[]),b=e=>{var t;let{apiId:l,value:n}=e,i=null===(t=n.config)||void 0===t?void 0:t.label;if((0,B.Ss)(K.C,n.type)||null==i)return;if("Range"===n.type||"IntegrationFields"===n.type||"Separator"===n.type)throw Error("Unsupported Field Type: ".concat(n.type));let a=K.C[n.type];try{a.schema.validateSync(n,{stripUnknown:!1})}catch(e){throw Error('Add field: Model is invalid for field "'.concat(n.type,'".'))}let o=k.L$.fromSM(n);d({customType:(0,m.xS)({customType:c,newField:o,newFieldId:l,sectionId:r}),onSaveCallback:()=>{O.Am.success("".concat("Group"===n.type?"Group":"Field"," added"))}}),(0,U.V)({id:l,field:o})},y=e=>{let{apiId:t,newKey:l,value:n,inGroupFieldAction:i,updateMeta:a}=e;if((0,B.Ss)(K.C,n.type))return;let o=k.L$.fromSM(n);d({customType:(0,m.L4)({customType:c,previousFieldId:t,newFieldId:l,newField:o,sectionId:r}),onSaveCallback:()=>{"add"===i&&O.Am.success("Field added")},updateMeta:a}),i||(0,V.Z)({previousId:t,id:l,field:o})};return(0,n.jsx)(F.h,{children:(0,n.jsx)(s.Suspense,{fallback:(0,n.jsx)(i.D,{padding:32,children:(0,n.jsx)(i.bg,{})}),children:(0,n.jsxs)(P.aV,{border:!1,style:{flexGrow:1},children:[(0,n.jsx)(G.Z,{zoneType:"customType",zoneTypeFormat:null!==(o=c.format)&&void 0!==o?o:"custom",tabId:r,title:"Static zone",dataTip:"",fields:x,poolOfFieldsToCheck:v,showHints:!0,EditModal:X.Z,widgetsArray:eM,onDeleteItem:e=>{d({customType:(0,m.AK)({customType:c,fieldId:e,sectionId:r})})},onSave:e=>""===e.apiId?b({...e,apiId:e.newKey}):y(e),onDragEnd:e=>{if((0,B.uS)(e))return;let{source:t,destination:l}=e;if(!l)return;let n=(0,m.gR)({customType:c,sourceIndex:t.index,destinationIndex:l.index,sectionId:r});(0,Z.flushSync)(()=>d({customType:n}))},renderHintBase:e=>{let{item:t}=e;return"data".concat((0,R.Ti)(t.key))},renderFieldAccessor:e=>"data".concat((0,R.Ti)(e)),testId:"static-zone-content",isRepeatableCustomType:c.repeatable}),(0,n.jsx)(eN,{customType:u,tabId:r,sliceZone:h,onRemoveSharedSlice:e=>{d({customType:(0,m.EN)({customType:c,sectionId:r,sliceId:e})})},onCreateSliceZone:()=>{d({customType:(0,m.Tr)(c,r)})},onDeleteSliceZone:()=>{d({customType:(0,m.E3)(c,r)})}})]})})})};let eZ=()=>{var e,t,l;let{customType:a,setCustomType:o}=I(),r=k.Dc.toSM(a),[c,d]=(0,s.useState)(null===(e=r.tabs[0])||void 0===e?void 0:e.key),[u,h]=(0,s.useState)(),p=(null===(l=r.tabs.find(e=>e.key===c))||void 0===l?void 0:null===(t=l.sliceZone)||void 0===t?void 0:t.value.length)===0;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(i.c9,{sx:p?{flexGrow:1}:void 0,children:["page"===a.format?(0,n.jsx)(i.ca,{title:a.repeatable?(0,n.jsx)(T,{}):void 0}):void 0,(0,n.jsxs)(i.cb,{onValueChange:d,value:c,children:[(0,n.jsx)(i.cd,{onAddNewTab:()=>{h({type:"CREATE_CUSTOM_TYPE_TAB"})},children:r.tabs.map(e=>(0,n.jsx)(i.ce,{menu:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(i.at,{onSelect:()=>{h({type:"UPDATE_CUSTOM_TYPE_TAB",tabKey:e.key})},startIcon:(0,n.jsx)(i.aX,{name:"edit"}),children:"Rename"}),(0,n.jsx)(i.at,{color:"tomato",disabled:function(e){if(r.tabs.length<=1)return!0;let t=r.tabs.find(e=>e.value.find(e=>"uid"===e.key));return"page"===a.format&&a.repeatable&&(null==t?void 0:t.key)===e}(e.key),onSelect:()=>{h({type:"DELETE_CUSTOM_TYPE_TAB",tabKey:e.key})},startIcon:(0,n.jsx)(i.aX,{name:"delete"}),children:"Remove"})]}),value:e.key,children:e.key},e.key))}),r.tabs.map(e=>(0,n.jsx)(i.cc,{value:e.key,children:(0,n.jsx)(ez,{tabId:e.key})},e.key))]})]}),(null==u?void 0:u.type)==="CREATE_CUSTOM_TYPE_TAB"?(0,n.jsx)(N,{close:()=>{h(void 0)},isOpen:!0,onSubmit:e=>{let{id:t}=e;o({customType:(0,m.vB)(a,t)}),d(t)},tabIds:r.tabs.map(e=>e.key.toLowerCase())}):void 0,(null==u?void 0:u.type)==="UPDATE_CUSTOM_TYPE_TAB"?(0,n.jsx)(z,{close:()=>{h(void 0)},initialTabKey:u.tabKey,isOpen:!0,onSubmit:e=>{let{id:t}=e;o({customType:(0,m.HO)(a,u.tabKey,t)}),c===u.tabKey&&d(t)},tabIds:r.tabs.filter(e=>e.key!==u.tabKey).map(e=>e.key.toLowerCase())}):void 0,(null==u?void 0:u.type)==="DELETE_CUSTOM_TYPE_TAB"?(0,n.jsx)(M,{close:()=>{h(void 0)},isOpen:!0,onSubmit:()=>{if(o({customType:(0,m.F$)(a,u.tabKey)}),c===u.tabKey){var e;let t=null===(e=r.tabs.find(e=>e.key!==u.tabKey))||void 0===e?void 0:e.key;void 0!==t&&d(t)}}}):void 0]})};var eO=l(16442),eP=l(78254),eF=l(60867),eK=l(11166),eB=l(34919),eR=l.n(eB);let eU=e=>{let{tabs:t,...l}=e;return(0,n.jsxs)(eK.fC,{...l,className:eR().root,defaultValue:t[0].label,orientation:"vertical",children:[(0,n.jsx)(eK.aV,{className:eR().list,"aria-label":"content tabs",children:t.map((e,t)=>{let{label:l}=e;return(0,n.jsx)(eK.xz,{className:eR().trigger,value:l,children:(0,n.jsx)(i.bL,{className:eR().triggerText,component:"span",color:"inherit",children:l})},"".concat(l,"-trig").concat(t+1))})}),t.map((e,t)=>{let{label:l,content:a}=e;return(0,n.jsx)(eK.VY,{className:eR().content,value:l,children:(0,n.jsx)(i.bn,{className:eR().scrollArea,children:a})},"".concat(l,"-content").concat(t+1))})]})};var eV=l(25661),eX=l(88241),eG=l(32554),eY=l(44621),eq=l.n(eY);let eH=e=>{var t,l;let{inline:a,...o}=e,r=(0,eG.p)();if(!0===a)return(0,n.jsx)("code",{...o,className:eq().inlineCode});let s=(()=>{var e,t,l,n,i;if((null===(t=o.node)||void 0===t?void 0:null===(e=t.data)||void 0===e?void 0:e.meta)!==void 0){let e=null===(n=o.node)||void 0===n?void 0:null===(l=n.data)||void 0===l?void 0:l.meta;return{fileName:e.substring(1,e.length-1),language:null===(i=o.className)||void 0===i?void 0:i.split("-")[1]}}return null})(),c=null===(t=/language-(\w+)/.exec(null!==(l=o.className)&&void 0!==l?l:""))||void 0===t?void 0:t[1];return(0,n.jsx)(i.W,{...o,onCopy:()=>{v.Xe.track({event:"page-type:copy-snippet",framework:r})},language:c,code:String(o.children).replace(/\n$/,""),title:null==s?void 0:s.fileName})},eQ=e=>{let{markdown:t}=e;return(0,n.jsx)(eV.D,{children:t,linkTarget:"_blank",remarkPlugins:[eX.Z],components:{code:e=>(0,n.jsx)(eH,{...e}),h1:e=>(0,n.jsx)(i.bL,{children:e.children,component:"h1",variant:"h1"}),h2:e=>(0,n.jsx)(i.bL,{children:e.children,component:"h2",variant:"h2"}),h3:e=>(0,n.jsx)(i.bL,{children:e.children,component:"h3",variant:"h3"}),h4:e=>(0,n.jsx)(i.bL,{children:e.children,component:"h4",variant:"h4"}),h5:e=>(0,n.jsx)(i.bL,{children:e.children,component:"h4",variant:"h4"}),p:e=>(0,n.jsx)(i.bL,{className:eq().section,children:e.children,component:"p",variant:"normal"}),pre:e=>(0,n.jsx)(i.bL,{className:eq().section,children:e.children,component:"pre",variant:"normal"})}})};async function eW(e){let t=JSON.parse(e),{errors:l,documentation:n}=await ee.managerClient.documentation.read({kind:t.kind,data:t.data});if(l.length>0)throw l;return n}var e$=l(65480),eJ=l.n(e$);let e0=e=>{var t;let{model:l}=e,a=(0,eG.p)(),o=(t={kind:"PageSnippet",data:{model:l}},(0,J.QT)(eW,[JSON.stringify(t)])),{completeStep:r}=(0,W.k)();return 0===o.length?null:(0,n.jsxs)(i.ae,{size:"small",trigger:(0,n.jsx)(i.E,{color:"grey",onClick:()=>{r("codePage"),v.Xe.track({event:"page-type:open-snippet",framework:a})},startIcon:"code",children:"Page snippet"}),children:[(0,n.jsx)(i.al,{icon:"code",title:"Page snippet"}),(0,n.jsx)("section",{className:eJ().content,children:o.length>1?(0,n.jsx)(eU,{style:{flex:1},tabs:o.map((e,t)=>{let{label:l,content:i}=e;return{label:null!=l?l:"Tab ".concat(t+1),content:(0,n.jsx)(eQ,{markdown:i})}})}):(0,n.jsx)(i.bn,{style:{flex:1,padding:16},children:(0,n.jsx)(eQ,{markdown:o[0].content})})})]})},e1=e=>{let{model:t}=e;return(0,n.jsx)("div",{children:(0,n.jsx)(F.h,{children:(0,n.jsx)(s.Suspense,{fallback:(0,n.jsx)(i.E,{color:"grey",startIcon:"code",children:"Page snippet"}),children:(0,n.jsx)(e0,{model:t})})})})},e4=()=>{let e=(0,r.useRouter)(),{selectedCustomType:t}=(0,c.v9)(t=>({selectedCustomType:(0,eP.Jk)(t,(0,h.Ag)(e.query))}));return((0,s.useEffect)(()=>{t&&(0,eO.TG)(t)||e.replace("/")},[t,e]),t&&(0,eO.TG)(t))?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o(),{children:(0,n.jsxs)("title",{children:[t.local.label," - Slice Machine"]})}),(0,n.jsx)(e6,{customType:t.local})]}):(0,n.jsx)(p.LN,{})},e6=e=>{let{customType:t}=e;return null===t?(0,n.jsx)(p.LN,{}):(0,n.jsx)(p.LN,{children:(0,n.jsx)(S,{initialCustomType:k.Dc.fromSM(t),children:e=>{var l;let{actionQueueStatus:a,customType:o,setCustomType:r}=e,s=(0,m.y6)(o),c=h.cd[t.format],x=f.$[t.format];return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(p.wd,{children:[(0,n.jsx)(p.Xq,{url:c.tablePagePathname}),(0,n.jsxs)(p.Cx,{children:[(0,n.jsx)(d.g,{children:x.name({start:!0,plural:!0})}),(0,n.jsx)(d.g,{active:!0,children:null!==(l=o.label)&&void 0!==l?l:o.id})]}),(0,n.jsxs)(p.K2,{children:[(0,n.jsx)(u.X,{status:a}),"page"===o.format?(0,n.jsx)(e1,{model:o}):void 0,(0,n.jsx)(eF._,{isChangesLocal:!0,format:s,customType:o,setLocalCustomType:r})]})]}),(0,n.jsx)(p.RN,{children:(0,n.jsx)(i.D,{flexDirection:"column",minWidth:0,children:(0,n.jsx)(eZ,{})})})]})}})})}},84879:function(e,t,l){"use strict";l.d(t,{E:function(){return o}});var n=l(18566),i=l(80148);async function a(){return i.managerClient.project.getSliceMachineConfig()}function o(e){var t,l;let[o,r]=[(0,n.QT)(a,[]),async e=>{await i.managerClient.project.writeSliceMachineConfig({config:e}),(0,n.VA)(a,[],e)}],s=async t=>{let l={...o,labs:{...o.labs}};t?l.labs[e]=t:e in l.labs&&delete l.labs[e],0===Object.keys(l.labs).length&&delete l.labs,await r(l)};return[{enabled:null!==(l=null==o?void 0:null===(t=o.labs)||void 0===t?void 0:t[e])&&void 0!==l&&l},s]}},34919:function(e){e.exports={flex:"ContentTabs_flex__T21Oc",column:"ContentTabs_column__1f8b8 ContentTabs_flex__T21Oc",root:"ContentTabs_root__Gn3Zg ContentTabs_column__1f8b8 ContentTabs_flex__T21Oc",list:"ContentTabs_list__rAZtl ContentTabs_flex__T21Oc",trigger:"ContentTabs_trigger__cTyPN ContentTabs_column__1f8b8 ContentTabs_flex__T21Oc",triggerText:"ContentTabs_triggerText__p_ZBl",content:"ContentTabs_content__H1Stj ContentTabs_column__1f8b8 ContentTabs_flex__T21Oc",scrollArea:"ContentTabs_scrollArea__DuDcQ"}},65480:function(e){e.exports={content:"PageSnippetDialog_content__jIN6d"}},44621:function(e){e.exports={section:"MarkdownRenderer_section__uNS1M",inlineCode:"MarkdownRenderer_inlineCode__lmGTi"}},65375:function(e){e.exports={scrollArea:"ConvertLegacySliceButton_scrollArea__xf3vM",label:"ConvertLegacySliceButton_label__BK0Gd"}}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[630],{35289:function(e,t,n){"use strict";n.d(t,{aV:function(){return s},Bu:function(){return d}});var i=n(52322),r=n(11699),l=n(6277),o=n(13834),a=n.n(o);let s=e=>{let{border:t=!0,...n}=e;return(0,i.jsx)("div",{...n,className:(0,l.Z)(a().root,t&&a()["root-border"])})},d=e=>{let{actions:t,children:n,toggle:l,...o}=e;return(0,i.jsxs)("div",{...o,className:a().header,children:[(0,i.jsx)(r.bL,{color:"grey11",component:"span",noWrap:!0,variant:"bold",children:n}),l,t?(0,i.jsx)("div",{className:a().headerActions,children:t}):null]})}},6882:function(e,t,n){"use strict";n.d(t,{$S:function(){return x},$U:function(){return c},BB:function(){return m},Fj:function(){return b},J9:function(){return v},L0:function(){return u},Qr:function(){return i},U:function(){return y},UG:function(){return g},Wc:function(){return p},XU:function(){return k},_M:function(){return f},_n:function(){return h},gA:function(){return o},pG:function(){return r},pV:function(){return d},pt:function(){return l},tg:function(){return s},uG:function(){return a}});let i={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"},r={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"},l={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"},o={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"},a={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"},s={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"},d={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"},c={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"},u={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"},p={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"},h={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"},f={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"},m={name:"Table",description:"A structured table.",icon:"table",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1737381854/FIELDS_SM/Table_f47jnq.png",type:"Table"},x={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"},g={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"},v=[s,x,h,i,p,f,d,u,r,l,m,g,o,a,c],b={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"},y={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"},j={...y,variant:"NestedGroup"},k=[...v,b,y,j]},34166:function(e,t,n){"use strict";n.d(t,{nZ:function(){return c},rT:function(){return p},tB:function(){return u}});var i=n(52322),r=n(11699),l=n(2784),o=n(30195),a=n(94160),s=n(76611),d=n(5683);function c(e){let{type:t,library:n,sliceId:i,variationId:r,langSmithUrl:l}=e,o=(0,d.i)({type:t,library:n,sliceId:i,variationId:r}),a=JSON.stringify({langSmithUrl:l});localStorage.setItem(o,a)}function u(e){let{type:t,library:n,sliceId:i,variationId:r}=e,l=(0,d.i)({type:t,library:n,sliceId:i,variationId:r});localStorage.removeItem(l)}function p(e){let{type:t,library:n,sliceId:c,variationId:u}=e,{key:p,value:h,done:f}=function(e){let{type:t,library:n,sliceId:i,variationId:r}=e,l=(0,d.i)({type:t,library:n,sliceId:i,variationId:r}),[a,c]=(0,s.V)(l,void 0,{schema:o.z.object({langSmithUrl:o.z.string().url().optional()})});return{key:l,value:a,done:()=>c(void 0)}}({type:t,library:n,sliceId:c,variationId:u}),[m,x]=(0,l.useState)(),g=e=>()=>{h&&(x(p),a.Xe.track({event:"slice-generation-feedback",type:t,sliceId:c,variationId:u,feedback:e,langSmithUrl:h.langSmithUrl}),f())};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.be,{children:(0,i.jsx)(r.bQ,{anchor:(0,i.jsx)(r.D,{width:"100%",justifyContent:"center",position:"absolute",bottom:64}),icon:"check",title:"Thanks for your feedback!",seconds:2,open:!!m,onOpenChange:e=>{e||x(void 0)}},m)}),(0,i.jsx)(r.i,{children:h&&(0,i.jsxs)(r.D,{flexDirection:"row",justifyContent:"end",gap:8,alignItems:"center",children:[(0,i.jsx)(r.bL,{color:"grey11",children:"Did the AI get it right?"}),(0,i.jsxs)(r.D,{flexDirection:"row",gap:4,children:[(0,i.jsx)(r.c3,{side:"bottom",sideOffset:4,variant:"text",content:"Looks good",children:(0,i.jsx)(r.aZ,{variant:"solid",size:"small",icon:"thumbUp",onClick:g("up")})}),(0,i.jsx)(r.c3,{side:"bottom",sideOffset:4,variant:"text",content:"Needs improvement",children:(0,i.jsx)(r.aZ,{variant:"solid",size:"small",icon:"thumbDown",onClick:g("down")})})]})]})})]})}},23094:function(e,t,n){"use strict";n.d(t,{X:function(){return l}});var i=n(52322),r=n(11699);let l=e=>{let t;let{status:n}=e;switch(n){case"pending":t={icon:(0,i.jsx)(r.bg,{color:"grey11"}),text:"Saving..."};break;case"failed":t={icon:(0,i.jsx)(r.aX,{name:"close",color:"tomato11",size:"medium"}),text:"Failed to save"};break;case"done":t={icon:(0,i.jsx)(r.aX,{name:"check",color:"green11",size:"medium"}),text:"Auto-saved"}}return(0,i.jsxs)(r.D,{gap:8,alignItems:"center",children:[t.icon,(0,i.jsx)(r.bL,{color:"grey11",children:t.text})]})}},6609:function(e,t,n){"use strict";n.d(t,{S:function(){return o}});var i=n(52322),r=n(11699),l=n(6882);function o(e){let{open:t,onOpenChange:n,disabled:o=!1,onSelectField:s,fields:d,triggerDataTestId:c="add-field",trigger:u}=e,p=d.filter(e=>l.J9.some(t=>t.name===e.name)||e.name===l.Fj.name),h=d.find(e=>e.name===l.U.name);return(0,i.jsxs)(r.ar,{open:t,onOpenChange:n,children:[(0,i.jsx)(r.av,{disabled:o,children:null!=u?u:(0,i.jsx)(r.E,{startIcon:"add",color:"grey","data-testid":c,children:"Add a field"})}),(0,i.jsxs)(r.as,{align:"end",maxHeight:400,collisionPadding:8,children:[(0,i.jsx)(r.au,{children:"Single fields"}),p.map(e=>(0,i.jsx)(a,{field:e,onSelectField:s},e.name)),h&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.au,{children:"Set of fields"}),(0,i.jsx)(a,{field:h,onSelectField:s})]})]})]})}function a(e){let{field:t,onSelectField:n}=e,{type:l,variant:o,name:a,icon:s,description:d,thumbnail:c}=t;return(0,i.jsx)(r.at,{startIcon:(0,i.jsx)(r.aX,{name:s,size:"large"}),description:d,onSelect:()=>n(null!=o?o:l),renderTooltip:e=>(0,i.jsx)(r.c3,{visible:!0,variant:"custom",content:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.a_,{src:c,borderRadius:4,sx:{height:170,width:278},animateOnLoad:!1}),(0,i.jsx)(r.bL,{color:"white",children:"How it will look for content editors."})]}),align:"start",side:"left",sideOffset:4,animation:"none",children:e}),children:a},"".concat(l).concat(o?"-".concat(o):""))}},41347:function(e,t,n){"use strict";n.d(t,{zE:function(){return d},Vg:function(){return j},WP:function(){return C}});var i=n(52322),r=n(47124),l=n(11699),o=n(2784),a=n(50477),s=n(87446);function d(e){return(0,i.jsx)(s.h,{renderError:()=>(0,i.jsxs)(l.D,{alignItems:"center",gap:8,children:[(0,i.jsx)(l.aX,{name:"alert",size:"small",color:"tomato10"}),(0,i.jsx)(l.bL,{color:"tomato10",children:"Error loading your types"})]}),children:(0,i.jsx)(l.bB,{fallback:(0,i.jsxs)(l.D,{flexDirection:"column",position:"relative",children:[(0,i.jsx)(l.bx,{height:240}),(0,i.jsxs)(l.D,{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",alignItems:"center",gap:8,children:[(0,i.jsx)(l.aX,{name:"autorenew",size:"small",color:"grey11"}),(0,i.jsx)(l.bL,{color:"grey11",children:"Loading your types..."})]})]}),children:(0,i.jsx)(c,{...e})})})}function c(e){let{value:t,onChange:n}=e,{allCustomTypes:r,pickedCustomTypes:s}=function(e){let{customTypes:t}=(0,a.xU)();if((0,o.useEffect)(()=>{(0,a.NG)()},[]),!e)return{allCustomTypes:t,pickedCustomTypes:[]};let n=e.flatMap(e=>{var n;return null!==(n=t.find(t=>t.id===L(e)))&&void 0!==n?n:[]});return{allCustomTypes:t,pickedCustomTypes:n}}(t),d=t?j({linkCustomtypes:t,allCustomTypes:r}):{};return(0,i.jsxs)(l.D,{overflow:"hidden",flexDirection:"column",border:!0,borderRadius:6,width:"100%",children:[(0,i.jsx)(l.D,{border:{bottom:!0},padding:{inline:16,bottom:16,top:12},flexDirection:"column",gap:8,children:s.length>0?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(l.D,{flexDirection:"column",children:[(0,i.jsx)(l.bL,{variant:"h4",color:"grey12",children:"Allowed type"}),(0,i.jsxs)(l.bL,{color:"grey11",children:["Select a single type that editors can link to in the Page Builder.",(0,i.jsx)("br",{}),"For the selected type, choose which fields to include in the API response."]}),s.length>1&&(0,i.jsx)(l.D,{margin:{block:12},children:(0,i.jsx)(l.f,{color:"warn",icon:"alert",subtitle:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l.bL,{color:"inherit",variant:"bold",children:"Legacy mode. Keep only one type to enable the improved Content Relationship feature."}),(0,i.jsx)("br",{}),(0,i.jsxs)("a",{href:"https://prismic.io/docs/fields/content-relationship",target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"none",fontWeight:"bold",display:"flex",alignItems:"center",gap:4},children:[(0,i.jsx)(l.bL,{color:"inherit",variant:"bold",children:"See documentation"}),(0,i.jsx)(l.aX,{name:"arrowForward",size:"small",color:"inherit"})]})]})})})]}),s.map(e=>{var o;return(0,i.jsxs)(l.D,{gap:4,padding:8,border:!0,borderRadius:6,borderColor:"grey6",backgroundColor:"white",justifyContent:"space-between",children:[s.length>1?(0,i.jsx)(l.bL,{children:e.id}):(0,i.jsx)(l.c5,{children:(0,i.jsx)(h,{customType:e,onChange:i=>{n(function(e){let{linkCustomtypes:t,fieldCheckMap:n,newCustomType:i,customTypeId:r}=e,l=[],o=Object.entries({...n,[r]:i}).flatMap(e=>{let[t,n]=e,i=Object.entries(n).flatMap(e=>{let[t,n]=e;if("group"===n.type){let e=Object.entries(n.value).flatMap(e=>{let[t,n]=e;if("checkbox"===n.type)return n.value?t:[];let i=S(n.value);return i.length>0?{id:t,customtypes:i}:[]});return e.length>0?{id:t,fields:e}:[]}if("contentRelationship"===n.type){let e=S(n.value);return e.length>0?{id:t,customtypes:e}:[]}return n.value?t:[]});return i.length>0?{id:t,fields:i}:[]});if(!t)return o;for(let e of t){let t=o.find(t=>L(t)===L(e));void 0!==t?l.push(t):L(e)===r?l.push(L(e)):l.push(e)}return l}({fieldCheckMap:d,newCustomType:i,linkCustomtypes:t,customTypeId:e.id}))},fieldCheckMap:null!==(o=d[e.id])&&void 0!==o?o:{},allCustomTypes:r})}),(0,i.jsx)(l.aZ,{icon:"close",size:"small",onClick:()=>{var i;return i=e.id,void(t&&n(t.filter(e=>L(e)!==i)))},sx:{height:24,width:24},hiddenLabel:"Remove type"})]},e.id)})]}):(0,i.jsx)(u,{onSelect:function(e){n(t?[...t,e]:[e])},allCustomTypes:r})}),(0,i.jsx)(l.D,{backgroundColor:"white",flexDirection:"column",padding:12,children:(0,i.jsxs)(l.bL,{variant:"normal",color:"grey11",children:["Have ideas for improving this field?"," ",(0,i.jsx)("a",{href:"https://community.prismic.io/t/content-relationship-share-your-requests-and-feedback/19843",target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"underline"},children:"Please provide your feedback here"}),"."]})})]})}function u(e){let{allCustomTypes:t,onSelect:n}=e;return(0,i.jsxs)(l.D,{flexDirection:"column",gap:8,alignItems:"center",padding:{block:24},children:[(0,i.jsxs)(l.D,{flexDirection:"column",alignItems:"center",gap:4,children:[(0,i.jsx)(l.bL,{variant:"h5",color:"grey12",children:"No type selected"}),(0,i.jsxs)(l.bL,{color:"grey11",component:"p",align:"center",children:["Select the type editors can link to.",(0,i.jsx)("br",{}),"Then, choose which fields to return in the API."]})]}),(0,i.jsx)(l.D,{children:(0,i.jsx)(p,{allCustomTypes:t,onSelect:n})})]})}function p(e){let{allCustomTypes:t,onSelect:n}=e,r=(0,i.jsx)(l.E,{startIcon:"add",color:"grey",disabled:0===t.length,children:"Add type"});return 0===t.length?(0,i.jsx)(l.D,{children:(0,i.jsx)(l.c3,{content:"No type available",side:"bottom",align:"start",disableHoverableContent:!0,children:r})}):(0,i.jsx)(l.D,{children:(0,i.jsxs)(l.ar,{children:[(0,i.jsx)(l.av,{children:r}),(0,i.jsxs)(l.as,{maxHeight:400,minWidth:256,align:"center",children:[(0,i.jsx)(l.au,{children:(0,i.jsx)(l.bL,{color:"grey11",children:"Types"})}),t.map(e=>(0,i.jsx)(l.at,{onSelect:()=>n(e.id),children:(0,i.jsxs)(l.D,{alignItems:"center",justifyContent:"space-between",gap:8,children:[(0,i.jsx)(l.bO,{children:(0,i.jsx)(l.bL,{children:e.id})}),(0,i.jsx)(l.m,{title:(0,i.jsx)(l.bL,{variant:"extraSmall",color:"purple11",children:b(e.format)}),color:"purple",size:"small"})]})},e.id))]})]})})}function h(e){let{customType:t,fieldCheckMap:n,onChange:r,allCustomTypes:o}=e,a=I(t).map(e=>{var t,a,s;let[d,c]=e;if("Group"===c.type){let e=null!==(a=n[d])&&void 0!==a?a:{};return(0,i.jsx)(g,{group:c,groupId:d,onChange:e=>{r({...n,[d]:{type:"group",value:e}})},fieldCheckMap:"group"===e.type?e.value:{},allCustomTypes:o},d)}if(F(c,o)){let e=null!==(s=n[d])&&void 0!==s?s:{};return(0,i.jsx)(f,{field:c,fieldId:d,onChange:e=>{r({...n,[d]:{type:"contentRelationship",value:e}})},fieldCheckMap:"contentRelationship"===e.type?e.value:{},allCustomTypes:o},d)}return(0,i.jsx)(l.c6,{title:d,checked:(null===(t=n[d])||void 0===t?void 0:t.value)===!0,onCheckedChange:e=>{r({...n,[d]:{type:"checkbox",value:e}})}},d)}),s=C(n);return(0,i.jsx)(l.c7,{title:t.id,subtitle:s.pickedFields>0?v(s.pickedFields,"returned in the API"):"(No fields returned in the API)",badge:b(t.format),defaultOpen:!0,children:a.length>0?a:(0,i.jsx)(m,{})},t.id)}function f(e){var t,n;let{field:r,fieldId:o,fieldCheckMap:a,onChange:s,allCustomTypes:d}=e,[c]=y(null===(t=r.config)||void 0===t?void 0:t.customtypes,d),u=e=>{s({...a,[c.id]:e})},p=null!==(n=a[c.id])&&void 0!==n?n:{},h=I(c).map(e=>{var t,n;let[r,o]=e;if("Group"===o.type){let e=null!==(n=p[r])&&void 0!==n?n:{};return(0,i.jsx)(x,{group:o,groupId:r,onChange:e=>{u({...p,[r]:{type:"group",value:e}})},fieldCheckMap:"group"===e.type?e.value:{}},r)}return(0,i.jsx)(l.c6,{title:r,checked:(null===(t=p[r])||void 0===t?void 0:t.value)===!0,onCheckedChange:e=>{u({...p,[r]:{type:"checkbox",value:e}})}},r)});return(0,i.jsx)(l.c7,{title:(0,i.jsxs)(l.bL,{children:[o," ",(0,i.jsxs)(l.bL,{color:"grey11",children:["→ ",c.id]})]}),subtitle:v(C(p).pickedFields),badge:b(c.format),children:h.length>0?h:(0,i.jsx)(m,{})},c.id)}function m(){return(0,i.jsx)(l.bL,{color:"grey11",children:"No available fields to select"})}function x(e){let{group:t,groupId:n,fieldCheckMap:r,onChange:o}=e,a=w(t).map(e=>{var t;let{fieldId:n}=e;return(0,i.jsx)(l.c6,{title:n,checked:(null===(t=r[n])||void 0===t?void 0:t.value)===!0,onCheckedChange:e=>{o({...r,[n]:{type:"checkbox",value:e}})}},n)});return(0,i.jsx)(l.c7,{title:n,subtitle:v(C(r).pickedFields),badge:"Group",children:a.length>0?a:(0,i.jsx)(m,{})},n)}function g(e){let{group:t,groupId:n,fieldCheckMap:r,onChange:o,allCustomTypes:a}=e,s=w(t).map(e=>{var t,n;let{fieldId:s,field:d}=e;if(F(d,a)){let e=null!==(n=r[s])&&void 0!==n?n:{};return(0,i.jsx)(f,{field:d,fieldId:s,fieldCheckMap:"contentRelationship"===e.type?e.value:{},onChange:e=>{o({...r,[s]:{type:"contentRelationship",value:e}})},allCustomTypes:a},s)}return(0,i.jsx)(l.c6,{title:s,checked:(null===(t=r[s])||void 0===t?void 0:t.value)===!0,onCheckedChange:e=>{o({...r,[s]:{type:"checkbox",value:e}})}},s)});return(0,i.jsx)(l.c7,{title:n,subtitle:v(C(r).pickedFields),badge:"Group",children:s.length>0?s:(0,i.jsx)(m,{})},n)}function v(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"selected";if(0!==e)return"(".concat(e," ").concat((0,r._6)(e,"field","fields")," ").concat(t,")")}function b(e){return"page"===e?"Page type":"Custom type"}function y(e,t){return e?e.flatMap(e=>{var n;return null!==(n=t.find(t=>t.id===L(e)))&&void 0!==n?n:[]}):[]}function j(e){let{linkCustomtypes:t,allCustomTypes:n}=e,i=void 0!==n;return t.reduce((e,t)=>{if("string"==typeof t)return e;let r={};if(i){let i=n.find(e=>e.id===t.id);if(!i)return e;r=T(i)}let l=t.fields.reduce((e,t)=>{let l=r[L(t)];if(i&&void 0===l)return e;if("string"==typeof t)return i&&void 0!==l&&"Group"===l.type||(e[t]={type:"checkbox",value:!0}),e;if("fields"in t&&void 0!==t.fields){if(i&&void 0!==l&&"Group"!==l.type)return e;let o=function(e){let{group:t,ctFlatFieldMap:n,allCustomTypes:i}=e,r=void 0!==i,l=t.fields.reduce((e,l)=>{let o=E(n,t.id,L(l));if(r&&!o)return e;if("string"==typeof l)return r&&void 0!==o&&"Group"===o.type||(e[l]={type:"checkbox",value:!0}),e;if("customtypes"in l&&void 0!==l.customtypes){if(r&&void 0!==o&&!_(o))return e;let t=k({field:l,allCustomTypes:i});t&&(e[l.id]=t)}return e},{});if(0!==Object.keys(l).length)return{type:"group",value:l}}({group:t,allCustomTypes:n,ctFlatFieldMap:r});return o&&(e[t.id]=o),e}if("customtypes"in t&&void 0!==t.customtypes){if(i&&void 0!==l&&!_(l))return e;let r=k({field:t,allCustomTypes:n});r&&(e[t.id]=r)}return e},{});return Object.keys(l).length>0&&(e[t.id]=l),e},{})}function k(e){let{field:t,allCustomTypes:n}=e,i=void 0!==n,r=t.customtypes.reduce((e,t)=>{if("string"==typeof t)return e;let r={};if(i){let i=n.find(e=>e.id===t.id);if(!i)return e;r=T(i)}let l=t.fields.reduce((e,t)=>{if("string"==typeof t){let n=r[t];return i&&(void 0===n||"Group"===n.type)||(e[t]={type:"checkbox",value:!0}),e}if("fields"in t&&void 0!==t.fields){let n=t.fields.reduce((e,n)=>{let l=E(r,t.id,n);return i&&(void 0===l||"Group"===l.type)||(e[n]={type:"checkbox",value:!0}),e},{});Object.keys(n).length>0&&(e[t.id]={type:"group",value:n})}return e},{});return Object.keys(l).length>0&&(e[t.id]=l),e},{});if(0!==Object.keys(r).length)return{type:"contentRelationship",value:r}}function S(e){return Object.entries(e).flatMap(e=>{let[t,n]=e,i=Object.entries(n).flatMap(e=>{let[t,n]=e;if("group"===n.type){let e=Object.entries(n.value).flatMap(e=>{let[t,n]=e;return"checkbox"===n.type&&n.value?t:[]});return e.length>0?{id:t,fields:e}:[]}return n.value?t:[]});return i.length>0?{id:t,fields:i}:[]})}function C(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e?Object.values(e).reduce((e,n)=>{if(!function(e){if("object"!=typeof e||null===e||Array.isArray(e)||e instanceof Date||e instanceof RegExp||e instanceof Error)return!1;for(let t in e)if("string"!=typeof t||!Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(n))return e;if("type"in n&&"checkbox"===n.type)return n.value?{pickedFields:e.pickedFields+1,nestedPickedFields:e.nestedPickedFields+(t?1:0)}:e;if("type"in n&&"contentRelationship"===n.type){let{pickedFields:t,nestedPickedFields:i}=C(n,!0);return{pickedFields:e.pickedFields+t,nestedPickedFields:e.nestedPickedFields+i}}let{pickedFields:i,nestedPickedFields:r}=C(n,t);return{pickedFields:e.pickedFields+i,nestedPickedFields:e.nestedPickedFields+r}},{pickedFields:0,nestedPickedFields:0}):{pickedFields:0,nestedPickedFields:0}}function _(e){var t;return"Link"===e.type&&(null===(t=e.config)||void 0===t?void 0:t.select)==="document"}function F(e,t){var n;return _(e)&&1===y(null===(n=e.config)||void 0===n?void 0:n.customtypes,t).length}function I(e){return Object.values(e.json).flatMap(e=>Object.entries(e).flatMap(e=>{let[t,n]=e;return"Slices"!==n.type&&"Choice"!==n.type&&"UID"!==n.type&&"uid"!==t?[[t,n]]:[]}))}function T(e){return Object.fromEntries(I(e))}function E(e,t,n){var i,r;let l=e[t];if(void 0!==l&&"Group"===l.type)return null===(r=l.config)||void 0===r?void 0:null===(i=r.fields)||void 0===i?void 0:i[n]}function w(e){var t;return(null===(t=e.config)||void 0===t?void 0:t.fields)?Object.entries(e.config.fields).map(e=>{let[t,n]=e;return{fieldId:t,field:n}}):[]}function L(e){return"string"==typeof e?e:e.id}},96317:function(e,t,n){"use strict";n.d(t,{L:function(){return o}});var i=n(18566),r=n(80148);async function l(e){try{return await r.managerClient.telemetry.getExperimentVariant(e)}catch(e){console.error("Error while trying to get experiment value",e);return}}function o(e){return(0,i.QT)(l,[e])}},76611:function(e,t,n){"use strict";n.d(t,{V:function(){return r}});var i=n(2784);function r(e,t,n){let{schema:r}=null!=n?n:{},l=()=>{try{let n=localStorage.getItem(e);if(null==n)return t;if(!r)return JSON.parse(n);return r.parse(JSON.parse(n))}catch(e){return t}},[o,a]=(0,i.useState)(l),[s,d]=(0,i.useState)(e);return s!==e&&(d(e),a(l())),[o,(0,i.useCallback)(n=>{a(i=>{let r;if(void 0===(r="function"==typeof n?n(i):n)){try{localStorage.removeItem(e)}catch(e){return i}return t}try{localStorage.setItem(e,JSON.stringify(r))}catch(e){return i}return r})},[e,t])]}},38193:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var i=n(52322),r=n(61183);n(2784);var l=n(59326),o=n(75289);r.Z.registerLanguage("svelte",e=>({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}]}]}));let a=["javascript","bash","xml","html","json"];var s=e=>{var t;let{children:n,lang:s,sx:d,codeStyle:c,codeClass:u,Header:p}=e,{theme:h}=(0,l.B7)(),f=s?r.Z.highlight(n,{language:"vue"===s?"html":s}).value:r.Z.highlightAuto(n,a).value;return(0,i.jsxs)(o.kC,{as:"pre",sx:d,children:[p?(0,i.jsx)(p,{}):null,(0,i.jsx)("code",{className:"hljs".concat(u?" ".concat(u):""),style:{overflowX:"auto",padding:"3px 5px",borderRadius:"6px",border:"1px solid",borderColor:String(null===(t=h.colors)||void 0===t?void 0:t.textClear),...c},dangerouslySetInnerHTML:{__html:f}})]})}},80575:function(e,t,n){"use strict";n.d(t,{J:function(){return o},k:function(){return l}});var i=n(52322);n(2784);var r=n(75289);let l=e=>{let{children:t,sx:n,...l}=e;return(0,i.jsx)(r.xu,{sx:{display:["block","block","flex"],flexWrap:"wrap",justifyContent:"space-between",...n},...l,children:t})},o=e=>{let{children:t,cols:n=2}=e;return(0,i.jsx)(r.xu,{sx:{flex:"0 ".concat(100/n-1,"%"),mb:1},children:t})}},90167:function(e,t,n){"use strict";n.d(t,{kp:function(){return d},sP:function(){return c},w8:function(){return u},Hq:function(){return h}});var i,r,l=n(52322),o=n(63397),a=n(2784),s=n(75289),d=e=>{let{field:t,meta:n,fieldName:i,label:r,focusOnNewEntry:d=!0,inputPlaceholder:c,buttonLabel:u}=e,[p,h]=(0,a.useState)(n.value.length),f=(0,a.useRef)(Array(n.value.length));return(0,a.useEffect)(()=>{f.current=f.current.slice(0,n.value.length)},[n.value.length]),(0,a.useEffect)(()=>{let e=f.current.length;d&&e>p&&f.current[e-1].focus(),h(e)},[f.current.length,d,p]),(0,l.jsxs)(a.Fragment,{children:[(0,l.jsxs)(s.__,{variant:"label.primary",htmlFor:i,children:[r,n.touched&&n.error?(0,l.jsx)(s.xv,{as:"span",variant:"text.labelError",children:n.error}):null]}),(0,l.jsx)(o.F2,{name:i,id:i,...t,render:e=>(0,l.jsxs)("div",{children:[t.value&&t.value.length>0?t.value.map((t,n)=>(0,l.jsxs)(s.kC,{my:2,children:[(0,l.jsx)(s.II,{placeholder:c,name:"".concat(i,".").concat(n),value:t,ref:e=>f.current[n]=e,onChange:t=>{let{target:{value:i}}=t;return e.replace(n,i)}}),(0,l.jsx)(s.zx,{ml:2,type:"button",variant:"secondary",onClick:()=>e.remove(n),children:"-"})]},"".concat(i,"-").concat(+n+1))):null,(0,l.jsx)(s.zx,{type:"button",onClick:()=>e.insert(t.value.length,""),children:u})]})})]})},c=e=>{let{initialValues:t,meta:n,label:i,fieldName:r,onChange:a,...d}=e;return(0,l.jsxs)(s.__,{variant:"label.border",...d,children:[(0,l.jsx)(o.gN,{as:s.XZ,type:"checkbox",name:r,onChange:()=>a(!n.value),checked:n.value}),i]})},u=e=>{let{field:t,label:n,defaultValue:i,onChange:r,controlledValue:o,setControlledValue:s,buildControlledValue:d}=e,[u,p]=(0,a.useState)(i||t.defaultValue||!1);return(0,a.useEffect)(()=>{d?s(d(o,u)):s(d)},[u,o,d]),(0,l.jsx)(c,{meta:{value:u},fieldName:t.name,onChange:e=>p(e)&&r&&r(e),label:"function"==typeof n?n(o,u):n})};(i=r||(r={}))[i.ERROR=0]="ERROR",i[i.DISABLED=1]="DISABLED",i[i.WARNING=2]="WARNING";let p=e=>{let t={"&::placeholder":{color:"#C9D0D8"}};switch(e){case 1:return{...t,border:"1px solid #E6E6EA",backgroundColor:"#F3F5F7"};case 0:return{...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 2:return{...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}},h=e=>{let{sx:t={},field:n,meta:i,formField:r,fieldName:a,fields:d,initialValues:c,isDisabled:u,autoFocus:h}=e,f=i.error?0:u||r.disabled?1:void 0;return(0,l.jsxs)(s.xu,{sx:t,children:[(0,l.jsxs)(s.__,{variant:"label.primary",htmlFor:a,children:[r.label||a,i.touched&&i.error?(0,l.jsx)(s.xv,{as:"span",variant:"text.labelError",children:i.error}):null]}),(0,l.jsx)(o.gN,{id:a,name:a,type:"text",placeholder:r.placeholder||r.label||a,...r.fieldLevelValidation&&c?{validate:e=>r.fieldLevelValidation&&r.fieldLevelValidation({value:e,fields:d,initialId:c.id})}:null,...n,as:s.II,sx:p(f),disabled:u||r.disabled,autoFocus:null!=h?h:r.autoFocus})]})}},70705:function(e,t,n){"use strict";var i=n(52322),r=n(2784),l=n(75289);let o=(0,r.forwardRef)((e,t)=>{let{children:n,Component:r=l.kC,sx:o={},...a}=e;return(0,i.jsx)(r,{as:"li",sx:{p:3,mx:3,alignItems:"center",variant:"styles.listItem",...o},ref:t,...a,children:n})});t.Z=o},86355:function(e,t,n){"use strict";n.d(t,{Z:function(){return j}});var i=n(52322),r=n(11699),l=n(5446),o=n(2784),a=n(40023),s=n(951),d=n(8799),c=n(18978),u=n(59326),p=n(75289),h=n(70705),f=n(66770),m=n(33710),x=n(28316),g=n(65077);let v=e=>{let{children:t}=e;return(0,x.createPortal)((0,i.jsx)(g.xR,{children:t}),document.body)},b=e=>{let{text:t,as:n,sx:r={},...l}=e,a=(0,o.useRef)(null),[s,d]=(0,o.useState)(null),c=()=>{d(a.current&&a.current.offsetWidth<a.current.scrollWidth)};return(0,o.useEffect)(()=>(c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}),[]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(p.xv,{"data-for":t,"data-tip":!0,sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",...r},as:n,ref:a,...l,children:t}),s&&(0,i.jsx)(v,{children:(0,i.jsx)(m.Z,{id:t,type:"dark",multiline:!0,border:!0,borderColor:"black",place:"bottom",effect:"solid",children:t})})]})};var y=e=>{var t,n;let{text:l,sliceFieldName:o,theme:a,WidgetIcon:s,widgetIconTooltip:d}=e;return(0,i.jsxs)(p.kC,{sx:{alignItems:"center",position:"relative"},children:[(0,i.jsx)(r.c3,{content:d,sideOffset:2,disableHoverableContent:!0,children:(0,i.jsx)(r.D,{margin:{right:8},children:(0,i.jsx)(s,{size:28,style:{color:null===(t=a.colors)||void 0===t?void 0:t.primary,borderRadius:"4px",padding:"4px",border:"2px solid",borderColor:null===(n=a.colors)||void 0===n?void 0:n.primary,flexShrink:0}})})}),(0,i.jsx)(b,{text:l,as:"p",sx:{py:0,px:1,fontWeight:"label",fontSize:"15px"},"data-testid":"field-name"}),(0,i.jsx)(p.xv,{as:"p",sx:{display:["none","none","initial"],fontSize:"14px",ml:1,color:"textClear",overflow:"hidden",textOverflow:"ellipsis"},"data-testid":"field-id",children:o})]})},j=function(e){let{item:t,index:n,deleteItem:m,enterEditMode:x,modelFieldName:g,renderFieldAccessor:v,HintElement:b,CustomEditElement:j,CustomEditElements:k,widget:S,draggableId:C,testId:_,isRepeatableCustomType:F,children:I}=e,{theme:T}=(0,u.B7)(),{key:E,value:{config:w,type:L}}=t,D=!!(("Link"===L||"Group"===L)&&(null==w?void 0:w.repeat));return(0,i.jsx)(o.Fragment,{children:(0,i.jsx)(a._l,{draggableId:C,index:n,children:e=>{var a,u,C,M,O;return(0,i.jsx)(o.Fragment,{children:(0,i.jsxs)(h.Z,{"data-testid":_,ref:e.innerRef,...e.draggableProps,Component:p.xu,sx:{p:0,mx:0,my:3},children:[(0,i.jsxs)(p.kC,{sx:{width:"100%"},children:[(0,i.jsx)(f.Z,{label:"Reorder slice field (drag and drop)",Icon:c.Fm7,color:null===(a=T.colors)||void 0===a?void 0:a.icons,mr:1,mt:3,...e.dragHandleProps}),(0,i.jsxs)(p.xu,{sx:{bg:"headSection",width:"100%",borderRadius:"3px",border:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))}},children:[(0,i.jsxs)(p.kC,{sx:{p:3,alignItems:"center",justifyContent:"space-between",width:"100%"},children:[(0,i.jsx)(y,{theme:T,text:(null==w?void 0:w.label)||E,sliceFieldName:v&&v(E),WidgetIcon:S.Meta.icon,widgetIconTooltip:S.label}),(0,i.jsxs)(p.kC,{sx:{flex:"0 0 auto"},children:[D&&(0,i.jsx)(r.m,{title:"Repeatable",color:"purple",size:"medium",sx:{alignSelf:"center",marginInline:16}}),k||null,j||(0,i.jsx)(f.Z,{size:22,Icon:s.$iz,label:"Edit field",sx:{cursor:"pointer",color:null===(u=T.colors)||void 0===u?void 0:u.icons,flexShrink:0},onClick:()=>x([E,t.value],g,n)}),!(!0===F&&"UID"==L)&&(0,i.jsxs)(l.v2,{children:[(0,i.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,i.jsx)(d.FQA,{size:20,color:null===(C=T.colors)||void 0===C?void 0:C.icons,style:{pointerEvents:"none"}})}),(0,i.jsx)(l.qy,{style:{background:null===(M=T.colors)||void 0===M?void 0:M.gray,border:"1px solid",borderRadius:"3px",borderColor:null===(O=T.colors)||void 0===O?void 0:O.borders,outline:"0"},children:(0,i.jsx)(l.sN,{style:{padding:"6px",cursor:"pointer"},onSelect:()=>m(E),children:"Delete field"})})]})]})]}),b||null]})]}),I]})})}})})}},66770:function(e,t,n){"use strict";var i=n(52322),r=n(75289);let l=(e,t)=>t?{border:e=>{let{colors:t}=e;return"1px solid ".concat(t.error)}}:e?{border:e=>{let{colors:t}=e;return"1px solid ".concat(t.primary)}}:{border:e=>{let{colors:t}=e;return"1px solid ".concat(t.borders)}};t.Z=e=>{let{sx:t=null,onClick:n=()=>null,label:o,Icon:a,error:s=null,size:d=16,fitButton:c=!1,active:u=!1,useActive:p=!1,activeSx:h=l,...f}=e;return(0,i.jsx)(r.hU,{onClick:n,"aria-label":o,type:"button",sx:{...c?{width:d,height:d}:null,...p&&h(u,s),...t},...f,children:(0,i.jsx)(a,{size:d})})}},89280:function(e,t,n){"use strict";var i=n(52322),r=n(63397),l=n(2784),o=n(75289),a=n(90167),s=n(79256);t.Z=e=>{let{fieldName:t,formField:n,fields:d,initialValues:c,autoFocus:u}=e,[p,h,f]=(0,r.U$)(t),m=n.component;return(0,i.jsx)(o.xu,{sx:{mt:2,alignItems:"center",...n.type===s.h.CHECKBOX?{display:"flex",height:"130%"}:null},children:m?(0,i.jsx)(m,{meta:h,field:p,helpers:f,fieldName:t,formField:n,initialValues:c}):(0,i.jsxs)(l.Fragment,{children:[n.type===s.h.INPUT?(0,i.jsx)(a.Hq,{meta:h,field:p,fields:d,formField:n,fieldName:t,initialValues:c,autoFocus:u}):null,n.type===s.h.CHECKBOX&&(0,i.jsx)(a.sP,{meta:h,label:n.label,fieldName:t,initialValues:c,onChange:e=>f.setValue(e)})]})})}},3285:function(e,t,n){"use strict";n.d(t,{Z:function(){return A}});var i=n(52322),r=n(37149),l=n.n(r),o=n(56580),a=n(59326),s=n(75289),d=n(65413),c=n(30527),u=n(2784),p=n(92928);let h=e=>{let{children:t,...n}=e;return(0,i.jsx)(s.xu,{as:"ul",sx:{p:0,m:0,px:e=>"calc(".concat(e.space[3],"px + 8px)"),borderBottom:"1px solid #DFE1E5",position:"relative"},...n,children:t})};h.tabsRole="TabList";let f=e=>{let{children:t,...n}=e,{theme:r}=(0,a.B7)();return(0,i.jsx)(p.OK,{...n,style:{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(r.colors.primary),color:r.colors.text,fontWeight:"500",opacity:"1",backgroundColor:"transparent"}:{borderBottom:"3px solid transparent"}},children:t})};f.tabsRole="Tab";var m=(0,u.memo)(e=>{let{children:t,Footer:n,Header:r,tabs:l,bodySx:o,footerSx:a,defaultIndex:d=0}=e,[m,x]=(0,u.useState)(d);return(0,i.jsx)(c.Z,{borderFooter:!0,footerSx:{p:0,...a},bodySx:{p:0,...o},sx:{border:"none"},Header:r,Footer:n,children:(0,i.jsxs)(p.mQ,{defaultIndex:d,onSelect:e=>x(e),children:[(0,i.jsx)(h,{children:(l||[]).map(e=>(0,i.jsx)(f,{children:e},e))}),u.Children.map(t,(e,t)=>(0,i.jsx)(s.xu,{sx:{p:e=>"calc(".concat(e.space[3],"px + 8px)"),display:t===m?"block":"none"},children:(0,i.jsx)(p.x4,{children:e})}))]})})}),x=n(80575),g=e=>{var t,n;let{text:r,sliceFieldName:l,theme:o,WidgetIcon:a}=e;return(0,i.jsxs)(s.kC,{sx:{alignItems:"center"},children:[(0,i.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,i.jsx)(s.xv,{as:"p","data-testid":"item-header-text",sx:{py:0,px:1,fontWeight:"label",fontSize:"15px"},children:r}),(0,i.jsx)(s.xv,{as:"p",sx:{display:["none","none","initial"],fontSize:"14px",ml:1,color:"textClear"},children:l})]})},v=n(55862),b=n(68169),y=n(5632),j=n(65186),k=n(7974);let S=()=>{let e=(0,y.useRouter)();return(0,i.jsxs)(s.xu,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",padding:"60px"},children:[(0,i.jsx)(j.wr$,{size:48,color:"#C9D0D8"}),(0,i.jsx)(s.xu,{sx:{height:"12px"}}),(0,i.jsx)(s.xv,{color:"text",sx:{fontWeight:600,fontSize:"24px",lineHeight:"32px",textAlign:"center"},children:"Your mock data has moved"}),(0,i.jsx)(s.xu,{sx:{height:"8px"}}),(0,i.jsx)(s.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,i.jsx)(s.xu,{sx:{height:"24px"}}),(0,i.jsx)(s.zx,{onClick:t=>{t.preventDefault(),window.open("".concat(e.asPath,"/simulator"),k.pq)},children:"Go to the Slice Simulator"})]})};var C=n(16442),_=n(45440),F=n(16086),I=n(78254),T=n(23134),E=n(89280),w=n(63397),L=n(358);function D(){let[{value:e}]=(0,w.U$)("config.label"),[{value:t},n,i]=(0,w.U$)("id"),r=(0,u.useRef)(null!=n.initialValue&&n.initialValue.length>0);(0,u.useEffect)(()=>{r.current||null==e||i.setValue((0,L.lV)(e),!1)},[e]),(0,u.useEffect)(()=>{let n=null==t||0===t.length;if(r.current){if(!n)return;r.current=!1}else n||null!=e&&t===(0,L.lV)(e)||(r.current=!0)},[t])}var M=(0,u.memo)(e=>{let{formId:t,initialValues:n,validationSchema:r,onSave:l,FormFields:o,children:a}=e;return(0,i.jsx)(s.xu,{children:(0,i.jsx)(w.J9,{initialValues:n,validationSchema:r,onSubmit:(e,t)=>{let{id:n,...i}=e;l({newKey:n,value:Object.entries(i).reduce((e,t)=>{let[n,i]=t;if(typeof i!==Boolean&&!i){var r;let t=null===(r=o[n])||void 0===r?void 0:r.defaultValue;if(void 0!==t)return{...e,[n]:t}}return{...e,[n]:i}},{})})},children:e=>(0,i.jsxs)(w.l0,{id:t,children:[(0,i.jsx)(D,{}),a({...e,initialValues:n})]})})})});function O(e){let{children:t}=e,n=(0,c.W)();return(0,i.jsx)(s.kC,{sx:{position:"sticky",zIndex:1,top:0,p:3,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n},children:t})}l().setAppElement("#__next");var A=e=>{let{close:t,data:n,fields:r,onSave:l,zoneType:c}=e,{theme:u}=(0,a.B7)(),p=(0,o.v9)(I.Ch).filter(C.TG);if(!n.isOpen)return null;let{field:[h,f]}=n,y=(0,T.t)(_.C,f.config,f.type);if(!y)return(0,i.jsxs)("div",{children:[f.type," not found"]});let{Meta:{icon:j},FormFields:k,Form:w,schema:L,label:D}=y,A={...(0,b.f7)((0,F.B9)(k,"id")),...y.prepareInitialValues?y.prepareInitialValues(p,f.config):f.config},{res:N,err:R}=(()=>{try{return{res:L.validateSync({type:f.type,config:A},{stripUnknown:!0})}}catch(e){return{err:e}}})();R&&(console.error("[EditModal] Failed to validate field of type ".concat(f.type,".\n Please update model.json accordingly.")),console.error(R));let P={id:h,config:N?N.config:A},[q,V]=k.id.validate.matches,z=d.object().shape({id:d.string().matches(q,V).min(3).max(35).required(),config:L.fields.config}),B="".concat("edit-modal-form","-").concat(Math.random().toString());return(0,i.jsx)(v.Z,{isOpen:!0,shouldCloseOnOverlayClick:!0,onRequestClose:t,contentLabel:"Widget Form Modal",children:(0,i.jsx)(M,{apiId:h,formId:B,initialValues:P,validationSchema:z,FormFields:k,onSave:e=>{let{newKey:n,value:i}=e;l({apiId:h,newKey:n,value:{...f,...i},updateMeta:{fieldIdChanged:{previousPath:[h],newPath:[n]}}}),t()},children:e=>{let{isValid:n,isSubmitting:l,initialValues:o}=e,a=w?(0,i.jsx)(w,{...e,fields:r},"field-model-tab-content"):(0,i.jsx)(x.k,{children:Object.entries(k).map(e=>{let[t,n]=e;return(0,i.jsx)(x.J,{children:(0,i.jsx)(E.Z,{fieldName:(0,b.lm)(t),formField:n,fields:r,initialValues:o,autoFocus:""===h&&void 0})},t)})},"field-model-tab-content"),d=["Field Model"],p=[a];if("slice"===c){let e=(0,i.jsx)(s.xu,{children:(0,i.jsx)(S,{})},"mock-data-tab-content");d.push("Mock Data"),p.push(e)}return(0,i.jsx)(m,{borderFooter:!0,footerSx:{position:"sticky",bottom:0,p:0},tabs:d,Header:(0,i.jsxs)(O,{children:[(0,i.jsx)(g,{theme:u,text:D,WidgetIcon:j}),(0,i.jsx)(s.x8,{onClick:t,type:"button"})]}),Footer:(0,i.jsxs)(s.kC,{sx:{position:"sticky",bottom:0,alignItems:"space-between",bg:"headSection",p:3},children:[(0,i.jsx)(s.xu,{sx:{ml:"auto"}}),(0,i.jsx)(s.zx,{mr:2,type:"button",onClick:t,variant:"secondary",children:"Cancel"}),(0,i.jsx)(s.zx,{form:B,type:"submit",disabled:!n&&l,sx:{fontWeight:"400",paddingBlock:"8px",paddingInline:"16px",fontSize:"14px",borderRadius:"4px"},children:"Done"})]}),children:p})}})})}},16182:function(e,t,n){"use strict";n.d(t,{Z:function(){return v}});var i=n(52322),r=n(2784),l=n(49857),o=n(11699);function a(e){return e.show?(0,i.jsx)(o.D,{padding:{block:8,inline:16},border:{top:!0},borderColor:"grey6",children:(0,i.jsxs)(o.bL,{variant:"normal",color:"grey11",children:["No code snippet for this field."," ",(0,i.jsx)(o.bL,{component:"a",href:"https://prismic.io/docs/fields/content-relationship",rel:"noopener noreferrer",target:"_blank",color:"grey11",underline:!0,children:"Check the docs"})," ","for an example."]})}):null}var s=n(80148),d=n(77245),c=n(8799),u=n(65186),p=n(59326),h=n(75289),f=n(38193);let m={position:"relative",top:"3px"};var x=e=>{var t,n,l;let{code:o,lang:a}=e,{theme:s}=(0,p.B7)(),[x,g]=(0,r.useState)(!1);return o?(0,i.jsxs)(h.kC,{sx:{p:2,px:3,alignItems:"center",borderTop:"1px solid",borderColor:"borders",justifyContent:"space-between"},children:[(0,i.jsxs)(h.kC,{sx:{alignItems:"center",display:["none","none","flex"],maxWidth:"80%"},children:[(0,i.jsx)(c.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,i.jsx)(f.Z,{sx:{margin:"0px 8px",border:"none",borderRadius:"3px",fontSize:"13px"},lang:a,children:o})]}),(0,i.jsx)(h.xu,{children:(0,i.jsxs)(h.zx,{"aria-label":x?"Code snippet copied":"Copy code snippet",onClick:()=>{o&&navigator.clipboard.writeText(o).then(()=>{g(!0),setTimeout(()=>{g(!1)},1200)})},variant:"textButton",children:[x?(0,i.jsx)(u.HhX,{size:16,color:null==s?void 0:null===(l=s.colors)||void 0===l?void 0:l.success,style:m}):(0,i.jsx)(d.LhG,{size:16,style:m}),(0,i.jsx)(h.xv,{as:"span",sx:{display:["none","inline","none","inline"]},children:"\xa0Copy"})]})})]}):null};let g=e=>{let{show:t,renderHintBase:n,item:r,hintItemName:o}=e,a=n({item:r}),d=[a];if("Link"===r.value.type){var c,u,p,h,f;null!==(h=null===(c=r.value.config)||void 0===c?void 0:c.allowText)&&void 0!==h&&h&&d.push("allowText"),null!==(f=null===(u=r.value.config)||void 0===u?void 0:u.repeat)&&void 0!==f&&f&&d.push("repeat"),(null===(p=r.value.config)||void 0===p?void 0:p.variants)&&d.push("variants")}let{data:m,error:g}=(0,l.ZP)(d.join("$"),async()=>await s.managerClient.snippets.readSnippets({fieldPath:a.split("."),model:r.value,itemName:o}));if(g&&console.error(g),!m||g)return null;let v=m.snippets||[];return v[0]?(0,i.jsx)("div",{style:{display:t?"initial":"none"},children:(0,i.jsx)(x,{code:v[0].code,lang:v[0].language})}):null};var v=e=>{var t;let{item:n}=e;return"Link"===n.value.type&&(null===(t=n.value.config)||void 0===t?void 0:t.select)==="document"?(0,i.jsx)(a,{show:e.show}):(0,i.jsx)(g,{...e})}},40141:function(e,t,n){"use strict";n.d(t,{Z:function(){return M}});var i=n(52322),r=n(11699),l=n(13980),o=n(2784),a=n(65077),s=n(94160),d=n(35289),c=n(6882),u=n(6609);function p(e){let{open:t,onOpenChange:n,onConfirm:l}=e;return(0,i.jsxs)(r.ae,{open:t,onOpenChange:n,size:"small",children:[(0,i.jsx)(r.al,{title:"Static zone"}),(0,i.jsx)(r.aj,{children:(0,i.jsx)(r.bn,{children:(0,i.jsxs)(r.D,{as:"article",flexDirection:"column",padding:16,gap:4,children:[(0,i.jsx)(r.bL,{sx:{marginBottom:4},color:"purple9",variant:"smallBold",children:"About"}),(0,i.jsx)(r.bL,{variant:"h3",children:"What is the static zone?"}),(0,i.jsx)(r.bL,{color:"grey11",children:"The static zone in Prismic page types contain fields that are always present on the page. Use it for essential information like a page's title, page design settings, or metadata. Unlike slices, which can be added or removed, static zone fields remain fixed."}),(0,i.jsx)(r.c8,{src:"https://res.cloudinary.com/dmtf1daqp/video/upload/v1723540305/DEV_TOOLS/STATES/Explication_vide%CC%81o_zone_statique_phibeq.mp4",sizing:"contain",autoPlay:!0,loop:!0})]})})}),(0,i.jsx)(r.ah,{children:(0,i.jsx)(r.af,{size:"medium",sx:{flexGrow:1},onClick:()=>{l(),n(!1)},children:"Got it"})})]})}var h=n(76611),f=n(5683);let m=(0,o.forwardRef)((e,t)=>{var n;return(0,i.jsx)(r.E,{...e,ref:t,startIcon:"add",color:"grey","aria-label":"Add a field","data-testid":null!==(n=e["data-testid"])&&void 0!==n?n:"add-field"})});function x(e){let{zoneTypeFormat:t,...n}=e;return"page"===t?(0,i.jsx)(v,{...n}):(0,i.jsx)(b,{...n})}let g=(0,i.jsx)("div",{style:{position:"absolute",bottom:0,right:0}});function v(e){let{disabled:t,fields:n,triggerDataTestId:l,onSelectField:a}=e,[s,d]=(0,o.useState)(!1),[c,x]=(0,o.useState)(!1),[v,b]=(0,h.V)(f.v,!1);return(0,i.jsxs)(r.D,{position:"relative",children:[(0,i.jsx)(m,{onClick:()=>{v?d(!0):x(!0)},"data-testid":l}),(0,i.jsx)(p,{open:c,onOpenChange:e=>{x(e),e||d(!0)},onConfirm:()=>b(!0)}),(0,i.jsx)(u.S,{open:s,onOpenChange:d,disabled:t,onSelectField:a,fields:n,trigger:g})]})}function b(e){let{disabled:t,fields:n,triggerDataTestId:r,onSelectField:l}=e;return(0,i.jsx)(u.S,{disabled:t,onSelectField:l,fields:n,trigger:(0,i.jsx)(m,{"data-testid":r})})}var y=n(45440),j=n(49919),k=n(40023),S=n(75289),C=n(70705),_=n(86355),F=n(23134),I=n(16182),T=e=>{let{fields:t,title:n,tabId:r,enterEditMode:l,enterSelectMode:o,onDragEnd:a,renderFieldAccessor:s,onDeleteItem:d,onSave:c,showHints:u,renderHintBase:p,isRepeatable:h,testId:f,isRepeatableCustomType:m}=e;return(0,i.jsx)(k.Z5,{onDragEnd:a,children:(0,i.jsx)(k.bK,{droppableId:n,children:(e,n)=>(0,i.jsxs)(S.xu,{as:"ul",ref:e.innerRef,...e.droppableProps,"data-testid":f,sx:{paddingInline:"16px !important"},children:[t.map((e,t)=>{let{value:{config:a,type:f}}=e,x=(0,F.t)(y.C,a,f);if(!x)return(0,i.jsx)(C.Z,{children:(0,i.jsxs)(S.xv,{children:['Field type "',f,'" not supported']})});let g={item:e,index:t,tabId:r,widget:x,showHints:u,key:e.key,enterSelectMode:o,renderFieldAccessor:s,enterEditMode:l,parentSnapshot:n,deleteItem:d,saveItem:c,draggableId:"list-item-".concat(e.key),isRepeatableCustomType:m,testId:"list-item-".concat(e.key)},v=(0,i.jsx)(I.Z,{item:e,show:u,isRepeatable:h,renderHintBase:p,hintItemName:x.hintItemName,Widgets:y.C,typeName:x.CUSTOM_NAME||x.TYPE_NAME});if(x.CustomListItem){let{CustomListItem:e}=x;return(0,i.jsx)(e,{...g,HintElement:v})}return(0,i.jsx)(_.Z,{...g,HintElement:v})}),e.placeholder]})})})},E=n(644),w=n.n(E);let L=e=>{let{zoneType:t,heading:n="Your ".concat(t," has no fields yet"),action:l}=e;return(0,i.jsxs)("div",{className:w().root,children:[(0,i.jsxs)("div",{children:[(0,i.jsx)(r.bL,{variant:"bold",children:n}),(0,i.jsx)(r.bL,{color:"grey11",children:"A field is an input for content (e.g. text, images, links)."})]}),l]})},D=e=>{let t,{zoneType:n,zoneTypeFormat:l,tabId:p,title:h,fields:f,poolOfFieldsToCheck:m,widgetsArray:g,isRepeatable:v,onDeleteItem:b,onDragEnd:k,EditModal:S,onSave:C,dataTip:_,renderHintBase:F,renderFieldAccessor:I,testId:E,isRepeatableCustomType:w,emptyStateHeading:D}=e,M=(()=>{let e=!!Object.entries(m).find(e=>{let[,{value:t}]=e;return"UID"===t.type}),t=g.filter(e=>{let{TYPE_NAME:t}=e;return"UID"!==t});return e?t:[...t,g.find(e=>{let{TYPE_NAME:t}=e;return"UID"===t})]})(),[O,A]=(0,o.useState)(!1),[N,R]=(0,o.useState)({isOpen:!1}),P={onSelectField:e=>{R({isOpen:!0,field:["",y.C[e].create("")]})},fields:M.filter(Boolean).map(e=>{let{TYPE_NAME:t,CUSTOM_NAME:n}=e;return c.XU.find(e=>e.type===t&&(void 0===n||e.variant===n))}),triggerDataTestId:v?"add-field-in-items":void 0};return"slice"===n&&f.length>0?t=(0,i.jsx)(u.S,{...P}):"customType"===n&&(t=(0,i.jsx)(x,{...P,zoneTypeFormat:l})),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(d.Bu,{actions:(0,i.jsxs)(i.Fragment,{children:[f.length>0&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.bL,{color:"grey11",component:"span",noWrap:!0,children:"Show code snippets?"}),(0,i.jsx)(r.bC,{checked:O,onCheckedChange:A,size:"small",style:{flexShrink:0},"data-testid":"code-snippets-switch"})]}),t]}),children:h}),0===f.length&&"slice"===n?(0,i.jsx)(L,{zoneType:"customType"===n?"page"===l?"page type":"custom type":n,heading:D,action:(0,i.jsx)(u.S,{...P})}):f.length>0?(0,i.jsx)(a.xR,{children:(0,i.jsx)(T,{tabId:p,isRepeatable:v,fields:f,showHints:O,dataTip:_,title:h,renderFieldAccessor:I,renderHintBase:F,enterEditMode:e=>{R({isOpen:!0,field:e});let[t,n]=e;s.Xe.track({event:"field:settings-opened",id:t,name:n.config.label,type:n.type,isInAGroup:!1,contentType:(0,j.T)(window.location.pathname)})},onDragEnd:k,onDeleteItem:b,onSave:C,testId:E,isRepeatableCustomType:w})}):void 0,(0,i.jsx)(S,{data:N,close:()=>{R({isOpen:!1})},onSave:C,fields:m,zoneType:n})]})};D.propTypes={isRepeatable:l.bool,title:l.string.isRequired,dataTip:l.string.isRequired,onSave:l.func.isRequired,onDragEnd:l.func.isRequired,onDeleteItem:l.func.isRequired,poolOfFieldsToCheck:(0,l.arrayOf)((0,l.shape)({key:l.string,value:l.object})),renderHintBase:l.func.isRequired,renderFieldAccessor:l.func.isRequired,widgetsArray:l.array.isRequired,fields:(0,l.arrayOf)((0,l.shape)({key:l.string.isRequired,value:(0,l.shape)({config:l.object,fields:l.array,type:l.string.isRequired})}))};var M=D},23134:function(e,t,n){"use strict";n.d(t,{t:function(){return r}});var i=n(59050);let r=(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]}},9889:function(e,t,n){"use strict";n.d(t,{Jp:function(){return o},OR:function(){return l}});var i=n(7974),r=n(49046);let 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)",!0),id:(0,r.II)("API ID*",{min:!0,max:!0,required:"This field is required",matches:[i.xo,"No special characters allowed (except _)"]},e=>{let{value:t,fields:n,initialId:i}=e;return t?n.find(e=>{let{key:n}=e;return n===t})&&t!==i?'Field "'.concat(t,'" already exists.'):void 0:"Field is required"},void 0,"A unique identifier for the field (e.g. buttonLink)")},o={...l,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")}},49046:function(e,t,n){"use strict";n.d(t,{II:function(){return d},Jg:function(){return l}});var i=n(68169),r=n(79256);let l=function(e){let 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"}},o=[3,"String is too short. Min: 3"],a=[35,"String is too long. Max: 35"],s=["Field is required"],d=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{min:o,max:a,required:s},n=arguments.length>2?arguments[2]:void 0,l=arguments.length>3?arguments[3]:void 0,d=arguments.length>4?arguments[4]:void 0,c=arguments.length>5&&void 0!==arguments[5]&&arguments[5],{min:u,max:p,required:h,matches:f}=t||{};return{type:r.h.INPUT,label:e,validate:{required:(0,i.MJ)(h,s),min:(0,i.MJ)(u,o),max:(0,i.MJ)(p,a),matches:f},defaultValue:l,fieldLevelValidation:n,yupType:"string",placeholder:d,autoFocus:c}}},68169:function(e,t,n){"use strict";n.d(t,{MJ:function(){return a},f7:function(){return s},gc:function(){return d},lm:function(){return o}});var i=n(65413),r=n(79256);let l=e=>null===e.defaultValue?void 0:void 0!==e.defaultValue?e.defaultValue:e.type===r.h.CHECKBOX||(e.type===r.h.INPUT?"":e.type===r.h.SELECT?[]:void 0),o=e=>"id"===e?"id":"config.".concat(e),a=(e,t)=>Array.isArray(e)?e:"boolean"==typeof e&&e?t:null,s=e=>Object.entries(e).reduce((e,t)=>{let[n,i]=t,r=l(i);return void 0!==r?{...e,[n]:r}:e},{}),d=e=>i.object().shape(Object.entries(e).filter(e=>e).reduce((e,t)=>{let[n,r]=t,{validate:l,yupType:o}=r;if(!l)return e;if("function"==typeof l)return{...e,[n]:l(n,r)};let a=i[o]();return Object.entries(l).filter(e=>e&&e[1]).forEach(e=>{let[t,i]=e;if(i&&a[t]){a=a[t](...Array.isArray(i)?i:[i]);return}console.warn('Invalid Yup validator for field "'.concat(n,'"'))}),{...e,[n]:a}},{})).required().default(void 0).noUnknown(!0)},79256: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"},45440:function(e,t,n){"use strict";n.d(t,{C:function(){return tc}});var i=n(52322),r=n(96317),l=n(65186),o=n(65413),a=n(6882),s=n(75289),d=n(80575),c=n(89280),u=n(68169),p=n(9889),h=n(49046);let f={...p.OR,repeat:(0,h.Jg)("Repeatable",!1,!0)};var m=e=>{let{initialValues:t,fields:n,values:r,setFieldValue:l}=e,{config:{repeat:o}}=r;return(0,i.jsxs)(d.k,{children:[Object.entries(f).filter(e=>{let[t]=e;return"repeat"!==t}).map(e=>{let[r,l]=e;return(0,i.jsx)(d.J,{children:(0,i.jsx)(c.Z,{fieldName:(0,u.lm)(r),formField:l,fields:n,initialValues:t})},r)}),(0,i.jsx)(d.J,{children:(0,i.jsx)(s.xu,{sx:{mt:2,alignItems:"center",display:"flex",height:"130%"},children:(0,i.jsxs)(s.__,{variant:"label.border",sx:{mb:0},children:[(0,i.jsx)(s.XZ,{checked:o,onChange:()=>l("config.repeat",!o)}),"Repeatable"]})})})]})};let x={icon:l.iy3},g=e=>o.object().shape({type:o.string().matches(e,{excludeEmptyString:!0}).required(),config:o.object().shape({fields:o.array(),label:o.string(),repeat:o.boolean().optional()})});function v(e){let{schemaTypeRegex:t,customListItem:n,customName:i,hintItemName:r}=e;return{Meta:x,Form:m,FormFields:f,schema:g(t),create:e=>({type:"Group",config:{label:e,repeat:!0,fields:[]}}),CustomListItem:n,TYPE_NAME:"Group",CUSTOM_NAME:i,hintItemName:r,label:a.U.name}}var b=n(59050),y=n(2784),j=n(40023),k=n(28316),S=n(94160),C=n(6609),_=n(86355),F=n(3285),I=n(16182),T=n(23134),E=n(49219),w=n(16086),L=n(358),D=n(49919),M=n(5495),O=n(39302);let A=e=>{let{tabId:t,widget:n,Widgets:r,widgetsArray:l,hintBase:o,parentSnapshot:d,showHints:c,isRepeatable:u,item:p,draggableId:h,saveItem:f,HintElement:m,...x}=e,[g,v]=(0,y.useState)({isOpen:!1}),A=e=>{var t;let{apiId:n,value:i}=e;null===(t=i.config)||void 0===t||t.label;let r=function(e){var t,n,i;let r=structuredClone(e.group);return null!==(n=r.config)&&void 0!==n||(r.config={}),null!==(i=(t=r.config).fields)&&void 0!==i||(t.fields={}),r.config.fields[e.fieldId]=e.field,r}({group:E.Fl.fromSM(p.value),fieldId:n,field:i});f({apiId:p.key,newKey:p.key,value:E.Fl.toSM(r),inGroupFieldAction:"add"}),(0,M.V)({id:n,field:i,isInAGroup:!0})},N=e=>{let{apiId:t,newKey:n,value:i}=e,r=i.type===b.GroupFieldType?E.Fl.fromSM(i):i,l=function(e){var t,n;let 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(let t in i.config.fields={},e.group.config.fields)t===e.previousFieldId?i.config.fields[e.newFieldId]=e.field:i.config.fields[t]=e.group.config.fields[t];return i}({group:E.Fl.fromSM(p.value),previousFieldId:t,newFieldId:n,field:r});f({apiId:p.key,newKey:p.key,value:E.Fl.toSM(l),inGroupFieldAction:"update",updateMeta:{fieldIdChanged:{previousPath:[p.key,t],newPath:[p.key,n]}}}),(0,O.Z)({previousId:t,id:n,field:r,isInAGroup:!0})},R=e=>{let t=function(e){var t,n;let i=structuredClone(e.group);return null===(n=i.config)||void 0===n||null===(t=n.fields)||void 0===t||delete t[e.fieldId],i}({group:E.Fl.fromSM(p.value),fieldId:e});f({apiId:p.key,newKey:p.key,value:E.Fl.toSM(t)})},P=e=>{v({isOpen:!0,field:e});let[t,n]=e;S.Xe.track({event:"field:settings-opened",id:t,name:n.config.label,type:n.type,isInAGroup:!0,contentType:(0,D.T)(window.location.pathname)})};return(0,i.jsxs)(y.Fragment,{children:[(0,i.jsx)(_.Z,{item:p,widget:n,draggableId:h,...x,HintElement:m,CustomEditElements:[(0,i.jsx)(C.S,{onSelectField:e=>{v({isOpen:!0,field:["",r[e].create("")]})},fields:l.filter(Boolean).map(e=>{let{TYPE_NAME:t,CUSTOM_NAME:n}=e,i=a.XU.find(e=>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,i.jsx)(s.xu,{sx:{ml:4},children:(0,i.jsx)(j.Z5,{onDragEnd:e=>{if((0,w.uS)(e))return;let{source:t,destination:n}=e;if(!n)return;let{index:i}=t,{index:r}=n,l=function(e){var t;let n=structuredClone(e.group);if(!(null===(t=n.config)||void 0===t?void 0:t.fields))return n;let i=Object.entries(n.config.fields),[r]=i.splice(e.sourceIndex,1);return i.splice(e.destinationIndex,0,r),n.config.fields=Object.fromEntries(i),n}({group:E.Fl.fromSM(p.value),sourceIndex:i,destinationIndex:r});(0,k.flushSync)(()=>{f({apiId:p.key,newKey:p.key,value:E.Fl.toSM(l)})})},children:(0,i.jsx)(j.bK,{droppableId:"".concat(t,"-").concat(p.key,"-zone"),children:e=>(0,i.jsxs)("ul",{ref:e.innerRef,...e.droppableProps,children:[p.value.config.fields.map((e,t)=>{let{value:{config:n,type:l}}=e,a=(0,T.t)(r,n,l);if(!a)return null;let s={item:e,index:t,widget:a,key:e.key,enterEditMode:P,deleteItem:R,saveItem:N,showHints:c,renderFieldAccessor:t=>"item".concat((0,L.Ti)(e.key)),draggableId:"group-".concat(p.key,"-").concat(e.key,"-").concat(t),testId:"list-item-group-".concat(p.key,"-").concat(e.key)},d=(0,i.jsx)(I.Z,{item:e,show:c,isRepeatable:u,renderHintBase:e=>{let{item:t}=e;return"".concat(o).concat((0,L.Ti)(t.key))},hintItemName:a.hintItemName,Widgets:r,typeName:a.CUSTOM_NAME||a.TYPE_NAME});if(a.CustomListItem){let{CustomListItem:e}=a;return(0,i.jsx)(e,{...s,HintElement:d})}return(0,i.jsx)(_.Z,{...s,HintElement:d})}),e.placeholder]})})})})}),(0,i.jsx)(F.Z,{data:g,close:()=>{v({isOpen:!1})},onSave:e=>""===e.apiId?A({...e,apiId:e.newKey}):N(e),fields:p.value.config.fields})]})},N={icon:l.hs8},R={label:p.Jp.label,id:p.Jp.id,placeholder_false:(0,h.II)("False Placeholder",{required:!1},null,"false","Value the content creator sees (Output as 'false' in the API)."),placeholder_true:(0,h.II)("True Placeholder",{required:!1},null,"true","Value the content creator sees (Output as 'true' in the API)"),default_value:(0,h.Jg)("Default to true")},P={TYPE_NAME:"Boolean",create:e=>({type:"Boolean",config:{label:e,default_value:!1,placeholder_true:"true",placeholder_false:"false"}}),Meta:N,schema:o.object().shape({type:o.string().matches(/^Boolean$/,{excludeEmptyString:!0}).required(),config:(0,u.gc)((0,w.B9)(R,"id"))}),FormFields:R,label:a.Qr.name},q={icon:l.U8L},{TYPE_NAME:V,FormFields:z,schema:B}=(0,w.zg)("Color"),G={create:e=>({type:"Color",config:{label:e,placeholder:""}}),FormFields:z,TYPE_NAME:V,schema:B,Meta:q,label:a.pG.name};var J=n(11699),U=n(63397);function Z(e){let{checked:t,height:n=130,setFieldValue:r}=e,[l,o]=(0,y.useState)(null);return(0,i.jsx)(d.J,{children:(0,i.jsx)(s.kC,{sx:{mt:2,alignItems:"center",height:"".concat(n,"%")},children:(0,i.jsx)(s.__,{variant:"label.border",children:(0,i.jsxs)(J.D,{display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",ref:o,children:[(0,i.jsxs)(s.kC,{children:[(0,i.jsx)(s.XZ,{checked:t,onChange:e=>{r("config.allowText",e.target.checked)}}),"Allow display text"]}),(0,i.jsx)(J.c3,{container:l,align:"end",content:"Allow editors to customize the link display text",children:(0,i.jsx)(J.aX,{name:"alert",size:"medium",color:"grey11"})})]})})})})}function H(e){let{checked:t,setFieldValue:n}=e;return(0,i.jsxs)(J.D,{flexDirection:"column",children:[(0,i.jsx)(s.__,{htmlFor:"repeat",variant:"label.primary",children:"Repeatable"}),(0,i.jsxs)(s.__,{variant:"label.border",sx:{display:"flex"},children:[(0,i.jsx)(s.XZ,{name:"repeat",checked:t,onChange:e=>{n("config.repeat",e.target.checked)}}),"Make this link repeatable (allows editors to create lists of links)"]}),(0,i.jsxs)(J.D,{alignItems:"center",gap:4,children:[(0,i.jsx)(J.aX,{name:"alert",size:"medium",color:"grey11"}),(0,i.jsxs)(J.bL,{variant:"normal",color:"grey11",children:["Repeatable link fields are returned as an array of links by the API."," ",(0,i.jsx)("a",{href:"https://prismic.io/docs/field",style:{textDecoration:"none"},target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(J.bL,{variant:"normal",color:"indigo11",children:"See documentation."})})]})]})]})}function W(e){var t,n;let{variants:r,onVariantsChange:l,error:o}=e,a=!!r,s=a?"Enabled":"Disabled",d="Options (".concat(null!==(t=null==r?void 0:r.length)&&void 0!==t?t:0,")"),c=(null!==(n=null==r?void 0:r.length)&&void 0!==n?n:0)>2,u=(0,y.useRef)();return(0,i.jsxs)(J.D,{overflow:"hidden",flexDirection:"column",border:!0,borderRadius:6,children:[(0,i.jsxs)(J.D,{border:{bottom:!0},padding:12,flexDirection:"column",gap:8,children:[(0,i.jsx)(J.bL,{variant:"h4",color:"grey12",children:"Variants"}),(0,i.jsx)(J.bL,{color:"grey12",children:'Add variants like "Primary" and "Secondary" to allow editors to choose the link\'s style by selecting one of them.'}),(0,i.jsxs)(J.D,{gap:8,children:[(0,i.jsx)(J.bC,{checked:a,onCheckedChange:e=>{l(e?["Primary","Secondary"]:void 0)}}),(0,i.jsx)(J.bL,{color:"grey11",children:s})]})]}),a&&(0,i.jsxs)(J.D,{border:{bottom:!0},padding:12,flexDirection:"column",gap:8,children:[(0,i.jsxs)(J.bL,{variant:"h5",color:"grey11",children:[d,!!o&&(0,i.jsx)(J.bL,{variant:"inherit",color:"tomato9",children:" ".concat(o)})]}),null==r?void 0:r.map((e,t)=>(0,i.jsxs)(J.D,{gap:4,alignItems:"center",children:[(0,i.jsx)(J.D,{flexGrow:1,backgroundColor:"white",padding:{inline:12,block:8},flexDirection:"column",border:!0,borderRadius:4,children:(0,i.jsx)(J.bN,{ref:e=>{u.current===t&&(u.current=void 0,null==e||e.focus())},placeholder:"Variant option (e.g. Primary)",value:e,onValueChange:e=>l(null==r?void 0:r.map((n,i)=>i===t?e:n))})}),c&&(0,i.jsx)(J.aZ,{type:"button",icon:"delete",onClick:()=>l(null==r?void 0:r.filter((e,n)=>n!==t))})]},t)),(0,i.jsx)(J.D,{children:(0,i.jsx)(J.E,{invisible:!0,startIcon:"add",onClick:()=>{u.current=null==r?void 0:r.length,l([...null!=r?r:[],""])},children:"Add option"})})]}),(0,i.jsx)(J.D,{backgroundColor:"white",flexDirection:"column",padding:12,children:(0,i.jsxs)(J.bL,{variant:"normal",color:"grey11",children:['Need additional properties similar to "Variants"?'," ",(0,i.jsx)("a",{href:"https://community.prismic.io/t/link-field-use-cases-share-your-requests-and-feedback/18146",target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"underline"},children:"Please provide your feedback here."})]})})]})}let $={...p.Jp};function X(e){var t;let{variants:n,setFieldValue:r}=e,l="config.variants",[o,a]=(0,U.U$)(l),s=null===(t=a.error)||void 0===t?void 0:t.find(e=>e);return(0,i.jsx)(W,{variants:n,onVariantsChange:e=>r(l,e),error:s})}let K={icon:l.$l_},Y=o.object().shape({label:o.string().optional(),useAsTitle:o.boolean().optional(),placeholder:o.string().optional(),select:o.string().optional().oneOf(["media","document","web",null]).nullable(),customtypes:o.array().strict().optional(),masks:o.array(o.string()).optional(),tags:o.array(o.string()).optional(),allowTargetBlank:o.boolean().strict().optional(),allowText:o.boolean().strict().optional(),repeat:o.boolean().strict().optional(),variants:o.array(o.string().trim().required("Values can't be empty")).optional()}).required().default(void 0).noUnknown(!0),Q={Meta:K,FormFields:$,schema:o.object().shape({type:o.string().matches(/^Link$/,{excludeEmptyString:!0}).required(),config:Y.optional()}),Form:e=>{let{initialValues:t,values:n,fields:r,setFieldValue:l}=e,{config:{allowText:o,repeat:a,variants:p}}=n;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(d.k,{children:[Object.entries($).map(e=>{let[n,l]=e;return(0,i.jsx)(d.J,{children:(0,i.jsx)(c.Z,{fieldName:(0,u.lm)(n),formField:l,fields:r,initialValues:t})},n)}),(0,i.jsx)(d.J,{children:(0,i.jsxs)(s.kC,{sx:{gap:2,marginTop:3},style:{paddingTop:"1px"},children:[(0,i.jsx)(d.J,{children:(0,i.jsx)(c.Z,{fieldName:(0,u.lm)("allowTargetBlank"),formField:(0,h.Jg)("Allow target blank",!1,!0),fields:r,initialValues:t})}),(0,i.jsx)(Z,{checked:o,setFieldValue:l})]})},"allowTargetBlank")]}),(0,i.jsx)(J.D,{height:8}),(0,i.jsxs)(J.D,{flexDirection:"column",gap:16,children:[(0,i.jsx)(H,{checked:a,setFieldValue:l}),(0,i.jsx)(X,{variants:p,setFieldValue:l})]})]})},create:e=>({type:"Link",config:{label:e,placeholder:"",select:null,allowTargetBlank:!0,allowText:!0,repeat:!1}}),TYPE_NAME:"Link",label:a.pV.name};var ee=n(41347);let et={label:p.Jp.label,id:p.Jp.id,customtypes:{validate:()=>o.array()}},en={icon:l.I2R},ei=Y.shape({label:o.string().max(35,"String is too long. Max: 35"),select:o.string().required().matches(/^document$/,{excludeEmptyString:!0}),customtypes:o.array().optional()}),er={create:e=>({type:"Link",config:{label:e,select:"document",repeat:!1,customtypes:[]}}),Meta:en,schema:o.object().shape({type:o.string().matches(/^Link$/,{excludeEmptyString:!0}).required(),config:ei}),TYPE_NAME:"Link",FormFields:et,CUSTOM_NAME:"ContentRelationship",Form:e=>{let{initialValues:t,values:n,setFieldValue:r,fields:l}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(d.k,{children:Object.entries(et).filter(e=>"customtypes"!==e[0]).map(e=>{let[n,r]=e;return(0,i.jsx)(d.J,{children:(0,i.jsx)(c.Z,{fieldName:(0,u.lm)(n),formField:r,fields:l,initialValues:t})},n)})}),(0,i.jsx)(s.xu,{mt:20,children:(0,i.jsx)(ee.zE,{value:n.config.customtypes,onChange:e=>{r("config.customtypes",e)}})})]})},prepareInitialValues:(e,t)=>(null==t?void 0:t.customtypes)?{...t,customtypes:t.customtypes.filter(t=>e.find(e=>"string"==typeof t?e.local.id===t:e.local.id===t.id))}:t,label:a.$U.name},{FormFields:el,schema:eo}=(0,w.zg)("Date"),ea={create:e=>({type:"Date",config:{label:e,placeholder:""}}),FormFields:el,TYPE_NAME:"Date",schema:eo,Meta:{icon:l.f$3},label:a.pt.name},{FormFields:es,schema:ed}=(0,w.zg)("Embed"),ec={create:e=>({type:"Embed",config:{label:e,placeholder:""}}),FormFields:es,TYPE_NAME:"Embed",schema:ed,Meta:{icon:l.xoN},label:a.gA.name},eu={create:e=>({type:"GeoPoint",config:{label:e}}),FormFields:{label:p.Jp.label,id:p.Jp.id},TYPE_NAME:"GeoPoint",schema:o.object().shape({type:o.string().matches(/^GeoPoint$/,{excludeEmptyString:!0}).required(),config:o.object().shape({label:o.string()}).required().default(void 0).noUnknown(!0)}),Meta:{icon:l.lPv},label:a.uG.name};var ep=n(8799),eh=n(90167),ef=n(66770);let em=e=>{let{onClick:t,error:n,onDelete:r,active:o,text:a,sx:d}=e;return(0,i.jsx)(ef.Z,{useActive:!0,fitButton:!0,error:n,onClick:t,active:o,sx:{position:"relative",width:"64px",height:"64px",...d},Icon:()=>(0,i.jsxs)(y.Fragment,{children:[(0,i.jsxs)(s.kC,{sx:{flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[(0,i.jsx)(ep.jnY,{size:22}),(0,i.jsx)(s.xv,{mt:1,children:a})]}),r?(0,i.jsx)(s.Ct,{onClick:r,variant:"circle-right",children:(0,i.jsx)(l.B4e,{})}):null]})})},ex=e=>{let{onClick:t}=e;return(0,i.jsx)(ef.Z,{fitButton:!0,onClick:t,sx:{width:"64px",height:"64px",border:e=>{let{colors:t}=e;return"1px solid ".concat(String(null==t?void 0:t.borders))}},Icon:()=>(0,i.jsx)(s.kC,{sx:{flexDirection:"column",justifyContent:"center",alignItems:"center"},children:(0,i.jsx)(ep.iTs,{size:34,color:"#5263BA","aria-label":"Add a thumbnail"})})})},eg=e=>{let{prefix:t,required:n=!1,display:r}=e,[l,o]=(0,U.U$)(t),a=n?"*":"";return r?(0,i.jsxs)(y.Fragment,{children:[(0,i.jsx)(ev,{name:"".concat(t,".name"),label:"Name".concat(a),placeholder:"main",sx:{mb:3},isConstraint:"config.constraint"===t,meta:o}),(0,i.jsx)(eb,{name:"".concat(t,".width"),label:"Width (px)".concat(a),placeholder:" ",sx:{mb:3}}),(0,i.jsx)(eb,{name:"".concat(t,".height"),label:"Height (px)".concat(a),placeholder:" "})]}):null},ev=e=>{let{name:t,label:n,placeholder:r,meta:l,isConstraint:o,...a}=e,[s]=(0,U.U$)(t);return(0,i.jsx)(eh.Hq,{...a,fieldName:t,meta:l,formField:{label:n,placeholder:r},field:o?{value:"main",readOnly:!0}:{value:s.value},variant:o?"disabled":"primary"})},eb=e=>{let{name:t,label:n,placeholder:r,...l}=e,[o,a]=(0,U.U$)(t);return(0,i.jsx)(eh.Hq,{...l,fieldName:t,formField:{label:n,placeholder:r},meta:a,field:{min:0,type:"number",value:o.value||"",onKeyDown:e=>{("e"===e.key||"-"===e.key||"+"===e.key)&&e.preventDefault()}}})},ey=()=>o.number().nullable().transform((e,t)=>""===t?null:e),ej={label:p.Jp.label,id:p.Jp.id,constraint:{validate:()=>o.object().defined().shape({width:ey(),height:ey()})},thumbnails:{validate:()=>o.array().of(o.object().test({name:"Thumbnails",message:"Must set name and width or height at minimum",test:function(e){if(!e.name)return!1;let t="number"==typeof e.width&&e.width,n="number"==typeof e.height&&e.height;return e.name&&(t||n)}}))}},ek={name:"",width:"",height:""},eS=function(){let{width:e,height:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!n||e||t?e||t?"".concat(e||"auto","x").concat(t||"auto"):"...":"auto"},eC=o.object().shape({type:o.string().matches(/^Image$/,{excludeEmptyString:!0}).required(),config:(0,u.gc)((0,w.B9)(ej,"id"))}),e_={Meta:{icon:l.Fwj},Form:e=>{let{initialValues:t,values:n,errors:r,fields:l,touched:o}=e,[a,p]=(0,y.useState)(0),{config:{thumbnails:h=[],constraint:f}}=n;return(0,y.useEffect)(()=>{p(h.length)},[h.length]),(0,i.jsxs)(d.k,{children:[Object.entries(ej).map(e=>{let[n,r]=e;return(0,i.jsx)(d.J,{children:(0,i.jsx)(c.Z,{fieldName:(0,u.lm)(n),formField:r,fields:l,initialValues:t})},n)}),(0,i.jsxs)(d.J,{children:[(0,i.jsx)(s.__,{htmlFor:"thumbnails",variant:"label.primary",sx:{mt:1,display:"flex",alignItems:"center"},children:"Responsive views*"}),(0,i.jsx)(s.Zb,{p:3,children:(0,i.jsx)(U.F2,{name:"config.thumbnails",render:t=>{let{push:n,remove:l}=t;return(0,i.jsxs)(y.Fragment,{children:[(0,i.jsxs)(s.kC,{mb:3,children:[(0,i.jsx)(em,{active:0===a,text:eS(f,!0),sx:{mr:2},onClick:()=>p(0)}),h.map((e,t)=>(0,i.jsx)(em,{sx:{mr:3},active:a===+t+1,text:eS(e),error:!!r.thumbnails&&!!o.thumbnails&&!!o.thumbnails[t]&&!!r.thumbnails&&!!r.thumbnails[t],onDelete:()=>l(t),onClick:()=>p(+t+1)},"thumbnail-button-".concat(+t+1))),(0,i.jsx)(ex,{onClick:()=>{n(ek)}})]}),(0,i.jsx)(eg,{...e,display:0===a,prefix:"config.constraint"}),h.map((t,n)=>(0,y.createElement)(eg,{...e,required:!0,key:"thumbnail-".concat(+n+1),display:a===+n+1,prefix:"config.thumbnails[".concat(n,"]")}))]})}})})]})]})},schema:eC,create:e=>({type:"Image",config:{label:e,constraint:{},thumbnails:[]}}),FormFields:ej,TYPE_NAME:"Image",label:a.tg.name},eF={...p.Jp},eI={icon:l._b$},eT=Y.shape({select:o.string().required().matches(/^media$/,{excludeEmptyString:!0})}),eE={Meta:eI,FormFields:eF,schema:o.object().shape({type:o.string().matches(/^Link$/,{excludeEmptyString:!0}).required(),config:eT.optional()}),Form:e=>{let{initialValues:t,values:n,fields:r,setFieldValue:l}=e,{config:{allowText:o,variants:a}}=n;return(0,i.jsxs)(J.D,{flexDirection:"column",gap:16,children:[(0,i.jsxs)(d.k,{children:[Object.entries(eF).map(e=>{let[n,l]=e;return(0,i.jsx)(d.J,{children:(0,i.jsx)(c.Z,{fieldName:(0,u.lm)(n),formField:l,fields:r,initialValues:t})},n)}),(0,i.jsx)(Z,{checked:o,setFieldValue:l})]}),(0,i.jsx)(X,{variants:a,setFieldValue:l})]})},create:e=>({type:"Link",config:{label:e,placeholder:"",select:"media",allowText:!0}}),TYPE_NAME:"Link",CUSTOM_NAME:"LinkToMedia",label:a.L0.name},{FormFields:ew,schema:eL}=(0,w.zg)("Number"),eD={create:e=>({type:"Number",config:{label:e,placeholder:""}}),FormFields:ew,TYPE_NAME:"Number",schema:eL,Meta:{icon:l.KZU},label:a.Wc.name};var eM=n(79256);let eO=e=>"use first value as default ".concat(e?'("'.concat(e,'")'):""),eA=(e,t)=>t?e:void 0,eN={...p.Jp,default_value:{type:eM.h.CHECKBOX,yupType:"string",defaultValue:null,validate:function(){return o.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(t=>t===e)}})},component:e=>{var t;let{values:n}=(0,U.u6)(),r=null===(t=n.config)||void 0===t?void 0:t.options[0];return(0,i.jsx)(eh.w8,{...e,defaultValue:e.field.value,controlledValue:r,setControlledValue:e.helpers.setValue,buildControlledValue:eA,label:eO})}},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:e=>!e.some(e=>!e||!e.length)}},component:e=>(0,i.jsx)(eh.kp,{label:"Options",inputPlaceholder:"Select option output in API (e.g. 'blueTheme')",buttonLabel:"Add option",...e})}},eR={icon:l.nwY},eP=o.object().shape({type:o.string().matches(/^Select$/,{excludeEmptyString:!0}).required(),config:(0,u.gc)((0,w.B9)(eN,"id"))}),eq={FormFields:eN,create:e=>({type:"Select",config:{label:e,placeholder:"",options:["1","2"]}}),schema:eP,Meta:eR,TYPE_NAME:"Select",label:a._M.name};var eV=n(47927),ez=n(29259),eB=n.n(ez),eG=n(85505),eJ=n.n(eG),eU=n(34543);let eZ=e=>t=>{let{size:n}=t;return(0,i.jsx)("span",{style:{fontSize:n},children:e})},eH=[{value:"paragraph",label:"P",icon:eZ("p")},{value:"preformatted",label:"PRE",icon:eZ("pre")},{value:"heading1",label:"H1",icon:eZ("h1")},{value:"heading2",label:"H2",icon:eZ("h2")},{value:"heading3",label:"H3",icon:eZ("h3")},{value:"heading4",label:"H4",icon:eZ("h4")},{value:"heading5",label:"H5",icon:eZ("h5")},{value:"heading6",label:"H6",icon:eZ("h6")},{value:"strong",label:"Strong",icon:eZ((0,i.jsx)("b",{children:"b"}))},{value:"em",label:"em",icon:eZ((0,i.jsx)("em",{style:{fontFamily:"serif"},children:"I"}))},{value:"hyperlink",label:"hyperlink",icon:eZ((0,i.jsx)(eU.eR7,{}))},{value:"image",label:"image",icon:eZ((0,i.jsx)(eU.LFN,{}))},{value:"embed",label:"embed",icon:eZ((0,i.jsx)(eU.xqv,{}))},{value:"list-item",label:"list",icon:eZ((0,i.jsx)(eU.SnF,{}))},{value:"o-list-item",label:"o",icon:eZ((0,i.jsx)(ep.KyO,{}))},{value:"rtl",label:"rtl",icon:eZ("rtl")}],eW=eH.map(e=>e.value),e$=e=>!eW.find(t=>!e.includes(t)),eX=e=>{let t=e.split(",");return eH.reduce((e,n)=>{let{value:i}=n;return t.includes(i)?[...e,i]:e},[])};function eK(e,t){return(0,eV.has)("parent",e)&&eB()(e.parent)&&(0,eV.has)(t,e.parent)&&eJ()(e.parent[t])?e.parent[t]:null}function eY(e){return()=>o.string().test({name:e,message:"Options cannot be empty",test:function(t,n){let i="single"===e?"multi":"single",r=eK(n,e),l=eK(n,i);return!!l&&"string"==typeof l||!("string"!=typeof r||(!r||!r.length)&&(!l||!l.length)||r.split(",").find(e=>!eW.includes(e)))}})}let eQ={...p.Jp,allowTargetBlank:(0,h.Jg)("Allow target blank for links"),single:{validate:eY("single")},multi:{validate:eY("multi")}},e0=["config.single","config.multi"],e1={icon:l.BAW},e2=o.object().shape({type:o.string().matches(/^StructuredText$/,{excludeEmptyString:!0}).required(),config:(0,u.gc)((0,w.B9)({...eQ,labels:{yupType:"array",validate:{}}},"id"))}),e5={create:e=>({type:"StructuredText",config:{label:e,placeholder:"",allowTargetBlank:!0,multi:eW.join(",")}}),FormFields:eQ,Meta:e1,schema:e2,TYPE_NAME:"StructuredText",Form:e=>{var t;let{initialValues:n,values:r,errors:l,fields:o,setFieldValue:a}=e,{config:{single:p,multi:h}}=r,f=p?eX(p):h?eX(h):eW,[m,x]=(0,y.useState)(!p),[g,v]=(0,y.useState)(f);return(0,y.useEffect)(()=>{let e=m?1:0;a(e0[e],g.join(",")),setTimeout(()=>{a(e0[1-e],void 0)},100)},[m,g]),(0,i.jsxs)(d.k,{children:[Object.entries(eQ).map(e=>{let[t,r]=e;return(0,i.jsx)(d.J,{children:(0,i.jsx)(c.Z,{fieldName:(0,u.lm)(t),formField:r,fields:o,initialValues:n})},t)}),(0,i.jsxs)(d.J,{children:[(0,i.jsxs)(s.__,{htmlFor:"accept",variant:"label.primary",sx:{mt:1,display:"flex",alignItems:"center"},children:["Accept*",(0,i.jsx)(s.zx,{type:"button",variant:"buttons.textButton",onClick:()=>{if(e$(g))return v([]);v(eW)},children:e$(g)?"Unselect All":"Select all"})]}),eH.map(e=>(0,i.jsx)(ef.Z,{fitButton:!0,useActive:!0,label:e.label,size:14,Icon:e.icon,sx:{p:"16px",mb:2,mr:2,variant:"buttons.selectIcon"},active:g.includes(e.value),onClick:()=>{if(g.find(t=>t===e.value))return v(g.filter(t=>t!==e.value));v([...g,e.value])}},e.value)),(null===(t=l.config)||void 0===t?void 0:t[m?"multi":"single"])?(0,i.jsx)(s.xu,{sx:{position:"absolute"},children:(0,i.jsx)(s.xv,{as:"span",variant:"text.labelError",pl:0,children:l.config[m?"multi":"single"]})}):null]}),(0,i.jsx)(d.J,{children:(0,i.jsx)(s.kC,{sx:{mt:2,alignItems:"center",height:"100%"},children:(0,i.jsxs)(s.__,{variant:"label.border",children:[(0,i.jsx)(s.XZ,{checked:m,onChange:()=>x(!m)}),"Allow multiple paragraphs"]})})})]})},label:a._n.name};var e6=n(18978);let e9={create:e=>({type:"Table",config:{label:e}}),FormFields:{label:p.Jp.label,id:p.Jp.id},TYPE_NAME:"Table",schema:o.object().shape({type:o.string().matches(/^Table$/,{excludeEmptyString:!0}).required(),config:o.object().shape({label:o.string()}).required().default(void 0).noUnknown(!0)}),Meta:{icon:e6.WHV},label:a.BB.name},e3=p.Jp,e4=o.object().shape({type:o.string().matches(/^Text$/,{excludeEmptyString:!0}).required(),config:(0,u.gc)((0,w.B9)(e3,"id"))}),e8={create:e=>({type:"Text",config:{label:e,placeholder:""}}),Meta:{icon:l.SQS},schema:e4,TYPE_NAME:"Text",FormFields:e3,label:a.$S.name},e7=p.Jp,te={create:e=>({type:"Timestamp",config:{label:e,placeholder:""}}),schema:o.object().shape({type:o.string().matches(/^Timestamp$/,{excludeEmptyString:!0}).required(),config:(0,u.gc)((0,w.B9)(e7,"id"))}),FormFields:e7,TYPE_NAME:"Timestamp",Meta:{icon:l.k71},label:a.UG.name},tt={label:p.Jp.label,id:{...p.Jp.id,validate:{required:"This field is required",matches:[/^uid$/,"Api ID must be 'uid' for this field."]},disabled:!0},placeholder:p.Jp.placeholder},tn=o.object().shape({type:o.string().matches(/^UID$/,{excludeEmptyString:!0}).required(),config:(0,u.gc)((0,w.B9)(tt,"id"))}),ti={Boolean:P,Color:G,ContentRelationship:er,Date:ea,Embed:ec,GeoPoint:eu,Image:e_,Link:Q,LinkToMedia:eE,Number:eD,Select:eq,StructuredText:e5,Table:e9,Text:e8,Timestamp:te,UID:{create:e=>({type:"UID",config:{label:e,placeholder:""}}),Meta:{icon:l.XN7},schema:tn,TYPE_NAME:"UID",FormFields:tt,label:a.Fj.name}},tr=[ti.Image,ti.Text,ti.StructuredText,ti.Link,ti.Select,ti.Boolean,ti.Number,ti.Color,ti.Date,ti.Table,ti.Embed,ti.Timestamp,ti.GeoPoint,ti.ContentRelationship,ti.LinkToMedia],tl="subItem",to=v({schemaTypeRegex:/^NestedGroup$/,customListItem:e=>(0,i.jsx)(A,{Widgets:ti,widgetsArray:tr,hintBase:tl,...e}),customName:"NestedGroup",hintItemName:tl}),ta={...ti,NestedGroup:to},ts=[ta.Image,ta.Text,ta.StructuredText,ta.Link,ta.Select,ta.Boolean,ta.Number,ta.Color,ta.Date,ta.Table,ta.Embed,ta.Timestamp,ta.GeoPoint,ta.ContentRelationship,ta.LinkToMedia,ta.NestedGroup],td="item",tc={Group:v({schemaTypeRegex:/^Group$/,customListItem:e=>{let t=function(){let e=(0,r.L)("slicemachine-nested-groups");return{eligible:(null==e?void 0:e.value)==="on"}}(),n=ts.filter(e=>!!t.eligible||"NestedGroup"!==e.CUSTOM_NAME);return(0,i.jsx)(A,{Widgets:ta,widgetsArray:n,hintBase:td,...e})},hintItemName:td}),NestedGroup:to,...ti}},16086:function(e,t,n){"use strict";n.d(t,{B9:function(){return o},Ss:function(){return s},uS:function(){return a},zg:function(){return d}});var i=n(65413),r=n(68169),l=n(9889);let o=(e,t)=>{let{[t]:n,...i}=e;return i},a=e=>!e.destination||e.source.index===e.destination.index||e.source.droppableId!==e.destination.droppableId,s=(e,t)=>!e[t]&&(console.log('Could not find widget with type name "'.concat(t,'".')),!0),d=e=>({TYPE_NAME:e,FormFields:l.Jp,schema:i.object().shape({type:i.string().test({name:"type",test:function(t){return t===e}}),config:(0,r.gc)(o(l.Jp,"id"))}),create:()=>({type:e,config:(0,r.f7)(o(l.Jp,"id"))})})},5683:function(e,t,n){"use strict";n.d(t,{i:function(){return l},v:function(){return r}});let i=e=>"slice-machine_".concat(e),r=i("staticFieldsInfoDialogDismissed");function l(e){let{type:t,library:n,sliceId:r,variationId:l}=e;return i(["ai-feedback",t,n,r,l].join("#"))}},49919: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}})},93155:function(e,t,n){"use strict";n.d(t,{F:function(){return r}});var i=n(41347);function r(e){var t,n,r,l,o,a;return{allowText:null===(t=e.config)||void 0===t?void 0:t.allowText,repeat:null===(n=e.config)||void 0===n?void 0:n.repeat,variants:null===(r=e.config)||void 0===r?void 0:r.variants,linkSelect:null===(l=e.config)||void 0===l?void 0:l.select,...(null===(o=e.config)||void 0===o?void 0:o.select)==="document"&&(null===(a=e.config)||void 0===a?void 0:a.customtypes)&&(()=>{var t;let{pickedFields:n,nestedPickedFields:r}=(0,i.WP)((0,i.Vg)({linkCustomtypes:null===(t=e.config)||void 0===t?void 0:t.customtypes}));return{linkPickedFields:n,linkNestedPickedFields:r}})()}}},5495:function(e,t,n){"use strict";n.d(t,{V:function(){return o}});var i=n(94160),r=n(49919),l=n(93155);function o(e){var t,n;let{id:o,field:a,isInAGroup:s=!1}=e;i.Xe.track({event:"field:added",id:o,name:null!==(n=null===(t=a.config)||void 0===t?void 0:t.label)&&void 0!==n?n:"",type:a.type,isInAGroup:s,contentType:(0,r.T)(window.location.pathname),..."Link"===a.type&&(0,l.F)(a)})}},39302:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var i=n(94160),r=n(49919),l=n(93155);function o(e){var t,n;let{id:o,previousId:a=o,field:s,isInAGroup:d=!1}=e;i.Xe.track({event:"field:updated",previousId:a,id:o,idUpdated:a!==o,name:null!==(n=null===(t=s.config)||void 0===t?void 0:t.label)&&void 0!==n?n:"",type:s.type,isInAGroup:d,contentType:(0,r.T)(window.location.pathname),..."Link"===s.type&&(0,l.F)(s)})}},13834:function(e){e.exports={flex:"List_flex__b6acG",row:"List_row__zKnOI List_flex__b6acG",root:"List_root__m_SiQ List_flex__b6acG","root-border":"List_root-border__UW3vp",child:"List_child__MJ49i List_row__zKnOI List_flex__b6acG",header:"List_header__T0WM5 List_child__MJ49i List_row__zKnOI List_flex__b6acG",headerActions:"List_headerActions__mNgLY List_row__zKnOI List_flex__b6acG",item:"List_item__LMBx4 List_child__MJ49i List_row__zKnOI List_flex__b6acG"}},644:function(e){e.exports={root:"ZoneEmptyState_root__DAfG2"}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[647],{77630:function(e,t,n){n.d(t,{AK:function(){return v},E3:function(){return p},EN:function(){return f},F$:function(){return x},H8:function(){return C},HO:function(){return h},L4:function(){return g},N3:function(){return c},Tr:function(){return d},Ue:function(){return I},eK:function(){return S},gR:function(){return b},j5:function(){return a},mf:function(){return m},vB:function(){return y},xS:function(){return j},y6:function(){return i}});var r=n(98863),o=n(88866);function i(e){var t;return null!==(t=e.format)&&void 0!==t?t:"custom"}function l(e){return Object.entries(e.json)}function s(e){return l(e).find(e=>{let[t,n]=e;return Object.values(n).some(e=>"UID"===e.type)})}function a(e){var t;let[n,r]=null!==(t=s(e))&&void 0!==t?t:[];return Object.entries(null!=r?r:{}).find(e=>{let[t,n]=e;return"UID"===n.type})}function c(e){var t,n;return null!==(n=null==e?void 0:null===(t=e.config)||void 0===t?void 0:t.label)&&void 0!==n?n:void 0}function u(e,t){let n=e.json[t];if(void 0!==n)return Object.entries(n).find(e=>{let[t,n]=e;return n.type===o.SlicesFieldType})}function d(e,t){if(function(e,t){var n;let r=u(e,t),[o,i]=null!=r?r:[];return null!==(n=null==i?void 0:i.config)&&void 0!==n?n:void 0}(e,t))return e;let n=function(e,t){let n;let r=l(e),i=r.findIndex(e=>{let[n]=e;return n===t}),s=r.flatMap(e=>{let[t,n]=e;return Object.keys(n).filter(e=>n[e].type===o.SlicesFieldType)}),a=i;do n="slices".concat(0!==a?a.toString():""),a++;while(s.includes(n));return n}(e,t);return{...e,json:{...e.json,[t]:{...e.json[t],[n]:{type:o.SlicesFieldType,fieldset:"Slice Zone"}}}}}function p(e,t){let n=e.json[t];if(void 0===n)return e;let i=Object.keys(n).find(e=>n[e].type===o.SlicesFieldType);if(void 0===i)return e;let l=(0,r.ud)(n,i);return{...e,json:{...e.json,[t]:l}}}function f(e){var t,n;let{customType:i,sectionId:l,sliceId:s}=e,a=i.json[l];if(void 0===a)return i;let c=Object.keys(a).find(e=>a[e].type===o.SlicesFieldType);if(void 0===c)return i;let u=a[c];if(u.type!==o.SlicesFieldType)return i;let d=(0,r.ud)(null!==(n=null===(t=u.config)||void 0===t?void 0:t.choices)&&void 0!==n?n:{},s);return{...i,json:{...i.json,[l]:{...a,[c]:{...u,config:{...u.config,choices:d}}}}}}function m(e){let t={...e,format:"page"},n=l(e)[0];if(n){let[e]=n;t=d(t,e)}return t}function y(e,t){return{...e,json:{...e.json,[t]:{}}}}function x(e,t){let n=(0,r.ud)(e.json,t);return{...e,json:n}}function h(e,t,n){if(t===n)return e;let r=Object.keys(e.json).reduce((r,o)=>(o===t?r[n]=e.json[o]:r[o]=e.json[o],r),{});return{...e,json:r}}function j(e){let{customType:t,sectionId:n,newField:r,newFieldId:i}=e,l=t.json[n],s=u(t,n),a={...Object.fromEntries(Object.entries(l).filter(e=>{let[t,n]=e;return n.type!==o.SlicesFieldType})),[i]:r};if(void 0!==s){let[e,t]=s;a[e]=t}return T({customType:t,sectionId:n,updatedSection:a})}function v(e){let{customType:t,sectionId:n,fieldId:o}=e,i=(0,r.ud)(t.json[n],o);return T({customType:t,sectionId:n,updatedSection:i})}function g(e){let{customType:t,sectionId:n,previousFieldId:r,newFieldId:o,newField:i}=e,l=w({fields:t.json[n],previousFieldId:r,newFieldId:o,newField:i});return T({customType:t,sectionId:n,updatedSection:l})}function b(e){let{customType:t,sectionId:n,sourceIndex:r,destinationIndex:i}=e,l=t.json[n],s=u(t,n),a=Object.fromEntries(Object.entries(l).filter(e=>{let[t,n]=e;return n.type!==o.SlicesFieldType})),c="page"===t.format&&t.repeatable,d=Object.fromEntries(Object.entries(a).filter(e=>{let[t,n]=e;return"UID"!==n.type})),p=function(e){let{fields:t,sourceIndex:n,destinationIndex:r}=e,o=Object.entries(t),[i]=o.splice(n,1);return o.splice(r,0,i),Object.fromEntries(o)}({fields:c?d:a,sourceIndex:r,destinationIndex:i});if(void 0!==s){let[e,t]=s;p[e]=t}let f=Object.entries(p),m=Object.entries(a).find(e=>{let[t,n]=e;return"UID"===n.type});m&&f.unshift(m);let y=Object.fromEntries(f);return T({customType:t,sectionId:n,updatedSection:c?y:p})}function C(e,t){let n=l(t)[0],[r]=null!=n?n:[];return void 0===r?t:j({customType:t,sectionId:r,newField:{type:"UID",config:{label:e}},newFieldId:"uid"})}function S(e,t){var n,r;let[o]=null!==(n=s(t))&&void 0!==n?n:[],[i,l]=null!==(r=a(t))&&void 0!==r?r:[];if(!l||void 0===i||void 0===o)return t;let c=w({fields:t.json[o],previousFieldId:i,newFieldId:i,newField:{...l,config:{...l.config,label:e}}});return T({customType:t,sectionId:o,updatedSection:c})}function T(e){let{customType:t,sectionId:n,updatedSection:r}=e;return{...t,json:{...t.json,[n]:r}}}function w(e){let{fields:t,previousFieldId:n,newFieldId:r,newField:o}=e;return Object.entries(t).reduce((e,t)=>{let[i,l]=t;return i===n?e[r]=o:i!==r&&(e[i]=l),e},{})}function I(e){let{id:t,label:n,repeatable:r,format:o}=e,i=!1===r&&"page"===o?{...O,...R}:!1===r?k:"page"===o?{...N,...R}:F;return{format:o,id:t,json:i,label:n,repeatable:r,status:!0}}let k={Main:{}},O={Main:{slices:{config:{choices:{}},fieldset:"Slice Zone",type:"Slices"}}},F={Main:{uid:{type:"UID",config:{label:"UID"}}}},N={Main:{...F.Main,...O.Main}},R={"SEO & Metadata":{meta_title:{config:{label:"Meta Title",placeholder:"A title of the page used for social media and search engines"},type:"Text"},meta_description:{config:{label:"Meta Description",placeholder:"A brief summary of the page"},type:"Text"},meta_image:{config:{constraint:{height:1260,width:2400},label:"Meta Image",thumbnails:[]},type:"Image"}}}},60867:function(e,t,n){n.d(t,{_:function(){return N}});var r=n(52322),o=n(14226),i=n(5632),l=n(2784),s=n(65186),a=n(59326),c=n(75289),u=n(88932),d=n(80148),p=n(98564);async function f(e){let{customType:t,onSuccess:n}=e,r=p.$[t.format];try{let{errors:e}=await d.managerClient.customTypes.deleteCustomType({id:t.id});if(e.length>0)throw e;n(),u.Am.success("".concat(r.name({start:!0,plural:!1})," deleted"))}catch(t){let e="Internal Error: ".concat(r.name({start:!0,plural:!1})," could not be deleted");console.error(e,t),u.Am.error(e)}}var m=n(33986),y=n(30527),x=n(55862),h=n(54597);let j=e=>{var t;let{customType:n,format:o,onClose:i,onDeleteCustomTypeSuccess:u}=e,d=p.$[o],[j,v]=(0,l.useState)(!1),{deleteCustomTypeSuccess:g}=(0,h.Z)(),b=async()=>{v(!0),await f({customType:n,onSuccess:()=>g(n.id)}),u()},{theme:C}=(0,a.B7)();return(0,r.jsx)(x.Z,{isOpen:!0,shouldCloseOnOverlayClick:!0,style:{content:{maxWidth:612}},onRequestClose:()=>i(),children:(0,r.jsx)(y.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:(0,r.jsxs)(c.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",alignItems:"center",justifyContent:"space-between",borderBottom:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))}},children:[(0,r.jsxs)(c.kC,{sx:{alignItems:"center"},children:[(0,r.jsx)(s.$vK,{size:20,color:null===(t=C.colors)||void 0===t?void 0:t.greyIcon}),(0,r.jsxs)(c.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:["Delete"," ",d.name({start:!1,plural:!1})]})]}),(0,r.jsx)(c.x8,{type:"button",onClick:()=>i()})]}),Footer:()=>(0,r.jsxs)(c.kC,{sx:{justifyContent:"flex-end",height:64,alignItems:"center",paddingRight:16,borderTop:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.darkBorders))},backgroundColor:"gray"},children:[(0,r.jsx)(m.z,{label:"Cancel",variant:"secondary",onClick:()=>i(),sx:{mr:"10px",fontWeight:"bold",color:"grey12",borderRadius:6}}),void 0!==n&&(0,r.jsx)(m.z,{label:"Delete",variant:"danger",isLoading:j,onClick:()=>void b(),sx:{minHeight:39,minWidth:78}})]}),children:(0,r.jsxs)("div",{children:["This action will immediately make the following change:",(0,r.jsx)("ul",{children:(0,r.jsxs)("li",{children:["Delete the"," ",(0,r.jsxs)(c.xv,{sx:{fontWeight:"bold"},children:["customtypes/",null==n?void 0:n.id,"/"]})," ","directory."]})}),"The next time you push your changes to Prismic, the following change will happen:",(0,r.jsx)("ul",{children:(0,r.jsxs)("li",{children:["Remove the"," ",d.name({start:!1,plural:!1})," and any associated Documents from your repository."]})})]})})})};var v=n(56580);async function g(e){let{model:t,newLabel:n,onSuccess:r}=e,o=p.$[t.format];try{let e={...t,label:n},{errors:i}=await d.managerClient.customTypes.renameCustomType({model:e});if(i.length>0)throw i;r(e),u.Am.success("".concat(o.name({start:!0,plural:!1})," renamed"))}catch(t){let e="Internal Error: ".concat(o.name({start:!0,plural:!1})," could not be renamed");console.error(e,t),u.Am.error(e)}}var b=n(68968),C=n(78254),S=n(59532),T=n(46999);let w=e=>{var t,n;let{isChangesLocal:o,customType:i,format:s,onClose:a,setLocalCustomType:u}=e,d=null!==(t=null==i?void 0:i.label)&&void 0!==t?t:"",f=null!==(n=null==i?void 0:i.id)&&void 0!==n?n:"",{renameCustomTypeSuccess:m}=(0,h.Z)(),{syncChanges:y}=(0,b.g)(),[x,j]=(0,l.useState)(!1),w=async e=>{j(!0),o&&u?u({customType:{...i,label:e.customTypeName}}):await g({model:i,newLabel:e.customTypeName,onSuccess:e=>{m(e),y()}}),j(!1),a()},{customTypeLabels:I}=(0,v.v9)(e=>({customTypeLabels:(0,C.YS)(e)})),k=p.$[s];return(0,r.jsx)(S.Z,{isOpen:!0,testId:"rename-custom-type-modal",widthInPx:"530px",formId:"rename-custom-type-modal-".concat(f),buttonLabel:"Rename",close:a,onSubmit:e=>void w(e),initialValues:{customTypeName:d},isLoading:x,content:{title:"Rename a ".concat(k.name({start:!1,plural:!1}))},validate:e=>{let{customTypeName:t}=e,n={};return t&&t.length||(n.customTypeName="Cannot be empty."),void 0!=n.customTypeName&&I.includes(t)&&d!==t&&(n.customTypeName="".concat(k.name({start:!0,plural:!1})," name is already taken.")),["update","insert"].includes(t.toLowerCase())&&(n.customTypeName='Name "'.concat(t,'" is reserved for Slice Machine use.')),Object.keys(n).length>0?n:void 0},children:e=>{let{errors:t}=e;return(0,r.jsx)(c.xu,{children:(0,r.jsx)(T.W,{name:"customTypeName",label:"".concat(k.name({start:!0,plural:!1})," Name"),placeholder:"A display name for the ".concat(k.name({start:!1,plural:!1})),error:t.customTypeName,testId:"custom-type-name-input"})})}})};var I=n(94160),k=n(77630);async function O(e,t){let n=p.$[e.format];try{let r=(0,k.mf)(e),{errors:o}=await (0,I.KA)({customType:r});if(o.length>0)throw o;t(r),u.Am.success("".concat(n.name({start:!0,plural:!1})," converted to page type"))}catch(t){let e="Internal Error: ".concat(n.name({start:!0,plural:!1})," not converted to page type");console.error(e,t),u.Am.error(e)}}var F=n(59294);let N=e=>{let{format:t,customType:n,isChangesLocal:s,setLocalCustomType:a}=e,c=(0,i.useRouter)(),{saveCustomTypeSuccess:u}=(0,h.Z)(),[d,p]=(0,l.useState)(!1),[f,m]=(0,l.useState)(!1),[y,x]=(0,l.useState)(!1),v=async()=>{x(!0),await O(n,u);let e=F.cd.custom.getBuilderPagePathname(n.id);if(c.asPath===e){let e=F.cd.page.getBuilderPagePathname(n.id);c.replace(e),x(!1)}else x(!1)};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(o.ar,{children:[(0,r.jsx)(o.av,{disabled:y,children:(0,r.jsx)(o.aZ,{color:"grey","data-testid":"editDropdown",hiddenLabel:"Custom type actions",icon:"moreVert",loading:y,variant:"solid"})}),(0,r.jsxs)(o.as,{align:"end",children:[(0,r.jsx)(o.at,{startIcon:(0,r.jsx)(o.aX,{name:"edit"}),onSelect:()=>{m(!0)},children:"Rename"}),"custom"===t&&!s&&(0,r.jsx)(o.at,{startIcon:(0,r.jsx)(o.aX,{name:"driveFileMove"}),onSelect:()=>void v(),children:"Convert to page type"}),(0,r.jsx)(o.at,{color:"tomato",startIcon:(0,r.jsx)(o.aX,{name:"delete"}),onSelect:()=>{p(!0)},children:"Remove"})]})]}),d?(0,r.jsx)(j,{format:t,customType:n,onClose:()=>p(!1),onDeleteCustomTypeSuccess:()=>{var e;let{tablePagePathname:t}=F.cd[null!==(e=n.format)&&void 0!==e?e:"custom"];c.asPath!==t?c.replace(t):p(!1)}}):null,f?(0,r.jsx)(w,{format:t,customType:n,isChangesLocal:s,onClose:()=>m(!1),setLocalCustomType:a}):null]})}},50477:function(e,t,n){n.d(t,{NG:function(){return a},xU:function(){return l}});var r=n(18566),o=n(2784),i=n(80148);function l(e){let t=(0,o.useCallback)(t=>(0,r.VA)(s,[e],t),[e]);return{customTypes:(0,r.QT)(s,[e]),updateCustomTypes:t}}async function s(e){let{errors:t,models:n}=await i.managerClient.customTypes.readAllCustomTypes(e?{format:e}:void 0);if(t.length>0)throw t;return n.map(e=>{let{model:t}=e;return t})}function a(e){(0,r.gw)(s,[]),(0,r.gw)(s,[e])}},33986:function(e,t,n){n.d(t,{z:function(){return a}});var r=n(52322),o=n(2784),i=n(75289);let l=(e,t)=>e?"".concat(e,"-").concat(t):"",s=e=>{switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},a=(0,o.forwardRef)((e,t)=>{let{label:n,Icon:o,type:a,form:c,isLoading:u=!1,disabled:d=!1,onClick:p,sx:f={},iconSize:m=16,iconFill:y,variant:x="primary",...h}=e;return(0,r.jsx)(i.zx,{ref:t,sx:{...f,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",...u?{cursor:"wait !important"}:{}},type:a,form:c,disabled:d||u,onClick:u?void 0:p,variant:x,...h,children:u?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.$j,{size:m,color:s(x),"data-testid":l(h["data-testid"],"spinner")}),o&&n]}):(0,r.jsxs)(r.Fragment,{children:[o&&(0,r.jsx)(o,{size:m,fill:y,"data-testid":l(h["data-testid"],"icon")}),n]})})})},46999:function(e,t,n){n.d(t,{W:function(){return l}});var r=n(52322),o=n(63397);n(2784);var i=n(75289);let l=e=>{let{name:t,label:n,placeholder:l,error:s,testId:a,onChange:c}=e;return(0,r.jsxs)(i.xu,{mb:3,children:[(0,r.jsx)(i.__,{htmlFor:t,mb:2,children:n}),(0,r.jsx)(o.gN,{name:t,type:"text",placeholder:l,as:i.II,autoComplete:"off",...c?{onChange:c}:null,...a?{"data-testid":a}:null}),s?(0,r.jsx)(i.xv,{"data-testid":a?"".concat(a,"-error"):"input-error",sx:{color:"error",mt:1},children:s}):null]})}},59532:function(e,t,n){var r=n(52322),o=n(63397),i=n(37149),l=n.n(i),s=n(75289),a=n(33986),c=n(55862),u=n(30527);function d(e){let{children:t}=e,n=(0,u.W)();return(0,r.jsx)(s.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",pl:4,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:e=>{var t;return"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.borders)}},children:t})}t.Z=function(e){let{children:t,close:n,isOpen:i,formId:p,validate:f,onSubmit:m,widthInPx:y,initialValues:x,content:{title:h},cardProps:j,omitFooter:v=!1,isLoading:g=!1,buttonLabel:b="Save",testId:C,actionMessage:S}=e;return l().setAppElement("#__next"),(0,r.jsx)(c.Z,{isOpen:i,shouldCloseOnOverlayClick:!0,onRequestClose:n,contentLabel:h,style:{content:{width:null!=y?y:"900px"}},children:(0,r.jsx)(o.J9,{initialValues:x,validate:e=>f?f(e):void 0,onSubmit:e=>{m(e)},children:e=>{let{isValid:i,isSubmitting:l,values:c,errors:f,touched:m,setFieldValue:y,setValues:x}=e;return(0,r.jsx)(o.l0,{id:p,...null!=C?{"data-testid":C}:null,children:(0,r.jsx)(u.Z,{borderFooter:!0,footerSx:{p:3,position:"sticky",bottom:0,background:"gray"},bodySx:{px:4,py:4},sx:{border:"none"},...j,Header:(0,r.jsxs)(d,{children:[(0,r.jsx)(s.X6,{sx:{fontSize:"20px"},children:h}),(0,r.jsx)(s.x8,{type:"button",onClick:n})]}),Footer:v?null:(0,r.jsxs)(s.kC,{sx:{alignItems:"space-between"},children:[(0,r.jsx)(s.kC,{sx:{fontSize:"14px",alignItems:"center"},children:"function"==typeof S?S(e):S}),(0,r.jsxs)(s.kC,{sx:{ml:"auto"},children:[(0,r.jsx)(s.zx,{mr:2,type:"button",onClick:n,variant:"secondary",disabled:l||g,children:"Cancel"}),(0,r.jsx)(a.z,{label:b,form:p,type:"submit",disabled:!i||l||g,isLoading:l||g,sx:{fontWeight:"400",paddingBlock:"8px",paddingInline:"16px",fontSize:"14px",borderRadius:"4px"}})]})]}),children:t({isValid:i,isSubmitting:l,values:c,errors:f,touched:m,setFieldValue:y,setValues:x})})})}})})}}}]);
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[647],{77630:function(e,t,n){n.d(t,{AK:function(){return v},E3:function(){return p},EN:function(){return f},F$:function(){return x},H8:function(){return C},HO:function(){return h},L4:function(){return g},N3:function(){return c},Tr:function(){return d},Ue:function(){return I},eK:function(){return S},gR:function(){return b},j5:function(){return a},mf:function(){return m},vB:function(){return y},xS:function(){return j},y6:function(){return i}});var r=n(98863),o=n(88866);function i(e){var t;return null!==(t=e.format)&&void 0!==t?t:"custom"}function l(e){return Object.entries(e.json)}function s(e){return l(e).find(e=>{let[t,n]=e;return Object.values(n).some(e=>"UID"===e.type)})}function a(e){var t;let[n,r]=null!==(t=s(e))&&void 0!==t?t:[];return Object.entries(null!=r?r:{}).find(e=>{let[t,n]=e;return"UID"===n.type})}function c(e){var t,n;return null!==(n=null==e?void 0:null===(t=e.config)||void 0===t?void 0:t.label)&&void 0!==n?n:void 0}function u(e,t){let n=e.json[t];if(void 0!==n)return Object.entries(n).find(e=>{let[t,n]=e;return n.type===o.SlicesFieldType})}function d(e,t){if(function(e,t){var n;let r=u(e,t),[o,i]=null!=r?r:[];return null!==(n=null==i?void 0:i.config)&&void 0!==n?n:void 0}(e,t))return e;let n=function(e,t){let n;let r=l(e),i=r.findIndex(e=>{let[n]=e;return n===t}),s=r.flatMap(e=>{let[t,n]=e;return Object.keys(n).filter(e=>n[e].type===o.SlicesFieldType)}),a=i;do n="slices".concat(0!==a?a.toString():""),a++;while(s.includes(n));return n}(e,t);return{...e,json:{...e.json,[t]:{...e.json[t],[n]:{type:o.SlicesFieldType,fieldset:"Slice Zone"}}}}}function p(e,t){let n=e.json[t];if(void 0===n)return e;let i=Object.keys(n).find(e=>n[e].type===o.SlicesFieldType);if(void 0===i)return e;let l=(0,r.ud)(n,i);return{...e,json:{...e.json,[t]:l}}}function f(e){var t,n;let{customType:i,sectionId:l,sliceId:s}=e,a=i.json[l];if(void 0===a)return i;let c=Object.keys(a).find(e=>a[e].type===o.SlicesFieldType);if(void 0===c)return i;let u=a[c];if(u.type!==o.SlicesFieldType)return i;let d=(0,r.ud)(null!==(n=null===(t=u.config)||void 0===t?void 0:t.choices)&&void 0!==n?n:{},s);return{...i,json:{...i.json,[l]:{...a,[c]:{...u,config:{...u.config,choices:d}}}}}}function m(e){let t={...e,format:"page"},n=l(e)[0];if(n){let[e]=n;t=d(t,e)}return t}function y(e,t){return{...e,json:{...e.json,[t]:{}}}}function x(e,t){let n=(0,r.ud)(e.json,t);return{...e,json:n}}function h(e,t,n){if(t===n)return e;let r=Object.keys(e.json).reduce((r,o)=>(o===t?r[n]=e.json[o]:r[o]=e.json[o],r),{});return{...e,json:r}}function j(e){let{customType:t,sectionId:n,newField:r,newFieldId:i}=e,l=t.json[n],s=u(t,n),a={...Object.fromEntries(Object.entries(l).filter(e=>{let[t,n]=e;return n.type!==o.SlicesFieldType})),[i]:r};if(void 0!==s){let[e,t]=s;a[e]=t}return T({customType:t,sectionId:n,updatedSection:a})}function v(e){let{customType:t,sectionId:n,fieldId:o}=e,i=(0,r.ud)(t.json[n],o);return T({customType:t,sectionId:n,updatedSection:i})}function g(e){let{customType:t,sectionId:n,previousFieldId:r,newFieldId:o,newField:i}=e,l=w({fields:t.json[n],previousFieldId:r,newFieldId:o,newField:i});return T({customType:t,sectionId:n,updatedSection:l})}function b(e){let{customType:t,sectionId:n,sourceIndex:r,destinationIndex:i}=e,l=t.json[n],s=u(t,n),a=Object.fromEntries(Object.entries(l).filter(e=>{let[t,n]=e;return n.type!==o.SlicesFieldType})),c="page"===t.format&&t.repeatable,d=Object.fromEntries(Object.entries(a).filter(e=>{let[t,n]=e;return"UID"!==n.type})),p=function(e){let{fields:t,sourceIndex:n,destinationIndex:r}=e,o=Object.entries(t),[i]=o.splice(n,1);return o.splice(r,0,i),Object.fromEntries(o)}({fields:c?d:a,sourceIndex:r,destinationIndex:i});if(void 0!==s){let[e,t]=s;p[e]=t}let f=Object.entries(p),m=Object.entries(a).find(e=>{let[t,n]=e;return"UID"===n.type});m&&f.unshift(m);let y=Object.fromEntries(f);return T({customType:t,sectionId:n,updatedSection:c?y:p})}function C(e,t){let n=l(t)[0],[r]=null!=n?n:[];return void 0===r?t:j({customType:t,sectionId:r,newField:{type:"UID",config:{label:e}},newFieldId:"uid"})}function S(e,t){var n,r;let[o]=null!==(n=s(t))&&void 0!==n?n:[],[i,l]=null!==(r=a(t))&&void 0!==r?r:[];if(!l||void 0===i||void 0===o)return t;let c=w({fields:t.json[o],previousFieldId:i,newFieldId:i,newField:{...l,config:{...l.config,label:e}}});return T({customType:t,sectionId:o,updatedSection:c})}function T(e){let{customType:t,sectionId:n,updatedSection:r}=e;return{...t,json:{...t.json,[n]:r}}}function w(e){let{fields:t,previousFieldId:n,newFieldId:r,newField:o}=e;return Object.entries(t).reduce((e,t)=>{let[i,l]=t;return i===n?e[r]=o:i!==r&&(e[i]=l),e},{})}function I(e){let{id:t,label:n,repeatable:r,format:o}=e,i=!1===r&&"page"===o?{...O,...R}:!1===r?k:"page"===o?{...N,...R}:F;return{format:o,id:t,json:i,label:n,repeatable:r,status:!0}}let k={Main:{}},O={Main:{slices:{config:{choices:{}},fieldset:"Slice Zone",type:"Slices"}}},F={Main:{uid:{type:"UID",config:{label:"UID"}}}},N={Main:{...F.Main,...O.Main}},R={"SEO & Metadata":{meta_title:{config:{label:"Meta Title",placeholder:"A title of the page used for social media and search engines"},type:"Text"},meta_description:{config:{label:"Meta Description",placeholder:"A brief summary of the page"},type:"Text"},meta_image:{config:{constraint:{height:1260,width:2400},label:"Meta Image",thumbnails:[]},type:"Image"}}}},60867:function(e,t,n){n.d(t,{_:function(){return N}});var r=n(52322),o=n(11699),i=n(5632),l=n(2784),s=n(65186),a=n(59326),c=n(75289),u=n(88932),d=n(80148),p=n(98564);async function f(e){let{customType:t,onSuccess:n}=e,r=p.$[t.format];try{let{errors:e}=await d.managerClient.customTypes.deleteCustomType({id:t.id});if(e.length>0)throw e;n(),u.Am.success("".concat(r.name({start:!0,plural:!1})," deleted"))}catch(t){let e="Internal Error: ".concat(r.name({start:!0,plural:!1})," could not be deleted");console.error(e,t),u.Am.error(e)}}var m=n(33986),y=n(30527),x=n(55862),h=n(54597);let j=e=>{var t;let{customType:n,format:o,onClose:i,onDeleteCustomTypeSuccess:u}=e,d=p.$[o],[j,v]=(0,l.useState)(!1),{deleteCustomTypeSuccess:g}=(0,h.Z)(),b=async()=>{v(!0),await f({customType:n,onSuccess:()=>g(n.id)}),u()},{theme:C}=(0,a.B7)();return(0,r.jsx)(x.Z,{isOpen:!0,shouldCloseOnOverlayClick:!0,style:{content:{maxWidth:612}},onRequestClose:()=>i(),children:(0,r.jsx)(y.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:(0,r.jsxs)(c.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",alignItems:"center",justifyContent:"space-between",borderBottom:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))}},children:[(0,r.jsxs)(c.kC,{sx:{alignItems:"center"},children:[(0,r.jsx)(s.$vK,{size:20,color:null===(t=C.colors)||void 0===t?void 0:t.greyIcon}),(0,r.jsxs)(c.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:["Delete"," ",d.name({start:!1,plural:!1})]})]}),(0,r.jsx)(c.x8,{type:"button",onClick:()=>i()})]}),Footer:()=>(0,r.jsxs)(c.kC,{sx:{justifyContent:"flex-end",height:64,alignItems:"center",paddingRight:16,borderTop:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.darkBorders))},backgroundColor:"gray"},children:[(0,r.jsx)(m.z,{label:"Cancel",variant:"secondary",onClick:()=>i(),sx:{mr:"10px",fontWeight:"bold",color:"grey12",borderRadius:6}}),void 0!==n&&(0,r.jsx)(m.z,{label:"Delete",variant:"danger",isLoading:j,onClick:()=>void b(),sx:{minHeight:39,minWidth:78}})]}),children:(0,r.jsxs)("div",{children:["This action will immediately make the following change:",(0,r.jsx)("ul",{children:(0,r.jsxs)("li",{children:["Delete the"," ",(0,r.jsxs)(c.xv,{sx:{fontWeight:"bold"},children:["customtypes/",null==n?void 0:n.id,"/"]})," ","directory."]})}),"The next time you push your changes to Prismic, the following change will happen:",(0,r.jsx)("ul",{children:(0,r.jsxs)("li",{children:["Remove the"," ",d.name({start:!1,plural:!1})," and any associated Documents from your repository."]})})]})})})};var v=n(56580);async function g(e){let{model:t,newLabel:n,onSuccess:r}=e,o=p.$[t.format];try{let e={...t,label:n},{errors:i}=await d.managerClient.customTypes.renameCustomType({model:e});if(i.length>0)throw i;r(e),u.Am.success("".concat(o.name({start:!0,plural:!1})," renamed"))}catch(t){let e="Internal Error: ".concat(o.name({start:!0,plural:!1})," could not be renamed");console.error(e,t),u.Am.error(e)}}var b=n(68968),C=n(78254),S=n(59532),T=n(46999);let w=e=>{var t,n;let{isChangesLocal:o,customType:i,format:s,onClose:a,setLocalCustomType:u}=e,d=null!==(t=null==i?void 0:i.label)&&void 0!==t?t:"",f=null!==(n=null==i?void 0:i.id)&&void 0!==n?n:"",{renameCustomTypeSuccess:m}=(0,h.Z)(),{syncChanges:y}=(0,b.g)(),[x,j]=(0,l.useState)(!1),w=async e=>{j(!0),o&&u?u({customType:{...i,label:e.customTypeName}}):await g({model:i,newLabel:e.customTypeName,onSuccess:e=>{m(e),y()}}),j(!1),a()},{customTypeLabels:I}=(0,v.v9)(e=>({customTypeLabels:(0,C.YS)(e)})),k=p.$[s];return(0,r.jsx)(S.Z,{isOpen:!0,testId:"rename-custom-type-modal",widthInPx:"530px",formId:"rename-custom-type-modal-".concat(f),buttonLabel:"Rename",close:a,onSubmit:e=>void w(e),initialValues:{customTypeName:d},isLoading:x,content:{title:"Rename a ".concat(k.name({start:!1,plural:!1}))},validate:e=>{let{customTypeName:t}=e,n={};return t&&t.length||(n.customTypeName="Cannot be empty."),void 0!=n.customTypeName&&I.includes(t)&&d!==t&&(n.customTypeName="".concat(k.name({start:!0,plural:!1})," name is already taken.")),["update","insert"].includes(t.toLowerCase())&&(n.customTypeName='Name "'.concat(t,'" is reserved for Slice Machine use.')),Object.keys(n).length>0?n:void 0},children:e=>{let{errors:t}=e;return(0,r.jsx)(c.xu,{children:(0,r.jsx)(T.W,{name:"customTypeName",label:"".concat(k.name({start:!0,plural:!1})," Name"),placeholder:"A display name for the ".concat(k.name({start:!1,plural:!1})),error:t.customTypeName,testId:"custom-type-name-input"})})}})};var I=n(94160),k=n(77630);async function O(e,t){let n=p.$[e.format];try{let r=(0,k.mf)(e),{errors:o}=await (0,I.KA)({customType:r});if(o.length>0)throw o;t(r),u.Am.success("".concat(n.name({start:!0,plural:!1})," converted to page type"))}catch(t){let e="Internal Error: ".concat(n.name({start:!0,plural:!1})," not converted to page type");console.error(e,t),u.Am.error(e)}}var F=n(59294);let N=e=>{let{format:t,customType:n,isChangesLocal:s,setLocalCustomType:a}=e,c=(0,i.useRouter)(),{saveCustomTypeSuccess:u}=(0,h.Z)(),[d,p]=(0,l.useState)(!1),[f,m]=(0,l.useState)(!1),[y,x]=(0,l.useState)(!1),v=async()=>{x(!0),await O(n,u);let e=F.cd.custom.getBuilderPagePathname(n.id);if(c.asPath===e){let e=F.cd.page.getBuilderPagePathname(n.id);c.replace(e),x(!1)}else x(!1)};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(o.ar,{children:[(0,r.jsx)(o.av,{disabled:y,children:(0,r.jsx)(o.aZ,{color:"grey","data-testid":"editDropdown",hiddenLabel:"Custom type actions",icon:"moreVert",loading:y,variant:"solid"})}),(0,r.jsxs)(o.as,{align:"end",children:[(0,r.jsx)(o.at,{startIcon:(0,r.jsx)(o.aX,{name:"edit"}),onSelect:()=>{m(!0)},children:"Rename"}),"custom"===t&&!s&&(0,r.jsx)(o.at,{startIcon:(0,r.jsx)(o.aX,{name:"driveFileMove"}),onSelect:()=>void v(),children:"Convert to page type"}),(0,r.jsx)(o.at,{color:"tomato",startIcon:(0,r.jsx)(o.aX,{name:"delete"}),onSelect:()=>{p(!0)},children:"Remove"})]})]}),d?(0,r.jsx)(j,{format:t,customType:n,onClose:()=>p(!1),onDeleteCustomTypeSuccess:()=>{var e;let{tablePagePathname:t}=F.cd[null!==(e=n.format)&&void 0!==e?e:"custom"];c.asPath!==t?c.replace(t):p(!1)}}):null,f?(0,r.jsx)(w,{format:t,customType:n,isChangesLocal:s,onClose:()=>m(!1),setLocalCustomType:a}):null]})}},50477:function(e,t,n){n.d(t,{NG:function(){return a},xU:function(){return l}});var r=n(18566),o=n(2784),i=n(80148);function l(e){let t=(0,o.useCallback)(t=>(0,r.VA)(s,[e],t),[e]);return{customTypes:(0,r.QT)(s,[e]),updateCustomTypes:t}}async function s(e){let{errors:t,models:n}=await i.managerClient.customTypes.readAllCustomTypes(e?{format:e}:void 0);if(t.length>0)throw t;return n.map(e=>{let{model:t}=e;return t})}function a(e){(0,r.gw)(s,[]),(0,r.gw)(s,[e])}},33986:function(e,t,n){n.d(t,{z:function(){return a}});var r=n(52322),o=n(2784),i=n(75289);let l=(e,t)=>e?"".concat(e,"-").concat(t):"",s=e=>{switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},a=(0,o.forwardRef)((e,t)=>{let{label:n,Icon:o,type:a,form:c,isLoading:u=!1,disabled:d=!1,onClick:p,sx:f={},iconSize:m=16,iconFill:y,variant:x="primary",...h}=e;return(0,r.jsx)(i.zx,{ref:t,sx:{...f,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",...u?{cursor:"wait !important"}:{}},type:a,form:c,disabled:d||u,onClick:u?void 0:p,variant:x,...h,children:u?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.$j,{size:m,color:s(x),"data-testid":l(h["data-testid"],"spinner")}),o&&n]}):(0,r.jsxs)(r.Fragment,{children:[o&&(0,r.jsx)(o,{size:m,fill:y,"data-testid":l(h["data-testid"],"icon")}),n]})})})},46999:function(e,t,n){n.d(t,{W:function(){return l}});var r=n(52322),o=n(63397);n(2784);var i=n(75289);let l=e=>{let{name:t,label:n,placeholder:l,error:s,testId:a,onChange:c}=e;return(0,r.jsxs)(i.xu,{mb:3,children:[(0,r.jsx)(i.__,{htmlFor:t,mb:2,children:n}),(0,r.jsx)(o.gN,{name:t,type:"text",placeholder:l,as:i.II,autoComplete:"off",...c?{onChange:c}:null,...a?{"data-testid":a}:null}),s?(0,r.jsx)(i.xv,{"data-testid":a?"".concat(a,"-error"):"input-error",sx:{color:"error",mt:1},children:s}):null]})}},59532:function(e,t,n){var r=n(52322),o=n(63397),i=n(37149),l=n.n(i),s=n(75289),a=n(33986),c=n(55862),u=n(30527);function d(e){let{children:t}=e,n=(0,u.W)();return(0,r.jsx)(s.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",pl:4,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:e=>{var t;return"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.borders)}},children:t})}t.Z=function(e){let{children:t,close:n,isOpen:i,formId:p,validate:f,onSubmit:m,widthInPx:y,initialValues:x,content:{title:h},cardProps:j,omitFooter:v=!1,isLoading:g=!1,buttonLabel:b="Save",testId:C,actionMessage:S}=e;return l().setAppElement("#__next"),(0,r.jsx)(c.Z,{isOpen:i,shouldCloseOnOverlayClick:!0,onRequestClose:n,contentLabel:h,style:{content:{width:null!=y?y:"900px"}},children:(0,r.jsx)(o.J9,{initialValues:x,validate:e=>f?f(e):void 0,onSubmit:e=>{m(e)},children:e=>{let{isValid:i,isSubmitting:l,values:c,errors:f,touched:m,setFieldValue:y,setValues:x}=e;return(0,r.jsx)(o.l0,{id:p,...null!=C?{"data-testid":C}:null,children:(0,r.jsx)(u.Z,{borderFooter:!0,footerSx:{p:3,position:"sticky",bottom:0,background:"gray"},bodySx:{px:4,py:4},sx:{border:"none"},...j,Header:(0,r.jsxs)(d,{children:[(0,r.jsx)(s.X6,{sx:{fontSize:"20px"},children:h}),(0,r.jsx)(s.x8,{type:"button",onClick:n})]}),Footer:v?null:(0,r.jsxs)(s.kC,{sx:{alignItems:"space-between"},children:[(0,r.jsx)(s.kC,{sx:{fontSize:"14px",alignItems:"center"},children:"function"==typeof S?S(e):S}),(0,r.jsxs)(s.kC,{sx:{ml:"auto"},children:[(0,r.jsx)(s.zx,{mr:2,type:"button",onClick:n,variant:"secondary",disabled:l||g,children:"Cancel"}),(0,r.jsx)(a.z,{label:b,form:p,type:"submit",disabled:!i||l||g,isLoading:l||g,sx:{fontWeight:"400",paddingBlock:"8px",paddingInline:"16px",fontSize:"14px",borderRadius:"4px"}})]})]}),children:t({isValid:i,isSubmitting:l,values:c,errors:f,touched:m,setFieldValue:y,setValues:x})})})}})})}}}]);