slice-machine-ui 2.18.2-beta.6 → 2.18.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.
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[630],{35289:function(e,t,n){"use strict";n.d(t,{aV:function(){return s},Bu:function(){return d}});var i=n(52322),r=n(11699),l=n(6277),o=n(13834),a=n.n(o);let s=e=>{let{border:t=!0,...n}=e;return(0,i.jsx)("div",{...n,className:(0,l.Z)(a().root,t&&a()["root-border"])})},d=e=>{let{actions:t,children:n,toggle:l,...o}=e;return(0,i.jsxs)("div",{...o,className:a().header,children:[(0,i.jsx)(r.bL,{color:"grey11",component:"span",noWrap:!0,variant:"bold",children:n}),l,t?(0,i.jsx)("div",{className:a().headerActions,children:t}):null]})}},6882:function(e,t,n){"use strict";n.d(t,{$S:function(){return x},$U:function(){return c},BB:function(){return m},Fj:function(){return b},J9:function(){return v},L0:function(){return u},Qr:function(){return i},U:function(){return y},UG:function(){return g},Wc:function(){return p},XU:function(){return k},_M:function(){return f},_n:function(){return h},gA:function(){return o},pG:function(){return r},pV:function(){return d},pt:function(){return l},tg:function(){return s},uG:function(){return a}});let i={name:"Boolean",description:"A true or false toggle.",icon:"toggleOff",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295526/DEV_TOOLS/SM_FIELDS/Type_Boolean_cbwg8k.png",type:"Boolean"},r={name:"Color",description:"A color in hex format.",icon:"colorLens",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295521/DEV_TOOLS/SM_FIELDS/Type_Color_nyoeit.png",type:"Color"},l={name:"Date",description:"A date without time.",icon:"dateRange",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295525/DEV_TOOLS/SM_FIELDS/Type_Date_dsuaeq.png",type:"Date"},o={name:"Embed",description:"A video, song, or oEmbed link.",icon:"code",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295523/DEV_TOOLS/SM_FIELDS/Type_Embed_wwssvd.png",type:"Embed"},a={name:"Geopoint",description:"A geographical coordinate.",icon:"place",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295522/DEV_TOOLS/SM_FIELDS/Type_GeoPoint_lpq0sm.png",type:"GeoPoint"},s={name:"Image",description:"A responsive image.",icon:"image",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295520/DEV_TOOLS/SM_FIELDS/Type_Image_zyatxy.png",type:"Image"},d={name:"Link",description:"A link to a website, asset, or document.",icon:"link",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295528/DEV_TOOLS/SM_FIELDS/Type_Link_bgslgy.png",type:"Link"},c={name:"Content Relationship",description:"A reference to a Prismic document.",icon:"settingsEthernet",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295527/DEV_TOOLS/SM_FIELDS/Type_Content_RelationShip_s4z4nh.png",type:"Link",variant:"ContentRelationship"},u={name:"Link to Media",description:"A link to a media asset.",icon:"attachFile",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295519/DEV_TOOLS/SM_FIELDS/Type_LinkToMedia_m2p0ce.png",type:"Link",variant:"LinkToMedia"},p={name:"Number",description:"An integer or float.",icon:"pin",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295522/DEV_TOOLS/SM_FIELDS/Type_Number_o3olop.png",type:"Number"},h={name:"Rich Text",description:"Text with formatting options.",icon:"textFields",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295530/DEV_TOOLS/SM_FIELDS/Type_Rich_Text_fxdyar.png",type:"StructuredText"},f={name:"Select",description:"A dropdown of options.",icon:"arrowDropDownCircle",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295527/DEV_TOOLS/SM_FIELDS/Type_Select_bedjei.png",type:"Select"},m={name:"Table",description:"A structured table.",icon:"table",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1737381854/FIELDS_SM/Table_f47jnq.png",type:"Table"},x={name:"Text",description:"A text string without formatting.",icon:"title",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295529/DEV_TOOLS/SM_FIELDS/Type_Key_Text_xrqf45.png",type:"Text"},g={name:"Timestamp",description:"A date and time.",icon:"schedule",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295524/DEV_TOOLS/SM_FIELDS/Type_Timestamp_fkr5iw.png",type:"Timestamp"},v=[s,x,h,i,p,f,d,u,r,l,m,g,o,a,c],b={name:"UID",description:"Unique Identifier",icon:"tag",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721295519/DEV_TOOLS/SM_FIELDS/Type_UID_hrwzug.png",type:"UID"},y={name:"Repeatable Group",description:"A set of fields that editors can repeat.",icon:"createNewFolder",thumbnail:"https://res.cloudinary.com/dmtf1daqp/image/upload/v1721314577/DEV_TOOLS/SM_FIELDS/Type_Group_uwwco0.png",type:"Group"},j={...y,variant:"NestedGroup"},k=[...v,b,y,j]},34166:function(e,t,n){"use strict";n.d(t,{nZ:function(){return c},rT:function(){return p},tB:function(){return u}});var i=n(52322),r=n(11699),l=n(2784),o=n(30195),a=n(94160),s=n(76611),d=n(5683);function c(e){let{type:t,library:n,sliceId:i,variationId:r,langSmithUrl:l}=e,o=(0,d.i)({type:t,library:n,sliceId:i,variationId:r}),a=JSON.stringify({langSmithUrl:l});localStorage.setItem(o,a)}function u(e){let{type:t,library:n,sliceId:i,variationId:r}=e,l=(0,d.i)({type:t,library:n,sliceId:i,variationId:r});localStorage.removeItem(l)}function p(e){let{type:t,library:n,sliceId:c,variationId:u}=e,{key:p,value:h,done:f}=function(e){let{type:t,library:n,sliceId:i,variationId:r}=e,l=(0,d.i)({type:t,library:n,sliceId:i,variationId:r}),[a,c]=(0,s.V)(l,void 0,{schema:o.z.object({langSmithUrl:o.z.string().url().optional()})});return{key:l,value:a,done:()=>c(void 0)}}({type:t,library:n,sliceId:c,variationId:u}),[m,x]=(0,l.useState)(),g=e=>()=>{h&&(x(p),a.Xe.track({event:"slice-generation-feedback",type:t,sliceId:c,variationId:u,feedback:e,langSmithUrl:h.langSmithUrl}),f())};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.be,{children:(0,i.jsx)(r.bQ,{anchor:(0,i.jsx)(r.D,{width:"100%",justifyContent:"center",position:"absolute",bottom:64}),icon:"check",title:"Thanks for your feedback!",seconds:2,open:!!m,onOpenChange:e=>{e||x(void 0)}},m)}),(0,i.jsx)(r.i,{children:h&&(0,i.jsxs)(r.D,{flexDirection:"row",justifyContent:"end",gap:8,alignItems:"center",children:[(0,i.jsx)(r.bL,{color:"grey11",children:"Did the AI get it right?"}),(0,i.jsxs)(r.D,{flexDirection:"row",gap:4,children:[(0,i.jsx)(r.c3,{side:"bottom",sideOffset:4,variant:"text",content:"Looks good",children:(0,i.jsx)(r.aZ,{variant:"solid",size:"small",icon:"thumbUp",onClick:g("up")})}),(0,i.jsx)(r.c3,{side:"bottom",sideOffset:4,variant:"text",content:"Needs improvement",children:(0,i.jsx)(r.aZ,{variant:"solid",size:"small",icon:"thumbDown",onClick:g("down")})})]})]})})]})}},23094:function(e,t,n){"use strict";n.d(t,{X:function(){return l}});var i=n(52322),r=n(11699);let l=e=>{let t;let{status:n}=e;switch(n){case"pending":t={icon:(0,i.jsx)(r.bg,{color:"grey11"}),text:"Saving..."};break;case"failed":t={icon:(0,i.jsx)(r.aX,{name:"close",color:"tomato11",size:"medium"}),text:"Failed to save"};break;case"done":t={icon:(0,i.jsx)(r.aX,{name:"check",color:"green11",size:"medium"}),text:"Auto-saved"}}return(0,i.jsxs)(r.D,{gap:8,alignItems:"center",children:[t.icon,(0,i.jsx)(r.bL,{color:"grey11",children:t.text})]})}},6609:function(e,t,n){"use strict";n.d(t,{S:function(){return o}});var i=n(52322),r=n(11699),l=n(6882);function o(e){let{open:t,onOpenChange:n,disabled:o=!1,onSelectField:s,fields:d,triggerDataTestId:c="add-field",trigger:u}=e,p=d.filter(e=>l.J9.some(t=>t.name===e.name)||e.name===l.Fj.name),h=d.find(e=>e.name===l.U.name);return(0,i.jsxs)(r.ar,{open:t,onOpenChange:n,children:[(0,i.jsx)(r.av,{disabled:o,children:null!=u?u:(0,i.jsx)(r.E,{startIcon:"add",color:"grey","data-testid":c,children:"Add a field"})}),(0,i.jsxs)(r.as,{align:"end",maxHeight:400,collisionPadding:8,children:[(0,i.jsx)(r.au,{children:"Single fields"}),p.map(e=>(0,i.jsx)(a,{field:e,onSelectField:s},e.name)),h&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.au,{children:"Set of fields"}),(0,i.jsx)(a,{field:h,onSelectField:s})]})]})]})}function a(e){let{field:t,onSelectField:n}=e,{type:l,variant:o,name:a,icon:s,description:d,thumbnail:c}=t;return(0,i.jsx)(r.at,{startIcon:(0,i.jsx)(r.aX,{name:s,size:"large"}),description:d,onSelect:()=>n(null!=o?o:l),renderTooltip:e=>(0,i.jsx)(r.c3,{visible:!0,variant:"custom",content:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.a_,{src:c,borderRadius:4,sx:{height:170,width:278},animateOnLoad:!1}),(0,i.jsx)(r.bL,{color:"white",children:"How it will look for content editors."})]}),align:"start",side:"left",sideOffset:4,animation:"none",children:e}),children:a},"".concat(l).concat(o?"-".concat(o):""))}},41347:function(e,t,n){"use strict";n.d(t,{zE:function(){return d},Vg:function(){return j},WP:function(){return C}});var i=n(52322),r=n(47124),l=n(11699),o=n(2784),a=n(50477),s=n(87446);function d(e){return(0,i.jsx)(s.h,{renderError:()=>(0,i.jsxs)(l.D,{alignItems:"center",gap:8,children:[(0,i.jsx)(l.aX,{name:"alert",size:"small",color:"tomato10"}),(0,i.jsx)(l.bL,{color:"tomato10",children:"Error loading your types"})]}),children:(0,i.jsx)(l.bB,{fallback:(0,i.jsxs)(l.D,{flexDirection:"column",position:"relative",children:[(0,i.jsx)(l.bx,{height:240}),(0,i.jsxs)(l.D,{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",alignItems:"center",gap:8,children:[(0,i.jsx)(l.aX,{name:"autorenew",size:"small",color:"grey11"}),(0,i.jsx)(l.bL,{color:"grey11",children:"Loading your types..."})]})]}),children:(0,i.jsx)(c,{...e})})})}function c(e){let{value:t,onChange:n}=e,{allCustomTypes:r,pickedCustomTypes:s}=function(e){let{customTypes:t}=(0,a.xU)();if((0,o.useEffect)(()=>{(0,a.NG)()},[]),!e)return{allCustomTypes:t,pickedCustomTypes:[]};let n=e.flatMap(e=>{var n;return null!==(n=t.find(t=>t.id===L(e)))&&void 0!==n?n:[]});return{allCustomTypes:t,pickedCustomTypes:n}}(t),d=t?j({linkCustomtypes:t,allCustomTypes:r}):{};return(0,i.jsxs)(l.D,{overflow:"hidden",flexDirection:"column",border:!0,borderRadius:6,width:"100%",children:[(0,i.jsx)(l.D,{border:{bottom:!0},padding:{inline:16,bottom:16,top:12},flexDirection:"column",gap:8,children:s.length>0?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(l.D,{flexDirection:"column",children:[(0,i.jsx)(l.bL,{variant:"h4",color:"grey12",children:"Allowed type"}),(0,i.jsxs)(l.bL,{color:"grey11",children:["Select a single type that editors can link to in the Page Builder.",(0,i.jsx)("br",{}),"For the selected type, choose which fields to include in the API response."]}),s.length>1&&(0,i.jsx)(l.D,{margin:{block:12},children:(0,i.jsx)(l.f,{color:"warn",icon:"alert",subtitle:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l.bL,{color:"inherit",variant:"bold",children:"Legacy mode. Keep only one type to enable the improved Content Relationship feature."}),(0,i.jsx)("br",{}),(0,i.jsxs)("a",{href:"https://prismic.io/docs/fields/content-relationship",target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"none",fontWeight:"bold",display:"flex",alignItems:"center",gap:4},children:[(0,i.jsx)(l.bL,{color:"inherit",variant:"bold",children:"See documentation"}),(0,i.jsx)(l.aX,{name:"arrowForward",size:"small",color:"inherit"})]})]})})})]}),s.map(e=>{var o;return(0,i.jsxs)(l.D,{gap:4,padding:8,border:!0,borderRadius:6,borderColor:"grey6",backgroundColor:"white",justifyContent:"space-between",children:[s.length>1?(0,i.jsx)(l.bL,{children:e.id}):(0,i.jsx)(l.c5,{children:(0,i.jsx)(h,{customType:e,onChange:i=>{n(function(e){let{linkCustomtypes:t,fieldCheckMap:n,newCustomType:i,customTypeId:r}=e,l=[],o=Object.entries({...n,[r]:i}).flatMap(e=>{let[t,n]=e,i=Object.entries(n).flatMap(e=>{let[t,n]=e;if("group"===n.type){let e=Object.entries(n.value).flatMap(e=>{let[t,n]=e;if("checkbox"===n.type)return n.value?t:[];let i=S(n.value);return i.length>0?{id:t,customtypes:i}:[]});return e.length>0?{id:t,fields:e}:[]}if("contentRelationship"===n.type){let e=S(n.value);return e.length>0?{id:t,customtypes:e}:[]}return n.value?t:[]});return i.length>0?{id:t,fields:i}:[]});if(!t)return o;for(let e of t){let t=o.find(t=>L(t)===L(e));void 0!==t?l.push(t):L(e)===r?l.push(L(e)):l.push(e)}return l}({fieldCheckMap:d,newCustomType:i,linkCustomtypes:t,customTypeId:e.id}))},fieldCheckMap:null!==(o=d[e.id])&&void 0!==o?o:{},allCustomTypes:r})}),(0,i.jsx)(l.aZ,{icon:"close",size:"small",onClick:()=>{var i;return i=e.id,void(t&&n(t.filter(e=>L(e)!==i)))},sx:{height:24,width:24},hiddenLabel:"Remove type"})]},e.id)})]}):(0,i.jsx)(u,{onSelect:function(e){n(t?[...t,e]:[e])},allCustomTypes:r})}),(0,i.jsx)(l.D,{backgroundColor:"white",flexDirection:"column",padding:12,children:(0,i.jsxs)(l.bL,{variant:"normal",color:"grey11",children:["Have ideas for improving this field?"," ",(0,i.jsx)("a",{href:"https://community.prismic.io/t/content-relationship-share-your-requests-and-feedback/19843",target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"underline"},children:"Please provide your feedback here"}),"."]})})]})}function u(e){let{allCustomTypes:t,onSelect:n}=e;return(0,i.jsxs)(l.D,{flexDirection:"column",gap:8,alignItems:"center",padding:{block:24},children:[(0,i.jsxs)(l.D,{flexDirection:"column",alignItems:"center",gap:4,children:[(0,i.jsx)(l.bL,{variant:"h5",color:"grey12",children:"No type selected"}),(0,i.jsxs)(l.bL,{color:"grey11",component:"p",align:"center",children:["Select the type editors can link to.",(0,i.jsx)("br",{}),"Then, choose which fields to return in the API."]})]}),(0,i.jsx)(l.D,{children:(0,i.jsx)(p,{allCustomTypes:t,onSelect:n})})]})}function p(e){let{allCustomTypes:t,onSelect:n}=e,r=(0,i.jsx)(l.E,{startIcon:"add",color:"grey",disabled:0===t.length,children:"Add type"});return 0===t.length?(0,i.jsx)(l.D,{children:(0,i.jsx)(l.c3,{content:"No type available",side:"bottom",align:"start",disableHoverableContent:!0,children:r})}):(0,i.jsx)(l.D,{children:(0,i.jsxs)(l.ar,{children:[(0,i.jsx)(l.av,{children:r}),(0,i.jsxs)(l.as,{maxHeight:400,minWidth:256,align:"center",children:[(0,i.jsx)(l.au,{children:(0,i.jsx)(l.bL,{color:"grey11",children:"Types"})}),t.map(e=>(0,i.jsx)(l.at,{onSelect:()=>n(e.id),children:(0,i.jsxs)(l.D,{alignItems:"center",justifyContent:"space-between",gap:8,children:[(0,i.jsx)(l.bO,{children:(0,i.jsx)(l.bL,{children:e.id})}),(0,i.jsx)(l.m,{title:(0,i.jsx)(l.bL,{variant:"extraSmall",color:"purple11",children:b(e.format)}),color:"purple",size:"small"})]})},e.id))]})]})})}function h(e){let{customType:t,fieldCheckMap:n,onChange:r,allCustomTypes:o}=e,a=I(t).map(e=>{var t,a,s;let[d,c]=e;if("Group"===c.type){let e=null!==(a=n[d])&&void 0!==a?a:{};return(0,i.jsx)(g,{group:c,groupId:d,onChange:e=>{r({...n,[d]:{type:"group",value:e}})},fieldCheckMap:"group"===e.type?e.value:{},allCustomTypes:o},d)}if(F(c,o)){let e=null!==(s=n[d])&&void 0!==s?s:{};return(0,i.jsx)(f,{field:c,fieldId:d,onChange:e=>{r({...n,[d]:{type:"contentRelationship",value:e}})},fieldCheckMap:"contentRelationship"===e.type?e.value:{},allCustomTypes:o},d)}return(0,i.jsx)(l.c6,{title:d,checked:(null===(t=n[d])||void 0===t?void 0:t.value)===!0,onCheckedChange:e=>{r({...n,[d]:{type:"checkbox",value:e}})}},d)}),s=C(n);return(0,i.jsx)(l.c7,{title:t.id,subtitle:s.pickedFields>0?v(s.pickedFields,"returned in the API"):"(No fields returned in the API)",badge:b(t.format),defaultOpen:!0,children:a.length>0?a:(0,i.jsx)(m,{})},t.id)}function f(e){var t,n;let{field:r,fieldId:o,fieldCheckMap:a,onChange:s,allCustomTypes:d}=e,[c]=y(null===(t=r.config)||void 0===t?void 0:t.customtypes,d),u=e=>{s({...a,[c.id]:e})},p=null!==(n=a[c.id])&&void 0!==n?n:{},h=I(c).map(e=>{var t,n;let[r,o]=e;if("Group"===o.type){let e=null!==(n=p[r])&&void 0!==n?n:{};return(0,i.jsx)(x,{group:o,groupId:r,onChange:e=>{u({...p,[r]:{type:"group",value:e}})},fieldCheckMap:"group"===e.type?e.value:{}},r)}return(0,i.jsx)(l.c6,{title:r,checked:(null===(t=p[r])||void 0===t?void 0:t.value)===!0,onCheckedChange:e=>{u({...p,[r]:{type:"checkbox",value:e}})}},r)});return(0,i.jsx)(l.c7,{title:(0,i.jsxs)(l.bL,{children:[o," ",(0,i.jsxs)(l.bL,{color:"grey11",children:["→ ",c.id]})]}),subtitle:v(C(p).pickedFields),badge:b(c.format),children:h.length>0?h:(0,i.jsx)(m,{})},c.id)}function m(){return(0,i.jsx)(l.bL,{color:"grey11",children:"No available fields to select"})}function x(e){let{group:t,groupId:n,fieldCheckMap:r,onChange:o}=e,a=w(t).map(e=>{var t;let{fieldId:n}=e;return(0,i.jsx)(l.c6,{title:n,checked:(null===(t=r[n])||void 0===t?void 0:t.value)===!0,onCheckedChange:e=>{o({...r,[n]:{type:"checkbox",value:e}})}},n)});return(0,i.jsx)(l.c7,{title:n,subtitle:v(C(r).pickedFields),badge:"Group",children:a.length>0?a:(0,i.jsx)(m,{})},n)}function g(e){let{group:t,groupId:n,fieldCheckMap:r,onChange:o,allCustomTypes:a}=e,s=w(t).map(e=>{var t,n;let{fieldId:s,field:d}=e;if(F(d,a)){let e=null!==(n=r[s])&&void 0!==n?n:{};return(0,i.jsx)(f,{field:d,fieldId:s,fieldCheckMap:"contentRelationship"===e.type?e.value:{},onChange:e=>{o({...r,[s]:{type:"contentRelationship",value:e}})},allCustomTypes:a},s)}return(0,i.jsx)(l.c6,{title:s,checked:(null===(t=r[s])||void 0===t?void 0:t.value)===!0,onCheckedChange:e=>{o({...r,[s]:{type:"checkbox",value:e}})}},s)});return(0,i.jsx)(l.c7,{title:n,subtitle:v(C(r).pickedFields),badge:"Group",children:s.length>0?s:(0,i.jsx)(m,{})},n)}function v(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"selected";if(0!==e)return"(".concat(e," ").concat((0,r._6)(e,"field","fields")," ").concat(t,")")}function b(e){return"page"===e?"Page type":"Custom type"}function y(e,t){return e?e.flatMap(e=>{var n;return null!==(n=t.find(t=>t.id===L(e)))&&void 0!==n?n:[]}):[]}function j(e){let{linkCustomtypes:t,allCustomTypes:n}=e,i=void 0!==n;return t.reduce((e,t)=>{if("string"==typeof t)return e;let r={};if(i){let i=n.find(e=>e.id===t.id);if(!i)return e;r=T(i)}let l=t.fields.reduce((e,t)=>{let l=r[L(t)];if(i&&void 0===l)return e;if("string"==typeof t)return i&&void 0!==l&&"Group"===l.type||(e[t]={type:"checkbox",value:!0}),e;if("fields"in t&&void 0!==t.fields){if(i&&void 0!==l&&"Group"!==l.type)return e;let o=function(e){let{group:t,ctFlatFieldMap:n,allCustomTypes:i}=e,r=void 0!==i,l=t.fields.reduce((e,l)=>{let o=E(n,t.id,L(l));if(r&&!o)return e;if("string"==typeof l)return r&&void 0!==o&&"Group"===o.type||(e[l]={type:"checkbox",value:!0}),e;if("customtypes"in l&&void 0!==l.customtypes){if(r&&void 0!==o&&!_(o))return e;let t=k({field:l,allCustomTypes:i});t&&(e[l.id]=t)}return e},{});if(0!==Object.keys(l).length)return{type:"group",value:l}}({group:t,allCustomTypes:n,ctFlatFieldMap:r});return o&&(e[t.id]=o),e}if("customtypes"in t&&void 0!==t.customtypes){if(i&&void 0!==l&&!_(l))return e;let r=k({field:t,allCustomTypes:n});r&&(e[t.id]=r)}return e},{});return Object.keys(l).length>0&&(e[t.id]=l),e},{})}function k(e){let{field:t,allCustomTypes:n}=e,i=void 0!==n,r=t.customtypes.reduce((e,t)=>{if("string"==typeof t)return e;let r={};if(i){let i=n.find(e=>e.id===t.id);if(!i)return e;r=T(i)}let l=t.fields.reduce((e,t)=>{if("string"==typeof t){let n=r[t];return i&&(void 0===n||"Group"===n.type)||(e[t]={type:"checkbox",value:!0}),e}if("fields"in t&&void 0!==t.fields){let n=t.fields.reduce((e,n)=>{let l=E(r,t.id,n);return i&&(void 0===l||"Group"===l.type)||(e[n]={type:"checkbox",value:!0}),e},{});Object.keys(n).length>0&&(e[t.id]={type:"group",value:n})}return e},{});return Object.keys(l).length>0&&(e[t.id]=l),e},{});if(0!==Object.keys(r).length)return{type:"contentRelationship",value:r}}function S(e){return Object.entries(e).flatMap(e=>{let[t,n]=e,i=Object.entries(n).flatMap(e=>{let[t,n]=e;if("group"===n.type){let e=Object.entries(n.value).flatMap(e=>{let[t,n]=e;return"checkbox"===n.type&&n.value?t:[]});return e.length>0?{id:t,fields:e}:[]}return n.value?t:[]});return i.length>0?{id:t,fields:i}:[]})}function C(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e?Object.values(e).reduce((e,n)=>{if(!function(e){if("object"!=typeof e||null===e||Array.isArray(e)||e instanceof Date||e instanceof RegExp||e instanceof Error)return!1;for(let t in e)if("string"!=typeof t||!Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(n))return e;if("type"in n&&"checkbox"===n.type)return n.value?{pickedFields:e.pickedFields+1,nestedPickedFields:e.nestedPickedFields+(t?1:0)}:e;if("type"in n&&"contentRelationship"===n.type){let{pickedFields:t,nestedPickedFields:i}=C(n,!0);return{pickedFields:e.pickedFields+t,nestedPickedFields:e.nestedPickedFields+i}}let{pickedFields:i,nestedPickedFields:r}=C(n,t);return{pickedFields:e.pickedFields+i,nestedPickedFields:e.nestedPickedFields+r}},{pickedFields:0,nestedPickedFields:0}):{pickedFields:0,nestedPickedFields:0}}function _(e){var t;return"Link"===e.type&&(null===(t=e.config)||void 0===t?void 0:t.select)==="document"}function F(e,t){var n;return _(e)&&1===y(null===(n=e.config)||void 0===n?void 0:n.customtypes,t).length}function I(e){return Object.values(e.json).flatMap(e=>Object.entries(e).flatMap(e=>{let[t,n]=e;return"Slices"!==n.type&&"Choice"!==n.type&&"UID"!==n.type&&"uid"!==t?[[t,n]]:[]}))}function T(e){return Object.fromEntries(I(e))}function E(e,t,n){var i,r;let l=e[t];if(void 0!==l&&"Group"===l.type)return null===(r=l.config)||void 0===r?void 0:null===(i=r.fields)||void 0===i?void 0:i[n]}function w(e){var t;return(null===(t=e.config)||void 0===t?void 0:t.fields)?Object.entries(e.config.fields).map(e=>{let[t,n]=e;return{fieldId:t,field:n}}):[]}function L(e){return"string"==typeof e?e:e.id}},96317:function(e,t,n){"use strict";n.d(t,{L:function(){return o}});var i=n(18566),r=n(80148);async function l(e){try{return await r.managerClient.telemetry.getExperimentVariant(e)}catch(e){console.error("Error while trying to get experiment value",e);return}}function o(e){return(0,i.QT)(l,[e])}},76611:function(e,t,n){"use strict";n.d(t,{V:function(){return r}});var i=n(2784);function r(e,t,n){let{schema:r}=null!=n?n:{},l=()=>{try{let n=localStorage.getItem(e);if(null==n)return t;if(!r)return JSON.parse(n);return r.parse(JSON.parse(n))}catch(e){return t}},[o,a]=(0,i.useState)(l),[s,d]=(0,i.useState)(e);return s!==e&&(d(e),a(l())),[o,(0,i.useCallback)(n=>{a(i=>{let r;if(void 0===(r="function"==typeof n?n(i):n)){try{localStorage.removeItem(e)}catch(e){return i}return t}try{localStorage.setItem(e,JSON.stringify(r))}catch(e){return i}return r})},[e,t])]}},38193:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var i=n(52322),r=n(61183);n(2784);var l=n(59326),o=n(75289);r.Z.registerLanguage("svelte",e=>({subLanguage:"xml",contains:[e.COMMENT("<!--","-->",{relevance:10}),{begin:/^(\s*)(<script(\s*context="module")?>)/gm,end:/^(\s*)(<\/script>)/gm,subLanguage:"javascript",excludeBegin:!0,excludeEnd:!0,contains:[{begin:/^(\s*)(\$:)/gm,end:/(\s*)/gm,className:"keyword"}]},{begin:/^(\s*)(<style.*>)/gm,end:/^(\s*)(<\/style>)/gm,subLanguage:"css",excludeBegin:!0,excludeEnd:!0},{begin:/\{/gm,end:/\}/gm,subLanguage:"javascript",contains:[{begin:/[\{]/,end:/[\}]/,skip:!0},{begin:/([#:\/@])(if|else|each|await|then|catch|debug|html)/gm,className:"keyword",relevance:10}]}]}));let a=["javascript","bash","xml","html","json"];var s=e=>{var t;let{children:n,lang:s,sx:d,codeStyle:c,codeClass:u,Header:p}=e,{theme:h}=(0,l.B7)(),f=s?r.Z.highlight(n,{language:"vue"===s?"html":s}).value:r.Z.highlightAuto(n,a).value;return(0,i.jsxs)(o.kC,{as:"pre",sx:d,children:[p?(0,i.jsx)(p,{}):null,(0,i.jsx)("code",{className:"hljs".concat(u?" ".concat(u):""),style:{overflowX:"auto",padding:"3px 5px",borderRadius:"6px",border:"1px solid",borderColor:String(null===(t=h.colors)||void 0===t?void 0:t.textClear),...c},dangerouslySetInnerHTML:{__html:f}})]})}},80575:function(e,t,n){"use strict";n.d(t,{J:function(){return o},k:function(){return l}});var i=n(52322);n(2784);var r=n(75289);let l=e=>{let{children:t,sx:n,...l}=e;return(0,i.jsx)(r.xu,{sx:{display:["block","block","flex"],flexWrap:"wrap",justifyContent:"space-between",...n},...l,children:t})},o=e=>{let{children:t,cols:n=2}=e;return(0,i.jsx)(r.xu,{sx:{flex:"0 ".concat(100/n-1,"%"),mb:1},children:t})}},90167:function(e,t,n){"use strict";n.d(t,{kp:function(){return d},sP:function(){return c},w8:function(){return u},Hq:function(){return h}});var i,r,l=n(52322),o=n(63397),a=n(2784),s=n(75289),d=e=>{let{field:t,meta:n,fieldName:i,label:r,focusOnNewEntry:d=!0,inputPlaceholder:c,buttonLabel:u}=e,[p,h]=(0,a.useState)(n.value.length),f=(0,a.useRef)(Array(n.value.length));return(0,a.useEffect)(()=>{f.current=f.current.slice(0,n.value.length)},[n.value.length]),(0,a.useEffect)(()=>{let e=f.current.length;d&&e>p&&f.current[e-1].focus(),h(e)},[f.current.length,d,p]),(0,l.jsxs)(a.Fragment,{children:[(0,l.jsxs)(s.__,{variant:"label.primary",htmlFor:i,children:[r,n.touched&&n.error?(0,l.jsx)(s.xv,{as:"span",variant:"text.labelError",children:n.error}):null]}),(0,l.jsx)(o.F2,{name:i,id:i,...t,render:e=>(0,l.jsxs)("div",{children:[t.value&&t.value.length>0?t.value.map((t,n)=>(0,l.jsxs)(s.kC,{my:2,children:[(0,l.jsx)(s.II,{placeholder:c,name:"".concat(i,".").concat(n),value:t,ref:e=>f.current[n]=e,onChange:t=>{let{target:{value:i}}=t;return e.replace(n,i)}}),(0,l.jsx)(s.zx,{ml:2,type:"button",variant:"secondary",onClick:()=>e.remove(n),children:"-"})]},"".concat(i,"-").concat(+n+1))):null,(0,l.jsx)(s.zx,{type:"button",onClick:()=>e.insert(t.value.length,""),children:u})]})})]})},c=e=>{let{initialValues:t,meta:n,label:i,fieldName:r,onChange:a,...d}=e;return(0,l.jsxs)(s.__,{variant:"label.border",...d,children:[(0,l.jsx)(o.gN,{as:s.XZ,type:"checkbox",name:r,onChange:()=>a(!n.value),checked:n.value}),i]})},u=e=>{let{field:t,label:n,defaultValue:i,onChange:r,controlledValue:o,setControlledValue:s,buildControlledValue:d}=e,[u,p]=(0,a.useState)(i||t.defaultValue||!1);return(0,a.useEffect)(()=>{d?s(d(o,u)):s(d)},[u,o,d]),(0,l.jsx)(c,{meta:{value:u},fieldName:t.name,onChange:e=>p(e)&&r&&r(e),label:"function"==typeof n?n(o,u):n})};(i=r||(r={}))[i.ERROR=0]="ERROR",i[i.DISABLED=1]="DISABLED",i[i.WARNING=2]="WARNING";let p=e=>{let t={"&::placeholder":{color:"#C9D0D8"}};switch(e){case 1:return{...t,border:"1px solid #E6E6EA",backgroundColor:"#F3F5F7"};case 0:return{...t,border:"1px solid #E26049","&:focus":{outline:"none",borderColor:"#E26049",boxShadow:"0 0 0 3px rgba(226, 96, 73, 0.2), inset 0 1px 2px rgba(226, 96, 73, 0.2)"}};case 2:return{...t,border:"1px solid orange","&:focus":{outline:"none",borderColor:"orange",boxShadow:"0 0 0 3px rgba(255, 165, 0, 0.2), inset 0 1px 2px rgba(255, 165, 0, 0.2)"}};default:return t}},h=e=>{let{sx:t={},field:n,meta:i,formField:r,fieldName:a,fields:d,initialValues:c,isDisabled:u,autoFocus:h}=e,f=i.error?0:u||r.disabled?1:void 0;return(0,l.jsxs)(s.xu,{sx:t,children:[(0,l.jsxs)(s.__,{variant:"label.primary",htmlFor:a,children:[r.label||a,i.touched&&i.error?(0,l.jsx)(s.xv,{as:"span",variant:"text.labelError",children:i.error}):null]}),(0,l.jsx)(o.gN,{id:a,name:a,type:"text",placeholder:r.placeholder||r.label||a,...r.fieldLevelValidation&&c?{validate:e=>r.fieldLevelValidation&&r.fieldLevelValidation({value:e,fields:d,initialId:c.id})}:null,...n,as:s.II,sx:p(f),disabled:u||r.disabled,autoFocus:null!=h?h:r.autoFocus})]})}},70705:function(e,t,n){"use strict";var i=n(52322),r=n(2784),l=n(75289);let o=(0,r.forwardRef)((e,t)=>{let{children:n,Component:r=l.kC,sx:o={},...a}=e;return(0,i.jsx)(r,{as:"li",sx:{p:3,mx:3,alignItems:"center",variant:"styles.listItem",...o},ref:t,...a,children:n})});t.Z=o},86355:function(e,t,n){"use strict";n.d(t,{Z:function(){return j}});var i=n(52322),r=n(11699),l=n(5446),o=n(2784),a=n(40023),s=n(951),d=n(8799),c=n(18978),u=n(59326),p=n(75289),h=n(70705),f=n(66770),m=n(33710),x=n(28316),g=n(65077);let v=e=>{let{children:t}=e;return(0,x.createPortal)((0,i.jsx)(g.xR,{children:t}),document.body)},b=e=>{let{text:t,as:n,sx:r={},...l}=e,a=(0,o.useRef)(null),[s,d]=(0,o.useState)(null),c=()=>{d(a.current&&a.current.offsetWidth<a.current.scrollWidth)};return(0,o.useEffect)(()=>(c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}),[]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(p.xv,{"data-for":t,"data-tip":!0,sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",...r},as:n,ref:a,...l,children:t}),s&&(0,i.jsx)(v,{children:(0,i.jsx)(m.Z,{id:t,type:"dark",multiline:!0,border:!0,borderColor:"black",place:"bottom",effect:"solid",children:t})})]})};var y=e=>{var t,n;let{text:l,sliceFieldName:o,theme:a,WidgetIcon:s,widgetIconTooltip:d}=e;return(0,i.jsxs)(p.kC,{sx:{alignItems:"center",position:"relative"},children:[(0,i.jsx)(r.c3,{content:d,sideOffset:2,disableHoverableContent:!0,children:(0,i.jsx)(r.D,{margin:{right:8},children:(0,i.jsx)(s,{size:28,style:{color:null===(t=a.colors)||void 0===t?void 0:t.primary,borderRadius:"4px",padding:"4px",border:"2px solid",borderColor:null===(n=a.colors)||void 0===n?void 0:n.primary,flexShrink:0}})})}),(0,i.jsx)(b,{text:l,as:"p",sx:{py:0,px:1,fontWeight:"label",fontSize:"15px"},"data-testid":"field-name"}),(0,i.jsx)(p.xv,{as:"p",sx:{display:["none","none","initial"],fontSize:"14px",ml:1,color:"textClear",overflow:"hidden",textOverflow:"ellipsis"},"data-testid":"field-id",children:o})]})},j=function(e){let{item:t,index:n,deleteItem:m,enterEditMode:x,modelFieldName:g,renderFieldAccessor:v,HintElement:b,CustomEditElement:j,CustomEditElements:k,widget:S,draggableId:C,testId:_,isRepeatableCustomType:F,children:I}=e,{theme:T}=(0,u.B7)(),{key:E,value:{config:w,type:L}}=t,D=!!(("Link"===L||"Group"===L)&&(null==w?void 0:w.repeat));return(0,i.jsx)(o.Fragment,{children:(0,i.jsx)(a._l,{draggableId:C,index:n,children:e=>{var a,u,C,M,O;return(0,i.jsx)(o.Fragment,{children:(0,i.jsxs)(h.Z,{"data-testid":_,ref:e.innerRef,...e.draggableProps,Component:p.xu,sx:{p:0,mx:0,my:3},children:[(0,i.jsxs)(p.kC,{sx:{width:"100%"},children:[(0,i.jsx)(f.Z,{label:"Reorder slice field (drag and drop)",Icon:c.Fm7,color:null===(a=T.colors)||void 0===a?void 0:a.icons,mr:1,mt:3,...e.dragHandleProps}),(0,i.jsxs)(p.xu,{sx:{bg:"headSection",width:"100%",borderRadius:"3px",border:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))}},children:[(0,i.jsxs)(p.kC,{sx:{p:3,alignItems:"center",justifyContent:"space-between",width:"100%"},children:[(0,i.jsx)(y,{theme:T,text:(null==w?void 0:w.label)||E,sliceFieldName:v&&v(E),WidgetIcon:S.Meta.icon,widgetIconTooltip:S.label}),(0,i.jsxs)(p.kC,{sx:{flex:"0 0 auto"},children:[D&&(0,i.jsx)(r.m,{title:"Repeatable",color:"purple",size:"medium",sx:{alignSelf:"center",marginInline:16}}),k||null,j||(0,i.jsx)(f.Z,{size:22,Icon:s.$iz,label:"Edit field",sx:{cursor:"pointer",color:null===(u=T.colors)||void 0===u?void 0:u.icons,flexShrink:0},onClick:()=>x([E,t.value],g,n)}),!(!0===F&&"UID"==L)&&(0,i.jsxs)(l.v2,{children:[(0,i.jsx)(l.j2,{className:"sliceMenuButton","data-testid":"field-menu-button",style:{padding:"0",cursor:"pointer",width:"32px",height:"32px",border:"none",background:"transparent",outline:"0"},children:(0,i.jsx)(d.FQA,{size:20,color:null===(C=T.colors)||void 0===C?void 0:C.icons,style:{pointerEvents:"none"}})}),(0,i.jsx)(l.qy,{style:{background:null===(M=T.colors)||void 0===M?void 0:M.gray,border:"1px solid",borderRadius:"3px",borderColor:null===(O=T.colors)||void 0===O?void 0:O.borders,outline:"0"},children:(0,i.jsx)(l.sN,{style:{padding:"6px",cursor:"pointer"},onSelect:()=>m(E),children:"Delete field"})})]})]})]}),b||null]})]}),I]})})}})})}},66770:function(e,t,n){"use strict";var i=n(52322),r=n(75289);let l=(e,t)=>t?{border:e=>{let{colors:t}=e;return"1px solid ".concat(t.error)}}:e?{border:e=>{let{colors:t}=e;return"1px solid ".concat(t.primary)}}:{border:e=>{let{colors:t}=e;return"1px solid ".concat(t.borders)}};t.Z=e=>{let{sx:t=null,onClick:n=()=>null,label:o,Icon:a,error:s=null,size:d=16,fitButton:c=!1,active:u=!1,useActive:p=!1,activeSx:h=l,...f}=e;return(0,i.jsx)(r.hU,{onClick:n,"aria-label":o,type:"button",sx:{...c?{width:d,height:d}:null,...p&&h(u,s),...t},...f,children:(0,i.jsx)(a,{size:d})})}},89280:function(e,t,n){"use strict";var i=n(52322),r=n(63397),l=n(2784),o=n(75289),a=n(90167),s=n(79256);t.Z=e=>{let{fieldName:t,formField:n,fields:d,initialValues:c,autoFocus:u}=e,[p,h,f]=(0,r.U$)(t),m=n.component;return(0,i.jsx)(o.xu,{sx:{mt:2,alignItems:"center",...n.type===s.h.CHECKBOX?{display:"flex",height:"130%"}:null},children:m?(0,i.jsx)(m,{meta:h,field:p,helpers:f,fieldName:t,formField:n,initialValues:c}):(0,i.jsxs)(l.Fragment,{children:[n.type===s.h.INPUT?(0,i.jsx)(a.Hq,{meta:h,field:p,fields:d,formField:n,fieldName:t,initialValues:c,autoFocus:u}):null,n.type===s.h.CHECKBOX&&(0,i.jsx)(a.sP,{meta:h,label:n.label,fieldName:t,initialValues:c,onChange:e=>f.setValue(e)})]})})}},3285:function(e,t,n){"use strict";n.d(t,{Z:function(){return A}});var i=n(52322),r=n(37149),l=n.n(r),o=n(56580),a=n(59326),s=n(75289),d=n(65413),c=n(30527),u=n(2784),p=n(92928);let h=e=>{let{children:t,...n}=e;return(0,i.jsx)(s.xu,{as:"ul",sx:{p:0,m:0,px:e=>"calc(".concat(e.space[3],"px + 8px)"),borderBottom:"1px solid #DFE1E5",position:"relative"},...n,children:t})};h.tabsRole="TabList";let f=e=>{let{children:t,...n}=e,{theme:r}=(0,a.B7)();return(0,i.jsx)(p.OK,{...n,style:{margin:"0 32px 0 0",top:"0",padding:"8px 0px",border:"none",bottom:"-1px",opacity:"0.8",transition:"all 150ms cubic-bezier(0.215,0.60,0.355,1)",borderRadius:"0",...n.selected?{borderBottom:"3px solid ".concat(r.colors.primary),color:r.colors.text,fontWeight:"500",opacity:"1",backgroundColor:"transparent"}:{borderBottom:"3px solid transparent"}},children:t})};f.tabsRole="Tab";var m=(0,u.memo)(e=>{let{children:t,Footer:n,Header:r,tabs:l,bodySx:o,footerSx:a,defaultIndex:d=0}=e,[m,x]=(0,u.useState)(d);return(0,i.jsx)(c.Z,{borderFooter:!0,footerSx:{p:0,...a},bodySx:{p:0,...o},sx:{border:"none"},Header:r,Footer:n,children:(0,i.jsxs)(p.mQ,{defaultIndex:d,onSelect:e=>x(e),children:[(0,i.jsx)(h,{children:(l||[]).map(e=>(0,i.jsx)(f,{children:e},e))}),u.Children.map(t,(e,t)=>(0,i.jsx)(s.xu,{sx:{p:e=>"calc(".concat(e.space[3],"px + 8px)"),display:t===m?"block":"none"},children:(0,i.jsx)(p.x4,{children:e})}))]})})}),x=n(80575),g=e=>{var t,n;let{text:r,sliceFieldName:l,theme:o,WidgetIcon:a}=e;return(0,i.jsxs)(s.kC,{sx:{alignItems:"center"},children:[(0,i.jsx)(a,{size:28,style:{color:null===(t=o.colors)||void 0===t?void 0:t.primary,marginRight:"8px",borderRadius:"4px",padding:"4px",border:"2px solid",borderColor:null===(n=o.colors)||void 0===n?void 0:n.primary}}),(0,i.jsx)(s.xv,{as:"p","data-testid":"item-header-text",sx:{py:0,px:1,fontWeight:"label",fontSize:"15px"},children:r}),(0,i.jsx)(s.xv,{as:"p",sx:{display:["none","none","initial"],fontSize:"14px",ml:1,color:"textClear"},children:l})]})},v=n(55862),b=n(68169),y=n(5632),j=n(65186),k=n(7974);let S=()=>{let e=(0,y.useRouter)();return(0,i.jsxs)(s.xu,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",padding:"60px"},children:[(0,i.jsx)(j.wr$,{size:48,color:"#C9D0D8"}),(0,i.jsx)(s.xu,{sx:{height:"12px"}}),(0,i.jsx)(s.xv,{color:"text",sx:{fontWeight:600,fontSize:"24px",lineHeight:"32px",textAlign:"center"},children:"Your mock data has moved"}),(0,i.jsx)(s.xu,{sx:{height:"8px"}}),(0,i.jsx)(s.xv,{color:"text",sx:{fontWeight:400,fontSize:"14px",lineHeight:"24px",textAlign:"center"},children:"You can now edit directly your mock data in the new Slice Simulator."}),(0,i.jsx)(s.xu,{sx:{height:"24px"}}),(0,i.jsx)(s.zx,{onClick:t=>{t.preventDefault(),window.open("".concat(e.asPath,"/simulator"),k.pq)},children:"Go to the Slice Simulator"})]})};var C=n(16442),_=n(45440),F=n(16086),I=n(78254),T=n(23134),E=n(89280),w=n(63397),L=n(358);function D(){let[{value:e}]=(0,w.U$)("config.label"),[{value:t},n,i]=(0,w.U$)("id"),r=(0,u.useRef)(null!=n.initialValue&&n.initialValue.length>0);(0,u.useEffect)(()=>{r.current||null==e||i.setValue((0,L.lV)(e),!1)},[e]),(0,u.useEffect)(()=>{let n=null==t||0===t.length;if(r.current){if(!n)return;r.current=!1}else n||null!=e&&t===(0,L.lV)(e)||(r.current=!0)},[t])}var M=(0,u.memo)(e=>{let{formId:t,initialValues:n,validationSchema:r,onSave:l,FormFields:o,children:a}=e;return(0,i.jsx)(s.xu,{children:(0,i.jsx)(w.J9,{initialValues:n,validationSchema:r,onSubmit:(e,t)=>{let{id:n,...i}=e;l({newKey:n,value:Object.entries(i).reduce((e,t)=>{let[n,i]=t;if(typeof i!==Boolean&&!i){var r;let t=null===(r=o[n])||void 0===r?void 0:r.defaultValue;if(void 0!==t)return{...e,[n]:t}}return{...e,[n]:i}},{})})},children:e=>(0,i.jsxs)(w.l0,{id:t,children:[(0,i.jsx)(D,{}),a({...e,initialValues:n})]})})})});function O(e){let{children:t}=e,n=(0,c.W)();return(0,i.jsx)(s.kC,{sx:{position:"sticky",zIndex:1,top:0,p:3,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n},children:t})}l().setAppElement("#__next");var A=e=>{let{close:t,data:n,fields:r,onSave:l,zoneType:c}=e,{theme:u}=(0,a.B7)(),p=(0,o.v9)(I.Ch).filter(C.TG);if(!n.isOpen)return null;let{field:[h,f]}=n,y=(0,T.t)(_.C,f.config,f.type);if(!y)return(0,i.jsxs)("div",{children:[f.type," not found"]});let{Meta:{icon:j},FormFields:k,Form:w,schema:L,label:D}=y,A={...(0,b.f7)((0,F.B9)(k,"id")),...y.prepareInitialValues?y.prepareInitialValues(p,f.config):f.config},{res:N,err:R}=(()=>{try{return{res:L.validateSync({type:f.type,config:A},{stripUnknown:!0})}}catch(e){return{err:e}}})();R&&(console.error("[EditModal] Failed to validate field of type ".concat(f.type,".\n Please update model.json accordingly.")),console.error(R));let P={id:h,config:N?N.config:A},[q,V]=k.id.validate.matches,z=d.object().shape({id:d.string().matches(q,V).min(3).max(35).required(),config:L.fields.config}),B="".concat("edit-modal-form","-").concat(Math.random().toString());return(0,i.jsx)(v.Z,{isOpen:!0,shouldCloseOnOverlayClick:!0,onRequestClose:t,contentLabel:"Widget Form Modal",children:(0,i.jsx)(M,{apiId:h,formId:B,initialValues:P,validationSchema:z,FormFields:k,onSave:e=>{let{newKey:n,value:i}=e;l({apiId:h,newKey:n,value:{...f,...i},updateMeta:{fieldIdChanged:{previousPath:[h],newPath:[n]}}}),t()},children:e=>{let{isValid:n,isSubmitting:l,initialValues:o}=e,a=w?(0,i.jsx)(w,{...e,fields:r},"field-model-tab-content"):(0,i.jsx)(x.k,{children:Object.entries(k).map(e=>{let[t,n]=e;return(0,i.jsx)(x.J,{children:(0,i.jsx)(E.Z,{fieldName:(0,b.lm)(t),formField:n,fields:r,initialValues:o,autoFocus:""===h&&void 0})},t)})},"field-model-tab-content"),d=["Field Model"],p=[a];if("slice"===c){let e=(0,i.jsx)(s.xu,{children:(0,i.jsx)(S,{})},"mock-data-tab-content");d.push("Mock Data"),p.push(e)}return(0,i.jsx)(m,{borderFooter:!0,footerSx:{position:"sticky",bottom:0,p:0},tabs:d,Header:(0,i.jsxs)(O,{children:[(0,i.jsx)(g,{theme:u,text:D,WidgetIcon:j}),(0,i.jsx)(s.x8,{onClick:t,type:"button"})]}),Footer:(0,i.jsxs)(s.kC,{sx:{position:"sticky",bottom:0,alignItems:"space-between",bg:"headSection",p:3},children:[(0,i.jsx)(s.xu,{sx:{ml:"auto"}}),(0,i.jsx)(s.zx,{mr:2,type:"button",onClick:t,variant:"secondary",children:"Cancel"}),(0,i.jsx)(s.zx,{form:B,type:"submit",disabled:!n&&l,sx:{fontWeight:"400",paddingBlock:"8px",paddingInline:"16px",fontSize:"14px",borderRadius:"4px"},children:"Done"})]}),children:p})}})})}},16182:function(e,t,n){"use strict";n.d(t,{Z:function(){return v}});var i=n(52322),r=n(2784),l=n(49857),o=n(11699);function a(e){return e.show?(0,i.jsx)(o.D,{padding:{block:8,inline:16},border:{top:!0},borderColor:"grey6",children:(0,i.jsxs)(o.bL,{variant:"normal",color:"grey11",children:["No code snippet for this field."," ",(0,i.jsx)(o.bL,{component:"a",href:"https://prismic.io/docs/fields/content-relationship",rel:"noopener noreferrer",target:"_blank",color:"grey11",underline:!0,children:"Check the docs"})," ","for an example."]})}):null}var s=n(80148),d=n(77245),c=n(8799),u=n(65186),p=n(59326),h=n(75289),f=n(38193);let m={position:"relative",top:"3px"};var x=e=>{var t,n,l;let{code:o,lang:a}=e,{theme:s}=(0,p.B7)(),[x,g]=(0,r.useState)(!1);return o?(0,i.jsxs)(h.kC,{sx:{p:2,px:3,alignItems:"center",borderTop:"1px solid",borderColor:"borders",justifyContent:"space-between"},children:[(0,i.jsxs)(h.kC,{sx:{alignItems:"center",display:["none","none","flex"],maxWidth:"80%"},children:[(0,i.jsx)(c.vcz,{size:26,color:null==s?void 0:null===(t=s.colors)||void 0===t?void 0:t.icons,style:{border:"1px solid",borderColor:null==s?void 0:null===(n=s.colors)||void 0===n?void 0:n.borders,borderRadius:"3px",padding:"4px",marginRight:"2px"}}),(0,i.jsx)(f.Z,{sx:{margin:"0px 8px",border:"none",borderRadius:"3px",fontSize:"13px"},lang:a,children:o})]}),(0,i.jsx)(h.xu,{children:(0,i.jsxs)(h.zx,{"aria-label":x?"Code snippet copied":"Copy code snippet",onClick:()=>{o&&navigator.clipboard.writeText(o).then(()=>{g(!0),setTimeout(()=>{g(!1)},1200)})},variant:"textButton",children:[x?(0,i.jsx)(u.HhX,{size:16,color:null==s?void 0:null===(l=s.colors)||void 0===l?void 0:l.success,style:m}):(0,i.jsx)(d.LhG,{size:16,style:m}),(0,i.jsx)(h.xv,{as:"span",sx:{display:["none","inline","none","inline"]},children:"\xa0Copy"})]})})]}):null};let g=e=>{let{show:t,renderHintBase:n,item:r,hintItemName:o}=e,a=n({item:r}),d=[a];if("Link"===r.value.type){var c,u,p,h,f;null!==(h=null===(c=r.value.config)||void 0===c?void 0:c.allowText)&&void 0!==h&&h&&d.push("allowText"),null!==(f=null===(u=r.value.config)||void 0===u?void 0:u.repeat)&&void 0!==f&&f&&d.push("repeat"),(null===(p=r.value.config)||void 0===p?void 0:p.variants)&&d.push("variants")}let{data:m,error:g}=(0,l.ZP)(d.join("$"),async()=>await s.managerClient.snippets.readSnippets({fieldPath:a.split("."),model:r.value,itemName:o}));if(g&&console.error(g),!m||g)return null;let v=m.snippets||[];return v[0]?(0,i.jsx)("div",{style:{display:t?"initial":"none"},children:(0,i.jsx)(x,{code:v[0].code,lang:v[0].language})}):null};var v=e=>{var t;let{item:n}=e;return"Link"===n.value.type&&(null===(t=n.value.config)||void 0===t?void 0:t.select)==="document"?(0,i.jsx)(a,{show:e.show}):(0,i.jsx)(g,{...e})}},40141:function(e,t,n){"use strict";n.d(t,{Z:function(){return M}});var i=n(52322),r=n(11699),l=n(13980),o=n(2784),a=n(65077),s=n(94160),d=n(35289),c=n(6882),u=n(6609);function p(e){let{open:t,onOpenChange:n,onConfirm:l}=e;return(0,i.jsxs)(r.ae,{open:t,onOpenChange:n,size:"small",children:[(0,i.jsx)(r.al,{title:"Static zone"}),(0,i.jsx)(r.aj,{children:(0,i.jsx)(r.bn,{children:(0,i.jsxs)(r.D,{as:"article",flexDirection:"column",padding:16,gap:4,children:[(0,i.jsx)(r.bL,{sx:{marginBottom:4},color:"purple9",variant:"smallBold",children:"About"}),(0,i.jsx)(r.bL,{variant:"h3",children:"What is the static zone?"}),(0,i.jsx)(r.bL,{color:"grey11",children:"The static zone in Prismic page types contain fields that are always present on the page. Use it for essential information like a page's title, page design settings, or metadata. Unlike slices, which can be added or removed, static zone fields remain fixed."}),(0,i.jsx)(r.c8,{src:"https://res.cloudinary.com/dmtf1daqp/video/upload/v1723540305/DEV_TOOLS/STATES/Explication_vide%CC%81o_zone_statique_phibeq.mp4",sizing:"contain",autoPlay:!0,loop:!0})]})})}),(0,i.jsx)(r.ah,{children:(0,i.jsx)(r.af,{size:"medium",sx:{flexGrow:1},onClick:()=>{l(),n(!1)},children:"Got it"})})]})}var h=n(76611),f=n(5683);let m=(0,o.forwardRef)((e,t)=>{var n;return(0,i.jsx)(r.E,{...e,ref:t,startIcon:"add",color:"grey","aria-label":"Add a field","data-testid":null!==(n=e["data-testid"])&&void 0!==n?n:"add-field"})});function x(e){let{zoneTypeFormat:t,...n}=e;return"page"===t?(0,i.jsx)(v,{...n}):(0,i.jsx)(b,{...n})}let g=(0,i.jsx)("div",{style:{position:"absolute",bottom:0,right:0}});function v(e){let{disabled:t,fields:n,triggerDataTestId:l,onSelectField:a}=e,[s,d]=(0,o.useState)(!1),[c,x]=(0,o.useState)(!1),[v,b]=(0,h.V)(f.v,!1);return(0,i.jsxs)(r.D,{position:"relative",children:[(0,i.jsx)(m,{onClick:()=>{v?d(!0):x(!0)},"data-testid":l}),(0,i.jsx)(p,{open:c,onOpenChange:e=>{x(e),e||d(!0)},onConfirm:()=>b(!0)}),(0,i.jsx)(u.S,{open:s,onOpenChange:d,disabled:t,onSelectField:a,fields:n,trigger:g})]})}function b(e){let{disabled:t,fields:n,triggerDataTestId:r,onSelectField:l}=e;return(0,i.jsx)(u.S,{disabled:t,onSelectField:l,fields:n,trigger:(0,i.jsx)(m,{"data-testid":r})})}var y=n(45440),j=n(49919),k=n(40023),S=n(75289),C=n(70705),_=n(86355),F=n(23134),I=n(16182),T=e=>{let{fields:t,title:n,tabId:r,enterEditMode:l,enterSelectMode:o,onDragEnd:a,renderFieldAccessor:s,onDeleteItem:d,onSave:c,showHints:u,renderHintBase:p,isRepeatable:h,testId:f,isRepeatableCustomType:m}=e;return(0,i.jsx)(k.Z5,{onDragEnd:a,children:(0,i.jsx)(k.bK,{droppableId:n,children:(e,n)=>(0,i.jsxs)(S.xu,{as:"ul",ref:e.innerRef,...e.droppableProps,"data-testid":f,sx:{paddingInline:"16px !important"},children:[t.map((e,t)=>{let{value:{config:a,type:f}}=e,x=(0,F.t)(y.C,a,f);if(!x)return(0,i.jsx)(C.Z,{children:(0,i.jsxs)(S.xv,{children:['Field type "',f,'" not supported']})});let g={item:e,index:t,tabId:r,widget:x,showHints:u,key:e.key,enterSelectMode:o,renderFieldAccessor:s,enterEditMode:l,parentSnapshot:n,deleteItem:d,saveItem:c,draggableId:"list-item-".concat(e.key),isRepeatableCustomType:m,testId:"list-item-".concat(e.key)},v=(0,i.jsx)(I.Z,{item:e,show:u,isRepeatable:h,renderHintBase:p,hintItemName:x.hintItemName,Widgets:y.C,typeName:x.CUSTOM_NAME||x.TYPE_NAME});if(x.CustomListItem){let{CustomListItem:e}=x;return(0,i.jsx)(e,{...g,HintElement:v})}return(0,i.jsx)(_.Z,{...g,HintElement:v})}),e.placeholder]})})})},E=n(644),w=n.n(E);let L=e=>{let{zoneType:t,heading:n="Your ".concat(t," has no fields yet"),action:l}=e;return(0,i.jsxs)("div",{className:w().root,children:[(0,i.jsxs)("div",{children:[(0,i.jsx)(r.bL,{variant:"bold",children:n}),(0,i.jsx)(r.bL,{color:"grey11",children:"A field is an input for content (e.g. text, images, links)."})]}),l]})},D=e=>{let t,{zoneType:n,zoneTypeFormat:l,tabId:p,title:h,fields:f,poolOfFieldsToCheck:m,widgetsArray:g,isRepeatable:v,onDeleteItem:b,onDragEnd:k,EditModal:S,onSave:C,dataTip:_,renderHintBase:F,renderFieldAccessor:I,testId:E,isRepeatableCustomType:w,emptyStateHeading:D}=e,M=(()=>{let e=!!Object.entries(m).find(e=>{let[,{value:t}]=e;return"UID"===t.type}),t=g.filter(e=>{let{TYPE_NAME:t}=e;return"UID"!==t});return e?t:[...t,g.find(e=>{let{TYPE_NAME:t}=e;return"UID"===t})]})(),[O,A]=(0,o.useState)(!1),[N,R]=(0,o.useState)({isOpen:!1}),P={onSelectField:e=>{R({isOpen:!0,field:["",y.C[e].create("")]})},fields:M.filter(Boolean).map(e=>{let{TYPE_NAME:t,CUSTOM_NAME:n}=e;return c.XU.find(e=>e.type===t&&(void 0===n||e.variant===n))}),triggerDataTestId:v?"add-field-in-items":void 0};return"slice"===n&&f.length>0?t=(0,i.jsx)(u.S,{...P}):"customType"===n&&(t=(0,i.jsx)(x,{...P,zoneTypeFormat:l})),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(d.Bu,{actions:(0,i.jsxs)(i.Fragment,{children:[f.length>0&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.bL,{color:"grey11",component:"span",noWrap:!0,children:"Show code snippets?"}),(0,i.jsx)(r.bC,{checked:O,onCheckedChange:A,size:"small",style:{flexShrink:0},"data-testid":"code-snippets-switch"})]}),t]}),children:h}),0===f.length&&"slice"===n?(0,i.jsx)(L,{zoneType:"customType"===n?"page"===l?"page type":"custom type":n,heading:D,action:(0,i.jsx)(u.S,{...P})}):f.length>0?(0,i.jsx)(a.xR,{children:(0,i.jsx)(T,{tabId:p,isRepeatable:v,fields:f,showHints:O,dataTip:_,title:h,renderFieldAccessor:I,renderHintBase:F,enterEditMode:e=>{R({isOpen:!0,field:e});let[t,n]=e;s.Xe.track({event:"field:settings-opened",id:t,name:n.config.label,type:n.type,isInAGroup:!1,contentType:(0,j.T)(window.location.pathname)})},onDragEnd:k,onDeleteItem:b,onSave:C,testId:E,isRepeatableCustomType:w})}):void 0,(0,i.jsx)(S,{data:N,close:()=>{R({isOpen:!1})},onSave:C,fields:m,zoneType:n})]})};D.propTypes={isRepeatable:l.bool,title:l.string.isRequired,dataTip:l.string.isRequired,onSave:l.func.isRequired,onDragEnd:l.func.isRequired,onDeleteItem:l.func.isRequired,poolOfFieldsToCheck:(0,l.arrayOf)((0,l.shape)({key:l.string,value:l.object})),renderHintBase:l.func.isRequired,renderFieldAccessor:l.func.isRequired,widgetsArray:l.array.isRequired,fields:(0,l.arrayOf)((0,l.shape)({key:l.string.isRequired,value:(0,l.shape)({config:l.object,fields:l.array,type:l.string.isRequired})}))};var M=D},23134:function(e,t,n){"use strict";n.d(t,{t:function(){return r}});var i=n(59050);let r=(e,t,n)=>{if("Link"===n)switch(null==t?void 0:t.select){case"document":return e.ContentRelationship;case"media":return e.LinkToMedia;default:return e.Link}if(n===i.GroupFieldType){var r;return null!==(r=e.Group)&&void 0!==r?r:e.NestedGroup}return e[n]}},9889:function(e,t,n){"use strict";n.d(t,{Jp:function(){return o},OR:function(){return l}});var i=n(7974),r=n(49046);let l={label:(0,r.II)("Label",{required:"This field is required",max:!0},void 0,void 0,"Label for content creators (defaults to field type)",!0),id:(0,r.II)("API ID*",{min:!0,max:!0,required:"This field is required",matches:[i.xo,"No special characters allowed (except _)"]},e=>{let{value:t,fields:n,initialId:i}=e;return t?n.find(e=>{let{key:n}=e;return n===t})&&t!==i?'Field "'.concat(t,'" already exists.'):void 0:"Field is required"},void 0,"A unique identifier for the field (e.g. buttonLink)")},o={...l,placeholder:(0,r.II)("Placeholder",{required:"This field is required",max:[100,"String is too long. Max: 100"]},void 0,void 0,"Placeholder text for content creators")}},49046:function(e,t,n){"use strict";n.d(t,{II:function(){return d},Jg:function(){return l}});var i=n(68169),r=n(79256);let l=function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=!(arguments.length>2)||void 0===arguments[2]||arguments[2];return{type:r.h.CHECKBOX,validate:{required:(0,i.MJ)(t,s)},required:t,label:e,defaultValue:n,yupType:"boolean"}},o=[3,"String is too short. Min: 3"],a=[35,"String is too long. Max: 35"],s=["Field is required"],d=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{min:o,max:a,required:s},n=arguments.length>2?arguments[2]:void 0,l=arguments.length>3?arguments[3]:void 0,d=arguments.length>4?arguments[4]:void 0,c=arguments.length>5&&void 0!==arguments[5]&&arguments[5],{min:u,max:p,required:h,matches:f}=t||{};return{type:r.h.INPUT,label:e,validate:{required:(0,i.MJ)(h,s),min:(0,i.MJ)(u,o),max:(0,i.MJ)(p,a),matches:f},defaultValue:l,fieldLevelValidation:n,yupType:"string",placeholder:d,autoFocus:c}}},68169:function(e,t,n){"use strict";n.d(t,{MJ:function(){return a},f7:function(){return s},gc:function(){return d},lm:function(){return o}});var i=n(65413),r=n(79256);let l=e=>null===e.defaultValue?void 0:void 0!==e.defaultValue?e.defaultValue:e.type===r.h.CHECKBOX||(e.type===r.h.INPUT?"":e.type===r.h.SELECT?[]:void 0),o=e=>"id"===e?"id":"config.".concat(e),a=(e,t)=>Array.isArray(e)?e:"boolean"==typeof e&&e?t:null,s=e=>Object.entries(e).reduce((e,t)=>{let[n,i]=t,r=l(i);return void 0!==r?{...e,[n]:r}:e},{}),d=e=>i.object().shape(Object.entries(e).filter(e=>e).reduce((e,t)=>{let[n,r]=t,{validate:l,yupType:o}=r;if(!l)return e;if("function"==typeof l)return{...e,[n]:l(n,r)};let a=i[o]();return Object.entries(l).filter(e=>e&&e[1]).forEach(e=>{let[t,i]=e;if(i&&a[t]){a=a[t](...Array.isArray(i)?i:[i]);return}console.warn('Invalid Yup validator for field "'.concat(n,'"'))}),{...e,[n]:a}},{})).required().default(void 0).noUnknown(!0)},79256:function(e,t,n){"use strict";var i,r;n.d(t,{h:function(){return i}}),(r=i||(i={})).CHECKBOX="checkbox",r.INPUT="input",r.SELECT="select"},45440:function(e,t,n){"use strict";n.d(t,{C:function(){return tc}});var i=n(52322),r=n(96317),l=n(65186),o=n(65413),a=n(6882),s=n(75289),d=n(80575),c=n(89280),u=n(68169),p=n(9889),h=n(49046);let f={...p.OR,repeat:(0,h.Jg)("Repeatable",!1,!0)};var m=e=>{let{initialValues:t,fields:n,values:r,setFieldValue:l}=e,{config:{repeat:o}}=r;return(0,i.jsxs)(d.k,{children:[Object.entries(f).filter(e=>{let[t]=e;return"repeat"!==t}).map(e=>{let[r,l]=e;return(0,i.jsx)(d.J,{children:(0,i.jsx)(c.Z,{fieldName:(0,u.lm)(r),formField:l,fields:n,initialValues:t})},r)}),(0,i.jsx)(d.J,{children:(0,i.jsx)(s.xu,{sx:{mt:2,alignItems:"center",display:"flex",height:"130%"},children:(0,i.jsxs)(s.__,{variant:"label.border",sx:{mb:0},children:[(0,i.jsx)(s.XZ,{checked:o,onChange:()=>l("config.repeat",!o)}),"Repeatable"]})})})]})};let x={icon:l.iy3},g=e=>o.object().shape({type:o.string().matches(e,{excludeEmptyString:!0}).required(),config:o.object().shape({fields:o.array(),label:o.string(),repeat:o.boolean().optional()})});function v(e){let{schemaTypeRegex:t,customListItem:n,customName:i,hintItemName:r}=e;return{Meta:x,Form:m,FormFields:f,schema:g(t),create:e=>({type:"Group",config:{label:e,repeat:!0,fields:[]}}),CustomListItem:n,TYPE_NAME:"Group",CUSTOM_NAME:i,hintItemName:r,label:a.U.name}}var b=n(59050),y=n(2784),j=n(40023),k=n(28316),S=n(94160),C=n(6609),_=n(86355),F=n(3285),I=n(16182),T=n(23134),E=n(49219),w=n(16086),L=n(358),D=n(49919),M=n(5495),O=n(39302);let A=e=>{let{tabId:t,widget:n,Widgets:r,widgetsArray:l,hintBase:o,parentSnapshot:d,showHints:c,isRepeatable:u,item:p,draggableId:h,saveItem:f,HintElement:m,...x}=e,[g,v]=(0,y.useState)({isOpen:!1}),A=e=>{var t;let{apiId:n,value:i}=e;null===(t=i.config)||void 0===t||t.label;let r=function(e){var t,n,i;let r=structuredClone(e.group);return null!==(n=r.config)&&void 0!==n||(r.config={}),null!==(i=(t=r.config).fields)&&void 0!==i||(t.fields={}),r.config.fields[e.fieldId]=e.field,r}({group:E.Fl.fromSM(p.value),fieldId:n,field:i});f({apiId:p.key,newKey:p.key,value:E.Fl.toSM(r),inGroupFieldAction:"add"}),(0,M.V)({id:n,field:i,isInAGroup:!0})},N=e=>{let{apiId:t,newKey:n,value:i}=e,r=i.type===b.GroupFieldType?E.Fl.fromSM(i):i,l=function(e){var t,n;let i=structuredClone(e.group);if(!(null===(t=i.config)||void 0===t?void 0:t.fields)||!(null===(n=e.group.config)||void 0===n?void 0:n.fields))return i;for(let t in i.config.fields={},e.group.config.fields)t===e.previousFieldId?i.config.fields[e.newFieldId]=e.field:i.config.fields[t]=e.group.config.fields[t];return i}({group:E.Fl.fromSM(p.value),previousFieldId:t,newFieldId:n,field:r});f({apiId:p.key,newKey:p.key,value:E.Fl.toSM(l),inGroupFieldAction:"update",updateMeta:{fieldIdChanged:{previousPath:[p.key,t],newPath:[p.key,n]}}}),(0,O.Z)({previousId:t,id:n,field:r,isInAGroup:!0})},R=e=>{let t=function(e){var t,n;let i=structuredClone(e.group);return null===(n=i.config)||void 0===n||null===(t=n.fields)||void 0===t||delete t[e.fieldId],i}({group:E.Fl.fromSM(p.value),fieldId:e});f({apiId:p.key,newKey:p.key,value:E.Fl.toSM(t)})},P=e=>{v({isOpen:!0,field:e});let[t,n]=e;S.Xe.track({event:"field:settings-opened",id:t,name:n.config.label,type:n.type,isInAGroup:!0,contentType:(0,D.T)(window.location.pathname)})};return(0,i.jsxs)(y.Fragment,{children:[(0,i.jsx)(_.Z,{item:p,widget:n,draggableId:h,...x,HintElement:m,CustomEditElements:[(0,i.jsx)(C.S,{onSelectField:e=>{v({isOpen:!0,field:["",r[e].create("")]})},fields:l.filter(Boolean).map(e=>{let{TYPE_NAME:t,CUSTOM_NAME:n}=e,i=a.XU.find(e=>e.type===t&&(void 0===n||e.variant===n));if(!i)throw Error("Field not found for widget: ".concat(t," - ").concat(n));return i})},"add-field-dropdown")],children:(0,i.jsx)(s.xu,{sx:{ml:4},children:(0,i.jsx)(j.Z5,{onDragEnd:e=>{if((0,w.uS)(e))return;let{source:t,destination:n}=e;if(!n)return;let{index:i}=t,{index:r}=n,l=function(e){var t;let n=structuredClone(e.group);if(!(null===(t=n.config)||void 0===t?void 0:t.fields))return n;let i=Object.entries(n.config.fields),[r]=i.splice(e.sourceIndex,1);return i.splice(e.destinationIndex,0,r),n.config.fields=Object.fromEntries(i),n}({group:E.Fl.fromSM(p.value),sourceIndex:i,destinationIndex:r});(0,k.flushSync)(()=>{f({apiId:p.key,newKey:p.key,value:E.Fl.toSM(l)})})},children:(0,i.jsx)(j.bK,{droppableId:"".concat(t,"-").concat(p.key,"-zone"),children:e=>(0,i.jsxs)("ul",{ref:e.innerRef,...e.droppableProps,children:[p.value.config.fields.map((e,t)=>{let{value:{config:n,type:l}}=e,a=(0,T.t)(r,n,l);if(!a)return null;let s={item:e,index:t,widget:a,key:e.key,enterEditMode:P,deleteItem:R,saveItem:N,showHints:c,renderFieldAccessor:t=>"item".concat((0,L.Ti)(e.key)),draggableId:"group-".concat(p.key,"-").concat(e.key,"-").concat(t),testId:"list-item-group-".concat(p.key,"-").concat(e.key)},d=(0,i.jsx)(I.Z,{item:e,show:c,isRepeatable:u,renderHintBase:e=>{let{item:t}=e;return"".concat(o).concat((0,L.Ti)(t.key))},hintItemName:a.hintItemName,Widgets:r,typeName:a.CUSTOM_NAME||a.TYPE_NAME});if(a.CustomListItem){let{CustomListItem:e}=a;return(0,i.jsx)(e,{...s,HintElement:d})}return(0,i.jsx)(_.Z,{...s,HintElement:d})}),e.placeholder]})})})})}),(0,i.jsx)(F.Z,{data:g,close:()=>{v({isOpen:!1})},onSave:e=>""===e.apiId?A({...e,apiId:e.newKey}):N(e),fields:p.value.config.fields})]})},N={icon:l.hs8},R={label:p.Jp.label,id:p.Jp.id,placeholder_false:(0,h.II)("False Placeholder",{required:!1},null,"false","Value the content creator sees (Output as 'false' in the API)."),placeholder_true:(0,h.II)("True Placeholder",{required:!1},null,"true","Value the content creator sees (Output as 'true' in the API)"),default_value:(0,h.Jg)("Default to true")},P={TYPE_NAME:"Boolean",create:e=>({type:"Boolean",config:{label:e,default_value:!1,placeholder_true:"true",placeholder_false:"false"}}),Meta:N,schema:o.object().shape({type:o.string().matches(/^Boolean$/,{excludeEmptyString:!0}).required(),config:(0,u.gc)((0,w.B9)(R,"id"))}),FormFields:R,label:a.Qr.name},q={icon:l.U8L},{TYPE_NAME:V,FormFields:z,schema:B}=(0,w.zg)("Color"),G={create:e=>({type:"Color",config:{label:e,placeholder:""}}),FormFields:z,TYPE_NAME:V,schema:B,Meta:q,label:a.pG.name};var J=n(11699),U=n(63397);function Z(e){let{checked:t,height:n=130,setFieldValue:r}=e,[l,o]=(0,y.useState)(null);return(0,i.jsx)(d.J,{children:(0,i.jsx)(s.kC,{sx:{mt:2,alignItems:"center",height:"".concat(n,"%")},children:(0,i.jsx)(s.__,{variant:"label.border",children:(0,i.jsxs)(J.D,{display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",ref:o,children:[(0,i.jsxs)(s.kC,{children:[(0,i.jsx)(s.XZ,{checked:t,onChange:e=>{r("config.allowText",e.target.checked)}}),"Allow display text"]}),(0,i.jsx)(J.c3,{container:l,align:"end",content:"Allow editors to customize the link display text",children:(0,i.jsx)(J.aX,{name:"alert",size:"medium",color:"grey11"})})]})})})})}function H(e){let{checked:t,setFieldValue:n}=e;return(0,i.jsxs)(J.D,{flexDirection:"column",children:[(0,i.jsx)(s.__,{htmlFor:"repeat",variant:"label.primary",children:"Repeatable"}),(0,i.jsxs)(s.__,{variant:"label.border",sx:{display:"flex"},children:[(0,i.jsx)(s.XZ,{name:"repeat",checked:t,onChange:e=>{n("config.repeat",e.target.checked)}}),"Make this link repeatable (allows editors to create lists of links)"]}),(0,i.jsxs)(J.D,{alignItems:"center",gap:4,children:[(0,i.jsx)(J.aX,{name:"alert",size:"medium",color:"grey11"}),(0,i.jsxs)(J.bL,{variant:"normal",color:"grey11",children:["Repeatable link fields are returned as an array of links by the API."," ",(0,i.jsx)("a",{href:"https://prismic.io/docs/field",style:{textDecoration:"none"},target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(J.bL,{variant:"normal",color:"indigo11",children:"See documentation."})})]})]})]})}function W(e){var t,n;let{variants:r,onVariantsChange:l,error:o}=e,a=!!r,s=a?"Enabled":"Disabled",d="Options (".concat(null!==(t=null==r?void 0:r.length)&&void 0!==t?t:0,")"),c=(null!==(n=null==r?void 0:r.length)&&void 0!==n?n:0)>2,u=(0,y.useRef)();return(0,i.jsxs)(J.D,{overflow:"hidden",flexDirection:"column",border:!0,borderRadius:6,children:[(0,i.jsxs)(J.D,{border:{bottom:!0},padding:12,flexDirection:"column",gap:8,children:[(0,i.jsx)(J.bL,{variant:"h4",color:"grey12",children:"Variants"}),(0,i.jsx)(J.bL,{color:"grey12",children:'Add variants like "Primary" and "Secondary" to allow editors to choose the link\'s style by selecting one of them.'}),(0,i.jsxs)(J.D,{gap:8,children:[(0,i.jsx)(J.bC,{checked:a,onCheckedChange:e=>{l(e?["Primary","Secondary"]:void 0)}}),(0,i.jsx)(J.bL,{color:"grey11",children:s})]})]}),a&&(0,i.jsxs)(J.D,{border:{bottom:!0},padding:12,flexDirection:"column",gap:8,children:[(0,i.jsxs)(J.bL,{variant:"h5",color:"grey11",children:[d,!!o&&(0,i.jsx)(J.bL,{variant:"inherit",color:"tomato9",children:" ".concat(o)})]}),null==r?void 0:r.map((e,t)=>(0,i.jsxs)(J.D,{gap:4,alignItems:"center",children:[(0,i.jsx)(J.D,{flexGrow:1,backgroundColor:"white",padding:{inline:12,block:8},flexDirection:"column",border:!0,borderRadius:4,children:(0,i.jsx)(J.bN,{ref:e=>{u.current===t&&(u.current=void 0,null==e||e.focus())},placeholder:"Variant option (e.g. Primary)",value:e,onValueChange:e=>l(null==r?void 0:r.map((n,i)=>i===t?e:n))})}),c&&(0,i.jsx)(J.aZ,{type:"button",icon:"delete",onClick:()=>l(null==r?void 0:r.filter((e,n)=>n!==t))})]},t)),(0,i.jsx)(J.D,{children:(0,i.jsx)(J.E,{invisible:!0,startIcon:"add",onClick:()=>{u.current=null==r?void 0:r.length,l([...null!=r?r:[],""])},children:"Add option"})})]}),(0,i.jsx)(J.D,{backgroundColor:"white",flexDirection:"column",padding:12,children:(0,i.jsxs)(J.bL,{variant:"normal",color:"grey11",children:['Need additional properties similar to "Variants"?'," ",(0,i.jsx)("a",{href:"https://community.prismic.io/t/link-field-use-cases-share-your-requests-and-feedback/18146",target:"_blank",rel:"noopener noreferrer",style:{color:"inherit",textDecoration:"underline"},children:"Please provide your feedback here."})]})})]})}let $={...p.Jp};function X(e){var t;let{variants:n,setFieldValue:r}=e,l="config.variants",[o,a]=(0,U.U$)(l),s=null===(t=a.error)||void 0===t?void 0:t.find(e=>e);return(0,i.jsx)(W,{variants:n,onVariantsChange:e=>r(l,e),error:s})}let K={icon:l.$l_},Y=o.object().shape({label:o.string().optional(),useAsTitle:o.boolean().optional(),placeholder:o.string().optional(),select:o.string().optional().oneOf(["media","document","web",null]).nullable(),customtypes:o.array().strict().optional(),masks:o.array(o.string()).optional(),tags:o.array(o.string()).optional(),allowTargetBlank:o.boolean().strict().optional(),allowText:o.boolean().strict().optional(),repeat:o.boolean().strict().optional(),variants:o.array(o.string().trim().required("Values can't be empty")).optional()}).required().default(void 0).noUnknown(!0),Q={Meta:K,FormFields:$,schema:o.object().shape({type:o.string().matches(/^Link$/,{excludeEmptyString:!0}).required(),config:Y.optional()}),Form:e=>{let{initialValues:t,values:n,fields:r,setFieldValue:l}=e,{config:{allowText:o,repeat:a,variants:p}}=n;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(d.k,{children:[Object.entries($).map(e=>{let[n,l]=e;return(0,i.jsx)(d.J,{children:(0,i.jsx)(c.Z,{fieldName:(0,u.lm)(n),formField:l,fields:r,initialValues:t})},n)}),(0,i.jsx)(d.J,{children:(0,i.jsxs)(s.kC,{sx:{gap:2,marginTop:3},style:{paddingTop:"1px"},children:[(0,i.jsx)(d.J,{children:(0,i.jsx)(c.Z,{fieldName:(0,u.lm)("allowTargetBlank"),formField:(0,h.Jg)("Allow target blank",!1,!0),fields:r,initialValues:t})}),(0,i.jsx)(Z,{checked:o,setFieldValue:l})]})},"allowTargetBlank")]}),(0,i.jsx)(J.D,{height:8}),(0,i.jsxs)(J.D,{flexDirection:"column",gap:16,children:[(0,i.jsx)(H,{checked:a,setFieldValue:l}),(0,i.jsx)(X,{variants:p,setFieldValue:l})]})]})},create:e=>({type:"Link",config:{label:e,placeholder:"",select:null,allowTargetBlank:!0,allowText:!0,repeat:!1}}),TYPE_NAME:"Link",label:a.pV.name};var ee=n(41347);let et={label:p.Jp.label,id:p.Jp.id,customtypes:{validate:()=>o.array()}},en={icon:l.I2R},ei=Y.shape({label:o.string().max(35,"String is too long. Max: 35"),select:o.string().required().matches(/^document$/,{excludeEmptyString:!0}),customtypes:o.array().optional()}),er={create:e=>({type:"Link",config:{label:e,select:"document",repeat:!1,customtypes:[]}}),Meta:en,schema:o.object().shape({type:o.string().matches(/^Link$/,{excludeEmptyString:!0}).required(),config:ei}),TYPE_NAME:"Link",FormFields:et,CUSTOM_NAME:"ContentRelationship",Form:e=>{let{initialValues:t,values:n,setFieldValue:r,fields:l}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(d.k,{children:Object.entries(et).filter(e=>"customtypes"!==e[0]).map(e=>{let[n,r]=e;return(0,i.jsx)(d.J,{children:(0,i.jsx)(c.Z,{fieldName:(0,u.lm)(n),formField:r,fields:l,initialValues:t})},n)})}),(0,i.jsx)(s.xu,{mt:20,children:(0,i.jsx)(ee.zE,{value:n.config.customtypes,onChange:e=>{r("config.customtypes",e)}})})]})},prepareInitialValues:(e,t)=>(null==t?void 0:t.customtypes)?{...t,customtypes:t.customtypes.filter(t=>e.find(e=>"string"==typeof t?e.local.id===t:e.local.id===t.id))}:t,label:a.$U.name},{FormFields:el,schema:eo}=(0,w.zg)("Date"),ea={create:e=>({type:"Date",config:{label:e,placeholder:""}}),FormFields:el,TYPE_NAME:"Date",schema:eo,Meta:{icon:l.f$3},label:a.pt.name},{FormFields:es,schema:ed}=(0,w.zg)("Embed"),ec={create:e=>({type:"Embed",config:{label:e,placeholder:""}}),FormFields:es,TYPE_NAME:"Embed",schema:ed,Meta:{icon:l.xoN},label:a.gA.name},eu={create:e=>({type:"GeoPoint",config:{label:e}}),FormFields:{label:p.Jp.label,id:p.Jp.id},TYPE_NAME:"GeoPoint",schema:o.object().shape({type:o.string().matches(/^GeoPoint$/,{excludeEmptyString:!0}).required(),config:o.object().shape({label:o.string()}).required().default(void 0).noUnknown(!0)}),Meta:{icon:l.lPv},label:a.uG.name};var ep=n(8799),eh=n(90167),ef=n(66770);let em=e=>{let{onClick:t,error:n,onDelete:r,active:o,text:a,sx:d}=e;return(0,i.jsx)(ef.Z,{useActive:!0,fitButton:!0,error:n,onClick:t,active:o,sx:{position:"relative",width:"64px",height:"64px",...d},Icon:()=>(0,i.jsxs)(y.Fragment,{children:[(0,i.jsxs)(s.kC,{sx:{flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[(0,i.jsx)(ep.jnY,{size:22}),(0,i.jsx)(s.xv,{mt:1,children:a})]}),r?(0,i.jsx)(s.Ct,{onClick:r,variant:"circle-right",children:(0,i.jsx)(l.B4e,{})}):null]})})},ex=e=>{let{onClick:t}=e;return(0,i.jsx)(ef.Z,{fitButton:!0,onClick:t,sx:{width:"64px",height:"64px",border:e=>{let{colors:t}=e;return"1px solid ".concat(String(null==t?void 0:t.borders))}},Icon:()=>(0,i.jsx)(s.kC,{sx:{flexDirection:"column",justifyContent:"center",alignItems:"center"},children:(0,i.jsx)(ep.iTs,{size:34,color:"#5263BA","aria-label":"Add a thumbnail"})})})},eg=e=>{let{prefix:t,required:n=!1,display:r}=e,[l,o]=(0,U.U$)(t),a=n?"*":"";return r?(0,i.jsxs)(y.Fragment,{children:[(0,i.jsx)(ev,{name:"".concat(t,".name"),label:"Name".concat(a),placeholder:"main",sx:{mb:3},isConstraint:"config.constraint"===t,meta:o}),(0,i.jsx)(eb,{name:"".concat(t,".width"),label:"Width (px)".concat(a),placeholder:" ",sx:{mb:3}}),(0,i.jsx)(eb,{name:"".concat(t,".height"),label:"Height (px)".concat(a),placeholder:" "})]}):null},ev=e=>{let{name:t,label:n,placeholder:r,meta:l,isConstraint:o,...a}=e,[s]=(0,U.U$)(t);return(0,i.jsx)(eh.Hq,{...a,fieldName:t,meta:l,formField:{label:n,placeholder:r},field:o?{value:"main",readOnly:!0}:{value:s.value},variant:o?"disabled":"primary"})},eb=e=>{let{name:t,label:n,placeholder:r,...l}=e,[o,a]=(0,U.U$)(t);return(0,i.jsx)(eh.Hq,{...l,fieldName:t,formField:{label:n,placeholder:r},meta:a,field:{min:0,type:"number",value:o.value||"",onKeyDown:e=>{("e"===e.key||"-"===e.key||"+"===e.key)&&e.preventDefault()}}})},ey=()=>o.number().nullable().transform((e,t)=>""===t?null:e),ej={label:p.Jp.label,id:p.Jp.id,constraint:{validate:()=>o.object().defined().shape({width:ey(),height:ey()})},thumbnails:{validate:()=>o.array().of(o.object().test({name:"Thumbnails",message:"Must set name and width or height at minimum",test:function(e){if(!e.name)return!1;let t="number"==typeof e.width&&e.width,n="number"==typeof e.height&&e.height;return e.name&&(t||n)}}))}},ek={name:"",width:"",height:""},eS=function(){let{width:e,height:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!n||e||t?e||t?"".concat(e||"auto","x").concat(t||"auto"):"...":"auto"},eC=o.object().shape({type:o.string().matches(/^Image$/,{excludeEmptyString:!0}).required(),config:(0,u.gc)((0,w.B9)(ej,"id"))}),e_={Meta:{icon:l.Fwj},Form:e=>{let{initialValues:t,values:n,errors:r,fields:l,touched:o}=e,[a,p]=(0,y.useState)(0),{config:{thumbnails:h=[],constraint:f}}=n;return(0,y.useEffect)(()=>{p(h.length)},[h.length]),(0,i.jsxs)(d.k,{children:[Object.entries(ej).map(e=>{let[n,r]=e;return(0,i.jsx)(d.J,{children:(0,i.jsx)(c.Z,{fieldName:(0,u.lm)(n),formField:r,fields:l,initialValues:t})},n)}),(0,i.jsxs)(d.J,{children:[(0,i.jsx)(s.__,{htmlFor:"thumbnails",variant:"label.primary",sx:{mt:1,display:"flex",alignItems:"center"},children:"Responsive views*"}),(0,i.jsx)(s.Zb,{p:3,children:(0,i.jsx)(U.F2,{name:"config.thumbnails",render:t=>{let{push:n,remove:l}=t;return(0,i.jsxs)(y.Fragment,{children:[(0,i.jsxs)(s.kC,{mb:3,children:[(0,i.jsx)(em,{active:0===a,text:eS(f,!0),sx:{mr:2},onClick:()=>p(0)}),h.map((e,t)=>(0,i.jsx)(em,{sx:{mr:3},active:a===+t+1,text:eS(e),error:!!r.thumbnails&&!!o.thumbnails&&!!o.thumbnails[t]&&!!r.thumbnails&&!!r.thumbnails[t],onDelete:()=>l(t),onClick:()=>p(+t+1)},"thumbnail-button-".concat(+t+1))),(0,i.jsx)(ex,{onClick:()=>{n(ek)}})]}),(0,i.jsx)(eg,{...e,display:0===a,prefix:"config.constraint"}),h.map((t,n)=>(0,y.createElement)(eg,{...e,required:!0,key:"thumbnail-".concat(+n+1),display:a===+n+1,prefix:"config.thumbnails[".concat(n,"]")}))]})}})})]})]})},schema:eC,create:e=>({type:"Image",config:{label:e,constraint:{},thumbnails:[]}}),FormFields:ej,TYPE_NAME:"Image",label:a.tg.name},eF={...p.Jp},eI={icon:l._b$},eT=Y.shape({select:o.string().required().matches(/^media$/,{excludeEmptyString:!0})}),eE={Meta:eI,FormFields:eF,schema:o.object().shape({type:o.string().matches(/^Link$/,{excludeEmptyString:!0}).required(),config:eT.optional()}),Form:e=>{let{initialValues:t,values:n,fields:r,setFieldValue:l}=e,{config:{allowText:o,variants:a}}=n;return(0,i.jsxs)(J.D,{flexDirection:"column",gap:16,children:[(0,i.jsxs)(d.k,{children:[Object.entries(eF).map(e=>{let[n,l]=e;return(0,i.jsx)(d.J,{children:(0,i.jsx)(c.Z,{fieldName:(0,u.lm)(n),formField:l,fields:r,initialValues:t})},n)}),(0,i.jsx)(Z,{checked:o,setFieldValue:l})]}),(0,i.jsx)(X,{variants:a,setFieldValue:l})]})},create:e=>({type:"Link",config:{label:e,placeholder:"",select:"media",allowText:!0}}),TYPE_NAME:"Link",CUSTOM_NAME:"LinkToMedia",label:a.L0.name},{FormFields:ew,schema:eL}=(0,w.zg)("Number"),eD={create:e=>({type:"Number",config:{label:e,placeholder:""}}),FormFields:ew,TYPE_NAME:"Number",schema:eL,Meta:{icon:l.KZU},label:a.Wc.name};var eM=n(79256);let eO=e=>"use first value as default ".concat(e?'("'.concat(e,'")'):""),eA=(e,t)=>t?e:void 0,eN={...p.Jp,default_value:{type:eM.h.CHECKBOX,yupType:"string",defaultValue:null,validate:function(){return o.string().test({name:"default_value",message:'Default value is not part of field "options" in Select',test:function(e){return void 0===e||this.parent&&this.parent.options&&this.parent.options.find(t=>t===e)}})},component:e=>{var t;let{values:n}=(0,U.u6)(),r=null===(t=n.config)||void 0===t?void 0:t.options[0];return(0,i.jsx)(eh.w8,{...e,defaultValue:e.field.value,controlledValue:r,setControlledValue:e.helpers.setValue,buildControlledValue:eA,label:eO})}},options:{yupType:"array",defaultValue:["1","2"],validate:{required:["Select requires a minimum of 2 options"],min:[2,"Choose at least 2 options"],test:{name:"non-empty values",message:"Values cannot be empty",test:e=>!e.some(e=>!e||!e.length)}},component:e=>(0,i.jsx)(eh.kp,{label:"Options",inputPlaceholder:"Select option output in API (e.g. 'blueTheme')",buttonLabel:"Add option",...e})}},eR={icon:l.nwY},eP=o.object().shape({type:o.string().matches(/^Select$/,{excludeEmptyString:!0}).required(),config:(0,u.gc)((0,w.B9)(eN,"id"))}),eq={FormFields:eN,create:e=>({type:"Select",config:{label:e,placeholder:"",options:["1","2"]}}),schema:eP,Meta:eR,TYPE_NAME:"Select",label:a._M.name};var eV=n(47927),ez=n(29259),eB=n.n(ez),eG=n(85505),eJ=n.n(eG),eU=n(34543);let eZ=e=>t=>{let{size:n}=t;return(0,i.jsx)("span",{style:{fontSize:n},children:e})},eH=[{value:"paragraph",label:"P",icon:eZ("p")},{value:"preformatted",label:"PRE",icon:eZ("pre")},{value:"heading1",label:"H1",icon:eZ("h1")},{value:"heading2",label:"H2",icon:eZ("h2")},{value:"heading3",label:"H3",icon:eZ("h3")},{value:"heading4",label:"H4",icon:eZ("h4")},{value:"heading5",label:"H5",icon:eZ("h5")},{value:"heading6",label:"H6",icon:eZ("h6")},{value:"strong",label:"Strong",icon:eZ((0,i.jsx)("b",{children:"b"}))},{value:"em",label:"em",icon:eZ((0,i.jsx)("em",{style:{fontFamily:"serif"},children:"I"}))},{value:"hyperlink",label:"hyperlink",icon:eZ((0,i.jsx)(eU.eR7,{}))},{value:"image",label:"image",icon:eZ((0,i.jsx)(eU.LFN,{}))},{value:"embed",label:"embed",icon:eZ((0,i.jsx)(eU.xqv,{}))},{value:"list-item",label:"list",icon:eZ((0,i.jsx)(eU.SnF,{}))},{value:"o-list-item",label:"o",icon:eZ((0,i.jsx)(ep.KyO,{}))},{value:"rtl",label:"rtl",icon:eZ("rtl")}],eW=eH.map(e=>e.value),e$=e=>!eW.find(t=>!e.includes(t)),eX=e=>{let t=e.split(",");return eH.reduce((e,n)=>{let{value:i}=n;return t.includes(i)?[...e,i]:e},[])};function eK(e,t){return(0,eV.has)("parent",e)&&eB()(e.parent)&&(0,eV.has)(t,e.parent)&&eJ()(e.parent[t])?e.parent[t]:null}function eY(e){return()=>o.string().test({name:e,message:"Options cannot be empty",test:function(t,n){let i="single"===e?"multi":"single",r=eK(n,e),l=eK(n,i);return!!l&&"string"==typeof l||!("string"!=typeof r||(!r||!r.length)&&(!l||!l.length)||r.split(",").find(e=>!eW.includes(e)))}})}let eQ={...p.Jp,allowTargetBlank:(0,h.Jg)("Allow target blank for links"),single:{validate:eY("single")},multi:{validate:eY("multi")}},e0=["config.single","config.multi"],e1={icon:l.BAW},e2=o.object().shape({type:o.string().matches(/^StructuredText$/,{excludeEmptyString:!0}).required(),config:(0,u.gc)((0,w.B9)({...eQ,labels:{yupType:"array",validate:{}}},"id"))}),e5={create:e=>({type:"StructuredText",config:{label:e,placeholder:"",allowTargetBlank:!0,multi:eW.join(",")}}),FormFields:eQ,Meta:e1,schema:e2,TYPE_NAME:"StructuredText",Form:e=>{var t;let{initialValues:n,values:r,errors:l,fields:o,setFieldValue:a}=e,{config:{single:p,multi:h}}=r,f=p?eX(p):h?eX(h):eW,[m,x]=(0,y.useState)(!p),[g,v]=(0,y.useState)(f);return(0,y.useEffect)(()=>{let e=m?1:0;a(e0[e],g.join(",")),setTimeout(()=>{a(e0[1-e],void 0)},100)},[m,g]),(0,i.jsxs)(d.k,{children:[Object.entries(eQ).map(e=>{let[t,r]=e;return(0,i.jsx)(d.J,{children:(0,i.jsx)(c.Z,{fieldName:(0,u.lm)(t),formField:r,fields:o,initialValues:n})},t)}),(0,i.jsxs)(d.J,{children:[(0,i.jsxs)(s.__,{htmlFor:"accept",variant:"label.primary",sx:{mt:1,display:"flex",alignItems:"center"},children:["Accept*",(0,i.jsx)(s.zx,{type:"button",variant:"buttons.textButton",onClick:()=>{if(e$(g))return v([]);v(eW)},children:e$(g)?"Unselect All":"Select all"})]}),eH.map(e=>(0,i.jsx)(ef.Z,{fitButton:!0,useActive:!0,label:e.label,size:14,Icon:e.icon,sx:{p:"16px",mb:2,mr:2,variant:"buttons.selectIcon"},active:g.includes(e.value),onClick:()=>{if(g.find(t=>t===e.value))return v(g.filter(t=>t!==e.value));v([...g,e.value])}},e.value)),(null===(t=l.config)||void 0===t?void 0:t[m?"multi":"single"])?(0,i.jsx)(s.xu,{sx:{position:"absolute"},children:(0,i.jsx)(s.xv,{as:"span",variant:"text.labelError",pl:0,children:l.config[m?"multi":"single"]})}):null]}),(0,i.jsx)(d.J,{children:(0,i.jsx)(s.kC,{sx:{mt:2,alignItems:"center",height:"100%"},children:(0,i.jsxs)(s.__,{variant:"label.border",children:[(0,i.jsx)(s.XZ,{checked:m,onChange:()=>x(!m)}),"Allow multiple paragraphs"]})})})]})},label:a._n.name};var e6=n(18978);let e9={create:e=>({type:"Table",config:{label:e}}),FormFields:{label:p.Jp.label,id:p.Jp.id},TYPE_NAME:"Table",schema:o.object().shape({type:o.string().matches(/^Table$/,{excludeEmptyString:!0}).required(),config:o.object().shape({label:o.string()}).required().default(void 0).noUnknown(!0)}),Meta:{icon:e6.WHV},label:a.BB.name},e3=p.Jp,e4=o.object().shape({type:o.string().matches(/^Text$/,{excludeEmptyString:!0}).required(),config:(0,u.gc)((0,w.B9)(e3,"id"))}),e8={create:e=>({type:"Text",config:{label:e,placeholder:""}}),Meta:{icon:l.SQS},schema:e4,TYPE_NAME:"Text",FormFields:e3,label:a.$S.name},e7=p.Jp,te={create:e=>({type:"Timestamp",config:{label:e,placeholder:""}}),schema:o.object().shape({type:o.string().matches(/^Timestamp$/,{excludeEmptyString:!0}).required(),config:(0,u.gc)((0,w.B9)(e7,"id"))}),FormFields:e7,TYPE_NAME:"Timestamp",Meta:{icon:l.k71},label:a.UG.name},tt={label:p.Jp.label,id:{...p.Jp.id,validate:{required:"This field is required",matches:[/^uid$/,"Api ID must be 'uid' for this field."]},disabled:!0},placeholder:p.Jp.placeholder},tn=o.object().shape({type:o.string().matches(/^UID$/,{excludeEmptyString:!0}).required(),config:(0,u.gc)((0,w.B9)(tt,"id"))}),ti={Boolean:P,Color:G,ContentRelationship:er,Date:ea,Embed:ec,GeoPoint:eu,Image:e_,Link:Q,LinkToMedia:eE,Number:eD,Select:eq,StructuredText:e5,Table:e9,Text:e8,Timestamp:te,UID:{create:e=>({type:"UID",config:{label:e,placeholder:""}}),Meta:{icon:l.XN7},schema:tn,TYPE_NAME:"UID",FormFields:tt,label:a.Fj.name}},tr=[ti.Image,ti.Text,ti.StructuredText,ti.Link,ti.Select,ti.Boolean,ti.Number,ti.Color,ti.Date,ti.Table,ti.Embed,ti.Timestamp,ti.GeoPoint,ti.ContentRelationship,ti.LinkToMedia],tl="subItem",to=v({schemaTypeRegex:/^NestedGroup$/,customListItem:e=>(0,i.jsx)(A,{Widgets:ti,widgetsArray:tr,hintBase:tl,...e}),customName:"NestedGroup",hintItemName:tl}),ta={...ti,NestedGroup:to},ts=[ta.Image,ta.Text,ta.StructuredText,ta.Link,ta.Select,ta.Boolean,ta.Number,ta.Color,ta.Date,ta.Table,ta.Embed,ta.Timestamp,ta.GeoPoint,ta.ContentRelationship,ta.LinkToMedia,ta.NestedGroup],td="item",tc={Group:v({schemaTypeRegex:/^Group$/,customListItem:e=>{let t=function(){let e=(0,r.L)("slicemachine-nested-groups");return{eligible:(null==e?void 0:e.value)==="on"}}(),n=ts.filter(e=>!!t.eligible||"NestedGroup"!==e.CUSTOM_NAME);return(0,i.jsx)(A,{Widgets:ta,widgetsArray:n,hintBase:td,...e})},hintItemName:td}),NestedGroup:to,...ti}},16086:function(e,t,n){"use strict";n.d(t,{B9:function(){return o},Ss:function(){return s},uS:function(){return a},zg:function(){return d}});var i=n(65413),r=n(68169),l=n(9889);let o=(e,t)=>{let{[t]:n,...i}=e;return i},a=e=>!e.destination||e.source.index===e.destination.index||e.source.droppableId!==e.destination.droppableId,s=(e,t)=>!e[t]&&(console.log('Could not find widget with type name "'.concat(t,'".')),!0),d=e=>({TYPE_NAME:e,FormFields:l.Jp,schema:i.object().shape({type:i.string().test({name:"type",test:function(t){return t===e}}),config:(0,r.gc)(o(l.Jp,"id"))}),create:()=>({type:e,config:(0,r.f7)(o(l.Jp,"id"))})})},5683:function(e,t,n){"use strict";n.d(t,{i:function(){return l},v:function(){return r}});let i=e=>"slice-machine_".concat(e),r=i("staticFieldsInfoDialogDismissed");function l(e){let{type:t,library:n,sliceId:r,variationId:l}=e;return i(["ai-feedback",t,n,r,l].join("#"))}},49919:function(e,t,n){"use strict";function i(e){if(e.startsWith("/slices/"))return"slice";if(e.startsWith("/custom-types/"))return"custom type";if(e.startsWith("/page-types/"))return"page type";throw Error("Did not detect a content type from: ".concat(e))}n.d(t,{T:function(){return i}})},93155:function(e,t,n){"use strict";n.d(t,{F:function(){return r}});var i=n(41347);function r(e){var t,n,r,l,o,a;return{allowText:null===(t=e.config)||void 0===t?void 0:t.allowText,repeat:null===(n=e.config)||void 0===n?void 0:n.repeat,variants:null===(r=e.config)||void 0===r?void 0:r.variants,linkSelect:null===(l=e.config)||void 0===l?void 0:l.select,...(null===(o=e.config)||void 0===o?void 0:o.select)==="document"&&(null===(a=e.config)||void 0===a?void 0:a.customtypes)&&(()=>{var t;let{pickedFields:n,nestedPickedFields:r}=(0,i.WP)((0,i.Vg)({linkCustomtypes:null===(t=e.config)||void 0===t?void 0:t.customtypes}));return{linkPickedFields:n,linkNestedPickedFields:r}})()}}},5495:function(e,t,n){"use strict";n.d(t,{V:function(){return o}});var i=n(94160),r=n(49919),l=n(93155);function o(e){var t,n;let{id:o,field:a,isInAGroup:s=!1}=e;i.Xe.track({event:"field:added",id:o,name:null!==(n=null===(t=a.config)||void 0===t?void 0:t.label)&&void 0!==n?n:"",type:a.type,isInAGroup:s,contentType:(0,r.T)(window.location.pathname),..."Link"===a.type&&(0,l.F)(a)})}},39302:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var i=n(94160),r=n(49919),l=n(93155);function o(e){var t,n;let{id:o,previousId:a=o,field:s,isInAGroup:d=!1}=e;i.Xe.track({event:"field:updated",previousId:a,id:o,idUpdated:a!==o,name:null!==(n=null===(t=s.config)||void 0===t?void 0:t.label)&&void 0!==n?n:"",type:s.type,isInAGroup:d,contentType:(0,r.T)(window.location.pathname),..."Link"===s.type&&(0,l.F)(s)})}},13834:function(e){e.exports={flex:"List_flex__b6acG",row:"List_row__zKnOI List_flex__b6acG",root:"List_root__m_SiQ List_flex__b6acG","root-border":"List_root-border__UW3vp",child:"List_child__MJ49i List_row__zKnOI List_flex__b6acG",header:"List_header__T0WM5 List_child__MJ49i List_row__zKnOI List_flex__b6acG",headerActions:"List_headerActions__mNgLY List_row__zKnOI List_flex__b6acG",item:"List_item__LMBx4 List_child__MJ49i List_row__zKnOI List_flex__b6acG"}},644:function(e){e.exports={root:"ZoneEmptyState_root__DAfG2"}}}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[849],{21985:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/changes",function(){return n(22425)}])},72641:function(e,t,n){"use strict";n.d(t,{R$:function(){return o},Qj:function(){return x},T9:function(){return d},nf:function(){return h},u2:function(){return c},_T:function(){return u}});var i=n(52322),s=n(11699),l=n(6277),r=n(83478),a=n.n(r);let o=e=>{let{backgroundImage:t,style:n,...s}=e,r=void 0!==t;return(0,i.jsx)("article",{...s,className:(0,l.W)(a().root,{[a().withBackground]:r}),style:{backgroundImage:r?"url(".concat(t,")"):void 0,...n}})},c=e=>(0,i.jsx)("div",{...e,className:a().image}),d=e=>(0,i.jsx)("div",{...e,className:a().content}),u=e=>(0,i.jsx)(s.bL,{...e,variant:"h3"}),h=e=>(0,i.jsx)(s.bL,{...e,color:"grey11"}),x=e=>(0,i.jsx)("div",{...e,className:a().actions,color:"grey"})},96317:function(e,t,n){"use strict";n.d(t,{L:function(){return r}});var i=n(18566),s=n(80148);async function l(e){try{return await s.managerClient.telemetry.getExperimentVariant(e)}catch(e){console.error("Error while trying to get experiment value",e);return}}function r(e){return(0,i.QT)(l,[e])}},33986:function(e,t,n){"use strict";n.d(t,{z:function(){return o}});var i=n(52322),s=n(2784),l=n(75289);let r=(e,t)=>e?"".concat(e,"-").concat(t):"",a=e=>{switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},o=(0,s.forwardRef)((e,t)=>{let{label:n,Icon:s,type:o,form:c,isLoading:d=!1,disabled:u=!1,onClick:h,sx:x={},iconSize:m=16,iconFill:g,variant:p="primary",...j}=e;return(0,i.jsx)(l.zx,{ref:t,sx:{...x,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",...d?{cursor:"wait !important"}:{}},type:o,form:c,disabled:u||d,onClick:d?void 0:h,variant:p,...j,children:d?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l.$j,{size:m,color:a(p),"data-testid":r(j["data-testid"],"spinner")}),s&&n]}):(0,i.jsxs)(i.Fragment,{children:[s&&(0,i.jsx)(s,{size:m,fill:g,"data-testid":r(j["data-testid"],"icon")}),n]})})})},21151:function(e,t,n){"use strict";var i=n(52322),s=n(75289);t.Z=function(e){let{elems:t,renderElem:n,defineElementKey:l,gridTemplateMinPx:r="320px",gridGap:a="16px",sx:o}=e;return(0,i.jsx)(s.xu,{as:"section",sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(".concat(r,", 1fr))"),gridGap:a,pt:2,...o},children:t.map((e,t)=>e?(0,i.jsx)("span",{children:n(e,t)},"".concat(l(e),"-").concat(t+1)):null)})}},22425:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return ea}});var i=n(52322),s=n(11699),l=n(97729),r=n.n(l),a=n(5632),o=n(2784),c=n(88932),d=n(65077),u=n(94160),h=n(43388),x=n(72641);function m(e){let{isPostPush:t,documentsListEndpoint:n}=e,l=t?p:g;return(0,i.jsxs)(x.R$,{style:{alignSelf:"center",marginTop:s.t.space[72]},children:[(0,i.jsx)(x.u2,{children:(0,i.jsx)(s.a_,{src:l.img,sizing:"cover"})}),(0,i.jsxs)(x.T9,{children:[(0,i.jsx)(x._T,{children:l.title}),(0,i.jsx)(x.nf,{children:l.description}),t&&(0,i.jsx)(x.Qj,{children:(0,i.jsx)(s.E,{onClick:()=>{u.Xe.track({event:"post-push:empty-state-cta-clicked"}),window.open(n,"_blank")},size:"large",children:"Create content in the Page Builder"})})]})]})}let g={img:"/blank-slate-changes-uptodate.png",title:"Everything is up-to-date",description:"No changes are staged. Saved updates will appear here, ready to be pushed to the Page Builder."},p={img:"/blank-slate-push-success.png",title:"Success! Your changes have been pushed to the Page Builder.",description:"Add content to your website to bring it to life!"},j=(0,o.forwardRef)((e,t)=>(0,i.jsx)(s.E,{...e,ref:t,startIcon:"upload",children:"Push"}));var f=n(98250),v=n(98033),y=n(68968),b=n(13434),k=n(19468),w=n(978),C=n(30613),S=n(58446),_=n(91914),D=n(75289);let T=()=>(0,i.jsx)(D.kC,{sx:{justifyContent:"center",alignItems:"center",flex:1},children:(0,i.jsxs)(D.kC,{sx:{flexDirection:"column",alignItems:"center",transform:"translateY(-50%)"},children:[(0,i.jsx)(_.wQ1,{size:48}),(0,i.jsx)(D.xv,{sx:{fontWeight:600,fontSize:"24px",lineHeight:"32px",mb:"8px",mt:"2px",textAlign:"center"},children:"No internet connection"}),(0,i.jsx)(D.xv,{sx:{fontSize:"13px",lineHeight:"24px",textAlign:"center"},children:"Connect to the internet to sync your changes."})]})});var L=n(54597);let B=()=>{let{openLoginModal:e}=(0,L.Z)();return(0,i.jsxs)(s.D,{flexDirection:"column",height:"100%",alignItems:"center",justifyContent:"center",gap:8,children:[(0,i.jsx)(s.bL,{variant:"h3",align:"center",children:"It seems like you are logged out"}),(0,i.jsx)(s.bL,{align:"center",children:"Log in to connect to your repository."}),(0,i.jsxs)(s.bL,{align:"center",children:["If that doesn't work, it's possible that Slice Machine is having trouble accessing Prismic's servers."," ",(0,i.jsx)(s.bL,{href:"https://community.prismic.io/",children:"Contact our support team"}),"."]}),(0,i.jsx)(s.E,{onClick:()=>e(),children:"Log in to Prismic"})]})};var E=n(951),I=n(63908),O=n(87446),N=n(51507),F=n(21442);let R=e=>{let{children:t}=e;return(0,i.jsx)(D.kC,{sx:{alignItems:"center",justifyContent:"space-between",mt:"8px",bg:"grey02",borderRadius:4,padding:"12px 16px",width:"100%"},children:t})};var z=n(39097),A=n.n(z),P=n(99195),W=n(59294),H=n(16442);let X=e=>{let{ct:t,status:n,authStatus:s,isOnline:l}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(D.xu,{as:"td",style:{width:"40%"},children:(0,i.jsx)(D.xv,{sx:{fontWeight:500},children:t.label})}),(0,i.jsx)(D.xu,{as:"td",style:{width:"40%"},children:t.id}),(0,i.jsx)(D.xu,{as:"td",style:{width:"20%"},children:(0,i.jsx)(P.O,{authStatus:s,isOnline:l,modelStatus:n,modelType:"CustomType"})})]})},Z=e=>{let{customTypes:t,modelsStatuses:n,authStatus:s,isOnline:l}=e;return(0,i.jsxs)(D.xu,{as:"table","data-legacy-component":!0,children:[(0,i.jsx)("thead",{children:(0,i.jsxs)("tr",{className:"transparent small",children:[(0,i.jsx)(D.xu,{as:"th",sx:{width:"40%",fontWeight:600},children:"Name"}),(0,i.jsx)(D.xu,{as:"th",sx:{width:"40%",fontWeight:600},children:"API ID"}),(0,i.jsx)(D.xu,{as:"th",sx:{width:"20%",fontWeight:600},children:"Status"})]})}),(0,i.jsx)("tbody",{children:t.map(e=>(0,H.TG)(e)?(0,i.jsx)(A(),{passHref:!0,href:W.cd[e.local.format].getBuilderPagePathname(e.local.id),legacyBehavior:!0,children:(0,i.jsx)("tr",{tabIndex:0,"data-testid":"custom-type-".concat(e.local.id),children:(0,i.jsx)(X,{ct:e.local,status:n.customTypes[e.local.id],authStatus:s,isOnline:l},e.local.id)})},e.local.id):(0,i.jsx)("tr",{tabIndex:0,className:"disabled","data-testid":"custom-type-".concat(e.remote.id),children:(0,i.jsx)(X,{ct:e.remote,status:n.customTypes[e.remote.id],authStatus:s,isOnline:l},e.remote.id)},e.remote.id))})]})};var G=n(21151),M=n(68105),U=n(56448),Y=n(96317);function Q(){let e=(0,Y.L)("slicemachine-dev-collaboration"),[t,n]=(0,o.useState)(!1),l=null==e?void 0:e.payload;return((0,o.useEffect)(()=>{(null==e?void 0:e.value)==="on"&&void 0!==l&&u.Xe.track({event:"dev-collab:workflow-stub-displayed"})},[e,l]),(null==e?void 0:e.value)!=="on"||void 0===l)?null:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(s.D,{alignItems:"flex-start",border:{bottom:!0,left:!0,right:!0,top:!0},borderRadius:6,borderStyle:"dashed",flexDirection:"column",flexShrink:0,gap:8,padding:16,width:320,children:[(0,i.jsxs)(s.D,{flexDirection:"column",gap:2,children:[(0,i.jsx)(s.bL,{variant:"smallBold",children:l.cardTitle}),(0,i.jsx)(s.bL,{color:"grey11",variant:"small",children:l.cardDescription})]}),(0,i.jsx)(s.E,{color:"grey",onClick:()=>{u.Xe.track({event:"dev-collab:set-up-workflow-opened"}),n(!0)},children:l.cardButtonLabel})]}),(0,i.jsxs)(s.ae,{onOpenChange:e=>{e||n(!1)},open:t,size:{height:"auto",width:448},children:[(0,i.jsx)(s.al,{title:l.dialogTitle}),(0,i.jsx)(s.aj,{children:(0,i.jsxs)(s.D,{flexDirection:"column",children:[(0,i.jsx)(s.D,{flexDirection:"column",padding:16,children:(0,i.jsx)(s.bL,{children:l.dialogDescription})}),(0,i.jsxs)(s.ah,{children:[(0,i.jsx)(s.ai,{size:"medium"}),(0,i.jsx)(s.af,{size:"medium",onClick:()=>{u.Xe.track({event:"dev-collab:join-beta-clicked"}),window.open(l.dialogButtonLink,"_blank"),n(!1)},children:l.dialogButtonLabel})]})]})})]})]})}let J=e=>{let{unSyncedCustomTypes:t,unSyncedSlices:n,modelsStatuses:l,authStatus:r,isOnline:a}=e,{modalPayload:c,onOpenModal:d}=(0,F.H)(),{sliceFilterFn:u,defaultVariationSelector:h}=c,x=n.filter(e=>l.slices[e.model.id]!==U.GJ.Deleted);return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(s.D,{gap:16,alignItems:"flex-start",children:[(0,i.jsxs)(s.D,{flexDirection:"column",flexGrow:1,children:[t.length>0&&(0,i.jsxs)(s.D,{flexDirection:"column",children:[(0,i.jsx)(R,{children:(0,i.jsxs)(s.D,{children:[(0,i.jsx)(s.bL,{variant:"h5",children:"Types"}),(0,i.jsx)(s.bL,{variant:"h5",sx:{marginLeft:8},children:t.length})]})}),(0,i.jsx)(Z,{customTypes:t,modelsStatuses:l,authStatus:r,isOnline:a})]}),n.length>0&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(s.D,{padding:{bottom:8},children:(0,i.jsxs)(R,{children:[(0,i.jsxs)(s.D,{children:[(0,i.jsx)(s.bL,{variant:"h5",children:"Slices"}),(0,i.jsx)(s.bL,{variant:"h5",sx:{marginLeft:8},children:n.length})]}),(0,i.jsxs)(s.D,{children:[n.some(e=>(0,I.cx)(e)>0&&l.slices[e.model.id]!==U.GJ.Deleted)&&(0,i.jsxs)(s.bL,{color:"amber11",sx:{marginRight:8,alignSelf:"center"},children:[(0,i.jsx)(E.sQg,{size:16,style:{marginRight:"4px",position:"relative",top:"3px"}}),"Missing Screenshots"]}),(0,i.jsx)(s.E,{color:"dark",startIcon:"photoCamera",onClick:()=>d({sliceFilterFn:e=>e}),children:"Update all screenshots"})]})]})}),(0,i.jsx)(G.Z,{gridGap:"32px 16px",elems:n,gridTemplateMinPx:"305px",defineElementKey:e=>e.model.name,renderElem:e=>{let t=l.slices[e.model.id];return(0,i.jsx)(N.b,{action:{type:"status",authStatus:r,isOnline:a,modelStatus:t},isDeleted:t===U.GJ.Deleted,mode:"navigation",onUpdateScreenshot:()=>{d({sliceFilterFn:t=>t.filter(t=>t.model.id===e.model.id)})},slice:e,variant:"solid"})}}),(0,i.jsx)(M.Z,{slices:u(x),defaultVariationSelector:h})]})]}),(0,i.jsx)(O.h,{children:(0,i.jsx)(o.Suspense,{children:(0,i.jsx)(Q,{})})})]})})};var V=n(56580),$=n(33986),q=n(79797),K=n(30527);let ee=e=>{let{isOpen:t,title:n,footer:s,explanations:l,onClose:r}=e;return(0,i.jsx)(q.Z,{placement:"right",open:t,level:null,onClose:r,width:496,children:(0,i.jsx)(K.Z,{radius:"0px",bodySx:{bg:"white",padding:24,flex:1,display:"flex",flexDirection:"column",overflow:"scroll"},footerSx:{p:0},sx:{flexDirection:"column",display:"flex",height:"100%",border:"none"},borderFooter:!0,Header:(0,i.jsxs)(D.kC,{sx:{p:"16px",alignItems:"center",justifyContent:"space-between",borderBottom:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))}},children:[(0,i.jsx)(D.kC,{sx:{alignItems:"center"},children:(0,i.jsx)(D.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:n})}),(0,i.jsx)(D.x8,{type:"button",onClick:()=>r()})]}),Footer:()=>(0,i.jsx)(D.kC,{sx:{flexDirection:"column",justifyContent:"center",alignItems:"center",paddingRight:16,borderTop:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.darkBorders))},backgroundColor:"white",padding:20},children:s}),children:l})})};var et=n(78254);n(98564);let en=e=>{let{ctName:t,numberOfDocuments:n,link:s,isOverLimit:l=!1}=e;return(0,i.jsxs)(D.Zb,{sx:{mb:12},variant:"drawerCard","data-testid":"AssociatedDocumentsCard-".concat(t),children:[(0,i.jsxs)(D.kC,{sx:{flexDirection:"column"},children:[(0,i.jsx)(D.xv,{children:t}),(0,i.jsxs)(D.xv,{sx:{color:"textClear",fontSize:"12px",lineHeight:"16px"},children:[n," documents"]})]}),(0,i.jsx)(D.rU,{href:s,target:"_blank",variant:"cardSmall",sx:{color:l?"danger":"purple08"},children:"View documents"})]})},ei=e=>{let{pushChanges:t,modalData:n,onClose:s}=e,{remoteOnlyCustomTypes:l}=(0,V.v9)(e=>({remoteOnlyCustomTypes:(0,et.Ch)(e).filter(H.yp)}));if((null==n?void 0:n.type)!=="HARD")return null;let r=n.details.customTypes.map(e=>{var t;let n=l.find(t=>(0,H.n5)(t)===e.id);return void 0===n?null:(0,i.jsx)(en,{isOverLimit:!0,ctName:null!==(t=n.remote.label)&&void 0!==t?t:n.remote.id,link:e.url,numberOfDocuments:e.numberOfDocuments},e.id)});return(0,i.jsx)(ee,{isOpen:"HARD"===n.type,title:"Manual action required",onClose:s,footer:(0,i.jsx)($.z,{label:"Try again",variant:"primary",onClick:()=>{t(!1)},sx:{fontWeight:"bold",color:"white",borderRadius:6,width:"100%"}}),explanations:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(D.xv,{sx:{fontWeight:"bold",mb:1,lineHeight:"24px"},children:["Your type",n.details.customTypes.length>1&&"s"," cannot be deleted."]}),(0,i.jsxs)(D.xv,{sx:{mb:24},children:[n.details.customTypes.length>1?"These types have":"This type has"," ","too many associated Documents. Archive and delete these Documents manually and then try deleting the types again."]}),r]})})},es=e=>{let{onToggle:t,isConfirmed:n,sx:s}=e;return(0,i.jsxs)(D.kC,{sx:{borderRadius:6,flexDirection:"column",backgroundColor:"grey03",padding:12,width:"100%",...s},children:[(0,i.jsx)(D.xv,{sx:{fontWeight:"bold",mb:2},children:"Are you sure to proceed?"}),(0,i.jsxs)(D.__,{sx:{mt:"4px",py:1},variant:"large",children:[(0,i.jsx)(D.XZ,{defaultChecked:n,onChange:t,variant:"forms.checkbox.dark"}),"Delete these Documents"]})]})},el=e=>{let{pushChanges:t,modalData:n,onClose:s}=e,[l,r]=(0,o.useState)(!1),{remoteOnlyCustomTypes:a}=(0,V.v9)(e=>({remoteOnlyCustomTypes:(0,et.Ch)(e).filter(H.yp)}));if((null==n?void 0:n.type)!=="SOFT")return null;let c=n.details.customTypes.map(e=>{var t;let n=a.find(t=>(0,H.n5)(t)===e.id);return void 0===n?null:(0,i.jsx)(en,{isOverLimit:!0,ctName:null!==(t=n.remote.label)&&void 0!==t?t:n.remote.id,link:e.url,numberOfDocuments:e.numberOfDocuments},e.id)});return(0,i.jsx)(ee,{isOpen:"SOFT"===n.type,title:"Confirm deletion",onClose:s,footer:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(es,{onToggle:()=>{r(!l)},isConfirmed:l,sx:{mb:10}}),(0,i.jsx)($.z,{label:"Push changes",variant:"primary",onClick:()=>{t(l)},disabled:!l,sx:{fontWeight:"bold",color:"white",borderRadius:6,width:"100%"}})]}),explanations:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(D.xv,{sx:{fontWeight:"bold",mb:1,lineHeight:"24px"},children:"This action will also delete Documents."}),(0,i.jsxs)(D.xv,{sx:{mb:24},children:[n.details.customTypes.length>1?"These types have":"This type has"," ","associated Documents, which will also be deleted. This might create broken links in your repository."]}),c]})})};var er=n(93671),ea=()=>{let{unSyncedSlices:e,unSyncedCustomTypes:t,changedCustomTypes:n,changedSlices:l,modelsStatuses:x}=(0,b.X)(),g=(0,w.L)(),p=(0,k.n)(),{pushChangesSuccess:_,refreshState:D}=(0,L.Z)(),[E,I]=(0,o.useState)(!1),[O,N]=(0,o.useState)(void 0),{autoSyncStatus:F}=(0,y.g)(),R=(0,a.useRouter)(),[z,A]=(0,o.useState)(!1),[P,W]=(0,o.useState)(!1),{repositoryUrl:H}=(0,C.U)(),{completeStep:X}=(0,f.k)(),Z=e.length+t.length;(0,o.useEffect)(()=>{("synced"===F||"failed"===F||"syncing"===F)&&R.push("/")},[F,R]);let G=async e=>{try{I(!0),N(void 0);let t=await (0,v.t)({confirmDeleteDocuments:e,changedCustomTypes:n,changedSlices:l});if(void 0!==t)N(t);else{let e=await (0,u.y0)();D(e),_(),A(!0),W(!0),X("reviewAndPush")}}catch(e){console.error("Something went wrong when manually pushing your changes",e),c.Am.error("Something went wrong when pushing your changes. Check your terminal logs.")}I(!1)},M=(0,o.useMemo)(()=>g?p===er.t.UNAUTHENTICATED?(0,i.jsx)(B,{}):0===Z?(0,i.jsx)(m,{isPostPush:z,documentsListEndpoint:H}):(0,i.jsx)(J,{unSyncedSlices:e,unSyncedCustomTypes:t,modelsStatuses:x,authStatus:p,isOnline:g}):(0,i.jsx)(T,{}),[g,p,Z,e,t,x,z,H]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r(),{children:(0,i.jsx)("title",{children:"Changes - Slice Machine"})}),(0,i.jsxs)(S.LN,{children:[(0,i.jsxs)(S.wd,{children:[(0,i.jsx)(S.Cx,{children:(0,i.jsx)(h.g,{children:"Changes"})}),(0,i.jsxs)(S.K2,{children:[(0,i.jsx)(j,{disabled:0===Z||!g||p!==er.t.AUTHENTICATED||E,loading:E,onClick:()=>{G(!1)}}),(0,i.jsx)(s.bQ,{anchor:(0,i.jsx)(s.D,{position:"fixed",top:32,right:32,width:322}),open:P,variant:"card",seconds:20,title:"Success! \uD83C\uDF89",subtitle:"Your changes have been pushed.",action:{title:"Create content in the Page Builder",onClick:()=>{u.Xe.track({event:"post-push:toast-cta-clicked"}),window.open(H,"_blank")}},cancel:{onClick:()=>W(!1)},onOpenChange:W})]})]}),(0,i.jsx)(S.RN,{children:(0,i.jsxs)(d.xR,{sx:{display:"flex",flexDirection:"column"},children:[M,(0,i.jsx)(el,{pushChanges:e=>void G(e),modalData:O,onClose:()=>N(void 0)}),(0,i.jsx)(ei,{pushChanges:e=>void G(e),modalData:O,onClose:()=>N(void 0)})]})})]})]})}},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"}}},function(e){e.O(0,[898,789,123,918,34,658,888,774,179],function(){return e(e.s=21985)}),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[436],{74600:function(e,t,n){var i=n(34311),l=n(23779),o=i(function(e,t,n){return e+(n?" ":"")+l(t)});e.exports=o},26688:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/slices",function(){return n(31562)}])},34166:function(e,t,n){"use strict";n.d(t,{nZ:function(){return d},rT:function(){return x},tB:function(){return u}});var i=n(52322),l=n(11699),o=n(2784),r=n(30195),s=n(94160),a=n(76611),c=n(5683);function d(e){let{type:t,library:n,sliceId:i,variationId:l,langSmithUrl:o}=e,r=(0,c.i)({type:t,library:n,sliceId:i,variationId:l}),s=JSON.stringify({langSmithUrl:o});localStorage.setItem(r,s)}function u(e){let{type:t,library:n,sliceId:i,variationId:l}=e,o=(0,c.i)({type:t,library:n,sliceId:i,variationId:l});localStorage.removeItem(o)}function x(e){let{type:t,library:n,sliceId:d,variationId:u}=e,{key:x,value:m,done:h}=function(e){let{type:t,library:n,sliceId:i,variationId:l}=e,o=(0,c.i)({type:t,library:n,sliceId:i,variationId:l}),[s,d]=(0,a.V)(o,void 0,{schema:r.z.object({langSmithUrl:r.z.string().url().optional()})});return{key:o,value:s,done:()=>d(void 0)}}({type:t,library:n,sliceId:d,variationId:u}),[p,f]=(0,o.useState)(),g=e=>()=>{m&&(f(x),s.Xe.track({event:"slice-generation-feedback",type:t,sliceId:d,variationId:u,feedback:e,langSmithUrl:m.langSmithUrl}),h())};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:!!p,onOpenChange:e=>{e||f(void 0)}},p)}),(0,i.jsx)(l.i,{children:m&&(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")})})]})]})})]})}},76611:function(e,t,n){"use strict";n.d(t,{V:function(){return l}});var i=n(2784);function l(e,t,n){let{schema:l}=null!=n?n:{},o=()=>{try{let n=localStorage.getItem(e);if(null==n)return t;if(!l)return JSON.parse(n);return l.parse(JSON.parse(n))}catch(e){return t}},[r,s]=(0,i.useState)(o),[a,c]=(0,i.useState)(e);return a!==e&&(c(e),s(o())),[r,(0,i.useCallback)(n=>{s(i=>{let l;if(void 0===(l="function"==typeof n?n(i):n)){try{localStorage.removeItem(e)}catch(e){return i}return t}try{localStorage.setItem(e,JSON.stringify(l))}catch(e){return i}return l})},[e,t])]}},33986:function(e,t,n){"use strict";n.d(t,{z:function(){return a}});var i=n(52322),l=n(2784),o=n(75289);let r=(e,t)=>e?"".concat(e,"-").concat(t):"",s=e=>{switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},a=(0,l.forwardRef)((e,t)=>{let{label:n,Icon:l,type:a,form:c,isLoading:d=!1,disabled:u=!1,onClick:x,sx:m={},iconSize:h=16,iconFill:p,variant:f="primary",...g}=e;return(0,i.jsx)(o.zx,{ref:t,sx:{...m,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",...d?{cursor:"wait !important"}:{}},type:a,form:c,disabled:u||d,onClick:d?void 0:x,variant:f,...g,children:d?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.$j,{size:h,color:s(f),"data-testid":r(g["data-testid"],"spinner")}),l&&n]}):(0,i.jsxs)(i.Fragment,{children:[l&&(0,i.jsx)(l,{size:h,fill:p,"data-testid":r(g["data-testid"],"icon")}),n]})})})},46999:function(e,t,n){"use strict";n.d(t,{W:function(){return r}});var i=n(52322),l=n(63397);n(2784);var o=n(75289);let r=e=>{let{name:t,label:n,placeholder:r,error:s,testId:a,onChange:c}=e;return(0,i.jsxs)(o.xu,{mb:3,children:[(0,i.jsx)(o.__,{htmlFor:t,mb:2,children:n}),(0,i.jsx)(l.gN,{name:t,type:"text",placeholder:r,as:o.II,autoComplete:"off",...c?{onChange:c}:null,...a?{"data-testid":a}:null}),s?(0,i.jsx)(o.xv,{"data-testid":a?"".concat(a,"-error"):"input-error",sx:{color:"error",mt:1},children:s}):null]})}},59532:function(e,t,n){"use strict";var i=n(52322),l=n(63397),o=n(37149),r=n.n(o),s=n(75289),a=n(33986),c=n(55862),d=n(30527);function u(e){let{children:t}=e,n=(0,d.W)();return(0,i.jsx)(s.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",pl:4,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:e=>{var t;return"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.borders)}},children:t})}t.Z=function(e){let{children:t,close:n,isOpen:o,formId:x,validate:m,onSubmit:h,widthInPx:p,initialValues:f,content:{title:g},cardProps:j,omitFooter:v=!1,isLoading:y=!1,buttonLabel:b="Save",testId:S,actionMessage:C}=e;return r().setAppElement("#__next"),(0,i.jsx)(c.Z,{isOpen:o,shouldCloseOnOverlayClick:!0,onRequestClose:n,contentLabel:g,style:{content:{width:null!=p?p:"900px"}},children:(0,i.jsx)(l.J9,{initialValues:f,validate:e=>m?m(e):void 0,onSubmit:e=>{h(e)},children:e=>{let{isValid:o,isSubmitting:r,values:c,errors:m,touched:h,setFieldValue:p,setValues:f}=e;return(0,i.jsx)(l.l0,{id:x,...null!=S?{"data-testid":S}:null,children:(0,i.jsx)(d.Z,{borderFooter:!0,footerSx:{p:3,position:"sticky",bottom:0,background:"gray"},bodySx:{px:4,py:4},sx:{border:"none"},...j,Header:(0,i.jsxs)(u,{children:[(0,i.jsx)(s.X6,{sx:{fontSize:"20px"},children:g}),(0,i.jsx)(s.x8,{type:"button",onClick:n})]}),Footer:v?null:(0,i.jsxs)(s.kC,{sx:{alignItems:"space-between"},children:[(0,i.jsx)(s.kC,{sx:{fontSize:"14px",alignItems:"center"},children:"function"==typeof C?C(e):C}),(0,i.jsxs)(s.kC,{sx:{ml:"auto"},children:[(0,i.jsx)(s.zx,{mr:2,type:"button",onClick:n,variant:"secondary",disabled:r||y,children:"Cancel"}),(0,i.jsx)(a.z,{label:b,form:x,type:"submit",disabled:!o||r||y,isLoading:r||y,sx:{fontWeight:"400",paddingBlock:"8px",paddingInline:"16px",fontSize:"14px",borderRadius:"4px"}})]})]}),children:t({isValid:o,isSubmitting:r,values:c,errors:m,touched:h,setFieldValue:p,setValues:f})})})}})})}},31562:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return q}});var i=n(52322),l=n(11699),o=n(97729),r=n.n(o),s=n(5632),a=n(2784),c=n(56580),d=n(88932),u=n(65077),x=n(75289),m=n(43388),h=n(91589),p=n(27213),f=n(51507),g=n(27763),j=n(21442),v=n(58446),y=n(65186),b=n(59326),S=n(34166),C=n(80148);async function k(e){let{sliceName:t,sliceID:n,libraryID:i,sliceVariationIds:l,onSuccess:o}=e;try{let{errors:e}=await C.managerClient.slices.deleteSlice({libraryID:i,sliceID:n});if(e.length>0)throw e;l.forEach(e=>{(0,S.tB)({type:"model",library:i,sliceId:n,variationId:e})}),o(),d.Am.success("Successfully deleted slice “".concat(t,"”"))}catch(n){let e="An unexpected error happened while deleting slice “".concat(t,"”.");console.error(e,n),d.Am.error(e)}}var I=n(68968),w=n(33986),z=n(30527),N=n(55862),D=n(54597);let O=e=>{var t;let{isOpen:n,libName:l,sliceId:o,sliceName:r,sliceVariationIds:s,onClose:c}=e,[d,u]=(0,a.useState)(!1),{deleteSliceSuccess:m}=(0,D.Z)(),{syncChanges:h}=(0,I.g)(),{theme:p}=(0,b.B7)(),f=async()=>{u(!0),await k({libraryID:l,sliceID:o,sliceName:r,sliceVariationIds:s,onSuccess:()=>{m(o,l),h()}}),c(),u(!1)};return(0,i.jsx)(N.Z,{isOpen:n,shouldCloseOnOverlayClick:!0,style:{content:{maxWidth:612}},onRequestClose:c,children:(0,i.jsx)(z.Z,{bodySx:{p:0,bg:"white",position:"relative",height:"100%",padding:16},footerSx:{position:"sticky",bottom:0,p:0},sx:{border:"none"},borderFooter:!0,Header:(0,i.jsxs)(x.kC,{sx:{position:"sticky",background:"gray",top:0,zIndex:1,p:"16px",alignItems:"center",justifyContent:"space-between",borderBottom:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))}},children:[(0,i.jsxs)(x.kC,{sx:{alignItems:"center"},children:[(0,i.jsx)(y.$vK,{size:20,color:null===(t=p.colors)||void 0===t?void 0:t.greyIcon}),(0,i.jsx)(x.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:"Delete Slice"})]}),(0,i.jsx)(x.x8,{type:"button",onClick:c})]}),Footer:()=>(0,i.jsxs)(x.kC,{sx:{justifyContent:"flex-end",height:64,alignItems:"center",paddingRight:16,borderTop:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.darkBorders))},backgroundColor:"gray"},children:[(0,i.jsx)(w.z,{label:"Cancel",variant:"secondary",onClick:c,sx:{mr:"10px",fontWeight:"bold",color:"grey12",borderRadius:6}}),(0,i.jsx)(w.z,{label:"Delete",variant:"danger",isLoading:d,sx:{minHeight:39,minWidth:78},onClick:()=>{f()}})]}),children:(0,i.jsxs)(x.nv,{children:["This action will immediately make the following changes:",(0,i.jsxs)("ul",{children:[(0,i.jsxs)("li",{children:["Delete the"," ",(0,i.jsxs)(x.xv,{sx:{fontWeight:"bold"},children:[l,"/",r,"/"]})," ","directory."]}),(0,i.jsx)("li",{children:"Remove the Slice from all Slice Zones that use it."})]}),"The next time you push your changes to Prismic, the following change will happen:",(0,i.jsx)("ul",{children:(0,i.jsx)("li",{children:"Remove the Slice from the list of available Slices to use in the Page Builder."})}),"You will need to manually remove the Slice from any Pages that currently use it."]})})})};var R=n(36887),W=n(94160),_=e=>{let{title:t,onCreateNew:n,buttonText:l,documentationComponent:o,videoPublicIdUrl:r,...s}=e;return(0,i.jsxs)(x.xu,{sx:{display:"flex",width:"80%",flexWrap:"wrap",justifyContent:"center"},...s,children:[(0,i.jsx)(x.xu,{sx:e=>{var t;return{display:"flex",flex:1,alignItems:"center",minWidth:"400px",maxWidth:"70%",border:"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.grey02)}},children:(0,i.jsx)(R.nk,{cloudName:"dmtf1daqp",controls:!0,loop:!0,style:{maxWidth:"100%",objectFit:"contain"},publicId:r,onPlay:()=>{W.Xe.track({event:"open-video-tutorials",video:r})}})}),(0,i.jsxs)(x.xu,{sx:e=>{var t;return{bg:"white",display:"flex",flexDirection:"column",border:"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.grey02),flex:1,minWidth:"400px",maxWidth:"70%"}},children:[(0,i.jsxs)(x.xu,{sx:e=>{var t;return{display:"flex",flexDirection:"column",p:4,borderBottom:"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.grey02)}},children:[(0,i.jsx)(x.X6,{as:"h3",variant:"heading",sx:{fontSize:"16px",lineHeight:"24px",mb:2},children:t}),(0,i.jsx)(x.xv,{variant:"xs",sx:{lineHeight:"24px",fontSize:"13px"},children:o})]}),(0,i.jsxs)(x.xu,{sx:{display:"flex",p:4,alignItems:"center"},children:[(0,i.jsx)(x.zx,{onClick:n,"data-testid":"empty-state-main-button",sx:{display:"flex",justifyContent:"center",alignItems:"center",flexShrink:0,mr:4},children:l}),(0,i.jsx)(x.xv,{sx:{fontSize:"12px",color:"grey04",maxWidth:"280px"},children:"It will be stored locally and you will be able to push it to your repository"})]})]})]})},Z=n(6256),F=n(63908),L=n(26109);async function P(e){let{slice:t,newSliceName:n,onSuccess:i}=e;try{let e=(0,F.PQ)(t,n),{errors:l}=await C.managerClient.slices.renameSlice({libraryID:t.from,model:L.id.fromSM(e.model)});if(l.length>0)throw l;i(e),d.Am.success("Slice name updated")}catch(n){let e="An unexpected error happened while renaming “".concat(t.model.name,"”.");console.error(e,n),d.Am.error(e)}}var T=n(7723),A=n(59532),B=n(46999),E=n(63019);let X=e=>{var t,n;let{slice:l,isOpen:o,onClose:r}=e,{renameSliceSuccess:s}=(0,D.Z)(),{syncChanges:a}=(0,I.g)(),{localLibs:d,remoteLibs:u}=(0,c.v9)(e=>({localLibs:(0,T.Sd)(e),remoteLibs:(0,T.sT)(e)})),m=null!==(t=null==l?void 0:l.model.name)&&void 0!==t?t:"",h=async e=>{l&&(await P({slice:l,newSliceName:e.sliceName,onSuccess:e=>{s(e.from,e.model),a()}}),r())};return(0,i.jsx)(A.Z,{testId:"rename-slice-modal",isOpen:o,widthInPx:"530px",formId:"rename-slice-modal-".concat(null!==(n=null==l?void 0:l.model.id)&&void 0!==n?n:""),close:r,buttonLabel:"Rename",onSubmit:e=>void h(e),initialValues:{sliceName:m},content:{title:"Rename a slice"},validate:e=>(0,E.h)(e,d,u),children:e=>{let{touched:t,errors:n}=e;return(0,i.jsx)(x.xu,{children:(0,i.jsx)(B.W,{name:"sliceName",label:"Slice Name","data-testid":"slice-name-input",placeholder:"Pascalised Slice API ID (e.g. TextBlock)",error:t.sliceName?n.sliceName:void 0,testId:"slice-name-input"})})}})};var H=n(21151),U=n(68105),V=n(39204),J=n(7974),q=()=>{var e,t,n,o;let y=(0,s.useRouter)(),{modalPayload:b,onOpenModal:S}=(0,j.H)(),{openLoginModal:k}=(0,D.Z)(),I=(0,p.F)({menuType:"Dropdown"}),{sliceFilterFn:w,defaultVariationSelector:z}=b,{remoteSlices:N,libraries:R}=(0,c.v9)(e=>({remoteSlices:(0,T.sT)(e),libraries:(0,T.Sd)(e)})),[W,F]=(0,a.useState)(!1),[L,P]=(0,a.useState)(!1),[A,B]=(0,a.useState)(!1),[E,q]=(0,a.useState)(!1),M=R.filter(e=>e.isLocal),Q=R.map(e=>(e.components=[...e.components].sort((e,t)=>e.model.name.localeCompare(t.model.name)),e)),Y=(R||[]).map(e=>e.components).flat(),G=Y.length,[K,$]=(0,a.useState)(),ee=()=>{P(!0)},et=()=>{B(!0)},en=async()=>{await C.managerClient.user.checkIsLoggedIn()?q(!0):k()},ei=()=>{q(!1)};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r(),{children:(0,i.jsx)("title",{children:"Slices - Slice Machine"})}),(0,i.jsxs)(v.LN,{children:[(0,i.jsxs)(v.wd,{children:[(0,i.jsx)(v.Cx,{children:(0,i.jsx)(m.g,{children:"Slices"})}),(null==M?void 0:M.length)!==0&&0!==G?(0,i.jsxs)(l.ar,{children:[(0,i.jsx)(l.av,{children:(0,i.jsx)(l.E,{color:"purple",startIcon:"add","data-testid":"add-new-slice-dropdown",children:"Add"})}),(0,i.jsxs)(l.as,{align:"end",children:[(0,i.jsx)(l.at,{renderStartIcon:()=>I.fromImage.BackgroundIcon,onSelect:()=>void en(),description:I.fromImage.description,children:I.fromImage.title}),(0,i.jsx)(l.at,{renderStartIcon:()=>I.fromScratch.BackgroundIcon,onSelect:()=>F(!0),description:I.fromScratch.description,children:I.fromScratch.title})]})]}):void 0]}),(0,i.jsxs)(v.RN,{children:[(0,i.jsx)(u.xR,{sx:{display:"flex",flexDirection:"column"},children:Q.length>0?(0,i.jsx)(x.kC,{sx:{flex:1,flexDirection:"column"},children:0===G?(0,i.jsx)(x.kC,{sx:{flex:1,justifyContent:"center",alignItems:"center"},children:(0,i.jsx)(_,{title:"What are slices?",onCreateNew:()=>{F(!0)},buttonText:"Create one",videoPublicIdUrl:J.rd,documentationComponent:(0,i.jsxs)(i.Fragment,{children:['Slices are sections of your website. Prismic documents contain a dynamic "Slice Zone" that allows content creators to add, edit, and rearrange slices to compose dynamic layouts for any page design.'," ",(0,i.jsx)(x.rU,{target:"_blank",href:"https://prismic.io/docs/core-concepts/slices",sx:e=>{var t;return{color:null==e?void 0:null===(t=e.colors)||void 0===t?void 0:t.primary}},children:"Learn more"}),"."]}),"data-testid":"slices-table-blank-slate"})}):Q.map(e=>{let{name:t,isLocal:n,components:l}=e;return(0,i.jsxs)(x.kC,{sx:{flexDirection:"column","&:not(:last-of-type)":{mb:4}},children:[(0,i.jsxs)(x.kC,{sx:{alignItems:"center",justifyContent:"space-between"},children:[(0,i.jsx)(x.kC,{sx:{alignItems:"center",fontSize:3,lineHeight:"48px",fontWeight:"heading",mb:1},children:(0,i.jsx)(x.xv,{children:1===Q.length?"Your slices":t})}),!n&&(0,i.jsx)("p",{children:"⚠️ External libraries are read-only"})]}),(0,i.jsx)(H.Z,{elems:l,defineElementKey:e=>e.model.name,renderElem:e=>(0,i.jsx)(f.b,{action:{type:"menu",onRemove:()=>{$(e),ee()},onRename:()=>{$(e),et()}},mode:"navigation",onUpdateScreenshot:()=>{S({sliceFilterFn:t=>t.filter(t=>t.model.id===e.model.id)})},slice:e,variant:"solid"}),gridGap:"32px 16px"})]},t)})}):void 0}),(null==M?void 0:M.length)>0&&(0,i.jsx)(U.Z,{slices:w(Y),defaultVariationSelector:z}),(null==M?void 0:M.length)>0&&W&&(0,i.jsx)(Z.c,{localLibraries:M,location:"slices",remoteSlices:N,onSuccess:(e,t)=>{let n=e.variations[0].id,i=g.Y.getBuilderPagePathname({libraryName:t,sliceName:e.name,variationId:n});y.push(i),d.Am.success((0,V.kQ)({path:"".concat(t,"/").concat(e.name,"/model.json")}))},onClose:()=>{F(!1)}}),(0,i.jsx)(X,{isOpen:A,slice:K,onClose:()=>{B(!1)},"data-testid":"rename-slice-modal"}),(0,i.jsx)(O,{isOpen:L,libName:null!==(e=null==K?void 0:K.from)&&void 0!==e?e:"",sliceId:null!==(t=null==K?void 0:K.model.id)&&void 0!==t?t:"",sliceName:null!==(n=null==K?void 0:K.model.name)&&void 0!==n?n:"",sliceVariationIds:(null!==(o=null==K?void 0:K.model.variations)&&void 0!==o?o:[]).map(e=>e.id),onClose:()=>{P(!1)}}),(0,i.jsx)(h.S,{open:E,location:"slices",onSuccess:e=>{let{library:t}=e;d.Am.success((0,i.jsx)(V.GX,{message:"Slice(s) added to slice zone and created at: ",path:t})),ei()},onClose:ei})]})]})]})}},5683:function(e,t,n){"use strict";n.d(t,{i:function(){return o},v:function(){return l}});let i=e=>"slice-machine_".concat(e),l=i("staticFieldsInfoDialogDismissed");function o(e){let{type:t,library:n,sliceId:l,variationId:o}=e;return i(["ai-feedback",t,n,l,o].join("#"))}}},function(e){e.O(0,[898,789,797,397,344,500,34,658,907,888,774,179],function(){return e(e.s=26688)}),_N_E=e.O()}]);