slice-machine-ui 2.19.2-alpha.lg-import-slices.1 → 2.19.2-alpha.xru-unskip-e2e-test-redirection.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/out/404.html +1 -1
  2. package/out/_next/static/UxC5PuGC_LR5N5R6FFDo6/_buildManifest.js +1 -0
  3. package/out/_next/static/chunks/422-c9192a1dbdd2ae0e.js +1 -0
  4. package/out/_next/static/chunks/{429-e5d7e39160de9f5e.js → 429-aab52070cad2884b.js} +1 -1
  5. package/out/_next/static/chunks/489-ce3053e1d81ade83.js +1 -0
  6. package/out/_next/static/chunks/907-180eb33eefccc237.js +1 -0
  7. package/out/_next/static/chunks/pages/{_app-a8345a65a46d8112.js → _app-0e4d39dfdf8ae39a.js} +1 -1
  8. package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-97120b65616617fb.js → [customTypeId]-af9376721beb489e.js} +1 -1
  9. package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-b358358b5c2c1c43.js → [pageTypeId]-a24665e91b882169.js} +1 -1
  10. package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/{simulator-8c70298caf51bed0.js → simulator-faeb6d2f77d97096.js} +1 -1
  11. package/out/_next/static/chunks/pages/slices-81c1c3f1bcad60f4.js +1 -0
  12. package/out/changelog.html +1 -1
  13. package/out/changes.html +1 -1
  14. package/out/custom-types/[customTypeId].html +1 -1
  15. package/out/custom-types.html +1 -1
  16. package/out/index.html +1 -1
  17. package/out/labs.html +1 -1
  18. package/out/page-types/[pageTypeId].html +1 -1
  19. package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
  20. package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
  21. package/out/slices.html +1 -1
  22. package/package.json +3 -3
  23. package/src/features/customTypes/customTypesBuilder/CreateSliceFromImageModal/CreateSliceFromImageModal.tsx +36 -3
  24. package/src/features/customTypes/customTypesBuilder/SliceZoneBlankSlate.tsx +0 -11
  25. package/src/features/customTypes/customTypesBuilder/sliceCreationOptions.tsx +0 -14
  26. package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/index.tsx +0 -51
  27. package/src/pages/slices.tsx +0 -30
  28. package/out/_next/static/Q_2lm2CqEzK8hMGWeR30R/_buildManifest.js +0 -1
  29. package/out/_next/static/chunks/130-e1a16d2f94fb2b64.js +0 -1
  30. package/out/_next/static/chunks/489-d6580011169630a1.js +0 -1
  31. package/out/_next/static/chunks/585-c89bb2471e85b9f8.js +0 -1
  32. package/out/_next/static/chunks/928-ebbe58b08e1e70b1.js +0 -1
  33. package/out/_next/static/chunks/954-bedaaabf664584a0.js +0 -1
  34. package/out/_next/static/chunks/pages/slices-d5a2b0fcb7490565.js +0 -1
  35. package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/ImportSlicesFromLibraryModal.tsx +0 -291
  36. package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/SliceCard.tsx +0 -48
  37. package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/hooks/useImportSlicesFromGithub.ts +0 -93
  38. package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/index.tsx +0 -1
  39. package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/types.ts +0 -28
  40. package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/utils/addSlices.ts +0 -193
  41. package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/utils/github.ts +0 -630
  42. package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/utils/mapWithConcurrency.ts +0 -28
  43. package/src/features/customTypes/customTypesBuilder/ImportSlicesFromLibraryModal/utils/sliceWithoutConflicts.ts +0 -51
  44. package/src/features/customTypes/customTypesBuilder/shared/getSubmitButtonLabel.ts +0 -12
  45. package/src/features/customTypes/customTypesBuilder/shared/useExistingSlices.ts +0 -26
  46. /package/out/_next/static/{Q_2lm2CqEzK8hMGWeR30R → UxC5PuGC_LR5N5R6FFDo6}/_ssgManifest.js +0 -0
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[954],{74600:function(e,t,n){var i=n(34311),o=n(23779),a=i(function(e,t,n){return e+(n?" ":"")+o(t)});e.exports=a},50421:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContentPath=void 0,t.ContentPath={serialize:e=>e.map(e=>e.key).join("::"),current:e=>e[e.length-1],append:(e,t)=>e+"::"+t,make:e=>e.reduce((e,{key:t,type:n})=>t?e.concat({key:t,type:n}):e,[])}},7217:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.migrateDocument=t.collectWidgets=t.traverseDocument=t.fillDocumentWithDefaultValues=t.DocumentLegacy=t.Document=void 0;let i=n(22970),o=n(76160),a=n(45974),r=n(30902),l=(0,i.__importStar)(n(32521)),c=n(50421),p=n(98088),d=n(88866),u=n(82956),s=n(75122);t.Document=l.record(p.WidgetKey,u.WidgetContent);let y=l.record(p.WidgetKey,l.unknown),_=e=>new l.Type("Document",e=>!!e&&"object"==typeof e,t=>(0,r.pipe)(y.decode(t),o.either.map(t=>Object.entries(t).reduce((t,[n,i])=>{let o=(0,s.defaultCtx)(n,e),r=(0,u.WidgetLegacy)(o).decode(i);return!r||(0,a.isLeft)(r)?t:{...t,[n]:r.right}},{}))),t=>Object.entries(t).reduce((t,[n,i])=>{let o=(0,s.defaultCtx)(n,e),a=(0,u.WidgetLegacy)(o).encode(i);return a?{content:{...t.content,[n]:a.content},types:{...t.types,...a.types}}:t},{content:{},types:{}}));function C(e){let{types:t,widgets:n}=Object.entries(e).reduce((e,[t,n])=>{if(t.endsWith("_TYPE")){let i=s.FieldOrSliceType.decode(n);if((0,a.isRight)(i))return{...e,types:e.types.set(t.substring(0,t.length-5),i.right)}}return t.endsWith("_POSITION")||t.endsWith("_TYPE")?e:{...e,widgets:{...e.widgets,[t]:n}}},{types:new Map,widgets:{}}),i=e.slugs_INTERNAL||[];return{widgets:n,types:t,uid:e.uid,slugs:i}}function T(e){return{customTypeId:null==e?void 0:e.id,fields:Object.fromEntries((0,d.flattenSections)(e))}}function m({document:e,customType:t}){let n=t&&d.StaticCustomType.is(t)?T(t):t;return({transformWidget:t=({content:e})=>e,transformSlice:i=({content:e})=>e})=>{let o=n&&Object.entries(n.fields).reduce((e,[t,n])=>({...e,[t]:n}),{});return Object.entries(e).reduce((e,[a,r])=>{let l=o&&o[a],p=c.ContentPath.make([{key:null==n?void 0:n.customTypeId,type:"CustomType"},{key:a,type:"Widget"}]),d=(()=>{switch(r.__TYPE__){case"SliceContentType":return(0,u.traverseSlices)({path:p,key:a,model:(null==l?void 0:l.type)==="Slices"||(null==l?void 0:l.type)==="Choice"?l:void 0,content:r})({transformWidget:t,transformSlice:i});case"GroupContentType":return(0,u.traverseGroupContent)({path:p,key:a,apiId:a,model:(null==l?void 0:l.type)==="Group"?l:void 0,content:r})(t);case"RepeatableContent":return(0,u.traverseRepeatableContent)({path:p,key:a,apiId:a,model:(null==l?void 0:l.type)==="Link"?l:void 0,content:r})(t);case"TableContent":return(0,u.traverseTableContent)({path:p,key:a,apiId:a,model:(null==l?void 0:l.type)==="Table"?l:void 0,content:r})(t);default:return t({path:p,key:a,apiId:a,model:(null==l?void 0:l.type)!=="Group"&&(null==l?void 0:l.type)!=="Slices"&&(null==l?void 0:l.type)!=="Choice"?l:void 0,content:r})}})();return{...e,...d?{[a]:d}:{}}},{})}}function g(e,t){let n=d.StaticCustomType.is(t)?T(t):t;return Object.values((0,d.collectSharedSlices)(n)).some(e=>!!e.legacyPaths)?m({document:e,customType:t})({transformSlice:u.migrateSliceItem}):e}t.DocumentLegacy={_codec:_,extractMetadata:C,parse:function(e,t){let n=(0,r.pipe)(l.record(p.WidgetKey,l.unknown).decode(e),o.either.chain(e=>{let{types:t,widgets:n}=C(e);return _(t).decode(n)}));return(0,a.isLeft)(n)?void 0:g(n.right,t)},encode:function(e){let t=_().encode(e);return{...t.content,...t.types}}},t.fillDocumentWithDefaultValues=function(e,t){let{fields:n}=e&&d.StaticCustomType.is(e)?T(e):e;return Object.entries(n).reduce((e,[n,i])=>{let o=t[n],a=(()=>{switch(i.type){case"Group":return(0,u.isGroupContent)(o)?(0,u.groupContentWithDefaultValues)(i,o):o;case"Choice":case"Slices":return(0,u.isSlicesContent)(o)?(0,u.slicesContentWithDefaultValues)(i,o):o;default:return void 0===o&&d.NestableWidget.is(i)?(0,u.NestableContentDefaultValue)(i):o}})();return a?{...e,[n]:a}:e},t)},t.traverseDocument=m,t.collectWidgets=function(e,t){let n={};return m({document:e})({transformWidget:({content:e,path:i})=>{let o=c.ContentPath.serialize(i);return t(e,i)&&(n[o]=e),e}}),n},t.migrateDocument=g},75122:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultCtx=t.getFieldCtx=t.LegacyContentCtx=t.FieldOrSliceType=void 0;let i=(0,n(22970).__importStar)(n(32521)),o=n(59050);t.FieldOrSliceType=i.union([i.union([o.FieldType,o.SlicesTypes]),i.literal("Repeatable.Link")]);class a{constructor(e,t,n){Object.defineProperty(this,"fieldKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"prefixedKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"keyOfType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fieldPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fieldType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"allTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.fieldKey=e,this.fieldPath=t||[],this.allTypes=n||new Map;let i=Array.of(this.fieldPath,[this.fieldKey]).flat().join(".");this.prefixedKey=i,this.keyOfType=`${i}_TYPE`,this.fieldType=this.allTypes.get(this.prefixedKey)}}t.LegacyContentCtx=a,t.getFieldCtx=function(e,t,n){return new a(e,[...t.fieldPath,t.fieldKey,...n||[]],t.allTypes)},t.defaultCtx=function(e,t=new Map){return new a(e,[],t)}},54175:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EmptyContent=t.EmptyLegacy=t.isEmptyContent=t.EmptyContentType=void 0;let i=n(22970),o=n(76160),a=n(30902),r=(0,i.__importStar)(n(32521)),l=n(3441);t.EmptyContentType="EmptyContent",t.isEmptyContent=e=>(0,l.hasContentType)(e)&&e.__TYPE__===t.EmptyContentType;let c=r.union([r.null,r.type({value:r.null})]);t.EmptyLegacy=e=>new r.Type("EmptyLegacy",t.isEmptyContent,n=>(0,a.pipe)(c.decode(n),o.either.map(()=>({type:e,__TYPE__:t.EmptyContentType}))),()=>null),t.EmptyContent=r.strict({type:r.string,__TYPE__:r.literal(t.EmptyContentType)})},35792:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.traverseGroupItemsContent=t.traverseGroupContent=t.groupContentWithDefaultValues=t.GroupLegacy=t.GroupItemLegacy=t.GroupContentDefaultValue=t.isGroupContent=t.GroupContent=t.GroupItemContent=t.GroupContentType=t.GroupItemContentType=void 0;let i=n(22970),o=n(76160),a=n(45974),r=n(30902),l=(0,i.__importStar)(n(32521)),c=n(88866),p=n(75122),d=n(3441),u=n(69732),s=n(29231);t.GroupItemContentType="GroupItemContent",t.GroupContentType="GroupContentType",t.GroupItemContent=l.recursion("GroupItemContent",()=>l.strict({__TYPE__:l.literal(t.GroupItemContentType),value:l.array(l.tuple([l.string,l.union([u.NestableContent,t.GroupContent])]))})),t.GroupContent=l.recursion("GroupContent",()=>l.strict({__TYPE__:l.literal(t.GroupContentType),value:l.array(t.GroupItemContent)})),t.isGroupContent=e=>(0,d.hasContentType)(e)&&e.__TYPE__===t.GroupContentType,t.GroupContentDefaultValue={__TYPE__:t.GroupContentType,value:[]};let y=l.record(l.string,l.unknown);function _({path:e,key:t,apiId:n,model:i,content:o}){return a=>{var r;let l=C({path:e,model:null===(r=null==i?void 0:i.config)||void 0===r?void 0:r.fields,content:o.value})(a);return a({path:e,key:t,apiId:n,model:i,content:{__TYPE__:o.__TYPE__,value:l}})}}function C({path:e,model:n,content:i}){return o=>i.map((i,a)=>{let r=e.concat([{key:a.toString(),type:"GroupItem"}]),l=i.value.reduce((e,[i,a])=>{let l;let c=null==n?void 0:n[i];return(l=(0,t.isGroupContent)(a)?_({path:r.concat([{key:i,type:"Widget"}]),key:i,apiId:i,model:(null==c?void 0:c.type)==="Group"?c:void 0,content:a})(o):(0,u.isRepeatableContent)(a)?(0,u.traverseRepeatableContent)({path:r.concat([{key:i,type:"Widget"}]),key:i,apiId:i,model:(null==c?void 0:c.type)==="Link"?c:void 0,content:a})(o):(0,u.isTableContent)(a)?(0,u.traverseTableContent)({path:r.concat([{key:i,type:"Widget"}]),key:i,apiId:i,model:(null==c?void 0:c.type)==="Table"?c:void 0,content:a})(o):o({path:r.concat([{key:i,type:"Widget"}]),key:i,apiId:i,model:c,content:a}))&&((0,u.isNestableContent)(l)||(0,t.isGroupContent)(l))?e.concat([[i,l]]):e},[]);return{__TYPE__:i.__TYPE__,value:l}})}t.GroupItemLegacy=e=>new l.Type("GroupItemLegacy",e=>(0,d.hasContentType)(e)&&e.__TYPE__===t.GroupItemContentType,n=>(0,r.pipe)(y.decode(n),o.either.map(n=>({value:Object.entries(n).reduce((n,[i,o])=>{let r=(0,p.getFieldCtx)(i,e),l=r.fieldType===c.GroupFieldType?(0,t.GroupLegacy)(r).decode(o):(0,u.NestableLegacy)(r).decode(o);return!l||(0,a.isLeft)(l)?n:[...n,[i,l.right]]},[]),__TYPE__:t.GroupItemContentType}))),n=>n.value.reduce((n,[i,o])=>{let a=(0,p.getFieldCtx)(i,e),r=(0,t.isGroupContent)(o)?(0,t.GroupLegacy)(a).encode(o):(0,u.NestableLegacy)(a).encode(o);return r?{content:{...n.content,[i]:r.content},types:{...n.types,...r.types}}:n},{content:{},types:{}})),t.GroupLegacy=e=>{let n=l.array(l.union([l.null,(0,t.GroupItemLegacy)(e)])),i=l.array((0,t.GroupItemLegacy)(e));return new l.Type("GroupLegacy",t.isGroupContent,e=>(0,r.pipe)(n.decode(e),o.either.map(e=>({value:e.map(e=>null===e?{__TYPE__:t.GroupItemContentType,value:[]}:e),__TYPE__:t.GroupContentType}))),t=>{let n=i.encode(t.value);return{content:n.map(e=>e.content),types:n.reduce((e,t)=>({...e,...t.types}),{[e.keyOfType]:c.GroupFieldType})}})},t.groupContentWithDefaultValues=function(e,t){var n;let i=null===(n=e.config)||void 0===n?void 0:n.fields;return i?{...t,value:(0,s.repeatableContentWithDefaultNestableContentValues)(i,t.value)}:t},t.traverseGroupContent=_,t.traverseGroupItemsContent=C},86901:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UIDContent=t.UIDLegacy=t.isUIDContent=t.UIDContentType=void 0;let i=n(22970),o=n(76160),a=n(30902),r=(0,i.__importStar)(n(32521)),l=n(3441);t.UIDContentType="UIDContent",t.isUIDContent=e=>(0,l.hasContentType)(e)&&e.__TYPE__===t.UIDContentType,t.UIDLegacy=e=>new r.Type("UIDLegacy",t.isUIDContent,e=>(0,a.pipe)(r.string.decode(e),o.either.map(e=>t.UIDContent.encode({value:e,__TYPE__:t.UIDContentType}))),t=>({content:t.value,types:{[e.keyOfType]:"UID"}})),t.UIDContent=r.type({__TYPE__:r.literal(t.UIDContentType),value:r.string})},18268:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WidgetLegacy=t.isWidgetContent=t.WidgetContent=void 0;let i=(0,n(22970).__importStar)(n(32521)),o=n(35792),a=n(69732),r=n(6869),l=n(86901);t.WidgetContent=i.union([o.GroupContent,a.NestableContent,l.UIDContent,r.SlicesContent]),t.isWidgetContent=e=>(0,o.isGroupContent)(e)||(0,a.isNestableContent)(e)||(0,l.isUIDContent)(e)||(0,r.isSlicesContent)(e),t.WidgetLegacy=e=>({decode(t){if(!e.fieldType)return;let n=(()=>{switch(e.fieldType){case"UID":return(0,l.UIDLegacy)(e);case"Group":return(0,o.GroupLegacy)(e);case"Choice":case"Slices":return(0,r.SlicesLegacy)(e);default:return(0,a.NestableLegacy)(e)}})();if(n)return n.decode(t)},encode(t){switch(t.__TYPE__){case l.UIDContentType:return(0,l.UIDLegacy)(e).encode(t);case o.GroupContentType:return(0,o.GroupLegacy)(e).encode(t);case r.SlicesContentType:return(0,r.SlicesLegacy)(e).encode(t);default:return(0,a.NestableLegacy)(e).encode(t)}}})},82956:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let i=n(22970);(0,i.__exportStar)(n(54175),t),(0,i.__exportStar)(n(35792),t),(0,i.__exportStar)(n(69732),t),(0,i.__exportStar)(n(6869),t),(0,i.__exportStar)(n(86901),t),(0,i.__exportStar)(n(18268),t)},58021:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BooleanContentDefaultValue=t.BooleanContent=t.BooleanLegacy=t.isBooleanContent=t.BooleanContentType=void 0;let i=n(22970),o=n(76160),a=n(30902),r=(0,i.__importStar)(n(32521)),l=n(3441);t.BooleanContentType="BooleanContent",t.isBooleanContent=e=>(0,l.hasContentType)(e)&&e.__TYPE__===t.BooleanContentType,t.BooleanLegacy=e=>new r.Type("BooleanLegacy",t.isBooleanContent,e=>(0,a.pipe)(r.boolean.decode(e),o.either.map(e=>t.BooleanContent.encode({value:e,__TYPE__:t.BooleanContentType}))),t=>({content:t.value,types:{[e.keyOfType]:"Boolean"}})),t.BooleanContent=r.strict({__TYPE__:r.literal(t.BooleanContentType),value:r.boolean}),t.BooleanContentDefaultValue=e=>{var n;return(null===(n=e.config)||void 0===n?void 0:n.default_value)!==void 0?{__TYPE__:t.BooleanContentType,value:e.config.default_value||!1}:void 0}},92611:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EmbedContent=t.EmbedLegacy=t.EmbedContentLegacy=t.isEmbedContent=t.EmbedContentType=void 0;let i=n(22970),o=n(76160),a=n(30902),r=(0,i.__importStar)(n(32521)),l=n(10082),c=n(3441);t.EmbedContentType="EmbedContent",t.isEmbedContent=e=>(0,c.hasContentType)(e)&&e.__TYPE__===t.EmbedContentType,t.EmbedContentLegacy=r.exact(r.intersection([r.type({embed_url:r.string,type:r.string}),r.partial({version:r.union([r.string,r.number,r.null]),title:l.StringOrNull,author_name:l.StringOrNull,author_url:l.StringOrNull,provider_name:l.StringOrNull,provider_url:l.StringOrNull,cache_age:r.union([r.string,r.number,r.null]),thumbnail_url:l.StringOrNull,thumbnail_width:l.NumberOrNull,thumbnail_height:l.NumberOrNull,html:l.StringOrNull})])),t.EmbedLegacy=e=>new r.Type("EmbedLegacy",t.isEmbedContent,e=>(0,a.pipe)(t.EmbedContentLegacy.decode(e),o.either.map(n=>({...n,all:e,__TYPE__:t.EmbedContentType}))),t=>({content:t.all,types:{[e.keyOfType]:"Embed"}})),t.EmbedContent=r.intersection([t.EmbedContentLegacy,r.strict({__TYPE__:r.literal(t.EmbedContentType),all:r.unknown})])},28043:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContent=t.ColorLegacy=t.isColorContent=void 0;let i=n(22970),o=n(76160),a=n(30902),r=(0,i.__importStar)(n(32521)),l=n(59050),c=(0,i.__importDefault)(n(93662)),p=n(3441),d=n(1876);t.isColorContent=e=>(0,p.hasContentType)(e)&&e.__TYPE__===d.FieldContentType&&(0,p.hasFieldContentType)(e)&&"Color"===e.type,t.ColorLegacy=e=>new r.Type("ColorLegacy",t.isColorContent,e=>(0,a.pipe)(c.default.decode(e),o.either.map(e=>t.ColorContent.encode({value:e,type:l.ColorFieldType,__TYPE__:d.FieldContentType}))),t=>({content:t.value,types:{[e.keyOfType]:l.ColorFieldType}})),t.ColorContent=r.strict({type:r.literal(l.ColorFieldType),value:c.default,__TYPE__:r.literal(d.FieldContentType)})},87029:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DateContent=t.DateLegacy=t.isDateContent=void 0;let i=n(22970),o=n(76160),a=n(30902),r=(0,i.__importStar)(n(32521)),l=n(59050),c=(0,i.__importDefault)(n(93662)),p=n(3441),d=n(1876);t.isDateContent=e=>(0,p.hasContentType)(e)&&e.__TYPE__===d.FieldContentType&&(0,p.hasFieldContentType)(e)&&"Date"===e.type,t.DateLegacy=e=>new r.Type("DateLegacy",t.isDateContent,e=>(0,a.pipe)(c.default.decode(e),o.either.map(e=>t.DateContent.encode({value:e,type:l.DateFieldType,__TYPE__:d.FieldContentType}))),t=>({content:t.value,types:{[e.keyOfType]:l.DateFieldType}})),t.DateContent=r.strict({type:r.literal(l.DateFieldType),value:c.default,__TYPE__:r.literal(d.FieldContentType)})},10473:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NumberContent=t.NumberLegacy=t.isNumberContent=void 0;let i=n(22970),o=n(76160),a=n(30902),r=(0,i.__importStar)(n(32521)),l=n(59050),c=(0,i.__importDefault)(n(93662)),p=n(3441),d=n(1876);t.isNumberContent=e=>(0,p.hasContentType)(e)&&e.__TYPE__===d.FieldContentType&&(0,p.hasFieldContentType)(e)&&"Number"===e.type,t.NumberLegacy=e=>new r.Type("NumberLegacy",t.isNumberContent,e=>(0,a.pipe)(c.default.decode(e),o.either.map(e=>t.NumberContent.encode({value:e,type:l.NumberFieldType,__TYPE__:d.FieldContentType}))),t=>({content:t.value,types:{[e.keyOfType]:l.NumberFieldType}})),t.NumberContent=r.strict({type:r.literal(l.NumberFieldType),value:c.default,__TYPE__:r.literal(d.FieldContentType)})},21576:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RangeContent=t.RangeLegacy=t.isRangeContent=void 0;let i=n(22970),o=n(76160),a=n(30902),r=(0,i.__importStar)(n(32521)),l=n(59050),c=(0,i.__importDefault)(n(93662)),p=n(3441),d=n(1876);t.isRangeContent=e=>(0,p.hasContentType)(e)&&e.__TYPE__===d.FieldContentType&&(0,p.hasFieldContentType)(e)&&"Range"===e.type,t.RangeLegacy=e=>new r.Type("RangeLegacy",t.isRangeContent,e=>(0,a.pipe)(c.default.decode(e),o.either.map(e=>t.RangeContent.encode({value:e,type:l.RangeFieldType,__TYPE__:d.FieldContentType}))),t=>({content:t.value,types:{[e.keyOfType]:l.RangeFieldType}})),t.RangeContent=r.strict({type:r.literal(l.RangeFieldType),value:c.default,__TYPE__:r.literal(d.FieldContentType)})},62145:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SelectContentDefaultValue=t.SelectContent=t.SelectLegacy=t.isSelectContent=void 0;let i=n(22970),o=n(76160),a=n(30902),r=(0,i.__importStar)(n(32521)),l=n(59050),c=(0,i.__importDefault)(n(93662)),p=n(3441),d=n(1876);t.isSelectContent=e=>(0,p.hasContentType)(e)&&e.__TYPE__===d.FieldContentType&&(0,p.hasFieldContentType)(e)&&"Select"===e.type,t.SelectLegacy=e=>new r.Type("SelectLegacy",t.isSelectContent,e=>(0,a.pipe)(c.default.decode(e),o.either.map(e=>t.SelectContent.encode({value:e,type:l.SelectFieldType,__TYPE__:d.FieldContentType}))),t=>({content:t.value,types:{[e.keyOfType]:l.SelectFieldType}})),t.SelectContent=r.strict({type:r.literal(l.SelectFieldType),value:c.default,__TYPE__:r.literal(d.FieldContentType)}),t.SelectContentDefaultValue=e=>{var t;return(null===(t=e.config)||void 0===t?void 0:t.default_value)?{__TYPE__:d.FieldContentType,type:l.SelectFieldType,value:e.config.default_value||""}:void 0}},51008:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TextContent=t.TextLegacy=t.isTextContent=void 0;let i=n(22970),o=n(76160),a=n(30902),r=(0,i.__importStar)(n(32521)),l=n(59050),c=(0,i.__importDefault)(n(93662)),p=n(3441),d=n(1876);t.isTextContent=e=>(0,p.hasContentType)(e)&&e.__TYPE__===d.FieldContentType&&(0,p.hasFieldContentType)(e)&&"Text"===e.type,t.TextLegacy=e=>new r.Type("TextLegacy",t.isTextContent,e=>(0,a.pipe)(c.default.decode(e),o.either.map(e=>t.TextContent.encode({value:e,type:l.TextFieldType,__TYPE__:d.FieldContentType}))),t=>({content:t.value,types:{[e.keyOfType]:l.TextFieldType}})),t.TextContent=r.strict({type:r.literal(l.TextFieldType),value:c.default,__TYPE__:r.literal(d.FieldContentType)})},47286:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TimestampContent=t.TimestampLegacy=t.isTimestampContent=void 0;let i=n(22970),o=n(76160),a=n(30902),r=(0,i.__importStar)(n(32521)),l=n(59050),c=(0,i.__importDefault)(n(93662)),p=n(3441),d=n(1876);t.isTimestampContent=e=>(0,p.hasContentType)(e)&&e.__TYPE__===d.FieldContentType&&(0,p.hasFieldContentType)(e)&&"Timestamp"===e.type,t.TimestampLegacy=e=>new r.Type("TimestampLegacy",t.isTimestampContent,e=>(0,a.pipe)(c.default.decode(e),o.either.map(e=>t.TimestampContent.encode({value:e,type:l.TimestampFieldType,__TYPE__:d.FieldContentType}))),t=>({content:t.value,types:{[e.keyOfType]:l.TimestampFieldType}})),t.TimestampContent=r.strict({type:r.literal(l.TimestampFieldType),value:c.default,__TYPE__:r.literal(d.FieldContentType)})},1876:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FieldContentType=void 0,t.FieldContentType="FieldContent"},51711:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FieldContent=t.FieldType=void 0;let i=n(22970),o=(0,i.__importStar)(n(32521)),a=n(28043),r=n(87029),l=n(10473),c=n(21576),p=n(62145),d=n(51008),u=n(47286);t.FieldType=o.keyof({Text:null,Date:null,Timestamp:null,Color:null,Number:null,Range:null,Select:null}),t.FieldContent=o.union([r.DateContent,a.ColorContent,l.NumberContent,c.RangeContent,p.SelectContent,d.TextContent,u.TimestampContent]),(0,i.__exportStar)(n(28043),t),(0,i.__exportStar)(n(1876),t),(0,i.__exportStar)(n(87029),t),(0,i.__exportStar)(n(10473),t),(0,i.__exportStar)(n(21576),t),(0,i.__exportStar)(n(62145),t),(0,i.__exportStar)(n(51008),t),(0,i.__exportStar)(n(47286),t)},95110:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GeoPointContent=t.GeoPointLegacy=t.isGeoPointContent=t.GeoPointContentType=void 0;let i=n(22970),o=n(76160),a=n(3735),r=(0,i.__importStar)(n(32521)),l=n(3441);t.GeoPointContentType="GeoPointContent",t.isGeoPointContent=e=>(0,l.hasContentType)(e)&&e.__TYPE__===t.GeoPointContentType;let c=r.strict({position:r.strict({lat:r.number,lng:r.number})});t.GeoPointLegacy=e=>new r.Type("GeoPointLegacy",t.isGeoPointContent,e=>(0,a.pipe)(c.decode(e),o.either.map(e=>t.GeoPointContent.encode({...e,__TYPE__:t.GeoPointContentType}))),t=>({content:{position:t.position},types:{[e.keyOfType]:"GeoPoint"}})),t.GeoPointContent=r.intersection([c,r.strict({__TYPE__:r.literal(t.GeoPointContentType)})])},19729:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ImageContent=t.ImageLegacy=t.ImageContentView=t.isImageContent=t.ImageContentType=void 0;let i=n(22970),o=n(76160),a=n(30902),r=(0,i.__importStar)(n(32521)),l=n(46898),c=n(10082),p=n(3441);t.ImageContentType="ImageContent",t.isImageContent=e=>(0,p.hasContentType)(e)&&e.__TYPE__===t.ImageContentType;let d=r.exact(r.type({id:r.string,url:r.string,width:r.number,height:r.number}));t.ImageContentView=r.exact(r.intersection([r.type({origin:d,width:r.number,height:r.number,edit:r.type({zoom:r.number,crop:r.type({x:r.number,y:r.number}),background:r.string})}),r.partial({url:r.string,credits:c.NonEmptyStringOrNull,alt:c.NonEmptyStringOrNull,provider:c.StringOrNull})]));let u=r.intersection([t.ImageContentView,r.partial({thumbnails:r.record(r.string,t.ImageContentView)})]);t.ImageLegacy=e=>new r.Type("ImageLegacy",t.isImageContent,e=>(0,a.pipe)(u.decode(e),o.either.map(e=>t.ImageContent.encode({...e,__TYPE__:t.ImageContentType}))),t=>({content:(0,l.withOptionals)({edit:t.edit,height:t.height,origin:t.origin,width:t.width},[["alt",t.alt],["credits",t.credits],["provider",t.provider],["thumbnails",t.thumbnails],["url",t.url]]),types:{[e.keyOfType]:"Image"}})),t.ImageContent=r.intersection([u,r.strict({__TYPE__:r.literal(t.ImageContentType)})])},14506:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IntegrationFieldContent=t.IntegrationFieldLegacy=t.isIntegrationFieldContent=t.IntegrationFieldContentType=void 0;let i=n(22970),o=n(76160),a=n(30902),r=(0,i.__importStar)(n(32521)),l=n(3441);t.IntegrationFieldContentType="IntegrationFieldsContent",t.isIntegrationFieldContent=e=>(0,l.hasContentType)(e)&&e.__TYPE__===t.IntegrationFieldContentType,t.IntegrationFieldLegacy=e=>new r.Type("IntegrationFieldLegacy",t.isIntegrationFieldContent,e=>(0,a.pipe)(r.string.decode(e),o.either.map(e=>t.IntegrationFieldContent.encode({value:e,__TYPE__:t.IntegrationFieldContentType}))),t=>({content:t.value,types:{[e.keyOfType]:"IntegrationFields"}})),t.IntegrationFieldContent=r.strict({__TYPE__:r.literal(t.IntegrationFieldContentType),value:r.string})},70451:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FilledLinkContent=t.FilledLink=t.FilledLinkContentLegacy=t.FilledLinkLegacy=t.isFilledLinkContent=t.LinkContent=t.Link=t.LinkContentLegacy=t.LinkLegacy=t.isLinkContent=t.LinkContentType=t.AnyLinkContent=t.AnyLinkType=t.ExternalLinkContent=t.FilledExternalLinkContent=t.ExternalLinkType=t.DocumentLinkContent=t.FilledDocumentLinkContent=t.DocumentLinkType=t.MediaLinkContent=t.MediaLinkType=t.FileLinkContent=t.FilledFileLinkContent=t.FileLinkType=t.ImageLinkContent=t.FilledImageLinkContent=t.ImageLinkType=void 0;let i=n(22970),o=n(76160),a=n(30902),r=(0,i.__importStar)(n(32521)),l=n(7862),c=n(10082),p=n(61365),d=n(3441);t.ImageLinkType="ImageLink";let u=e=>"string"==typeof e,s=new r.Type("ImageLinkKind",e=>u(e),(e,t)=>u(e)?r.success("image"):r.failure(e,t),()=>"image"),y=r.intersection([r.strict({kind:s,id:r.string,url:r.string,height:r.string,width:r.string,size:r.string,name:r.string}),r.exact(r.partial({date:c.StringOrNull}))]),_=new r.Type("FilledImageLink",e=>(0,d.hasContentType)(e)&&e.__TYPE__===t.ImageLinkType,e=>(0,a.pipe)(y.decode(e),o.either.map(e=>t.FilledImageLinkContent.encode({...e,__TYPE__:t.ImageLinkType}))),e=>y.encode(e));t.FilledImageLinkContent=r.intersection([r.strict({__TYPE__:r.literal(t.ImageLinkType)}),y]);let C=r.intersection([r.union([y,r.strict({kind:r.literal("image")})]),r.exact(r.partial({text:r.string,variant:r.string}))]),T=new r.Type("ImageLink",e=>(0,d.hasContentType)(e)&&e.__TYPE__===t.ImageLinkType,e=>(0,a.pipe)(C.decode(e),o.either.map(e=>t.ImageLinkContent.encode({...e,__TYPE__:t.ImageLinkType}))),e=>C.encode(e));t.ImageLinkContent=r.intersection([r.strict({__TYPE__:r.literal(t.ImageLinkType)}),C]),t.FileLinkType="FileLink";let m=e=>"string"==typeof e,g=new r.Type("FileLinkKind",e=>m(e),(e,t)=>m(e)?r.success("file"):r.failure(e,t),()=>"file"),S=r.exact(r.intersection([r.type({kind:g,id:r.string,url:r.string,name:r.string,size:(0,l.withFallback)(r.string,"0")}),r.partial({date:c.StringOrNull})])),v=new r.Type("FilledFileLink",e=>(0,d.hasContentType)(e)&&e.__TYPE__===t.FileLinkType,e=>(0,a.pipe)(S.decode(e),o.either.map(e=>t.FilledFileLinkContent.encode({...e,__TYPE__:t.FileLinkType}))),e=>S.encode(e));t.FilledFileLinkContent=r.intersection([r.strict({__TYPE__:r.literal(t.FileLinkType)}),S]);let L=r.intersection([r.union([S,r.strict({kind:r.literal("file")})]),r.exact(r.partial({text:r.string,variant:r.string}))]),f=new r.Type("FileLink",e=>(0,d.hasContentType)(e)&&e.__TYPE__===t.FileLinkType,e=>(0,a.pipe)(L.decode(e),o.either.map(e=>t.FileLinkContent.encode({...e,__TYPE__:t.FileLinkType}))),e=>L.encode(e));t.FileLinkContent=r.intersection([r.strict({__TYPE__:r.literal(t.FileLinkType)}),L]),t.MediaLinkType="MediaLink";let h=r.intersection([r.strict({kind:r.literal("media")}),r.exact(r.partial({text:r.string,variant:r.string}))]),b=new r.Type("MediaLink",e=>(0,d.hasContentType)(e)&&e.__TYPE__===t.MediaLinkType,e=>(0,a.pipe)(h.decode(e),o.either.map(e=>t.MediaLinkContent.encode({...e,__TYPE__:t.MediaLinkType}))),e=>h.encode(e));t.MediaLinkContent=r.intersection([r.strict({__TYPE__:r.literal(t.MediaLinkType)}),h]),t.DocumentLinkType="DocumentLink";let k=r.strict({id:c.NonEmptyString}),P=new r.Type("FilledDocumentLink",e=>(0,d.hasContentType)(e)&&e.__TYPE__===t.DocumentLinkType,e=>(0,a.pipe)(k.decode(e),o.either.map(e=>t.FilledDocumentLinkContent.encode({...e,__TYPE__:t.DocumentLinkType}))),e=>k.encode(e));t.FilledDocumentLinkContent=r.intersection([r.strict({__TYPE__:r.literal(t.DocumentLinkType)}),k]);let E=r.intersection([r.union([k,r.strict({kind:r.literal("document")})]),r.exact(r.partial({text:r.string,variant:r.string}))]),x=new r.Type("DocumentLink",e=>(0,d.hasContentType)(e)&&e.__TYPE__===t.DocumentLinkType,e=>(0,a.pipe)(E.decode(e),o.either.map(e=>t.DocumentLinkContent.encode({...e,__TYPE__:t.DocumentLinkType}))),e=>E.encode(e));t.DocumentLinkContent=r.intersection([r.strict({__TYPE__:r.literal(t.DocumentLinkType)}),E]),t.ExternalLinkType="ExternalLink";let I=r.exact(r.intersection([r.type({url:r.string}),r.partial({kind:r.literal("web"),target:c.StringOrNull,preview:(0,p.nullable)(r.partial({title:r.string}))})])),F=new r.Type("FilledExternalLink",e=>(0,d.hasContentType)(e)&&e.__TYPE__===t.ExternalLinkType,e=>(0,a.pipe)(I.decode(e),o.either.map(e=>t.FilledExternalLinkContent.encode({...e,__TYPE__:t.ExternalLinkType}))),e=>I.encode(e));t.FilledExternalLinkContent=r.intersection([r.strict({__TYPE__:r.literal(t.ExternalLinkType)}),I]);let w=r.intersection([r.union([I,r.strict({kind:r.literal("web")})]),r.exact(r.partial({text:r.string,variant:r.string}))]),Y=new r.Type("ExternalLink",e=>(0,d.hasContentType)(e)&&e.__TYPE__===t.ExternalLinkType,e=>(0,a.pipe)(w.decode(e),o.either.map(e=>t.ExternalLinkContent.encode({...e,__TYPE__:t.ExternalLinkType}))),e=>w.encode(e));t.ExternalLinkContent=r.intersection([r.strict({__TYPE__:r.literal(t.ExternalLinkType)}),w]),t.AnyLinkType="AnyLink";let D=r.exact(r.intersection([r.type({kind:(0,l.withFallback)(r.literal("any"),"any")}),r.partial({text:r.string,variant:r.string})])),N=new r.Type("AnyLink",e=>(0,d.hasContentType)(e)&&e.__TYPE__===t.AnyLinkType,e=>(0,a.pipe)(D.decode(e),o.either.map(e=>t.AnyLinkContent.encode({...e,__TYPE__:t.AnyLinkType}))),e=>D.encode(e));t.AnyLinkContent=r.intersection([r.strict({__TYPE__:r.literal(t.AnyLinkType)}),D]),t.LinkContentType="LinkContent",t.isLinkContent=e=>(0,d.hasContentType)(e)&&e.__TYPE__===t.LinkContentType,t.LinkLegacy=(0,d.withKey)(r.union([T,f,x,Y,b,N])),t.LinkContentLegacy=e=>new r.Type("LinkLegacy",t.isLinkContent,e=>(0,a.pipe)(t.LinkLegacy.decode(e),o.either.map(({key:e,...n})=>t.LinkContent.encode({__TYPE__:"LinkContent",key:e,value:n}))),({key:n,value:i})=>({content:t.LinkLegacy.encode({...i,key:n}),types:{[e.keyOfType]:"Link"}})),t.Link=r.union([t.ImageLinkContent,t.FileLinkContent,t.DocumentLinkContent,t.ExternalLinkContent,t.MediaLinkContent,t.AnyLinkContent]),t.LinkContent=(0,d.withKey)(r.strict({__TYPE__:r.literal(t.LinkContentType),value:t.Link})),t.isFilledLinkContent=e=>(0,d.hasContentType)(e)&&e.__TYPE__===t.LinkContentType,t.FilledLinkLegacy=r.union([_,v,P,F]),t.FilledLinkContentLegacy=e=>{let n=(0,d.withKey)(t.FilledLinkLegacy);return new r.Type("FilledLinkLegacy",t.isFilledLinkContent,e=>(0,a.pipe)(n.decode(e),o.either.map(({key:e,...n})=>t.FilledLinkContent.encode({__TYPE__:"LinkContent",key:e,value:n}))),({key:t,value:i})=>({content:n.encode({...i,key:t}),types:{[e.keyOfType]:"Link"}}))},t.FilledLink=r.union([t.FilledImageLinkContent,t.FilledFileLinkContent,t.FilledDocumentLinkContent,t.FilledExternalLinkContent]),t.FilledLinkContent=(0,d.withKey)(r.strict({__TYPE__:r.literal(t.LinkContentType),value:t.FilledLink}))},60882:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NestableLegacy=t.isNestableContent=t.NestableContentDefaultValue=t.NestableContent=void 0;let i=n(22970),o=n(45974),a=(0,i.__importStar)(n(32521)),r=n(54175),l=n(58021),c=n(92611),p=n(51711),d=n(1876),u=n(95110),s=n(19729),y=n(14506),_=n(70451),C=n(97798),T=n(13656),m=n(9746),g=n(43940);t.NestableContent=a.union([r.EmptyContent,l.BooleanContent,c.EmbedContent,p.TextContent,p.TimestampContent,p.SelectContent,p.RangeContent,p.NumberContent,p.DateContent,p.ColorContent,u.GeoPointContent,s.ImageContent,y.IntegrationFieldContent,_.LinkContent,T.RichTextContent,m.SeparatorContent,g.TableContent,C.RepeatableContent]),t.NestableContentDefaultValue=e=>{switch(e.type){case"Boolean":return(0,l.BooleanContentDefaultValue)(e);case"Select":return(0,p.SelectContentDefaultValue)(e);default:return}},t.isNestableContent=e=>(0,p.isTextContent)(e)||(0,p.isColorContent)(e)||(0,p.isDateContent)(e)||(0,p.isTimestampContent)(e)||(0,p.isNumberContent)(e)||(0,p.isRangeContent)(e)||(0,p.isSelectContent)(e)||(0,u.isGeoPointContent)(e)||(0,T.isRichTextContent)(e)||(0,l.isBooleanContent)(e)||(0,c.isEmbedContent)(e)||(0,s.isImageContent)(e)||(0,y.isIntegrationFieldContent)(e)||(0,_.isLinkContent)(e)||(0,m.isSeparatorContent)(e)||(0,g.isTableContent)(e)||(0,r.isEmptyContent)(e)||(0,C.isRepeatableContent)(e),t.NestableLegacy=e=>({decode(t){if(!e.fieldType)return;let n=(0,r.EmptyLegacy)(e.fieldType).decode(t);if((0,o.isRight)(n))return n;let i=(()=>{switch(e.fieldType){case"Text":return(0,p.TextLegacy)(e);case"Color":return(0,p.ColorLegacy)(e);case"Date":return(0,p.DateLegacy)(e);case"Timestamp":return(0,p.TimestampLegacy)(e);case"Number":return(0,p.NumberLegacy)(e);case"Range":return(0,p.RangeLegacy)(e);case"Select":return(0,p.SelectLegacy)(e);case"GeoPoint":return(0,u.GeoPointLegacy)(e);case"StructuredText":return(0,T.RichTextLegacy)(e);case"Boolean":return(0,l.BooleanLegacy)(e);case"Embed":return(0,c.EmbedLegacy)(e);case"Image":return(0,s.ImageLegacy)(e);case"IntegrationFields":return(0,y.IntegrationFieldLegacy)(e);case"Link":return(0,_.LinkContentLegacy)(e);case"Separator":return(0,m.SeparatorLegacy)(e);case"Table":return(0,g.TableLegacy)(e);case"Repeatable.Link":return(0,C.RepeatableLegacy)(e,"Link");default:return}})();if(i)return i.decode(t)},encode(t){switch(t.__TYPE__){case d.FieldContentType:if("Text"===t.type)return(0,p.TextLegacy)(e).encode(t);if("Color"===t.type)return(0,p.ColorLegacy)(e).encode(t);if("Range"===t.type)return(0,p.RangeLegacy)(e).encode(t);if("Date"===t.type)return(0,p.DateLegacy)(e).encode(t);if("Number"===t.type)return(0,p.NumberLegacy)(e).encode(t);if("Timestamp"===t.type)return(0,p.TimestampLegacy)(e).encode(t);if("Select"===t.type)return(0,p.SelectLegacy)(e).encode(t);return;case u.GeoPointContentType:return(0,u.GeoPointLegacy)(e).encode(t);case T.RichTextContentType:return(0,T.RichTextLegacy)(e).encode(t);case c.EmbedContentType:return(0,c.EmbedLegacy)(e).encode(t);case l.BooleanContentType:return(0,l.BooleanLegacy)(e).encode(t);case s.ImageContentType:return(0,s.ImageLegacy)(e).encode(t);case y.IntegrationFieldContentType:return(0,y.IntegrationFieldLegacy)(e).encode(t);case _.LinkContentType:return(0,_.LinkContentLegacy)(e).encode(t);case m.SeparatorContentType:return(0,m.SeparatorLegacy)(e).encode(t);case g.TableContentType:return(0,g.TableLegacy)(e).encode(t);case"RepeatableContent":return(0,C.RepeatableLegacy)(e,t.type).encode(t);default:return}}})},97798:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.traverseRepeatableContent=t.RepeatableLegacy=t.isRepeatableContent=t.RepeatableContent=void 0;let i=n(22970),o=n(76160),a=n(45974),r=n(30902),l=(0,i.__importStar)(n(32521)),c=n(3441),p=n(70451),d="RepeatableContent";t.RepeatableContent=l.strict({__TYPE__:l.literal(d),type:l.literal("Link"),value:l.array(p.LinkContent)}),t.isRepeatableContent=e=>(0,c.hasContentType)(e)&&e.__TYPE__===d,t.RepeatableLegacy=(e,n)=>new l.Type("RepeatableLegacy",t.isRepeatableContent,t=>(0,r.pipe)(l.array(l.unknown).decode(t),o.either.map(t=>({value:t.reduce((t,i)=>{let o;return"Link"===n&&(o=(0,p.LinkContentLegacy)(e).decode(i)),!o||(0,a.isLeft)(o)?t:[...t,o.right]},[]),type:n,__TYPE__:"RepeatableContent"}))),t=>({content:l.array(p.LinkContent).encode(t.value).reduce((t,n)=>{let i;return n.__TYPE__===p.LinkContentType&&(i=(0,p.LinkContentLegacy)(e).encode(n)),i?[...t,i]:t},[]).map(e=>e.content),types:{[e.keyOfType]:`Repeatable.${n}`}})),t.traverseRepeatableContent=function({path:e,key:t,apiId:n,model:i,content:o}){return a=>{let r=o.value.reduce((o,r,l)=>{let c=a({path:e.concat([{key:l.toString(),type:"Widget"}]),key:t,apiId:n,model:(null==i?void 0:i.type)==="Link"&&i.config?{...i,config:{...i.config,repeat:!1}}:i,content:r});return c&&(0,p.isLinkContent)(c)?o.concat(c):o},[]);return a({path:e,key:t,apiId:n,model:i,content:{__TYPE__:o.__TYPE__,type:o.type,value:r}})}}},76994:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Block=t.BlockLegacy=t.TextBlockLegacy=t.TextBlock=t.checkEmbedBlock=t.EmbedBlock=t.checkImageBlock=t.ImageBlock=t.ValidatedSpans=t.SpanLegacy=t.Span=void 0;let i=n(22970),o=n(76160),a=n(45974),r=n(30902),l=(0,i.__importStar)(n(32521)),c=n(7862),p=n(8199),d=n(10082),u=n(61365),s=n(92611),y=n(19729),_=n(70451),C=e=>l.strict({data:e,start:l.number,end:l.number,type:l.literal(p.RichTextNodeType.hyperlink)}),T=l.strict({data:(0,c.withFallback)(l.string,""),start:l.number,end:l.number,type:l.literal("label")}),m=l.strict({start:l.number,end:l.number,type:l.keyof({[p.RichTextNodeType.strong]:null,[p.RichTextNodeType.em]:null,"list-item":null})});t.Span=l.union([C(_.FilledLink),T,m]),t.SpanLegacy=l.union([C(_.FilledLinkLegacy),T,m]),t.ValidatedSpans=e=>new l.Type("ValidatedSpans",t=>Array.isArray(t)&&t.every(e.is),(t,n)=>{if(!Array.isArray(t))return l.failure(t,n);{let n=t.reduce((t,n)=>{let i=e.decode(n);return(0,a.isLeft)(i)?t:[...t,i.right]},[]).sort((e,t)=>e.start-t.start);return l.success(n)}},t=>t.reduce((t,n)=>[...t,e.encode(n)],[]));let g=e=>l.exact(l.intersection([l.type({type:l.literal(p.RichTextNodeType.image),data:l.intersection([y.ImageContentView,l.partial({linkTo:(0,u.nullable)(e)})])}),l.partial({label:d.StringOrNull,direction:d.StringOrNull})]));t.ImageBlock=g(_.FilledLink);let S=g(_.FilledLinkLegacy);t.checkImageBlock=function(e){return e.type===p.RichTextNodeType.image};let v=l.exact(l.intersection([l.type({type:l.literal(p.RichTextNodeType.embed),data:l.unknown}),l.partial({label:d.StringOrNull,direction:d.StringOrNull})])),L=new l.Type("EmbedBlockLegacy",e=>"embed"===e.type,e=>(0,r.pipe)(v.decode(e),o.either.chain(e=>o.either.map(t=>[e,t])(s.EmbedContentLegacy.decode(e.data))),o.either.map(([e,n])=>t.EmbedBlock.encode({...e,data:{...n,__TYPE__:s.EmbedContentType,all:e.data}}))),e=>({...v.encode(e),data:s.EmbedContentLegacy.encode(e.data)}));t.EmbedBlock=l.exact(l.intersection([l.type({type:l.literal(p.RichTextNodeType.embed),data:s.EmbedContent}),l.partial({label:d.StringOrNull,direction:d.StringOrNull})])),t.checkEmbedBlock=function(e){return e.type===p.RichTextNodeType.embed};let f=e=>l.exact(l.intersection([l.type({type:(0,u.refineType)(p.RichTextNodeTypeCodec,`string which isn't ${p.RichTextNodeType.image} ${p.RichTextNodeType.embed}`,e=>e!==p.RichTextNodeType.image&&e!==p.RichTextNodeType.embed),content:l.intersection([l.type({text:l.string}),l.partial({spans:(0,t.ValidatedSpans)(e)})])}),l.partial({label:l.string,direction:l.string})]));t.TextBlock=f(t.Span),t.TextBlockLegacy=f(t.SpanLegacy);let h=l.union([L,S,t.TextBlockLegacy]);t.BlockLegacy=new l.Type("BlockLegacy",e=>L.is(e)||S.is(e)||t.TextBlockLegacy.is(e),e=>h.decode(e),e=>t.ImageBlock.is(e)?S.encode(e):t.EmbedBlock.is(e)?L.encode(e):t.TextBlockLegacy.encode(e)),t.Block=l.union([t.ImageBlock,t.EmbedBlock,t.TextBlock])},13656:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RichTextLegacy=t.RichTextContent=t.RichTextLegacyContent=t.isRichTextContent=t.RichTextContentType=void 0;let i=n(22970),o=n(76160),a=n(30902),r=(0,i.__importStar)(n(32521)),l=n(3441),c=n(76994);t.RichTextContentType="StructuredTextContent",t.isRichTextContent=e=>(0,l.hasContentType)(e)&&e.__TYPE__===t.RichTextContentType,t.RichTextLegacyContent=r.array(c.BlockLegacy),t.RichTextContent=r.strict({__TYPE__:r.literal(t.RichTextContentType),value:r.array(c.Block)}),(0,i.__exportStar)(n(76994),t),t.RichTextLegacy=e=>new r.Type("RichTextLegacy",t.isRichTextContent,e=>(0,a.pipe)(t.RichTextLegacyContent.decode(e),o.either.map(e=>({value:e,__TYPE__:t.RichTextContentType}))),n=>({content:t.RichTextLegacyContent.encode(n.value),types:{[e.keyOfType]:"StructuredText"}}))},9746:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SeparatorContent=t.SeparatorLegacy=t.isSeparatorContent=t.SeparatorContentType=void 0;let i=(0,n(22970).__importStar)(n(32521)),o=n(3441);t.SeparatorContentType="SeparatorContent",t.isSeparatorContent=e=>(0,o.hasContentType)(e)&&e.__TYPE__===t.SeparatorContentType,t.SeparatorLegacy=e=>new i.Type("SeparatorLegacy",t.isSeparatorContent,()=>i.success(t.SeparatorContent.encode({__TYPE__:t.SeparatorContentType})),()=>({content:{},types:{[e.keyOfType]:"Separator"}})),t.SeparatorContent=i.strict({__TYPE__:i.literal(t.SeparatorContentType)})},43940:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.traverseTableContent=t.TableLegacy=t.TableContent=t.isTableContent=t.TableContentType=void 0;let i=n(22970),o=n(76160),a=n(30902),r=(0,i.__importStar)(n(32521)),l=n(88866),c=n(3441),p=n(13656);t.TableContentType="TableContent",t.isTableContent=e=>(0,c.hasContentType)(e)&&e.__TYPE__===t.TableContentType;let d=(0,c.withKey)(r.intersection([r.strict({type:r.union([r.literal("tableHeader"),r.literal("tableCell")]),content:p.RichTextContent}),r.exact(r.partial({columnWidth:r.number}))])),u=(0,c.withKey)(r.strict({type:r.literal("tableRow"),content:r.array(d)}));t.TableContent=r.strict({__TYPE__:r.literal(t.TableContentType),content:r.array(u)});let s=(0,c.withKey)(r.intersection([r.strict({type:r.union([r.literal("tableHeader"),r.literal("tableCell")]),content:p.RichTextLegacyContent}),r.exact(r.partial({columnWidth:r.number}))])),y=(0,c.withKey)(r.strict({type:r.literal("tableRow"),content:r.array(s)})),_=r.strict({content:r.array(y)});t.TableLegacy=e=>new r.Type("TableLegacy",t.isTableContent,e=>(0,a.pipe)(_.decode(e),o.either.map(e=>({__TYPE__:"TableContent",content:e.content.map(e=>({...e,content:e.content.map(e=>({...e,content:{__TYPE__:"StructuredTextContent",value:e.content}}))}))}))),t=>({content:_.encode({content:t.content.map(e=>({...e,content:e.content.map(e=>({...e,content:e.content.value}))}))}),types:{[e.keyOfType]:"Table"}})),t.traverseTableContent=function({path:e,key:t,apiId:n,model:i,content:o}){return a=>{let r=o.content.map((i,o)=>({...i,content:i.content.map((i,r)=>{let c=a({path:e.concat([{key:[o.toString(),r.toString()].join(","),type:"Widget"}]),key:t,apiId:n,model:l.TableCell,content:{__TYPE__:i.content.__TYPE__,value:i.content.value}})||{__TYPE__:"StructuredTextContent",value:[]};return{...i,content:c}})}));return a({path:e,key:t,apiId:n,model:i,content:{__TYPE__:o.__TYPE__,content:r}})}}},69732:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let i=n(22970);(0,i.__exportStar)(n(58021),t),(0,i.__exportStar)(n(92611),t),(0,i.__exportStar)(n(51711),t),(0,i.__exportStar)(n(95110),t),(0,i.__exportStar)(n(19729),t),(0,i.__exportStar)(n(14506),t),(0,i.__exportStar)(n(70451),t),(0,i.__exportStar)(n(60882),t),(0,i.__exportStar)(n(97798),t),(0,i.__exportStar)(n(13656),t),(0,i.__exportStar)(n(9746),t),(0,i.__exportStar)(n(43940),t)},77517:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.migrateCompositeSlice=t.traverseCompositeSliceContent=t.compositeSliceContentWithDefaultValues=t.CompositeSliceContent=t.CompositeSliceLegacy=t.isCompositeSliceContent=t.CompositeSliceContentType=void 0;let i=n(22970),o=n(76160),a=n(45974),r=n(30902),l=(0,i.__importStar)(n(32521)),c=n(75122),p=n(3441),d=n(35792),u=n(69732),s=n(29231),y=n(96279);t.CompositeSliceContentType="CompositeSliceContent",t.isCompositeSliceContent=e=>(0,p.hasContentType)(e)&&e.__TYPE__===t.CompositeSliceContentType;let _=l.exact(l.partial({repeat:l.array(l.unknown),"non-repeat":l.UnknownRecord}));t.CompositeSliceLegacy=e=>new l.Type("CompositeSliceLegacy",t.isCompositeSliceContent,n=>(0,r.pipe)(_.decode(n),o.either.map(n=>{let i=(()=>{let t=(0,c.getFieldCtx)("repeat",e),i=(0,y.RepeatableWidgetsLegacy)(t).decode(n.repeat);if(!(!i||(0,a.isLeft)(i)))return i.right})()||[];return{nonRepeat:Object.entries(n["non-repeat"]||{}).reduce((t,[n,i])=>{let o=(0,c.getFieldCtx)(n,e,["non-repeat"]);if(!o)return t;let r=(0,u.NestableLegacy)(o).decode(i);return!r||(0,a.isLeft)(r)?t:{...t,[n]:r.right}},{}),repeat:i,__TYPE__:t.CompositeSliceContentType}})),t=>{let n=Object.entries(t.nonRepeat).reduce((t,[n,i])=>{let o=(0,c.getFieldCtx)(n,e,["non-repeat"]),a=(0,u.NestableLegacy)(o).encode(i);return a?{content:{...t.content,[n]:a.content},types:{...t.types,...a.types}}:t},{content:{},types:{}}),i=(()=>{let n=(0,c.getFieldCtx)("repeat",e);return(0,y.RepeatableWidgetsLegacy)(n).encode(t.repeat)})()||[];return{content:{"non-repeat":n.content,repeat:i.map(e=>e.content)},types:{[e.keyOfType]:"Slice",...n.types,...i.reduce((e,t)=>({...e,...t.types}),{})}}}),t.CompositeSliceContent=l.strict({__TYPE__:l.literal(t.CompositeSliceContentType),nonRepeat:l.record(l.string,u.NestableContent),repeat:y.RepeatableWidgets}),t.compositeSliceContentWithDefaultValues=function(e,t){var n,i;let o=(0,s.withDefaultNestableContentValues)(null!==(n=e["non-repeat"])&&void 0!==n?n:{},t.nonRepeat),a=(0,s.repeatableContentWithDefaultNestableContentValues)(null!==(i=e.repeat)&&void 0!==i?i:{},t.repeat);return{...t,nonRepeat:o,repeat:a}},t.traverseCompositeSliceContent=function({path:e,sliceKey:t,sliceName:n,model:i,content:o}){return(a,r)=>{let l=Object.entries(o.widget.nonRepeat).reduce((o,[r,l])=>{var c,p,d;let s=(null==i?void 0:i.type)==="SharedSlice"?null===(p=null===(c=null==i?void 0:i.fields)||void 0===c?void 0:c.primary)||void 0===p?void 0:p[r]:null===(d=null==i?void 0:i["non-repeat"])||void 0===d?void 0:d[r],y=a({path:e.concat([{key:"non-repeat",type:"primary"},{key:r,type:"Widget"}]),key:r,apiId:n,model:s,content:l});return y?(0,u.isNestableContent)(y)?{...o,[r]:y}:(console.warn(`Warn: Non nestable content with key [${r}] detected in a composite slice [${n}] with key [${t}]`),o):o},{}),c=(0,d.traverseGroupItemsContent)({path:e.concat([{key:"repeat",type:"items"}]),model:(null==i?void 0:i.type)==="SharedSlice"?null==i?void 0:i.fields.items:null==i?void 0:i.repeat,content:o.widget.repeat})(a);return r({key:t,apiId:n,path:e,model:i,content:{...o,widget:{__TYPE__:"CompositeSliceContent",repeat:c,nonRepeat:l}}})}},t.migrateCompositeSlice=function(e,t){let[,n]=t.key.split("$");return{key:`${e.sliceName}$${n}`,name:e.sliceName,maybeLabel:t.maybeLabel,widget:{__TYPE__:"SharedSliceContent",variation:e.variationId,primary:Object.entries(t.widget.nonRepeat).reduce((n,[i,o])=>{var a;return(null===(a=e.fields.primary)||void 0===a?void 0:a[i])?{...n,[i]:o}:(console.warn(`The widget ${i} in the non-repeat zone of the composite slice [${e.sliceName}] with key [${t.key}] doesn't exist in the model.`),n)},{}),items:t.widget.repeat.map(n=>({__TYPE__:"GroupItemContent",value:n.value.reduce((n,[i,o])=>{var a;return(null===(a=e.fields.items)||void 0===a?void 0:a[i])?n.concat([[i,o]]):(console.warn(`The widget ${i} in the repeat zone of the composite slice [${e.sliceName}] with key [${t.key}] doesn't exist in the model.`),n)},[])}),[])}}}},96279:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RepeatableWidgets=t.RepeatableWidgetsLegacy=void 0;let i=(0,n(22970).__importStar)(n(32521)),o=n(35792),a=n(69732);t.RepeatableWidgetsLegacy=e=>i.array((0,o.GroupItemLegacy)(e));let r=i.tuple([i.string,i.union([a.NestableContent,o.GroupContent])]),l=i.strict({__TYPE__:i.literal(o.GroupItemContentType),value:i.array(r)});t.RepeatableWidgets=i.array(l)},90848:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.traverseSharedSliceContent=t.sharedSliceContentWithDefaultValues=t.SharedSliceContent=t.SharedSliceLegacy=t.isSharedSliceContent=t.SharedSliceContentType=void 0;let i=n(22970),o=n(76160),a=n(45974),r=n(30902),l=(0,i.__importStar)(n(32521)),c=n(7862),p=n(88866),d=n(75122),u=n(3441),s=n(35792),y=n(69732),_=n(29231),C=n(96279),T=n(95305);t.SharedSliceContentType="SharedSliceContent",t.isSharedSliceContent=e=>(0,u.hasContentType)(e)&&e.__TYPE__===t.SharedSliceContentType;let m=l.exact(l.type({variation:l.string,items:(0,c.withFallback)(l.array(l.unknown),[]),primary:(0,c.withFallback)(l.UnknownRecord,{})}));t.SharedSliceLegacy=e=>new l.Type("SharedSliceLegacy",t.isSharedSliceContent,n=>(0,r.pipe)(m.decode(n),o.either.map(n=>{let i=(()=>{let t=(0,d.getFieldCtx)("items",e,["variations",n.variation]),i=(0,C.RepeatableWidgetsLegacy)(t).decode(n.items);if(!(!i||(0,a.isLeft)(i)))return i.right})()||[],o=Object.entries(n.primary).reduce((t,[i,o])=>{let r=(0,d.getFieldCtx)(i,e,["variations",n.variation,"primary"]),l=(0,T.SlicePrimaryLegacy)(r).decode(o);return!l||(0,a.isLeft)(l)?t:{...t,[i]:l.right}},{});return{variation:n.variation,primary:o,items:i,__TYPE__:t.SharedSliceContentType}})),t=>{let n=Object.entries(t.primary).reduce((n,[i,o])=>{let a=(0,d.getFieldCtx)(i,e,["variations",t.variation,"primary"]),r=(0,T.SlicePrimaryLegacy)(a).encode(o);return r?{content:{...n.content,[i]:r.content},types:{...n.types,...r.types}}:n},{content:{},types:{}}),i=(()=>{let n=(0,d.getFieldCtx)("items",e,["variations",t.variation]);return(0,C.RepeatableWidgetsLegacy)(n).encode(t.items)})()||[];return{content:{primary:n.content,items:i.map(e=>e.content),variation:t.variation},types:{[e.keyOfType]:"SharedSlice",...n.types,...i.reduce((e,t)=>({...e,...t.types}),{})}}}),t.SharedSliceContent=l.strict({__TYPE__:l.literal(t.SharedSliceContentType),variation:l.string,primary:l.record(l.string,T.SlicePrimaryContent),items:C.RepeatableWidgets}),t.sharedSliceContentWithDefaultValues=function(e,t){var n,i;let o=e.variations.find(e=>e.id===t.variation),a=null!==(n=null==o?void 0:o.primary)&&void 0!==n?n:{},r=null!==(i=null==o?void 0:o.items)&&void 0!==i?i:{},l=(0,_.withDefaultSlicePrimaryContentValues)(a,t.primary),c=(0,_.repeatableContentWithDefaultNestableContentValues)(r,t.items);return{...t,primary:l,items:c}},t.traverseSharedSliceContent=function({path:e,sliceKey:t,sliceName:n,model:i,content:o}){return(a,r)=>{let l=Object.entries(o.widget.primary).reduce((o,[r,l])=>{var c,d;let u=null===(d=null===(c=null==i?void 0:i.fields)||void 0===c?void 0:c.primary)||void 0===d?void 0:d[r],_=(0,s.isGroupContent)(l)?(0,s.traverseGroupContent)({path:e.concat([{key:"primary",type:"primary"},{key:r,type:"Widget"}]),key:r,apiId:r,content:l,model:(null==u?void 0:u.type)===p.GroupFieldType?u:void 0})(a):(0,y.isRepeatableContent)(l)?(0,y.traverseRepeatableContent)({path:e.concat([{key:"primary",type:"primary"},{key:r,type:"Widget"}]),key:r,apiId:r,content:l,model:(null==u?void 0:u.type)==="Link"?u:void 0})(a):(0,y.isTableContent)(l)?(0,y.traverseTableContent)({path:e.concat([{key:"primary",type:"primary"},{key:r,type:"Widget"}]),key:r,apiId:r,content:l,model:(null==u?void 0:u.type)==="Table"?u:void 0})(a):(0,y.isNestableContent)(l)?a({path:e.concat([{key:"primary",type:"primary"},{key:r,type:"Widget"}]),key:r,apiId:r,model:u,content:l}):void 0;return _?((0,T.isSlicePrimaryContent)(_)||console.warn(`Warn: Non nestable or group content with key [${r}] detected in a shared slice [${n}] with key [${t}]`),{...o,[r]:_}):o},{}),c=(0,s.traverseGroupItemsContent)({path:e.concat([{key:"items",type:"items"}]),model:null==i?void 0:i.fields.items,content:o.widget.items})(a);return r({key:t,apiId:n,path:e,model:i,content:{...o,widget:{__TYPE__:"SharedSliceContent",variation:o.widget.variation,primary:l,items:c}}})}}},56710:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.migrateSimpleSlice=t.traverseSimpleSliceContent=t.SimpleSliceLegacy=t.isSimpleSliceContent=t.SimpleSliceContent=void 0;let i=(0,n(22970).__importStar)(n(32521)),o=n(35792),a=n(69732);t.SimpleSliceContent=i.union([a.NestableContent,o.GroupContent]),t.isSimpleSliceContent=e=>(0,a.isNestableContent)(e)||(0,o.isGroupContent)(e),t.SimpleSliceLegacy=e=>({decode:"Group"===e.fieldType?(0,o.GroupLegacy)(e).decode.bind(null):(0,a.NestableLegacy)(e).decode.bind(null),encode:t=>"GroupContentType"===t.__TYPE__?(0,o.GroupLegacy)(e).encode(t):(0,a.NestableLegacy)(e).encode(t)}),t.traverseSimpleSliceContent=function({path:e,sliceKey:t,sliceName:n,model:i,content:a}){return(r,l)=>{var c;if((0,o.isGroupContent)(a.widget)){let t=(0,o.traverseGroupContent)({path:e,key:a.key,apiId:a.name,model:(null==i?void 0:i.type)==="Group"?i:(null==i?void 0:i.type)==="SharedSlice"?{type:"Group",config:{fields:i.fields.items||{}}}:void 0,content:a.widget})(r);return t&&l({key:a.key,apiId:a.name,path:e,model:i,content:{...a,widget:t}})}let p=r({key:a.key,apiId:a.name,path:e,model:(null==i?void 0:i.type)==="SharedSlice"?null===(c=i.fields.primary)||void 0===c?void 0:c[a.name]:(null==i?void 0:i.type)!=="Group"?i:void 0,content:a.widget});return p&&l({key:t,apiId:n,path:e,model:i,content:{...a,widget:p}})}},t.migrateSimpleSlice=function(e,t){var n;let[,i]=t.key.split("$"),o=`${e.sliceName}$${i}`;return"GroupContentType"===t.widget.__TYPE__?{key:o,name:e.sliceName,maybeLabel:t.maybeLabel,widget:{__TYPE__:"SharedSliceContent",variation:e.variationId,primary:{},items:t.widget.value.map(t=>({__TYPE__:"GroupItemContent",value:t.value.reduce((t,[n,i])=>{var o;return(null===(o=e.fields.items)||void 0===o?void 0:o[n])?t.concat([[n,i]]):t},[])}),[])}}:{key:o,name:e.sliceName,maybeLabel:t.maybeLabel,widget:{__TYPE__:"SharedSliceContent",variation:e.variationId,primary:(null===(n=e.fields.primary)||void 0===n?void 0:n[t.name])?{[t.name]:t.widget}:{},items:[]}}}},95305:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isSlicePrimaryContent=t.SlicePrimaryLegacy=t.SlicePrimaryContent=void 0;let i=(0,n(22970).__importStar)(n(32521)),o=n(88866),a=n(35792),r=n(69732);t.SlicePrimaryContent=i.union([r.NestableContent,a.GroupContent]),t.SlicePrimaryLegacy=e=>{let t=(0,a.GroupLegacy)(e),n=(0,r.NestableLegacy)(e);return{decode:i=>e.fieldType===o.GroupFieldType?t.decode(i):n.decode(i),encode:e=>(0,a.isGroupContent)(e)?t.encode(e):n.encode(e)}},t.isSlicePrimaryContent=e=>(0,r.isNestableContent)(e)||(0,a.isGroupContent)(e)},71771:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SliceContent=t.SliceLegacy=void 0;let i=n(22970),o=(0,i.__importStar)(n(32521)),a=n(77517),r=n(90848),l=n(56710);t.SliceLegacy=e=>({decode:t=>(()=>{switch(e.fieldType){case"Slice":return(0,a.CompositeSliceLegacy)(e);case"SharedSlice":return(0,r.SharedSliceLegacy)(e);default:return(0,l.SimpleSliceLegacy)(e)}})().decode(t),encode:t=>{switch(t.__TYPE__){case"SharedSliceContent":return(0,r.SharedSliceLegacy)(e).encode(t);case"CompositeSliceContent":return(0,a.CompositeSliceLegacy)(e).encode(t);default:return(0,l.SimpleSliceLegacy)(e).encode(t)}}}),t.SliceContent=o.union([a.CompositeSliceContent,r.SharedSliceContent,l.SimpleSliceContent]),(0,i.__exportStar)(n(77517),t),(0,i.__exportStar)(n(90848),t),(0,i.__exportStar)(n(56710),t),(0,i.__exportStar)(n(95305),t)},66219:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.migrateSliceItem=t.SlicesItemLegacy=t.sliceItemContentWithDefaultValues=t.isSimpleSliceItemContent=t.isCompositeSliceItemContent=t.isSharedSliceItemContent=t.SliceItemContent=void 0;let i=n(22970),o=n(76160),a=n(45974),r=n(30902),l=(0,i.__importStar)(n(32521)),c=n(61365),p=n(75122),d=n(35792),u=n(69732),s=n(29231),y=n(71771),_=n(77517),C=n(90848),T=n(56710);function m(e){return(0,_.isCompositeSliceContent)(e.widget)}function g(e){return(0,d.isGroupContent)(e.widget)||(0,u.isNestableContent)(e.widget)}t.SliceItemContent=l.type({key:l.string,name:l.string,maybeLabel:l.union([l.string,l.undefined]),widget:y.SliceContent}),t.isSharedSliceItemContent=function(e){return(0,C.isSharedSliceContent)(e.widget)},t.isCompositeSliceItemContent=m,t.isSimpleSliceItemContent=g,t.sliceItemContentWithDefaultValues=function(e,t){var n;if("SharedSlice"===e.type&&(0,C.isSharedSliceContent)(t))return(0,y.sharedSliceContentWithDefaultValues)(e,t);if("Slice"===e.type&&(0,_.isCompositeSliceContent)(t))return(0,y.compositeSliceContentWithDefaultValues)(e,t);if("Group"===e.type&&(0,d.isGroupContent)(t)&&(null===(n=e.config)||void 0===n?void 0:n.fields)){let n=(0,s.repeatableContentWithDefaultNestableContentValues)(e.config.fields,t.value);return{...t,value:n}}return t};let S=l.exact(l.intersection([l.type({key:l.string,value:l.unknown}),l.partial({label:(0,c.nullable)(l.string)})]));t.SlicesItemLegacy=e=>new l.Type("SlicesItemLegacy",e=>((0,C.isSharedSliceContent)(e.widget),(0,_.isCompositeSliceContent)(e.widget),(0,T.isSimpleSliceContent)(e.widget)),(t,n)=>(0,r.pipe)(S.decode(t),o.either.chain(i=>{var o;let r=i.key.indexOf("$"),c=i.key.substring(0,r>0?r:void 0),d=(0,p.getFieldCtx)(c,e),u=(0,y.SliceLegacy)(d).decode(i.value);return!u||(0,a.isLeft)(u)?l.failure(t,n):l.success({key:i.key,name:c,maybeLabel:null!==(o=i.label)&&void 0!==o?o:void 0,widget:u.right})})),t=>{let n=(0,p.getFieldCtx)(t.name,e),i=(0,y.SliceLegacy)(n).encode(t.widget);return{content:{key:t.key,label:t.maybeLabel,value:(null==i?void 0:i.content)||{}},types:(null==i?void 0:i.types)||{}}}),t.migrateSliceItem=({model:e,content:t})=>m(t)&&(null==e?void 0:e.type)==="SharedSlice"?(0,_.migrateCompositeSlice)(e,t):g(t)&&(null==e?void 0:e.type)==="SharedSlice"?(0,T.migrateSimpleSlice)(e,t):t},84186:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.traverseSlices=t.slicesContentWithDefaultValues=t.SlicesContent=t.SlicesLegacy=t.isSlicesContent=t.SlicesContentType=void 0;let i=n(22970),o=n(76160),a=n(30902),r=(0,i.__importStar)(n(32521)),l=n(50421),c=n(88866),p=n(3441),d=n(77517),u=n(90848),s=n(56710),y=n(66219);t.SlicesContentType="SliceContentType",t.isSlicesContent=e=>(0,p.hasContentType)(e)&&e.__TYPE__===t.SlicesContentType,t.SlicesLegacy=e=>{let n=r.array((0,y.SlicesItemLegacy)(e));return new r.Type("SlicesLegacy",t.isSlicesContent,e=>(0,a.pipe)(n.decode(e),o.either.map(e=>({__TYPE__:t.SlicesContentType,value:e}))),t=>{let i=n.encode(t.value);return{content:i.map(e=>e.content),types:i.reduce((e,t)=>({...e,...t.types}),{[e.keyOfType]:"Slices"})}})},t.SlicesContent=r.type({__TYPE__:r.literal(t.SlicesContentType),value:r.array(y.SliceItemContent)}),t.slicesContentWithDefaultValues=function(e,t){var n;let i=null===(n=null==e?void 0:e.config)||void 0===n?void 0:n.choices;if(void 0===i)return t;let o=t.value.map(e=>{let t=i[e.name];if(t){let n=(0,y.sliceItemContentWithDefaultValues)(t,e.widget);return{...e,widget:n}}return e});return{...t,value:o}},t.traverseSlices=function({path:e,key:t,model:n,content:i}){return({transformWidget:o=({content:e})=>e,transformSlice:a=({content:e})=>e})=>{let r=i.value.reduce((t,i)=>{let r=n&&function(e,t,n){var i,o;let a=null===(o=null===(i=null==t?void 0:t.config)||void 0===i?void 0:i.choices)||void 0===o?void 0:o[n.name];return(()=>{if((0,y.isSharedSliceItemContent)(n)&&a&&(0,c.isStaticSharedSlice)(a)){let e=a.variations.find(e=>e.id===n.widget.variation);return e?{type:"SharedSlice",sliceName:a.id,variationId:e.id,fields:{primary:e.primary||{},items:e.items||{}}}:void 0}})()||(()=>{var i;let o=l.ContentPath.append(l.ContentPath.serialize(e),n.name),a=Object.values((null===(i=null==t?void 0:t.config)||void 0===i?void 0:i.choices)||{}).find(e=>{var t;return!!(0,c.isStaticSharedSlice)(e)&&!!(null===(t=e.legacyPaths)||void 0===t?void 0:t[o])});if(!a)return;let r=null==a?void 0:a.variations.find(e=>{var t;return e.id===(null===(t=a.legacyPaths)||void 0===t?void 0:t[o])});if(r)return{type:"SharedSlice",sliceName:a.id,variationId:r.id,fields:{primary:r.primary||{},items:r.items||{}}}})()||(()=>{if(a){if((0,c.isCompositeSlice)(a))return{type:"Slice","non-repeat":a["non-repeat"]||{},repeat:a.repeat||{}};if((0,c.isLegacySlice)(a))return a}})()}(e,n,i),p=(0,y.isSharedSliceItemContent)(i)?(0,u.traverseSharedSliceContent)({path:e.concat({key:i.key,type:"SharedSlice"}),sliceKey:i.key,sliceName:i.name,model:(null==r?void 0:r.type)==="SharedSlice"?r:void 0,content:i})(o,a):(0,y.isCompositeSliceItemContent)(i)?(0,d.traverseCompositeSliceContent)({path:e.concat({key:i.key,type:"Slice"}),sliceKey:i.key,sliceName:i.name,model:(null==r?void 0:r.type)==="Slice"||(null==r?void 0:r.type)==="SharedSlice"?r:void 0,content:i})(o,a):(0,y.isSimpleSliceItemContent)(i)?(0,s.traverseSimpleSliceContent)({path:e.concat({key:i.key,type:"LegacySlice"}),sliceKey:i.key,sliceName:i.name,model:r&&(null==r?void 0:r.type)!=="Slice"?r:void 0,content:i})(o,a):void 0;return p?t.concat(p):t},[]);return o({path:e,key:t,apiId:t,model:n,content:{__TYPE__:i.__TYPE__,value:r}})}}},6869:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let i=n(22970);(0,i.__exportStar)(n(71771),t),(0,i.__exportStar)(n(66219),t),(0,i.__exportStar)(n(84186),t)},29231:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.repeatableContentWithDefaultNestableContentValues=t.withDefaultNestableContentValues=t.withDefaultSlicePrimaryContentValues=void 0;let i=n(88866),o=n(35792),a=n(69732);t.withDefaultSlicePrimaryContentValues=function(e,t){for(let[n,r]of Object.entries(e)){let e=t[n];if(void 0===e){if(r.type===i.GroupFieldType)t[n]=(0,o.groupContentWithDefaultValues)(r,o.GroupContentDefaultValue);else{let e=(0,a.NestableContentDefaultValue)(r);e&&(t[n]=e)}continue}r.type===i.GroupFieldType&&(0,o.isGroupContent)(e)&&(t[n]=(0,o.groupContentWithDefaultValues)(r,e))}return t},t.withDefaultNestableContentValues=function(e,t){return Object.entries(e).reduce((e,[n,i])=>{if(void 0===t[n]){let t=(0,a.NestableContentDefaultValue)(i);return void 0!==t?{...e,[n]:t}:e}return e},t)},t.repeatableContentWithDefaultNestableContentValues=function(e,t){let n=Object.entries(e);return t.map(e=>n.reduce((t,[n,i])=>{var r;let l=e.value.find(([e])=>e===n);if("Group"===i.type){let e=(0,o.groupContentWithDefaultValues)(i,null!==(r=null==l?void 0:l[1])&&void 0!==r?r:{__TYPE__:o.GroupContentType,value:[]});return{...t,value:[...t.value.filter(([e])=>e!==n),...e?[[n,e]]:[]]}}if(!l){let e=(0,a.NestableContentDefaultValue)(i);return{...t,value:[...t.value,...e?[[n,e]]:[]]}}return t},e))}},74686:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let i=n(22970);(0,i.__exportStar)(n(7217),t),(0,i.__exportStar)(n(82956),t),(0,i.__exportStar)(n(75122),t)},3441:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.withKey=t.hasContentType=t.hasFieldContentType=void 0;let i=n(22970),o=n(45974),a=(0,i.__importStar)(n(32521)),r=n(60130),l=n(82956);function c(e){return"object"==typeof e&&null!==e&&"__TYPE__"in e}t.hasFieldContentType=function(e){return c(e)&&e.__TYPE__===l.FieldContentType&&(null==e?void 0:e.type)!==void 0&&"string"==typeof e.type&&(0,o.isRight)(l.FieldType.decode(e.type))},t.hasContentType=c;let p=e=>"string"==typeof e&&(0,r.validate)(e),d=new a.Type("UUID",p,(e,t)=>void 0===e?a.success((0,r.v4)()):p(e)?a.success(e):a.failure(e,t),a.identity);t.withKey=function(e){return a.intersection([a.strict({key:d}),e])}},93662:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let i=n(22970),o=n(83296),a=n(3735),r=(0,i.__importStar)(n(32521));t.default=new r.Type("TrimmedString",r.string.is,(e,t)=>(0,a.pipe)(r.string.validate(e,t),(0,o.chain)(e=>r.success(function(e){let t=0;for(;t<e.length&&e[t]<=" ";)t++;let n=e.length;for(;t<n&&e[n-1]<=" ";)n--;return e.substring(t,n)}(e)))),e=>e)}}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[436],{26688:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/slices",function(){return n(31562)}])},34166:function(e,t,n){"use strict";n.d(t,{nZ:function(){return d},rT:function(){return u},tB:function(){return x}});var i=n(52322),l=n(11699),o=n(2784),s=n(30195),r=n(94160),a=n(76611),c=n(5683);function d(e){let{type:t,library:n,sliceId:i,variationId:l,langSmithUrl:o}=e,s=(0,c.iv)({type:t,library:n,sliceId:i,variationId:l}),r=JSON.stringify({langSmithUrl:o});localStorage.setItem(s,r)}function x(e){let{type:t,library:n,sliceId:i,variationId:l}=e,o=(0,c.iv)({type:t,library:n,sliceId:i,variationId:l});localStorage.removeItem(o)}function u(e){let{type:t,library:n,sliceId:d,variationId:x}=e,{key:u,value:m,done:h}=function(e){let{type:t,library:n,sliceId:i,variationId:l}=e,o=(0,c.iv)({type:t,library:n,sliceId:i,variationId:l}),[r,d]=(0,a.V)(o,void 0,{schema:s.z.object({langSmithUrl:s.z.string().url().optional()})});return{key:o,value:r,done:()=>d(void 0)}}({type:t,library:n,sliceId:d,variationId:x}),[p,f]=(0,o.useState)(),g=e=>()=>{m&&(f(u),r.Xe.track({event:"slice-generation-feedback",type:t,sliceId:d,variationId:x,feedback:e,langSmithUrl:m.langSmithUrl}),h())};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l.be,{children:(0,i.jsx)(l.bQ,{anchor:(0,i.jsx)(l.D,{width:"100%",justifyContent:"center",position:"absolute",bottom:64}),icon:"check",title:"Thanks for your feedback!",seconds:2,open:!!p,onOpenChange:e=>{e||f(void 0)}},p)}),(0,i.jsx)(l.i,{children:m&&(0,i.jsxs)(l.D,{flexDirection:"row",justifyContent:"end",gap:8,alignItems:"center",children:[(0,i.jsx)(l.bL,{color:"grey11",children:"Did the AI get it right?"}),(0,i.jsxs)(l.D,{flexDirection:"row",gap:4,children:[(0,i.jsx)(l.c3,{side:"bottom",sideOffset:4,variant:"text",content:"Looks good",children:(0,i.jsx)(l.aZ,{variant:"solid",size:"small",icon:"thumbUp",onClick:g("up")})}),(0,i.jsx)(l.c3,{side:"bottom",sideOffset:4,variant:"text",content:"Needs improvement",children:(0,i.jsx)(l.aZ,{variant:"solid",size:"small",icon:"thumbDown",onClick:g("down")})})]})]})})]})}},33986:function(e,t,n){"use strict";n.d(t,{z:function(){return a}});var i=n(52322),l=n(2784),o=n(75289);let s=(e,t)=>e?"".concat(e,"-").concat(t):"",r=e=>{switch(e){case"white":case"secondaryMedium":case"secondarySmall":case"secondary":return"#1A1523";default:return"grey01"}},a=(0,l.forwardRef)((e,t)=>{let{label:n,Icon:l,type:a,form:c,isLoading:d=!1,disabled:x=!1,onClick:u,sx:m={},iconSize:h=16,iconFill:p,variant:f="primary",...g}=e;return(0,i.jsx)(o.zx,{ref:t,sx:{...m,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",...d?{cursor:"wait !important"}:{}},type:a,form:c,disabled:x||d,onClick:d?void 0:u,variant:f,...g,children:d?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.$j,{size:h,color:r(f),"data-testid":s(g["data-testid"],"spinner")}),l&&n]}):(0,i.jsxs)(i.Fragment,{children:[l&&(0,i.jsx)(l,{size:h,fill:p,"data-testid":s(g["data-testid"],"icon")}),n]})})})},46999:function(e,t,n){"use strict";n.d(t,{W:function(){return s}});var i=n(52322),l=n(63397);n(2784);var o=n(75289);let s=e=>{let{name:t,label:n,placeholder:s,error:r,testId:a,onChange:c}=e;return(0,i.jsxs)(o.xu,{mb:3,children:[(0,i.jsx)(o.__,{htmlFor:t,mb:2,children:n}),(0,i.jsx)(l.gN,{name:t,type:"text",placeholder:s,as:o.II,autoComplete:"off",...c?{onChange:c}:null,...a?{"data-testid":a}:null}),r?(0,i.jsx)(o.xv,{"data-testid":a?"".concat(a,"-error"):"input-error",sx:{color:"error",mt:1},children:r}):null]})}},59532:function(e,t,n){"use strict";var i=n(52322),l=n(63397),o=n(37149),s=n.n(o),r=n(75289),a=n(33986),c=n(55862),d=n(30527);function x(e){let{children:t}=e,n=(0,d.W)();return(0,i.jsx)(r.kC,{sx:{position:"sticky",top:0,zIndex:1,p:"16px",pl:4,bg:"headSection",alignItems:"center",justifyContent:"space-between",borderTopLeftRadius:n,borderTopRightRadius:n,borderBottom:e=>{var t;return"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.borders)}},children:t})}t.Z=function(e){let{children:t,close:n,isOpen:o,formId:u,validate:m,onSubmit:h,widthInPx:p,initialValues:f,content:{title:g},cardProps:j,omitFooter:v=!1,isLoading:y=!1,buttonLabel:b="Save",testId:S,actionMessage:C}=e;return s().setAppElement("#__next"),(0,i.jsx)(c.Z,{isOpen:o,shouldCloseOnOverlayClick:!0,onRequestClose:n,contentLabel:g,style:{content:{width:null!=p?p:"900px"}},children:(0,i.jsx)(l.J9,{initialValues:f,validate:e=>m?m(e):void 0,onSubmit:e=>{h(e)},children:e=>{let{isValid:o,isSubmitting:s,values:c,errors:m,touched:h,setFieldValue:p,setValues:f}=e;return(0,i.jsx)(l.l0,{id:u,...null!=S?{"data-testid":S}:null,children:(0,i.jsx)(d.Z,{borderFooter:!0,footerSx:{p:3,position:"sticky",bottom:0,background:"gray"},bodySx:{px:4,py:4},sx:{border:"none"},...j,Header:(0,i.jsxs)(x,{children:[(0,i.jsx)(r.X6,{sx:{fontSize:"20px"},children:g}),(0,i.jsx)(r.x8,{type:"button",onClick:n})]}),Footer:v?null:(0,i.jsxs)(r.kC,{sx:{alignItems:"space-between"},children:[(0,i.jsx)(r.kC,{sx:{fontSize:"14px",alignItems:"center"},children:"function"==typeof C?C(e):C}),(0,i.jsxs)(r.kC,{sx:{ml:"auto"},children:[(0,i.jsx)(r.zx,{mr:2,type:"button",onClick:n,variant:"secondary",disabled:s||y,children:"Cancel"}),(0,i.jsx)(a.z,{label:b,form:u,type:"submit",disabled:!o||s||y,isLoading:s||y,sx:{fontWeight:"400",paddingBlock:"8px",paddingInline:"16px",fontSize:"14px",borderRadius:"4px"}})]})]}),children:t({isValid:o,isSubmitting:s,values:c,errors:m,touched:h,setFieldValue:p,setValues:f})})})}})})}},31562:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return M}});var i=n(52322),l=n(11699),o=n(97729),s=n.n(o),r=n(5632),a=n(2784),c=n(56580),d=n(88932),x=n(65077),u=n(75289),m=n(43388),h=n(91589),p=n(53403),f=n(27213),g=n(51507),j=n(27763),v=n(21442),y=n(58446),b=n(65186),S=n(59326),C=n(34166),k=n(80148);async function w(e){let{sliceName:t,sliceID:n,libraryID:i,sliceVariationIds:l,onSuccess:o}=e;try{let{errors:e}=await k.managerClient.slices.deleteSlice({libraryID:i,sliceID:n});if(e.length>0)throw e;l.forEach(e=>{(0,C.tB)({type:"model",library:i,sliceId:n,variationId:e})}),o(),d.Am.success("Successfully deleted slice “".concat(t,"”"))}catch(n){let e="An unexpected error happened while deleting slice “".concat(t,"”.");console.error(e,n),d.Am.error(e)}}var I=n(68968),z=n(33986),N=n(30527),D=n(55862),R=n(54597);let W=e=>{var t;let{isOpen:n,libName:l,sliceId:o,sliceName:s,sliceVariationIds:r,onClose:c}=e,[d,x]=(0,a.useState)(!1),{deleteSliceSuccess:m}=(0,R.Z)(),{syncChanges:h}=(0,I.g)(),{theme:p}=(0,S.B7)(),f=async()=>{x(!0),await w({libraryID:l,sliceID:o,sliceName:s,sliceVariationIds:r,onSuccess:()=>{m(o,l),h()}}),c(),x(!1)};return(0,i.jsx)(D.Z,{isOpen:n,shouldCloseOnOverlayClick:!0,style:{content:{maxWidth:612}},onRequestClose:c,children:(0,i.jsx)(N.Z,{bodySx:{p:0,bg:"white",position:"relative",height:"100%",padding:16},footerSx:{position:"sticky",bottom:0,p:0},sx:{border:"none"},borderFooter:!0,Header:(0,i.jsxs)(u.kC,{sx:{position:"sticky",background:"gray",top:0,zIndex:1,p:"16px",alignItems:"center",justifyContent:"space-between",borderBottom:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.borders))}},children:[(0,i.jsxs)(u.kC,{sx:{alignItems:"center"},children:[(0,i.jsx)(b.$vK,{size:20,color:null===(t=p.colors)||void 0===t?void 0:t.greyIcon}),(0,i.jsx)(u.X6,{sx:{fontSize:"14px",fontWeight:"bold",ml:1},children:"Delete Slice"})]}),(0,i.jsx)(u.x8,{type:"button",onClick:c})]}),Footer:()=>(0,i.jsxs)(u.kC,{sx:{justifyContent:"flex-end",height:64,alignItems:"center",paddingRight:16,borderTop:e=>{var t;return"1px solid ".concat(String(null===(t=e.colors)||void 0===t?void 0:t.darkBorders))},backgroundColor:"gray"},children:[(0,i.jsx)(z.z,{label:"Cancel",variant:"secondary",onClick:c,sx:{mr:"10px",fontWeight:"bold",color:"grey12",borderRadius:6}}),(0,i.jsx)(z.z,{label:"Delete",variant:"danger",isLoading:d,sx:{minHeight:39,minWidth:78},onClick:()=>{f()}})]}),children:(0,i.jsxs)(u.nv,{children:["This action will immediately make the following changes:",(0,i.jsxs)("ul",{children:[(0,i.jsxs)("li",{children:["Delete the"," ",(0,i.jsxs)(u.xv,{sx:{fontWeight:"bold"},children:[l,"/",s,"/"]})," ","directory."]}),(0,i.jsx)("li",{children:"Remove the Slice from all Slice Zones that use it."})]}),"The next time you push your changes to Prismic, the following change will happen:",(0,i.jsx)("ul",{children:(0,i.jsx)("li",{children:"Remove the Slice from the list of available Slices to use in the Page Builder."})}),"You will need to manually remove the Slice from any Pages that currently use it."]})})})};var F=n(36887),_=n(94160),Z=e=>{let{title:t,onCreateNew:n,buttonText:l,documentationComponent:o,videoPublicIdUrl:s,...r}=e;return(0,i.jsxs)(u.xu,{sx:{display:"flex",width:"80%",flexWrap:"wrap",justifyContent:"center"},...r,children:[(0,i.jsx)(u.xu,{sx:e=>{var t;return{display:"flex",flex:1,alignItems:"center",minWidth:"400px",maxWidth:"70%",border:"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.grey02)}},children:(0,i.jsx)(F.nk,{cloudName:"dmtf1daqp",controls:!0,loop:!0,style:{maxWidth:"100%",objectFit:"contain"},publicId:s,onPlay:()=>{_.Xe.track({event:"open-video-tutorials",video:s})}})}),(0,i.jsxs)(u.xu,{sx:e=>{var t;return{bg:"white",display:"flex",flexDirection:"column",border:"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.grey02),flex:1,minWidth:"400px",maxWidth:"70%"}},children:[(0,i.jsxs)(u.xu,{sx:e=>{var t;return{display:"flex",flexDirection:"column",p:4,borderBottom:"1px solid ".concat(null===(t=e.colors)||void 0===t?void 0:t.grey02)}},children:[(0,i.jsx)(u.X6,{as:"h3",variant:"heading",sx:{fontSize:"16px",lineHeight:"24px",mb:2},children:t}),(0,i.jsx)(u.xv,{variant:"xs",sx:{lineHeight:"24px",fontSize:"13px"},children:o})]}),(0,i.jsxs)(u.xu,{sx:{display:"flex",p:4,alignItems:"center"},children:[(0,i.jsx)(u.zx,{onClick:n,"data-testid":"empty-state-main-button",sx:{display:"flex",justifyContent:"center",alignItems:"center",flexShrink:0,mr:4},children:l}),(0,i.jsx)(u.xv,{sx:{fontSize:"12px",color:"grey04",maxWidth:"280px"},children:"It will be stored locally and you will be able to push it to your repository"})]})]})]})},O=n(6256),A=n(63908),B=n(26109);async function E(e){let{slice:t,newSliceName:n,onSuccess:i}=e;try{let e=(0,A.PQ)(t,n),{errors:l}=await k.managerClient.slices.renameSlice({libraryID:t.from,model:B.id.fromSM(e.model)});if(l.length>0)throw l;i(e),d.Am.success("Slice name updated")}catch(n){let e="An unexpected error happened while renaming “".concat(t.model.name,"”.");console.error(e,n),d.Am.error(e)}}var L=n(7723),P=n(59532),T=n(46999),X=n(63019);let H=e=>{var t,n;let{slice:l,isOpen:o,onClose:s}=e,{renameSliceSuccess:r}=(0,R.Z)(),{syncChanges:a}=(0,I.g)(),{localLibs:d,remoteLibs:x}=(0,c.v9)(e=>({localLibs:(0,L.Sd)(e),remoteLibs:(0,L.sT)(e)})),m=null!==(t=null==l?void 0:l.model.name)&&void 0!==t?t:"",h=async e=>{l&&(await E({slice:l,newSliceName:e.sliceName,onSuccess:e=>{r(e.from,e.model),a()}}),s())};return(0,i.jsx)(P.Z,{testId:"rename-slice-modal",isOpen:o,widthInPx:"530px",formId:"rename-slice-modal-".concat(null!==(n=null==l?void 0:l.model.id)&&void 0!==n?n:""),close:s,buttonLabel:"Rename",onSubmit:e=>void h(e),initialValues:{sliceName:m},content:{title:"Rename a slice"},validate:e=>(0,X.h)(e,d,x),children:e=>{let{touched:t,errors:n}=e;return(0,i.jsx)(u.xu,{children:(0,i.jsx)(T.W,{name:"sliceName",label:"Slice Name","data-testid":"slice-name-input",placeholder:"Pascalised Slice API ID (e.g. TextBlock)",error:t.sliceName?n.sliceName:void 0,testId:"slice-name-input"})})}})};var U=n(21151),V=n(68105),q=n(39204),G=n(7974),M=()=>{var e,t,n,o;let b=(0,r.useRouter)(),{modalPayload:S,onOpenModal:C}=(0,v.H)(),{openLoginModal:w}=(0,R.Z)(),I=(0,f.F)({menuType:"Dropdown"}),{sliceFilterFn:z,defaultVariationSelector:N}=S,{remoteSlices:D,libraries:F}=(0,c.v9)(e=>({remoteSlices:(0,L.sT)(e),libraries:(0,L.Sd)(e)})),[_,A]=(0,a.useState)(!1),[B,E]=(0,a.useState)(!1),[P,T]=(0,a.useState)(!1),[X,M]=(0,a.useState)(!1),[Q,Y]=(0,a.useState)(!1),J=F.filter(e=>e.isLocal),K=F.map(e=>(e.components=[...e.components].sort((e,t)=>e.model.name.localeCompare(t.model.name)),e)),$=(F||[]).map(e=>e.components).flat(),ee=$.length,[et,en]=(0,a.useState)(),ei=()=>{E(!0)},el=()=>{T(!0)},eo=async()=>{await k.managerClient.user.checkIsLoggedIn()?M(!0):w()},es=()=>{M(!1)};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(s(),{children:(0,i.jsx)("title",{children:"Slices - Slice Machine"})}),(0,i.jsxs)(y.LN,{children:[(0,i.jsxs)(y.wd,{children:[(0,i.jsx)(y.Cx,{children:(0,i.jsx)(m.g,{children:"Slices"})}),(null==J?void 0:J.length)!==0&&0!==ee?(0,i.jsxs)(l.ar,{children:[(0,i.jsx)(l.av,{children:(0,i.jsx)(l.E,{color:"purple",startIcon:"add","data-testid":"add-new-slice-dropdown",children:"Add"})}),(0,i.jsxs)(l.as,{align:"end",children:[(0,i.jsx)(l.at,{renderStartIcon:()=>I.fromImage.BackgroundIcon,onSelect:()=>void eo(),description:I.fromImage.description,children:I.fromImage.title}),(0,i.jsx)(l.at,{renderStartIcon:()=>I.fromScratch.BackgroundIcon,onSelect:()=>A(!0),description:I.fromScratch.description,children:I.fromScratch.title}),(0,i.jsx)(l.at,{renderStartIcon:()=>I.importFromExternal.BackgroundIcon,onSelect:()=>Y(!0),description:I.importFromExternal.description,children:I.importFromExternal.title})]})]}):void 0]}),(0,i.jsxs)(y.RN,{children:[(0,i.jsx)(x.xR,{sx:{display:"flex",flexDirection:"column"},children:K.length>0?(0,i.jsx)(u.kC,{sx:{flex:1,flexDirection:"column"},children:0===ee?(0,i.jsx)(u.kC,{sx:{flex:1,justifyContent:"center",alignItems:"center"},children:(0,i.jsx)(Z,{title:"What are slices?",onCreateNew:()=>{A(!0)},buttonText:"Create one",videoPublicIdUrl:G.rd,documentationComponent:(0,i.jsxs)(i.Fragment,{children:['Slices are sections of your website. Prismic documents contain a dynamic "Slice Zone" that allows content creators to add, edit, and rearrange slices to compose dynamic layouts for any page design.'," ",(0,i.jsx)(u.rU,{target:"_blank",href:"https://prismic.io/docs/core-concepts/slices",sx:e=>{var t;return{color:null==e?void 0:null===(t=e.colors)||void 0===t?void 0:t.primary}},children:"Learn more"}),"."]}),"data-testid":"slices-table-blank-slate"})}):K.map(e=>{let{name:t,isLocal:n,components:l}=e;return(0,i.jsxs)(u.kC,{sx:{flexDirection:"column","&:not(:last-of-type)":{mb:4}},children:[(0,i.jsxs)(u.kC,{sx:{alignItems:"center",justifyContent:"space-between"},children:[(0,i.jsx)(u.kC,{sx:{alignItems:"center",fontSize:3,lineHeight:"48px",fontWeight:"heading",mb:1},children:(0,i.jsx)(u.xv,{children:1===K.length?"Your slices":t})}),!n&&(0,i.jsx)("p",{children:"⚠️ External libraries are read-only"})]}),(0,i.jsx)(U.Z,{elems:l,defineElementKey:e=>e.model.name,renderElem:e=>(0,i.jsx)(g.b,{action:{type:"menu",onRemove:()=>{en(e),ei()},onRename:()=>{en(e),el()}},mode:"navigation",onUpdateScreenshot:()=>{C({sliceFilterFn:t=>t.filter(t=>t.model.id===e.model.id)})},slice:e,variant:"solid"}),gridGap:"32px 16px"})]},t)})}):void 0}),(null==J?void 0:J.length)>0&&(0,i.jsx)(V.Z,{slices:z($),defaultVariationSelector:N}),(null==J?void 0:J.length)>0&&_&&(0,i.jsx)(O.c,{localLibraries:J,location:"slices",remoteSlices:D,onSuccess:(e,t)=>{let n=e.variations[0].id,i=j.Y.getBuilderPagePathname({libraryName:t,sliceName:e.name,variationId:n});b.push(i),d.Am.success((0,q.kQ)({path:"".concat(t,"/").concat(e.name,"/model.json")}))},onClose:()=>{A(!1)}}),(0,i.jsx)(H,{isOpen:P,slice:et,onClose:()=>{T(!1)},"data-testid":"rename-slice-modal"}),(0,i.jsx)(W,{isOpen:B,libName:null!==(e=null==et?void 0:et.from)&&void 0!==e?e:"",sliceId:null!==(t=null==et?void 0:et.model.id)&&void 0!==t?t:"",sliceName:null!==(n=null==et?void 0:et.model.name)&&void 0!==n?n:"",sliceVariationIds:(null!==(o=null==et?void 0:et.model.variations)&&void 0!==o?o:[]).map(e=>e.id),onClose:()=>{E(!1)}}),(0,i.jsx)(h.S,{open:X,location:"slices",onSuccess:e=>{let{library:t}=e;d.Am.success((0,i.jsx)(q.GX,{message:"Slice(s) added to slice zone and created at: ",path:t})),es()},onClose:es}),(0,i.jsx)(p.w,{open:Q,location:"slices",onSuccess:e=>{let{library:t}=e;d.Am.success((0,i.jsx)(q.GX,{message:"Slice(s) added to slice zone and created at: ",path:t})),Y(!1)},onClose:()=>Y(!1)})]})]})]})}}},function(e){e.O(0,[898,789,797,397,344,130,954,500,34,928,658,888,774,179],function(){return e(e.s=26688)}),_N_E=e.O()}]);
@@ -1,291 +0,0 @@
1
- import {
2
- Box,
3
- Button,
4
- Dialog,
5
- DialogActionButton,
6
- DialogActions,
7
- DialogCancelButton,
8
- DialogContent,
9
- DialogDescription,
10
- DialogHeader,
11
- ScrollArea,
12
- Text,
13
- TextInput,
14
- } from "@prismicio/editor-ui";
15
- import { SharedSlice } from "@prismicio/types-internal/lib/customtypes";
16
- import { useEffect, useRef, useState } from "react";
17
- import { toast } from "react-toastify";
18
-
19
- import { getState, telemetry } from "@/apiClient";
20
- import { useOnboarding } from "@/features/onboarding/useOnboarding";
21
- import { useAutoSync } from "@/features/sync/AutoSyncProvider";
22
- import useSliceMachineActions from "@/modules/useSliceMachineActions";
23
-
24
- import { getSubmitButtonLabel } from "../shared/getSubmitButtonLabel";
25
- import { useExistingSlices } from "../shared/useExistingSlices";
26
- import { useImportSlicesFromGithub } from "./hooks/useImportSlicesFromGithub";
27
- import { SliceCard } from "./SliceCard";
28
- import { NewSlice } from "./types";
29
- import { addSlices } from "./utils/addSlices";
30
- import { sliceWithoutConflicts } from "./utils/sliceWithoutConflicts";
31
-
32
- interface ImportSlicesFromLibraryModalProps {
33
- open: boolean;
34
- location: "custom_type" | "page_type" | "slices";
35
- onSuccess: (args: {
36
- slices: {
37
- model: SharedSlice;
38
- langSmithUrl?: string;
39
- }[];
40
- library: string;
41
- }) => void;
42
- onClose: () => void;
43
- }
44
-
45
- export function ImportSlicesFromLibraryModal(
46
- props: ImportSlicesFromLibraryModalProps,
47
- ) {
48
- const { open, location, onSuccess, onClose } = props;
49
-
50
- const [isCreatingSlices, setIsCreatingSlices] = useState(false);
51
- const [githubUrl, setGithubUrl] = useState("");
52
- const [selectedSliceIds, setSelectedSliceIds] = useState<Set<string>>(
53
- new Set(),
54
- );
55
-
56
- const { syncChanges } = useAutoSync();
57
- const { createSliceSuccess, updateSliceMockSuccess } =
58
- useSliceMachineActions();
59
- const { completeStep } = useOnboarding();
60
- const existingSlices = useExistingSlices({ open });
61
- const { isLoadingSlices, handleImportFromGithub, slices, resetSlices } =
62
- useImportSlicesFromGithub();
63
-
64
- useEffect(() => {
65
- if (slices.length === 0) return;
66
-
67
- // Set all slices as selected by default
68
- const allSliceIds = new Set<string>();
69
- for (const slice of slices) {
70
- allSliceIds.add(slice.model.id);
71
- }
72
- setSelectedSliceIds(allSliceIds);
73
- }, [slices]);
74
-
75
- /**
76
- * Keeps track of the current instance id.
77
- * When the modal is closed, the id is reset.
78
- */
79
- const id = useRef(crypto.randomUUID());
80
-
81
- const onOpenChange = (open: boolean) => {
82
- if (open || isCreatingSlices) return;
83
- onClose();
84
- id.current = crypto.randomUUID();
85
- setGithubUrl("");
86
- setSelectedSliceIds(new Set());
87
- resetSlices();
88
- };
89
-
90
- const onSubmit = () => {
91
- const newSlices = slices.reduce<NewSlice[]>((acc, slice) => {
92
- if (selectedSliceIds.has(slice.model.id)) {
93
- acc.push({
94
- image: slice.image,
95
- model: slice.model,
96
- files: slice.files,
97
- componentContents: slice.componentContents,
98
- mocks: slice.mocks,
99
- screenshots: slice.screenshots,
100
- });
101
- }
102
- return acc;
103
- }, []);
104
- if (!newSlices.length) {
105
- toast.error("Please select at least one slice to import");
106
- return;
107
- }
108
-
109
- // Ensure ids and names are conflict-free against existing and newly-added slices
110
- const conflictFreeSlices: NewSlice[] = [];
111
- for (const s of newSlices) {
112
- const adjustedModel = sliceWithoutConflicts({
113
- existingSlices: existingSlices.current,
114
- newSlices: conflictFreeSlices,
115
- slice: s.model,
116
- });
117
- conflictFreeSlices.push({ ...s, model: adjustedModel });
118
- }
119
-
120
- const currentId = id.current;
121
- setIsCreatingSlices(true);
122
- addSlices(conflictFreeSlices)
123
- .then(async ({ slices, library }) => {
124
- if (currentId !== id.current) return;
125
-
126
- // Wait a moment to ensure all file writes are complete
127
- await new Promise((resolve) => setTimeout(resolve, 100));
128
-
129
- const serverState = await getState();
130
-
131
- // Ensure mocks are included in the libraries data before updating store
132
- const librariesWithMocks = serverState.libraries.map((lib) => {
133
- if (lib.name !== library) return lib;
134
-
135
- return {
136
- ...lib,
137
- components: lib.components.map((component) => {
138
- // Find the corresponding slice from newSlices to get its mocks
139
- const importedSlice = conflictFreeSlices.find(
140
- (s) => s.model.id === component.model.id,
141
- );
142
-
143
- // If mocks are already in component, use them; otherwise use imported mocks
144
- const mocks =
145
- component.mocks && component.mocks.length > 0
146
- ? component.mocks
147
- : importedSlice?.mocks;
148
-
149
- return {
150
- ...component,
151
- mocks: mocks ?? component.mocks,
152
- };
153
- }),
154
- };
155
- });
156
-
157
- createSliceSuccess(librariesWithMocks);
158
-
159
- // Also update mocks individually to ensure they're in the store
160
- for (const slice of newSlices) {
161
- if (
162
- slice.mocks &&
163
- Array.isArray(slice.mocks) &&
164
- slice.mocks.length > 0
165
- ) {
166
- updateSliceMockSuccess({
167
- libraryID: library,
168
- sliceID: slice.model.id,
169
- mocks: slice.mocks,
170
- });
171
- }
172
- }
173
-
174
- syncChanges();
175
-
176
- onSuccess({ slices, library });
177
-
178
- setIsCreatingSlices(false);
179
- id.current = crypto.randomUUID();
180
- resetSlices();
181
-
182
- void completeStep("createSlice");
183
-
184
- for (const { model } of slices) {
185
- void telemetry.track({
186
- event: "slice:created",
187
- id: model.id,
188
- name: model.name,
189
- library,
190
- location,
191
- mode: "import",
192
- });
193
- }
194
- })
195
- .catch(() => {
196
- if (currentId !== id.current) return;
197
- setIsCreatingSlices(false);
198
- toast.error("An unexpected error happened while adding slices.");
199
- });
200
- };
201
-
202
- const selectedSlices = slices.filter((slice) =>
203
- selectedSliceIds.has(slice.model.id),
204
- );
205
-
206
- return (
207
- <Dialog open={open} onOpenChange={onOpenChange}>
208
- <DialogHeader title="Import slices from library" />
209
- <DialogContent gap={0}>
210
- <DialogDescription hidden>
211
- Import slices from a github repository
212
- </DialogDescription>
213
- {slices.length === 0 ? (
214
- <Box padding={16} height="100%" flexDirection="column" gap={16}>
215
- <Box flexDirection="column" gap={8}>
216
- <Box
217
- display="flex"
218
- flexDirection="column"
219
- gap={8}
220
- padding={16}
221
- border
222
- borderRadius={8}
223
- >
224
- <Text color="grey11">Import from GitHub</Text>
225
- <TextInput
226
- placeholder="https://github.com/username/repository"
227
- value={githubUrl}
228
- onValueChange={setGithubUrl}
229
- />
230
- <Button
231
- onClick={() => handleImportFromGithub(githubUrl)}
232
- disabled={!githubUrl.trim() || isLoadingSlices}
233
- loading={isLoadingSlices}
234
- color="purple"
235
- >
236
- {isLoadingSlices ? "Loading slices..." : "Import from GitHub"}
237
- </Button>
238
- </Box>
239
- </Box>
240
- </Box>
241
- ) : (
242
- <ScrollArea stableScrollbar={false}>
243
- <Box
244
- display="grid"
245
- gridTemplateColumns="1fr 1fr 1fr"
246
- gap={16}
247
- padding={16}
248
- >
249
- {slices.map((slice) => {
250
- return (
251
- <SliceCard
252
- model={slice.model}
253
- thumbnailUrl={slice.thumbnailUrl}
254
- key={slice.model.id}
255
- selected={selectedSliceIds.has(slice.model.id)}
256
- onSelectedChange={(selected) => {
257
- if (selected) {
258
- setSelectedSliceIds((prev) => {
259
- const next = new Set(prev);
260
- next.add(slice.model.id);
261
- return next;
262
- });
263
- } else {
264
- setSelectedSliceIds((prev) => {
265
- const next = new Set(prev);
266
- next.delete(slice.model.id);
267
- return next;
268
- });
269
- }
270
- }}
271
- />
272
- );
273
- })}
274
- </Box>
275
- </ScrollArea>
276
- )}
277
-
278
- <DialogActions>
279
- <DialogCancelButton disabled={isCreatingSlices} />
280
- <DialogActionButton
281
- disabled={selectedSlices.length === 0}
282
- loading={isCreatingSlices}
283
- onClick={onSubmit}
284
- >
285
- {getSubmitButtonLabel(location)} ({selectedSlices.length})
286
- </DialogActionButton>
287
- </DialogActions>
288
- </DialogContent>
289
- </Dialog>
290
- );
291
- }
@@ -1,48 +0,0 @@
1
- import { Checkbox } from "@prismicio/editor-ui";
2
- import { SharedSlice } from "@prismicio/types-internal/lib/customtypes";
3
-
4
- import { Card, CardFooter, CardMedia } from "@/components/Card";
5
-
6
- interface SliceCardProps {
7
- thumbnailUrl?: string;
8
- model: SharedSlice;
9
- selected: boolean;
10
- onSelectedChange: (selected: boolean) => void;
11
- }
12
-
13
- export function SliceCard(props: SliceCardProps) {
14
- const { thumbnailUrl, model, selected = true, onSelectedChange } = props;
15
-
16
- const handleClick = () => {
17
- onSelectedChange(!selected);
18
- };
19
-
20
- const cardContent = (
21
- <>
22
- {thumbnailUrl !== undefined && thumbnailUrl ? (
23
- <CardMedia src={thumbnailUrl} />
24
- ) : (
25
- <CardMedia component="div" />
26
- )}
27
- <CardFooter
28
- title={model.name}
29
- action={
30
- <div onClick={(event) => event.stopPropagation()}>
31
- <Checkbox checked={selected} onCheckedChange={onSelectedChange} />
32
- </div>
33
- }
34
- />
35
- </>
36
- );
37
-
38
- return (
39
- <Card
40
- interactive={true}
41
- onClick={handleClick}
42
- checked={selected}
43
- size="small"
44
- >
45
- {cardContent}
46
- </Card>
47
- );
48
- }
@@ -1,93 +0,0 @@
1
- import { useState } from "react";
2
- import { toast } from "react-toastify";
3
-
4
- import { SliceImport } from "../types";
5
- import {
6
- fetchSlicesFromLibraries,
7
- getDefaultBranch,
8
- getSliceLibraries,
9
- parseGithubUrl,
10
- } from "../utils/github";
11
-
12
- export function useImportSlicesFromGithub() {
13
- const [isLoadingSlices, setIsLoadingSlices] = useState(false);
14
- const [slices, setSlices] = useState<SliceImport[]>([]);
15
-
16
- const resetSlices = () => {
17
- setSlices([]);
18
- setIsLoadingSlices(false);
19
- };
20
-
21
- const handleImportFromGithub = (githubUrl: string) => {
22
- void (async () => {
23
- try {
24
- setIsLoadingSlices(true);
25
-
26
- const { owner, repo } = parseGithubUrl(githubUrl);
27
- if (!owner || !repo) {
28
- toast.error("Invalid GitHub URL format");
29
- setIsLoadingSlices(false);
30
- return;
31
- }
32
-
33
- const branch = await getDefaultBranch({ owner, repo });
34
-
35
- let libraries: string[] | undefined;
36
-
37
- try {
38
- libraries = await getSliceLibraries({ owner, repo, branch });
39
- } catch (error) {
40
- console.error("Failed to fetch slicemachine.config.json:", error);
41
- toast.error(
42
- `Failed to fetch slicemachine.config.json: ${
43
- error instanceof Error ? error.message : "Unknown error"
44
- }`,
45
- );
46
- setIsLoadingSlices(false);
47
- return;
48
- }
49
-
50
- if (libraries.length === 0) {
51
- console.warn("No libraries were found in the SM config.");
52
- setIsLoadingSlices(false);
53
- toast.error("No libraries were found in the SM config.");
54
- return;
55
- }
56
-
57
- const fetchedSlices = await fetchSlicesFromLibraries({
58
- owner,
59
- repo,
60
- branch,
61
- libraries,
62
- });
63
-
64
- if (fetchedSlices.length === 0) {
65
- toast.error("Error fetching slices from the repository");
66
- setIsLoadingSlices(false);
67
- return;
68
- }
69
-
70
- setSlices(fetchedSlices);
71
- setIsLoadingSlices(false);
72
- toast.success(
73
- `Found ${fetchedSlices.length} slice(s) from ${libraries.length} library/libraries`,
74
- );
75
- } catch (error) {
76
- console.error("Error importing from GitHub:", error);
77
- toast.error(
78
- `Error importing from GitHub: ${
79
- error instanceof Error ? error.message : "Unknown error"
80
- }`,
81
- );
82
- setIsLoadingSlices(false);
83
- }
84
- })();
85
- };
86
-
87
- return {
88
- isLoadingSlices,
89
- slices,
90
- resetSlices,
91
- handleImportFromGithub,
92
- };
93
- }
@@ -1 +0,0 @@
1
- export { ImportSlicesFromLibraryModal } from "./ImportSlicesFromLibraryModal";
@@ -1,28 +0,0 @@
1
- import { SharedSliceContent } from "@prismicio/types-internal/lib/content";
2
- import { SharedSlice } from "@prismicio/types-internal/lib/customtypes";
3
-
4
- export type SliceImport = {
5
- image: File;
6
- model: SharedSlice;
7
- thumbnailUrl?: string;
8
- files?: SliceFile[];
9
- componentContents?: string;
10
- mocks?: SharedSliceContent[];
11
- screenshots?: Record<string, File>;
12
- };
13
-
14
- export type SliceFile = {
15
- path: string;
16
- contents: string | ArrayBuffer;
17
- isBinary: boolean;
18
- };
19
-
20
- export type NewSlice = {
21
- image: File;
22
- model: SharedSlice;
23
- langSmithUrl?: string;
24
- files?: SliceFile[];
25
- componentContents?: string;
26
- mocks?: SharedSliceContent[];
27
- screenshots?: Record<string, File>;
28
- };