slice-machine-ui 1.26.1-beta.12 → 1.26.1-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/404.html +1 -1
- package/out/_next/static/chunks/127-5f39b7de8178c2e4.js +1 -0
- package/out/_next/static/chunks/453-4e2d00a3515202f4.js +1 -0
- package/out/_next/static/chunks/46-bd45510ac2a839b5.js +10 -0
- package/out/_next/static/chunks/{91-1c3665ce38e58792.js → 91-aa2369249805fb5a.js} +1 -1
- package/out/_next/static/chunks/96-24fed6adc069e313.js +1 -0
- package/out/_next/static/chunks/pages/{_app-01bcd29a595cec3a.js → _app-2e45ed74db68cb0a.js} +2 -2
- package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-8bcc4d88f470d3f7.js → [customTypeId]-5b08515fec5e6668.js} +1 -1
- package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-8461ab4fcfaf0755.js → [pageTypeId]-41fc6d4f726fdfb9.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-8c8d4de562fca8ac.js +1 -0
- package/out/_next/static/{svF8JPCb25QlsmymuzIiN → umd9mjV29cCbZplewdOPw}/_buildManifest.js +1 -1
- package/out/changelog.html +1 -1
- package/out/changes.html +1 -1
- package/out/custom-types/[customTypeId].html +1 -1
- package/out/custom-types.html +1 -1
- package/out/index.html +1 -1
- package/out/labs.html +1 -1
- package/out/page-types/[pageTypeId].html +1 -1
- package/out/settings.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
- package/out/slices.html +1 -1
- package/package.json +6 -6
- package/src/domain/__tests__/customType.test.ts +0 -184
- package/src/domain/__tests__/group.test.ts +161 -0
- package/src/domain/customType.ts +0 -191
- package/src/domain/group.ts +89 -0
- package/src/domain/slice.ts +24 -11
- package/src/legacy/lib/builders/CustomTypeBuilder/TabZone/index.tsx +4 -7
- package/src/legacy/lib/builders/SliceBuilder/FieldZones/index.tsx +27 -35
- package/src/legacy/lib/builders/common/Zone/Card/index.jsx +3 -0
- package/src/legacy/lib/builders/common/Zone/index.jsx +4 -7
- package/src/legacy/lib/models/common/Slice.ts +17 -3
- package/src/legacy/lib/models/common/widgets/Group/ListItem/index.jsx +51 -60
- package/src/legacy/lib/models/common/widgets/groupBuilderArray.ts +18 -0
- package/src/legacy/lib/models/common/widgets/sliceBuilderArray.ts +16 -28
- package/src/legacy/lib/models/common/widgets/withGroup.ts +1 -18
- package/src/utils/getContentTypeForTracking.ts +21 -0
- package/out/_next/static/chunks/207-f71df53ed0b0ac4d.js +0 -1
- package/out/_next/static/chunks/453-1a14e86de385fe7c.js +0 -1
- package/out/_next/static/chunks/46-d22d7a121254e31d.js +0 -8
- package/out/_next/static/chunks/96-33e38032f1e55366.js +0 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-217d0b0469d4320e.js +0 -1
- /package/out/_next/static/{svF8JPCb25QlsmymuzIiN → umd9mjV29cCbZplewdOPw}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[91],{840:function(e,n,r){"use strict";r.d(n,{F:function(){return A}});var t=r(52322),s=r(22715),a=r(97729),i=r.n(a),c=r(2784),l=r(41730),o=r(8564),d=r(78656),u=r(90898),h=r(24448),f=r(5632),x=r(2754),p=r(67557),m=r(50002),j=r(6277);r(64117);var g=function(e){var n=e.children;return(0,t.jsx)("div",{className:"_1ecs97dez0 _1ecs97dez5 _1ecs97d3fg _1ecs97d3mt _1ecs97df0r _1ecs97df23 _1ecs97df2h _1ecs97dezr",children:(0,t.jsx)("table",{className:"gdfsm51 _1ecs97dez0 _1ecs97dez5 _1ecs97df3p _1ecs97df4v",children:n})})},C=(0,c.createContext)("body");function v(){return(0,c.useContext)(C)}var b=function(e){var n=e.children;return(0,t.jsx)(C.Provider,{value:"head",children:(0,t.jsx)("thead",{className:"gdfsm52 _1ecs97dez0 _1ecs97dez5 _1ecs97d18 _1ecs97d8l",children:n})})},_=function(e){var n=e.children;return(0,t.jsx)(C.Provider,{value:"body",children:(0,t.jsx)("tbody",{className:"gdfsm53 _1ecs97dez0 _1ecs97dez5",children:n})})},y=function(e){var n,r=e.children,s=e.onClick,a=v();return(0,t.jsx)("tr",{className:(0,j.W)("_1ecs97dez0 _1ecs97dez5 _1ecs97df71",(n={},(0,p.Z)(n,"_1ecs97df41",!!s),(0,p.Z)(n,"_1ecs97dm _1ecs97d7z _1ecs97d3c _1ecs97dap _1ecs97d2w _1ecs97da9 _1ecs97df74 _1ecs97dfj8 _1ecs97df0d _1ecs97dfjb","body"===a),n)),onClick:function(e){var n,r=e.target;if(s&&e.currentTarget.contains(r)){var t=(0,m.JY)(r);(null===(n=null==t?void 0:t.contains(e.currentTarget))||void 0===n||n)&&s(e)}},children:r})},S=function(e){var n=e.children,r=v();return(0,t.jsx)("head"===r?"th":"td",{className:"gdfsm55 _1ecs97dez0 _1ecs97dez5 _1ecs97d3fg _1ecs97d3mt _1ecs97df2h _1ecs97dez1 _1ecs97da62 _1ecs97dadf _1ecs97df45 _1ecs97dfhi",children:(0,t.jsx)("div",{className:"gdfsm56 _1ecs97dez0 _1ecs97dez2",children:n})})},w=function(){return(0,t.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("path",{d:"M8 28H24C25.1046 28 26 27.1046 26 26V9L21 4H8C6.89543 4 6 4.89543 6 6V26C6 27.1046 6.89543 28 8 28Z",fill:"#6E56CF"}),(0,t.jsx)("path",{d:"M23 9H26L21 4V7C21 8.10457 21.8954 9 23 9Z",fill:"#9E8CFC"}),(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.0912 12C13.2794 12 11 14.2794 11 17.0912C11 19.903 13.2794 22.1824 16.0912 22.1824C17.9763 22.1824 19.6215 21.1577 20.501 19.6372C20.6563 19.3688 20.7878 19.0849 20.8926 18.7883C20.9846 18.5279 20.8482 18.2422 20.5878 18.1502C20.3275 18.0582 20.0418 18.1947 19.9498 18.455C19.8657 18.693 19.7601 18.9209 19.6354 19.1365C18.9273 20.3606 17.6049 21.1824 16.0912 21.1824C13.8317 21.1824 12 19.3507 12 17.0912C12 14.8317 13.8317 13 16.0912 13C17.4478 13 18.6507 13.66 19.3955 14.6782H17.6216C17.3455 14.6782 17.1216 14.9021 17.1216 15.1782C17.1216 15.4544 17.3455 15.6782 17.6216 15.6782H20.2998C20.576 15.6782 20.7998 15.4544 20.7998 15.1782V12.5C20.7998 12.2239 20.576 12 20.2998 12C20.0237 12 19.7998 12.2239 19.7998 12.5V13.6032C18.8717 12.6167 17.5536 12 16.0912 12Z",fill:"white"})]})},L=function(){return(0,t.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("path",{d:"M8 28H24C25.1046 28 26 27.1046 26 26V9L21 4H8C6.89543 4 6 4.89543 6 6V26C6 27.1046 6.89543 28 8 28Z",fill:"#6E56CF"}),(0,t.jsx)("path",{d:"M23 9H26L21 4V7C21 8.10457 21.8954 9 23 9Z",fill:"#9E8CFC"}),(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.0869 14.6818L14.6627 12.3787C14.7183 12.1561 14.9183 12 15.1477 12C15.473 12 15.7117 12.3057 15.6328 12.6213L15.1177 14.6818H17.7232L18.299 12.3787C18.3547 12.1561 18.5547 12 18.7841 12C19.1094 12 19.3481 12.3057 19.2692 12.6213L18.754 14.6818H21C21.2761 14.6818 21.5 14.9057 21.5 15.1818C21.5 15.458 21.2761 15.6818 21 15.6818H18.504L17.8449 18.3182H20C20.2761 18.3182 20.5 18.542 20.5 18.8182C20.5 19.0943 20.2761 19.3182 20 19.3182H17.5949L17.0192 21.6213C16.9635 21.8439 16.7635 22 16.5341 22C16.2088 22 15.9701 21.6943 16.049 21.3787L16.5642 19.3182H13.9586L13.3828 21.6213C13.3272 21.8439 13.1272 22 12.8977 22C12.5724 22 12.3338 21.6943 12.4127 21.3787L12.9278 19.3182H11C10.7239 19.3182 10.5 19.0943 10.5 18.8182C10.5 18.542 10.7239 18.3182 11 18.3182H13.1778L13.8369 15.6818H12C11.7239 15.6818 11.5 15.458 11.5 15.1818C11.5 14.9057 11.7239 14.6818 12 14.6818H14.0869ZM16.8142 18.3182L17.4732 15.6818H14.8677L14.2086 18.3182H16.8142Z",fill:"white"})]})},Z=r(67445),k=r(54845),T=r(22710),z=r(99267),H=r(17329),I=r(56580),R=r(74026),N=r(52312),V=r(81038),M=r(28849);function E(e){return F.apply(this,arguments)}function F(){return(F=(0,T.Z)(function(e){var n,r,t;return(0,z.__generator)(this,function(s){switch(s.label){case 0:return[4,V.j.customTypes.readAllCustomTypes({format:e})];case 1:if(r=(n=s.sent()).errors,t=n.models,r.length>0)throw r;return[2,t.map(function(e){return e.model})]}})})).apply(this,arguments)}var P=function(e){var n,r,a,i,l,o,u=e.format,h=e.isCreatingCustomType,p=e.openCreateCustomTypeModal,m=(0,f.useRouter)(),j=(r=(0,c.useCallback)(function(e){return(0,H.VA)(E,[u],e)},[u]),{customTypes:(0,H.QT)(E,[u]),updateCustomTypes:r}),C=j.customTypes,v=j.updateCustomTypes,T=C.sort(function(e,n){return e.id.localeCompare(n.id)}),z=Z.cd[u],V=d.$[u];return(o=(0,I.v9)(function(e){return{storeCustomTypes:(0,M.Ch)(e).filter(N.TG)}}).storeCustomTypes,(0,c.useEffect)(function(){var e=o.filter(function(e){return e.local.format===u});(e.length!==C.length||e.some(function(e){var n=C.find(function(n){return n.id===e.local.id});return!n||JSON.stringify(R.Dc.fromSM(e.local))!==JSON.stringify(n)}))&&v(e.map(function(e){var n=e.local;return R.Dc.fromSM(n)}))},[u,v,C,o]),0===T.length)?(0,t.jsxs)(x.R$,{"data-testid":"blank-slate",style:{alignSelf:"center",marginTop:s.TV.size[72]},children:[(0,t.jsx)(x.u2,{children:(0,t.jsx)(s.Ee,{src:z.blankSlateImage,sizing:"cover"})}),(0,t.jsxs)(x.T9,{children:[(0,t.jsx)(x._T,{children:V.name({start:!0,plural:!0})}),(0,t.jsx)(x.nf,{children:V.blankSlateDescription}),(0,t.jsx)(x.Qj,{children:(0,t.jsx)(s.zx,{onClick:p,loading:h,children:"Create"})})]})]}):(0,t.jsxs)(g,{children:[(0,t.jsx)(b,{children:(0,t.jsxs)(y,{children:[(0,t.jsx)(S,{children:(0,t.jsx)(s.I5,{name:"notes",size:"medium"})}),(0,t.jsx)(S,{children:"Label"}),(0,t.jsx)(S,{children:"API ID"}),(0,t.jsx)(S,{children:"Limit"}),(0,t.jsx)(S,{})]})}),(0,t.jsx)(_,{children:T.map(function(e){var n=e.repeatable,r=e.label,s=e.id;return(0,t.jsxs)(y,{onClick:function(){m.push(Z.cd[u].getBuilderPagePathname(s))},children:[(0,t.jsx)(S,{children:n?(0,t.jsx)(w,{}):(0,t.jsx)(L,{})}),(0,t.jsx)(S,{children:r}),(0,t.jsx)(S,{children:s}),(0,t.jsx)(S,{children:n?"Reusable":"Single"}),(0,t.jsx)(S,{children:(0,t.jsx)(k._,{isChangesLocal:!1,format:u,customType:e})})]},s)})})]})},A=function(e){var n=e.format,r=d.$[n],a=(0,c.useState)(!1),f=a[0],x=a[1],p=(0,c.useState)(!1),m=p[0],j=p[1];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i(),{children:(0,t.jsxs)("title",{children:[r.name({start:!0,plural:!0})," - Slice Machine"]})}),(0,t.jsx)(o.S,{renderError:function(){return(0,t.jsx)(u.LN,{children:(0,t.jsx)(u.RN,{children:(0,t.jsx)(s.xu,{alignItems:"center",justifyContent:"center",children:(0,t.jsx)(s.Iq,{title:"Request failed",description:"An error occurred while fetching your ".concat(r.name({start:!1,plural:!0}),".")})})})})},children:(0,t.jsx)(c.Suspense,{fallback:(0,t.jsxs)(u.LN,{children:[(0,t.jsxs)(u.wd,{children:[(0,t.jsx)(u.Cx,{children:(0,t.jsx)(l.g,{children:r.name({start:!0,plural:!0})})}),(0,t.jsx)(u.K2,{children:(0,t.jsx)(s.zx,{disabled:!0,startIcon:"add",children:"Create"})})]}),(0,t.jsx)(u.RN,{children:(0,t.jsx)(s._3,{})})]}),children:(0,t.jsxs)(u.LN,{children:[(0,t.jsxs)(u.wd,{children:[(0,t.jsx)(u.Cx,{children:(0,t.jsx)(l.g,{children:r.name({start:!0,plural:!0})})}),(0,t.jsx)(u.K2,{children:(0,t.jsx)(s.zx,{"data-testid":"create-ct",loading:f,onClick:function(){j(!0)},startIcon:"add",children:"Create"})})]}),(0,t.jsx)(u.RN,{children:(0,t.jsxs)(s.xu,{flexDirection:"column",children:[(0,t.jsx)(P,{format:n,isCreatingCustomType:f,openCreateCustomTypeModal:function(){j(!0)}}),(0,t.jsx)(h.M,{format:n,isCreating:f,isOpen:m,onCreateChange:x,onOpenChange:j})]})})]})})})]})}},98898:function(e,n,r){"use strict";r.d(n,{Z:function(){return o}});var t=r(62230),s=r(85244),a=r(98240),i=r(52322);r(2784);var c=r(75289),l=function(e){var n=e.bg,r=e.background,s=e.sx,a=e.withRadius,l=e.radius,o=e.children;return(0,i.jsx)(c.xu,{sx:(0,t.Z)({p:4,bg:n||r},a?{borderBottomLeftRadius:l,borderBottomRightRadius:l}:null,s),children:o})},o=function(e){var n=e.Header,r=void 0===n?null:n,o=e.SubHeader,d=void 0===o?null:o,u=e.Body,h=void 0===u?null:u,f=e.Footer,x=void 0===f?null:f,p=e.borderFooter,m=e.radius,j=void 0===m?"6px":m,g=e.bodySx,C=e.footerSx,v=e.sx,b=e.bg,_=e.background,y=e.children,S=(0,a.Z)(e,["Header","SubHeader","Body","Footer","borderFooter","radius","bodySx","footerSx","sx","bg","background","children"]);return(0,i.jsxs)(c.Zb,(0,s.Z)((0,t.Z)({sx:(0,t.Z)({border:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))},borderRadius:j},void 0===v?null:v)},S),{children:[r?(0,i.jsx)(r,{radius:j}):null,d?(0,i.jsx)(d,{radius:j}):null,(0,i.jsxs)(l,{bg:b,background:_,sx:void 0===g?{}:g,withRadius:!x,children:[h?(0,i.jsx)(h,{}):null,y||null]}),x?(0,i.jsx)(l,{bg:b,background:_,sx:(0,t.Z)({},void 0!==p&&p?{borderTop:function(e){var n=e.colors;return"1px solid ".concat(String(null==n?void 0:n.borders))}}:null,void 0===C?{}:C),radius:j,withRadius:!0,children:"object"==typeof x?x:(0,i.jsx)(x,{})}):null]}))}},24448:function(e,n,r){"use strict";r.d(n,{M:function(){return H}});var t=r(22710),s=r(62230),a=r(85244),i=r(99267),c=r(52322),l=r(5632),o=r(2784),d=r(56580),u=r(75289),h=r(91061),f=r(88932),x=r(82770),p=r(6777),m=r(78656);function j(){return(j=(0,t.Z)(function(e){var n,r,t,s,a,c,l,o,d,u;return(0,i.__generator)(this,function(i){switch(i.label){case 0:n=e.id,r=e.label,t=e.repeatable,s=e.format,a=e.onSuccess,c=m.$[s],l=(0,h.Ue)({id:n,label:r,repeatable:t,format:s}),i.label=1;case 1:return i.trys.push([1,4,,5]),[4,(0,x.KA)(l)];case 2:if((o=i.sent().errors).length>0)throw o;return x.Xe.track({event:"custom-type:created",id:l.id,name:r,format:s,type:t?"repeatable":"single",origin:"table"}),[4,a(l)];case 3:return i.sent(),f.Am.success((0,p.GX)({message:"".concat(c.name({start:!0,plural:!1})," saved successfully at "),path:"./customtypes/".concat(l.id,"/index.json")})),[3,5];case 4:return d=i.sent(),u="Internal Error: ".concat(c.name({start:!0,plural:!1})," not saved"),console.error(u,d),f.Am.error(u),[3,5];case 5:return[2]}})})).apply(this,arguments)}var g=r(67445),C=r(50950),v=r(6134),b=r(63094),_=r(17384),y=r(28849),S=r(90374),w=r(36960),L=r(17064),Z=r(63397),k=r(98240),T=function(e){var n=e.selected,r=(0,k.Z)(e,["selected"]);return(0,c.jsx)(u.kC,(0,s.Z)({sx:{p:"24px",mb:3,alignItems:"top",cursor:"pointer",borderRadius:"6px",backgroundColor:"grayLight",boxShadow:n?function(e){var n;return"0 0 0 2px ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.primary))}:"none","&:hover":{boxShadow:function(e){var n;return"0 0 0 2px ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.primary))}}}},r))},z=function(e){var n=e.format,r=(0,L.Z)((0,Z.U$)("repeatable"),3),t=r[0],s=r[2],a=m.$[n];return(0,c.jsxs)(u.xu,{mb:2,children:[(0,c.jsxs)(T,{selected:t.value,onClick:function(){return s.setValue(!0)},children:[(0,c.jsx)(u.Y8,{checked:t.value,onChange:function(){},"data-testid":"repeatable-type-radio-btn"}),(0,c.jsxs)(u.xu,{sx:{marginLeft:2},children:["Reusable type",(0,c.jsx)(u.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:a.hintRepeatable})]})]}),(0,c.jsxs)(T,{selected:!t.value,onClick:function(){return s.setValue(!1)},children:[(0,c.jsx)(u.Y8,{checked:!t.value,onChange:function(){},"data-testid":"single-type-radio-btn"}),(0,c.jsxs)(u.xu,{sx:{marginLeft:2},children:["Single type",(0,c.jsx)(u.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:a.hintSingle})]})]})]})},H=function(e){var n,r=e.format,f=e.isCreating,x=e.isOpen,p=e.origin,L=void 0===p?"table":p,Z=e.onCreateChange,k=e.onOpenChange,T=(0,S.Z)().createCustomTypeSuccess,H=(0,d.v9)(function(e){return{customTypeIds:(0,y.W6)(e),customTypeLabels:(0,y.YS)(e)}}),I=H.customTypeIds,R=H.customTypeLabels,N=m.$[r],V=(0,o.useState)(!0),M=V[0],E=V[1],F=(0,C.g)().syncChanges,P=(0,l.useRouter)(),A=(n=(0,t.Z)(function(e){var n,s,a;return(0,i.__generator)(this,function(c){switch(c.label){case 0:var l;return n=e.id,s=e.label,a=e.repeatable,Z(!0),[4,function(e){return j.apply(this,arguments)}({format:r,id:n,label:s,origin:L,repeatable:a,onSuccess:(l=(0,t.Z)(function(e){var r,t;return(0,i.__generator)(this,function(s){switch(s.label){case 0:return T(e),r=(0,h.y6)(e),t=g.cd[r],E(!0),[4,P.push({pathname:t.getBuilderPagePathname(n),query:"page"===e.format?{newPageType:!0}:void 0})];case 1:return s.sent(),F(),[2]}})}),function(e){return l.apply(this,arguments)})})];case 1:return c.sent(),Z(!1),k(!1),[2]}})}),function(e){return n.apply(this,arguments)}),D=function(e,n,r){r(M?(0,a.Z)((0,s.Z)({},n),{label:e.target.value,id:(0,_.lV)(e.target.value)}):(0,a.Z)((0,s.Z)({},n),{label:e.target.value}))},O=function(e,n){n("id",e.target.value),E(!1)};return(0,c.jsx)(v.Z,{testId:"create-ct-modal",isOpen:x,widthInPx:"530px",formId:"create-custom-type",buttonLabel:"Create",close:function(){k(!1),E(!0)},onSubmit:function(e){A(e)},isLoading:f,initialValues:{repeatable:!0,id:"",label:""},validate:function(e){var n=e.id,r=e.label,t={};return r&&r.length||(t.label="Cannot be empty."),!t.label&&R.includes(r)&&(t.label="".concat(N.name({start:!0,plural:!1})," name is already taken.")),n&&n.length||(t.id="ID cannot be empty."),t.id||!n||b.xo.exec(n)||(t.id="Invalid id: No special characters allowed."),!t.id&&n&&I.map(function(e){return e.toLowerCase()}).includes(n)&&(t.id='ID "'.concat(n,'" exists already.')),Object.keys(t).length>0?t:void 0},content:{title:"Create a new ".concat(N.name({start:!1,plural:!1}))},children:function(e){var n=e.errors,t=e.setValues,s=e.setFieldValue,a=e.values,i=e.touched;return(0,c.jsxs)(u.xu,{children:[(0,c.jsx)(z,{format:r}),(0,c.jsx)(w.W,{name:"label",label:"".concat(N.name({start:!0,plural:!1})," Name"),testId:"ct-name-input",placeholder:"A display name for the ".concat(N.name({start:!1,plural:!1})),error:i.label?n.label:void 0,onChange:function(e){return D(e,a,t)}}),(0,c.jsx)(w.W,{name:"id",testId:"ct-id-input",label:"".concat(N.name({start:!0,plural:!1})," ID"),placeholder:N.inputPlaceholder,error:i.id?n.id:void 0,onChange:function(e){return O(e,s)}})]})}})}},63094:function(e,n,r){"use strict";r.d(n,{Sn:function(){return c},lS:function(){return t},nG:function(){return s},pq:function(){return l},rd:function(){return i},xo:function(){return a}});var t=["components"],s=["png","jpg","jpeg"],a=/^[A-Za-z0-9]+(?:_[A-Za-z0-9]+)*$/,i="placeholders/What_are_Slices_mrvome",c="SM_HELP_VIDEOS/mock_data",l="slice-machine-simulator"},64117:function(){}}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[91],{840:function(e,n,r){"use strict";r.d(n,{F:function(){return A}});var t=r(52322),s=r(22715),a=r(97729),i=r.n(a),c=r(2784),l=r(41730),o=r(8564),d=r(78656),u=r(90898),h=r(24448),f=r(5632),x=r(2754),p=r(67557),m=r(50002),j=r(6277);r(64117);var g=function(e){var n=e.children;return(0,t.jsx)("div",{className:"_1ecs97dez0 _1ecs97dez5 _1ecs97d3fg _1ecs97d3mt _1ecs97df0r _1ecs97df23 _1ecs97df2h _1ecs97dezr",children:(0,t.jsx)("table",{className:"gdfsm51 _1ecs97dez0 _1ecs97dez5 _1ecs97df3p _1ecs97df4v",children:n})})},C=(0,c.createContext)("body");function v(){return(0,c.useContext)(C)}var b=function(e){var n=e.children;return(0,t.jsx)(C.Provider,{value:"head",children:(0,t.jsx)("thead",{className:"gdfsm52 _1ecs97dez0 _1ecs97dez5 _1ecs97d18 _1ecs97d8l",children:n})})},_=function(e){var n=e.children;return(0,t.jsx)(C.Provider,{value:"body",children:(0,t.jsx)("tbody",{className:"gdfsm53 _1ecs97dez0 _1ecs97dez5",children:n})})},y=function(e){var n,r=e.children,s=e.onClick,a=v();return(0,t.jsx)("tr",{className:(0,j.W)("_1ecs97dez0 _1ecs97dez5 _1ecs97df71",(n={},(0,p.Z)(n,"_1ecs97df41",!!s),(0,p.Z)(n,"_1ecs97dm _1ecs97d7z _1ecs97d3c _1ecs97dap _1ecs97d2w _1ecs97da9 _1ecs97df74 _1ecs97dfj8 _1ecs97df0d _1ecs97dfjb","body"===a),n)),onClick:function(e){var n,r=e.target;if(s&&e.currentTarget.contains(r)){var t=(0,m.JY)(r);(null===(n=null==t?void 0:t.contains(e.currentTarget))||void 0===n||n)&&s(e)}},children:r})},S=function(e){var n=e.children,r=v();return(0,t.jsx)("head"===r?"th":"td",{className:"gdfsm55 _1ecs97dez0 _1ecs97dez5 _1ecs97d3fg _1ecs97d3mt _1ecs97df2h _1ecs97dez1 _1ecs97da62 _1ecs97dadf _1ecs97df45 _1ecs97dfhi",children:(0,t.jsx)("div",{className:"gdfsm56 _1ecs97dez0 _1ecs97dez2",children:n})})},w=function(){return(0,t.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("path",{d:"M8 28H24C25.1046 28 26 27.1046 26 26V9L21 4H8C6.89543 4 6 4.89543 6 6V26C6 27.1046 6.89543 28 8 28Z",fill:"#6E56CF"}),(0,t.jsx)("path",{d:"M23 9H26L21 4V7C21 8.10457 21.8954 9 23 9Z",fill:"#9E8CFC"}),(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.0912 12C13.2794 12 11 14.2794 11 17.0912C11 19.903 13.2794 22.1824 16.0912 22.1824C17.9763 22.1824 19.6215 21.1577 20.501 19.6372C20.6563 19.3688 20.7878 19.0849 20.8926 18.7883C20.9846 18.5279 20.8482 18.2422 20.5878 18.1502C20.3275 18.0582 20.0418 18.1947 19.9498 18.455C19.8657 18.693 19.7601 18.9209 19.6354 19.1365C18.9273 20.3606 17.6049 21.1824 16.0912 21.1824C13.8317 21.1824 12 19.3507 12 17.0912C12 14.8317 13.8317 13 16.0912 13C17.4478 13 18.6507 13.66 19.3955 14.6782H17.6216C17.3455 14.6782 17.1216 14.9021 17.1216 15.1782C17.1216 15.4544 17.3455 15.6782 17.6216 15.6782H20.2998C20.576 15.6782 20.7998 15.4544 20.7998 15.1782V12.5C20.7998 12.2239 20.576 12 20.2998 12C20.0237 12 19.7998 12.2239 19.7998 12.5V13.6032C18.8717 12.6167 17.5536 12 16.0912 12Z",fill:"white"})]})},L=function(){return(0,t.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("path",{d:"M8 28H24C25.1046 28 26 27.1046 26 26V9L21 4H8C6.89543 4 6 4.89543 6 6V26C6 27.1046 6.89543 28 8 28Z",fill:"#6E56CF"}),(0,t.jsx)("path",{d:"M23 9H26L21 4V7C21 8.10457 21.8954 9 23 9Z",fill:"#9E8CFC"}),(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.0869 14.6818L14.6627 12.3787C14.7183 12.1561 14.9183 12 15.1477 12C15.473 12 15.7117 12.3057 15.6328 12.6213L15.1177 14.6818H17.7232L18.299 12.3787C18.3547 12.1561 18.5547 12 18.7841 12C19.1094 12 19.3481 12.3057 19.2692 12.6213L18.754 14.6818H21C21.2761 14.6818 21.5 14.9057 21.5 15.1818C21.5 15.458 21.2761 15.6818 21 15.6818H18.504L17.8449 18.3182H20C20.2761 18.3182 20.5 18.542 20.5 18.8182C20.5 19.0943 20.2761 19.3182 20 19.3182H17.5949L17.0192 21.6213C16.9635 21.8439 16.7635 22 16.5341 22C16.2088 22 15.9701 21.6943 16.049 21.3787L16.5642 19.3182H13.9586L13.3828 21.6213C13.3272 21.8439 13.1272 22 12.8977 22C12.5724 22 12.3338 21.6943 12.4127 21.3787L12.9278 19.3182H11C10.7239 19.3182 10.5 19.0943 10.5 18.8182C10.5 18.542 10.7239 18.3182 11 18.3182H13.1778L13.8369 15.6818H12C11.7239 15.6818 11.5 15.458 11.5 15.1818C11.5 14.9057 11.7239 14.6818 12 14.6818H14.0869ZM16.8142 18.3182L17.4732 15.6818H14.8677L14.2086 18.3182H16.8142Z",fill:"white"})]})},Z=r(67445),k=r(54845),T=r(22710),z=r(99267),H=r(17329),I=r(56580),R=r(15354),N=r(52312),V=r(81038),M=r(28849);function E(e){return F.apply(this,arguments)}function F(){return(F=(0,T.Z)(function(e){var n,r,t;return(0,z.__generator)(this,function(s){switch(s.label){case 0:return[4,V.j.customTypes.readAllCustomTypes({format:e})];case 1:if(r=(n=s.sent()).errors,t=n.models,r.length>0)throw r;return[2,t.map(function(e){return e.model})]}})})).apply(this,arguments)}var P=function(e){var n,r,a,i,l,o,u=e.format,h=e.isCreatingCustomType,p=e.openCreateCustomTypeModal,m=(0,f.useRouter)(),j=(r=(0,c.useCallback)(function(e){return(0,H.VA)(E,[u],e)},[u]),{customTypes:(0,H.QT)(E,[u]),updateCustomTypes:r}),C=j.customTypes,v=j.updateCustomTypes,T=C.sort(function(e,n){return e.id.localeCompare(n.id)}),z=Z.cd[u],V=d.$[u];return(o=(0,I.v9)(function(e){return{storeCustomTypes:(0,M.Ch)(e).filter(N.TG)}}).storeCustomTypes,(0,c.useEffect)(function(){var e=o.filter(function(e){return e.local.format===u});(e.length!==C.length||e.some(function(e){var n=C.find(function(n){return n.id===e.local.id});return!n||JSON.stringify(R.Dc.fromSM(e.local))!==JSON.stringify(n)}))&&v(e.map(function(e){var n=e.local;return R.Dc.fromSM(n)}))},[u,v,C,o]),0===T.length)?(0,t.jsxs)(x.R$,{"data-testid":"blank-slate",style:{alignSelf:"center",marginTop:s.TV.size[72]},children:[(0,t.jsx)(x.u2,{children:(0,t.jsx)(s.Ee,{src:z.blankSlateImage,sizing:"cover"})}),(0,t.jsxs)(x.T9,{children:[(0,t.jsx)(x._T,{children:V.name({start:!0,plural:!0})}),(0,t.jsx)(x.nf,{children:V.blankSlateDescription}),(0,t.jsx)(x.Qj,{children:(0,t.jsx)(s.zx,{onClick:p,loading:h,children:"Create"})})]})]}):(0,t.jsxs)(g,{children:[(0,t.jsx)(b,{children:(0,t.jsxs)(y,{children:[(0,t.jsx)(S,{children:(0,t.jsx)(s.I5,{name:"notes",size:"medium"})}),(0,t.jsx)(S,{children:"Label"}),(0,t.jsx)(S,{children:"API ID"}),(0,t.jsx)(S,{children:"Limit"}),(0,t.jsx)(S,{})]})}),(0,t.jsx)(_,{children:T.map(function(e){var n=e.repeatable,r=e.label,s=e.id;return(0,t.jsxs)(y,{onClick:function(){m.push(Z.cd[u].getBuilderPagePathname(s))},children:[(0,t.jsx)(S,{children:n?(0,t.jsx)(w,{}):(0,t.jsx)(L,{})}),(0,t.jsx)(S,{children:r}),(0,t.jsx)(S,{children:s}),(0,t.jsx)(S,{children:n?"Reusable":"Single"}),(0,t.jsx)(S,{children:(0,t.jsx)(k._,{isChangesLocal:!1,format:u,customType:e})})]},s)})})]})},A=function(e){var n=e.format,r=d.$[n],a=(0,c.useState)(!1),f=a[0],x=a[1],p=(0,c.useState)(!1),m=p[0],j=p[1];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i(),{children:(0,t.jsxs)("title",{children:[r.name({start:!0,plural:!0})," - Slice Machine"]})}),(0,t.jsx)(o.S,{renderError:function(){return(0,t.jsx)(u.LN,{children:(0,t.jsx)(u.RN,{children:(0,t.jsx)(s.xu,{alignItems:"center",justifyContent:"center",children:(0,t.jsx)(s.Iq,{title:"Request failed",description:"An error occurred while fetching your ".concat(r.name({start:!1,plural:!0}),".")})})})})},children:(0,t.jsx)(c.Suspense,{fallback:(0,t.jsxs)(u.LN,{children:[(0,t.jsxs)(u.wd,{children:[(0,t.jsx)(u.Cx,{children:(0,t.jsx)(l.g,{children:r.name({start:!0,plural:!0})})}),(0,t.jsx)(u.K2,{children:(0,t.jsx)(s.zx,{disabled:!0,startIcon:"add",children:"Create"})})]}),(0,t.jsx)(u.RN,{children:(0,t.jsx)(s._3,{})})]}),children:(0,t.jsxs)(u.LN,{children:[(0,t.jsxs)(u.wd,{children:[(0,t.jsx)(u.Cx,{children:(0,t.jsx)(l.g,{children:r.name({start:!0,plural:!0})})}),(0,t.jsx)(u.K2,{children:(0,t.jsx)(s.zx,{"data-testid":"create-ct",loading:f,onClick:function(){j(!0)},startIcon:"add",children:"Create"})})]}),(0,t.jsx)(u.RN,{children:(0,t.jsxs)(s.xu,{flexDirection:"column",children:[(0,t.jsx)(P,{format:n,isCreatingCustomType:f,openCreateCustomTypeModal:function(){j(!0)}}),(0,t.jsx)(h.M,{format:n,isCreating:f,isOpen:m,onCreateChange:x,onOpenChange:j})]})})]})})})]})}},98898:function(e,n,r){"use strict";r.d(n,{Z:function(){return o}});var t=r(62230),s=r(85244),a=r(98240),i=r(52322);r(2784);var c=r(75289),l=function(e){var n=e.bg,r=e.background,s=e.sx,a=e.withRadius,l=e.radius,o=e.children;return(0,i.jsx)(c.xu,{sx:(0,t.Z)({p:4,bg:n||r},a?{borderBottomLeftRadius:l,borderBottomRightRadius:l}:null,s),children:o})},o=function(e){var n=e.Header,r=void 0===n?null:n,o=e.SubHeader,d=void 0===o?null:o,u=e.Body,h=void 0===u?null:u,f=e.Footer,x=void 0===f?null:f,p=e.borderFooter,m=e.radius,j=void 0===m?"6px":m,g=e.bodySx,C=e.footerSx,v=e.sx,b=e.bg,_=e.background,y=e.children,S=(0,a.Z)(e,["Header","SubHeader","Body","Footer","borderFooter","radius","bodySx","footerSx","sx","bg","background","children"]);return(0,i.jsxs)(c.Zb,(0,s.Z)((0,t.Z)({sx:(0,t.Z)({border:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))},borderRadius:j},void 0===v?null:v)},S),{children:[r?(0,i.jsx)(r,{radius:j}):null,d?(0,i.jsx)(d,{radius:j}):null,(0,i.jsxs)(l,{bg:b,background:_,sx:void 0===g?{}:g,withRadius:!x,children:[h?(0,i.jsx)(h,{}):null,y||null]}),x?(0,i.jsx)(l,{bg:b,background:_,sx:(0,t.Z)({},void 0!==p&&p?{borderTop:function(e){var n=e.colors;return"1px solid ".concat(String(null==n?void 0:n.borders))}}:null,void 0===C?{}:C),radius:j,withRadius:!0,children:"object"==typeof x?x:(0,i.jsx)(x,{})}):null]}))}},24448:function(e,n,r){"use strict";r.d(n,{M:function(){return H}});var t=r(22710),s=r(62230),a=r(85244),i=r(99267),c=r(52322),l=r(5632),o=r(2784),d=r(56580),u=r(75289),h=r(91061),f=r(88932),x=r(82770),p=r(6777),m=r(78656);function j(){return(j=(0,t.Z)(function(e){var n,r,t,s,a,c,l,o,d,u;return(0,i.__generator)(this,function(i){switch(i.label){case 0:n=e.id,r=e.label,t=e.repeatable,s=e.format,a=e.onSuccess,c=m.$[s],l=(0,h.Ue)({id:n,label:r,repeatable:t,format:s}),i.label=1;case 1:return i.trys.push([1,4,,5]),[4,(0,x.KA)(l)];case 2:if((o=i.sent().errors).length>0)throw o;return x.Xe.track({event:"custom-type:created",id:l.id,name:r,format:s,type:t?"repeatable":"single",origin:"table"}),[4,a(l)];case 3:return i.sent(),f.Am.success((0,p.GX)({message:"".concat(c.name({start:!0,plural:!1})," saved successfully at "),path:"./customtypes/".concat(l.id,"/index.json")})),[3,5];case 4:return d=i.sent(),u="Internal Error: ".concat(c.name({start:!0,plural:!1})," not saved"),console.error(u,d),f.Am.error(u),[3,5];case 5:return[2]}})})).apply(this,arguments)}var g=r(67445),C=r(50950),v=r(6134),b=r(63094),_=r(17384),y=r(28849),S=r(90374),w=r(36960),L=r(17064),Z=r(63397),k=r(98240),T=function(e){var n=e.selected,r=(0,k.Z)(e,["selected"]);return(0,c.jsx)(u.kC,(0,s.Z)({sx:{p:"24px",mb:3,alignItems:"top",cursor:"pointer",borderRadius:"6px",backgroundColor:"grayLight",boxShadow:n?function(e){var n;return"0 0 0 2px ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.primary))}:"none","&:hover":{boxShadow:function(e){var n;return"0 0 0 2px ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.primary))}}}},r))},z=function(e){var n=e.format,r=(0,L.Z)((0,Z.U$)("repeatable"),3),t=r[0],s=r[2],a=m.$[n];return(0,c.jsxs)(u.xu,{mb:2,children:[(0,c.jsxs)(T,{selected:t.value,onClick:function(){return s.setValue(!0)},children:[(0,c.jsx)(u.Y8,{checked:t.value,onChange:function(){},"data-testid":"repeatable-type-radio-btn"}),(0,c.jsxs)(u.xu,{sx:{marginLeft:2},children:["Reusable type",(0,c.jsx)(u.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:a.hintRepeatable})]})]}),(0,c.jsxs)(T,{selected:!t.value,onClick:function(){return s.setValue(!1)},children:[(0,c.jsx)(u.Y8,{checked:!t.value,onChange:function(){},"data-testid":"single-type-radio-btn"}),(0,c.jsxs)(u.xu,{sx:{marginLeft:2},children:["Single type",(0,c.jsx)(u.xu,{as:"p",sx:{fontSize:"12px",color:"textClear",mt:1},children:a.hintSingle})]})]})]})},H=function(e){var n,r=e.format,f=e.isCreating,x=e.isOpen,p=e.origin,L=void 0===p?"table":p,Z=e.onCreateChange,k=e.onOpenChange,T=(0,S.Z)().createCustomTypeSuccess,H=(0,d.v9)(function(e){return{customTypeIds:(0,y.W6)(e),customTypeLabels:(0,y.YS)(e)}}),I=H.customTypeIds,R=H.customTypeLabels,N=m.$[r],V=(0,o.useState)(!0),M=V[0],E=V[1],F=(0,C.g)().syncChanges,P=(0,l.useRouter)(),A=(n=(0,t.Z)(function(e){var n,s,a;return(0,i.__generator)(this,function(c){switch(c.label){case 0:var l;return n=e.id,s=e.label,a=e.repeatable,Z(!0),[4,function(e){return j.apply(this,arguments)}({format:r,id:n,label:s,origin:L,repeatable:a,onSuccess:(l=(0,t.Z)(function(e){var r,t;return(0,i.__generator)(this,function(s){switch(s.label){case 0:return T(e),r=(0,h.y6)(e),t=g.cd[r],E(!0),[4,P.push({pathname:t.getBuilderPagePathname(n),query:"page"===e.format?{newPageType:!0}:void 0})];case 1:return s.sent(),F(),[2]}})}),function(e){return l.apply(this,arguments)})})];case 1:return c.sent(),Z(!1),k(!1),[2]}})}),function(e){return n.apply(this,arguments)}),D=function(e,n,r){r(M?(0,a.Z)((0,s.Z)({},n),{label:e.target.value,id:(0,_.lV)(e.target.value)}):(0,a.Z)((0,s.Z)({},n),{label:e.target.value}))},O=function(e,n){n("id",e.target.value),E(!1)};return(0,c.jsx)(v.Z,{testId:"create-ct-modal",isOpen:x,widthInPx:"530px",formId:"create-custom-type",buttonLabel:"Create",close:function(){k(!1),E(!0)},onSubmit:function(e){A(e)},isLoading:f,initialValues:{repeatable:!0,id:"",label:""},validate:function(e){var n=e.id,r=e.label,t={};return r&&r.length||(t.label="Cannot be empty."),!t.label&&R.includes(r)&&(t.label="".concat(N.name({start:!0,plural:!1})," name is already taken.")),n&&n.length||(t.id="ID cannot be empty."),t.id||!n||b.xo.exec(n)||(t.id="Invalid id: No special characters allowed."),!t.id&&n&&I.map(function(e){return e.toLowerCase()}).includes(n)&&(t.id='ID "'.concat(n,'" exists already.')),Object.keys(t).length>0?t:void 0},content:{title:"Create a new ".concat(N.name({start:!1,plural:!1}))},children:function(e){var n=e.errors,t=e.setValues,s=e.setFieldValue,a=e.values,i=e.touched;return(0,c.jsxs)(u.xu,{children:[(0,c.jsx)(z,{format:r}),(0,c.jsx)(w.W,{name:"label",label:"".concat(N.name({start:!0,plural:!1})," Name"),testId:"ct-name-input",placeholder:"A display name for the ".concat(N.name({start:!1,plural:!1})),error:i.label?n.label:void 0,onChange:function(e){return D(e,a,t)}}),(0,c.jsx)(w.W,{name:"id",testId:"ct-id-input",label:"".concat(N.name({start:!0,plural:!1})," ID"),placeholder:N.inputPlaceholder,error:i.id?n.id:void 0,onChange:function(e){return O(e,s)}})]})}})}},63094:function(e,n,r){"use strict";r.d(n,{Sn:function(){return c},lS:function(){return t},nG:function(){return s},pq:function(){return l},rd:function(){return i},xo:function(){return a}});var t=["components"],s=["png","jpg","jpeg"],a=/^[A-Za-z0-9]+(?:_[A-Za-z0-9]+)*$/,i="placeholders/What_are_Slices_mrvome",c="SM_HELP_VIDEOS/mock_data",l="slice-machine-simulator"},64117:function(){}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[96],{28173:function(e,n,t){"use strict";t.d(n,{aV:function(){return s},Bu:function(){return c}});var i=t(62230),r=t(85244),o=t(98240),l=t(52322),a=t(22715);t(82432),t(84779);var s=function(e){return(0,l.jsx)("div",(0,r.Z)((0,i.Z)({},e),{className:"_2a96i71 _1ecs97dez0 _1ecs97dez2 _1ecs97d3fg _1ecs97d3mt _1ecs97df0r _1ecs97df23 _1ecs97df2h _1ecs97dezb _1ecs97dezr"}))},c=function(e){var n=e.actions,t=e.children,s=e.toggle,c=(0,o.Z)(e,["actions","children","toggle"]);return(0,l.jsxs)("div",(0,r.Z)((0,i.Z)({},c),{className:"_2a96i73 _2a96i72 _1ecs97dez0 _1ecs97dez2 _1ecs97dezc _1ecs97dez8 _1ecs97d6r8 _1ecs97d6yl _1ecs97df2l _1ecs97dez1 _1ecs97df71 _1ecs97dfie _1ecs97d18 _1ecs97d8l _1ecs97df29 _1ecs97df92 _1ecs97dfi1",children:[(0,l.jsx)(a.xv,{color:"grey11",component:"span",noWrap:!0,variant:"bold",children:t}),s,Boolean(n)?(0,l.jsx)("div",{className:"_1ecs97dez0 _1ecs97dez2 _1ecs97dezc _1ecs97dez8 _1ecs97dezd _1ecs97df92 _1ecs97dezj _1ecs97df51",children:n}):null]}))}},47976:function(e,n,t){"use strict";t.d(n,{X:function(){return o}});var i=t(52322),r=t(22715),o=function(e){var n,t=e.status;switch(t){case"pending":n={icon:(0,i.jsx)(r._3,{color:"grey11"}),text:"Saving..."};break;case"failed":n={icon:(0,i.jsx)(r.I5,{name:"close",color:"tomato11",size:"medium"}),text:"Failed to save"};break;case"done":n={icon:(0,i.jsx)(r.I5,{name:"check",color:"green11",size:"medium"}),text:"Auto-saved"}}return(0,i.jsxs)(r.xu,{gap:8,alignItems:"center",children:[n.icon,(0,i.jsx)(r.xv,{color:"grey11",children:n.text})]})}},57899:function(e,n,t){"use strict";t.d(n,{Z:function(){return d}});var i=t(62230),r=t(52322),o=t(61183);t(2784);var l=t(59326),a=t(75289),s=function(e){return{subLanguage:"xml",contains:[e.COMMENT("<!--","-->",{relevance:10}),{begin:/^(\s*)(<script(\s*context="module")?>)/gm,end:/^(\s*)(<\/script>)/gm,subLanguage:"javascript",excludeBegin:!0,excludeEnd:!0,contains:[{begin:/^(\s*)(\$:)/gm,end:/(\s*)/gm,className:"keyword"},]},{begin:/^(\s*)(<style.*>)/gm,end:/^(\s*)(<\/style>)/gm,subLanguage:"css",excludeBegin:!0,excludeEnd:!0},{begin:/\{/gm,end:/\}/gm,subLanguage:"javascript",contains:[{begin:/[\{]/,end:/[\}]/,skip:!0},{begin:/([#:\/@])(if|else|each|await|then|catch|debug|html)/gm,className:"keyword",relevance:10},]},]}};o.Z.registerLanguage("svelte",s);var c=["javascript","bash","xml","html","json"],d=function(e){var n,t=e.children,s=e.lang,d=e.sx,u=e.codeStyle,f=e.codeClass,p=e.Header,x=(0,l.B7)().theme,m=s?o.Z.highlight(t,{language:"vue"===s?"html":s}).value:o.Z.highlightAuto(t,c).value;return(0,r.jsxs)(a.kC,{as:"pre",sx:d,children:[p?(0,r.jsx)(p,{}):null,(0,r.jsx)("code",{className:"hljs".concat(f?" ".concat(f):""),style:(0,i.Z)({overflowX:"auto",padding:"3px 5px",borderRadius:"6px",border:"1px solid",borderColor:String(null===(n=x.colors)||void 0===n?void 0:n.textClear)},u),dangerouslySetInnerHTML:{__html:m}})]})}},74757:function(e,n,t){"use strict";t.d(n,{J:function(){return c},k:function(){return s}});var i=t(62230),r=t(85244),o=t(98240),l=t(52322);t(2784);var a=t(75289),s=function(e){var n=e.children,t=e.sx,s=(0,o.Z)(e,["children","sx"]);return(0,l.jsx)(a.xu,(0,r.Z)((0,i.Z)({sx:(0,i.Z)({display:["block","block","flex"],flexWrap:"wrap",justifyContent:"space-between"},t)},s),{children:n}))},c=function(e){var n=e.children,t=e.cols;return(0,l.jsx)(a.xu,{sx:{flex:"0 ".concat(100/(void 0===t?2:t)-1,"%"),mb:1},children:n})}},46577:function(e,n,t){"use strict";t.d(n,{$w:function(){return i},Hq:function(){return u},tM:function(){return d}});var i,r=t(62230),o=t(85244),l=t(52322),a=t(63397);t(2784);var s,c=t(75289);(s=i||(i={}))[s.ERROR=0]="ERROR",s[s.DISABLED=1]="DISABLED",s[s.WARNING=2]="WARNING";var d=function(e){var n={"&::placeholder":{color:"#C9D0D8"}};switch(e){case i.DISABLED:return(0,o.Z)((0,r.Z)({},n),{border:"1px solid #E6E6EA",backgroundColor:"#F3F5F7"});case i.ERROR:return(0,o.Z)((0,r.Z)({},n),{border:"1px solid #E26049","&:focus":{outline:"none",borderColor:"#E26049",boxShadow:"0 0 0 3px rgba(226, 96, 73, 0.2), inset 0 1px 2px rgba(226, 96, 73, 0.2)"}});case i.WARNING:return(0,o.Z)((0,r.Z)({},n),{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 n}},u=function(e){var n=e.sx,t=e.field,s=e.meta,u=e.formField,f=e.fieldName,p=e.fields,x=e.initialValues,m=e.isDisabled,h=s.error?i.ERROR:m||u.disabled?i.DISABLED:void 0;return(0,l.jsxs)(c.xu,{sx:void 0===n?{}:n,children:[(0,l.jsxs)(c.__,{variant:"label.primary",htmlFor:f,children:[u.label||f,s.touched&&s.error?(0,l.jsx)(c.xv,{as:"span",variant:"text.labelError",children:s.error}):null]}),(0,l.jsx)(a.gN,(0,o.Z)((0,r.Z)({id:f,name:f,type:"text",placeholder:u.placeholder||u.label||f},u.fieldLevelValidation&&x?{validate:function(e){return u.fieldLevelValidation&&u.fieldLevelValidation({value:e,fields:p,initialId:x.id})}}:null,t),{as:c.II,sx:d(h),disabled:m||u.disabled}))]})}},3402:function(e,n,t){"use strict";t.d(n,{kp:function(){return c},sP:function(){return u},w8:function(){return f},Hq:function(){return p.Hq}});var i=t(62230),r=t(85244),o=t(52322),l=t(63397),a=t(2784),s=t(75289),c=function(e){var n=e.field,t=e.meta,c=e.fieldName,d=e.label,u=e.focusOnNewEntry,f=void 0===u||u,p=e.inputPlaceholder,x=e.buttonLabel,m=(0,a.useState)(t.value.length),h=m[0],g=m[1],v=(0,a.useRef)(Array(t.value.length));return(0,a.useEffect)(function(){v.current=v.current.slice(0,t.value.length)},[t.value.length]),(0,a.useEffect)(function(){var e=v.current.length;f&&e>h&&v.current[e-1].focus(),g(e)},[v.current.length,f,h]),(0,o.jsxs)(a.Fragment,{children:[(0,o.jsxs)(s.__,{variant:"label.primary",htmlFor:c,children:[d,t.touched&&t.error?(0,o.jsx)(s.xv,{as:"span",variant:"text.labelError",children:t.error}):null]}),(0,o.jsx)(l.F2,(0,r.Z)((0,i.Z)({name:c,id:c},n),{render:function(e){return(0,o.jsxs)("div",{children:[n.value&&n.value.length>0?n.value.map(function(n,t){return(0,o.jsxs)(s.kC,{my:2,children:[(0,o.jsx)(s.II,{placeholder:p,name:"".concat(c,".").concat(t),value:n,ref:function(e){return v.current[t]=e},onChange:function(n){var i=n.target.value;return e.replace(t,i)}}),(0,o.jsx)(s.zx,{ml:2,type:"button",variant:"secondary",onClick:function(){return e.remove(t)},children:"-"})]},"".concat(c,"-").concat(+t+1))}):null,(0,o.jsx)(s.zx,{type:"button",onClick:function(){return e.insert(n.value.length,"")},children:x})]})}}))]})},d=t(98240),u=function(e){e.initialValues;var n=e.meta,t=e.label,a=e.fieldName,c=e.onChange,u=(0,d.Z)(e,["initialValues","meta","label","fieldName","onChange"]);return(0,o.jsxs)(s.__,(0,r.Z)((0,i.Z)({variant:"label.border"},u),{children:[(0,o.jsx)(l.gN,{as:s.XZ,type:"checkbox",name:a,onChange:function(){return c(!n.value)},checked:n.value}),t]}))},f=function(e){var n=e.field,t=e.label,i=e.defaultValue,r=e.onChange,l=e.controlledValue,s=e.setControlledValue,c=e.buildControlledValue,d=(0,a.useState)(i||n.defaultValue||!1),f=d[0],p=d[1];return(0,a.useEffect)(function(){c?s(c(l,f)):s(c)},[f,l,c]),(0,o.jsx)(u,{meta:{value:f},fieldName:n.name,onChange:function(e){return p(e)&&r&&r(e)},label:"function"==typeof t?t(l,f):t})},p=t(46577)},12374:function(e,n,t){"use strict";var i=t(62230),r=t(85244),o=t(98240),l=t(52322),a=t(2784),s=t(75289),c=(0,a.forwardRef)(function(e,n){var t=e.children,a=e.Component,c=void 0===a?s.kC:a,d=e.sx,u=(0,o.Z)(e,["children","Component","sx"]);return(0,l.jsx)(c,(0,r.Z)((0,i.Z)({as:"li",sx:(0,i.Z)({p:3,mx:3,alignItems:"center",variant:"styles.listItem"},void 0===d?{}:d),ref:n},u),{children:t}))});n.Z=c},97470:function(e,n,t){"use strict";t.d(n,{Z:function(){return j}});var i=t(62230),r=t(85244),o=t(52322),l=t(5446),a=t(2784),s=t(40023),c=t(951),d=t(8799),u=t(18978),f=t(59326),p=t(75289),x=t(12374),m=t(89363),h=t(98240),g=t(33710),v=t(82119),b=function(e){var n=e.text,t=e.as,l=e.sx,s=(0,h.Z)(e,["text","as","sx"]),c=(0,a.useRef)(null),d=(0,a.useState)(null),u=d[0],f=d[1],x=function(){f(c.current&&c.current.offsetWidth<c.current.scrollWidth)};return(0,a.useEffect)(function(){return x(),window.addEventListener("resize",x),function(){window.removeEventListener("resize",x)}},[]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(p.xv,(0,r.Z)((0,i.Z)({"data-for":n,"data-tip":!0,sx:(0,i.Z)({flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},void 0===l?{}:l),as:t,ref:c},s),{children:n})),u&&(0,o.jsx)(v.X,{children:(0,o.jsx)(g.Z,{id:n,type:"dark",multiline:!0,border:!0,borderColor:"black",place:"bottom",effect:"solid",children:n})})]})},y=function(e){var n,t,i=e.text,r=e.sliceFieldName,l=e.theme,a=e.WidgetIcon;return(0,o.jsxs)(p.kC,{sx:{alignItems:"center",position:"relative"},children:[(0,o.jsx)(a,{size:28,style:{color:null===(n=l.colors)||void 0===n?void 0:n.primary,marginRight:"8px",borderRadius:"4px",padding:"4px",border:"2px solid",borderColor:null===(t=l.colors)||void 0===t?void 0:t.primary}}),(0,o.jsx)(b,{text:i,as:"p",sx:{py:0,px:1,fontWeight:"label",fontSize:"15px"},"data-testid":"field-name"}),(0,o.jsx)(p.xv,{as:"p",sx:{display:["none","none","initial"],fontSize:"14px",ml:1,color:"textClear"},"data-testid":"field-id",children:r})]})},j=function(e){var n=e.item,t=e.index,h=e.deleteItem,g=e.enterEditMode,v=e.modelFieldName,b=e.renderFieldAccessor,j=e.HintElement,Z=e.CustomEditElement,k=e.CustomEditElements,C=e.widget,I=e.draggableId,S=e.testId,F=e.isRepeatableCustomType,E=e.children,w=(0,f.B7)().theme,T=n.key,A=n.value,N=A.config,R=A.type;return(0,o.jsx)(a.Fragment,{children:(0,o.jsx)(s._l,{draggableId:I,index:t,children:function(e){var s,f,I,A,M;return(0,o.jsx)(a.Fragment,{children:(0,o.jsxs)(x.Z,(0,r.Z)((0,i.Z)({"data-testid":S,ref:e.innerRef},e.draggableProps),{Component:p.xu,sx:{p:0,mx:0,my:3},children:[(0,o.jsxs)(p.kC,{sx:{width:"100%"},children:[(0,o.jsx)(m.Z,(0,i.Z)({label:"Reorder slice field (drag and drop)",Icon:u.Fm7,color:null===(s=w.colors)||void 0===s?void 0:s.icons,mr:1,mt:3},e.dragHandleProps)),(0,o.jsxs)(p.xu,{sx:{bg:"headSection",width:"100%",borderRadius:"3px",border:function(e){var n;return"1px solid ".concat(String(null===(n=e.colors)||void 0===n?void 0:n.borders))}},children:[(0,o.jsxs)(p.kC,{sx:{p:3,alignItems:"center",justifyContent:"space-between",width:"100%"},children:[(0,o.jsx)(y,{theme:w,text:(null==N?void 0:N.label)||T,sliceFieldName:b&&b(T),WidgetIcon:C.Meta.icon}),(0,o.jsxs)(p.kC,{children:[k||null,Z||(0,o.jsx)(m.Z,{size:22,Icon:c.$iz,label:"Edit field",sx:{cursor:"pointer",color:null===(f=w.colors)||void 0===f?void 0:f.icons},onClick:function(){return g([T,n.value],v,t)}}),!(!0===F&&"UID"==R)&&(0,o.jsxs)(l.v2,{children:[(0,o.jsx)(l.j2,{className:"sliceMenuButton","data-testid":"field-menu-button",style:{padding:"0",cursor:"pointer",width:"32px",height:"32px",border:"none",background:"transparent",outline:"0"},children:(0,o.jsx)(d.FQA,{size:20,color:null===(I=w.colors)||void 0===I?void 0:I.icons,style:{pointerEvents:"none"}})}),(0,o.jsx)(l.qy,{style:{background:null===(A=w.colors)||void 0===A?void 0:A.gray,border:"1px solid",borderRadius:"3px",borderColor:null===(M=w.colors)||void 0===M?void 0:M.borders,outline:"0"},children:(0,o.jsx)(l.sN,{style:{padding:"6px",cursor:"pointer"},onSelect:function(){return h(T)},children:"Delete field"})})]})]})]}),j||null]})]}),E]}))})}})})}},89363:function(e,n,t){"use strict";var i=t(62230),r=t(85244),o=t(98240),l=t(52322),a=t(75289),s=function(e,n){return n?{border:function(e){var n=e.colors;return"1px solid ".concat(n.error)}}:e?{border:function(e){var n=e.colors;return"1px solid ".concat(n.primary)}}:{border:function(e){var n=e.colors;return"1px solid ".concat(n.borders)}}},c=function(e){var n=e.sx,t=e.onClick,c=e.label,d=e.Icon,u=e.error,f=e.size,p=void 0===f?16:f,x=e.fitButton,m=e.active,h=e.useActive,g=e.activeSx,v=(0,o.Z)(e,["sx","onClick","label","Icon","error","size","fitButton","active","useActive","activeSx"]);return(0,l.jsx)(a.hU,(0,r.Z)((0,i.Z)({onClick:void 0===t?function(){return null}:t,"aria-label":c,type:"button",sx:(0,i.Z)({},void 0!==x&&x?{width:p,height:p}:null,void 0!==h&&h&&(void 0===g?s:g)(void 0!==m&&m,void 0===u?null:u),void 0===n?null:n)},v),{children:(0,l.jsx)(d,{size:p})}))};n.Z=c},46784:function(e,n,t){"use strict";var i=t(62230),r=t(17064),o=t(52322),l=t(63397),a=t(2784),s=t(75289),c=t(3402),d=t(98079),u=function(e){var n=e.fieldName,t=e.formField,u=e.fields,f=e.initialValues,p=(0,r.Z)((0,l.U$)(n),3),x=p[0],m=p[1],h=p[2],g=t.component;return(0,o.jsx)(s.xu,{sx:(0,i.Z)({mt:2,alignItems:"center"},t.type===d.h.CHECKBOX?{display:"flex",height:"130%"}:null),children:g?(0,o.jsx)(g,{meta:m,field:x,helpers:h,fieldName:n,formField:t,initialValues:f}):(0,o.jsxs)(a.Fragment,{children:[t.type===d.h.INPUT?(0,o.jsx)(c.Hq,{meta:m,field:x,fields:u,formField:t,fieldName:n,initialValues:f}):null,t.type===d.h.CHECKBOX&&(0,o.jsx)(c.sP,{meta:m,label:t.label,fieldName:n,initialValues:f,onChange:function(e){return h.setValue(e)}})]})})};n.Z=u},73393:function(e,n,t){"use strict";t.d(n,{Z:function(){return B}});var i=t(62230),r=t(85244),o=t(17064),l=t(52322),a=t(37149),s=t.n(a),c=t(59326),d=t(75289),u=t(65413),f=t(2784),p=t(92928),x=t(98898),m=t(98240),h=function(e){var n=e.children,t=(0,m.Z)(e,["children"]);return(0,l.jsx)(d.xu,(0,r.Z)((0,i.Z)({as:"ul",sx:{p:0,m:0,px:function(e){return"calc(".concat(e.space[3],"px + 8px)")},borderBottom:"1px solid #DFE1E5",position:"relative"}},t),{children:n}))};h.tabsRole="TabList";var g=function(e){var n=e.children,t=(0,m.Z)(e,["children"]),o=(0,c.B7)().theme;return(0,l.jsx)(p.OK,(0,r.Z)((0,i.Z)({},t),{style:(0,i.Z)({margin:"0 32px 0 0",top:"0",padding:"8px 0px",border:"none",bottom:"-1px",opacity:"0.8",transition:"all 150ms cubic-bezier(0.215,0.60,0.355,1)",borderRadius:"0"},t.selected?{borderBottom:"3px solid ".concat(o.colors.primary),color:o.colors.text,fontWeight:"500",opacity:"1",backgroundColor:"transparent"}:{borderBottom:"3px solid transparent"}),children:n}))};g.tabsRole="Tab";var v=function(e){var n=e.children,t=e.Footer,r=e.Header,o=e.tabs,a=e.bodySx,s=e.footerSx,c=e.defaultIndex,u=void 0===c?0:c,m=(0,f.useState)(u),v=m[0],b=m[1];return(0,l.jsx)(x.Z,{borderFooter:!0,footerSx:(0,i.Z)({p:0},s),bodySx:(0,i.Z)({p:0},a),sx:{border:"none"},Header:r,Footer:t,children:(0,l.jsxs)(p.mQ,{defaultIndex:u,onSelect:function(e){return b(e)},children:[(0,l.jsx)(h,{children:(o||[]).map(function(e){return(0,l.jsx)(g,{children:e},e)})}),f.Children.map(n,function(e,n){return(0,l.jsx)(d.xu,{sx:{p:function(e){return"calc(".concat(e.space[3],"px + 8px)")},display:n===v?"block":"none"},children:(0,l.jsx)(p.x4,{children:e})})})]})})},b=(0,f.memo)(v),y=t(74757),j=function(e){var n,t,i=e.text,r=e.sliceFieldName,o=e.theme,a=e.WidgetIcon;return(0,l.jsxs)(d.kC,{sx:{alignItems:"center"},children:[(0,l.jsx)(a,{size:28,style:{color:null===(n=o.colors)||void 0===n?void 0:n.primary,marginRight:"8px",borderRadius:"4px",padding:"4px",border:"2px solid",borderColor:null===(t=o.colors)||void 0===t?void 0:t.primary}}),(0,l.jsx)(d.xv,{as:"p","data-testid":"item-header-text",sx:{py:0,px:1,fontWeight:"label",fontSize:"15px"},children:i}),(0,l.jsx)(d.xv,{as:"p",sx:{display:["none","none","initial"],fontSize:"14px",ml:1,color:"textClear"},children:r})]})},Z=t(83399),k=t(77495),C=t(5632),I=t(65186),S=t(63094),F=function(){var e=(0,C.useRouter)();return(0,l.jsxs)(d.xu,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",padding:"60px"},children:[(0,l.jsx)(I.wr$,{size:48,color:"#C9D0D8"}),(0,l.jsx)(d.xu,{sx:{height:"12px"}}),(0,l.jsx)(d.xv,{color:"text",sx:{fontWeight:600,fontSize:"24px",lineHeight:"32px",textAlign:"center"},children:"Your mock data has moved"}),(0,l.jsx)(d.xu,{sx:{height:"8px"}}),(0,l.jsx)(d.xv,{color:"text",sx:{fontWeight:400,fontSize:"14px",lineHeight:"24px",textAlign:"center"},children:"You can now edit directly your mock data in the new Slice Simulator."}),(0,l.jsx)(d.xu,{sx:{height:"24px"}}),(0,l.jsx)(d.zx,{onClick:function(n){n.preventDefault(),window.open("".concat(e.asPath,"/simulator"),S.pq)},children:"Go to the Slice Simulator"})]})},E=t(52586),w=t(13302),T=t(8830),A=t(46784),N=t(67557),R=t(77033),M=t(63397),_=function(e){var n=e.formId,t=e.initialValues,a=e.validationSchema,s=e.onSave,c=e.FormFields,u=e.children;return(0,l.jsx)(d.xu,{children:(0,l.jsx)(M.J9,{initialValues:t,validationSchema:a,onSubmit:function(e,n){var t;s({newKey:e.id,value:Object.entries((0,m.Z)(e,["id"])).reduce(function(e,n){var t=(0,o.Z)(n,2),l=t[0],a=t[1];if((void 0===a?"undefined":(0,R.Z)(a))!==Boolean&&!a){var s,d=null===(s=c[l])||void 0===s?void 0:s.defaultValue;if(void 0!==d)return(0,r.Z)((0,i.Z)({},e),(0,N.Z)({},l,d))}return(0,r.Z)((0,i.Z)({},e),(0,N.Z)({},l,a))},{})})},children:function(e){return(0,l.jsx)(M.l0,{id:n,children:u((0,r.Z)((0,i.Z)({},e),{initialValues:t}))})}})})},z=(0,f.memo)(_);s().setAppElement("#__next");var B=function(e){var n=e.close,t=e.data,a=e.fields,s=e.onSave,f=e.zoneType,p=(0,c.B7)().theme;if(!t.isOpen)return null;var x=(0,o.Z)(t.field,2),m=x[0],h=x[1],g=(0,T.t)(E,h.config,h.type);if(!g)return(0,l.jsxs)("div",{children:[h.type," not found"]});var v=g.Meta.icon,C=g.FormFields,I=g.Form,S=g.schema,N=(0,i.Z)({},(0,k.f7)((0,w.B9)(C,"id")),g.prepareInitialValues?g.prepareInitialValues(h.config):h.config),R=function(){try{return{res:S.validateSync({type:h.type,config:N},{stripUnknown:!0})}}catch(e){return{err:e}}}(),M=R.res,_=R.err;_&&(console.error("[EditModal] Failed to validate field of type ".concat(h.type,".\n Please update model.json accordingly.")),console.error(_));var B={id:m,config:M?M.config:N},D=(0,o.Z)(C.id.validate.matches,2),q=D[0],O=D[1],V=u.object().shape({id:u.string().matches(q,O).min(3).max(35).required(),config:S.fields.config}),P="".concat("edit-modal-form","-").concat(Math.random().toString());return(0,l.jsx)(Z.Z,{isOpen:!0,shouldCloseOnOverlayClick:!0,onRequestClose:n,contentLabel:"Widget Form Modal",children:(0,l.jsx)(z,{apiId:m,formId:P,initialValues:B,validationSchema:V,FormFields:C,onSave:function(e){var t=e.newKey,r=e.value;s({apiId:m,newKey:t,value:(0,i.Z)({},h,r)}),n()},children:function(e){var t=e.values,s=t.id,c=t.config.label,u=e.isValid,x=e.isSubmitting,m=e.initialValues,h=I?(0,l.jsx)(I,(0,r.Z)((0,i.Z)({},e),{fields:a}),"field-model-tab-content"):(0,l.jsx)(y.k,{children:Object.entries(C).map(function(e){var n=(0,o.Z)(e,2),t=n[0],i=n[1];return(0,l.jsx)(y.J,{children:(0,l.jsx)(A.Z,{fieldName:(0,k.lm)(t),formField:i,fields:a,initialValues:m})},t)})},"field-model-tab-content"),g=["Field Model"],Z=[h];if("slice"===f){var S=(0,l.jsx)(d.xu,{children:(0,l.jsx)(F,{})},"mock-data-tab-content");g.push("Mock Data"),Z.push(S)}return(0,l.jsx)(b,{borderFooter:!0,footerSx:{position:"sticky",bottom:0,p:0},tabs:g,Header:function(e){var t=e.radius;return(0,l.jsxs)(d.kC,{sx:{position:"sticky",zIndex:1,top:0,p:3,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:t,borderTopRightRadius:t},children:[(0,l.jsx)(j,{theme:p,text:c||s,WidgetIcon:v}),(0,l.jsx)(d.x8,{onClick:n,type:"button"})]})},Footer:(0,l.jsxs)(d.kC,{sx:{position:"sticky",bottom:0,alignItems:"space-between",bg:"headSection",p:3},children:[(0,l.jsx)(d.xu,{sx:{ml:"auto"}}),(0,l.jsx)(d.zx,{mr:2,type:"button",onClick:n,variant:"secondary",children:"Cancel"}),(0,l.jsx)(d.zx,{form:P,type:"submit",disabled:!u&&x,sx:{fontWeight:"400",paddingBlock:"8px",paddingInline:"16px",fontSize:"14px",borderRadius:"4px"},children:"Done"})]}),children:Z})}})})}},35308:function(e,n,t){"use strict";t.d(n,{Z:function(){return x}});var i=t(62230),r=t(85244),o=t(52322),l=t(37149),a=t.n(l),s=t(75289),c=t(98898),d=t(74757),u=t(83399),f=t(59326),p=function(e){var n=e.title,t=e.description,i=e.icon,r=e.onSelect,l=(0,f.B7)().theme;return(0,o.jsxs)(s.kC,{sx:{p:3,my:2,alignItems:"center",cursor:"pointer",borderRadius:"3px",border:function(e){var n;return"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.borders)},"&:hover":{border:function(e){var n=e.colors;return"1px solid ".concat(n.primary)},boxShadow:"0 0 0 3px rgba(81, 99, 186, 0.2)"}},"data-testid":n,onClick:r,children:[(0,o.jsx)(i,{label:'Select field of type "'.concat(n,'"'),style:{color:l.colors.primary,marginRight:"8px",borderRadius:"4px",padding:"5px",border:"2px solid",borderColor:l.colors.primary},size:32}),(0,o.jsxs)(s.xu,{ml:1,children:[(0,o.jsx)(s.X6,{as:"h4",sx:{fontSize:1},children:(0,o.jsx)("b",{children:n})}),(0,o.jsx)(s.xv,{as:"p",variant:"xs",children:t})]})]})};a().setAppElement("#__next");var x=function(e){var n=e.data,t=e.close,l=e.onSelect,a=e.widgetsArray;return n.isOpen?(0,o.jsx)(u.Z,{isOpen:!0,shouldCloseOnOverlayClick:!0,onRequestClose:t,contentLabel:"Widget Form Modal",children:(0,o.jsx)(c.Z,{borderFooter:!0,footerSx:{p:3},bodySx:{pt:2,pb:4,px:4},sx:{border:"none"},Header:function(e){var n=e.radius;return(0,o.jsxs)(s.kC,{sx:{position:"sticky",top:0,zIndex:1,p:3,pl:4,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:function(e){var n;return"1px solid ".concat(null===(n=e.colors)||void 0===n?void 0:n.borders)}},children:[(0,o.jsx)(s.X6,{children:"Add a new field"}),(0,o.jsx)(s.x8,{onClick:t})]})},children:(0,o.jsx)(d.k,{children:a.filter(function(e){return e}).map(function(e){var n=e.Meta,t=e.TYPE_NAME,a=e.CUSTOM_NAME;return(0,o.jsx)(d.J,{children:(0,o.jsx)(p,(0,r.Z)((0,i.Z)({},n),{onSelect:function(){return l(a||t)}}))},a||t)})})})}):null}},13166:function(e,n,t){"use strict";t.d(n,{Z:function(){return g}});var i=t(22710),r=t(99267),o=t(52322),l=t(2784),a=t(49857),s=t(81038),c=t(77245),d=t(8799),u=t(65186),f=t(59326),p=t(75289),x=t(57899),m={position:"relative",top:"3px"},h=function(e){var n,t,i,r=e.code,a=e.lang,s=(0,f.B7)().theme,h=(0,l.useState)(!1),g=h[0],v=h[1],b=function(){r&&navigator.clipboard.writeText(r).then(function(){v(!0),setTimeout(function(){v(!1)},1200)})};return r?(0,o.jsxs)(p.kC,{sx:{p:2,px:3,alignItems:"center",borderTop:"1px solid",borderColor:"borders",justifyContent:"space-between"},children:[(0,o.jsxs)(p.kC,{sx:{alignItems:"center",display:["none","none","flex"],maxWidth:"80%"},children:[(0,o.jsx)(d.vcz,{size:26,color:null==s?void 0:null===(n=s.colors)||void 0===n?void 0:n.icons,style:{border:"1px solid",borderColor:null==s?void 0:null===(t=s.colors)||void 0===t?void 0:t.borders,borderRadius:"3px",padding:"4px",marginRight:"2px"}}),(0,o.jsx)(x.Z,{sx:{margin:"0px 8px",border:"none",borderRadius:"3px",fontSize:"13px"},lang:a,children:r})]}),(0,o.jsx)(p.xu,{children:(0,o.jsxs)(p.zx,{"aria-label":g?"Code snippet copied":"Copy code snippet",onClick:b,variant:"textButton",children:[g?(0,o.jsx)(u.HhX,{size:16,color:null==s?void 0:null===(i=s.colors)||void 0===i?void 0:i.success,style:m}):(0,o.jsx)(c.LhG,{size:16,style:m}),(0,o.jsx)(p.xv,{as:"span",sx:{display:["none","inline","none","inline"]},children:"\xa0Copy"})]})})]}):null},g=function(e){var n=e.show,t=e.renderHintBase,l=e.item,c=t({item:l}),d=(0,a.ZP)(c,(0,i.Z)(function(){return(0,r.__generator)(this,function(e){switch(e.label){case 0:return[4,s.j.snippets.readSnippets({fieldPath:c.split("."),model:l.value})];case 1:return[2,e.sent()]}})})),u=d.data,f=d.error;if(f&&console.error(f),!u||f)return null;var p=u.snippets||[];return p[0]?(0,o.jsx)("div",{style:{display:n?"initial":"none"},children:(0,o.jsx)(h,{code:p[0].code,lang:p[0].language})}):null}},76167:function(e,n,t){"use strict";t.d(n,{Z:function(){return Z}});var i=t(62230),r=t(85244),o=t(98240),l=t(52322),a=t(22715),s=t(63397),c=t(2784),d=t(75289),u=t(59326),f=t(46577),p=t(77495),x=t(77735),m=t(52586),h=t(17384),g=t(18978),v=t(33710),b=t(82119),y=function(e){var n=e.error;return n?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(b.X,{children:(0,l.jsx)(v.Z,{type:"light",multiline:!0,border:!0,borderColor:"tomato"})}),(0,l.jsx)(g.Zlu,{color:"tomato","data-tip":n,style:{position:"absolute",right:"8px"},size:16})]}):null},j=function(e){var n=e.innerRef,t=(0,o.Z)(e,["innerRef"]);return(0,l.jsx)(d.II,(0,r.Z)((0,i.Z)({},t),{ref:n}))},Z=function(e){var n=e.widgetTypeName,t=e.fields,o=e.onSave,g=e.onCancelNewField,v=(0,c.useRef)(null),b=(0,u.B7)().theme,Z=(0,c.useState)(!0),k=Z[0],C=Z[1];(0,c.useEffect)(function(){v.current&&v.current.focus()},[v]);var I=m[n];if(!I)return console.error('Widget of type "'.concat(n,'" not found. This is a problem on our side!')),(0,l.jsx)("div",{children:"Unexpected error. Contact us for more info."});var S=I.FormFields,F=I.Meta.icon,E={id:S.id,label:S.label},w=(0,r.Z)((0,i.Z)({},(0,p.f7)(E),"UID"===n?{id:"uid"}:{}),{widgetTypeName:n}),T=(0,p.gc)(E),A=function(e,n,t){t(k&&!E.id.disabled?(0,r.Z)((0,i.Z)({},n),{label:e.target.value,id:(0,h.lV)(e.target.value)}):(0,r.Z)((0,i.Z)({},n),{label:e.target.value}))},N=function(e,n){n("id",e.target.value),C(!1)};return(0,l.jsx)(s.J9,{onSubmit:o,validationSchema:T,initialValues:w,children:function(e){var n,o,c=e.errors,u=e.values,p=e.setValues,m=e.setFieldValue,h=e.submitForm;return(0,l.jsx)(s.l0,{"data-testid":"new-field-form",children:(0,l.jsxs)(d.kC,{as:"li",sx:{bg:"white",p:3,px:3,mx:0,ml:"34px",alignItems:"center",variant:"styles.listItem",border:function(e){var n,t;return"1px solid ".concat((null===(n=e.colors)||void 0===n?void 0:null===(t=n.borders)||void 0===t?void 0:t.toString())||"")},flexWrap:"wrap",gap:"12px",justifyContent:"flex-start"},children:[(0,l.jsx)(F,{style:{color:null===(n=b.colors)||void 0===n?void 0:n.primary,borderRadius:"4px",padding:"4px",border:"2px solid",borderColor:null===(o=b.colors)||void 0===o?void 0:o.primary},size:28}),(0,l.jsxs)(d.kC,{sx:{alignItems:"center",flexGrow:1,gap:2,position:"relative"},children:[(0,l.jsx)(d.xv,{as:"p",sx:{fontWeight:500,whiteSpace:"nowrap"},children:"Field Name"}),(0,l.jsx)(s.gN,{onChange:function(e){return A(e,u,p)},onKeyDown:function(e){"Enter"===e.key&&h()},name:"label",placeholder:"Field Name",type:"text",validate:function(e){if(!e.length)return"This field is required"},as:j,innerRef:v,sx:(0,r.Z)((0,i.Z)({},(0,f.tM)(E.label.disabled?f.$w.DISABLED:c.label?f.$w.ERROR:void 0)),{flexGrow:1,minWidth:"128px",width:"initial"}),"aria-label":"label-input","data-testid":"new-field-name-input"}),(0,l.jsx)(y,{error:c.label})]}),(0,l.jsxs)(d.kC,{sx:{alignItems:"center",flexGrow:1,gap:2,position:"relative"},children:[(0,l.jsx)(d.xv,{as:"p",sx:{fontWeight:500,whiteSpace:"nowrap"},children:"Field ID"}),(0,l.jsx)(s.gN,{onChange:function(e){return N(e,m)},onKeyDown:function(e){"Enter"===e.key&&h()},name:"id",placeholder:"e.g. buttonLink",type:"text",disabled:E.id.disabled,validate:function(e){return(0,x.u)({value:e,fields:t,initialId:null})},as:j,sx:(0,r.Z)((0,i.Z)({},(0,f.tM)(E.id.disabled?f.$w.DISABLED:c.id?f.$w.ERROR:void 0)),{flexGrow:1,minWidth:"128px",width:"initial"}),"data-testid":"new-field-id-input"}),(0,l.jsx)(y,{error:c.id})]}),(0,l.jsxs)(d.kC,{sx:{gap:2},children:[(0,l.jsx)(a.zx,{onClick:g,color:"grey",children:"Cancel"}),(0,l.jsx)(a.zx,{onClick:function(){h()},children:"Add"})]})]})})}})}},18645:function(e,n,t){"use strict";t.d(n,{Z:function(){return F}});var i=t(62230),r=t(85244),o=t(17064),l=t(81541),a=t(52322),s=t(22715),c=t(13980),d=t(2784),u=t(65077),f=t(82770),p=t(28173),x=t(9461),m=t(35308),h=t(40023),g=t(75289),v=t(12374),b=t(97470),y=t(52586),j=t(8830),Z=t(13166),k=function(e){var n=e.fields,t=e.title,o=e.tabId,l=e.enterEditMode,s=e.enterSelectMode,c=e.onDragEnd,d=e.renderFieldAccessor,u=e.onDeleteItem,f=e.onSave,p=e.showHints,x=e.newField,m=e.renderHintBase,k=e.isRepeatable,C=e.testId,I=e.isRepeatableCustomType;return(0,a.jsx)(h.Z5,{onDragEnd:c,children:(0,a.jsx)(h.bK,{droppableId:t,children:function(e,t){return(0,a.jsxs)(g.xu,(0,r.Z)((0,i.Z)({as:"ul",ref:e.innerRef},e.droppableProps),{"data-testid":C,sx:{paddingInline:"16px !important"},children:[n.map(function(e,n){var c=e.value,x=c.config,h=c.type,C=(0,j.t)(y,x,h);if(!C)return(0,a.jsx)(v.Z,{children:(0,a.jsxs)(g.xv,{children:['Field type "',h,'" not supported']})});var S={item:e,index:n,tabId:o,widget:C,showHints:p,key:e.key,enterSelectMode:s,renderFieldAccessor:d,enterEditMode:l,parentSnapshot:t,deleteItem:u,saveItem:f,draggableId:"list-item-".concat(e.key),isRepeatableCustomType:I,testId:"list-item-".concat(e.key)};if(C.CustomListItem){var F=C.CustomListItem;return(0,a.jsx)(F,(0,i.Z)({},S))}var E=(0,a.jsx)(Z.Z,{item:e,show:p,isRepeatable:k,renderHintBase:m,Widgets:y,typeName:C.CUSTOM_NAME||C.TYPE_NAME});return(0,a.jsx)(b.Z,(0,r.Z)((0,i.Z)({},S),{HintElement:E}))}),e.placeholder,x]}))}})})},C=t(76167),I=function(e){var n=e.onEnterSelectMode,t=e.zoneName;return(0,a.jsxs)(g.xu,{sx:{textAlign:"center",my:4},children:[(0,a.jsx)(g.X6,{as:"h5",children:"Add a new field here"}),(0,a.jsx)(g.xu,{sx:{my:2},children:(0,a.jsx)(g.xv,{sx:{color:"textClear"},children:"Fields are inputs for content (e.g. text, images, links)."})}),(0,a.jsx)(g.xu,{sx:{display:"flex",justifyContent:"center",marginTop:16},children:(0,a.jsx)(s.zx,{color:"grey",onClick:function(){return n()},"data-testid":"add-".concat(t,"-field"),startIcon:"add",children:"Add a new field"})})]})},S=function(e){var n=e.zoneType,t=e.tabId,c=e.title,h=e.fields,g=e.poolOfFieldsToCheck,v=e.widgetsArray,b=e.isRepeatable,y=e.onDeleteItem,j=e.onSaveNewField,Z=e.onDragEnd,S=e.EditModal,F=e.onSave,E=e.dataTip,w=e.renderHintBase,T=e.renderFieldAccessor,A=e.testId,N=e.isRepeatableCustomType,R=Object.entries(g).find(function(e){return"UID"===(0,o.Z)(e,2)[1].value.type})?v.filter(function(e){return"UID"!==e.TYPE_NAME}):v,M=(0,d.useState)(!1),_=M[0],z=M[1],B=(0,d.useState)({isOpen:!1}),D=B[0],q=B[1],O=(0,d.useState)({isOpen:!1}),V=O[0],P=O[1],L=(0,d.useState)(null),J=L[0],H=L[1],W=function(e){q({isOpen:!0,field:e});var n=(0,o.Z)(e,2),t=n[0],i=n[1];f.Xe.track({event:"field:settings-opened",id:t,name:i.config.label,type:i.type,isInAGroup:!1,contentType:(0,x.T)(window.location.pathname)})},U=function(){P({isOpen:!0})},G=function(){q({isOpen:!1})},$=function(){return P({isOpen:!1})},Y=function(e){H({widgetTypeName:e,fields:h}),P({isOpen:!1})},K=function(){return H(null)};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(p.Bu,{actions:h.length>0?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(s.xv,{color:"grey11",component:"span",noWrap:!0,children:"Show code snippets?"}),(0,a.jsx)(s.rs,{checked:_,onCheckedChange:z,size:"small",style:{flexShrink:0},"data-testid":"code-snippets-switch"}),(0,a.jsx)(s.zx,{"data-testid":"add-".concat(b?"Repeatable":"Static","-field"),onClick:U,startIcon:"add",color:"grey",disabled:null!==J,children:"Add a new field"})]}):void 0,children:c}),0!==h.length||J?h.length>0||J?(0,a.jsx)(u.xR,{children:(0,a.jsx)(k,{tabId:t,isRepeatable:b,fields:h,showHints:_,dataTip:E,title:c,renderFieldAccessor:T,renderHintBase:w,enterEditMode:W,enterSelectMode:U,onDragEnd:Z,onDeleteItem:y,onSave:F,testId:A,isRepeatableCustomType:N,newField:J&&(0,a.jsx)(C.Z,(0,r.Z)((0,i.Z)({},J),{fields:g||h,onSave:function(){for(var e=arguments.length,n=Array(e),t=0;t<e;t++)n[t]=arguments[t];j.apply(void 0,(0,l.Z)(n)),H(null)},onCancelNewField:K}))})}):void 0:(0,a.jsx)(u.xR,{children:(0,a.jsx)(I,{onEnterSelectMode:function(){return U()},zoneName:b?"Repeatable":"Static"})}),(0,a.jsx)(S,{data:D,close:G,onSave:F,fields:g,zoneType:n}),(0,a.jsx)(m.Z,{data:V,close:$,onSelect:Y,widgetsArray:R})]})};S.propTypes={isRepeatable:c.bool,title:c.string.isRequired,dataTip:c.string.isRequired,onSave:c.func.isRequired,onSaveNewField:c.func.isRequired,onDragEnd:c.func.isRequired,onDeleteItem:c.func.isRequired,poolOfFieldsToCheck:(0,c.arrayOf)((0,c.shape)({key:c.string,value:c.object})),renderHintBase:c.func.isRequired,renderFieldAccessor:c.func.isRequired,widgetsArray:c.array.isRequired,fields:(0,c.arrayOf)((0,c.shape)({key:c.string.isRequired,value:(0,c.shape)({config:c.object,fields:c.array,type:c.string.isRequired})}))};var F=S},8830:function(e,n,t){"use strict";t.d(n,{t:function(){return i}});var i=function(e,n,t){if("Link"===t)switch(null==n?void 0:n.select){case"document":return e.ContentRelationship;case"media":return e.LinkToMedia;default:return e.Link}return e[t]}},77735:function(e,n,t){"use strict";t.d(n,{J:function(){return l},u:function(){return o}});var i=t(63094),r=t(43947),o=function(e){var n=e.value,t=e.fields,i=e.initialId;return n?t.find(function(e){return e.key===n})&&n!==i?'Field "'.concat(n,'" already exists.'):void 0:"Field is required"},l={label:(0,r.II)("Label",{required:"This field is required",max:!0},void 0,void 0,"Label for content creators (defaults to field type)"),id:(0,r.II)("API ID*",{min:!0,max:!0,required:"This field is required",matches:[i.xo,"No special characters allowed (except _)"]},o,void 0,"A unique identifier for the field (e.g. buttonLink)"),placeholder:(0,r.II)("Placeholder",{required:"This field is required",max:[100,"String is too long. Max: 100"]},void 0,void 0,"Placeholder text for content creators")}},43947:function(e,n,t){"use strict";t.d(n,{II:function(){return c},Jg:function(){return o}});var i=t(77495),r=t(98079),o=function(e){var n=!(arguments.length>1)||void 0===arguments[1]||arguments[1],t=!(arguments.length>2)||void 0===arguments[2]||arguments[2];return{type:r.h.CHECKBOX,validate:{required:(0,i.MJ)(n,s)},required:n,label:e,defaultValue:t,yupType:"boolean"}},l=[3,"String is too short. Min: 3"],a=[35,"String is too long. Max: 35"],s=["Field is required"],c=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{min:l,max:a,required:s},t=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,c=arguments.length>4?arguments[4]:void 0,d=n||{},u=d.min,f=d.max,p=d.required,x=d.matches;return{type:r.h.INPUT,label:e,validate:{required:(0,i.MJ)(p,s),min:(0,i.MJ)(u,l),max:(0,i.MJ)(f,a),matches:x},defaultValue:o,fieldLevelValidation:t,yupType:"string",placeholder:c}}},77495:function(e,n,t){"use strict";t.d(n,{MJ:function(){return u},f7:function(){return f},gc:function(){return p},lm:function(){return d}});var i=t(67557),r=t(62230),o=t(85244),l=t(17064),a=t(81541),s=t(65413),c=t(98079),d=function(e){return"id"===e?"id":"config.".concat(e)},u=function(e,n){return Array.isArray(e)?e:"boolean"==typeof e&&e?n:null},f=function(e){return Object.entries(e).reduce(function(e,n){var t,a=(0,l.Z)(n,2),s=a[0],d=null===(t=a[1]).defaultValue?void 0:void 0!==t.defaultValue?t.defaultValue:t.type===c.h.CHECKBOX||(t.type===c.h.INPUT?"":t.type===c.h.SELECT?[]:void 0);return void 0!==d?(0,o.Z)((0,r.Z)({},e),(0,i.Z)({},s,d)):e},{})},p=function(e){return s.object().shape(Object.entries(e).filter(function(e){return e}).reduce(function(e,n){var t=(0,l.Z)(n,2),c=t[0],d=t[1],u=d.validate,f=d.yupType;if(!u)return e;if("function"==typeof u)return(0,o.Z)((0,r.Z)({},e),(0,i.Z)({},c,u(c,d)));var p=s[f]();return Object.entries(u).filter(function(e){return e&&e[1]}).forEach(function(e){var n,t=(0,l.Z)(e,2),i=t[0],r=t[1];if(r&&p[i]){p=(n=p)[i].apply(n,(0,a.Z)(Array.isArray(r)?r:[r]));return}console.warn('Invalid Yup validator for field "'.concat(c,'"'))}),(0,o.Z)((0,r.Z)({},e),(0,i.Z)({},c,p))},{})).required().default(void 0).noUnknown(!0)}},98079:function(e,n,t){"use strict";var i,r;t.d(n,{h:function(){return i}}),(r=i||(i={})).CHECKBOX="checkbox",r.INPUT="input",r.SELECT="select"},36195:function(e,n,t){"use strict";var i=t(89150);n.Z=[i.StructuredText,i.Image,i.Link,i.LinkToMedia,i.ContentRelationship,i.Select,i.Boolean,i.Date,i.Timestamp,i.Embed,i.Number,i.GeoPoint,i.Color,i.Text,]},89150:function(e,n,t){"use strict";t.r(n),t.d(n,{Boolean:function(){return g},Color:function(){return Z},ContentRelationship:function(){return H},Date:function(){return G},Embed:function(){return K},GeoPoint:function(){return Q},Image:function(){return eh},Link:function(){return B},LinkToMedia:function(){return ej},Number:function(){return eI},Select:function(){return eN},StructuredText:function(){return e$},Text:function(){return eX},Timestamp:function(){return e0},UID:function(){return e7}});var i,r,o,l,a,s=t(8799),c=t(65413),d=t(77495),u=t(77735),f=t(43947),p=t(13302),x={icon:s.XGl,title:"Boolean",description:"An input that is either true or false"},m={label:u.J.label,id:u.J.id,placeholder_false:(0,f.II)("False Placeholder",{required:!1},null,"false","Value the content creator sees (Output as 'false' in the API)."),placeholder_true:(0,f.II)("True Placeholder",{required:!1},null,"true","Value the content creator sees (Output as 'true' in the API)"),default_value:(0,f.Jg)("Default to true")},h=c.object().shape({type:c.string().matches(/^Boolean$/,{excludeEmptyString:!0}).required(),config:(0,d.gc)((0,p.B9)(m,"id"))}),g={TYPE_NAME:"Boolean",create:function(e){return{type:"Boolean",config:{label:e,default_value:!1,placeholder_true:"true",placeholder_false:"false"}}},Meta:x,schema:h,FormFields:m},v=t(65186),b={icon:v.jqW,title:"Color",description:"A color picker"},y=(0,p.zg)("Color"),j=y.TYPE_NAME,Z={create:function(e){return{type:"Color",config:{label:e,placeholder:""}}},FormFields:y.FormFields,TYPE_NAME:j,schema:y.schema,Meta:b},k=t(62230),C=t(85244),I=t(56580),S=t(52312),F=t(28849),E=t(34543),w=t(17064),T=t(52322),A=t(74757),N=t(46784),R=(0,C.Z)((0,k.Z)({},u.J),{allowTargetBlank:(0,f.Jg)("Allow target blank",!1,!1)}),M=function(e){var n=e.initialValues,t=e.fields;return(0,T.jsx)(A.k,{children:Object.entries(R).map(function(e){var i=(0,w.Z)(e,2),r=i[0],o=i[1];return(0,T.jsx)(A.J,{children:(0,T.jsx)(N.Z,{fieldName:(0,d.lm)(r),formField:o,fields:t,initialValues:n})},r)})})},_={icon:E.eR7,title:"Link",description:"A link to web, media or Prismic document"},z=c.object().shape({label:c.string().optional(),useAsTitle:c.boolean().optional(),placeholder:c.string().optional(),select:c.string().optional().oneOf(["media","document","web",null]).nullable(),customtypes:c.array(c.string()).strict().optional(),masks:c.array(c.string()).optional(),tags:c.array(c.string()).optional(),allowTargetBlank:c.boolean().strict().optional()}).required().default(void 0).noUnknown(!0),B={Meta:_,FormFields:R,schema:c.object().shape({type:c.string().matches(/^Link$/,{excludeEmptyString:!0}).required(),config:z.optional()}),Form:M,create:function(e){return{type:"Link",config:{label:e,placeholder:"",select:null}}},TYPE_NAME:"Link"},D=t(36131),q=t(75289),O={label:u.J.label,id:u.J.id,customtypes:{validate:function(){return c.array().of(c.string())}}},V=function(e){var n=e.initialValues,t=e.values,i=e.fields,r=e.setFieldValue,o=(0,I.v9)(F.Ch).filter(S.TG),l=o.map(function(e){return{value:e.local.id,label:e.local.label}}),a=t.config.customtypes?t.config.customtypes.map(function(e){var n=o.find(function(n){return n.local.id===e});return{value:null==n?void 0:n.local.id,label:null==n?void 0:n.local.label}}):null;return(0,T.jsxs)(A.k,{children:[Object.entries(O).filter(function(e){return"customtypes"!==e[0]}).map(function(e){var t=(0,w.Z)(e,2),r=t[0],o=t[1];return(0,T.jsx)(A.J,{children:(0,T.jsx)(N.Z,{fieldName:(0,d.lm)(r),formField:o,fields:i,initialValues:n})},r)}),(0,T.jsx)(A.J,{children:(0,T.jsxs)(q.xu,{sx:{mt:2,alignItems:"center"},children:[(0,T.jsx)(q.__,{htmlFor:"origin",mb:"1",children:"Types"}),(0,T.jsx)(D.ZP,{isMulti:!0,name:"origin",options:l,onChange:function(e){e&&r("config.customtypes",e.map(function(e){return e.value}))},value:a,theme:function(e){return(0,C.Z)((0,k.Z)({},e),{colors:(0,C.Z)((0,k.Z)({},e.colors),{text:"text",primary:"background"})})}})]})})]})},P={icon:v.I2R,title:"Content Relationship",description:"Define content relations & internal links"},L=z.shape({label:c.string().max(35,"String is too long. Max: 35"),select:c.string().required().matches(/^document$/,{excludeEmptyString:!0}),customtypes:c.array(c.string()).strict().optional()}),J=c.object().shape({type:c.string().matches(/^Link$/,{excludeEmptyString:!0}).required(),config:L}),H={create:function(e){return{type:"Link",config:{label:e,select:"document"}}},Meta:P,schema:J,TYPE_NAME:"Link",FormFields:O,CUSTOM_NAME:"ContentRelationship",Form:V,prepareInitialValues:function(e){var n=(0,I.v9)(F.Ch).filter(S.TG);return(null==e?void 0:e.customtypes)?(0,C.Z)((0,k.Z)({},e),{customtypes:e.customtypes.filter(function(e){return n.find(function(n){return n.local.id===e})})}):e}},W=(0,p.zg)("Date"),U=W.FormFields,G={create:function(e){return{type:"Date",config:{label:e,placeholder:""}}},FormFields:U,TYPE_NAME:"Date",schema:W.schema,Meta:{icon:v.f$3,title:"Date",description:"A calendar date picker"}},$=(0,p.zg)("Embed"),Y=$.FormFields,K={create:function(e){return{type:"Embed",config:{label:e,placeholder:""}}},FormFields:Y,TYPE_NAME:"Embed",schema:$.schema,Meta:{icon:E.xqv,title:"Embed",description:"Embed videos, songs, tweets, slides, …"}},X={label:u.J.label,id:u.J.id},Q={create:function(e){return{type:"GeoPoint",config:{label:e}}},FormFields:X,TYPE_NAME:"GeoPoint",schema:c.object().shape({type:c.string().matches(/^GeoPoint$/,{excludeEmptyString:!0}).required(),config:c.object().shape({label:c.string()}).required().default(void 0).noUnknown(!0)}),Meta:{icon:v.c7Z,title:"GeoPoint",description:"A field for storing geo-coordinates"}},ee=t(2784),en=t(63397),et=t(98240),ei=t(3402),er=t(89363),eo=function(e){var n=e.onClick,t=e.error,i=e.onDelete,r=e.active,o=e.text,l=e.sx;return(0,T.jsx)(er.Z,{useActive:!0,fitButton:!0,error:t,onClick:n,active:r,sx:(0,k.Z)({position:"relative",width:"64px",height:"64px"},l),Icon:function(){return(0,T.jsxs)(ee.Fragment,{children:[(0,T.jsxs)(q.kC,{sx:{flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[(0,T.jsx)(s.jnY,{size:22}),(0,T.jsx)(q.xv,{mt:1,children:o})]}),i?(0,T.jsx)(q.Ct,{onClick:i,variant:"circle-right",children:(0,T.jsx)(v.B4e,{})}):null]})}})},el=function(e){var n=e.onClick;return(0,T.jsx)(er.Z,{fitButton:!0,onClick:n,sx:{width:"64px",height:"64px",border:function(e){var n=e.colors;return"1px solid ".concat(String(null==n?void 0:n.borders))}},Icon:function(){return(0,T.jsx)(q.kC,{sx:{flexDirection:"column",justifyContent:"center",alignItems:"center"},children:(0,T.jsx)(s.iTs,{size:34,color:"#5263BA","aria-label":"Add a thumbnail"})})}})},ea=function(e){var n=e.prefix,t=e.required,i=e.display,r=(0,w.Z)((0,en.U$)(n),2),o=(r[0],r[1]),l=void 0!==t&&t?"*":"";return i?(0,T.jsxs)(ee.Fragment,{children:[(0,T.jsx)(es,{name:"".concat(n,".name"),label:"Name".concat(l),placeholder:"main",sx:{mb:3},isConstraint:"config.constraint"===n,meta:o}),(0,T.jsx)(ec,{name:"".concat(n,".width"),label:"Width (px)".concat(l),placeholder:" ",sx:{mb:3}}),(0,T.jsx)(ec,{name:"".concat(n,".height"),label:"Height (px)".concat(l),placeholder:" "})]}):null},es=function(e){var n=e.name,t=e.label,i=e.placeholder,r=e.meta,o=e.isConstraint,l=(0,et.Z)(e,["name","label","placeholder","meta","isConstraint"]),a=(0,w.Z)((0,en.U$)(n),1)[0];return(0,T.jsx)(ei.Hq,(0,C.Z)((0,k.Z)({},l),{fieldName:n,meta:r,formField:{label:t,placeholder:i},field:o?{value:"main",readOnly:!0}:{value:a.value},variant:o?"disabled":"primary"}))},ec=function(e){var n=e.name,t=e.label,i=e.placeholder,r=(0,et.Z)(e,["name","label","placeholder"]),o=(0,w.Z)((0,en.U$)(n),2),l=o[0],a=o[1];return(0,T.jsx)(ei.Hq,(0,C.Z)((0,k.Z)({},r),{fieldName:n,formField:{label:t,placeholder:i},meta:a,field:{min:0,type:"number",value:l.value||"",onKeyDown:function(e){("e"===e.key||"-"===e.key||"+"===e.key)&&e.preventDefault()}}}))},ed=function(){return c.number().nullable().transform(function(e,n){return""===n?null:e})},eu={label:u.J.label,id:u.J.id,constraint:{validate:function(){return c.object().defined().shape({width:ed(),height:ed()})}},thumbnails:{validate:function(){return c.array().defined().of(c.object().test({name:"Thumbnails",message:"Must set name and width or height at minimum",test:function(e){if(!e.name)return!1;var n="number"==typeof e.width&&e.width,t="number"==typeof e.height&&e.height;return e.name&&(n||t)}}))}}},ef={name:"",width:"",height:""},ep=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.width,t=e.height,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!i||n||t?n||t?"".concat(n||"auto","x").concat(t||"auto"):"...":"auto"},ex=function(e){var n=e.initialValues,t=e.values,i=e.errors,r=e.fields,o=e.touched,l=(0,ee.useState)(0),a=l[0],s=l[1],c=t.config,u=c.thumbnails,f=c.constraint;return(0,ee.useEffect)(function(){s(u.length)},[u.length]),(0,T.jsxs)(A.k,{children:[Object.entries(eu).map(function(e){var t=(0,w.Z)(e,2),i=t[0],o=t[1];return(0,T.jsx)(A.J,{children:(0,T.jsx)(N.Z,{fieldName:(0,d.lm)(i),formField:o,fields:r,initialValues:n})},i)}),(0,T.jsxs)(A.J,{children:[(0,T.jsx)(q.__,{htmlFor:"thumbnails",variant:"label.primary",sx:{mt:1,display:"flex",alignItems:"center"},children:"Responsive views*"}),(0,T.jsx)(q.Zb,{p:3,children:(0,T.jsx)(en.F2,{name:"config.thumbnails",render:function(n){var t=n.push,r=n.remove;return(0,T.jsxs)(ee.Fragment,{children:[(0,T.jsxs)(q.kC,{mb:3,children:[(0,T.jsx)(eo,{active:0===a,text:ep(f,!0),sx:{mr:2},onClick:function(){return s(0)}}),u.map(function(e,n){return(0,T.jsx)(eo,{sx:{mr:3},active:a===+n+1,text:ep(e),error:!!i.thumbnails&&!!o.thumbnails&&!!o.thumbnails[n]&&!!i.thumbnails&&!!i.thumbnails[n],onDelete:function(){return r(n)},onClick:function(){return s(+n+1)}},"thumbnail-button-".concat(+n+1))}),(0,T.jsx)(el,{onClick:function(){t(ef)}})]}),(0,T.jsx)(ea,(0,C.Z)((0,k.Z)({},e),{display:0===a,prefix:"config.constraint"})),u.map(function(n,t){return(0,ee.createElement)(ea,(0,C.Z)((0,k.Z)({},e),{required:!0,key:"thumbnail-".concat(+t+1),display:a===+t+1,prefix:"config.thumbnails[".concat(t,"]")}))})]})}})})]})]})},em=c.object().shape({type:c.string().matches(/^Image$/,{excludeEmptyString:!0}).required(),config:(0,d.gc)((0,p.B9)(eu,"id"))}),eh={Meta:{icon:s.jnY,title:"Image",description:"A responsive image field with constraints"},Form:ex,schema:em,create:function(e){return{type:"Image",config:{label:e,constraint:{},thumbnails:[]}}},FormFields:eu,TYPE_NAME:"Image"},eg=(0,k.Z)({},u.J),ev=function(e){var n=e.initialValues,t=e.fields;return(0,T.jsx)(A.k,{children:Object.entries(eg).map(function(e){var i=(0,w.Z)(e,2),r=i[0],o=i[1];return(0,T.jsx)(A.J,{children:(0,T.jsx)(N.Z,{fieldName:(0,d.lm)(r),formField:o,fields:t,initialValues:n})},r)})})},eb={icon:v.x2k,title:"Link to media",description:"A link to files, document and media"},ey=z.shape({select:c.string().required().matches(/^media$/,{excludeEmptyString:!0})}),ej={Meta:eb,FormFields:eg,schema:c.object().shape({type:c.string().matches(/^Link$/,{excludeEmptyString:!0}).required(),config:ey.optional()}),Form:ev,create:function(e){return{type:"Link",config:{label:e,placeholder:"",select:"media"}}},TYPE_NAME:"Link",CUSTOM_NAME:"LinkToMedia"},eZ=t(951),ek=(0,p.zg)("Number"),eC=ek.FormFields,eI={create:function(e){return{type:"Number",config:{label:e,placeholder:""}}},FormFields:eC,TYPE_NAME:"Number",schema:ek.schema,Meta:{icon:eZ.JUs,title:"Number",description:"A number input field"}},eS=t(98079),eF=function(e){return"use first value as default ".concat(e?'("'.concat(e,'")'):"")},eE=function(e,n){return n?e:void 0},ew=(0,C.Z)((0,k.Z)({},u.J),{default_value:{type:eS.h.CHECKBOX,yupType:"string",defaultValue:null,validate:function(){return c.string().test({name:"default_value",message:'Default value is not part of field "options" in Select',test:function(e){return void 0===e||this.parent&&this.parent.options&&this.parent.options.find(function(n){return n===e})}})},component:function(e){var n,t=null===(n=(0,en.u6)().values.config)||void 0===n?void 0:n.options[0];return(0,T.jsx)(ei.w8,(0,C.Z)((0,k.Z)({},e),{defaultValue:e.field.value,controlledValue:t,setControlledValue:e.helpers.setValue,buildControlledValue:eE,label:eF}))}},options:{yupType:"array",defaultValue:["1","2"],validate:{required:["Select requires a minimum of 2 options"],min:[2,"Choose at least 2 options"],test:{name:"non-empty values",message:"Values cannot be empty",test:function(e){return!e.some(function(e){return!e||!e.length})}}},component:function(e){return(0,T.jsx)(ei.kp,(0,k.Z)({label:"Options",inputPlaceholder:"Select option output in API (e.g. 'blueTheme')",buttonLabel:"Add option"},e))}}}),eT={icon:v.dzP,title:"Select",description:"A dropdown field of options for content creators."},eA=c.object().shape({type:c.string().matches(/^Select$/,{excludeEmptyString:!0}).required(),config:(0,d.gc)((0,p.B9)(ew,"id"))}),eN={FormFields:ew,create:function(e){return{type:"Select",config:{label:e,placeholder:"",options:["1","2"]}}},schema:eA,Meta:eT,TYPE_NAME:"Select"},eR=t(81541),eM=t(47927),e_=t(76635),ez=function(e){return function(n){var t=n.size;return(0,T.jsx)("span",{style:{fontSize:t},children:e})}},eB=[{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,T.jsx)("b",{children:"b"}))},{value:"em",label:"em",icon:ez((0,T.jsx)("em",{style:{fontFamily:"serif"},children:"I"}))},{value:"hyperlink",label:"hyperlink",icon:ez((0,T.jsx)(E.eR7,{}))},{value:"image",label:"image",icon:ez((0,T.jsx)(E.LFN,{}))},{value:"embed",label:"embed",icon:ez((0,T.jsx)(E.xqv,{}))},{value:"list-item",label:"list",icon:ez((0,T.jsx)(E.SnF,{}))},{value:"o-list-item",label:"o",icon:ez((0,T.jsx)(s.KyO,{}))},{value:"rtl",label:"rtl",icon:ez("rtl")},],eD=eB.map(function(e){return e.value}),eq=function(e){return!eD.find(function(n){return!e.includes(n)})},eO=function(e){var n=e.split(",");return eB.reduce(function(e,t){var i=t.value;return n.includes(i)?(0,eR.Z)(e).concat([i]):e},[])};function eV(e,n){return(0,eM.has)("parent",e)&&(0,e_.isObject)(e.parent)&&(0,eM.has)(n,e.parent)&&(0,e_.isString)(e.parent[n])?e.parent[n]:null}function eP(e){return function(){return c.string().test({name:e,message:"Options cannot be empty",test:function(n,t){var i=eV(t,e),r=eV(t,"single"===e?"multi":"single");return!!r&&"string"==typeof r||"string"==typeof i&&(!!i&&!!i.length||!!r&&!!r.length)&&!i.split(",").find(function(e){return!eD.includes(e)})}})}}var eL,eJ=(0,C.Z)((0,k.Z)({},u.J),{allowTargetBlank:(0,f.Jg)("Allow target blank for links"),single:{validate:eP("single")},multi:{validate:eP("multi")}}),eH=["config.single","config.multi"],eW=function(e){var n,t=e.initialValues,i=e.values,r=e.errors,o=e.fields,l=e.setFieldValue,a=i.config,s=a.single,c=a.multi,u=s?eO(s):c&&eO(c)||eD,f=(0,ee.useState)(!s),p=f[0],x=f[1],m=(0,ee.useState)(u),h=m[0],g=m[1];return(0,ee.useEffect)(function(){var e=p?1:0;l(eH[e],h.join(",")),setTimeout(function(){l(eH[1-e],void 0)},100)},[p,h]),(0,T.jsxs)(A.k,{children:[Object.entries(eJ).map(function(e){var n=(0,w.Z)(e,2),i=n[0],r=n[1];return(0,T.jsx)(A.J,{children:(0,T.jsx)(N.Z,{fieldName:(0,d.lm)(i),formField:r,fields:o,initialValues:t})},i)}),(0,T.jsxs)(A.J,{children:[(0,T.jsxs)(q.__,{htmlFor:"accept",variant:"label.primary",sx:{mt:1,display:"flex",alignItems:"center"},children:["Accept*",(0,T.jsx)(q.zx,{type:"button",variant:"buttons.textButton",onClick:function(){if(eq(h))return g([]);g(eD)},children:eq(h)?"Unselect All":"Select all"})]}),eB.map(function(e){return(0,T.jsx)(er.Z,{fitButton:!0,useActive:!0,label:e.label,size:14,Icon:e.icon,sx:{p:"16px",mb:2,mr:2,variant:"buttons.selectIcon"},active:h.includes(e.value),onClick:function(){if(h.find(function(n){return n===e.value}))return g(h.filter(function(n){return n!==e.value}));g((0,eR.Z)(h).concat([e.value]))}},e.value)}),(null===(n=r.config)||void 0===n?void 0:n[p?"multi":"single"])?(0,T.jsx)(q.xu,{sx:{position:"absolute"},children:(0,T.jsx)(q.xv,{as:"span",variant:"text.labelError",pl:0,children:r.config[p?"multi":"single"]})}):null]}),(0,T.jsx)(A.J,{children:(0,T.jsx)(q.kC,{sx:{mt:2,alignItems:"center",height:"100%"},children:(0,T.jsxs)(q.__,{variant:"label.border",children:[(0,T.jsx)(q.XZ,{checked:p,onChange:function(){return x(!p)}}),"Allow multiple paragraphs"]})})})]})},eU={icon:v.BAW,title:"Rich Text",description:"A rich text field with formatting options"},eG=c.object().shape({type:c.string().matches(/^StructuredText$/,{excludeEmptyString:!0}).required(),config:(0,d.gc)((0,p.B9)((0,k.Z)({},eJ,{labels:{yupType:"array",validate:{}}}),"id"))}),e$={create:function(e){return{type:"StructuredText",config:{label:e,placeholder:"",allowTargetBlank:!0,multi:eD.join(",")}}},FormFields:eJ,Meta:eU,schema:eG,TYPE_NAME:"StructuredText",Form:eW},eY=u.J,eK=c.object().shape({type:c.string().matches(/^Text$/,{excludeEmptyString:!0}).required(),config:(0,d.gc)((0,p.B9)(eY,"id"))}),eX={create:function(e){return{type:"Text",config:{label:e,placeholder:""}}},Meta:{icon:v.SQS,title:"Key Text",description:"A simple text string field"},schema:eK,TYPE_NAME:"Text",FormFields:eY},eQ=u.J,e0={create:function(e){return{type:"Timestamp",config:{label:e,placeholder:""}}},schema:c.object().shape({type:c.string().matches(/^Timestamp$/,{excludeEmptyString:!0}).required(),config:(0,d.gc)((0,p.B9)(eQ,"id"))}),FormFields:eQ,TYPE_NAME:"Timestamp",Meta:{icon:v.f$3,title:"Timestamp",description:"A calendar date picker with time"}},e2={label:u.J.label,id:(0,C.Z)((0,k.Z)({},u.J.id),{validate:{required:"This field is required",matches:[/^uid$/,"Api ID must be 'uid' for this field."]},disabled:!0}),placeholder:u.J.placeholder},e1=c.object().shape({type:c.string().matches(/^UID$/,{excludeEmptyString:!0}).required(),config:(0,d.gc)((0,p.B9)(e2,"id"))}),e7={create:function(e){return{type:"UID",config:{label:e,placeholder:""}}},Meta:{icon:v.izl,title:"UID",description:"Unique Identifier"},schema:e1,TYPE_NAME:"UID",FormFields:e2}},52586:function(e,n,t){"use strict";t.r(n),t.d(n,{Boolean:function(){return l.Boolean},Color:function(){return l.Color},ContentRelationship:function(){return l.ContentRelationship},Date:function(){return l.Date},Embed:function(){return l.Embed},GeoPoint:function(){return l.GeoPoint},Group:function(){return q},Image:function(){return l.Image},Link:function(){return l.Link},LinkToMedia:function(){return l.LinkToMedia},Number:function(){return l.Number},Select:function(){return l.Select},StructuredText:function(){return l.StructuredText},Text:function(){return l.Text},Timestamp:function(){return l.Timestamp},UID:function(){return l.UID}});var i,r,o,l=t(89150),a=t(65186),s=t(65413),c=t(62230),d=t(85244),u=t(17064),f=t(52322),p=t(75289),x=t(74757),m=t(46784),h=t(77495),g=t(77735),v=t(43947),b=(0,d.Z)((0,c.Z)({},g.J),{repeat:(0,v.Jg)("Repeatable",!1,!0)}),y=function(e){var n=e.initialValues,t=e.fields,i=e.values,r=e.setFieldValue,o=i.config.repeat;return(0,f.jsxs)(x.k,{children:[Object.entries(b).filter(function(e){return"repeat"!==(0,u.Z)(e,1)[0]}).map(function(e){var i=(0,u.Z)(e,2),r=i[0],o=i[1];return(0,f.jsx)(x.J,{children:(0,f.jsx)(m.Z,{fieldName:(0,h.lm)(r),formField:o,fields:t,initialValues:n})},r)}),(0,f.jsx)(x.J,{children:(0,f.jsx)(p.xu,{sx:{mt:2,alignItems:"center",display:"flex",height:"130%"},children:(0,f.jsxs)(p.__,{variant:"label.border",sx:{mb:0},children:[(0,f.jsx)(p.XZ,{checked:o,onChange:function(){return r("config.repeat",!o)}}),"Repeatable"]})})})]})},j=t(98240),Z=t(81541),k=t(2784),C=t(40023),I=t(28316),S=t(82770),F=t(97470),E=t(73393),w=t(35308),T=t(13166),A=t(76167),N=t(8830),R=t(24244),M=t(36195),_=t(13302),z=t(17384),B=t(9461),D=function(e){var n=e.tabId,t=e.widget,o=(e.parentSnapshot,e.showHints),a=e.isRepeatable,s=e.item,x=e.draggableId,m=e.saveItem,h=(0,j.Z)(e,["tabId","widget","parentSnapshot","showHints","isRepeatable","item","draggableId","saveItem"]),g=(0,k.useState)(!1),v=g[0],b=g[1],y=(0,k.useState)(null),D=y[0],q=y[1],O=(0,k.useState)({isOpen:!1}),V=O[0],P=O[1],L=function(e){q({widgetTypeName:e}),b(!1)},J=function(){q(null)},H=function(){P({isOpen:!1})},W=function(e){var n,t,o,a,c=e.id,d=e.label,u=l[e.widgetTypeName].create(d),f=(n={group:R.Fl.fromSM(s.value),fieldId:c,field:u},null!==(t=(i=a=structuredClone(n.group)).config)&&void 0!==t||(i.config={}),null!==(o=(r=a.config).fields)&&void 0!==o||(r.fields={}),a.config.fields[n.fieldId]=n.field,a);m({apiId:s.key,newKey:s.key,value:R.Fl.toSM(f)}),S.Xe.track({event:"field:added",id:c,name:d,type:u.type,isInAGroup:!0,contentType:(0,B.T)(window.location.pathname)})},U=function(e){var n=e.apiId,t=e.newKey,i=e.value,r=function(e){var n,t,i=structuredClone(e.group);if(!(null===(n=i.config)||void 0===n?void 0:n.fields)||!(null===(t=e.group.config)||void 0===t?void 0:t.fields))return i;for(var r in i.config.fields={},e.group.config.fields)r===e.previousFieldId?i.config.fields[e.newFieldId]=e.field:i.config.fields[r]=e.group.config.fields[r];return i}({group:R.Fl.fromSM(s.value),previousFieldId:n,newFieldId:t,field:i});m({apiId:s.key,newKey:s.key,value:R.Fl.toSM(r)})},G=function(e){if(!(0,_.uS)(e)){var n=e.source,t=e.destination;if(t){var i=n.index,r=t.index,o=function(e){var n,t=structuredClone(e.group);if(!(null===(n=t.config)||void 0===n?void 0:n.fields))return t;var i=Object.entries(t.config.fields),r=(0,u.Z)(i.splice(e.sourceIndex,1),1)[0];return i.splice(e.destinationIndex,0,r),t.config.fields=Object.fromEntries(i),t}({group:R.Fl.fromSM(s.value),sourceIndex:i,destinationIndex:r});(0,I.flushSync)(function(){m({apiId:s.key,newKey:s.key,value:R.Fl.toSM(o)})})}}},$=function(e){var n,t,i,r,o=(n={group:R.Fl.fromSM(s.value),fieldId:e},null===(t=(r=structuredClone(n.group)).config)||void 0===t||null===(i=t.fields)||void 0===i||delete i[n.fieldId],r);m({apiId:s.key,newKey:s.key,value:R.Fl.toSM(o)})},Y=function(e){P({isOpen:!0,field:e});var n=(0,u.Z)(e,2),t=n[0],i=n[1];S.Xe.track({event:"field:settings-opened",id:t,name:i.config.label,type:i.type,isInAGroup:!0,contentType:(0,B.T)(window.location.pathname)})};return(0,f.jsxs)(k.Fragment,{children:[(0,f.jsx)(F.Z,(0,d.Z)((0,c.Z)({item:s,widget:t,draggableId:x},h),{CustomEditElements:[(0,f.jsx)(p.zx,{mr:2,variant:"buttons.darkSmall",onClick:function(){return b(!0)},children:"Add Field"},"custom-edit-element-".concat(s.key)),],children:(0,f.jsx)(p.xu,{sx:{ml:4},children:(0,f.jsx)(C.Z5,{onDragEnd:G,children:(0,f.jsx)(C.bK,{droppableId:"".concat(n,"-").concat(s.key,"-zone"),children:function(e){return(0,f.jsxs)("ul",(0,d.Z)((0,c.Z)({ref:e.innerRef},e.droppableProps),{children:[s.value.config.fields.map(function(e,n){var t=e.value,i=t.config,r=t.type,u=(0,N.t)(l,i,r);if(!u)return null;var p={item:e,index:n,widget:u,key:e.key,enterEditMode:Y,deleteItem:$,renderFieldAccessor:function(n){return"item".concat((0,z.Ti)(e.key))},draggableId:"group-".concat(s.key,"-").concat(e.key,"-").concat(n),testId:"list-item-group-".concat(s.key,"-").concat(e.key)},x=(0,f.jsx)(T.Z,{item:e,show:o,isRepeatable:a,renderHintBase:function(e){var n=e.item;return"item".concat((0,z.Ti)(n.key))},Widgets:l,typeName:u.CUSTOM_NAME||u.TYPE_NAME});return(0,f.jsx)(F.Z,(0,d.Z)((0,c.Z)({},p),{HintElement:x}))}),e.placeholder,D&&(0,f.jsx)(A.Z,(0,d.Z)((0,c.Z)({},D),{fields:s.value.config.fields||[],onSave:function(){for(var e=arguments.length,n=Array(e),t=0;t<e;t++)n[t]=arguments[t];W.apply(void 0,(0,Z.Z)(n)),q(null)},onCancelNewField:J}))]}))}})})})})),(0,f.jsx)(w.Z,{data:{isOpen:v},close:function(){return b(!1)},onSelect:L,widgetsArray:M.Z}),(0,f.jsx)(E.Z,{data:V,close:H,onSave:U,fields:s.value.config.fields})]})},q={Meta:{icon:a.cC1,title:"Group",description:"A Group of Prismic fields"},Form:y,FormFields:b,schema:s.object().shape({type:s.string().matches(/^Group$/,{excludeEmptyString:!0}).required(),config:s.object().shape({fields:s.array(),label:s.string(),placeholder:s.string(),repeat:s.boolean().optional()})}),create:function(e){return{type:"Group",config:{label:e,repeat:!0,fields:[]}}},CustomListItem:D,TYPE_NAME:"Group"}},13302:function(e,n,t){"use strict";t.d(n,{B9:function(){return s},Ss:function(){return d},uS:function(){return c},zg:function(){return u}});var i=t(98240),r=t(9849),o=t(65413),l=t(77495),a=t(77735),s=function(e,n){return e[n],(0,i.Z)(e,[n].map(r.Z))},c=function(e){return!e.destination||e.source.index===e.destination.index||e.source.droppableId!==e.destination.droppableId},d=function(e,n){return!e[n]&&(console.log('Could not find widget with type name "'.concat(n,'".')),!0)},u=function(e){return{TYPE_NAME:e,FormFields:a.J,schema:o.object().shape({type:o.string().test({name:"type",test:function(n){return n===e}}),config:(0,l.gc)(s(a.J,"id"))}),create:function(){return{type:e,config:(0,l.f7)(s(a.J,"id"))}}}}},9461:function(e,n,t){"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))}t.d(n,{T:function(){return i}})},84779:function(){},82432:function(){}}]);
|