slice-machine-ui 2.20.5-alpha.jp-import-slice-base.2 → 2.20.5-alpha.jp-import-slices-2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/404.html +1 -1
- package/out/_next/static/-Yjs5UmgvuB8nY3BLb3TK/_buildManifest.js +1 -0
- package/out/_next/static/chunks/21-f3962d02eda0a46e.js +1 -0
- package/out/_next/static/chunks/{248-84a5987f0499b074.js → 248-2902bda47821f37b.js} +1 -1
- package/out/_next/static/chunks/{630-2bf927bca082a191.js → 630-4fe1e982234bd925.js} +1 -1
- package/out/_next/static/chunks/633-2d20c3e815c79c7f.js +1 -0
- package/out/_next/static/chunks/{647-aa094286bc248d52.js → 647-a29bee23cb9ac7a2.js} +1 -1
- package/out/_next/static/chunks/660-e3d7a5444ab7391e.js +1 -0
- package/out/_next/static/chunks/6611d287.1714222015f895ea.js +28 -0
- package/out/_next/static/chunks/{882-48d61b2fabee28d8.js → 882-8ab59c0c72307c87.js} +1 -1
- package/out/_next/static/chunks/pages/{_app-651bb3e76e35a633.js → _app-89df34df01f52931.js} +217 -217
- package/out/_next/static/chunks/pages/{changelog-8514e0696e90a1b2.js → changelog-bc83e25e8d316ca9.js} +1 -1
- package/out/_next/static/chunks/pages/{changes-e66094f57453cf9c.js → changes-6f371ebe52dbe76a.js} +1 -1
- package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-273e9a82c085b596.js → [customTypeId]-80defa14b6ea36f7.js} +1 -1
- package/out/_next/static/chunks/pages/{labs-56fd818a63553497.js → labs-16d118a80936d583.js} +1 -1
- package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-3fa7667de1a790d9.js → [pageTypeId]-f4ff9ad74b44bf09.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/{simulator-8c70298caf51bed0.js → simulator-873c0c89aaf50b3c.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/{[variation]-22ffa2561ac66557.js → [variation]-0e9aa745ed9fe1ec.js} +1 -1
- package/out/_next/static/chunks/pages/slices-93fc784c443a996c.js +1 -0
- package/out/_next/static/chunks/{webpack-24ddb02bea621501.js → webpack-e986dd216b883a74.js} +1 -1
- package/out/_next/static/css/b30fbbc3ed00a725.css +1 -0
- package/out/changelog.html +1 -1
- package/out/changes.html +1 -1
- package/out/custom-types/[customTypeId].html +1 -1
- package/out/custom-types.html +1 -1
- package/out/index.html +1 -1
- package/out/labs.html +1 -1
- package/out/page-types/[pageTypeId].html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
- package/out/slices.html +1 -1
- package/package.json +6 -6
- package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/ImportSlicesFromLibraryModal.tsx +104 -285
- package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/LibrarySlicesTab.tsx +125 -0
- package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/LocalSlicesTab.tsx +67 -0
- package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/ReuseExistingSlicesContext.tsx +279 -0
- package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/hooks/useImportSlicesFromGithub.ts +7 -4
- package/src/features/customTypes/customTypesBuilder/SliceZoneBlankSlate.tsx +4 -18
- package/src/features/customTypes/customTypesBuilder/shared/getSubmitButtonLabel.ts +3 -5
- package/src/features/customTypes/customTypesBuilder/sliceCreationOptions.tsx +0 -14
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModalList.tsx +1 -3
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/index.tsx +26 -79
- package/src/pages/slices.tsx +0 -30
- package/out/_next/static/CGK-vfrV6JByBnDLoS7iE/_buildManifest.js +0 -1
- package/out/_next/static/chunks/422-c7a16d95b75c9e1c.js +0 -1
- package/out/_next/static/chunks/489-c9535ef34da63d1a.js +0 -1
- package/out/_next/static/chunks/585-c89bb2471e85b9f8.js +0 -1
- package/out/_next/static/chunks/954-bedaaabf664584a0.js +0 -1
- package/out/_next/static/chunks/a6495ab1.00190ac98e794d8f.js +0 -28
- package/out/_next/static/chunks/pages/slices-76679cf064761d2b.js +0 -1
- package/out/_next/static/css/bc89f2cd4e4781f5.css +0 -1
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModal.tsx +0 -72
- /package/out/_next/static/{CGK-vfrV6JByBnDLoS7iE → -Yjs5UmgvuB8nY3BLb3TK}/_ssgManifest.js +0 -0
|
@@ -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(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
|
+
(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(18337),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(18337),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([[630],{35289:function(e,t,n){"use strict";n.d(t,{aV:function(){return s},Bu:function(){return d}});var i=n(52322),l=n(11699),r=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,r.Z)(a().root,t&&a()["root-border"])})},d=e=>{let{actions:t,children:n,toggle:r,...o}=e;return(0,i.jsxs)("div",{...o,className:a().header,children:[(0,i.jsx)(l.bL,{color:"grey11",component:"span",noWrap:!0,variant:"bold",children:n}),r,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 f},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 m},_n:function(){return h},gA:function(){return o},pG:function(){return l},pV:function(){return d},pt:function(){return r},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"},l={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"},r={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"},m={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"},f={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,m,d,u,l,r,f,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),l=n(11699),r=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:l,langSmithUrl:r}=e,o=(0,d.iv)({type:t,library:n,sliceId:i,variationId:l}),a=JSON.stringify({langSmithUrl:r});localStorage.setItem(o,a)}function u(e){let{type:t,library:n,sliceId:i,variationId:l}=e,r=(0,d.iv)({type:t,library:n,sliceId:i,variationId:l});localStorage.removeItem(r)}function p(e){let{type:t,library:n,sliceId:c,variationId:u}=e,{key:p,value:h,done:m}=function(e){let{type:t,library:n,sliceId:i,variationId:l}=e,r=(0,d.iv)({type:t,library:n,sliceId:i,variationId:l}),[a,c]=(0,s.V)(r,void 0,{schema:o.z.object({langSmithUrl:o.z.string().url().optional()})});return{key:r,value:a,done:()=>c(void 0)}}({type:t,library:n,sliceId:c,variationId:u}),[f,x]=(0,r.useState)(),g=e=>()=>{h&&(x(p),a.Xe.track({event:"slice-generation-feedback",type:t,sliceId:c,variationId:u,feedback:e,langSmithUrl:h.langSmithUrl}),m())};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l.be,{children:(0,i.jsx)(l.bQ,{anchor:(0,i.jsx)(l.D,{width:"100%",justifyContent:"center",position:"absolute",bottom:64}),icon:"check",title:"Thanks for your feedback!",seconds:2,open:!!f,onOpenChange:e=>{e||x(void 0)}},f)}),(0,i.jsx)(l.i,{children:h&&(0,i.jsxs)(l.D,{flexDirection:"row",justifyContent:"end",gap:8,alignItems:"center",children:[(0,i.jsx)(l.bL,{color:"grey11",children:"Did the AI get it right?"}),(0,i.jsxs)(l.D,{flexDirection:"row",gap:4,children:[(0,i.jsx)(l.c3,{side:"bottom",sideOffset:4,variant:"text",content:"Looks good",children:(0,i.jsx)(l.aZ,{variant:"solid",size:"small",icon:"thumbUp",onClick:g("up")})}),(0,i.jsx)(l.c3,{side:"bottom",sideOffset:4,variant:"text",content:"Needs improvement",children:(0,i.jsx)(l.aZ,{variant:"solid",size:"small",icon:"thumbDown",onClick:g("down")})})]})]})})]})}},23094:function(e,t,n){"use strict";n.d(t,{X:function(){return r}});var i=n(52322),l=n(11699);let r=e=>{let t;let{status:n}=e;switch(n){case"pending":t={icon:(0,i.jsx)(l.bg,{color:"grey11"}),text:"Saving..."};break;case"failed":t={icon:(0,i.jsx)(l.aX,{name:"close",color:"tomato11",size:"medium"}),text:"Failed to save"};break;case"done":t={icon:(0,i.jsx)(l.aX,{name:"check",color:"green11",size:"medium"}),text:"Auto-saved"}}return(0,i.jsxs)(l.D,{gap:8,alignItems:"center",children:[t.icon,(0,i.jsx)(l.bL,{color:"grey11",children:t.text})]})}},6609:function(e,t,n){"use strict";n.d(t,{S:function(){return o}});var i=n(52322),l=n(11699),r=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=>r.J9.some(t=>t.name===e.name)||e.name===r.Fj.name),h=d.find(e=>e.name===r.U.name);return(0,i.jsxs)(l.ar,{open:t,onOpenChange:n,children:[(0,i.jsx)(l.av,{disabled:o,children:null!=u?u:(0,i.jsx)(l.E,{startIcon:"add",color:"grey","data-testid":c,children:"Add a field"})}),(0,i.jsxs)(l.as,{align:"end",maxHeight:400,collisionPadding:8,children:[(0,i.jsx)(l.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)(l.au,{children:"Set of fields"}),(0,i.jsx)(a,{field:h,onSelectField:s})]})]})]})}function a(e){let{field:t,onSelectField:n}=e,{type:r,variant:o,name:a,icon:s,description:d,thumbnail:c}=t;return(0,i.jsx)(l.at,{startIcon:(0,i.jsx)(l.aX,{name:s,size:"large"}),description:d,onSelect:()=>n(null!=o?o:r),renderTooltip:e=>(0,i.jsx)(l.c3,{visible:!0,variant:"custom",content:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l.a_,{src:c,borderRadius:4,sx:{height:170,width:278},animateOnLoad:!1}),(0,i.jsx)(l.bL,{color:"white",children:"How it will look for content editors."})]}),align:"start",side:"left",sideOffset:4,animation:"none",children:e}),children:a},"".concat(r).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),l=n(47124),r=n(11699),o=n(2784),a=n(50477),s=n(87446);function d(e){return(0,i.jsx)(s.h,{renderError:()=>(0,i.jsxs)(r.D,{alignItems:"center",gap:8,children:[(0,i.jsx)(r.aX,{name:"alert",size:"small",color:"tomato10"}),(0,i.jsx)(r.bL,{color:"tomato10",children:"Error loading your types"})]}),children:(0,i.jsx)(r.bB,{fallback:(0,i.jsxs)(r.D,{flexDirection:"column",position:"relative",children:[(0,i.jsx)(r.bx,{height:240}),(0,i.jsxs)(r.D,{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",alignItems:"center",gap:8,children:[(0,i.jsx)(r.aX,{name:"autorenew",size:"small",color:"grey11"}),(0,i.jsx)(r.bL,{color:"grey11",children:"Loading your types..."})]})]}),children:(0,i.jsx)(c,{...e})})})}function c(e){let{value:t,onChange:n}=e,{allCustomTypes:l,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:l}):{};return(0,i.jsxs)(r.D,{overflow:"hidden",flexDirection:"column",border:!0,borderRadius:6,width:"100%",children:[(0,i.jsx)(r.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)(r.D,{flexDirection:"column",children:[(0,i.jsx)(r.bL,{variant:"h4",color:"grey12",children:"Allowed type"}),(0,i.jsxs)(r.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)(r.D,{margin:{block:12},children:(0,i.jsx)(r.f,{color:"warn",icon:"alert",subtitle:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.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)(r.bL,{color:"inherit",variant:"bold",children:"See documentation"}),(0,i.jsx)(r.aX,{name:"arrowForward",size:"small",color:"inherit"})]})]})})})]}),s.map(e=>{var o;return(0,i.jsxs)(r.D,{gap:4,padding:8,border:!0,borderRadius:6,borderColor:"grey6",backgroundColor:"white",justifyContent:"space-between",children:[s.length>1?(0,i.jsx)(r.bL,{children:e.id}):(0,i.jsx)(r.c5,{children:(0,i.jsx)(h,{customType:e,onChange:i=>{n(function(e){let{linkCustomtypes:t,fieldCheckMap:n,newCustomType:i,customTypeId:l}=e,r=[],o=Object.entries({...n,[l]: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?r.push(t):L(e)===l?r.push(L(e)):r.push(e)}return r}({fieldCheckMap:d,newCustomType:i,linkCustomtypes:t,customTypeId:e.id}))},fieldCheckMap:null!==(o=d[e.id])&&void 0!==o?o:{},allCustomTypes:l})}),(0,i.jsx)(r.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:l})}),(0,i.jsx)(r.D,{backgroundColor:"white",flexDirection:"column",padding:12,children:(0,i.jsxs)(r.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)(r.D,{flexDirection:"column",gap:8,alignItems:"center",padding:{block:24},children:[(0,i.jsxs)(r.D,{flexDirection:"column",alignItems:"center",gap:4,children:[(0,i.jsx)(r.bL,{variant:"h5",color:"grey12",children:"No type selected"}),(0,i.jsxs)(r.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)(r.D,{children:(0,i.jsx)(p,{allCustomTypes:t,onSelect:n})})]})}function p(e){let{allCustomTypes:t,onSelect:n}=e,l=(0,i.jsx)(r.E,{startIcon:"add",color:"grey",disabled:0===t.length,children:"Add type"});return 0===t.length?(0,i.jsx)(r.D,{children:(0,i.jsx)(r.c3,{content:"No type available",side:"bottom",align:"start",disableHoverableContent:!0,children:l})}):(0,i.jsx)(r.D,{children:(0,i.jsxs)(r.ar,{children:[(0,i.jsx)(r.av,{children:l}),(0,i.jsxs)(r.as,{maxHeight:400,minWidth:256,align:"center",children:[(0,i.jsx)(r.au,{children:(0,i.jsx)(r.bL,{color:"grey11",children:"Types"})}),t.map(e=>(0,i.jsx)(r.at,{onSelect:()=>n(e.id),children:(0,i.jsxs)(r.D,{alignItems:"center",justifyContent:"space-between",gap:8,children:[(0,i.jsx)(r.bO,{children:(0,i.jsx)(r.bL,{children:e.id})}),(0,i.jsx)(r.m,{title:(0,i.jsx)(r.bL,{variant:"extraSmall",color:"purple11",children:b(e.format)}),color:"purple",size:"small"})]})},e.id))]})]})})}function h(e){let{customType:t,fieldCheckMap:n,onChange:l,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=>{l({...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)(m,{field:c,fieldId:d,onChange:e=>{l({...n,[d]:{type:"contentRelationship",value:e}})},fieldCheckMap:"contentRelationship"===e.type?e.value:{},allCustomTypes:o},d)}return(0,i.jsx)(r.c6,{title:d,checked:(null===(t=n[d])||void 0===t?void 0:t.value)===!0,onCheckedChange:e=>{l({...n,[d]:{type:"checkbox",value:e}})}},d)}),s=C(n);return(0,i.jsx)(r.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)(f,{})},t.id)}function m(e){var t,n;let{field:l,fieldId:o,fieldCheckMap:a,onChange:s,allCustomTypes:d}=e,[c]=y(null===(t=l.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[l,o]=e;if("Group"===o.type){let e=null!==(n=p[l])&&void 0!==n?n:{};return(0,i.jsx)(x,{group:o,groupId:l,onChange:e=>{u({...p,[l]:{type:"group",value:e}})},fieldCheckMap:"group"===e.type?e.value:{}},l)}return(0,i.jsx)(r.c6,{title:l,checked:(null===(t=p[l])||void 0===t?void 0:t.value)===!0,onCheckedChange:e=>{u({...p,[l]:{type:"checkbox",value:e}})}},l)});return(0,i.jsx)(r.c7,{title:(0,i.jsxs)(r.bL,{children:[o," ",(0,i.jsxs)(r.bL,{color:"grey11",children:["→ ",c.id]})]}),subtitle:v(C(p).pickedFields),badge:b(c.format),children:h.length>0?h:(0,i.jsx)(f,{})},c.id)}function f(){return(0,i.jsx)(r.bL,{color:"grey11",children:"No available fields to select"})}function x(e){let{group:t,groupId:n,fieldCheckMap:l,onChange:o}=e,a=w(t).map(e=>{var t;let{fieldId:n}=e;return(0,i.jsx)(r.c6,{title:n,checked:(null===(t=l[n])||void 0===t?void 0:t.value)===!0,onCheckedChange:e=>{o({...l,[n]:{type:"checkbox",value:e}})}},n)});return(0,i.jsx)(r.c7,{title:n,subtitle:v(C(l).pickedFields),badge:"Group",children:a.length>0?a:(0,i.jsx)(f,{})},n)}function g(e){let{group:t,groupId:n,fieldCheckMap:l,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=l[s])&&void 0!==n?n:{};return(0,i.jsx)(m,{field:d,fieldId:s,fieldCheckMap:"contentRelationship"===e.type?e.value:{},onChange:e=>{o({...l,[s]:{type:"contentRelationship",value:e}})},allCustomTypes:a},s)}return(0,i.jsx)(r.c6,{title:s,checked:(null===(t=l[s])||void 0===t?void 0:t.value)===!0,onCheckedChange:e=>{o({...l,[s]:{type:"checkbox",value:e}})}},s)});return(0,i.jsx)(r.c7,{title:n,subtitle:v(C(l).pickedFields),badge:"Group",children:s.length>0?s:(0,i.jsx)(f,{})},n)}function v(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"selected";if(0!==e)return"(".concat(e," ").concat((0,l._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 l={};if(i){let i=n.find(e=>e.id===t.id);if(!i)return e;l=T(i)}let r=t.fields.reduce((e,t)=>{let r=l[L(t)];if(i&&void 0===r)return e;if("string"==typeof t)return i&&void 0!==r&&"Group"===r.type||(e[t]={type:"checkbox",value:!0}),e;if("fields"in t&&void 0!==t.fields){if(i&&void 0!==r&&"Group"!==r.type)return e;let o=function(e){let{group:t,ctFlatFieldMap:n,allCustomTypes:i}=e,l=void 0!==i,r=t.fields.reduce((e,r)=>{let o=E(n,t.id,L(r));if(l&&!o)return e;if("string"==typeof r)return l&&void 0!==o&&"Group"===o.type||(e[r]={type:"checkbox",value:!0}),e;if("customtypes"in r&&void 0!==r.customtypes){if(l&&void 0!==o&&!_(o))return e;let t=k({field:r,allCustomTypes:i});t&&(e[r.id]=t)}return e},{});if(0!==Object.keys(r).length)return{type:"group",value:r}}({group:t,allCustomTypes:n,ctFlatFieldMap:l});return o&&(e[t.id]=o),e}if("customtypes"in t&&void 0!==t.customtypes){if(i&&void 0!==r&&!_(r))return e;let l=k({field:t,allCustomTypes:n});l&&(e[t.id]=l)}return e},{});return Object.keys(r).length>0&&(e[t.id]=r),e},{})}function k(e){let{field:t,allCustomTypes:n}=e,i=void 0!==n,l=t.customtypes.reduce((e,t)=>{if("string"==typeof t)return e;let l={};if(i){let i=n.find(e=>e.id===t.id);if(!i)return e;l=T(i)}let r=t.fields.reduce((e,t)=>{if("string"==typeof t){let n=l[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 r=E(l,t.id,n);return i&&(void 0===r||"Group"===r.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(r).length>0&&(e[t.id]=r),e},{});if(0!==Object.keys(l).length)return{type:"contentRelationship",value:l}}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:l}=C(n,t);return{pickedFields:e.pickedFields+i,nestedPickedFields:e.nestedPickedFields+l}},{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,l;let r=e[t];if(void 0!==r&&"Group"===r.type)return null===(l=r.config)||void 0===l?void 0:null===(i=l.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}},38193:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var i=n(52322),l=n(61183);n(2784);var r=n(59326),o=n(75289);l.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,r.B7)(),m=s?l.Z.highlight(n,{language:"vue"===s?"html":s}).value:l.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:m}})]})}},80575:function(e,t,n){"use strict";n.d(t,{J:function(){return o},k:function(){return r}});var i=n(52322);n(2784);var l=n(75289);let r=e=>{let{children:t,sx:n,...r}=e;return(0,i.jsx)(l.xu,{sx:{display:["block","block","flex"],flexWrap:"wrap",justifyContent:"space-between",...n},...r,children:t})},o=e=>{let{children:t,cols:n=2}=e;return(0,i.jsx)(l.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,l,r=n(52322),o=n(63397),a=n(2784),s=n(75289),d=e=>{let{field:t,meta:n,fieldName:i,label:l,focusOnNewEntry:d=!0,inputPlaceholder:c,buttonLabel:u}=e,[p,h]=(0,a.useState)(n.value.length),m=(0,a.useRef)(Array(n.value.length));return(0,a.useEffect)(()=>{m.current=m.current.slice(0,n.value.length)},[n.value.length]),(0,a.useEffect)(()=>{let e=m.current.length;d&&e>p&&m.current[e-1].focus(),h(e)},[m.current.length,d,p]),(0,r.jsxs)(a.Fragment,{children:[(0,r.jsxs)(s.__,{variant:"label.primary",htmlFor:i,children:[l,n.touched&&n.error?(0,r.jsx)(s.xv,{as:"span",variant:"text.labelError",children:n.error}):null]}),(0,r.jsx)(o.F2,{name:i,id:i,...t,render:e=>(0,r.jsxs)("div",{children:[t.value&&t.value.length>0?t.value.map((t,n)=>(0,r.jsxs)(s.kC,{my:2,children:[(0,r.jsx)(s.II,{placeholder:c,name:"".concat(i,".").concat(n),value:t,ref:e=>m.current[n]=e,onChange:t=>{let{target:{value:i}}=t;return e.replace(n,i)}}),(0,r.jsx)(s.zx,{ml:2,type:"button",variant:"secondary",onClick:()=>e.remove(n),children:"-"})]},"".concat(i,"-").concat(+n+1))):null,(0,r.jsx)(s.zx,{type:"button",onClick:()=>e.insert(t.value.length,""),children:u})]})})]})},c=e=>{let{initialValues:t,meta:n,label:i,fieldName:l,onChange:a,...d}=e;return(0,r.jsxs)(s.__,{variant:"label.border",...d,children:[(0,r.jsx)(o.gN,{as:s.XZ,type:"checkbox",name:l,onChange:()=>a(!n.value),checked:n.value}),i]})},u=e=>{let{field:t,label:n,defaultValue:i,onChange:l,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,r.jsx)(c,{meta:{value:u},fieldName:t.name,onChange:e=>p(e)&&l&&l(e),label:"function"==typeof n?n(o,u):n})};(i=l||(l={}))[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:l,fieldName:a,fields:d,initialValues:c,isDisabled:u,autoFocus:h}=e,m=i.error?0:u||l.disabled?1:void 0;return(0,r.jsxs)(s.xu,{sx:t,children:[(0,r.jsxs)(s.__,{variant:"label.primary",htmlFor:a,children:[l.label||a,i.touched&&i.error?(0,r.jsx)(s.xv,{as:"span",variant:"text.labelError",children:i.error}):null]}),(0,r.jsx)(o.gN,{id:a,name:a,type:"text",placeholder:l.placeholder||l.label||a,...l.fieldLevelValidation&&c?{validate:e=>l.fieldLevelValidation&&l.fieldLevelValidation({value:e,fields:d,initialId:c.id})}:null,...n,as:s.II,sx:p(m),disabled:u||l.disabled,autoFocus:null!=h?h:l.autoFocus})]})}},70705:function(e,t,n){"use strict";var i=n(52322),l=n(2784),r=n(75289);let o=(0,l.forwardRef)((e,t)=>{let{children:n,Component:l=r.kC,sx:o={},...a}=e;return(0,i.jsx)(l,{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),l=n(11699),r=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),m=n(66770),f=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:l={},...r}=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",...l},as:n,ref:a,...r,children:t}),s&&(0,i.jsx)(v,{children:(0,i.jsx)(f.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:r,sliceFieldName:o,theme:a,WidgetIcon:s,widgetIconTooltip:d}=e;return(0,i.jsxs)(p.kC,{sx:{alignItems:"center",position:"relative"},children:[(0,i.jsx)(l.c3,{content:d,sideOffset:2,disableHoverableContent:!0,children:(0,i.jsx)(l.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:r,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:f,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)(m.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)(l.m,{title:"Repeatable",color:"purple",size:"medium",sx:{alignSelf:"center",marginInline:16}}),k||null,j||(0,i.jsx)(m.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)(r.v2,{children:[(0,i.jsx)(r.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)(r.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)(r.sN,{style:{padding:"6px",cursor:"pointer"},onSelect:()=>f(E),children:"Delete field"})})]})]})]}),b||null]})]}),I]})})}})})}},66770:function(e,t,n){"use strict";var i=n(52322),l=n(75289);let r=(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=r,...m}=e;return(0,i.jsx)(l.hU,{onClick:n,"aria-label":o,type:"button",sx:{...c?{width:d,height:d}:null,...p&&h(u,s),...t},...m,children:(0,i.jsx)(a,{size:d})})}},89280:function(e,t,n){"use strict";var i=n(52322),l=n(63397),r=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,m]=(0,l.U$)(t),f=n.component;return(0,i.jsx)(o.xu,{sx:{mt:2,alignItems:"center",...n.type===s.h.CHECKBOX?{display:"flex",height:"130%"}:null},children:f?(0,i.jsx)(f,{meta:h,field:p,helpers:m,fieldName:t,formField:n,initialValues:c}):(0,i.jsxs)(r.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=>m.setValue(e)})]})})}},3285:function(e,t,n){"use strict";n.d(t,{Z:function(){return A}});var i=n(52322),l=n(37149),r=n.n(l),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 m=e=>{let{children:t,...n}=e,{theme:l}=(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(l.colors.primary),color:l.colors.text,fontWeight:"500",opacity:"1",backgroundColor:"transparent"}:{borderBottom:"3px solid transparent"}},children:t})};m.tabsRole="Tab";var f=(0,u.memo)(e=>{let{children:t,Footer:n,Header:l,tabs:r,bodySx:o,footerSx:a,defaultIndex:d=0}=e,[f,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:l,Footer:n,children:(0,i.jsxs)(p.mQ,{defaultIndex:d,onSelect:e=>x(e),children:[(0,i.jsx)(h,{children:(r||[]).map(e=>(0,i.jsx)(m,{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===f?"block":"none"},children:(0,i.jsx)(p.x4,{children:e})}))]})})}),x=n(80575),g=e=>{var t,n;let{text:l,sliceFieldName:r,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:l}),(0,i.jsx)(s.xv,{as:"p",sx:{display:["none","none","initial"],fontSize:"14px",ml:1,color:"textClear"},children:r})]})},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"),l=(0,u.useRef)(null!=n.initialValue&&n.initialValue.length>0);(0,u.useEffect)(()=>{l.current||null==e||i.setValue((0,L.lV)(e),!1)},[e]),(0,u.useEffect)(()=>{let n=null==t||0===t.length;if(l.current){if(!n)return;l.current=!1}else n||null!=e&&t===(0,L.lV)(e)||(l.current=!0)},[t])}var M=(0,u.memo)(e=>{let{formId:t,initialValues:n,validationSchema:l,onSave:r,FormFields:o,children:a}=e;return(0,i.jsx)(s.xu,{children:(0,i.jsx)(w.J9,{initialValues:n,validationSchema:l,onSubmit:(e,t)=>{let{id:n,...i}=e;r({newKey:n,value:Object.entries(i).reduce((e,t)=>{let[n,i]=t;if(typeof i!==Boolean&&!i){var l;let t=null===(l=o[n])||void 0===l?void 0:l.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})}r().setAppElement("#__next");var A=e=>{let{close:t,data:n,fields:l,onSave:r,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,m]}=n,y=(0,T.t)(_.C,m.config,m.type);if(!y)return(0,i.jsxs)("div",{children:[m.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,m.config):m.config},{res:N,err:R}=(()=>{try{return{res:L.validateSync({type:m.type,config:A},{stripUnknown:!0})}}catch(e){return{err:e}}})();R&&(console.error("[EditModal] Failed to validate field of type ".concat(m.type,".\n Please update model.json accordingly.")),console.error(R));let P={id:h,config:N?N.config:A},[q,z]=k.id.validate.matches,V=d.object().shape({id:d.string().matches(q,z).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:V,FormFields:k,onSave:e=>{let{newKey:n,value:i}=e;r({apiId:h,newKey:n,value:{...m,...i},updateMeta:{fieldIdChanged:{previousPath:[h],newPath:[n]}}}),t()},children:e=>{let{isValid:n,isSubmitting:r,initialValues:o}=e,a=w?(0,i.jsx)(w,{...e,fields:l},"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:l,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)(f,{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&&r,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),l=n(2784),r=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),m=n(38193);let f={position:"relative",top:"3px"};var x=e=>{var t,n,r;let{code:o,lang:a}=e,{theme:s}=(0,p.B7)(),[x,g]=(0,l.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)(m.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===(r=s.colors)||void 0===r?void 0:r.success,style:f}):(0,i.jsx)(d.LhG,{size:16,style:f}),(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:l,hintItemName:o}=e,a=n({item:l}),d=[a];if("Link"===l.value.type){var c,u,p,h,m;null!==(h=null===(c=l.value.config)||void 0===c?void 0:c.allowText)&&void 0!==h&&h&&d.push("allowText"),null!==(m=null===(u=l.value.config)||void 0===u?void 0:u.repeat)&&void 0!==m&&m&&d.push("repeat"),(null===(p=l.value.config)||void 0===p?void 0:p.variants)&&d.push("variants")}let{data:f,error:g}=(0,r.ZP)(d.join("$"),async()=>await s.managerClient.snippets.readSnippets({fieldPath:a.split("."),model:l.value,itemName:o}));if(g&&console.error(g),!f||g)return null;let v=f.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),l=n(11699),r=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:r}=e;return(0,i.jsxs)(l.ae,{open:t,onOpenChange:n,size:"small",children:[(0,i.jsx)(l.al,{title:"Static zone"}),(0,i.jsx)(l.aj,{children:(0,i.jsx)(l.bn,{children:(0,i.jsxs)(l.D,{as:"article",flexDirection:"column",padding:16,gap:4,children:[(0,i.jsx)(l.bL,{sx:{marginBottom:4},color:"purple9",variant:"smallBold",children:"About"}),(0,i.jsx)(l.bL,{variant:"h3",children:"What is the static zone?"}),(0,i.jsx)(l.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)(l.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)(l.ah,{children:(0,i.jsx)(l.af,{size:"medium",sx:{flexGrow:1},onClick:()=>{r(),n(!1)},children:"Got it"})})]})}var h=n(76611),m=n(5683);let f=(0,o.forwardRef)((e,t)=>{var n;return(0,i.jsx)(l.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:r,onSelectField:a}=e,[s,d]=(0,o.useState)(!1),[c,x]=(0,o.useState)(!1),[v,b]=(0,h.V)(m.vm,!1);return(0,i.jsxs)(l.D,{position:"relative",children:[(0,i.jsx)(f,{onClick:()=>{v?d(!0):x(!0)},"data-testid":r}),(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:l,onSelectField:r}=e;return(0,i.jsx)(u.S,{disabled:t,onSelectField:r,fields:n,trigger:(0,i.jsx)(f,{"data-testid":l})})}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:l,enterEditMode:r,enterSelectMode:o,onDragEnd:a,renderFieldAccessor:s,onDeleteItem:d,onSave:c,showHints:u,renderHintBase:p,isRepeatable:h,testId:m,isRepeatableCustomType:f}=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":m,sx:{paddingInline:"16px !important"},children:[t.map((e,t)=>{let{value:{config:a,type:m}}=e,x=(0,F.t)(y.C,a,m);if(!x)return(0,i.jsx)(C.Z,{children:(0,i.jsxs)(S.xv,{children:['Field type "',m,'" not supported']})});let g={item:e,index:t,tabId:l,widget:x,showHints:u,key:e.key,enterSelectMode:o,renderFieldAccessor:s,enterEditMode:r,parentSnapshot:n,deleteItem:d,saveItem:c,draggableId:"list-item-".concat(e.key),isRepeatableCustomType:f,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:r}=e;return(0,i.jsxs)("div",{className:w().root,children:[(0,i.jsxs)("div",{children:[(0,i.jsx)(l.bL,{variant:"bold",children:n}),(0,i.jsx)(l.bL,{color:"grey11",children:"A field is an input for content (e.g. text, images, links)."})]}),r]})},D=e=>{let t,{zoneType:n,zoneTypeFormat:r,tabId:p,title:h,fields:m,poolOfFieldsToCheck:f,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(f).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&&m.length>0?t=(0,i.jsx)(u.S,{...P}):"customType"===n&&(t=(0,i.jsx)(x,{...P,zoneTypeFormat:r})),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(d.Bu,{actions:(0,i.jsxs)(i.Fragment,{children:[m.length>0&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l.bL,{color:"grey11",component:"span",noWrap:!0,children:"Show code snippets?"}),(0,i.jsx)(l.bC,{checked:O,onCheckedChange:A,size:"small",style:{flexShrink:0},"data-testid":"code-snippets-switch"})]}),t]}),children:h}),0===m.length&&"slice"===n?(0,i.jsx)(L,{zoneType:"customType"===n?"page"===r?"page type":"custom type":n,heading:D,action:(0,i.jsx)(u.S,{...P})}):m.length>0?(0,i.jsx)(a.xR,{children:(0,i.jsx)(T,{tabId:p,isRepeatable:v,fields:m,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:f,zoneType:n})]})};D.propTypes={isRepeatable:r.bool,title:r.string.isRequired,dataTip:r.string.isRequired,onSave:r.func.isRequired,onDragEnd:r.func.isRequired,onDeleteItem:r.func.isRequired,poolOfFieldsToCheck:(0,r.arrayOf)((0,r.shape)({key:r.string,value:r.object})),renderHintBase:r.func.isRequired,renderFieldAccessor:r.func.isRequired,widgetsArray:r.array.isRequired,fields:(0,r.arrayOf)((0,r.shape)({key:r.string.isRequired,value:(0,r.shape)({config:r.object,fields:r.array,type:r.string.isRequired})}))};var M=D},23134:function(e,t,n){"use strict";n.d(t,{t:function(){return l}});var i=n(59050);let l=(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 l;return null!==(l=e.Group)&&void 0!==l?l:e.NestedGroup}return e[n]}},9889:function(e,t,n){"use strict";n.d(t,{Jp:function(){return o},OR:function(){return r}});var i=n(7974),l=n(49046);let r={label:(0,l.II)("Label",{required:"This field is required",max:!0},void 0,void 0,"Label for content creators (defaults to field type)",!0),id:(0,l.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={...r,placeholder:(0,l.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 r}});var i=n(68169),l=n(79256);let r=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:l.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,r=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:m}=t||{};return{type:l.h.INPUT,label:e,validate:{required:(0,i.MJ)(h,s),min:(0,i.MJ)(u,o),max:(0,i.MJ)(p,a),matches:m},defaultValue:r,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),l=n(79256);let r=e=>null===e.defaultValue?void 0:void 0!==e.defaultValue?e.defaultValue:e.type===l.h.CHECKBOX||(e.type===l.h.INPUT?"":e.type===l.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,l=r(i);return void 0!==l?{...e,[n]:l}:e},{}),d=e=>i.object().shape(Object.entries(e).filter(e=>e).reduce((e,t)=>{let[n,l]=t,{validate:r,yupType:o}=l;if(!r)return e;if("function"==typeof r)return{...e,[n]:r(n,l)};let a=i[o]();return Object.entries(r).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,l;n.d(t,{h:function(){return i}}),(l=i||(i={})).CHECKBOX="checkbox",l.INPUT="input",l.SELECT="select"},45440:function(e,t,n){"use strict";n.d(t,{C:function(){return tc}});var i=n(52322),l=n(96317),r=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 m={...p.OR,repeat:(0,h.Jg)("Repeatable",!1,!0)};var f=e=>{let{initialValues:t,fields:n,values:l,setFieldValue:r}=e,{config:{repeat:o}}=l;return(0,i.jsxs)(d.k,{children:[Object.entries(m).filter(e=>{let[t]=e;return"repeat"!==t}).map(e=>{let[l,r]=e;return(0,i.jsx)(d.J,{children:(0,i.jsx)(c.Z,{fieldName:(0,u.lm)(l),formField:r,fields:n,initialValues:t})},l)}),(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:()=>r("config.repeat",!o)}),"Repeatable"]})})})]})};let x={icon:r.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:l}=e;return{Meta:x,Form:f,FormFields:m,schema:g(t),create:e=>({type:"Group",config:{label:e,repeat:!0,fields:[]}}),CustomListItem:n,TYPE_NAME:"Group",CUSTOM_NAME:i,hintItemName:l,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:l,widgetsArray:r,hintBase:o,parentSnapshot:d,showHints:c,isRepeatable:u,item:p,draggableId:h,saveItem:m,HintElement:f,...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 l=function(e){var t,n,i;let l=structuredClone(e.group);return null!==(n=l.config)&&void 0!==n||(l.config={}),null!==(i=(t=l.config).fields)&&void 0!==i||(t.fields={}),l.config.fields[e.fieldId]=e.field,l}({group:E.Fl.fromSM(p.value),fieldId:n,field:i});m({apiId:p.key,newKey:p.key,value:E.Fl.toSM(l),inGroupFieldAction:"add"}),(0,M.V)({id:n,field:i,isInAGroup:!0})},N=e=>{let{apiId:t,newKey:n,value:i}=e,l=i.type===b.GroupFieldType?E.Fl.fromSM(i):i,r=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:l});m({apiId:p.key,newKey:p.key,value:E.Fl.toSM(r),inGroupFieldAction:"update",updateMeta:{fieldIdChanged:{previousPath:[p.key,t],newPath:[p.key,n]}}}),(0,O.Z)({previousId:t,id:n,field:l,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});m({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:f,CustomEditElements:[(0,i.jsx)(C.S,{onSelectField:e=>{v({isOpen:!0,field:["",l[e].create("")]})},fields:r.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:l}=n,r=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),[l]=i.splice(e.sourceIndex,1);return i.splice(e.destinationIndex,0,l),n.config.fields=Object.fromEntries(i),n}({group:E.Fl.fromSM(p.value),sourceIndex:i,destinationIndex:l});(0,k.flushSync)(()=>{m({apiId:p.key,newKey:p.key,value:E.Fl.toSM(r)})})},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:r}}=e,a=(0,T.t)(l,n,r);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:l,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:r.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:r.U8L},{TYPE_NAME:z,FormFields:V,schema:B}=(0,w.zg)("Color"),G={create:e=>({type:"Color",config:{label:e,placeholder:""}}),FormFields:V,TYPE_NAME:z,schema:B,Meta:q,label:a.pG.name};var U=n(11699),J=n(63397);function Z(e){let{checked:t,height:n=130,setFieldValue:l}=e,[r,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)(U.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=>{l("config.allowText",e.target.checked)}}),"Allow display text"]}),(0,i.jsx)(U.c3,{container:r,align:"end",content:"Allow editors to customize the link display text",children:(0,i.jsx)(U.aX,{name:"alert",size:"medium",color:"grey11"})})]})})})})}function H(e){let{checked:t,setFieldValue:n}=e;return(0,i.jsxs)(U.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)(U.D,{alignItems:"center",gap:4,children:[(0,i.jsx)(U.aX,{name:"alert",size:"medium",color:"grey11"}),(0,i.jsxs)(U.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)(U.bL,{variant:"normal",color:"indigo11",children:"See documentation."})})]})]})]})}function W(e){var t,n;let{variants:l,onVariantsChange:r,error:o}=e,a=!!l,s=a?"Enabled":"Disabled",d="Options (".concat(null!==(t=null==l?void 0:l.length)&&void 0!==t?t:0,")"),c=(null!==(n=null==l?void 0:l.length)&&void 0!==n?n:0)>2,u=(0,y.useRef)();return(0,i.jsxs)(U.D,{overflow:"hidden",flexDirection:"column",border:!0,borderRadius:6,children:[(0,i.jsxs)(U.D,{border:{bottom:!0},padding:12,flexDirection:"column",gap:8,children:[(0,i.jsx)(U.bL,{variant:"h4",color:"grey12",children:"Variants"}),(0,i.jsx)(U.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)(U.D,{gap:8,children:[(0,i.jsx)(U.bC,{checked:a,onCheckedChange:e=>{r(e?["Primary","Secondary"]:void 0)}}),(0,i.jsx)(U.bL,{color:"grey11",children:s})]})]}),a&&(0,i.jsxs)(U.D,{border:{bottom:!0},padding:12,flexDirection:"column",gap:8,children:[(0,i.jsxs)(U.bL,{variant:"h5",color:"grey11",children:[d,!!o&&(0,i.jsx)(U.bL,{variant:"inherit",color:"tomato9",children:" ".concat(o)})]}),null==l?void 0:l.map((e,t)=>(0,i.jsxs)(U.D,{gap:4,alignItems:"center",children:[(0,i.jsx)(U.D,{flexGrow:1,backgroundColor:"white",padding:{inline:12,block:8},flexDirection:"column",border:!0,borderRadius:4,children:(0,i.jsx)(U.bN,{ref:e=>{u.current===t&&(u.current=void 0,null==e||e.focus())},placeholder:"Variant option (e.g. Primary)",value:e,onValueChange:e=>r(null==l?void 0:l.map((n,i)=>i===t?e:n))})}),c&&(0,i.jsx)(U.aZ,{type:"button",icon:"delete",onClick:()=>r(null==l?void 0:l.filter((e,n)=>n!==t))})]},t)),(0,i.jsx)(U.D,{children:(0,i.jsx)(U.E,{invisible:!0,startIcon:"add",onClick:()=>{u.current=null==l?void 0:l.length,r([...null!=l?l:[],""])},children:"Add option"})})]}),(0,i.jsx)(U.D,{backgroundColor:"white",flexDirection:"column",padding:12,children:(0,i.jsxs)(U.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:l}=e,r="config.variants",[o,a]=(0,J.U$)(r),s=null===(t=a.error)||void 0===t?void 0:t.find(e=>e);return(0,i.jsx)(W,{variants:n,onVariantsChange:e=>l(r,e),error:s})}let K={icon:r.$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:l,setFieldValue:r}=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,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)(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:l,initialValues:t})}),(0,i.jsx)(Z,{checked:o,setFieldValue:r})]})},"allowTargetBlank")]}),(0,i.jsx)(U.D,{height:8}),(0,i.jsxs)(U.D,{flexDirection:"column",gap:16,children:[(0,i.jsx)(H,{checked:a,setFieldValue:r}),(0,i.jsx)(X,{variants:p,setFieldValue:r})]})]})},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:r.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()}),el={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:l,fields:r}=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,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)(s.xu,{mt:20,children:(0,i.jsx)(ee.zE,{value:n.config.customtypes,onChange:e=>{l("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:er,schema:eo}=(0,w.zg)("Date"),ea={create:e=>({type:"Date",config:{label:e,placeholder:""}}),FormFields:er,TYPE_NAME:"Date",schema:eo,Meta:{icon:r.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:r.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:r.lPv},label:a.uG.name};var ep=n(8799),eh=n(90167),em=n(66770);let ef=e=>{let{onClick:t,error:n,onDelete:l,active:o,text:a,sx:d}=e;return(0,i.jsx)(em.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})]}),l?(0,i.jsx)(s.Ct,{onClick:l,variant:"circle-right",children:(0,i.jsx)(r.B4e,{})}):null]})})},ex=e=>{let{onClick:t}=e;return(0,i.jsx)(em.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:l}=e,[r,o]=(0,J.U$)(t),a=n?"*":"";return l?(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:l,meta:r,isConstraint:o,...a}=e,[s]=(0,J.U$)(t);return(0,i.jsx)(eh.Hq,{...a,fieldName:t,meta:r,formField:{label:n,placeholder:l},field:o?{value:"main",readOnly:!0}:{value:s.value},variant:o?"disabled":"primary"})},eb=e=>{let{name:t,label:n,placeholder:l,...r}=e,[o,a]=(0,J.U$)(t);return(0,i.jsx)(eh.Hq,{...r,fieldName:t,formField:{label:n,placeholder:l},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:r.Fwj},Form:e=>{let{initialValues:t,values:n,errors:l,fields:r,touched:o}=e,[a,p]=(0,y.useState)(0),{config:{thumbnails:h=[],constraint:m}}=n;return(0,y.useEffect)(()=>{p(h.length)},[h.length]),(0,i.jsxs)(d.k,{children:[Object.entries(ej).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.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)(J.F2,{name:"config.thumbnails",render:t=>{let{push:n,remove:r}=t;return(0,i.jsxs)(y.Fragment,{children:[(0,i.jsxs)(s.kC,{mb:3,children:[(0,i.jsx)(ef,{active:0===a,text:eS(m,!0),sx:{mr:2},onClick:()=>p(0)}),h.map((e,t)=>(0,i.jsx)(ef,{sx:{mr:3},active:a===+t+1,text:eS(e),error:!!l.thumbnails&&!!o.thumbnails&&!!o.thumbnails[t]&&!!l.thumbnails&&!!l.thumbnails[t],onDelete:()=>r(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:r._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:l,setFieldValue:r}=e,{config:{allowText:o,variants:a}}=n;return(0,i.jsxs)(U.D,{flexDirection:"column",gap:16,children:[(0,i.jsxs)(d.k,{children:[Object.entries(eF).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)(Z,{checked:o,setFieldValue:r})]}),(0,i.jsx)(X,{variants:a,setFieldValue:r})]})},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:r.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,J.u6)(),l=null===(t=n.config)||void 0===t?void 0:t.options[0];return(0,i.jsx)(eh.w8,{...e,defaultValue:e.field.value,controlledValue:l,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:r.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 ez=n(47927),eV=n(29259),eB=n.n(eV),eG=n(85505),eU=n.n(eG),eJ=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)(eJ.eR7,{}))},{value:"image",label:"image",icon:eZ((0,i.jsx)(eJ.LFN,{}))},{value:"embed",label:"embed",icon:eZ((0,i.jsx)(eJ.xqv,{}))},{value:"list-item",label:"list",icon:eZ((0,i.jsx)(eJ.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,ez.has)("parent",e)&&eB()(e.parent)&&(0,ez.has)(t,e.parent)&&eU()(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",l=eK(n,e),r=eK(n,i);return!!r&&"string"==typeof r||!("string"!=typeof l||(!l||!l.length)&&(!r||!r.length)||l.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:r.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:l,errors:r,fields:o,setFieldValue:a}=e,{config:{single:p,multi:h}}=l,m=p?eX(p):h?eX(h):eW,[f,x]=(0,y.useState)(!p),[g,v]=(0,y.useState)(m);return(0,y.useEffect)(()=>{let e=f?1:0;a(e0[e],g.join(",")),setTimeout(()=>{a(e0[1-e],void 0)},100)},[f,g]),(0,i.jsxs)(d.k,{children:[Object.entries(eQ).map(e=>{let[t,l]=e;return(0,i.jsx)(d.J,{children:(0,i.jsx)(c.Z,{fieldName:(0,u.lm)(t),formField:l,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)(em.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=r.config)||void 0===t?void 0:t[f?"multi":"single"])?(0,i.jsx)(s.xu,{sx:{position:"absolute"},children:(0,i.jsx)(s.xv,{as:"span",variant:"text.labelError",pl:0,children:r.config[f?"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:f,onChange:()=>x(!f)}),"Allow multiple paragraphs"]})})})]})},label:a._n.name};var e9=n(18978);let e6={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:e9.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:r.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:r.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:el,Date:ea,Embed:ec,GeoPoint:eu,Image:e_,Link:Q,LinkToMedia:eE,Number:eD,Select:eq,StructuredText:e5,Table:e6,Text:e8,Timestamp:te,UID:{create:e=>({type:"UID",config:{label:e,placeholder:""}}),Meta:{icon:r.XN7},schema:tn,TYPE_NAME:"UID",FormFields:tt,label:a.Fj.name}},tl=[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],tr="subItem",to=v({schemaTypeRegex:/^NestedGroup$/,customListItem:e=>(0,i.jsx)(A,{Widgets:ti,widgetsArray:tl,hintBase:tr,...e}),customName:"NestedGroup",hintItemName:tr}),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,l.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),l=n(68169),r=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:r.Jp,schema:i.object().shape({type:i.string().test({name:"type",test:function(t){return t===e}}),config:(0,l.gc)(o(r.Jp,"id"))}),create:()=>({type:e,config:(0,l.f7)(o(r.Jp,"id"))})})},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 l}});var i=n(41347);function l(e){var t,n,l,r,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===(l=e.config)||void 0===l?void 0:l.variants,linkSelect:null===(r=e.config)||void 0===r?void 0:r.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:l}=(0,i.WP)((0,i.Vg)({linkCustomtypes:null===(t=e.config)||void 0===t?void 0:t.customtypes}));return{linkPickedFields:n,linkNestedPickedFields:l}})()}}},5495:function(e,t,n){"use strict";n.d(t,{V:function(){return o}});var i=n(94160),l=n(49919),r=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,l.T)(window.location.pathname),..."Link"===a.type&&(0,r.F)(a)})}},39302:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var i=n(94160),l=n(49919),r=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,l.T)(window.location.pathname),..."Link"===s.type&&(0,r.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
|
+
(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),l=n(18337),r=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,r.Z)(a().root,t&&a()["root-border"])})},d=e=>{let{actions:t,children:n,toggle:r,...o}=e;return(0,i.jsxs)("div",{...o,className:a().header,children:[(0,i.jsx)(l.bL,{color:"grey11",component:"span",noWrap:!0,variant:"bold",children:n}),r,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 f},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 m},_n:function(){return h},gA:function(){return o},pG:function(){return l},pV:function(){return d},pt:function(){return r},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"},l={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"},r={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"},m={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"},f={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,m,d,u,l,r,f,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),l=n(18337),r=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:l,langSmithUrl:r}=e,o=(0,d.iv)({type:t,library:n,sliceId:i,variationId:l}),a=JSON.stringify({langSmithUrl:r});localStorage.setItem(o,a)}function u(e){let{type:t,library:n,sliceId:i,variationId:l}=e,r=(0,d.iv)({type:t,library:n,sliceId:i,variationId:l});localStorage.removeItem(r)}function p(e){let{type:t,library:n,sliceId:c,variationId:u}=e,{key:p,value:h,done:m}=function(e){let{type:t,library:n,sliceId:i,variationId:l}=e,r=(0,d.iv)({type:t,library:n,sliceId:i,variationId:l}),[a,c]=(0,s.V)(r,void 0,{schema:o.z.object({langSmithUrl:o.z.string().url().optional()})});return{key:r,value:a,done:()=>c(void 0)}}({type:t,library:n,sliceId:c,variationId:u}),[f,x]=(0,r.useState)(),g=e=>()=>{h&&(x(p),a.Xe.track({event:"slice-generation-feedback",type:t,sliceId:c,variationId:u,feedback:e,langSmithUrl:h.langSmithUrl}),m())};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l.be,{children:(0,i.jsx)(l.bQ,{anchor:(0,i.jsx)(l.D,{width:"100%",justifyContent:"center",position:"absolute",bottom:64}),icon:"check",title:"Thanks for your feedback!",seconds:2,open:!!f,onOpenChange:e=>{e||x(void 0)}},f)}),(0,i.jsx)(l.i,{children:h&&(0,i.jsxs)(l.D,{flexDirection:"row",justifyContent:"end",gap:8,alignItems:"center",children:[(0,i.jsx)(l.bL,{color:"grey11",children:"Did the AI get it right?"}),(0,i.jsxs)(l.D,{flexDirection:"row",gap:4,children:[(0,i.jsx)(l.c3,{side:"bottom",sideOffset:4,variant:"text",content:"Looks good",children:(0,i.jsx)(l.aZ,{variant:"solid",size:"small",icon:"thumbUp",onClick:g("up")})}),(0,i.jsx)(l.c3,{side:"bottom",sideOffset:4,variant:"text",content:"Needs improvement",children:(0,i.jsx)(l.aZ,{variant:"solid",size:"small",icon:"thumbDown",onClick:g("down")})})]})]})})]})}},23094:function(e,t,n){"use strict";n.d(t,{X:function(){return r}});var i=n(52322),l=n(18337);let r=e=>{let t;let{status:n}=e;switch(n){case"pending":t={icon:(0,i.jsx)(l.bg,{color:"grey11"}),text:"Saving..."};break;case"failed":t={icon:(0,i.jsx)(l.aX,{name:"close",color:"tomato11",size:"medium"}),text:"Failed to save"};break;case"done":t={icon:(0,i.jsx)(l.aX,{name:"check",color:"green11",size:"medium"}),text:"Auto-saved"}}return(0,i.jsxs)(l.D,{gap:8,alignItems:"center",children:[t.icon,(0,i.jsx)(l.bL,{color:"grey11",children:t.text})]})}},6609:function(e,t,n){"use strict";n.d(t,{S:function(){return o}});var i=n(52322),l=n(18337),r=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=>r.J9.some(t=>t.name===e.name)||e.name===r.Fj.name),h=d.find(e=>e.name===r.U.name);return(0,i.jsxs)(l.ar,{open:t,onOpenChange:n,children:[(0,i.jsx)(l.av,{disabled:o,children:null!=u?u:(0,i.jsx)(l.E,{startIcon:"add",color:"grey","data-testid":c,children:"Add a field"})}),(0,i.jsxs)(l.as,{align:"end",maxHeight:400,collisionPadding:8,children:[(0,i.jsx)(l.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)(l.au,{children:"Set of fields"}),(0,i.jsx)(a,{field:h,onSelectField:s})]})]})]})}function a(e){let{field:t,onSelectField:n}=e,{type:r,variant:o,name:a,icon:s,description:d,thumbnail:c}=t;return(0,i.jsx)(l.at,{startIcon:(0,i.jsx)(l.aX,{name:s,size:"large"}),description:d,onSelect:()=>n(null!=o?o:r),renderTooltip:e=>(0,i.jsx)(l.c3,{visible:!0,variant:"custom",content:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l.a_,{src:c,borderRadius:4,sx:{height:170,width:278},animateOnLoad:!1}),(0,i.jsx)(l.bL,{color:"white",children:"How it will look for content editors."})]}),align:"start",side:"left",sideOffset:4,animation:"none",children:e}),children:a},"".concat(r).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),l=n(47124),r=n(18337),o=n(2784),a=n(50477),s=n(87446);function d(e){return(0,i.jsx)(s.h,{renderError:()=>(0,i.jsxs)(r.D,{alignItems:"center",gap:8,children:[(0,i.jsx)(r.aX,{name:"alert",size:"small",color:"tomato10"}),(0,i.jsx)(r.bL,{color:"tomato10",children:"Error loading your types"})]}),children:(0,i.jsx)(r.bB,{fallback:(0,i.jsxs)(r.D,{flexDirection:"column",position:"relative",children:[(0,i.jsx)(r.bx,{height:240}),(0,i.jsxs)(r.D,{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",alignItems:"center",gap:8,children:[(0,i.jsx)(r.aX,{name:"autorenew",size:"small",color:"grey11"}),(0,i.jsx)(r.bL,{color:"grey11",children:"Loading your types..."})]})]}),children:(0,i.jsx)(c,{...e})})})}function c(e){let{value:t,onChange:n}=e,{allCustomTypes:l,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:l}):{};return(0,i.jsxs)(r.D,{overflow:"hidden",flexDirection:"column",border:!0,borderRadius:6,width:"100%",children:[(0,i.jsx)(r.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)(r.D,{flexDirection:"column",children:[(0,i.jsx)(r.bL,{variant:"h4",color:"grey12",children:"Allowed type"}),(0,i.jsxs)(r.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)(r.D,{margin:{block:12},children:(0,i.jsx)(r.f,{color:"warn",icon:"alert",subtitle:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.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)(r.bL,{color:"inherit",variant:"bold",children:"See documentation"}),(0,i.jsx)(r.aX,{name:"arrowForward",size:"small",color:"inherit"})]})]})})})]}),s.map(e=>{var o;return(0,i.jsxs)(r.D,{gap:4,padding:8,border:!0,borderRadius:6,borderColor:"grey6",backgroundColor:"white",justifyContent:"space-between",children:[s.length>1?(0,i.jsx)(r.bL,{children:e.id}):(0,i.jsx)(r.c5,{children:(0,i.jsx)(h,{customType:e,onChange:i=>{n(function(e){let{linkCustomtypes:t,fieldCheckMap:n,newCustomType:i,customTypeId:l}=e,r=[],o=Object.entries({...n,[l]: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?r.push(t):L(e)===l?r.push(L(e)):r.push(e)}return r}({fieldCheckMap:d,newCustomType:i,linkCustomtypes:t,customTypeId:e.id}))},fieldCheckMap:null!==(o=d[e.id])&&void 0!==o?o:{},allCustomTypes:l})}),(0,i.jsx)(r.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:l})}),(0,i.jsx)(r.D,{backgroundColor:"white",flexDirection:"column",padding:12,children:(0,i.jsxs)(r.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)(r.D,{flexDirection:"column",gap:8,alignItems:"center",padding:{block:24},children:[(0,i.jsxs)(r.D,{flexDirection:"column",alignItems:"center",gap:4,children:[(0,i.jsx)(r.bL,{variant:"h5",color:"grey12",children:"No type selected"}),(0,i.jsxs)(r.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)(r.D,{children:(0,i.jsx)(p,{allCustomTypes:t,onSelect:n})})]})}function p(e){let{allCustomTypes:t,onSelect:n}=e,l=(0,i.jsx)(r.E,{startIcon:"add",color:"grey",disabled:0===t.length,children:"Add type"});return 0===t.length?(0,i.jsx)(r.D,{children:(0,i.jsx)(r.c3,{content:"No type available",side:"bottom",align:"start",disableHoverableContent:!0,children:l})}):(0,i.jsx)(r.D,{children:(0,i.jsxs)(r.ar,{children:[(0,i.jsx)(r.av,{children:l}),(0,i.jsxs)(r.as,{maxHeight:400,minWidth:256,align:"center",children:[(0,i.jsx)(r.au,{children:(0,i.jsx)(r.bL,{color:"grey11",children:"Types"})}),t.map(e=>(0,i.jsx)(r.at,{onSelect:()=>n(e.id),children:(0,i.jsxs)(r.D,{alignItems:"center",justifyContent:"space-between",gap:8,children:[(0,i.jsx)(r.bO,{children:(0,i.jsx)(r.bL,{children:e.id})}),(0,i.jsx)(r.m,{title:(0,i.jsx)(r.bL,{variant:"extraSmall",color:"purple11",children:b(e.format)}),color:"purple",size:"small"})]})},e.id))]})]})})}function h(e){let{customType:t,fieldCheckMap:n,onChange:l,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=>{l({...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)(m,{field:c,fieldId:d,onChange:e=>{l({...n,[d]:{type:"contentRelationship",value:e}})},fieldCheckMap:"contentRelationship"===e.type?e.value:{},allCustomTypes:o},d)}return(0,i.jsx)(r.c6,{title:d,checked:(null===(t=n[d])||void 0===t?void 0:t.value)===!0,onCheckedChange:e=>{l({...n,[d]:{type:"checkbox",value:e}})}},d)}),s=C(n);return(0,i.jsx)(r.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)(f,{})},t.id)}function m(e){var t,n;let{field:l,fieldId:o,fieldCheckMap:a,onChange:s,allCustomTypes:d}=e,[c]=y(null===(t=l.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[l,o]=e;if("Group"===o.type){let e=null!==(n=p[l])&&void 0!==n?n:{};return(0,i.jsx)(x,{group:o,groupId:l,onChange:e=>{u({...p,[l]:{type:"group",value:e}})},fieldCheckMap:"group"===e.type?e.value:{}},l)}return(0,i.jsx)(r.c6,{title:l,checked:(null===(t=p[l])||void 0===t?void 0:t.value)===!0,onCheckedChange:e=>{u({...p,[l]:{type:"checkbox",value:e}})}},l)});return(0,i.jsx)(r.c7,{title:(0,i.jsxs)(r.bL,{children:[o," ",(0,i.jsxs)(r.bL,{color:"grey11",children:["→ ",c.id]})]}),subtitle:v(C(p).pickedFields),badge:b(c.format),children:h.length>0?h:(0,i.jsx)(f,{})},c.id)}function f(){return(0,i.jsx)(r.bL,{color:"grey11",children:"No available fields to select"})}function x(e){let{group:t,groupId:n,fieldCheckMap:l,onChange:o}=e,a=w(t).map(e=>{var t;let{fieldId:n}=e;return(0,i.jsx)(r.c6,{title:n,checked:(null===(t=l[n])||void 0===t?void 0:t.value)===!0,onCheckedChange:e=>{o({...l,[n]:{type:"checkbox",value:e}})}},n)});return(0,i.jsx)(r.c7,{title:n,subtitle:v(C(l).pickedFields),badge:"Group",children:a.length>0?a:(0,i.jsx)(f,{})},n)}function g(e){let{group:t,groupId:n,fieldCheckMap:l,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=l[s])&&void 0!==n?n:{};return(0,i.jsx)(m,{field:d,fieldId:s,fieldCheckMap:"contentRelationship"===e.type?e.value:{},onChange:e=>{o({...l,[s]:{type:"contentRelationship",value:e}})},allCustomTypes:a},s)}return(0,i.jsx)(r.c6,{title:s,checked:(null===(t=l[s])||void 0===t?void 0:t.value)===!0,onCheckedChange:e=>{o({...l,[s]:{type:"checkbox",value:e}})}},s)});return(0,i.jsx)(r.c7,{title:n,subtitle:v(C(l).pickedFields),badge:"Group",children:s.length>0?s:(0,i.jsx)(f,{})},n)}function v(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"selected";if(0!==e)return"(".concat(e," ").concat((0,l._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 l={};if(i){let i=n.find(e=>e.id===t.id);if(!i)return e;l=T(i)}let r=t.fields.reduce((e,t)=>{let r=l[L(t)];if(i&&void 0===r)return e;if("string"==typeof t)return i&&void 0!==r&&"Group"===r.type||(e[t]={type:"checkbox",value:!0}),e;if("fields"in t&&void 0!==t.fields){if(i&&void 0!==r&&"Group"!==r.type)return e;let o=function(e){let{group:t,ctFlatFieldMap:n,allCustomTypes:i}=e,l=void 0!==i,r=t.fields.reduce((e,r)=>{let o=E(n,t.id,L(r));if(l&&!o)return e;if("string"==typeof r)return l&&void 0!==o&&"Group"===o.type||(e[r]={type:"checkbox",value:!0}),e;if("customtypes"in r&&void 0!==r.customtypes){if(l&&void 0!==o&&!_(o))return e;let t=k({field:r,allCustomTypes:i});t&&(e[r.id]=t)}return e},{});if(0!==Object.keys(r).length)return{type:"group",value:r}}({group:t,allCustomTypes:n,ctFlatFieldMap:l});return o&&(e[t.id]=o),e}if("customtypes"in t&&void 0!==t.customtypes){if(i&&void 0!==r&&!_(r))return e;let l=k({field:t,allCustomTypes:n});l&&(e[t.id]=l)}return e},{});return Object.keys(r).length>0&&(e[t.id]=r),e},{})}function k(e){let{field:t,allCustomTypes:n}=e,i=void 0!==n,l=t.customtypes.reduce((e,t)=>{if("string"==typeof t)return e;let l={};if(i){let i=n.find(e=>e.id===t.id);if(!i)return e;l=T(i)}let r=t.fields.reduce((e,t)=>{if("string"==typeof t){let n=l[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 r=E(l,t.id,n);return i&&(void 0===r||"Group"===r.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(r).length>0&&(e[t.id]=r),e},{});if(0!==Object.keys(l).length)return{type:"contentRelationship",value:l}}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:l}=C(n,t);return{pickedFields:e.pickedFields+i,nestedPickedFields:e.nestedPickedFields+l}},{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,l;let r=e[t];if(void 0!==r&&"Group"===r.type)return null===(l=r.config)||void 0===l?void 0:null===(i=l.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}},38193:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var i=n(52322),l=n(61183);n(2784);var r=n(59326),o=n(75289);l.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,r.B7)(),m=s?l.Z.highlight(n,{language:"vue"===s?"html":s}).value:l.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:m}})]})}},80575:function(e,t,n){"use strict";n.d(t,{J:function(){return o},k:function(){return r}});var i=n(52322);n(2784);var l=n(75289);let r=e=>{let{children:t,sx:n,...r}=e;return(0,i.jsx)(l.xu,{sx:{display:["block","block","flex"],flexWrap:"wrap",justifyContent:"space-between",...n},...r,children:t})},o=e=>{let{children:t,cols:n=2}=e;return(0,i.jsx)(l.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,l,r=n(52322),o=n(63397),a=n(2784),s=n(75289),d=e=>{let{field:t,meta:n,fieldName:i,label:l,focusOnNewEntry:d=!0,inputPlaceholder:c,buttonLabel:u}=e,[p,h]=(0,a.useState)(n.value.length),m=(0,a.useRef)(Array(n.value.length));return(0,a.useEffect)(()=>{m.current=m.current.slice(0,n.value.length)},[n.value.length]),(0,a.useEffect)(()=>{let e=m.current.length;d&&e>p&&m.current[e-1].focus(),h(e)},[m.current.length,d,p]),(0,r.jsxs)(a.Fragment,{children:[(0,r.jsxs)(s.__,{variant:"label.primary",htmlFor:i,children:[l,n.touched&&n.error?(0,r.jsx)(s.xv,{as:"span",variant:"text.labelError",children:n.error}):null]}),(0,r.jsx)(o.F2,{name:i,id:i,...t,render:e=>(0,r.jsxs)("div",{children:[t.value&&t.value.length>0?t.value.map((t,n)=>(0,r.jsxs)(s.kC,{my:2,children:[(0,r.jsx)(s.II,{placeholder:c,name:"".concat(i,".").concat(n),value:t,ref:e=>m.current[n]=e,onChange:t=>{let{target:{value:i}}=t;return e.replace(n,i)}}),(0,r.jsx)(s.zx,{ml:2,type:"button",variant:"secondary",onClick:()=>e.remove(n),children:"-"})]},"".concat(i,"-").concat(+n+1))):null,(0,r.jsx)(s.zx,{type:"button",onClick:()=>e.insert(t.value.length,""),children:u})]})})]})},c=e=>{let{initialValues:t,meta:n,label:i,fieldName:l,onChange:a,...d}=e;return(0,r.jsxs)(s.__,{variant:"label.border",...d,children:[(0,r.jsx)(o.gN,{as:s.XZ,type:"checkbox",name:l,onChange:()=>a(!n.value),checked:n.value}),i]})},u=e=>{let{field:t,label:n,defaultValue:i,onChange:l,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,r.jsx)(c,{meta:{value:u},fieldName:t.name,onChange:e=>p(e)&&l&&l(e),label:"function"==typeof n?n(o,u):n})};(i=l||(l={}))[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:l,fieldName:a,fields:d,initialValues:c,isDisabled:u,autoFocus:h}=e,m=i.error?0:u||l.disabled?1:void 0;return(0,r.jsxs)(s.xu,{sx:t,children:[(0,r.jsxs)(s.__,{variant:"label.primary",htmlFor:a,children:[l.label||a,i.touched&&i.error?(0,r.jsx)(s.xv,{as:"span",variant:"text.labelError",children:i.error}):null]}),(0,r.jsx)(o.gN,{id:a,name:a,type:"text",placeholder:l.placeholder||l.label||a,...l.fieldLevelValidation&&c?{validate:e=>l.fieldLevelValidation&&l.fieldLevelValidation({value:e,fields:d,initialId:c.id})}:null,...n,as:s.II,sx:p(m),disabled:u||l.disabled,autoFocus:null!=h?h:l.autoFocus})]})}},70705:function(e,t,n){"use strict";var i=n(52322),l=n(2784),r=n(75289);let o=(0,l.forwardRef)((e,t)=>{let{children:n,Component:l=r.kC,sx:o={},...a}=e;return(0,i.jsx)(l,{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),l=n(18337),r=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),m=n(66770),f=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:l={},...r}=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",...l},as:n,ref:a,...r,children:t}),s&&(0,i.jsx)(v,{children:(0,i.jsx)(f.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:r,sliceFieldName:o,theme:a,WidgetIcon:s,widgetIconTooltip:d}=e;return(0,i.jsxs)(p.kC,{sx:{alignItems:"center",position:"relative"},children:[(0,i.jsx)(l.c3,{content:d,sideOffset:2,disableHoverableContent:!0,children:(0,i.jsx)(l.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:r,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:f,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)(m.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)(l.m,{title:"Repeatable",color:"purple",size:"medium",sx:{alignSelf:"center",marginInline:16}}),k||null,j||(0,i.jsx)(m.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)(r.v2,{children:[(0,i.jsx)(r.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)(r.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)(r.sN,{style:{padding:"6px",cursor:"pointer"},onSelect:()=>f(E),children:"Delete field"})})]})]})]}),b||null]})]}),I]})})}})})}},66770:function(e,t,n){"use strict";var i=n(52322),l=n(75289);let r=(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=r,...m}=e;return(0,i.jsx)(l.hU,{onClick:n,"aria-label":o,type:"button",sx:{...c?{width:d,height:d}:null,...p&&h(u,s),...t},...m,children:(0,i.jsx)(a,{size:d})})}},89280:function(e,t,n){"use strict";var i=n(52322),l=n(63397),r=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,m]=(0,l.U$)(t),f=n.component;return(0,i.jsx)(o.xu,{sx:{mt:2,alignItems:"center",...n.type===s.h.CHECKBOX?{display:"flex",height:"130%"}:null},children:f?(0,i.jsx)(f,{meta:h,field:p,helpers:m,fieldName:t,formField:n,initialValues:c}):(0,i.jsxs)(r.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=>m.setValue(e)})]})})}},3285:function(e,t,n){"use strict";n.d(t,{Z:function(){return A}});var i=n(52322),l=n(37149),r=n.n(l),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 m=e=>{let{children:t,...n}=e,{theme:l}=(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(l.colors.primary),color:l.colors.text,fontWeight:"500",opacity:"1",backgroundColor:"transparent"}:{borderBottom:"3px solid transparent"}},children:t})};m.tabsRole="Tab";var f=(0,u.memo)(e=>{let{children:t,Footer:n,Header:l,tabs:r,bodySx:o,footerSx:a,defaultIndex:d=0}=e,[f,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:l,Footer:n,children:(0,i.jsxs)(p.mQ,{defaultIndex:d,onSelect:e=>x(e),children:[(0,i.jsx)(h,{children:(r||[]).map(e=>(0,i.jsx)(m,{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===f?"block":"none"},children:(0,i.jsx)(p.x4,{children:e})}))]})})}),x=n(80575),g=e=>{var t,n;let{text:l,sliceFieldName:r,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:l}),(0,i.jsx)(s.xv,{as:"p",sx:{display:["none","none","initial"],fontSize:"14px",ml:1,color:"textClear"},children:r})]})},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"),l=(0,u.useRef)(null!=n.initialValue&&n.initialValue.length>0);(0,u.useEffect)(()=>{l.current||null==e||i.setValue((0,L.lV)(e),!1)},[e]),(0,u.useEffect)(()=>{let n=null==t||0===t.length;if(l.current){if(!n)return;l.current=!1}else n||null!=e&&t===(0,L.lV)(e)||(l.current=!0)},[t])}var M=(0,u.memo)(e=>{let{formId:t,initialValues:n,validationSchema:l,onSave:r,FormFields:o,children:a}=e;return(0,i.jsx)(s.xu,{children:(0,i.jsx)(w.J9,{initialValues:n,validationSchema:l,onSubmit:(e,t)=>{let{id:n,...i}=e;r({newKey:n,value:Object.entries(i).reduce((e,t)=>{let[n,i]=t;if(typeof i!==Boolean&&!i){var l;let t=null===(l=o[n])||void 0===l?void 0:l.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})}r().setAppElement("#__next");var A=e=>{let{close:t,data:n,fields:l,onSave:r,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,m]}=n,y=(0,T.t)(_.C,m.config,m.type);if(!y)return(0,i.jsxs)("div",{children:[m.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,m.config):m.config},{res:N,err:R}=(()=>{try{return{res:L.validateSync({type:m.type,config:A},{stripUnknown:!0})}}catch(e){return{err:e}}})();R&&(console.error("[EditModal] Failed to validate field of type ".concat(m.type,".\n Please update model.json accordingly.")),console.error(R));let P={id:h,config:N?N.config:A},[q,z]=k.id.validate.matches,V=d.object().shape({id:d.string().matches(q,z).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:V,FormFields:k,onSave:e=>{let{newKey:n,value:i}=e;r({apiId:h,newKey:n,value:{...m,...i},updateMeta:{fieldIdChanged:{previousPath:[h],newPath:[n]}}}),t()},children:e=>{let{isValid:n,isSubmitting:r,initialValues:o}=e,a=w?(0,i.jsx)(w,{...e,fields:l},"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:l,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)(f,{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&&r,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),l=n(2784),r=n(49857),o=n(18337);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),m=n(38193);let f={position:"relative",top:"3px"};var x=e=>{var t,n,r;let{code:o,lang:a}=e,{theme:s}=(0,p.B7)(),[x,g]=(0,l.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)(m.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===(r=s.colors)||void 0===r?void 0:r.success,style:f}):(0,i.jsx)(d.LhG,{size:16,style:f}),(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:l,hintItemName:o}=e,a=n({item:l}),d=[a];if("Link"===l.value.type){var c,u,p,h,m;null!==(h=null===(c=l.value.config)||void 0===c?void 0:c.allowText)&&void 0!==h&&h&&d.push("allowText"),null!==(m=null===(u=l.value.config)||void 0===u?void 0:u.repeat)&&void 0!==m&&m&&d.push("repeat"),(null===(p=l.value.config)||void 0===p?void 0:p.variants)&&d.push("variants")}let{data:f,error:g}=(0,r.ZP)(d.join("$"),async()=>await s.managerClient.snippets.readSnippets({fieldPath:a.split("."),model:l.value,itemName:o}));if(g&&console.error(g),!f||g)return null;let v=f.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),l=n(18337),r=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:r}=e;return(0,i.jsxs)(l.ae,{open:t,onOpenChange:n,size:"small",children:[(0,i.jsx)(l.al,{title:"Static zone"}),(0,i.jsx)(l.aj,{children:(0,i.jsx)(l.bn,{children:(0,i.jsxs)(l.D,{as:"article",flexDirection:"column",padding:16,gap:4,children:[(0,i.jsx)(l.bL,{sx:{marginBottom:4},color:"purple9",variant:"smallBold",children:"About"}),(0,i.jsx)(l.bL,{variant:"h3",children:"What is the static zone?"}),(0,i.jsx)(l.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)(l.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)(l.ah,{children:(0,i.jsx)(l.af,{size:"medium",sx:{flexGrow:1},onClick:()=>{r(),n(!1)},children:"Got it"})})]})}var h=n(76611),m=n(5683);let f=(0,o.forwardRef)((e,t)=>{var n;return(0,i.jsx)(l.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:r,onSelectField:a}=e,[s,d]=(0,o.useState)(!1),[c,x]=(0,o.useState)(!1),[v,b]=(0,h.V)(m.vm,!1);return(0,i.jsxs)(l.D,{position:"relative",children:[(0,i.jsx)(f,{onClick:()=>{v?d(!0):x(!0)},"data-testid":r}),(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:l,onSelectField:r}=e;return(0,i.jsx)(u.S,{disabled:t,onSelectField:r,fields:n,trigger:(0,i.jsx)(f,{"data-testid":l})})}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:l,enterEditMode:r,enterSelectMode:o,onDragEnd:a,renderFieldAccessor:s,onDeleteItem:d,onSave:c,showHints:u,renderHintBase:p,isRepeatable:h,testId:m,isRepeatableCustomType:f}=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":m,sx:{paddingInline:"16px !important"},children:[t.map((e,t)=>{let{value:{config:a,type:m}}=e,x=(0,F.t)(y.C,a,m);if(!x)return(0,i.jsx)(C.Z,{children:(0,i.jsxs)(S.xv,{children:['Field type "',m,'" not supported']})});let g={item:e,index:t,tabId:l,widget:x,showHints:u,key:e.key,enterSelectMode:o,renderFieldAccessor:s,enterEditMode:r,parentSnapshot:n,deleteItem:d,saveItem:c,draggableId:"list-item-".concat(e.key),isRepeatableCustomType:f,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:r}=e;return(0,i.jsxs)("div",{className:w().root,children:[(0,i.jsxs)("div",{children:[(0,i.jsx)(l.bL,{variant:"bold",children:n}),(0,i.jsx)(l.bL,{color:"grey11",children:"A field is an input for content (e.g. text, images, links)."})]}),r]})},D=e=>{let t,{zoneType:n,zoneTypeFormat:r,tabId:p,title:h,fields:m,poolOfFieldsToCheck:f,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(f).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&&m.length>0?t=(0,i.jsx)(u.S,{...P}):"customType"===n&&(t=(0,i.jsx)(x,{...P,zoneTypeFormat:r})),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(d.Bu,{actions:(0,i.jsxs)(i.Fragment,{children:[m.length>0&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l.bL,{color:"grey11",component:"span",noWrap:!0,children:"Show code snippets?"}),(0,i.jsx)(l.bC,{checked:O,onCheckedChange:A,size:"small",style:{flexShrink:0},"data-testid":"code-snippets-switch"})]}),t]}),children:h}),0===m.length&&"slice"===n?(0,i.jsx)(L,{zoneType:"customType"===n?"page"===r?"page type":"custom type":n,heading:D,action:(0,i.jsx)(u.S,{...P})}):m.length>0?(0,i.jsx)(a.xR,{children:(0,i.jsx)(T,{tabId:p,isRepeatable:v,fields:m,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:f,zoneType:n})]})};D.propTypes={isRepeatable:r.bool,title:r.string.isRequired,dataTip:r.string.isRequired,onSave:r.func.isRequired,onDragEnd:r.func.isRequired,onDeleteItem:r.func.isRequired,poolOfFieldsToCheck:(0,r.arrayOf)((0,r.shape)({key:r.string,value:r.object})),renderHintBase:r.func.isRequired,renderFieldAccessor:r.func.isRequired,widgetsArray:r.array.isRequired,fields:(0,r.arrayOf)((0,r.shape)({key:r.string.isRequired,value:(0,r.shape)({config:r.object,fields:r.array,type:r.string.isRequired})}))};var M=D},23134:function(e,t,n){"use strict";n.d(t,{t:function(){return l}});var i=n(59050);let l=(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 l;return null!==(l=e.Group)&&void 0!==l?l:e.NestedGroup}return e[n]}},9889:function(e,t,n){"use strict";n.d(t,{Jp:function(){return o},OR:function(){return r}});var i=n(7974),l=n(49046);let r={label:(0,l.II)("Label",{required:"This field is required",max:!0},void 0,void 0,"Label for content creators (defaults to field type)",!0),id:(0,l.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={...r,placeholder:(0,l.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 r}});var i=n(68169),l=n(79256);let r=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:l.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,r=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:m}=t||{};return{type:l.h.INPUT,label:e,validate:{required:(0,i.MJ)(h,s),min:(0,i.MJ)(u,o),max:(0,i.MJ)(p,a),matches:m},defaultValue:r,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),l=n(79256);let r=e=>null===e.defaultValue?void 0:void 0!==e.defaultValue?e.defaultValue:e.type===l.h.CHECKBOX||(e.type===l.h.INPUT?"":e.type===l.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,l=r(i);return void 0!==l?{...e,[n]:l}:e},{}),d=e=>i.object().shape(Object.entries(e).filter(e=>e).reduce((e,t)=>{let[n,l]=t,{validate:r,yupType:o}=l;if(!r)return e;if("function"==typeof r)return{...e,[n]:r(n,l)};let a=i[o]();return Object.entries(r).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,l;n.d(t,{h:function(){return i}}),(l=i||(i={})).CHECKBOX="checkbox",l.INPUT="input",l.SELECT="select"},45440:function(e,t,n){"use strict";n.d(t,{C:function(){return tc}});var i=n(52322),l=n(96317),r=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 m={...p.OR,repeat:(0,h.Jg)("Repeatable",!1,!0)};var f=e=>{let{initialValues:t,fields:n,values:l,setFieldValue:r}=e,{config:{repeat:o}}=l;return(0,i.jsxs)(d.k,{children:[Object.entries(m).filter(e=>{let[t]=e;return"repeat"!==t}).map(e=>{let[l,r]=e;return(0,i.jsx)(d.J,{children:(0,i.jsx)(c.Z,{fieldName:(0,u.lm)(l),formField:r,fields:n,initialValues:t})},l)}),(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:()=>r("config.repeat",!o)}),"Repeatable"]})})})]})};let x={icon:r.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:l}=e;return{Meta:x,Form:f,FormFields:m,schema:g(t),create:e=>({type:"Group",config:{label:e,repeat:!0,fields:[]}}),CustomListItem:n,TYPE_NAME:"Group",CUSTOM_NAME:i,hintItemName:l,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:l,widgetsArray:r,hintBase:o,parentSnapshot:d,showHints:c,isRepeatable:u,item:p,draggableId:h,saveItem:m,HintElement:f,...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 l=function(e){var t,n,i;let l=structuredClone(e.group);return null!==(n=l.config)&&void 0!==n||(l.config={}),null!==(i=(t=l.config).fields)&&void 0!==i||(t.fields={}),l.config.fields[e.fieldId]=e.field,l}({group:E.Fl.fromSM(p.value),fieldId:n,field:i});m({apiId:p.key,newKey:p.key,value:E.Fl.toSM(l),inGroupFieldAction:"add"}),(0,M.V)({id:n,field:i,isInAGroup:!0})},N=e=>{let{apiId:t,newKey:n,value:i}=e,l=i.type===b.GroupFieldType?E.Fl.fromSM(i):i,r=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:l});m({apiId:p.key,newKey:p.key,value:E.Fl.toSM(r),inGroupFieldAction:"update",updateMeta:{fieldIdChanged:{previousPath:[p.key,t],newPath:[p.key,n]}}}),(0,O.Z)({previousId:t,id:n,field:l,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});m({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:f,CustomEditElements:[(0,i.jsx)(C.S,{onSelectField:e=>{v({isOpen:!0,field:["",l[e].create("")]})},fields:r.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:l}=n,r=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),[l]=i.splice(e.sourceIndex,1);return i.splice(e.destinationIndex,0,l),n.config.fields=Object.fromEntries(i),n}({group:E.Fl.fromSM(p.value),sourceIndex:i,destinationIndex:l});(0,k.flushSync)(()=>{m({apiId:p.key,newKey:p.key,value:E.Fl.toSM(r)})})},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:r}}=e,a=(0,T.t)(l,n,r);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:l,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:r.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:r.U8L},{TYPE_NAME:z,FormFields:V,schema:B}=(0,w.zg)("Color"),G={create:e=>({type:"Color",config:{label:e,placeholder:""}}),FormFields:V,TYPE_NAME:z,schema:B,Meta:q,label:a.pG.name};var U=n(18337),J=n(63397);function Z(e){let{checked:t,height:n=130,setFieldValue:l}=e,[r,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)(U.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=>{l("config.allowText",e.target.checked)}}),"Allow display text"]}),(0,i.jsx)(U.c3,{container:r,align:"end",content:"Allow editors to customize the link display text",children:(0,i.jsx)(U.aX,{name:"alert",size:"medium",color:"grey11"})})]})})})})}function H(e){let{checked:t,setFieldValue:n}=e;return(0,i.jsxs)(U.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)(U.D,{alignItems:"center",gap:4,children:[(0,i.jsx)(U.aX,{name:"alert",size:"medium",color:"grey11"}),(0,i.jsxs)(U.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)(U.bL,{variant:"normal",color:"indigo11",children:"See documentation."})})]})]})]})}function W(e){var t,n;let{variants:l,onVariantsChange:r,error:o}=e,a=!!l,s=a?"Enabled":"Disabled",d="Options (".concat(null!==(t=null==l?void 0:l.length)&&void 0!==t?t:0,")"),c=(null!==(n=null==l?void 0:l.length)&&void 0!==n?n:0)>2,u=(0,y.useRef)();return(0,i.jsxs)(U.D,{overflow:"hidden",flexDirection:"column",border:!0,borderRadius:6,children:[(0,i.jsxs)(U.D,{border:{bottom:!0},padding:12,flexDirection:"column",gap:8,children:[(0,i.jsx)(U.bL,{variant:"h4",color:"grey12",children:"Variants"}),(0,i.jsx)(U.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)(U.D,{gap:8,children:[(0,i.jsx)(U.bC,{checked:a,onCheckedChange:e=>{r(e?["Primary","Secondary"]:void 0)}}),(0,i.jsx)(U.bL,{color:"grey11",children:s})]})]}),a&&(0,i.jsxs)(U.D,{border:{bottom:!0},padding:12,flexDirection:"column",gap:8,children:[(0,i.jsxs)(U.bL,{variant:"h5",color:"grey11",children:[d,!!o&&(0,i.jsx)(U.bL,{variant:"inherit",color:"tomato9",children:" ".concat(o)})]}),null==l?void 0:l.map((e,t)=>(0,i.jsxs)(U.D,{gap:4,alignItems:"center",children:[(0,i.jsx)(U.D,{flexGrow:1,backgroundColor:"white",padding:{inline:12,block:8},flexDirection:"column",border:!0,borderRadius:4,children:(0,i.jsx)(U.bN,{ref:e=>{u.current===t&&(u.current=void 0,null==e||e.focus())},placeholder:"Variant option (e.g. Primary)",value:e,onValueChange:e=>r(null==l?void 0:l.map((n,i)=>i===t?e:n))})}),c&&(0,i.jsx)(U.aZ,{type:"button",icon:"delete",onClick:()=>r(null==l?void 0:l.filter((e,n)=>n!==t))})]},t)),(0,i.jsx)(U.D,{children:(0,i.jsx)(U.E,{invisible:!0,startIcon:"add",onClick:()=>{u.current=null==l?void 0:l.length,r([...null!=l?l:[],""])},children:"Add option"})})]}),(0,i.jsx)(U.D,{backgroundColor:"white",flexDirection:"column",padding:12,children:(0,i.jsxs)(U.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:l}=e,r="config.variants",[o,a]=(0,J.U$)(r),s=null===(t=a.error)||void 0===t?void 0:t.find(e=>e);return(0,i.jsx)(W,{variants:n,onVariantsChange:e=>l(r,e),error:s})}let K={icon:r.$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:l,setFieldValue:r}=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,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)(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:l,initialValues:t})}),(0,i.jsx)(Z,{checked:o,setFieldValue:r})]})},"allowTargetBlank")]}),(0,i.jsx)(U.D,{height:8}),(0,i.jsxs)(U.D,{flexDirection:"column",gap:16,children:[(0,i.jsx)(H,{checked:a,setFieldValue:r}),(0,i.jsx)(X,{variants:p,setFieldValue:r})]})]})},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:r.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()}),el={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:l,fields:r}=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,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)(s.xu,{mt:20,children:(0,i.jsx)(ee.zE,{value:n.config.customtypes,onChange:e=>{l("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:er,schema:eo}=(0,w.zg)("Date"),ea={create:e=>({type:"Date",config:{label:e,placeholder:""}}),FormFields:er,TYPE_NAME:"Date",schema:eo,Meta:{icon:r.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:r.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:r.lPv},label:a.uG.name};var ep=n(8799),eh=n(90167),em=n(66770);let ef=e=>{let{onClick:t,error:n,onDelete:l,active:o,text:a,sx:d}=e;return(0,i.jsx)(em.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})]}),l?(0,i.jsx)(s.Ct,{onClick:l,variant:"circle-right",children:(0,i.jsx)(r.B4e,{})}):null]})})},ex=e=>{let{onClick:t}=e;return(0,i.jsx)(em.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:l}=e,[r,o]=(0,J.U$)(t),a=n?"*":"";return l?(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:l,meta:r,isConstraint:o,...a}=e,[s]=(0,J.U$)(t);return(0,i.jsx)(eh.Hq,{...a,fieldName:t,meta:r,formField:{label:n,placeholder:l},field:o?{value:"main",readOnly:!0}:{value:s.value},variant:o?"disabled":"primary"})},eb=e=>{let{name:t,label:n,placeholder:l,...r}=e,[o,a]=(0,J.U$)(t);return(0,i.jsx)(eh.Hq,{...r,fieldName:t,formField:{label:n,placeholder:l},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:r.Fwj},Form:e=>{let{initialValues:t,values:n,errors:l,fields:r,touched:o}=e,[a,p]=(0,y.useState)(0),{config:{thumbnails:h=[],constraint:m}}=n;return(0,y.useEffect)(()=>{p(h.length)},[h.length]),(0,i.jsxs)(d.k,{children:[Object.entries(ej).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.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)(J.F2,{name:"config.thumbnails",render:t=>{let{push:n,remove:r}=t;return(0,i.jsxs)(y.Fragment,{children:[(0,i.jsxs)(s.kC,{mb:3,children:[(0,i.jsx)(ef,{active:0===a,text:eS(m,!0),sx:{mr:2},onClick:()=>p(0)}),h.map((e,t)=>(0,i.jsx)(ef,{sx:{mr:3},active:a===+t+1,text:eS(e),error:!!l.thumbnails&&!!o.thumbnails&&!!o.thumbnails[t]&&!!l.thumbnails&&!!l.thumbnails[t],onDelete:()=>r(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:r._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:l,setFieldValue:r}=e,{config:{allowText:o,variants:a}}=n;return(0,i.jsxs)(U.D,{flexDirection:"column",gap:16,children:[(0,i.jsxs)(d.k,{children:[Object.entries(eF).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)(Z,{checked:o,setFieldValue:r})]}),(0,i.jsx)(X,{variants:a,setFieldValue:r})]})},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:r.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,J.u6)(),l=null===(t=n.config)||void 0===t?void 0:t.options[0];return(0,i.jsx)(eh.w8,{...e,defaultValue:e.field.value,controlledValue:l,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:r.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 ez=n(47927),eV=n(29259),eB=n.n(eV),eG=n(85505),eU=n.n(eG),eJ=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)(eJ.eR7,{}))},{value:"image",label:"image",icon:eZ((0,i.jsx)(eJ.LFN,{}))},{value:"embed",label:"embed",icon:eZ((0,i.jsx)(eJ.xqv,{}))},{value:"list-item",label:"list",icon:eZ((0,i.jsx)(eJ.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,ez.has)("parent",e)&&eB()(e.parent)&&(0,ez.has)(t,e.parent)&&eU()(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",l=eK(n,e),r=eK(n,i);return!!r&&"string"==typeof r||!("string"!=typeof l||(!l||!l.length)&&(!r||!r.length)||l.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:r.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:l,errors:r,fields:o,setFieldValue:a}=e,{config:{single:p,multi:h}}=l,m=p?eX(p):h?eX(h):eW,[f,x]=(0,y.useState)(!p),[g,v]=(0,y.useState)(m);return(0,y.useEffect)(()=>{let e=f?1:0;a(e0[e],g.join(",")),setTimeout(()=>{a(e0[1-e],void 0)},100)},[f,g]),(0,i.jsxs)(d.k,{children:[Object.entries(eQ).map(e=>{let[t,l]=e;return(0,i.jsx)(d.J,{children:(0,i.jsx)(c.Z,{fieldName:(0,u.lm)(t),formField:l,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)(em.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=r.config)||void 0===t?void 0:t[f?"multi":"single"])?(0,i.jsx)(s.xu,{sx:{position:"absolute"},children:(0,i.jsx)(s.xv,{as:"span",variant:"text.labelError",pl:0,children:r.config[f?"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:f,onChange:()=>x(!f)}),"Allow multiple paragraphs"]})})})]})},label:a._n.name};var e3=n(18978);let e4={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:e3.WHV},label:a.BB.name},e6=p.Jp,e8=o.object().shape({type:o.string().matches(/^Text$/,{excludeEmptyString:!0}).required(),config:(0,u.gc)((0,w.B9)(e6,"id"))}),e9={create:e=>({type:"Text",config:{label:e,placeholder:""}}),Meta:{icon:r.SQS},schema:e8,TYPE_NAME:"Text",FormFields:e6,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:r.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:el,Date:ea,Embed:ec,GeoPoint:eu,Image:e_,Link:Q,LinkToMedia:eE,Number:eD,Select:eq,StructuredText:e5,Table:e4,Text:e9,Timestamp:te,UID:{create:e=>({type:"UID",config:{label:e,placeholder:""}}),Meta:{icon:r.XN7},schema:tn,TYPE_NAME:"UID",FormFields:tt,label:a.Fj.name}},tl=[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],tr="subItem",to=v({schemaTypeRegex:/^NestedGroup$/,customListItem:e=>(0,i.jsx)(A,{Widgets:ti,widgetsArray:tl,hintBase:tr,...e}),customName:"NestedGroup",hintItemName:tr}),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,l.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),l=n(68169),r=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:r.Jp,schema:i.object().shape({type:i.string().test({name:"type",test:function(t){return t===e}}),config:(0,l.gc)(o(r.Jp,"id"))}),create:()=>({type:e,config:(0,l.f7)(o(r.Jp,"id"))})})},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 l}});var i=n(41347);function l(e){var t,n,l,r,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===(l=e.config)||void 0===l?void 0:l.variants,linkSelect:null===(r=e.config)||void 0===r?void 0:r.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:l}=(0,i.WP)((0,i.Vg)({linkCustomtypes:null===(t=e.config)||void 0===t?void 0:t.customtypes}));return{linkPickedFields:n,linkNestedPickedFields:l}})()}}},5495:function(e,t,n){"use strict";n.d(t,{V:function(){return o}});var i=n(94160),l=n(49919),r=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,l.T)(window.location.pathname),..."Link"===a.type&&(0,r.F)(a)})}},39302:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var i=n(94160),l=n(49919),r=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,l.T)(window.location.pathname),..."Link"===s.type&&(0,r.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"}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[633],{21446:function(e,t,a){a.d(t,{S:function(){return S}});var r=a(52322),i=a(74217),n=a(18337),l=a(37792),s=a(5632),o=a(2784),c=a(76473),d=a(88932),u=a(30195),m=a(94160),g=a(34166),p=a(98250),f=a(68968),h=a(96317);let x=(0,o.forwardRef)((e,t)=>{let{width:a,height:i}=e;return void 0===a&&void 0===i&&(a=10,i=16),(0,r.jsxs)("svg",{ref:t,viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",height:i,width:a,children:[(0,r.jsx)("path",{d:"M5 7.83323C5 6.45253 6.11928 5.33325 7.49997 5.33325C8.8807 5.33325 10 6.45255 10 7.83328V8.16656C10 9.54728 8.8807 10.6666 7.49997 10.6666C6.11928 10.6666 5 9.54731 5 8.16661V7.83323Z",fill:"#1ABCFE"}),(0,r.jsx)("path",{d:"M0 13.3334C0 11.8607 1.19391 10.6667 2.66667 10.6667H5V13.5001C5 14.8808 3.88071 16.0001 2.5 16.0001C1.11929 16.0001 0 14.8808 0 13.5001L0 13.3334Z",fill:"#0ACF83"}),(0,r.jsx)("path",{d:"M5 0V5.33333H7.33333C8.80609 5.33333 10 4.13943 10 2.66667C10 1.19391 8.80609 0 7.33333 0L5 0Z",fill:"#FF7262"}),(0,r.jsx)("path",{d:"M0 2.66659C0 4.13934 1.19391 5.33325 2.66667 5.33325L5 5.33325L5 -8.15392e-05L2.66667 -8.15392e-05C1.19391 -8.15392e-05 0 1.19383 0 2.66659Z",fill:"#F24E1E"}),(0,r.jsx)("path",{d:"M0 8.00008C0 9.47284 1.19391 10.6667 2.66667 10.6667H5L5 5.33341L2.66667 5.33341C1.19391 5.33341 0 6.52732 0 8.00008Z",fill:"#A259FF"})]})});var y=a(80148),j=a(54597),b=a(62434),w=a(56141);function v(e){let t;let{slice:a}=e,i="uploading"===a.status||"generating"===a.status,l="uploadError"===a.status||"generateError"===a.status||"cancelled"===a.status,s="pending"===a.status||"generateError"===a.status||"generating"===a.status||"success"===a.status||"cancelled"===a.status;return l?t=(0,r.jsx)(n.E,{startIcon:"refresh",color:"grey",onClick:a.onRetry,children:"Retry"}):"figma"===a.source&&(t=(0,r.jsx)(n.c3,{content:"Pasted from Figma",children:(0,r.jsx)(w.S,{})})),(0,r.jsxs)(b.Zb,{disabled:i,children:[s?(0,r.jsx)(b.ZB,{src:a.thumbnailUrl}):(0,r.jsx)(b.ZB,{component:"div"}),(0,r.jsx)(b.eW,{loading:i,startIcon:function(e){switch(e){case"uploadError":case"generateError":case"cancelled":return"close";case"pending":return"image";case"success":return"check";default:return}}(a.status),title:"success"===a.status?a.model.name:"figma"===a.source?a.image.name.split(".")[0]:a.image.name,subtitle:function(e){switch(e.status){case"uploading":return"Uploading...";case"pending":var t;return(t=e.image.size)<1024?"".concat(t," B"):t<1048576?"".concat((t/1024).toFixed(1)," kB"):"".concat((t/1048576).toFixed(1)," MB");case"uploadError":return"Unable to upload image";case"generating":return"Generating...";case"generateError":return"Something went wrong";case"cancelled":return"Cancelled";case"success":return"Generated"}}(a),error:l,action:t})]})}let C=u.z.object({__type:u.z.literal("figma-to-prismic/clipboard-data"),name:u.z.string(),image:u.z.string().startsWith("data:image/")});function S(e){let{open:t,location:a,onSuccess:u,onClose:h}=e,b=(0,s.useRouter)(),[w,S]=(0,o.useState)([]),[L,E]=(0,o.useState)(!1),[D,U]=(0,o.useState)(!1),{syncChanges:z}=(0,f.g)(),{createSliceSuccess:N,openLoginModal:B}=(0,j.Z)(),{completeStep:P}=(0,p.k)(),R=function(e){let{open:t}=e,a=(0,o.useRef)([]);return(0,o.useEffect)(()=>{t&&(a.current=[],y.managerClient.slices.readAllSlices().then(e=>{a.current=e.models.map(e=>{let{model:t}=e;return t})}).catch(()=>null))},[t]),a}({open:t}),M=A(),{libraryID:Z,isLoading:G}=function(){let[e,t]=(0,o.useState)();return(0,o.useEffect)(()=>{y.managerClient.project.getSliceMachineConfig().then(e=>{var a;let r=null==e?void 0:null===(a=e.libraries)||void 0===a?void 0:a[0];if(void 0===r)throw Error("No library found in the config.");t(r)}).catch(()=>{throw Error("Could not get library ID from the config.")})},[]),{libraryID:e,isLoading:void 0===e}}(),T=(0,i.R9)($),_=(0,o.useRef)(crypto.randomUUID());(0,c.y1)(["meta+v","ctrl+v"],e=>{e.preventDefault(),Q({isShortcut:!0})},{enabled:t&&M}),(0,o.useEffect)(()=>{if(!w.some(e=>"generating"===e.status))return;let e=e=>{T();let t="Your current generating slices will be cancelled.";return e.returnValue=t,t};return b.events.on("routeChangeStart",T),window.addEventListener("beforeunload",e),()=>{b.events.off("routeChangeStart",T),window.removeEventListener("beforeunload",e)}},[w,b.events,T]);let V=e=>{let{index:t,slice:a}=e;S(e=>e.map((e,r)=>r===t?a(e):e))},O=e=>{if(J)return;if(e.length>10){d.Am.error("You can only upload ".concat(10," images at a time."));return}let t=w.length;S(t=>[...t,...e.map(e=>({source:"upload",status:"uploading",image:e}))]),e.forEach((e,a)=>{H({index:t+a,image:e,source:"upload"})})},X=()=>{d.Am.error("Please log in and try again."),q(),B()},H=async e=>{let{index:t,image:a,source:r}=e,i=_.current;V({index:t,slice:e=>({...e,status:"uploading",image:a,source:r})});try{let e=await I({image:a});if(i!==_.current)return;V({index:t,slice:t=>({...t,status:"pending",thumbnailUrl:e})})}catch(e){if(i!==_.current)return;if(V({index:t,slice:e=>({...e,status:"uploadError",onRetry:()=>void H({index:t,image:a,source:r})})}),(0,l.ff)(e)){X();return}}},W=async e=>{if(void 0===Z)return;let{index:t,imageUrl:r,source:i}=e,n=_.current,s=crypto.randomUUID();V({index:t,slice:e=>({...e,status:"generating",thumbnailUrl:r,requestId:s})});try{let e=await y.managerClient.customTypes.inferSlice({source:i,libraryID:Z,imageUrl:r,requestId:s});if(n!==_.current)return;let l=function(e){let{existingSlices:t,newSlices:a,slice:r}=e,i=new Set,n=new Set;for(let{id:e,name:a}of t)i.add(e),n.add(a.toLowerCase());for(let e of a)"success"===e.status&&(i.add(e.model.id),n.add(e.model.name.toLowerCase()));let l=r.id,s=2;for(;i.has(l);)l="".concat(r.id,"_").concat(s),s++;let o=r.name;for(s=2;n.has(o.toLowerCase());)o="".concat(r.name).concat(s),s++;return{...r,id:l,name:o}}({existingSlices:R.current,newSlices:w,slice:e.slice});if(S(a=>a.map((a,i)=>i!==t?a:{...a,status:"success",thumbnailUrl:r,model:l,langSmithUrl:e.langSmithUrl})),"upload"===i){n=_.current;let e=w[t],{errors:a}=await y.managerClient.slices.createSlice({libraryID:Z,model:l});if(a.length)throw Error("Failed to create slice ".concat(l.id,"."));if(await y.managerClient.slices.updateSliceScreenshot({libraryID:Z,sliceID:l.id,variationID:l.variations[0].id,data:e.image}),n!==_.current)return}P("createSlice"),m.Xe.track({event:"slice:created",id:l.id,name:l.name,library:Z,location:a,..."figma"===i?{mode:"figma-to-slice"}:{mode:"ai",langSmithUrl:e.langSmithUrl}}),m.Xe.track({event:"slice-generation:ended",error:!1,source:i}),(0,g.nZ)({type:"model",library:Z,sliceId:l.id,variationId:l.variations[0].id,langSmithUrl:e.langSmithUrl})}catch(e){if(n!==_.current)return;if(V({index:t,slice:a=>({...a,status:e instanceof Error&&"AbortError"===e.name?"cancelled":"generateError",thumbnailUrl:r,onRetry:()=>{W({index:t,imageUrl:r,source:i})}})}),(0,l.ff)(e)){X();return}m.Xe.track({event:"slice-generation:ended",error:!0,source:i})}},Y=w.reduce((e,t)=>("generating"===t.status?e.generating++:"uploading"===t.status?e.uploading++:"pending"===t.status?e.pending++:"success"===t.status&&e.completed++,e.loading=e.generating+e.uploading,e.generate=e.loading+e.pending,e),{generating:0,uploading:0,pending:0,completed:0,loading:0,generate:0}),J=Y.generating>0||Y.completed>0,q=()=>{Y.loading>0||(h(),_.current=crypto.randomUUID(),setTimeout(()=>S([]),250))},K=async()=>{if(void 0!==Z)try{E(!0);let e=await (0,m.y0)();N(e.libraries),z(),u({slices:w.flatMap(e=>"success"===e.status?e.model:[]),library:Z}),q()}finally{E(!1)}},Q=async e=>{var a;let{isShortcut:r=!1}=null!=e?e:{};if(!(!t||!M||w.some(e=>"figma"===e.source)||w.some(e=>"uploading"===e.status||"generating"===e.status))){if("function"!=typeof(null===(a=navigator.clipboard)||void 0===a?void 0:a.read)){d.Am.error("Clipboard paste is not supported in this browser.");return}try{let e=await navigator.clipboard.read();if(0===e.length){d.Am.error("No data found in clipboard.");return}let t="pasted-image.png",a=null,i=!1;for(let t of e){let e=t.types.find(e=>e.startsWith("image/"));if(void 0!==e){a=await t.getType(e);break}}for(let r of e)if(r.types.includes("text/plain"))try{let e=await r.getType("text/plain"),n=await e.text(),l=C.safeParse(JSON.parse(n));if(l.success){i=!0;let e=l.data;if(t="".concat(e.name,".png"),!a){let t=await fetch(e.image);a=await t.blob()}}else console.warn("Clipboard data validation failed:",l.error)}catch(e){console.warn("Failed to parse JSON from clipboard:",e)}if(!a){i?d.Am.error("Could not extract Figma data from clipboard. Please try copying again using the Prismic Figma plugin."):d.Am.error("No Figma data found in clipboard. Make sure you've copied a design using the Prismic Figma plugin.");return}let n=w.length;if(n>=10){d.Am.error("You can only upload ".concat(10," images at a time."));return}let l=new File([a],t,{type:a.type});S(e=>[...e,{source:"figma",status:"uploading",image:l}]),H({index:n,image:l,source:"figma"}),m.Xe.track({event:"slice-generation:pasted-from-figma",source:r?"shortcut":"button"}),d.Am.success("Pasted ".concat(t).concat(i?" from Figma":""))}catch(e){console.error("Failed to paste from clipboard:",e),d.Am.error("Failed to paste from clipboard. Please check browser permissions and try again.")}}};function $(){let e=w.flatMap(e=>"generating"===e.status?[e.requestId]:[]);0!==e.length&&e.forEach(e=>{y.managerClient.customTypes.cancelInferSlice({requestId:e})})}return(0,r.jsxs)(n.ae,{open:t,onOpenChange:e=>!e&&q(),children:[(0,r.jsx)(n.al,{title:"Generate slices with AI"}),(0,r.jsxs)(n.aj,{gap:0,children:[(0,r.jsx)(n.ak,{hidden:!0,children:"Upload images to generate slices with AI"}),G?(0,r.jsx)(n.D,{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",children:(0,r.jsx)(n.bg,{color:"purple9"})}):(0,r.jsxs)(r.Fragment,{children:[0===w.length?(0,r.jsxs)(n.D,{padding:16,height:"100%",gap:16,display:"flex",flexDirection:"column",children:[M&&(0,r.jsxs)(n.D,{display:"flex",gap:16,alignItems:"center",backgroundColor:"grey2",padding:16,borderRadius:12,children:[(0,r.jsxs)(n.D,{display:"flex",gap:8,alignItems:"center",flexGrow:1,children:[(0,r.jsx)(n.D,{width:48,height:48,backgroundColor:"grey12",borderRadius:"100%",display:"flex",alignItems:"center",justifyContent:"center",children:(0,r.jsx)(x,{height:25})}),(0,r.jsxs)(n.D,{display:"flex",flexDirection:"column",flexGrow:1,children:[(0,r.jsx)(n.bL,{variant:"bold",children:"Want to work faster?"}),(0,r.jsx)(n.bL,{variant:"small",color:"grey11",children:"Copy frames from Figma with the Slice Machine plugin and paste them here."})]})]}),(0,r.jsx)(n.E,{endIcon:"arrowForward",color:"indigo",onClick:()=>{window.open("https://www.figma.com/community/plugin/1567955296461153730/figma-to-slice","_blank"),m.Xe.track({event:"slice-generation:plugin-installation-clicked"})},sx:{marginRight:8},invisible:!0,children:"Install plugin"})]}),(0,r.jsx)(n.aF,{onFilesSelected:O,assetType:"image",maxFiles:10,overlay:(0,r.jsx)(F,{onFilesSelected:O,onPaste:Q,droppingFiles:!0}),children:(0,r.jsx)(F,{onFilesSelected:O,onPaste:Q})})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.D,{display:"flex",alignItems:"center",justifyContent:"space-between",padding:16,children:[(0,r.jsx)(n.bL,{variant:"h3",children:"Design"}),(0,r.jsx)(n.aG,{size:"medium",color:"grey",onFilesSelected:O,startIcon:"attachFile",disabled:J,children:"Add images"})]}),(0,r.jsx)(n.bn,{stableScrollbar:!1,children:(0,r.jsx)(n.D,{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16,padding:16,children:w.map((e,t)=>(0,r.jsx)(v,{slice:e},"slice-".concat(t)))})})]}),(0,r.jsxs)(n.ah,{children:[Y.generating>0?(0,r.jsx)(n.ai,{onClick:()=>U(!0),size:"medium",sx:{marginRight:8},invisible:!0,children:"Cancel"}):(0,r.jsx)(n.ai,{onClick:()=>q(),size:"medium",sx:{marginRight:8},invisible:!0,children:"Close"}),0===Y.completed||Y.loading>0?(0,r.jsxs)(n.af,{color:"purple",startIcon:"autoFixHigh",onClick:()=>{void 0!==Z&&w.forEach((e,t)=>{"pending"===e.status&&W({index:t,imageUrl:e.thumbnailUrl,source:e.source})})},disabled:J||Y.loading>0||0===Y.pending,loading:Y.loading>0,size:"medium",children:["Generate ",Y.generate>0?"(".concat(Y.generate,") "):"",1===Y.generate?"Slice":"Slices"]}):(0,r.jsx)(n.af,{color:"purple",onClick:()=>void K(),loading:L,size:"medium",children:k(a,Y.completed)})]})]})]}),(0,r.jsxs)(n.ae,{size:"small",open:D,onOpenChange:U,children:[(0,r.jsx)(n.al,{title:"Cancel generation"}),(0,r.jsxs)(n.aj,{children:[(0,r.jsx)(n.ak,{children:(0,r.jsx)(n.D,{display:"flex",flexDirection:"column",padding:{inline:16},children:(0,r.jsx)(n.bL,{variant:"bold",children:"Are you sure you want to cancel the generation for all slices?"})})}),(0,r.jsxs)(n.ah,{children:[(0,r.jsx)(n.ai,{onClick:()=>U(!1),size:"small",children:"Keep generating"}),(0,r.jsx)(n.af,{color:"tomato",onClick:()=>{U(!1),$()},size:"small",children:"Confirm"})]})]})]})]})}function F(e){let{droppingFiles:t=!1,onFilesSelected:a,onPaste:i}=e,l=A();return(0,r.jsx)(n.D,{justifyContent:"center",flexDirection:"column",height:"100%",backgroundColor:t?"purple2":"grey2",border:!0,borderStyle:"dashed",borderColor:t?"purple9":"grey6",borderRadius:12,flexGrow:1,children:(0,r.jsx)(n.s,{children:(0,r.jsxs)(n.D,{display:"flex",flexDirection:"column",gap:16,alignItems:"center",children:[(0,r.jsx)(n.x,{lineColor:"purple11",backgroundColor:"purple5",name:"cloudUpload",size:"large"}),(0,r.jsx)(n.D,{display:"flex",flexDirection:"column",gap:4,alignItems:"center",children:l?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.bL,{children:"Generate slices from your designs"}),(0,r.jsx)(n.bL,{variant:"small",color:"grey11",children:"Upload your design images or paste them directly from Figma."})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.bL,{children:"Upload your design images."}),(0,r.jsx)(n.bL,{variant:"small",color:"grey11",children:"Once uploaded, you can generate slices automatically using AI."})]})}),(0,r.jsx)(n.D,{display:"flex",alignItems:"center",gap:16,children:l?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.E,{size:"small",renderStartIcon:()=>(0,r.jsx)(x,{height:16}),color:"grey",onClick:()=>void i(),children:"Paste from Figma"}),(0,r.jsx)(n.aG,{size:"small",onFilesSelected:a,color:"purple",invisible:!0,children:"Add images"})]}):(0,r.jsx)(n.aG,{startIcon:"attachFile",onFilesSelected:a,color:"grey",children:"Add images"})})]})})})}async function I(e){let{image:t}=e,a=[await y.managerClient.project.getResolvedRepositoryName(),"shared-slices","prismic-inferred-slices",crypto.randomUUID()].join("/");await y.managerClient.screenshots.initS3ACL();let{url:r}=await y.managerClient.screenshots.uploadScreenshot({keyPrefix:a,data:t});return r}let k=(e,t)=>{switch(e){case"custom_type":return"Add to type (".concat(t,")");case"page_type":return"Add to page (".concat(t,")");case"slices":return"Done"}};function A(){let e=(0,h.L)("llm-proxy-access");return(null==e?void 0:e.value)==="on"}},27213:function(e,t,a){a.d(t,{F:function(){return n}});var r=a(52322),i=a(18337);let n=e=>{let{menuType:t}=e;return{fromImage:{BackgroundIcon:(0,r.jsx)(i.B,{name:"autoFixHigh",size:"ActionList"===t?"small":"extraSmall",iconSize:"ActionList"===t?"medium":"small",color:"purple",variant:"solid",radius:6}),title:"Generate from image",description:"Build a slice based on your design image."},fromScratch:{BackgroundIcon:(0,r.jsx)(i.B,{name:"add",size:"ActionList"===t?"small":"extraSmall",iconSize:"ActionList"===t?"medium":"small",color:"white",variant:"solid",radius:6}),title:"Start from scratch",description:"Build a custom slice your way."},fromTemplate:{BackgroundIcon:(0,r.jsx)(i.B,{name:"contentCopy",size:"ActionList"===t?"small":"extraSmall",iconSize:"ActionList"===t?"medium":"small",color:"white",variant:"solid",radius:6}),title:"Use a template",description:"Choose from ready-made examples."},fromExisting:{BackgroundIcon:(0,r.jsx)(i.B,{name:"folder",size:"ActionList"===t?"small":"extraSmall",iconSize:"ActionList"===t?"medium":"small",color:"white",variant:"solid",radius:6}),title:"Reuse an existing slice",description:"Select from your created slices."}}}},6256:function(e,t,a){a.d(t,{c:function(){return j}});var r=a(52322),i=a(2784),n=a(36131),l=a(75289),s=a(94160),o=a(98250),c=a(88932),d=a(63908),u=a(358),m=a(80148);async function g(e){let{sliceName:t,libraryName:a,location:r,onSuccess:i}=e;try{let e=(0,d.fo)(t),{errors:n}=await m.managerClient.slices.createSlice({libraryID:a,model:e});if(n.length>0)throw n;s.Xe.track({event:"slice:created",id:(0,u.MP)(t),name:t,library:a,location:r,mode:"manual"}),await i(e)}catch(a){let e="An unexpected error happened while creating slice ".concat(t,".");console.error(e,a),c.Am.error(e)}}var p=a(68968),f=a(59532),h=a(54597),x=a(46999),y=a(63019);let j=e=>{let{onClose:t,onSuccess:a,localLibraries:c,location:d,remoteSlices:u}=e,{createSliceSuccess:m}=(0,h.Z)(),[j,b]=(0,i.useState)(!1),{syncChanges:w}=(0,p.g)(),{completeStep:v}=(0,o.k)(),C=async e=>{let t=e.sliceName,r=e.from;b(!0),await g({sliceName:t,libraryName:r,location:d,onSuccess:async e=>{m((await (0,s.y0)()).libraries),a(e,r),w(),v("createSlice")}})};return(0,r.jsx)(f.Z,{testId:"create-slice-modal",isOpen:!0,widthInPx:"530px",isLoading:j,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:a,setFieldValue:i,errors:s}=e;return(0,r.jsxs)(l.xu,{children:[(0,r.jsx)(x.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,r.jsx)(l.__,{htmlFor:"from",sx:{mb:2},children:"Target Library"}),(0,r.jsx)(n.ZP,{name:"from",options:c.map(e=>({value:e.name,label:e.name})),onChange:e=>e?void i("from",e.value):null,defaultValue:{value:a.from,label:a.from},styles:{option:e=>({...e,color:"#161618"})},theme:e=>({...e,colors:{...e.colors,primary:"#E9E8EA"}}),menuPortalTarget:document.body})]})}})}},63019:function(e,t,a){a.d(t,{h:function(){return o}});var r=a(96009),i=a.n(r),n=a(74600),l=a.n(n),s=a(7974);function o(e,t,a){let{sliceName:r}=e;return r?s.lS.includes(r.toLowerCase())?{sliceName:'Name "'.concat(r,'" is reserved for Slice Machine use.')}:s.xo.exec(r)?l()(i()(r)).replace(/\s/gm,"")!==r.trim()?{sliceName:"Value has to be PascalCased."}:r.match(/^\d/)?{sliceName:"Value cannot start with a number."}:[...t.flatMap(e=>e.components.map(e=>e.model.name)),...a.map(e=>e.name)].includes(r)?{sliceName:"Slice name is already taken."}:void 0:{sliceName:"No special characters allowed."}:{sliceName:"Cannot be empty"}}},21151:function(e,t,a){var r=a(52322),i=a(75289);t.Z=function(e){let{elems:t,renderElem:a,defineElementKey:n,gridTemplateMinPx:l="320px",gridGap:s="16px",sx:o}=e;return(0,r.jsx)(i.xu,{as:"section",sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(".concat(l,", 1fr))"),gridGap:s,pt:2,...o},children:t.map((e,t)=>e?(0,r.jsx)("span",{children:a(e,t)},"".concat(n(e),"-").concat(t+1)):null)})}}}]);
|