slice-machine-ui 2.14.3-beta.8 → 2.15.0

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 (29) hide show
  1. package/out/404.html +1 -1
  2. package/out/_next/static/{U6AYvW_IA53HHkwiXPzf8 → 5Yc5bbUW2HfFYMCbchihS}/_buildManifest.js +1 -1
  3. package/out/_next/static/chunks/746-47ffb3fe3bdaf9e4.js +1 -0
  4. package/out/_next/static/chunks/pages/{_app-a38169e84d4f8512.js → _app-9525c4a276f4c35f.js} +1 -1
  5. package/out/_next/static/chunks/pages/slices-27eebe7631d6cde5.js +1 -0
  6. package/out/changelog.html +1 -1
  7. package/out/changes.html +1 -1
  8. package/out/custom-types/[customTypeId].html +1 -1
  9. package/out/custom-types.html +1 -1
  10. package/out/index.html +1 -1
  11. package/out/labs.html +1 -1
  12. package/out/page-types/[pageTypeId].html +1 -1
  13. package/out/settings.html +1 -1
  14. package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
  15. package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
  16. package/out/slices.html +1 -1
  17. package/package.json +4 -5
  18. package/src/features/builder/useAiSliceGenerationExperiment.ts +1 -1
  19. package/src/features/customTypes/customTypesBuilder/GenerateSliceWithAiModal/GenerateSliceWithAiModal.tsx +11 -2
  20. package/src/features/slices/actions/createSlice.ts +4 -1
  21. package/src/features/slicesTemplates/actions/createSlicesTemplates.ts +4 -1
  22. package/src/legacy/components/Forms/CreateSliceModal/CreateSliceModal.tsx +3 -0
  23. package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/SlicesTemplatesModal.tsx +3 -0
  24. package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/index.tsx +18 -5
  25. package/src/pages/slices.tsx +1 -0
  26. package/test/pages/slices.test.tsx +4 -2
  27. package/out/_next/static/chunks/746-fcfebd9eace20d68.js +0 -1
  28. package/out/_next/static/chunks/pages/slices-f42c28ddc74a5b2b.js +0 -1
  29. /package/out/_next/static/{U6AYvW_IA53HHkwiXPzf8 → 5Yc5bbUW2HfFYMCbchihS}/_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/875f5e80d87cb5ef.css" as="style"/><link rel="stylesheet" href="/_next/static/css/875f5e80d87cb5ef.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-a31bc948075f7bde.js" defer=""></script><script src="/_next/static/chunks/main-8e15d66b38d840e9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-a38169e84d4f8512.js" defer=""></script><script src="/_next/static/chunks/pages/_error-1b183d3cf5ea03f9.js" defer=""></script><script src="/_next/static/U6AYvW_IA53HHkwiXPzf8/_buildManifest.js" defer=""></script><script src="/_next/static/U6AYvW_IA53HHkwiXPzf8/_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":"U6AYvW_IA53HHkwiXPzf8","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/875f5e80d87cb5ef.css" as="style"/><link rel="stylesheet" href="/_next/static/css/875f5e80d87cb5ef.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js"></script><script src="/_next/static/chunks/webpack-2f903acb0cccbf9e.js" defer=""></script><script src="/_next/static/chunks/framework-a31bc948075f7bde.js" defer=""></script><script src="/_next/static/chunks/main-8e15d66b38d840e9.js" defer=""></script><script src="/_next/static/chunks/pages/_app-9525c4a276f4c35f.js" defer=""></script><script src="/_next/static/chunks/pages/_error-1b183d3cf5ea03f9.js" defer=""></script><script src="/_next/static/5Yc5bbUW2HfFYMCbchihS/_buildManifest.js" defer=""></script><script src="/_next/static/5Yc5bbUW2HfFYMCbchihS/_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":"5Yc5bbUW2HfFYMCbchihS","runtimeConfig":{"sentryEnvironment":"production"},"nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
@@ -1 +1 @@
1
- self.__BUILD_MANIFEST=function(s,c,a,e,t,i,d,n,u,f,b,h,l,p,k,j,g,o){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":[a,p,k,"static/chunks/pages/index-48edd85de6369519.js"],"/_error":["static/chunks/pages/_error-1b183d3cf5ea03f9.js"],"/changelog":[s,e,"static/chunks/870-a72b74312773efea.js","static/chunks/pages/changelog-fd749acf98af82da.js"],"/changes":[s,t,"static/chunks/8eec4907-b712959d9f984b68.js","static/chunks/918-38ab72e6ee071fec.js",c,d,"static/css/d98ebc475f8423a3.css","static/chunks/pages/changes-7b550c4afcca3e66.js"],"/custom-types":[a,p,k,"static/chunks/pages/custom-types-4f95d75a29e9c7b1.js"],"/custom-types/[customTypeId]":[s,n,u,f,b,e,i,h,j,c,a,l,g,o,"static/chunks/pages/custom-types/[customTypeId]-c11cbcc5b5c1fb09.js"],"/labs":["static/chunks/pages/labs-41db727cff0af1a9.js"],"/page-types/[pageTypeId]":[s,n,u,f,b,e,i,h,j,c,a,l,g,o,"static/chunks/pages/page-types/[pageTypeId]-b82a6c15d600adf4.js"],"/settings":["static/css/e5f781f20e24a5ea.css","static/chunks/pages/settings-4efa7c64dc4f2468.js"],"/slices":[s,t,i,c,d,"static/css/efa5152b7c0f35c0.css","static/chunks/pages/slices-f42c28ddc74a5b2b.js"],"/slices/[lib]/[sliceName]/[variation]":[s,t,n,u,f,b,e,i,h,c,l,d,"static/css/cdee5b195444f185.css","static/chunks/pages/slices/[lib]/[sliceName]/[variation]-cedaecc2d2d88e13.js"],"/slices/[lib]/[sliceName]/[variation]/simulator":[t,"static/chunks/72585f70-28b4d7d5384b3703.js","static/chunks/157-7733f7f59581b0b5.js","static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-5b65c5cb79e1e66a.js"],sortedPages:["/","/_app","/_error","/changelog","/changes","/custom-types","/custom-types/[customTypeId]","/labs","/page-types/[pageTypeId]","/settings","/slices","/slices/[lib]/[sliceName]/[variation]","/slices/[lib]/[sliceName]/[variation]/simulator"]}}("static/chunks/59b4e022-8e544a511d670317.js","static/chunks/772-dc8d1f404dd4eed4.js","static/chunks/910-1979bde4d15e9a4b.js","static/chunks/183-b1a9f55f45cb8d8e.js","static/chunks/c8eae200-966ce352f7b5d2b9.js","static/chunks/50-586dc7ab5e584e76.js","static/chunks/639-424b570eee9a37fb.js","static/chunks/f36c6662-1f3a854183168b10.js","static/chunks/4c744e84-480e426e4b1cfef3.js","static/chunks/065a3ddb-9a38ca0d60f0bf2f.js","static/chunks/1cc2734a-09fb3b997ad1eb70.js","static/chunks/434-c7ad3ff97354e3b7.js","static/chunks/574-bbaa5391396443f5.js","static/chunks/764-dd770255e3082305.js","static/css/4e475d945cf8a890.css","static/chunks/479-6205c85aa978fc0b.js","static/chunks/746-fcfebd9eace20d68.js","static/css/56f2a6684a524374.css"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
1
+ self.__BUILD_MANIFEST=function(s,c,a,e,t,i,d,n,u,b,f,h,l,p,k,j,g,o){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":[a,p,k,"static/chunks/pages/index-48edd85de6369519.js"],"/_error":["static/chunks/pages/_error-1b183d3cf5ea03f9.js"],"/changelog":[s,e,"static/chunks/870-a72b74312773efea.js","static/chunks/pages/changelog-fd749acf98af82da.js"],"/changes":[s,t,"static/chunks/8eec4907-b712959d9f984b68.js","static/chunks/918-38ab72e6ee071fec.js",c,d,"static/css/d98ebc475f8423a3.css","static/chunks/pages/changes-7b550c4afcca3e66.js"],"/custom-types":[a,p,k,"static/chunks/pages/custom-types-4f95d75a29e9c7b1.js"],"/custom-types/[customTypeId]":[s,n,u,b,f,e,i,h,j,c,a,l,g,o,"static/chunks/pages/custom-types/[customTypeId]-c11cbcc5b5c1fb09.js"],"/labs":["static/chunks/pages/labs-41db727cff0af1a9.js"],"/page-types/[pageTypeId]":[s,n,u,b,f,e,i,h,j,c,a,l,g,o,"static/chunks/pages/page-types/[pageTypeId]-b82a6c15d600adf4.js"],"/settings":["static/css/e5f781f20e24a5ea.css","static/chunks/pages/settings-4efa7c64dc4f2468.js"],"/slices":[s,t,i,c,d,"static/css/efa5152b7c0f35c0.css","static/chunks/pages/slices-27eebe7631d6cde5.js"],"/slices/[lib]/[sliceName]/[variation]":[s,t,n,u,b,f,e,i,h,c,l,d,"static/css/cdee5b195444f185.css","static/chunks/pages/slices/[lib]/[sliceName]/[variation]-cedaecc2d2d88e13.js"],"/slices/[lib]/[sliceName]/[variation]/simulator":[t,"static/chunks/72585f70-28b4d7d5384b3703.js","static/chunks/157-7733f7f59581b0b5.js","static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-5b65c5cb79e1e66a.js"],sortedPages:["/","/_app","/_error","/changelog","/changes","/custom-types","/custom-types/[customTypeId]","/labs","/page-types/[pageTypeId]","/settings","/slices","/slices/[lib]/[sliceName]/[variation]","/slices/[lib]/[sliceName]/[variation]/simulator"]}}("static/chunks/59b4e022-8e544a511d670317.js","static/chunks/772-dc8d1f404dd4eed4.js","static/chunks/910-1979bde4d15e9a4b.js","static/chunks/183-b1a9f55f45cb8d8e.js","static/chunks/c8eae200-966ce352f7b5d2b9.js","static/chunks/50-586dc7ab5e584e76.js","static/chunks/639-424b570eee9a37fb.js","static/chunks/f36c6662-1f3a854183168b10.js","static/chunks/4c744e84-480e426e4b1cfef3.js","static/chunks/065a3ddb-9a38ca0d60f0bf2f.js","static/chunks/1cc2734a-09fb3b997ad1eb70.js","static/chunks/434-c7ad3ff97354e3b7.js","static/chunks/574-bbaa5391396443f5.js","static/chunks/764-dd770255e3082305.js","static/css/4e475d945cf8a890.css","static/chunks/479-6205c85aa978fc0b.js","static/chunks/746-47ffb3fe3bdaf9e4.js","static/css/56f2a6684a524374.css"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[746],{12746:function(e,t,l){"use strict";l.d(t,{H:function(){return e7}});var i=l(52322),n=l(7729),a=l(97729),r=l.n(a),s=l(5632),o=l(2784),c=l(56580),d=l(23335),u=l(93216),m=l(6697),h=l(63447),x=l(5335),p=l(74217),v=l(93188),g=l(80546),y=l(43874),f=l(41067),j=l(77507);let b=(0,o.createContext)(void 0);function S(e){let{children:t,initialCustomType:l}=e,[n,a]=(0,o.useState)(l),r=(0,u.y6)(n),s=j.$[r],{actionQueueStatus:c,setNextAction:d}=(0,y.c)({errorMessage:s.autoSaveFailed}),{saveCustomTypeSuccess:m}=(0,f.Z)(),h=(0,p.R9)(m),{syncChanges:x}=(0,g.g)(),S=(0,o.useCallback)((e,t)=>{a(e),d(async()=>{let{errors:l}=await (0,v.KA)(e);if(l.length>0)throw l;h(e),x(),null==t||t()})},[d,h,x]),C=(0,o.useMemo)(()=>({actionQueueStatus:c,customType:n,setCustomType:S}),[c,n,S]);return(0,i.jsx)(b.Provider,{value:C,children:"function"==typeof t?t(C):t})}function C(){let e=(0,o.useContext)(b);if(!e)throw Error("CustomTypeProvider not found");return e}var I=l(30195);function T(){var e;let[t,l]=(0,o.useState)(!1),{customType:a,setCustomType:r}=C(),[s,c]=null!==(e=(0,u.j5)(a))&&void 0!==e?e:[],d=c?(0,u.N3)(c):"",[m,h]=(0,o.useState)(null!=d?d:""),[x,v]=(0,o.useState)();(0,p.pQ)(t,()=>{t||(h(null!=d?d:""),v(void 0))});let g=(0,o.useCallback)(()=>(0,i.jsx)(n.JO$,{name:c?"language":"add",size:"small",color:"grey11"}),[c]);return(0,i.jsxs)(n.VqE,{open:t,onOpenChange:l,size:"small",trigger:(0,i.jsx)(n.zxk,{color:"grey",textColor:"placeholder",textWeight:"normal",renderStartIcon:g,sx:{marginInline:"auto"},children:c?d:"Add an UID"}),children:[(0,i.jsx)(n.fKu,{title:"Edit the UID label"}),(0,i.jsx)(n.cZJ,{children:(0,i.jsxs)(n.l09,{onSubmit:function(){x||(r(c?(0,u.eK)(m,a):(0,u.H8)(m,a)),l(!1))},children:[(0,i.jsx)(n.xuv,{flexDirection:"column",padding:16,gap:4,children:(0,i.jsx)(n.ytj,{type:"text",label:"Label *",placeholder:"UID",value:m,onValueChange:function(e){h(e),v(function(e){let t=w.safeParse(e,{errorMap:D});if(t.error)return t.error.errors[0].message}(e))},error:x,description:"A label for the UID"})}),(0,i.jsxs)(n.kXR,{children:[(0,i.jsx)(n.POh,{size:"medium"}),(0,i.jsx)(n._dX,{type:"submit",size:"medium",disabled:!!x,children:"Save"})]})]})})]})}let w=I.z.string().max(35).min(1),D=e=>{switch(e.code){case I.z.ZodIssueCode.too_big:return{message:"The label can't be longer than ".concat(e.maximum," characters")};case I.z.ZodIssueCode.too_small:return{message:"This field is required"};default:return{message:"Invalid value"}}};var k=l(95799),_=l(1490),A=l(63397),N=l(75289);let z=e=>{let{name:t,label:l,placeholder:n,error:a,...r}=e;return(0,i.jsxs)(N.xu,{mb:3,children:[(0,i.jsx)(N.__,{htmlFor:t,mb:2,children:l}),(0,i.jsx)(A.gN,{name:t,type:"text",placeholder:n,as:N.II,autoComplete:"off",...r}),a?(0,i.jsx)(N.xv,{sx:{color:"error",mt:1},children:a}):null]})};var Z=e=>{let{isOpen:t,onSubmit:l,close:n,tabIds:a}=e;return(0,i.jsx)(_.Z,{isOpen:t,widthInPx:"530px",formId:"create-tab",close:n,onSubmit:e=>{l(e),n()},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,i.jsx)(z,{name:"id",label:"New Tab ID",placeholder:"A label for selecting the tab (i.e. not used in the API)",error:t.id})}})},E=e=>{let{isOpen:t,onSubmit:l,close:n}=e;return(0,i.jsx)(_.Z,{omitFooter:!0,isOpen:t,widthInPx:"530px",formId:"create-tab",close:n,cardProps:{bodySx:{p:0}},onSubmit:e=>{l(e),n()},initialValues:{},content:{title:"Remove Tab"},children:()=>(0,i.jsxs)(N.xu,{sx:{px:4,py:4},children:[(0,i.jsx)(N.X6,{as:"h4",children:"Remove this tab?"}),(0,i.jsx)(N.xv,{as:"p",color:"textClear",sx:{mt:2},children:"This action cannot be undone."}),(0,i.jsx)(N.zx,{type:"button",variant:"buttons.actionDelete",sx:{mt:3},onClick:()=>{l({}),n()},children:"Yes, remove tab"})]})})},M=e=>{let{isOpen:t,onSubmit:l,close:n,tabIds:a,initialTabKey:r}=e;return(0,i.jsx)(_.Z,{omitFooter:!0,isOpen:t,widthInPx:"530px",formId:"create-tab",close:n,cardProps:{bodySx:{p:0}},onSubmit:e=>{l(e),n()},initialValues:{id:r},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:r,isValid:s}=e;return(0,i.jsxs)(N.xu,{sx:{px:4,py:4},children:[(0,i.jsx)(z,{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&&r("id",e.target.value.trim())},onChange:e=>{r("id",e.target.value)}}),(0,i.jsx)(N.zx,{type:"button",sx:{mt:3,width:"100%"},disabled:!s,onClick:()=>{a.id&&a.id.length&&l({id:a.id.trim()}),n()},children:"Save"})]})}})},O=l(28316),F=l(88932),P=l(80775),U=l(30988),R=l(18493),L=l(85357),K=l(99510),V=l(50268),X=l(44266),B=l(64602),G=l(47655),$=l(65077),J=l(53085);function q(){let e=(0,J.L)("slicemachine-image-to-slice");return{eligible:(null==e?void 0:e.value)==="on"}}var H=l(70647),Q=l(80218);function Y(e){let{slice:t}=e,l="uploading"===t.status||"generating"===t.status,a="uploadError"===t.status||"generateError"===t.status,r="generateError"===t.status||"generating"===t.status||"success"===t.status;return(0,i.jsxs)(Q.Zb,{disabled:l,children:[r?(0,i.jsx)(Q.ZB,{src:t.thumbnailUrl}):(0,i.jsx)(Q.ZB,{component:"div"}),(0,i.jsx)(Q.eW,{loading:l,startIcon:function(e){switch(e){case"uploadError":case"generateError":return"close";case"success":return"check";default:return}}(t.status),title:"success"===t.status?t.model.name:t.image.name,subtitle:function(e){switch(e){case"uploading":return"Uploading...";case"uploadError":return"Unable to upload image";case"generating":return"Generating...";case"generateError":return"Something went wrong";case"success":return"Generated"}}(t.status),error:a,action:a?(0,i.jsx)(n.zxk,{startIcon:"refresh",color:"grey",onClick:t.onRetry,children:"Retry"}):void 0})]})}function W(e){let{open:t,onSuccess:l,onClose:a}=e,[r,s]=(0,o.useState)([]),[c,d]=(0,o.useState)(!1),u=(0,o.useRef)(crypto.randomUUID()),m=e=>{let{index:t,slice:l}=e;s(e=>e.map((e,i)=>i===t?l(e):e))},h=e=>{if(e.length>10){F.Am.error("You can only upload ".concat(10," images at a time."));return}s(e.map(e=>({status:"uploading",image:e}))),e.forEach((e,t)=>x({index:t,image:e}))},x=e=>{let{index:t,image:l}=e,i=u.current;m({index:t,slice:e=>({...e,status:"uploading"})}),et({image:l}).then(e=>{i===u.current&&p({index:t,imageUrl:e})},()=>{i===u.current&&m({index:t,slice:e=>({...e,status:"uploadError",onRetry:()=>x({index:t,image:l})})})})},p=e=>{let{index:t,imageUrl:l}=e,i=u.current;m({index:t,slice:e=>({...e,status:"generating",thumbnailUrl:l})}),H.managerClient.customTypes.inferSlice({imageUrl:l}).then(e=>{let{slice:n}=e;i===u.current&&m({index:t,slice:e=>({...e,status:"success",thumbnailUrl:l,model:n})})},()=>{i===u.current&&m({index:t,slice:e=>({...e,status:"generateError",thumbnailUrl:l,onRetry:()=>p({index:t,imageUrl:l})})})})},v=r.some(e=>"uploading"===e.status||"generating"===e.status),g=r.filter(e=>"success"===e.status),y=g.length>0;return(0,i.jsxs)(n.VqE,{open:t,onOpenChange:e=>{e||c||(u.current=crypto.randomUUID(),a(),s([]))},children:[(0,i.jsx)(n.fKu,{title:"Generate from image"}),(0,i.jsxs)(n.cZJ,{gap:0,children:[(0,i.jsx)(n.BeV,{hidden:!0,children:"Upload images to generate slices with AI"}),0===r.length?(0,i.jsx)(n.xuv,{padding:16,height:"100%",children:(0,i.jsx)(n.Zzl,{onFilesSelected:h,assetType:"image",maxFiles:10,overlay:(0,i.jsx)(ee,{onFilesSelected:h,droppingFiles:!0}),children:(0,i.jsx)(ee,{onFilesSelected:h})})}):(0,i.jsx)(n.xrM,{stableScrollbar:!1,children:(0,i.jsx)(n.xuv,{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16,padding:16,children:r.map((e,t)=>(0,i.jsx)(Y,{slice:e},"slice-".concat(t)))})}),(0,i.jsxs)(n.kXR,{children:[(0,i.jsx)(n.POh,{disabled:c}),(0,i.jsxs)(n._dX,{disabled:!y||v,loading:c,onClick:()=>{let e=r.reduce((e,t)=>("success"===t.status&&e.push(t),e),[]);if(!e.length)return;let t=u.current;d(!0),el(e).then(async e=>{let{slices:i,library:n}=e;t===u.current&&(u.current=crypto.randomUUID(),await l({slices:i,library:n}),d(!1),s([]))}).catch(()=>{t===u.current&&(d(!1),F.Am.error("An unexpected error happened while adding slices."))})},children:["Add to page (",g.length,")"]})]})]})]})}function ee(e){let{droppingFiles:t=!1,onFilesSelected:l}=e;return(0,i.jsx)(n.xuv,{justifyContent:"center",flexDirection:"column",height:"100%",backgroundColor:t?"purple2":"grey2",border:!0,borderStyle:"dashed",borderColor:t?"purple9":"grey6",children:(0,i.jsxs)(n.R$c,{children:[(0,i.jsx)(n.avq,{lineColor:"purple11",backgroundColor:"purple5",name:"cloudUpload",size:"large"}),(0,i.jsx)(n._T6,{children:"Upload your design images."}),(0,i.jsx)(n.nfr,{children:"Once uploaded, you can generate slices automatically using AI."}),(0,i.jsx)(n.QjJ,{children:(0,i.jsx)(n.KH,{startIcon:"attachFile",onFilesSelected:l,color:"grey",children:"Add images"})})]})})}async function et(e){let{image:t}=e,l=[await H.managerClient.project.getResolvedRepositoryName(),"shared-slices","prismic-inferred-slices",crypto.randomUUID()].join("/");await H.managerClient.screenshots.initS3ACL();let{url:i}=await H.managerClient.screenshots.uploadScreenshot({keyPrefix:l,data:t});return i}async function el(e){let{libraries:t=[]}=await H.managerClient.project.getSliceMachineConfig(),l=t[0];if(!l)throw Error("No library found in the config.");let i=await H.managerClient.slices.addSlices({library:l,models:e.map(e=>e.model)});return await Promise.all(i.map((t,i)=>H.managerClient.slices.updateSliceScreenshot({libraryID:l,sliceID:t.id,variationID:t.variations[0].id,data:e[i].image}))),{slices:i,library:l}}let ei=e=>{let{openCreateSliceModal:t,openGenerateSliceWithAiModal:l,openUpdateSliceZoneModal:a,openSlicesTemplatesModal:r,projectHasAvailableSlices:s,isSlicesTemplatesSupported:o}=e,c=q();return(0,i.jsxs)(n.R$c,{"data-testid":"slice-zone-blank-slate",sx:{width:648},children:[(0,i.jsx)(n.avq,{lineColor:"purple9",backgroundColor:"purple5",name:"add",size:"large"}),(0,i.jsx)(n._T6,{size:"big",children:"Add slices"}),(0,i.jsx)(n.nfr,{children:"Slices are website sections that you can reuse on different pages with different content. Each slice has its own component in your code."}),(0,i.jsx)(n.QjJ,{children:(0,i.jsxs)(n.S0S,{children:[c.eligible&&(0,i.jsx)(n.F8s,{renderStartIcon:()=>(0,i.jsx)(n.AZf,{name:"autoFixHigh",size:"small",iconSize:"medium",color:"purple",variant:"solid",radius:6}),onClick:l,description:"Build a Slice based on your design image.",children:"Generate from image"}),(0,i.jsx)(n.F8s,{renderStartIcon:()=>(0,i.jsx)(n.AZf,{name:"add",size:"small",iconSize:"medium",color:"white",variant:"solid",radius:6}),onClick:t,description:"Build a custom Slice your way.",children:"Start from scratch"}),o&&(0,i.jsx)(n.F8s,{renderStartIcon:()=>(0,i.jsx)(n.AZf,{name:"contentCopy",size:"small",iconSize:"medium",color:"white",variant:"solid",radius:6}),onClick:r,description:"Choose from ready-made examples.",children:"Use a template"}),s&&(0,i.jsx)(n.F8s,{renderStartIcon:()=>(0,i.jsx)(n.AZf,{name:"folder",size:"small",iconSize:"medium",color:"white",variant:"solid",radius:6}),onClick:a,description:"Select from your created Slices.",children:"Reuse an existing Slice"})]})})]})};var en=l(65856);function ea(e){let{customType:t,tabId:l,slices:i}=e,n={...t};return i.forEach(e=>{n={...n,tabs:n.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}),n}var er=l(18566);async function es(){try{let{templates:e,errors:t}=await H.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 eo=l(17889),ec=l(91133),ed=l(68916),eu=l(47861),em=l(76805),eh=l(11104);let ex=e=>{let{deleteSliceZone:t,closeDeleteSliceZoneModal:l}=e;return(0,i.jsx)(eh.Z,{isOpen:!0,shouldCloseOnOverlayClick:!0,style:{content:{maxWidth:612}},onRequestClose:l,children:(0,i.jsx)(em.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,i.jsxs)(N.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,i.jsx)(N.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:"Do you really want to delete Slice Zone?"}),(0,i.jsx)(N.x8,{type:"button",onClick:l})]}),Footer:()=>(0,i.jsxs)(N.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,i.jsx)(eu.z,{label:"Cancel",variant:"secondary",onClick:l,sx:{mr:"10px",fontWeight:"bold",color:"grey12",borderRadius:6}}),(0,i.jsx)(eu.z,{label:"Delete",variant:"danger",onClick:t,sx:{minHeight:39,minWidth:78}})]}),children:(0,i.jsx)(N.nv,{children:"You're about to delete Slice Zone."})})})};var ep=l(61502),ev=l(3181),eg=l(99923),ey=l(17766),ef=l.n(ey);let ej=e=>{var t;let{isOpen:l,close:a,onSubmit:r,isLoading:s,slice:d,libraries:u}=e,{remoteSlices:m}=(0,c.v9)(e=>({remoteSlices:(0,ed.sT)(e)})),h={from:null===(t=u[0])||void 0===t?void 0:t.name,sliceName:(0,K.MP)(d.key)},[x,v]=(0,o.useState)(h),[g,y]=(0,o.useState)();function f(e){v(e),y((0,eg.h)(e,u,m))}return(0,p.pQ)(l,()=>{l||(v(h),y(void 0))}),(0,i.jsxs)(n.VqE,{open:l,onOpenChange:e=>!e&&a(),size:{width:448,height:"auto"},children:[(0,i.jsx)(n.fKu,{title:"Upgrade slice"}),(0,i.jsx)(n.cZJ,{children:(0,i.jsx)(n.l09,{onSubmit:function(){g&&Object.keys(g).length>0||r({libraryID:x.from,sliceID:x.sliceName})},children:(0,i.jsxs)(n.xuv,{flexDirection:"column",children:[(0,i.jsxs)(n.xrM,{className:ef().scrollArea,children:[(0,i.jsx)(n.xvT,{variant:"normal",color:"grey11",children:"This will create a new slice with the same fields. The new slice will replace the legacy slice in all of your types, and the existing slice content will be re-mapped to the new slice."}),(0,i.jsx)(n.xvT,{variant:"normal",color:"grey11",children:"This will not migrate your component. You will need to do that manually."}),(0,i.jsxs)(n.xuv,{flexDirection:"column",gap:4,children:[(0,i.jsx)(n.ytj,{label:"Slice name *",placeholder:"Pascalised Slice API ID (e.g. ".concat((0,K.MP)(d.key),")"),error:null==g?void 0:g.sliceName,value:x.sliceName,onValueChange:e=>f({...x,sliceName:e.slice(0,30)}),"data-testid":"slice-name-input"}),(0,i.jsx)(n.xvT,{variant:"normal",color:"grey11",children:"A display name for the slice"})]}),(0,i.jsxs)(n.xuv,{flexDirection:"column",gap:4,children:[(0,i.jsx)("label",{className:ef().label,children:(0,i.jsx)(n.xvT,{variant:"bold",children:"Slice library *"})}),(0,i.jsx)(n.PhF,{size:"medium",color:"grey",startIcon:"folder",flexContent:!0,value:x.from,onValueChange:e=>{e&&f({...x,from:e})},children:u.map(e=>(0,i.jsx)(n.QlF,{value:e.name,children:e.name},e.name))}),(0,i.jsx)(n.xvT,{variant:"normal",color:"grey11",children:"The library where we'll store your slice"})]})]}),(0,i.jsxs)(n.kXR,{children:[(0,i.jsx)(n.POh,{size:"medium"}),(0,i.jsx)(n._dX,{type:"submit",size:"medium",loading:s,disabled:g&&Object.keys(g).length>0,children:"Upgrade"})]})]})})})]})};var eb=l(96009),eS=l.n(eb);let eC=e=>{var t,l;let{isOpen:a,close:r,onSubmit:s,isLoading:c,slice:d,sliceName:u,libraries:m,localSharedSlices:h}=e,x={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:eS()(d.key),variationName:u},[v,g]=(0,o.useState)(!0),[y,f]=(0,o.useState)(x),[j,b]=(0,o.useState)({});function S(e){f(e),b(eI(e,m))}return(0,p.pQ)(a,()=>{a||(f(x),b({}))}),(0,i.jsxs)(n.VqE,{open:a,onOpenChange:e=>!e&&r(),size:{width:448,height:"auto"},children:[(0,i.jsx)(n.fKu,{title:"Convert to slice variation"}),(0,i.jsx)(n.cZJ,{children:(0,i.jsx)(n.l09,{onSubmit:function(){Object.keys(j).length>0||s(y)},children:(0,i.jsxs)(n.xuv,{display:"flex",flexDirection:"column",children:[(0,i.jsxs)(n.xrM,{className:ef().scrollArea,children:[(0,i.jsx)(n.xvT,{variant:"normal",color:"grey11",children:"If you have multiple slices that are similar, you can combine them as variations of the same slice."}),(0,i.jsxs)(n.xuv,{display:"flex",flexDirection:"column",gap:4,children:[(0,i.jsxs)("label",{className:ef().label,children:[(0,i.jsx)(n.xvT,{variant:"bold",children:"Target slice *"}),"string"==typeof j.libraryID?(0,i.jsx)(n.xvT,{variant:"small",color:"tomato10",children:j.libraryID}):null,"string"==typeof j.sliceID?(0,i.jsx)(n.xvT,{variant:"small",color:"tomato10",children:j.sliceID}):null]}),(0,i.jsx)(n.PhF,{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,i.jsxs)(n.QlF,{value:"".concat(e.from,"::").concat(e.model.id),children:[e.from," ",">"," ",e.model.name," (",e.model.id,")"]},"".concat(e.from,"::").concat(e.model.id)))}),(0,i.jsx)(n.xvT,{variant:"normal",color:"grey11",children:"Choose the slice to which you would like to add this variation."})]}),(0,i.jsx)(n.xuv,{display:"flex",flexDirection:"column",gap:4,children:(0,i.jsx)(n.ytj,{label:"Variation name *",placeholder:u,error:j.variationName,value:y.variationName,onValueChange:e=>{let t={...y,variationName:e.slice(0,30)};v&&(t.variationID=eS()(t.variationName)),S(t)},"data-testid":"variation-name-input"})}),(0,i.jsx)(n.xuv,{display:"flex",flexDirection:"column",gap:4,children:(0,i.jsx)(n.ytj,{label:"ID *",placeholder:eS()(d.key),error:j.variationID,value:y.variationID,onValueChange:e=>{g(!1),S({...y,variationID:e.slice(0,30)})},"data-testid":"variation-id-input"})})]}),(0,i.jsxs)(n.kXR,{children:[(0,i.jsx)(n.POh,{size:"medium"}),(0,i.jsx)(n._dX,{type:"submit",size:"medium",loading:c,disabled:Object.keys(j).length>0,children:"Convert"})]})]})})})]})},eI=(e,t)=>{let l={};e.libraryID||(l.libraryID="Cannot be empty.");let i=t.find(t=>t.path===e.libraryID);l.libraryID||i||(l.libraryID="Does not exist."),e.sliceID||(l.sliceID="Cannot be empty.");let n=null==i?void 0:i.components.find(t=>t.model.id===e.sliceID);if(l.sliceID||n||(l.sliceID="Does not exist."),e.variationName||(l.variationName="Cannot be empty."),e.variationID){var a;(null!==(a=null==n?void 0:n.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},eT=e=>{var t,l;let{isOpen:a,close:r,onSubmit:s,isLoading:c,identicalSlices:d}=e,u=null!==(l=null===(t=d[0])||void 0===t?void 0:t.path)&&void 0!==l?l:"",[m,h]=(0,o.useState)(u),[x,v]=(0,o.useState)();return(0,p.pQ)(a,()=>{a||(h(u),v(void 0))}),(0,i.jsxs)(n.VqE,{open:a,onOpenChange:e=>!e&&r(),size:{width:448,height:"auto"},children:[(0,i.jsx)(n.fKu,{title:"Merge with an existing slice"}),(0,i.jsx)(n.cZJ,{children:(0,i.jsx)(n.l09,{onSubmit:function(){if(x)return;let[e,t,l]=m.split("::");s({libraryID:e,sliceID:t,variationID:l})},children:(0,i.jsxs)(n.xuv,{display:"flex",flexDirection:"column",children:[(0,i.jsxs)(n.xrM,{className:ef().scrollArea,children:[(0,i.jsx)(n.xvT,{variant:"normal",color:"grey11",children:"If you have multiple identical slices, you can merge them. All of your content will be remapped to the target slice."}),(0,i.jsxs)(n.xuv,{display:"flex",flexDirection:"column",gap:4,children:[(0,i.jsxs)("label",{className:ef().label,children:[(0,i.jsx)(n.xvT,{variant:"bold",children:"Target slice*"}),"string"==typeof x?(0,i.jsx)(n.xvT,{variant:"small",color:"tomato10",children:x}):null]}),(0,i.jsx)(n.PhF,{size:"medium",color:"grey",startIcon:"viewDay",flexContent:!0,value:m,onValueChange:function(e){h(e),e||v("Cannot be empty.")},children:d.map(e=>(0,i.jsx)(n.QlF,{value:e.path,children:e.path.split("::").join(" > ")},e.path))}),(0,i.jsx)(n.xvT,{variant:"normal",color:"grey11",children:"Choose a slice that you would like to merge this into."})]})]}),(0,i.jsxs)(n.kXR,{children:[(0,i.jsx)(n.POh,{size:"medium"}),(0,i.jsx)(n._dX,{type:"submit",size:"medium",loading:c,disabled:!!x,children:"Merge"})]})]})})})]})},ew=e=>{var t;let{slice:l,path:a}=e,{refreshState:r}=(0,f.Z)(),[s,d]=(0,o.useState)(!1),[u,m]=(0,o.useState)(),{setCustomType:h}=C(),{libraries:x}=(0,c.v9)(e=>({libraries:(0,ed.Sd)(e)})),p="Slice"===l.value.type&&null!==(t=l.value.fieldset)&&void 0!==t?t:l.key,g=x.filter(e=>e.isLocal),y=g.map(e=>e.components).flat(),j=eD(l,p,y),b=async e=>{var t,i,n;if(!u)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:u});let{errors:s}=await H.managerClient.slices.convertLegacySliceToSharedSlice({model:l.value,src:{...a,sliceID:l.key},dest:{libraryID:e.libraryID,sliceID:e.sliceID,variationName:null!==(i=e.variationName)&&void 0!==i?i:"Default",variationID:null!==(n=e.variationID)&&void 0!==n?n:"default"}});if(s.length)throw console.error("Could not convert slice `".concat(p,"`"),s),F.Am.error("Could not convert slice `".concat(p,"`")),s;let{model:o,errors:c}=await H.managerClient.customTypes.readCustomType({id:a.customTypeID});if(c.length||!o){console.error("Could not refresh custom type view `".concat(a.customTypeID,"`"),c),F.Am.error("Could not refresh custom type view `".concat(a.customTypeID,"`"));return}switch(r(await (0,v.y0)()),d(!1),m(void 0),u){case"as_new_slice":F.Am.success("".concat(p," has been upgraded to a new slice ").concat(e.libraryID," > ").concat(e.sliceID));break;case"as_new_variation":F.Am.success("".concat(p," has been converted as a variation of ").concat(e.libraryID," > ").concat(e.sliceID));break;default:F.Am.success("".concat(p," has been merged with ").concat(e.libraryID," > ").concat(e.sliceID))}h(o)},S={path:a,slice:l,sliceName:p,libraries:g,localSharedSlices:y,identicalSlices:j,close:()=>m(void 0),onSubmit:b,isLoading:s};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h_2,{children:[(0,i.jsx)(n.$FS,{children:(0,i.jsx)(n.zxk,{"data-testid":"convert-legacy-slice",startIcon:"refresh",endIcon:"arrowDropDown",size:"medium",color:"grey",children:"Migrate legacy slice"})}),(0,i.jsxs)(n.AWV,{align:"start",children:[(0,i.jsx)(n.Xiv,{startIcon:(0,i.jsx)(n.JO$,{name:"folder",size:"large"}),description:"Use it with new types",onSelect:()=>m("as_new_slice"),children:"Upgrade slice"}),(0,i.jsx)(n.Xiv,{startIcon:(0,i.jsx)(n.JO$,{name:"viewDay",size:"large"}),description:"Add it to another slice",onSelect:()=>m("as_new_variation"),disabled:!y.length,children:"Convert to slice variation"}),(0,i.jsx)(n.Xiv,{startIcon:(0,i.jsx)(n.JO$,{name:"driveFileMove",size:"large"}),description:"Combine identical slices",onSelect:()=>m("merge_with_identical"),disabled:!j.length,children:"Merge with another slice"})]})]}),(0,i.jsx)(ej,{...S,isOpen:"as_new_slice"===u}),(0,i.jsx)(eC,{...S,isOpen:"as_new_variation"===u}),(0,i.jsx)(eT,{...S,isOpen:"merge_with_identical"===u})]})},eD=(e,t,l)=>(0,o.useMemo)(()=>{let i=[],n=(0,ev.ux)(e.value,t);for(let e of l)for(let t of e.model.variations){let l=(0,ev.ux)(t,e.model.name);n.primary===l.primary&&n.items===l.items&&i.push({libraryID:e.from,sliceID:e.model.id,variationID:t.id,path:"".concat(e.from,"::").concat(e.model.id,"::").concat(t.id)})}return i},[e,t,l]),ek=e=>{let{slice:t,path:l}=e,[a]=(0,ep.E)("legacySliceUpgrader"),r=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,i.jsxs)(Q.Zb,{children:[(0,i.jsx)(Q.ZB,{component:"div",children:(0,i.jsx)(n.xuv,{alignItems:"center",justifyContent:"center",children:(0,i.jsx)(n.xvT,{color:"grey11",component:"span",children:"No screenshot available"})})}),(0,i.jsxs)(Q.T$,{children:[(0,i.jsx)(n.ua7,{content:r,side:"bottom",children:(0,i.jsx)(n.Cts,{color:"purple",title:"Legacy Slice"})}),a.enabled?(0,i.jsx)(ew,{slice:t,path:l}):null]}),(0,i.jsx)(Q.eW,{subtitle:"1 variation",title:(0,ev.Dj)(t.value)})]})};var e_=l(53850),eA=l(42849);let eN=e=>{let{slices:t,format:l,path:n,onRemoveSharedSlice:a}=e,r=t.some(e=>"SharedSlice"!==e.type),s=j.$[l],[c]=(0,ep.E)("legacySliceUpgrader");return(0,o.useEffect)(()=>{r&&(c.enabled?F.Am.info("This ".concat(s.name({start:!1,plural:!1})," contains legacy slices that can be upgraded.")):F.Am.warning("This ".concat(s.name({start:!1,plural:!1})," contains slices that are incompatible.")))},[r]),(0,i.jsx)(eA.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,i.jsx)(ek,{slice:t,path:n})}{let t=e.payload;return(0,i.jsx)(e_.b,{action:{type:"remove",onRemove:()=>{a(t.model.id)}},mode:"navigation",slice:t,variant:"solid"})}},sx:{padding:"16px"}})};async function ez(e){try{let{templateIDs:t,localLibrariesNames:l,location:i,onSuccess:n}=e,{data:a,errors:r}=await H.managerClient.sliceTemplateLibrary.createSlices({templateIDs:t});if(r.length>0||void 0===a)throw r;a.sliceIDs.forEach((e,n)=>{v.Xe.track({event:"slice:created",id:e,name:e,library:l[0],location:i,mode:"template",sliceTemplate:t[n]})}),await n(a.sliceIDs)}catch(t){let e="Internal Error: Slice(s) not created";console.error(e,t),F.Am.error(e)}}var eZ=l(80410);let eE=[{extension:"",fileName:"",from:"",href:"",pathToSlice:"",model:{id:"video_highlights",name:"VideoHighlights",type:"SharedSlice",variations:[{description:"",docURL:"",id:"default",name:"Default",version:"sktwi1xtmkfgx8626"}]},screenshots:{default:{url:"/videoHighlights.png"}}}];var eM=e=>{let{availableSlices:t,values:l,placeholderSlices:n}=e;return(0,i.jsx)(A.F2,{name:"sliceKeys",render:e=>(0,i.jsx)(eA.Z,{gridTemplateMinPx:"200px",elems:t,defineElementKey:e=>"".concat(e.from,"-").concat(e.model.name),renderElem:t=>{var a;let r=null!==(a=null==n?void 0:n.some(e=>e.model.id===t.model.id))&&void 0!==a&&a,s=l.sliceKeys.includes(t.model.id);return(0,i.jsx)(e_.b,{action:{type:"checkbox"},isComingSoon:r,mode:"selection",onSelectedChange:i=>{i?e.push(t.model.id):e.remove(l.sliceKeys.indexOf(t.model.id))},selected:s,slice:t,variant:"outlined"})}})})};let eO=e=>{let{formId:t,close:l,onSuccess:n,availableSlicesTemplates:a,localLibraries:r,location:s}=e,{createSliceSuccess:o}=(0,f.Z)();return(0,i.jsx)(_.Z,{isOpen:!0,buttonLabel:"Add",formId:t,close:l,onSubmit:e=>{let{sliceKeys:t}=e;ez({templateIDs:t,localLibrariesNames:r.map(e=>e.name),location:s,onSuccess:async e=>{o((await (0,v.y0)()).libraries),n(await Promise.all(e.map(async e=>(await H.managerClient.slices.readSlice({libraryID:r[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,i.jsx)(N.xv,{sx:{color:"error"},children:t.sliceKeys}):void 0},children:e=>{let{values:t}=e;return(0,i.jsx)(eM,{values:t,placeholderSlices:eE,availableSlices:[...a.map(e=>({extension:"",fileName:"",from:"",href:"",pathToSlice:"",model:eZ.id.toSM(e.model),screenshots:Object.entries(e.screenshots).reduce((e,t)=>({...e,[t[0]]:{url:t[1]}}),{})})),...eE]})}})};var eF=e=>{let{formId:t,close:l,onSubmit:n,availableSlices:a}=e;return(0,i.jsx)(_.Z,{isOpen:!0,buttonLabel:"Add",formId:t,close:l,onSubmit:e=>{let{sliceKeys:t}=e;n(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,i.jsx)(N.xv,{sx:{color:"error"},children:t.sliceKeys}):void 0},children:e=>{let{values:t}=e;return(0,i.jsx)(eM,{values:t,availableSlices:a})}})};let eP=(e,t)=>{let l=(t||[]).reduce((e,t)=>[...e,...t.components],[]),{slicesInSliceZone:i,notFound:n}=e.value.reduce((e,t)=>{let{key:i,value:n}=t;if("SharedSlice"===n.type){let t=l.find(e=>e.model.id===i);return t?{...e,slicesInSliceZone:[...e.slicesInSliceZone,{type:"SharedSlice",payload:t}]}:{...e,notFound:[...e.notFound,{key:i}]}}return{...e,slicesInSliceZone:[...e.slicesInSliceZone,{type:"Slice",payload:{key:i,value:n}}]}},{slicesInSliceZone:[],notFound:[]});return{availableSlices:l,slicesInSliceZone:i,notFound:n}};var eU=e=>{var t;let{customType:l,onCreateSliceZone:a,onDeleteSliceZone:r,onRemoveSharedSlice:s,sliceZone:d,tabId:u}=e,m=q(),h=(0,er.QT)(es,[]),[x,p]=(0,o.useState)(!1),[y,j]=(0,o.useState)(!1),[b,S]=(0,o.useState)(!1),[I,T]=(0,o.useState)(!1),{remoteSlices:w,libraries:D}=(0,c.v9)(e=>({remoteSlices:(0,ed.sT)(e),libraries:(0,ed.Sd)(e),slices:(0,ed.xC)(e)})),{setCustomType:_}=C(),{completeStep:A}=(0,en.k)(),{createSliceSuccess:N,openLoginModal:z}=(0,f.Z)(),{syncChanges:Z}=(0,g.g)(),E=D.filter(e=>e.isLocal),{availableSlices:M,slicesInSliceZone:O,notFound:U}=(0,o.useMemo)(()=>d?eP(d,D):{availableSlices:[],slicesInSliceZone:[],notFound:[]},[d,D]),[R,L]=(0,o.useState)(!1);(0,o.useEffect)(()=>{(null==U?void 0:U.length)&&U.forEach(e=>{let{key:t}=e;s(t)})},[U]);let K=O.filter(e=>"SharedSlice"===e.type).map(e=>e.payload),V=M.filter(e=>!K.some(t=>t.model.id===e.model.id)),X=()=>{j(!0)},B=()=>{S(!0)},G=async()=>{await H.managerClient.user.checkIsLoggedIn()?T(!0):z()},J=()=>{p(!0),v.Xe.track({event:"custom-type:open-add-from-templates",customTypeId:l.id,customTypeFormat:l.format})},Q=()=>{j(!1)},Y=()=>{S(!1)},ee=()=>{T(!1)},et=()=>{p(!1)};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(P.Bu,{actions:d?(0,i.jsxs)(n.h_2,{children:[(0,i.jsx)(n.$FS,{children:(0,i.jsx)(n.zxk,{color:"purple",startIcon:"add","data-testid":"add-new-slice-dropdown",children:"Add"})}),(0,i.jsxs)(n.AWV,{align:"end",children:[m.eligible&&(0,i.jsx)(n.Xiv,{renderStartIcon:()=>(0,i.jsx)(n.AZf,{name:"autoFixHigh",size:"extraSmall",iconSize:"small",radius:6,variant:"solid",color:"purple"}),onSelect:()=>void G(),description:"Build a Slice based on your design image.",children:"Generate from image"}),(0,i.jsx)(n.Xiv,{renderStartIcon:()=>(0,i.jsx)(n.AZf,{name:"add",size:"extraSmall",iconSize:"small",radius:6,variant:"solid",color:"white"}),onSelect:B,description:"Build a custom Slice your way.",children:"Start from scratch"}),h.length>0?(0,i.jsx)(n.Xiv,{onSelect:J,renderStartIcon:()=>(0,i.jsx)(n.AZf,{name:"contentCopy",size:"extraSmall",iconSize:"small",radius:6,variant:"solid",color:"white"}),description:"Select from your created Slices.",children:"Use a template"}):void 0,V.length>0?(0,i.jsx)(n.Xiv,{onSelect:X,renderStartIcon:()=>(0,i.jsx)(n.AZf,{name:"folder",size:"extraSmall",iconSize:"small",radius:6,variant:"solid",color:"white"}),description:"Select from your created Slices.",children:"Reuse an existing Slice"}):void 0]})]}):void 0,toggle:"page"!==l.format||"Main"!==u?(0,i.jsx)(n.rsf,{checked:!!d,onCheckedChange:e=>{e?a():L(!0)},size:"small","data-testid":"slice-zone-switch"}):void 0,children:"Slices"}),d?O.length>0?(0,i.jsx)($.xR,{children:(0,i.jsx)(eN,{slices:O,format:l.format,path:{customTypeID:l.id,tabID:u,sliceZoneID:null!==(t=null==d?void 0:d.key)&&void 0!==t?t:""},onRemoveSharedSlice:s})}):(0,i.jsx)(n.xuv,{flexDirection:"column",flexGrow:1,justifyContent:"center",alignItems:"center",padding:{block:32},children:(0,i.jsx)(ei,{openUpdateSliceZoneModal:X,openCreateSliceModal:B,openGenerateSliceWithAiModal:()=>void G(),openSlicesTemplatesModal:J,projectHasAvailableSlices:V.length>0,isSlicesTemplatesSupported:h.length>0})}):void 0,y&&(0,i.jsx)(eF,{formId:"tab-slicezone-form-".concat(u),availableSlices:V,onSubmit:e=>{let t=ea({customType:l,tabId:u,slices:e});_(k.Dc.fromSM(t),()=>{F.Am.success("Slice(s) added to slice zone")}),A("createSlice"),Q()},close:Q}),x&&(0,i.jsx)(eO,{formId:"tab-slicezone-form-".concat(u),availableSlicesTemplates:h,localLibraries:E,location:"".concat(l.format,"_type"),onSuccess:e=>{let t=ea({customType:l,tabId:u,slices:e});_(k.Dc.fromSM(t),()=>{F.Am.success((0,i.jsx)(ec.GX,{message:"Slice template(s) added to slice zone and created at: ",path:"".concat(E[0].name,"/")}))}),A("createSlice"),et()},close:et}),R&&(0,i.jsx)(ex,{closeDeleteSliceZoneModal:()=>{L(!1)},deleteSliceZone:()=>{r(),L(!1)}}),(null==E?void 0:E.length)!==0&&b&&(0,i.jsx)(eo.c,{onSuccess:e=>{let t=ea({customType:l,tabId:u,slices:[e]});_(k.Dc.fromSM(t),()=>{F.Am.success((0,i.jsx)(ec.GX,{message:"New slice added to slice zone and created at: ",path:"".concat(E[0].name,"/")}))}),Y()},localLibraries:E,location:"".concat(l.format,"_type"),remoteSlices:w,onClose:Y}),(0,i.jsx)(W,{open:I,onSuccess:async e=>{let{slices:t,library:n}=e;N((await (0,v.y0)()).libraries);let a=ea({customType:l,tabId:u,slices:t});for(let e of(_(k.Dc.fromSM(a),()=>{F.Am.success((0,i.jsx)(ec.GX,{message:"Slice(s) added to slice zone and created at: ",path:n}))}),A("createSlice"),Z(),t))v.Xe.track({event:"slice:created",id:e.id,name:e.name,library:n,location:"".concat(l.format,"_type"),mode:"ai"});ee()},onClose:ee})]})};let eR=[R.C.UID,R.C.Image,R.C.Text,R.C.StructuredText,R.C.Link,R.C.Select,R.C.Boolean,R.C.Number,R.C.Color,R.C.Date,R.C.Table,R.C.Embed,R.C.Timestamp,R.C.GeoPoint,R.C.ContentRelationship,R.C.LinkToMedia,R.C.Group,R.C.NestedGroup];var eL=e=>{var t,l,a,r;let{tabId:s}=e,{customType:c,setCustomType:d}=C(),m=k.Dc.toSM(c),h=null===(t=m.tabs.find(e=>e.key===s))||void 0===t?void 0:t.sliceZone,x=null!==(a=null===(l=m.tabs.find(e=>e.key===s))||void 0===l?void 0:l.value)&&void 0!==a?a:[],p="page"===m.format&&m.repeatable?x.filter(e=>"uid"!==e.key):x,v=m.tabs.reduce((e,t)=>[...e,...t.value],[]),g=e=>{var t;let{apiId:l,value:i}=e,n=null===(t=i.config)||void 0===t?void 0:t.label;if((0,L.Ss)(R.C,i.type)||null==n)return;if("Range"===i.type||"IntegrationFields"===i.type||"Separator"===i.type)throw Error("Unsupported Field Type: ".concat(i.type));let a=R.C[i.type];try{a.schema.validateSync(i,{stripUnknown:!1})}catch(e){throw Error('Add field: Model is invalid for field "'.concat(i.type,'".'))}let r=k.L$.fromSM(i);d((0,u.xS)({customType:c,newField:r,newFieldId:l,sectionId:s}),()=>{F.Am.success("".concat("Group"===i.type?"Group":"Field"," added"))}),(0,V.V)({id:l,field:r})},y=e=>{let{apiId:t,newKey:l,value:i,inGroupFieldAction:n}=e;if((0,L.Ss)(R.C,i.type))return;let a=k.L$.fromSM(i);d((0,u.L4)({customType:c,previousFieldId:t,newFieldId:l,newField:a,sectionId:s}),()=>{"add"===n&&F.Am.success("Field added")}),n||(0,X.Z)({previousId:t,id:l,field:a})};return(0,i.jsx)(U.S,{children:(0,i.jsx)(o.Suspense,{fallback:(0,i.jsx)(n.xuv,{padding:32,children:(0,i.jsx)(n._3P,{})}),children:(0,i.jsxs)(P.aV,{border:!1,style:{flexGrow:1},children:[(0,i.jsx)(G.Z,{zoneType:"customType",zoneTypeFormat:null!==(r=c.format)&&void 0!==r?r:"custom",tabId:s,title:"Static zone",dataTip:"",fields:p,poolOfFieldsToCheck:v,showHints:!0,EditModal:B.Z,widgetsArray:eR,onDeleteItem:e=>{d((0,u.AK)({customType:c,fieldId:e,sectionId:s}))},onSave:e=>""===e.apiId?g({...e,apiId:e.newKey}):y(e),onDragEnd:e=>{if((0,L.uS)(e))return;let{source:t,destination:l}=e;if(!l)return;let i=(0,u.gR)({customType:c,sourceIndex:t.index,destinationIndex:l.index,sectionId:s});(0,O.flushSync)(()=>d(i))},renderHintBase:e=>{let{item:t}=e;return"data".concat((0,K.Ti)(t.key))},renderFieldAccessor:e=>"data".concat((0,K.Ti)(e)),testId:"static-zone-content",isRepeatableCustomType:c.repeatable}),(0,i.jsx)(eU,{customType:m,tabId:s,sliceZone:h,onRemoveSharedSlice:e=>{d((0,u.EN)({customType:c,sectionId:s,sliceId:e}))},onCreateSliceZone:()=>{d((0,u.Tr)(c,s))},onDeleteSliceZone:()=>{d((0,u.E3)(c,s))}})]})})})};let eK=()=>{var e,t,l;let{customType:a,setCustomType:r}=C(),s=k.Dc.toSM(a),[c,d]=(0,o.useState)(null===(e=s.tabs[0])||void 0===e?void 0:e.key),[m,h]=(0,o.useState)(),x=(null===(l=s.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,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.Rz2,{sx:x?{flexGrow:1}:void 0,children:["page"===a.format?(0,i.jsx)(n.pyJ,{title:a.repeatable?(0,i.jsx)(T,{}):void 0}):void 0,(0,i.jsxs)(n.KCD,{onValueChange:d,value:c,children:[(0,i.jsx)(n.mYC,{onAddNewTab:()=>{h({type:"CREATE_CUSTOM_TYPE_TAB"})},children:s.tabs.map(e=>(0,i.jsx)(n.wfd,{menu:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.Xiv,{onSelect:()=>{h({type:"UPDATE_CUSTOM_TYPE_TAB",tabKey:e.key})},startIcon:(0,i.jsx)(n.JO$,{name:"edit"}),children:"Rename"}),(0,i.jsx)(n.Xiv,{color:"tomato",disabled:function(e){if(s.tabs.length<=1)return!0;let t=s.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,i.jsx)(n.JO$,{name:"delete"}),children:"Remove"})]}),value:e.key,children:e.key},e.key))}),s.tabs.map(e=>(0,i.jsx)(n.e$b,{value:e.key,children:(0,i.jsx)(eL,{tabId:e.key})},e.key))]})]}),(null==m?void 0:m.type)==="CREATE_CUSTOM_TYPE_TAB"?(0,i.jsx)(Z,{close:()=>{h(void 0)},isOpen:!0,onSubmit:e=>{let{id:t}=e;r((0,u.vB)(a,t)),d(t)},tabIds:s.tabs.map(e=>e.key.toLowerCase())}):void 0,(null==m?void 0:m.type)==="UPDATE_CUSTOM_TYPE_TAB"?(0,i.jsx)(M,{close:()=>{h(void 0)},initialTabKey:m.tabKey,isOpen:!0,onSubmit:e=>{let{id:t}=e;r((0,u.HO)(a,m.tabKey,t)),c===m.tabKey&&d(t)},tabIds:s.tabs.filter(e=>e.key!==m.tabKey).map(e=>e.key.toLowerCase())}):void 0,(null==m?void 0:m.type)==="DELETE_CUSTOM_TYPE_TAB"?(0,i.jsx)(E,{close:()=>{h(void 0)},isOpen:!0,onSubmit:()=>{if(r((0,u.F$)(a,m.tabKey)),c===m.tabKey){var e;let t=null===(e=s.tabs.find(e=>e.key!==m.tabKey))||void 0===e?void 0:e.key;void 0!==t&&d(t)}}}):void 0]})};var eV=l(1744),eX=l(40572),eB=l(64910),eG=l(9975),e$=l(41329),eJ=l.n(e$);let eq=e=>{let{tabs:t,...l}=e;return(0,i.jsxs)(eG.fC,{...l,className:eJ().root,defaultValue:t[0].label,orientation:"vertical",children:[(0,i.jsx)(eG.aV,{className:eJ().list,"aria-label":"content tabs",children:t.map((e,t)=>{let{label:l}=e;return(0,i.jsx)(eG.xz,{className:eJ().trigger,value:l,children:(0,i.jsx)(n.xvT,{className:eJ().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,i.jsx)(eG.VY,{className:eJ().content,value:l,children:(0,i.jsx)(n.xrM,{className:eJ().scrollArea,children:a})},"".concat(l,"-content").concat(t+1))})]})};var eH=l(11290),eQ=l(88241),eY=l(58133),eW=l(37628),e0=l.n(eW);let e1=e=>{var t,l;let{inline:a,...r}=e,s=(0,eY.p)();if(!0===a)return(0,i.jsx)("code",{...r,className:e0().inlineCode});let o=(()=>{var e,t,l,i,n;if((null===(t=r.node)||void 0===t?void 0:null===(e=t.data)||void 0===e?void 0:e.meta)!==void 0){let e=null===(i=r.node)||void 0===i?void 0:null===(l=i.data)||void 0===l?void 0:l.meta;return{fileName:e.substring(1,e.length-1),language:null===(n=r.className)||void 0===n?void 0:n.split("-")[1]}}return null})(),c=null===(t=/language-(\w+)/.exec(null!==(l=r.className)&&void 0!==l?l:""))||void 0===t?void 0:t[1];return(0,i.jsx)(n.dnZ,{...r,onCopy:()=>{v.Xe.track({event:"page-type:copy-snippet",framework:s})},language:c,code:String(r.children).replace(/\n$/,""),title:null==o?void 0:o.fileName})},e6=e=>{let{markdown:t}=e;return(0,i.jsx)(eH.D,{children:t,linkTarget:"_blank",remarkPlugins:[eQ.Z],components:{code:e=>(0,i.jsx)(e1,{...e}),h1:e=>(0,i.jsx)(n.xvT,{children:e.children,component:"h1",variant:"h1"}),h2:e=>(0,i.jsx)(n.xvT,{children:e.children,component:"h2",variant:"h2"}),h3:e=>(0,i.jsx)(n.xvT,{children:e.children,component:"h3",variant:"h3"}),h4:e=>(0,i.jsx)(n.xvT,{children:e.children,component:"h4",variant:"h4"}),h5:e=>(0,i.jsx)(n.xvT,{children:e.children,component:"h4",variant:"h4"}),p:e=>(0,i.jsx)(n.xvT,{className:e0().section,children:e.children,component:"p",variant:"normal"}),pre:e=>(0,i.jsx)(n.xvT,{className:e0().section,children:e.children,component:"pre",variant:"normal"})}})};async function e8(e){let t=JSON.parse(e),{errors:l,documentation:i}=await H.managerClient.documentation.read({kind:t.kind,data:t.data});if(l.length>0)throw l;return i}var e2=l(83321),e3=l.n(e2);let e4=e=>{var t;let{model:l}=e,a=(0,eY.p)(),r=(t={kind:"PageSnippet",data:{model:l}},(0,er.QT)(e8,[JSON.stringify(t)])),{completeStep:s}=(0,en.k)();return 0===r.length?null:(0,i.jsxs)(n.VqE,{size:"small",trigger:(0,i.jsx)(n.zxk,{color:"grey",onClick:()=>{s("codePage"),v.Xe.track({event:"page-type:open-snippet",framework:a})},startIcon:"code",children:"Page snippet"}),children:[(0,i.jsx)(n.fKu,{icon:"code",title:"Page snippet"}),(0,i.jsx)("section",{className:e3().content,children:r.length>1?(0,i.jsx)(eq,{style:{flex:1},tabs:r.map((e,t)=>{let{label:l,content:n}=e;return{label:null!=l?l:"Tab ".concat(t+1),content:(0,i.jsx)(e6,{markdown:n})}})}):(0,i.jsx)(n.xrM,{style:{flex:1,padding:16},children:(0,i.jsx)(e6,{markdown:r[0].content})})})]})},e9=e=>{let{model:t}=e;return(0,i.jsx)("div",{children:(0,i.jsx)(U.S,{children:(0,i.jsx)(o.Suspense,{fallback:(0,i.jsx)(n.zxk,{color:"grey",startIcon:"code",children:"Page snippet"}),children:(0,i.jsx)(e4,{model:t})})})})},e7=()=>{let e=(0,s.useRouter)(),{selectedCustomType:t}=(0,c.v9)(t=>({selectedCustomType:(0,eX.Jk)(t,(0,h.Ag)(e.query))}));return((0,o.useEffect)(()=>{t&&(0,eV.TG)(t)||e.replace("/")},[t,e]),t&&(0,eV.TG)(t))?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r(),{children:(0,i.jsxs)("title",{children:[t.local.label," - Slice Machine"]})}),(0,i.jsx)(e5,{customType:t.local})]}):(0,i.jsx)(x.LN,{})},e5=e=>{let{customType:t}=e;return null===t?(0,i.jsx)(x.LN,{}):(0,i.jsx)(x.LN,{children:(0,i.jsx)(S,{initialCustomType:k.Dc.fromSM(t),children:e=>{var l;let{actionQueueStatus:a,customType:r,setCustomType:s}=e,o=(0,u.y6)(r),c=h.cd[t.format],p=j.$[t.format];return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(x.wd,{children:[(0,i.jsx)(x.Xq,{url:c.tablePagePathname}),(0,i.jsxs)(x.Cx,{children:[(0,i.jsx)(d.g,{children:p.name({start:!0,plural:!0})}),(0,i.jsx)(d.g,{active:!0,children:null!==(l=r.label)&&void 0!==l?l:r.id})]}),(0,i.jsxs)(x.K2,{children:[(0,i.jsx)(m.X,{status:a}),"page"===r.format?(0,i.jsx)(e9,{model:r}):void 0,(0,i.jsx)(eB._,{isChangesLocal:!0,format:o,customType:r,setLocalCustomType:s})]})]}),(0,i.jsx)(x.RN,{children:(0,i.jsx)(n.xuv,{flexDirection:"column",minWidth:0,children:(0,i.jsx)(eK,{})})})]})}})})}},61502:function(e,t,l){"use strict";l.d(t,{E:function(){return n}});var i=l(29806);function n(e){var t,l;let[n,a]=(0,i.f)(),r=async t=>{let l={...n,labs:{...n.labs}};t?l.labs[e]=t:e in l.labs&&delete l.labs[e],0===Object.keys(l.labs).length&&delete l.labs,await a(l)};return[{enabled:null!==(l=null==n?void 0:null===(t=n.labs)||void 0===t?void 0:t[e])&&void 0!==l&&l},r]}},29806:function(e,t,l){"use strict";l.d(t,{f:function(){return a}});var i=l(18566),n=l(70647);function a(){return[(0,i.QT)(r,[]),async e=>{await n.managerClient.project.writeSliceMachineConfig({config:e}),(0,i.VA)(r,[],e)}]}async function r(){return n.managerClient.project.getSliceMachineConfig()}},17889:function(e,t,l){"use strict";l.d(t,{c:function(){return f}});var i=l(52322),n=l(2784),a=l(36131),r=l(75289),s=l(93188),o=l(65856),c=l(88932),d=l(3181),u=l(99510),m=l(70647);async function h(e){let{sliceName:t,libraryName:l,location:i,onSuccess:n}=e;try{let e=(0,d.fo)(t),{errors:a}=await m.managerClient.slices.createSlice({libraryID:l,model:e});if(a.length>0)throw a;s.Xe.track({event:"slice:created",id:(0,u.MP)(t),name:t,library:l,location:i,mode:"manual"}),await n(e)}catch(l){let e="An unexpected error happened while creating slice ".concat(t,".");console.error(e,l),c.Am.error(e)}}var x=l(80546),p=l(1490),v=l(41067),g=l(28801),y=l(99923);let f=e=>{let{onClose:t,onSuccess:l,localLibraries:c,location:d,remoteSlices:u}=e,{createSliceSuccess:m}=(0,v.Z)(),[f,j]=(0,n.useState)(!1),{syncChanges:b}=(0,x.g)(),{completeStep:S}=(0,o.k)(),C=async e=>{let t=e.sliceName,i=e.from;j(!0),await h({sliceName:t,libraryName:i,location:d,onSuccess:async e=>{m((await (0,s.y0)()).libraries),l(e,i),b(),S("createSlice")}})};return(0,i.jsx)(p.Z,{testId:"create-slice-modal",isOpen:!0,widthInPx:"530px",isLoading:f,formId:"create-new-slice",close:t,buttonLabel:"Create",onSubmit:e=>{C(e)},initialValues:{sliceName:"",from:c[0].name},validate:e=>(0,y.h)(e,c,u),content:{title:"Create a new slice"},children:e=>{let{touched:t,values:l,setFieldValue:n,errors:s}=e;return(0,i.jsxs)(r.xu,{children:[(0,i.jsx)(g.W,{name:"sliceName",label:"Slice Name",placeholder:"Pascalised Slice API ID (e.g. TextBlock)",error:t.sliceName?s.sliceName:void 0,testId:"slice-name-input"}),(0,i.jsx)(r.__,{htmlFor:"from",sx:{mb:2},children:"Target Library"}),(0,i.jsx)(a.ZP,{name:"from",options:c.map(e=>({value:e.name,label:e.name})),onChange:e=>e?void n("from",e.value):null,defaultValue:{value:l.from,label:l.from},styles:{option:e=>({...e,color:"#161618"})},theme:e=>({...e,colors:{...e.colors,primary:"#E9E8EA"}}),menuPortalTarget:document.body})]})}})}},99923:function(e,t,l){"use strict";l.d(t,{h:function(){return o}});var i=l(96009),n=l.n(i),a=l(74600),r=l.n(a),s=l(17186);function o(e,t,l){let{sliceName:i}=e;return i?s.lS.includes(i.toLowerCase())?{sliceName:'Name "'.concat(i,'" is reserved for Slice Machine use.')}:s.xo.exec(i)?r()(n()(i)).replace(/\s/gm,"")!==i.trim()?{sliceName:"Value has to be PascalCased."}:i.match(/^\d/)?{sliceName:"Value cannot start with a number."}:[...t.flatMap(e=>e.components.map(e=>e.model.name)),...l.map(e=>e.name)].includes(i)?{sliceName:"Slice name is already taken."}:void 0:{sliceName:"No special characters allowed."}:{sliceName:"Cannot be empty"}}},42849:function(e,t,l){"use strict";var i=l(52322),n=l(75289);t.Z=function(e){let{elems:t,renderElem:l,defineElementKey:a,gridTemplateMinPx:r="320px",gridGap:s="16px",sx:o}=e;return(0,i.jsx)(n.xu,{as:"section",sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(".concat(r,", 1fr))"),gridGap:s,pt:2,...o},children:t.map((e,t)=>e?(0,i.jsx)("span",{children:l(e,t)},"".concat(a(e),"-").concat(t+1)):null)})}},41329: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"}},83321:function(e){e.exports={content:"PageSnippetDialog_content__jIN6d"}},37628:function(e){e.exports={section:"MarkdownRenderer_section__uNS1M",inlineCode:"MarkdownRenderer_inlineCode__lmGTi"}},17766:function(e){e.exports={scrollArea:"ConvertLegacySliceButton_scrollArea__xf3vM",label:"ConvertLegacySliceButton_label__BK0Gd"}}}]);